query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
CopySign sets z to x with the sign of y and returns z. It accepts NaN values.
func (z *Big) CopySign(x, y *Big) *Big { if debug { x.validate() y.validate() } // Pre-emptively capture signbit in case z == y. sign := y.form & signbit z.copyAbs(x) z.form |= sign return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Copysign(x, y float32) float32 {\n\treturn float32(math.Copysign(float64(x), float64(y)))\n}", "func Copysign(x, y float32) float32 {\n\tconst sign = 1 << 31\n\treturn math.Float32frombits(math.Float32bits(x)&^sign | math.Float32bits(y)&sign)\n}", "func (z *Big) Copy(x *Big) *Big {\n\tif debug {\n\t\tx.validate()\n\t}\n\tif z != x {\n\t\tsign := x.form & signbit\n\t\tz.copyAbs(x)\n\t\tz.form |= sign\n\t}\n\treturn z\n}", "func Copysign(out, a, b *NArray) *NArray {\n\n\tif out == nil {\n\t\tout = New(a.Shape...)\n\t}\n\tif !EqualShape(out, a, b) {\n\t\tpanic(\"narrays must have equal shape.\")\n\t}\n\n\tcsignSlice(out.Data, a.Data, b.Data)\n\n\treturn out\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func (z *Float) Copy(x *Float) *Float {}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func FloatSign(x *big.Float,) int", "func (x *Int) Sign() int {}", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func (p Point) Sign() (int64) {\n\tnum, _ :=strconv.Atoi(string(p.Val[len(p.Val)-1]))\n\ttempnum:= (int64(num)/128)\n\treturn tempnum\n}", "func (z *Float) Neg(x *Float) *Float {}", "func Sign(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Sign\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (z *Float64) Neg(y *Float64) *Float64 {\n\tz.l = -y.l\n\tz.r = -y.r\n\treturn z\n}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func (z *Big) copyAbs(x *Big) *Big {\n\tif z != x {\n\t\tz.precision = x.Precision()\n\t\tz.exp = x.exp\n\t\tz.compact = x.compact\n\t\tif x.IsFinite() && x.isInflated() {\n\t\t\tz.unscaled.Set(&x.unscaled)\n\t\t}\n\t}\n\tz.form = x.form & ^signbit\n\treturn z\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (z *Int) Neg(x *Int) *Int {}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func Sign(x *big.Int) int {\n\treturn x.Sign()\n}", "func signExtend(v uint64, bit int) uint64 {\n\tb := signBits[bit]\n\tif v&b.signBit != 0 {\n\t\treturn v | b.ones\n\t}\n\treturn v\n}", "func (s *Sword) sign(dst, payload []byte) {\n\n\ts.Lock()\n\tif s.dirty {\n\t\ts.hash.Reset()\n\t}\n\ts.dirty = true\n\ts.hash.Write(payload)\n\th := s.hash.Sum(nil)\n\ts.Unlock()\n\n\tbase64.RawURLEncoding.Encode(dst, h)\n}", "func (z *Big) SetNaN(signal bool) *Big {\n\tif signal {\n\t\tz.form = snan\n\t} else {\n\t\tz.form = qnan\n\t}\n\tz.compact = 0 // payload\n\treturn z\n}", "func (z *Int) Copy(x *Int) *Int {\n\tz[0], z[1], z[2], z[3] = x[0], x[1], x[2], x[3]\n\treturn z\n}", "func csignSlice(out, a, b []float64)", "func (i Int) Sign() int {\n\treturn i.i.Sign()\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func (g *Graph) Softsign(x Node) Node {\n\treturn g.NewOperator(fn.NewSoftsign(x), x)\n}", "func IntSign(x *big.Int,) int", "func (q *Quantity) Sign() int {\n\tif q.d.Dec != nil {\n\t\treturn q.d.Dec.Sign()\n\t}\n\treturn q.i.Sign()\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (c Currency) Sign() int {\n\tif c.m < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (v *Vector3) Copy(b *Vector3) {\n\tv.X = b.X\n\tv.Y = b.Y\n\tv.Z = b.Z\n}", "func (v *Vec3i) SetNegate() {\n\tv.X = -v.X\n\tv.Y = -v.Y\n\tv.Z = -v.Z\n}", "func SignBit(out1 *uint1, arg1 *[3]uint64) {\n\tx1 := uint1((arg1[2] >> 63))\n\t*out1 = x1\n}", "func (x *Big) Sign() int {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif (x.IsFinite() && x.isZero()) || x.IsNaN(0) {\n\t\treturn 0\n\t}\n\tif x.form&signbit != 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (c *curve) coordSign(i *mod.Int) uint {\n\treturn i.V.Bit(0)\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func SignExtend(x *big.Int, n uint) *big.Int {\n\tsignBit := n - 1\n\t// single bit set at sign bit position\n\tmask := new(big.Int).Lsh(big1, signBit)\n\t// all bits below sign bit set to 1 all above (including sign bit) set to 0\n\tmask.Sub(mask, big1)\n\tif x.Bit(int(signBit)) == 1 {\n\t\t// Number represented is negative - set all bits above sign bit (including sign bit)\n\t\treturn x.Or(x, mask.Not(mask))\n\t} else {\n\t\t// Number represented is positive - clear all bits above sign bit (including sign bit)\n\t\treturn x.And(x, mask)\n\t}\n}", "func (kh *KeyHandler) Sign(buf []byte) ([]byte, cop.Error) {\n\treturn make([]byte, 0), nil\n}", "func Neg(z, x *big.Int) *big.Int {\n\treturn z.Neg(x)\n}", "func Vec3Neg(a Vec3) (v Vec3) {\n\tv[0] = -a[0]\n\tv[1] = -a[1]\n\tv[2] = -a[2]\n\treturn\n}", "func (x *Float) Signbit() bool {}", "func (x *Rat) Sign() int {}", "func (v *Value) Copy() *Value {\n\tcVal := C.zj_Copy(v.V)\n\tif cVal == nil {\n\t\treturn nil\n\t}\n\tval := Value{V: cVal}\n\treturn &val\n}", "func (kp *FromAddress) Sign(input []byte) ([]byte, error) {\n\treturn nil, ErrCannotSign\n}", "func Sign(a int) int {\n\treturn neogointernal.Opcode1(\"SIGN\", a).(int)\n}", "func (m *Money) Sign() int {\n\tif m.M < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (adr *Address) Sign(tr *tx.Transaction) error {\n\treturn tr.Sign(adr.Address)\n}", "func (z *Big) setNaN(c Condition, f form, p Payload) *Big {\n\tz.form = f\n\tz.compact = uint64(p)\n\tz.Context.Conditions |= c\n\tif z.Context.OperatingMode == Go {\n\t\tpanic(ErrNaN{Msg: z.Context.Conditions.String()})\n\t}\n\treturn z\n}", "func fiat_p384_cmovznz_u64(out1 *uint64, arg1 fiat_p384_uint1, arg2 uint64, arg3 uint64) {\n var x1 uint64 = (uint64(arg1) * 0xffffffffffffffff)\n var x2 uint64 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func PSIGNW(mx, x operand.Op) { ctx.PSIGNW(mx, x) }", "func (q *Qsign) Sign(v interface{}) ([]byte, error) {\n\tdigest, err := q.Digest(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := q.hasher()\n\th.Write(digest)\n\n\te := q.encoder()\n\tdst := make([]byte, e.EncodedLen(h.Size()))\n\te.Encode(dst, h.Sum(nil))\n\n\treturn dst, nil\n}", "func SignInt(v int) int {\n\tif v < 0 {\n\t\treturn -1\n\t}\n\tif v > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func PSIGND(mx, x operand.Op) { ctx.PSIGND(mx, x) }", "func fiat_p384_cmovznz_u32(out1 *uint32, arg1 uint32, arg2 uint32, arg3 uint32) {\n var x1 uint32 = (arg1 * 0xffffffff)\n var x2 uint32 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func SoliditySign(data []byte, privKey *ecdsa.PrivateKey) ([]byte, error) {\n\tsig, err := crypto.Sign(data, privKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv := sig[len(sig)-1]\n\tsig[len(sig)-1] = v + 27\n\treturn sig, nil\n}", "func (b *Block) sign() error {\n\tvar sigErr error\n\tsignBytes := b.signablePayload()\n\tsig, sigErr := cs.SignBlock(signBytes)\n\tif sigErr != nil {\n\t\treturn sigErr\n\t}\n\n\tb.Sig = fmt.Sprintf(\"%x\", sig)\n\n\treturn nil\n}", "func (_BondedECDSAKeep *BondedECDSAKeepTransactor) Sign(opts *bind.TransactOpts, _digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"sign\", _digest)\n}", "func (p *PointAffine) Neg(p1 *PointAffine) *PointAffine {\n\tp.Set(p1)\n\tp.X.Neg(&p.X)\n\treturn p\n}", "func (v Vec3i) Negate() Vec3i {\n\treturn Vec3i{-v.X, -v.Y, -v.Z}\n}", "func IntNeg(z *big.Int, x *big.Int,) *big.Int", "func (addr *Address) Sign(privKey *id.PrivKey) error {\n\tbuf := make([]byte, surge.SizeHintU8+surge.SizeHintString(addr.Value)+surge.SizeHintU64)\n\treturn addr.SignWithBuffer(privKey, buf)\n}", "func (z *BiComplex) Neg(y *BiComplex) *BiComplex {\n\tz.l.Neg(&y.l)\n\tz.r.Neg(&y.r)\n\treturn z\n}", "func (v Vec3) Negate() Vec3 {\n\treturn Vec3{-v.X, -v.Y, -v.Z}\n}", "func (z *Big) Neg(x *Big) *Big {\n\tif debug {\n\t\tx.validate()\n\t}\n\tif !z.invalidContext(z.Context) && !z.checkNaNs(x, x, negation) {\n\t\txform := x.form // copy in case z == x\n\t\tz.copyAbs(x)\n\t\tif !z.IsFinite() || z.compact != 0 || z.Context.RoundingMode == ToNegativeInf {\n\t\t\tz.form = xform ^ signbit\n\t\t}\n\t}\n\treturn z.Context.round(z)\n}", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func Selectznz(out1 *[3]uint64, arg1 uint1, arg2 *[3]uint64, arg3 *[3]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n}", "func SignExtend(x uint16, bitCount uint) uint16 {\n\tif ((x >> (bitCount - 1)) & 1) > 0 {\n\t\tx |= (0xFFFF << bitCount)\n\t}\n\treturn x\n}", "func Copy(x, y Vector) {\n\tif x.N != y.N {\n\t\tpanic(badLength)\n\t}\n\tcblas128.Zcopy(x.N, x.Data, x.Inc, y.Data, y.Inc)\n}", "func (z *Float) Abs(x *Float) *Float {}", "func (store *SessionCookieStore) sign(src []byte) []byte {\n\tsign := store.hash(src)\n\treturn append(sign, src...)\n}", "func (p *p256Point) CopyConditional(src *p256Point, v int) {\r\n\tpMask := uint64(v) - 1\r\n\tsrcMask := ^pMask\r\n\r\n\tfor i, n := range p.xyz {\r\n\t\tp.xyz[i] = (n & pMask) | (src.xyz[i] & srcMask)\r\n\t}\r\n}", "func Selectznz(out1 *[4]uint64, arg1 uint1, arg2 *[4]uint64, arg3 *[4]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tvar x4 uint64\n\tcmovznzU64(&x4, arg1, arg2[3], arg3[3])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n\tout1[3] = x4\n}", "func (i InvVect) Copy() payload.Safe {\n\thash := make([]byte, len(i.Hash))\n\tcopy(hash, i.Hash)\n\n\treturn &InvVect{\n\t\tType: i.Type,\n\t\tHash: hash,\n\t}\n}", "func (fn *formulaFuncs) SIGN(argsList *list.List) formulaArg {\n\tif argsList.Len() != 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"SIGN requires 1 numeric argument\")\n\t}\n\tval := argsList.Front().Value.(formulaArg).ToNumber()\n\tif val.Type == ArgError {\n\t\treturn val\n\t}\n\tif val.Number < 0 {\n\t\treturn newNumberFormulaArg(-1)\n\t}\n\tif val.Number > 0 {\n\t\treturn newNumberFormulaArg(1)\n\t}\n\treturn newNumberFormulaArg(0)\n}", "func (s Sample) Copy() *Sample {\n\txs := make([]float64, len(s.Xs))\n\tcopy(xs, s.Xs)\n\treturn &Sample{xs, s.Sorted}\n}", "func (f *Frac) normalizeSignage() {\n\t//Switch signs if n and d are both negative, or if d is negative but n is not (to always keep negative on top)\n\tif f.n < 0 && f.d < 0 || f.d < 0 {\n\t\tf.n *= -1\n\t\tf.d *= -1\n\t}\n}", "func (l *Loader) CopySym(src, dst Sym) {\n\tif !l.IsExternal(dst) {\n\t\tpanic(\"dst is not external\") //l.newExtSym(l.SymName(dst), l.SymVersion(dst))\n\t}\n\tif !l.IsExternal(src) {\n\t\tpanic(\"src is not external\") //l.cloneToExternal(src)\n\t}\n\tl.payloads[l.extIndex(dst)] = l.payloads[l.extIndex(src)]\n\tl.SetSymPkg(dst, l.SymPkg(src))\n\t// TODO: other attributes?\n}", "func (t *Transform) Copy() *Transform {\n\tt.access.RLock()\n\tcpy := &Transform{\n\t\tparent: t.parent,\n\t\tpos: t.pos,\n\t\trot: t.rot,\n\t\tscale: t.scale,\n\t\tshear: t.shear,\n\t}\n\tif t.built != nil {\n\t\tbuiltCpy := *t.built\n\t\tcpy.built = &builtCpy\n\t}\n\tif t.localToWorld != nil {\n\t\tltwCpy := *t.localToWorld\n\t\tcpy.localToWorld = &ltwCpy\n\t}\n\tif t.worldToLocal != nil {\n\t\twtlCpy := *t.worldToLocal\n\t\tcpy.worldToLocal = &wtlCpy\n\t}\n\tif t.quat != nil {\n\t\tquatCpy := *t.quat\n\t\tcpy.quat = &quatCpy\n\t}\n\tt.access.RUnlock()\n\treturn cpy\n}", "func (c *Conn) Sign(buf []byte) []byte {\n\tc.WriteToHash(buf)\n\tc.WriteToHash(c.chalUs)\n\tbuf = c.h.Sum(buf)\n\tc.h.Reset()\n\treturn buf\n}", "func sign() int {\n\ts := -1 + rand.Intn(2)\n\tif s == 0 {\n\t\ts++\n\t}\n\treturn s\n}", "func (z *Rat) Neg(x *Rat) *Rat {}", "func signed_shift(b Bitboard, amount int) Bitboard {\n\tif amount >= 0 {\n\t\treturn b << uint(amount)\n\t}\n\treturn b >> uint(-amount)\n}", "func (_Ethdkg *EthdkgCaller) Sign(opts *bind.CallOpts, message []byte, privK *big.Int) ([2]*big.Int, error) {\n\tvar (\n\t\tret0 = new([2]*big.Int)\n\t)\n\tout := ret0\n\terr := _Ethdkg.contract.Call(opts, out, \"Sign\", message, privK)\n\treturn *ret0, err\n}", "func (z *Int) Abs(x *Int) *Int {}", "func Sign(suite suites.Suite, x kyber.Scalar, msg []byte) ([]byte, error) {\n\tHM := hashToPoint(suite, msg)\n\txHM := HM.Mul(x, HM)\n\ts, err := xHM.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "func fiat_25519_cmovznz_u32(out1 *uint32, arg1 fiat_25519_uint1, arg2 uint32, arg3 uint32) {\n var x1 uint32 = (uint32(arg1) * 0xffffffff)\n var x2 uint32 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func (p *g1JacExtended) doubleNegMixed(q *G1Affine) *g1JacExtended {\n\n\tvar U, V, W, S, XX, M, S2, L fp.Element\n\n\tU.Double(&q.Y)\n\tU.Neg(&U)\n\tV.Square(&U)\n\tW.Mul(&U, &V)\n\tS.Mul(&q.X, &V)\n\tXX.Square(&q.X)\n\tM.Double(&XX).\n\t\tAdd(&M, &XX) // -> + a, but a=0 here\n\tS2.Double(&S)\n\tL.Mul(&W, &q.Y)\n\n\tp.X.Square(&M).\n\t\tSub(&p.X, &S2)\n\tp.Y.Sub(&S, &p.X).\n\t\tMul(&p.Y, &M).\n\t\tAdd(&p.Y, &L)\n\tp.ZZ.Set(&V)\n\tp.ZZZ.Set(&W)\n\n\treturn p\n}", "func VMOVSHDUP_Z(mxyz, k, xyz operand.Op) { ctx.VMOVSHDUP_Z(mxyz, k, xyz) }", "func FloatSignbit(x *big.Float,) bool", "func VMOVSLDUP_Z(mxyz, k, xyz operand.Op) { ctx.VMOVSLDUP_Z(mxyz, k, xyz) }", "func fiat_p448_cmovznz_u64(out1 *uint64, arg1 fiat_p448_uint1, arg2 uint64, arg3 uint64) {\n var x1 uint64 = (uint64(arg1) * 0xffffffffffffffff)\n var x2 uint64 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func ZSTDCompress(dst, src []byte, compressionLevel int) ([]byte, error) {\n\treturn zstd.CompressLevel(dst, src, compressionLevel)\n}" ]
[ "0.77722967", "0.7512018", "0.5993056", "0.5640078", "0.54359055", "0.53883415", "0.53816557", "0.52782315", "0.52394253", "0.51437646", "0.5071439", "0.5047325", "0.5036318", "0.5000603", "0.49959162", "0.49682966", "0.49158344", "0.4904136", "0.48851633", "0.4869765", "0.47822294", "0.4780933", "0.47737095", "0.4770144", "0.47345617", "0.4732944", "0.47240978", "0.47223118", "0.46820736", "0.46733677", "0.46547693", "0.46547693", "0.4644909", "0.46224847", "0.4608057", "0.45756894", "0.45756894", "0.45705453", "0.45297122", "0.45289847", "0.4526914", "0.45230296", "0.45076442", "0.4500542", "0.4491044", "0.44756058", "0.4434946", "0.44220814", "0.43891367", "0.43633512", "0.43561402", "0.43505737", "0.43464264", "0.4339014", "0.43075123", "0.4302082", "0.4301165", "0.4293323", "0.42867047", "0.42734477", "0.4262236", "0.42612946", "0.4252964", "0.4237965", "0.4236607", "0.42248437", "0.42212492", "0.41983548", "0.4183085", "0.41809392", "0.4174419", "0.41708437", "0.41691083", "0.41689053", "0.41556942", "0.41545662", "0.414826", "0.41340396", "0.4133541", "0.41124502", "0.41107592", "0.41059566", "0.41047433", "0.41028833", "0.40989023", "0.40960592", "0.4095329", "0.40893403", "0.4079067", "0.40631956", "0.40586206", "0.40515208", "0.40490294", "0.4046079", "0.40456823", "0.4043043", "0.40411773", "0.40379444", "0.40368986", "0.4024359" ]
0.75588834
1
Float64 returns x as a float64 and a bool indicating whether x can fit into a float64 without truncation, overflow, or underflow. Special values are considered exact; however, special values that occur because the magnitude of x is too large to be represented as a float64 are not.
func (x *Big) Float64() (f float64, ok bool) { if debug { x.validate() } if !x.IsFinite() { switch x.form { case pinf, ninf: return math.Inf(int(x.form & signbit)), true case snan, qnan: return math.NaN(), true case ssnan, sqnan: return math.Copysign(math.NaN(), -1), true } } const ( maxPow10 = 22 // largest exact power of 10 maxMantissa = 1<<53 + 1 // largest exact mantissa ) switch xc := x.compact; { case !x.isCompact(): fallthrough //lint:ignore ST1015 convoluted, but on purpose default: f, _ = strconv.ParseFloat(x.String(), 64) ok = !math.IsInf(f, 0) && !math.IsNaN(f) case xc == 0: ok = true case x.IsInt(): if xc, ok := x.Int64(); ok { f = float64(xc) } else if xc, ok := x.Uint64(); ok { f = float64(xc) } ok = xc < maxMantissa || (xc&(xc-1)) == 0 case x.exp == 0: f = float64(xc) ok = xc < maxMantissa || (xc&(xc-1)) == 0 case x.exp > 0: f = float64(x.compact) * math.Pow10(x.exp) ok = x.compact < maxMantissa && x.exp < maxPow10 case x.exp < 0: f = float64(x.compact) / math.Pow10(-x.exp) ok = x.compact < maxMantissa && x.exp > -maxPow10 } if x.form&signbit != 0 { f = math.Copysign(f, -1) } return f, ok }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func isNaN64(f float64) bool { return f != f }", "func IsValidFloat64(val float64) bool {\n\tif math.IsNaN(val) {\n\t\treturn false\n\t}\n\tif math.IsInf(val, 0) {\n\t\treturn false\n\t}\n\treturn true\n}", "func CloseEnoughF64(a, b float64) bool { return ToleranceF64(a, b, 1e-8) }", "func VeryCloseF64(a, b float64) bool { return ToleranceF64(a, b, 4e-16) }", "func IsFloat64(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Float64\n}", "func FloatIsInf(x *big.Float,) bool", "func Float64Val(x Value) (float64, bool) {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Float64Val(x)\n}", "func CloseF64(a, b float64) bool { return ToleranceF64(a, b, 1e-14) }", "func (x *Rat) Float64() (f float64, exact bool) {}", "func NewFromFloat64(x float64) (f Float, exact bool) {\n\tintRep := math.Float64bits(x)\n\tsign := intRep&0x8000000000000000 != 0\n\texp := intRep & 0x7FF0000000000000 >> 52\n\tmant := intRep & 0xFFFFFFFFFFFFF\n\tleftMant := mant & 0xFFFFFFFFFFFF0 >> 4\n\tvar a uint64\n\tb := mant & 0xF << 60\n\n\tswitch exp {\n\t// 0b11111111\n\tcase 0x7FF:\n\t\t// NaN or Inf\n\t\tif mant == 0 {\n\t\t\t// +-Inf\n\t\t\ta = 0x7FFF000000000000\n\t\t\tif sign {\n\t\t\t\ta = 0xFFFF000000000000\n\t\t\t}\n\t\t\treturn Float{a: a, b: b}, true\n\t\t}\n\t\t// +-NaN\n\n\t\ta = 0\n\t\tif sign {\n\t\t\ta = 0x8000000000000000\n\t\t}\n\t\ta = a | 0x7FFF000000000000\n\n\t\tnewMant := leftMant\n\t\ta |= newMant\n\n\t\treturn Float{a: a, b: b}, true\n\t\t// 0b00000000\n\tcase 0x0:\n\t\tif mant == 0 {\n\t\t\t// +-Zero\n\t\t\tvar a uint64\n\t\t\tif sign {\n\t\t\t\ta = 0x8000000000000000\n\t\t\t}\n\t\t\treturn Float{a: a, b: b}, true\n\t\t}\n\t}\n\n\tif sign {\n\t\ta = 0x8000000000000000\n\t}\n\n\tnewExp := (exp - 1023 + 16383) << 48\n\ta |= newExp\n\n\ta |= leftMant\n\n\treturn Float{a: a, b: b}, true\n}", "func equalFloat(x float64, y float64, limit float64) bool {\n\n\tif limit <= 0.0 {\n\t\tlimit = math.SmallestNonzeroFloat64\n\t}\n\n\treturn math.Abs(x-y) <= (limit * math.Min(math.Abs(x), math.Abs(y)))\n}", "func (num Number) Float64() (float64, bool) {\n\tf, err := json.Number(num).Float64()\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn f, true\n}", "func ToleranceF64(a, b, e float64) bool {\n\td := a - b\n\tif d < 0 {\n\t\td = -d\n\t}\n\n\t// note: b is correct (expected) value, a is actual value.\n\t// make error tolerance a fraction of b, not a.\n\tif b != 0 {\n\t\te = e * b\n\t\tif e < 0 {\n\t\t\te = -e\n\t\t}\n\t}\n\treturn d <= e\n}", "func equalFloat64(a, b float64) bool {\n\t// Compare up to 6 decimal digits\n\teps := 1e-6\n\n\t// Check if difference between numbers falls within band of width 2 x epsilon\n\treturn (a-b) < eps && (b-a) < eps\n}", "func (f Float) Float64() (float64, big.Accuracy) {\n\tx, nan := f.Big()\n\tif nan {\n\t\tif x.Signbit() {\n\t\t\treturn -math.NaN(), big.Exact\n\t\t}\n\t\treturn math.NaN(), big.Exact\n\t}\n\treturn x.Float64()\n}", "func (f Float) Float64() (float64, big.Accuracy) {\n\tx, nan := f.Big()\n\tif nan {\n\t\tif x.Signbit() {\n\t\t\treturn -math.NaN(), big.Exact\n\t\t}\n\t\treturn math.NaN(), big.Exact\n\t}\n\treturn x.Float64()\n}", "func (f Float) Float64() (float64, big.Accuracy) {\n\tx, nan := f.Big()\n\tif nan {\n\t\tif x.Signbit() {\n\t\t\treturn -math.NaN(), big.Exact\n\t\t}\n\t\treturn math.NaN(), big.Exact\n\t}\n\treturn x.Float64()\n}", "func VeryCloseF32(a, b float32) bool { return ToleranceF32(a, b, 1e-6) }", "func (a *Assertions) AllOfFloat64(target []float64, predicate PredicateOfFloat, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldAllOfFloat(target, predicate); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func (a *Assertions) AnyOfFloat64(target []float64, predicate PredicateOfFloat, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldAnyOfFloat(target, predicate); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func EqualFloat(x, y, limit float64) bool {\n\tif limit <= 0.0 {\n\t\tlimit = math.SmallestNonzeroFloat64\n\t}\n\treturn math.Abs(x - y) <= (limit * math.Min(math.Abs(x), math.Abs(y)))\n}", "func float64equals(x, y float64) bool {\n\treturn math.Abs(x-y) < EPSILON\n}", "func (d Decimal) Float64() (f float64, exact bool) {\n\treturn d.val.Float64()\n}", "func FloatSignbit(x *big.Float,) bool", "func (x *Float) Float64() (float64, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func (x *Big) IsFinite() bool { return x.form & ^signbit == 0 }", "func toFloat64(v interface{}) (float64, bool) {\n\tswitch value := v.(type) {\n\tcase int64:\n\t\treturn float64(value), true\n\tcase float64:\n\t\treturn value, true\n\tcase PositionPoint:\n\t\treturn toFloat64(value.Value)\n\t}\n\treturn 0, false\n}", "func IsFloat(val any) bool {\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tswitch rv := val.(type) {\n\tcase float32, float64:\n\t\treturn true\n\tcase string:\n\t\treturn rv != \"\" && rxFloat.MatchString(rv)\n\t}\n\treturn false\n}", "func IsFloat(t Type) bool {\n\treturn int(t)&flagIsFloat == flagIsFloat\n}", "func (d Decimal) Float64() (f float64, exact bool) {\n\treturn d.Rat().Float64()\n}", "func (d Decimal) Float64() (f float64, exact bool) {\n\treturn d.Rat().Float64()\n}", "func FloatIsInt(x *big.Float,) bool", "func isNaN32(f float32) bool { return f != f }", "func (d Definition) IsFloat() bool {\n\tif k, ok := d.Output.(reflect.Kind); ok {\n\t\tif k == reflect.Float32 || k == reflect.Float64 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func EqualFloat64(a, b, epsilon float64) bool {\n\tif a == b {\n\t\treturn true\n\t}\n\tabsA := math.Abs(a)\n\tabsB := math.Abs(b)\n\tdiff := math.Abs(a - b)\n\tif a == 0 || b == 0 || diff < minNormal {\n\t\t// a or b is zero or both are extremely close to it\n\t\t// relative error is less meaningful here\n\t\treturn diff < (epsilon * minNormal)\n\t}\n\t// use relative error\n\treturn diff/math.Min((absA+absB), math.MaxFloat64) < epsilon\n}", "func IsFloat(data interface{}) bool {\n\treturn typeIs(data,\n\t\treflect.Float32,\n\t\treflect.Float64,\n\t)\n}", "func Float64sChk(cmp Cmp, s []float64, t ...float64) bool {\n\tdata := sort.Float64Slice(append(s, t...))\n\treturn cmp(data, len(s))\n}", "func softfloat_eq128(a64, a0, b64, b0 uint64) bool {\n\treturn (a64 == b64) && (a0 == b0)\n}", "func atof64exact(mantissa uint64, exp int, neg bool) (f float64, ok bool) {\n\tif mantissa>>float64info.mantbits != 0 {\n\t\treturn\n\t}\n\tf = float64(mantissa)\n\tif neg {\n\t\tf = -f\n\t}\n\tswitch {\n\tcase exp == 0:\n\t\t// an integer.\n\t\treturn f, true\n\t// Exact integers are <= 10^15.\n\t// Exact powers of ten are <= 10^22.\n\tcase exp > 0 && exp <= 15+22: // int * 10^k\n\t\t// If exponent is big but number of digits is not,\n\t\t// can move a few zeros into the integer part.\n\t\tif exp > 22 {\n\t\t\tf *= float64pow10[exp-22]\n\t\t\texp = 22\n\t\t}\n\t\tif f > 1e15 || f < -1e15 {\n\t\t\t// the exponent was really too large.\n\t\t\treturn\n\t\t}\n\t\treturn f * float64pow10[exp], true\n\tcase exp < 0 && exp >= -22: // int / 10^k\n\t\treturn f / float64pow10[-exp], true\n\t}\n\treturn\n}", "func atof64exact(mantissa uint64, exp int, neg bool) (f float64, ok bool) {\n\tif mantissa>>float64info.mantbits != 0 {\n\t\treturn\n\t}\n\tf = float64(mantissa)\n\tif neg {\n\t\tf = -f\n\t}\n\tswitch {\n\tcase exp == 0:\n\t\t// an integer.\n\t\treturn f, true\n\t// Exact integers are <= 10^15.\n\t// Exact powers of ten are <= 10^22.\n\tcase exp > 0 && exp <= 15+22: // int * 10^k\n\t\t// If exponent is big but number of digits is not,\n\t\t// can move a few zeros into the integer part.\n\t\tif exp > 22 {\n\t\t\tf *= float64pow10[exp-22]\n\t\t\texp = 22\n\t\t}\n\t\tif f > 1e15 || f < -1e15 {\n\t\t\t// the exponent was really too large.\n\t\t\treturn\n\t\t}\n\t\treturn f * float64pow10[exp], true\n\tcase exp < 0 && exp >= -22: // int / 10^k\n\t\treturn f / float64pow10[-exp], true\n\t}\n\treturn\n}", "func boolFloat64(b bool) float64 {\n\tif !b {\n\t\treturn 0.0\n\t}\n\n\treturn 1.0\n}", "func IsFloat(id int) bool {\n\treturn id >= IDFloat16 && id <= IDFloat64\n}", "func FloatValue(v Value) (float64, bool) {\n\tif v.Type() != FloatType {\n\t\treturn 0, false\n\t}\n\tval, ok := (v.Value()).(float64)\n\treturn val, ok\n}", "func AlikeF64(a, b float64) bool {\n\tswitch {\n\tcase math.IsNaN(a) && math.IsNaN(b):\n\t\treturn true\n\tcase a == b:\n\t\treturn math.Signbit(a) == math.Signbit(b)\n\t}\n\treturn false\n}", "func (x *Float) IsInf() bool {}", "func Float64Equal(a, b float64) bool {\n\treturn floatEqual(a, b, epsilon4Float64)\n}", "func EqualFloat64(actual, expected, delta float64, typ int) (status bool) {\n\tswitch {\n\tcase math.IsNaN(actual) || math.IsNaN(expected):\n\t\tstatus = math.IsNaN(actual) == math.IsNaN(expected)\n\t\tbreak\n\tcase math.IsInf(actual, 0) || math.IsInf(expected, 0):\n\t\tstatus = math.IsInf(actual, 0) == math.IsInf(expected, 0)\n\t\tbreak\n\tcase expected == 0:\n\t\tstatus = math.Abs(actual-expected) < math.Abs(delta)\n\t\tbreak\n\tcase expected != 0:\n\t\tif typ == 0 {\n\t\t\tstatus = math.Abs(actual-expected) < math.Abs(delta)\n\t\t} else {\n\t\t\tstatus = math.Abs(actual-expected)/math.Abs(expected) < math.Abs(delta)\n\t\t}\n\t}\n\treturn\n}", "func softfloat_le128(a64, a0, b64, b0 uint64) bool {\n\treturn (a64 < b64) || ((a64 == b64) && (a0 <= b0))\n}", "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func isFloatEqual(a, b float64) bool {\n\tEPILOPS := 0.000001\n\n\tif (a-b) > EPILOPS || (b-a) > EPILOPS {\n\t\treturn false\n\t}\n\n\treturn true\n\n}", "func Float64(v interface{}) (float64, error) {\n\tswitch v := v.(type) {\n\tdefault:\n\t\treturn 0, ErrWrongType\n\tcase int:\n\t\tif int(float64(v)) != v {\n\t\t\tif warnOnImpreciseConversion {\n\t\t\t\tlog.Warn(ErrImpreciseConversion)\n\t\t\t}\n\t\t\tif !allowImpreciseConversion {\n\t\t\t\treturn float64(v), ErrImpreciseConversion\n\t\t\t}\n\t\t}\n\t\treturn float64(v), nil\n\n\tcase uint:\n\t\tif uint(float64(v)) != v {\n\t\t\tif warnOnImpreciseConversion {\n\t\t\t\tlog.Warn(ErrImpreciseConversion)\n\t\t\t}\n\t\t\tif !allowImpreciseConversion {\n\t\t\t\treturn float64(v), ErrImpreciseConversion\n\t\t\t}\n\t\t}\n\t\treturn float64(v), nil\n\n\tcase uint64:\n\t\tif uint64(float64(v)) != v {\n\t\t\tif warnOnImpreciseConversion {\n\t\t\t\tlog.Warn(ErrImpreciseConversion)\n\t\t\t}\n\t\t\tif !allowImpreciseConversion {\n\t\t\t\treturn float64(v), ErrImpreciseConversion\n\t\t\t}\n\t\t}\n\t\treturn float64(v), nil\n\n\tcase int64:\n\t\tif int64(float64(v)) != v {\n\t\t\tif warnOnImpreciseConversion {\n\t\t\t\tlog.Warn(ErrImpreciseConversion)\n\t\t\t}\n\t\t\tif !allowImpreciseConversion {\n\t\t\t\treturn float64(v), ErrImpreciseConversion\n\t\t\t}\n\t\t}\n\t\treturn float64(v), nil\n\n\tcase int8:\n\t\treturn float64(v), nil\n\tcase int16:\n\t\treturn float64(v), nil\n\tcase int32:\n\t\treturn float64(v), nil\n\tcase uint8:\n\t\treturn float64(v), nil\n\tcase uint16:\n\t\treturn float64(v), nil\n\tcase uint32:\n\t\treturn float64(v), nil\n\tcase float32:\n\t\treturn float64(v), nil\n\tcase float64:\n\t\treturn v, nil\n\t}\n}", "func Float(a float64, b float64) bool {\n\treturn a == b\n}", "func (v Value) IsFloat() bool {\n\treturn IsFloat(v.typ)\n}", "func (mysql *MySQLDatabase) IsFloat(column Column) bool {\n\treturn IsStringInSlice(column.DataType, mysql.GetFloatDatatypes())\n}", "func parseFloat64(s string) (float64, bool) {\n\tf, err := strconv.ParseFloat(strings.TrimSpace(s), 64)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn f, true\n}", "func TestCheckBinaryExprFloatLssFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 < 2.0`, env, (2.0 < 2.0), ConstBool)\n}", "func isInt64(v *big.Float) bool {\n\tbigInt, accuracy := v.Int(nil)\n\tif accuracy != big.Exact {\n\t\treturn false\n\t}\n\n\treturn bigInt.IsInt64()\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func floatEqual(a, b float64) bool {\n\treturn (a-b) < epsilon && (b-a) < epsilon\n}", "func (node *GoValueNode) IsReal() bool {\n\tkind := pkg.GetBaseKind(node.thisValue)\n\n\treturn kind == reflect.Float64\n}", "func (v *Variant) IsFloating() bool {\n\treturn gobool(C.g_variant_is_floating(v.native()))\n}", "func TestCheckBinaryExprFloatGeqBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 >= true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 >= true (mismatched types float64 and bool)`,\n\t)\n\n}", "func AnyFloat64(f func(float64, int) bool, input []float64) (output bool) {\n\toutput = false\n\tfor idx, data := range input {\n\t\toutput = output || f(data, idx)\n\t\tif output {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func (f Float) Float64() float64 {\n\tpanic(\"not yet implemented\")\n}", "func (f F128d16) Float64() (float64, error) {\n\tn := f.AsFloat64()\n\tif strconv.FormatFloat(n, 'g', -1, 64) != f.String() {\n\t\treturn 0, errDoesNotFitInFloat64\n\t}\n\treturn n, nil\n}", "func TestCheckBinaryExprFloatGtrFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 > 2.0`, env, (2.0 > 2.0), ConstBool)\n}", "func ConvertToFloat64(value interface{}) (float64, bool) {\n\tswitch v := value.(type) {\n\tcase int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64:\n\t\tnum := reflect.ValueOf(value).Convert(reflect.TypeOf(float64(0))).Float()\n\t\treturn num, !math.IsInf(num, 0) && !math.IsNaN(num)\n\tcase string:\n\t\tnum, err := strconv.ParseFloat(v, 64)\n\t\tif err == nil {\n\t\t\treturn num, true\n\t\t}\n\t}\n\treturn float64(0), false\n}", "func ToFloat(val interface{}) (float64, bool) {\n\tswitch t := val.(type) {\n\n\tcase float64:\n\t\treturn t, true\n\n\tcase variable:\n\t\tv, ok := t.value.(float64)\n\t\tif !ok {\n\t\t\treturn 0, false\n\t\t}\n\t\treturn v, true\n\n\tdefault:\n\t\treturn 0, false\n\t}\n}", "func Float64(a, b interface{}) int {\n\tf1, _ := a.(float64)\n\tf2, _ := b.(float64)\n\tswitch {\n\tcase f1 < f2:\n\t\treturn -1\n\tcase f1 > f2:\n\t\treturn 1\n\tdefault:\n\t\treturn 0\n\t}\n}", "func (v *Value) Float64() float64 {\n\tswitch {\n\tcase v.fvalOk:\n\tcase v.ivalOk:\n\t\tv.fval = float64(v.ival)\n\t\tv.fvalOk = true\n\tcase v.svalOk:\n\t\t// Perform a best-effort conversion from string to float64.\n\t\tv.fval = 0.0\n\t\tstrs := matchFloat.FindStringSubmatch(v.sval)\n\t\tif len(strs) >= 2 {\n\t\t\tv.fval, _ = strconv.ParseFloat(strs[1], 64)\n\t\t}\n\t\tv.fvalOk = true\n\t}\n\treturn v.fval\n}", "func Float64(val interface{}) float64 {\r\n\r\n\tswitch t := val.(type) {\r\n\tcase int:\r\n\t\treturn float64(t)\r\n\tcase int8:\r\n\t\treturn float64(t)\r\n\tcase int16:\r\n\t\treturn float64(t)\r\n\tcase int32:\r\n\t\treturn float64(t)\r\n\tcase int64:\r\n\t\treturn float64(t)\r\n\tcase uint:\r\n\t\treturn float64(t)\r\n\tcase uint8:\r\n\t\treturn float64(t)\r\n\tcase uint16:\r\n\t\treturn float64(t)\r\n\tcase uint32:\r\n\t\treturn float64(t)\r\n\tcase uint64:\r\n\t\treturn float64(t)\r\n\tcase float32:\r\n\t\treturn float64(t)\r\n\tcase float64:\r\n\t\treturn float64(t)\r\n\tcase bool:\r\n\t\tif t == true {\r\n\t\t\treturn float64(1)\r\n\t\t}\r\n\t\treturn float64(0)\r\n\tcase string:\r\n\t\tf, _ := strconv.ParseFloat(val.(string), 64)\r\n\t\treturn f\r\n\tdefault:\r\n\t\ts := String(val)\r\n\t\tf, _ := strconv.ParseFloat(s, 64)\r\n\t\treturn f\r\n\t}\r\n\r\n\tpanic(\"Reached\")\r\n}", "func TestCheckBinaryExprFloatLeqBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 <= true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 <= true (mismatched types float64 and bool)`,\n\t)\n\n}", "func CloseF32(a, b float32) bool { return ToleranceF32(a, b, 1e-5) }", "func TestCheckBinaryExprFloatLeqFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 <= 2.0`, env, (2.0 <= 2.0), ConstBool)\n}", "func Float64(list []float64, element float64) (int, bool) {\n\tleft := 0\n\tright := len(list) - 1\n\tfor left <= right {\n\t\tmiddle := (left + right) / 2\n\t\tvalue := list[middle]\n\t\tif element > value {\n\t\t\tleft = middle + 1\n\t\t} else if element < value {\n\t\t\tright = middle - 1\n\t\t} else {\n\t\t\treturn middle, true\n\t\t}\n\t}\n\treturn left, false\n}", "func TestCheckBinaryExprFloatGtrBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 > true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 > true (mismatched types float64 and bool)`,\n\t)\n\n}", "func TestCheckBinaryExprFloatGeqFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 >= 2.0`, env, (2.0 >= 2.0), ConstBool)\n}", "func floatEquals(a, b float64) bool {\n\tvar epsilon float64 = 0.000000001\n\tif (a-b) < epsilon && (b-a) < epsilon {\n\t\treturn true\n\t}\n\treturn false\n}", "func TestCheckBinaryExprFloatEqlFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 == 2.0`, env, (2.0 == 2.0), ConstBool)\n}", "func InSliceFloat64(x float64, a []float64) bool {\n\tl := len(a)\n\n\tif l == 0 {\n\t\treturn false\n\t}\n\n\tsort.Float64s(a)\n\n\ti := sort.SearchFloat64s(a, x)\n\n\tif i < l && a[i] == x {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func TestFloatsMatch(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tfor _, tc := range []struct {\n\t\tf1, f2 string\n\t\tmatch bool\n\t}{\n\t\t{f1: \"NaN\", f2: \"+Inf\", match: false},\n\t\t{f1: \"+Inf\", f2: \"+Inf\", match: true},\n\t\t{f1: \"NaN\", f2: \"NaN\", match: true},\n\t\t{f1: \"+Inf\", f2: \"-Inf\", match: false},\n\t\t{f1: \"-0.0\", f2: \"0.0\", match: true},\n\t\t{f1: \"0.0\", f2: \"NaN\", match: false},\n\t\t{f1: \"123.45\", f2: \"12.345\", match: false},\n\t\t{f1: \"0.1234567890123456\", f2: \"0.1234567890123455\", match: true},\n\t\t{f1: \"0.1234567890123456\", f2: \"0.1234567890123457\", match: true},\n\t\t{f1: \"-0.1234567890123456\", f2: \"0.1234567890123456\", match: false},\n\t\t{f1: \"-0.1234567890123456\", f2: \"-0.1234567890123455\", match: true},\n\t} {\n\t\tmatch, err := floatsMatch(tc.f1, tc.f2)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif match != tc.match {\n\t\t\tt.Fatalf(\"wrong result on %v\", tc)\n\t\t}\n\t}\n}", "func TestCheckBinaryExprFloatLssBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 < true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 < true (mismatched types float64 and bool)`,\n\t)\n\n}", "func IsFloat(str string) bool {\n\treturn str != \"\" && rxFloat.MatchString(str)\n}", "func EqualFloat64(a, b, precision float64) bool {\n\treturn math.Abs(a-b) < precision\n}", "func TestRoundTripFloat(t *testing.T) {\n\tf := func(flt float64) bool {\n\t\tflt = math.Abs(flt)\n\t\tneeded := fmt.Sprintf(\"%f\", flt)\n\t\tgotten := TestExpr(needed)\n\t\tresult, _ := strconv.ParseFloat(gotten[\"value\"].(string), 64)\n\t\treturn flt == result\n\t}\n\n\tif err := quick.Check(f, nil); err != nil {\n\t\tt.Error(err)\n\t}\n}", "func TestCheckBinaryExprFloatRemBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 % true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 % true (mismatched types float64 and bool)`,\n\t)\n\n}", "func TestCheckBinaryExprFloatNeqFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 != 2.0`, env, (2.0 != 2.0), ConstBool)\n}", "func op_f64_gteq(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromBool(ReadF64(fp, inp1) >= ReadF64(fp, inp2))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\tif f.IsNaN() {\n\t\treturn x, true\n\t}\n\th := big.NewFloat(f.high).SetPrec(precision)\n\tl := big.NewFloat(f.low).SetPrec(precision)\n\tx.Add(h, l)\n\n\tzero := big.NewFloat(0).SetPrec(precision)\n\tif x.Cmp(zero) == 0 && math.Signbit(f.high) {\n\t\t// -zero\n\t\tif !x.Signbit() {\n\t\t\tx.Neg(x)\n\t\t}\n\t}\n\n\treturn x, false\n}", "func (x *Rat) Float32() (f float32, exact bool) {}", "func IsFinite(arg float64, ch int) bool {\n\treturn !math.IsInf(arg, ch)\n}", "func TestCompareFloats(t *testing.T) {\n\tlt := CompareFloats(0, 1)\n\teq := CompareFloats(1, 1)\n\tgt := CompareFloats(1, 0)\n\n\tif err := checkResult(lt, eq, gt); err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n}", "func (nvp *NameValues) Float64(name string) (float64, bool) {\n\n\tif !nvp.prepared {\n\t\tnvp.prepare()\n\t}\n\n\tvar value float64\n\n\tname = strings.ToLower(name)\n\ttmp, exists := nvp.Pair[name]\n\tif exists {\n\t\tvalue, _ = strconv.ParseFloat(tmp.(string), 64)\n\t}\n\n\treturn value, exists\n}", "func ExampleFloat64() {\n\n\tfmt.Println(conv.Float64(float64(123.456))) // 123.456\n\tfmt.Println(conv.Float64(\"-123.456\")) // -123.456\n\tfmt.Println(conv.Float64(\"1.7976931348623157e+308\"))\n\t// Output:\n\t// 123.456 <nil>\n\t// -123.456 <nil>\n\t// 1.7976931348623157e+308 <nil>\n}", "func TestCheckBinaryExprFloatQuoBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 / true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 / true (mismatched types float64 and bool)`,\n\t)\n\n}", "func Float64(f *frm.Field, inp ...string) {\n\tnum, err := strconv.ParseFloat(strings.TrimSpace(inp[0]), 64)\n\tf.Value = num\n\tif err != nil {\n\t\t//Return error if input string failed to convert.\n\t\tf.Err = err.Error()\n\t\treturn\n\t}\n\n\tif !f.Required && num == 0 {\n\t\t//f.ValueFloat64 is zero by default so assigning zero isn't required\n\t\treturn\n\t}\n\n\tif f.Min != nil && num < f.Min.(float64) || f.Max != nil && num > f.Max.(float64) {\n\t\tf.Err = fmt.Sprintf(\"Must be between %v and %v.\", f.Min, f.Max)\n\t\treturn\n\t}\n\n\tif rem := toFixed(math.Mod(num, float64(f.Step)), 6); rem != 0 {\n\t\tf.Err = fmt.Sprintf(\"Please enter a valid value. The two nearest values are %v and %v.\", num-rem, num-rem+float64(f.Step))\n\t}\n}", "func testFloatPrimitiveTypes() {\n\tvar minFloat32 float32 = -3.4e+38\n\tvar maxFloat32 float32 = +3.4e+38\n\n\tvar minFloat64 float64 = -1.7e+308\n\tvar maxFloat64 float64 = +1.7e+308\n\n\tfmt.Println(varinfo(minFloat32))\n\tfmt.Println(varinfo(maxFloat32))\n\tfmt.Println(varinfo(minFloat64))\n\tfmt.Println(varinfo(maxFloat64))\n\n\tfmt.Printf(\"%+.38f\\n\", minFloat32)\n\tfmt.Printf(\"%+.38f\\n\", maxFloat32)\n\n\tfmt.Printf(\"%+.308f\\n\", minFloat64)\n\tfmt.Printf(\"%+.308f\\n\", maxFloat64)\n}", "func TestCheckBinaryExprFloatNeqBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 != true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 != true (mismatched types float64 and bool)`,\n\t)\n\n}", "func TestCheckBinaryExprFloatEqlBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 == true`, env,\n\t\t`cannot convert true to type float64`,\n\t\t`invalid operation: 2 == true (mismatched types float64 and bool)`,\n\t)\n\n}", "func (w *ByteWriter) MustWriteFloat64(val float64, offset int) int {\n\treturn w.MustWriteVal(val, offset)\n}" ]
[ "0.69162524", "0.6890497", "0.6879801", "0.6812547", "0.6634595", "0.6512635", "0.64959264", "0.6441451", "0.64363927", "0.6405067", "0.62267417", "0.6203944", "0.61706656", "0.6093597", "0.60854876", "0.60854876", "0.60854876", "0.60595846", "0.603317", "0.6018857", "0.60031766", "0.5990099", "0.5975783", "0.59685284", "0.59376514", "0.5928075", "0.5911568", "0.5902272", "0.5899063", "0.5895208", "0.5895208", "0.5886568", "0.5875864", "0.5870775", "0.58305097", "0.5829687", "0.5822576", "0.5806898", "0.5802513", "0.5802513", "0.57931924", "0.5789101", "0.5776601", "0.5775591", "0.5762461", "0.57398385", "0.57260126", "0.57179236", "0.570796", "0.56835306", "0.56754434", "0.566926", "0.5658859", "0.5644584", "0.5634536", "0.5619267", "0.56178105", "0.5614715", "0.5604372", "0.559915", "0.5595666", "0.5591865", "0.5581982", "0.5568443", "0.55673283", "0.5563437", "0.5563169", "0.5562279", "0.5554849", "0.55538845", "0.55397385", "0.5533335", "0.55294645", "0.5527951", "0.5526072", "0.5514954", "0.55125546", "0.54982686", "0.54937154", "0.54926795", "0.5486846", "0.5485491", "0.54729444", "0.54708123", "0.5451785", "0.5449513", "0.54484636", "0.5443456", "0.54424685", "0.5427705", "0.5424433", "0.54047227", "0.5385674", "0.536636", "0.5362", "0.53599715", "0.53595203", "0.5356075", "0.5349662", "0.5345798" ]
0.70267004
0
Float sets z to x and returns z. z is allowed to be nil. The result is undefined if z is a NaN value.
func (x *Big) Float(z *big.Float) *big.Float { if debug { x.validate() } if z == nil { z = new(big.Float) } switch x.form { case finite, finite | signbit: if x.isZero() { z.SetUint64(0) } else { z.SetRat(x.Rat(nil)) } case pinf, ninf: z.SetInf(x.form == pinf) default: // snan, qnan, ssnan, sqnan: z.SetUint64(0) } return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Set(x *Float) *Float {}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (z *Float) SetFloat64(x float64) *Float {}", "func (z *Float) Copy(x *Float) *Float {}", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (jz *Jzon) Float() (f float64, err error) {\n\tif jz.Type != JzTypeFlt {\n\t\treturn f, expectTypeOf(JzTypeInt, jz.Type)\n\t}\n\n\treturn jz.data.(float64), nil\n}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func NewFloat(x float64) *Float { return new(Float).SetFloat64(x) }", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (z *Float) SetRat(x *Rat) *Float {}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func NewFloat(x float64) *Float {}", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (t *Type) Float(defaultValue ...float64) FloatAccessor {\n\tnv := &NullFloat{}\n\tif nv.Error = t.err; t.err != nil {\n\t\treturn nv\n\t}\n\tvalueTo := t.toFloat(reflect.Float64)\n\tnv = &NullFloat{FloatCommon{Error: valueTo.Err()}}\n\tif defaultFloat(nv, defaultValue...) {\n\t\treturn nv\n\t}\n\tv := valueTo.V()\n\tnv.P = &v\n\treturn nv\n}", "func FloatAbs(z *big.Float, x *big.Float,) *big.Float", "func (c *Context) Float(v float64) *AST {\n\t//TODO: test if this could work\n\treturn &AST{\n\t\trawCtx: c.raw,\n\t\trawAST: C.Z3_mk_real(c.raw, C.int(v), C.int(1)),\n\t}\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (z *Float) Abs(x *Float) *Float {}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (v Base) Float() float64 {\n\treturn float64(v)\n}", "func (v Value) Float() float64 {\n\tpanic(message)\n}", "func NewFloat(x float64) *big.Float", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func ZeroFloat(v interface{}) float64 {\n\tf, err := Float64(v)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn f\n}", "func (f *Float) Set(x *Float) *Float {\n\tf.doinit()\n\tC.mpf_set(&f.i[0], &x.i[0])\n\treturn f\n}", "func (me TPositiveFloatType) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "func (n *Number) Float() float64 {\n\treturn n.floating\n}", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func Float(v float64) *float64 {\n\treturn &v\n}", "func NewFloat(typ *types.FloatType, x float64) *ConstFloat {\n\tif math.IsNaN(x) {\n\t\t// TODO: store sign of NaN?\n\t\treturn &ConstFloat{Typ: typ, NaN: true}\n\t}\n\treturn &ConstFloat{Typ: typ, X: big.NewFloat(x)}\n}", "func (n null) Float() float64 {\n\tpanic(ErrInvalidConvNilToFloat)\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func toFloatMaybe(v starlark.Value) (float64, bool) {\n\treturn starlark.AsFloat(v)\n}", "func toFloatMaybe(v starlark.Value) (float64, bool) {\n\treturn starlark.AsFloat(v)\n}", "func (c *C) Float() Type {\n\treturn FloatT(4)\n}", "func Float(name string, value float, usage string) *float {\n\tp := new(float);\n\tFloatVar(p, name, value, usage);\n\treturn p;\n}", "func FloatRat(x *big.Float, z *big.Rat,) (*big.Rat, big.Accuracy,)", "func (f Fixed) Float() float64 {\n\tif f.IsNaN() {\n\t\treturn math.NaN()\n\t}\n\treturn float64(f.fp) / float64(scale)\n}", "func (f Fixed) Float() float64 {\n\tif f.IsNaN() {\n\t\treturn math.NaN()\n\t}\n\treturn float64(f.fp) / float64(scale)\n}", "func Float(flag string, value float64, description string) *float64 {\n\tvar v float64\n\tFloatVar(&v, flag, value, description)\n\treturn &v\n}", "func (v Value) Float() float64 {\n\treturn v.v.Float()\n}", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func (v Value) Float() float64 {\n\tswitch {\n\tcase v == 0:\n\t\treturn 0\n\tcase v == 64:\n\t\treturn 0.5\n\tcase v == 127:\n\t\treturn 1\n\tcase v < 64:\n\t\treturn float64(v) / 128\n\tdefault:\n\t\treturn float64(v-1) / 126\n\t}\n}", "func (s *Smpval) Float() float64 {\n\treturn s.f\n}", "func (c *Constructor[_]) Float(name string, value float64, help string) *float64 {\n\tp := new(float64)\n\tc.FloatVar(p, name, value, help)\n\treturn p\n}", "func (me *TPositiveFloatType) Set(s string) { (*xsdt.Float)(me).Set(s) }", "func FloatAdd(z *big.Float, x, y *big.Float,) *big.Float", "func Float(f float64) *float64 {\n\treturn &f\n}", "func FloatMul(z *big.Float, x, y *big.Float,) *big.Float", "func Float(value float64) *float64 {\n\treturn New(value).(*float64)\n}", "func (o *FloatObject) AsFloat() (float64) {\n return o.Value\n}", "func (tr Row) ForceFloat(nn int) (val float64) {\n\tval, _ = tr.FloatErr(nn)\n\treturn\n}", "func MakeFloatOrDefault(in *float32, defaultValue float32) *google_protobuf.FloatValue {\n\tif in == nil {\n\t\treturn &google_protobuf.FloatValue{\n\t\t\tValue: defaultValue,\n\t\t}\n\t}\n\n\treturn &google_protobuf.FloatValue{\n\t\tValue: *in,\n\t}\n}", "func FloatSetString(z *big.Float, s string) (*big.Float, bool)", "func (obj *Value) SetFloat(v float32) {\n\tobj.Candy().Guify(\"g_value_set_float\", obj, v)\n}", "func (c *Coord) Z() float64 { return c[2] }", "func (v *Value) Float() float64 {\n return Util.ToFloat(v.data)\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func (this *parameter) Float() float64 {\n\tif this.Values == nil {\n\t\treturn 0\n\t} else {\n\t\treturn reflekt.AsFloat(this.Values[0])\n\t}\n}", "func (o *FakeObject) Float() float64 { return o.Value.(float64) }", "func Float(param interface{}) float64 {\n\tvar v float64\n\tif param != nil {\n\t\tswitch param.(type) {\n\t\tcase int64:\n\t\t\tv = float64(param.(int64))\n\t\tdefault:\n\t\t\tv = param.(float64)\n\t\t}\n\t}\n\treturn v\n}", "func FloatInt(x *big.Float, z *big.Int,) (*big.Int, big.Accuracy,)", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func (s *Slider) Float(f *Float) *Slider {\n\ts.float = f\n\treturn s\n}", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (p Point) Z() float64 {\n\treturn p[2]\n}", "func (n Number) AsFloat() float64 {\n\treturn n.value\n}", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func (c *Cell) SetFloat(n float64) {\n\tc.SetFloatWithFormat(n, \"0.00e+00\")\n}", "func (e Entry) Float(k string, v float64) Entry {\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func (geom Geometry) Z(index int) float64 {\n\tz := C.OGR_G_GetZ(geom.cval, C.int(index))\n\treturn float64(z)\n}", "func ReportFloat(ns, name string) VarFloat {\n\tvarName := ns + \".\" + name\n\tvarLock.Lock()\n\tdefer varLock.Unlock()\n\n\tif v := expvar.Get(varName); v != nil {\n\t\treturn v.(*expvar.Float)\n\t}\n\treturn expvar.NewFloat(varName)\n}", "func (e ChainEntry) Float(k string, v float64) ChainEntry {\n\tif e.disabled {\n\t\treturn e\n\t}\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func NewFloat(i float64) Float { return &i }", "func FloatPrec(x *big.Float,) uint", "func ToFloat(x Value) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.ToFloat(x)\n}", "func (me XsdGoPkgHasElem_Z) ZDefault() xsdt.Double { var x = new(xsdt.Double); x.Set(\"1.0\"); return *x }", "func FloatOrPanic(s string) float64 {\n\tf, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (s *Smplen) Float() float64 {\n\treturn s.f\n}", "func (v Float) Float64() float64 {\n\treturn v.v\n}", "func (self *Map) Float(key string, fallbacks ...interface{}) float64 {\n\treturn self.Get(key, fallbacks...).Float()\n}", "func (x *Rat) Float32() (f float32, exact bool) {}", "func (a ASTNode) Float() float64 {\n\tif a.t != tval {\n\t\tpanic(ConfErr{a.pos, errors.New(\"Not a basic value\")})\n\t}\n\tv, err := strconv.ParseFloat(a.val.(string), 64)\n\tif err != nil {\n\t\tpanic(ConfErr{a.pos, err})\n\t}\n\treturn v\n}", "func tryFloat(v interface{}, dflt float64) float64 {\n\tf, ok := v.(float64)\n\tif !ok {\n\t\treturn dflt\n\t}\n\treturn f\n}", "func (me XsdGoPkgHasElems_Z) ZDefault() xsdt.Double {\r\n\tvar x = new(xsdt.Double)\r\n\tx.Set(\"1.0\")\r\n\treturn *x\r\n}", "func (f FloatFlag) Float(ctx context.Context, flagger ...Flagger) float64 {\n\ti, ok := f.value(ctx, flagger...)\n\tif !ok {\n\t\treturn f.defaultFloat\n\t}\n\tv, ok := i.(float64)\n\tif !ok {\n\t\treturn f.defaultFloat\n\t}\n\treturn v\n}", "func (f Number) Float(context.Context) float64 {\n\treturn float64(f)\n}", "func (p Point3) Z() float64 {\n\treturn p.Dim(2)\n}", "func FloatSub(z *big.Float, x, y *big.Float,) *big.Float", "func (z *Float) Neg(x *Float) *Float {}", "func (z *Float) SetUint64(x uint64) *Float {}", "func _fstore(frame *rtda.StackFrame, index uint) {\n\tval := frame.OperandStack().PopFloat()\n\tframe.LocalVars().SetFloat(index, val)\n}", "func (v *Value) Float() float64 {\n\treturn (float64)(C.value_get_double(v.value))\n}", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}" ]
[ "0.7320618", "0.7318478", "0.67963076", "0.6706169", "0.65353197", "0.6531598", "0.6487981", "0.63998747", "0.63235986", "0.62512195", "0.6203898", "0.61892086", "0.6120503", "0.6077566", "0.6072339", "0.5918691", "0.5891225", "0.5885803", "0.5863337", "0.584555", "0.5788752", "0.5777914", "0.5764304", "0.5747273", "0.57395655", "0.5727631", "0.5726571", "0.57237685", "0.572369", "0.5717332", "0.5716765", "0.5690503", "0.56717485", "0.566194", "0.5654298", "0.56495976", "0.5640137", "0.562435", "0.56217617", "0.56217617", "0.5579699", "0.55699784", "0.5565994", "0.55567384", "0.55567384", "0.55324614", "0.55220526", "0.55010754", "0.5469139", "0.5466736", "0.54614973", "0.54526293", "0.5420096", "0.5405679", "0.5398294", "0.5397201", "0.53914696", "0.5380469", "0.53539723", "0.5351275", "0.53505903", "0.5349192", "0.53417534", "0.5338452", "0.53354985", "0.5325292", "0.53142744", "0.53128105", "0.5294786", "0.5282235", "0.5281098", "0.5277702", "0.5276995", "0.52715945", "0.5262083", "0.52610844", "0.5260041", "0.52556753", "0.5255456", "0.525355", "0.5250847", "0.52435476", "0.52431035", "0.52391", "0.5238029", "0.5217582", "0.5204859", "0.5201749", "0.51979566", "0.5188151", "0.5181706", "0.5155007", "0.51426506", "0.5138933", "0.51362723", "0.5119731", "0.51163346", "0.51113427", "0.51110804", "0.5110077" ]
0.65150666
6
FMA sets z to (x y) + u without any intermediate rounding.
func (z *Big) FMA(x, y, u *Big) *Big { return z.Context.FMA(z, x, y, u) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func affinize(points []*G1) {\n\tif len(points) == 0 {\n\t\treturn\n\t}\n\tws := make([]ff.Fp, len(points)+1)\n\tws[0].SetOne()\n\tfor i := 0; i < len(points); i++ {\n\t\tws[i+1].Mul(&ws[i], &points[i].z)\n\t}\n\n\tw := &ff.Fp{}\n\tw.Inv(&ws[len(points)])\n\n\tzinv := &ff.Fp{}\n\tfor i := len(points) - 1; i >= 0; i-- {\n\t\tzinv.Mul(w, &ws[i])\n\t\tw.Mul(w, &points[i].z)\n\n\t\tpoints[i].x.Mul(&points[i].x, zinv)\n\t\tpoints[i].y.Mul(&points[i].y, zinv)\n\t\tpoints[i].z.SetOne()\n\t}\n}", "func TrapzF(x []float64, y Cb_yx) (A float64) {\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y(x[i]) + y(x[i-1])) / 2.0\n\t}\n\treturn A\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func GoFapa03(t float64) float64 {\n\treturn (0.024381750 + 0.00000538691*t) * t\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func FloatMul(z *big.Float, x, y *big.Float,) *big.Float", "func FloatAbs(z *big.Float, x *big.Float,) *big.Float", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (z *Float) Copy(x *Float) *Float {}", "func FloatAdd(z *big.Float, x, y *big.Float,) *big.Float", "func (a *Array64) FMA12(x float64, b *Array64) *Array64 {\n\tif a.valRith(b, \"FMA\") {\n\t\treturn a\n\t}\n\n\tif b.strides[0] != a.strides[0] {\n\t\tcmp, mul := new(sync.WaitGroup), len(a.data)/len(b.data)\n\t\tcmp.Add(mul)\n\t\tfor k := 0; k < mul; k++ {\n\t\t\tgo func(m int) {\n\t\t\t\tasm.Fma12(x, a.data[m:m+len(b.data)], b.data)\n\t\t\t\tcmp.Done()\n\t\t\t}(k * len(b.data))\n\t\t}\n\t\tcmp.Wait()\n\t\treturn a\n\t}\n\n\tasm.Fma12(x, a.data, b.data)\n\treturn a\n}", "func (z *Float) Set(x *Float) *Float {}", "func (z *Float64) Maclaurin(y *Float64, p *maclaurin.Float64) *Float64 {\n\tif p.Len() == 0 {\n\t\tz = new(Float64)\n\t\treturn z\n\t}\n\tn := p.Degree\n\tvar a float64\n\tif n == 0 {\n\t\tz = new(Float64)\n\t\ta, _ = p.Coeff(n)\n\t\tz.SetReal(a)\n\t\treturn z\n\t}\n\ta, _ = p.Coeff(n)\n\tz.Dilate(y, a)\n\tfor n > 1 {\n\t\tn--\n\t\tif a, ok := p.Coeff(n); ok {\n\t\t\tz.Plus(z, a)\n\t\t}\n\t\tz.Mul(z, y)\n\t}\n\tif a, ok := p.Coeff(0); ok {\n\t\tz.Plus(z, a)\n\t}\n\treturn z\n}", "func avgmva(init *SPH_UDF_INIT, args *SPH_UDF_ARGS, err *ERR_FLAG) float64 {\n\n\tresult := float64(0.0)\n\tnvalues := args.lenval(0)\n\n\tif nvalues == 0 {\n\t\treturn result\n\t}\n\n\tis64 := SPH_UDF_TYPE(init.getuint32())\n\tswitch is64 {\n\tcase SPH_UDF_TYPE_UINT32SET:\n\t\t{\n\t\t\tmvas := args.mva32(0)\n\t\t\tfor _, value := range mvas {\n\t\t\t\tresult += float64(value)\n\t\t\t}\n\t\t}\n\tcase SPH_UDF_TYPE_INT64SET:\n\t\t{\n\t\t\tmvas := args.mva64(0)\n\t\t\tfor _, value := range mvas {\n\t\t\t\tresult += float64(value)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result / float64(nvalues)\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func CgoFapa03(t float64) float64 {\n\tvar cF C.double\n\tcF = C.iauFapa03(C.double(t))\n\treturn float64(cF)\n}", "func (a *Array64) FMA21(x float64, b *Array64) *Array64 {\n\tif a.valRith(b, \"FMA\") {\n\t\treturn a\n\t}\n\tif b.strides[0] != a.strides[0] {\n\t\tcmp, mul := new(sync.WaitGroup), len(a.data)/len(b.data)\n\t\tcmp.Add(mul)\n\t\tfor k := 0; k < mul; k++ {\n\t\t\tgo func(m int) {\n\t\t\t\tasm.Fma21(x, a.data[m:m+len(b.data)], b.data)\n\t\t\t\tcmp.Done()\n\t\t\t}(k * len(b.data))\n\t\t}\n\t\tcmp.Wait()\n\t\treturn a\n\t}\n\n\tasm.Fma21(x, a.data, b.data)\n\treturn a\n}", "func (v Vec3) ByZ() Vec2 {\n\tf := 1.0 / v[2]\n\treturn Vec2{f * v[0], f * v[1]}\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func calcMAE(X, Y []float64, m, b float64) (mAE float64) {\n\tfor i := range Y {\n\t\tmAE += math.Abs(Y[i]-(m*X[i]+b)) / float64(len(Y))\n\t}\n\treturn\n}", "func (sink *Trainer) Featurize(input, feature []float64) {\n\tsqrt2OverD := math.Sqrt(2.0 / float64(sink.nFeatures))\n\tfor i := range feature {\n\t\tfeature[i] = computeZ(input, sink.features.RowView(i), sink.b[i], sqrt2OverD)\n\t}\n}", "func Sma(window int) func(s []float64) []float64 {\n\treturn func(s []float64) (res []float64) {\n\t\tadder := movavg.NewSMA(window)\n\n\t\tfor i, v := range s {\n\t\t\tadder.Add(v)\n\n\t\t\tif i >= window-1 {\n\t\t\t\tres = append(res, adder.Avg())\n\t\t\t}\n\t\t}\n\n\t\treturn\n\t}\n}", "func FloatRat(x *big.Float, z *big.Rat,) (*big.Rat, big.Accuracy,)", "func VPMAXUW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUW_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VPMAXUW_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUW_Z(mxyz, xyz, k, xyz1))\n}", "func (self *SinglePad) SetOnFloatCallbackA(member interface{}) {\n self.Object.Set(\"onFloatCallback\", member)\n}", "func CgoFad03(t float64) float64 {\n\tvar cF C.double\n\tcF = C.iauFad03(C.double(t))\n\treturn float64(cF)\n}", "func (a Vector3) Ave() float64 {\n\treturn (a.X + a.Y + a.Z) / 3\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func Ema(input []float64, smoothingFactor float64) []float64 {\n\tema := make([]float64, 0, len(input))\n\tif len(input) > 0 {\n\t\tema = append(ema, input[0])\n\t}\n\n\tfor i := 1; i < len(input); i++ {\n\t\tema = append(ema, smoothingFactor*input[i]+(1-smoothingFactor)*ema[i-1])\n\t}\n\treturn ema\n}", "func (a *Vector3) Normalise() {\n\tl := a.Length()\n\t*a = Vector3{a.X / l, a.Y / l, a.Z / l}\n}", "func VertexAttrib3f(dst Attrib, x, y, z float32) {\n\tgl.VertexAttrib3f(uint32(dst.Value), x, y, z)\n}", "func Mix(x, y, a float64) float64 {\n\treturn x + (a * (y - x))\n}", "func (r *FloatMovingAverageReducer) AggregateFloat(p *FloatPoint) {\n\tif len(r.buf) != cap(r.buf) {\n\t\tr.buf = append(r.buf, p.Value)\n\t} else {\n\t\tr.sum -= r.buf[r.pos]\n\t\tr.buf[r.pos] = p.Value\n\t}\n\tr.sum += p.Value\n\tr.time = p.Time\n\tr.pos++\n\tif r.pos >= cap(r.buf) {\n\t\tr.pos = 0\n\t}\n}", "func (c *Context) VPMAXUD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUD_Z(mxyz, xyz, k, xyz1))\n}", "func _fstore(frame *rtda.StackFrame, index uint) {\n\tval := frame.OperandStack().PopFloat()\n\tframe.LocalVars().SetFloat(index, val)\n}", "func VPMAXUD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUD_Z(mxyz, xyz, k, xyz1) }", "func (z *Float) SetFloat64(x float64) *Float {}", "func (c *Context) Float(v float64) *AST {\n\t//TODO: test if this could work\n\treturn &AST{\n\t\trawCtx: c.raw,\n\t\trawAST: C.Z3_mk_real(c.raw, C.int(v), C.int(1)),\n\t}\n}", "func computeZ(featurizedInput, feature []float64, b float64, sqrt2OverD float64) float64 {\n\tdot := floats.Dot(featurizedInput, feature)\n\treturn sqrt2OverD * (math.Cos(dot + b))\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func medianOfThreeZfunc(data LessSwap, m1, m0, m2 int) {\n\tif data.Less(m1, m0) {\n\t\tdata.Swap(m1, m0)\n\t}\n\tif data.Less(m2, m1) {\n\t\tdata.Swap(m2, m1)\n\t\tif data.Less(m1, m0) {\n\t\t\tdata.Swap(m1, m0)\n\t\t}\n\t}\n}", "func Mat3Frob(a []float64) float64 {\n\treturn hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8])\n}", "func CgoFal03(t float64) float64 {\n\tvar cF C.double\n\tcF = C.iauFal03(C.double(t))\n\treturn float64(cF)\n}", "func FloatPrec(x *big.Float,) uint", "func VPMAXUB_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUB_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VPMAXUB_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUB_Z(mxyz, xyz, k, xyz1))\n}", "func Minf(a, b float32) float32", "func MToF(m Meter) Foot { return Foot(m / 0.3048) }", "func MToF(m Meter) Feet { return Feet(m / 0.3048) }", "func FToM(f Feet) Meter { return Meter(f * 0.3048) }", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func normalize(f *dump.Frame) {\n\ta := f.Vectors()\n\tfor i := range a[0] {\n\n\t\tfor j := range a[0][i] {\n\n\t\t\tfor k := range a[0][i][j] {\n\t\t\t\tx, y, z := a[0][i][j][k], a[1][i][j][k], a[2][i][j][k]\n\t\t\t\tnorm := math.Sqrt(float64(x*x + y*y + z*z))\n\t\t\t\tinvnorm := float32(1)\n\t\t\t\tif norm != 0 {\n\t\t\t\t\tinvnorm = float32(1 / norm)\n\t\t\t\t}\n\t\t\t\ta[0][i][j][k] *= invnorm\n\t\t\t\ta[1][i][j][k] *= invnorm\n\t\t\t\ta[2][i][j][k] *= invnorm\n\n\t\t\t}\n\t\t}\n\t}\n}", "func (bd *BaseItems) CalcA() {\n\tt := bd.GetItem(\"planetPeriod\")\n\t//ignoring the satellite mass compared to the earth mass\n\tt = t * 24.0 * 3600.0\n\taCubed := (earthMass * gravity * t * t) / (4.0 * math.Pi * math.Pi)\n\tp := 1.0 / 3.0\n\ta := math.Pow(aCubed, p)\n\tdd := *bd\n\tdd[\"planetSMA\"] = BaseItem{\n\t\tName: \"planetSMA\",\n\t\tValue: a / au,\n\t\tNumonic: \"a\",\n\t\tDescription: \"Satellite Semi Major Axis (SMA)\",\n\t}\n}", "func Uniform3fv(location int32, count int32, value *float32) {\n\tsyscall.Syscall(gpUniform3fv, 3, uintptr(location), uintptr(count), uintptr(unsafe.Pointer(value)))\n}", "func (e Entry) Float(k string, v float64) Entry {\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func Mat3Set(out []float64, m00, m01, m02, m10, m11, m12, m20, m21, m22 float64) []float64 {\n\tout[0] = m00\n\tout[1] = m01\n\tout[2] = m02\n\tout[3] = m10\n\tout[4] = m11\n\tout[5] = m12\n\tout[6] = m20\n\tout[7] = m21\n\tout[8] = m22\n\treturn out\n}", "func GoFal03(t float64) float64 {\n\t// Mean anomaly of the Moon (IERS Conventions 2003).\n\treturn math.Mod(485868.249036+\n\t\tt*(1717915923.2178+\n\t\t\tt*(31.8792+\n\t\t\t\tt*(0.051635+\n\t\t\t\t\tt*(-0.00024470)))), TURNAS) * DAS2R\n}", "func FloatSqrt(z *big.Float, x *big.Float,) *big.Float", "func Uniform3f(location int32, v0 float32, v1 float32, v2 float32) {\n\tsyscall.Syscall6(gpUniform3f, 4, uintptr(location), uintptr(math.Float32bits(v0)), uintptr(math.Float32bits(v1)), uintptr(math.Float32bits(v2)), 0, 0)\n}", "func f ( a int , a float64) int {\r\n\r\n}", "func FloatAcc(x *big.Float,) big.Accuracy", "func Mat3FromScaling(out, v []float64) []float64 {\n\tout[0] = v[0]\n\tout[1] = 0\n\tout[2] = 0\n\n\tout[3] = 0\n\tout[4] = v[1]\n\tout[5] = 0\n\n\tout[6] = 0\n\tout[7] = 0\n\tout[8] = 1\n\treturn out\n}", "func appendFloat(dst []byte, f float64, fmt byte, prec int, bitSize int) []byte {\n\treturn genericFtoa(dst, f, fmt, prec, bitSize)\n}", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func (c *Constructor[_]) Float(name string, value float64, help string) *float64 {\n\tp := new(float64)\n\tc.FloatVar(p, name, value, help)\n\treturn p\n}", "func (z *Float) Abs(x *Float) *Float {}", "func Ztoc_float(input DSPSplitComplex, inputStride int, output []float32, outputStride int) {\n\tvar splitComplex C.DSPSplitComplex\n\tsplitComplex.realp = (*C.float)(&input.Real[0])\n\tsplitComplex.imagp = (*C.float)(&input.Imag[0])\n\tC.vDSP_ztoc(&splitComplex, C.vDSP_Stride(inputStride), (*C.DSPComplex)(unsafe.Pointer(&output[0])), C.vDSP_Stride(outputStride), C.vDSP_Length(len(output)/outputStride))\n}", "func (etf *Etf) normalize(x, y, z float32) gocv.Vecf {\n\tnv := float32(math.Sqrt(float64(x*x) + float64(y*y) + float64(z*z)))\n\n\tif nv > 0.0 {\n\t\treturn gocv.Vecf{x * 1.0 / nv, y * 1.0 / nv, z * 1.0 / nv}\n\t}\n\treturn gocv.Vecf{0.0, 0.0, 0.0}\n}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func fiat_p384_cmovznz_u64(out1 *uint64, arg1 fiat_p384_uint1, arg2 uint64, arg3 uint64) {\n var x1 uint64 = (uint64(arg1) * 0xffffffffffffffff)\n var x2 uint64 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func (e ChainEntry) Float(k string, v float64) ChainEntry {\n\tif e.disabled {\n\t\treturn e\n\t}\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func GoFad03(t float64) float64 {\n\t// Mean elongation of the Moon from the Sun (IERS Conventions 2003).\n\treturn math.Mod(1072260.703692+\n\t\tt*(1602961601.2090+\n\t\t\tt*(-6.3706+\n\t\t\t\tt*(0.006593+\n\t\t\t\t\tt*(-0.00003169)))), TURNAS) * DAS2R\n}", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func UnLexFloat(b uint64) float64 {\n\tif b>>63 == 1 {\n\t\tb = b ^ (1 << 63)\n\t} else {\n\t\tb = ^b\n\t}\n\treturn math.Float64frombits(b)\n}", "func VFMADD132SS_Z(mx, x, k, x1 operand.Op) { ctx.VFMADD132SS_Z(mx, x, k, x1) }", "func fiat_p448_msat(out1 *[8]uint64) {\n out1[0] = 0xffffffffffffffff\n out1[1] = 0xffffffffffffffff\n out1[2] = 0xffffffffffffffff\n out1[3] = 0xfffffffeffffffff\n out1[4] = 0xffffffffffffffff\n out1[5] = 0xffffffffffffffff\n out1[6] = 0xffffffffffffffff\n out1[7] = uint64(0x0)\n}", "func fiat_p384_cmovznz_u32(out1 *uint32, arg1 uint32, arg2 uint32, arg3 uint32) {\n var x1 uint32 = (arg1 * 0xffffffff)\n var x2 uint32 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func MulA24(z, x *Elt)", "func (c *Context) VMOVUPS_Z(mxyz, k, mxyz1 operand.Op) {\n\tc.addinstruction(x86.VMOVUPS_Z(mxyz, k, mxyz1))\n}", "func mathACosh(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar f phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn phpv.ZFloat(math.Acosh(float64(f))).ZVal(), nil\n}", "func VPSHUFB_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPSHUFB_Z(mxyz, xyz, k, xyz1) }", "func (pdl PriceDataList) sma(n int, offset int) float64 {\n\tstart := len(pdl) - n - offset\n\tend := len(pdl) - offset\n\n\tslice := pdl[start:end]\n\tsum := float64(0)\n\n\tfor _, pd := range slice {\n\t\tsum += pd.Close\n\t}\n\n\treturn sum / float64(n)\n}", "func remez(des, grid, bands, wt []float64, ngrid int, iext []int, alpha []float64, nfcns, itrmax int, dimsize int) (float64, error) {\n\ta := make([]float64, dimsize+1)\n\tp := make([]float64, dimsize+1)\n\tq := make([]float64, dimsize+1)\n\tad := make([]float64, dimsize+1)\n\tx := make([]float64, dimsize+1)\n\ty := make([]float64, dimsize+1)\n\n\tdevl := -1.0\n\tnz := nfcns + 1\n\tnzz := nfcns + 2\n\n\tvar comp, dev, y1 float64\n\nIterationLoop:\n\tfor niter := 0; niter <= itrmax; niter++ {\n\t\tif niter == itrmax {\n\t\t\treturn dev, errors.New(\"remez: reached max iterations\")\n\t\t}\n\n\t\tiext[nzz] = ngrid + 1\n\n\t\tfor j := 1; j <= nz; j++ {\n\t\t\tx[j] = math.Cos(grid[iext[j]] * pi2)\n\t\t}\n\n\t\tjet := (nfcns-1)/15 + 1\n\t\tfor j := 1; j <= nz; j++ {\n\t\t\tad[j] = lagrangeInterp(j, nz, jet, x)\n\t\t}\n\n\t\tdnum, dden := 0.0, 0.0\n\t\tfor j, k := 1, 1.0; j <= nz; j, k = j+1, -k {\n\t\t\tl := iext[j]\n\t\t\tdnum += ad[j] * des[l]\n\t\t\tdden += k * ad[j] / wt[l]\n\t\t}\n\t\tdev = dnum / dden\n\n\t\t/* printf(\"DEVIATION = %lg\\n\",*dev); */\n\n\t\tnu := 1.0\n\t\tif dev > 0.0 {\n\t\t\tnu = -1.0\n\t\t}\n\t\tdev = math.Abs(dev) // dev = -nu * dev\n\t\tfor j, k := 1, nu; j <= nz; j, k = j+1, -k {\n\t\t\tl := iext[j]\n\t\t\ty[j] = des[l] + k*dev/wt[l]\n\t\t}\n\t\tif dev <= devl {\n\t\t\t/* finished */\n\t\t\treturn dev, errors.New(\"remez: deviation decreased\")\n\t\t}\n\t\tdevl = dev\n\n\t\tjchnge := 0\n\t\tk1 := iext[1]\n\t\tknz := iext[nz]\n\t\tklow := 0\n\t\tnut := -nu\n\n\t\tdown := func(l, j int) {\n\t\t\tfor {\n\t\t\t\tl--\n\t\t\t\tif l <= klow {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp <= 0.0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcomp = nut * e\n\t\t\t}\n\t\t\tklow = iext[j]\n\t\t\tiext[j] = l + 1\n\t\t\tjchnge++\n\t\t}\n\n\t\tup := func(l, j, kup int) {\n\t\t\tfor {\n\t\t\t\tl++\n\t\t\t\tif l >= kup {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp <= 0.0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcomp = nut * e\n\t\t\t}\n\t\t\tiext[j] = l - 1\n\t\t\tklow = l - 1\n\t\t\tjchnge++\n\t\t}\n\n\t\t/*\n\t\t * SEARCH FOR THE EXTREMAL FREQUENCIES OF THE BEST APPROXIMATION\n\t\t */\n\n\t\tfor j := 1; j < nzz; j++ {\n\t\t\tkup := iext[j+1]\n\t\t\tnut = -nut\n\t\t\tif j == 2 {\n\t\t\t\ty1 = comp\n\t\t\t}\n\t\t\tcomp = dev\n\n\t\t\tl := iext[j] + 1\n\t\t\tif l < kup {\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\tcomp = nut * e\n\t\t\t\t\tup(l, j, kup)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tl--\n\n\t\t\tfor {\n\t\t\t\tl--\n\t\t\t\tif l <= klow {\n\t\t\t\t\tl = iext[j] + 1\n\t\t\t\t\tif jchnge > 0 {\n\t\t\t\t\t\tiext[j] = l - 1\n\t\t\t\t\t\tklow = l - 1\n\t\t\t\t\t\tjchnge++\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor {\n\t\t\t\t\t\t\tl++\n\t\t\t\t\t\t\tif l >= kup {\n\t\t\t\t\t\t\t\tklow = iext[j]\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\t\t\t\tcomp = nut * e\n\t\t\t\t\t\t\t\tup(l, j, kup)\n\t\t\t\t\t\t\t\tbreak\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\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\tcomp = nut * e\n\t\t\t\t\tdown(l, j)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif jchnge > 0 {\n\t\t\t\t\tklow = iext[j]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif k1 > iext[1] {\n\t\t\tk1 = iext[1]\n\t\t}\n\t\tif knz < iext[nz] {\n\t\t\tknz = iext[nz]\n\t\t}\n\n\t\tluck := 6\n\t\tnut1 := nut\n\t\tnut = -nu\n\t\tcomp *= 1.00001\n\t\tj := nzz\n\n\t\tfor l := 1; l < k1; l++ {\n\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\tcomp = nut * e\n\t\t\t\tup(l, j, k1)\n\t\t\t\tj = nzz + 1\n\t\t\t\tluck = 1\n\n\t\t\t\tif comp > y1 {\n\t\t\t\t\ty1 = comp\n\t\t\t\t}\n\t\t\t\tk1 = iext[nzz]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tklow = knz\n\t\tnut = -nut1\n\t\tcomp = y1 * 1.00001\n\n\t\tfor l := ngrid; l > klow; l-- {\n\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\tcomp = nut * e\n\t\t\t\tdown(l, j)\n\n\t\t\t\tkn := iext[nzz]\n\t\t\t\tfor i := 1; i <= nfcns; i++ {\n\t\t\t\t\tiext[i] = iext[i+1]\n\t\t\t\t}\n\t\t\t\tiext[nz] = kn\n\t\t\t\tcontinue IterationLoop\n\t\t\t}\n\t\t}\n\n\t\tif luck != 6 {\n\t\t\tfor i := 1; i <= nfcns; i++ {\n\t\t\t\tiext[nzz-i] = iext[nz-i]\n\t\t\t}\n\t\t\tiext[1] = k1\n\t\t} else if jchnge <= 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t/*\n\t * CALCULATION OF THE COEFFICIENTS OF THE BEST APPROXIMATION\n\t * USING THE INVERSE DISCRETE FOURIER TRANSFORM\n\t */\n\tnm1 := nfcns - 1\n\tfsh := 1.0e-06\n\tgtemp := grid[1]\n\tx[nzz] = -2.0\n\tcn := float64(2*nfcns - 1)\n\tdelf := 1.0 / cn\n\tl := 1\n\tkkk := 0\n\n\tif bands[0] == 0.0 && bands[len(bands)-1] == 0.5 {\n\t\tkkk = 1\n\t}\n\n\tif nfcns <= 3 {\n\t\tkkk = 1\n\t}\n\n\tvar aa, bb float64\n\tif kkk != 1 {\n\t\tdtemp := math.Cos(pi2 * grid[1])\n\t\tdnum := math.Cos(pi2 * grid[ngrid])\n\t\taa = 2.0 / (dtemp - dnum)\n\t\tbb = -(dtemp + dnum) / (dtemp - dnum)\n\t}\n\n\tfor j := 1; j <= nfcns; j++ {\n\t\tft := float64(j-1) * delf\n\t\txt := math.Cos(pi2 * ft)\n\t\tif kkk != 1 {\n\t\t\txt = (xt - bb) / aa\n\t\t\t// /*XX* ckeck up !! */\n\t\t\t// xt1 = sqrt(1.0-xt*xt);\n\t\t\t// ft = atan2(xt1,xt)/pi2;\n\n\t\t\tft = math.Acos(xt) / pi2\n\t\t}\n\t\tfor {\n\t\t\txe := x[l]\n\t\t\tif xt > xe {\n\t\t\t\tif (xt - xe) < fsh {\n\t\t\t\t\ta[j] = y[l]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tgrid[1] = ft\n\t\t\t\ta[j] = freqEval(1, nz, grid, x, y, ad)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (xe - xt) < fsh {\n\t\t\t\ta[j] = y[l]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tl++\n\t\t}\n\t\tif l > 1 {\n\t\t\tl = l - 1\n\t\t}\n\t}\n\n\tgrid[1] = gtemp\n\tdden := pi2 / cn\n\tfor j := 1; j <= nfcns; j++ {\n\t\tdtemp := 0.0\n\t\tdnum := float64(j-1) * dden\n\t\tif nm1 >= 1 {\n\t\t\tfor k := 1; k <= nm1; k++ {\n\t\t\t\tdtemp += a[k+1] * math.Cos(dnum*float64(k))\n\t\t\t}\n\t\t}\n\t\talpha[j] = 2.0*dtemp + a[1]\n\t}\n\n\tfor j := 2; j <= nfcns; j++ {\n\t\talpha[j] *= 2.0 / cn\n\t}\n\talpha[1] /= cn\n\n\tif kkk != 1 {\n\t\tp[1] = 2.0*alpha[nfcns]*bb + alpha[nm1]\n\t\tp[2] = 2.0 * aa * alpha[nfcns]\n\t\tq[1] = alpha[nfcns-2] - alpha[nfcns]\n\t\tfor j := 2; j <= nm1; j++ {\n\t\t\tif j >= nm1 {\n\t\t\t\taa *= 0.5\n\t\t\t\tbb *= 0.5\n\t\t\t}\n\t\t\tp[j+1] = 0.0\n\t\t\tfor k := 1; k <= j; k++ {\n\t\t\t\ta[k] = p[k]\n\t\t\t\tp[k] = 2.0 * bb * a[k]\n\t\t\t}\n\t\t\tp[2] += a[1] * 2.0 * aa\n\t\t\tfor k := 1; k <= j-1; k++ {\n\t\t\t\tp[k] += q[k] + aa*a[k+1]\n\t\t\t}\n\t\t\tfor k := 3; k <= j+1; k++ {\n\t\t\t\tp[k] += aa * a[k-1]\n\t\t\t}\n\n\t\t\tif j != nm1 {\n\t\t\t\tfor k := 1; k <= j; k++ {\n\t\t\t\t\tq[k] = -a[k]\n\t\t\t\t}\n\t\t\t\tq[1] += alpha[nfcns-1-j]\n\t\t\t}\n\t\t}\n\t\tfor j := 1; j <= nfcns; j++ {\n\t\t\talpha[j] = p[j]\n\t\t}\n\t}\n\n\tif nfcns <= 3 {\n\t\talpha[nfcns+1] = 0.0\n\t\talpha[nfcns+2] = 0.0\n\t}\n\treturn dev, nil\n}", "func UniformMatrix3fv(location int32, count int32, transpose bool, value *float32) {\n\tsyscall.Syscall6(gpUniformMatrix3fv, 4, uintptr(location), uintptr(count), boolToUintptr(transpose), uintptr(unsafe.Pointer(value)), 0, 0)\n}", "func FloatAppend(x *big.Float, buf []byte, fmt byte, prec int) []byte", "func VFMSUBADD213PD_RU_SAE_Z(z, z1, k, z2 operand.Op) { ctx.VFMSUBADD213PD_RU_SAE_Z(z, z1, k, z2) }", "func UniformMatrix3fv(location int32, count int32, transpose bool, value *float32) {\n C.glowUniformMatrix3fv(gpUniformMatrix3fv, (C.GLint)(location), (C.GLsizei)(count), (C.GLboolean)(boolToInt(transpose)), (*C.GLfloat)(unsafe.Pointer(value)))\n}", "func Float(v float64) *float64 {\n\treturn &v\n}", "func VFMSUBADD213PD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VFMSUBADD213PD_Z(mxyz, xyz, k, xyz1) }", "func fiat_p448_cmovznz_u64(out1 *uint64, arg1 fiat_p448_uint1, arg2 uint64, arg3 uint64) {\n var x1 uint64 = (uint64(arg1) * 0xffffffffffffffff)\n var x2 uint64 = ((x1 & arg3) | ((^x1) & arg2))\n *out1 = x2\n}", "func UniformMatrix3fv(dst Uniform, src []float32) {\n\tgl.UniformMatrix3fv(dst.Value, int32(len(src)/(3*3)), false, &src[0])\n}", "func UnZValue(z [2]uint64) types.Point {\n\txl, yl := UnInterleaveUint64(z[0])\n\txr, yr := UnInterleaveUint64(z[1])\n\txf := UnLexFloat((xl << 32) | xr)\n\tyf := UnLexFloat((yl << 32) | yr)\n\treturn types.Point{X: xf, Y: yf}\n}", "func VFMADD213SS_Z(mx, x, k, x1 operand.Op) { ctx.VFMADD213SS_Z(mx, x, k, x1) }", "func VEXTRACTF32X4_Z(i, yz, k, mx operand.Op) { ctx.VEXTRACTF32X4_Z(i, yz, k, mx) }" ]
[ "0.57408684", "0.56587553", "0.5631097", "0.5547086", "0.53585625", "0.5339658", "0.52872926", "0.5235077", "0.5174893", "0.5167047", "0.5099495", "0.50588405", "0.50502396", "0.5019461", "0.501725", "0.5009467", "0.5008925", "0.4950905", "0.49338824", "0.4926024", "0.48678043", "0.48278025", "0.48043612", "0.4776149", "0.4748985", "0.47068042", "0.47054553", "0.4679713", "0.46772277", "0.46745571", "0.4668613", "0.46267304", "0.45996755", "0.4559299", "0.4554658", "0.455428", "0.45527536", "0.45517614", "0.4546465", "0.4533566", "0.45321247", "0.4528877", "0.45255312", "0.45065895", "0.4497241", "0.4492347", "0.4490261", "0.44532087", "0.44264704", "0.44181666", "0.44168487", "0.43840215", "0.43826073", "0.4382533", "0.43780264", "0.4370191", "0.43578827", "0.43512452", "0.43456316", "0.43450403", "0.43445542", "0.43428716", "0.43364182", "0.43192494", "0.43171325", "0.4312831", "0.43127304", "0.43077314", "0.43074104", "0.43016958", "0.42990246", "0.42910942", "0.42845318", "0.42780668", "0.42757317", "0.42732662", "0.4272402", "0.4268688", "0.4262376", "0.42597207", "0.42553896", "0.425494", "0.42457128", "0.42383584", "0.4235754", "0.42344838", "0.42286125", "0.42203578", "0.4217805", "0.42088798", "0.4204915", "0.42043975", "0.42021257", "0.42009524", "0.4199888", "0.41948205", "0.4194174", "0.41900414", "0.41894028", "0.4187139" ]
0.7032753
0
Int sets z to x, truncating the fractional portion (if any) and returns z. z is allowed to be nil. If x is an infinity or a NaN value the result is undefined.
func (x *Big) Int(z *big.Int) *big.Int { if debug { x.validate() } if z == nil { z = new(big.Int) } if !x.IsFinite() { return z } if x.isCompact() { z.SetUint64(x.compact) } else { z.Set(&x.unscaled) } if x.Signbit() { z.Neg(z) } if x.exp == 0 { return z } return bigScalex(z, z, x.exp) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetInt(x *Int) *Float {}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func Int(num cty.Value) (cty.Value, error) {\n\tif num == cty.PositiveInfinity || num == cty.NegativeInfinity {\n\t\treturn cty.NilVal, fmt.Errorf(\"can't truncate infinity to an integer\")\n\t}\n\treturn IntFunc.Call([]cty.Value{num})\n}", "func FloatInt(x *big.Float, z *big.Int,) (*big.Int, big.Accuracy,)", "func (x *Float) Int(z *Int) (*Int, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func (z *Numeric) SetInt(x int) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tif x < 0 {\n\t\tz.sign = numericNegative\n\t} else {\n\t\tz.sign = numericPositive\n\t}\n\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := mathh.AbsInt16(int16(x % numericBase))\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}", "func integerPower(z, x *inf.Dec, y int64, s inf.Scale) *inf.Dec {\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t}\n\n\tneg := y < 0\n\tif neg {\n\t\ty = -y\n\t}\n\n\tz.Set(decimalOne)\n\tfor y > 0 {\n\t\tif y%2 == 1 {\n\t\t\tz = z.Mul(z, x)\n\t\t}\n\t\ty >>= 1\n\t\tx.Mul(x, x)\n\n\t\t// integerPower is only ever called with `e` (decimalE), which is a constant\n\t\t// with very high precision. When it is squared above, the number of digits\n\t\t// needed to express it goes up quickly. If we are a large power of a small\n\t\t// number (like 0.5 ^ 5000), this loop becomes very slow because of the very\n\t\t// high number of digits it must compute. To prevent that, round x.\n\t\tx.Round(x, s*2, inf.RoundHalfUp)\n\t}\n\n\tif neg {\n\t\tz = z.QuoRound(decimalOne, z, s+2, inf.RoundHalfUp)\n\t}\n\treturn z.Round(z, s, inf.RoundHalfUp)\n}", "func (f Float) floor_int() (int) {\n i := int(f)\n if f < Float(0.0) && f != Float(i) { \n return i - 1\n }\n return i \n}", "func trunc(num float64) int {\n\treturn int(num)\n}", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func (f Fixed) Int() int64 {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.fp / scale\n}", "func maybeFloatToInt(val interface{}) interface{} {\n\tif f64, ok := val.(float64); ok {\n\t\tfloor := math.Floor(f64)\n\t\tif f64-floor == 0 {\n\t\t\treturn int64(floor)\n\t\t}\n\t}\n\n\treturn val\n}", "func (f Number) Int(context.Context) int64 {\n\treturn int64(math.Trunc(float64(f)))\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (z *Rat) SetInt(x *Int) *Rat {}", "func Floor(x float64, unit float64) float64 {\n\tif IsZero(unit) {\n\t\treturn x\n\t}\n\n\tunits := int64((x + unit*e) / unit)\n\treturn float64(units) * unit\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (z *Float) SetInt64(x int64) *Float {}", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func Floor(x float64) float64 {\n\n\treturn math.Floor(x)\n}", "func Pow(z, x, y *inf.Dec, s inf.Scale) (*inf.Dec, error) {\n\ts = s + 2\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t\tz.SetUnscaled(1).SetScale(0)\n\t}\n\n\t// Check if y is of type int.\n\ttmp := new(inf.Dec).Abs(y)\n\tisInt := tmp.Cmp(new(inf.Dec).Round(tmp, 0, inf.RoundDown)) == 0\n\n\txs := x.Sign()\n\tif xs == 0 {\n\t\tswitch y.Sign() {\n\t\tcase 0:\n\t\t\treturn z.SetUnscaled(1).SetScale(0), nil\n\t\tcase 1:\n\t\t\treturn z.SetUnscaled(0).SetScale(0), nil\n\t\tdefault: // -1\n\t\t\t// undefined for y < 0\n\t\t\treturn nil, errPowZeroNegative\n\t\t}\n\t}\n\n\tneg := xs < 0\n\n\tif !isInt && neg {\n\t\treturn nil, errPowNegNonInteger\n\t}\n\n\t// Exponent Precision Explanation (RaduBerinde):\n\t// Say we compute the Log with a scale of k. That means that the result we get is:\n\t// ln x +/- 10^-k.\n\t// This leads to an error of y * 10^-k in the exponent, which leads to a\n\t// multiplicative error of e^(y*10^-k) in the result.\n\t// For small values of u, e^u can be approximated by 1 + u, so for large k\n\t// that error is around 1 + y*10^-k. So the additive error will be x^y * y * 10^-k,\n\t// and we want this to be less than 10^-s. This approximately means that k has to be\n\t// s + the number of digits before the decimal point in x^y. Which roughly is\n\t//\n\t// s + <the number of digits before decimal point in x> * y.\n\t//\n\t// exponent precision = s + <the number of digits before decimal point in x> * y.\n\tnumDigits := float64(x.UnscaledBig().BitLen()) / digitsToBitsRatio\n\tnumDigits -= float64(x.Scale())\n\n\t// Round up y which should provide us with a threshold in calculating the new scale.\n\tyu := float64(new(inf.Dec).Round(y, 0, inf.RoundUp).UnscaledBig().Int64())\n\n\t// exponent precision = s + <the number of digits before decimal point in x> * y\n\tes := s + inf.Scale(numDigits*yu)\n\tif es < 0 || es > maxPrecision {\n\t\treturn nil, errArgumentTooLarge\n\t}\n\n\ttmp = new(inf.Dec).Abs(x)\n\t_, err := Log(tmp, tmp, es)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttmp.Mul(tmp, y)\n\tExp(tmp, tmp, es)\n\n\tif neg && y.Round(y, 0, inf.RoundDown).UnscaledBig().Bit(0) == 1 {\n\t\ttmp.Neg(tmp)\n\t}\n\n\t// Round to the desired scale.\n\treturn z.Round(tmp, s-2, inf.RoundHalfUp), nil\n}", "func ensureInt(x interface{}) int {\n\tres, ok := x.(int)\n\tif !ok {\n\t\tres = int(x.(float64))\n\t}\n\treturn res\n}", "func (f *Float) Floor(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_floor(&f.i[0], &x.i[0])\n\treturn f\n}", "func truncate(x, m int64) int64 {\n\tif m <= 0 {\n\t\treturn x\n\t}\n\treturn x - x%m\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Int) Abs(x *Int) *Int {}", "func (fn *formulaFuncs) ISOdotCEILING(argsList *list.List) formulaArg {\n\tif argsList.Len() == 0 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"ISO.CEILING requires at least 1 argument\")\n\t}\n\tif argsList.Len() > 2 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"ISO.CEILING allows at most 2 arguments\")\n\t}\n\tvar significance float64\n\tnumber := argsList.Front().Value.(formulaArg).ToNumber()\n\tif number.Type == ArgError {\n\t\treturn number\n\t}\n\tif number.Number < 0 {\n\t\tsignificance = -1\n\t}\n\tif argsList.Len() == 1 {\n\t\treturn newNumberFormulaArg(math.Ceil(number.Number))\n\t}\n\tif argsList.Len() > 1 {\n\t\ts := argsList.Back().Value.(formulaArg).ToNumber()\n\t\tif s.Type == ArgError {\n\t\t\treturn s\n\t\t}\n\t\tsignificance = s.Number\n\t\tsignificance = math.Abs(significance)\n\t\tif significance == 0 {\n\t\t\treturn newNumberFormulaArg(significance)\n\t\t}\n\t}\n\tval, res := math.Modf(number.Number / significance)\n\tif res != 0 {\n\t\tif number.Number > 0 {\n\t\t\tval++\n\t\t}\n\t}\n\treturn newNumberFormulaArg(val * significance)\n}", "func (z *Big) RoundToInt() *Big { return z.Context.RoundToInt(z) }", "func CLZ(x int64) (n int)", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (z *Int) Div(x, y *Int) *Int {}", "func IntNeg(z *big.Int, x *big.Int,) *big.Int", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func (f *Float) Trunc(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_trunc(&f.i[0], &x.i[0])\n\treturn f\n}", "func IntAbs(z *big.Int, x *big.Int,) *big.Int", "func FloatAbs(z *big.Float, x *big.Float,) *big.Float", "func IntRem(z *big.Int, x, y *big.Int,) *big.Int", "func FloatMinPrec(x *big.Float,) uint", "func (d Decimal) Floor() Decimal {\n\td.ensureInitialized()\n\n\tif d.exp >= 0 {\n\t\treturn d\n\t}\n\n\texp := big.NewInt(10)\n\n\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\texp.Exp(exp, big.NewInt(-int64(d.exp)), nil)\n\n\tz := new(big.Int).Div(d.value, exp)\n\treturn Decimal{value: z, exp: 0}\n}", "func (d Decimal) Floor() Decimal {\n\td.ensureInitialized()\n\n\tif d.exp >= 0 {\n\t\treturn d\n\t}\n\n\texp := big.NewInt(10)\n\n\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\texp.Exp(exp, big.NewInt(-int64(d.exp)), nil)\n\n\tz := new(big.Int).Div(d.value, exp)\n\treturn Decimal{value: z, exp: 0}\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func FloatSign(x *big.Float,) int", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func Sqrt(x float64) float64 {\n z := 1.0;\n for i := 0; i < 10; i++ {\n fmt.Println(z)\n z -= (z*z - x) / (2*z)\n }\n return z\n}", "func (z *Int) Div(x, y *Int) *Int {\n\tif y.IsZero() || y.Gt(x) {\n\t\treturn z.Clear()\n\t}\n\tif x.Eq(y) {\n\t\treturn z.SetOne()\n\t}\n\t// Shortcut some cases\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() / y.Uint64())\n\t}\n\n\t// At this point, we know\n\t// x/y ; x > y > 0\n\t// See Knuth, Volume 2, section 4.3.1, Algorithm D.\n\n\t// Normalize by shifting divisor left just enough so that its high-order\n\t// bit is on and u left the same amount.\n\t// function nlz do the caculating of the amount and shl do the left operation.\n\ts := nlz(y)\n\txn := shl(x, s, true)\n\tyn := shl(y, s, false)\n\n\t// divKnuth do the division of normalized dividend and divisor with Knuth Algorithm D.\n\tq := divKnuth(xn, yn)\n\n\tz.Clear()\n\tfor i := 0; i < len(q); i++ {\n\t\tz[i/2] = z[i/2] | uint64(q[i])<<(32*(uint64(i)%2))\n\t}\n\n\treturn z\n}", "func f(x int) {\n\tfmt.Printf(\"f(%d)\\n\", x+0/x) // panics if x == 0\n\tdefer fmt.Printf(\"defer %d\\n\", x)\n\tf(x - 1)\n}", "func wrap(x, bound float64) float64 {\n\tif x >= 0 && x < bound {\n\t\treturn x\n\t}\n\tif x = math.Mod(x, bound); x < 0 {\n\t\treturn bound + x\n\t}\n\treturn x\n}", "func (x *Big) Rat(z *big.Rat) *big.Rat {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Rat)\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn z.SetInt64(0)\n\t}\n\n\t// Fast path for decimals <= math.MaxInt64.\n\tif x.IsInt() {\n\t\tif u, ok := x.Int64(); ok {\n\t\t\t// If profiled we can call scalex ourselves and save the overhead of\n\t\t\t// calling Int64. But I doubt it'll matter much.\n\t\t\treturn z.SetInt64(u)\n\t\t}\n\t}\n\n\tnum := new(big.Int)\n\tif x.isCompact() {\n\t\tnum.SetUint64(x.compact)\n\t} else {\n\t\tnum.Set(&x.unscaled)\n\t}\n\tif x.exp > 0 {\n\t\tarith.MulBigPow10(num, num, uint64(x.exp))\n\t}\n\tif x.Signbit() {\n\t\tnum.Neg(num)\n\t}\n\n\tdenom := c.OneInt\n\tif x.exp < 0 {\n\t\tdenom = new(big.Int)\n\t\tif shift, ok := arith.Pow10(uint64(-x.exp)); ok {\n\t\t\tdenom.SetUint64(shift)\n\t\t} else {\n\t\t\tdenom.Set(arith.BigPow10(uint64(-x.exp)))\n\t\t}\n\t}\n\treturn z.SetFrac(num, denom)\n}", "func (n Number) Int() int {\n\tif n == 0 {\n\t\treturn 0\n\t}\n\treturn int(math.Round(float64(n)))\n}", "func Log(z *inf.Dec, x *inf.Dec, s inf.Scale) (*inf.Dec, error) {\n\t// Validate the sign of x.\n\tif x.Sign() <= 0 {\n\t\treturn nil, errors.Errorf(\"natural log of non-positive value: %s\", x)\n\t}\n\n\t// Allocate if needed and make sure args aren't mutated.\n\tx = new(inf.Dec).Set(x)\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t} else {\n\t\tz.SetUnscaled(0).SetScale(0)\n\t}\n\n\t// Use a scale with an arbitrary amount of higher precision for Sqrt and\n\t// QuoRound to achieve precision needed to get correct enough outputs. The\n\t// current algorithm with this extra precision returns results with at least\n\t// the same first 12 digits as postgres for inputs < ~1e-50.\n\tns := s + 20\n\n\tfact := inf.NewDec(2, 0)\n\n\t// Use the Taylor series approximation:\n\t//\n\t// r = (x - 1) / (x + 1)\n\t// ln(x) = 2 * [ r + r^3 / 3 + r^5 / 5 + ... ]\n\n\t// The taylor series of ln(x) converges much faster if 0.9 < x < 1.1. We\n\t// can use the logarithmic identity:\n\t// log_b (sqrt(x)) = log_b (x) / 2\n\t// Thus, successively square-root x until it is in that region. Keep track\n\t// of how many square-rootings were done using fact and multiply at the end.\n\tfor x.Cmp(decimalZeroPtNine) < 0 || x.Cmp(decimalOnePtOne) > 0 {\n\t\tSqrt(x, x, ns)\n\t\tfact.Mul(fact, decimalTwo)\n\t}\n\n\ttmp1 := new(inf.Dec)\n\t// tmp1 = x + 1\n\ttmp1.Add(x, decimalOne)\n\ttmp2 := new(inf.Dec)\n\t// tmp2 = x - 1\n\ttmp2.Sub(x, decimalOne)\n\telem := new(inf.Dec)\n\t// elem = r = (x - 1) / (x + 1)\n\telem.QuoRound(tmp2, tmp1, ns, inf.RoundHalfUp)\n\t// z will be the result. Initialize to elem.\n\tz.Set(elem)\n\tnumerator := new(inf.Dec)\n\t// numerator\n\tnumerator.Set(elem)\n\t// elem = r^2 = ((x - 1) / (x + 1)) ^ 2\n\t// Used since the series uses only odd powers of z.\n\telem.Mul(elem, elem)\n\ttmp1.SetScale(0)\n\n\tfor loop := newLoop(\"log\", x, s, 40); ; {\n\t\t// tmp1 = n, the i'th odd power: 3, 5, 7, 9, etc.\n\t\ttmp1.SetUnscaled(int64(loop.i)*2 + 3)\n\t\t// numerator = r^n\n\t\tnumerator.Mul(numerator, elem)\n\t\t// tmp2 = r^n / n\n\t\ttmp2.QuoRound(numerator, tmp1, ns, inf.RoundHalfUp)\n\t\t// z += r^n / n\n\t\tz.Add(z, tmp2)\n\t\tif loop.done(z) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Undo input range reduction.\n\tz.Mul(z, fact)\n\n\t// Round to the desired scale.\n\treturn z.Round(z, s, inf.RoundHalfUp), nil\n}", "func (z *Float) Set(x *Float) *Float {}", "func absInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func f1(x int) int {\n\treturn x / 3 * 3\n}", "func Abs(z, x *big.Int) *big.Int {\n\treturn z.Abs(x)\n}", "func (z *Big) Modf(x *Big) (int *Big, frac *Big) {\n\tint = z\n\tfrac = new(Big)\n\n\tif x.form == zero {\n\t\tz.form = zero\n\t\tfrac.form = zero\n\t\treturn z, frac\n\t}\n\n\tif x.form == inf {\n\t\tz.form = inf\n\t\tfrac.form = inf\n\t\treturn z, frac\n\t}\n\n\tz.ctx = x.ctx\n\tz.form = finite\n\n\t// Needs proper scale.\n\t// Set frac before z in case z aliases x.\n\tfrac.scale = x.scale\n\tfrac.ctx = x.ctx\n\tfrac.form = finite\n\n\tif x.IsInt() {\n\t\tif x.isCompact() {\n\t\t\tz.compact = x.compact\n\t\t} else {\n\t\t\tz.mantissa.Set(&x.mantissa)\n\t\t}\n\t\tz.scale = 0\n\t\treturn z, frac\n\t}\n\n\tif x.isCompact() {\n\t\ti, f, ok := mod(x.compact, x.scale)\n\t\tif ok {\n\t\t\tz.compact, frac.compact = i, f\n\t\t\tz.scale = 0\n\t\t\treturn z, frac\n\t\t}\n\t}\n\n\tm := &x.mantissa\n\t// Possible fallthrough.\n\tif x.isCompact() {\n\t\tm = big.NewInt(x.compact)\n\t}\n\ti, f := modbig(m, x.scale)\n\tz.compact = c.Inflated\n\tfrac.compact = c.Inflated\n\tz.mantissa.Set(i)\n\tfrac.mantissa.Set(f)\n\tz.scale = 0\n\treturn z, frac\n}", "func Floor(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Floor\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func (z *Int) Abs() *Int {\n\tif z.Lt(SignedMin) {\n\t\treturn z\n\t}\n\tz.Sub(zero, z)\n\treturn z\n}", "func (z *Float) Abs(x *Float) *Float {}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func TruncateFloat(f float64, flen int, decimal int) (float64, error) {\n\tif math.IsNaN(f) {\n\t\t// nan returns 0\n\t\treturn 0, nil\n\t}\n\n\tmaxF := getMaxFloat(flen, decimal)\n\n\tif !math.IsInf(f, 0) {\n\t\tf = truncateFloat(f, decimal)\n\t}\n\n\tif f > maxF {\n\t\tf = maxF\n\t} else if f < -maxF {\n\t\tf = -maxF\n\t}\n\n\treturn f, nil\n}", "func Sqrt(x float64) float64 {\n\tz:=45.0\n\tfor ; z*z-x>0.0000001;{\n\t\tz -= (z*z - x) / (2*z)\n\t\tfmt.Println(z)\n\t}\n\treturn z\n}", "func IntSet(z *big.Int, x *big.Int,) *big.Int", "func reverse(x int) (int, error) {\n\terr := errors.New(\"Integer overflow\")\n\n\tif x > math.MaxInt32 || x < math.MinInt32 {\n\t\treturn 0, err\n\t}\n\n\tsign := 1\n\tif x < 0 {\n\t\tsign *= -1\n\t}\n\tx *= sign\n\trevX := 0\n\tfor x > 0 {\n\t\trevX = revX*10 + x%10\n\t\tx /= 10\n\t}\n\treturn revX * sign, nil\n}", "func Floor(arg float64) float64 {\n\treturn math.Floor(arg)\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t} else {\n\t\treturn x\n\t}\n}", "func FloorAtZero(x *float64) bool {\n\tif *x < 0 {\n\t\t*x = 0.0\n\t\treturn true\n\t}\n\treturn false\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func (f *Float) Ceil(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_ceil(&f.i[0], &x.i[0])\n\treturn f\n}", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (d LegacyDec) TruncateInt() Int {\n\treturn NewIntFromBigInt(chopPrecisionAndTruncateNonMutative(d.i))\n}", "func intRoot(n int) int {\n return int(math.Sqrt(float64(n))) + 1\n}", "func FloatPrec(x *big.Float,) uint", "func ZeroInt(v interface{}) int {\n\ti, err := Int64(v)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn int(i)\n}", "func clamp(x float64) float64 {\n\tif x > 1 {\n\t\treturn 1\n\t}\n\treturn x\n}", "func Ceil(x float64) float64 {\n\n\treturn math.Ceil(x)\n}", "func IntMod(z *big.Int, x, y *big.Int,) *big.Int", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func IntSqrt(z *big.Int, x *big.Int,) *big.Int", "func (z *Rat) SetInt64(x int64) *Rat {}", "func (jz *Jzon) Float() (f float64, err error) {\n\tif jz.Type != JzTypeFlt {\n\t\treturn f, expectTypeOf(JzTypeInt, jz.Type)\n\t}\n\n\treturn jz.data.(float64), nil\n}", "func (r *CatmullRom) Interpolate(x float64) float64 {\n\tb := 0.0\n\tc := 0.5\n\tx = math.Abs(x)\n\n\tif x < 1.0 {\n\t\treturn (6 - 2*b + (-18+12*b+6*c)*math.Pow(x, 2) + (12-9*b-6*c)*math.Pow(x, 3)) / 6\n\t} else if x <= 2.0 {\n\t\treturn (8*b + 24*c + (-12*b-48*c)*x + (6*b+30*c)*math.Pow(x, 2) + (-b-6*c)*math.Pow(x, 3)) / 6\n\t}\n\treturn 0\n}", "func Min(x, min int) int { return x }", "func IntModSqrt(z *big.Int, x, p *big.Int,) *big.Int", "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func (frac Fractal) X(r float64) int {\n\treturn int(frac.xZoom*(r+real(frac.Offset)) + float64(frac.Width)/2.0)\n}", "func (z *Int) Xor(x, y *Int) *Int {}", "func (x *Float) MinPrec() uint {}", "func RatInv(z *big.Rat, x *big.Rat,) *big.Rat", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func Exp(o, z *big.Float) *big.Float {\n\tif o.Prec() == 0 {\n\t\to.SetPrec(z.Prec())\n\t}\n\tif z.Sign() == 0 {\n\t\treturn o.SetFloat64(1)\n\t}\n\tif z.IsInf() {\n\t\tif z.Sign() < 0 {\n\t\t\treturn o.Set(&gzero)\n\t\t}\n\t\treturn o.Set(z)\n\t}\n\n\tp := o\n\tif p == z {\n\t\t// We need z for Newton's algorithm, so ensure we don't overwrite it.\n\t\tp = new(big.Float).SetPrec(z.Prec())\n\t}\n\t// try to get initial estimate using IEEE-754 math\n\t// TODO: save work (and an import of math) by checking the exponent of z\n\tzf, _ := z.Float64()\n\tzf = math.Exp(zf)\n\tif math.IsInf(zf, 1) || zf == 0 {\n\t\t// too big or too small for IEEE-754 math,\n\t\t// perform argument reduction using\n\t\t// e^{2z} = (e^z)²\n\t\thalfZ := quicksh(new(big.Float), z, -1).SetPrec(p.Prec() + 64)\n\t\t// TODO: avoid recursion\n\t\thalfExp := Exp(halfZ, halfZ)\n\t\treturn p.Mul(halfExp, halfExp)\n\t}\n\t// we got a nice IEEE-754 estimate\n\tguess := big.NewFloat(zf)\n\n\t// f(t)/f'(t) = t*(log(t) - z)\n\tf := func(t *big.Float) *big.Float {\n\t\tp.Sub(Log(new(big.Float), t), z)\n\t\treturn p.Mul(p, t)\n\t}\n\n\tx := newton(f, guess, z.Prec()) // TODO: make newton operate in place\n\n\treturn o.Set(x)\n}", "func IntExp(z *big.Int, x, y, m *big.Int,) *big.Int", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setZero(sign, 0)\n\t}\n\tif math.IsNaN(x) {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setNaN(0, qnan|sign, 0)\n\t}\n\tif math.IsInf(x, 0) {\n\t\tif math.IsInf(x, 1) {\n\t\t\tz.form = pinf\n\t\t} else {\n\t\t\tz.form = ninf\n\t\t}\n\t\treturn z\n\t}\n\n\t// The gist of the following is lifted from math/big/rat.go, but adapted for\n\t// base-10 decimals.\n\n\tconst expMask = 1<<11 - 1\n\tbits := math.Float64bits(x)\n\tmantissa := bits & (1<<52 - 1)\n\texp := int((bits >> 52) & expMask)\n\tif exp == 0 { // denormal\n\t\texp -= 1022\n\t} else { // normal\n\t\tmantissa |= 1 << 52\n\t\texp -= 1023\n\t}\n\n\tif mantissa == 0 {\n\t\treturn z.SetUint64(0)\n\t}\n\n\tshift := 52 - exp\n\tfor mantissa&1 == 0 && shift > 0 {\n\t\tmantissa >>= 1\n\t\tshift--\n\t}\n\n\tz.exp = 0\n\tz.form = finite | form(bits>>63)\n\n\tif shift > 0 {\n\t\tz.unscaled.SetUint64(uint64(shift))\n\t\tz.unscaled.Exp(c.FiveInt, &z.unscaled, nil)\n\t\tarith.Mul(&z.unscaled, &z.unscaled, mantissa)\n\t\tz.exp = -shift\n\t} else {\n\t\t// TODO(eric): figure out why this doesn't work for _some_ numbers. See\n\t\t// https://github.com/ericlagergren/decimal/issues/89\n\t\t//\n\t\t// z.compact = mantissa << uint(-shift)\n\t\t// z.precision = arith.Length(z.compact)\n\n\t\tz.compact = c.Inflated\n\t\tz.unscaled.SetUint64(mantissa)\n\t\tz.unscaled.Lsh(&z.unscaled, uint(-shift))\n\t}\n\treturn z.norm()\n}", "func FloatSub(z *big.Float, x, y *big.Float,) *big.Float" ]
[ "0.5891745", "0.5842197", "0.58383715", "0.57142097", "0.5668319", "0.55824393", "0.5520578", "0.5482356", "0.54121065", "0.5408934", "0.5359774", "0.53485197", "0.53456", "0.5337167", "0.52935195", "0.5247217", "0.5238465", "0.5194335", "0.5193267", "0.5169111", "0.5135624", "0.51331", "0.50865173", "0.5058648", "0.5054686", "0.50346863", "0.5025319", "0.49979427", "0.49785724", "0.49740177", "0.4942433", "0.49419367", "0.4931552", "0.48688495", "0.48656437", "0.48634288", "0.48623133", "0.4853825", "0.4818846", "0.48111454", "0.48072588", "0.48072588", "0.4801431", "0.4799735", "0.47946903", "0.4792975", "0.47925395", "0.4787862", "0.47670692", "0.4762053", "0.47528416", "0.4738424", "0.4732628", "0.47285384", "0.47243023", "0.4722999", "0.47093722", "0.47032443", "0.46972984", "0.4691384", "0.46813717", "0.46682855", "0.46604803", "0.46483648", "0.46468914", "0.46404514", "0.46361232", "0.46347797", "0.4634359", "0.46186182", "0.4608705", "0.46069184", "0.45994863", "0.4595385", "0.45923826", "0.45923826", "0.45900306", "0.458769", "0.45830613", "0.45750013", "0.45667475", "0.4557833", "0.45542938", "0.45337993", "0.45250517", "0.45197898", "0.45157886", "0.4513016", "0.45086715", "0.450389", "0.4503566", "0.4493444", "0.44930547", "0.4491218", "0.44908458", "0.44844344", "0.44840747", "0.44807744", "0.44700527", "0.4464166" ]
0.5404971
10
Int64 returns x as an int64, truncating towards zero. The returned boolean indicates whether the conversion to an int64 was successful.
func (x *Big) Int64() (int64, bool) { if debug { x.validate() } if !x.IsFinite() { return 0, false } // x might be too large to fit into an int64 *now*, but rescaling x might // shrink it enough. See issue #20. if !x.isCompact() { xb := x.Int(nil) return xb.Int64(), xb.IsInt64() } u := x.compact if x.exp != 0 { var ok bool if u, ok = scalex(u, x.exp); !ok { return 0, false } } su := int64(u) if su >= 0 || x.Signbit() && su == -su { if x.Signbit() { su = -su } return su, true } return 0, false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsInt64(x *big.Int) bool {\n\treturn x.IsInt64()\n}", "func (x *Int) IsInt64() bool {}", "func AsInt64(val interface{}) (int64, bool) {\n\tswitch val.(type) {\n\tcase int64:\n\t\treturn val.(int64), true\n\tcase int:\n\t\treturn int64(val.(int)), true\n\tcase int32:\n\t\treturn int64(val.(int32)), true\n\tcase int16:\n\t\treturn int64(val.(int16)), true\n\tcase int8:\n\t\treturn int64(val.(int8)), true\n\t}\n\n\treturn 0, false\n}", "func Int64(x *big.Int) int64 {\n\treturn x.Int64()\n}", "func IsInt64(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Int64\n}", "func (num Number) Int64() (int64, bool) {\n\ti, err := json.Number(num).Int64()\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn i, true\n}", "func Int64(tst *testing.T, msg string, val, correct int64) {\n\tif val != correct {\n\t\tPrintFail(\"%s: error %d != %d\\n\", msg, val, correct)\n\t\ttst.Errorf(\"%s failed with: %d != %d\", msg, val, correct)\n\t\treturn\n\t}\n\tPrintOk(\"%s: %d == %d\", msg, val, correct)\n}", "func Int64(any interface{}) int64 {\n\tif any == nil {\n\t\treturn 0\n\t}\n\tswitch value := any.(type) {\n\tcase int:\n\t\treturn int64(value)\n\tcase int8:\n\t\treturn int64(value)\n\tcase int16:\n\t\treturn int64(value)\n\tcase int32:\n\t\treturn int64(value)\n\tcase int64:\n\t\treturn value\n\tcase uint:\n\t\treturn int64(value)\n\tcase uint8:\n\t\treturn int64(value)\n\tcase uint16:\n\t\treturn int64(value)\n\tcase uint32:\n\t\treturn int64(value)\n\tcase uint64:\n\t\treturn int64(value)\n\tcase float32:\n\t\treturn int64(value)\n\tcase float64:\n\t\treturn int64(value)\n\tcase bool:\n\t\tif value {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\tcase []byte:\n\t\treturn gbinary.DecodeToInt64(value)\n\tdefault:\n\t\tif f, ok := value.(iInt64); ok {\n\t\t\treturn f.Int64()\n\t\t}\n\t\tvar (\n\t\t\ts = String(value)\n\t\t\tisMinus = false\n\t\t)\n\t\tif len(s) > 0 {\n\t\t\tif s[0] == '-' {\n\t\t\t\tisMinus = true\n\t\t\t\ts = s[1:]\n\t\t\t} else if s[0] == '+' {\n\t\t\t\ts = s[1:]\n\t\t\t}\n\t\t}\n\t\t// Hexadecimal\n\t\tif len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') {\n\t\t\tif v, e := strconv.ParseInt(s[2:], 16, 64); e == nil {\n\t\t\t\tif isMinus {\n\t\t\t\t\treturn -v\n\t\t\t\t}\n\t\t\t\treturn v\n\t\t\t}\n\t\t}\n\t\t// Decimal\n\t\tif v, e := strconv.ParseInt(s, 10, 64); e == nil {\n\t\t\tif isMinus {\n\t\t\t\treturn -v\n\t\t\t}\n\t\t\treturn v\n\t\t}\n\t\t// Float64\n\t\treturn int64(Float64(value))\n\t}\n}", "func Int64Val(x Value) (int64, bool) {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Int64Val(x)\n}", "func ConvertToInt64(value interface{}) (int64, bool) {\n\tswitch v := value.(type) {\n\tcase int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64:\n\t\tnum := reflect.ValueOf(value).Convert(reflect.TypeOf(int64(0))).Int()\n\t\treturn num, true\n\tcase string:\n\t\tnum, err := strconv.ParseInt(v, 10, 64)\n\t\tif err == nil {\n\t\t\treturn num, true\n\t\t}\n\t}\n\treturn 0, false\n}", "func Int64(r interface{}, err error) (int64, error) {\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tswitch r := r.(type) {\n\tcase int:\n\t\treturn int64(r), nil\n\tcase int64:\n\t\treturn r, nil\n\tcase []byte:\n\t\tn, err := strconv.ParseInt(string(r), 10, 64)\n\t\treturn n, err\n\tcase string:\n\t\tn, err := strconv.ParseInt(r, 10, 64)\n\t\treturn n, err\n\tcase nil:\n\t\treturn 0, simplesessions.ErrNil\n\t}\n\n\treturn 0, simplesessions.ErrAssertType\n}", "func Int64(v interface{}) (int64, error) {\n\tswitch v := v.(type) {\n\tdefault:\n\t\treturn 0, ErrWrongType\n\n\tcase uint:\n\t\tif v > math.MaxInt64 {\n\t\t\tif !allowOverFlow {\n\t\t\t\treturn int64(v), ErrOverflowInt64\n\t\t\t} else if warnOnOverFlow {\n\t\t\t\tlog.Warn(ErrOverflowInt64)\n\t\t\t}\n\t\t}\n\t\treturn int64(v), nil\n\tcase uint64:\n\t\tif v > math.MaxInt64 {\n\t\t\tif !allowOverFlow {\n\t\t\t\treturn int64(v), ErrOverflowInt64\n\t\t\t} else if warnOnOverFlow {\n\t\t\t\tlog.Warn(ErrOverflowInt64)\n\t\t\t}\n\t\t}\n\t\treturn int64(v), nil\n\tcase int:\n\t\treturn int64(v), nil\n\tcase int8:\n\t\treturn int64(v), nil\n\tcase int16:\n\t\treturn int64(v), nil\n\tcase int32:\n\t\treturn int64(v), nil\n\tcase int64:\n\t\treturn int64(v), nil\n\tcase uint8:\n\t\treturn int64(v), nil\n\tcase uint16:\n\t\treturn int64(v), nil\n\tcase uint32:\n\t\treturn int64(v), nil\n\t}\n}", "func (z *Int) Int64() int64 {\n\treturn int64(z[0] & 0x7fffffffffffffff)\n}", "func Int64(v int64) dgo.Integer {\n\treturn intVal(v)\n}", "func isInt64(v *big.Float) bool {\n\tbigInt, accuracy := v.Int(nil)\n\tif accuracy != big.Exact {\n\t\treturn false\n\t}\n\n\treturn bigInt.IsInt64()\n}", "func (r *Result) Int64() int64 {\n\tif r.Error != nil {\n\t\treturn 0\n\t}\n\n\treturn convert.ToInt64(r.Value)\n}", "func Int64(v interface{}) *int64 {\n\tswitch v.(type) {\n\tcase string, int32, int16, int8, int, uint32, uint16, uint8, uint, float32, float64:\n\t\tval := fmt.Sprintf(\"%v\", v)\n\t\tres, err := strconv.ParseInt(val, 10, 64)\n\t\tif err != nil {\n\t\t\texception.Err(err, 500).Ctx(M{\"v\": v}).Throw()\n\t\t}\n\t\treturn &res\n\tcase int64, uint64:\n\t\tres := v.(int64)\n\t\treturn &res\n\tcase bool:\n\t\tval := v.(bool)\n\t\tvar res int64 = 0\n\t\tif val {\n\t\t\tres = 1\n\t\t}\n\t\treturn &res\n\t}\n\treturn nil\n}", "func TestInt64(tst *testing.T) {\n\n\t// Test bool\n\ti, err := StringToInt64(\"187480198367637651\")\n\tbrtesting.AssertEqual(tst, err, nil, \"StringToInt64 failed\")\n\tbrtesting.AssertEqual(tst, i, int64(187480198367637651), \"StringToInt64 failed\")\n\ti, err = StringToInt64(\"go-bedrock\")\n\tbrtesting.AssertNotEqual(tst, err, nil, \"StringToInt64 failed\")\n}", "func Int64(val interface{}) (int64, error) {\n\tstr, err := String(val)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn strconv.ParseInt(str, 10, 64)\n}", "func Int64(v *int64) int64 {\n\tif v != nil {\n\t\treturn *v\n\t}\n\treturn 0\n}", "func (x *Int) IsUint64() bool {}", "func IntToInt64(int_ int) (int64_ int64) {\n\tint64_ = int64(int_)\n\n\treturn\n}", "func Int64(values ...int64) int64 {\n\tfor index := range values {\n\t\tif values[index] != 0 {\n\t\t\treturn values[index]\n\t\t}\n\t}\n\treturn 0\n}", "func convertibleToInt64(v model.SampleValue) bool {\n\treturn v <= maxInt64 && v >= minInt64\n}", "func (n Number) Int64() int64 {\n\treturn int64(n.Int())\n}", "func (n Number) Int64() (int64, error) {\n\treturn strconv.ParseInt(string(n), 10, 64)\n}", "func Int64(i *int64) int64 {\n\tif i == nil {\n\t\treturn 0\n\t}\n\treturn *i\n}", "func parseInt64(s string) (int64, bool) {\n\ti, err := strconv.ParseInt(strings.TrimSpace(s), 10, 64)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn i, true\n}", "func Int64(v *Value, def int64) int64 {\n\ti, err := v.Int64()\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn i\n}", "func Int64(a, b interface{}) int {\n\ti1, _ := a.(int64)\n\ti2, _ := b.(int64)\n\tswitch {\n\tcase i1 < i2:\n\t\treturn -1\n\tcase i1 > i2:\n\t\treturn 1\n\tdefault:\n\t\treturn 0\n\t}\n}", "func (q *Quantity) AsInt64() (int64, bool) {\n\tif q.d.Dec != nil {\n\t\treturn 0, false\n\t}\n\treturn q.i.AsInt64()\n}", "func (i *Int64) Int64() int64 {\n\treturn int64(*i)\n}", "func (c *Const) Int64() int64 {\n\tswitch x := constant.ToInt(c.Value); x.Kind() {\n\tcase constant.Int:\n\t\tif i, ok := constant.Int64Val(x); ok {\n\t\t\treturn i\n\t\t}\n\t\treturn 0\n\tcase constant.Float:\n\t\tf, _ := constant.Float64Val(x)\n\t\treturn int64(f)\n\t}\n\tpanic(fmt.Sprintf(\"unexpected constant value: %T\", c.Value))\n}", "func (x *Int) Int64() int64 {}", "func (r *Reader) Int64() int64 {\n\treturn int64(r.Uint64())\n}", "func ToInt64(in interface{}) int64 {\n\tif i, ok := in.(int64); ok {\n\t\treturn i\n\t}\n\treturn 0\n}", "func (tr Row) Int64(nn int) (val int64) {\n\tval, err := tr.Int64Err(nn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func ZeroInt64(v interface{}) int64 {\n\ti, err := Int64(v)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn i\n}", "func Int64(buf []byte) (v int64, n int) {\n\tu, n := Uint64(buf)\n\treturn int64(u>>1) ^ -int64(u&1), n\n}", "func ValIsInt64(model ModelT, val *YvalT) int32 {\n\treturn int32(C.yices_val_is_int64(ymodel(model), (*C.yval_t)(val)))\n}", "func MinInt64(x, min int64) int64 { return x }", "func toInt64(v interface{}) int64 {\n\treturn cast.ToInt64(v)\n}", "func Is64(t *Type) bool", "func Int64(i64 int64) Val { return Val{t: bsontype.Int64}.writei64(i64) }", "func (c *Cell) Int64() (int64, error) {\n\tf, err := strconv.ParseInt(c.Value, 10, 64)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn f, nil\n}", "func ToInt64(value interface{}) (int64, error) {\n\tvalue = indirect(value)\n\n\tvar s string\n\tswitch v := value.(type) {\n\tcase nil:\n\t\treturn 0, nil\n\tcase bool:\n\t\tif v {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn 0, nil\n\tcase int:\n\t\treturn int64(v), nil\n\tcase int8:\n\t\treturn int64(v), nil\n\tcase int16:\n\t\treturn int64(v), nil\n\tcase int32:\n\t\treturn int64(v), nil\n\tcase int64:\n\t\treturn v, nil\n\tcase uint:\n\t\treturn int64(v), nil\n\tcase uint8:\n\t\treturn int64(v), nil\n\tcase uint16:\n\t\treturn int64(v), nil\n\tcase uint32:\n\t\treturn int64(v), nil\n\tcase uint64:\n\t\treturn int64(v), nil\n\tcase float32:\n\t\treturn int64(v), nil\n\tcase float64:\n\t\treturn int64(v), nil\n\tcase complex64:\n\t\treturn int64(real(v)), nil\n\tcase complex128:\n\t\treturn int64(real(v)), nil\n\tcase []byte:\n\t\ts = string(v)\n\tcase string:\n\t\ts = v\n\tcase fmt.Stringer:\n\t\ts = v.String()\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to int64\", v, v)\n\t}\n\n\tif i, err := strconv.ParseInt(s, 0, 64); err == nil {\n\t\treturn i, nil\n\t}\n\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to int64\", value, value)\n}", "func (v TimestampNano) Int64() int64 {\n\tif !v.Valid() || v.time.UnixNano() == 0 {\n\t\treturn 0\n\t}\n\treturn v.time.UnixNano()\n}", "func (dr DatumRow) GetInt64(colIdx int) (int64, bool) {\n\tdatum := dr[colIdx]\n\tif datum.IsNull() {\n\t\treturn 0, true\n\t}\n\treturn dr[colIdx].GetInt64(), false\n}", "func (e *Encoder) Int64(v int64) (int, error) {\n\treturn e.uint64(uint64(v))\n}", "func (b *Bytes) Int64() int64 {\n\treturn int64(*b)\n}", "func (reply Reply) Int64() (int64, error) {\n\tresult, err := redis.Int64(reply.data, reply.err)\n\tif err != nil {\n\t\treturn 0, redisError(err)\n\t}\n\n\treturn result, nil\n}", "func ToInt(value interface{}) (int64, bool) {\n\tok := true\n\tv := int64(0)\n\tswitch value := value.(type) {\n\tcase intVal:\n\t\tv = int64(value)\n\tcase int:\n\t\tv = int64(value)\n\tcase int64:\n\t\tv = value\n\tcase int32:\n\t\tv = int64(value)\n\tcase int16:\n\t\tv = int64(value)\n\tcase int8:\n\t\tv = int64(value)\n\tcase uint:\n\t\tif value <= math.MaxInt64 {\n\t\t\tv = int64(value)\n\t\t} else {\n\t\t\tok = false\n\t\t}\n\tcase uint64:\n\t\tif value <= math.MaxInt64 {\n\t\t\tv = int64(value)\n\t\t} else {\n\t\t\tok = false\n\t\t}\n\tcase uintVal:\n\t\tif value <= math.MaxInt64 {\n\t\t\tv = int64(value)\n\t\t} else {\n\t\t\tok = false\n\t\t}\n\tcase uint32:\n\t\tv = int64(value)\n\tcase uint16:\n\t\tv = int64(value)\n\tcase uint8:\n\t\tv = int64(value)\n\tcase *big.Int:\n\t\tif value.IsInt64() {\n\t\t\tv = value.Int64()\n\t\t} else {\n\t\t\tok = false\n\t\t}\n\tcase dgo.BigInt:\n\t\tv, ok = value.ToInt()\n\tdefault:\n\t\tok = false\n\t}\n\treturn v, ok\n}", "func Int64Val(i *int64) int64 {\n\tif i == nil {\n\t\treturn 0\n\t}\n\treturn *i\n}", "func (v Timestamp) Int64() int64 {\n\tif !v.Valid() || v.time.Unix() == 0 {\n\t\treturn 0\n\t}\n\treturn v.time.Unix()\n}", "func ToInt64(i interface{}) (int64, error) {\n\ti = indirect(i)\n\n\tswitch s := i.(type) {\n\tcase int64:\n\t\treturn s, nil\n\tcase int:\n\t\treturn int64(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 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 to int64\", i)\n\tcase float64:\n\t\treturn int64(s), nil\n\tcase bool:\n\t\tif s {\n\t\t\treturn int64(1), nil\n\t\t}\n\t\treturn int64(0), nil\n\tcase nil:\n\t\treturn int64(0), nil\n\tdefault:\n\t\treturn int64(0), fmt.Errorf(\"unable to cast %#v to int64\", i)\n\t}\n}", "func OfInt64(value int64) Int64 {\n\treturn Int64{V: value, Set: true}\n}", "func ToInt64(v sqltypes.Value) (int64, error) {\n\tvar num EvalResult\n\tif err := num.setValueIntegralNumeric(v); err != nil {\n\t\treturn 0, err\n\t}\n\tswitch num.typeof() {\n\tcase sqltypes.Int64:\n\t\treturn num.int64(), nil\n\tcase sqltypes.Uint64:\n\t\tival := num.int64()\n\t\tif ival < 0 {\n\t\t\treturn 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"unsigned number overflows int64 value: %d\", num.uint64())\n\t\t}\n\t\treturn ival, nil\n\t}\n\tpanic(\"unreachable\")\n}", "func ToOptionalInt64(value interface{}) (int64, bool) {\n\tv, err := ToInt64(value)\n\treturn v, err == nil\n}", "func ToInt64(value interface{}) (int64, error) {\n\tcast, ok := value.(int64)\n\tif ok {\n\t\treturn cast, nil\n\t}\n\n\t// For sql.NullInt64 and sql.NullFloat64 support.\n\tvaluer, ok := value.(driver.Valuer)\n\tif ok {\n\t\tv, err := valuer.Value()\n\t\tif err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"cannot convert to int64\")\n\t\t}\n\t\tif v == nil {\n\t\t\treturn 0, errors.Errorf(\"cannot convert to int64\")\n\t\t}\n\t\tvalue = v\n\t}\n\n\treflected := reflect.Indirect(reflect.ValueOf(value))\n\n\tif !reflected.IsValid() {\n\t\treturn 0, errors.Errorf(\"invalid value: %v\", value)\n\t}\n\n\tif !reflected.Type().ConvertibleTo(int64Type) {\n\t\treturn 0, errors.Errorf(\"unable to convert %v to int64\", reflected.Type())\n\t}\n\n\treturn reflected.Convert(int64Type).Int(), nil\n}", "func (x *Float) Int64() (int64, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func TernaryInt64(condition bool, trueVal, falseVal int64) int64 {\n\tif condition {\n\t\treturn trueVal\n\t} else {\n\t\treturn falseVal\n\t}\n}", "func Int64(v int) *int64 {\n\tp := int64(v)\n\treturn &p\n}", "func Int64(a string) int64 {\n\tnum, err := strconv.ParseInt(a, 10, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn num\n}", "func IsUint64(x *big.Int) bool {\n\treturn x.IsUint64()\n}", "func (r *Redis) Int64(reply interface{}, err error) (int64, error) {\n\treturn redigo.Int64(reply, err)\n}", "func Int64(flag string, value int64, description string) *int64 {\n\tvar v int64\n\tInt64Var(&v, flag, value, description)\n\treturn &v\n}", "func (s *Streamer) Int64(v int64) *Streamer {\n\tif s.Error != nil {\n\t\treturn s\n\t}\n\ts.onVal()\n\ts.buffer = appendInt64(s.buffer, v)\n\treturn s\n}", "func (c *Cell) Int64() (int64, error) {\n\tif !c.Is(Numeric) {\n\t\treturn 0, fmt.Errorf(\"cell data is not numeric\")\n\t}\n\n\ti, err := strconv.ParseInt(c.data, 10, 64)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to convert cell data to number\")\n\t}\n\treturn i, nil\n}", "func MustToInt64(i interface{}) int64 {\n\tv, _ := ToInt64(i)\n\treturn v\n}", "func (c *ConfigContainer) Int64(key string) (int64, error) {\n\tv, err := c.getData(key)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tswitch val := v.(type) {\n\tcase int:\n\t\treturn int64(val), nil\n\tcase int64:\n\t\treturn val, nil\n\tdefault:\n\t\treturn 0, errors.New(\"not int or int64 value\")\n\t}\n}", "func (i *Number) AsInt64() int64 {\n\treturn int64(i.value)\n}", "func MinMaxInt64(x, min, max int64) int64 { return x }", "func Int64(val int64) TermT {\n\treturn TermT(C.yices_int64(C.int64_t(val)))\n}", "func Int64Value(v *int64) int64 {\n\tif v == nil {\n\t\treturn 0\n\t}\n\n\treturn *v\n}", "func (p *Parser) Int64(i int, context string) int64 {\n\treturn p.NullInt64(i, context).Value\n}", "func (d LegacyDec) TruncateInt64() int64 {\n\tchopped := chopPrecisionAndTruncateNonMutative(d.i)\n\tif !chopped.IsInt64() {\n\t\tpanic(\"Int64() out of bound\")\n\t}\n\treturn chopped.Int64()\n}", "func (size Size) AsInt64() int64 {\n\treturn int64(size)\n}", "func AssertInt64(s string) int64 {\n\tif s == \"\" {\n\t\treturn 0\n\t}\n\ti, err := strconv.ParseInt(s, 0, 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn i\n}", "func (f F128d16) Int64() (int64, error) {\n\tn := f.AsInt64()\n\tif F128d16FromInt64(n) != f {\n\t\treturn 0, errDoesNotFitInInt64\n\t}\n\treturn n, nil\n}", "func (this *DynMap) GetInt64(key string) (int64, bool) {\n\ttmp, ok := this.Get(key)\n\tif !ok {\n\t\treturn -1, ok\n\t}\n\tval, err := ToInt64(tmp)\n\tif err == nil {\n\t\treturn val, true\n\t}\n\treturn -1, false\n}", "func ToInt64(i interface{}) int64 {\n\treturn cast.ToInt64(i)\n}", "func uint64IsZero(x uint64) int {\r\n\tx = ^x\r\n\tx &= x >> 32\r\n\tx &= x >> 16\r\n\tx &= x >> 8\r\n\tx &= x >> 4\r\n\tx &= x >> 2\r\n\tx &= x >> 1\r\n\treturn int(x & 1)\r\n}", "func (bn BlockNumber) Int64() int64 {\n\tif bn < 0 {\n\t\treturn 0\n\t} else if bn == 0 {\n\t\treturn 1\n\t}\n\n\treturn int64(bn)\n}", "func AsInt64(v interface{}) int64 {\n\tswitch v.(type) {\n\tcase int:\n\t\treturn int64(v.(int))\n\tcase int8:\n\t\treturn int64(v.(int8))\n\tcase int16:\n\t\treturn int64(v.(int16))\n\tcase int32:\n\t\treturn int64(v.(int32))\n\tcase int64:\n\t\treturn v.(int64)\n\tcase uint:\n\t\treturn int64(v.(uint))\n\tcase uint8:\n\t\treturn int64(v.(uint8))\n\tcase uint16:\n\t\treturn int64(v.(uint16))\n\tcase uint32:\n\t\treturn int64(v.(uint32))\n\tcase uint64:\n\t\treturn int64(v.(uint64))\n\tcase float32:\n\t\treturn int64(v.(float32))\n\tcase float64:\n\t\treturn int64(v.(float64))\n\tcase []byte:\n\t\tf, e := strconv.ParseFloat(string(v.([]byte)), 64)\n\t\tif e == nil {\n\t\t\treturn int64(f)\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\tcase string:\n\t\tf, e := strconv.ParseFloat(v.(string), 64)\n\t\tif e == nil {\n\t\t\treturn int64(f)\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\tcase bool:\n\t\tif v.(bool) {\n\t\t\treturn 1\n\t\t} else {\n\t\t\treturn 0\n\t\t}\n\tdefault:\n\t\treturn 0\n\t}\n}", "func AbsInt64(v int64) int64 {\n\ty := v >> 63 // y ← x >> 63\n\treturn (v ^ y) - y // (x ⨁ y) - y\n}", "func (tr Row) ForceInt64(nn int) (val int64) {\n\tval, _ = tr.Int64Err(nn)\n\treturn\n}", "func MustInt64(data interface{}, err error) int64 {\n\tn, err := Int64(data, err)\n\tcheck(err, \"MustInt64\", data)\n\treturn n\n}", "func (res Response) AsInt64() (int64, error) {\n\treturn res.Bits.AsInt64(), res.Error\n}", "func SafeInt64(value uint64) (int64, error) {\n\tif value > uint64(math.MaxInt64) {\n\t\treturn 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, \"uint64 value %v cannot exceed %v\", value, int64(math.MaxInt64))\n\t}\n\n\treturn int64(value), nil\n}", "func (no *Node) Int64() (int64, error) {\n\tvar out int64\n\tif err := binary.Read(no.buf, binary.LittleEndian, &out); err != nil {\n\t\treturn 0, err\n\t}\n\treturn out, nil\n}", "func (r *Response) Int64() (int64, error) {\n\treturn strconv.ParseInt(r.String(), 10, 64)\n}", "func uint64IsZero(x uint64) int {\n\tx = ^x\n\tx &= x >> 32\n\tx &= x >> 16\n\tx &= x >> 8\n\tx &= x >> 4\n\tx &= x >> 2\n\tx &= x >> 1\n\treturn int(x & 1)\n}", "func IfInt64(condition bool, defaultValue int64, ifFalse int64) int64 {\n\tif condition {\n\t\treturn defaultValue\n\t}\n\n\treturn ifFalse\n}", "func (d DataView) Int64(offset uint, littleEndian bool) int64 {\n\tvar decoding binary.ByteOrder\n\tif littleEndian {\n\t\tdecoding = binary.LittleEndian\n\t} else {\n\t\tdecoding = binary.BigEndian\n\t}\n\treturn int64(decoding.Uint64(d[offset:]))\n}", "func Int64(v int64) *int64 {\n\treturn &v\n}", "func Int64(v int64) *int64 {\n\treturn &v\n}", "func Int64(v int64) *int64 {\n\treturn &v\n}", "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() == true {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\tdefault:\n\t\treturn 0\n\t}\n}", "func NullableInt64(value interface{}) nulls.Int64 {\n\ti, ok := value.(int64)\n\tif !ok {\n\t\treturn nulls.Int64{}\n\t}\n\treturn nulls.NewInt64(i)\n}", "func Int64(key string) (value int64, err error) {\n\treturn strconv.ParseInt(fmt.Sprint(Get(key)), 10, 64)\n}" ]
[ "0.74957633", "0.7358272", "0.73101777", "0.7193197", "0.7080008", "0.70770097", "0.70752776", "0.7023111", "0.69888866", "0.69823414", "0.68923175", "0.68744254", "0.6852106", "0.68443376", "0.6838524", "0.67761654", "0.6774245", "0.67455125", "0.6726367", "0.66730005", "0.6653175", "0.6612711", "0.6601484", "0.65970063", "0.6571466", "0.65698767", "0.65675783", "0.65453017", "0.65451086", "0.6542084", "0.654144", "0.6538014", "0.65348893", "0.644634", "0.64248353", "0.64221513", "0.64187086", "0.6376773", "0.63762903", "0.63611966", "0.6351325", "0.6334959", "0.6329903", "0.63249403", "0.6310373", "0.6295608", "0.6293086", "0.6292284", "0.6283189", "0.6281688", "0.6276803", "0.62754387", "0.6268042", "0.62601", "0.62580323", "0.6251864", "0.62302804", "0.6226481", "0.621384", "0.6213082", "0.6198931", "0.618093", "0.61800987", "0.61758953", "0.6174728", "0.61730766", "0.6169857", "0.61624956", "0.6160305", "0.61584145", "0.61550456", "0.61453736", "0.6139946", "0.61321574", "0.613125", "0.61251855", "0.6116625", "0.6112442", "0.61109555", "0.61098915", "0.60944945", "0.6094216", "0.6071428", "0.6047654", "0.604663", "0.60337484", "0.6031117", "0.60257477", "0.6019851", "0.601941", "0.60158896", "0.60073304", "0.5993801", "0.59894234", "0.5984235", "0.5984235", "0.5984235", "0.59830034", "0.59809464", "0.5978603" ]
0.7898785
0
Uint64 returns x as a uint64, truncating towards zero. The returned boolean indicates whether the conversion to a uint64 was successful.
func (x *Big) Uint64() (uint64, bool) { if debug { x.validate() } if !x.IsFinite() || x.Signbit() { return 0, false } // x might be too large to fit into an uint64 *now*, but rescaling x might // shrink it enough. See issue #20. if !x.isCompact() { xb := x.Int(nil) return xb.Uint64(), xb.IsUint64() } b := x.compact if x.exp == 0 { return b, true } return scalex(b, x.exp) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsUint64(x *big.Int) bool {\n\treturn x.IsUint64()\n}", "func (x *Int) IsUint64() bool {}", "func (z *Int) IsUint64() bool {\n\treturn (z[3] == 0) && (z[2] == 0) && (z[1] == 0)\n}", "func Uint64Val(x Value) (uint64, bool) {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Uint64Val(x)\n}", "func IsUint64(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Uint64\n}", "func (z *Int) Uint64WithOverflow() (uint64, bool) {\n\treturn z[0], z[1] != 0 || z[2] != 0 || z[3] != 0\n}", "func (n *Uint256) IsUint64() bool {\n\treturn (n.n[1] | n.n[2] | n.n[3]) == 0\n}", "func Uint64(val interface{}) uint64 {\r\n\r\n\tswitch t := val.(type) {\r\n\tcase int:\r\n\t\treturn uint64(t)\r\n\tcase int8:\r\n\t\treturn uint64(t)\r\n\tcase int16:\r\n\t\treturn uint64(t)\r\n\tcase int32:\r\n\t\treturn uint64(t)\r\n\tcase int64:\r\n\t\treturn uint64(t)\r\n\tcase uint:\r\n\t\treturn uint64(t)\r\n\tcase uint8:\r\n\t\treturn uint64(t)\r\n\tcase uint16:\r\n\t\treturn uint64(t)\r\n\tcase uint32:\r\n\t\treturn uint64(t)\r\n\tcase uint64:\r\n\t\treturn uint64(t)\r\n\tcase float32:\r\n\t\treturn uint64(t)\r\n\tcase float64:\r\n\t\treturn uint64(t)\r\n\tcase bool:\r\n\t\tif t == true {\r\n\t\t\treturn uint64(1)\r\n\t\t}\r\n\t\treturn uint64(0)\r\n\tdefault:\r\n\t\ts := String(val)\r\n\t\ti, _ := strconv.ParseUint(s, 10, 64)\r\n\t\treturn i\r\n\t}\r\n\r\n\tpanic(\"Reached\")\r\n\r\n}", "func Uint64(u *uint64) uint64 {\n\tif u == nil {\n\t\treturn 0\n\t}\n\treturn *u\n}", "func Uint64(x *big.Int) uint64 {\n\treturn x.Uint64()\n}", "func (dr DatumRow) GetUint64(colIdx int) (uint64, bool) {\n\tdatum := dr[colIdx]\n\tif datum.IsNull() {\n\t\treturn 0, true\n\t}\n\treturn dr[colIdx].GetUint64(), false\n}", "func Uint64(v *uint64) uint64 {\n\tif v != nil {\n\t\treturn *v\n\t}\n\treturn 0\n}", "func UInt64(r interface{}, err error) (uint64, error) {\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tswitch r := r.(type) {\n\tcase uint64:\n\t\treturn r, err\n\tcase int:\n\t\tif r < 0 {\n\t\t\treturn 0, simplesessions.ErrAssertType\n\t\t}\n\t\treturn uint64(r), nil\n\tcase int64:\n\t\tif r < 0 {\n\t\t\treturn 0, simplesessions.ErrAssertType\n\t\t}\n\t\treturn uint64(r), nil\n\tcase []byte:\n\t\tn, err := strconv.ParseUint(string(r), 10, 64)\n\t\treturn n, err\n\tcase string:\n\t\tn, err := strconv.ParseUint(r, 10, 64)\n\t\treturn n, err\n\tcase nil:\n\t\treturn 0, simplesessions.ErrNil\n\t}\n\n\treturn 0, simplesessions.ErrAssertType\n}", "func (u Uint64) Uint64() uint64 {\n\treturn uint64(u)\n}", "func Uint64(input []byte, startBitPos int) (result uint64, resultPtr *uint64, err error) {\n\tif Len(input)-startBitPos < 64 {\n\t\treturn 0, nil, errors.New(\"Input is less than 64 bits\")\n\t}\n\n\ttmpArr, _, err := SubBits(input, startBitPos, 64)\n\tresult = binary.BigEndian.Uint64(tmpArr)\n\n\treturn result, &result, err\n}", "func BoolTouint64(value bool) uint64 {\n\tif value {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func ConvertToUint64(value interface{}) (uint64, bool) {\n\tswitch v := value.(type) {\n\tcase int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64:\n\t\tnum := reflect.ValueOf(value).Convert(reflect.TypeOf(uint64(0))).Uint()\n\t\treturn num, true\n\tcase string:\n\t\tnum, err := strconv.ParseUint(v, 10, 64)\n\t\tif err == nil {\n\t\t\treturn num, true\n\t\t}\n\t}\n\treturn 0, false\n}", "func Uint64(v interface{}) (uint64, error) {\n\tvar err error\n\tv = indirect(v)\n\n\tswitch n := v.(type) {\n\tcase int8:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int16:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int32:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int64:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase uint8:\n\t\treturn uint64(n), err\n\tcase uint16:\n\t\treturn uint64(n), err\n\tcase uint32:\n\t\treturn uint64(n), err\n\tcase uint64:\n\t\treturn n, err\n\tcase uint:\n\t\treturn uint64(n), err\n\t}\n\n\treturn 0, InvalidTypeError{ToType: \"uint64\", Value: v}\n}", "func LookupUint64(key string) (uint64, bool) {\n\tv, find := Lookup(key)\n\treturn toUint64(v), find\n}", "func (x *Float) Uint64() (uint64, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func Uint64(a, b interface{}) int {\n\tu1, _ := a.(uint64)\n\tu2, _ := b.(uint64)\n\tswitch {\n\tcase u1 < u2:\n\t\treturn -1\n\tcase u1 > u2:\n\t\treturn 1\n\tdefault:\n\t\treturn 0\n\t}\n}", "func (tr Row) Uint64(nn int) (val uint64) {\n\tval, err := tr.Uint64Err(nn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func Uint64(flag string, value uint64, description string) *uint64 {\n\tvar v uint64\n\tUint64Var(&v, flag, value, description)\n\treturn &v\n}", "func uint64IsZero(x uint64) int {\r\n\tx = ^x\r\n\tx &= x >> 32\r\n\tx &= x >> 16\r\n\tx &= x >> 8\r\n\tx &= x >> 4\r\n\tx &= x >> 2\r\n\tx &= x >> 1\r\n\treturn int(x & 1)\r\n}", "func (res Response) AsUInt64() (uint64, error) {\n\treturn res.Bits.AsUInt64(), res.Error\n}", "func (i *UInt64) UInt64() uint64 {\n\treturn uint64(*i)\n}", "func ToUint64(v sqltypes.Value) (uint64, error) {\n\tvar num EvalResult\n\tif err := num.setValueIntegralNumeric(v); err != nil {\n\t\treturn 0, err\n\t}\n\tswitch num.typeof() {\n\tcase sqltypes.Int64:\n\t\tif num.uint64() > math.MaxInt64 {\n\t\t\treturn 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"negative number cannot be converted to unsigned: %d\", num.int64())\n\t\t}\n\t\treturn num.uint64(), nil\n\tcase sqltypes.Uint64:\n\t\treturn num.uint64(), nil\n\t}\n\tpanic(\"unreachable\")\n}", "func (x *Int) Uint64() uint64 {}", "func (rng *splitMix64Source) Uint64() uint64 {\n\trng.state += 0x9E3779B97F4A7C15\n\tz := rng.state\n\tz = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9\n\tz = (z ^ (z >> 27)) * 0x94D049BB133111EB\n\treturn z ^ (z >> 31)\n}", "func ToUint64(value interface{}) (uint64, error) {\n\tvalue = indirect(value)\n\n\tvar s string\n\tswitch v := value.(type) {\n\tcase nil:\n\t\treturn 0, nil\n\tcase bool:\n\t\tif v {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn 0, nil\n\tcase int:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int8:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int16:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int32:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int64:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase uint:\n\t\treturn uint64(v), nil\n\tcase uint8:\n\t\treturn uint64(v), nil\n\tcase uint16:\n\t\treturn uint64(v), nil\n\tcase uint32:\n\t\treturn uint64(v), nil\n\tcase uint64:\n\t\treturn v, nil\n\tcase float32:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase float64:\n\t\tif v < 0 {\n\t\t\treturn 0, errNegativeNotAllowed\n\t\t}\n\t\treturn uint64(v), nil\n\tcase complex64:\n\t\treturn uint64(real(v)), nil\n\tcase complex128:\n\t\treturn uint64(real(v)), nil\n\tcase []byte:\n\t\ts = string(v)\n\tcase string:\n\t\ts = v\n\tcase fmt.Stringer:\n\t\ts = v.String()\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to uint64\", v, v)\n\t}\n\n\tif i, err := strconv.ParseUint(s, 0, 64); err == nil {\n\t\treturn i, nil\n\t}\n\treturn 0, fmt.Errorf(\"unable to cast %#v of type %T to uint64\", value, value)\n}", "func (tr Row) ForceUint64(nn int) (val uint64) {\n\tval, _ = tr.Uint64Err(nn)\n\treturn\n}", "func uint64IsZero(x uint64) int {\n\tx = ^x\n\tx &= x >> 32\n\tx &= x >> 16\n\tx &= x >> 8\n\tx &= x >> 4\n\tx &= x >> 2\n\tx &= x >> 1\n\treturn int(x & 1)\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn ex.FlagSet.Uint64(name, value, usage)\n}", "func (rng *Rng) Uint64() uint64 {\n\trng.State += 0x9E3779B97F4A7C15\n\tz := rng.State\n\tz = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9\n\tz = (z ^ (z >> 27)) * 0x94D049BB133111EB\n\treturn z ^ (z >> 31)\n}", "func Uint64Value(b bitarray.BitArray, length uint64) (uint64, error) {\n\tres := uint64(0)\n\n\tfor i := uint64(0); i < length; i++ {\n\t\tbit, err := b.GetBit(i)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tres <<= 1\n\t\tif bit {\n\t\t\tres |= 1\n\t\t}\n\t}\n\n\treturn res, nil\n}", "func (ob *PyObject) Uint64() uint64 {\n\treturn uint64(C.PyLong_AsUnsignedLongLong(ob.rawptr))\n}", "func (f *FlagSet) Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\tp := new(uint64)\n\tf.Uint64Var(p, name, alias, value, usage, fn)\n\treturn p\n}", "func UInt64(v uint64) *uint64 {\n\treturn &v\n}", "func Uint64(v uint64) *uint64 {\n\treturn &v\n}", "func Uint64(v uint64) *uint64 {\n\treturn &v\n}", "func (td TupleDesc) GetUint64(i int, tup Tuple) (v uint64, ok bool) {\n\ttd.expectEncoding(i, Uint64Enc)\n\tb := td.GetField(i, tup)\n\tif b != nil {\n\t\tv, ok = readUint64(b), true\n\t}\n\treturn\n}", "func Uint64(uint64 uint64) *uint64 {\n\treturn &uint64\n}", "func (x *Secp256k1N) Uint64() uint64 {\n\treturn x.limbs[0] + (x.limbs[1]&0xfff)<<52\n}", "func (id *Id) Uint64() uint64 {\n\treturn uint64(*id)\n}", "func (p *PCG64) Uint64() uint64 {\n\tp.multiply()\n\tp.add()\n\t// XOR high and low 64 bits together and rotate right by high 6 bits of state.\n\treturn bits.RotateLeft64(p.high^p.low, -int(p.high>>58))\n}", "func (i *Int64) UInt64() uint64 {\n\treturn uint64(*i)\n}", "func Uint64Value(v *uint64) uint64 {\n\tif v != nil {\n\t\treturn *v\n\t}\n\treturn 0\n}", "func (s *OptionalUInt64) UInt64() uint64 {\n\treturn s.Value\n}", "func (s *Streamer) Uint64(v uint64) *Streamer {\n\tif s.Error != nil {\n\t\treturn s\n\t}\n\ts.onVal()\n\ts.buffer = appendUint64(s.buffer, v)\n\treturn s\n}", "func (c *DChUInt64) TryUInt64() (dat uint64, open bool) {\n\tc.req <- struct{}{}\n\tdat, open = <-c.dat\n\treturn dat, open\n}", "func u64(wr *wrappers.UInt64Value) *uint64 {\n\tif wr == nil {\n\t\treturn nil\n\t}\n\tresult := new(uint64)\n\t*result = wr.GetValue()\n\n\treturn result\n}", "func (c *SChUInt64) TryUInt64() (dat uint64, open bool) {\n\t// eq <- struct{}{}\n\tdat, open = <-c.dat\n\treturn dat, open\n}", "func Uint64(list []uint64, value uint64) bool {\n\tfor _, item := range list {\n\t\tif item == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d *Decoder) Uint64() uint64 {\n\tdata := d.tmp[:8]\n\tn, err := d.buf.Read(data)\n\tif n < 8 || err != nil {\n\t\tpanic(\"unmarshalUint64\")\n\t}\n\treturn binary.LittleEndian.Uint64(data)\n}", "func Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\treturn CommandLine.Uint64(name, alias, value, usage, fn)\n}", "func GetUint64FromConstant(expr Expression) (uint64, bool, bool) {\n\ttrace_util_0.Count(_util_00000, 221)\n\tcon, ok := expr.(*Constant)\n\tif !ok {\n\t\ttrace_util_0.Count(_util_00000, 225)\n\t\tlogutil.Logger(context.Background()).Warn(\"not a constant expression\", zap.String(\"expression\", expr.ExplainInfo()))\n\t\treturn 0, false, false\n\t}\n\ttrace_util_0.Count(_util_00000, 222)\n\tdt := con.Value\n\tif con.DeferredExpr != nil {\n\t\ttrace_util_0.Count(_util_00000, 226)\n\t\tvar err error\n\t\tdt, err = con.DeferredExpr.Eval(chunk.Row{})\n\t\tif err != nil {\n\t\t\ttrace_util_0.Count(_util_00000, 227)\n\t\t\tlogutil.Logger(context.Background()).Warn(\"eval deferred expr failed\", zap.Error(err))\n\t\t\treturn 0, false, false\n\t\t}\n\t}\n\ttrace_util_0.Count(_util_00000, 223)\n\tswitch dt.Kind() {\n\tcase types.KindNull:\n\t\ttrace_util_0.Count(_util_00000, 228)\n\t\treturn 0, true, true\n\tcase types.KindInt64:\n\t\ttrace_util_0.Count(_util_00000, 229)\n\t\tval := dt.GetInt64()\n\t\tif val < 0 {\n\t\t\ttrace_util_0.Count(_util_00000, 232)\n\t\t\treturn 0, false, false\n\t\t}\n\t\ttrace_util_0.Count(_util_00000, 230)\n\t\treturn uint64(val), false, true\n\tcase types.KindUint64:\n\t\ttrace_util_0.Count(_util_00000, 231)\n\t\treturn dt.GetUint64(), false, true\n\t}\n\ttrace_util_0.Count(_util_00000, 224)\n\treturn 0, false, false\n}", "func UInt64(list []uint64, element uint64) (int, bool) {\n\tleft := 0\n\tright := len(list) - 1\n\tfor left <= right {\n\t\tmiddle := (left + right) / 2\n\t\tvalue := list[middle]\n\t\tif element > value {\n\t\t\tleft = middle + 1\n\t\t} else if element < value {\n\t\t\tright = middle - 1\n\t\t} else {\n\t\t\treturn middle, true\n\t\t}\n\t}\n\treturn left, false\n}", "func (c *Const) Uint64() uint64 {\n\tswitch x := constant.ToInt(c.Value); x.Kind() {\n\tcase constant.Int:\n\t\tif u, ok := constant.Uint64Val(x); ok {\n\t\t\treturn u\n\t\t}\n\t\treturn 0\n\tcase constant.Float:\n\t\tf, _ := constant.Float64Val(x)\n\t\treturn uint64(f)\n\t}\n\tpanic(fmt.Sprintf(\"unexpected constant value: %T\", c.Value))\n}", "func (sm64 *splitMix64) Uint64() uint64 {\n\tsm64.state = sm64.state + uint64(0x9E3779B97F4A7C15)\n\tz := sm64.state\n\tz = (z ^ (z >> 30)) * uint64(0xBF58476D1CE4E5B9)\n\tz = (z ^ (z >> 27)) * uint64(0x94D049BB133111EB)\n\treturn z ^ (z >> 31)\n\n}", "func (y *Yaml) Uint64() (uint64, error) {\n\tswitch y.data.(type) {\n\tcase float32, float64:\n\t\treturn uint64(reflect.ValueOf(y.data).Float()), nil\n\tcase int, int8, int16, int32, int64:\n\t\treturn uint64(reflect.ValueOf(y.data).Int()), nil\n\t}\n\treturn 0, errors.New(\"invalid value type\")\n}", "func (elt *Element) Uint64(defaultValue ...uint64) (uint64, error) {\n\tdefValue := func() *uint64 {\n\t\tif len(defaultValue) == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn &defaultValue[0]\n\t}\n\tdef := defValue()\n\tif elt.Value == nil {\n\t\tdef := defValue()\n\t\tif def == nil {\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongPathError(elt.Path)\n\t\t}\n\t\treturn *def, nil\n\t}\n\tv, ok := elt.Value.(uint64)\n\tif !ok {\n\t\tif def == nil{\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongTypeError(\"uint64\", elt.Value)\n\t\t}\n\t\treturn *def, nil\n\t}\n\treturn v, nil\n}", "func Uint64(name string, defaultValue uint64) uint64 {\n\tif strVal, ok := os.LookupEnv(name); ok {\n\t\tif i64, err := strconv.ParseUint(strVal, 10, 64); err == nil {\n\t\t\treturn i64\n\t\t}\n\t}\n\n\treturn defaultValue\n}", "func (o *FakeObject) Uint64() uint64 { return o.Value.(uint64) }", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn Environment.Uint64(name, value, usage)\n}", "func (w *ByteWriter) MustWriteUint64(val uint64, offset int) int {\n\treturn w.MustWriteVal(val, offset)\n}", "func (obj *Value) GetUint64() uint64 {\n\treturn obj.Candy().Guify(\"g_value_get_uint64\", obj).MustUint64()\n}", "func opUI64Eq(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) == ReadUI64(fp, expr.Inputs[1])\n\tWriteBool(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func CheckErrUint64(value string, err error) *wrappers.UInt64Value {\n\tif err == nil && value != \"\" {\n\t\tvar i uint64\n\t\ti, err = strconv.ParseUint(value, 10, 64)\n\t\tif err == nil {\n\t\t\treturn &wrappers.UInt64Value{Value: i}\n\t\t}\n\t}\n\n\treturn nil\n}", "func Uint64(n, min, max uint64) uint64 {\n\tif n < min {\n\t\tn = min\n\t} else if n > max {\n\t\tn = max\n\t}\n\treturn n\n}", "func (ic *Counter) Uint64() uint64 {\n\treturn atomic.AddUint64((*uint64)(ic), 0)\n}", "func (s STags) LookupUint64(tag string, fields ...string) (value uint64, ok bool) {\n\tn, ok := s.getNum(vUINT64, tag, fields...)\n\tif ok {\n\t\tvalue = n.(uint64)\n\t}\n\treturn\n}", "func (a *Address) uint64() uint64 {\n\tv := binary.BigEndian.Uint64(a[:])\n\treturn v\n}", "func (r *Rand) Uint64() uint64 {\n\tif x, err := r.cryptoRand.Uint64(); err == nil {\n\t\treturn x\n\t}\n\treturn r.mathRand.Uint64()\n}", "func (r *Decoder) Uint64() uint64 {\n\tr.Sync(SyncUint64)\n\treturn r.rawUvarint()\n}", "func Uint64Arg(register Register, name string, options ...ArgOptionApplyer) *uint64 {\n\tp := new(uint64)\n\t_ = Uint64ArgVar(register, p, name, options...)\n\treturn p\n}", "func (d DataView) Uint64(offset uint, littleEndian bool) uint64 {\n\tvar decoding binary.ByteOrder\n\tif littleEndian {\n\t\tdecoding = binary.LittleEndian\n\t} else {\n\t\tdecoding = binary.BigEndian\n\t}\n\treturn decoding.Uint64(d[offset:])\n}", "func (n *Uint256) Uint64() uint64 {\n\treturn n.n[0]\n}", "func (o *OutputState) ApplyUint64(applier interface{}) Uint64Output {\n\treturn o.ApplyT(applier).(Uint64Output)\n}", "func (r Row) GetUint64(colIdx int) uint64 {\n\treturn r.c.columns[colIdx].GetUint64(r.idx)\n}", "func (pcg *PCGSource) Uint64() uint64 {\n\tpcg.multiply()\n\tpcg.add()\n\t// XOR high and low 64 bits together and rotate right by high 6 bits of state.\n\treturn bits.RotateLeft64(pcg.high^pcg.low, -int(pcg.high>>58))\n}", "func (bh *bh_rng) Uint64() (v uint64) {\n\tbinary.Read(bh, binary.BigEndian, &v)\n\treturn\n}", "func anyToUint64(i interface{}, def ...uint64) uint64 {\n\tvar defV uint64 = 0\n\tif len(def) > 0 {\n\t\tdefV = def[0]\n\t}\n\tif i == nil {\n\t\treturn defV\n\t}\n\tswitch value := i.(type) {\n\tcase int:\n\t\treturn uint64(value)\n\tcase int8:\n\t\treturn uint64(value)\n\tcase int16:\n\t\treturn uint64(value)\n\tcase int32:\n\t\treturn uint64(value)\n\tcase int64:\n\t\treturn uint64(value)\n\tcase uint:\n\t\treturn uint64(value)\n\tcase uint8:\n\t\treturn uint64(value)\n\tcase uint16:\n\t\treturn uint64(value)\n\tcase uint32:\n\t\treturn uint64(value)\n\tcase uint64:\n\t\treturn value\n\tcase float32:\n\t\treturn uint64(value)\n\tcase float64:\n\t\treturn uint64(value)\n\tcase bool:\n\t\tif value {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\tcase []byte:\n\t\treturn decodeToUint64(value)\n\tdefault:\n\t\ts := anyToString(value)\n\t\t// Hexadecimal\n\t\tif len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') {\n\t\t\tif v, e := strconv.ParseUint(s[2:], 16, 64); e == nil {\n\t\t\t\treturn v\n\t\t\t}\n\t\t}\n\t\t// Octal\n\t\tif len(s) > 1 && s[0] == '0' {\n\t\t\tif v, e := strconv.ParseUint(s[1:], 8, 64); e == nil {\n\t\t\t\treturn v\n\t\t\t}\n\t\t}\n\t\t// Decimal\n\t\tif v, e := strconv.ParseUint(s, 10, 64); e == nil {\n\t\t\treturn v\n\t\t}\n\t\t// Float64\n\t\treturn uint64(anyToFloat64(value))\n\t}\n}", "func ToUint64(v sqltypes.Value) (uint64, error) {\n\tnum, err := valueToEvalNumeric(v)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tswitch num := num.(type) {\n\tcase *evalInt64:\n\t\tif num.i < 0 {\n\t\t\treturn 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"negative number cannot be converted to unsigned: %d\", num.i)\n\t\t}\n\t\treturn uint64(num.i), nil\n\tcase *evalUint64:\n\t\treturn num.u, nil\n\tdefault:\n\t\treturn 0, vterrors.Errorf(vtrpcpb.Code_INTERNAL, \"unexpected return from numeric evaluation (%T)\", num)\n\t}\n}", "func (p *siprng) Uint64() uint64 {\n\tp.mu.Lock()\n\tif p.ctr == 0 || p.ctr > 8*1024*1024 {\n\t\tp.rekey()\n\t}\n\tv := siphash(p.k0, p.k1, p.ctr)\n\tp.ctr++\n\tp.mu.Unlock()\n\treturn v\n}", "func (s *EnvVarSet) Uint64(name string, value uint64, usage string) *uint64 {\n\tp := new(uint64)\n\n\ts.Uint64Var(p, name, value, usage)\n\n\treturn p\n}", "func Uint64(num uint64) *cells.BinaryCell {\n\treturn cells.New(OpUint64, proto.EncodeVarint(num))\n}", "func (d *Data) GetUint64(key string, defaultValue uint64) uint64 {\n\tval, err := d.Get(key)\n\tif err != nil {\n\t\treturn defaultValue\n\t}\n\n\tres, ok := val.(uint64)\n\tif !ok {\n\t\treturn defaultValue\n\t}\n\n\treturn res\n}", "func (z *Int) LtUint64(n uint64) bool {\n\treturn (z[3] == 0) && (z[2] == 0) && (z[1] == 0) && z[0] < n\n}", "func Uint64(buf []byte) (v uint64, n int) {\n\tv = binary.LittleEndian.Uint64(buf)\n\n\ttz := bits.TrailingZeros64(v)\n\tif tz > 7 {\n\t\tv = binary.LittleEndian.Uint64(buf[1:])\n\t\treturn v, 9\n\t}\n\n\tv &= readMasks[tz]\n\n\tsize := tz + 1\n\tv >>= uint(size)\n\treturn v, size\n}", "func (z *Int) GtUint64(n uint64) bool {\n\treturn (z[3] != 0) || (z[2] != 0) || (z[1] != 0) || z[0] > n\n}", "func Ifu64(cond bool, ifTrue, ifFalse uint64) uint64 {\n\tif cond {\n\t\treturn ifTrue\n\t}\n\treturn ifFalse\n}", "func (r *ISAAC) Uint64() (number uint64) {\n\tr.Lock.Lock()\n\tdefer r.Lock.Unlock()\n\tnumber = r.randrsl[r.randcnt]\n\tr.randcnt++\n\tif r.randcnt == 256 {\n\t\tr.generateNextSet()\n\t\tr.randcnt = 0\n\t}\n\treturn\n}", "func (m *TestAllTypes) GetSingleUint64() (x uint64) {\n\tif m == nil {\n\t\treturn x\n\t}\n\treturn m.SingleUint64\n}", "func (x *Big) Int64() (int64, bool) {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn 0, false\n\t}\n\n\t// x might be too large to fit into an int64 *now*, but rescaling x might\n\t// shrink it enough. See issue #20.\n\tif !x.isCompact() {\n\t\txb := x.Int(nil)\n\t\treturn xb.Int64(), xb.IsInt64()\n\t}\n\n\tu := x.compact\n\tif x.exp != 0 {\n\t\tvar ok bool\n\t\tif u, ok = scalex(u, x.exp); !ok {\n\t\t\treturn 0, false\n\t\t}\n\t}\n\tsu := int64(u)\n\tif su >= 0 || x.Signbit() && su == -su {\n\t\tif x.Signbit() {\n\t\t\tsu = -su\n\t\t}\n\t\treturn su, true\n\t}\n\treturn 0, false\n}", "func GetUint64(key string) uint64 {\n\treturn v.GetUint64(key)\n}", "func GetUint64(key string) uint64 {\n\treturn toUint64(Parse(key))\n}", "func TestUint64(t *testing.T) {\n\ttests := []struct {\n\t\tin uint64 // Value to encode\n\t\tbuf []byte // serialized\n\t}{\n\t\t{1, []byte{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, // Min single byte\n\t\t{255, []byte{0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, // Max single byte\n\t\t{256, []byte{0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00}}, // Min 2-byte\n\t\t{65535, []byte{0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00}}, // Max 2-byte\n\t\t{0x10000, []byte{0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00}}, // Min 4-byte\n\t\t{0xffffffff, []byte{0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00}}, // Max 4-byte\n\t\t{0x100000000, []byte{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}}, // Min 8-byte\n\t\t{0xffffffffffffffff, []byte{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}}, // Max 8-byte\n\t}\n\n\tt.Logf(\"Running uint64 %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\tvar buf bytes.Buffer\n\t\terr := WriteUint64(&buf, test.in)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"WriteUint64 #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(buf.Bytes(), test.buf) {\n\t\t\tt.Errorf(\"WriteUint64 #%d\\n got: %v want: %v\", i,\n\t\t\t\tbuf.Bytes(), test.buf)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Read from protos format.\n\t\trbuf := bytes.NewReader(test.buf)\n\t\tvar val uint64\n\t\terr = ReadUint64(rbuf, &val)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"ReadUint64 #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif val != test.in {\n\t\t\tt.Errorf(\"ReadUint64 #%d\\n got: %v want: %v\", i,\n\t\t\t\tval, test.in)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (i *InmemStore) GetUint64(key []byte) (uint64, error) {\n\ti.l.RLock()\n\tdefer i.l.RUnlock()\n\treturn i.kvInt[string(key)], nil\n}", "func (sto *RocksdbStorage) GetUint64(key string) (uint64, error) {\n\tbytes, err := sto.Get(key)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tval, err := BytesToUint64(bytes)\n\treturn val, err\n}", "func (s STags) GetUint64(tag string, fields ...string) (value uint64) {\n\tn, ok := s.getNum(vUINT64, tag, fields...)\n\tif ok {\n\t\tvalue = n.(uint64)\n\t}\n\treturn\n}" ]
[ "0.7552163", "0.7529806", "0.71701646", "0.7107275", "0.70967805", "0.70193774", "0.69914687", "0.6868089", "0.68263274", "0.67936605", "0.6788953", "0.67658705", "0.67648816", "0.6721825", "0.67133445", "0.6692564", "0.66430235", "0.6638877", "0.6624757", "0.6616391", "0.6500999", "0.6470393", "0.64584404", "0.64507395", "0.6402184", "0.6387055", "0.637498", "0.63708985", "0.636953", "0.6349244", "0.6328223", "0.63215595", "0.6310465", "0.6300152", "0.6288364", "0.6288152", "0.6277266", "0.6276933", "0.6252843", "0.6252843", "0.6248213", "0.6237064", "0.6224949", "0.62190616", "0.6216641", "0.6209225", "0.6209045", "0.61879444", "0.6178393", "0.6176911", "0.61652863", "0.61624575", "0.61545026", "0.614943", "0.61455584", "0.61385167", "0.6133993", "0.61154336", "0.6108824", "0.6107967", "0.6107421", "0.6100965", "0.60857654", "0.60849714", "0.60830384", "0.6082965", "0.60817885", "0.6078827", "0.6063503", "0.6055745", "0.60554516", "0.6051273", "0.60491765", "0.60480314", "0.6042454", "0.60382384", "0.6037721", "0.60353416", "0.6033225", "0.60296404", "0.60180956", "0.60096216", "0.600711", "0.59963465", "0.59868217", "0.5985602", "0.5981262", "0.59805745", "0.5979412", "0.5963655", "0.5963631", "0.595163", "0.5941414", "0.5931352", "0.59175366", "0.59029776", "0.5900775", "0.5895595", "0.58952004", "0.58947897" ]
0.76390654
0
IsFinite returns true if x is finite.
func (x *Big) IsFinite() bool { return x.form & ^signbit == 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func (g GLC) IsFinite() (bool, error) {\n\tvar expandedVariables []string\n\treturn g.isFinite(g.InitialVariable, expandedVariables)\n}", "func IsFinite(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsFinite\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func IsFinite(arg float64, ch int) bool {\n\treturn !math.IsInf(arg, ch)\n}", "func IsInFinite(arg float64, ch int) bool {\n\treturn math.IsInf(arg, ch)\n}", "func (x *Float) IsInf() bool {}", "func FloatIsInf(x *big.Float,) bool", "func Finite(x *big.Rat) bool {\n\t// calling x.Denom() can modify x (populates b) so be extra careful\n\txx := new(big.Rat).Set(x)\n\n\td := xx.Denom()\n\ti := new(big.Int)\n\tm := new(big.Int)\n\n\tfor {\n\t\tswitch {\n\t\tcase d.Cmp(big1) == 0:\n\t\t\treturn true\n\t\tcase remQuo(d, big2, i, m).Sign() == 0:\n\t\t\td.Set(i)\n\t\tcase remQuo(d, big5, i, m).Sign() == 0:\n\t\t\td.Set(i)\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n}", "func IsInfinite(f float64, sign int) bool {\n\n\treturn math.IsInf(f, sign)\n}", "func (f Float) IsZero() bool {\n\treturn !f.Valid\n}", "func (c curve) IsAtInfinity(X, Y *big.Int) bool {\n\treturn X.Sign() == 0 && Y.Sign() == 0\n}", "func (rx *RotationX) IsInfinite() bool {\r\n\treturn rx.Primitive.IsInfinite()\r\n}", "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func (x *Big) IsInf(sign int) bool {\n\treturn sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf\n}", "func FloatIsInt(x *big.Float,) bool", "func (p *G1Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (state *State) IsFloat(index int) bool {\n\treturn IsFloat(state.get(index))\n}", "func (f Float32) IsZero() bool {\n\treturn !f.Valid\n}", "func (ec *EC) Infinite(p *Point) bool {\n\tif p.X == nil || p.Y == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func (p *G2Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (v Value) IsFloat() bool {\n\treturn IsFloat(v.typ)\n}", "func (g GLC) isFinite(variable string, expandedVariables []string) (bool, error) {\n\t// Validamos que variable exista en variables\n\t_, variableExist := strutil.Find(g.Variables, variable)\n\tif !variableExist {\n\t\treturn false, fmt.Errorf(\"%v not found in variables\", variable)\n\t}\n\n\t// Validamos las condiciones de parada\n\t_, alreadyExpanded := strutil.Find(expandedVariables, variable)\n\tif alreadyExpanded {\n\t\treturn false, nil\n\t}\n\n\t// Agregamos variable a expandedVariables\n\texpandedVariables = append(expandedVariables, variable)\n\t// fmt.Println(expandedVariables)\n\n\t// Expandimos cada production correspondiente a variable.\n\tfinite := true\n\tfor _, production := range g.Productions {\n\t\t// Validamos que variable de production exista en variables\n\t\t_, productionVariableExist := strutil.Find(g.Variables, production.Variable)\n\t\tif !productionVariableExist {\n\t\t\treturn false, fmt.Errorf(\"%v not found in variables\", production.Variable)\n\t\t}\n\n\t\tif production.Variable != variable {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Buscamos alguna variable en la produccion.\n\t\tcontainsProduction := production.Contains(g.Variables)\n\t\t// Si contiene alguna produccion expandimos cada produccion.\n\t\tif containsProduction {\n\t\t\textractedVariables := production.ExtractVariables(g.Variables)\n\t\t\t// fmt.Println(extractedVariables)\n\t\t\tfor _, extractedVariable := range extractedVariables {\n\t\t\t\tf, err := g.isFinite(extractedVariable, expandedVariables)\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\tfinite = finite && f\n\t\t\t}\n\t\t} else {\n\t\t\t// Si no contiene una produccion, corresponde a un estado terminal.\n\t\t\tfinite = finite && true\n\t\t}\n\t}\n\n\treturn finite, nil\n}", "func IsFloat(t Type) bool {\n\treturn int(t)&flagIsFloat == flagIsFloat\n}", "func (v *Variant) IsFloating() bool {\n\treturn gobool(C.g_variant_is_floating(v.native()))\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func IsZero(x float64) bool {\n\treturn EQ(x, 0)\n}", "func isNaN64(f float64) bool { return f != f }", "func (env *Environment) FiniteHoppings() bool {\n\teps := 1e-9\n\teven := (math.Abs(env.Tce) > eps) || (math.Abs(env.Tbe) > eps)\n\todd := math.Abs(env.Tco) > eps\n\treturn even || odd\n}", "func (f Number) Bool(context.Context) bool {\n\treturn float64(f) != 0\n}", "func IsInf(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsInf\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func isFloatInt(floatValue float64) bool {\n\treturn math.Mod(floatValue, 1.0) == 0\n}", "func (d Definition) IsFloat() bool {\n\tif k, ok := d.Output.(reflect.Kind); ok {\n\t\tif k == reflect.Float32 || k == reflect.Float64 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func FloatSignbit(x *big.Float,) bool", "func FinitePrec(x *big.Rat) int {\n\tif !Finite(x) {\n\t\tpanic(fmt.Errorf(\"rounding.FinitePrec: called with non-finite value: %v\", x))\n\t}\n\t// calling x.Denom() can modify x (populates b) so be extra careful\n\txx := new(big.Rat).Set(x)\n\n\td := xx.Denom()\n\tn := xx.Num()\n\tm := new(big.Int)\n\n\tvar i int\n\tfor m.Mod(n, d).Sign() != 0 {\n\t\ti++\n\t\tn.Mul(n, big10)\n\t}\n\treturn i\n}", "func (Integer) IsPosInf() bool {\n\treturn false\n}", "func IsFloat(val any) bool {\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tswitch rv := val.(type) {\n\tcase float32, float64:\n\t\treturn true\n\tcase string:\n\t\treturn rv != \"\" && rxFloat.MatchString(rv)\n\t}\n\treturn false\n}", "func IsNan(f float64) bool {\n\n\treturn math.IsNaN(f)\n}", "func (f Float) IsNaN() bool {\n\t// NaN + NaN should be NaN in consideration\n\treturn math.IsNaN(f.high) || math.IsNaN(f.low)\n}", "func (*BigInt) IsPosInf() bool {\n\treturn false\n}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (e stringElement) IsInf(sign int) bool {\n\tswitch strings.ToLower(e.e) {\n\tcase \"inf\", \"-inf\", \"+inf\":\n\t\tf, err := strconv.ParseFloat(e.e, 64)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn math.IsInf(f, sign)\n\t}\n\treturn false\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func isNaN32(f float32) bool { return f != f }", "func IsFloat(id int) bool {\n\treturn id >= IDFloat16 && id <= IDFloat64\n}", "func (f Frac) IsZero() bool {\n\treturn f.n == 0\n}", "func Inf(a, b interface{}, f Func) bool {\n\treturn f(a, b) == -1\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func IsFloat(data interface{}) bool {\n\treturn typeIs(data,\n\t\treflect.Float32,\n\t\treflect.Float64,\n\t)\n}", "func (v *Object) IsFloating() bool {\n\tc := C.g_object_is_floating(C.gpointer(v.ptr))\n\treturn gobool(c)\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func IsFloat(str string) bool {\n\treturn str != \"\" && rxFloat.MatchString(str)\n}", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func FiniteString(x *big.Rat) string {\n\treturn x.FloatString(FinitePrec(x))\n}", "func IsValidFloat64(val float64) bool {\n\tif math.IsNaN(val) {\n\t\treturn false\n\t}\n\tif math.IsInf(val, 0) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (v Float) Nil() bool {\n\treturn !v.present\n}", "func (mysql *MySQLDatabase) IsFloat(column Column) bool {\n\treturn IsStringInSlice(column.DataType, mysql.GetFloatDatatypes())\n}", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func (x *Float) Signbit() bool {}", "func (x *Big) Float64() (f float64, ok bool) {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif !x.IsFinite() {\n\t\tswitch x.form {\n\t\tcase pinf, ninf:\n\t\t\treturn math.Inf(int(x.form & signbit)), true\n\t\tcase snan, qnan:\n\t\t\treturn math.NaN(), true\n\t\tcase ssnan, sqnan:\n\t\t\treturn math.Copysign(math.NaN(), -1), true\n\t\t}\n\t}\n\n\tconst (\n\t\tmaxPow10 = 22 // largest exact power of 10\n\t\tmaxMantissa = 1<<53 + 1 // largest exact mantissa\n\t)\n\tswitch xc := x.compact; {\n\tcase !x.isCompact():\n\t\tfallthrough\n\t//lint:ignore ST1015 convoluted, but on purpose\n\tdefault:\n\t\tf, _ = strconv.ParseFloat(x.String(), 64)\n\t\tok = !math.IsInf(f, 0) && !math.IsNaN(f)\n\tcase xc == 0:\n\t\tok = true\n\tcase x.IsInt():\n\t\tif xc, ok := x.Int64(); ok {\n\t\t\tf = float64(xc)\n\t\t} else if xc, ok := x.Uint64(); ok {\n\t\t\tf = float64(xc)\n\t\t}\n\t\tok = xc < maxMantissa || (xc&(xc-1)) == 0\n\tcase x.exp == 0:\n\t\tf = float64(xc)\n\t\tok = xc < maxMantissa || (xc&(xc-1)) == 0\n\tcase x.exp > 0:\n\t\tf = float64(x.compact) * math.Pow10(x.exp)\n\t\tok = x.compact < maxMantissa && x.exp < maxPow10\n\tcase x.exp < 0:\n\t\tf = float64(x.compact) / math.Pow10(-x.exp)\n\t\tok = x.compact < maxMantissa && x.exp > -maxPow10\n\t}\n\n\tif x.form&signbit != 0 {\n\t\tf = math.Copysign(f, -1)\n\t}\n\treturn f, ok\n}", "func IsNan(arg float64) bool {\n\treturn math.IsNaN(arg)\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tfrac := f.Frac()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Half-precision_floating-point_format#Exponent_encoding\n\t//\n\t// 0b00001 - 0b11110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-15) * 1.mant_2\n\tlead := 1\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b11111\n\tcase 0x1F:\n\t\t// Inf or NaN\n\t\tif frac == 0 {\n\t\t\t// +-Inf\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b00000\n\tcase 0x00:\n\t\tif frac == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-14) * 0.mant_2\n\t\tlead = 0\n\t\texponent = -14\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\ts := fmt.Sprintf(\"%s0b%d.%010bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func IsPos(x float64) bool {\n\treturn GT(x, 0)\n}", "func Float(str string) bool {\n\t_, err := strconv.ParseFloat(str, 0)\n\treturn err == nil\n}", "func isInt(n float64) bool {\n\treturn n == float64(int64(n))\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\tif f.IsNaN() {\n\t\treturn x, true\n\t}\n\th := big.NewFloat(f.high).SetPrec(precision)\n\tl := big.NewFloat(f.low).SetPrec(precision)\n\tx.Add(h, l)\n\n\tzero := big.NewFloat(0).SetPrec(precision)\n\tif x.Cmp(zero) == 0 && math.Signbit(f.high) {\n\t\t// -zero\n\t\tif !x.Signbit() {\n\t\t\tx.Neg(x)\n\t\t}\n\t}\n\n\treturn x, false\n}", "func (n *Number) Zero() bool {\n\tif n.isInteger {\n\t\treturn n.integer.Cmp(&big.Int{}) == 0\n\t} else {\n\t\treturn n.floating == 0\n\t}\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (this *unsignedFixed) zero() bool {\n\tm := this.mantissa\n\tresult := m == 0\n\treturn result\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format\n\t//\n\t// 0b000000000000001 - 0b111111111111110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-16383) * 1.mant_2\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b111111111111111\n\tcase 0x7FFF:\n\t\t// Inf or NaN\n\t\tif f.m == 0x8000000000000000 {\n\t\t\t// +-Inf\n\t\t\t// 10 zero\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\t// 10 non-zero\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b000000000000000\n\tcase 0x0000:\n\t\tif f.m == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-16382) * 0.mant_2\n\t\texponent = -16382\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\tlead := f.Lead()\n\tfrac := f.Frac()\n\ts := fmt.Sprintf(\"%s0b%d.%063bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func FloatValue(v Value) (float64, bool) {\n\tif v.Type() != FloatType {\n\t\treturn 0, false\n\t}\n\tval, ok := (v.Value()).(float64)\n\treturn val, ok\n}", "func (f *Fieldx) IsZero() bool {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn reflect.DeepEqual(f.Value(), zero)\n}", "func (v Value) IsNaN() bool {\n\treturn v.v.Kind() == reflect.Float64 && math.IsNaN(v.v.Float())\n}", "func isNaN(val string) bool {\n\tif val == nan {\n\t\treturn true\n\t}\n\n\t_, err := strconv.ParseFloat(val, 64)\n\n\treturn err != nil\n}", "func IsNaN(f float32) (is bool) {\n\t// IEEE 754 says that only NaNs satisfy `f != f`.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf`\n\treturn f != f\n}", "func (x *Big) Float(z *big.Float) *big.Float {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Float)\n\t}\n\n\tswitch x.form {\n\tcase finite, finite | signbit:\n\t\tif x.isZero() {\n\t\t\tz.SetUint64(0)\n\t\t} else {\n\t\t\tz.SetRat(x.Rat(nil))\n\t\t}\n\tcase pinf, ninf:\n\t\tz.SetInf(x.form == pinf)\n\tdefault: // snan, qnan, ssnan, sqnan:\n\t\tz.SetUint64(0)\n\t}\n\treturn z\n}", "func TestPriceFloatValueOne(t *testing.T) {\n\tonePrice := &Price{\n\t\tAmountWant: 1,\n\t\tAmountHave: 1,\n\t}\n\n\tif priceValue, _ := onePrice.ToFloat(); priceValue != float64(1) {\n\t\tt.Errorf(\"A price of one should return 1 when calling ToFloat\")\n\t\treturn\n\t}\n\treturn\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func (me TxsdTaxAccountingBasis) IsF() bool { return me.String() == \"F\" }", "func Float(a float64, b float64) bool {\n\treturn a == b\n}", "func Infinity() Point {\n\treturn Point{1, 0}\n}", "func (x *Big) IsInt() bool {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn false\n\t}\n\n\t// 0, 5000, 40\n\tif x.isZero() || x.exp >= 0 {\n\t\treturn true\n\t}\n\n\txp := x.Precision()\n\texp := x.exp\n\n\t// 0.001\n\t// 0.5\n\tif -exp >= xp {\n\t\treturn false\n\t}\n\n\t// 44.00\n\t// 1.000\n\tif x.isCompact() {\n\t\tfor v := x.compact; v%10 == 0; v /= 10 {\n\t\t\texp++\n\t\t}\n\t\t// Avoid the overhead of copying x.unscaled if we know for a fact it's not\n\t\t// an integer.\n\t} else if x.unscaled.Bit(0) == 0 {\n\t\tv := new(big.Int).Set(&x.unscaled)\n\t\tr := new(big.Int)\n\t\tfor {\n\t\t\tv.QuoRem(v, c.TenInt, r)\n\t\t\tif r.Sign() != 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\texp++\n\t\t}\n\t}\n\treturn exp >= 0\n}", "func (a *_Atom) isFunctional() bool {\n\tif a.atNum != 6 {\n\t\treturn true\n\t}\n\tif len(a.features) > 0 {\n\t\treturn true\n\t}\n\tif a.unsaturation > cmn.UnsaturationNone {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f Frac) IsWhole() bool {\n\treturn f.Reduce().d == 1\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func FloatingPrime() bool{\n\tvar input float64\n\n\t//Receives input\n\tfmt.Println(\"Please enter any number that ranges from 1.0 - 10.0\")\n\t_,err := fmt.Scan(&input)\n\n\tif err != nil{\n\t\tfmt.Println(err)\n\t}\n\n\t//Check the range of the inputted\n\tif input < 1 || input > 10{\n\t\tlog.Fatal(\"The given input is invalid\")\n\t}\n\n\t//Converts to string and splits according to the decimals\n\tstr := strconv.FormatFloat(input, 'f', 3, 64)\n\n\tsplited := strings.Split(str, \".\")\n\ttemp := splited[0]\n\n\t//For loops the converted strings has already been splited\n\tfor _,val := range string([]rune(splited[1])){\n\t\t//Concat the splited strings together\n\t\ttemp += string(val)\n\t\tn, _ := strconv.ParseInt(temp,10,32 )\n\n\t\t//Check if that number is prime\n\t\tif big.NewInt(n).ProbablyPrime(0){\n\t\t\tfmt.Println(\"Is a prime number at:\",n)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Zero(n float64) bool {\n\treturn NegEpsilon64 <= n && n <= Epsilon64\n}", "func isNumber(x interface{}) bool {\n\tif x == nil {\n\t\treturn false\n\t}\n\n\tswitch reflect.TypeOf(x).Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\treflect.Float32, reflect.Float64:\n\t\treturn true\n\t}\n\treturn false\n}", "func TestCheckBinaryExprFloatEqlFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `2.0 == 2.0`, env, (2.0 == 2.0), ConstBool)\n}", "func (node *GoValueNode) IsReal() bool {\n\tkind := pkg.GetBaseKind(node.thisValue)\n\n\treturn kind == reflect.Float64\n}", "func (s *NumSeries) IsZero() bool { return s.weight <= 0 }", "func isFloatEqual(a, b float64) bool {\n\tEPILOPS := 0.000001\n\n\tif (a-b) > EPILOPS || (b-a) > EPILOPS {\n\t\treturn false\n\t}\n\n\treturn true\n\n}", "func (x *Big) IsNaN(quiet int) bool {\n\treturn quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan\n}", "func IsNaN32(f float32) (is bool) {\n\tx := Float32bits(f)\n\treturn x&uvinf32 == uvinf32 && x != uvinf32 && x != uvneginf32\n}", "func (k Feature_Kind) IsNumerical() bool { return k == Feature_NUMERICAL }", "func IsFloat64(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Float64\n}", "func (d Definition) IsNumber() bool {\n\treturn d.IsInteger() || d.IsFloat()\n}", "func (b Bits) Singular() bool {\n\treturn b != 0 && (b&(b-1)) == 0\n}" ]
[ "0.8286918", "0.8070107", "0.804661", "0.7833303", "0.7490696", "0.73328984", "0.69117486", "0.661476", "0.6564865", "0.6270238", "0.6108329", "0.60892147", "0.60506237", "0.6028886", "0.60128975", "0.598571", "0.59734184", "0.5942874", "0.5867907", "0.5845846", "0.58361876", "0.57710236", "0.56794935", "0.5678719", "0.5648326", "0.5648326", "0.56430984", "0.5636474", "0.5631789", "0.562537", "0.5612002", "0.5584512", "0.55587876", "0.55363786", "0.55124927", "0.54941887", "0.54880065", "0.54721737", "0.5461392", "0.5460743", "0.54519254", "0.54303324", "0.5423646", "0.54096466", "0.53831935", "0.53675324", "0.5360569", "0.5358638", "0.53585136", "0.53484184", "0.5341058", "0.5308192", "0.5268915", "0.5255514", "0.5237982", "0.5223791", "0.5217431", "0.51982135", "0.5196945", "0.5183223", "0.513997", "0.51054436", "0.50602984", "0.50229836", "0.5013499", "0.5008961", "0.5004754", "0.49603534", "0.49486342", "0.49403706", "0.49380827", "0.49321797", "0.49293405", "0.4910202", "0.4907971", "0.48961625", "0.48890176", "0.48875073", "0.48726988", "0.4865562", "0.48604912", "0.48347494", "0.48277232", "0.48210642", "0.47990093", "0.47988892", "0.47932285", "0.47716165", "0.47488448", "0.47415742", "0.47344398", "0.47335544", "0.47158366", "0.47054517", "0.4688543", "0.46868744", "0.4678637", "0.46784806", "0.4675351", "0.4672967" ]
0.8008782
3
IsNormal returns true if x is normal.
func (x *Big) IsNormal() bool { return x.IsFinite() && x.adjusted() >= x.Context.minScale() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (c *Candy) IsNormal() bool {\n\treturn c._type > 0 && c._type <= NbCandyType\n}", "func (me TxsdPresentationAttributesFontSpecificationFontStretch) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (me TxsdPresentationAttributesFontSpecificationFontVariant) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (me TxsdPresentationAttributesFontSpecificationFontWeight) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (me TxsdPresentationAttributesFontSpecificationFontStyle) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (gdt *Vector3) IsNormalized() Bool {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_is_normalized(GDNative.api, arg0)\n\n\treturn Bool(ret)\n}", "func (me TxsdFeBlendTypeMode) IsNormal() bool { return me.String() == \"normal\" }", "func (x *Big) IsSubnormal() bool {\n\treturn x.IsFinite() && x.adjusted() < x.Context.minScale()\n}", "func (me TxsdPresentationAttributesTextContentElementsUnicodeBidi) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (pmf PMF) IsNormalized() bool {\n\tdelta := math.Abs(1.0 - float64(pmf.Sum()))\n\treturn delta <= maxDelta\n}", "func NewNormal(mu []float64, sigma mat64.Symmetric, src *rand.Rand) (*Normal, bool) {\n\tif len(mu) == 0 {\n\t\tpanic(badZeroDimension)\n\t}\n\tdim := sigma.Symmetric()\n\tif dim != len(mu) {\n\t\tpanic(badSizeMismatch)\n\t}\n\tn := &Normal{\n\t\tsrc: src,\n\t\tdim: dim,\n\t\tmu: make([]float64, dim),\n\t\tsigma: mat64.NewSymDense(dim, nil),\n\t\tchol: mat64.NewTriDense(dim, true, nil),\n\t}\n\tcopy(n.mu, mu)\n\tn.sigma.CopySym(sigma)\n\t// TODO(btracey): Change this to the input Sigma, in case it is diagonal or\n\t// banded.\n\tok := n.chol.Cholesky(n.sigma, true)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tfor i := 0; i < dim; i++ {\n\t\tn.logSqrtDet += math.Log(n.chol.At(i, i))\n\t}\n\treturn n, true\n}", "func IsNormalFlag(s AbnormalFlag) bool {\n\treturn s == AbnormalFlagEmpty || s == AbnormalFlagNormal\n}", "func (s Sphere) Normal(p vector.Vec4) vector.Vec4 {\n\treturn vector.Subtract(&s.origin, &p)\n}", "func (me TcolorModeEnumType) IsNormal() bool { return me == \"normal\" }", "func Normal(mean, sd float64) float64 {\n\treturn rand.NormFloat64()*sd + mean\n}", "func (tp Type) IsNormalTable() bool {\n\treturn tp == NormalTable\n}", "func (me TstyleStateEnumType) IsNormal() bool { return me == \"normal\" }", "func (model *Way) normalProbability(cor Coordinate) float64 {\n\tvar NormalMean float64\n\tvar NormalDeviation float64 = 20 //Amount of expected GPS error\n\tprojection := model.FindProjection(cor)\n\tdistanceMeter := projection.Distance * float64(distanceMeterFactor)\n\t//Normal distribution formula\n\tprobability := 1 / (math.Sqrt(2*math.Pi) * NormalDeviation) * math.Exp(-(math.Pow(distanceMeter-NormalMean, 2) / (2 * math.Pow(NormalDeviation, 2))))\n\treturn probability\n}", "func NewNormal(mean, variance float64) gostats.Distribution {\n\treturn &Normal{\n\t\tmean: mean,\n\t\tvariance: variance,\n\t\tstddev: math.Sqrt(variance),\n\t}\n}", "func SensitivityPNormal() *Sensitivity {\n\tv := SensitivityVNormal\n\treturn &v\n}", "func NewNormal(mu float64, sigma float64) (Normal, error) {\n\tif sigma <= 0 {\n\t\treturn Normal{}, errors.New(\"stats: invalid Normal parameters. Check Sigma > 0\")\n\t}\n\treturn Normal{Mu: mu, Sigma: sigma}, nil\n}", "func (s StatusInfo) Normal() bool {\n\treturn s.Code == 0x03\n}", "func (r RuleName) IsNormalize() bool {\n\treturn r < startExploreRule\n}", "func LogNormal(μ, σ float64) func() float64 {\n\treturn func() float64 { return LogNormalNext(μ, σ) }\n}", "func (b *BasicShape) NormalAt(geometry.Vector) geometry.Vector {\n\tpanic(\"NormalAt is not implemented for basic shape\")\n}", "func (u Vec) Normal() Vec {\n\treturn Vec{-u.Y, u.X}\n}", "func (pn Plane) NormalAtPoint(p rays.Point) rays.Ray {\n\treturn pn.normal\n}", "func NewNormalProposer(mu, sigma float64) *NormalProposer {\n\tp, _ := prob.NewNormal(mu, sigma)\n\treturn &NormalProposer{p}\n}", "func LogNormalMean(μ, σ float64) float64 {\n\treturn exp(μ + σ*σ/2)\n}", "func NormalDistribution(generator *rand.Rand, standardDeviation float64) Transformation {\n\trandom := fallbackNewRandom(generator)\n\n\treturn func(duration time.Duration) time.Duration {\n\t\treturn time.Duration(random.NormFloat64()*standardDeviation + float64(duration))\n\t}\n}", "func NormalMode() bool {\n\treturn mode == 0\n}", "func (m *LikelihoodStudentsT) 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}", "func (a Vec2) Normalized() (v Vec2, ok bool) {\n\tlength := math.Sqrt(a.X*a.X + a.Y*a.Y)\n\tif Equal(length, 0) {\n\t\treturn Vec2Zero, false\n\t}\n\treturn Vec2{\n\t\ta.X / length,\n\t\ta.Y / length,\n\t}, true\n}", "func randNorm(x float32) float32 {\n\tr := rand.Float32()*.2 + .9\n\tx *= r\n\tif x > 1 {\n\t\treturn 1\n\t}\n\treturn x\n}", "func (c *Circle) NormalSDF(coord Coord) (Coord, float64) {\n\tdirection := coord.Sub(c.Center)\n\tif norm := direction.Norm(); norm == 0 {\n\t\t// Pick an arbitrary normal\n\t\treturn X(1), c.Radius\n\t} else {\n\t\treturn direction.Scale(1 / norm), c.SDF(coord)\n\t}\n}", "func (n Noun) IsAtom() bool { return n.atom != nil }", "func NewNormal(lb int64, ub int64) *Normal {\n\treturn &Normal{\n\t\tImpl: distuv.Normal{\n\t\t\tMu: float64(lb + ub/2), // Mean of the normal distribution\n\t\t\tSigma: NormalSigma, // Standard deviation of the normal distribution\n\t\t},\n\t}\n}", "func (norm Normal) Mean() float64 {\n\treturn norm.Mu\n}", "func TruncatedNormal(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...TruncatedNormalAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"dtype\": dtype}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"TruncatedNormal\",\n\t\tInput: []tf.Input{\n\t\t\tshape,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func StandardNormalCDF(x float64) (r float64) {\n\tsum := x\n\tvalue := x\n\tfor i := 1; i <= 1000; i++ {\n\t\tvalue = (value * x * x / (2*float64(i) + 1))\n\t\tsum += value\n\t}\n\tr = 0.5 + (sum/math.Sqrt(2*math.Pi))*math.Exp(-(x*x)/2)\n\treturn\n}", "func LogNormalMode(μ, σ float64) float64 {\n\treturn exp(μ - σ*σ)\n}", "func (gdt *Vector3) Normalized() Vector3 {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_normalized(GDNative.api, arg0)\n\n\treturn Vector3{base: &ret}\n\n}", "func (n *Normal) Mean() float64 {\n\treturn n.mean\n}", "func ReadNormal(r Reader) float32 {\n\t// sign bit\n\tif ReadBool(r) {\n\t\treturn float32(r.ReadBits(11)) * normal_divisor\n\t} else {\n\t\treturn -float32(r.ReadBits(11)) * normal_divisor\n\t}\n}", "func NormalProbabilityBetween(z1, z2 float64) float64 {\n\treturn math.Abs(NormalCDF(z1) - NormalCDF(z2))\n}", "func (v Vector) Normalize() (Vector, bool) {\n\tmag := v.Magnitude()\n\t// Zero-length vector has no direction and therefore can not be normalized\n\tif mag <= 0.0 {\n\t\treturn v, false\n\t}\n\treturn v.Scale(1.0 / mag), true\n}", "func (pl *Plane) NormalAt(point *Tuple) Tuple {\n\tobNormal := Vector(0, 1, 0)\n\twNormal := pl.NormalToWorld(obNormal)\n\treturn *wNormal\n}", "func (n NormOrder) Valid() bool {\n\tswitch {\n\tcase math.IsNaN(float64(n)):\n\t\tnb := math.Float64bits(float64(n))\n\t\tif math.Float64bits(float64(UnorderedNorm())) == nb || math.Float64bits(float64(FrobeniusNorm())) == nb || math.Float64bits(float64(NuclearNorm())) == nb {\n\t\t\treturn true\n\t\t}\n\tcase math.IsInf(float64(n), 0):\n\t\treturn true\n\tdefault:\n\t\tif _, frac := math.Modf(float64(n)); frac == 0.0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (c *Capsule) NormalSDF(coord Coord) (Coord, float64) {\n\tvar n Coord\n\tres := c.genericSDF(coord, &n, nil)\n\treturn n, res\n}", "func (s *Sphere) NormalAt(p Vector) Vector {\n\treturn p.Minus(s.Center).Normalize()\n}", "func LogNormalPDF(μ, σ float64) func(x float64) float64 {\n\tnormalogormalizer := 0.3989422804014327 / σ\n\treturn func(x float64) float64 { return normalogormalizer * exp(-1*(log(x)-μ)*(log(x)-μ)/(2*σ*σ)) / x }\n}", "func LogNormalVar(μ, σ float64) float64 {\n\treturn exp(σ*σ) - 1*exp(2*μ+σ*σ)\n}", "func GetNormal(l *Line, p, out *point.Point) *point.Point {\n\tif out == nil {\n\t\tout = point.New(0, 0)\n\t}\n\n\ta := Angle(l) - phomath.TAU\n\n\tout.X = math.Cos(a)\n\tout.Y = math.Sin(a)\n\n\treturn out\n}", "func (t *Triangle) NormalSDF(c Coord) (Coord, float64) {\n\tvar n Coord\n\tres := t.genericSDF(c, &n, nil, nil)\n\treturn n, res\n}", "func LogNormalStd(μ, σ float64) float64 {\n\treturn sqrt(LogNormalVar(μ, σ))\n}", "func (r *Rect) NormalSDF(c Coord) (Coord, float64) {\n\tvar n Coord\n\tres := r.genericSDF(c, &n, nil)\n\treturn n, res\n}", "func (rng RandomGenerator) MakeNormalVector(size int, mean, stdDev float64) []float64 {\n\tret := make([]float64, size)\n\tfor i := 0; i < len(ret); i++ {\n\t\tret[i] = rng.NormFloat64()*stdDev + mean\n\t}\n\treturn ret\n}", "func (p *Point) Norm() {\n\tif p.W == 0 {\n\t\tp.Z = 1\n\t} else {\n\t\tp.Z = p.Z / p.W\n\t\tp.W = 1\n\t}\n}", "func (g *Group) LocalNormalAt(p *algebra.Vector, hit *Intersection) (*algebra.Vector, error) {\n\treturn nil, GroupNormalError(*g)\n}", "func (g SimplePoint) IsGeometry() bool {\n\treturn true\n}", "func NormalPDF(z float64) float64 {\n\treturn math.Exp(-math.Pow(z, 2)/2) / math.Sqrt(2*math.Pi)\n}", "func (sx ScaleX) Normalize(min, max, x float64) float64 {\n\ttXMin := sx(min)\n\treturn (sx(x) - tXMin) / (sx(max) - tXMin)\n}", "func (n *NormalModel) IsAnomalousValue(value, threshold float64) bool {\n\treturn (value <= n.Mean-threshold*n.StandardDeviation) || (value >= n.Mean+threshold*n.StandardDeviation)\n}", "func Normal(a [100][100]float64, b [100]float64, m int32) {\n\tvar i, j int32\n\tvar big float64\n\n\tfor i = 0; i < m; i++ {\n\t\tbig = 0.0\n\n\t\tfor j = 0; j < m; j++ {\n\t\t\tif big < math.Abs(a[i][j]) {\n\t\t\t\tbig = math.Abs(a[i][j])\n\t\t\t}\n\t\t}\n\n\t\tfor j = 0; j < m; j++ {\n\t\t\ta[i][j] = a[i][j] / big\n\t\t}\n\n\t\tb[i] = b[i] / big\n\t}\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func RandomStandardNormal(scope *Scope, shape tf.Output, dtype tf.DataType, optional ...RandomStandardNormalAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"dtype\": dtype}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"RandomStandardNormal\",\n\t\tInput: []tf.Input{\n\t\t\tshape,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (cp *CCollisionPoly) NormalAxes() []pixel.Vec {\n\tvar normals []pixel.Vec\n\tfor _, ed := range cp.UniqueEdges {\n\t\tangle := ed.pointA.Sub(*ed.pointB).Angle() + math.Pi/2\n\t\tnormal := pixel.Unit(angle)\n\t\tnormals = append(normals, normal)\n\t}\n\treturn normals\n}", "func (p Point) Normalize() Point {\n\treturn p.Scale(1.0 / math.Sqrt(p.Dot(p)))\n}", "func (v Vec3) Normalized() Vec3 {\n\tf := 1.0 / v.Norm()\n\treturn Vec3{f * v[0], f * v[1], f * v[2]}\n}", "func (tri *Triangle) RecalculateNormal() {\n\ttri.Normal = calculateNormal(tri.Vertices[0].Position, tri.Vertices[1].Position, tri.Vertices[2].Position)\n}", "func (f Number) Bool(context.Context) bool {\n\treturn float64(f) != 0\n}", "func NormalCDF(z float64) float64 {\n\treturn (1 + math.Erf(z/(math.Sqrt2))) / 2\n}", "func (d Definition) IsNumber() bool {\n\treturn d.IsInteger() || d.IsFloat()\n}", "func TestNormalize(t *testing.T) {\n\tvar i uint\n\t// It makes no sense to normalize a zero vector, therefore we start at 1.\n\tfor i = 1; i < 100; i++ {\n\t\ta := makeRandomVector(i)\n\t\tb := Normalize(a)\n\n\t\tif b.Len() != float64(1) {\n\t\t\tt.Error(\"Normalization failed, vector doesn't have length 1.\")\n\t\t\tt.Logf(\"%f != 1\", b.Len())\n\t\t}\n\t}\n}", "func (m *Model) IsRegression() bool { return m.target.IsNumeric() }", "func StatefulStandardNormalDtype(value tf.DataType) StatefulStandardNormalAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"dtype\"] = value\n\t}\n}", "func LogNormalNext(μ, σ float64) float64 { return exp(NormalNext(μ, σ)) }", "func (b box) findNormal(point vector) vector {\n\tnormal := makeVector(0, 0, 0) //point.sub(b.center).direction()\n\tif math.Abs(point.x-b.min.x) < errorDelta {\n\t\tnormal = makeVector(-1, 0, 0)\n\t} else if math.Abs(point.x-b.max.x) < errorDelta {\n\t\tnormal = makeVector(1, 0, 0)\n\t} else if math.Abs(point.y-b.min.y) < errorDelta {\n\t\tnormal = makeVector(0, -1, 0)\n\t} else if math.Abs(point.y-b.max.y) < errorDelta {\n\t\tnormal = makeVector(0, 1, 0)\n\t} else if math.Abs(point.z-b.min.z) < errorDelta {\n\t\tnormal = makeVector(0, 0, -1)\n\t} else if math.Abs(point.z-b.max.z) < errorDelta {\n\t\tnormal = makeVector(0, 0, 1)\n\t} else {\n\t\tfmt.Println(\"Point not placed:\", math.Abs(point.x-b.min.x) < errorDelta)\n\t}\n\treturn normal\n}", "func RandNormalVector(r *rand.Rand, mean, std []float64) []float64 {\n\n\tif len(mean) != len(std) {\n\t\tpanic(fmt.Errorf(\"Cannot generate random vectors because length of mean [%d] and std [%d] don't match.\",\n\t\t\tlen(mean), len(std)))\n\t}\n\tvector := make([]float64, len(mean))\n\tfor i, _ := range mean {\n\t\tv := r.NormFloat64()*std[i] + mean[i]\n\t\tvector[i] = v\n\t}\n\n\treturn vector\n}", "func (o *MicrosoftGraphVerifiedDomain) GetIsInitial() bool {\n\tif o == nil || o.IsInitial == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsInitial\n}", "func (b Bool) Normalized() Bool {\n\tif b.Valid {\n\t\treturn b\n\t}\n\t// If !Valid, then Bool could be any value.\n\t// Normalized value can be compared for equality.\n\treturn Bool{}\n}", "func NormalGrass() GrassType {\n\treturn GrassType{0}\n}", "func NewStdNorm() (x *Norm){\n x = NewNorm(0.,1.)\n return\n}", "func (n *Normal) StdDev() float64 {\n\treturn n.stddev\n}", "func NormalEquation(X Matrix, y Matrix)Matrix{\n\t//note: when the normal equation meets the problem of non-invertible matrix\n\t//\t\tregularized normal equation can fix it ;-)\n\t//\t\tjust put a really small number like o.ooo1 into lambda\n\n\tif y.Row != X.Row || y.Column != 1{\n\t\tpanic(\"value format error\")\n\t}\n\tXT := TransposeMatrix(X)\n\treturn MatrixMultiplication(MatrixMultiplication(InverseMatrix(MatrixMultiplication(XT, X)), XT), y)\n\n\n}", "func LogNormalCDF(μ, σ float64) func(x float64) float64 {\n\treturn func(x float64) float64 { return ((1.0 / 2.0) * (1 + erf((log(x)-μ)/(σ*sqrt2)))) }\n}", "func (k Keeper) IsDerivativeDenom(ctx sdk.Context, denom string) bool {\n\tvalAddr, err := types.ParseLiquidStakingTokenDenom(denom)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t_, found := k.stakingKeeper.GetValidator(ctx, valAddr)\n\treturn found\n}", "func NewLogNormalProposer(mu, sigma float64) *LogNormalProposer {\n\tp, _ := prob.NewLogNormal(mu, sigma)\n\treturn &LogNormalProposer{p}\n}", "func (n *Normal) Variance() float64 {\n\treturn n.variance\n}", "func (x *Float) IsInf() bool {}", "func (rng RandomGenerator) MakeNormalMatrix(row, col int, mean, stdDev float64) [][]float64 {\n\tret := make([][]float64, row)\n\tfor i := range ret {\n\t\tret[i] = rng.MakeNormalVector(col, mean, stdDev)\n\t}\n\treturn ret\n}", "func (me TxsdPremiseNumberNumberType) IsSingle() bool { return me == \"Single\" }", "func (me TxsdConfidenceRating) IsNumeric() bool { return me.String() == \"numeric\" }", "func (p *Posting) Norm() float64 {\n\treturn float64(float32(1.0 / math.Sqrt(float64(math.Float32bits(p.norm)))))\n}", "func TruncatedNormalSeed(value int64) TruncatedNormalAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"seed\"] = value\n\t}\n}", "func (p *Vect) Normalize() {\n\t// Neat trick I saw somewhere to avoid div/0.\n\tp.Mult(1.0 / (p.Length() + f.FloatMin))\n}", "func LogNormalSkew(μ, σ float64) float64 {\n\treturn exp(σ*σ) + 2*sqrt(exp(σ*σ)-1)\n}", "func (bill Amount) IsPositive() bool {\n\tif bill.Unit == 0 {\n\t\treturn false\n\t}\n\tif bill.Dist <= 0 {\n\t\treturn false\n\t}\n\t// Meet requirements\n\treturn true\n}", "func (v Vec3) Norm() float32 {\n\treturn float32(math.Sqrt(float64(v.SquareNorm())))\n}" ]
[ "0.6978493", "0.6832683", "0.6530506", "0.6522392", "0.6405958", "0.6360109", "0.6321225", "0.6214152", "0.6193896", "0.6151518", "0.6004056", "0.58610797", "0.582082", "0.5700992", "0.55730987", "0.55395657", "0.541299", "0.5309574", "0.53021777", "0.5297656", "0.5247428", "0.5177037", "0.5166898", "0.5143819", "0.5139819", "0.51328033", "0.50259316", "0.5016335", "0.50072116", "0.49833572", "0.4943323", "0.4894939", "0.4842319", "0.4835347", "0.4822312", "0.4821397", "0.4817135", "0.48049334", "0.48009127", "0.4794483", "0.4783656", "0.47697437", "0.47621292", "0.47581464", "0.47555137", "0.47475696", "0.47389466", "0.47316897", "0.47135013", "0.46989694", "0.46942547", "0.46721765", "0.46686703", "0.46438897", "0.46383882", "0.46269274", "0.4622085", "0.46182498", "0.46072572", "0.46003732", "0.45918295", "0.4591242", "0.45781538", "0.45732743", "0.45674002", "0.45497125", "0.45496386", "0.45437065", "0.45375937", "0.4532005", "0.45231736", "0.45077404", "0.45067182", "0.4462882", "0.44540325", "0.4447654", "0.44373032", "0.44333184", "0.44306162", "0.4429525", "0.44294804", "0.44181585", "0.44030386", "0.43923005", "0.43830973", "0.43719065", "0.4357939", "0.43115613", "0.4311405", "0.43055564", "0.4303424", "0.4297068", "0.42793056", "0.4268335", "0.42663395", "0.42523235", "0.42503884", "0.42442808", "0.42423826", "0.4232019" ]
0.8046503
0
IsSubnormal returns true if x is subnormal.
func (x *Big) IsSubnormal() bool { return x.IsFinite() && x.adjusted() < x.Context.minScale() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (x *Big) IsNormal() bool {\n\treturn x.IsFinite() && x.adjusted() >= x.Context.minScale()\n}", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (c *Candy) IsNormal() bool {\n\treturn c._type > 0 && c._type <= NbCandyType\n}", "func (me TxsdPresentationAttributesFontSpecificationFontVariant) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (me TxsdFeBlendTypeMode) IsNormal() bool { return me.String() == \"normal\" }", "func IsNormalFlag(s AbnormalFlag) bool {\n\treturn s == AbnormalFlagEmpty || s == AbnormalFlagNormal\n}", "func (k KernSubtable) IsVariation() bool {\n\treturn k.coverage&kerxVariation != 0\n}", "func (me TxsdPresentationAttributesFontSpecificationFontStretch) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (gdt *Vector3) IsNormalized() Bool {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_is_normalized(GDNative.api, arg0)\n\n\treturn Bool(ret)\n}", "func (pmf PMF) IsNormalized() bool {\n\tdelta := math.Abs(1.0 - float64(pmf.Sum()))\n\treturn delta <= maxDelta\n}", "func (a Vec2) Normalized() (v Vec2, ok bool) {\n\tlength := math.Sqrt(a.X*a.X + a.Y*a.Y)\n\tif Equal(length, 0) {\n\t\treturn Vec2Zero, false\n\t}\n\treturn Vec2{\n\t\ta.X / length,\n\t\ta.Y / length,\n\t}, true\n}", "func (me TxsdPresentationAttributesFontSpecificationFontStyle) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.gogitTreeEntry.Mode == filemode.Submodule\n}", "func (tk Tokens) IsSubCat() bool {\n\treturn tk.SubCat() == tk\n}", "func Subdivide(reg RegionNumerics) bool {\n\tif !Uniform(reg) {\n\t\treg.Split()\n\t\treturn true\n\t}\n\treturn false\n}", "func (me TxsdPresentationAttributesTextContentElementsUnicodeBidi) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.entryMode == EntryModeCommit\n}", "func Normal(mean, sd float64) float64 {\n\treturn rand.NormFloat64()*sd + mean\n}", "func (tk Kinds) IsSubCat() bool {\n\treturn tk.SubCat() == tk\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func Split(s float64) bool {\n\treturn s > 0.0 && s < 1.0\n}", "func (me TxsdPresentationAttributesFontSpecificationFontWeight) IsNormal() bool {\n\treturn me.String() == \"normal\"\n}", "func (tp Type) IsNormalTable() bool {\n\treturn tp == NormalTable\n}", "func (b *BasicShape) NormalAt(geometry.Vector) geometry.Vector {\n\tpanic(\"NormalAt is not implemented for basic shape\")\n}", "func (s Sphere) Normal(p vector.Vec4) vector.Vec4 {\n\treturn vector.Subtract(&s.origin, &p)\n}", "func TestSubtype(tau TypeT, sigma TypeT) bool {\n\treturn int32(1) == int32(C.yices_test_subtype(C.type_t(tau), C.type_t(sigma)))\n}", "func isBtrfsSubVolume(subvolPath string) bool {\n\tfs := syscall.Stat_t{}\n\terr := syscall.Lstat(subvolPath, &fs)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// Check if BTRFS_FIRST_FREE_OBJECTID\n\tif fs.Ino != 256 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (m Matrix3) IsScale() bool {\n\treturn m[0][1] == 0 && m[1][0] == 0 && m.IsAffine()\n}", "func (me TcolorModeEnumType) IsNormal() bool { return me == \"normal\" }", "func (r RuleName) IsNormalize() bool {\n\treturn r < startExploreRule\n}", "func IsSuperUser(username string) bool {\n\tu, err := GetUser(models.User{\n\t\tUsername: username,\n\t})\n\tlog.Debugf(\"Check if user %s is super user\", username)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to get user from DB, username: %s, error: %v\", username, err)\n\t\treturn false\n\t}\n\treturn u != nil && u.UserID == 1\n}", "func (s String) IsSuperset(other String) bool {\n\treturn other.IsSubset(s)\n}", "func (s1 Int64) IsSuperset(s2 Int64) bool {\n\treturn cast(s1).IsSuperset(cast(s2))\n}", "func (m *VnSubnetsType) IsFlatSubnet() bool {\n\tvnIpamSubnets := m.GetIpamSubnets()\n\tif len(vnIpamSubnets) != 1 || vnIpamSubnets[0].GetSubnet().GetIPPrefix() != \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (n *Normal) Variance() float64 {\n\treturn n.variance\n}", "func (norm Normal) StdDev() float64 {\n\treturn norm.Sigma\n}", "func (c Category) IsSubSet() bool {\n\treturn c.Sub != 0\n}", "func (z *Int) SubOverflow(x, y *Int) bool {\n\tvar (\n\t\tunderflow bool\n\t)\n\tz[0], underflow = u64Sub(x[0], y[0], underflow)\n\tz[1], underflow = u64Sub(x[1], y[1], underflow)\n\tz[2], underflow = u64Sub(x[2], y[2], underflow)\n\tz[3], underflow = u64Sub(z[3], y[3], underflow)\n\treturn underflow\n}", "func SubNormalise(attr *StatusAttribute, v int64) float64 {\n\treturn statusNormalise(attr, v)\n}", "func StandardNormalCDF(x float64) (r float64) {\n\tsum := x\n\tvalue := x\n\tfor i := 1; i <= 1000; i++ {\n\t\tvalue = (value * x * x / (2*float64(i) + 1))\n\t\tsum += value\n\t}\n\tr = 0.5 + (sum/math.Sqrt(2*math.Pi))*math.Exp(-(x*x)/2)\n\treturn\n}", "func (v Vector) IsVertical() bool {\n\treturn math.Abs(v.Y) > 1e-8 && math.Abs(v.X) < 1e-8 && math.Abs(v.Z) < 1e-8\n}", "func (s *Set) IsSuperset(other *Set) bool {\n\treturn other.IsSubset(s)\n}", "func (me TxsdPresentationAttributesGraphicsShapeRendering) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func IsSuperUser(ctx context.Context, username string) bool {\n\tu, err := user.Mgr.GetByName(ctx, username)\n\tif err != nil {\n\t\t// LDAP user can't be found before onboard to Harbor\n\t\tlog.Debugf(\"Failed to get user from DB, username: %s, error: %v\", username, err)\n\t\treturn false\n\t}\n\treturn u.UserID == 1\n}", "func (norm Normal) Variance() float64 {\n\treturn math.Pow(norm.Sigma, 2.0)\n}", "func (m *Model) IsRegression() bool { return m.target.IsNumeric() }", "func (tk Tokens) InSubCat(other Tokens) bool {\n\treturn tk.SubCat() == other.SubCat()\n}", "func IsSuperAdmin(user *models.User) bool {\n\treturn user.IsSuperAdmin\n}", "func (n *Normal) StdDev() float64 {\n\treturn n.stddev\n}", "func IsSubvolume(path string) bool {\n\tout, err := exec.Command(\"btrfs\", \"subvolume\", \"show\", path).CombinedOutput()\n\tlog.Check(log.DebugLevel, \"Checking is path BTRFS subvolume\", err)\n\treturn strings.Contains(string(out), \"Subvolume ID\")\n}", "func (r *Rect) NormalSDF(c Coord) (Coord, float64) {\n\tvar n Coord\n\tres := r.genericSDF(c, &n, nil)\n\treturn n, res\n}", "func (_Auditable *AuditableCaller) IsSuperuser(opts *bind.CallOpts, _addr common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Auditable.contract.Call(opts, out, \"isSuperuser\", _addr)\n\treturn *ret0, err\n}", "func (s *NumSeries) SampleStdDev() float64 {\n\treturn math.Sqrt(s.SampleVariance())\n}", "func (o *CatalogEntry) HasSubregionName() bool {\n\tif o != nil && o.SubregionName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (this *KeyspaceTerm) IsInCorrSubq() bool {\n\treturn (this.property & TERM_IN_CORR_SUBQ) != 0\n}", "func (b *Builder) IsSupersetOf(rhs interface{}) *predicate.Predicate {\n\tb.p.RegisterPredicate(impl.IsSupersetOf(rhs))\n\tif b.t != nil {\n\t\tb.t.Helper()\n\t\tEvaluate(b)\n\t}\n\treturn &b.p\n}", "func (o *Volume) HasSubregionName() bool {\n\tif o != nil && o.SubregionName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Volume) HasSubregionName() bool {\n\tif o != nil && o.SubregionName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func LogNormalStd(μ, σ float64) float64 {\n\treturn sqrt(LogNormalVar(μ, σ))\n}", "func (s *Operation) IsIngrediant() bool {\n\treturn false\n}", "func TestGet_StandardDeviation(t *testing.T) {\n\tdata := []float64{1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299}\n\tmean, stdev_s := normality.Get_AverageAndStandardDeviation(&data)\n\t// Expected values (Correct answer)\n\t// mean = 1328.6\n\t// stdev_s = 27.46391571984349\n\tfmt.Println(\" Mean : \", mean)\n\tfmt.Println(\"Standard Deviation : \", stdev_s)\n}", "func (ds *Dataset) SampleStandardDeviation() float64 {\n\treturn math.Sqrt(ds.SampleVariance())\n}", "func (d *MyDecimal) IsNegative() bool {\n\ttrace_util_0.Count(_mydecimal_00000, 34)\n\treturn d.negative\n}", "func NormalMode() bool {\n\treturn mode == 0\n}", "func (v Vector) IsOrth(w Vector) bool {\n\treturn v.Dot(w) == 0\n}", "func (f *FaultDomain) IsAncestorOf(d *FaultDomain) bool {\n\tif f.Empty() {\n\t\t// root is the ancestor of all\n\t\treturn true\n\t}\n\tif f.NumLevels() > d.NumLevels() {\n\t\t// f can't be an ancestor - d is a higher-level domain\n\t\treturn false\n\t}\n\tif f.Equals(d) {\n\t\treturn true\n\t}\n\tfor i, domain1 := range f.Domains {\n\t\tdomain2 := d.Domains[i]\n\t\tif domain1 != domain2 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (d Decimal) IsNegative() bool {\n\treturn d.Sign() == -1\n}", "func (me TstyleStateEnumType) IsNormal() bool { return me == \"normal\" }", "func IsTypeSubTypeOf(schema Schema, maybeSubType Type, superType Type) bool {\n\t// Equivalent type is a valid subtype\n\tif maybeSubType == superType {\n\t\treturn true\n\t}\n\n\tswitch superType := superType.(type) {\n\tcase NonNull:\n\t\t// If superType is non-null, maybeSubType must also be non-null.\n\t\tif maybeSubType, ok := maybeSubType.(NonNull); ok {\n\t\t\treturn IsTypeSubTypeOf(schema, maybeSubType.InnerType(), superType.InnerType())\n\t\t}\n\t\treturn false\n\n\tcase List:\n\t\t// If superType type is a list, maybeSubType type must also be a list.\n\t\tif maybeSubType, ok := maybeSubType.(List); ok {\n\t\t\treturn IsTypeSubTypeOf(schema, maybeSubType.ElementType(), superType.ElementType())\n\t\t}\n\t\treturn false\n\n\tcase AbstractType:\n\t\t// If superType type is an abstract type, maybeSubType type may be a currently possible object\n\t\t// type.\n\t\tif maybeSubType, ok := maybeSubType.(Object); ok {\n\t\t\treturn schema.PossibleTypes(superType).Contains(maybeSubType)\n\t\t}\n\t\treturn false\n\n\tdefault:\n\t\tif maybeSubType, ok := maybeSubType.(NonNull); ok {\n\t\t\t// If superType is nullable, maybeSubType may be non-null or nullable.\n\t\t\treturn IsTypeSubTypeOf(schema, maybeSubType.InnerType(), superType)\n\t\t}\n\n\t\t// Otherwise, the child type is not a valid subtype of the parent type.\n\t\treturn false\n\t}\n}", "func (t Torus) Sub(a, b Point) Point {\n\ta, b = t.normPair(a, b)\n\treturn a.Sub(b)\n}", "func (r Ray) InAABB(pos Vec) bool {\n\tp := r.O.To(pos)\n\tif r.V.Y == 0 {\n\t\tp.Y = 0\n\t} else {\n\t\tp.Y /= r.V.Y\n\t}\n\tif r.V.X == 0 {\n\t\tp.X = 0\n\t} else {\n\t\tp.X /= r.V.X\n\t}\n\treturn p.X <= 1 && p.Y <= 1 && p.X >= 0 && p.Y >= 0\n}", "func (rc *ResourceCommand) IsDeleteSubcommand(cmd string) bool {\n\treturn cmd == rc.deleteCmd.FullCommand()\n}", "func (r Response) IsEntity() bool {\n\treturn r.isType(TypeEntity)\n}", "func (_BREM *BREMCaller) IsSuperuser(opts *bind.CallOpts, _addr common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _BREM.contract.Call(opts, out, \"isSuperuser\", _addr)\n\treturn *ret0, err\n}", "func (g SimplePoint) IsGeometry() bool {\n\treturn true\n}", "func (_BREMFactory *BREMFactoryCaller) IsSuperuser(opts *bind.CallOpts, _addr common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _BREMFactory.contract.Call(opts, out, \"isSuperuser\", _addr)\n\treturn *ret0, err\n}", "func (_Auditable *AuditableSession) IsSuperuser(_addr common.Address) (bool, error) {\n\treturn _Auditable.Contract.IsSuperuser(&_Auditable.CallOpts, _addr)\n}", "func (vec Vector2) IsUnit() bool {\n\treturn vec.Len() == 1\n}", "func (ds *Dataset) StandardDeviation() float64 {\n\treturn math.Sqrt(ds.Variance())\n}", "func (c *Controller) IsSuperAdmin(nick string) (bool, error) {\n\tdata, err := c.accountCache.Get(nick)\n\tif err == nil {\n\t\tisSuperAdmin, ok := data.(bool)\n\t\tif ok {\n\t\t\treturn isSuperAdmin, nil\n\t\t}\n\t}\n\n\tif err != cache.ErrNotFound {\n\t\treturn false, err\n\t}\n\n\taccount, err := modelhelper.GetAccount(nick)\n\tif err == mgo.ErrNotFound {\n\t\treturn false, nil\n\t}\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif err := c.accountCache.Set(nick, account.HasFlag(\"super-admin\")); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn account.HasFlag(\"super-admin\"), nil\n}", "func (d *MyDecimal) IsNegative() bool {\n\treturn d.negative\n}", "func (me TxsdPresentationAttributesFontSpecificationFontStyle) IsOblique() bool {\n\treturn me.String() == \"oblique\"\n}", "func LogNormalVar(μ, σ float64) float64 {\n\treturn exp(σ*σ) - 1*exp(2*μ+σ*σ)\n}", "func (mi *mountInfoParser) isSysboxfsSubMountOf(info, baseInfo *mountInfo) bool {\n\tif info.ParentID != baseInfo.MountID {\n\t\treturn false\n\t}\n\n\t// Note: submounts may contain mounts *not* managed by sysbox-fs (e.g., if a\n\t// user mounts something under /proc/*). Check if the given submount is\n\t// managed by sysbox-fs or not.\n\n\trelMountpoint := strings.TrimPrefix(info.MountPoint, baseInfo.MountPoint)\n\n\tswitch baseInfo.FsType {\n\tcase \"proc\":\n\t\tif isMountpointUnder(relMountpoint, mi.mh.procMounts) ||\n\t\t\tisMountpointUnder(relMountpoint, mi.cntr.ProcRoPaths()) ||\n\t\t\tisMountpointUnder(relMountpoint, mi.cntr.ProcMaskPaths()) {\n\t\t\treturn true\n\t\t}\n\tcase \"sysfs\":\n\t\tif isMountpointUnder(relMountpoint, mi.mh.sysMounts) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (me TxsdPresentationAttributesGraphicsTextRendering) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func (s UserSet) IsSuperUser() bool {\n\tres := s.Collection().Call(\"IsSuperUser\")\n\tresTyped, _ := res.(bool)\n\treturn resTyped\n}", "func (s1 Byte) IsSuperset(s2 Byte) bool {\n\tfor item := range s2 {\n\t\tif !s1.Has(item) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (set *AppleSet) IsSuperset(other *AppleSet) bool {\n\treturn other.IsSubset(set)\n}", "func (m *VMStatus) GetHasSubStatus() (x bool) {\n\tif m == nil {\n\t\treturn x\n\t}\n\treturn m.HasSubStatus\n}", "func (me TxsdPresentationAttributesFontSpecificationFontVariant) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func (p *Point) IsIn(x float64, y float64, scale float64) bool {\n\tlen := math.Pow(2, scale)\n\n\treturn p.X >= x-len/2 && p.X < x+len/2 && p.Y >= y-len/2 && p.Y < y+len/2\n}", "func (info *BaseEndpointInfo) IsTerminating() bool {\n\treturn info.Terminating\n}", "func (this *KeyspaceTerm) IsUnderNL() bool {\n\treturn (this.property & TERM_UNDER_NL) != 0\n}", "func (me TxsdPresentationAttributesTextContentElementsDominantBaseline) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func (_Auditable *AuditableCallerSession) IsSuperuser(_addr common.Address) (bool, error) {\n\treturn _Auditable.Contract.IsSuperuser(&_Auditable.CallOpts, _addr)\n}", "func (r Response) IsVeryNegative() bool {\n\treturn r.Sentiment == SentimentVeryNegative\n}", "func (l *labelInfo) isSuperTenant() bool {\n\tif l.Tenant == \"\" || strings.ToLower(string(l.Tenant)) == frontend.GetDefaultTenant() {\n\t\treturn true\n\t}\n\treturn false\n}", "func (m *NetworkIpam) IsFlatSubnet() bool {\n\treturn m.IpamSubnetMethod == flatSubnet\n}", "func (k Keeper) IsDerivativeDenom(ctx sdk.Context, denom string) bool {\n\tvalAddr, err := types.ParseLiquidStakingTokenDenom(denom)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t_, found := k.stakingKeeper.GetValidator(ctx, valAddr)\n\treturn found\n}", "func (me TxsdPresentationAttributesTextContentElementsAlignmentBaseline) IsBaseline() bool {\n\treturn me.String() == \"baseline\"\n}" ]
[ "0.65229833", "0.5292802", "0.4906575", "0.48972237", "0.48554552", "0.47551087", "0.47263622", "0.4701936", "0.46909374", "0.46324718", "0.45682678", "0.4566828", "0.45386723", "0.44625965", "0.44621158", "0.44608685", "0.4387859", "0.43782654", "0.4346102", "0.4341811", "0.4324474", "0.431987", "0.42926782", "0.42760673", "0.4267948", "0.42562371", "0.42558157", "0.42323008", "0.41786864", "0.41718674", "0.41449445", "0.41447532", "0.4133068", "0.41235197", "0.4122223", "0.41029522", "0.40764356", "0.4065529", "0.40595743", "0.40587524", "0.40529242", "0.4050953", "0.4049111", "0.40411884", "0.40407673", "0.40155113", "0.4014567", "0.40121233", "0.4008378", "0.4004784", "0.400391", "0.4003791", "0.3992237", "0.39816135", "0.39733458", "0.39656287", "0.39620143", "0.39620143", "0.39617407", "0.39600432", "0.39412445", "0.3940522", "0.39404434", "0.3939064", "0.39216805", "0.39106035", "0.39053878", "0.39012626", "0.38942125", "0.38924158", "0.38846907", "0.38766906", "0.3875022", "0.38747972", "0.3863955", "0.38627717", "0.3855691", "0.3843165", "0.38418707", "0.38337636", "0.38249582", "0.38231885", "0.3820037", "0.3819841", "0.38026324", "0.37997806", "0.37930882", "0.37906653", "0.37805545", "0.37700963", "0.37681633", "0.3761185", "0.37582797", "0.37576652", "0.37538674", "0.37536225", "0.37449425", "0.37442708", "0.37347874", "0.37298405" ]
0.8129674
0
IsInf returns true if x is an infinity according to sign. If sign > 0, IsInf reports whether x is positive infinity. If sign < 0, IsInf reports whether x is negative infinity. If sign == 0, IsInf reports whether x is either infinity.
func (x *Big) IsInf(sign int) bool { return sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func (x *Float) IsInf() bool {}", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func IsInfinite(f float64, sign int) bool {\n\n\treturn math.IsInf(f, sign)\n}", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func (e stringElement) IsInf(sign int) bool {\n\tswitch strings.ToLower(e.e) {\n\tcase \"inf\", \"-inf\", \"+inf\":\n\t\tf, err := strconv.ParseFloat(e.e, 64)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn math.IsInf(f, sign)\n\t}\n\treturn false\n}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func FloatIsInf(x *big.Float,) bool", "func (Integer) IsPosInf() bool {\n\treturn false\n}", "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func IsInf(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsInf\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (c curve) IsAtInfinity(X, Y *big.Int) bool {\n\treturn X.Sign() == 0 && Y.Sign() == 0\n}", "func (*BigInt) IsPosInf() bool {\n\treturn false\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (p *G1Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func (p *G2Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func Inf(a, b interface{}, f Func) bool {\n\treturn f(a, b) == -1\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func (z *Big) SetInf(signbit bool) *Big {\n\tif signbit {\n\t\tz.form = ninf\n\t} else {\n\t\tz.form = pinf\n\t}\n\treturn z\n}", "func IsInFinite(arg float64, ch int) bool {\n\treturn math.IsInf(arg, ch)\n}", "func IsFinite(arg float64, ch int) bool {\n\treturn !math.IsInf(arg, ch)\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func (space RealIntervalSpace) Inf() float64 {\n\treturn space.Min\n}", "func posInf() float64 {\n\treturn math.Inf(1) // argument specifies positive infinity\n}", "func (rx *RotationX) IsInfinite() bool {\r\n\treturn rx.Primitive.IsInfinite()\r\n}", "func (x *Big) IsFinite() bool { return x.form & ^signbit == 0 }", "func (f Float) IsNaN() bool {\n\t// NaN + NaN should be NaN in consideration\n\treturn math.IsNaN(f.high) || math.IsNaN(f.low)\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func Inf() complex128 {\n\tinf := math.Inf(1)\n\treturn complex(inf, inf)\n}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func FloatSignbit(x *big.Float,) bool", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func FloatSign(x *big.Float,) int", "func IsNan(arg float64) bool {\n\treturn math.IsNaN(arg)\n}", "func IsNan(f float64) bool {\n\n\treturn math.IsNaN(f)\n}", "func (i Int) IsZero() bool {\n\treturn i.i.Sign() == 0\n}", "func Inf32(sign int) float32 {\n\treturn float32(math.Inf(sign))\n}", "func (g GLC) IsFinite() (bool, error) {\n\tvar expandedVariables []string\n\treturn g.isFinite(g.InitialVariable, expandedVariables)\n}", "func NewInfinityValue() InfinityValue {\n\treturn infinityValue\n}", "func Sinf(a float64) float64 {\n\treturn float64(math.Sin(float64(a)))\n}", "func TestPriceCompareInfZero(t *testing.T) {\n\tinfPrice := &Price{\n\t\tAmountWant: uint64(1),\n\t\tAmountHave: 0,\n\t}\n\tzeroPrice := &Price{\n\t\tAmountWant: 0,\n\t\tAmountHave: uint64(1),\n\t}\n\n\tif leftSide := infPrice.Cmp(zeroPrice); leftSide != 1 {\n\t\tt.Errorf(\"Error, infinite price when compared to zero should be greater\")\n\t\treturn\n\t}\n\tif rightSide := zeroPrice.Cmp(infPrice); rightSide != -1 {\n\t\tt.Errorf(\"Error, zero price when compared to infinite should be greater\")\n\t\treturn\n\t}\n\treturn\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (v Value) IsNaN() bool {\n\treturn v.v.Kind() == reflect.Float64 && math.IsNaN(v.v.Float())\n}", "func (x *Float) Signbit() bool {}", "func (x *Big) Sign() int {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif (x.IsFinite() && x.isZero()) || x.IsNaN(0) {\n\t\treturn 0\n\t}\n\tif x.form&signbit != 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (ec *EC) Infinite(p *Point) bool {\n\tif p.X == nil || p.Y == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func Infinity() Point {\n\treturn Point{1, 0}\n}", "func Inf32(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf32\n\t} else {\n\t\tv = uvneginf32\n\t}\n\treturn Float32frombits(v)\n}", "func Benchmark_FindNaNOrInf(b *testing.B) {\n\tfuncs := []taggedMultiBenchVarargsFunc{\n\t\t{\n\t\t\tf: findNaNOrInfSimdSubtask,\n\t\t\ttag: \"SIMD\",\n\t\t},\n\t\t{\n\t\t\tf: findNaNOrInfBitwiseSubtask,\n\t\t\ttag: \"Bitwise\",\n\t\t},\n\t\t{\n\t\t\tf: findNaNOrInfStandardSubtask,\n\t\t\ttag: \"Standard\",\n\t\t},\n\t}\n\trand.Seed(1)\n\tfor _, f := range funcs {\n\t\tmultiBenchmarkVarargs(f.f, f.tag+\"Long\", 100000, func() interface{} {\n\t\t\tmain := make([]float64, 30000)\n\t\t\t// Results were overly influenced by RNG if the number of NaNs/infs in\n\t\t\t// the slice was not controlled.\n\t\t\tfor i := 0; i < 30; i++ {\n\t\t\t\tfor {\n\t\t\t\t\tpos := rand.Intn(len(main))\n\t\t\t\t\tif main[pos] != math.Inf(0) {\n\t\t\t\t\t\tmain[pos] = math.Inf(0)\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\treturn float64Args{\n\t\t\t\tmain: main,\n\t\t\t}\n\t\t}, b)\n\t}\n}", "func (f Float) IsZero() bool {\n\treturn !f.Valid\n}", "func (x *Big) IsNaN(quiet int) bool {\n\treturn quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan\n}", "func (v Value) IsSigned() bool {\n\treturn IsSigned(v.typ)\n}", "func FloatIsInt(x *big.Float,) bool", "func IsNaN(f float32) (is bool) {\n\t// IEEE 754 says that only NaNs satisfy `f != f`.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf`\n\treturn f != f\n}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (x *Big) IsInt() bool {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn false\n\t}\n\n\t// 0, 5000, 40\n\tif x.isZero() || x.exp >= 0 {\n\t\treturn true\n\t}\n\n\txp := x.Precision()\n\texp := x.exp\n\n\t// 0.001\n\t// 0.5\n\tif -exp >= xp {\n\t\treturn false\n\t}\n\n\t// 44.00\n\t// 1.000\n\tif x.isCompact() {\n\t\tfor v := x.compact; v%10 == 0; v /= 10 {\n\t\t\texp++\n\t\t}\n\t\t// Avoid the overhead of copying x.unscaled if we know for a fact it's not\n\t\t// an integer.\n\t} else if x.unscaled.Bit(0) == 0 {\n\t\tv := new(big.Int).Set(&x.unscaled)\n\t\tr := new(big.Int)\n\t\tfor {\n\t\t\tv.QuoRem(v, c.TenInt, r)\n\t\t\tif r.Sign() != 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\texp++\n\t\t}\n\t}\n\treturn exp >= 0\n}", "func (f Float) Signbit() bool {\n\t// 0b1000000000000000\n\treturn f.se&0x8000 != 0\n}", "func isFloatInt(floatValue float64) bool {\n\treturn math.Mod(floatValue, 1.0) == 0\n}", "func Sign(x *big.Int) int {\n\treturn x.Sign()\n}", "func Finite(x *big.Rat) bool {\n\t// calling x.Denom() can modify x (populates b) so be extra careful\n\txx := new(big.Rat).Set(x)\n\n\td := xx.Denom()\n\ti := new(big.Int)\n\tm := new(big.Int)\n\n\tfor {\n\t\tswitch {\n\t\tcase d.Cmp(big1) == 0:\n\t\t\treturn true\n\t\tcase remQuo(d, big2, i, m).Sign() == 0:\n\t\t\td.Set(i)\n\t\tcase remQuo(d, big5, i, m).Sign() == 0:\n\t\t\td.Set(i)\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format\n\t//\n\t// 0b000000000000001 - 0b111111111111110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-16383) * 1.mant_2\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b111111111111111\n\tcase 0x7FFF:\n\t\t// Inf or NaN\n\t\tif f.m == 0x8000000000000000 {\n\t\t\t// +-Inf\n\t\t\t// 10 zero\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\t// 10 non-zero\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b000000000000000\n\tcase 0x0000:\n\t\tif f.m == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-16382) * 0.mant_2\n\t\texponent = -16382\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\tlead := f.Lead()\n\tfrac := f.Frac()\n\ts := fmt.Sprintf(\"%s0b%d.%063bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func IsZero(x float64) bool {\n\treturn EQ(x, 0)\n}", "func (f Float) Signbit() bool {\n\t// first bit is sign bit: 0b1000000000000000\n\treturn f.bits&0x8000 != 0\n}", "func IsSigned(t Type) bool {\n\treturn int(t)&(flagIsIntegral|flagIsUnsigned) == flagIsIntegral\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tfrac := f.Frac()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Half-precision_floating-point_format#Exponent_encoding\n\t//\n\t// 0b00001 - 0b11110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-15) * 1.mant_2\n\tlead := 1\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b11111\n\tcase 0x1F:\n\t\t// Inf or NaN\n\t\tif frac == 0 {\n\t\t\t// +-Inf\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b00000\n\tcase 0x00:\n\t\tif frac == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-14) * 0.mant_2\n\t\tlead = 0\n\t\texponent = -14\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\ts := fmt.Sprintf(\"%s0b%d.%010bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func (d Decimal) IsNegative() bool {\n\treturn d.Sign() == -1\n}", "func (s Series) IsNaN() []bool {\n\tret := make([]bool, s.Len())\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.elements.Elem(i).IsNaN()\n\t}\n\treturn ret\n}", "func (v Value) IsIntegral() bool {\n\treturn IsIntegral(v.typ)\n}", "func (f Float32) IsZero() bool {\n\treturn !f.Valid\n}", "func (v *Variant) IsFloating() bool {\n\treturn gobool(C.g_variant_is_floating(v.native()))\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func Loginf(s string) {\n\n\twritelog(s, INF)\n\treturn\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\tif f.IsNaN() {\n\t\treturn x, true\n\t}\n\th := big.NewFloat(f.high).SetPrec(precision)\n\tl := big.NewFloat(f.low).SetPrec(precision)\n\tx.Add(h, l)\n\n\tzero := big.NewFloat(0).SetPrec(precision)\n\tif x.Cmp(zero) == 0 && math.Signbit(f.high) {\n\t\t// -zero\n\t\tif !x.Signbit() {\n\t\t\tx.Neg(x)\n\t\t}\n\t}\n\n\treturn x, false\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func (d Decimal) IsInteger() bool {\n\t// The most typical case, all decimal with exponent higher or equal 0 can be represented as integer\n\tif d.exp >= 0 {\n\t\treturn true\n\t}\n\t// When the exponent is negative we have to check every number after the decimal place\n\t// If all of them are zeroes, we are sure that given decimal can be represented as an integer\n\tvar r big.Int\n\tq := new(big.Int).Set(d.value)\n\tfor z := abs(d.exp); z > 0; z-- {\n\t\tq.QuoRem(q, tenInt, &r)\n\t\tif r.Cmp(zeroInt) != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func isNaN64(f float64) bool { return f != f }", "func (d Direction) Infinity() string { return infty[d] }", "func (e Extrinsic) IsSigned() bool {\n\treturn e.Version&ExtrinsicBitSigned == ExtrinsicBitSigned\n}", "func (a Vec2) IsNaN() bool {\n\treturn math.IsNaN(a.X) || math.IsNaN(a.Y)\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func (z *Int) Sgt(x *Int) bool {\n\tzSign := z.Sign()\n\txSign := x.Sign()\n\n\tswitch {\n\tcase zSign >= 0 && xSign < 0:\n\t\treturn true\n\tcase zSign < 0 && xSign >= 0:\n\t\treturn false\n\tdefault:\n\t\treturn z.Gt(x)\n\t}\n}", "func (d *MyDecimal) IsNegative() bool {\n\ttrace_util_0.Count(_mydecimal_00000, 34)\n\treturn d.negative\n}", "func IsFinite(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsFinite\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func IsValidFloat64(val float64) bool {\n\tif math.IsNaN(val) {\n\t\treturn false\n\t}\n\tif math.IsInf(val, 0) {\n\t\treturn false\n\t}\n\treturn true\n}", "func Int(num cty.Value) (cty.Value, error) {\n\tif num == cty.PositiveInfinity || num == cty.NegativeInfinity {\n\t\treturn cty.NilVal, fmt.Errorf(\"can't truncate infinity to an integer\")\n\t}\n\treturn IntFunc.Call([]cty.Value{num})\n}", "func IsNaN32(f float32) (is bool) {\n\tx := Float32bits(f)\n\treturn x&uvinf32 == uvinf32 && x != uvinf32 && x != uvneginf32\n}", "func (i Int8) IsZero() bool {\n\treturn !i.Valid\n}", "func (n *Number) IsInt() bool {\n\treturn n.isInteger\n}" ]
[ "0.85563856", "0.80208313", "0.8010691", "0.7959639", "0.791601", "0.7724972", "0.7723768", "0.7549482", "0.7369673", "0.7367579", "0.7246049", "0.72361714", "0.72230864", "0.7112551", "0.6925236", "0.667426", "0.6602583", "0.659049", "0.658996", "0.6586077", "0.6585602", "0.64697284", "0.6463401", "0.6317858", "0.6305012", "0.6245018", "0.61025167", "0.6087284", "0.60844344", "0.5964249", "0.5945306", "0.58344406", "0.5834298", "0.57946885", "0.57577455", "0.5659403", "0.5625129", "0.560086", "0.560086", "0.5559725", "0.5510125", "0.5469363", "0.54221535", "0.5421785", "0.5417824", "0.54115874", "0.5390281", "0.53785884", "0.5373146", "0.5371033", "0.53588295", "0.53470415", "0.5328124", "0.5321316", "0.5312458", "0.5284028", "0.5255257", "0.5225666", "0.5219985", "0.52128613", "0.51500356", "0.51261926", "0.5110178", "0.50983536", "0.50887036", "0.5079727", "0.5053967", "0.5039767", "0.50344366", "0.5000629", "0.49941266", "0.49770996", "0.49764353", "0.497483", "0.494973", "0.4942276", "0.4930637", "0.49179128", "0.490895", "0.4892368", "0.48892152", "0.48892152", "0.4879151", "0.48571688", "0.48498476", "0.48471856", "0.48335257", "0.48234373", "0.48217723", "0.48180544", "0.47909796", "0.47909796", "0.47796556", "0.47752768", "0.47472626", "0.47372383", "0.47179887", "0.46986163", "0.46861577", "0.46761692" ]
0.87394303
0
IsNaN returns true if x is NaN. If sign > 0, IsNaN reports whether x is quiet NaN. If sign < 0, IsNaN reports whether x is signaling NaN. If sign == 0, IsNaN reports whether x is either NaN.
func (x *Big) IsNaN(quiet int) bool { return quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsNan(arg float64) bool {\n\treturn math.IsNaN(arg)\n}", "func (v Value) IsNaN() bool {\n\treturn v.v.Kind() == reflect.Float64 && math.IsNaN(v.v.Float())\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func IsNan(f float64) bool {\n\n\treturn math.IsNaN(f)\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func (s Series) IsNaN() []bool {\n\tret := make([]bool, s.Len())\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.elements.Elem(i).IsNaN()\n\t}\n\treturn ret\n}", "func (f Float) IsNaN() bool {\n\t// NaN + NaN should be NaN in consideration\n\treturn math.IsNaN(f.high) || math.IsNaN(f.low)\n}", "func (x *Float) IsInf() bool {}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func IsNaN(f float32) (is bool) {\n\t// IEEE 754 says that only NaNs satisfy `f != f`.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf`\n\treturn f != f\n}", "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func (a Vec2) IsNaN() bool {\n\treturn math.IsNaN(a.X) || math.IsNaN(a.Y)\n}", "func (p *G1Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (c curve) IsAtInfinity(X, Y *big.Int) bool {\n\treturn X.Sign() == 0 && Y.Sign() == 0\n}", "func (x *Big) IsInf(sign int) bool {\n\treturn sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf\n}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func FloatIsInf(x *big.Float,) bool", "func (e stringElement) IsNaN() bool {\n\tif !e.valid {\n\t\treturn true\n\t}\n\tf, err := strconv.ParseFloat(e.e, 64)\n\tif err == nil {\n\t\treturn math.IsNaN(f)\n\t}\n\treturn true\n}", "func (p *G2Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (s Series) HasNaN() bool {\n\tfor i := 0; i < s.Len(); i++ {\n\t\tif s.elements.Elem(i).IsNaN() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func IsInfinite(f float64, sign int) bool {\n\n\treturn math.IsInf(f, sign)\n}", "func IsNaN32(f float32) (is bool) {\n\tx := Float32bits(f)\n\treturn x&uvinf32 == uvinf32 && x != uvinf32 && x != uvneginf32\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func IsNaN32(f float32) (is bool) {\n\treturn math.IsNaN(float64(f))\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func IsZero(x float64) bool {\n\treturn EQ(x, 0)\n}", "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func IsNan(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsNan\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (s *Series) IsNa() *Series {\n\tdata := make([]interface{}, 0, s.Len())\n\tfor _, val := range s.Data {\n\t\tif val == nil {\n\t\t\tdata = append(data, true)\n\t\t} else {\n\t\t\tdata = append(data, false)\n\t\t}\n\t}\n\n\tboolS := s.ShallowCopy()\n\tboolS.Data = data\n\tboolS.column.Dtype = base.Bool\n\tboolS.column.ColIndex = 0\n\tboolS.column.Name = helpers.FunctionNameWrapper(\"isna\", s.column.Name)\n\n\treturn boolS\n}", "func (z *Big) SetNaN(signal bool) *Big {\n\tif signal {\n\t\tz.form = snan\n\t} else {\n\t\tz.form = qnan\n\t}\n\tz.compact = 0 // payload\n\treturn z\n}", "func nanChecker(want, got float64) bool {\n\ta, b, c := math.IsNaN(want), math.IsNaN(got), (want == got)\n\treturn (a && b) || (!a && !b && c)\n}", "func isNaN64(f float64) bool { return f != f }", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func (s *Series) NotNa() *Series {\n\tdata := make([]interface{}, 0, s.Len())\n\tfor _, val := range s.Data {\n\t\tif val != nil {\n\t\t\tdata = append(data, true)\n\t\t} else {\n\t\t\tdata = append(data, false)\n\t\t}\n\t}\n\n\tboolS := s.ShallowCopy()\n\tboolS.Data = data\n\tboolS.column.Dtype = base.Bool\n\tboolS.column.ColIndex = 0\n\tboolS.column.Name = helpers.FunctionNameWrapper(\"notna\", s.column.Name)\n\n\treturn boolS\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (Integer) IsPosInf() bool {\n\treturn false\n}", "func (z *Big) CheckNaNs(x, y *Big) bool {\n\treturn z.invalidContext(z.Context) || z.checkNaNs(x, y, 0)\n}", "func (v Value) IsSigned() bool {\n\treturn IsSigned(v.typ)\n}", "func (f Float) IsZero() bool {\n\treturn !f.Valid\n}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func (f Float32) IsZero() bool {\n\treturn !f.Valid\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func isNaN(val string) bool {\n\tif val == nan {\n\t\treturn true\n\t}\n\n\t_, err := strconv.ParseFloat(val, 64)\n\n\treturn err != nil\n}", "func (*BigInt) IsPosInf() bool {\n\treturn false\n}", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (i Int) IsZero() bool {\n\treturn i.i.Sign() == 0\n}", "func NaN() float32 { return Float32frombits(uvnan) }", "func (rx *RotationX) IsInfinite() bool {\r\n\treturn rx.Primitive.IsInfinite()\r\n}", "func (e stringElement) IsInf(sign int) bool {\n\tswitch strings.ToLower(e.e) {\n\tcase \"inf\", \"-inf\", \"+inf\":\n\t\tf, err := strconv.ParseFloat(e.e, 64)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn math.IsInf(f, sign)\n\t}\n\treturn false\n}", "func Zero(n float64) bool {\n\treturn NegEpsilon64 <= n && n <= Epsilon64\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func IsInf(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsInf\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (x *Big) Sign() int {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif (x.IsFinite() && x.isZero()) || x.IsNaN(0) {\n\t\treturn 0\n\t}\n\tif x.form&signbit != 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (ms Int64DataPoint) IsNil() bool {\n\treturn *ms.orig == nil\n}", "func isNaN32(f float32) bool { return f != f }", "func FloatSignbit(x *big.Float,) bool", "func (x *Float) Signbit() bool {}", "func IsZeroVal(x interface{}) bool {\n\treturn x == nil || reflect.DeepEqual(x, reflect.Zero(reflect.TypeOf(x)).Interface())\n}", "func (ec *EC) Infinite(p *Point) bool {\n\tif p.X == nil || p.Y == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func (t Timestamp) IsZeroValue() bool {\n\treturn t.IsZero()\n}", "func (i NullInt) IsZero() bool {\n\treturn !i.Valid\n}", "func (v Value) IsZero() bool {\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn !v.Bool()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn v.Int() == 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn v.Uint() == 0\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn math.Float64bits(v.Float()) == 0\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tc := v.Complex()\n\t\treturn math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0\n\tcase reflect.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif !v.Index(i).IsZero() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t\t// return isZeroArray(v)\n\tcase reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:\n\t\treturn v.IsNil()\n\tcase reflect.UnsafePointer:\n\t\treturn v.IsNil()\n\tcase reflect.String:\n\t\treturn v.Len() == 0\n\tcase reflect.Struct:\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tif !v.Field(i).IsZero() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t\t// return isZeroStruct(v)\n\tdefault:\n\t\t// This should never happens, but will act as a safeguard for\n\t\t// later, as a default value doesn't makes sense here.\n\t\t// panic(fmt.Sprintf(\"reflect.Value.IsZero, kind=%b\", v.Kind()))\n\t\treturn false\n\t}\n}", "func (v *V) IsZero() bool {\n\tif v.IsNaV() {\n\t\tpanic(ErrNaV)\n\t}\n\tfor _, e := range v.Data {\n\t\tif !IsNEqual(e, 0) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (v *V) IsNaV() bool {\n\tif len(v.Data) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (n *Number) Zero() bool {\n\tif n.isInteger {\n\t\treturn n.integer.Cmp(&big.Int{}) == 0\n\t} else {\n\t\treturn n.floating == 0\n\t}\n}", "func FloatSign(x *big.Float,) int", "func Inf() complex128 {\n\tinf := math.Inf(1)\n\treturn complex(inf, inf)\n}", "func IsSigned(t Type) bool {\n\treturn int(t)&(flagIsIntegral|flagIsUnsigned) == flagIsIntegral\n}", "func (s *NumSeries) IsZero() bool { return s.weight <= 0 }", "func (a *Array64) NaNSum(axis ...int) *Array64 {\n\tif a.valAxis(&axis, \"NaNSum\") {\n\t\treturn a\n\t}\n\n\tns := func(d []float64) (r float64) {\n\t\tflag := false\n\t\tfor _, v := range d {\n\t\t\tif !math.IsNaN(v) {\n\t\t\t\tflag = true\n\t\t\t\tr += v\n\t\t\t}\n\t\t}\n\t\tif flag {\n\t\t\treturn r\n\t\t}\n\t\treturn math.NaN()\n\t}\n\n\treturn a.Fold(ns, axis...)\n\n}", "func (v Float) Nil() bool {\n\treturn !v.present\n}", "func (a Float32s) IsNil() bool {\n\treturn len(a) == 0\n}", "func (bill Amount) IsPositive() bool {\n\tif bill.Unit == 0 {\n\t\treturn false\n\t}\n\tif bill.Dist <= 0 {\n\t\treturn false\n\t}\n\t// Meet requirements\n\treturn true\n}", "func IsZero(v reflect.Value) bool {\n\t//switch v.Kind() {\n\t//case reflect.Bool:\n\t//\treturn !v.Bool()\n\t//case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t//\treturn v.Int() == 0\n\t//case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t//\treturn v.Uint() == 0\n\t//case reflect.Float32, reflect.Float64:\n\t//\treturn math.Float64bits(v.Float()) == 0\n\t//case reflect.Complex64, reflect.Complex128:\n\t//\tc := v.Complex()\n\t//\treturn math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0\n\t//case reflect.Array:\n\t//\treturn isZeroArray(v)\n\t//case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:\n\t//\treturn v.IsNil()\n\t//case reflect.UnsafePointer:\n\t//\treturn isNil(v)\n\t//case reflect.String:\n\t//\treturn v.Len() == 0\n\t//case reflect.Struct:\n\t//\treturn isZeroStruct(v)\n\t//default:\n\t//\t// This should never happens, but will act as a safeguard for\n\t//\t// later, as a default value doesn't makes sense here.\n\t//\tpanic(fmt.Sprintf(\"reflect.Value.IsZero, kind=%b\", v.Kind()))\n\t//}\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn !v.Bool()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn v.Int() == 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn v.Uint() == 0\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn math.Float64bits(v.Float()) == 0\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tc := v.Complex()\n\t\treturn math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0\n\tcase reflect.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif !v.Index(i).IsZero() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t\t// return isZeroArray(v)\n\tcase reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:\n\t\treturn IsNil(v)\n\tcase reflect.UnsafePointer:\n\t\treturn IsNil(v)\n\tcase reflect.String:\n\t\treturn v.Len() == 0\n\tcase reflect.Struct:\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tif !v.Field(i).IsZero() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t\t// return isZeroStruct(v)\n\tdefault:\n\t\t// This should never happens, but will act as a safeguard for\n\t\t// later, as a default value doesn't makes sense here.\n\t\t// panic(fmt.Sprintf(\"reflect.Value.IsZero, kind=%b\", v.Kind()))\n\t\treturn false\n\t}\n}", "func IsValidFloat64(val float64) bool {\n\tif math.IsNaN(val) {\n\t\treturn false\n\t}\n\tif math.IsInf(val, 0) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (ms DoubleDataPoint) IsNil() bool {\n\treturn *ms.orig == nil\n}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func (space RealIntervalSpace) Inf() float64 {\n\treturn space.Min\n}", "func (v Vec3i) IsNil() bool {\n\tif v.X == 0 && v.Y == 0 && v.Z == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (x *Big) IsFinite() bool { return x.form & ^signbit == 0 }", "func (s Series) Any(skipnan bool) (bool, error) {\n\trs := false\n\tfor i := 0; i < s.Len(); i++ {\n\t\te := s.elements.Elem(i)\n\t\tif !e.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tif !skipnan && e.IsNaN() {\n\t\t\trs = true\n\t\t\tbreak\n\t\t} else if skipnan && e.IsNaN() {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tv, e := e.Bool()\n\t\t\tif e != nil {\n\t\t\t\treturn rs, e\n\t\t\t}\n\t\t\tif v {\n\t\t\t\trs = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn rs, nil\n}", "func (result Result) NaN() Result {\r\n\tresult.AvgDelay = math.NaN()\r\n\tresult.MinDelay = math.NaN()\r\n\tresult.MaxDelay = math.NaN()\r\n\treturn result\r\n}", "func Inf32(sign int) float32 {\n\treturn float32(math.Inf(sign))\n}", "func (v Value) IsZero() bool {\n\treturn toRV(v).IsZero()\n}", "func Inf(a, b interface{}, f Func) bool {\n\treturn f(a, b) == -1\n}", "func (f Frac) IsZero() bool {\n\treturn f.n == 0\n}", "func (t Token) IsZero() bool {\n\t// as each number is already minified, starting with a zero means it is zero\n\treturn (t.TokenType == css.DimensionToken || t.TokenType == css.PercentageToken || t.TokenType == css.NumberToken) && t.Data[0] == '0'\n}" ]
[ "0.7151861", "0.70489705", "0.7027137", "0.69230175", "0.68980867", "0.6880118", "0.6859038", "0.6685041", "0.6491412", "0.64820385", "0.638677", "0.63032633", "0.61607933", "0.6159763", "0.61364555", "0.6083304", "0.60447836", "0.5992494", "0.59710914", "0.5912776", "0.5903947", "0.5872582", "0.5854732", "0.5854732", "0.5826197", "0.58228344", "0.5761528", "0.5760441", "0.57384646", "0.5735623", "0.5681283", "0.5658084", "0.5638943", "0.56293494", "0.55858123", "0.5485715", "0.54749924", "0.54736036", "0.547003", "0.54290926", "0.5420293", "0.5412494", "0.5412494", "0.5410634", "0.53968143", "0.5372", "0.5358414", "0.5348526", "0.5346853", "0.53331155", "0.53276", "0.5325943", "0.5279102", "0.5270121", "0.5269194", "0.52525395", "0.52327365", "0.5207984", "0.51568264", "0.51485336", "0.51246506", "0.51169175", "0.5106782", "0.5069618", "0.5062403", "0.5061094", "0.50402385", "0.5027308", "0.5025028", "0.5021922", "0.5017027", "0.50165975", "0.5013166", "0.49973494", "0.4991625", "0.49599016", "0.49500588", "0.49408177", "0.49292436", "0.489525", "0.4881152", "0.48799178", "0.4879054", "0.48754156", "0.48729882", "0.48723146", "0.48653468", "0.48566645", "0.48444742", "0.48444742", "0.48315126", "0.4811489", "0.4810552", "0.4806564", "0.47932664", "0.4771423", "0.47656217", "0.47654566", "0.47619238", "0.47591737" ]
0.67186636
7
IsInt reports whether x is an integer. Infinity and NaN values are not integers.
func (x *Big) IsInt() bool { if debug { x.validate() } if !x.IsFinite() { return false } // 0, 5000, 40 if x.isZero() || x.exp >= 0 { return true } xp := x.Precision() exp := x.exp // 0.001 // 0.5 if -exp >= xp { return false } // 44.00 // 1.000 if x.isCompact() { for v := x.compact; v%10 == 0; v /= 10 { exp++ } // Avoid the overhead of copying x.unscaled if we know for a fact it's not // an integer. } else if x.unscaled.Bit(0) == 0 { v := new(big.Int).Set(&x.unscaled) r := new(big.Int) for { v.QuoRem(v, c.TenInt, r) if r.Sign() != 0 { break } exp++ } } return exp >= 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsInt(x Value) bool {\n\tswitch v := Val(x).(type) {\n\tcase int64, *big.Int:\n\t\treturn true\n\tcase *big.Rat:\n\t\treturn v.IsInt()\n\t}\n\treturn false\n}", "func IsInt(v cty.Value) hcl.Diagnostics {\n\tvar diags hcl.Diagnostics\n\n\tif v.IsNull() {\n\t\treturn diags\n\t}\n\tif v.Type() != cty.Number || !isInt64(v.AsBigFloat()) {\n\t\tdiags = diags.Append(wrongTypeDiagnostic(v, \"integer\"))\n\t}\n\n\treturn diags\n}", "func (n *Number) IsInt() bool {\n\treturn n.isInteger\n}", "func IsInt(data interface{}) bool {\n\treturn typeIs(data,\n\t\treflect.Int,\n\t\treflect.Int8,\n\t\treflect.Int16,\n\t\treflect.Int32,\n\t\treflect.Int64,\n\t)\n}", "func isInt(n float64) bool {\n\treturn n == float64(int64(n))\n}", "func IsInt(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Int\n}", "func (x *Rat) IsInt() bool {}", "func IsInt(str string) bool {\n\tif IsNull(str) {\n\t\treturn false\n\t}\n\treturn rxInt.MatchString(str)\n}", "func FloatIsInt(x *big.Float,) bool", "func IsInt(t reflect.Type) bool {\n\tswitch t.Kind() {\n\tcase reflect.Int:\n\t\treturn true\n\tcase reflect.Uint:\n\t\treturn true\n\tcase reflect.Int8:\n\t\treturn true\n\tcase reflect.Uint8:\n\t\treturn true\n\tcase reflect.Int16:\n\t\treturn true\n\tcase reflect.Uint16:\n\t\treturn true\n\tcase reflect.Int32:\n\t\treturn true\n\tcase reflect.Uint32:\n\t\treturn true\n\tcase reflect.Int64:\n\t\treturn true\n\tcase reflect.Uint64:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func IsInt(v string) bool {\n\tif _, err := strconv.ParseInt(v, 10, 64); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func RatIsInt(x *big.Rat,) bool", "func (v *verifier) IsntInt() *verifier {\n\t_, err := strconv.Atoi(v.Query)\n\treturn v.addVerification(\"Int\", err != nil)\n}", "func isFloatInt(floatValue float64) bool {\n\treturn math.Mod(floatValue, 1.0) == 0\n}", "func TypeIsInt(tau TypeT) bool {\n\treturn int32(1) == int32(C.yices_type_is_int(C.type_t(tau)))\n}", "func (node *GoValueNode) IsInteger() bool {\n\tkind := pkg.GetBaseKind(node.thisValue)\n\n\treturn kind == reflect.Int64 || kind == reflect.Uint64\n}", "func IsInt(val any, minAndMax ...int64) (ok bool) {\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tintVal, err := valueToInt64(val, true)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\targLn := len(minAndMax)\n\tif argLn == 0 { // only check type\n\t\treturn true\n\t}\n\n\t// value check\n\tminVal := minAndMax[0]\n\tif argLn == 1 { // only min length check.\n\t\treturn intVal >= minVal\n\t}\n\n\t// min and max length check\n\treturn intVal >= minVal && intVal <= minAndMax[1]\n}", "func TermIsInt(t TermT) bool {\n\treturn C.yices_term_is_int(C.term_t(t)) == C.int32_t(1)\n}", "func (d Definition) IsInteger() bool {\n\tif k, ok := d.Output.(reflect.Kind); ok {\n\t\tif k == reflect.Int || k == reflect.Int8 || k == reflect.Int16 || k == reflect.Int32 || k == reflect.Int64 || k == reflect.Uint || k == reflect.Uint8 || k == reflect.Uint16 || k == reflect.Uint32 || k == reflect.Uint64 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (state *State) IsInt(index int) bool { return IsInt(state.get(index)) }", "func IsIntKind(k reflect.Kind) bool {\n\tswitch k {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn true\n\t}\n\treturn false\n}", "func ValIsInteger(model ModelT, val *YvalT) int32 {\n\treturn int32(C.yices_val_is_integer(ymodel(model), (*C.yval_t)(val)))\n}", "func (n NestedInteger) IsInteger() bool {\n\treturn n.single\n}", "func IntValue(v Value) (int, bool) {\n\tif v.Type() != IntType {\n\t\treturn 0, false\n\t}\n\tval, ok := (v.Value()).(int)\n\treturn val, ok\n}", "func (v Value) IsIntegral() bool {\n\treturn IsIntegral(v.typ)\n}", "func TypeInt(v Int) Bool {\n\treturn TrimBool(&typInt{\n\t\tE: v,\n\t\thash: hashWithId(73679, v),\n\t\thasVariable: v.HasVariable(),\n\t})\n}", "func (x *Int) IsInt64() bool {}", "func (me TdtypeType) IsInteger() bool { return me.String() == \"integer\" }", "func (i *Info) IsIntFieldType() bool {\n\n\tif i.IsUIntFieldType() {\n\t\treturn false\n\t}\n\tif strings.Contains(i.Value, \"int\") {\n\t\treturn true\n\t}\n\treturn false\n}", "func (d Decimal) IsInteger() bool {\n\t// The most typical case, all decimal with exponent higher or equal 0 can be represented as integer\n\tif d.exp >= 0 {\n\t\treturn true\n\t}\n\t// When the exponent is negative we have to check every number after the decimal place\n\t// If all of them are zeroes, we are sure that given decimal can be represented as an integer\n\tvar r big.Int\n\tq := new(big.Int).Set(d.value)\n\tfor z := abs(d.exp); z > 0; z-- {\n\t\tq.QuoRem(q, tenInt, &r)\n\t\tif r.Cmp(zeroInt) != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (n NestedInteger) IsInteger() bool {\n\treturn n.Ns == nil\n}", "func TestInt(min, max, value int, minExclusive, maxExclusive bool) bool {\n\tmin, max, minExclusive, maxExclusive = MinMaxExclusiveInt(min, max, minExclusive, maxExclusive)\n\treturn !(value < min || value > max || (maxExclusive && (value == max)) || (minExclusive && (value == min)))\n}", "func IsInteger(id int) bool {\n\treturn id <= IDInt64\n}", "func IsIntString(s string) bool {\n\treturn s != \"\" && rxInt.MatchString(s)\n}", "func IsIntString(s string) bool {\n\treturn s != \"\" && rxInt.MatchString(s)\n}", "func IsIntegral(t Type) bool {\n\treturn int(t)&flagIsIntegral == flagIsIntegral\n}", "func Int(str string) bool {\n\tif len(str) == 0 {\n\t\treturn true\n\t}\n\t_, err := strconv.Atoi(str)\n\n\treturn err == nil\n}", "func (d LegacyDec) IsInteger() bool {\n\treturn new(big.Int).Rem(d.i, precisionReuse).Sign() == 0\n}", "func (a Cardinality) IsEqInt() func(int) bool {\n\treturn func(x int) bool {\n\t\treturn a.IsEq()(Cardinal(x))\n\t}\n}", "func isInt(s string) bool {\n\tfor _, c := range s {\n\t\tif !unicode.IsDigit(c) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (x IntRange) ContainsInt(i *big.Int) bool {\n\treturn (x[0] == nil || x[0].Cmp(i) <= 0) &&\n\t\t(x[1] == nil || x[1].Cmp(i) >= 0)\n}", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func Int(num cty.Value) (cty.Value, error) {\n\tif num == cty.PositiveInfinity || num == cty.NegativeInfinity {\n\t\treturn cty.NilVal, fmt.Errorf(\"can't truncate infinity to an integer\")\n\t}\n\treturn IntFunc.Call([]cty.Value{num})\n}", "func (v CanIntegerValue) CanInt() bool {\n\tswitch v.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func IsInt32(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Int32\n}", "func (this NestedInteger) IsInteger() bool {\n\treturn true\n}", "func IsInts(val any) bool {\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tswitch val.(type) {\n\tcase []int, []int8, []int16, []int32, []int64, []uint, []uint8, []uint16, []uint32, []uint64:\n\t\treturn true\n\t}\n\treturn false\n}", "func (this NestedInteger) IsInteger() bool {\n\treturn false\n}", "func IsInt64(x *big.Int) bool {\n\treturn x.IsInt64()\n}", "func isNegativeInt(n *int) bool {\n\treturn n != nil && *n < 0\n}", "func Int(a int, b int) bool {\n\treturn a == b\n}", "func ensureInt(x interface{}) int {\n\tres, ok := x.(int)\n\tif !ok {\n\t\tres = int(x.(float64))\n\t}\n\treturn res\n}", "func checkFloatToInt(argT, paramT reflect.Type, argV reflect.Value) bool {\n\n\t// Confirm that (arg, param) are in (Float, Int)\n\t// If they aren't, then return immediately.\n\tif !(argT.Kind() == reflect.Float64 && paramT.Kind() == reflect.Int) {\n\t\treturn false\n\t}\n\n\t// If a floating point equals its floor, then it's an integer.\n\tif math.Floor(argV.Float()) == argV.Float() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func ValIsInt32(model ModelT, val *YvalT) int32 {\n\treturn int32(C.yices_val_is_int32(ymodel(model), (*C.yval_t)(val)))\n}", "func IsIntAtom(t TermT) TermT {\n\treturn TermT(C.yices_is_int_atom(C.term_t(t)))\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func (s Scalar) IntValue() (int, bool) {\n\tv, err := strconv.Atoi(string(s))\n\tif err != nil {\n\t\treturn v, false\n\t}\n\treturn v, true\n}", "func (mysql *MySQLDatabase) IsInteger(column Column) bool {\n\treturn IsStringInSlice(column.DataType, mysql.GetIntegerDatatypes())\n}", "func (this NestedInteger) IsInteger() bool { panic(\"\") }", "func isNumber(x interface{}) bool {\n\tif x == nil {\n\t\treturn false\n\t}\n\n\tswitch reflect.TypeOf(x).Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\treflect.Float32, reflect.Float64:\n\t\treturn true\n\t}\n\treturn false\n}", "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func (i Int) IsZero() bool {\n\treturn i.i.Sign() == 0\n}", "func isZeroInt(n *int) bool {\n\treturn n != nil && *n == 0\n}", "func (Integer) IsPosInf() bool {\n\treturn false\n}", "func (num Number) Int() (int, bool) {\n\ti64, ok := num.Int64()\n\treturn int(i64), ok\n}", "func IsPositiveInteger(in string) bool {\n\tif in == \"0\" {\n\t\treturn true\n\t}\n\n\treturn positiveNumeric.MatchString(in)\n}", "func ToInt(v Value) (int64, bool) {\n\tif n, ok := v.TryInt(); ok {\n\t\treturn n, true\n\t}\n\tif f, ok := v.TryFloat(); ok {\n\t\tn, tp := FloatToInt(f)\n\t\treturn n, tp == IsInt\n\t}\n\tif s, ok := v.TryString(); ok {\n\t\tn, tp := stringToInt(s)\n\t\treturn n, tp == IsInt\n\t}\n\treturn 0, false\n}", "func isInt64(v *big.Float) bool {\n\tbigInt, accuracy := v.Int(nil)\n\tif accuracy != big.Exact {\n\t\treturn false\n\t}\n\n\treturn bigInt.IsInt64()\n}", "func TestInt(tst *testing.T) {\n\n\t// Test bool\n\ti, err := StringToInt(\"80\")\n\tbrtesting.AssertEqual(tst, err, nil, \"StringToInt failed\")\n\tbrtesting.AssertEqual(tst, i, 80, \"StringToInt failed\")\n\ti, err = StringToInt(\"-80\")\n\tbrtesting.AssertEqual(tst, err, nil, \"StringToInt failed\")\n\tbrtesting.AssertEqual(tst, i, -80, \"StringToInt failed\")\n\ti, err = StringToInt(\"go-bedrock\")\n\tbrtesting.AssertNotEqual(tst, err, nil, \"StringToInt failed\")\n}", "func asInt(data interface{}) (int64, bool) {\n\tswitch val := data.(type) {\n\tcase int:\n\t\treturn int64(val), true\n\n\tcase int8:\n\t\treturn int64(val), true\n\n\tcase int16:\n\t\treturn int64(val), true\n\n\tcase int32:\n\t\treturn int64(val), true\n\n\tcase int64:\n\t\treturn val, true\n\n\tcase uint:\n\t\treturn int64(val), true\n\n\tcase uint8:\n\t\treturn int64(val), true\n\n\tcase uint16:\n\t\treturn int64(val), true\n\n\tcase uint32:\n\t\treturn int64(val), true\n\n\tcase uint64:\n\t\treturn int64(val), true\n\n\tcase time.Duration:\n\t\treturn int64(val), true\n\n\tcase StyledCell:\n\t\treturn asInt(val.Data)\n\t}\n\n\treturn 0, false\n}", "func (v Value) TryInt() (n int64, ok bool) {\n\tn, ok = v.iface.(int64)\n\treturn\n}", "func FloatToInt(f float64) (int64, NumberType) {\n\tn := int64(f)\n\tif float64(n) == f {\n\t\treturn n, IsInt\n\t}\n\treturn 0, NaI\n}", "func (v *missingValue) SetInt(value int) bool {\n\treturn false\n}", "func IsInt2(val interface{}, minAndMax ...int64) (ok bool) {\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tintVal, err := ToInt(val)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\targLn := len(minAndMax)\n\tif argLn == 0 { // only check type\n\t\treturn true\n\t}\n\n\t// value check\n\tminVal := minAndMax[0]\n\tif argLn == 1 { // only min length check.\n\t\treturn intVal >= minVal\n\t}\n\n\tmaxVal := minAndMax[1]\n\n\t// min and max length check\n\treturn intVal >= minVal && intVal <= maxVal\n}", "func TestToInt(t *testing.T) {\n\t// conversion from false to 0\n\tresult := evaluator.ToInt(false)\n\tassert.Equal(t, 0, result)\n\n\t// conversion from true to 1\n\tresult = evaluator.ToInt(true)\n\tassert.Equal(t, 1, result)\n}", "func (x *Float) IsInf() bool {}", "func (v *missingValue) GetInt() (int, bool) {\n\treturn 0, false\n}", "func ValidInt(str string) bool {\n\tvar intRegex = regexp.MustCompile(`^[0-9]{1,8}$`)\n\treturn intRegex.MatchString(str)\n}", "func IsInt8(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Int8\n}", "func (t *Typed) IntIf(key string) (int, bool) {\n\tvalue, exists := t.GetIf(key)\n\tif exists == false {\n\t\treturn 0, false\n\t}\n\n\tswitch t := value.(type) {\n\tcase int:\n\t\treturn int(t), true\n\tcase int16:\n\t\treturn int(t), true\n\tcase int32:\n\t\treturn int(t), true\n\tcase int64:\n\t\treturn int(t), true\n\tcase uint:\n\t\treturn int(t), true\n\tcase uint8:\n\t\treturn int(t), true\n\tcase uint16:\n\t\treturn int(t), true\n\tcase uint32:\n\t\treturn int(t), true\n\tcase uint64:\n\t\treturn int(t), true\n\tcase float64:\n\t\treturn int(t), true\n\tcase float32:\n\t\treturn int(t), true\n\tcase string:\n\t\ti, err := strconv.Atoi(t)\n\t\treturn i, err == nil\n\t}\n\treturn 0, false\n}", "func IsInt64(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Int64\n}", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func FloatIsInf(x *big.Float,) bool", "func (x *Big) IsInf(sign int) bool {\n\treturn sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf\n}", "func (*BigInt) IsPosInf() bool {\n\treturn false\n}", "func (v RangeInt) Test(value int) bool {\n\treturn TestInt(v.min, v.max, value, v.minExclusive, v.maxExclusive)\n}", "func Int(v interface{}) *int {\n\tswitch v.(type) {\n\tcase string, int32, int16, int8, int64, uint32, uint16, uint8, uint64, float32, float64:\n\t\tval := fmt.Sprintf(\"%v\", v)\n\t\tres, err := strconv.Atoi(val)\n\t\tif err != nil {\n\t\t\texception.Err(err, 500).Ctx(M{\"v\": v}).Throw()\n\t\t}\n\t\treturn &res\n\tcase int, uint:\n\t\tres := v.(int)\n\t\treturn &res\n\tcase bool:\n\t\tval := v.(bool)\n\t\tvar res int = 0\n\t\tif val {\n\t\t\tres = 1\n\t\t}\n\t\treturn &res\n\t}\n\treturn nil\n}", "func (state *State) CheckInt(index int) int64 {\n\tv, ok := toInteger(state.get(index))\n\tif !ok {\n\t\tintError(state, index)\n\t}\n\treturn int64(v)\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func LooksLikeAnInteger(inputStr string) (matched bool, value int) {\n\tmatched = intRe.MatchString(inputStr)\n\tif matched {\n\t\tvalue, _ = strconv.Atoi(inputStr)\n\t\treturn true, value\n\t}\n\treturn\n}", "func ValidInt(field FormField, ctx context.Context) error {\n\t_, err := field.GetInt()\n\tif err != nil {\n\t\treturn EInvalidInteger\n\t}\n\treturn nil\n}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (s *Smpval) SetInt(i int64) bool {\n\tif s.flag == Int && s.val.CanSet() {\n\t\ts.val.SetInt(i)\n\t\ts.i = s.val.Int()\n\t\treturn true\n\t}\n\treturn false\n}", "func (z *Int) IsZero() bool {\n\treturn (z[3] == 0) && (z[2] == 0) && (z[1] == 0) && (z[0] == 0)\n}", "func (t Type) IsNumber() bool {\n\treturn num_start < t && t < num_end\n}", "func IsInf(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsInf\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func IsNumber(n int) bool {\n\tif n < 10 {\n\t\treturn true\n\t}\n\tdigits := strconv.Itoa(n)\n\tp := len(digits)\n\tfor _, d := range digits {\n\t\tx, _ := strconv.Atoi(string(d))\n\t\tn -= int(math.Pow(float64(x), float64(p)))\n\t}\n\treturn n == 0\n}", "func Int(a, b interface{}) int {\n\ti1, _ := a.(int)\n\ti2, _ := b.(int)\n\tswitch {\n\tcase i1 < i2:\n\t\treturn -1\n\tcase i1 > i2:\n\t\treturn 1\n\tdefault:\n\t\treturn 0\n\t}\n}" ]
[ "0.8459752", "0.8078862", "0.7934551", "0.7692145", "0.7640611", "0.7374967", "0.723088", "0.71803105", "0.7160576", "0.70589256", "0.70163596", "0.69406474", "0.69217443", "0.68400544", "0.6819024", "0.6806735", "0.6694523", "0.66869605", "0.64541924", "0.63801026", "0.63574415", "0.6307982", "0.6303457", "0.6270036", "0.62494034", "0.6180236", "0.61792266", "0.61787736", "0.61673164", "0.6156912", "0.61398566", "0.61394304", "0.61377853", "0.6111475", "0.6111475", "0.60938275", "0.60879546", "0.6082331", "0.6076299", "0.6065924", "0.60529774", "0.6024118", "0.6021572", "0.60150206", "0.60134727", "0.60000825", "0.5936923", "0.58937407", "0.5875044", "0.5856807", "0.5844989", "0.58338135", "0.5828321", "0.57996625", "0.574906", "0.5733032", "0.5720572", "0.57173204", "0.56793237", "0.56404656", "0.5616453", "0.5610334", "0.56011933", "0.5593313", "0.559059", "0.55843824", "0.5569029", "0.5524711", "0.5523908", "0.5521732", "0.5515074", "0.54884803", "0.54860735", "0.5483847", "0.54806995", "0.545697", "0.5418602", "0.5410331", "0.53729826", "0.5372742", "0.53570855", "0.53524697", "0.5345136", "0.5327873", "0.53185296", "0.5304547", "0.5283661", "0.52795017", "0.52721035", "0.52637815", "0.5257114", "0.5245313", "0.52330285", "0.5229235", "0.51947933", "0.5193444", "0.51906", "0.51857823", "0.5162074", "0.51461995" ]
0.6872431
13
Mul sets z to x y and returns z.
func (z *Big) Mul(x, y *Big) *Big { return z.Context.Mul(z, x, y) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Mul(z, x, y *Elt)", "func (z *Int) Mul(x, y *Int) *Int {}", "func (z *Float64) Mul(x, y *Float64) *Float64 {\n\ta := (x.l * y.l) + (y.r * x.r)\n\tb := (x.r * y.l) + (y.r * x.l)\n\tz.SetPair(a, b)\n\treturn z\n}", "func RatMul(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (v *Vec3i) SetMul(other Vec3i) {\n\tv.X *= other.X\n\tv.Y *= other.Y\n\tv.Z *= other.Z\n}", "func FloatMul(z *big.Float, x, y *big.Float,) *big.Float", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func (z *Rat) Mul(x, y *Rat) *Rat {}", "func IntMul(z *big.Int, x, y *big.Int,) *big.Int", "func (z *Perplex) Mul(x, y *Perplex) *Perplex {\n\ta := new(big.Int).Set(&x.l)\n\tb := new(big.Int).Set(&x.r)\n\tc := new(big.Int).Set(&y.l)\n\td := new(big.Int).Set(&y.r)\n\ttemp := new(big.Int)\n\tz.l.Add(\n\t\tz.l.Mul(a, c),\n\t\ttemp.Mul(d, b),\n\t)\n\tz.r.Add(\n\t\tz.r.Mul(d, a),\n\t\ttemp.Mul(b, c),\n\t)\n\treturn z\n}", "func (z *E2) Mul(x, y *E2) *E2 {\n\tmulGenericE2(z, x, y)\n\treturn z\n}", "func (v Vec3i) Mul(other Vec3i) Vec3i {\n\treturn Vec3i{v.X * other.X, v.Y * other.Y, v.Z * other.Z}\n}", "func (z *E12) Mul(x, y *E12) *E12 {\n\tvar a, b, c E6\n\ta.Add(&x.C0, &x.C1)\n\tb.Add(&y.C0, &y.C1)\n\ta.Mul(&a, &b)\n\tb.Mul(&x.C0, &y.C0)\n\tc.Mul(&x.C1, &y.C1)\n\tz.C1.Sub(&a, &b).Sub(&z.C1, &c)\n\tz.C0.MulByNonResidue(&c).Add(&z.C0, &b)\n\treturn z\n}", "func Mul(x, y meta.ConstValue) meta.ConstValue {\n\tswitch x.Type {\n\tcase meta.Integer:\n\t\tswitch y.Type {\n\t\tcase meta.Integer:\n\t\t\treturn meta.NewIntConst(x.GetInt() * y.GetInt())\n\t\tcase meta.Float:\n\t\t\treturn meta.NewFloatConst(float64(x.GetInt()) * y.GetFloat())\n\t\t}\n\tcase meta.Float:\n\t\tswitch y.Type {\n\t\tcase meta.Integer:\n\t\t\treturn meta.NewFloatConst(x.GetFloat() * float64(y.GetInt()))\n\t\tcase meta.Float:\n\t\t\treturn meta.NewFloatConst(x.GetFloat() * y.GetFloat())\n\t\t}\n\t}\n\treturn meta.UnknownValue\n}", "func (z *Int) Mul(x, y *Int) {\n\n\tvar (\n\t\talfa = &Int{} // Aggregate results\n\t\tbeta = &Int{} // Calculate intermediate\n\t)\n\t// The numbers are internally represented as [ a, b, c, d ]\n\t// We do the following operations\n\t//\n\t// d1 * d2\n\t// d1 * c2 (upshift 64)\n\t// d1 * b2 (upshift 128)\n\t// d1 * a2 (upshift 192)\n\t//\n\t// c1 * d2 (upshift 64)\n\t// c1 * c2 (upshift 128)\n\t// c1 * b2 (upshift 192)\n\t//\n\t// b1 * d2 (upshift 128)\n\t// b1 * c2 (upshift 192)\n\t//\n\t// a1 * d2 (upshift 192)\n\t//\n\t// And we aggregate results into 'alfa'\n\n\t// One optimization, however, is reordering.\n\t// For these ones, we don't care about if they overflow, thus we can use native multiplication\n\t// and set the result immediately into `a` of the result.\n\t// b1 * c2 (upshift 192)\n\t// a1 * d2 (upshift 192)\n\t// d1 * a2 (upshift 192)\n\t// c1 * b2 11(upshift 192)\n\n\t// Remaining ops:\n\t//\n\t// d1 * d2\n\t// d1 * c2 (upshift 64)\n\t// d1 * b2 (upshift 128)\n\t//\n\t// c1 * d2 (upshift 64)\n\t// c1 * c2 (upshift 128)\n\t//\n\t// b1 * d2 (upshift 128)\n\n\talfa.mulIntoLower128(x[0], y[0])\n\talfa.mulIntoUpper128(x[0], y[2])\n\talfa[3] += x[0]*y[3] + x[1]*y[2] + x[2]*y[1] + x[3]*y[0] // Top ones, ignore overflow\n\n\tbeta.mulIntoMiddle128(x[0], y[1])\n\talfa.Add(alfa, beta)\n\n\tbeta.Clear().mulIntoMiddle128(x[1], y[0])\n\talfa.Add(alfa, beta)\n\n\tbeta.Clear().mulIntoUpper128(x[1], y[1])\n\talfa.addHigh128(beta[3], beta[2])\n\n\tbeta.Clear().mulIntoUpper128(x[2], y[0])\n\talfa.addHigh128(beta[3], beta[2])\n\tz.Copy(alfa)\n\n}", "func (z *BiComplex) Mul(x, y *BiComplex) *BiComplex {\n\ta := new(Complex).Set(&x.l)\n\tb := new(Complex).Set(&x.r)\n\tc := new(Complex).Set(&y.l)\n\td := new(Complex).Set(&y.r)\n\ttemp := new(Complex)\n\tz.l.Sub(\n\t\tz.l.Mul(a, c),\n\t\ttemp.Mul(b, d),\n\t)\n\tz.r.Add(\n\t\tz.r.Mul(a, d),\n\t\ttemp.Mul(b, c),\n\t)\n\treturn z\n}", "func (x *Secp256k1N) Mul(y, z *Secp256k1N) {\n\tC.secp256k1n_mul((*C.secp256k1n)(unsafe.Pointer(x)), (*C.secp256k1n)(unsafe.Pointer(y)), (*C.secp256k1n)(unsafe.Pointer(z)))\n}", "func (p Vector3) Mul(m Coord) Vector3 {\n\treturn Vector3{p.X * m, p.Y * m, p.Z * m}\n}", "func Mul(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Mul\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (p Point3) Mul(ps ...Point3) Point3 {\n\tfor _, p2 := range ps {\n\t\tp[0] *= p2[0]\n\t\tp[1] *= p2[1]\n\t\tp[2] *= p2[2]\n\t}\n\treturn p\n}", "func basicMul(z, x, y nat) {\n\tz[0 : len(x)+len(y)].clear() // initialize z\n\tfor i, d := range y {\n\t\tif d != 0 {\n\t\t\tz[len(x)+i] = addMulVVW(z[i:i+len(x)], x, d)\n\t\t}\n\t}\n}", "func (q Quat) Mul(other Quat) Quat {\n\treturn Quat{q.W * other.W, q.X * other.X, q.Y * other.Y, q.Z * other.Z}\n}", "func (t Tuple) Mul(scalar float64) Tuple {\n\treturn Tuple{t.X * scalar, t.Y * scalar, t.Z * scalar, t.W * scalar}\n}", "func MulA24(z, x *Elt)", "func (s *Scalar) Multiply(x, y *Scalar) *Scalar {\n\ts.s.Mul(&x.s, &y.s)\n\treturn s\n}", "func basicMul(z, x, y fermat) {\n\t// initialize z\n\tfor i := 0; i < len(z); i++ {\n\t\tz[i] = 0\n\t}\n\tfor i, d := range y {\n\t\tif d != 0 {\n\t\t\tz[len(x)+i] = addMulVVW(z[i:i+len(x)], x, d)\n\t\t}\n\t}\n}", "func (p *Int64) Mul(q, r *Int64) *Int64 {\n\tx := new(Int64).Set(q)\n\ty := new(Int64).Set(r)\n\tz := NewInt64()\n\tvar l uint64\n\tfor n, a := range x.c {\n\t\tfor m, b := range y.c {\n\t\t\tl = n + m\n\t\t\tif coeff, ok := z.Coeff(l); ok {\n\t\t\t\tz.SetCoeff(l, coeff+(a*b))\n\t\t\t} else {\n\t\t\t\tz.SetCoeff(l, a*b)\n\t\t\t}\n\t\t}\n\t}\n\treturn p.Set(z)\n}", "func (v Vec3) Mult(v2 Vec3) Vec3 {\n\treturn Vec3{X: v.X * v2.X, Y: v.Y * v2.Y, Z: v.Z * v2.Z}\n}", "func (t *Tuple) Mul(scalar float64) *Tuple {\n\treturn &Tuple{\n\t\tt.x * scalar,\n\t\tt.y * scalar,\n\t\tt.z * scalar,\n\t\tt.w * scalar,\n\t}\n\n}", "func (x Vector64) Mul(y float64) Vector64 {\n\tfor i := 0; i < len(x); i++ {\n\t\tx[i] *= y\n\t}\n\treturn x\n}", "func (v Vec) Mul(c int) Vec {\n\treturn Vec{c * v.i, c * v.j}\n}", "func (n *bigNumber) mul(x *bigNumber, y *bigNumber) *bigNumber {\n\t//it does not work in place, that why the temporary bigNumber is necessary\n\treturn karatsubaMul(n, x, y)\n}", "func (a Vector3) Mult(b float32) Vector3 {\n\treturn Vector3{a.X * b, a.Y * b, a.Z * b}\n}", "func Command_Mul(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:mul\", \"2\")\n\t}\n\n\tscript.RetVal = rex.NewValueFloat64(params[0].Float64() * params[1].Float64())\n\treturn\n}", "func mul(x, y int) int {\n\treturn x * y\n}", "func Mul(x, y *Money) *Money {\n\tz := Money{}\n\treturn &z\n}", "func (z *E6) Mul(x, y *E6) *E6 {\n\t// Algorithm 13 from https://eprint.iacr.org/2010/354.pdf\n\tvar t0, t1, t2, c0, c1, c2, tmp E2\n\tt0.Mul(&x.B0, &y.B0)\n\tt1.Mul(&x.B1, &y.B1)\n\tt2.Mul(&x.B2, &y.B2)\n\n\tc0.Add(&x.B1, &x.B2)\n\ttmp.Add(&y.B1, &y.B2)\n\tc0.Mul(&c0, &tmp).Sub(&c0, &t1).Sub(&c0, &t2).MulByNonResidue(&c0).Add(&c0, &t0)\n\n\tc1.Add(&x.B0, &x.B1)\n\ttmp.Add(&y.B0, &y.B1)\n\tc1.Mul(&c1, &tmp).Sub(&c1, &t0).Sub(&c1, &t1)\n\ttmp.MulByNonResidue(&t2)\n\tc1.Add(&c1, &tmp)\n\n\ttmp.Add(&x.B0, &x.B2)\n\tc2.Add(&y.B0, &y.B2).Mul(&c2, &tmp).Sub(&c2, &t0).Sub(&c2, &t2).Add(&c2, &t1)\n\n\tz.B0.Set(&c0)\n\tz.B1.Set(&c1)\n\tz.B2.Set(&c2)\n\n\treturn z\n}", "func Multiply(v *Vec, mul float64) *Vec {\n\treturn &Vec{\n\t\tv.X / mul,\n\t\tv.Y / mul,\n\t}\n}", "func (a *Vec4) Multiply(s float32) {\n\ta.X *= s\n\ta.Y *= s\n\ta.Z *= s\n\ta.W *= s\n}", "func (x IntRange) Mul(y IntRange) (z IntRange) {\n\treturn x.mulLsh(y, false)\n}", "func (u *Update) Mul(obj types.M) *Update {\n\tu.update[\"$mul\"] = obj\n\treturn u\n}", "func Mul(x, y int) int {\n\treturn x * y\n}", "func Mul(x, y Number) Number {\n\treturn Number{\n\t\tReal: x.Real * y.Real,\n\t\tE1mag: x.Real*y.E1mag + x.E1mag*y.Real,\n\t\tE2mag: x.Real*y.E2mag + x.E2mag*y.Real,\n\t\tE1E2mag: x.Real*y.E1E2mag + x.E1mag*y.E2mag + x.E2mag*y.E1mag + x.E1E2mag*y.Real,\n\t}\n}", "func (u *Update) Mul(obj utils.M) *Update {\n\tu.update[\"$mul\"] = obj\n\treturn u\n}", "func (v Vector3D) Mul(factor int) Vector3D {\n\treturn Vector3D{\n\t\tx: factor * v.x,\n\t\ty: factor * v.y,\n\t\tz: factor * v.z,\n\t}\n}", "func (v *Vec3i) SetMulScalar(s int32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n}", "func (cal *Calculate) mul(value float64) (result float64) {\n\tif len(cal.Arg) == 2 {\n\t\treturn (cal.Arg[0] * cal.Arg[1])\n\t} else if len(cal.Arg) == 1 {\n\t\treturn (value * cal.Arg[0])\n\t}\n\n\tlog.Fatalln(\"Please check the data format of the calculation unit\")\n\treturn\n}", "func (f *Float) Mul(x, y *Float) *Float {\n\tx.doinit()\n\ty.doinit()\n\tf.doinit()\n\tC.mpf_mul(&f.i[0], &x.i[0], &y.i[0])\n\treturn f\n}", "func (quaternion Quaternion) Mul(angle, x, y, z float32) Quaternion {\n\tother := NewQuaternion(angle, x, y, z)\n\treturn quaternion.MulQ(other)\n}", "func (c Currency) Mul(d Currency) Currency {\n\t// @todo c.m*d.m will overflow int64\n\tr := utils.Round(float64(c.m*d.m)/c.dpf, .5, 0)\n\treturn c.Set(int64(r))\n}", "func feMul(out *fieldElement, a *fieldElement, b *fieldElement)", "func (z *E12) MulByVW(x *E12, y *E2) *E12 {\n\n\tvar result E12\n\tvar yNR E2\n\n\tyNR.MulByNonResidue(y)\n\tresult.C0.B0.Mul(&x.C1.B1, &yNR)\n\tresult.C0.B1.Mul(&x.C1.B2, &yNR)\n\tresult.C0.B2.Mul(&x.C1.B0, y)\n\tresult.C1.B0.Mul(&x.C0.B2, &yNR)\n\tresult.C1.B1.Mul(&x.C0.B0, y)\n\tresult.C1.B2.Mul(&x.C0.B1, y)\n\tz.Set(&result)\n\treturn z\n}", "func (p Point) Mul(k int) Point { return Point{p.X * k, p.Y * k} }", "func (x f26dot6) mul(y f26dot6) f26dot6 {\n\treturn f26dot6(int64(x) * int64(y) >> 6)\n}", "func Multiply(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn MultiplyFunc.Call([]cty.Value{a, b})\n}", "func (p thinPoly) Mul(c int32, v []int32) thinPoly {\n\tfor i := range v {\n\t\tp[i] = c * v[i]\n\t}\n\treturn p.Freeze()\n}", "func (vn *VecN) Mul(dst *VecN, c float64) *VecN {\n\tif vn == nil {\n\t\treturn nil\n\t}\n\tdst = dst.Resize(len(vn.vec))\n\n\tfor i, el := range vn.vec {\n\t\tdst.vec[i] = el * c\n\t}\n\n\treturn dst\n}", "func Mul(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx * yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx * yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx * yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx * yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx * yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx * yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Float32:\n\t\txx := float32(x.Float())\n\t\tyy := float32(y.Float())\n\t\tzz := float64(xx * yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Float64:\n\t\txx := float64(x.Float())\n\t\tyy := float64(y.Float())\n\t\tzz := float64(xx * yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Complex64:\n\t\txx := complex64(x.Complex())\n\t\tyy := complex64(y.Complex())\n\t\tzz := complex128(xx * yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\tcase reflect.Complex128:\n\t\txx := complex128(x.Complex())\n\t\tyy := complex128(y.Complex())\n\t\tzz := complex128(xx * yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator * not defined on %v\", x.Type()))\n}", "func (n *bigNumber) mulCopy(x *bigNumber, y *bigNumber) *bigNumber {\n\t//it does not work in place, that why the temporary bigNumber is necessary\n\treturn n.set(new(bigNumber).mul(x, y))\n}", "func (v Posit8x4) Mul(x Posit8x4) Posit8x4 {\n\tout := Posit8x4{impl: make([]Posit8, 4)}\n\tfor i, posit := range v.impl {\n\t\tout.impl[i] = posit.Mul(x.impl[i])\n\t}\n\treturn out\n}", "func (s *SourceControl) Multiply(args *FactorArgs, reply *int) error {\n\t*reply = args.A * args.B\n\treturn nil\n}", "func (wv *Spectrum) Mul(other Spectrum) {\n\t// if wv.Lambda != other.Lambda IS ERROR\n\twv.C[0] *= other.C[0]\n\twv.C[1] *= other.C[1]\n\twv.C[2] *= other.C[2]\n\twv.C[3] *= other.C[3]\n}", "func (v Vec) Mul(other Vec) Vec {\n\treturn v.Copy().MulBy(other)\n}", "func (p *FloatPrice) Mul(q FloatPrice) *FloatPrice {\n\treturn p.SetFloat64(p.Float64() * q.Float64())\n}", "func (x Rational) Multiply(y Rational) Rational {\n\treturn NewRational(x.numerator*y.numerator, x.denominator*y.denominator)\n}", "func (z *Int) Exp(x, y, m *Int) *Int {}", "func (ai *Arith) Mul(decimal1 *ZnDecimal, others ...*ZnDecimal) *ZnDecimal {\n\t// init result from decimal1\n\tvar result = copyZnDecimal(decimal1)\n\tif len(others) == 0 {\n\t\treturn result\n\t}\n\n\tfor _, item := range others {\n\t\tresult.co.Mul(result.co, item.co)\n\t\tresult.exp = result.exp + item.exp\n\t}\n\n\treturn result\n}", "func (z *Int) MulMod(x, y, m *Int) *Int {\n\t// If we can do multiplication within 256 bytes, no need to wrap bigints\n\t// i.e: if both x and y are <= 128 bytes\n\tif x.IsUint128() && y.IsUint128() {\n\n\t\tif z == m { //z is an alias for m\n\t\t\tm = m.Clone()\n\t\t}\n\t\tz.Mul(x, y)\n\t\tz.Mod(z, m)\n\t\treturn z\n\t}\n\t// At this point, we _could_ do x=x mod m, y = y mod m, and test again\n\t// if they fit within 256 bytes. But for now just wrap big.Int instead\n\tbx := big.NewInt(0)\n\tby := big.NewInt(0)\n\tbx.SetBytes(x.Bytes()[:])\n\tby.SetBytes(y.Bytes()[:])\n\tbx.Mul(bx, by)\n\tby.SetBytes(m.Bytes()[:])\n\tz.SetFromBig(bx.Mod(bx, by))\n\treturn z\n}", "func (z *E6) MulByE2(x *E6, y *E2) *E6 {\n\tvar yCopy E2\n\tyCopy.Set(y)\n\tz.B0.Mul(&x.B0, &yCopy)\n\tz.B1.Mul(&x.B1, &yCopy)\n\tz.B2.Mul(&x.B2, &yCopy)\n\treturn z\n}", "func NewMul(x, y value.Value) *InstMul {\n\tinst := &InstMul{X: x, Y: y}\n\t// Compute type.\n\tinst.Type()\n\treturn inst\n}", "func (g *gcm) mul(y *gcmFieldElement) {\n\tvar z gcmFieldElement\n\n\tfor i := 0; i < 2; i++ {\n\t\tword := y.high\n\t\tif i == 1 {\n\t\t\tword = y.low\n\t\t}\n\n\t\t// Multiplication works by multiplying z by 16 and adding in\n\t\t// one of the precomputed multiples of H.\n\t\tfor j := 0; j < 64; j += 4 {\n\t\t\tmsw := z.high & 0xf\n\t\t\tz.high >>= 4\n\t\t\tz.high |= z.low << 60\n\t\t\tz.low >>= 4\n\t\t\tz.low ^= uint64(gcmReductionTable[msw]) << 48\n\n\t\t\t// the values in |table| are ordered for\n\t\t\t// little-endian bit positions. See the comment\n\t\t\t// in NewGCMWithNonceSize.\n\t\t\tt := &g.productTable[word&0xf]\n\n\t\t\tz.low ^= t.low\n\t\t\tz.high ^= t.high\n\t\t\tword >>= 4\n\t\t}\n\t}\n\n\t*y = z\n}", "func rcMul(p *TCompiler, code *TCode) (*value.Value, error) {\n\tv := value.Mul(p.regGet(code.B), p.regGet(code.C))\n\tp.regSet(code.A, v)\n\tp.moveNext()\n\treturn v, nil\n}", "func (p Point2) Mul(ps ...Point2) Point2 {\n\tfor _, p2 := range ps {\n\t\tp[0] *= p2[0]\n\t\tp[1] *= p2[1]\n\t}\n\treturn p\n}", "func (p Point) Mul(k int) Point {\n\treturn Point{p.X * k, p.Y * k}\n}", "func Mul(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Mul(x, y)\n}", "func Mul(multiplicand, multiplier *big.Int) *big.Int {\n\treturn I().Mul(multiplicand, multiplier)\n}", "func Mul(t1 TermT, t2 TermT) TermT {\n\treturn TermT(C.yices_mul(C.term_t(t1), C.term_t(t2)))\n}", "func (a *Mtx) Mult(b *Mtx) *Mtx {\n\tm := Mtx{}\n\tfor i := 0; i < 4; i++ {\n\t\tfor j := 0; j < 4; j++ {\n\t\t\tfor k := 0; k < 4; k++ {\n\t\t\t\tm.el[j][i] += a.el[k][i] * b.el[j][k]\n\t\t\t}\n\t\t}\n\t}\n\treturn &m\n}", "func (ms *matrixStack) AssignMul(a *mat4.T) {\n\tproduct := mat4.Zero\n\tfor col := 0; col < a.Cols(); col++ {\n\t\tfor row := 0; row < a.Rows(); row++ {\n\t\t\tfor vecPos := 0; vecPos < a.Rows(); vecPos++ {\n\t\t\t\tproduct[col][row] += ms.T[vecPos][row] * a[col][vecPos]\n\t\t\t}\n\t\t}\n\t}\n\tms.T = product\n}", "func (p Point) Mul(k int) Point {\n\treturn Point{X: p.X * k, Y: p.Y * k}\n}", "func (z *E12) MulByV(x *E12, y *E2) *E12 {\n\n\tvar result E12\n\tvar yNR E2\n\n\tyNR.MulByNonResidue(y)\n\tresult.C0.B0.Mul(&x.C0.B2, &yNR)\n\tresult.C0.B1.Mul(&x.C0.B0, y)\n\tresult.C0.B2.Mul(&x.C0.B1, y)\n\tresult.C1.B0.Mul(&x.C1.B2, &yNR)\n\tresult.C1.B1.Mul(&x.C1.B0, y)\n\tresult.C1.B2.Mul(&x.C1.B1, y)\n\tz.Set(&result)\n\treturn z\n}", "func (v1 Vector2) Mul(v2 Vector2) Vector2 {\n\tv1.MulThis(v2)\n\treturn v1\n}", "func Mul(a, b int) int {\n\treturn a * b\n}", "func (q1 Quat) Mul(q2 Quat) Quat {\n\treturn Quat{q1.W*q2.W - q1.V.Dot(q2.V), q1.V.Cross(q2.V).Add(q2.V.Mul(q1.W)).Add(q1.V.Mul(q2.W))}\n}", "func multi(x, y int) (answer int, err error) {\n\tanswer = x * y\n\treturn\n}", "func MULPD(mx, x operand.Op) { ctx.MULPD(mx, x) }", "func MulInto(ctx *build.Context, z, x, y ir.Int) {\n\tacc := NewAccumulator(ctx, z)\n\tfor i, a := range x.Limbs() {\n\t\tfor j, b := range y.Limbs() {\n\t\t\tlo, hi := ctx.Register(\"lo\"), ctx.Register(\"hi\")\n\t\t\tctx.MUL(a, b, hi, lo)\n\t\t\tacc.AddProduct(hi, lo, i+j)\n\t\t}\n\t\tacc.Flush()\n\t}\n}", "func (m *Money) Mul(n *Money) *Money {\n\treturn m.Set(m.M * n.M / DP)\n}", "func (t *Arith) Multiply(args *Args, reply *int) error {\n *reply = args.A * args.B\n return nil\n}", "func (i I) Multiply(i2 I) I {\n\ti.X *= i2.X\n\ti.Y *= i2.Y\n\treturn i\n}", "func mul(a, b big.Int) big.Int {\n\treturn *big.NewInt(1).Mul(&a, &b)\n}", "func Multiply(a, operand int) int { return operand * a }", "func (s SamplesC64) Multiply(c complex64) {\n\tsimd.RotateComplex(c, s)\n}", "func (t1 *Tensor) Multiply(t2 *Tensor) (*Tensor, error) {\n\tif t1.Size.Z != t2.Size.Z || t1.Size.X != t2.Size.Y {\n\t\treturn nil, ErrDimensionsNotFit\n\t}\n\tret := NewTensor(t2.Size.X, t1.Size.Y, t1.Size.Z)\n\tfor z := 0; z < t1.Size.Z; z++ {\n\t\tfor y := 0; y < t1.Size.Y; y++ {\n\t\t\tfor x := 0; x < t2.Size.X; x++ {\n\t\t\t\tvar e float64\n\t\t\t\tfor i := 0; i < t1.Size.X; i++ {\n\t\t\t\t\te += t1.Get(i, y, z) * t2.Get(x, i, z)\n\t\t\t\t}\n\t\t\t\tret.Set(x, y, z, e)\n\t\t\t}\n\t\t}\n\t}\n\treturn ret, nil\n}", "func Mul128(x, y uint64) (z1, z0 uint64) {\n\t// Split x and y into 2 halfwords each, multiply\n\t// the halfwords separately while avoiding overflow,\n\t// and return the product as 2 words.\n\n\tconst (\n\t\tW\t= uint(unsafe.Sizeof(x)) * 8;\n\t\tW2\t= W / 2;\n\t\tB2\t= 1 << W2;\n\t\tM2\t= B2 - 1;\n\t)\n\n\tif x < y {\n\t\tx, y = y, x\n\t}\n\n\tif x < B2 {\n\t\t// y < B2 because y <= x\n\t\t// sub-digits of x and y are (0, x) and (0, y)\n\t\t// z = z[0] = x*y\n\t\tz0 = x * y;\n\t\treturn;\n\t}\n\n\tif y < B2 {\n\t\t// sub-digits of x and y are (x1, x0) and (0, y)\n\t\t// x = (x1*B2 + x0)\n\t\t// y = (y1*B2 + y0)\n\t\tx1, x0 := x>>W2, x&M2;\n\n\t\t// x*y = t2*B2*B2 + t1*B2 + t0\n\t\tt0 := x0 * y;\n\t\tt1 := x1 * y;\n\n\t\t// compute result digits but avoid overflow\n\t\t// z = z[1]*B + z[0] = x*y\n\t\tz0 = t1<<W2 + t0;\n\t\tz1 = (t1 + t0>>W2) >> W2;\n\t\treturn;\n\t}\n\n\t// general case\n\t// sub-digits of x and y are (x1, x0) and (y1, y0)\n\t// x = (x1*B2 + x0)\n\t// y = (y1*B2 + y0)\n\tx1, x0 := x>>W2, x&M2;\n\ty1, y0 := y>>W2, y&M2;\n\n\t// x*y = t2*B2*B2 + t1*B2 + t0\n\tt0 := x0 * y0;\n\tt1 := x1*y0 + x0*y1;\n\tt2 := x1 * y1;\n\n\t// compute result digits but avoid overflow\n\t// z = z[1]*B + z[0] = x*y\n\tz0 = t1<<W2 + t0;\n\tz1 = t2 + (t1+t0>>W2)>>W2;\n\treturn;\n}", "func mulr(a, b, c int, r register) register {\n\tr[c] = r[a] * r[b]\n\treturn r\n}", "func (c *calculon) Multiply(ctx context.Context, arg calculator.Operand) (calculator.Result, error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tc.current *= arg.Value\n\treturn calculator.Result{c.current}, nil\n}", "func mul(m ast.Mul, isparam map[ast.Variable]bool) (Operation, error) {\n\t// Expect the second operand to always be a variable.\n\tif _, ok := m.Y.(ast.Variable); !ok {\n\t\treturn nil, errutil.AssertionFailure(\"expect second multiply operand to be variable\")\n\t}\n\n\t// Check for a const multiply.\n\tif c, ok := m.X.(ast.Constant); ok {\n\t\treturn ConstMul(c), nil\n\t}\n\n\t// Check for parameter multiply.\n\tif v, ok := m.X.(ast.Variable); ok && isparam[v] {\n\t\treturn ParamMul(v), nil\n\t}\n\n\tif v, ok := m.Y.(ast.Variable); ok && isparam[v] {\n\t\treturn ParamMul(v), nil\n\t}\n\n\t// Fallback to a generic multiply.\n\treturn Mul{}, nil\n}", "func multiply(a, b float64) float64 {\n\treturn a * b\n}", "func Multiply() {\n\tMatch('*')\n\tFactor()\n\tEmitLn(\"MULS (SP)+,D0\")\n}" ]
[ "0.7870542", "0.7677118", "0.72692245", "0.71937406", "0.7186736", "0.7144699", "0.7068656", "0.70019877", "0.69182754", "0.6779325", "0.664848", "0.6635656", "0.65184134", "0.65160215", "0.64909726", "0.64568543", "0.6446939", "0.641071", "0.62620425", "0.62328297", "0.62091386", "0.61995673", "0.6197208", "0.61855894", "0.6184176", "0.61643165", "0.61386573", "0.6131409", "0.6114755", "0.61085117", "0.60617226", "0.60365045", "0.60050637", "0.5999519", "0.5987931", "0.59745026", "0.5973536", "0.59644836", "0.5936562", "0.59345233", "0.59249204", "0.59055835", "0.58891934", "0.5887178", "0.5872087", "0.58616453", "0.5825985", "0.5821084", "0.58170485", "0.5815838", "0.57763904", "0.57758594", "0.57554775", "0.57504207", "0.5749953", "0.5727741", "0.5713024", "0.569122", "0.5681342", "0.56485724", "0.5648048", "0.56395096", "0.5639444", "0.5635065", "0.56266624", "0.5619047", "0.56172836", "0.5605582", "0.5600738", "0.55831116", "0.5575137", "0.5568744", "0.55662596", "0.5564241", "0.55472344", "0.5541481", "0.5537191", "0.5520576", "0.55155617", "0.55132663", "0.5511713", "0.5506079", "0.55054456", "0.5495169", "0.54945064", "0.54868275", "0.5484846", "0.5484637", "0.5481832", "0.5460806", "0.5425895", "0.5419101", "0.5417641", "0.5414295", "0.5412233", "0.5410478", "0.54045665", "0.53928953", "0.537878", "0.53732014" ]
0.75033665
2
Neg sets z to x and returns z. If x is positive infinity, z will be set to negative infinity and visa versa. If x == 0, z will be set to zero as well. NaN will result in an error.
func (z *Big) Neg(x *Big) *Big { if debug { x.validate() } if !z.invalidContext(z.Context) && !z.checkNaNs(x, x, negation) { xform := x.form // copy in case z == x z.copyAbs(x) if !z.IsFinite() || z.compact != 0 || z.Context.RoundingMode == ToNegativeInf { z.form = xform ^ signbit } } return z.Context.round(z) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Neg(x *Float) *Float {}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (z *Float) Abs(x *Float) *Float {}", "func RatNeg(z *big.Rat, x *big.Rat,) *big.Rat", "func (z *Int) Neg(x *Int) *Int {}", "func Neg(z, x *big.Int) *big.Int {\n\treturn z.Neg(x)\n}", "func (z *Float64) Neg(y *Float64) *Float64 {\n\tz.l = -y.l\n\tz.r = -y.r\n\treturn z\n}", "func (z *Rat) Neg(x *Rat) *Rat {}", "func IntNeg(z *big.Int, x *big.Int,) *big.Int", "func (z *Int) Abs(x *Int) *Int {}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (z *Float) SetInf(signbit bool) *Float {}", "func (f *Float) Neg(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_neg(&f.i[0], &x.i[0])\n\treturn f\n}", "func (v *Vec3i) SetNegate() {\n\tv.X = -v.X\n\tv.Y = -v.Y\n\tv.Z = -v.Z\n}", "func (v Vector) Negative() Vector {\n\treturn Vector{\n\t\tX: -v.X,\n\t\tY: -v.Y,\n\t\tZ: -v.Z,\n\t}\n}", "func (v Vec3) Negate() Vec3 {\n\treturn Vec3{-v.X, -v.Y, -v.Z}\n}", "func (v Vec3i) Negate() Vec3i {\n\treturn Vec3i{-v.X, -v.Y, -v.Z}\n}", "func (z *Rat) Abs(x *Rat) *Rat {}", "func Neg(x meta.ConstValue) meta.ConstValue {\n\tswitch x.Type {\n\tcase meta.Integer:\n\t\treturn meta.NewIntConst(-x.GetInt())\n\tcase meta.Float:\n\t\treturn meta.NewFloatConst(-x.GetFloat())\n\t}\n\treturn meta.UnknownValue\n}", "func (v Vec3) DropZ() Vec2 {\n\treturn Vec2{v[0], v[1]}\n}", "func (z *Perplex) Neg(y *Perplex) *Perplex {\n\tz.l.Neg(&y.l)\n\tz.r.Neg(&y.r)\n\treturn z\n}", "func FloatAbs(z *big.Float, x *big.Float,) *big.Float", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\tx = -x\n\t}\n\treturn x\n}", "func Vec3Neg(a Vec3) (v Vec3) {\n\tv[0] = -a[0]\n\tv[1] = -a[1]\n\tv[2] = -a[2]\n\treturn\n}", "func (z *BiComplex) Neg(y *BiComplex) *BiComplex {\n\tz.l.Neg(&y.l)\n\tz.r.Neg(&y.r)\n\treturn z\n}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func Abs(z, x *big.Int) *big.Int {\n\treturn z.Abs(x)\n}", "func (z *Rat) Inv(x *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\tif x == 0 {\n\t\treturn 0 // return correctly abs(-0)\n\t}\n\treturn x\n}", "func NegNegOptimization(a *Node) (retVal *Node, err error) {\n\tstabLogf(\"Optimizing -(-x)\")\n\tenterLogScope()\n\tdefer leaveLogScope()\n\n\tif euo, ok := a.op.(elemUnaryOp); !ok || (ok && euo.unaryOpType() != negOpType) {\n\t\treturn a, noStabilizationErr{}\n\t}\n\n\tx := a.children[0]\n\treturn x, nil\n}", "func (z *E6) Neg(x *E6) *E6 {\n\tz.B0.Neg(&x.B0)\n\tz.B1.Neg(&x.B1)\n\tz.B2.Neg(&x.B2)\n\treturn z\n}", "func (a *api) Negate() {\n\ta.Commentf(\"%s computes z = -x (mod p).\", a.Name(\"Neg\"))\n\ta.Function(a.Name(\"Neg\"), a.Signature(\"z\", \"x\"))\n\ta.Call(\"Sub\", \"z\", \"&\"+a.Name(\"prime\"), \"x\")\n\ta.LeaveBlock()\n}", "func (v *Vector) Negated() *Vector {\n\treturn &Vector{X: -v.X, Y: -v.Y, Z: -v.Z}\n}", "func (t *FloatDataType) Negative() *FloatDataType {\n\treturn t.Max(1e-10)\n}", "func (f Frac) Neg() Frac {\n\treturn Frac{n: f.n * -1, d: f.d}\n}", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func (z *Int) Abs() *Int {\n\tif z.Lt(SignedMin) {\n\t\treturn z\n\t}\n\tz.Sub(zero, z)\n\treturn z\n}", "func (p *PointProj) setInfinity() *PointProj {\n\tp.X.SetZero()\n\tp.Y.SetOne()\n\tp.Z.SetOne()\n\treturn p\n}", "func (z *Big) Abs(x *Big) *Big {\n\tif debug {\n\t\tx.validate()\n\t}\n\tif !z.invalidContext(z.Context) && !z.checkNaNs(x, x, absvalue) {\n\t\tz.Context.round(z.copyAbs(x))\n\t}\n\treturn z\n}", "func (z *Float64) Minus(y *Float64, a float64) *Float64 {\n\tz.l = y.l - a\n\tz.r = y.r\n\treturn z\n}", "func (z *Float) Set(x *Float) *Float {}", "func (p *DatatypeGeoPoint) IgnoreZValue(ignoreZValue bool) *DatatypeGeoPoint {\n\tp.ignoreZValue = &ignoreZValue\n\treturn p\n}", "func Neg(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Neg\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func abs(x int64) int64 {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func (v Vec3) Negate() Vec3 {\n\treturn Vec3{-v[0], -v[1], -v[2]}\n}", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func Neg(n int) int { return -n }", "func (i I) Abs() I {\n\tif i.X < 0 {\n\t\ti.X = -i.X\n\t}\n\tif i.Y < 0 {\n\t\ti.Y = -i.Y\n\t}\n\treturn i\n}", "func (p *EdwardsPoint) Neg(t *EdwardsPoint) *EdwardsPoint {\n\tp.inner.X.Neg(&t.inner.X)\n\tp.inner.Y.Set(&t.inner.Y)\n\tp.inner.Z.Set(&t.inner.Z)\n\tp.inner.T.Neg(&t.inner.T)\n\treturn p\n}", "func (a Vector3) Abs() Vector3 {\n\treturn Vector3{math.Abs(a.X), math.Abs(a.Y), math.Abs(a.Z)}\n}", "func (s *Scalar) Negate(x *Scalar) *Scalar {\n\ts.s.Neg(&x.s)\n\treturn s\n}", "func Abs(x int) int {\n\tif x > 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func (m *Money) Neg() *Money {\n\tif m.M != 0 {\n\t\tm.M *= -1\n\t}\n\treturn m\n}", "func (p *PointProj) Neg(p1 *PointProj) *PointProj {\n\tp.Set(p1)\n\tp.X.Neg(&p.X)\n\treturn p\n}", "func (f Fixed) Abs() Fixed {\n\tif f.IsNaN() {\n\t\treturn NaN\n\t}\n\tif f.Sign() >= 0 {\n\t\treturn f\n\t}\n\tf0 := Fixed{fp: f.fp * -1}\n\treturn f0\n}", "func (v *Vector) Minus(a *Vector) *Vector {\n\treturn &Vector{X: v.X - a.X, Y: v.Y - a.Y, Z: v.Z - a.Z}\n}", "func (z *Int) Not(x *Int) *Int {}", "func (c Currency) Neg() Currency {\n\tif c.m != 0 {\n\t\tc.m *= -1\n\t}\n\treturn c\n}", "func (g *Graph) Neg(x Node) Node {\n\treturn g.NewOperator(fn.NewNeg(x), x)\n}", "func (m MyFloat) Abs() float64 {\n if m < 0 {\n return float64(-m)\n }\n return float64(m)\n}", "func Abs[T constraints.Number](x T) T {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func abs(x int64) int64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func iAbs(x int) int { if x >= 0 { return x } else { return -x } }", "func (c *Clac) Neg() error {\n\treturn c.applyFloat(1, func(vals []value.Value) (value.Value, error) {\n\t\treturn unary(\"-\", vals[0])\n\t})\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (f *Fieldx) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}", "func (z *Float64) Inv(y *Float64) *Float64 {\n\tif y.IsZeroDivisor() {\n\t\tpanic(zeroDivisorInverse)\n\t}\n\treturn z.Divide(z.Conj(y), y.Quad())\n}", "func ( f MyFloat ) Abs() float64 {\n\tif f < 0 { return float64( -f ) }\n\treturn float64(f) \n}", "func (v *Vec3i) SetZero() {\n\tv.SetScalar(0)\n}", "func (s *Scalar) Invert(x *Scalar) *Scalar {\n\ts.s.Inv(&x.s)\n\treturn s\n}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (gdt *Vector3) OperatorNeg() Vector3 {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_operator_neg(GDNative.api, arg0)\n\n\treturn Vector3{base: &ret}\n\n}", "func (me XsdGoPkgHasElems_Z) ZDefault() xsdt.Double {\r\n\tvar x = new(xsdt.Double)\r\n\tx.Set(\"1.0\")\r\n\treturn *x\r\n}", "func (me XsdGoPkgHasElem_Z) ZDefault() xsdt.Double { var x = new(xsdt.Double); x.Set(\"1.0\"); return *x }", "func (u UDim) Neg() UDim {\n\treturn UDim{\n\t\tScale: -u.Scale,\n\t\tOffset: -u.Offset,\n\t}\n}", "func Abs(in Res) Res {\n\tsign := in.Output().Copy()\n\tanyvec.GreaterThan(sign, sign.Creator().MakeNumeric(0))\n\tsign.Scale(sign.Creator().MakeNumeric(2))\n\tsign.AddScalar(sign.Creator().MakeNumeric(-1))\n\treturn Mul(in, NewConst(sign))\n}", "func Abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\r\n\tif x < 0 {\r\n\t\treturn -x\r\n\t}\r\n\treturn x\r\n}", "func (f *Float) Abs(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_abs(&f.i[0], &x.i[0])\n\treturn f\n}", "func RatAbs(z *big.Rat, x *big.Rat,) *big.Rat", "func (s *DatatypeGeoShape) IgnoreZValue(ignoreZValue bool) *DatatypeGeoShape {\n\ts.ignoreZValue = &ignoreZValue\n\treturn s\n}", "func abs(x int) int {\n\tif x < 0{\n\t\treturn -x\n\t}\n\treturn x\n}", "func (x *Big) Float(z *big.Float) *big.Float {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Float)\n\t}\n\n\tswitch x.form {\n\tcase finite, finite | signbit:\n\t\tif x.isZero() {\n\t\t\tz.SetUint64(0)\n\t\t} else {\n\t\t\tz.SetRat(x.Rat(nil))\n\t\t}\n\tcase pinf, ninf:\n\t\tz.SetInf(x.form == pinf)\n\tdefault: // snan, qnan, ssnan, sqnan:\n\t\tz.SetUint64(0)\n\t}\n\treturn z\n}", "func mathAbs(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar z *phpv.ZVal\n\t_, err := core.Expand(ctx, args, &z)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tz, err = z.AsNumeric(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch z.GetType() {\n\tcase phpv.ZtInt:\n\t\ti := z.AsInt(ctx)\n\t\tif i < 0 {\n\t\t\treturn (-i).ZVal(), nil\n\t\t} else {\n\t\t\treturn i.ZVal(), nil\n\t\t}\n\tcase phpv.ZtFloat:\n\t\treturn phpv.ZFloat(math.Abs(float64(z.AsFloat(ctx)))).ZVal(), nil\n\tdefault:\n\t\treturn phpv.ZNull{}.ZVal(), nil\n\t}\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func FloatSign(x *big.Float,) int", "func Zero() Vect { return Vect{} }" ]
[ "0.7231782", "0.71507126", "0.6635114", "0.6450123", "0.6422806", "0.63785046", "0.63411933", "0.6128639", "0.60820645", "0.60324293", "0.58987254", "0.58873147", "0.58386755", "0.5802333", "0.56693554", "0.5620133", "0.55897784", "0.55698377", "0.556133", "0.55603373", "0.5554938", "0.5527073", "0.5502887", "0.5474377", "0.5452436", "0.5385616", "0.53852504", "0.5368323", "0.5277776", "0.52755976", "0.5270665", "0.5241385", "0.5231861", "0.5210174", "0.52076024", "0.51812327", "0.5159791", "0.51478845", "0.51266223", "0.5124665", "0.50917906", "0.508439", "0.5079271", "0.50627446", "0.50548416", "0.5052937", "0.50368285", "0.50301564", "0.50226134", "0.5022475", "0.5019994", "0.49968144", "0.4996101", "0.4989196", "0.49876192", "0.49801153", "0.4964686", "0.49642226", "0.49504712", "0.49385142", "0.49370044", "0.49334818", "0.49308413", "0.49223542", "0.49221924", "0.48925823", "0.488456", "0.48833096", "0.48782244", "0.48782244", "0.48782244", "0.48782244", "0.48782244", "0.48782244", "0.48782244", "0.48782244", "0.487033", "0.48602355", "0.48536608", "0.4850558", "0.48195085", "0.48165315", "0.48149976", "0.48108548", "0.48079288", "0.4806384", "0.4805949", "0.48027393", "0.47840834", "0.4775868", "0.47732863", "0.4765842", "0.47653502", "0.47631964", "0.47532183", "0.4734463", "0.4734463", "0.4734463", "0.4725579", "0.47198877" ]
0.59579825
10
New creates a new Big decimal with the given value and scale. For example: New(1234, 3) // 1.234 New(42, 0) // 42 New(4321, 5) // 0.04321 New(1, 0) // 1 New(3, 10) // 30 000 000 000
func New(value int64, scale int) *Big { return new(Big).SetMantScale(value, scale) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newDecimal(prec, scale int32) (*types.T, error) {\n\tif scale > prec {\n\t\terr := pgerror.WithCandidateCode(\n\t\t\terrors.Newf(\"scale (%d) must be between 0 and precision (%d)\", scale, prec),\n\t\t\tpgcode.InvalidParameterValue)\n\t\treturn nil, err\n\t}\n\treturn types.MakeDecimal(prec, scale), nil\n}", "func New(value int64, exp int32) Decimal {\n\treturn Decimal{\n\t\tvalue: big.NewInt(value),\n\t\texp: exp,\n\t}\n}", "func New(value int64, exp int32) Decimal {\n\treturn decimal.New(value, exp)\n}", "func New(s string, base int) (v BigNum) {\n\tv.Input(s, base)\n\treturn\n}", "func New(value int64, exp int32) Decimal {\n\treturn Decimal{val: decimal.New(value, exp)}\n}", "func newDecimal(digits *big.Int, precision uint8) *TypedDecimal {\n\tvar isNegative int32 = isPositiveTypeOpt\n\tif digits.Sign() < 0 {\n\t\tisNegative = isNegativeTypeOpt\n\t}\n\ttypedDecimal64 := TypedDecimal{\n\t\tBytes: digits.Bytes(),\n\t\tType: ValueType_DECIMAL,\n\t\tTypeOpts: []int32{int32(precision), isNegative},\n\t}\n\treturn &typedDecimal64\n}", "func NewPrice(val decimal.Decimal, scale int32) PriceField {\n\treturn PriceField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func NewFromBigInt(value *big.Int, exp int32) Decimal {\n\treturn Decimal{\n\t\tvalue: new(big.Int).Set(value),\n\t\texp: exp,\n\t}\n}", "func NewFromBigInt(value *big.Int, exp int32) Decimal {\n\treturn decimal.NewFromBigInt(value, exp)\n}", "func New(n int, size int) Number {\n\tz2n := zero2nine.FromInt(n)\n\tnum := &number{size: size}\n\tswitch z2n {\n\tcase zero2nine.Zero:\n\t\treturn &zero{num}\n\tcase zero2nine.One:\n\t\treturn &one{num}\n\tcase zero2nine.Two:\n\t\treturn &two{num}\n\tcase zero2nine.Three:\n\t\treturn &three{num}\n\tcase zero2nine.Four:\n\t\treturn &four{num}\n\tcase zero2nine.Five:\n\t\treturn &five{num}\n\tcase zero2nine.Six:\n\t\treturn &six{num}\n\tcase zero2nine.Seven:\n\t\treturn &seven{num}\n\tcase zero2nine.Eight:\n\t\treturn &eight{num}\n\tcase zero2nine.Nine:\n\t\treturn &nine{num}\n\tdefault:\n\t\treturn nil\n\t}\n}", "func New(m int64, c string) *Money {\n\treturn &Money{m, c}\n}", "func NewDec(value int64, exp int32) Decimal {\n\treturn Decimal{\n\t\tvalue: big.NewInt(value),\n\t\texp: exp,\n\t}\n}", "func NewFromInt(value int64) Decimal {\n\treturn Decimal{\n\t\tvalue: big.NewInt(value),\n\t\texp: 0,\n\t}\n}", "func newDecimal(prec2 uint32) *Decimal {\n\tz := new(Decimal)\n\t// dec.make ensures the slice length is > 0\n\tz.mant = z.mant.make(int(prec2/_DW) * 2)\n\treturn z\n}", "func New(r, c int) M {\n\tvals := make([]Frac, r*c)\n\tfor i := range vals {\n\t\tvals[i] = NewScalarFrac(0)\n\t}\n\n\treturn M{r: r, c: c, values: vals}\n}", "func NewBigValue(bytes []Byte) BigValue {\n\treturn BigValue{\n\t\tLow: NewValue(bytes[0:2]),\n\t\tHigh: NewValue(bytes[2:4]),\n\t}\n}", "func TestDecimal_Scale(t *testing.T) {\n\ta := New(1234, -3)\n\tif a.Scale() != -3 {\n\t\tt.Errorf(\"error\")\n\t}\n}", "func (x *Big) Scale() int { return -x.exp }", "func NewFromString(val string) (Decimal, error) {\n\treturn decimal.NewFromString(val)\n}", "func NewFromString(value string) (Decimal, error) {\n\td, err := decimal.NewFromString(value)\n\treturn Decimal{val: d}, err\n}", "func NewFloat(x float64) *big.Float", "func NewBigInt(v string, base int) *big.Int {\n b := big.NewInt(0)\n b.SetString(v, base)\n return b\n}", "func New() *Bigo {\n\treturn NewWithLogger(DefaultLogger())\n}", "func NewAllocPrice(val decimal.Decimal, scale int32) AllocPriceField {\n\treturn AllocPriceField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func New(b, n int) (Decomposition, error) {\n\t// n must be non negative\n\tif n < 0 {\n\t\treturn Decomposition{}, fmt.Errorf(\"n must be non negative\")\n\t}\n\n\t// base must at least 2\n\tif b < 2 {\n\t\treturn Decomposition{}, fmt.Errorf(\"base must be at least 2\")\n\t}\n\n\treturn Decomposition{recDecompose(b, n, 0)}.clean(), nil\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func newBigFloat(n uint64) *big.Float {\n\ttmp := new(big.Float).SetUint64(n)\n\ttmp.SetPrec(ENCODER_DECODER_PREC)\n\treturn tmp\n}", "func NewComponentScaleMinMax() *ComponentScaleMinMax {\n return &ComponentScaleMinMax{js.Global.Get(\"Phaser\").Get(\"Component\").Get(\"ScaleMinMax\").New()}\n}", "func NewDecimal(decimal decimal.Decimal) *Decimal {\n\treturn &Decimal{Decimal: decimal}\n}", "func NewFromFloat(val float64) Decimal {\n\treturn decimal.NewFromFloat(val)\n}", "func NewFixed8(val int) Fixed8 {\n\treturn Fixed8(decimals * val)\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func NewFromDecimal(d decimal.Decimal) Decimal {\n\treturn Decimal{val: d}\n}", "func (p Point) Scale(s float64) Point {\n\treturn NewPoint(p.X*s, p.Y*s)\n}", "func NewFromFloatWithExponent(value float64, exp int32) Decimal {\n\tmul := math.Pow(10, -float64(exp))\n\tfloatValue := value * mul\n\tif math.IsNaN(floatValue) || math.IsInf(floatValue, 0) {\n\t\tpanic(fmt.Sprintf(\"Cannot create a Decimal from %v\", floatValue))\n\t}\n\tdValue := big.NewInt(round(floatValue))\n\n\treturn Decimal{\n\t\tvalue: dValue,\n\t\texp: exp,\n\t}\n}", "func NewContractMultiplier(val decimal.Decimal, scale int32) ContractMultiplierField {\n\treturn ContractMultiplierField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func NewNumberBig(b *big.Int) *Number {\n\t// Use big.Rat to convert the integer to a floating point.\n\t// NOTE: using float64(b.Int64()) will not work since floating points can\n\t// be larger than 2^64.\n\trat := big.Rat{}\n\trat.SetInt(b)\n\tf, _ := rat.Float64()\n\tres := Number{isInteger: true, floating: f}\n\tres.integer.Set(b)\n\treturn &res\n}", "func NewCurrency(v float64) Currency {\n\treturn Currency{\n\t\tvalue: int64(math.Round(v * currPrecision))}\n}", "func NewUnderlyingContractMultiplier(val decimal.Decimal, scale int32) UnderlyingContractMultiplierField {\n\treturn UnderlyingContractMultiplierField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func NewFromFloat(value float64) Decimal {\n\treturn Decimal{val: decimal.NewFromFloat(value)}\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func NewFromString(value string) (Decimal, error) {\n\toriginalInput := value\n\tvar intString string\n\tvar exp int64\n\n\t// Check if number is using scientific notation\n\teIndex := strings.IndexAny(value, \"Ee\")\n\tif eIndex != -1 {\n\t\texpInt, err := strconv.ParseInt(value[eIndex+1:], 10, 32)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*strconv.NumError); ok && e.Err == strconv.ErrRange {\n\t\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", value)\n\t\t\t}\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: exponent is not numeric\", value)\n\t\t}\n\t\tvalue = value[:eIndex]\n\t\texp = expInt\n\t}\n\n\tpIndex := -1\n\tvLen := len(value)\n\tfor i := 0; i < vLen; i++ {\n\t\tif value[i] == '.' {\n\t\t\tif pIndex > -1 {\n\t\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: too many .s\", value)\n\t\t\t}\n\t\t\tpIndex = i\n\t\t}\n\t}\n\n\tif pIndex == -1 {\n\t\t// There is no decimal point, we can just parse the original string as\n\t\t// an int\n\t\tintString = value\n\t} else {\n\t\tif pIndex+1 < vLen {\n\t\t\tintString = value[:pIndex] + value[pIndex+1:]\n\t\t} else {\n\t\t\tintString = value[:pIndex]\n\t\t}\n\t\texpInt := -len(value[pIndex+1:])\n\t\texp += int64(expInt)\n\t}\n\n\tvar dValue *big.Int\n\t// strconv.ParseInt is faster than new(big.Int).SetString so this is just a shortcut for strings we know won't overflow\n\tif len(intString) <= 18 {\n\t\tparsed64, err := strconv.ParseInt(intString, 10, 64)\n\t\tif err != nil {\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal\", value)\n\t\t}\n\t\tdValue = big.NewInt(parsed64)\n\t} else {\n\t\tdValue = new(big.Int)\n\t\t_, ok := dValue.SetString(intString, 10)\n\t\tif !ok {\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal\", value)\n\t\t}\n\t}\n\n\tif exp < math.MinInt32 || exp > math.MaxInt32 {\n\t\t// NOTE(vadim): I doubt a string could realistically be this long\n\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", originalInput)\n\t}\n\n\treturn Decimal{\n\t\tvalue: dValue,\n\t\texp: int32(exp),\n\t}, nil\n}", "func newLeafListDecimal(digits []*big.Int, precision uint8) *TypedLeafListDecimal {\n\tbytes := make([]byte, 0)\n\ttypeOpts := make([]int32, 0)\n\ttypeOpts = append(typeOpts, int32(precision))\n\tfor _, d := range digits {\n\t\ttypeOpts = append(typeOpts, int32(len(d.Bytes())))\n\t\tvar isNegative int32 = isPositiveTypeOpt\n\t\tif d.Sign() < 0 {\n\t\t\tisNegative = isNegativeTypeOpt\n\t\t}\n\t\ttypeOpts = append(typeOpts, isNegative)\n\t\tbytes = append(bytes, d.Bytes()...)\n\t}\n\ttypedLeafListDecimal := TypedLeafListDecimal{\n\t\tBytes: bytes,\n\t\tType: ValueType_LEAFLIST_DECIMAL,\n\t\tTypeOpts: typeOpts,\n\t}\n\treturn &typedLeafListDecimal\n}", "func NewFromFloat(value float64) Decimal {\n\tfloor := math.Floor(value)\n\n\t// fast path, where float is an int\n\tif floor == value && value <= math.MaxInt64 && value >= math.MinInt64 {\n\t\treturn NewDec(int64(value), 0)\n\t}\n\n\t// slow path: float is a decimal\n\t// HACK(vadim): do this the slow hacky way for now because the logic to\n\t// convert a base-2 float to base-10 properly is not trivial\n\tstr := strconv.FormatFloat(value, 'f', -1, 64)\n\tdec, err := NewFromString(str)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dec\n}", "func newCurrency(decimals int, symbol, name string) (*Currency, error) {\n\tif err := utils.ValidateSolidityTypeInstance(big.NewInt(int64(decimals)), constants.Uint8); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Currency{\n\t\tDecimals: decimals,\n\t\tSymbol: symbol,\n\t\tName: name,\n\t}, nil\n}", "func NewFromString(value string) (Decimal, error) {\n\toriginalInput := value\n\tvar intString string\n\tvar exp int64\n\n\t// Check if number is using scientific notation\n\teIndex := strings.IndexAny(value, \"Ee\")\n\tif eIndex != -1 {\n\t\texpInt, err := strconv.ParseInt(value[eIndex+1:], 10, 32)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*strconv.NumError); ok && e.Err == strconv.ErrRange {\n\t\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", value)\n\t\t\t}\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: exponent is not numeric\", value)\n\t\t}\n\t\tvalue = value[:eIndex]\n\t\texp = expInt\n\t}\n\n\tparts := strings.Split(value, \".\")\n\tif len(parts) == 1 {\n\t\t// There is no decimal point, we can just parse the original string as\n\t\t// an int\n\t\tintString = value\n\t} else if len(parts) == 2 {\n\t\t// strip the insignificant digits for more accurate comparisons.\n\t\tdecimalPart := strings.TrimRight(parts[1], \"0\")\n\t\tintString = parts[0] + decimalPart\n\t\texpInt := -len(decimalPart)\n\t\texp += int64(expInt)\n\t} else {\n\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: too many .s\", value)\n\t}\n\n\tdValue := new(big.Int)\n\t_, ok := dValue.SetString(intString, 10)\n\tif !ok {\n\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal\", value)\n\t}\n\n\tif exp < math.MinInt32 || exp > math.MaxInt32 {\n\t\t// NOTE(vadim): I doubt a string could realistically be this long\n\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", originalInput)\n\t}\n\n\treturn Decimal{\n\t\tvalue: dValue,\n\t\texp: int32(exp),\n\t}, nil\n}", "func NewLastPx(val decimal.Decimal, scale int32) LastPxField {\n\treturn LastPxField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func NewFromFloatWithExponent(value float64, exp int32) Decimal {\n\tif math.IsNaN(value) || math.IsInf(value, 0) {\n\t\tpanic(fmt.Sprintf(\"Cannot create a Decimal from %v\", value))\n\t}\n\n\tbits := math.Float64bits(value)\n\tmant := bits & (1<<52 - 1)\n\texp2 := int32((bits >> 52) & (1<<11 - 1))\n\tsign := bits >> 63\n\n\tif exp2 == 0 {\n\t\t// specials\n\t\tif mant == 0 {\n\t\t\treturn Decimal{}\n\t\t}\n\t\t// subnormal\n\t\texp2++\n\t} else {\n\t\t// normal\n\t\tmant |= 1 << 52\n\t}\n\n\texp2 -= 1023 + 52\n\n\t// normalizing base-2 values\n\tfor mant&1 == 0 {\n\t\tmant = mant >> 1\n\t\texp2++\n\t}\n\n\t// maximum number of fractional base-10 digits to represent 2^N exactly cannot be more than -N if N<0\n\tif exp < 0 && exp < exp2 {\n\t\tif exp2 < 0 {\n\t\t\texp = exp2\n\t\t} else {\n\t\t\texp = 0\n\t\t}\n\t}\n\n\t// representing 10^M * 2^N as 5^M * 2^(M+N)\n\texp2 -= exp\n\n\ttemp := big.NewInt(1)\n\tdMant := big.NewInt(int64(mant))\n\n\t// applying 5^M\n\tif exp > 0 {\n\t\ttemp = temp.SetInt64(int64(exp))\n\t\ttemp = temp.Exp(fiveInt, temp, nil)\n\t} else if exp < 0 {\n\t\ttemp = temp.SetInt64(-int64(exp))\n\t\ttemp = temp.Exp(fiveInt, temp, nil)\n\t\tdMant = dMant.Mul(dMant, temp)\n\t\ttemp = temp.SetUint64(1)\n\t}\n\n\t// applying 2^(M+N)\n\tif exp2 > 0 {\n\t\tdMant = dMant.Lsh(dMant, uint(exp2))\n\t} else if exp2 < 0 {\n\t\ttemp = temp.Lsh(temp, uint(-exp2))\n\t}\n\n\t// rounding and downscaling\n\tif exp > 0 || exp2 < 0 {\n\t\thalfDown := new(big.Int).Rsh(temp, 1)\n\t\tdMant = dMant.Add(dMant, halfDown)\n\t\tdMant = dMant.Quo(dMant, temp)\n\t}\n\n\tif sign == 1 {\n\t\tdMant = dMant.Neg(dMant)\n\t}\n\n\treturn Decimal{\n\t\tvalue: dMant,\n\t\texp: exp,\n\t}\n}", "func NewFromFloat(value float64) Decimal {\n\tif value == 0 {\n\t\treturn New(0, 0)\n\t}\n\treturn newFromFloat(value, math.Float64bits(value), &float64info)\n}", "func New(buffer, backing sorted.KeyValue, maxBufferBytes int64) *KeyValue {\n\treturn &KeyValue{\n\t\tbuffer: buffer,\n\t\tback: backing,\n\t\tmaxBuffer: maxBufferBytes,\n\t}\n}", "func New(opts ...OptionFunc) Currency {\n\tc := Currency{}\n\tc.applyDefaults()\n\tc.Option(opts...)\n\treturn c\n}", "func New(max time.Duration, interval time.Duration) *Backoff {\n\tif max < 0 || interval < 0 {\n\t\tpanic(\"backoff: max or interval is negative\")\n\t}\n\n\tb := &Backoff{\n\t\tmaxDuration: max,\n\t\tinterval: interval,\n\t}\n\tb.setup()\n\treturn b\n}", "func NewScaleInfo(cap int) *ScaleInfo {\n\treturn &ScaleInfo{\n\t\tpoints: make([]float32, cap),\n\t}\n}", "func New() (*BigcacheCache, error) {\n\tcache, err := bigcache.NewBigCache(bigcache.DefaultConfig(10 * time.Minute))\n\treturn &BigcacheCache{cache}, err\n}", "func NewBigFloat(f float64) *big.Float {\n\tr := big.NewFloat(f)\n\tr.SetPrec(CurrentPrecision)\n\treturn r\n}", "func NewFloat(f float64) T {\n\treturn big.NewFloat(f)\n}", "func NewDecimal() *Decimal {\n\treturn NewDecimalFromV2(new(accounting.Decimal))\n}", "func NewFromFloat(f float64) Fixed {\n\tif math.IsNaN(f) {\n\t\treturn Fixed{fp: nan}\n\t}\n\tif f >= max || f < 0 {\n\t\tpanic(errOverflow)\n\t}\n\tintPart := decimal.NewFromFloat(f).Mul(decimal.NewFromFloat(float64(scale))).IntPart()\n\treturn Fixed{fp: uint64(intPart)}\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func newFloat(prec int64) (*types.T, error) {\n\tif prec < 1 {\n\t\treturn nil, errFloatPrecAtLeast1\n\t}\n\tif prec <= 24 {\n\t\treturn types.Float4, nil\n\t}\n\tif prec <= 54 {\n\t\treturn types.Float, nil\n\t}\n\treturn nil, errFloatPrecMax54\n}", "func NewBidPx(val decimal.Decimal, scale int32) BidPxField {\n\treturn BidPxField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func New(ctx context.Context, rate, timespan int) (Bucket, error) {\n\tq := make(chan struct{}, rate)\n\tb := Bucket{ctx: ctx, queue: q, rate: rate, timespan: timespan}\n\tgo b.leak()\n\treturn b, nil // maybe return pointer?\n}", "func (p Point) Scale(f float64) Point {\n\treturn Point{p[0] * f, p[1] * f, p[2] * f}\n}", "func (v Vec3) Scale(s float64) Vec3 {\n\treturn Vec3{v[0] * s, v[1] * s, v[2] * s}\n}", "func (r *ScaleREST) New() runtime.Object {\n\treturn &extensions.Scale{}\n}", "func BBMake(l, t, r, b Float) (BB) { \n return BB{L: l, B: b, R: r, T: t}\n}", "func NewFromBig(x *big.Float) (Float, big.Accuracy) {\n\t// +-Inf\n\tzero := big.NewFloat(0)\n\tswitch {\n\tcase x.IsInf():\n\t\tif x.Signbit() {\n\t\t\t// -Inf\n\t\t\treturn NegInf, big.Exact\n\t\t}\n\t\t// +Inf\n\t\treturn Inf, big.Exact\n\t// +-zero\n\tcase x.Cmp(zero) == 0:\n\t\tif x.Signbit() {\n\t\t\t// -zero\n\t\t\treturn NegZero, big.Exact\n\t\t}\n\t\t// +zero\n\t\treturn Zero, big.Exact\n\t}\n\n\t// Sign\n\tvar bits uint16\n\tif x.Signbit() {\n\t\tbits |= 0x8000\n\t}\n\n\t// Exponent and mantissa.\n\tmant := new(big.Float)\n\texponent := x.MantExp(mant)\n\t// Remove 1 from the exponent as big.Float has an no lead bit.\n\texp := exponent - 1 + bias\n\n\t// Handle denormalized values.\n\t// TODO: validate implementation of denormalized values.\n\tif exp <= 0 {\n\t\tacc := big.Exact\n\t\tif exp <= -(precision - 1) {\n\t\t\texp = precision - 1\n\t\t\tacc = big.Below\n\t\t}\n\t\tmant.SetMantExp(mant, exp+precision-1)\n\t\tif mant.Signbit() {\n\t\t\tmant.Neg(mant)\n\t\t}\n\t\tmantissa, _ := mant.Uint64()\n\t\t// TODO: calculate acc based on if mantissa&^0x7FF != 0 {}\n\t\tbits |= uint16(mantissa & 0x7FF)\n\t\treturn Float{bits: bits}, acc\n\t}\n\n\t// exponent mask (5 bits): 0b11111\n\tacc := big.Exact\n\tif (exp &^ 0x1F) != 0 {\n\t\tacc = big.Above\n\t}\n\tbits |= uint16(exp&0x1F) << 10\n\n\tif mant.Signbit() {\n\t\tmant.Neg(mant)\n\t}\n\tmant.SetMantExp(mant, precision)\n\tif !mant.IsInt() {\n\t\tacc = big.Below\n\t}\n\tmantissa, _ := mant.Uint64()\n\tmantissa &^= 0x400 // clear implicit lead bit; 2^10\n\n\t// mantissa mask (11 bits, including implicit lead bit): 0b11111111111\n\tif acc == big.Exact && (mantissa&^0x7FF) != 0 {\n\t\tacc = big.Below\n\t}\n\tmantissa &= 0x7FF\n\tbits |= uint16(mantissa)\n\treturn Float{bits: bits}, acc\n}", "func newFloat(value *big.Float) *TypedFloat {\n\tbytes, _ := value.GobEncode()\n\ttypedFloat := TypedFloat{\n\t\tBytes: bytes,\n\t\tType: ValueType_FLOAT,\n\t}\n\treturn &typedFloat\n}", "func (z *Big) SetScale(scale int) *Big {\n\tz.exp = -scale\n\treturn z\n}", "func (v Vector) Scale(scale float64) Vector {\n\treturn Vector{\n\t\tX: v.X * scale,\n\t\tY: v.Y * scale,\n\t\tZ: v.Z * scale}\n}", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func NewFromBig(x *big.Float) (Float, big.Accuracy) {\n\t// +-Inf\n\tzero := big.NewFloat(0)\n\tswitch {\n\tcase x.IsInf():\n\t\tif x.Signbit() {\n\t\t\t// -Inf\n\t\t\t// sign: 1\n\t\t\t// exp: all ones\n\t\t\t// mant: 10 zero\n\t\t\treturn NegInf, big.Exact\n\t\t}\n\t\t// +Inf\n\t\t// sign: 0\n\t\t// exp: all ones\n\t\t// mant: 10 zero\n\t\treturn Inf, big.Exact\n\t// +-zero\n\tcase x.Cmp(zero) == 0:\n\t\tif x.Signbit() {\n\t\t\t// -zero\n\t\t\t// sign: 1\n\t\t\t// exp: zero\n\t\t\t// mant: zero\n\t\t\treturn NegZero, big.Exact\n\t\t}\n\t\t// +zero\n\t\t// sign: 0\n\t\t// exp: zero\n\t\t// mant: zero\n\t\treturn Zero, big.Exact\n\t}\n\n\t// Sign\n\tvar se uint16\n\tif x.Signbit() {\n\t\tse |= 0x8000\n\t}\n\n\t// Exponent and mantissa.\n\tvar m uint64\n\tmant := &big.Float{}\n\texponent := x.MantExp(mant)\n\t// TODO: verify, as float80x86 also has an explicit lead bit.\n\t// Remove 1 from the exponent as big.Float has an no lead bit.\n\texp := exponent - 1 + bias\n\n\t// Handle denormalized values.\n\t// TODO: validate implementation of denormalized values.\n\tif exp <= 0 {\n\t\tacc := big.Exact\n\t\tif exp <= -(precision - 1) {\n\t\t\texp = precision - 1\n\t\t\tacc = big.Below\n\t\t}\n\t\tmant.SetMantExp(mant, exp+precision-1)\n\t\tif mant.Signbit() {\n\t\t\tmant.Neg(mant)\n\t\t}\n\t\tv, _ := mant.Uint64()\n\t\t// TODO: calculate acc based on if v&^0x7FFFFFFFFFFFFFFF != 0 {}\n\t\tm |= v & 0x7FFFFFFFFFFFFFFF\n\t\treturn Float{se: se, m: m}, acc\n\t}\n\n\t// 0b111111111111111\n\tacc := big.Exact\n\tif (exp &^ 0x7FFF) != 0 {\n\t\tacc = big.Above\n\t}\n\tse |= uint16(exp & 0x7FFF)\n\n\tif mant.Signbit() {\n\t\tmant.Neg(mant)\n\t}\n\tmant.SetMantExp(mant, precision)\n\tif !mant.IsInt() {\n\t\tacc = big.Below\n\t}\n\t// mantissa, including explicit lead bit\n\tmantissa, acc2 := mant.Uint64()\n\tif acc == big.Exact {\n\t\tacc = acc2\n\t}\n\tm |= mantissa\n\treturn Float{se: se, m: m}, acc\n}", "func LegacyNewDecFromBigIntWithPrec(i *big.Int, prec int64) LegacyDec {\n\treturn LegacyDec{\n\t\tnew(big.Int).Mul(i, precisionMultiplier(prec)),\n\t}\n}", "func NewRat(a, b int64) *big.Rat", "func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal {\n value := new(big.Int)\n switch v := ivalue.(type) {\n case string:\n value.SetString(v, 10)\n case *big.Int:\n value = v\n }\n\n mul := decimal.NewFromFloat(float64(10)).Pow(decimal.NewFromFloat(float64(decimals)))\n num, _ := decimal.NewFromString(value.String())\n result := num.Div(mul)\n\n return result\n}", "func NewBidSize(val decimal.Decimal, scale int32) BidSizeField {\n\treturn BidSizeField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func Make(amount decimal.Decimal, c currency.Currency) Money {\n\treturn Money{amount, c}\n}", "func New(p uint8) Counter {\n\tif p < 4 || p > 18 {\n\t\tpanic(\"hll: precision p must be in range [4,18]\")\n\t}\n\tm := int(1 << uint(p))\n\tc := Counter{\n\t\tp: p,\n\t\tbits: bitbucket.New(m, 6),\n\t}\n\tc.initParams()\n\n\treturn c\n}", "func modbig(b *big.Int, scale int32) (dec *big.Int, frac *big.Int) {\n\tif b.Sign() < 0 {\n\t\tdec, frac = modbig(new(big.Int).Neg(b), scale)\n\t\tdec.Neg(dec)\n\t\tfrac.Neg(frac)\n\t\treturn dec, frac\n\t}\n\texp := pow.BigTen(int64(scale))\n\tif exp.Sign() == 0 {\n\t\treturn b, new(big.Int)\n\t}\n\tdec = new(big.Int).Quo(b, &exp)\n\tfrac = new(big.Int).Mul(dec, &exp)\n\tfrac = frac.Sub(b, frac)\n\treturn dec, frac\n}", "func NewNetMoney(val decimal.Decimal, scale int32) NetMoneyField {\n\treturn NetMoneyField{quickfix.FIXDecimal{Decimal: val, Scale: scale}}\n}", "func (p Point) Scale(s Length) Point {\n\treturn Point{p.X * s, p.Y * s}\n}", "func NewMaxOrMinDec(negative bool, prec, frac int) *MyDecimal {\n\tstr := make([]byte, prec+2)\n\tfor i := 0; i < len(str); i++ {\n\t\tstr[i] = '9'\n\t}\n\tif negative {\n\t\tstr[0] = '-'\n\t} else {\n\t\tstr[0] = '+'\n\t}\n\tstr[1+prec-frac] = '.'\n\tdec := new(MyDecimal)\n\terr := dec.FromString(str)\n\tterror.Log(errors.Trace(err))\n\treturn dec\n}", "func NewMaxOrMinDec(negative bool, prec, frac int) *MyDecimal {\n\ttrace_util_0.Count(_mydecimal_00000, 634)\n\tstr := make([]byte, prec+2)\n\tfor i := 0; i < len(str); i++ {\n\t\ttrace_util_0.Count(_mydecimal_00000, 637)\n\t\tstr[i] = '9'\n\t}\n\ttrace_util_0.Count(_mydecimal_00000, 635)\n\tif negative {\n\t\ttrace_util_0.Count(_mydecimal_00000, 638)\n\t\tstr[0] = '-'\n\t} else {\n\t\ttrace_util_0.Count(_mydecimal_00000, 639)\n\t\t{\n\t\t\tstr[0] = '+'\n\t\t}\n\t}\n\ttrace_util_0.Count(_mydecimal_00000, 636)\n\tstr[1+prec-frac] = '.'\n\tdec := new(MyDecimal)\n\terr := dec.FromString(str)\n\tterror.Log(errors.Trace(err))\n\treturn dec\n}", "func New(major, minor, patch int) Version {\n\treturn &version{major, minor, patch}\n}", "func NewDecimalFromString(src string) (result *Decimal, err error) {\n\tdec, err := decimal.NewFromString(src)\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = NewDecimal(dec)\n\treturn\n}", "func New(name string, rate float64, tags ...string) Metric {\n\treturn Metric{name, rate, tags}\n}", "func ScaleButtonNew(size IconSize, min, max, step float64, icons []string) (*ScaleButton, error) {\n\tcicons := make([]*C.gchar, len(icons))\n\tfor i, icon := range icons {\n\t\tcicons[i] = (*C.gchar)(C.CString(icon))\n\t\tdefer C.free(unsafe.Pointer(cicons[i]))\n\t}\n\tcicons = append(cicons, nil)\n\n\tc := C.gtk_scale_button_new(C.GtkIconSize(size),\n\t\tC.gdouble(min),\n\t\tC.gdouble(max),\n\t\tC.gdouble(step),\n\t\t&cicons[0])\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\tobj := glib.Take(unsafe.Pointer(c))\n\treturn wrapScaleButton(obj), nil\n}", "func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal {\n\tvalue := new(big.Int)\n\tswitch v := ivalue.(type) {\n\tcase int64:\n\t\tvalue.SetInt64(v)\n\tcase string:\n\t\tvalue.SetString(v, 10)\n\tcase *big.Int:\n\t\tvalue = v\n\t}\n\n\tmul := decimal.NewFromFloat(float64(10)).Pow(decimal.NewFromFloat(float64(decimals)))\n\tnum, _ := decimal.NewFromString(value.String())\n\tresult := num.Div(mul)\n\n\treturn result\n}", "func NewMoney(i interface{}) (Money, error) {\n\tvar err error\n\tvar d decimal.Decimal\n\n\tswitch v := i.(type) {\n\tcase string:\n\t\td, err = decimal.NewFromString(v)\n\tcase float64:\n\t\td = decimal.NewFromFloat(v)\n\tcase int64:\n\t\td = decimal.New(v, 0)\n\tcase int:\n\t\td = decimal.New(int64(v), 0)\n\tcase decimal.Decimal:\n\t\td = v\n\tcase Decimal:\n\t\td = v.Decimal\n\tcase Money:\n\t\td = v.Decimal\n\tcase lib_decimal.Decimal:\n\t\td, err = decimal.NewFromString(v.String())\n\tdefault:\n\t\terr = fmt.Errorf(\"Can't convert %+v to types.Money\", i)\n\t}\n\n\treturn Money{d}, err\n}", "func NewMoney(a int, c string) *Money {\n\treturn &Money{amount: a, currency: c}\n}", "func New(args ...float64) Tuple {\n\treturn args\n}", "func NewFromOriginal(i uint64) Fixed {\n\treturn NewFromUintWithExponent(i , nPlaces)\n}", "func New(dir string, valueDir string) (Backend, error) {\n\topts := badger.DefaultOptions\n\topts.Dir = dir\n\topts.ValueDir = valueDir\n\n\tdb, err := badger.Open(opts)\n\treturn Backend{db}, err\n}", "func LegacyNewDecFromBigInt(i *big.Int) LegacyDec {\n\treturn LegacyNewDecFromBigIntWithPrec(i, 0)\n}", "func (i *Number) Multiply(v Number) *Number {\n\treturn NewNumber(i.value * v.value)\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func New(\n\tconfig *configuration.Configuration,\n\tparser *parser.Parser,\n\thelper Helper,\n\thandler Handler,\n) (*Constructor, error) {\n\tminimumBalance, ok := new(big.Int).SetString(config.Construction.MinimumBalance, 10)\n\tif !ok {\n\t\treturn nil, errors.New(\"cannot parse minimum balance\")\n\t}\n\n\tmaximumFee, ok := new(big.Int).SetString(config.Construction.MaximumFee, 10)\n\tif !ok {\n\t\treturn nil, errors.New(\"cannot parse maximum fee\")\n\t}\n\n\treturn &Constructor{\n\t\tnetwork: config.Network,\n\t\taccountingModel: config.Construction.AccountingModel,\n\t\tcurrency: config.Construction.Currency,\n\t\tminimumBalance: minimumBalance,\n\t\tmaximumFee: maximumFee,\n\t\tcurveType: config.Construction.CurveType,\n\t\tnewAccountProbability: config.Construction.NewAccountProbability,\n\t\tmaxAddresses: config.Construction.MaxAddresses,\n\t\tscenario: config.Construction.Scenario,\n\t\tchangeScenario: config.Construction.ChangeScenario,\n\t\thelper: helper,\n\t\thandler: handler,\n\t}, nil\n}", "func NewFromBig(x *big.Float) (Float, big.Accuracy) {\n\t// +-Inf\n\tzero := big.NewFloat(0).SetPrec(precision)\n\tswitch {\n\tcase x.IsInf():\n\t\tif x.Signbit() {\n\t\t\t// -Inf\n\t\t\treturn NegInf, big.Exact\n\t\t}\n\t\t// +Inf\n\t\treturn Inf, big.Exact\n\t// +-zero\n\tcase x.Cmp(zero) == 0:\n\t\tif x.Signbit() {\n\t\t\t// -zero\n\t\t\treturn NegZero, big.Exact\n\t\t}\n\t\t// +zero\n\t\treturn Zero, big.Exact\n\t}\n\n\t// set precision of x.\n\tx.SetPrec(precision).SetMode(big.ToNearestEven)\n\n\t// get high part of the double-double floating-point value.\n\thigh, _ := x.Float64()\n\th := big.NewFloat(high).SetPrec(precision).SetMode(big.ToNearestEven)\n\n\t// compute low part by subtracting high from x.\n\tl := big.NewFloat(0).SetPrec(precision).SetMode(big.ToNearestEven)\n\tl.Sub(x, h)\n\tlow, _ := l.Float64()\n\n\t// check accuracy of results.\n\tresult := big.NewFloat(0).SetPrec(precision).SetMode(big.ToNearestEven)\n\tresult.Add(h, l)\n\tacc := big.Accuracy(x.Cmp(result))\n\n\treturn Float{high: high, low: low}, acc\n}" ]
[ "0.71687335", "0.69553965", "0.68472266", "0.6801925", "0.67120224", "0.6174388", "0.61388785", "0.6130154", "0.6117089", "0.60937726", "0.59742767", "0.5895762", "0.58735913", "0.5809028", "0.57657033", "0.5728065", "0.5727161", "0.5717478", "0.5668966", "0.5616128", "0.5600366", "0.55336523", "0.5496215", "0.54847616", "0.5425786", "0.54246145", "0.53903097", "0.5376692", "0.5375397", "0.53719497", "0.5367658", "0.53595287", "0.53593373", "0.53527427", "0.53346854", "0.53239673", "0.5309212", "0.5300966", "0.5295729", "0.5291045", "0.5290843", "0.52629143", "0.523812", "0.5225855", "0.5217992", "0.5210473", "0.5203199", "0.51994795", "0.5198159", "0.519687", "0.51966655", "0.51680475", "0.5138783", "0.51381695", "0.5135849", "0.51119894", "0.5097123", "0.509368", "0.5082327", "0.5081239", "0.5079833", "0.50740206", "0.5073862", "0.5069879", "0.50686175", "0.50656974", "0.504962", "0.5048131", "0.5032922", "0.5019468", "0.5014257", "0.50072134", "0.49975416", "0.49705103", "0.4969586", "0.49683428", "0.49637002", "0.49571964", "0.495386", "0.49395344", "0.49286494", "0.4927832", "0.49271926", "0.49201375", "0.49174613", "0.49137485", "0.49079335", "0.49049896", "0.48866516", "0.48829037", "0.48734912", "0.48720124", "0.48717126", "0.48680377", "0.48639914", "0.485471", "0.48443416", "0.48332986", "0.48330182", "0.48249087" ]
0.7762048
0
Payload returns the payload of x, provided x is a NaN value. If x is not a NaN value, the result is undefined.
func (x *Big) Payload() Payload { if !x.IsNaN(0) { return 0 } return Payload(x.compact) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPayload() Payload {\n\tp := Payload{-1, \"\", 0, \"\", 0}\n\treturn p\n}", "func (nf *NetworkPayload) GetPayload() []byte {\n\treturn nil\n}", "func (v *Value) AsPayload() *Payload {\n\tif v.IsUndefined() {\n\t\treturn NewPayload()\n\t}\n\tswitch tv := v.raw.(type) {\n\tcase *Payload:\n\t\treturn tv\n\tdefault:\n\t\treturn &Payload{\n\t\t\tvalues: map[string]interface{}{\n\t\t\t\tDefaultKey: tv,\n\t\t\t},\n\t\t}\n\t}\n}", "func (d *DNP3) Payload() []byte {\n\treturn nil\n}", "func NewNullPayload() NullPayload {\n\treturn NullPayload{}\n}", "func (e PrecisionTiming) Payload() interface{} {\n\treturn e\n}", "func (h hash) PayloadTrimmed() []byte {\n\tpayload := h.Payload()\n\tfor i := range payload {\n\t\tif payload[i] != 0 {\n\t\t\treturn payload[i:]\n\t\t}\n\t}\n\treturn payload[len(payload)-1:]\n}", "func (rw *DataRW) payload(msg Msg) []byte {\n\tbuffer := bytes.NewBuffer(make([]byte, 0, 65536))\n\t_, err := io.Copy(buffer, msg.Payload)\n\tif err != nil {\n\t\treturn nil\n\t}\n\ttemp := buffer.Bytes()\n\tlength := len(temp)\n\tvar body []byte\n\t//are we wasting more than 5% space?\n\tif cap(temp) > (length + length/5) {\n\t\tbody = make([]byte, length)\n\t\tcopy(body, temp)\n\t} else {\n\t\tbody = temp\n\t}\n\treturn body\n}", "func (d *DeploymentRequest) GetPayload() string {\n\tif d == nil || d.Payload == nil {\n\t\treturn \"\"\n\t}\n\treturn *d.Payload\n}", "func (bp *BasePayload) GetPayload() []byte {\n\treturn bp.Payload\n}", "func (e DomainEvent) Payload() interface{} {\n\treturn e.payload\n}", "func validateAndGetPayload(r *http.Request, w http.ResponseWriter) ([]byte, bool) {\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Invalid payload\", http.StatusBadRequest)\n\t\treturn nil, false\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil || string(body) == \"\" {\n\t\thttp.Error(w, \"Error payload\", http.StatusBadRequest)\n\t\treturn nil, false\n\t}\n\treturn body, true\n}", "func (n *GlobalNotification) Payload() map[string]interface{} {\r\n\treturn n.payload\r\n}", "func GetPayload(ctx context.Context, hostnameData hostname.Data) *Payload {\n\tmeta := hostMetadataUtils.GetMeta(ctx, config.Datadog)\n\tmeta.Hostname = hostnameData.Hostname\n\n\tp := &Payload{\n\t\tOs: osName,\n\t\tAgentFlavor: flavor.GetFlavor(),\n\t\tPythonVersion: python.GetPythonInfo(),\n\t\tSystemStats: getSystemStats(),\n\t\tMeta: meta,\n\t\tHostTags: hostMetadataUtils.GetHostTags(ctx, false, config.Datadog),\n\t\tContainerMeta: containerMetadata.Get(1 * time.Second),\n\t\tNetworkMeta: getNetworkMeta(ctx),\n\t\tLogsMeta: getLogsMeta(),\n\t\tInstallMethod: getInstallMethod(getInstallInfoPath()),\n\t\tProxyMeta: getProxyMeta(),\n\t\tOtlpMeta: getOtlpMeta(),\n\t}\n\n\t// Cache the metadata for use in other payloads\n\tkey := buildKey(\"payload\")\n\tcache.Cache.Set(key, p, cache.NoExpiration)\n\n\treturn p\n}", "func (m *NestedTestAllTypes) GetPayload() (x *TestAllTypes) {\n\tif m == nil {\n\t\treturn x\n\t}\n\treturn m.Payload\n}", "func (s *SignatureVerification) GetPayload() string {\n\tif s == nil || s.Payload == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Payload\n}", "func Just(input payload.Payload) Mono {\n\treturn newProxy(mono.Just(input))\n}", "func (o *NotificationConfig) GetPayload() string {\n\tif o == nil || o.Payload == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Payload\n}", "func (t *Token) Payload() []byte {\n\treturn t.payload\n}", "func payload() string {\n\treturn \"window.postMessage({r:1}, `*`)\"\n}", "func (o *GetIdentityIDUnreachable) SetPayload(payload models.Error) {\n\to.Payload = payload\n}", "func (o *AnalysisUpdateNotificationData) GetNotificationPayload() AnalysisUpdateNotificationPayload {\n\tif o == nil || o.NotificationPayload == nil {\n\t\tvar ret AnalysisUpdateNotificationPayload\n\t\treturn ret\n\t}\n\treturn *o.NotificationPayload\n}", "func (e Timing) Payload() interface{} {\n\treturn map[string]float64{\n\t\t\"min\": e.Min,\n\t\t\"max\": e.Max,\n\t\t\"val\": e.Value,\n\t\t\"cnt\": e.Count,\n\t}\n}", "func (tangle *Tangle) solidifyPayload(cachedPayload *payload.CachedPayload, cachedMetadata *CachedPayloadMetadata, cachedTransaction *transaction.CachedTransaction, cachedTransactionMetadata *CachedTransactionMetadata) {\n\t// initialize the stack\n\tsolidificationStack := list.New()\n\tsolidificationStack.PushBack(&valuePayloadPropagationStackEntry{\n\t\tCachedPayload: cachedPayload,\n\t\tCachedPayloadMetadata: cachedMetadata,\n\t\tCachedTransaction: cachedTransaction,\n\t\tCachedTransactionMetadata: cachedTransactionMetadata,\n\t})\n\n\t// keep track of the added payloads so we do not add them multiple times\n\tprocessedPayloads := make(map[payload.ID]types.Empty)\n\n\t// process payloads that are supposed to be checked for solidity recursively\n\tfor solidificationStack.Len() > 0 {\n\t\tcurrentSolidificationEntry := solidificationStack.Front()\n\t\ttangle.processSolidificationStackEntry(solidificationStack, processedPayloads, currentSolidificationEntry.Value.(*valuePayloadPropagationStackEntry))\n\t\tsolidificationStack.Remove(currentSolidificationEntry)\n\t}\n}", "func (o *CreatePackageUnprocessableEntity) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func Undefined() Val { return Val{t: bsontype.Undefined} }", "func (o WebhookOutput) Payload() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Webhook) pulumi.StringOutput { return v.Payload }).(pulumi.StringOutput)\n}", "func (o *CreateEvaluationReportNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (b *BaseHandler) Payload() []byte {\n\tcontent, err := ioutil.ReadAll(b.request.Body)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn content\n}", "func (e *Envelope) Payload() (_ *api.Payload, err error) {\n\tstate := e.State()\n\tif state != Clear && state != ClearError {\n\t\terr = fmt.Errorf(\"envelope is in state %q: payload may be invalid\", state)\n\t}\n\treturn e.payload, err\n}", "func (e *Exchange) Payload() []byte {\n\treturn e.payload\n}", "func (l *Loader) getPayload(i Sym) *extSymPayload {\n\tif !l.IsExternal(i) {\n\t\tpanic(fmt.Sprintf(\"bogus symbol index %d in getPayload\", i))\n\t}\n\tpi := l.extIndex(i)\n\treturn l.payloads[pi]\n}", "func (b *Block) signablePayload() []byte {\n\n\telements := [][]byte{\n\t\t[]byte(b.BlockId),\n\t\t[]byte(b.Author),\n\t\t[]byte(b.Hash),\n\t\t[]byte(b.PrevBlockHash),\n\t\tb.Data.Bytes(),\n\t}\n\treturn bytes.Join(elements, []byte{})\n\n}", "func (o *DeleteShipmentUnprocessableEntity) SetPayload(payload *ghcmessages.ValidationError) {\n\to.Payload = payload\n}", "func (radius *RADIUS) Payload() []byte {\n\treturn radius.BaseLayer.Payload\n}", "func (o *CreateEvaluationReportUnprocessableEntity) SetPayload(payload *ghcmessages.ValidationError) {\n\to.Payload = payload\n}", "func (o *GraphqlPostUnprocessableEntity) WithPayload(payload *models.ErrorResponse) *GraphqlPostUnprocessableEntity {\n\to.Payload = payload\n\treturn o\n}", "func (o *GetDistrictForSchoolNotFound) SetPayload(payload *models.NotFound) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func MockPayload(content string) string {\n\tdata := make(map[string]interface{})\n\tdata[\"content\"] = content\n\n\tres, err := json.Marshal(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn string(res)\n}", "func (o *CreatePackageNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GraphqlPostUnprocessableEntity) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func TaskPayload() string {\n\treturn environ.GetValueStr(\"TASK_PAYLOAD\")\n}", "func (o *GetMoveCounselingEvaluationReportsListNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (o *NrActivityListJoinedDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *ServiceInstanceLastOperationGetGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (w *Writer) encodePayload(e *xml.Encoder) error {\n\tif w.ObjectName == \"\" {\n\t\treturn e.Encode(w.Payload)\n\t}\n\treturn e.EncodeElement(w.Payload, xml.StartElement{Name: xml.Name{Local: w.ObjectName}})\n}", "func (o *GetPublicPublishedTestGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *BookBuyDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *UpdateVMTempNotFound) SetPayload(payload *UpdateVMTempNotFoundBody) {\n\to.Payload = payload\n}", "func (e *exchange) GetPayloadValue() types.Message {\n\treturn &exchangetypes.ExchangeAction{}\n}", "func NewPayload(v interface{}) Payload {\n\treturn makeJSONPayload(v)\n}", "func (o *RemoveOneDefault) SetPayload(payload *rest_model.RestError) {\n\to.Payload = payload\n}", "func (pl *Payload) push(x interface{}) {\n\tmetadata, err := getHostMetadata()\n\tif err != nil {\n\t\ttelemetryLogger.Printf(\"Error getting metadata %v\", err)\n\t} else {\n\t\terr = saveHostMetadata(metadata)\n\t\tif err != nil {\n\t\t\ttelemetryLogger.Printf(\"saving host metadata failed with :%v\", err)\n\t\t}\n\t}\n\n\tif pl.len() < MaxPayloadSize {\n\t\tswitch x.(type) {\n\t\tcase DNCReport:\n\t\t\tdncReport := x.(DNCReport)\n\t\t\tdncReport.Metadata = metadata\n\t\t\tpl.DNCReports = append(pl.DNCReports, dncReport)\n\t\tcase CNIReport:\n\t\t\tcniReport := x.(CNIReport)\n\t\t\tcniReport.Metadata = metadata\n\t\t\tpl.CNIReports = append(pl.CNIReports, cniReport)\n\t\tcase NPMReport:\n\t\t\tnpmReport := x.(NPMReport)\n\t\t\tnpmReport.Metadata = metadata\n\t\t\tpl.NPMReports = append(pl.NPMReports, npmReport)\n\t\tcase CNSReport:\n\t\t\tcnsReport := x.(CNSReport)\n\t\t\tcnsReport.Metadata = metadata\n\t\t\tpl.CNSReports = append(pl.CNSReports, cnsReport)\n\t\t}\n\t}\n}", "func (o *UpdateHostIgnitionForbidden) SetPayload(payload *models.InfraError) {\n\to.Payload = payload\n}", "func (ds *DepositToStake) Payload() []byte { return ds.payload }", "func (o *GetNFTContractTokenOK) SetPayload(payload *models.NFTTokenRow) {\n\to.Payload = payload\n}", "func GetPayload(r *http.Request, v interface{}) (bool, error) {\n\tfmt.Println(\"THE BODY: \", r.Body)\n\tif r.Body == nil {\n\t\treturn false, nil\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(body) > 0 {\n\t\terr = json.Unmarshal(body, &v)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn true, err\n\t}\n\treturn false, nil\n}", "func (o *PutSlideLikePaymentRequired) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "func (o *PutSlideLikeDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *RemoveTeamToPublishedTestGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (s Sig) Payload() ([]byte, error) {\n\t// The payload bytes are uploaded to an OCI registry as blob, and are referenced by digest.\n\t// This digiest is embedded into the OCI image manifest as a layer via a descriptor (see https://github.com/opencontainers/image-spec/blob/main/descriptor.md).\n\t// Here we compare the digest of the blob data with the layer digest to verify if this blob is associated with the layer.\n\tif digest.FromBytes(s.Blob) != s.Layer.Digest {\n\t\treturn nil, errors.New(\"an unmatched payload digest is paired with a layer descriptor digest\")\n\t}\n\treturn s.Blob, nil\n}", "func (f *framer) payload() {\n\tf.flags |= flagCustomPayload\n}", "func (o *GetPaymentNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (rq *RemedyQuery) OnlyX(ctx context.Context) *Remedy {\n\tnode, err := rq.Only(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "func (o *ShowPackageReleasesNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *RecalculatePaymentRequestInternalServerError) SetPayload(payload *supportmessages.Error) {\n\to.Payload = payload\n}", "func (o NotificationEndpointGrpcSettingsPtrOutput) PayloadName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NotificationEndpointGrpcSettings) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PayloadName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o *UpdateMoveTaskOrderPostCounselingInformationNotFound) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "func (o *GetFleetsFleetIDMembersNotFound) SetPayload(payload *models.GetFleetsFleetIDMembersNotFoundBody) {\n\to.Payload = payload\n}", "func (upq *UnsavedPostQuery) OnlyX(ctx context.Context) *UnsavedPost {\n\tnode, err := upq.Only(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "func (o *UpdateMoveTaskOrderPostCounselingInformationUnprocessableEntity) SetPayload(payload *primemessages.ValidationError) {\n\to.Payload = payload\n}", "func (o *ShipPackageDefault) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *GetReportViolationsByReportIDNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (o *UpdateHostIgnitionInternalServerError) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetVMVolumeDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetBackupRuntimeEnvironmentsNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksNotFound) SetPayload(payload *models.Error) {\r\n\to.Payload = payload\r\n}", "func (o *RegisterInfraEnvForbidden) SetPayload(payload *models.InfraError) {\n\to.Payload = payload\n}", "func (omq *OutcomeMeasureQuery) OnlyX(ctx context.Context) *OutcomeMeasure {\n\tnode, err := omq.Only(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "func (o *GetHealthzInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *V2GetIgnoredValidationsNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetRepositoryInfoNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (tangle *Tangle) Payload(payloadID payload.ID) *payload.CachedPayload {\n\treturn &payload.CachedPayload{CachedObject: tangle.payloadStorage.Load(payloadID.Bytes())}\n}", "func (o *ServiceInstanceLastOperationGetDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetCharactersCharacterIDLoyaltyPointsForbidden) SetPayload(payload *models.GetCharactersCharacterIDLoyaltyPointsForbiddenBody) {\n\to.Payload = payload\n}", "func (p *Payload) String() string {\n\treturn utils.AsString(p.Body)\n}", "func (o *UpdateHostIgnitionNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *RecalculatePaymentRequestUnprocessableEntity) SetPayload(payload *supportmessages.ValidationError) {\n\to.Payload = payload\n}", "func (defintion *IndexDefinition) SetPayloadField(value string) (outDef *IndexDefinition) {\n\toutDef = defintion\n\toutDef.PayloadField = value\n\treturn\n}", "func (o *ShopGetProductDefault) SetPayload(payload *models.RuntimeError) {\n\to.Payload = payload\n}", "func JustOrEmpty(input payload.Payload) Mono {\n\treturn newProxy(mono.JustOrEmpty(input))\n}", "func (o *CreateEvaluationReportInternalServerError) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (o *UpdateMoveTaskOrderPostCounselingInformationInternalServerError) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentForbidden) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (v *Value) IsPayload() bool {\n\tif v.raw == nil {\n\t\treturn false\n\t}\n\t_, ok := v.raw.(*Payload)\n\treturn ok\n}", "func (wq *WorkflowQuery) OnlyX(ctx context.Context) *Workflow {\n\tnode, err := wq.Only(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "func (o *ViewOneOrderDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}" ]
[ "0.5493443", "0.53596836", "0.5260217", "0.520517", "0.4958753", "0.4847305", "0.48398957", "0.48280612", "0.48033786", "0.4774764", "0.47630236", "0.47428694", "0.4729739", "0.47256187", "0.46816078", "0.4679572", "0.4677514", "0.4675227", "0.46629202", "0.46601516", "0.46341893", "0.46266207", "0.46006006", "0.4567904", "0.45582223", "0.45579818", "0.45575893", "0.45533395", "0.45365623", "0.4532998", "0.4522438", "0.45140585", "0.45122468", "0.4496905", "0.44857726", "0.4478268", "0.44777033", "0.44776925", "0.44756997", "0.44688728", "0.44477808", "0.44468206", "0.44406897", "0.44151953", "0.44043475", "0.44027534", "0.43971628", "0.4390908", "0.43830767", "0.43713042", "0.43605387", "0.43601206", "0.43592447", "0.43582603", "0.435237", "0.43498117", "0.43474832", "0.434428", "0.43424517", "0.43371263", "0.43369362", "0.43347636", "0.4332485", "0.43316725", "0.43269408", "0.43251434", "0.43249616", "0.432263", "0.43217602", "0.43101057", "0.43061516", "0.43044853", "0.4298762", "0.42966232", "0.42956376", "0.4293036", "0.4291273", "0.42911962", "0.42888528", "0.4286453", "0.4278283", "0.42773983", "0.42760125", "0.42710978", "0.4269337", "0.42690036", "0.42689523", "0.42684838", "0.42663243", "0.42662582", "0.4265081", "0.42643762", "0.42635688", "0.4259105", "0.4257631", "0.425665", "0.4256227", "0.42555332", "0.4247356", "0.4246784" ]
0.6568773
0
Precision returns the precision of x. That is, it returns the number of digits in the unscaled form of x. x == 0 has a precision of 1. The result is undefined if x is not finite.
func (x *Big) Precision() int { // Cannot call validate since validate calls this method. if !x.IsFinite() { return 0 } if x.precision == 0 { return 1 } return x.precision }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Decimal) Precision() uint32 {\n\treturn (*accounting.Decimal)(d).\n\t\tGetPrecision()\n}", "func (d Decimal) Precision() int32 {\n\treturn -d.Exponent()\n}", "func (c Currency) Precision() int {\n\treturn c.prec\n}", "func (n Number) Precision() int8 {\n\treturn n.precision\n}", "func Precision(ap [][]int) (precision float64) {\n\tprecision = float64(ap[0][0]) / float64(ap[0][0]+ap[0][1])\n\n\treturn precision\n}", "func precision(p int) (int64, float64, int) {\n\tp64 := int64(p)\n\tl := int64(math.Log(float64(p64)))\n\tif p64 != 0 && (l%2) != 0 {\n\t\tp64 = int64(gDPi)\n\t}\n\tif p64 == 0 { // check for division by zero\n\t\tp64 = 1\n\t}\n\treturn p64, float64(p64), decimals(p64)\n}", "func (f *Fs) Precision() time.Duration {\n\treturn f.precision\n}", "func (rcv *Price) Precision() int8 {\n\treturn rcv._tab.GetInt8(rcv._tab.Pos + flatbuffers.UOffsetT(4))\n}", "func FloatPrecision(num float64, precision int) float64 {\n\tp := math.Pow10(precision)\n\tvalue := float64(int(num*p)) / p\n\treturn value\n}", "func FinitePrec(x *big.Rat) int {\n\tif !Finite(x) {\n\t\tpanic(fmt.Errorf(\"rounding.FinitePrec: called with non-finite value: %v\", x))\n\t}\n\t// calling x.Denom() can modify x (populates b) so be extra careful\n\txx := new(big.Rat).Set(x)\n\n\td := xx.Denom()\n\tn := xx.Num()\n\tm := new(big.Int)\n\n\tvar i int\n\tfor m.Mod(n, d).Sign() != 0 {\n\t\ti++\n\t\tn.Mul(n, big10)\n\t}\n\treturn i\n}", "func (x *Float) MinPrec() uint {}", "func (f *Fs) Precision() time.Duration {\n\treturn time.Second\n}", "func (f *Fs) Precision() time.Duration {\n\treturn time.Second\n}", "func (f *Fs) Precision() time.Duration {\n\tvar greatestPrecision time.Duration\n\tfor _, u := range f.upstreams {\n\t\tuPrecision := u.f.Precision()\n\t\tif uPrecision > greatestPrecision {\n\t\t\tgreatestPrecision = uPrecision\n\t\t}\n\t}\n\treturn greatestPrecision\n}", "func FloatPrec(x *big.Float,) uint", "func getPrecision(precision, interval time.Duration) time.Duration {\n\tif precision > 0 {\n\t\treturn precision\n\t}\n\n\tswitch {\n\tcase interval >= time.Second:\n\t\treturn time.Second\n\tcase interval >= time.Millisecond:\n\t\treturn time.Millisecond\n\tcase interval >= time.Microsecond:\n\t\treturn time.Microsecond\n\tdefault:\n\t\treturn time.Nanosecond\n\t}\n}", "func (c DataConversionConfig) GetFloatPrec() int {\n\t// The user-settable parameter ExtraFloatDigits indicates the number\n\t// of digits to be used to format the float value. PostgreSQL\n\t// combines this with %g.\n\t// The formula is <type>_DIG + extra_float_digits,\n\t// where <type> is either FLT (float4) or DBL (float8).\n\n\t// Also the value \"3\" in PostgreSQL is special and meant to mean\n\t// \"all the precision needed to reproduce the float exactly\". The Go\n\t// formatter uses the special value -1 for this and activates a\n\t// separate path in the formatter. We compare >= 3 here\n\t// just in case the value is not gated properly in the implementation\n\t// of SET.\n\tif c.ExtraFloatDigits >= 3 {\n\t\treturn -1\n\t}\n\n\t// CockroachDB only implements float8 at this time and Go does not\n\t// expose DBL_DIG, so we use the standard literal constant for\n\t// 64bit floats.\n\tconst StdDoubleDigits = 15\n\n\tnDigits := StdDoubleDigits + c.ExtraFloatDigits\n\tif nDigits < 1 {\n\t\t// Ensure the value is clamped at 1: printf %g does not allow\n\t\t// values lower than 1. PostgreSQL does this too.\n\t\tnDigits = 1\n\t}\n\treturn int(nDigits)\n}", "func (s *SeqFuncChecker) TestPrec() float64 {\n\tif s.Prec == 0 {\n\t\treturn DefaultPrec\n\t}\n\treturn s.Prec\n}", "func Precision(p int) OptionFunc {\n\treturn func(c *Currency) OptionFunc {\n\t\tprevious := int(c.dp)\n\t\tc.dp, c.dpf, c.prec = precision(p)\n\t\treturn Precision(previous)\n\t}\n}", "func getPrecision(dataJson map[string]interface{}) int64 {\n\treturn _getPricision(dataJson, fieldPrecision)\n}", "func (a *AssetRegistry) Precision(color devnetvm.Color) int {\n\tif asset, assetExists := a.Assets[color]; assetExists {\n\t\treturn int(asset.Precision)\n\t}\n\n\treturn 0\n}", "func calcPrecisionMultiplier(prec int64) *big.Int {\n\tif prec < 0 {\n\t\tpanic(fmt.Sprintf(\"negative precision %v\", prec))\n\t}\n\n\tif prec > LegacyPrecision {\n\t\tpanic(fmt.Sprintf(\"too much precision, maximum %v, provided %v\", LegacyPrecision, prec))\n\t}\n\tzerosToAdd := LegacyPrecision - prec\n\tmultiplier := new(big.Int).Exp(tenInt, big.NewInt(zerosToAdd), nil)\n\treturn multiplier\n}", "func NumDigits(x int) int {\n\n\tcountDigits := 0\n\tfor x != 0 {\n\t\tx = x / 10\n\t\tcountDigits++\n\t}\n\treturn countDigits\n\n}", "func (e *Expr) prec() int {\n\tif e.Kind != ExprBinop {\n\t\treturn 0\n\t}\n\tprec, ok := binopPrec[e.Op]\n\tif !ok {\n\t\tpanic(\"undefined precedence for binop \" + e.Op)\n\t}\n\treturn prec\n}", "func FloatMinPrec(x *big.Float,) uint", "func DropletPrecisionToDivisor(precision uint8) uint64 {\n\tif precision > droplet.Exponent {\n\t\tpanic(\"precision must be <= droplet.Exponent\")\n\t}\n\n\tn := droplet.Exponent - precision\n\tvar i uint64 = 1\n\tfor k := uint8(0); k < n; k++ {\n\t\ti = i * 10\n\t}\n\treturn i\n}", "func (f *Fs) Precision() time.Duration {\n\treturn fs.ModTimeNotSupported\n}", "func (f *Fs) Precision() time.Duration {\n\treturn fs.ModTimeNotSupported\n}", "func precisionMultiplier(prec int64) *big.Int {\n\tif prec < 0 {\n\t\tpanic(fmt.Sprintf(\"negative precision %v\", prec))\n\t}\n\n\tif prec > LegacyPrecision {\n\t\tpanic(fmt.Sprintf(\"too much precision, maximum %v, provided %v\", LegacyPrecision, prec))\n\t}\n\treturn precisionMultipliers[prec]\n}", "func (s *DatatypeGeoShape) Precision(precision string) *DatatypeGeoShape {\n\ts.precision = precision\n\treturn s\n}", "func toFixed(num float64, precision int) float64 {\n\toutput := math.Pow(10, float64(precision))\n\treturn float64(round(num*output)) / output\n}", "func (o IndexesResponseOutput) Precision() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v IndexesResponse) *int { return v.Precision }).(pulumi.IntPtrOutput)\n}", "func (ac *Accumulate) SetPrecision(interval time.Duration) {\n\tswitch {\n\tcase interval >= time.Second:\n\t\tac.precision = time.Second\n\tcase interval >= time.Millisecond:\n\t\tac.precision = time.Millisecond\n\tcase interval >= time.Microsecond:\n\t\tac.precision = time.Microsecond\n\tdefault:\n\t\tac.precision = time.Nanosecond\n\t}\n}", "func (o IndexesOutput) Precision() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v Indexes) *int { return v.Precision }).(pulumi.IntPtrOutput)\n}", "func (x *Float) Prec() uint {}", "func RoundSignificant(x float64, precision int) float64 {\n\tvar negative bool\n\tif x == 0 {\n\t\treturn x\n\t} else if x < 0 {\n\t\tx = -x\n\t\tnegative = true\n\t}\n\n\tvar rounded float64\n\tif pow := int(math.Floor(math.Log10(x))); pow < 0 && precision >= 0 {\n\t\trounded = math.Round(x*math.Pow10(precision-pow)) * math.Pow10(pow-precision)\n\t} else {\n\t\trounded = math.Round(x*math.Pow10(precision)) * math.Pow10(-precision)\n\t}\n\n\tif negative {\n\t\trounded *= -1\n\t}\n\n\treturn rounded\n}", "func ToFixed(num float64, precision int) float64 {\n\toutput := math.Pow(10, float64(precision))\n\treturn float64(round(num*output)) / output\n}", "func ToFixed(num float64, precision int) float64 {\n\toutput := math.Pow(10, float64(precision))\n\treturn float64(round(num*output)) / output\n}", "func (cr *callResult) ColumnTypePrecisionScale(idx int) (int64, int64, bool) {\n\treturn cr.outputFields[idx].TypePrecisionScale()\n}", "func (ac *accumulator) SetPrecision(precision, interval time.Duration) {\n\tif precision > 0 {\n\t\tac.precision = precision\n\t\treturn\n\t}\n\tswitch {\n\tcase interval >= time.Second:\n\t\tac.precision = time.Second\n\tcase interval >= time.Millisecond:\n\t\tac.precision = time.Millisecond\n\tcase interval >= time.Microsecond:\n\t\tac.precision = time.Microsecond\n\tdefault:\n\t\tac.precision = time.Nanosecond\n\t}\n}", "func Pwidth(wp, cw, defval float64) float64 {\n\tif wp == 0 {\n\t\treturn defval\n\t}\n\treturn (wp / 100) * cw\n}", "func (qr *queryResult) ColumnTypePrecisionScale(idx int) (int64, int64, bool) {\n\treturn qr.fields[idx].TypePrecisionScale()\n}", "func (qr *queryResult) ColumnTypePrecisionScale(idx int) (int64, int64, bool) {\n\treturn qr.fields[idx].TypePrecisionScale()\n}", "func (f *FieldSet) TypePrecisionScale(idx int) (int64, int64, bool) {\n\treturn f.fields[idx].typePrecisionScale()\n}", "func SQRT_APPROX(x int32) int32 {\n\tif x <= 0 {\n\t\treturn 0\n\t}\n\n\tlz, frac_Q7 := CLZ_FRAC(x)\n\n\tvar y int32\n\n\tif lz&1 != 0 {\n\t\ty = 32768\n\t} else {\n\t\ty = 46214 /* 46214 = sqrt(2) * 32768 */\n\t}\n\n\t/* get scaling right */\n\ty >>= lz >> 1\n\n\ty = SMLAWB(y, y, SMULBB(213, frac_Q7))\n\n\treturn y\n}", "func (o *SLOOverallStatuses) GetSpanPrecision() int64 {\n\tif o == nil || o.SpanPrecision.Get() == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.SpanPrecision.Get()\n}", "func GetPrecisionType(t BareType) (prect BareType, hasPrecision bool) {\n\tprect, hasPrecision = precisionTypeMap[t]\n\treturn\n}", "func Sqrt_Ten(x float64) float64 {\n\tz := 1.0\n\n\tfor i := 0; i < 10; i += 1 {\n\t\tz -= ((z * z) - x) / (2 * z)\n\t}\n\n\treturn z\n}", "func (d *MyDecimal) PrecisionAndFrac() (precision, frac int) {\n\ttrace_util_0.Count(_mydecimal_00000, 334)\n\tfrac = int(d.digitsFrac)\n\t_, digitsInt := d.removeLeadingZeros()\n\tprecision = digitsInt + frac\n\tif precision == 0 {\n\t\ttrace_util_0.Count(_mydecimal_00000, 336)\n\t\tprecision = 1\n\t}\n\ttrace_util_0.Count(_mydecimal_00000, 335)\n\treturn\n}", "func CountNumDigits(x int) int {\n\tcount := 1\n\tfor x/10 != 0 {\n\t\tcount++\n\t\tx /= 10\n\t}\n\treturn count\n}", "func roundTheTimestamp(timestamp, precision int64) int64 {\n\tfloor := math.Floor(float64(timestamp) / float64(precision))\n\treturn int64(floor) * precision\n}", "func k(x float64) float64 {\n\treturn math.Pow(3, 3*x-1)\n}", "func (ac *Accumulator) SetPrecision(precision, interval time.Duration) {\n}", "func (d *MyDecimal) PrecisionAndFrac() (precision, frac int) {\n\tfrac = int(d.digitsFrac)\n\t_, digitsInt := d.removeLeadingZeros()\n\tprecision = digitsInt + frac\n\tif precision == 0 {\n\t\tprecision = 1\n\t}\n\treturn\n}", "func Sqrt(x int64) int64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\t// p starts at the highest power of four less or equal to x\n\t//Fast way to make p highest power of 4 <= x\n\tvar v, n uint\n\tif x > 1<<32 {\n\t\tv = uint(x >> 32)\n\t\tn = 32\n\t} else {\n\t\tv = uint(x)\n\t}\n\tif v >= 1<<16 {\n\t\tv >>= 16\n\t\tn += 16\n\t}\n\tif v >= 1<<8 {\n\t\tv >>= 8\n\t\tn += 8\n\t}\n\tif v >= 1<<4 {\n\t\tv >>= 4\n\t\tn += 4\n\t}\n\tif v >= 1<<2 {\n\t\tn += 2\n\t}\n\tvar r, b int64\n\tfor p := int64(1 << n); p != 0; p >>= 2 {\n\t\tb = r | p\n\t\tr >>= 1\n\t\tif x >= b {\n\t\t\tx -= b\n\t\t\tr |= p\n\t\t}\n\t}\n\treturn r\n}", "func toFixed(num float64) float64 {\n\tbaseExpOutput := math.Pow10(floatFixedPrecision)\n\n\treturn math.Round(num*baseExpOutput) / baseExpOutput\n}", "func factorial( x int64 ) int64 {\n\n\tif x == 0 {\n\t\treturn 1;\n\t}\n\tif x < 0 {\n\t\treturn -1;\n\t}\n\n\tvar product int64 = 1;\n\tvar i int64;\n\tfor i = 1; i <= x; i++ {\n\t\tproduct *= i;\n\t}\n\n\treturn product;\n}", "func Round(n float64, precision int) float64 {\n\tm := math.Pow10(precision)\n\treturn math.Round(n*m) / m\n}", "func round(num float64, precision int) float64 {\n\toutput := math.Pow(10, float64(precision))\n\tproduct := num * output\n\tsigned := int(product + math.Copysign(0.5, product))\n\t\n\treturn float64(signed) / output\n}", "func (pr *PgRows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool) {\n\tvar fd = pr.columns.Columns[index]\n\tswitch fd.TypeOid {\n\tcase PgTypeNumeric, PgTypeArrNumeric:\n\t\tmod := fd.TypeModifier - headerSize\n\t\tprecision = int64((mod >> 16) & 0xffff)\n\t\tscale = int64(mod & 0xffff)\n\t\treturn precision, scale, true\n\tdefault:\n\t\treturn 0, 0, false\n\t}\n}", "func RoundP(x float64, p int) float64 {\n\tk := math.Pow10(p)\n\treturn math.Floor(x*k+0.5) / k\n}", "func (d *Decimal) SetPrecision(p uint32) {\n\t(*accounting.Decimal)(d).\n\t\tSetPrecision(p)\n}", "func pow(x, n, lim float64) float64 {\n if v := math.Pow(x, n); v < lim {\n return v\n }\n return lim\n}", "func (i *Number) Floor(precision Number) *Number {\n\tif precision.IsBelow(*NewNumber(1)) {\n\t\treturn NewNumber(math.Floor(i.AsFloat64()))\n\t}\n\tbuf := bytes.NewBuffer([]byte{})\n\tbuf.WriteString(\"1\")\n\tfor i := 0; i < precision.AsInt(); i++ {\n\t\tbuf.WriteString(\"0\")\n\t}\n\tfactor := NewNumber(buf.String())\n\tconverted := i.Multiply(*factor)\n\tflooring := NewNumber(math.Floor(converted.AsFloat64()))\n\treturn flooring.Divide(*factor)\n}", "func Round(num, precision float64) float64 {\n\tshift := math.Pow(10, precision)\n\treturn roundInt(num * shift)\n}", "func IsPrecision(token Token) bool { _, present := precisionKeywords[token]; return present }", "func (s serverImpl) getBatchPrecision(ctx types.Context, denom batchDenomT) (uint32, error) {\n\tvar batchInfo ecocredit.BatchInfo\n\terr := s.batchInfoTable.GetOne(ctx, orm.RowID(denom), &batchInfo)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tclassInfo, err := s.getClassInfo(ctx, batchInfo.ClassId)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn classInfo.CreditType.Precision, nil\n}", "func NewAvgPrxPrecision(val int) AvgPrxPrecisionField {\n\treturn AvgPrxPrecisionField{quickfix.FIXInt(val)}\n}", "func Exp(x float64) float64 {\n\tx = 1.0 + x/1024\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\tx *= x\n\n\treturn x\n}", "func GetFactorCount(x int) int {\n\tif x == 1 {\n\t\treturn 1\n\t}\n\tcount := 2\n\tfor i := 2; i <= x/2; i++ {\n\t\tif x%i == 0 {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func pow(x, n, lim float64) float64 {\n\tif v := math.Pow(x, n); v < lim {\n\t\treturn v\n\t}\n\treturn lim\n}", "func pow(x, n, lim float64) float64 {\n\tif v := math.Pow(x, n); v < lim {\n\t\treturn v\n\t}\n\treturn lim\n}", "func pow(x, n, lim float64) float64 {\n\tif v := math.Pow(x, n); v < lim {\n\t\treturn v\n\t}\n\treturn lim\n}", "func probFalsePositive(l, k int, t, precision float64) float64 {\n\treturn integral(falsePositive(l, k), 0, t, precision)\n}", "func (b *BinP1D) XWidth() float64 {\n\treturn b.xrange.Max - b.xrange.Min\n}", "func (c *constWithPrecision) get(precision uint32) *Decimal {\n\ti := 0\n\t// Find the smallest precision available that's at least as high as precision,\n\t// i.e. Ceil[ log2(p) ] = 1 + Floor[ log2(p-1) ]\n\tif precision > 1 {\n\t\tprecision--\n\t\ti++\n\t}\n\tfor precision >= 16 {\n\t\tprecision /= 16\n\t\ti += 4\n\t}\n\tfor precision >= 2 {\n\t\tprecision /= 2\n\t\ti++\n\t}\n\tif i >= len(c.vals) {\n\t\treturn &c.unrounded\n\t}\n\treturn &c.vals[i]\n}", "func RoundFixedDecimal(x float64, precision int) float64 {\n\trounded, _ := d.NewFromFloat(x).Round(int32(precision)).Float64()\n\treturn rounded\n}", "func (c *curve) PointLen() int {\n\treturn (c.P.BitLen() + 7 + 1) / 8\n}", "func decimalBinSize(precision, frac int) int {\n\ttrace_util_0.Count(_mydecimal_00000, 375)\n\tdigitsInt := precision - frac\n\twordsInt := digitsInt / digitsPerWord\n\twordsFrac := frac / digitsPerWord\n\txInt := digitsInt - wordsInt*digitsPerWord\n\txFrac := frac - wordsFrac*digitsPerWord\n\treturn wordsInt*wordSize + dig2bytes[xInt] + wordsFrac*wordSize + dig2bytes[xFrac]\n}", "func Sqrt(x float64) float64 {\n z := 1.0;\n for i := 0; i < 10; i++ {\n fmt.Println(z)\n z -= (z*z - x) / (2*z)\n }\n return z\n}", "func DropletPrecisionCheck(precision uint8, amount uint64) error {\n\tif amount%DropletPrecisionToDivisor(precision) != 0 {\n\t\treturn ErrInvalidDecimals\n\t}\n\treturn nil\n}", "func capNum(n, min, max float64) float64 {\n\tif n > max {\n\t\treturn max\n\t} else if n < min {\n\t\treturn min\n\t}\n\treturn n\n}", "func (x *Big) Scale() int { return -x.exp }", "func Len(x uint) int {\n\tif benchmarks.SizeOfUintInBits == 32 {\n\t\treturn Len32(uint32(x))\n\t}\n\treturn Len64(uint64(x))\n}", "func FloorP(x float64, p int) float64 {\n\tk := math.Pow10(p)\n\treturn math.Floor(x*k) / k\n}", "func (d Decimal) NumDigits() int {\n\t// Note(mwoss): It can be optimized, unnecessary cast of big.Int to string\n\tif d.IsNegative() {\n\t\treturn len(d.value.String()) - 1\n\t}\n\treturn len(d.value.String())\n}", "func _pow(x, n, lim float64) float64 {\n\tif v := math.Pow(x, n); v < lim {\n\t\treturn v\n\t} else {\n\t\tfmt.Printf(\"%g >= %g\\n\", v, lim)\n\t}\n\t// can't use v here, though\n\treturn lim\n}", "func roundFloat(x float64, prec int) float64 {\n\tvar rounder float64\n\tpow := math.Pow(10, float64(prec))\n\tintermed := x * pow\n\t_, frac := math.Modf(intermed)\n\tx = .5\n\tif frac < 0.0 {\n\t\tx = -.5\n\t}\n\tif frac >= x {\n\t\trounder = math.Ceil(intermed)\n\t} else {\n\t\trounder = math.Floor(intermed)\n\t}\n\n\treturn rounder / pow\n}", "func (pq *PrizeQuery) CountX(ctx context.Context) int {\n\tcount, err := pq.Count(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn count\n}", "func round(x float64) float64 {\n\tt := math.Trunc(x)\n\tif math.Abs(x-t) >= 0.5 {\n\t\treturn t + math.Copysign(1, x)\n\t}\n\treturn t\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func decimalPlaces(v string) int {\n\ts := strings.Split(v, \".\")\n\tif len(s) < 2 {\n\t\treturn 0\n\t}\n\treturn len(s[1])\n}", "func Sqrt(x float64) float64 {\n\tvar zN, zN1 float64 = 1.0, 0.0\n\n\tzN1 = zN - ((zN*zN)-x)/(2*zN)\n\n\tfor math.Abs(zN-zN1) > 0.000001 {\n\t\tzN = zN1\n\t\tzN1 = zN - ((zN*zN)-x)/(2*zN)\n\t}\n\treturn zN1\n}", "func Log1p(x float64) float64 {\n\n\treturn math.Log1p(x)\n}", "func gamma(x float64) float64 {\n\treturn math.Exp(logGamma(x))\n}", "func Sqrt(x float64) float64 {\n\tz, d := 1.0, 1.0\n\tfor math.Abs(d) > 1e-15 {\n\t\tzPrevious := z\n\t\tz = z - ((z*z - x) / (2 * z))\n\t\td = zPrevious - z\n\t\tfmt.Printf(\"Current delta: %v, z: %v, zPrevious: %v\\n\", d, z, zPrevious)\n\t}\n\treturn z\n}", "func NewPrecision(precision float64) StoppingCondition {\n\treturn StoppingCondition{IsMet: func(statistic IterationStatistic) bool { return statistic.GetScore() <= precision }}\n}", "func decimals(dec int64) int {\n\tif dec < 1 {\n\t\treturn 0\n\t}\n\treturn int(math.Floor(math.Log10(float64(dec))))\n}", "func XlaReducePrecision(scope *Scope, operand tf.Output, exponent_bits int64, mantissa_bits int64) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"exponent_bits\": exponent_bits, \"mantissa_bits\": mantissa_bits}\n\topspec := tf.OpSpec{\n\t\tType: \"XlaReducePrecision\",\n\t\tInput: []tf.Input{\n\t\t\toperand,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func trunc(num float64) int {\n\treturn int(num)\n}" ]
[ "0.6749858", "0.6596569", "0.6344909", "0.6229551", "0.6203113", "0.6081262", "0.5979742", "0.5857742", "0.58437103", "0.5767434", "0.5748789", "0.5739636", "0.5739636", "0.56803554", "0.5674", "0.55910194", "0.5590393", "0.55573237", "0.54589593", "0.54218894", "0.5418692", "0.541866", "0.54051316", "0.53990185", "0.53159606", "0.52915657", "0.5287803", "0.5287803", "0.5260406", "0.5242978", "0.5202702", "0.5202595", "0.5179969", "0.5166391", "0.51458144", "0.51457745", "0.51269853", "0.51269853", "0.5072092", "0.5064185", "0.50504184", "0.50228274", "0.50228274", "0.5014286", "0.50133526", "0.5010781", "0.49699396", "0.49665898", "0.49609262", "0.49564046", "0.49558553", "0.48982662", "0.48485813", "0.4846665", "0.48354912", "0.4822507", "0.47696665", "0.47654814", "0.4755063", "0.47412628", "0.47367775", "0.47097173", "0.46944505", "0.46496892", "0.463448", "0.46295366", "0.46261105", "0.46180514", "0.4610012", "0.4609491", "0.4609305", "0.4609305", "0.4609305", "0.45873013", "0.45680904", "0.45663816", "0.45651573", "0.4561304", "0.45547992", "0.4553504", "0.4540408", "0.4534849", "0.4520057", "0.45094708", "0.44991556", "0.4490758", "0.44845498", "0.44831192", "0.44781226", "0.4473598", "0.446513", "0.4449841", "0.44496202", "0.44414353", "0.44334528", "0.44278634", "0.4427816", "0.44274542", "0.44244465", "0.44184524" ]
0.73257846
0
Quantize sets z to the number equal in value and sign to z with the scale, n. The rounding of z is performed according to the rounding mode set in z.Context.RoundingMode. In order to perform truncation, set z.Context.RoundingMode to ToZero.
func (z *Big) Quantize(n int) *Big { return z.Context.Quantize(z, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Quantize(buf *audio.PCMBuffer, bitDepth int) {\n\tif buf == nil {\n\t\treturn\n\t}\n\tmax := math.Pow(2, float64(bitDepth)) - 1\n\n\tbuf.SwitchPrimaryType(audio.Float)\n\tbufLen := buf.Len()\n\tfor i := 0; i < bufLen; i++ {\n\t\tbuf.Floats[i] = round((buf.Floats[i]+1)*max)/max - 1.0\n\t}\n}", "func (r *Ri) Quantize(typeof RtToken, one, min, max RtInt, ditheramplitude RtFloat) error {\n\treturn r.writef(\"Quantize\", typeof, one, min, max, ditheramplitude)\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) {\n\tif q.IsZero() {\n\t\treturn zeroBytes, nil\n\t}\n\n\tvar rounded CanonicalValue\n\tformat := q.Format\n\tswitch format {\n\tcase DecimalExponent, DecimalSI:\n\tcase BinarySI:\n\t\tif q.CmpInt64(-1024) > 0 && q.CmpInt64(1024) < 0 {\n\t\t\t// This avoids rounding and hopefully confusion, too.\n\t\t\tformat = DecimalSI\n\t\t} else {\n\t\t\tvar exact bool\n\t\t\tif rounded, exact = q.AsScale(0); !exact {\n\t\t\t\t// Don't lose precision-- show as DecimalSI\n\t\t\t\tformat = DecimalSI\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tformat = DecimalExponent\n\t}\n\n\t// TODO: If BinarySI formatting is requested but would cause rounding, upgrade to\n\t// one of the other formats.\n\tswitch format {\n\tcase DecimalExponent, DecimalSI:\n\t\tnumber, exponent := q.AsCanonicalBytes(out)\n\t\tsuffix, _ := quantitySuffixer.constructBytes(10, exponent, format)\n\t\treturn number, suffix\n\tdefault:\n\t\t// format must be BinarySI\n\t\tnumber, exponent := rounded.AsCanonicalBase1024Bytes(out)\n\t\tsuffix, _ := quantitySuffixer.constructBytes(2, exponent*10, format)\n\t\treturn number, suffix\n\t}\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func (q *Quantity) RoundUp(scale Scale) bool {\n\tif q.d.Dec != nil {\n\t\tq.s = \"\"\n\t\td, exact := q.d.AsScale(scale)\n\t\tq.d = d\n\t\treturn exact\n\t}\n\t// avoid clearing the string value if we have already calculated it\n\tif q.i.scale >= scale {\n\t\treturn true\n\t}\n\tq.s = \"\"\n\ti, exact := q.i.AsScale(scale)\n\tq.i = i\n\treturn exact\n}", "func (x *Big) Scale() int { return -x.exp }", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (q *Quantity) Sign() int {\n\tif q.d.Dec != nil {\n\t\treturn q.d.Dec.Sign()\n\t}\n\treturn q.i.Sign()\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func UniformQuantizedClipByValueQuantizationAxis(value int64) UniformQuantizedClipByValueAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"quantization_axis\"] = value\n\t}\n}", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func (z *Float) Quo(x, y *Float) *Float {}", "func (w *QWriter) QZ(z []byte) {\n\tw.Q(unsafeBytesToStr(z))\n}", "func VPCOMPRESSQ_Z(xyz, k, mxyz operand.Op) { ctx.VPCOMPRESSQ_Z(xyz, k, mxyz) }", "func (z *Decimal) Sqrt(x *Decimal) *Decimal {\n\tif debugDecimal {\n\t\tx.validate()\n\t}\n\n\tif z.prec == 0 {\n\t\tz.prec = x.prec\n\t}\n\n\tif x.Sign() == -1 {\n\t\t// following IEEE754-2008 (section 7.2)\n\t\tpanic(ErrNaN{\"square root of negative operand\"})\n\t}\n\n\t// handle ±0 and +∞\n\tif x.form != finite {\n\t\tz.acc = Exact\n\t\tz.form = x.form\n\t\tz.neg = x.neg // IEEE754-2008 requires √±0 = ±0\n\t\treturn z\n\t}\n\n\t// MantExp sets the argument's precision to the receiver's, and\n\t// when z.prec > x.prec this will lower z.prec. Restore it after\n\t// the MantExp call.\n\tprec := z.prec\n\tb := x.MantExp(z)\n\tz.prec = prec\n\n\t// Compute √(z·10**b) as\n\t// √( z)·10**(½b) if b is even\n\t// √(10z)·10**(⌊½b⌋) if b > 0 is odd\n\t// √(z/10)·10**(⌈½b⌉) if b < 0 is odd\n\tswitch b % 2 {\n\tcase 0:\n\t\t// nothing to do\n\tcase 1:\n\t\tz.exp++\n\tcase -1:\n\t\tz.exp--\n\t}\n\t// 0.01 <= z < 10.0\n\n\t// Unlike with big.Float, solving x² - z = 0 directly is faster only for\n\t// very small precisions (<_DW/2).\n\t//\n\t// Solve 1/x² - z = 0 instead.\n\tz.sqrtInverse(z)\n\n\t// restore precision and re-attach halved exponent\n\treturn z.SetMantExp(z, b/2)\n}", "func (q *Quantity) Set(value int64) {\n\tq.SetScaled(value, 0)\n}", "func (c *Context) VPCOMPRESSQ_Z(xyz, k, mxyz operand.Op) {\n\tc.addinstruction(x86.VPCOMPRESSQ_Z(xyz, k, mxyz))\n}", "func ratScale(x *big.Rat, exp int) {\n\tif exp < 0 {\n\t\tx.Inv(x)\n\t\tratScale(x, -exp)\n\t\tx.Inv(x)\n\t\treturn\n\t}\n\tfor exp >= 9 {\n\t\tx.Quo(x, bigRatBillion)\n\t\texp -= 9\n\t}\n\tfor exp >= 1 {\n\t\tx.Quo(x, bigRatTen)\n\t\texp--\n\t}\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func (q Quantizer) Quantize(events midi.AbsEvents, ppq uint16) midi.AbsEvents {\n\tcc := events.Copy()\n\n\t// distance between \"grid lines\"\n\tstepSize := int(q.GridRes.StepSize(ppq))\n\thalfStep := int(stepSize / 2)\n\n\t// enforce a valid value for the quantization level\n\tif q.QuantizationLevel < 0 {\n\t\tq.QuantizationLevel = 0\n\t} else if q.QuantizationLevel > 1.0 {\n\t\tq.QuantizationLevel = 1.0\n\t}\n\t// if the quantization level is set to zero, we don't need to quantize and\n\t// can return the copy right away\n\tif q.QuantizationLevel == 0 {\n\t\treturn cc\n\t}\n\n\tvar snapPoint int\n\tvar delta int\n\tvar fullStepPos int\n\n\tif q.Start {\n\t\tfor i, ev := range cc {\n\t\t\t// snap start point\n\t\t\tif remainder := ev.Start % stepSize; remainder != 0 {\n\t\t\t\t// decide if the note should be moved sooner or later depending\n\t\t\t\t// on how close it is from the nearby steps\n\t\t\t\tfullStepPos = (ev.Start / stepSize * stepSize)\n\t\t\t\tif remainder >= halfStep {\n\t\t\t\t\tif q.QuantizationLevel == 1.0 {\n\t\t\t\t\t\tcc[i].Start = fullStepPos + stepSize\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// @ 100%\n\t\t\t\t\t\tsnapPoint = fullStepPos + stepSize\n\t\t\t\t\t\t// apply the quantization level to the distance to snap\n\t\t\t\t\t\tdelta = int(float64(snapPoint-cc[i].Start) * q.QuantizationLevel)\n\t\t\t\t\t\tcc[i].Start = cc[i].Start + delta\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif q.QuantizationLevel == 1.0 {\n\t\t\t\t\t\tcc[i].Start = fullStepPos\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdelta = int(float64(cc[i].Start-fullStepPos) * q.QuantizationLevel)\n\t\t\t\t\t\tcc[i].Start = cc[i].Start - delta\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif q.End {\n\t\tfor i, ev := range cc {\n\t\t\t// TODO: apply the quantization level\n\t\t\t// snap end point by adjusting the duration\n\t\t\tif remainder := ev.Duration % int(stepSize); remainder != 0 {\n\t\t\t\tif remainder >= halfStep {\n\t\t\t\t\tcc[i].Duration = (ev.Duration / stepSize * stepSize) + stepSize\n\t\t\t\t} else {\n\t\t\t\t\tcc[i].Duration = (ev.Duration / stepSize) * stepSize\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// sort the events, first ones first\n\tsort.Slice(cc, func(i, j int) bool {\n\t\tif cc[i].Start < cc[j].Start {\n\t\t\treturn true\n\t\t}\n\t\tif cc[i].Start > cc[j].Start {\n\t\t\treturn false\n\t\t}\n\t\t// if both items start at the same time, use the duration to sort\n\t\tif cc[i].Duration < cc[j].Duration {\n\t\t\treturn true\n\t\t}\n\t\tif cc[i].Duration > cc[j].Duration {\n\t\t\treturn false\n\t\t}\n\t\t// if both items start at the same time, have the same duration, we sort by note\n\t\tif cc[i].MIDINote < cc[j].MIDINote {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\n\treturn cc\n}", "func (c *core) Q() *big.Int {\n\treturn c.Curve.Params().N\n}", "func (c *Context) VPMAXSQ_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXSQ_Z(mxyz, xyz, k, xyz1))\n}", "func (z *Big) QuoInt(x, y *Big) *Big { return z.Context.QuoInt(z, x, y) }", "func (x Dec) Quo(y Dec) (Dec, error) {\n\tvar z Dec\n\t_, err := dec128Context.Quo(&z.dec, &x.dec, &y.dec)\n\treturn z, errorsmod.Wrap(err, \"decimal quotient error\")\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (f Fixed) Round(n int) Fixed {\n\tif f.IsNaN() {\n\t\treturn NaN\n\t}\n\n\tfraction := f.fp % scale\n\tf0 := fraction / int64(math.Pow10(nPlaces-n-1))\n\tdigit := abs(f0 % 10)\n\tf0 = (f0 / 10)\n\tif digit >= 5 {\n\t\tf0 += 1 * sign(f.fp)\n\t}\n\tf0 = f0 * int64(math.Pow10(nPlaces-n))\n\n\tintpart := f.fp - fraction\n\tfp := intpart + f0\n\n\treturn Fixed{fp: fp}\n}", "func (c *Context) VPSUBQ_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPSUBQ_Z(mxyz, xyz, k, xyz1))\n}", "func UniformQuantize(scope *Scope, input tf.Output, scales tf.Output, zero_points tf.Output, Tout tf.DataType, quantization_min_val int64, quantization_max_val int64, optional ...UniformQuantizeAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"Tout\": Tout, \"quantization_min_val\": quantization_min_val, \"quantization_max_val\": quantization_max_val}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"UniformQuantize\",\n\t\tInput: []tf.Input{\n\t\t\tinput, scales, zero_points,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (cq *cQT) Compact(sz int) {\n\tif sz < 0 || uint32(sz) > cq.maxSz || uint32(sz)&(uint32(sz-1)) != 0 {\n\t\tpanic(\"Compact Q with invalid size\")\n\t}\n\tnSz := roundUp2(cq.e - cq.s)\n\tif nSz < uint32(sz) {\n\t\tnSz = uint32(sz)\n\t}\n\tif nSz == cq.sz {\n\t\treturn\n\t}\n\tcq.resize(nSz)\n}", "func (b Datasize) Zettabits() float64 {\n\treturn float64(b / Zettabit)\n}", "func ROUNDSS(i, mx, x operand.Op) { ctx.ROUNDSS(i, mx, x) }", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func Sqrt(x float64) float64 {\n z := 1.0;\n for i := 0; i < 10; i++ {\n fmt.Println(z)\n z -= (z*z - x) / (2*z)\n }\n return z\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func (z *Big) Quo(x, y *Big) *Big { return z.Context.Quo(z, x, y) }", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func VPABSQ_Z(mxyz, k, xyz operand.Op) { ctx.VPABSQ_Z(mxyz, k, xyz) }", "func (d LegacyDec) QuoRoundupMut(d2 LegacyDec) LegacyDec {\n\t// multiply precision twice\n\td.i.Mul(d.i, squaredPrecisionReuse)\n\td.i.Quo(d.i, d2.i)\n\n\tchopPrecisionAndRoundUp(d.i)\n\tif d.i.BitLen() > maxDecBitLen {\n\t\tpanic(\"Int overflow\")\n\t}\n\treturn d\n}", "func (b Datasize) Zettabytes() float64 {\n\treturn float64(b / Zettabyte)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func VRNDSCALEPS_SAE_Z(i, z, k, z1 operand.Op) { ctx.VRNDSCALEPS_SAE_Z(i, z, k, z1) }", "func (c *Context) VALIGNQ_Z(i, mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VALIGNQ_Z(i, mxyz, xyz, k, xyz1))\n}", "func VPMAXSQ_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXSQ_Z(mxyz, xyz, k, xyz1) }", "func (w *QWriter) Z(z []byte) {\n\tw.Write(z)\n}", "func (z *Int) Quo(x, y *Int) *Int {}", "func VPSUBQ_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPSUBQ_Z(mxyz, xyz, k, xyz1) }", "func (z *Rat) Quo(x, y *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func smallExp(z, x *inf.Dec, s inf.Scale) *inf.Dec {\n\t// Allocate if needed and make sure args aren't mutated.\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t\tz.SetUnscaled(1).SetScale(0)\n\t}\n\tn := new(inf.Dec)\n\ttmp := new(inf.Dec).Set(z)\n\tfor loop := newLoop(\"exp\", z, s, 1); !loop.done(z); {\n\t\tn.Add(n, decimalOne)\n\t\ttmp.Mul(tmp, x)\n\t\ttmp.QuoRound(tmp, n, s+2, inf.RoundHalfUp)\n\t\tz.Add(z, tmp)\n\t}\n\t// Round to the desired scale.\n\treturn z.Round(z, s, inf.RoundHalfUp)\n}", "func (q Quantity) DeepCopy() Quantity {\n\tif q.d.Dec != nil {\n\t\ttmp := &inf.Dec{}\n\t\tq.d.Dec = tmp.Set(q.d.Dec)\n\t}\n\treturn q\n}", "func (c *Context) VPABSQ_Z(mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VPABSQ_Z(mxyz, k, xyz))\n}", "func (p *FloatPrice) Quo(q FloatPrice) *FloatPrice {\n\treturn p.SetFloat64(p.Float64() / q.Float64())\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func (q *Quantity) Value() int64 {\n\treturn q.ScaledValue(0)\n}", "func Pow(z, x, y *inf.Dec, s inf.Scale) (*inf.Dec, error) {\n\ts = s + 2\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t\tz.SetUnscaled(1).SetScale(0)\n\t}\n\n\t// Check if y is of type int.\n\ttmp := new(inf.Dec).Abs(y)\n\tisInt := tmp.Cmp(new(inf.Dec).Round(tmp, 0, inf.RoundDown)) == 0\n\n\txs := x.Sign()\n\tif xs == 0 {\n\t\tswitch y.Sign() {\n\t\tcase 0:\n\t\t\treturn z.SetUnscaled(1).SetScale(0), nil\n\t\tcase 1:\n\t\t\treturn z.SetUnscaled(0).SetScale(0), nil\n\t\tdefault: // -1\n\t\t\t// undefined for y < 0\n\t\t\treturn nil, errPowZeroNegative\n\t\t}\n\t}\n\n\tneg := xs < 0\n\n\tif !isInt && neg {\n\t\treturn nil, errPowNegNonInteger\n\t}\n\n\t// Exponent Precision Explanation (RaduBerinde):\n\t// Say we compute the Log with a scale of k. That means that the result we get is:\n\t// ln x +/- 10^-k.\n\t// This leads to an error of y * 10^-k in the exponent, which leads to a\n\t// multiplicative error of e^(y*10^-k) in the result.\n\t// For small values of u, e^u can be approximated by 1 + u, so for large k\n\t// that error is around 1 + y*10^-k. So the additive error will be x^y * y * 10^-k,\n\t// and we want this to be less than 10^-s. This approximately means that k has to be\n\t// s + the number of digits before the decimal point in x^y. Which roughly is\n\t//\n\t// s + <the number of digits before decimal point in x> * y.\n\t//\n\t// exponent precision = s + <the number of digits before decimal point in x> * y.\n\tnumDigits := float64(x.UnscaledBig().BitLen()) / digitsToBitsRatio\n\tnumDigits -= float64(x.Scale())\n\n\t// Round up y which should provide us with a threshold in calculating the new scale.\n\tyu := float64(new(inf.Dec).Round(y, 0, inf.RoundUp).UnscaledBig().Int64())\n\n\t// exponent precision = s + <the number of digits before decimal point in x> * y\n\tes := s + inf.Scale(numDigits*yu)\n\tif es < 0 || es > maxPrecision {\n\t\treturn nil, errArgumentTooLarge\n\t}\n\n\ttmp = new(inf.Dec).Abs(x)\n\t_, err := Log(tmp, tmp, es)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttmp.Mul(tmp, y)\n\tExp(tmp, tmp, es)\n\n\tif neg && y.Round(y, 0, inf.RoundDown).UnscaledBig().Bit(0) == 1 {\n\t\ttmp.Neg(tmp)\n\t}\n\n\t// Round to the desired scale.\n\treturn z.Round(tmp, s-2, inf.RoundHalfUp), nil\n}", "func (s Size) Round() Size {\n\tfor _, unit := range allUnits {\n\t\tif s >= unit {\n\t\t\treturn Size(math.Round(float64(s)/float64(unit))) * unit\n\t\t}\n\t}\n\treturn s\n}", "func (b Datasize) Zebibits() float64 {\n\treturn float64(b / Zebibit)\n}", "func (x *Big) Rat(z *big.Rat) *big.Rat {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Rat)\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn z.SetInt64(0)\n\t}\n\n\t// Fast path for decimals <= math.MaxInt64.\n\tif x.IsInt() {\n\t\tif u, ok := x.Int64(); ok {\n\t\t\t// If profiled we can call scalex ourselves and save the overhead of\n\t\t\t// calling Int64. But I doubt it'll matter much.\n\t\t\treturn z.SetInt64(u)\n\t\t}\n\t}\n\n\tnum := new(big.Int)\n\tif x.isCompact() {\n\t\tnum.SetUint64(x.compact)\n\t} else {\n\t\tnum.Set(&x.unscaled)\n\t}\n\tif x.exp > 0 {\n\t\tarith.MulBigPow10(num, num, uint64(x.exp))\n\t}\n\tif x.Signbit() {\n\t\tnum.Neg(num)\n\t}\n\n\tdenom := c.OneInt\n\tif x.exp < 0 {\n\t\tdenom = new(big.Int)\n\t\tif shift, ok := arith.Pow10(uint64(-x.exp)); ok {\n\t\t\tdenom.SetUint64(shift)\n\t\t} else {\n\t\t\tdenom.Set(arith.BigPow10(uint64(-x.exp)))\n\t\t}\n\t}\n\treturn z.SetFrac(num, denom)\n}", "func (c *Context) VRNDSCALEPS_SAE_Z(i, z, k, z1 operand.Op) {\n\tc.addinstruction(x86.VRNDSCALEPS_SAE_Z(i, z, k, z1))\n}", "func FloatRat(x *big.Float, z *big.Rat,) (*big.Rat, big.Accuracy,)", "func (d Decimal) Round(places int32) Decimal {\n\tif d.exp == -places {\n\t\treturn d\n\t}\n\t// truncate to places + 1\n\tret := d.rescale(-places - 1)\n\n\t// add sign(d) * 0.5\n\tif ret.value.Sign() < 0 {\n\t\tret.value.Sub(ret.value, fiveInt)\n\t} else {\n\t\tret.value.Add(ret.value, fiveInt)\n\t}\n\n\t// floor for positive numbers, ceil for negative numbers\n\t_, m := ret.value.DivMod(ret.value, tenInt, new(big.Int))\n\tret.exp++\n\tif ret.value.Sign() < 0 && m.Cmp(zeroInt) != 0 {\n\t\tret.value.Add(ret.value, oneInt)\n\t}\n\n\treturn ret\n}", "func (b Datasize) Quettabytes() float64 {\n\treturn float64(b / Quettabyte)\n}", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func VRNDSCALESS_Z(i, mx, x, k, x1 operand.Op) { ctx.VRNDSCALESS_Z(i, mx, x, k, x1) }", "func VPADDQ_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPADDQ_Z(mxyz, xyz, k, xyz1) }", "func ROUNDSD(i, mx, x operand.Op) { ctx.ROUNDSD(i, mx, x) }", "func NewByzQ(n int) (*ByzQ, error) {\n\tf := (n - 1) / 4\n\tif f < 1 {\n\t\treturn nil, fmt.Errorf(\"Byzantine masking quorums require n>4f replicas; only got n=%d, yielding f=%d\", n, f)\n\t}\n\treturn &ByzQ{n, f, (n + 2*f) / 2}, nil\n}", "func (c *Context) VFMSUB132SS_Z(mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VFMSUB132SS_Z(mx, x, k, x1))\n}", "func (b Datasize) Quettabits() float64 {\n\treturn float64(b / Quettabit)\n}", "func (d Decimal) RoundUp(places int32) Decimal {\n\tif d.exp >= -places {\n\t\treturn d\n\t}\n\n\trescaled := d.rescale(-places)\n\tif d.Equal(rescaled) {\n\t\treturn d\n\t}\n\n\tif d.value.Sign() > 0 {\n\t\trescaled.value.Add(rescaled.value, oneInt)\n\t} else if d.value.Sign() < 0 {\n\t\trescaled.value.Sub(rescaled.value, oneInt)\n\t}\n\n\treturn rescaled\n}", "func UniformQuantizedDotOutputQuantizationAxis(value int64) UniformQuantizedDotAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"output_quantization_axis\"] = value\n\t}\n}", "func VRNDSCALEPS_Z(i, mxyz, k, xyz operand.Op) { ctx.VRNDSCALEPS_Z(i, mxyz, k, xyz) }", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func UniformQuantizeQuantizationAxis(value int64) UniformQuantizeAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"quantization_axis\"] = value\n\t}\n}", "func (size Size) Format(precision int, scale SizeScale) string {\n\tvar (\n\t\tpower = 0\n\t\tvalue = float64(size)\n\t)\n\n\tfor value >= float64(scale.Divizor) && power+1 < len(scale.Suffixes) {\n\t\tpower += 1\n\t\tvalue /= float64(scale.Divizor)\n\t}\n\n\treturn strconv.FormatFloat(value, 'f', precision, 64) +\n\t\tscale.Suffixes[power]\n}", "func QuantizeV2RoundMode(value string) QuantizeV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"round_mode\"] = value\n\t}\n}", "func Sqrt_Ten(x float64) float64 {\n\tz := 1.0\n\n\tfor i := 0; i < 10; i += 1 {\n\t\tz -= ((z * z) - x) / (2 * z)\n\t}\n\n\treturn z\n}", "func VPSRAVQ_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPSRAVQ_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VRNDSCALESS_Z(i, mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VRNDSCALESS_Z(i, mx, x, k, x1))\n}", "func (c *Context) VCVTPS2QQ_RN_SAE_Z(y, k, z operand.Op) {\n\tc.addinstruction(x86.VCVTPS2QQ_RN_SAE_Z(y, k, z))\n}", "func (c *Context) VPMOVUSQB_Z(xyz, k, mx operand.Op) {\n\tc.addinstruction(x86.VPMOVUSQB_Z(xyz, k, mx))\n}", "func (c *Context) VPOPCNTQ_Z(mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VPOPCNTQ_Z(mxyz, k, xyz))\n}", "func (v Volume) Zepolitres() float64 {\n\treturn float64(v / Zepolitre)\n}", "func Sqrt(x float64) float64 {\n\tvar zN, zN1 float64 = 1.0, 0.0\n\n\tzN1 = zN - ((zN*zN)-x)/(2*zN)\n\n\tfor math.Abs(zN-zN1) > 0.000001 {\n\t\tzN = zN1\n\t\tzN1 = zN - ((zN*zN)-x)/(2*zN)\n\t}\n\treturn zN1\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func ROUNDPS(i, mx, x operand.Op) { ctx.ROUNDPS(i, mx, x) }", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func (c *Context) VPADDQ_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPADDQ_Z(mxyz, xyz, k, xyz1))\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func VALIGNQ_Z(i, mxyz, xyz, k, xyz1 operand.Op) { ctx.VALIGNQ_Z(i, mxyz, xyz, k, xyz1) }", "func (q *Quantity) AsCanonicalBytes(out []byte) (result []byte, exponent int32) {\n\tif q.d.Dec != nil {\n\t\treturn q.d.AsCanonicalBytes(out)\n\t}\n\treturn q.i.AsCanonicalBytes(out)\n}", "func (c *Context) VCVTPS2UQQ_RN_SAE_Z(y, k, z operand.Op) {\n\tc.addinstruction(x86.VCVTPS2UQQ_RN_SAE_Z(y, k, z))\n}", "func (x Vector64) Round(n int) Vector64 {\n\tfor i := 0; i < len(x); i++ {\n\t\tx[i] = Round64(x[i], n)\n\t}\n\treturn x\n}", "func CLZ(x int64) (n int)", "func (d Decimal) rescale(exp int32) Decimal {\n\td.ensureInitialized()\n\t// NOTE(vadim): must convert exps to float64 before - to prevent overflow\n\tdiff := math.Abs(float64(exp) - float64(d.exp))\n\tvalue := new(big.Int).Set(d.value)\n\n\texpScale := new(big.Int).Exp(tenInt, big.NewInt(int64(diff)), nil)\n\tif exp > d.exp {\n\t\tvalue = value.Quo(value, expScale)\n\t} else if exp < d.exp {\n\t\tvalue = value.Mul(value, expScale)\n\t}\n\n\treturn Decimal{\n\t\tvalue: value,\n\t\texp: exp,\n\t}\n}" ]
[ "0.5608611", "0.5563615", "0.5199561", "0.5160299", "0.5131443", "0.5085433", "0.5079202", "0.50659317", "0.4939197", "0.4927903", "0.49073538", "0.48771855", "0.47888413", "0.47833872", "0.4747182", "0.4740615", "0.4731992", "0.47307068", "0.47210962", "0.47156143", "0.47052714", "0.4705221", "0.4685394", "0.46801755", "0.46746358", "0.46741903", "0.46461126", "0.46376815", "0.46317944", "0.46221998", "0.45930845", "0.4588872", "0.45834604", "0.4577835", "0.45508766", "0.45473567", "0.4544205", "0.45439833", "0.45289007", "0.45137063", "0.44900215", "0.44830978", "0.44808823", "0.44708514", "0.44669974", "0.44645077", "0.4463766", "0.44544876", "0.44499952", "0.44492045", "0.4444061", "0.44418404", "0.44327348", "0.44246128", "0.44219568", "0.44139135", "0.4411436", "0.44107127", "0.44099614", "0.44052437", "0.44029316", "0.44023335", "0.44020653", "0.4400023", "0.4394163", "0.43863583", "0.43860918", "0.43856192", "0.43839014", "0.43720293", "0.4366886", "0.43573818", "0.43490088", "0.4342027", "0.43389186", "0.43316802", "0.43305033", "0.4313917", "0.43102023", "0.4308886", "0.4306114", "0.43038657", "0.42948925", "0.42948666", "0.42911988", "0.42911488", "0.42905188", "0.42899382", "0.42754343", "0.42723307", "0.42716077", "0.42691296", "0.42665002", "0.4263456", "0.42558652", "0.42462903", "0.42419076", "0.42416945", "0.4240342", "0.4240231" ]
0.69798386
0
Quo sets z to x / y and returns z.
func (z *Big) Quo(x, y *Big) *Big { return z.Context.Quo(z, x, y) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Quo(x, y *Float) *Float {}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (z *Int) Quo(x, y *Int) *Int {}", "func (v *Vec3i) SetDiv(other Vec3i) {\n\tv.X /= other.X\n\tv.Y /= other.Y\n\tv.Z /= other.Z\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func (z *Float64) Divide(y *Float64, a float64) *Float64 {\n\tz.l = y.l / a\n\tz.r = y.r / a\n\treturn z\n}", "func (z *Float) Set(x *Float) *Float {}", "func (c *Chunk) Set(x, y, z uint8) {\n\tc.Solid[x][y] |= 1 << z\n}", "func (z *Float64) Quo(x, y *Float64) *Float64 {\n\tif y.IsZeroDivisor() {\n\t\tpanic(zeroDivisorDenominator)\n\t}\n\tq := y.Quad()\n\ta := (x.l * y.l) - (y.r * x.r)\n\tb := (x.r * y.l) - (y.r * x.l)\n\tz.SetPair(a, b)\n\treturn z.Divide(z, q)\n}", "func (z *Rat) Quo(x, y *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (c Cube) Set(x, y, z int, val []float64) {\n\tc.Data[x][y][z] = val\n}", "func (q Quat) Div(other Quat) Quat {\n\treturn Quat{q.W / other.W, q.X / other.X, q.Y / other.Y, q.Z / other.Z}\n}", "func (c *Coord) Z() float64 { return c[2] }", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func Quo(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Float32:\n\t\txx := float32(x.Float())\n\t\tyy := float32(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Float64:\n\t\txx := float64(x.Float())\n\t\tyy := float64(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Complex64:\n\t\txx := complex64(x.Complex())\n\t\tyy := complex64(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\tcase reflect.Complex128:\n\t\txx := complex128(x.Complex())\n\t\tyy := complex128(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator / not defined on %v\", x.Type()))\n}", "func (z *Int) Div(x, y *Int) *Int {}", "func (v Vec3i) Div(other Vec3i) Vec3i {\n\treturn Vec3i{v.X / other.X, v.Y / other.Y, v.Z / other.Z}\n}", "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func (z *Int) QuoRem(x, y, r *Int) (*Int, *Int) {}", "func RatSet(z *big.Rat, x *big.Rat,) *big.Rat", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (v Vec3) ByZ() Vec2 {\n\tf := 1.0 / v[2]\n\treturn Vec2{f * v[0], f * v[1]}\n}", "func (v *Vec3i) Set(x, y, z int32) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (c *Chunk) Unset(x, y, z uint8) {\n\tc.Solid[x][y] &^= 1 << z\n}", "func (z *Perplex) Quo(x, y *Perplex) *Perplex {\n\tif y.IsZeroDiv() {\n\t\tpanic(\"zero divisor denominator\")\n\t}\n\tquad := y.Quad()\n\tz.Conj(y)\n\tz.Mul(x, z)\n\tz.l.Quo(&z.l, quad)\n\tz.r.Quo(&z.r, quad)\n\treturn z\n}", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VDIVPD_Z(mxyz, xyz, k, xyz1) }", "func IntQuo(z *big.Int, x, y *big.Int,) *big.Int", "func quoRem(x, y int) (quo, rem int) {\n\tquo = x / y\n\trem = x - quo*y\n\treturn\n}", "func Quat2Set(out []float64, x1, y1, z1, w1, x2, y2, z2, w2 float64) []float64 {\n\tout[0] = x1\n\tout[1] = y1\n\tout[2] = z1\n\tout[3] = w1\n\n\tout[4] = x2\n\tout[5] = y2\n\tout[6] = z2\n\tout[7] = w2\n\treturn out\n}", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func (z *Rat) Set(x *Rat) *Rat {}", "func (z *BiComplex) Quo(x, y *BiComplex) *BiComplex {\n\tif y.IsZeroDivisor() {\n\t\tpanic(\"denominator is zero divisor\")\n\t}\n\treturn z.Mul(z.Inv(y), x)\n}", "func (h heightmap) set(x, z, val uint8) {\n\th[(uint16(x)<<4)|uint16(z)] = val\n}", "func VPXORD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPXORD_Z(mxyz, xyz, k, xyz1) }", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func (z *Big) QuoRem(x, y, r *Big) (*Big, *Big) {\n\treturn z.Context.QuoRem(z, x, y, r)\n}", "func (c *Context) VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VDIVPD_Z(mxyz, xyz, k, xyz1))\n}", "func (z *Big) QuoInt(x, y *Big) *Big { return z.Context.QuoInt(z, x, y) }", "func (z *Int) Div(x, y *Int) *Int {\n\tif y.IsZero() || y.Gt(x) {\n\t\treturn z.Clear()\n\t}\n\tif x.Eq(y) {\n\t\treturn z.SetOne()\n\t}\n\t// Shortcut some cases\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() / y.Uint64())\n\t}\n\n\t// At this point, we know\n\t// x/y ; x > y > 0\n\t// See Knuth, Volume 2, section 4.3.1, Algorithm D.\n\n\t// Normalize by shifting divisor left just enough so that its high-order\n\t// bit is on and u left the same amount.\n\t// function nlz do the caculating of the amount and shl do the left operation.\n\ts := nlz(y)\n\txn := shl(x, s, true)\n\tyn := shl(y, s, false)\n\n\t// divKnuth do the division of normalized dividend and divisor with Knuth Algorithm D.\n\tq := divKnuth(xn, yn)\n\n\tz.Clear()\n\tfor i := 0; i < len(q); i++ {\n\t\tz[i/2] = z[i/2] | uint64(q[i])<<(32*(uint64(i)%2))\n\t}\n\n\treturn z\n}", "func (x Dec) Quo(y Dec) (Dec, error) {\n\tvar z Dec\n\t_, err := dec128Context.Quo(&z.dec, &x.dec, &y.dec)\n\treturn z, errorsmod.Wrap(err, \"decimal quotient error\")\n}", "func (a *Vector3) Set(b Vector3) {\n\ta.X = b.X\n\ta.Y = b.Y\n\ta.Z = b.Z\n}", "func (a Vec4) Slash(s float32) Vec4 {\n\treturn Vec4{a.X / s, a.Y / s, a.Z / s, a.W / s}\n}", "func VPORD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPORD_Z(mxyz, xyz, k, xyz1) }", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (v *Vector) Set(x, y, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func VPRORD_Z(i, mxyz, k, xyz operand.Op) { ctx.VPRORD_Z(i, mxyz, k, xyz) }", "func (z *Float) SetRat(x *Rat) *Float {}", "func (t *Edge) Set(xP, yP, xQ, yQ int, zP, zQ float32) {\n\t// Note: the larger Y value is at the \"bottom\" or lower on the display\n\t// if +Y axis is downward.\n\tif yP > yQ {\n\t\tt.yBot = yP\n\t} else {\n\t\tt.yBot = yQ\n\t}\n\n\tt.xP = xP\n\tt.yP = yP\n\tt.xQ = xQ\n\tt.yQ = yQ\n\tt.zP = zP\n\tt.zQ = zQ\n\n\tt.x = xP\n\tt.y = yP\n\tt.d = 0\n\n\tt.yInc = 1\n\tt.xInc = 1\n\tt.dx = xQ - xP\n\tt.dy = yQ - yP\n\n\tif t.dx < 0 {\n\t\tt.xInc = -1\n\t\tt.dx = -t.dx\n\t}\n\tif t.dy < 0 {\n\t\tt.yInc = -1\n\t\tt.dy = -t.dy\n\t}\n\n\tif t.dy <= t.dx {\n\t\tt.m = t.dy << 1\n\t\tt.c = t.dx << 1\n\n\t\tif t.xInc < 0 {\n\t\t\tt.dx++\n\t\t}\n\t} else {\n\t\tt.c = t.dy << 1\n\t\tt.m = t.dx << 1\n\n\t\tif t.yInc < 0 {\n\t\t\tt.dy++\n\t\t}\n\t}\n}", "func VDIVPD_RU_SAE_Z(z, z1, k, z2 operand.Op) { ctx.VDIVPD_RU_SAE_Z(z, z1, k, z2) }", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func (geom Geometry) Z(index int) float64 {\n\tz := C.OGR_G_GetZ(geom.cval, C.int(index))\n\treturn float64(z)\n}", "func (z nat) divW(x nat, y Word) (q nat, r Word) {\n\tm := len(x)\n\tswitch {\n\tcase y == 0:\n\t\tpanic(\"division by zero\")\n\tcase y == 1:\n\t\tq = z.set(x) // result is x\n\t\treturn\n\tcase m == 0:\n\t\tq = z.make(0) // result is 0\n\t\treturn\n\t}\n\t// m > 0\n\tz = z.make(m)\n\tr = divWVW(z, 0, x, y)\n\tq = z.norm()\n\treturn\n}", "func mathCosh(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar x phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &x)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn phpv.ZFloat(math.Cosh(float64(x))).ZVal(), nil\n}", "func Div(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Div\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func (q Quat) Normalize() Quat {\n\tlength := q.Length()\n\tif length == 1 { // shortcut\n\t\treturn q\n\t}\n\treturn Quat{q.W / length, q.X / length, q.Y / length, q.Z / length}\n}", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func VPRORQ_Z(i, mxyz, k, xyz operand.Op) { ctx.VPRORQ_Z(i, mxyz, k, xyz) }", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func (a *Vector3) Normalise() {\n\tl := a.Length()\n\t*a = Vector3{a.X / l, a.Y / l, a.Z / l}\n}", "func VPERMD_Z(myz, yz, k, yz1 operand.Op) { ctx.VPERMD_Z(myz, yz, k, yz1) }", "func (p Point3) Div(ps ...Point3) Point3 {\n\tfor _, p2 := range ps {\n\t\tp[0] /= p2[0]\n\t\tp[1] /= p2[1]\n\t\tp[2] /= p2[2]\n\t}\n\treturn p\n}", "func (p asciiTable) Z(c, r int) float64 {\n\treturn p.grid[r][c]\n}", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func (p Point3) Z() float64 {\n\treturn p.Dim(2)\n}", "func (v Quat) Normalize() Quat {\n\tl := v.Length()\n\tif l != 0 {\n\t\tv.W /= l\n\t\tv.X /= l\n\t\tv.Y /= l\n\t\tv.Z /= l\n\t}\n\treturn v\n}", "func (c *Context) VPXORD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPXORD_Z(mxyz, xyz, k, xyz1))\n}", "func (c Cube) Get(x, y, z int) []float64 {\n\treturn c.Data[x][y][z]\n}", "func (m *MockedCache) Z(score float64, member interface{}) redis.Z {\n\treturn redis.Z{}\n}", "func (p Point) Z() float64 {\n\treturn p[2]\n}", "func (z *Int) Xor(x, y *Int) *Int {}", "func VDIVPS_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VDIVPS_Z(mxyz, xyz, k, xyz1) }", "func (mu *MuHash) normalize() {\n\tmu.numerator.Divide(&mu.denominator)\n\tmu.denominator.SetToOne()\n}", "func VPMOVUSQD_Z(xyz, k, mxy operand.Op) { ctx.VPMOVUSQD_Z(xyz, k, mxy) }", "func (q Quat) DivScalar(s float32) Quat {\n\treturn Quat{q.W / s, q.X / s, q.Y / s, q.Z / s}\n}", "func VDIVPD_RZ_SAE_Z(z, z1, k, z2 operand.Op) { ctx.VDIVPD_RZ_SAE_Z(z, z1, k, z2) }", "func (c *Context) VPRORD_Z(i, mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VPRORD_Z(i, mxyz, k, xyz))\n}", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func (z *Int) Set(x *Int) *Int {}", "func (p *G1Jac) Set(a *G1Jac) *G1Jac {\n\tp.X, p.Y, p.Z = a.X, a.Y, a.Z\n\treturn p\n}", "func (p *CubicPolynomial) Set(y0, y1, D0, D1 float64) {\n\tp.a = y0\n\tp.b = D0\n\tp.c = 3*(y1-y0) - 2*D0 - D1\n\tp.d = 2*(y0-y1) + D0 + D1\n\t// Zero out any coefficients that are small relative to the others.\n\tsum := math.Abs(p.a) + math.Abs(p.b) + math.Abs(p.c) + math.Abs(p.d)\n\tp.a = ZeroSmall(p.a, sum, epsilon)\n\tp.b = ZeroSmall(p.b, sum, epsilon)\n\tp.c = ZeroSmall(p.c, sum, epsilon)\n\tp.d = ZeroSmall(p.d, sum, epsilon)\n}", "func (c *Context) VPORD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPORD_Z(mxyz, xyz, k, xyz1))\n}", "func (c *Context) VDIVPD_RU_SAE_Z(z, z1, k, z2 operand.Op) {\n\tc.addinstruction(x86.VDIVPD_RU_SAE_Z(z, z1, k, z2))\n}", "func VORPD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VORPD_Z(mxyz, xyz, k, xyz1) }", "func (a *Vec4) Divide(s float32) {\n\ta.X /= s\n\ta.Y /= s\n\ta.Z /= s\n\ta.W /= s\n}", "func Quat2SetDual(out, q []float64) []float64 {\n\tout[4] = q[0]\n\tout[5] = q[1]\n\tout[6] = q[2]\n\tout[7] = q[3]\n\treturn out\n}", "func mathACosh(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar f phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn phpv.ZFloat(math.Acosh(float64(f))).ZVal(), nil\n}", "func (m *M) Set(r, c int, v Frac) {\n\tr, c = r-1, c-1\n\tm.values[r*m.c+c] = v.Reduce()\n}", "func (spriteBatch *SpriteBatch) Setq(index int, quad *Quad, args ...float32) error {\n\treturn spriteBatch.addv(quad.getVertices(), generateModelMatFromArgs(args), index)\n}", "func FloorDiv(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"FloorDiv\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (t *Tuple) Div(scalar float64) *Tuple {\n\treturn &Tuple{\n\t\tt.x / scalar,\n\t\tt.y / scalar,\n\t\tt.z / scalar,\n\t\tt.w / scalar,\n\t}\n\n}", "func Mul(z, x, y *Elt)", "func FloatSqrt(z *big.Float, x *big.Float,) *big.Float", "func IntSet(z *big.Int, x *big.Int,) *big.Int" ]
[ "0.60730547", "0.6042108", "0.6023971", "0.5781043", "0.57618046", "0.5667484", "0.5625965", "0.56017685", "0.5543323", "0.5496648", "0.54894996", "0.547731", "0.5476026", "0.54493856", "0.54149026", "0.53925943", "0.5391164", "0.5375086", "0.536225", "0.5358733", "0.5342822", "0.5331149", "0.5296476", "0.5284019", "0.5258583", "0.52446556", "0.51413155", "0.51372653", "0.5128948", "0.51135737", "0.51127404", "0.507271", "0.50677794", "0.5062222", "0.5034785", "0.49146187", "0.4905525", "0.4887697", "0.48765084", "0.4857484", "0.48550025", "0.48543426", "0.48476607", "0.4838324", "0.48337588", "0.4832855", "0.48317418", "0.48281562", "0.48117942", "0.47993812", "0.47962648", "0.47882178", "0.47810096", "0.4776137", "0.4771298", "0.47638762", "0.47628316", "0.4742719", "0.47425073", "0.47139892", "0.47032738", "0.46873358", "0.46854565", "0.4682262", "0.46794438", "0.46755636", "0.46724835", "0.4652325", "0.46438456", "0.46419248", "0.46338707", "0.46318117", "0.46317846", "0.46255484", "0.4606285", "0.460505", "0.45885321", "0.45820823", "0.45776594", "0.45772538", "0.456733", "0.45637926", "0.45627898", "0.4550593", "0.45502603", "0.45466533", "0.4522373", "0.45145574", "0.45129645", "0.45017576", "0.4499524", "0.44972074", "0.44972032", "0.44970858", "0.44948018", "0.448779", "0.44817096", "0.44811466", "0.44779333", "0.44753537" ]
0.5662493
6
QuoInt sets z to x / y with the remainder truncated. See QuoRem for more details.
func (z *Big) QuoInt(x, y *Big) *Big { return z.Context.QuoInt(z, x, y) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func (z *Int) QuoRem(x, y, r *Int) (*Int, *Int) {}", "func IntQuo(z *big.Int, x, y *big.Int,) *big.Int", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func (z *Int) Quo(x, y *Int) *Int {}", "func IntRem(z *big.Int, x, y *big.Int,) *big.Int", "func quoRem(x, y int) (quo, rem int) {\n\tquo = x / y\n\trem = x - quo*y\n\treturn\n}", "func (z *Big) QuoRem(x, y, r *Big) (*Big, *Big) {\n\treturn z.Context.QuoRem(z, x, y, r)\n}", "func (z *Int) Div(x, y *Int) *Int {}", "func QuotRem(a, b int) (quot, rem int, err error) { // HL\n\tif b != 0 {\n\t\tquot, rem = a/b, a%b // HL\n\n\t} else {\n\t\terr = errors.New(\"cannot divide by 0\") // HL\n\t}\n\treturn\n}", "func QuoRem(x, y, r *big.Int) (*big.Int, *big.Int) {\n\treturn new(big.Int).QuoRem(x, y, r)\n}", "func (z *Int) Div(x, y *Int) *Int {\n\tif y.IsZero() || y.Gt(x) {\n\t\treturn z.Clear()\n\t}\n\tif x.Eq(y) {\n\t\treturn z.SetOne()\n\t}\n\t// Shortcut some cases\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() / y.Uint64())\n\t}\n\n\t// At this point, we know\n\t// x/y ; x > y > 0\n\t// See Knuth, Volume 2, section 4.3.1, Algorithm D.\n\n\t// Normalize by shifting divisor left just enough so that its high-order\n\t// bit is on and u left the same amount.\n\t// function nlz do the caculating of the amount and shl do the left operation.\n\ts := nlz(y)\n\txn := shl(x, s, true)\n\tyn := shl(y, s, false)\n\n\t// divKnuth do the division of normalized dividend and divisor with Knuth Algorithm D.\n\tq := divKnuth(xn, yn)\n\n\tz.Clear()\n\tfor i := 0; i < len(q); i++ {\n\t\tz[i/2] = z[i/2] | uint64(q[i])<<(32*(uint64(i)%2))\n\t}\n\n\treturn z\n}", "func IntDivMod(z *big.Int, x, y, m *big.Int,) (*big.Int, *big.Int,)", "func remQuo(x, y, q, r *big.Int) *big.Int {\n\tq.QuoRem(x, y, r)\n\treturn r\n}", "func QuoInt(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Quo(x, y)\n}", "func Quo(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Float32:\n\t\txx := float32(x.Float())\n\t\tyy := float32(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Float64:\n\t\txx := float64(x.Float())\n\t\tyy := float64(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Complex64:\n\t\txx := complex64(x.Complex())\n\t\tyy := complex64(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\tcase reflect.Complex128:\n\t\txx := complex128(x.Complex())\n\t\tyy := complex128(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator / not defined on %v\", x.Type()))\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func (x Dec) Quo(y Dec) (Dec, error) {\n\tvar z Dec\n\t_, err := dec128Context.Quo(&z.dec, &x.dec, &y.dec)\n\treturn z, errorsmod.Wrap(err, \"decimal quotient error\")\n}", "func (z *Float) Quo(x, y *Float) *Float {}", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func Quo(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Quo(x, y)\n}", "func IntMod(z *big.Int, x, y *big.Int,) *big.Int", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func (z *Rat) Quo(x, y *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func (z *Big) Quo(x, y *Big) *Big { return z.Context.Quo(z, x, y) }", "func IntSet(z *big.Int, x *big.Int,) *big.Int", "func IntModSqrt(z *big.Int, x, p *big.Int,) *big.Int", "func (z *Float64) Quo(x, y *Float64) *Float64 {\n\tif y.IsZeroDivisor() {\n\t\tpanic(zeroDivisorDenominator)\n\t}\n\tq := y.Quad()\n\ta := (x.l * y.l) - (y.r * x.r)\n\tb := (x.r * y.l) - (y.r * x.l)\n\tz.SetPair(a, b)\n\treturn z.Divide(z, q)\n}", "func cdiv(a, b int) int { return (a + b - 1) / b }", "func Div(hi, lo, y uint) (quo, rem uint) {\n\tif UintSize == 32 {\n\t\tq, r := Div32(uint32(hi), uint32(lo), uint32(y))\n\t\treturn uint(q), uint(r)\n\t}\n\tq, r := Div64(uint64(hi), uint64(lo), uint64(y))\n\treturn uint(q), uint(r)\n}", "func (v *Vec3i) SetDiv(other Vec3i) {\n\tv.X /= other.X\n\tv.Y /= other.Y\n\tv.Z /= other.Z\n}", "func (d LegacyDec) QuoInt64(i int64) LegacyDec {\n\treturn d.ImmutOpInt64(LegacyDec.QuoInt64Mut, i)\n}", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (q Quat) Div(other Quat) Quat {\n\treturn Quat{q.W / other.W, q.X / other.X, q.Y / other.Y, q.Z / other.Z}\n}", "func IntSqrt(z *big.Int, x *big.Int,) *big.Int", "func IntDiv(arg, arg2 int64) (quotient int64) {\n\tquotient = arg / arg2\n\treturn\n}", "func (z *Int) DivMod(x, y, m *Int) (*Int, *Int) {}", "func IntGCD(z *big.Int, x, y, a, b *big.Int,) *big.Int", "func main() {\n\tfmt.Println(safeDiv(3,0))\n\tfmt.Println(safeDiv(3,2))\n}", "func (z *Int) SetUint64(x uint64) *Int {}", "func (z *Float) SetInt(x *Int) *Float {}", "func IntRsh(z *big.Int, x *big.Int, n uint) *big.Int", "func (v Vec3i) Div(other Vec3i) Vec3i {\n\treturn Vec3i{v.X / other.X, v.Y / other.Y, v.Z / other.Z}\n}", "func (z *BiComplex) Quo(x, y *BiComplex) *BiComplex {\n\tif y.IsZeroDivisor() {\n\t\tpanic(\"denominator is zero divisor\")\n\t}\n\treturn z.Mul(z.Inv(y), x)\n}", "func Quotient(numerator, denominator float64) (int, error) {\n\tif denominator == 0 {\n\t\treturn 0.0, errors.New(\"#DIV/0!\t- Occurred because the supplied denominator argument is zero\")\n\t}\n\n\tif math.IsNaN(numerator) || math.IsNaN(denominator) {\n\t\treturn 0.0, errors.New(\"#VALUE!\t- Occurred because the supplied arguments are non-numeric \")\n\t}\n\n\treturn int(numerator / denominator), nil\n}", "func IntSetString(z *big.Int, s string, base int) (*big.Int, bool)", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func Div(dividend, divisor *big.Int) *big.Int { return I().Div(dividend, divisor) }", "func IntMul(z *big.Int, x, y *big.Int,) *big.Int", "func CLZ_FRAC(in int32, lz *int32, frac_Q7 *int32) {\n\tlzeros := CLZ32(in)\n\t*lz = lzeros\n\t*frac_Q7 = ROR32(in, 24-int(lzeros)) & 0x7f\n}", "func opUI64Div(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) / ReadUI64(fp, expr.Inputs[1])\n\tWriteUI64(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func DIVQ(mr operand.Op) { ctx.DIVQ(mr) }", "func div(x, y int) (answer int, err error) {\n\tif y == 0 {\n\t\terr = fmt.Errorf(\"Cannot Divid by zero\")\n\t} else {\n\t\tanswer = x / y\n\t}\n\treturn\n}", "func IntSub(z *big.Int, x, y *big.Int,) *big.Int", "func quo(a, b big.Int) big.Int {\n\treturn *big.NewInt(1).Quo(&a, &b)\n}", "func CLZ(x int64) (n int)", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func IntSetBytes(z *big.Int, buf []byte) *big.Int", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func (z *Int) SetInt64(x int64) *Int {}", "func Div(a, b *big.Float) *big.Float {\n\treturn ZeroBigFloat().Quo(a, b)\n}", "func Div32(hi, lo, y uint32) (quo, rem uint32) {\n\tif y != 0 && y <= hi {\n\t\tpanic(getOverflowError())\n\t}\n\tz := uint64(hi)<<32 | uint64(lo)\n\tquo, rem = uint32(z/uint64(y)), uint32(z%uint64(y))\n\treturn\n}", "func (z *Float) SetInt64(x int64) *Float {}", "func (z *Float64) Divide(y *Float64, a float64) *Float64 {\n\tz.l = y.l / a\n\tz.r = y.r / a\n\treturn z\n}", "func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal) {\n\td.ensureInitialized()\n\td2.ensureInitialized()\n\tif d2.value.Sign() == 0 {\n\t\tpanic(\"decimal division by 0\")\n\t}\n\tscale := -precision\n\te := int64(d.exp - d2.exp - scale)\n\tif e > math.MaxInt32 || e < math.MinInt32 {\n\t\tpanic(\"overflow in decimal QuoRem\")\n\t}\n\tvar aa, bb, expo big.Int\n\tvar scalerest int32\n\t// d = a 10^ea\n\t// d2 = b 10^eb\n\tif e < 0 {\n\t\taa = *d.value\n\t\texpo.SetInt64(-e)\n\t\tbb.Exp(tenInt, &expo, nil)\n\t\tbb.Mul(d2.value, &bb)\n\t\tscalerest = d.exp\n\t\t// now aa = a\n\t\t// bb = b 10^(scale + eb - ea)\n\t} else {\n\t\texpo.SetInt64(e)\n\t\taa.Exp(tenInt, &expo, nil)\n\t\taa.Mul(d.value, &aa)\n\t\tbb = *d2.value\n\t\tscalerest = scale + d2.exp\n\t\t// now aa = a ^ (ea - eb - scale)\n\t\t// bb = b\n\t}\n\tvar q, r big.Int\n\tq.QuoRem(&aa, &bb, &r)\n\tdq := Decimal{value: &q, exp: scale}\n\tdr := Decimal{value: &r, exp: scalerest}\n\treturn dq, dr\n}", "func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal) {\n\td.ensureInitialized()\n\td2.ensureInitialized()\n\tif d2.value.Sign() == 0 {\n\t\tpanic(\"decimal division by 0\")\n\t}\n\tscale := -precision\n\te := int64(d.exp - d2.exp - scale)\n\tif e > math.MaxInt32 || e < math.MinInt32 {\n\t\tpanic(\"overflow in decimal QuoRem\")\n\t}\n\tvar aa, bb, expo big.Int\n\tvar scalerest int32\n\t// d = a 10^ea\n\t// d2 = b 10^eb\n\tif e < 0 {\n\t\taa = *d.value\n\t\texpo.SetInt64(-e)\n\t\tbb.Exp(tenInt, &expo, nil)\n\t\tbb.Mul(d2.value, &bb)\n\t\tscalerest = d.exp\n\t\t// now aa = a\n\t\t// bb = b 10^(scale + eb - ea)\n\t} else {\n\t\texpo.SetInt64(e)\n\t\taa.Exp(tenInt, &expo, nil)\n\t\taa.Mul(d.value, &aa)\n\t\tbb = *d2.value\n\t\tscalerest = scale + d2.exp\n\t\t// now aa = a ^ (ea - eb - scale)\n\t\t// bb = b\n\t}\n\tvar q, r big.Int\n\tq.QuoRem(&aa, &bb, &r)\n\tdq := Decimal{value: &q, exp: scale}\n\tdr := Decimal{value: &r, exp: scalerest}\n\treturn dq, dr\n}", "func (z *Numeric) SetUint(x uint) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tz.sign = numericPositive\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := int16(x % numericBase)\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}", "func div(a, b int32) int32 {\n\tif a >= 0 {\n\t\treturn (a + (b >> 1)) / b\n\t}\n\treturn -((-a + (b >> 1)) / b)\n}", "func TestCheckBinaryExprIntQuoInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `4 / 4`, env, NewConstInt64(4 / 4), ConstInt)\n}", "func Div(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Div(x, y)\n}", "func IntAbs(z *big.Int, x *big.Int,) *big.Int", "func SetUint64(z *big.Int, x uint64) *big.Int {\n\treturn z.SetUint64(x)\n}", "func (l *BigInt) Div(r Number) Number {\n\tif ri, ok := r.(*BigInt); ok {\n\t\tlb := (*big.Int)(l)\n\t\trb := (*big.Int)(ri)\n\t\tif rb.IsInt64() && rb.Int64() == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\tres := new(big.Int).Quo(lb, rb)\n\t\treturn maybeInteger(res)\n\t}\n\tlp, rp := purify(l, r)\n\treturn lp.Div(rp)\n}", "func FloatInt(x *big.Float, z *big.Int,) (*big.Int, big.Accuracy,)", "func (z *Int) GCD(x, y, a, b *Int) *Int {}", "func (z *Perplex) Quo(x, y *Perplex) *Perplex {\n\tif y.IsZeroDiv() {\n\t\tpanic(\"zero divisor denominator\")\n\t}\n\tquad := y.Quad()\n\tz.Conj(y)\n\tz.Mul(x, z)\n\tz.l.Quo(&z.l, quad)\n\tz.r.Quo(&z.r, quad)\n\treturn z\n}", "func (q Quat) DivScalar(s float32) Quat {\n\treturn Quat{q.W / s, q.X / s, q.Y / s, q.Z / s}\n}", "func VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VDIVPD_Z(mxyz, xyz, k, xyz1) }", "func (pwm *pwmGroup) setClockDiv(Int, frac uint8) {\n\tpwm.DIV.ReplaceBits((uint32(frac)<<rp.PWM_CH0_DIV_FRAC_Pos)|\n\t\tu32max(uint32(Int), 1)<<rp.PWM_CH0_DIV_INT_Pos, rp.PWM_CH0_DIV_FRAC_Msk|rp.PWM_CH0_DIV_INT_Msk, 0)\n}", "func integerValue(tls *libc.TLS, zArg uintptr) int32 { /* speedtest1.c:210:12: */\n\tvar v sqlite3_int64 = int64(0)\n\tvar i int32\n\tvar isNeg int32 = 0\n\tif int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '-' {\n\t\tisNeg = 1\n\t\tzArg++\n\t} else if int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '+' {\n\t\tzArg++\n\t}\n\tif (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '0') && (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(1)))) == 'x') {\n\t\tvar x int32\n\t\tzArg += uintptr(2)\n\t\tfor (libc.AssignInt32(&x, hexDigitValue(tls, *(*int8)(unsafe.Pointer(zArg + uintptr(0)))))) >= 0 {\n\t\t\tv = ((v << 4) + sqlite3_int64(x))\n\t\t\tzArg++\n\t\t}\n\t} else {\n\t\tfor libc.Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0))))) != 0 {\n\t\t\tv = (((v * int64(10)) + sqlite3_int64(*(*int8)(unsafe.Pointer(zArg + uintptr(0))))) - int64('0'))\n\t\t\tzArg++\n\t\t}\n\t}\n\tfor i = 0; uint32(i) < (uint32(unsafe.Sizeof(aMult)) / uint32(unsafe.Sizeof(struct {\n\t\tzSuffix uintptr\n\t\tiMult int32\n\t}{}))); i++ {\n\t\tif sqlite3.Xsqlite3_stricmp(tls, aMult[i].zSuffix, zArg) == 0 {\n\t\t\tv = v * (sqlite3_int64(aMult[i].iMult))\n\t\t\tbreak\n\t\t}\n\t}\n\tif v > int64(0x7fffffff) {\n\t\tfatal_error(tls, ts+2153 /* \"parameter too la...\" */, 0)\n\t}\n\treturn func() int32 {\n\t\tif isNeg != 0 {\n\t\t\treturn int32(-v)\n\t\t}\n\t\treturn int32(v)\n\t}()\n}", "func (z *Rat) SetInt(x *Int) *Rat {}", "func (d LegacyDec) QuoRoundupMut(d2 LegacyDec) LegacyDec {\n\t// multiply precision twice\n\td.i.Mul(d.i, squaredPrecisionReuse)\n\td.i.Quo(d.i, d2.i)\n\n\tchopPrecisionAndRoundUp(d.i)\n\tif d.i.BitLen() > maxDecBitLen {\n\t\tpanic(\"Int overflow\")\n\t}\n\treturn d\n}", "func (z *Int) Set(x *Int) *Int {}", "func opUI8Div(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_ui8() / inputs[1].Get_ui8()\n\toutputs[0].Set_ui8(outV0)\n}", "func (c *Context) VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VDIVPD_Z(mxyz, xyz, k, xyz1))\n}", "func (x *Elt) SetInt(y *big.Int) {\n\t// Reduce if outside range.\n\tif y.Sign() < 0 || y.Cmp(modulus) >= 0 {\n\t\ty = new(big.Int).Mod(y, modulus)\n\t}\n\t// Copy bytes into field element.\n\tb := y.Bytes()\n\ti := 0\n\tfor ; i < len(b); i++ {\n\t\tx[i] = b[len(b)-1-i]\n\t}\n\tfor ; i < Size; i++ {\n\t\tx[i] = 0\n\t}\n}", "func (z *Int) Mul(x, y *Int) *Int {}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func Div(x, y int) int {\n\treturn x / y\n}", "func TestCheckBinaryExprComplexQuoInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `8.0i / 4`, env, NewConstComplex128(8.0i / 4), ConstComplex)\n}", "func (z nat) divW(x nat, y Word) (q nat, r Word) {\n\tm := len(x)\n\tswitch {\n\tcase y == 0:\n\t\tpanic(\"division by zero\")\n\tcase y == 1:\n\t\tq = z.set(x) // result is x\n\t\treturn\n\tcase m == 0:\n\t\tq = z.make(0) // result is 0\n\t\treturn\n\t}\n\t// m > 0\n\tz = z.make(m)\n\tr = divWVW(z, 0, x, y)\n\tq = z.norm()\n\treturn\n}", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func integerPower(z, x *inf.Dec, y int64, s inf.Scale) *inf.Dec {\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t}\n\n\tneg := y < 0\n\tif neg {\n\t\ty = -y\n\t}\n\n\tz.Set(decimalOne)\n\tfor y > 0 {\n\t\tif y%2 == 1 {\n\t\t\tz = z.Mul(z, x)\n\t\t}\n\t\ty >>= 1\n\t\tx.Mul(x, x)\n\n\t\t// integerPower is only ever called with `e` (decimalE), which is a constant\n\t\t// with very high precision. When it is squared above, the number of digits\n\t\t// needed to express it goes up quickly. If we are a large power of a small\n\t\t// number (like 0.5 ^ 5000), this loop becomes very slow because of the very\n\t\t// high number of digits it must compute. To prevent that, round x.\n\t\tx.Round(x, s*2, inf.RoundHalfUp)\n\t}\n\n\tif neg {\n\t\tz = z.QuoRound(decimalOne, z, s+2, inf.RoundHalfUp)\n\t}\n\treturn z.Round(z, s, inf.RoundHalfUp)\n}", "func (this *BigInteger) DivRemTo(m *BigInteger, q *BigInteger, r *BigInteger) {\n\tvar pm *BigInteger = m.Abs()\n\tif pm.T <= 0 {\n\t\treturn\n\t}\n\tvar pt *BigInteger = this.Abs()\n\tif pt.T < pm.T {\n\t\tif q != nil {\n\t\t\tq.FromInt(0)\n\t\t}\n\t\tif r != nil {\n\t\t\tthis.CopyTo(r)\n\t\t}\n\t\treturn\n\t}\n\tif r == nil {\n\t\tr = NewBigInteger()\n\t}\n\tvar y *BigInteger = NewBigInteger()\n\tvar ts int64 = this.S\n\tvar ms int64 = m.S\n\tvar nsh int64 = DB - Nbits(pm.V[pm.T-1])\n\tif nsh > 0 {\n\t\tpm.LShiftTo(nsh, y)\n\t\tpt.LShiftTo(nsh, r)\n\t} else {\n\t\tpm.CopyTo(y)\n\t\tpt.CopyTo(r)\n\t}\n\tvar ys int64 = y.T\n\tvar y0 int64 = y.V[ys-1]\n\tif y0 == 0 {\n\t\treturn\n\t}\n\tvar yt int64 = y0 * (1 << uint(F1))\n\tif ys > 1 {\n\t\tyt += y.V[ys-2] >> uint(F2)\n\t}\n\tvar d1 float64 = float64(FV) / float64(yt)\n\tvar d2 float64 = float64(1<<uint(F1)) / float64(yt)\n\tvar e int64 = 1 << uint(F2)\n\tvar i int64 = r.T\n\tvar j int64 = i - ys\n\tvar t *BigInteger = q\n\tif q == nil {\n\t\tt = NewBigInteger()\n\t}\n\ty.DLShiftTo(j, t)\n\tif r.CompareTo(t) >= 0 {\n\t\tr.V[r.T] = 1\n\t\tr.T++\n\t\tr.SubTo(t, r)\n\t}\n\tONE.DLShiftTo(ys, t)\n\tt.SubTo(y, y)\n\tfor j--; j >= 0; j-- {\n\t\tvar qd int64 = DM\n\t\ti--\n\t\tif r.V[i] != y0 {\n\t\t\tqd = int64(math.Floor(float64(r.V[i])*d1 + float64(r.V[i-1]+e)*d2))\n\t\t}\n\t\tr.V[i] += y.AM(0, qd, r, j, 0, ys)\n\t\tif (r.V[i]) > qd {\n\t\t\ty.DLShiftTo(j, t)\n\t\t\tr.SubTo(t, r)\n\t\t\tfor qd--; r.V[i] < qd; qd-- {\n\t\t\t\tr.SubTo(t, r)\n\t\t\t}\n\t\t}\n\t}\n\tif q != nil {\n\t\tr.DRShiftTo(ys, q)\n\t\tif ts != ms {\n\t\t\tZERO.SubTo(q, q)\n\t\t}\n\t}\n\tr.T = ys\n\tr.clamp()\n\tif nsh > 0 {\n\t\tr.RShiftTo(nsh, r)\n\t}\n\tif ts < 0 {\n\t\tZERO.SubTo(r, r)\n\t}\n}", "func SafeDiv(x float64, y float64) float64 {\n\tif IsZero(y) {\n\t\treturn 0\n\t}\n\n\treturn x / y\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Rat) SetUint64(x uint64) *Rat {}", "func Div64(hi, lo, y uint64) (quo, rem uint64) {\n\tconst (\n\t\ttwo32 = 1 << 32\n\t\tmask32 = two32 - 1\n\t)\n\tif y == 0 {\n\t\tpanic(getDivideError())\n\t}\n\tif y <= hi {\n\t\tpanic(getOverflowError())\n\t}\n\n\ts := uint(LeadingZeros64(y))\n\ty <<= s\n\n\tyn1 := y >> 32\n\tyn0 := y & mask32\n\tun32 := hi<<s | lo>>(64-s)\n\tun10 := lo << s\n\tun1 := un10 >> 32\n\tun0 := un10 & mask32\n\tq1 := un32 / yn1\n\trhat := un32 - q1*yn1\n\n\tfor q1 >= two32 || q1*yn0 > two32*rhat+un1 {\n\t\tq1--\n\t\trhat += yn1\n\t\tif rhat >= two32 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tun21 := un32*two32 + un1 - q1*y\n\tq0 := un21 / yn1\n\trhat = un21 - q0*yn1\n\n\tfor q0 >= two32 || q0*yn0 > two32*rhat+un0 {\n\t\tq0--\n\t\trhat += yn1\n\t\tif rhat >= two32 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn q1*two32 + q0, (un21*two32 + un0 - q0*y) >> s\n}", "func IntOr(z *big.Int, x, y *big.Int,) *big.Int" ]
[ "0.7472765", "0.72936076", "0.6718596", "0.66632986", "0.65173167", "0.6256829", "0.6183861", "0.60929185", "0.6073056", "0.606108", "0.59851223", "0.5890535", "0.5870699", "0.5868811", "0.58686084", "0.58576894", "0.5795034", "0.57838506", "0.5761324", "0.5613709", "0.55214626", "0.5496105", "0.5435649", "0.5418505", "0.53949547", "0.5367675", "0.5362551", "0.53278106", "0.53194577", "0.52985585", "0.5291082", "0.5272308", "0.5268442", "0.52678317", "0.52116185", "0.5190074", "0.5093619", "0.5092805", "0.50892764", "0.50865316", "0.5074198", "0.5015167", "0.49996275", "0.49958277", "0.49928755", "0.49892437", "0.49823558", "0.49654853", "0.49605832", "0.49559346", "0.49541134", "0.49310452", "0.49303234", "0.49050513", "0.48858693", "0.48852083", "0.48753393", "0.4844007", "0.48348415", "0.4820374", "0.4809198", "0.4790492", "0.47903207", "0.47799227", "0.47775668", "0.47753784", "0.47753784", "0.4772903", "0.47665524", "0.47506726", "0.47420955", "0.4741187", "0.47357777", "0.4735754", "0.47216427", "0.47167024", "0.47151923", "0.47061244", "0.47057036", "0.46938115", "0.46916103", "0.46888247", "0.46828473", "0.46822643", "0.46801862", "0.46779993", "0.46582907", "0.46519604", "0.46482983", "0.4643663", "0.46368274", "0.46254027", "0.4617165", "0.460318", "0.45970336", "0.4577278", "0.4575372", "0.45749274", "0.45718843", "0.45684648" ]
0.6926797
2
QuoRem sets z to the quotient x / y and r to the remainder x % y, such that x = z y + r, and returns the pair (z, r).
func (z *Big) QuoRem(x, y, r *Big) (*Big, *Big) { return z.Context.QuoRem(z, x, y, r) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Int) QuoRem(x, y, r *Int) (*Int, *Int) {}", "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func quoRem(x, y int) (quo, rem int) {\n\tquo = x / y\n\trem = x - quo*y\n\treturn\n}", "func QuoRem(x, y, r *big.Int) (*big.Int, *big.Int) {\n\treturn new(big.Int).QuoRem(x, y, r)\n}", "func QuotRem(a, b int) (quot, rem int, err error) { // HL\n\tif b != 0 {\n\t\tquot, rem = a/b, a%b // HL\n\n\t} else {\n\t\terr = errors.New(\"cannot divide by 0\") // HL\n\t}\n\treturn\n}", "func IntRem(z *big.Int, x, y *big.Int,) *big.Int", "func remQuo(x, y, q, r *big.Int) *big.Int {\n\tq.QuoRem(x, y, r)\n\treturn r\n}", "func (z *Int) DivMod(x, y, m *Int) (*Int, *Int) {}", "func IntDivMod(z *big.Int, x, y, m *big.Int,) (*big.Int, *big.Int,)", "func divmod(x, m uint64) (quo, rem uint64) {\n\tquo = x / m\n\trem = x % m\n\treturn\n}", "func Div(hi, lo, y uint) (quo, rem uint) {\n\tif UintSize == 32 {\n\t\tq, r := Div32(uint32(hi), uint32(lo), uint32(y))\n\t\treturn uint(q), uint(r)\n\t}\n\tq, r := Div64(uint64(hi), uint64(lo), uint64(y))\n\treturn uint(q), uint(r)\n}", "func Rem(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator % not defined on %v\", x.Type()))\n}", "func (e *ConstantExpr) URem(other *ConstantExpr) *ConstantExpr {\n\tassert(e.Width == other.Width, \"urem: width mismatch: %d != %d\", e.Width, other.Width)\n\tswitch e.Width {\n\tcase Width8:\n\t\treturn NewConstantExpr(uint64(uint8(e.Value)%uint8(other.Value)), e.Width)\n\tcase Width16:\n\t\treturn NewConstantExpr(uint64(uint16(e.Value)%uint16(other.Value)), e.Width)\n\tcase Width32:\n\t\treturn NewConstantExpr(uint64(uint32(e.Value)%uint32(other.Value)), e.Width)\n\tcase Width64:\n\t\treturn NewConstantExpr(uint64(uint64(e.Value)%uint64(other.Value)), e.Width)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"urem: non-standard width: %d\", e.Width))\n\t}\n}", "func (this *BigInteger) DivRemTo(m *BigInteger, q *BigInteger, r *BigInteger) {\n\tvar pm *BigInteger = m.Abs()\n\tif pm.T <= 0 {\n\t\treturn\n\t}\n\tvar pt *BigInteger = this.Abs()\n\tif pt.T < pm.T {\n\t\tif q != nil {\n\t\t\tq.FromInt(0)\n\t\t}\n\t\tif r != nil {\n\t\t\tthis.CopyTo(r)\n\t\t}\n\t\treturn\n\t}\n\tif r == nil {\n\t\tr = NewBigInteger()\n\t}\n\tvar y *BigInteger = NewBigInteger()\n\tvar ts int64 = this.S\n\tvar ms int64 = m.S\n\tvar nsh int64 = DB - Nbits(pm.V[pm.T-1])\n\tif nsh > 0 {\n\t\tpm.LShiftTo(nsh, y)\n\t\tpt.LShiftTo(nsh, r)\n\t} else {\n\t\tpm.CopyTo(y)\n\t\tpt.CopyTo(r)\n\t}\n\tvar ys int64 = y.T\n\tvar y0 int64 = y.V[ys-1]\n\tif y0 == 0 {\n\t\treturn\n\t}\n\tvar yt int64 = y0 * (1 << uint(F1))\n\tif ys > 1 {\n\t\tyt += y.V[ys-2] >> uint(F2)\n\t}\n\tvar d1 float64 = float64(FV) / float64(yt)\n\tvar d2 float64 = float64(1<<uint(F1)) / float64(yt)\n\tvar e int64 = 1 << uint(F2)\n\tvar i int64 = r.T\n\tvar j int64 = i - ys\n\tvar t *BigInteger = q\n\tif q == nil {\n\t\tt = NewBigInteger()\n\t}\n\ty.DLShiftTo(j, t)\n\tif r.CompareTo(t) >= 0 {\n\t\tr.V[r.T] = 1\n\t\tr.T++\n\t\tr.SubTo(t, r)\n\t}\n\tONE.DLShiftTo(ys, t)\n\tt.SubTo(y, y)\n\tfor j--; j >= 0; j-- {\n\t\tvar qd int64 = DM\n\t\ti--\n\t\tif r.V[i] != y0 {\n\t\t\tqd = int64(math.Floor(float64(r.V[i])*d1 + float64(r.V[i-1]+e)*d2))\n\t\t}\n\t\tr.V[i] += y.AM(0, qd, r, j, 0, ys)\n\t\tif (r.V[i]) > qd {\n\t\t\ty.DLShiftTo(j, t)\n\t\t\tr.SubTo(t, r)\n\t\t\tfor qd--; r.V[i] < qd; qd-- {\n\t\t\t\tr.SubTo(t, r)\n\t\t\t}\n\t\t}\n\t}\n\tif q != nil {\n\t\tr.DRShiftTo(ys, q)\n\t\tif ts != ms {\n\t\t\tZERO.SubTo(q, q)\n\t\t}\n\t}\n\tr.T = ys\n\tr.clamp()\n\tif nsh > 0 {\n\t\tr.RShiftTo(nsh, r)\n\t}\n\tif ts < 0 {\n\t\tZERO.SubTo(r, r)\n\t}\n}", "func (z *Int) Div(x, y *Int) *Int {}", "func (z *Float64) Quo(x, y *Float64) *Float64 {\n\tif y.IsZeroDivisor() {\n\t\tpanic(zeroDivisorDenominator)\n\t}\n\tq := y.Quad()\n\ta := (x.l * y.l) - (y.r * x.r)\n\tb := (x.r * y.l) - (y.r * x.l)\n\tz.SetPair(a, b)\n\treturn z.Divide(z, q)\n}", "func (z *Int) Div(x, y *Int) *Int {\n\tif y.IsZero() || y.Gt(x) {\n\t\treturn z.Clear()\n\t}\n\tif x.Eq(y) {\n\t\treturn z.SetOne()\n\t}\n\t// Shortcut some cases\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() / y.Uint64())\n\t}\n\n\t// At this point, we know\n\t// x/y ; x > y > 0\n\t// See Knuth, Volume 2, section 4.3.1, Algorithm D.\n\n\t// Normalize by shifting divisor left just enough so that its high-order\n\t// bit is on and u left the same amount.\n\t// function nlz do the caculating of the amount and shl do the left operation.\n\ts := nlz(y)\n\txn := shl(x, s, true)\n\tyn := shl(y, s, false)\n\n\t// divKnuth do the division of normalized dividend and divisor with Knuth Algorithm D.\n\tq := divKnuth(xn, yn)\n\n\tz.Clear()\n\tfor i := 0; i < len(q); i++ {\n\t\tz[i/2] = z[i/2] | uint64(q[i])<<(32*(uint64(i)%2))\n\t}\n\n\treturn z\n}", "func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal) {\n\td.ensureInitialized()\n\td2.ensureInitialized()\n\tif d2.value.Sign() == 0 {\n\t\tpanic(\"decimal division by 0\")\n\t}\n\tscale := -precision\n\te := int64(d.exp - d2.exp - scale)\n\tif e > math.MaxInt32 || e < math.MinInt32 {\n\t\tpanic(\"overflow in decimal QuoRem\")\n\t}\n\tvar aa, bb, expo big.Int\n\tvar scalerest int32\n\t// d = a 10^ea\n\t// d2 = b 10^eb\n\tif e < 0 {\n\t\taa = *d.value\n\t\texpo.SetInt64(-e)\n\t\tbb.Exp(tenInt, &expo, nil)\n\t\tbb.Mul(d2.value, &bb)\n\t\tscalerest = d.exp\n\t\t// now aa = a\n\t\t// bb = b 10^(scale + eb - ea)\n\t} else {\n\t\texpo.SetInt64(e)\n\t\taa.Exp(tenInt, &expo, nil)\n\t\taa.Mul(d.value, &aa)\n\t\tbb = *d2.value\n\t\tscalerest = scale + d2.exp\n\t\t// now aa = a ^ (ea - eb - scale)\n\t\t// bb = b\n\t}\n\tvar q, r big.Int\n\tq.QuoRem(&aa, &bb, &r)\n\tdq := Decimal{value: &q, exp: scale}\n\tdr := Decimal{value: &r, exp: scalerest}\n\treturn dq, dr\n}", "func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal) {\n\td.ensureInitialized()\n\td2.ensureInitialized()\n\tif d2.value.Sign() == 0 {\n\t\tpanic(\"decimal division by 0\")\n\t}\n\tscale := -precision\n\te := int64(d.exp - d2.exp - scale)\n\tif e > math.MaxInt32 || e < math.MinInt32 {\n\t\tpanic(\"overflow in decimal QuoRem\")\n\t}\n\tvar aa, bb, expo big.Int\n\tvar scalerest int32\n\t// d = a 10^ea\n\t// d2 = b 10^eb\n\tif e < 0 {\n\t\taa = *d.value\n\t\texpo.SetInt64(-e)\n\t\tbb.Exp(tenInt, &expo, nil)\n\t\tbb.Mul(d2.value, &bb)\n\t\tscalerest = d.exp\n\t\t// now aa = a\n\t\t// bb = b 10^(scale + eb - ea)\n\t} else {\n\t\texpo.SetInt64(e)\n\t\taa.Exp(tenInt, &expo, nil)\n\t\taa.Mul(d.value, &aa)\n\t\tbb = *d2.value\n\t\tscalerest = scale + d2.exp\n\t\t// now aa = a ^ (ea - eb - scale)\n\t\t// bb = b\n\t}\n\tvar q, r big.Int\n\tq.QuoRem(&aa, &bb, &r)\n\tdq := Decimal{value: &q, exp: scale}\n\tdr := Decimal{value: &r, exp: scalerest}\n\treturn dq, dr\n}", "func DivisorComResto(numeroA int, numberoB int) (resultado int, resto int) {\n\tresultado = numeroA / numberoB\n\tresto = numeroA % numberoB\n\treturn\n}", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func divmod(a, b int) (q int, r int) {\n\tif b == 0 {\n\t\treturn\n\t}\n\tq = a / b\n\tr = a % b\n\treturn\n}", "func (z *Int) Quo(x, y *Int) *Int {}", "func Div64(hi, lo, y uint64) (quo, rem uint64) {\n\tconst (\n\t\ttwo32 = 1 << 32\n\t\tmask32 = two32 - 1\n\t)\n\tif y == 0 {\n\t\tpanic(getDivideError())\n\t}\n\tif y <= hi {\n\t\tpanic(getOverflowError())\n\t}\n\n\ts := uint(LeadingZeros64(y))\n\ty <<= s\n\n\tyn1 := y >> 32\n\tyn0 := y & mask32\n\tun32 := hi<<s | lo>>(64-s)\n\tun10 := lo << s\n\tun1 := un10 >> 32\n\tun0 := un10 & mask32\n\tq1 := un32 / yn1\n\trhat := un32 - q1*yn1\n\n\tfor q1 >= two32 || q1*yn0 > two32*rhat+un1 {\n\t\tq1--\n\t\trhat += yn1\n\t\tif rhat >= two32 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tun21 := un32*two32 + un1 - q1*y\n\tq0 := un21 / yn1\n\trhat = un21 - q0*yn1\n\n\tfor q0 >= two32 || q0*yn0 > two32*rhat+un0 {\n\t\tq0--\n\t\trhat += yn1\n\t\tif rhat >= two32 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn q1*two32 + q0, (un21*two32 + un0 - q0*y) >> s\n}", "func Rem(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Rem(x, y)\n}", "func IntMod(z *big.Int, x, y *big.Int,) *big.Int", "func div(u uint8) (uint8, uint8) {\n\treturn u / 64, u % 64\n}", "func (q Quat) Div(other Quat) Quat {\n\treturn Quat{q.W / other.W, q.X / other.X, q.Y / other.Y, q.Z / other.Z}\n}", "func divmod(dvdn, dvsr int) (q, r int) {\n\tr = dvdn\n\tfor r >= dvsr {\n\t\tq++\n\t\tr = r - dvsr\n\t}\n\treturn\n}", "func Quo(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx / yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx / yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Float32:\n\t\txx := float32(x.Float())\n\t\tyy := float32(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Float64:\n\t\txx := float64(x.Float())\n\t\tyy := float64(y.Float())\n\t\tzz := float64(xx / yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Complex64:\n\t\txx := complex64(x.Complex())\n\t\tyy := complex64(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\tcase reflect.Complex128:\n\t\txx := complex128(x.Complex())\n\t\tyy := complex128(y.Complex())\n\t\tzz := complex128(xx / yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator / not defined on %v\", x.Type()))\n}", "func DivMod(x, y, m *big.Int) (*big.Int, *big.Int) {\n\treturn new(big.Int).DivMod(x, y, m)\n}", "func Rem(hi, lo, y uint) uint {\n\tif UintSize == 32 {\n\t\treturn uint(Rem32(uint32(hi), uint32(lo), uint32(y)))\n\t}\n\treturn uint(Rem64(uint64(hi), uint64(lo), uint64(y)))\n}", "func DivMod(dvdn, dvsr int) (q, r int) {\n\tr = dvdn\n\tfor r >= dvsr {\n\t\tq += 1\n\t\tr = r - dvsr\n\t}\n\treturn\n}", "func cdiv(a, b int) int { return (a + b - 1) / b }", "func (z *InfraHamilton) QuoR(x, y *InfraHamilton) *InfraHamilton {\n\tif y.IsZeroDivisor() {\n\t\tpanic(\"denominator is zero divisor\")\n\t}\n\treturn z.Mul(x, z.Inv(y))\n}", "func (z *Float) Quo(x, y *Float) *Float {}", "func TestCheckBinaryExprComplexRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 4`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func DIVQ(mr operand.Op) { ctx.DIVQ(mr) }", "func DivAndRemainder(a, b int) (int, int, error) {\n\tif b == 0 {\n\t\treturn 0, 0, errors.New(\"Cannot divide by zero\")\n\t}\n\td := int(math.Floor(float64(a) / float64(b)))\n\tr := a % b\n\treturn d, r, nil\n\n}", "func TestCheckBinaryExprIntRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `4 % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func rem(a, b big.Int) big.Int {\n\t// it's me in the corner\n\treturn *big.NewInt(1).Rem(&a, &b)\n}", "func div(d, r time.Duration) int64 {\n\tif m := d % r; m > 0 {\n\t\treturn int64(d/r + 1)\n\t}\n\treturn int64(d / r)\n}", "func S41_DivisionWithRemainder(in chan S41_In, out chan S41_Out) {\n\tv := <-in\n\tx, y := v.X, v.Y\n\n\tquot, rem := 0, x\n\tfor rem >= y {\n\t\trem -= y\n\t\tquot++\n\t}\n\tout <- S41_Out{quot, rem}\n}", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (p Poly64) Div(p2 Poly64) (q, r Poly64) {\n\tif p2 == 0 {\n\t\tpanic(\"division by zero\")\n\t}\n\n\tq = 0\n\tr = p\n\tlog2p2 := ilog2(uint64(p2))\n\tfor r != 0 {\n\t\tlog2r := ilog2(uint64(r))\n\t\tif log2r < log2p2 {\n\t\t\tbreak\n\t\t}\n\t\tdlog2 := log2r - log2p2\n\t\tq ^= (1 << dlog2)\n\t\tr ^= (p2 << dlog2)\n\t}\n\n\treturn q, r\n}", "func rcDiv(p *TCompiler, code *TCode) (*value.Value, error) {\n\tv := value.Div(p.regGet(code.B), p.regGet(code.C))\n\tp.regSet(code.A, v)\n\tp.moveNext()\n\treturn v, nil\n}", "func Rem64(hi, lo, y uint64) uint64 {\n\t// We scale down hi so that hi < y, then use Div64 to compute the\n\t// rem with the guarantee that it won't panic on quotient overflow.\n\t// Given that\n\t// hi ≡ hi%y (mod y)\n\t// we have\n\t// hi<<64 + lo ≡ (hi%y)<<64 + lo (mod y)\n\t_, rem := Div64(hi%y, lo, y)\n\treturn rem\n}", "func IntModSqrt(z *big.Int, x, p *big.Int,) *big.Int", "func DivUint64(a, b uint64) uint64 {\n\treturn native(\"div64.circ\", a, b)\n}", "func (z *Int) Rem(x, y *Int) *Int {}", "func TestCheckBinaryExprRuneRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `'@' % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func (v Vec3i) Div(other Vec3i) Vec3i {\n\treturn Vec3i{v.X / other.X, v.Y / other.Y, v.Z / other.Z}\n}", "func (z *Int) Mod(x, y *Int) *Int {}", "func (z *Float64) Divide(y *Float64, a float64) *Float64 {\n\tz.l = y.l / a\n\tz.r = y.r / a\n\treturn z\n}", "func NewURem(x, y value.Value) *InstURem {\n\tinst := &InstURem{X: x, Y: y}\n\t// Compute type.\n\tinst.Type()\n\treturn inst\n}", "func DivMod(a int, b int, div *int, mod *int) {\n\t*div = a / b\n\t*mod = a % b\n}", "func TestCheckBinaryExprComplexRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func (v *Vec3i) SetDiv(other Vec3i) {\n\tv.X /= other.X\n\tv.Y /= other.Y\n\tv.Z /= other.Z\n}", "func TestCheckBinaryExprComplexRemFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 2.0`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func Div32(hi, lo, y uint32) (quo, rem uint32) {\n\tif y != 0 && y <= hi {\n\t\tpanic(getOverflowError())\n\t}\n\tz := uint64(hi)<<32 | uint64(lo)\n\tquo, rem = uint32(z/uint64(y)), uint32(z%uint64(y))\n\treturn\n}", "func Modulo(a, operand int) int { return operand % a }", "func division(x, y uint) ([]uint, []uint, []uint) {\n\t// Digits before decimal point\n\tinteg := []uint{0}\n\n\t// Digits after decimal point including any recurrence\n\tfract := []uint{}\n\n\t// Track state of caculation to detect recurrence\n\tstate := make(map[uint]*struct{})\n\tindex := make(map[uint]int)\n\n\t// First, see if we have digits before the decimal point.\n\tif x/y != 0 {\n\t\tinteg = euler.UintToDigits(x / y)\n\t\tx = x % y\n\t}\n\n\t// Compute the fractional part. We will accumulate digits\n\t// in a slice and keep track of the leading digits.\n\n\t// Increasing here sets up to calculate the first digit, so\n\t// does not add a leading zero.\n\tif x > 0 && x/y == 0 {\n\t\tx *= 10\n\t}\n\n\t// Index of the current digit in the calculation\n\ti := 0\n\n\t// If further increases are needed, add more leading zeros\n\tfor x > 0 && x/y == 0 {\n\t\tx *= 10\n\t\tfract = append(fract, 0)\n\t\ti++\n\t}\n\n\tfor {\n\t\t// Increase x as needed and add zero digits\n\t\tfor x > 0 && x/y == 0 {\n\t\t\tx *= 10\n\t\t\tfract = append(fract, 0)\n\t\t}\n\n\t\t// Check if we've returned to a previous state, where the\n\t\t// current divisor has been seen before. Return the point\n\t\t// where the recurrence began. If we don't break out here\n\t\t// this would recur forever.\n\t\tif state[x] != nil {\n\t\t\t// Calculate the point the recurrence starts and\n\t\t\t// return slices for each part.\n\t\t\tr := index[x]\n\t\t\treturn integ, fract[:r], fract[r:]\n\t\t}\n\n\t\t// Record the current state\n\t\tstate[x] = &struct{}{}\n\t\tindex[x] = i\n\n\t\t// Div mod\n\t\tn := x / y\n\t\tm := x % y\n\n\t\t// Save digit\n\t\tfract = append(fract, n)\n\n\t\t// If no remainder, we're done\n\t\tif m == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// Continue the calculation with the remainder * 10\n\t\tx = m * 10\n\n\t\ti++\n\t}\n\n\t// No recurrence was found, return digits.\n\treturn integ, fract, []uint{}\n}", "func (z *Element22) Div(x, y *Element22) *Element22 {\n\tvar yInv Element22\n\tyInv.Inverse(y)\n\tz.Mul(x, &yInv)\n\treturn z\n}", "func (l Integer) Div(r Number) Number {\n\tif ri, ok := r.(Integer); ok {\n\t\tif ri == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\tres := big.NewRat(int64(l), int64(ri))\n\t\treturn maybeWhole(res)\n\t}\n\tpl, pr := purify(l, r)\n\treturn pl.Div(pr)\n}", "func DIVL(mr operand.Op) { ctx.DIVL(mr) }", "func div(a, b int32) int32 {\n\tif a >= 0 {\n\t\treturn (a + (b >> 1)) / b\n\t}\n\treturn -((-a + (b >> 1)) / b)\n}", "func (e *ConstantExpr) SRem(other *ConstantExpr) *ConstantExpr {\n\tassert(e.Width == other.Width, \"srem: width mismatch: %d != %d\", e.Width, other.Width)\n\tswitch e.Width {\n\tcase Width8:\n\t\treturn NewConstantExpr(uint64(int8(e.Value)%int8(other.Value)), e.Width)\n\tcase Width16:\n\t\treturn NewConstantExpr(uint64(int16(e.Value)%int16(other.Value)), e.Width)\n\tcase Width32:\n\t\treturn NewConstantExpr(uint64(int32(e.Value)%int32(other.Value)), e.Width)\n\tcase Width64:\n\t\treturn NewConstantExpr(uint64(int64(e.Value)%int64(other.Value)), e.Width)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"srem: non-standard width: %d\", e.Width))\n\t}\n}", "func IntQuo(z *big.Int, x, y *big.Int,) *big.Int", "func (z *Perplex) Quo(x, y *Perplex) *Perplex {\n\tif y.IsZeroDiv() {\n\t\tpanic(\"zero divisor denominator\")\n\t}\n\tquad := y.Quad()\n\tz.Conj(y)\n\tz.Mul(x, z)\n\tz.l.Quo(&z.l, quad)\n\tz.r.Quo(&z.r, quad)\n\treturn z\n}", "func TestCheckBinaryExprFloatRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func ChineseRemainder(congruences map[int]int) int {\n\tp := 1\n\tfor _, modulus := range congruences {\n\t\tp = p * modulus\n\t}\n\n\tx := 0\n\tfor remainder, modulus := range congruences {\n\t\tn := p / modulus\n\t\t_, inv, _ := EGCD(n, modulus)\n\t\tx = (x + remainder*n*inv) % p\n\t}\n\n\tfor x < 0 {\n\t\tx = x + p\n\t}\n\treturn x\n}", "func Div(a, b *big.Float) *big.Float {\n\treturn ZeroBigFloat().Quo(a, b)\n}", "func (z *Int) GCD(x, y, a, b *Int) *Int {}", "func (x Dec) Quo(y Dec) (Dec, error) {\n\tvar z Dec\n\t_, err := dec128Context.Quo(&z.dec, &x.dec, &y.dec)\n\treturn z, errorsmod.Wrap(err, \"decimal quotient error\")\n}", "func TestCheckBinaryExprIntRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `4 % 4`, env, NewConstInt64(4 % 4), ConstInt)\n}", "func (z *Big) Rem(x, y *Big) *Big { return z.Context.Rem(z, x, y) }", "func div(x, y int) (answer int, err error) {\n\tif y == 0 {\n\t\terr = fmt.Errorf(\"Cannot Divid by zero\")\n\t} else {\n\t\tanswer = x / y\n\t}\n\treturn\n}", "func (z *Rat) Quo(x, y *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func (z *Int) Mod(x, y *Int) *Int {\n\tif x.IsZero() || y.IsZero() {\n\t\treturn z.Clear()\n\t}\n\tswitch x.Cmp(y) {\n\tcase -1:\n\t\t// x < y\n\t\tcopy(z[:], x[:])\n\t\treturn z\n\tcase 0:\n\t\t// x == y\n\t\treturn z.Clear() // They are equal\n\t}\n\n\t// At this point:\n\t// x != 0\n\t// y != 0\n\t// x > y\n\n\t// Shortcut trivial case\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() % y.Uint64())\n\t}\n\n\tq := NewInt()\n\tq.Div(x, y)\n\tq.Mul(q, y)\n\tz.Sub(x, q)\n\treturn z\n}", "func opUI64Div(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) / ReadUI64(fp, expr.Inputs[1])\n\tWriteUI64(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func (r GroupSortedSet) ZRem(ctx context.Context, key string, member interface{}, members ...interface{}) (int64, error) {\n\tvar s = []interface{}{key}\n\ts = append(s, member)\n\ts = append(s, members...)\n\tv, err := r.redis.Do(ctx, \"ZRem\", s...)\n\treturn v.Int64(), err\n}", "func Rem32(hi, lo, y uint32) uint32 {\n\treturn uint32((uint64(hi)<<32 | uint64(lo)) % uint64(y))\n}", "func (z *Int) ModSqrt(x, p *Int) *Int {}", "func (z *BiComplex) Quo(x, y *BiComplex) *BiComplex {\n\tif y.IsZeroDivisor() {\n\t\tpanic(\"denominator is zero divisor\")\n\t}\n\treturn z.Mul(z.Inv(y), x)\n}", "func (rn *RangedNumber) Div(other *RangedNumber) *RangedNumber {\n\treturn rn.Set(rn.min/other.min, rn.max/other.max)\n}", "func (l Integer) Mod(r Number) Number {\n\tif ri, ok := r.(Integer); ok {\n\t\tif ri == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\treturn l % ri\n\t}\n\tpl, pr := purify(l, r)\n\treturn pl.Mod(pr)\n}", "func divmod(a, b, mod *big.Int) *big.Int {\n\tb = b.ModInverse(b, mod)\n\tif b == nil {\n\t\treturn nil\n\t}\n\treturn a.Mul(a, b)\n}", "func (n *Uint256) DivUint64(divisor uint64) *Uint256 {\n\tif divisor == 0 {\n\t\tpanic(\"division by zero\")\n\t}\n\n\t// Fast path for a couple of obvious cases. The result is zero when the\n\t// dividend is smaller than the divisor and one when they are equal. The\n\t// remaining code also has preconditions on these cases already being\n\t// handled.\n\tif n.LtUint64(divisor) {\n\t\tn.Zero()\n\t\treturn n\n\t}\n\tif n.EqUint64(divisor) {\n\t\treturn n.SetUint64(1)\n\t}\n\n\t// The range here satisfies the following inequalities:\n\t// 1 ≤ divisor < 2^64\n\t// 1 ≤ divisor < dividend < 2^256\n\tvar quotient Uint256\n\tvar r uint64\n\tfor d := n.numDigits() - 1; d >= 0; d-- {\n\t\tquotient.n[d], r = bits.Div64(r, n.n[d], divisor)\n\t}\n\treturn n.Set(&quotient)\n}", "func (z nat) divW(x nat, y Word) (q nat, r Word) {\n\tm := len(x)\n\tswitch {\n\tcase y == 0:\n\t\tpanic(\"division by zero\")\n\tcase y == 1:\n\t\tq = z.set(x) // result is x\n\t\treturn\n\tcase m == 0:\n\t\tq = z.make(0) // result is 0\n\t\treturn\n\t}\n\t// m > 0\n\tz = z.make(m)\n\tr = divWVW(z, 0, x, y)\n\tq = z.norm()\n\treturn\n}", "func TestCheckBinaryExprComplexRemRune(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % '@'`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func (l *BigInt) Div(r Number) Number {\n\tif ri, ok := r.(*BigInt); ok {\n\t\tlb := (*big.Int)(l)\n\t\trb := (*big.Int)(ri)\n\t\tif rb.IsInt64() && rb.Int64() == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\tres := new(big.Int).Quo(lb, rb)\n\t\treturn maybeInteger(res)\n\t}\n\tlp, rp := purify(l, r)\n\treturn lp.Div(rp)\n}", "func (z *Big) QuoInt(x, y *Big) *Big { return z.Context.QuoInt(z, x, y) }", "func TestCheckBinaryExprFloatRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 % 4`, env,\n\t\t`illegal constant expression: floating-point % operation`,\n\t)\n\n}", "func Div(x, y int) int {\n\treturn x / y\n}", "func RealDiv(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"RealDiv\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func divmod1e9(x uint64) (uint32, uint32) {\n\tif !host32bit {\n\t\treturn uint32(x / 1e9), uint32(x % 1e9)\n\t}\n\t// Use the same sequence of operations as the amd64 compiler.\n\thi, _ := bits.Mul64(x>>1, 0x89705f4136b4a598) // binary digits of 1e-9\n\tq := hi >> 28\n\treturn uint32(q), uint32(x - q*1e9)\n}", "func (c *Context) DIVQ(mr operand.Op) {\n\tc.addinstruction(x86.DIVQ(mr))\n}", "func Command_Div(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:div\", \"2\")\n\t}\n\n\tscript.RetVal = rex.NewValueFloat64(params[0].Float64() / params[1].Float64())\n\treturn\n}", "func Reciprocal3(r *[761]int16, s *[761]int8) int {\n\t// f starts as the modulus of Rq.\n\tf := new([761 + 1]int16)\n\tf[0] = -1\n\tf[1] = -1\n\tf[761] = 1\n\n\t// g starts as 3*s\n\tg := new([761 + 1]int16)\n\tfor i := 0; i < 761; i++ {\n\t\tg[i] = int16(3 * s[i])\n\t}\n\n\td := 761\n\te := 761\n\tloops := 2*761 + 1\n\tu := make([]int16, loops+1)\n\tv := make([]int16, loops+1)\n\tv[0] = 1\n\n\tfor i := 0; i < loops; i++ {\n\t\t// c = (lc(g)/lc(f)) % 3\n\t\tc := modq.Quotient(g[761], f[761])\n\t\t// g = g - f*c; g <<= 1\n\t\tvector.MinusProduct(g[:], 761+1, g[:], f[:], c)\n\t\tvector.Shift(g[:], 761+1)\n\t\t// v = v - u*c\n\t\tvector.MinusProduct(v, loops+1, v, u, c)\n\t\tvector.Shift(v, loops+1)\n\t\t// swap (e,d), (f,g), and (u,v) if d > e and lc(g) != 0\n\t\te--\n\t\tm := smallerMask(e, d) & modq.MaskSet(g[761])\n\t\tswapInt(&e, &d, m)\n\t\tvector.Swap(f[:], g[:], 761+1, m)\n\t\tvector.Swap(u, v, loops+1, m)\n\t}\n\tvector.Product(r[:], 761, u[761:], modq.Reciprocal(f[761]))\n\n\treturn smallerMask(0, d)\n}" ]
[ "0.782651", "0.77628213", "0.7099386", "0.6989584", "0.6791163", "0.63246447", "0.6182469", "0.59490997", "0.5859081", "0.57387716", "0.56355447", "0.5429526", "0.54193616", "0.54186124", "0.5415265", "0.5373845", "0.5330833", "0.5288362", "0.5288362", "0.52422345", "0.5236447", "0.51999795", "0.5192549", "0.5178787", "0.51677555", "0.5158748", "0.51566565", "0.5135369", "0.50902385", "0.5063295", "0.5057372", "0.50405484", "0.5038368", "0.5020417", "0.5010706", "0.49948272", "0.4984623", "0.49532923", "0.49439263", "0.49414107", "0.49272627", "0.4922175", "0.4896021", "0.48952726", "0.48927596", "0.48920727", "0.48856354", "0.48816887", "0.48542234", "0.48304185", "0.48184976", "0.48159027", "0.4808736", "0.48083776", "0.47803798", "0.4779936", "0.47666943", "0.4748296", "0.47481063", "0.47344798", "0.4731914", "0.47020757", "0.46988103", "0.46973312", "0.46809795", "0.46767184", "0.4672455", "0.46717542", "0.46710178", "0.46703956", "0.46699044", "0.46391428", "0.46354392", "0.46251792", "0.46192348", "0.46156442", "0.46097046", "0.46022224", "0.46011397", "0.45982307", "0.459251", "0.45646665", "0.4547866", "0.4543748", "0.4535723", "0.45261422", "0.45230496", "0.4508058", "0.45011657", "0.448626", "0.44713742", "0.44664913", "0.44531032", "0.4447922", "0.44434583", "0.44349542", "0.44310424", "0.442352", "0.44080386", "0.44049093" ]
0.705671
3
Rat sets z to x and returns z. z is allowed to be nil. The result is undefined if x is an infinity or NaN value.
func (x *Big) Rat(z *big.Rat) *big.Rat { if debug { x.validate() } if z == nil { z = new(big.Rat) } if !x.IsFinite() { return z.SetInt64(0) } // Fast path for decimals <= math.MaxInt64. if x.IsInt() { if u, ok := x.Int64(); ok { // If profiled we can call scalex ourselves and save the overhead of // calling Int64. But I doubt it'll matter much. return z.SetInt64(u) } } num := new(big.Int) if x.isCompact() { num.SetUint64(x.compact) } else { num.Set(&x.unscaled) } if x.exp > 0 { arith.MulBigPow10(num, num, uint64(x.exp)) } if x.Signbit() { num.Neg(num) } denom := c.OneInt if x.exp < 0 { denom = new(big.Int) if shift, ok := arith.Pow10(uint64(-x.exp)); ok { denom.SetUint64(shift) } else { denom.Set(arith.BigPow10(uint64(-x.exp))) } } return z.SetFrac(num, denom) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetRat(x *Rat) *Float {}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func RatSet(z *big.Rat, x *big.Rat,) *big.Rat", "func (x *Float) Rat(z *Rat) (*Rat, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func (z *Rat) Set(x *Rat) *Rat {}", "func FloatRat(x *big.Float, z *big.Rat,) (*big.Rat, big.Accuracy,)", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func (z *Rat) Mul(x, y *Rat) *Rat {}", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func (z *Big) SetRat(x *big.Rat) *Big {\n\tif x.IsInt() {\n\t\treturn z.Context.round(z.SetBigMantScale(x.Num(), 0))\n\t}\n\tvar num, denom Big\n\tnum.SetBigMantScale(x.Num(), 0)\n\tdenom.SetBigMantScale(x.Denom(), 0)\n\treturn z.Quo(&num, &denom)\n}", "func (z *Rat) Abs(x *Rat) *Rat {}", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func MakeRat(x interface{}) Value {\n\treturn &ratVal{constant.Make(x)}\n}", "func RatNeg(z *big.Rat, x *big.Rat,) *big.Rat", "func Real(x Value) Value {\n\tif _, ok := x.(*ratVal); ok {\n\t\treturn x\n\t}\n\treturn constant.Real(x)\n}", "func RatAbs(z *big.Rat, x *big.Rat,) *big.Rat", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (v Value) Rat() *big.Rat {\n\tn := big.NewInt(int64(v.num))\n\tif v.negative {\n\t\tn.Neg(n)\n\t}\n\n\td := big.NewInt(1)\n\tif v.offset < 0 {\n\t\td.Exp(big.NewInt(10), big.NewInt(-v.offset), nil)\n\t} else if v.offset > 0 {\n\t\tmult := big.NewInt(1)\n\t\tmult.Exp(big.NewInt(10), big.NewInt(v.offset), nil)\n\t\tn.Mul(n, mult)\n\t}\n\n\tres := big.NewRat(0, 1)\n\tres.SetFrac(n, d)\n\treturn res\n}", "func (z *Rat) SetInt(x *Int) *Rat {}", "func RatMul(z *big.Rat, x, y *big.Rat,) *big.Rat", "func RatInv(z *big.Rat, x *big.Rat,) *big.Rat", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func (d Decimal) Rat() *big.Rat {\n\td.ensureInitialized()\n\tif d.exp <= 0 {\n\t\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\t\tdenom := new(big.Int).Exp(tenInt, big.NewInt(-int64(d.exp)), nil)\n\t\treturn new(big.Rat).SetFrac(d.value, denom)\n\t}\n\n\tmul := new(big.Int).Exp(tenInt, big.NewInt(int64(d.exp)), nil)\n\tnum := new(big.Int).Mul(d.value, mul)\n\treturn new(big.Rat).SetFrac(num, oneInt)\n}", "func (d Decimal) Rat() *big.Rat {\n\td.ensureInitialized()\n\tif d.exp <= 0 {\n\t\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\t\tdenom := new(big.Int).Exp(tenInt, big.NewInt(-int64(d.exp)), nil)\n\t\treturn new(big.Rat).SetFrac(d.value, denom)\n\t}\n\n\tmul := new(big.Int).Exp(tenInt, big.NewInt(int64(d.exp)), nil)\n\tnum := new(big.Int).Mul(d.value, mul)\n\treturn new(big.Rat).SetFrac(num, oneInt)\n}", "func (z *Rat) Inv(x *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func RatNum(x *big.Rat,) *big.Int", "func (z *Float) Set(x *Float) *Float {}", "func (z *Rat) Neg(x *Rat) *Rat {}", "func (z *Rat) SetFrac64(a, b int64) *Rat {}", "func (z *Rat) Add(x, y *Rat) *Rat {}", "func (x *Rat) Sign() int {}", "func (me XsdGoPkgHasElem_Z) ZDefault() xsdt.Double { var x = new(xsdt.Double); x.Set(\"1.0\"); return *x }", "func RatSign(x *big.Rat,) int", "func (x *Rat) Float64() (f float64, exact bool) {}", "func MakeRatFromString(x string) Value {\n\tv := constant.MakeFromLiteral(x, gotoken.FLOAT, 0)\n\tif v.Kind() != Unknown {\n\t\tv = &ratVal{v}\n\t}\n\treturn v\n}", "func (t Target) Rat() *big.Rat {\n\treturn new(big.Rat).SetInt(t.Int())\n}", "func RatAdd(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (z *Rat) SetInt64(x int64) *Rat {}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func NewRat(a, b int64) *Rat {}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func (x *Rat) Num() *Int {}", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func RatSetString(z *big.Rat, s string) (*big.Rat, bool)", "func Sqr(z, x *Elt)", "func initial(k int, x float64) float64 {\n\tswitch k {\n\tcase 0:\n\t\tconst (\n\t\t\txbranch = -0.32358170806015724\n\t\t\txratp0 = 0.14546954290661823\n\t\t\txratp1 = 8.706658967856612\n\t\t)\n\t\tswitch {\n\t\tcase x < xbranch:\n\t\t\treturn branchpoint(k, x)\n\t\tcase x < xratp0:\n\t\t\treturn rationalp0(x)\n\t\tcase x < xratp1:\n\t\t\treturn rationalp1(x)\n\t\tdefault:\n\t\t\treturn asymptotic(k, x)\n\t\t}\n\tdefault: // k=-1\n\t\tconst xbranch = -0.30298541769\n\t\tswitch {\n\t\tcase x < xbranch:\n\t\t\treturn branchpoint(k, x)\n\t\tdefault:\n\t\t\treturn rationalm(x)\n\t\t}\n\t}\n}", "func (me XsdGoPkgHasElems_Z) ZDefault() xsdt.Double {\r\n\tvar x = new(xsdt.Double)\r\n\tx.Set(\"1.0\")\r\n\treturn *x\r\n}", "func ZernikeR(n, m int, x float64) float64 {\n\tswitch {\n\tcase math.IsNaN(x) || n < 0 || m < 0:\n\t\treturn math.NaN()\n\tcase (n-m)&1 == 1 || n < m:\n\t\treturn 0\n\tdefault:\n\t\ts := (n - m) / 2\n\t\ts = 1 - 2*(s&1)\n\t\treturn float64(s) * math.Pow(x, float64(m)) * JacobiP((n-m)/2, float64(m), 0, 1-2*x*x)\n\t}\n}", "func Val(x Value) interface{} {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Val(x)\n}", "func rationalp0(x float64) float64 {\n\tconst (\n\t\ta0 = 1\n\t\ta1 = 5.931375839364438\n\t\ta2 = 11.39220550532913\n\t\ta3 = 7.33888339911111\n\t\ta4 = 0.653449016991959\n\n\t\tb0 = 1\n\t\tb1 = 6.931373689597704\n\t\tb2 = 16.82349461388016\n\t\tb3 = 16.43072324143226\n\t\tb4 = 5.115235195211697\n\t)\n\tnum := a0 + x*(a1+x*(a2+x*(a3+x*a4)))\n\tden := b0 + x*(b1+x*(b2+x*(b3+x*b4)))\n\treturn x * num / den\n}", "func rationalm(x float64) float64 {\n\tconst (\n\t\ta0 = -7.81417672390744\n\t\ta1 = 253.88810188892484\n\t\ta2 = 657.9493176902304\n\n\t\tb0 = 1\n\t\tb1 = -60.43958713690808\n\t\tb2 = 99.9856708310761\n\t\tb3 = 682.6073999909428\n\t\tb4 = 962.1784396969866\n\t\tb5 = 1477.9341280760887\n\t)\n\n\treturn (a0 + x*(a1+x*a2)) / (b0 + x*(b1+x*(b2+x*(b3+x*(b4+x*b5)))))\n}", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func (z *Rat) Sub(x, y *Rat) *Rat {}", "func (k Keeper) SetRat(ctx sdk.Context, key string, value sdk.Rat) {\n\tk.paramsKeeper.Setter().SetRat(ctx, MakeFeeKey(key), value)\n}", "func RatSub(z *big.Rat, x, y *big.Rat,) *big.Rat", "func RatDenom(x *big.Rat,) *big.Int", "func (z *Rat) SetUint64(x uint64) *Rat {}", "func (z *Decimal) Sqrt(x *Decimal) *Decimal {\n\tif debugDecimal {\n\t\tx.validate()\n\t}\n\n\tif z.prec == 0 {\n\t\tz.prec = x.prec\n\t}\n\n\tif x.Sign() == -1 {\n\t\t// following IEEE754-2008 (section 7.2)\n\t\tpanic(ErrNaN{\"square root of negative operand\"})\n\t}\n\n\t// handle ±0 and +∞\n\tif x.form != finite {\n\t\tz.acc = Exact\n\t\tz.form = x.form\n\t\tz.neg = x.neg // IEEE754-2008 requires √±0 = ±0\n\t\treturn z\n\t}\n\n\t// MantExp sets the argument's precision to the receiver's, and\n\t// when z.prec > x.prec this will lower z.prec. Restore it after\n\t// the MantExp call.\n\tprec := z.prec\n\tb := x.MantExp(z)\n\tz.prec = prec\n\n\t// Compute √(z·10**b) as\n\t// √( z)·10**(½b) if b is even\n\t// √(10z)·10**(⌊½b⌋) if b > 0 is odd\n\t// √(z/10)·10**(⌈½b⌉) if b < 0 is odd\n\tswitch b % 2 {\n\tcase 0:\n\t\t// nothing to do\n\tcase 1:\n\t\tz.exp++\n\tcase -1:\n\t\tz.exp--\n\t}\n\t// 0.01 <= z < 10.0\n\n\t// Unlike with big.Float, solving x² - z = 0 directly is faster only for\n\t// very small precisions (<_DW/2).\n\t//\n\t// Solve 1/x² - z = 0 instead.\n\tz.sqrtInverse(z)\n\n\t// restore precision and re-attach halved exponent\n\treturn z.SetMantExp(z, b/2)\n}", "func NewRat(a, b int64) *big.Rat", "func Num(x Value) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Num(x)\n}", "func (z *Float) Abs(x *Float) *Float {}", "func (x *Rat) Denom() *Int {}", "func (x *Rat) Cmp(y *Rat) int {}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func Shift(x Value, op token.Token, s uint) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tvx := v.Value\n\t\tval := constant.Val(vx)\n\t\tif rat, ok := val.(*big.Rat); ok && rat.IsInt() {\n\t\t\tvx = constant.Num(vx)\n\t\t}\n\t\tret := constant.Shift(vx, gotoken.Token(op), s)\n\t\treturn &ratVal{ret}\n\t}\n\treturn constant.Shift(x, gotoken.Token(op), s)\n}", "func (z *Float) SetFloat64(x float64) *Float {}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (z *Rat) Quo(x, y *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func Ring(r orb.Ring, z maptile.Zoom) (maptile.Set, error) {\n\tif len(r) == 0 {\n\t\treturn make(maptile.Set), nil\n\t}\n\n\treturn Polygon(orb.Polygon{r}, z)\n}", "func (x *Rat) RatString() string {}", "func Imag(x Value) Value {\n\tif _, ok := x.(*ratVal); ok {\n\t\treturn constant.MakeInt64(0)\n\t}\n\treturn constant.Imag(x)\n}", "func (v *value) set(val interface{}) Value {\n\tswitch val.(type) {\n\tcase int:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int64:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int64))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float64:\n\t\tv.valueType = Real\n\t\tfloatVal := val.(float64)\n\t\tv.real = floatVal\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(float32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase complex128:\n\t\tv.valueType = Complex\n\t\tcomplexVal := val.(complex128)\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tcase complex64:\n\t\tv.valueType = Complex\n\t\tcomplexVal := complex128(val.(complex64))\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tdefault:\n\t\treturn Zero()\n\t}\n\tv.precision = 1\n\treturn v\n}", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func (z *Float) Copy(x *Float) *Float {}", "func Ramp(x float64) float64 {\n\tif x < 0.0 {\n\t\treturn 0.0\n\t}\n\treturn x\n}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func Sqrt(x float64) float64 {\n z := 1.0;\n for i := 0; i < 10; i++ {\n fmt.Println(z)\n z -= (z*z - x) / (2*z)\n }\n return z\n}", "func ToRat(v Value) (Rat, error) {\n\tswitch v := v.(type) {\n\tcase Rat:\n\t\treturn v, nil\n\tcase String:\n\t\tr := big.Rat{}\n\t\t_, err := fmt.Sscanln(string(v), &r)\n\t\tif err != nil {\n\t\t\treturn Rat{}, fmt.Errorf(\"%s cannot be parsed as rat\", v.Repr())\n\t\t}\n\t\treturn Rat{&r}, nil\n\tdefault:\n\t\treturn Rat{}, errOnlyStrOrRat\n\t}\n}", "func Exp(o, z *big.Float) *big.Float {\n\tif o.Prec() == 0 {\n\t\to.SetPrec(z.Prec())\n\t}\n\tif z.Sign() == 0 {\n\t\treturn o.SetFloat64(1)\n\t}\n\tif z.IsInf() {\n\t\tif z.Sign() < 0 {\n\t\t\treturn o.Set(&gzero)\n\t\t}\n\t\treturn o.Set(z)\n\t}\n\n\tp := o\n\tif p == z {\n\t\t// We need z for Newton's algorithm, so ensure we don't overwrite it.\n\t\tp = new(big.Float).SetPrec(z.Prec())\n\t}\n\t// try to get initial estimate using IEEE-754 math\n\t// TODO: save work (and an import of math) by checking the exponent of z\n\tzf, _ := z.Float64()\n\tzf = math.Exp(zf)\n\tif math.IsInf(zf, 1) || zf == 0 {\n\t\t// too big or too small for IEEE-754 math,\n\t\t// perform argument reduction using\n\t\t// e^{2z} = (e^z)²\n\t\thalfZ := quicksh(new(big.Float), z, -1).SetPrec(p.Prec() + 64)\n\t\t// TODO: avoid recursion\n\t\thalfExp := Exp(halfZ, halfZ)\n\t\treturn p.Mul(halfExp, halfExp)\n\t}\n\t// we got a nice IEEE-754 estimate\n\tguess := big.NewFloat(zf)\n\n\t// f(t)/f'(t) = t*(log(t) - z)\n\tf := func(t *big.Float) *big.Float {\n\t\tp.Sub(Log(new(big.Float), t), z)\n\t\treturn p.Mul(p, t)\n\t}\n\n\tx := newton(f, guess, z.Prec()) // TODO: make newton operate in place\n\n\treturn o.Set(x)\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func r_mx(Hstar, fo float64) float64 {\n\treturn 1. / (Hstar/3000. + 100.*fo)\n}", "func (z *Int) Xor(x, y *Int) *Int {}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func ToRat(v Value) (Rat, error) {\n\tswitch v := v.(type) {\n\tcase Rat:\n\t\treturn v, nil\n\tcase String:\n\t\tr := big.Rat{}\n\t\t_, err := fmt.Sscanln(string(v), &r)\n\t\tif err != nil {\n\t\t\treturn Rat{}, fmt.Errorf(\"%s cannot be parsed as rat\", v.Repr())\n\t\t}\n\t\treturn Rat{&r}, nil\n\tdefault:\n\t\treturn Rat{}, ErrOnlyStrOrRat\n\t}\n}", "func Sqrt(x float64) float64 {\n\tz:=45.0\n\tfor ; z*z-x>0.0000001;{\n\t\tz -= (z*z - x) / (2*z)\n\t\tfmt.Println(z)\n\t}\n\treturn z\n}", "func Rz(obj SDF3, deg float64) SDF3 {\n\tm := RotateZ(DtoR(deg))\n\treturn Transform3D(obj, m)\n}", "func (k Keeper) GetRat(ctx sdk.Context, key string) sdk.Rat {\n\tr, err := k.paramsKeeper.Getter().GetRat(ctx, MakeFeeKey(key))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func ratScale(x *big.Rat, exp int) {\n\tif exp < 0 {\n\t\tx.Inv(x)\n\t\tratScale(x, -exp)\n\t\tx.Inv(x)\n\t\treturn\n\t}\n\tfor exp >= 9 {\n\t\tx.Quo(x, bigRatBillion)\n\t\texp -= 9\n\t}\n\tfor exp >= 1 {\n\t\tx.Quo(x, bigRatTen)\n\t\texp--\n\t}\n}", "func RatRatString(x *big.Rat,) string", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (z *Int) Abs(x *Int) *Int {}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func (o *Brent) Root(xa, xb float64) (res float64) {\n\n\t// basic variables and function evaluation\n\ta := xa // the last but one approximation\n\tb := xb // the last and the best approximation to the root\n\tc := a // the last but one or even earlier approximation than a that\n\tfa := o.ffcn(a)\n\tfb := o.ffcn(b)\n\to.NumFeval = 2\n\to.NumJeval = 0\n\tfc := fa\n\n\t// check input\n\tif fa*fb >= -MACHEPS {\n\t\tchk.Panic(\"root must be bracketed: xa=%g, xb=%g, fa=%g, fb=%b => fa * fb >= 0\", xa, xb, fa, fb)\n\t}\n\n\t// message\n\tif o.Verbose {\n\t\tio.Pf(\"%4s%23s%23s%23s\\n\", \"it\", \"x\", \"f(x)\", \"err\")\n\t\tio.Pf(\"%50s%23.1e\\n\", \"\", o.Tol)\n\t}\n\n\t// solve\n\tvar prevStep float64 // distance from the last but one to the last approximation\n\tvar tolAct float64 // actual tolerance\n\tvar p, q float64 // interpol. step is calculated in the form p/q (divisions are delayed)\n\tvar newStep float64 // step at this iteration\n\tvar t1, cb, t2 float64 // auxiliary variables\n\tfor o.NumIter = 0; o.NumIter < o.MaxIt; o.NumIter++ {\n\n\t\t// distance\n\t\tprevStep = b - a\n\n\t\t// swap data for b to be the best approximation\n\t\tif math.Abs(fc) < math.Abs(fb) {\n\t\t\ta = b\n\t\t\tb = c\n\t\t\tc = a\n\t\t\tfa = fb\n\t\t\tfb = fc\n\t\t\tfc = fa\n\t\t}\n\t\ttolAct = 2.0*MACHEPS*math.Abs(b) + o.Tol/2.0\n\t\tnewStep = (c - b) / 2.0\n\n\t\t// converged?\n\t\tif o.Verbose {\n\t\t\tio.Pf(\"%4d%23.15e%23.15e%23.15e\\n\", o.NumIter, b, fb, math.Abs(newStep))\n\t\t}\n\t\tif math.Abs(newStep) <= tolAct || fb == 0.0 {\n\t\t\treturn b\n\t\t}\n\n\t\t// decide if the interpolation can be tried\n\t\tif math.Abs(prevStep) >= tolAct && math.Abs(fa) > math.Abs(fb) {\n\t\t\t// if prev_step was large enough and was in true direction, interpolation may be tried\n\t\t\tcb = c - b\n\n\t\t\t// with two distinct points, linear interpolation must be applied\n\t\t\tif a == c {\n\t\t\t\tt1 = fb / fa\n\t\t\t\tp = cb * t1\n\t\t\t\tq = 1.0 - t1\n\n\t\t\t\t// otherwise, quadric inverse interpolation is applied\n\t\t\t} else {\n\t\t\t\tq = fa / fc\n\t\t\t\tt1 = fb / fc\n\t\t\t\tt2 = fb / fa\n\t\t\t\tp = t2 * (cb*q*(q-t1) - (b-a)*(t1-1.0))\n\t\t\t\tq = (q - 1.0) * (t1 - 1.0) * (t2 - 1.0)\n\t\t\t}\n\n\t\t\t// p was calculated with the opposite sign;\n\t\t\t// make p positive and assign possible minus to q\n\t\t\tif p > 0.0 {\n\t\t\t\tq = -q\n\t\t\t} else {\n\t\t\t\tp = -p\n\t\t\t}\n\n\t\t\t// if b+p/q falls in [b,c] and isn't too large, it is accepted\n\t\t\t// if p/q is too large then the bissection procedure can reduce [b,c] range to more extent\n\t\t\tif p < (0.75*cb*q-math.Abs(tolAct*q)/2.0) && p < math.Abs(prevStep*q/2.0) {\n\t\t\t\tnewStep = p / q\n\t\t\t}\n\t\t}\n\n\t\t// adjust the step to be not less than tolerance\n\t\tif math.Abs(newStep) < tolAct {\n\t\t\tif newStep > 0.0 {\n\t\t\t\tnewStep = tolAct\n\t\t\t} else {\n\t\t\t\tnewStep = -tolAct\n\t\t\t}\n\t\t}\n\n\t\t// save the previous approximation\n\t\ta = b\n\t\tfa = fb\n\n\t\t// do step to a new approximation\n\t\tb += newStep\n\t\tfb = o.ffcn(b)\n\t\to.NumFeval++\n\n\t\t// adjust c for it to have a sign opposite to that of b\n\t\tif (fb > 0.0 && fc > 0.0) || (fb < 0.0 && fc < 0.0) {\n\t\t\tc = a\n\t\t\tfc = fa\n\t\t}\n\t}\n\n\t// did not converge\n\tchk.Panic(\"fail to converge after %d iterations\", o.NumIter)\n\treturn\n}" ]
[ "0.73778707", "0.69831675", "0.6645377", "0.6643432", "0.66268605", "0.62313914", "0.62217724", "0.6084067", "0.60632914", "0.60306674", "0.6018063", "0.59181076", "0.583361", "0.57868797", "0.57140726", "0.5706987", "0.5666669", "0.56218916", "0.5596837", "0.5586031", "0.55401707", "0.5531846", "0.55180746", "0.55180746", "0.53598315", "0.5307447", "0.52826166", "0.52729005", "0.52609473", "0.52212024", "0.5175759", "0.51679045", "0.5083589", "0.5082803", "0.5078779", "0.50778544", "0.5070141", "0.5059504", "0.49634486", "0.49501857", "0.4930272", "0.4906906", "0.48774773", "0.48680145", "0.4855116", "0.4847051", "0.47729573", "0.4763738", "0.47390008", "0.472451", "0.47102723", "0.47069114", "0.46734557", "0.46501544", "0.4645773", "0.46389404", "0.46166936", "0.46130833", "0.46126506", "0.46080387", "0.45990646", "0.45775175", "0.4557036", "0.45525128", "0.4543711", "0.4530989", "0.45139277", "0.45102462", "0.45068496", "0.4502228", "0.4448175", "0.44106773", "0.4407447", "0.43950817", "0.4391514", "0.43880412", "0.43817812", "0.43807128", "0.43715292", "0.43535727", "0.4350549", "0.43387595", "0.43318677", "0.43208528", "0.432057", "0.43201113", "0.43169358", "0.43084115", "0.4293367", "0.42917952", "0.42703325", "0.42654166", "0.42540932", "0.425122", "0.42276397", "0.42013988", "0.41958466", "0.41880766", "0.41878125", "0.41863775" ]
0.6346912
5
Raw directly returns x's raw compact and unscaled values. Caveat emptor: Neither are guaranteed to be valid. Raw is intended to support missing functionality outside this package and generally should be avoided. Additionally, Raw is the only part of this package's API which is not guaranteed to remain stable. This means the function could change or disappear at any time, even across minor version numbers.
func Raw(x *Big) (*uint64, *big.Int) { return &x.compact, &x.unscaled }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Raw(s string) Value {\n\treturn quad.Raw(s)\n}", "func (n Number) Raw() interface{} {\n\treturn n.underlying()\n}", "func (v Value) Raw() string {\n\treturn string(v.input[v.start : v.start+v.size])\n}", "func (c Currency) Raw() int64 {\n\treturn c.m\n}", "func (vn VecN) Raw() []float64 {\n\treturn vn.vec\n}", "func (v Value) Raw() []byte {\n\treturn v.val\n}", "func (d *Dense) Raw() []float64 {\n\treturn d.data\n}", "func (b *Boolean) Raw() bool {\n\treturn b.value\n}", "func (n Nil) Raw() interface{} {\n\treturn nil\n}", "func (b Bool) Raw() interface{} {\n\treturn b.underlying()\n}", "func (s String) Raw() interface{} {\n\treturn s.underlying()\n}", "func (e Empty) Raw() interface{} {\n\treturn e.underlying()\n}", "func (rc *Ctx) Raw(body []byte) *RawResult {\n\treturn rc.RawWithContentType(http.DetectContentType(body), body)\n}", "func (er *Invalid) Raw() string {\n\treturn er.raw\n}", "func (s *GoRuntimeInfo) Raw() interface{} { s.doCollect(); return s }", "func (d *Data) Raw() []byte {\n\treturn d.buf\n}", "func (i ID) Raw() uint64 {\n\treturn uint64(i)\n}", "func (s *smlWriter) Raw(raw string) error {\n\ts.writeIndent(false)\n\ts.writer.WriteString(\"{! \")\n\ts.writer.WriteString(raw)\n\ts.writer.WriteString(\" !}\")\n\treturn nil\n}", "func (m Map) Raw() interface{} {\n\treturn m.Underlying()\n}", "func (bw *BufWriter) Raw(val []byte) {\n\tif bw.Error != nil {\n\t\treturn\n\t}\n\t_, bw.Error = bw.writer.Write(val)\n}", "func (c *CSC) RawMatrix() *blas.SparseMatrix {\n\treturn &c.matrix\n}", "func (p *TimePanel) Raw() [][][]float64 {\n\treturn p.values\n}", "func (d *Duration) Raw() time.Duration {\n\treturn d.Duration\n}", "func Raw(input mono.Mono) Mono {\n\treturn newProxy(input)\n}", "func (r *Forecast) Raw(raw io.Reader) *Forecast {\n\tr.raw = raw\n\n\treturn r\n}", "func (r Row) GetRaw(colIdx int) []byte {\n\treturn r.c.columns[colIdx].GetRaw(r.idx)\n}", "func (em *Empty) Raw() string {\n\treturn em.raw\n}", "func (r Result) Raw() ([]byte, error) {\n\treturn r.body, r.err\n}", "func (dt *DateTime) Raw() time.Time {\n\treturn dt.value\n}", "func (a *atom) Raw() string {\n\tif a == nil {\n\t\treturn \"\"\n\t}\n\treturn a.raw\n}", "func (bitmap *bitmap) RawString() string {\n\treturn string(bitmap.data)\n}", "func TestRaw(value []byte) optic.Raw {\n\tsource := \"test1\"\n\ttags := map[string]string{\"tag1\": \"value1\"}\n\tr, _ := raw.New(\n\t\tsource,\n\t\tvalue,\n\t\ttags,\n\t\tnil,\n\t)\n\treturn r\n}", "func (c *CSR) RawMatrix() *blas.SparseMatrix {\n\treturn &c.matrix\n}", "func (s *Stream) Raw() ([]byte, error) {\n\t// get the kind and size of encoded data s.r\n\tkind, size, err := s.Kind()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// if it is a single byte, the value is stored in s.byteval, therefore can be returned directly\n\tif kind == Byte {\n\t\ts.kind = -1 // re-initialize s.Kind\n\t\treturn []byte{s.byteval}, nil\n\t}\n\n\t// get the size of the string heads and make a byte slice with its' total length\n\t// which is data length + length of heads\n\tstart := headsize(size)\n\tbuf := make([]byte, uint64(start)+size)\n\n\t// stores the remaining data (data without headers) into buf\n\tif err := s.readFull(buf[start:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// based on data kind, place the headers in front of the buf\n\tif kind == String {\n\t\tputhead(buf, 0x80, 0xB7, size)\n\t} else {\n\t\tputhead(buf, 0xC0, 0xF7, size)\n\t}\n\treturn buf, nil\n}", "func (r *ExplainDataFrameAnalytics) Raw(raw io.Reader) *ExplainDataFrameAnalytics {\n\tr.raw = raw\n\n\treturn r\n}", "func (uu *UserUpdate) ClearRaw() *UserUpdate {\n\tuu.raw = nil\n\tuu.clearraw = true\n\treturn uu\n}", "func (uu *UserUpdate) ClearRaw() *UserUpdate {\n\tuu.raw = nil\n\tuu.clearraw = true\n\treturn uu\n}", "func (u *InputUnifi) RawMetrics(filter *poller.Filter) ([]byte, error) {\n\tif l := len(u.Controllers); filter.Unit >= l {\n\t\treturn nil, fmt.Errorf(\"%d controller(s) configured, '%d': %w\", l, filter.Unit, ErrControllerNumNotFound)\n\t}\n\n\tc := u.Controllers[filter.Unit]\n\tif u.isNill(c) {\n\t\tu.Logf(\"Re-authenticating to UniFi Controller: %s\", c.URL)\n\n\t\tif err := u.getUnifi(c); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"re-authenticating to %s: %w\", c.URL, err)\n\t\t}\n\t}\n\n\tif err := u.checkSites(c); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsites, err := u.getFilteredSites(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch filter.Kind {\n\tcase \"d\", \"device\", \"devices\":\n\t\treturn u.getSitesJSON(c, unifi.APIDevicePath, sites)\n\tcase \"client\", \"clients\", \"c\":\n\t\treturn u.getSitesJSON(c, unifi.APIClientPath, sites)\n\tcase \"other\", \"o\":\n\t\treturn c.Unifi.GetJSON(filter.Path)\n\tdefault:\n\t\treturn []byte{}, ErrNoFilterKindProvided\n\t}\n}", "func (o LookupGroupVariableResultOutput) Raw() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupGroupVariableResult) bool { return v.Raw }).(pulumi.BoolOutput)\n}", "func (n LightControl) Raw() []byte {\n\treturn []uint8{0xf0, 0x4d, 0x4c, 0x4e, 0x45, n.key, n.turnOn, 0x00, 0xf7}\n}", "func (m Cuepoint) Raw() []byte {\n\treturn (&metaMessage{\n\t\tTyp: byte(byteCuepoint),\n\t\tData: []byte(m),\n\t}).Bytes()\n}", "func GetRaw(keymr string) ([]byte, error) {\n\tparams := hashRequest{Hash: keymr}\n\treq := NewJSON2Request(\"raw-data\", APICounter(), params)\n\tresp, err := factomdRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error != nil {\n\t\treturn nil, resp.Error\n\t}\n\n\traw := new(RawData)\n\tif err := json.Unmarshal(resp.JSONResult(), raw); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn raw.GetDataBytes()\n}", "func (s *VCStore) Raw(id string) (string, error) {\n\treturn s.state.Raw(id)\n}", "func (s ACIFaultSeverityID) Raw() of.ACIFaultSeverityRaw {\n\tm := map[int]string{\n\t\t0: \"cleared\",\n\t\t1: \"info\",\n\t\t2: \"warning\",\n\t\t3: \"minor\",\n\t\t4: \"major\",\n\t\t5: \"critical\",\n\t}\n\tr := m[int(s.ofID)]\n\treturn of.ACIFaultSeverityRaw(r)\n}", "func (c *publicKey) Raw() ([]byte, error) {\n\tif c.ki == nil {\n\t\treturn nil, errors.ErrNilPointerValue()\n\t}\n\n\treturn c.ki.Raw()\n}", "func (ms Float64Slice) AsRaw() []float64 {\n\treturn copyFloat64Slice(nil, *ms.getOrig())\n}", "func (uuo *UserUpdateOne) SetRaw(jm json.RawMessage) *UserUpdateOne {\n\tuuo.raw = &jm\n\treturn uuo\n}", "func (uuo *UserUpdateOne) SetRaw(jm json.RawMessage) *UserUpdateOne {\n\tuuo.raw = &jm\n\treturn uuo\n}", "func (s *TokenStream) Raw() *TokenStream {\n\treturn &TokenStream{iter: s.iter.Raw()}\n}", "func (n NamespaceStar) Raw() string { return string(n) }", "func (t *Transaction) RawRepresentation() (*Data, error) {\n\tif err := t.RequiredFields(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch t.TransactionType() {\n\tcase TransactionTypeLegacy:\n\t\t// Legacy Transactions are RLP(Nonce, GasPrice, Gas, To, Value, Input, V, R, S)\n\t\tmessage := rlp.Value{List: []rlp.Value{\n\t\t\tt.Nonce.RLP(),\n\t\t\tt.GasPrice.RLP(),\n\t\t\tt.Gas.RLP(),\n\t\t\tt.To.RLP(),\n\t\t\tt.Value.RLP(),\n\t\t\t{String: t.Input.String()},\n\t\t\tt.V.RLP(),\n\t\t\tt.R.RLP(),\n\t\t\tt.S.RLP(),\n\t\t}}\n\t\tif encoded, err := message.Encode(); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn NewData(encoded)\n\t\t}\n\tcase TransactionTypeAccessList:\n\t\t// EIP-2930 Transactions are 0x1 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])\n\t\ttypePrefix, err := t.Type.RLP().Encode()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := rlp.Value{List: []rlp.Value{\n\t\t\tt.ChainId.RLP(),\n\t\t\tt.Nonce.RLP(),\n\t\t\tt.GasPrice.RLP(),\n\t\t\tt.Gas.RLP(),\n\t\t\tt.To.RLP(),\n\t\t\tt.Value.RLP(),\n\t\t\t{String: t.Input.String()},\n\t\t\tt.AccessList.RLP(),\n\t\t\tt.V.RLP(),\n\t\t\tt.R.RLP(),\n\t\t\tt.S.RLP(),\n\t\t}}\n\t\tif encodedPayload, err := payload.Encode(); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn NewData(typePrefix + encodedPayload[2:])\n\t\t}\n\tcase TransactionTypeDynamicFee:\n\t\t// We introduce a new EIP-2718 transaction type, with the format 0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, access_list, signatureYParity, signatureR, signatureS]).\n\t\ttypePrefix, err := t.Type.RLP().Encode()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := rlp.Value{List: []rlp.Value{\n\t\t\tt.ChainId.RLP(),\n\t\t\tt.Nonce.RLP(),\n\t\t\tt.MaxPriorityFeePerGas.RLP(),\n\t\t\tt.MaxFeePerGas.RLP(),\n\t\t\tt.Gas.RLP(),\n\t\t\tt.To.RLP(),\n\t\t\tt.Value.RLP(),\n\t\t\t{String: t.Input.String()},\n\t\t\tt.AccessList.RLP(),\n\t\t\tt.V.RLP(),\n\t\t\tt.R.RLP(),\n\t\t\tt.S.RLP(),\n\t\t}}\n\t\tif encodedPayload, err := payload.Encode(); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn NewData(typePrefix + encodedPayload[2:])\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported transaction type\")\n\t}\n}", "func (d Document) Raw() map[interface{}]interface{} { return d.raw }", "func (l List) Raw() interface{} {\n\treturn l.Underlying()\n}", "func LoadRawData(raw interface{}) (f Float64Data) {\n\tvar r []interface{}\n\tvar s Float64Data\n\n\tswitch t := raw.(type) {\n\tcase []interface{}:\n\t\tr = t\n\tcase []uint:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []uint8:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []uint16:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []uint32:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []uint64:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []bool:\n\t\tfor _, v := range t {\n\t\t\tif v == true {\n\t\t\t\ts = append(s, 1.0)\n\t\t\t} else {\n\t\t\t\ts = append(s, 0.0)\n\t\t\t}\n\t\t}\n\t\treturn s\n\tcase []float64:\n\t\treturn Float64Data(t)\n\tcase []int:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []int8:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []int16:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []int32:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []int64:\n\t\tfor _, v := range t {\n\t\t\ts = append(s, float64(v))\n\t\t}\n\t\treturn s\n\tcase []string:\n\t\tfor _, v := range t {\n\t\t\tr = append(r, v)\n\t\t}\n\tcase []time.Duration:\n\t\tfor _, v := range t {\n\t\t\tr = append(r, v)\n\t\t}\n\tcase map[int]int:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]int8:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]int16:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]int32:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]int64:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]string:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\tr = append(r, t[i])\n\t\t}\n\tcase map[int]uint:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]uint8:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]uint16:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]uint32:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]uint64:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, float64(t[i]))\n\t\t}\n\t\treturn s\n\tcase map[int]bool:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\tif t[i] == true {\n\t\t\t\ts = append(s, 1.0)\n\t\t\t} else {\n\t\t\t\ts = append(s, 0.0)\n\t\t\t}\n\t\t}\n\t\treturn s\n\tcase map[int]float64:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\ts = append(s, t[i])\n\t\t}\n\t\treturn s\n\tcase map[int]time.Duration:\n\t\tfor i := 0; i < len(t); i++ {\n\t\t\tr = append(r, t[i])\n\t\t}\n\t}\n\n\tfor _, v := range r {\n\t\tswitch t := v.(type) {\n\t\tcase int:\n\t\t\ta := float64(t)\n\t\t\tf = append(f, a)\n\t\tcase uint:\n\t\t\tf = append(f, float64(t))\n\t\tcase float64:\n\t\t\tf = append(f, t)\n\t\tcase string:\n\t\t\tfl, err := strconv.ParseFloat(t, 64)\n\t\t\tif err == nil {\n\t\t\t\tf = append(f, fl)\n\t\t\t}\n\t\tcase bool:\n\t\t\tif t == true {\n\t\t\t\tf = append(f, 1.0)\n\t\t\t} else {\n\t\t\t\tf = append(f, 0.0)\n\t\t\t}\n\t\tcase time.Duration:\n\t\t\tf = append(f, float64(t))\n\t\t}\n\t}\n\treturn f\n}", "func TestMakeRawMetric(t *testing.T) {\n\tprefix := \"serverStatus.transactions.\"\n\tname := \"retriedCommandsCount\"\n\ttestCases := []struct {\n\t\tvalue interface{}\n\t\twantVal *float64\n\t}{\n\t\t{value: true, wantVal: pointer.ToFloat64(1)},\n\t\t{value: false, wantVal: pointer.ToFloat64(0)},\n\t\t{value: int32(1), wantVal: pointer.ToFloat64(1)},\n\t\t{value: int64(2), wantVal: pointer.ToFloat64(2)},\n\t\t{value: float32(1.23), wantVal: pointer.ToFloat64(float64(float32(1.23)))},\n\t\t{value: float64(1.23), wantVal: pointer.ToFloat64(1.23)},\n\t\t{value: primitive.A{}, wantVal: nil},\n\t\t{value: primitive.Timestamp{}, wantVal: nil},\n\t\t{value: \"zapp\", wantVal: nil},\n\t\t{value: []byte{}, wantVal: nil},\n\t\t{value: time.Date(2020, 06, 15, 0, 0, 0, 0, time.UTC), wantVal: nil},\n\t}\n\n\tln := make([]string, 0) // needs pre-allocation to accomplish pre-allocation for labels\n\tlv := make([]string, 0)\n\n\tfqName := prometheusize(prefix + name)\n\thelp := metricHelp(prefix, name)\n\n\tfor _, tc := range testCases {\n\t\tvar want *rawMetric\n\t\tif tc.wantVal != nil {\n\t\t\twant = &rawMetric{\n\t\t\t\tfqName: fqName,\n\t\t\t\thelp: help,\n\t\t\t\tln: ln,\n\t\t\t\tlv: lv,\n\t\t\t\tval: *tc.wantVal,\n\t\t\t\tvt: 3,\n\t\t\t}\n\t\t}\n\n\t\tm, err := makeRawMetric(prefix, name, tc.value, nil)\n\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, want, m)\n\t}\n}", "func (uuo *UserUpdateOne) ClearRaw() *UserUpdateOne {\n\tuuo.raw = nil\n\tuuo.clearraw = true\n\treturn uuo\n}", "func (uuo *UserUpdateOne) ClearRaw() *UserUpdateOne {\n\tuuo.raw = nil\n\tuuo.clearraw = true\n\treturn uuo\n}", "func (o *RawProperty) GetRawData() []byte {\n\treturn o.Raw\n}", "func (p *ProcessInfo) Raw() any { p.Collect(); return p }", "func Raw(cmd string, options ...types.Option) (string, error) {\n\treturn command(context.Background(), cmd, options...)\n}", "func (m *Map) GetRaw(name string) (string, error) {\n\tkey, err := m.schema.getKey(name)\n\tif err != nil {\n\t\treturn \"\", errors.WithStack(err)\n\t}\n\tvalue, ok := m.values[name]\n\tif !ok {\n\t\tvalue = key.Default\n\t}\n\treturn value, nil\n}", "func Raw(b []byte) Field {\n\treturn func(p *Packet) error {\n\t\tif p.Len()+len(b) > MaxEIRPacketLength {\n\t\t\treturn ErrNotFit\n\t\t}\n\t\tp.b = append(p.b, b...)\n\t\treturn nil\n\t}\n}", "func (n TurnOn) Raw() []byte {\n\treturn n.data\n}", "func (r *Record) Raw() (sql.SelectObjectFormat, interface{}) {\n\treturn r.SelectFormat, r.KVS\n}", "func (c *Config) Raw() []byte {\n\tdata := (*configData)(atomic.LoadPointer(&c.data))\n\treturn data.raw\n}", "func (o *Author) SetRaw(v string) {\n\to.Raw = &v\n}", "func Raw_point() (Point) { \n\ttoken := make([]byte,32)\n\treturn Point{*big.NewInt(0),*big.NewInt(0),token}\n}", "func (s *InMemorySender) GetRaw() []interface{} {\n\tmsgs := s.Get()\n\traw := make([]interface{}, 0, len(msgs))\n\tfor _, msg := range msgs {\n\t\traw = append(raw, msg.Raw())\n\t}\n\treturn raw\n}", "func (uu *UserUpdate) SetRaw(jm json.RawMessage) *UserUpdate {\n\tuu.raw = &jm\n\treturn uu\n}", "func (uu *UserUpdate) SetRaw(jm json.RawMessage) *UserUpdate {\n\tuu.raw = &jm\n\treturn uu\n}", "func (r *Response) Raw() []byte {\n\treturn r.raw\n}", "func (addr *Sockaddr) Raw() []byte {\n\traw := addr.RawFixed()\n\treturn raw[:]\n}", "func (s *GenericStorage) RawStorage() RawStorage {\n\treturn s.raw\n}", "func (es Slice) AsRaw() []any {\n\trawSlice := make([]any, 0, es.Len())\n\tfor i := 0; i < es.Len(); i++ {\n\t\trawSlice = append(rawSlice, es.At(i).AsRaw())\n\t}\n\treturn rawSlice\n}", "func (m *Message) Raw() ([]byte, error) {\n\treturn json.Marshal(m)\n}", "func (q *QueryGoPg) Raw(dst interface{}, sql string, args ...interface{}) (err error) {\n\t_, err = goPgConnection.Query(dst, sql, args...)\n\treturn\n}", "func ReadRaw(in io.Reader) (Data, error) {\n\treturn read(in)\n}", "func (obj *GenericMeasure) GetInfoRaw(ctx context.Context) (json.RawMessage, error) {\n\tresult := &struct {\n\t\tInfo json.RawMessage `json:\"qInfo\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetInfo\", result)\n\treturn result.Info, err\n}", "func (ge *GollumEvent) Raw() Event {\n\treturn ge.raw\n}", "func (s SequencerData) Raw() []byte {\n\treturn (&metaMessage{\n\t\tTyp: byteSequencerSpecific,\n\t\tData: s.Data(),\n\t}).Bytes()\n}", "func (t *Token) Raw() []byte {\n\treturn t.raw\n}", "func (this *metaUsbSvc) Raw() (*peripheral.Usb) {\n\treturn this.Usb\n}", "func (daemon *Daemon) RawSysInfo() *sysinfo.SysInfo {\n\tdaemon.sysInfoOnce.Do(func() {\n\t\t// We check if sysInfo is not set here, to allow some test to\n\t\t// override the actual sysInfo.\n\t\tif daemon.sysInfo == nil {\n\t\t\tdaemon.sysInfo = getSysInfo(&daemon.config().Config)\n\t\t}\n\t})\n\n\treturn daemon.sysInfo\n}", "func (g String) Raw() String {\n\tstr := g.String()\n\tres := strings.TrimPrefix(str, \"g.\")\n\tcmd := NewCustomTraversal(res)\n\treturn cmd\n}", "func (config *Config) GetRaw() map[string]interface{} {\n\treturn config.data\n}", "func (feature Feature) RawField(index int) Field {\n\tfield := C.OGR_F_GetRawFieldRef(feature.cval, C.int(index))\n\treturn Field{field}\n}", "func (c *Client) Raw() interface{} {\n\treturn c.c.Client()\n}", "func (n *nullCache) GetRaw(key []byte) (value []byte, found bool) {\n\treturn []byte{}, false\n}", "func (addr *Sockaddr) RawFixed() (raw [18]byte) {\n\taddr.Write(raw[:])\n\treturn\n}", "func (c ColorOrder) RawPixel(r, g, b byte) Pixel {\n\tswitch c {\n\tcase RGB:\n\t\treturn Pixel{[8]byte{\n\t\t\tzero &^ (r>>7&1 | r>>3&8 | r<<1&0x40),\n\t\t\tzero &^ (r>>4&1 | r>>0&8 | r<<4&0x40),\n\t\t\tzero &^ (r>>1&1 | r<<3&8 | g>>1&0x40),\n\t\t\tzero &^ (g>>6&1 | g>>2&8 | g<<2&0x40),\n\t\t\tzero &^ (g>>3&1 | g<<1&8 | g<<5&0x40),\n\t\t\tzero &^ (g>>0&1 | b>>4&8 | b>>0&0x40),\n\t\t\tzero &^ (b>>5&1 | b>>1&8 | b<<3&0x40),\n\t\t\tzero &^ (b>>2&1 | b<<2&8 | b<<6&0x40),\n\t\t}}\n\tcase GRB:\n\t\treturn Pixel{[8]byte{\n\t\t\tzero &^ (g>>7&1 | g>>3&8 | g<<1&0x40),\n\t\t\tzero &^ (g>>4&1 | g>>0&8 | g<<4&0x40),\n\t\t\tzero &^ (g>>1&1 | g<<3&8 | r>>1&0x40),\n\t\t\tzero &^ (r>>6&1 | r>>2&8 | r<<2&0x40),\n\t\t\tzero &^ (r>>3&1 | r<<1&8 | r<<5&0x40),\n\t\t\tzero &^ (r>>0&1 | b>>4&8 | b>>0&0x40),\n\t\t\tzero &^ (b>>5&1 | b>>1&8 | b<<3&0x40),\n\t\t\tzero &^ (b>>2&1 | b<<2&8 | b<<6&0x40),\n\t\t}}\n\t}\n\treturn Pixel{}\n}", "func (o *RawProperty) SetRawData(data []byte) error {\n\to.Raw = data\n\treturn nil\n}", "func StripRaw(text string) string {\n\ttext = reStripColor.ReplaceAllString(text, \"\")\n\n\tfor _, code := range fmtCodes {\n\t\ttext = strings.ReplaceAll(text, code, \"\")\n\t}\n\n\treturn text\n}", "func (obj *GenericMeasure) GetMeasureRaw(ctx context.Context) (json.RawMessage, error) {\n\tresult := &struct {\n\t\tMeasure json.RawMessage `json:\"qMeasure\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetMeasure\", result)\n\treturn result.Measure, err\n}", "func (r *Response) Raw() *http.Response {\n\treturn r.httpResp\n}", "func (i ID) Raw() string {\n\treturn string(i)\n}", "func NewRaw(id, netID string, args ...string) *CmdMsg {\n\tcmd := NewCmd(id, \"raw\", args...)\n\tcmd.Network.Init(netID, \"net\")\n\treturn cmd\n}", "func (n NamespaceNode) Raw() string { return string(n) }", "func (r *Search) Raw(raw io.Reader) *Search {\n\tr.raw = raw\n\n\treturn r\n}", "func (c *Client) QueryRaw(\n\tctx context.Context,\n\tq query.UnparsedRawQuery,\n) (*query.RawQueryResults, error) {\n\tcallStart := c.nowFn()\n\n\tpbRawQuery, err := q.ToProto()\n\tif err != nil {\n\t\tc.metrics.queryRaw.ReportError(c.nowFn().Sub(callStart))\n\t\treturn nil, err\n\t}\n\n\tctx, cancelFn := context.WithTimeout(ctx, c.readTimeout)\n\tdefer cancelFn()\n\n\tpbRes, err := c.client.QueryRaw(ctx, pbRawQuery)\n\tif err != nil {\n\t\tc.metrics.queryRaw.ReportError(c.nowFn().Sub(callStart))\n\t\treturn nil, err\n\t}\n\n\tres, err := query.NewRawQueryResultsFromProto(pbRes)\n\tif err != nil {\n\t\tc.metrics.queryRaw.ReportError(c.nowFn().Sub(callStart))\n\t\treturn nil, err\n\t}\n\n\tc.metrics.queryRaw.ReportSuccess(c.nowFn().Sub(callStart))\n\treturn res, nil\n}", "func (b *BlankLine) Raw() []byte {\n\treturn b.NLCode\n}" ]
[ "0.64168406", "0.6339452", "0.6237392", "0.62326294", "0.6208013", "0.61576927", "0.60795105", "0.5818222", "0.5796609", "0.57943225", "0.57940865", "0.5776874", "0.5748706", "0.5735411", "0.5699503", "0.56879514", "0.5656565", "0.56269664", "0.5605789", "0.5553578", "0.55297154", "0.5516349", "0.5505627", "0.5463511", "0.5456493", "0.54334253", "0.54281485", "0.54225147", "0.54001355", "0.53759474", "0.5366445", "0.5333782", "0.5319491", "0.5310415", "0.5309104", "0.5307837", "0.5307837", "0.5300044", "0.5293008", "0.52911884", "0.5284044", "0.52702624", "0.5236172", "0.52299327", "0.5225133", "0.52114785", "0.5169848", "0.5169848", "0.5138735", "0.5121572", "0.51125014", "0.5072724", "0.5069063", "0.50656945", "0.505066", "0.50258285", "0.50258285", "0.5025358", "0.500541", "0.49989384", "0.49944836", "0.49923202", "0.49892235", "0.4979798", "0.49761474", "0.49749425", "0.49690363", "0.4968465", "0.496777", "0.496777", "0.49610716", "0.49608755", "0.49584883", "0.4953059", "0.49464828", "0.49381354", "0.49341282", "0.4922144", "0.4919316", "0.4916573", "0.49041855", "0.4883049", "0.48747322", "0.48682678", "0.48612353", "0.48574138", "0.48544547", "0.48528287", "0.484584", "0.4832191", "0.48286036", "0.48262334", "0.48217344", "0.48195216", "0.48164546", "0.48118654", "0.48063612", "0.4800577", "0.47853956", "0.47851628" ]
0.69487935
0
Reduce reduces a finite z to its most simplest form.
func (z *Big) Reduce() *Big { return z.Context.Reduce(z) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func VREDUCESS_Z(i, mx, x, k, x1 operand.Op) { ctx.VREDUCESS_Z(i, mx, x, k, x1) }", "func VREDUCESD_Z(i, mx, x, k, x1 operand.Op) { ctx.VREDUCESD_Z(i, mx, x, k, x1) }", "func VREDUCEPS_Z(i, mxyz, k, xyz operand.Op) { ctx.VREDUCEPS_Z(i, mxyz, k, xyz) }", "func VREDUCEPD_Z(i, mxyz, k, xyz operand.Op) { ctx.VREDUCEPD_Z(i, mxyz, k, xyz) }", "func (v Vector) Z() float64 {\n\treturn v[2]\n}", "func (v Vec3) ByZ() Vec2 {\n\tf := 1.0 / v[2]\n\treturn Vec2{f * v[0], f * v[1]}\n}", "func (c *Context) VREDUCESS_Z(i, mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VREDUCESS_Z(i, mx, x, k, x1))\n}", "func (c *Context) VPMAXUW_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUW_Z(mxyz, xyz, k, xyz1))\n}", "func (c *Context) VREDUCEPS_Z(i, mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VREDUCEPS_Z(i, mxyz, k, xyz))\n}", "func (v Vector) reduce() Vector {\n\tret := v.clone()\n\tfor n, d := range ret.data {\n\t\tif d == 0 {\n\t\t\tdelete(ret.data, n)\n\t\t}\n\t}\n\n\treturn ret\n}", "func getLanczosSum(fZ float64) float64 {\n\tnum := []float64{\n\t\t23531376880.41075968857200767445163675473,\n\t\t42919803642.64909876895789904700198885093,\n\t\t35711959237.35566804944018545154716670596,\n\t\t17921034426.03720969991975575445893111267,\n\t\t6039542586.35202800506429164430729792107,\n\t\t1439720407.311721673663223072794912393972,\n\t\t248874557.8620541565114603864132294232163,\n\t\t31426415.58540019438061423162831820536287,\n\t\t2876370.628935372441225409051620849613599,\n\t\t186056.2653952234950402949897160456992822,\n\t\t8071.672002365816210638002902272250613822,\n\t\t210.8242777515793458725097339207133627117,\n\t\t2.506628274631000270164908177133837338626,\n\t}\n\tdenom := []float64{\n\t\t0,\n\t\t39916800,\n\t\t120543840,\n\t\t150917976,\n\t\t105258076,\n\t\t45995730,\n\t\t13339535,\n\t\t2637558,\n\t\t357423,\n\t\t32670,\n\t\t1925,\n\t\t66,\n\t\t1,\n\t}\n\tvar sumNum, sumDenom, zInv float64\n\tif fZ <= 1 {\n\t\tsumNum = num[12]\n\t\tsumDenom = denom[12]\n\t\tfor i := 11; i >= 0; i-- {\n\t\t\tsumNum *= fZ\n\t\t\tsumNum += num[i]\n\t\t\tsumDenom *= fZ\n\t\t\tsumDenom += denom[i]\n\t\t}\n\t} else {\n\t\tzInv = 1 / fZ\n\t\tsumNum = num[0]\n\t\tsumDenom = denom[0]\n\t\tfor i := 1; i <= 12; i++ {\n\t\t\tsumNum *= zInv\n\t\t\tsumNum += num[i]\n\t\t\tsumDenom *= zInv\n\t\t\tsumDenom += denom[i]\n\t\t}\n\t}\n\treturn sumNum / sumDenom\n}", "func VPMAXUW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUW_Z(mxyz, xyz, k, xyz1) }", "func TrapzF(x []float64, y Cb_yx) (A float64) {\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y(x[i]) + y(x[i-1])) / 2.0\n\t}\n\treturn A\n}", "func Z(f L) L {\n\thelp := func(x L) L {\n\t\treturn f(func(v L) L {\n\t\t\treturn x(x)(v)\n\t\t})\n\t}\n\treturn help(help)\n}", "func lorentzFactor(v float64) float64 {\n\n\t// ensure that the velocity is not equal to c\n\tif v == c {\n\t\treturn 0.0\n\t}\n\n\t// determine the square factor\n\tsquareFactor := 1 - ((v * v) / (c * c))\n\n\t// take the square root of the factor\n\tsqrtFactor := math.Sqrt(squareFactor)\n\n\t// safety check, ensure that that factor is not zero\n\tif sqrtFactor == 0.0 {\n\t\treturn 0.0\n\t}\n\n\t// go ahead and return the inverse square root\n\treturn 1 / sqrtFactor\n}", "func Z(s seq.Sequence, start, end int) (cz float64, err error) {\n\tif start < s.Start() || end > s.End() {\n\t\terr = fmt.Errorf(\"complex: index out of range\")\n\t\treturn\n\t}\n\tif start == end {\n\t\treturn 0, nil\n\t}\n\n\tbc := new(byteCounter)\n\tz := zlib.NewWriter(bc)\n\tdefer z.Close()\n\tit := s.Alphabet().LetterIndex()\n\tvar N float64\n\tfor i := start; i < end; i++ {\n\t\tif b := byte(s.At(i).L); it[b] >= 0 {\n\t\t\tN++\n\t\t\tz.Write([]byte{b})\n\t\t}\n\t}\n\tz.Close()\n\n\tcz = (float64(*bc - overhead)) / N\n\n\treturn\n}", "func (v Vec3) DropZ() Vec2 {\n\treturn Vec2{v[0], v[1]}\n}", "func (c *Context) VREDUCEPD_Z(i, mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VREDUCEPD_Z(i, mxyz, k, xyz))\n}", "func Sqr(z, x *Elt)", "func (c *Context) VREDUCESD_Z(i, mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VREDUCESD_Z(i, mx, x, k, x1))\n}", "func (v Var) Reduce() Expression { return v }", "func Trapz(x, y []float64) (A float64) {\n\tif len(x) != len(y) {\n\t\tchk.Panic(\"length of x and y must be the same. %d != %d\", len(x), len(y))\n\t}\n\tfor i := 1; i < len(x); i++ {\n\t\tA += (x[i] - x[i-1]) * (y[i] + y[i-1]) / 2.0\n\t}\n\treturn\n}", "func (f Frac) Reduce() Frac {\n\tif f.n == 0 {\n\t\treturn Frac{n: 0, d: 1}\n\t}\n\n\td := gcd(f.n, f.d)\n\n\tf1 := Frac{n: f.n / d, d: f.d / d}\n\n\tf1.normalizeSignage()\n\n\treturn f1\n}", "func SimplifyFactorization(f Factorization) Factorization {\n\toccuringPrimes := FindOccuringPrimes(f)\n\tsortedPrimes := Sort(occuringPrimes)\n\tsimplifiedF := CompactFactorization(sortedPrimes, f)\n\n\treturn simplifiedF\n}", "func (c *Context) VPMAXUD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUD_Z(mxyz, xyz, k, xyz1))\n}", "func Relu(z float64) float64 {\n\t// 1 / 1 + e^(-z)\n\tresult := math.Max(z, 0)\n\treturn result\n}", "func StoZ(s *mat.CMatrix, z0 *mat.CVector) *mat.CMatrix {\n\tvar err error\n\n\tz := s.DeepCopy()\n\tzinv := s.DeepCopy()\n\tztmp := s.DeepCopy()\n\n\t// Generate sqrt(Z0) matrix and identity matrix for calculation\n\tsqz0 := cmf(z0.Size, z0.Size, opts)\n\tfor i, val := range z0.Data {\n\t\tsqz0.Set(i, i, cmplx.Sqrt(val))\n\t}\n\tid := cmf(s.Rows, s.Cols, s.Opts)\n\tgolapack.Zlaset(mat.Full, s.Rows, s.Cols, 0, 1, id)\n\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, s.Rows, s.Cols, s.Cols, 1, id, id, 1, z); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, s.Rows, s.Cols, s.Cols, 1, id, id, -1, zinv); err != nil {\n\t\tpanic(err)\n\t}\n\n\tcmatInv(zinv)\n\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, s.Rows, s.Cols, s.Cols, 1, sqz0, zinv, 0, ztmp); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, s.Rows, s.Cols, s.Cols, 1, ztmp, z, 0, zinv); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, s.Rows, s.Cols, s.Cols, 1, zinv, sqz0, 0, s); err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn s\n}", "func (w *QWriter) UZ(z []byte) {\n\tw.U(unsafeBytesToStr(z))\n}", "func VPMAXUD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUD_Z(mxyz, xyz, k, xyz1) }", "func VPMAXSW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXSW_Z(mxyz, xyz, k, xyz1) }", "func bzReduce(combine bzConsumer, start float64, L, d int, fn BzFunc) float64 {\n\tpoints := bzPoints(L, d)\n\ttotal := start\n\tfor i := 0; i < len(points); i++ {\n\t\tk := points[i]\n\t\ttotal = combine(fn(k), total)\n\t}\n\treturn total\n}", "func (expr *ExprZExt) Simplify() Constant {\n\tpanic(\"not yet implemented\")\n}", "func computeZ(featurizedInput, feature []float64, b float64, sqrt2OverD float64) float64 {\n\tdot := floats.Dot(featurizedInput, feature)\n\treturn sqrt2OverD * (math.Cos(dot + b))\n}", "func (v Volume) Zepolitres() float64 {\n\treturn float64(v / Zepolitre)\n}", "func Selectznz(out1 *[4]uint64, arg1 uint1, arg2 *[4]uint64, arg3 *[4]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tvar x4 uint64\n\tcmovznzU64(&x4, arg1, arg2[3], arg3[3])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n\tout1[3] = x4\n}", "func (z *Float64) Unreal() float64 {\n\treturn z.r\n}", "func CLZ(x int64) (n int)", "func affinize(points []*G1) {\n\tif len(points) == 0 {\n\t\treturn\n\t}\n\tws := make([]ff.Fp, len(points)+1)\n\tws[0].SetOne()\n\tfor i := 0; i < len(points); i++ {\n\t\tws[i+1].Mul(&ws[i], &points[i].z)\n\t}\n\n\tw := &ff.Fp{}\n\tw.Inv(&ws[len(points)])\n\n\tzinv := &ff.Fp{}\n\tfor i := len(points) - 1; i >= 0; i-- {\n\t\tzinv.Mul(w, &ws[i])\n\t\tw.Mul(w, &points[i].z)\n\n\t\tpoints[i].x.Mul(&points[i].x, zinv)\n\t\tpoints[i].y.Mul(&points[i].y, zinv)\n\t\tpoints[i].z.SetOne()\n\t}\n}", "func ZtoS(z *mat.CMatrix, z0 *mat.CVector) *mat.CMatrix {\n\tvar err error\n\n\tzinv := z.DeepCopy()\n\tztmp := z.DeepCopy()\n\tzwrk := z.DeepCopy()\n\n\t// Generate sqrt(Z0) matrix and identity matrix for calculation\n\tsqy0 := cmf(z0.Size, z0.Size, opts)\n\tfor i, val := range z0.Data {\n\t\tsqy0.Set(i, i, cmplx.Sqrt(1/val))\n\t}\n\tgolapack.Zlaset(mat.Full, z.Rows, z.Cols, 0, 1, ztmp)\n\tgolapack.Zlaset(mat.Full, z.Rows, z.Cols, 0, 1, zinv)\n\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, z.Rows, z.Cols, z.Cols, 1, sqy0, z, 0, zwrk); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, z.Rows, z.Cols, z.Cols, 1, zwrk, sqy0, -1, ztmp); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, z.Rows, z.Cols, z.Cols, 1, sqy0, z, 0, zwrk); err != nil {\n\t\tpanic(err)\n\t}\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, z.Rows, z.Cols, z.Cols, 1, zwrk, sqy0, 1, zinv); err != nil {\n\t\tpanic(err)\n\t}\n\n\tcmatInv(zinv)\n\n\tif err = goblas.Zgemm(mat.NoTrans, mat.NoTrans, z.Rows, z.Cols, z.Cols, 1, ztmp, zinv, 0, z); err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn z\n}", "func (s scope) Reduce() Expression { return s }", "func Selectznz(out1 *[3]uint64, arg1 uint1, arg2 *[3]uint64, arg3 *[3]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n}", "func VPMAXUB_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXUB_Z(mxyz, xyz, k, xyz1) }", "func CollatzConjecture(input int) (int, error) {\n\tvar steps int = 0\n\tif input < 1 {\n\t\treturn 0, errors.New(\"Input must be positive integer\")\n\t}\n\tfor input != 1 {\n\t\tif input%2 == 0 {\n\t\t\tinput = input / 2\n\t\t\tsteps++\n\n\t\t} else {\n\t\t\tinput = (input * 3) + 1\n\t\t\tsteps++\n\t\t}\n\t}\n\treturn steps, nil\n}", "func VREDUCEPD_BCST_Z(i, m, k, xyz operand.Op) { ctx.VREDUCEPD_BCST_Z(i, m, k, xyz) }", "func remez(des, grid, bands, wt []float64, ngrid int, iext []int, alpha []float64, nfcns, itrmax int, dimsize int) (float64, error) {\n\ta := make([]float64, dimsize+1)\n\tp := make([]float64, dimsize+1)\n\tq := make([]float64, dimsize+1)\n\tad := make([]float64, dimsize+1)\n\tx := make([]float64, dimsize+1)\n\ty := make([]float64, dimsize+1)\n\n\tdevl := -1.0\n\tnz := nfcns + 1\n\tnzz := nfcns + 2\n\n\tvar comp, dev, y1 float64\n\nIterationLoop:\n\tfor niter := 0; niter <= itrmax; niter++ {\n\t\tif niter == itrmax {\n\t\t\treturn dev, errors.New(\"remez: reached max iterations\")\n\t\t}\n\n\t\tiext[nzz] = ngrid + 1\n\n\t\tfor j := 1; j <= nz; j++ {\n\t\t\tx[j] = math.Cos(grid[iext[j]] * pi2)\n\t\t}\n\n\t\tjet := (nfcns-1)/15 + 1\n\t\tfor j := 1; j <= nz; j++ {\n\t\t\tad[j] = lagrangeInterp(j, nz, jet, x)\n\t\t}\n\n\t\tdnum, dden := 0.0, 0.0\n\t\tfor j, k := 1, 1.0; j <= nz; j, k = j+1, -k {\n\t\t\tl := iext[j]\n\t\t\tdnum += ad[j] * des[l]\n\t\t\tdden += k * ad[j] / wt[l]\n\t\t}\n\t\tdev = dnum / dden\n\n\t\t/* printf(\"DEVIATION = %lg\\n\",*dev); */\n\n\t\tnu := 1.0\n\t\tif dev > 0.0 {\n\t\t\tnu = -1.0\n\t\t}\n\t\tdev = math.Abs(dev) // dev = -nu * dev\n\t\tfor j, k := 1, nu; j <= nz; j, k = j+1, -k {\n\t\t\tl := iext[j]\n\t\t\ty[j] = des[l] + k*dev/wt[l]\n\t\t}\n\t\tif dev <= devl {\n\t\t\t/* finished */\n\t\t\treturn dev, errors.New(\"remez: deviation decreased\")\n\t\t}\n\t\tdevl = dev\n\n\t\tjchnge := 0\n\t\tk1 := iext[1]\n\t\tknz := iext[nz]\n\t\tklow := 0\n\t\tnut := -nu\n\n\t\tdown := func(l, j int) {\n\t\t\tfor {\n\t\t\t\tl--\n\t\t\t\tif l <= klow {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp <= 0.0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcomp = nut * e\n\t\t\t}\n\t\t\tklow = iext[j]\n\t\t\tiext[j] = l + 1\n\t\t\tjchnge++\n\t\t}\n\n\t\tup := func(l, j, kup int) {\n\t\t\tfor {\n\t\t\t\tl++\n\t\t\t\tif l >= kup {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp <= 0.0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcomp = nut * e\n\t\t\t}\n\t\t\tiext[j] = l - 1\n\t\t\tklow = l - 1\n\t\t\tjchnge++\n\t\t}\n\n\t\t/*\n\t\t * SEARCH FOR THE EXTREMAL FREQUENCIES OF THE BEST APPROXIMATION\n\t\t */\n\n\t\tfor j := 1; j < nzz; j++ {\n\t\t\tkup := iext[j+1]\n\t\t\tnut = -nut\n\t\t\tif j == 2 {\n\t\t\t\ty1 = comp\n\t\t\t}\n\t\t\tcomp = dev\n\n\t\t\tl := iext[j] + 1\n\t\t\tif l < kup {\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\tcomp = nut * e\n\t\t\t\t\tup(l, j, kup)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tl--\n\n\t\t\tfor {\n\t\t\t\tl--\n\t\t\t\tif l <= klow {\n\t\t\t\t\tl = iext[j] + 1\n\t\t\t\t\tif jchnge > 0 {\n\t\t\t\t\t\tiext[j] = l - 1\n\t\t\t\t\t\tklow = l - 1\n\t\t\t\t\t\tjchnge++\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor {\n\t\t\t\t\t\t\tl++\n\t\t\t\t\t\t\tif l >= kup {\n\t\t\t\t\t\t\t\tklow = iext[j]\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\t\t\t\tcomp = nut * e\n\t\t\t\t\t\t\t\tup(l, j, kup)\n\t\t\t\t\t\t\t\tbreak\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\tbreak\n\t\t\t\t}\n\t\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\t\tcomp = nut * e\n\t\t\t\t\tdown(l, j)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif jchnge > 0 {\n\t\t\t\t\tklow = iext[j]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif k1 > iext[1] {\n\t\t\tk1 = iext[1]\n\t\t}\n\t\tif knz < iext[nz] {\n\t\t\tknz = iext[nz]\n\t\t}\n\n\t\tluck := 6\n\t\tnut1 := nut\n\t\tnut = -nu\n\t\tcomp *= 1.00001\n\t\tj := nzz\n\n\t\tfor l := 1; l < k1; l++ {\n\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\tcomp = nut * e\n\t\t\t\tup(l, j, k1)\n\t\t\t\tj = nzz + 1\n\t\t\t\tluck = 1\n\n\t\t\t\tif comp > y1 {\n\t\t\t\t\ty1 = comp\n\t\t\t\t}\n\t\t\t\tk1 = iext[nzz]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tklow = knz\n\t\tnut = -nut1\n\t\tcomp = y1 * 1.00001\n\n\t\tfor l := ngrid; l > klow; l-- {\n\t\t\te := (freqEval(l, nz, grid, x, y, ad) - des[l]) * wt[l]\n\t\t\tif nut*e-comp > 0.0 {\n\t\t\t\tcomp = nut * e\n\t\t\t\tdown(l, j)\n\n\t\t\t\tkn := iext[nzz]\n\t\t\t\tfor i := 1; i <= nfcns; i++ {\n\t\t\t\t\tiext[i] = iext[i+1]\n\t\t\t\t}\n\t\t\t\tiext[nz] = kn\n\t\t\t\tcontinue IterationLoop\n\t\t\t}\n\t\t}\n\n\t\tif luck != 6 {\n\t\t\tfor i := 1; i <= nfcns; i++ {\n\t\t\t\tiext[nzz-i] = iext[nz-i]\n\t\t\t}\n\t\t\tiext[1] = k1\n\t\t} else if jchnge <= 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t/*\n\t * CALCULATION OF THE COEFFICIENTS OF THE BEST APPROXIMATION\n\t * USING THE INVERSE DISCRETE FOURIER TRANSFORM\n\t */\n\tnm1 := nfcns - 1\n\tfsh := 1.0e-06\n\tgtemp := grid[1]\n\tx[nzz] = -2.0\n\tcn := float64(2*nfcns - 1)\n\tdelf := 1.0 / cn\n\tl := 1\n\tkkk := 0\n\n\tif bands[0] == 0.0 && bands[len(bands)-1] == 0.5 {\n\t\tkkk = 1\n\t}\n\n\tif nfcns <= 3 {\n\t\tkkk = 1\n\t}\n\n\tvar aa, bb float64\n\tif kkk != 1 {\n\t\tdtemp := math.Cos(pi2 * grid[1])\n\t\tdnum := math.Cos(pi2 * grid[ngrid])\n\t\taa = 2.0 / (dtemp - dnum)\n\t\tbb = -(dtemp + dnum) / (dtemp - dnum)\n\t}\n\n\tfor j := 1; j <= nfcns; j++ {\n\t\tft := float64(j-1) * delf\n\t\txt := math.Cos(pi2 * ft)\n\t\tif kkk != 1 {\n\t\t\txt = (xt - bb) / aa\n\t\t\t// /*XX* ckeck up !! */\n\t\t\t// xt1 = sqrt(1.0-xt*xt);\n\t\t\t// ft = atan2(xt1,xt)/pi2;\n\n\t\t\tft = math.Acos(xt) / pi2\n\t\t}\n\t\tfor {\n\t\t\txe := x[l]\n\t\t\tif xt > xe {\n\t\t\t\tif (xt - xe) < fsh {\n\t\t\t\t\ta[j] = y[l]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tgrid[1] = ft\n\t\t\t\ta[j] = freqEval(1, nz, grid, x, y, ad)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (xe - xt) < fsh {\n\t\t\t\ta[j] = y[l]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tl++\n\t\t}\n\t\tif l > 1 {\n\t\t\tl = l - 1\n\t\t}\n\t}\n\n\tgrid[1] = gtemp\n\tdden := pi2 / cn\n\tfor j := 1; j <= nfcns; j++ {\n\t\tdtemp := 0.0\n\t\tdnum := float64(j-1) * dden\n\t\tif nm1 >= 1 {\n\t\t\tfor k := 1; k <= nm1; k++ {\n\t\t\t\tdtemp += a[k+1] * math.Cos(dnum*float64(k))\n\t\t\t}\n\t\t}\n\t\talpha[j] = 2.0*dtemp + a[1]\n\t}\n\n\tfor j := 2; j <= nfcns; j++ {\n\t\talpha[j] *= 2.0 / cn\n\t}\n\talpha[1] /= cn\n\n\tif kkk != 1 {\n\t\tp[1] = 2.0*alpha[nfcns]*bb + alpha[nm1]\n\t\tp[2] = 2.0 * aa * alpha[nfcns]\n\t\tq[1] = alpha[nfcns-2] - alpha[nfcns]\n\t\tfor j := 2; j <= nm1; j++ {\n\t\t\tif j >= nm1 {\n\t\t\t\taa *= 0.5\n\t\t\t\tbb *= 0.5\n\t\t\t}\n\t\t\tp[j+1] = 0.0\n\t\t\tfor k := 1; k <= j; k++ {\n\t\t\t\ta[k] = p[k]\n\t\t\t\tp[k] = 2.0 * bb * a[k]\n\t\t\t}\n\t\t\tp[2] += a[1] * 2.0 * aa\n\t\t\tfor k := 1; k <= j-1; k++ {\n\t\t\t\tp[k] += q[k] + aa*a[k+1]\n\t\t\t}\n\t\t\tfor k := 3; k <= j+1; k++ {\n\t\t\t\tp[k] += aa * a[k-1]\n\t\t\t}\n\n\t\t\tif j != nm1 {\n\t\t\t\tfor k := 1; k <= j; k++ {\n\t\t\t\t\tq[k] = -a[k]\n\t\t\t\t}\n\t\t\t\tq[1] += alpha[nfcns-1-j]\n\t\t\t}\n\t\t}\n\t\tfor j := 1; j <= nfcns; j++ {\n\t\t\talpha[j] = p[j]\n\t\t}\n\t}\n\n\tif nfcns <= 3 {\n\t\talpha[nfcns+1] = 0.0\n\t\talpha[nfcns+2] = 0.0\n\t}\n\treturn dev, nil\n}", "func (p *Poly) reduce() {\n\tfor i := 0; i < n; i++ {\n\t\tp[i] = barretReduce(p[i])\n\t}\n}", "func (c *Context) VPMAXUB_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUB_Z(mxyz, xyz, k, xyz1))\n}", "func (q Quat) Z() float32 {\n\treturn q.V[2]\n}", "func (s VectOp) Reduce(f fs.ReduceOperator, identity float64) float64 {\n\tresult := identity\n\tfor _, val := range s {\n\t\tresult = f(val, result)\n\t}\n\treturn result\n}", "func (c *Coord) Z() float64 { return c[2] }", "func CompactFactorization(sortedPrimes []uint64, factorization Factorization) Factorization {\n\tvar compactedF Factorization\n\n\t// iterate over all occuring primes (in sored order)\n\tfor _, sortedPrime := range sortedPrimes {\n\t\tvar summedExponents uint64\n\t\t// for each prime iterate over factorization and sum all exponents\n\t\tfor i := range factorization {\n\t\t\tif factorization[i].prime == sortedPrime {\n\t\t\t\tsummedExponents += factorization[i].exp\n\t\t\t}\n\t\t}\n\t\tcompactedF = append(compactedF, PrimeFactor{sortedPrime, summedExponents})\n\t}\n\n\treturn compactedF\n}", "func Reduce(c Context, op string, v Value) Value {\n\t// We must be right associative; that is the grammar.\n\t// -/1 2 3 == 1-2-3 is 1-(2-3) not (1-2)-3. Answer: 2.\n\tswitch v := v.(type) {\n\tcase Int, BigInt, BigRat:\n\t\treturn v\n\tcase Vector:\n\t\tif len(v) == 0 {\n\t\t\treturn v\n\t\t}\n\t\tacc := v[len(v)-1]\n\t\tfor i := len(v) - 2; i >= 0; i-- {\n\t\t\tacc = c.EvalBinary(v[i], op, acc)\n\t\t}\n\t\treturn acc\n\tcase *Matrix:\n\t\tif v.Rank() < 2 {\n\t\t\tErrorf(\"shape for matrix is degenerate: %s\", NewIntVector(v.shape))\n\t\t}\n\t\tstride := v.shape[v.Rank()-1]\n\t\tif stride == 0 {\n\t\t\tErrorf(\"shape for matrix is degenerate: %s\", NewIntVector(v.shape))\n\t\t}\n\t\tshape := v.shape[:v.Rank()-1]\n\t\tdata := make(Vector, size(shape))\n\t\tindex := 0\n\t\tfor i := range data {\n\t\t\tpos := index + stride - 1\n\t\t\tacc := v.data[pos]\n\t\t\tpos--\n\t\t\tfor i := 1; i < stride; i++ {\n\t\t\t\tacc = c.EvalBinary(v.data[pos], op, acc)\n\t\t\t\tpos--\n\t\t\t}\n\t\t\tdata[i] = acc\n\t\t\tindex += stride\n\t\t}\n\t\tif len(shape) == 1 { // TODO: Matrix.shrink()?\n\t\t\treturn NewVector(data)\n\t\t}\n\t\treturn NewMatrix(shape, data)\n\t}\n\tErrorf(\"can't do reduce on %s\", whichType(v))\n\tpanic(\"not reached\")\n}", "func VREDUCEPS_BCST_Z(i, m, k, xyz operand.Op) { ctx.VREDUCEPS_BCST_Z(i, m, k, xyz) }", "func VPSHUFLW_Z(i, mxyz, k, xyz operand.Op) { ctx.VPSHUFLW_Z(i, mxyz, k, xyz) }", "func SimpleFold(r rune) rune", "func CollatzConjecture(n int) (int, error) {\n\tif n < 1 {\n\t\treturn 0, errors.New(\"input must be at least 1\")\n\t}\n\n\tvar steps int = 0\n\tfor n != 1 {\n\t\tn = CollatzStep(n)\n\t\tsteps += 1\n\t}\n\treturn steps, nil\n}", "func Selectznz(out1 *[5]uint32, arg1 uint1, arg2 *[5]uint32, arg3 *[5]uint32) {\n\tvar x1 uint32\n\tcmovznzU32(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint32\n\tcmovznzU32(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint32\n\tcmovznzU32(&x3, arg1, arg2[2], arg3[2])\n\tvar x4 uint32\n\tcmovznzU32(&x4, arg1, arg2[3], arg3[3])\n\tvar x5 uint32\n\tcmovznzU32(&x5, arg1, arg2[4], arg3[4])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n\tout1[3] = x4\n\tout1[4] = x5\n}", "func UnZValue(z [2]uint64) types.Point {\n\txl, yl := UnInterleaveUint64(z[0])\n\txr, yr := UnInterleaveUint64(z[1])\n\txf := UnLexFloat((xl << 32) | xr)\n\tyf := UnLexFloat((yl << 32) | yr)\n\treturn types.Point{X: xf, Y: yf}\n}", "func VMINSS_Z(mx, x, k, x1 operand.Op) { ctx.VMINSS_Z(mx, x, k, x1) }", "func (c *Context) VPMAXUQ_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXUQ_Z(mxyz, xyz, k, xyz1))\n}", "func (s TriangleSection) Jz() (j float64) {\n\txc := s.centerMassX()\n\tfor _, tr := range s.Elements {\n\t\tif tr.check() == nil {\n\t\t\ttm := Triangle{[3]Coord{\n\t\t\t\tCoord{X: tr.P[0].X - xc, Z: tr.P[0].Z},\n\t\t\t\tCoord{X: tr.P[1].X - xc, Z: tr.P[1].Z},\n\t\t\t\tCoord{X: tr.P[2].X - xc, Z: tr.P[2].Z},\n\t\t\t}}\n\t\t\tj += tm.momentInertiaZ()\n\t\t}\n\t}\n\treturn\n}", "func Test_Reduce_First_Lowest(t *testing.T) {\n\tvar hours []int = []int{1, 6}\n\tvar difference int = 1\n\n\tvar original_sum = core.Sum(hours)\n\n\tresult := reduce(hours, difference)\n\n\tvar result_sum = core.Sum(result)\n\n\tif original_sum != result_sum {\n\t\tt.Errorf(\"Total hours sum does not match.\")\n\t}\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func Test_Reduce_Simple(t *testing.T) {\n\tvar hours []int = []int{6, 1, 7, 10, 2}\n\tvar difference int = 1\n\n\tresult := reduce(hours, difference)\n\n\tif len(result) != len(hours)-1 {\n\t\tt.Errorf(\"input hours should be reduced by one\")\n\t\treturn\n\t}\n\tif result[0] != 6 {\n\t\tt.Errorf(\"Result does not have correct amount of hours.\")\n\t\treturn\n\t}\n\tif result[1] != 3 {\n\t\tt.Errorf(\"Result does not have correct amount of hours.\")\n\t\treturn\n\t}\n\tif result[2] != 7 {\n\t\tt.Errorf(\"Result does not have correct amount of hours.\")\n\t\treturn\n\t}\n\tif result[3] != 10 {\n\t\tt.Errorf(\"Result does not have correct amount of hours.\")\n\t\treturn\n\t}\n}", "func (c *Context) VPMAXSW_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXSW_Z(mxyz, xyz, k, xyz1))\n}", "func CollatzConjecture(number int) (int, error) {\n\tif number < 1 {\n\t\treturn -1, errors.New(\"function doesn't work with a negative or zero number\")\n\t}\n\n\tcounter := 0\n\tfor ; number > 1; number = step(number) {\n\t\tcounter++\n\t}\n\n\treturn counter, nil\n}", "func VMAXSS_Z(mx, x, k, x1 operand.Op) { ctx.VMAXSS_Z(mx, x, k, x1) }", "func Selectznz(out1 *[8]uint32, arg1 uint1, arg2 *[8]uint32, arg3 *[8]uint32) {\n\tvar x1 uint32\n\tcmovznzU32(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint32\n\tcmovznzU32(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint32\n\tcmovznzU32(&x3, arg1, arg2[2], arg3[2])\n\tvar x4 uint32\n\tcmovznzU32(&x4, arg1, arg2[3], arg3[3])\n\tvar x5 uint32\n\tcmovznzU32(&x5, arg1, arg2[4], arg3[4])\n\tvar x6 uint32\n\tcmovznzU32(&x6, arg1, arg2[5], arg3[5])\n\tvar x7 uint32\n\tcmovznzU32(&x7, arg1, arg2[6], arg3[6])\n\tvar x8 uint32\n\tcmovznzU32(&x8, arg1, arg2[7], arg3[7])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n\tout1[3] = x4\n\tout1[4] = x5\n\tout1[5] = x6\n\tout1[6] = x7\n\tout1[7] = x8\n}", "func (c *Context) VPSHUFLW_Z(i, mxyz, k, xyz operand.Op) {\n\tc.addinstruction(x86.VPSHUFLW_Z(i, mxyz, k, xyz))\n}", "func basicMul(z, x, y nat) {\n\tz[0 : len(x)+len(y)].clear() // initialize z\n\tfor i, d := range y {\n\t\tif d != 0 {\n\t\t\tz[len(x)+i] = addMulVVW(z[i:i+len(x)], x, d)\n\t\t}\n\t}\n}", "func VMULSS_Z(mx, x, k, x1 operand.Op) { ctx.VMULSS_Z(mx, x, k, x1) }", "func (v Volume) Zettalitres() float64 {\n\treturn float64(v / Zettalitre)\n}", "func VPSHUFD_Z(i, mxyz, k, xyz operand.Op) { ctx.VPSHUFD_Z(i, mxyz, k, xyz) }", "func (h *Halo) Redshift() float64 { return h.Z }", "func VPMAXSQ_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXSQ_Z(mxyz, xyz, k, xyz1) }", "func VPMADDUBSW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMADDUBSW_Z(mxyz, xyz, k, xyz1) }", "func lookup(z float64) (numStd float64) {\n\n\ta := math.Sqrt(1/z - 1)\n\tb := math.Sqrt(1/z + 1)\n\tres := math.Log(a*b+(1/z)) / 2.0\n\n\treturn res\n}", "func (c *Context) VMINSS_Z(mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VMINSS_Z(mx, x, k, x1))\n}", "func JZ(r operand.Op) { ctx.JZ(r) }", "func PauliZ() *Gate {\n\treturn newOneQubitGate([4]complex128{\n\t\t1, 0,\n\t\t0, -1})\n}", "func CollatzConjecture(n int) (int, error) {\n\tif n < 1 {\n\t\treturn -1, errors.New(\"input is less than 1\")\n\t}\n\tres := 0\n\tfor n != 1 {\n\t\tif n%2 == 0 {\n\t\t\tn /= 2\n\t\t} else {\n\t\t\tn = n*3 + 1\n\t\t}\n\t\tres++\n\t}\n\treturn res, nil\n}", "func VPMAXSD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPMAXSD_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VMAXSS_Z(mx, x, k, x1 operand.Op) {\n\tc.addinstruction(x86.VMAXSS_Z(mx, x, k, x1))\n}", "func VSUBSS_Z(mx, x, k, x1 operand.Op) { ctx.VSUBSS_Z(mx, x, k, x1) }", "func (s TriangleSection) Wz() (j float64) {\n\tvar xmax float64\n\txc := s.centerMassX()\n\tfor _, tr := range s.Elements {\n\t\tfor _, c := range tr.P {\n\t\t\txmax = math.Max(xmax, c.X-xc)\n\t\t}\n\t}\n\treturn s.Jz() / xmax\n}", "func (v *Vector) Minus(a *Vector) *Vector {\n\treturn &Vector{X: v.X - a.X, Y: v.Y - a.Y, Z: v.Z - a.Z}\n}", "func zig(i uint32, j uint32) uint32 {\n\tif (i > 0x4000) || (j > 0x4000) {\n\t\tpanic(\"overflow\")\n\t}\n\tn := i + j\n\treturn ((n * (n + 1)) / 2) + j\n}", "func strictThreeWayZfunc(data LessSwap, lo, hi int) (midlo, midhi int) {\n\tm := int(uint(lo+hi) >> 1)\n\tif hi-lo > 40 {\n\t\ts := (hi - lo) / 8\n\t\tmedianOfThreeZfunc(data, lo, lo+s, lo+2*s)\n\t\tmedianOfThreeZfunc(data, m, m-s, m+s)\n\t\tmedianOfThreeZfunc(data, hi-1, hi-1-s, hi-1-2*s)\n\t}\n\tmedianOfThreeZfunc(data, lo, m, hi-1)\n\tpivot := lo\n\ta, c := lo+1, hi-1\n\tfor ; a < c && data.Less(a, pivot); a++ {\n\t}\n\tb := a\n\tfor {\n\t\tfor ; b < c && !data.Less(pivot, b); b++ {\n\t\t}\n\t\tfor ; b < c && data.Less(pivot, c-1); c-- {\n\t\t}\n\t\tif b >= c {\n\t\t\tbreak\n\t\t}\n\t\tdata.Swap(b, c-1)\n\t\tb++\n\t\tc--\n\t}\n\tfor {\n\t\tfor ; a < b && !data.Less(b-1, pivot); b-- {\n\t\t}\n\t\tfor ; a < b && data.Less(a, pivot); a++ {\n\t\t}\n\t\tif a >= b {\n\t\t\tbreak\n\t\t}\n\t\tdata.Swap(a, b-1)\n\t\ta++\n\t\tb--\n\t}\n\tif !data.Less(pivot, hi-1) {\n\t\tdata.Swap(c, hi-1)\n\t\tc++\n\t}\n\tdata.Swap(pivot, b-1)\n\treturn b - 1, c\n}", "func (cpu *CPU) S_Z() int {\r\n\treturn int((cpu.Sr() >> 1) & 1)\r\n}", "func VPSUBSW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPSUBSW_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VPMAXSQ_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPMAXSQ_Z(mxyz, xyz, k, xyz1))\n}", "func Selectznz(out1 *[4]uint64, arg1 uint1, arg2 *[4]uint64, arg3 *[4]uint64) {\n var x1 uint64\n cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0]))\n var x2 uint64\n cmovznzU64(&x2, arg1, (arg2[1]), (arg3[1]))\n var x3 uint64\n cmovznzU64(&x3, arg1, (arg2[2]), (arg3[2]))\n var x4 uint64\n cmovznzU64(&x4, arg1, (arg2[3]), (arg3[3]))\n out1[0] = x1\n out1[1] = x2\n out1[2] = x3\n out1[3] = x4\n}", "func Reduce(elements []Value, memo Value, reductor BiMapper) Value {\n\tfor _, elem := range elements {\n\t\tmemo = reductor(memo, elem)\n\t}\n\treturn memo\n}", "func cmovznzU1(out1 *uint1, arg1 uint1, arg2 uint1, arg3 uint1) {\n\tx1 := ((arg1 & arg3) | ((^arg1) & arg2))\n\t*out1 = x1\n}", "func cmovznzU1(out1 *uint1, arg1 uint1, arg2 uint1, arg3 uint1) {\n\tx1 := ((arg1 & arg3) | ((^arg1) & arg2))\n\t*out1 = x1\n}", "func cmovznzU1(out1 *uint1, arg1 uint1, arg2 uint1, arg3 uint1) {\n\tx1 := ((arg1 & arg3) | ((^arg1) & arg2))\n\t*out1 = x1\n}", "func VRNDSCALEPD_SAE_Z(i, z, k, z1 operand.Op) { ctx.VRNDSCALEPD_SAE_Z(i, z, k, z1) }", "func VPSUBW_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VPSUBW_Z(mxyz, xyz, k, xyz1) }", "func (c *Context) VPSUBUSW_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VPSUBUSW_Z(mxyz, xyz, k, xyz1))\n}", "func simplify(landmarks []image.Point) []image.Point {\n\tvar out []image.Point\n\n\tfor i := 0; i < 17; i++ {\n\t\tout = append(out, landmarks[i])\n\t}\n\n\tfor i := 26; i >= 17; i-- {\n\t\tout = append(out, moveUp(landmarks[8], landmarks[i]))\n\t}\n\n\treturn out\n}" ]
[ "0.5418615", "0.53875196", "0.5339523", "0.53097135", "0.524707", "0.5185971", "0.51534474", "0.5153013", "0.50972736", "0.50938153", "0.5091379", "0.50770324", "0.50621927", "0.5043481", "0.50147516", "0.5010768", "0.49960193", "0.49713972", "0.49566567", "0.49497017", "0.49440995", "0.4909701", "0.4887087", "0.48806387", "0.48772997", "0.48515943", "0.4851579", "0.48380148", "0.4836058", "0.480011", "0.47871748", "0.4765391", "0.47418675", "0.47373328", "0.47248942", "0.47140294", "0.4701699", "0.4698612", "0.46963432", "0.46810663", "0.46728274", "0.4670168", "0.46625498", "0.4659828", "0.46563554", "0.46421093", "0.46341836", "0.46180493", "0.46100104", "0.46047032", "0.46035233", "0.46027395", "0.45986256", "0.45936465", "0.4593469", "0.45622975", "0.45601547", "0.45438996", "0.45425522", "0.45354274", "0.45321128", "0.45289847", "0.45227957", "0.45193735", "0.45138344", "0.4513027", "0.4509522", "0.45070928", "0.44852096", "0.4482775", "0.4480826", "0.44757798", "0.447254", "0.44642985", "0.44624445", "0.44622344", "0.4460371", "0.4457518", "0.44561118", "0.44506356", "0.44489548", "0.44453984", "0.44432357", "0.44429842", "0.4437069", "0.44264683", "0.44185477", "0.44150192", "0.4412018", "0.4410829", "0.44033533", "0.4399601", "0.43944573", "0.43930265", "0.43930265", "0.43930265", "0.43911356", "0.4380426", "0.4380154", "0.43798727" ]
0.52355194
5
Rem sets z to the remainder x % y. See QuoRem for more details.
func (z *Big) Rem(x, y *Big) *Big { return z.Context.Rem(z, x, y) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func (z *Int) QuoRem(x, y, r *Int) (*Int, *Int) {}", "func IntDivMod(z *big.Int, x, y, m *big.Int,) (*big.Int, *big.Int,)", "func (z *Int) DivMod(x, y, m *Int) (*Int, *Int) {}", "func IntRem(z *big.Int, x, y *big.Int,) *big.Int", "func divmod(x, m uint64) (quo, rem uint64) {\n\tquo = x / m\n\trem = x % m\n\treturn\n}", "func (z *Int) Mod(x, y *Int) *Int {}", "func IntMod(z *big.Int, x, y *big.Int,) *big.Int", "func QuotRem(a, b int) (quot, rem int, err error) { // HL\n\tif b != 0 {\n\t\tquot, rem = a/b, a%b // HL\n\n\t} else {\n\t\terr = errors.New(\"cannot divide by 0\") // HL\n\t}\n\treturn\n}", "func Modulo(a, operand int) int { return operand % a }", "func (z *Int) Div(x, y *Int) *Int {}", "func DivMod(a int, b int, div *int, mod *int) {\n\t*div = a / b\n\t*mod = a % b\n}", "func (z *Big) QuoRem(x, y, r *Big) (*Big, *Big) {\n\treturn z.Context.QuoRem(z, x, y, r)\n}", "func quoRem(x, y int) (quo, rem int) {\n\tquo = x / y\n\trem = x - quo*y\n\treturn\n}", "func mod(val, m int) int {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "func (z *Int) Mod(x, y *Int) *Int {\n\tif x.IsZero() || y.IsZero() {\n\t\treturn z.Clear()\n\t}\n\tswitch x.Cmp(y) {\n\tcase -1:\n\t\t// x < y\n\t\tcopy(z[:], x[:])\n\t\treturn z\n\tcase 0:\n\t\t// x == y\n\t\treturn z.Clear() // They are equal\n\t}\n\n\t// At this point:\n\t// x != 0\n\t// y != 0\n\t// x > y\n\n\t// Shortcut trivial case\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() % y.Uint64())\n\t}\n\n\tq := NewInt()\n\tq.Div(x, y)\n\tq.Mul(q, y)\n\tz.Sub(x, q)\n\treturn z\n}", "func DivMod(x, y, m *big.Int) (*big.Int, *big.Int) {\n\treturn new(big.Int).DivMod(x, y, m)\n}", "func mod(v, modulus int) int {\n\treturn (v%modulus + modulus) % modulus\n}", "func Rem(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx % yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx % yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator % not defined on %v\", x.Type()))\n}", "func divmod(a, b int) (q int, r int) {\n\tif b == 0 {\n\t\treturn\n\t}\n\tq = a / b\n\tr = a % b\n\treturn\n}", "func (z *Int) Div(x, y *Int) *Int {\n\tif y.IsZero() || y.Gt(x) {\n\t\treturn z.Clear()\n\t}\n\tif x.Eq(y) {\n\t\treturn z.SetOne()\n\t}\n\t// Shortcut some cases\n\tif x.IsUint64() {\n\t\treturn z.SetUint64(x.Uint64() / y.Uint64())\n\t}\n\n\t// At this point, we know\n\t// x/y ; x > y > 0\n\t// See Knuth, Volume 2, section 4.3.1, Algorithm D.\n\n\t// Normalize by shifting divisor left just enough so that its high-order\n\t// bit is on and u left the same amount.\n\t// function nlz do the caculating of the amount and shl do the left operation.\n\ts := nlz(y)\n\txn := shl(x, s, true)\n\tyn := shl(y, s, false)\n\n\t// divKnuth do the division of normalized dividend and divisor with Knuth Algorithm D.\n\tq := divKnuth(xn, yn)\n\n\tz.Clear()\n\tfor i := 0; i < len(q); i++ {\n\t\tz[i/2] = z[i/2] | uint64(q[i])<<(32*(uint64(i)%2))\n\t}\n\n\treturn z\n}", "func QuoRem(x, y, r *big.Int) (*big.Int, *big.Int) {\n\treturn new(big.Int).QuoRem(x, y, r)\n}", "func calMod(b, mod byte) byte {\n\treturn b % mod\n}", "func Mod(dividend, divisor *big.Int) *big.Int { return I().Mod(dividend, divisor) }", "func Modulo(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn ModuloFunc.Call([]cty.Value{a, b})\n}", "func modll(val, m int64) int64 {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "func TestCheckBinaryExprComplexRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 4`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func IntModInverse(z *big.Int, g, n *big.Int,) *big.Int", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func divmod(a, b, mod *big.Int) *big.Int {\n\tb = b.ModInverse(b, mod)\n\tif b == nil {\n\t\treturn nil\n\t}\n\treturn a.Mul(a, b)\n}", "func IntModSqrt(z *big.Int, x, p *big.Int,) *big.Int", "func TestCheckBinaryExprIntRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `4 % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func S41_DivisionWithRemainder(in chan S41_In, out chan S41_Out) {\n\tv := <-in\n\tx, y := v.X, v.Y\n\n\tquot, rem := 0, x\n\tfor rem >= y {\n\t\trem -= y\n\t\tquot++\n\t}\n\tout <- S41_Out{quot, rem}\n}", "func (v *Vec3i) SetDiv(other Vec3i) {\n\tv.X /= other.X\n\tv.Y /= other.Y\n\tv.Z /= other.Z\n}", "func modi(val, m int) int {\n\tres := val % m\n\tif res < 0 {\n\t\tres += m\n\t}\n\treturn res\n}", "func (z *Int) ModSqrt(x, p *Int) *Int {}", "func DivMod(dvdn, dvsr int) (q, r int) {\n\tr = dvdn\n\tfor r >= dvsr {\n\t\tq += 1\n\t\tr = r - dvsr\n\t}\n\treturn\n}", "func ModInt(a, m int) int {\n\ta = a % m\n\tif a < 0 {\n\t\ta += m\n\t}\n\treturn a\n}", "func Rem(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Rem(x, y)\n}", "func (z *Float64) Divide(y *Float64, a float64) *Float64 {\n\tz.l = y.l / a\n\tz.r = y.r / a\n\treturn z\n}", "func opUI8Mod(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_ui8() % inputs[1].Get_ui8()\n\toutputs[0].Set_ui8(outV0)\n}", "func (pwm *pwmGroup) setClockDiv(Int, frac uint8) {\n\tpwm.DIV.ReplaceBits((uint32(frac)<<rp.PWM_CH0_DIV_FRAC_Pos)|\n\t\tu32max(uint32(Int), 1)<<rp.PWM_CH0_DIV_INT_Pos, rp.PWM_CH0_DIV_FRAC_Msk|rp.PWM_CH0_DIV_INT_Msk, 0)\n}", "func Mod(d, m int) int {\n\tvar res int = d % m\n\tif (res < 0 && m > 0) || (res > 0 && m < 0) {\n\t\treturn res + m\n\t}\n\treturn res\n}", "func Mod(d, m int) int {\n\tvar res int = d % m\n\tif ((res < 0 && m > 0) || (res > 0 && m < 0)) {\n\t return res + m\n\t}\n\treturn res\n }", "func opUI64Mod(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) % ReadUI64(fp, expr.Inputs[1])\n\tWriteUI64(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func DivAndRemainder(a, b int) (int, int, error) {\n\tif b == 0 {\n\t\treturn 0, 0, errors.New(\"Cannot divide by zero\")\n\t}\n\td := int(math.Floor(float64(a) / float64(b)))\n\tr := a % b\n\treturn d, r, nil\n\n}", "func TestCheckBinaryExprComplexRemFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 2.0`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func (l Integer) Mod(r Number) Number {\n\tif ri, ok := r.(Integer); ok {\n\t\tif ri == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\treturn l % ri\n\t}\n\tpl, pr := purify(l, r)\n\treturn pl.Mod(pr)\n}", "func cdiv(a, b int) int { return (a + b - 1) / b }", "func floorMod(x, y int64) int64 {\n\tm := x % y\n\tif m == 0 || ((x >= 0 && y > 0) || (x < 0 && y < 0)) {\n\t\treturn m\n\t}\n\treturn m + y\n}", "func divmod(dvdn, dvsr int) (q, r int) {\n\tr = dvdn\n\tfor r >= dvsr {\n\t\tq++\n\t\tr = r - dvsr\n\t}\n\treturn\n}", "func TestCheckBinaryExprFloatRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 % 4`, env,\n\t\t`illegal constant expression: floating-point % operation`,\n\t)\n\n}", "func remQuo(x, y, q, r *big.Int) *big.Int {\n\tq.QuoRem(x, y, r)\n\treturn r\n}", "func TestCheckBinaryExprIntRemInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `4 % 4`, env, NewConstInt64(4 % 4), ConstInt)\n}", "func (this *BigInteger) DivRemTo(m *BigInteger, q *BigInteger, r *BigInteger) {\n\tvar pm *BigInteger = m.Abs()\n\tif pm.T <= 0 {\n\t\treturn\n\t}\n\tvar pt *BigInteger = this.Abs()\n\tif pt.T < pm.T {\n\t\tif q != nil {\n\t\t\tq.FromInt(0)\n\t\t}\n\t\tif r != nil {\n\t\t\tthis.CopyTo(r)\n\t\t}\n\t\treturn\n\t}\n\tif r == nil {\n\t\tr = NewBigInteger()\n\t}\n\tvar y *BigInteger = NewBigInteger()\n\tvar ts int64 = this.S\n\tvar ms int64 = m.S\n\tvar nsh int64 = DB - Nbits(pm.V[pm.T-1])\n\tif nsh > 0 {\n\t\tpm.LShiftTo(nsh, y)\n\t\tpt.LShiftTo(nsh, r)\n\t} else {\n\t\tpm.CopyTo(y)\n\t\tpt.CopyTo(r)\n\t}\n\tvar ys int64 = y.T\n\tvar y0 int64 = y.V[ys-1]\n\tif y0 == 0 {\n\t\treturn\n\t}\n\tvar yt int64 = y0 * (1 << uint(F1))\n\tif ys > 1 {\n\t\tyt += y.V[ys-2] >> uint(F2)\n\t}\n\tvar d1 float64 = float64(FV) / float64(yt)\n\tvar d2 float64 = float64(1<<uint(F1)) / float64(yt)\n\tvar e int64 = 1 << uint(F2)\n\tvar i int64 = r.T\n\tvar j int64 = i - ys\n\tvar t *BigInteger = q\n\tif q == nil {\n\t\tt = NewBigInteger()\n\t}\n\ty.DLShiftTo(j, t)\n\tif r.CompareTo(t) >= 0 {\n\t\tr.V[r.T] = 1\n\t\tr.T++\n\t\tr.SubTo(t, r)\n\t}\n\tONE.DLShiftTo(ys, t)\n\tt.SubTo(y, y)\n\tfor j--; j >= 0; j-- {\n\t\tvar qd int64 = DM\n\t\ti--\n\t\tif r.V[i] != y0 {\n\t\t\tqd = int64(math.Floor(float64(r.V[i])*d1 + float64(r.V[i-1]+e)*d2))\n\t\t}\n\t\tr.V[i] += y.AM(0, qd, r, j, 0, ys)\n\t\tif (r.V[i]) > qd {\n\t\t\ty.DLShiftTo(j, t)\n\t\t\tr.SubTo(t, r)\n\t\t\tfor qd--; r.V[i] < qd; qd-- {\n\t\t\t\tr.SubTo(t, r)\n\t\t\t}\n\t\t}\n\t}\n\tif q != nil {\n\t\tr.DRShiftTo(ys, q)\n\t\tif ts != ms {\n\t\t\tZERO.SubTo(q, q)\n\t\t}\n\t}\n\tr.T = ys\n\tr.clamp()\n\tif nsh > 0 {\n\t\tr.RShiftTo(nsh, r)\n\t}\n\tif ts < 0 {\n\t\tZERO.SubTo(r, r)\n\t}\n}", "func TestCheckBinaryExprComplexRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `8.0i % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func TestCheckBinaryExprFloatRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `2.0 % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func (r *Ring) mod(p int) int {\n\treturn p % len(r.buff)\n}", "func rem(a, b big.Int) big.Int {\n\t// it's me in the corner\n\treturn *big.NewInt(1).Rem(&a, &b)\n}", "func (z *Int) MulMod(x, y, m *Int) *Int {\n\t// If we can do multiplication within 256 bytes, no need to wrap bigints\n\t// i.e: if both x and y are <= 128 bytes\n\tif x.IsUint128() && y.IsUint128() {\n\n\t\tif z == m { //z is an alias for m\n\t\t\tm = m.Clone()\n\t\t}\n\t\tz.Mul(x, y)\n\t\tz.Mod(z, m)\n\t\treturn z\n\t}\n\t// At this point, we _could_ do x=x mod m, y = y mod m, and test again\n\t// if they fit within 256 bytes. But for now just wrap big.Int instead\n\tbx := big.NewInt(0)\n\tby := big.NewInt(0)\n\tbx.SetBytes(x.Bytes()[:])\n\tby.SetBytes(y.Bytes()[:])\n\tbx.Mul(bx, by)\n\tby.SetBytes(m.Bytes()[:])\n\tz.SetFromBig(bx.Mod(bx, by))\n\treturn z\n}", "func TestCheckBinaryExprIntRemFloat(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `4 % 2.0`, env,\n\t\t`illegal constant expression: floating-point % operation`,\n\t)\n\n}", "func Mod(x, y float64) float64 {\n\tres := math.Mod(x, y)\n\tif (res < 0 && y > 0) || (res > 0 && y < 0) {\n\t\treturn res + y\n\t}\n\n\treturn res\n}", "func (v Vec3i) Div(other Vec3i) Vec3i {\n\treturn Vec3i{v.X / other.X, v.Y / other.Y, v.Z / other.Z}\n}", "func divShift(s string, n int) string {\n\tn = n % len(s)\n\tif n == 0 {\n\t\treturn s\n\t}\n\tbuf := make([]byte, len(s))\n\tcopy(buf, s)\n\tswap(buf, 0, n, len(buf))\n\treturn string(buf)\n}", "func ModularMultivector(m *Multivector, q *big.Int) *Multivector {\n\tm.E0.Mod(m.E0, q)\n\tm.E1.Mod(m.E1, q)\n\tm.E2.Mod(m.E2, q)\n\tm.E3.Mod(m.E3, q)\n\tm.E12.Mod(m.E12, q)\n\tm.E13.Mod(m.E13, q)\n\tm.E23.Mod(m.E23, q)\n\tm.E123.Mod(m.E123, q)\n\n\treturn m\n}", "func mod(a int, n int) int {\n\tif n == 0 {\n\t\treturn 0\n\t}\n\tval := a - (n * int(a/n))\n\tif val < 0 {\n\t\treturn val + n\n\t}\n\treturn val\n}", "func (z *Int) Rem(x, y *Int) *Int {}", "func (z *Element22) Div(x, y *Element22) *Element22 {\n\tvar yInv Element22\n\tyInv.Inverse(y)\n\tz.Mul(x, &yInv)\n\treturn z\n}", "func Modp(z *Elt)", "func (l *BigInt) Mod(r Number) Number {\n\tif ri, ok := r.(*BigInt); ok {\n\t\tlb := (*big.Int)(l)\n\t\trb := (*big.Int)(ri)\n\t\tif rb.IsInt64() && rb.Int64() == 0 {\n\t\t\tpanic(errors.New(ErrDivideByZero))\n\t\t}\n\t\tres := new(big.Int).Rem(lb, rb)\n\t\treturn maybeInteger(res)\n\t}\n\tlp, rp := purify(l, r)\n\treturn lp.Mod(rp)\n}", "func Mod(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Mod(x, y)\n}", "func div(u uint8) (uint8, uint8) {\n\treturn u / 64, u % 64\n}", "func walkDivMod(n *ir.BinaryExpr, init *ir.Nodes) ir.Node {\n\tn.X = walkExpr(n.X, init)\n\tn.Y = walkExpr(n.Y, init)\n\n\t// rewrite complex div into function call.\n\tet := n.X.Type().Kind()\n\n\tif types.IsComplex[et] && n.Op() == ir.ODIV {\n\t\tt := n.Type()\n\t\tcall := mkcall(\"complex128div\", types.Types[types.TCOMPLEX128], init, typecheck.Conv(n.X, types.Types[types.TCOMPLEX128]), typecheck.Conv(n.Y, types.Types[types.TCOMPLEX128]))\n\t\treturn typecheck.Conv(call, t)\n\t}\n\n\t// Nothing to do for float divisions.\n\tif types.IsFloat[et] {\n\t\treturn n\n\t}\n\n\t// rewrite 64-bit div and mod on 32-bit architectures.\n\t// TODO: Remove this code once we can introduce\n\t// runtime calls late in SSA processing.\n\tif types.RegSize < 8 && (et == types.TINT64 || et == types.TUINT64) {\n\t\tif n.Y.Op() == ir.OLITERAL {\n\t\t\t// Leave div/mod by constant powers of 2 or small 16-bit constants.\n\t\t\t// The SSA backend will handle those.\n\t\t\tswitch et {\n\t\t\tcase types.TINT64:\n\t\t\t\tc := ir.Int64Val(n.Y)\n\t\t\t\tif c < 0 {\n\t\t\t\t\tc = -c\n\t\t\t\t}\n\t\t\t\tif c != 0 && c&(c-1) == 0 {\n\t\t\t\t\treturn n\n\t\t\t\t}\n\t\t\tcase types.TUINT64:\n\t\t\t\tc := ir.Uint64Val(n.Y)\n\t\t\t\tif c < 1<<16 {\n\t\t\t\t\treturn n\n\t\t\t\t}\n\t\t\t\tif c != 0 && c&(c-1) == 0 {\n\t\t\t\t\treturn n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar fn string\n\t\tif et == types.TINT64 {\n\t\t\tfn = \"int64\"\n\t\t} else {\n\t\t\tfn = \"uint64\"\n\t\t}\n\t\tif n.Op() == ir.ODIV {\n\t\t\tfn += \"div\"\n\t\t} else {\n\t\t\tfn += \"mod\"\n\t\t}\n\t\treturn mkcall(fn, n.Type(), init, typecheck.Conv(n.X, types.Types[et]), typecheck.Conv(n.Y, types.Types[et]))\n\t}\n\treturn n\n}", "func Div(hi, lo, y uint) (quo, rem uint) {\n\tif UintSize == 32 {\n\t\tq, r := Div32(uint32(hi), uint32(lo), uint32(y))\n\t\treturn uint(q), uint(r)\n\t}\n\tq, r := Div64(uint64(hi), uint64(lo), uint64(y))\n\treturn uint(q), uint(r)\n}", "func DivisorComResto(numeroA int, numberoB int) (resultado int, resto int) {\n\tresultado = numeroA / numberoB\n\tresto = numeroA % numberoB\n\treturn\n}", "func ChineseRemainder(congruences map[int]int) int {\n\tp := 1\n\tfor _, modulus := range congruences {\n\t\tp = p * modulus\n\t}\n\n\tx := 0\n\tfor remainder, modulus := range congruences {\n\t\tn := p / modulus\n\t\t_, inv, _ := EGCD(n, modulus)\n\t\tx = (x + remainder*n*inv) % p\n\t}\n\n\tfor x < 0 {\n\t\tx = x + p\n\t}\n\treturn x\n}", "func (d Decimal) Mod(d2 Decimal) Decimal {\n\tquo := d.Div(d2).Truncate(0)\n\treturn d.Sub(d2.Mul(quo))\n}", "func (d Decimal) Mod(d2 Decimal) Decimal {\n\tquo := d.Div(d2).Truncate(0)\n\treturn d.Sub(d2.Mul(quo))\n}", "func mathFmod(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar x, y phpv.ZFloat\n\t_, err := core.Expand(ctx, args, &x, &y)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn phpv.ZFloat(math.Mod(float64(x), float64(y))).ZVal(), nil\n}", "func div(a, b int32) int32 {\n\tif a >= 0 {\n\t\treturn (a + (b >> 1)) / b\n\t}\n\treturn -((-a + (b >> 1)) / b)\n}", "func div(x, y int) (answer int, err error) {\n\tif y == 0 {\n\t\terr = fmt.Errorf(\"Cannot Divid by zero\")\n\t} else {\n\t\tanswer = x / y\n\t}\n\treturn\n}", "func ModMul(a, b, mod int) int {\n\ta, b = a%mod, b%mod\n\tif b == 0 {\n\t\treturn 0\n\t}\n\tif a*b/b == a {\n\t\treturn a * b % mod\n\t}\n\tpanic(\"overflow\")\n}", "func (vm *VM) opMod(instr []uint16) int {\n\ta, b, c := vm.getAbc(instr)\n\n\tvm.registers[a] = b % c\n\treturn 4\n}", "func mod(c uint) uint {\n\tconst MODULUS uint = 0x14d\n\n\t// c2 = (c << 1) ^ ((c & 0x80) ? MODULUS : 0)\n\tif c & 0x80 {\n\t\tv := MODULUS\n\t} else {\n\t\tv := 0\n\t}\n\tc2 := (c << 1) ^ v\n\n\t// c1 = c2 ^ (c >> 1) ^ ((c & 1) ? (MODULUS >> 1) : 0)\n\tif c & 1 {\n\t\tv = MODULUS >> 1\n\t} else {\n\t\tv = 0\n\t}\n\tc1 := c2 ^ (c >> 1) ^ v\n\n\treturn c | (c1 << 8) | (c2 << 16) | (c1 << 24)\n}", "func DIVQ(mr operand.Op) { ctx.DIVQ(mr) }", "func TestCheckBinaryExprRuneRemComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `'@' % 8.0i`, env,\n\t\t`illegal constant expression: untyped number % untyped number`,\n\t)\n\n}", "func DIVL(mr operand.Op) { ctx.DIVL(mr) }", "func main() {\n\tfmt.Println(safeDiv(3,0))\n\tfmt.Println(safeDiv(3,2))\n}", "func rcDiv(p *TCompiler, code *TCode) (*value.Value, error) {\n\tv := value.Div(p.regGet(code.B), p.regGet(code.C))\n\tp.regSet(code.A, v)\n\tp.moveNext()\n\treturn v, nil\n}", "func MulMod(a, b, m int64) int64 {\n\tvar sum int64 = 0\n\ta, b = a%m, b%m\n\tfor b != 0 {\n\t\tif b&1 == 1 {\n\t\t\tsum = (sum + a) % m\n\t\t}\n\t\ta, b = (2*a)%m, b>>1\n\t}\n\treturn sum\n}", "func (r GroupSortedSet) ZRem(ctx context.Context, key string, member interface{}, members ...interface{}) (int64, error) {\n\tvar s = []interface{}{key}\n\ts = append(s, member)\n\ts = append(s, members...)\n\tv, err := r.redis.Do(ctx, \"ZRem\", s...)\n\treturn v.Int64(), err\n}", "func (e *ConstantExpr) URem(other *ConstantExpr) *ConstantExpr {\n\tassert(e.Width == other.Width, \"urem: width mismatch: %d != %d\", e.Width, other.Width)\n\tswitch e.Width {\n\tcase Width8:\n\t\treturn NewConstantExpr(uint64(uint8(e.Value)%uint8(other.Value)), e.Width)\n\tcase Width16:\n\t\treturn NewConstantExpr(uint64(uint16(e.Value)%uint16(other.Value)), e.Width)\n\tcase Width32:\n\t\treturn NewConstantExpr(uint64(uint32(e.Value)%uint32(other.Value)), e.Width)\n\tcase Width64:\n\t\treturn NewConstantExpr(uint64(uint64(e.Value)%uint64(other.Value)), e.Width)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"urem: non-standard width: %d\", e.Width))\n\t}\n}", "func DIVPD(mx, x operand.Op) { ctx.DIVPD(mx, x) }", "func (z *Int) Mul(x, y *Int) *Int {}", "func main() {\n\tfor i := 10; i <= 100; i++ {\n\t\tm := i % 4\n\t\tfmt.Printf(\"When %v is devided by 4 the remaining value is %v\\n\", i, m)\n\t}\n}", "func main() {\n\tfor i := 10; i <= 100; i++ {\n\t\tfmt.Printf(\"When %d is devided by 4, the remainder (modulus) is %d\\n\", i, i%4)\n\t}\n}", "func main() {\n\tN := scanInt()\n\tn, e, t := 1, 1, 1\n\tfor i := 0; i < N; i++ {\n\t\t// [+/*]you can divide by mod each add/time ops\n\t\te = (e * 8) % mod\n\t\tn = (n * 9) % mod\n\t\tt = (t * 10) % mod\n\t}\n\tans := t - n - n + e\n\t// [+]consider if above time calc result over mod\n\tans %= mod\n\t// [-]consider if above sub calc result goes negative number\n\tans = (ans + mod) % mod\n\tfmt.Println(ans)\n}", "func Command_Div(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 2 {\n\t\trex.ErrorParamCount(\"float:div\", \"2\")\n\t}\n\n\tscript.RetVal = rex.NewValueFloat64(params[0].Float64() / params[1].Float64())\n\treturn\n}", "func opUI64Div(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) / ReadUI64(fp, expr.Inputs[1])\n\tWriteUI64(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func (c *Context) VDIVPD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VDIVPD_Z(mxyz, xyz, k, xyz1))\n}", "func (x f26dot6) div(y f26dot6) f26dot6 {\n\treturn f26dot6((int64(x) << 6) / int64(y))\n}" ]
[ "0.7398744", "0.7098709", "0.7067952", "0.7055104", "0.69073147", "0.6627208", "0.6597806", "0.6574439", "0.65691066", "0.632363", "0.62499833", "0.62156296", "0.6178628", "0.6129219", "0.60879785", "0.60101384", "0.5970646", "0.5908157", "0.5896735", "0.5891395", "0.5821937", "0.58057743", "0.5785718", "0.57376254", "0.5730371", "0.5724658", "0.569118", "0.5690182", "0.5642327", "0.56216955", "0.5619632", "0.560906", "0.56008536", "0.55969906", "0.55569285", "0.5536689", "0.5489495", "0.5476632", "0.5465753", "0.5463592", "0.5459317", "0.5453733", "0.5453105", "0.5447625", "0.5446451", "0.5429528", "0.54260576", "0.5424957", "0.5410485", "0.5401145", "0.5390228", "0.5388736", "0.538792", "0.5359301", "0.53400874", "0.53118145", "0.5306418", "0.5291747", "0.5273923", "0.5244722", "0.5243785", "0.5242256", "0.52295953", "0.5219848", "0.5217863", "0.5211722", "0.52101076", "0.5208402", "0.51960695", "0.5194127", "0.51931256", "0.518816", "0.51839817", "0.51809454", "0.5165319", "0.516174", "0.5151746", "0.5151746", "0.51456857", "0.5111686", "0.51036716", "0.5093159", "0.5092214", "0.5091898", "0.5082844", "0.5081625", "0.5077368", "0.507728", "0.5056273", "0.50528544", "0.50505924", "0.5026759", "0.5002144", "0.5000919", "0.500054", "0.4988945", "0.4984758", "0.49775395", "0.49685037", "0.49433252", "0.49388474" ]
0.0
-1
RoundToInt rounds z down to an integral value.
func (z *Big) RoundToInt() *Big { return z.Context.RoundToInt(z) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d LegacyDec) RoundInt() Int {\n\treturn NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i))\n}", "func RoundToInt(f float64) int {\n\tif math.Abs(f) < 0.5 {\n\t\treturn 0\n\t}\n\treturn int(f + math.Copysign(0.5, f))\n}", "func integerPower(z, x *inf.Dec, y int64, s inf.Scale) *inf.Dec {\n\tif z == nil {\n\t\tz = new(inf.Dec)\n\t}\n\n\tneg := y < 0\n\tif neg {\n\t\ty = -y\n\t}\n\n\tz.Set(decimalOne)\n\tfor y > 0 {\n\t\tif y%2 == 1 {\n\t\t\tz = z.Mul(z, x)\n\t\t}\n\t\ty >>= 1\n\t\tx.Mul(x, x)\n\n\t\t// integerPower is only ever called with `e` (decimalE), which is a constant\n\t\t// with very high precision. When it is squared above, the number of digits\n\t\t// needed to express it goes up quickly. If we are a large power of a small\n\t\t// number (like 0.5 ^ 5000), this loop becomes very slow because of the very\n\t\t// high number of digits it must compute. To prevent that, round x.\n\t\tx.Round(x, s*2, inf.RoundHalfUp)\n\t}\n\n\tif neg {\n\t\tz = z.QuoRound(decimalOne, z, s+2, inf.RoundHalfUp)\n\t}\n\treturn z.Round(z, s, inf.RoundHalfUp)\n}", "func IntRsh(z *big.Int, x *big.Int, n uint) *big.Int", "func reverseInt(num int) int {\n\tvar r int\n\n\t//if num negative -> convert to positve first\n\tif num < 0 {\n\t\tnum = num * -1\n\t\tfor num > 0 {\n\t\t\t//pop: %10 and x /=10\n\t\t\tr = r*10 + num%10\n\t\t\tnum = num / 10\n\t\t}\n\t\t//if r is out of range\n\t\tif r > 2147483647 || r < -2147483647 {\n\t\t\treturn 0\n\t\t}\n\t\treturn r * -1\n\t}\n\tfor num > 0 {\n\t\tr = r*10 + num%10\n\t\tnum = num / 10\n\t}\n\n\t//if r is out of range\n\tif r > 2147483647 || r < -2147483647 {\n\t\treturn 0\n\t}\n\treturn r\n}", "func Round(v float64) int {\n\tx := strconv.FormatFloat(v, 'f', 0, 64)\n\tr, err := strconv.Atoi(x)\n\tif err != nil {\n\t\t// Shouldn't happen.\n\t\tlog.Fatalf(\"failed to parse float %f with 0 decimal values as int: %err\", x, err)\n\t}\n\treturn r\n}", "func reverseInt(n int) int {\r\n\tmult := 1\r\n\tif n < 0 {\r\n\t\tmult = -1\r\n\t\tn = -n\r\n\t}\r\n\tnewInt := 0\r\n\r\n\tfor n > 0 {\r\n\t\t//remainder of each spot (right to left), next time through mult by 10 and add new remainder and continue dividing source int by 10 until ==0\r\n\t\tremainder := n % 10\r\n\t\tnewInt *= 10\r\n\t\tnewInt += remainder\r\n\t\tn /= 10\r\n\t}\r\n\treturn mult * newInt\r\n}", "func (jz *Jzon) Integer() (n int64, err error) {\n\tif jz.Type != JzTypeInt {\n\t\treturn n, expectTypeOf(JzTypeInt, jz.Type)\n\t}\n\n\treturn jz.data.(int64), nil\n}", "func reverseInt(number int32) int32 {\n\tvar reversed, residuoDigit int32\n\treversed = 0\n\tfor number != 0 {\n\t\tresiduoDigit = (number % 10) // residuo\n\t\treversed = reversed*10 + residuoDigit // reversa el residuo\n\t\tnumber = (number / 10) // pasa al siguiente digito\n\t}\n\treturn reversed\n}", "func ReverseInteger(x int) int {\n\tif x == 0 {\n\t\treturn 0\n\t}\n\n\tisNeg := x < 0\n\txString := strconv.Itoa(x)\n\n\tvar xStringReverse string\n\tif isNeg {\n\t\txStringReverse = Reverse(xString[1:])\n\t} else {\n\t\txStringReverse = Reverse(xString)\n\t}\n\n\ti64, err := strconv.ParseInt(xStringReverse, 10, 32)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\tif isNeg {\n\t\ti64 *= -1\n\t}\n\n\treturn int(i64)\n}", "func round(val float64) int32 {\n\tif val < 0 {\n\t\treturn int32(val - 0.5)\n\t}\n\treturn int32(val + 0.5)\n}", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func (a *decimal) RoundedInteger() uint64 {\n\tif a.dp > 20 {\n\t\treturn 0xFFFFFFFFFFFFFFFF\n\t}\n\tvar i int\n\tn := uint64(0)\n\tfor i = 0; i < a.dp && i < a.nd; i++ {\n\t\tn = n*10 + uint64(a.d[i]-'0')\n\t}\n\tfor ; i < a.dp; i++ {\n\t\tn *= 10\n\t}\n\tif shouldRoundUp(a, a.dp) {\n\t\tn++\n\t}\n\treturn n\n}", "func round(num float64) int {\n\treturn int(num + math.Copysign(0.5, num))\n}", "func round(num float64) int {\n\treturn int(num + math.Copysign(0.5, num))\n}", "func round(num float64) int {\n\treturn int(num + math.Copysign(0.5, num))\n}", "func (n Number) Int() int {\n\tif n == 0 {\n\t\treturn 0\n\t}\n\treturn int(math.Round(float64(n)))\n}", "func reverse(x int) int {\n\tn := int32(x) // golang中的int可能是64位的\n\tres := int32(0)\n\tfor n != 0 {\n\t\tif (res*10+n%10)/10 != res {\n\t\t\treturn 0 // overflow\n\t\t}\n\t\tres = res*10 + n%10\n\t\tn /= 10\n\t}\n\treturn int(res)\n}", "func reverse(x int) int {\n\txStr := strconv.Itoa(abs(x))\n\trunes := []rune(xStr)\n\n\tfor i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {\n\t\trunes[i], runes[j] = runes[j], runes[i]\n\t}\n\n\tres, _ := strconv.Atoi(string(runes))\n\n\t// math.MinInt32 == -(1 << 31)\n\t// math.MaxInt32 == (1 << 31) - 1\n\tif res < math.MinInt32 || res > math.MaxInt32 { // overflow\n\t\treturn 0\n\t}\n\n\tif x < 0 {\n\t\treturn -res\n\t}\n\treturn res\n}", "func (x *Big) Int(z *big.Int) *big.Int {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Int)\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn z\n\t}\n\n\tif x.isCompact() {\n\t\tz.SetUint64(x.compact)\n\t} else {\n\t\tz.Set(&x.unscaled)\n\t}\n\tif x.Signbit() {\n\t\tz.Neg(z)\n\t}\n\tif x.exp == 0 {\n\t\treturn z\n\t}\n\treturn bigScalex(z, z, x.exp)\n}", "func (f Number) Int(context.Context) int64 {\n\treturn int64(math.Trunc(float64(f)))\n}", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func round(val float64) int {\n\tif val < 0 {\n\t\treturn int(val - 0.5)\n\t}\n\treturn int(val + 0.5)\n}", "func RoundUpPowerOfTwo(x int32) int32 {\n\tx--\n\tx |= (x >> 1)\n\tx |= (x >> 2)\n\tx |= (x >> 4)\n\tx |= (x >> 8)\n\tx |= (x >> 16)\n\treturn x + 1\n}", "func (z *Int) Int64() int64 {\n\treturn int64(z[0] & 0x7fffffffffffffff)\n}", "func reverse2(x int) int {\n\tans := 0\n\tfor x != 0 {\n\t\tans = ans*10 + (x % 10)\n\t\tif ans < math.MinInt32 || math.MaxInt32 < ans {\n\t\t\treturn 0 // early prune\n\t\t}\n\t\tx /= 10\n\t}\n\treturn ans\n}", "func reverse(x int) int {\n\tneg := false\n\tif x < 0 {\n\t\tneg = true\n\t\tx = -x\n\t}\n\tr := 0\n\tfor x != 0 {\n\t\td := x % 10\n\t\tr = r*10 + d\n\t\tx /= 10\n\t}\n\tif neg {\n\t\tr = -r\n\t}\n\tif r >= (1<<31-1) || r < -(1<<31) {\n\t\treturn 0\n\t}\n\treturn r\n}", "func CLZ(x int64) (n int)", "func ReverseInteger(n int) int {\n var sig int = (n >> 31) * 2 + 1\n var n0 int = n * sig\n var res int = 0\n for n0 > 0 {\n var temp = n0 % 10;\n n0 /= 10\n res = res * 10 + temp\n }\n return res * sig\n}", "func reverseInt(a int) int{\n revNum := 0\n for ; a > 0 ; a = a/10 {\n revNum = 10 * revNum + a % 10\n }\n return revNum \n}", "func IntDiv(z *big.Int, x, y *big.Int,) *big.Int", "func FloatInt(x *big.Float, z *big.Int,) (*big.Int, big.Accuracy,)", "func Int(val interface{}) (int, error) {\n\ti, err := Int64(val)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int(i), nil\n}", "func IntRem(z *big.Int, x, y *big.Int,) *big.Int", "func (d LegacyDec) RoundInt64() int64 {\n\tchopped := chopPrecisionAndRoundNonMutative(d.i)\n\tif !chopped.IsInt64() {\n\t\tpanic(\"Int64() out of bound\")\n\t}\n\treturn chopped.Int64()\n}", "func reverse(x int) (int, error) {\n\terr := errors.New(\"Integer overflow\")\n\n\tif x > math.MaxInt32 || x < math.MinInt32 {\n\t\treturn 0, err\n\t}\n\n\tsign := 1\n\tif x < 0 {\n\t\tsign *= -1\n\t}\n\tx *= sign\n\trevX := 0\n\tfor x > 0 {\n\t\trevX = revX*10 + x%10\n\t\tx /= 10\n\t}\n\treturn revX * sign, nil\n}", "func ExampleInt() {\n\n\tfmt.Println(conv.Uint(\"123.456\")) // 123\n\tfmt.Println(conv.Uint(\"-123.456\")) // 0\n\tfmt.Println(conv.Uint8(uint64(math.MaxUint64))) // 255\n\t// Output:\n\t// 123 <nil>\n\t// 0 <nil>\n\t// 255 <nil>\n}", "func round(r float32) int32 {\n\tif r >= 0 {\n\t\treturn int32(r + 0.5)\n\t}\n\n\treturn int32(r - 0.5)\n}", "func Round(f float64) int {\n\tif math.Abs(f) < 0.5 {\n\t\treturn 0\n\t}\n\treturn int(f + math.Copysign(0.5, f))\n}", "func Iround(v float64) int {\n\tif v >= 0 {\n\t\treturn int(v + 0.5)\n\t}\n\treturn int(v - 0.5)\n}", "func IntQuo(z *big.Int, x, y *big.Int,) *big.Int", "func IntQuoRem(z *big.Int, x, y, r *big.Int,) (*big.Int, *big.Int,)", "func Round(num, precision float64) float64 {\n\tshift := math.Pow(10, precision)\n\treturn roundInt(num * shift)\n}", "func (g GenericBackend) Round(value int) int {\n\tconst genericAlignment = 16\n\t// Inspired by Chromium's base/bits.h:Align() function.\n\treturn (value + genericAlignment - 1) & ^(genericAlignment - 1)\n}", "func (f Float) floor_int() (int) {\n i := int(f)\n if f < Float(0.0) && f != Float(i) { \n return i - 1\n }\n return i \n}", "func IntLsh(z *big.Int, x *big.Int, n uint) *big.Int", "func IntAbs(z *big.Int, x *big.Int,) *big.Int", "func reverse(x int) int {\n\tif x == 0 {\n\t\treturn x\n\t}\n\n\tisNegative := false\n\tif x < 0 {\n\t\tisNegative = true\n\t\tx = -x\n\t}\n\n\tm := x / 10\n\tc := x % 10\n\n\tvar result int\n\tfor m > 0 {\n\t\tresult = result*10 + c\n\t\tc = m % 10\n\t\tm = m / 10\n\t}\n\n\tresult = result*10 + c\n\n\tif isNegative {\n\t\tresult = -result\n\t\tif result < -int(math.Pow(float64(2), float64(31))) {\n\t\t\treturn 0\n\t\t}\n\t}else {\n\t\tif result > int(math.Pow(float64(2), float64(31)))-1 {\n\t\t\treturn 0\n\t\t}\n\t}\n\t\n\treturn result\n}", "func CLZ_FRAC(in int32, lz *int32, frac_Q7 *int32) {\n\tlzeros := CLZ32(in)\n\t*lz = lzeros\n\t*frac_Q7 = ROR32(in, 24-int(lzeros)) & 0x7f\n}", "func roundUp2(v uint32) uint32 {\n\tif v == 0 {\n\t\treturn 1\n\t}\n\tv--\n\tv |= v >> 1\n\tv |= v >> 2\n\tv |= v >> 4\n\tv |= v >> 8\n\tv |= v >> 16\n\tv++\n\treturn v\n}", "func Round(val float64, place int) float64 {\n\tshift := math.Pow(10, float64(place))\n\treturn math.Floor(val*shift+.5) / shift\n}", "func digitsToInt(digits ...int) int {\n\tn := 0\n\tfor i := range digits {\n\t\tn += digits[i] * int(math.Pow10(len(digits)-i-1))\n\t}\n\treturn n\n}", "func IntScan(z *big.Int, s fmt.ScanState, ch rune) error", "func ZeroInt(v interface{}) int {\n\ti, err := Int64(v)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn int(i)\n}", "func integerValue(tls *libc.TLS, zArg uintptr) int32 { /* speedtest1.c:210:12: */\n\tvar v sqlite3_int64 = int64(0)\n\tvar i int32\n\tvar isNeg int32 = 0\n\tif int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '-' {\n\t\tisNeg = 1\n\t\tzArg++\n\t} else if int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '+' {\n\t\tzArg++\n\t}\n\tif (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0)))) == '0') && (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(1)))) == 'x') {\n\t\tvar x int32\n\t\tzArg += uintptr(2)\n\t\tfor (libc.AssignInt32(&x, hexDigitValue(tls, *(*int8)(unsafe.Pointer(zArg + uintptr(0)))))) >= 0 {\n\t\t\tv = ((v << 4) + sqlite3_int64(x))\n\t\t\tzArg++\n\t\t}\n\t} else {\n\t\tfor libc.Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(zArg + uintptr(0))))) != 0 {\n\t\t\tv = (((v * int64(10)) + sqlite3_int64(*(*int8)(unsafe.Pointer(zArg + uintptr(0))))) - int64('0'))\n\t\t\tzArg++\n\t\t}\n\t}\n\tfor i = 0; uint32(i) < (uint32(unsafe.Sizeof(aMult)) / uint32(unsafe.Sizeof(struct {\n\t\tzSuffix uintptr\n\t\tiMult int32\n\t}{}))); i++ {\n\t\tif sqlite3.Xsqlite3_stricmp(tls, aMult[i].zSuffix, zArg) == 0 {\n\t\t\tv = v * (sqlite3_int64(aMult[i].iMult))\n\t\t\tbreak\n\t\t}\n\t}\n\tif v > int64(0x7fffffff) {\n\t\tfatal_error(tls, ts+2153 /* \"parameter too la...\" */, 0)\n\t}\n\treturn func() int32 {\n\t\tif isNeg != 0 {\n\t\t\treturn int32(-v)\n\t\t}\n\t\treturn int32(v)\n\t}()\n}", "func zigzag32(v int32) uint32 {\n\tif v < 0 {\n\t\treturn ((uint32)(-v))*2 - 1\n\t} else {\n\t\treturn uint32(v * 2)\n\t}\n}", "func (f Fixed) Int() int64 {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.fp / scale\n}", "func (r *ISAAC) Int() int {\n\tu := uint(r.Uint64())\n\treturn int(u << 1 >> 1) // clear sign bit if int == int32\n}", "func round(f float64) int {\n\tif math.Abs(f) < 0.5 {\n\t\treturn 0\n\t}\n\treturn int(f + math.Copysign(0.5, f))\n}", "func reverse(n int) int {\n\tleading := true\n\tr := 0\n\tfor n > 0 {\n\t\tremainder := n % 10\n\t\tif leading {\n\t\t\tif remainder == 0 {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tleading = false\n\t\t}\n\t\tr *= 10\n\t\tr += remainder\n\t\tn /= 10\n\t}\n\treturn r\n}", "func RoundUpPowerOf2(n int) int {\n\tn--\n\tn |= n >> 1\n\tn |= n >> 2\n\tn |= n >> 4\n\tn |= n >> 8\n\tn |= n >> 16\n\tn++\n\treturn n\n}", "func reverse4(x int) int {\n\tans := int32(0)\n\tfor x != 0 {\n\t\tif ans < math.MinInt32/10 || math.MaxInt32/10 < ans {\n\t\t\treturn 0 // early prune\n\t\t}\n\t\tans = ans*10 + int32(x%10)\n\t\tx /= 10\n\t}\n\treturn int(ans)\n}", "func reverse1(x int) int {\n\tvar s string\n\tif x < 0 {\n\t\ts = strconv.Itoa(-x)\n\t} else {\n\t\ts = strconv.Itoa(x)\n\t}\n\n\tbs := []byte(s)\n\thead := 0\n\ttail := len(bs) - 1\n\tfor head < tail {\n\t\tbs[head], bs[tail] = bs[tail], bs[head]\n\t\thead++\n\t\ttail--\n\t}\n\trs := string(bs)\n\tif x < 0 {\n\t\trs = \"-\" + rs\n\t}\n\ty, err := strconv.Atoi(rs)\n\tif err != nil {\n\t\tfmt.Println(err, rs)\n\t}\n\tif y > math.MaxInt32 || y < math.MinInt32 {\n\t\treturn 0\n\t}\n\treturn y\n}", "func roundUp(v uint64) uint64 {\n\tv--\n\tv |= v >> 1\n\tv |= v >> 2\n\tv |= v >> 4\n\tv |= v >> 8\n\tv |= v >> 16\n\tv |= v >> 32\n\tv++\n\treturn v\n}", "func roundUp(v uint64) uint64 {\n\tv--\n\tv |= v >> 1\n\tv |= v >> 2\n\tv |= v >> 4\n\tv |= v >> 8\n\tv |= v >> 16\n\tv |= v >> 32\n\tv++\n\treturn v\n}", "func Int() int {\n\treturn int(Int64n(int64(1000)))\n}", "func Int(num cty.Value) (cty.Value, error) {\n\tif num == cty.PositiveInfinity || num == cty.NegativeInfinity {\n\t\treturn cty.NilVal, fmt.Errorf(\"can't truncate infinity to an integer\")\n\t}\n\treturn IntFunc.Call([]cty.Value{num})\n}", "func IntToInt(int_ int) int {\n\treturn int_\n}", "func(a Integer) ToInteger() Integer { return a }", "func (z *Int) Rsh(x *Int, n uint) *Int {}", "func (x *Float) Int(z *Int) (*Int, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func writeInt(out io.Writer, s int64) {\n\tif s < 0 {\n\t\twriteUint(out, 2*(uint64(-s)-1)+1)\n\t} else {\n\t\twriteUint(out, 2*(uint64(s)))\n\t}\n}", "func zigzag64(v int64) uint64 {\n\tif v < 0 {\n\t\treturn uint64(-v)*2 - 1\n\t} else {\n\t\treturn uint64(v) * 2\n\t}\n}", "func (h *hinter) round(x f26dot6) f26dot6 {\n\tif h.roundPeriod == 0 {\n\t\treturn x\n\t}\n\tneg := x < 0\n\tx -= h.roundPhase\n\tx += h.roundThreshold\n\tif x >= 0 {\n\t\tx = (x / h.roundPeriod) * h.roundPeriod\n\t} else {\n\t\tx -= h.roundPeriod\n\t\tx += 1\n\t\tx = (x / h.roundPeriod) * h.roundPeriod\n\t}\n\tx += h.roundPhase\n\tif neg {\n\t\tif x >= 0 {\n\t\t\tx = h.roundPhase - h.roundPeriod\n\t\t}\n\t} else if x < 0 {\n\t\tx = h.roundPhase\n\t}\n\treturn x\n}", "func IntSqrt(z *big.Int, x *big.Int,) *big.Int", "func (ndf *NDFlagSet) ZVInt(name string, example int, usage string) *int {\n\tvar iv int\n\tndf.ZVIntVar(&iv, name, example, usage)\n\treturn &iv\n}", "func UnwrapInt(val *int) int {\n\tif val == nil {\n\t\treturn 0\n\t}\n\treturn *val\n}", "func RandomInt(ceiling int) int {\n\tif ceiling <= 0 {\n\t\treturn 0\n\t}\n\n\trandomBytes := make([]byte, 4)\n\trand.Read(randomBytes)\n\n\treturn int(siaencoding.DecUint32(randomBytes)) % ceiling\n}", "func IntToInt64(int_ int) (int64_ int64) {\n\tint64_ = int64(int_)\n\n\treturn\n}", "func Int(param interface{}) int64 {\n\tvar v int64\n\tif param != nil {\n\t\tswitch param.(type) {\n\t\tcase float64:\n\t\t\tv = int64(param.(float64))\n\t\tcase int:\n\t\t\tv = int64(param.(int))\n\t\tdefault:\n\t\t\tv = param.(int64)\n\t\t}\n\t}\n\treturn v\n}", "func ReverseToInt(s string) (int32, error) {\n\tsRev, err := reverseS(s)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\ti, err := strconv.ParseInt(sRev, 10, 32)\n\treturn int32(i), err\n}", "func reverse(x int) int {\n\tisNeg := false\n\tif x < 0 {\n\t\tisNeg = true\n\t\tx = -x\n\t}\n\n\tans := 0\n\tfor x > 0 {\n\t\tans = ans*10 + x%10\n\t\tx = x / 10\n\n\t}\n\n\tif isNeg {\n\t\tans = -ans\n\t\tif ans < (-1 * (1 << 31)) {\n\t\t\treturn 0\n\t\t}\n\t\treturn ans\n\t}\n\n\tif ans > 1<<31 {\n\t\treturn 0\n\t}\n\treturn ans\n\n}", "func (z *Big) QuoInt(x, y *Big) *Big { return z.Context.QuoInt(z, x, y) }", "func Int(n, min, max int) int {\n\tif n < min {\n\t\tn = min\n\t} else if n > max {\n\t\tn = max\n\t}\n\treturn n\n}", "func Round(arg float64) float64 {\n\treturn math.Round(arg)\n}", "func (a *decimal) RoundUp(nd int) {\n\tif nd < 0 || nd >= a.nd {\n\t\treturn\n\t}\n\n\t// round up\n\tfor i := nd - 1; i >= 0; i-- {\n\t\tc := a.d[i]\n\t\tif c < '9' { // can stop after this digit\n\t\t\ta.d[i]++\n\t\t\ta.nd = i + 1\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Number is all 9s.\n\t// Change to single 1 with adjusted decimal point.\n\ta.d[0] = '1'\n\ta.nd = 1\n\ta.dp++\n}", "func round(f float64) int {\n\tif f < 0 {\n\t\treturn int(math.Ceil(f - 0.5))\n\t}\n\treturn int(math.Floor(f + 0.5))\n}", "func (g I915Backend) Round(value int) int {\n\tconst i915Alignment = 16\n\t// Inspired by Chromium's base/bits.h:Align() function.\n\treturn (value + i915Alignment - 1) & ^(i915Alignment - 1)\n}", "func Int(input interface{}) (output int64, err error) {\n\n\tswitch castValue := input.(type) {\n\tcase Inter:\n\t\toutput = castValue.Int()\n\t\treturn\n\tcase string:\n\t\toutput, err = strconv.ParseInt(castValue, 10, 64)\n\t\treturn\n\tcase []byte:\n\t\toutput, err = strconv.ParseInt(string(castValue), 10, 64)\n\t\treturn\n\tcase int:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase int8:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase int16:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase int32:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase int64:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase uint:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase uint8:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase uint16:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase uint32:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase uint64:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase float32:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase float64:\n\t\toutput = int64(castValue)\n\t\treturn\n\tcase bool:\n\t\toutput = int64(0)\n\t\tif castValue {\n\t\t\toutput = int64(1)\n\t\t}\n\t\treturn\n\tcase nil:\n\t\toutput = int64(0)\n\t\treturn\n\tdefault:\n\t\terr = NewCastError(\"Could not convert to int\")\n\t}\n\treturn\n}", "func (bc ByteCount) ConvertRound(unit ByteCount, precision int) float64 {\n\tp := math.Pow(10, float64(precision))\n\tv := math.Round(p*float64(bc)/float64(unit)) / p\n\treturn v\n}", "func intScale(val int, val_range int, out_range int) int {\n\tnum := val*(out_range-1)*2 + (val_range - 1)\n\tdem := (val_range - 1) * 2\n\treturn num / dem\n}", "func ToInt(i interface{}) (int, error) {\n\tn, err := parseInt64(i)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"cannot convert %#v of type %T to int64\", i, i)\n\t}\n\tif n > MaxInt || n < MinInt {\n\t\treturn 0, strconv.ErrRange\n\t}\n\treturn int(n), nil\n}", "func WrapInt(min, max, value int) int {\n\tmin, max = MinMaxInt(min, max)\n\tvar maxLessMin = max - min\n\tfor value < min {\n\t\tvalue += maxLessMin\n\t}\n\tfor value >= max {\n\t\tvalue -= maxLessMin\n\t}\n\treturn value\n\t//Original implementation is not working well for unsigned types:\n\t//return ((value-min)%maxLessMin+maxLessMin)%maxLessMin + min\n}", "func CastInt(exec boil.Executor, v0 string) (int, error) {\n\tvar err error\n\n\t// sql query\n\tconst query = `SELECT public.cast_int($1)`\n\n\t// run query\n\tvar ret int\n\n\terr = exec.QueryRow(query, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ret, nil\n}", "func (d LegacyDec) TruncateInt() Int {\n\treturn NewIntFromBigInt(chopPrecisionAndTruncateNonMutative(d.i))\n}", "func toInt(card z.Card) int {\n\tresult := MapRankToInt[card.Rank]*10 + MapSuitToInt[card.Suit]\n\treturn result\n}", "func toInt(card z.Card) int {\n\tresult := MapRankToInt[card.Rank]*10 + MapSuitToInt[card.Suit]\n\treturn result\n}", "func (i ID) Round() uint64 {\n\treturn i.Raw() >> (64 - BitwidthRound)\n}", "func (p *PCG64) Int() int {\n\tu := uint(p.Int63())\n\treturn int(u << 1 >> 1) // clear sign bit if int == int32\n}", "func (a *AST) Int() int {\n\tvar dst C.int\n\tC.Z3_get_numeral_int(a.rawCtx, a.rawAST, &dst)\n\treturn int(dst)\n}" ]
[ "0.6222463", "0.60707176", "0.5877097", "0.5812608", "0.57941353", "0.55734134", "0.5557275", "0.549525", "0.5482456", "0.54750586", "0.54631066", "0.54584205", "0.53971136", "0.53742886", "0.53742886", "0.53742886", "0.5358152", "0.53350157", "0.5330478", "0.53285986", "0.53175837", "0.5282822", "0.5279364", "0.5265372", "0.5259846", "0.52346474", "0.5222672", "0.52220327", "0.5213966", "0.5167652", "0.5150605", "0.5147018", "0.5128679", "0.5127708", "0.512198", "0.51147205", "0.5111907", "0.51014096", "0.5091282", "0.5061663", "0.50526154", "0.50209105", "0.5006338", "0.50022984", "0.49993563", "0.49723735", "0.4963372", "0.49443048", "0.49252155", "0.49231675", "0.49060243", "0.4905417", "0.48991057", "0.4882969", "0.4878758", "0.4875779", "0.4871094", "0.4866183", "0.48639902", "0.4860446", "0.485857", "0.48558214", "0.48518786", "0.48487106", "0.48487106", "0.48476946", "0.48433647", "0.4837419", "0.48349434", "0.48299345", "0.4829319", "0.48238775", "0.48222673", "0.48134923", "0.4806691", "0.4803932", "0.47976905", "0.47964826", "0.47942078", "0.4792282", "0.47922558", "0.4790975", "0.47908893", "0.47805628", "0.47792837", "0.4776853", "0.47716", "0.47633007", "0.4757308", "0.47554314", "0.47548887", "0.47486204", "0.47357845", "0.47230616", "0.47100002", "0.47065565", "0.47065565", "0.46993232", "0.46924046", "0.46887052" ]
0.7330858
0
Scale returns x's scale.
func (x *Big) Scale() int { return -x.exp }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func (t *Transform) GetScale() *Vector {\n\treturn t.Scale\n}", "func (p Point) Scale(s Length) Point {\n\treturn Point{p.X * s, p.Y * s}\n}", "func (this *Transformable) GetScale() (scale Vector2f) {\n\tscale.fromC(C.sfTransformable_getScale(this.cptr))\n\treturn\n}", "func (v *V_elem) Scale(ofs, scale *[3]float32) *[3]int {\n\treturn &[3]int{\n\t\tint((v.x[0] + ofs[0]) * scale[0]),\n\t\tint((v.x[1] + ofs[1]) * scale[1]),\n\t\tint((v.x[2] + ofs[2]) * scale[2]),\n\t}\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func (t *Transform) Scale() lmath.Vec3 {\n\tt.access.RLock()\n\ts := t.scale\n\tt.access.RUnlock()\n\treturn s\n}", "func (w *GlfwWindow) GetScale() (x float64, y float64) {\n\n\treturn w.scaleX, w.scaleY\n}", "func (sx ScaleX) Normalize(min, max, x float64) float64 {\n\ttXMin := sx(min)\n\treturn (sx(x) - tXMin) / (sx(max) - tXMin)\n}", "func (p *Proc) Scale(x, y float64) {\n\tp.stk.scale(x, y)\n}", "func Scale(A float64, x *Matrix) (*Matrix, error) {\n\tout, _ := New(x.RowCount, x.ColCount, nil)\n\n\tfor rowID := 0; rowID < x.RowCount; rowID++ {\n\t\tfor colID := 0; colID < x.ColCount; colID++ {\n\t\t\tout.Matrix[rowID][colID] = A * x.Matrix[rowID][colID]\n\t\t}\n\t}\n\n\treturn out, nil\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (self *Rectangle) Scale(x int) *Rectangle{\n return &Rectangle{self.Object.Call(\"scale\", x)}\n}", "func (p Point) Scale(s float64) Point {\n\treturn NewPoint(p.X*s, p.Y*s)\n}", "func Scale(X *mat.Dense) *mat.Dense {\n\tXout, _ := NewStandardScaler().FitTransform(X, nil)\n\treturn Xout\n}", "func (this *RectangleShape) GetScale() (scale Vector2f) {\n\tscale.fromC(C.sfRectangleShape_getScale(this.cptr))\n\treturn\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (p Point) Scale(f float64) Point {\n\treturn Point{p[0] * f, p[1] * f, p[2] * f}\n}", "func Scale(w, h int) int {\n\ta := w / WIDTH\n\tb := h / HEIGHT\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "func (f *Font) emScaleX(v int16) Position { return Position(v) * f.XScale / f.faceUpem }", "func (o ContainerOutput) Scale() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Container) pulumi.IntOutput { return v.Scale }).(pulumi.IntOutput)\n}", "func scale(val float64, min float64, max float64, outMin float64, outMax float64) float64 {\r\n\tdenom := 1.0\r\n\ty := 0.0\r\n\tif outMin - min != 0 {\r\n\t\tdenom = outMin - min\r\n\t\ty = (outMax - max) / denom * val - min + outMin\r\n\t} else {\r\n\t\ty = outMax / max * val - min + outMin\r\n\t}\r\n\treturn y\r\n}", "func (o *CanvasItem) X_EditGetScale() gdnative.Vector2 {\n\t//log.Println(\"Calling CanvasItem.X_EditGetScale()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"CanvasItem\", \"_edit_get_scale\")\n\n\t// Call the parent method.\n\t// Vector2\n\tretPtr := gdnative.NewEmptyVector2()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewVector2FromPointer(retPtr)\n\treturn ret\n}", "func (self Text) GetScale() (x, y float32) {\n\tv := C.sfText_getScale(self.Cref)\n\treturn float32(v.x), float32(v.y)\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (p *point) scaleBy(factor int) {\n\tp.x *= factor\n\tp.y *= factor\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (self Transform) Scale(scaleX, scaleY float32) {\n\tC.sfTransform_scale(self.Cref, C.float(scaleX), C.float(scaleY))\n}", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func (v Vector) Scale(c float64) Vector {\n\tfor i, x := range v {\n\t\tv[i] = x * c\n\t}\n\treturn v\n}", "func (o ContainerServiceOutput) Scale() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *ContainerService) pulumi.IntOutput { return v.Scale }).(pulumi.IntOutput)\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func (b *Base) Scale(w http.ResponseWriter, r *http.Request) {\n\tb.log.Printf(\"%s %s -> %s\", r.Method, r.URL.Path, r.RemoteAddr)\n\n\tsOptions, pOptions, kOptions, oOptions := render.SetDefaultScaleOptions()\n\n\tpv := render.PageVars{\n\t\tTitle: \"Practice Scales and Arpeggios\", // default scale initially displayed is A Major\n\t\tScalearp: \"Scale\",\n\t\tPitch: \"Major\",\n\t\tKey: \"A\",\n\t\tScaleImgPath: \"img/scale/major/a1.png\",\n\t\tGifPath: \"\",\n\t\tAudioPath: \"mp3/scale/major/a1.mp3\",\n\t\tAudioPath2: \"mp3/drone/a1.mp3\",\n\t\tLeftLabel: \"Listen to Major scale\",\n\t\tRightLabel: \"Listen to Drone\",\n\t\tScaleOptions: sOptions,\n\t\tPitchOptions: pOptions,\n\t\tKeyOptions: kOptions,\n\t\tOctaveOptions: oOptions,\n\t}\n\n\tif err := render.Render(w, \"scale.html\", pv); err != nil {\n\t\tb.log.Printf(\"%s %s -> %s : ERROR : %v\", r.Method, r.URL.Path, r.RemoteAddr, err)\n\t\treturn\n\t}\n}", "func (tt *telloTrackT) deriveScale() (scale float32) {\n\tscale = 1.0 // minimum scale value\n\tif tt.maxX > scale {\n\t\tscale = tt.maxX\n\t}\n\tif -tt.minX > scale {\n\t\tscale = -tt.minX\n\t}\n\tif tt.maxY > scale {\n\t\tscale = tt.maxY\n\t}\n\tif -tt.minY > scale {\n\t\tscale = -tt.minY\n\t}\n\tscale = float32(math.Ceil(float64(scale)))\n\treturn scale\n}", "func (w *windowImpl) Scale(dr image.Rectangle, src screen.Texture, sr image.Rectangle, op draw.Op, opts *screen.DrawOptions) {\n\tpanic(\"not implemented\") // TODO: Implement\n}", "func (v Vec3) Scale(s float64) Vec3 {\n\treturn Vec3{v[0] * s, v[1] * s, v[2] * s}\n}", "func (v Vector) Scale(scale float64) Vector {\n\treturn Vector{\n\t\tX: v.X * scale,\n\t\tY: v.Y * scale,\n\t\tZ: v.Z * scale}\n}", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (sy ScaleY) Normalize(min, max, x float64) float64 {\n\ttYMin := sy(min)\n\treturn (sy(x) - tYMin) / (sy(max) - tYMin)\n}", "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ViewBoundScale(value float64) *SimpleElement { return newSEFloat(\"viewBoundScale\", value) }", "func (r Rectangle) Scale(factor float64) Rectangle {\n\treturn Rectangle{\n\t\tMin: r.Min.Mul(factor),\n\t\tMax: r.Max.Mul(factor),\n\t}\n}", "func scale(v []int, x int) []int {\n\ty := make([]int, len(v))\n\tfor i := range v {\n\t\ty[i] = v[i] * x\n\t}\n\treturn y\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (c *Circle) Scale(f float64) {\n\tc.radius *= f\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (self *ComponentScaleMinMax) ScaleMin() *Point{\n return &Point{self.Object.Get(\"scaleMin\")}\n}", "func (me XsdGoPkgHasElem_Scale) ScaleDefault() xsdt.Double {\r\n\tvar x = new(xsdt.Double)\r\n\tx.Set(\"1.0\")\r\n\treturn *x\r\n}", "func scale(bytes int64) (scaled int64, scale string) {\n\tif bytes < 0 {\n\t\tscaled, scale = uscale(uint64(bytes * -1))\n\t\tscaled *= -1\n\t} else {\n\t\tscaled, scale = uscale(uint64(bytes))\n\t}\n\treturn\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (me *XsdGoPkgHasElem_Scale) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_Scale; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (v *Vec4) Scale(s float32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\tv.W *= s\n}", "func (self *ComponentScaleMinMax) ScaleMax() *Point{\n return &Point{self.Object.Get(\"scaleMax\")}\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (this *RectangleShape) Scale(factor Vector2f) {\n\tC.sfRectangleShape_scale(this.cptr, factor.toC())\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (me XsdGoPkgHasElems_Scale) ScaleDefault() xsdt.Double {\r\n\tvar x = new(xsdt.Double)\r\n\tx.Set(\"1.0\")\r\n\treturn *x\r\n}", "func (self Text) Scale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_scale(self.Cref, v)\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func (f *Font) GetCurrentScale() float32 {\n\t_, uiHeight := f.Owner.GetResolution()\n\tdesignHeight := f.Owner.GetDesignHeight()\n\treturn float32(uiHeight) / float32(designHeight)\n}", "func (p *P1D) Scale(factor float64) {\n\tp.bng.scaleW(factor)\n}", "func (b *IconButton) Scale(scale float32) *IconButton {\n\tb.size = b.th.TextSize.Scale(scale * 0.72)\n\treturn b\n}", "func linearScale(value, min, max float64) float64 {\n\treturn (value - min) * (1 / (max - min))\n}", "func ScaleFunc(v *Vertex, f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (c *canvasRenderer) Scale(amount sprec.Vec2) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.ScaleMat4(amount.X, amount.Y, 1.0),\n\t)\n}", "func (self *Rectangle) Scale1O(x int, y int) *Rectangle{\n return &Rectangle{self.Object.Call(\"scale\", x, y)}\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}" ]
[ "0.7067415", "0.69420356", "0.6934427", "0.691587", "0.6910443", "0.6908746", "0.6885395", "0.68813145", "0.6766992", "0.6717634", "0.6649341", "0.6649029", "0.6606986", "0.66068214", "0.66049236", "0.6601579", "0.65879315", "0.65610296", "0.6549763", "0.6510218", "0.6500102", "0.6479999", "0.6468801", "0.6439833", "0.64053094", "0.63763744", "0.63573986", "0.6347843", "0.63456255", "0.63433075", "0.63336515", "0.6318174", "0.63154817", "0.63128024", "0.6309066", "0.6303366", "0.6294318", "0.6278853", "0.6270955", "0.6257318", "0.6248213", "0.6248213", "0.6248213", "0.6248213", "0.6248213", "0.6248213", "0.6248213", "0.6214659", "0.6211634", "0.61867964", "0.6166094", "0.61576563", "0.615476", "0.61524475", "0.6147603", "0.6139002", "0.61379766", "0.6126034", "0.6090531", "0.6087735", "0.60835665", "0.6073907", "0.60557556", "0.60504156", "0.60449666", "0.6038583", "0.6036668", "0.6013126", "0.6006144", "0.59766454", "0.5976227", "0.59731835", "0.5970746", "0.5969965", "0.5961631", "0.5949911", "0.59399384", "0.5931551", "0.5926966", "0.591854", "0.5900595", "0.587845", "0.5873047", "0.586909", "0.5859819", "0.58579654", "0.5850484", "0.5845872", "0.5830443", "0.5813174", "0.57811046", "0.5780571", "0.5769825", "0.5758473", "0.57574886", "0.57484996", "0.5748169", "0.5737835", "0.5727926", "0.5721751" ]
0.66740763
10
Set sets z to x and returns z. The result might be rounded depending on z's Context, and even if z == x.
func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) Set(x *Float) *Float {}", "func (z *Rat) Set(x *Rat) *Rat {}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func RatSet(z *big.Rat, x *big.Rat,) *big.Rat", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (z *Int) Set(x *Int) *Int {}", "func (v *Vec3i) Set(x, y, z int32) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (v *Vector) Set(x, y, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (z *Float) SetFloat64(x float64) *Float {}", "func (c Cube) Set(x, y, z int, val []float64) {\n\tc.Data[x][y][z] = val\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func (c *Chunk) Set(x, y, z uint8) {\n\tc.Solid[x][y] |= 1 << z\n}", "func (z *Rat) SetInt(x *Int) *Rat {}", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func (z *Float) SetInt64(x int64) *Float {}", "func (z *E12) Set(x *E12) *E12 {\n\tz.C0 = x.C0\n\tz.C1 = x.C1\n\treturn z\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func (p *Point) Set(x, y float64) {\n\tp.Call(\"set\", x, y)\n}", "func (h heightmap) set(x, z, val uint8) {\n\th[(uint16(x)<<4)|uint16(z)] = val\n}", "func (f *Float) Set(x *Float) *Float {\n\tf.doinit()\n\tC.mpf_set(&f.i[0], &x.i[0])\n\treturn f\n}", "func IntSet(z *big.Int, x *big.Int,) *big.Int", "func (a *Vector3) Set(b Vector3) {\n\ta.X = b.X\n\ta.Y = b.Y\n\ta.Z = b.Z\n}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func (m *M) Set(r, c int, v Frac) {\n\tr, c = r-1, c-1\n\tm.values[r*m.c+c] = v.Reduce()\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func (p *G1Jac) Set(a *G1Jac) *G1Jac {\n\tp.X, p.Y, p.Z = a.X, a.Y, a.Z\n\treturn p\n}", "func (z *E6) Set(x *E6) *E6 {\n\tz.B0 = x.B0\n\tz.B1 = x.B1\n\tz.B2 = x.B2\n\treturn z\n}", "func (i *MyInt) set(x int) {\n\t*i = MyInt(x)\n}", "func (z *Rat) SetFrac64(a, b int64) *Rat {}", "func Set(name string, value float64) int64 {\n\treturn instance.Set(name, value)\n}", "func (t *Edge) Set(xP, yP, xQ, yQ int, zP, zQ float32) {\n\t// Note: the larger Y value is at the \"bottom\" or lower on the display\n\t// if +Y axis is downward.\n\tif yP > yQ {\n\t\tt.yBot = yP\n\t} else {\n\t\tt.yBot = yQ\n\t}\n\n\tt.xP = xP\n\tt.yP = yP\n\tt.xQ = xQ\n\tt.yQ = yQ\n\tt.zP = zP\n\tt.zQ = zQ\n\n\tt.x = xP\n\tt.y = yP\n\tt.d = 0\n\n\tt.yInc = 1\n\tt.xInc = 1\n\tt.dx = xQ - xP\n\tt.dy = yQ - yP\n\n\tif t.dx < 0 {\n\t\tt.xInc = -1\n\t\tt.dx = -t.dx\n\t}\n\tif t.dy < 0 {\n\t\tt.yInc = -1\n\t\tt.dy = -t.dy\n\t}\n\n\tif t.dy <= t.dx {\n\t\tt.m = t.dy << 1\n\t\tt.c = t.dx << 1\n\n\t\tif t.xInc < 0 {\n\t\t\tt.dx++\n\t\t}\n\t} else {\n\t\tt.c = t.dy << 1\n\t\tt.m = t.dx << 1\n\n\t\tif t.yInc < 0 {\n\t\t\tt.dy++\n\t\t}\n\t}\n}", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (v *value) set(val interface{}) Value {\n\tswitch val.(type) {\n\tcase int:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int64:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int64))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float64:\n\t\tv.valueType = Real\n\t\tfloatVal := val.(float64)\n\t\tv.real = floatVal\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(float32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase complex128:\n\t\tv.valueType = Complex\n\t\tcomplexVal := val.(complex128)\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tcase complex64:\n\t\tv.valueType = Complex\n\t\tcomplexVal := complex128(val.(complex64))\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tdefault:\n\t\treturn Zero()\n\t}\n\tv.precision = 1\n\treturn v\n}", "func (z *Float) SetUint64(x uint64) *Float {}", "func (point *Point) Z() float64 {\n\treturn point.z\n}", "func (z *Rat) SetUint64(x uint64) *Rat {}", "func (z *Big) SetRat(x *big.Rat) *Big {\n\tif x.IsInt() {\n\t\treturn z.Context.round(z.SetBigMantScale(x.Num(), 0))\n\t}\n\tvar num, denom Big\n\tnum.SetBigMantScale(x.Num(), 0)\n\tdenom.SetBigMantScale(x.Denom(), 0)\n\treturn z.Quo(&num, &denom)\n}", "func (z *Perplex) Set(y *Perplex) *Perplex {\n\tz.l.Set(&y.l)\n\tz.r.Set(&y.r)\n\treturn z\n}", "func (self *Graphics) SetZA(member int) {\n self.Object.Set(\"z\", member)\n}", "func (m *Matrix) Set(x, y int, val float64) {\n\treturn\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func (me *Tangle360Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func (obj VECTOR_TYPE) Set(x ConstVector) {\n if obj == x {\n return\n }\n if obj.Dim() != x.Dim() {\n panic(\"Set(): Vector dimensions do not match!\")\n }\n for it := obj.JOINT_ITERATOR(x); it.Ok(); it.Next() {\n s1, s2 := it.Get()\n switch {\n case s1 != nil && s2 != nil: s1.Set(s2)\n case s1 != nil : s1.SetValue(0.0)\n default : obj.AT(it.Index()).Set(s2)\n }\n }\n}", "func (z *Int) SetInt64(x int64) *Int {}", "func (p *EdwardsPoint) Set(t *EdwardsPoint) *EdwardsPoint {\n\tp.inner.X.Set(&t.inner.X)\n\tp.inner.Y.Set(&t.inner.Y)\n\tp.inner.Z.Set(&t.inner.Z)\n\tp.inner.T.Set(&t.inner.T)\n\treturn p\n}", "func (geom Geometry) SetPoint(index int, x, y, z float64) {\n\tC.OGR_G_SetPoint(\n\t\tgeom.cval,\n\t\tC.int(index),\n\t\tC.double(x),\n\t\tC.double(y),\n\t\tC.double(z))\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func (c *Complex64) Set(v complex64) {\n\tc.value = &v\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (p *CubicPolynomial) Set(y0, y1, D0, D1 float64) {\n\tp.a = y0\n\tp.b = D0\n\tp.c = 3*(y1-y0) - 2*D0 - D1\n\tp.d = 2*(y0-y1) + D0 + D1\n\t// Zero out any coefficients that are small relative to the others.\n\tsum := math.Abs(p.a) + math.Abs(p.b) + math.Abs(p.c) + math.Abs(p.d)\n\tp.a = ZeroSmall(p.a, sum, epsilon)\n\tp.b = ZeroSmall(p.b, sum, epsilon)\n\tp.c = ZeroSmall(p.c, sum, epsilon)\n\tp.d = ZeroSmall(p.d, sum, epsilon)\n}", "func (v *Vec3i) SetDiv(other Vec3i) {\n\tv.X /= other.X\n\tv.Y /= other.Y\n\tv.Z /= other.Z\n}", "func (obj *SparseRealVector) Set(x ConstVector) {\n if obj == x {\n return\n }\n if obj.Dim() != x.Dim() {\n panic(\"Set(): Vector dimensions do not match!\")\n }\n for it := obj.JOINT_ITERATOR(x); it.Ok(); it.Next() {\n s1, s2 := it.Get()\n switch {\n case s1 != nil && s2 != nil: s1.Set(s2)\n case s1 != nil : s1.SetValue(0.0)\n default : obj.AT(it.Index()).Set(s2)\n }\n }\n}", "func (z *BiComplex) Set(y *BiComplex) *BiComplex {\n\tz.l.Set(&y.l)\n\tz.r.Set(&y.r)\n\treturn z\n}", "func (z *Float) Copy(x *Float) *Float {}", "func (self *TileSprite) SetZA(member int) {\n self.Object.Set(\"z\", member)\n}", "func (r *Radix) set(v interface{}) {\n\tr.value = v\n}", "func (m *Mock) Set(t time.Time) time.Duration {\n\tm.Lock()\n\tdefer m.Unlock()\n\t_, d := m.set(t)\n\treturn d\n}", "func (p *RGBAf) Set(x, y int, c color.Color) {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn\n\t}\n\ti := p.PixOffset(x, y)\n\tc1 := color.RGBAModel.Convert(c).(color.RGBA)\n\ts := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857\n\ts[0] = float32(c1.R)\n\ts[1] = float32(c1.G)\n\ts[2] = float32(c1.B)\n\ts[3] = float32(c1.A)\n}", "func (c Currency) Set(i int64) Currency {\n\tc.m = i\n\tc.Valid = true\n\treturn c\n}", "func (me *Tangle90Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func (p *Int64) Set(q *Int64) *Int64 {\n\tp = NewInt64()\n\tfor n, a := range q.c {\n\t\tp.SetCoeff(n, a)\n\t}\n\treturn p\n}", "func (v *Vec3i) SetMul(other Vec3i) {\n\tv.X *= other.X\n\tv.Y *= other.Y\n\tv.Z *= other.Z\n}", "func (f *Fieldx) Set(v interface{}) error {\n\tif !f.IsExport() {\n\t\treturn ErrNotExported\n\t}\n\n\tif !f.value.CanSet() {\n\t\treturn errNotSettable\n\t}\n\n\tvv := reflect.ValueOf(v)\n\tif f.Kind() != vv.Kind() {\n\t\treturn fmt.Errorf(\"xstruct: value kind not match, want: %s but got %s\", f.Kind(), vv.Kind())\n\t}\n\n\tf.value.Set(vv)\n\n\treturn nil\n}", "func (f *Int64) Set(val int64) {\n\tf.set(-1, val, false)\n}", "func (m *Matrix) Set(x, y int, v int64) {\n\txl, yl := int(m.focus.Min().X)+x, int(m.focus.Min().Y)+y\n\tif xl < 0 || xl >= m.WAbs() || yl < 0 || yl >= m.HAbs() {\n\t\treturn\n\t}\n\tm.list[xl+m.WAbs()*yl] = v\n}", "func (me *Tanglepos180Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func (me *Tangle180Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func Set(k string, x interface{}, d time.Duration) {\n\tc.Set(k, x, d)\n}", "func (p *G2Jac) Set(a *G2Jac) *G2Jac {\n\tp.X.Set(&a.X)\n\tp.Y.Set(&a.Y)\n\tp.Z.Set(&a.Z)\n\treturn p\n}", "func (self *Graphics) SetXA(member int) {\n self.Object.Set(\"x\", member)\n}", "func (m *MockedCache) Z(score float64, member interface{}) redis.Z {\n\treturn redis.Z{}\n}", "func (m *Money) Set(x int64) *Money {\n\tm.M = x\n\treturn m\n}", "func (d *Decimal) SetValue(v int64) {\n\t(*accounting.Decimal)(d).\n\t\tSetValue(v)\n}", "func (m *ModifierMock) Set(p context.Context, p1 Drop) (r error) {\n\tcounter := atomic.AddUint64(&m.SetPreCounter, 1)\n\tdefer atomic.AddUint64(&m.SetCounter, 1)\n\n\tif len(m.SetMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.SetMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to ModifierMock.Set. %v %v\", p, p1)\n\t\t\treturn\n\t\t}\n\n\t\tinput := m.SetMock.expectationSeries[counter-1].input\n\t\ttestify_assert.Equal(m.t, *input, ModifierMockSetInput{p, p1}, \"Modifier.Set got unexpected parameters\")\n\n\t\tresult := m.SetMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ModifierMock.Set\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.SetMock.mainExpectation != nil {\n\n\t\tinput := m.SetMock.mainExpectation.input\n\t\tif input != nil {\n\t\t\ttestify_assert.Equal(m.t, *input, ModifierMockSetInput{p, p1}, \"Modifier.Set got unexpected parameters\")\n\t\t}\n\n\t\tresult := m.SetMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ModifierMock.Set\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.SetFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to ModifierMock.Set. %v %v\", p, p1)\n\t\treturn\n\t}\n\n\treturn m.SetFunc(p, p1)\n}", "func (c *Coord) Z() float64 { return c[2] }", "func (z *Rat) Mul(x, y *Rat) *Rat {}", "func (uni *UniformMatrix3f) Set(pos int, v float32) {\n\n\tuni.v[pos] = v\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func SetMpzValue(model ModelT, t TermT, val *MpzT) int32 {\n\treturn int32(C.yices_model_set_mpzp(ymodel(model), C.term_t(t), (*C.mpz_t)(unsafe.Pointer(val))))\n}", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func (g *G1) SetIdentity() { g.x = ff.Fp{}; g.y.SetOne(); g.z = ff.Fp{} }", "func (p *g1JacExtended) Set(a *g1JacExtended) *g1JacExtended {\n\tp.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ\n\treturn p\n}", "func (level *DepthOfMarketLevel) Set(price, volume float64, isBid bool) {\n\t(*level)[0] = price\n\tif isBid {\n\t\t(*level)[0] *= -1\n\t}\n\t(*level)[1] = volume\n}", "func (c *GeoBass) Set(p Point, value interface{}) error {\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\thash, err := getHash(p, c.precision)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to hash point: %v\", err)\n\t}\n\tc.items[hash] = value\n\treturn nil\n}", "func IntSetBit(z *big.Int, x *big.Int, i int, b uint) *big.Int", "func (self *Rectangle) SetXA(member int) {\n self.Object.Set(\"x\", member)\n}", "func (cpu *CPU) set_Z(i uint16) {\r\n\tcpu.regs[2] = (cpu.regs[2] & 0xfd) | ((i & 1) << 1)\r\n}", "func (z *Int) SetUint64(x uint64) *Int {}", "func (z *Numeric) SetInt(x int) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tif x < 0 {\n\t\tz.sign = numericNegative\n\t} else {\n\t\tz.sign = numericPositive\n\t}\n\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := mathh.AbsInt16(int16(x % numericBase))\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}" ]
[ "0.71290857", "0.6694286", "0.655188", "0.65362024", "0.65268594", "0.64692193", "0.64211214", "0.6375159", "0.62010866", "0.6167918", "0.6071297", "0.6015038", "0.5890692", "0.5878823", "0.5815794", "0.58125335", "0.574378", "0.5728071", "0.56841", "0.5668045", "0.5591025", "0.5577491", "0.5541211", "0.5529068", "0.549018", "0.5482445", "0.547277", "0.54446626", "0.5442767", "0.53978425", "0.53957593", "0.53937036", "0.5385788", "0.5321697", "0.53170484", "0.52326745", "0.5222877", "0.52213037", "0.5200854", "0.5173523", "0.51228845", "0.5109833", "0.51095057", "0.5100599", "0.50857484", "0.5079007", "0.5071413", "0.50472206", "0.5014635", "0.5010852", "0.49903727", "0.4981867", "0.49718046", "0.4949465", "0.49447522", "0.494278", "0.49359253", "0.49248433", "0.49184138", "0.48979065", "0.4888737", "0.48805383", "0.48775157", "0.48739928", "0.48669878", "0.48646688", "0.4864585", "0.48584658", "0.48583248", "0.4855663", "0.48537323", "0.48229244", "0.48079205", "0.47952858", "0.47875103", "0.4781258", "0.47780854", "0.47735354", "0.47642848", "0.47579432", "0.47526133", "0.4747546", "0.47417524", "0.47401515", "0.47294796", "0.47281507", "0.47131032", "0.47124165", "0.47101414", "0.47073522", "0.46987525", "0.46906415", "0.46820453", "0.46639085", "0.4661512", "0.4650413", "0.46429467", "0.4641846", "0.46359006", "0.46309057" ]
0.7498269
0
SetBigMantScale sets z to the given value and scale.
func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big { // Do this first in case value == z.unscaled. Don't want to clobber the sign. z.form = finite if value.Sign() < 0 { z.form |= signbit } z.unscaled.Abs(value) z.compact = c.Inflated z.precision = arith.BigLength(value) if z.unscaled.IsUint64() { if v := z.unscaled.Uint64(); v != c.Inflated { z.compact = v } } z.exp = -scale return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Big) SetMantScale(value int64, scale int) *Big {\n\tz.SetUint64(arith.Abs(value))\n\tz.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64\n\tif value < 0 {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (z *Big) SetScale(scale int) *Big {\n\tz.exp = -scale\n\treturn z\n}", "func (tr *trooper) setScale(scale float64) { tr.part.SetScale(scale, scale, scale) }", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (self *TileSprite) SetTileScaleA(member *Point) {\n self.Object.Set(\"tileScale\", member)\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (x *Big) Scale() int { return -x.exp }", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (self *Tween) SetTimeScaleA(member int) {\n self.Object.Set(\"timeScale\", member)\n}", "func (self *ComponentScaleMinMax) SetScaleMaxA(member *Point) {\n self.Object.Set(\"scaleMax\", member)\n}", "func New(value int64, scale int) *Big {\n\treturn new(Big).SetMantScale(value, scale)\n}", "func (n *Uint256) SetBig(n2 *big.Int) *Uint256 {\n\t// Take the value mod 2^256 if needed.\n\ttmp := n2\n\tif n2.BitLen() > 256 {\n\t\ttmp = new(big.Int).And(n2, bigUint256Mask)\n\t}\n\n\tvar buf [32]byte\n\ttmp.FillBytes(buf[:]) // Requires Go 1.15.\n\tn.SetBytes(&buf)\n\tif tmp.Sign() < 0 {\n\t\tn.Negate()\n\t}\n\treturn n\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setZero(sign, 0)\n\t}\n\tif math.IsNaN(x) {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setNaN(0, qnan|sign, 0)\n\t}\n\tif math.IsInf(x, 0) {\n\t\tif math.IsInf(x, 1) {\n\t\t\tz.form = pinf\n\t\t} else {\n\t\t\tz.form = ninf\n\t\t}\n\t\treturn z\n\t}\n\n\t// The gist of the following is lifted from math/big/rat.go, but adapted for\n\t// base-10 decimals.\n\n\tconst expMask = 1<<11 - 1\n\tbits := math.Float64bits(x)\n\tmantissa := bits & (1<<52 - 1)\n\texp := int((bits >> 52) & expMask)\n\tif exp == 0 { // denormal\n\t\texp -= 1022\n\t} else { // normal\n\t\tmantissa |= 1 << 52\n\t\texp -= 1023\n\t}\n\n\tif mantissa == 0 {\n\t\treturn z.SetUint64(0)\n\t}\n\n\tshift := 52 - exp\n\tfor mantissa&1 == 0 && shift > 0 {\n\t\tmantissa >>= 1\n\t\tshift--\n\t}\n\n\tz.exp = 0\n\tz.form = finite | form(bits>>63)\n\n\tif shift > 0 {\n\t\tz.unscaled.SetUint64(uint64(shift))\n\t\tz.unscaled.Exp(c.FiveInt, &z.unscaled, nil)\n\t\tarith.Mul(&z.unscaled, &z.unscaled, mantissa)\n\t\tz.exp = -shift\n\t} else {\n\t\t// TODO(eric): figure out why this doesn't work for _some_ numbers. See\n\t\t// https://github.com/ericlagergren/decimal/issues/89\n\t\t//\n\t\t// z.compact = mantissa << uint(-shift)\n\t\t// z.precision = arith.Length(z.compact)\n\n\t\tz.compact = c.Inflated\n\t\tz.unscaled.SetUint64(mantissa)\n\t\tz.unscaled.Lsh(&z.unscaled, uint(-shift))\n\t}\n\treturn z.norm()\n}", "func (t *Transform) SetScaleXY(x float64, y float64) ITransform {\n\treturn t.SetScale(NewVector(x, y))\n}", "func (z *Big) SetUint64(x uint64) *Big {\n\tz.compact = x\n\tif x == c.Inflated {\n\t\tz.unscaled.SetUint64(x)\n\t}\n\tz.precision = arith.Length(x)\n\tz.exp = 0\n\tz.form = finite\n\treturn z\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func SetBigInt(gauge prometheus.Gauge, arg *big.Int) {\n\tgauge.Set(float64(arg.Int64()))\n}", "func (this *RectangleShape) SetScale(scale Vector2f) {\n\tC.sfRectangleShape_setScale(this.cptr, scale.toC())\n}", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func (a *ReplaySnapshotArgs) SetScale(scale float64) *ReplaySnapshotArgs {\n\ta.Scale = &scale\n\treturn a\n}", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (s SamplesC64) Scale(r float32) {\n\tsimd.ScaleComplex(r, s)\n}", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (blk *Block) Scale(sx, sy float64) {\n\tops := contentstream.NewContentCreator().\n\t\tScale(sx, sy).\n\t\tOperations()\n\n\t*blk.contents = append(*ops, *blk.contents...)\n\tblk.contents.WrapIfNeeded()\n\n\tblk.width *= sx\n\tblk.height *= sy\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (nt nodeTasks) setScale(node *Node, scale, buffer int) {\n\tst := nt[node]\n\tst.Lock()\n\tdefer st.RUnlock()\n\n\tcurrScale := len(st.buffers)\n\n\t// Increase the number of tasks for the given node.\n\t// a scale of 1 only adds a buffer with no scale.\n\tif scale > currScale {\n\t\tfor ; scale > currScale; currScale++ {\n\t\t\ttask := make(chan Record, buffer)\n\t\t\tst.buffers = append(st.buffers, task)\n\t\t\tgo func() {\n\t\t\t\tfor record := range task {\n\t\t\t\t\tnode.forward(record)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif scale < currScale {\n\t\tfor ; scale < currScale; currScale-- {\n\t\t\tclose(st.buffers[currScale-1])\n\t\t\tst.buffers = st.buffers[:currScale-1]\n\t\t}\n\t}\n}", "func (self *TileSprite) SetTileScaleOffsetA(member *Point) {\n self.Object.Set(\"tileScaleOffset\", member)\n}", "func (v Vec3) Scale(s float64) Vec3 {\n\treturn Vec3{v[0] * s, v[1] * s, v[2] * s}\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (p *Proc) Scale(x, y float64) {\n\tp.stk.scale(x, y)\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func Scale(s Frac, m M) M {\n\tm = CopyMatrix(m)\n\n\tfor r := 1; r <= m.Rows(); r++ {\n\t\tm.MultiplyRow(r, s)\n\t}\n\n\treturn m\n}", "func scale(val float64, min float64, max float64, outMin float64, outMax float64) float64 {\r\n\tdenom := 1.0\r\n\ty := 0.0\r\n\tif outMin - min != 0 {\r\n\t\tdenom = outMin - min\r\n\t\ty = (outMax - max) / denom * val - min + outMin\r\n\t} else {\r\n\t\ty = outMax / max * val - min + outMin\r\n\t}\r\n\treturn y\r\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (fpsc *FloorPlanScaleCreate) SetScaleInMeters(f float64) *FloorPlanScaleCreate {\n\tfpsc.mutation.SetScaleInMeters(f)\n\treturn fpsc\n}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *ScaleButton) SetValue(value float64) {\n\tC.gtk_scale_button_set_value(v.native(), C.gdouble(value))\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func MatrixScale(x, y, z float32) Matrix {\n\tresult := NewMatrix(\n\t\tx, 0.0, 0.0, 0.0,\n\t\t0.0, y, 0.0, 0.0,\n\t\t0.0, 0.0, z, 0.0,\n\t\t0.0, 0.0, 0.0, 1.0)\n\n\treturn result\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (c *LinehaulCostComputation) Scale(factor float64) {\n\tc.BaseLinehaul = c.BaseLinehaul.MultiplyFloat64(factor)\n\tc.OriginLinehaulFactor = c.OriginLinehaulFactor.MultiplyFloat64(factor)\n\tc.DestinationLinehaulFactor = c.DestinationLinehaulFactor.MultiplyFloat64(factor)\n\tc.ShorthaulCharge = c.ShorthaulCharge.MultiplyFloat64(factor)\n\tc.LinehaulChargeTotal = c.LinehaulChargeTotal.MultiplyFloat64(factor)\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (v Vector) Scale(c float64) Vector {\n\tfor i, x := range v {\n\t\tv[i] = x * c\n\t}\n\treturn v\n}", "func main() {\n\tv := Vertex{1, 2}\n\tc := float64(rand.Intn(1337))\n\n\tfmt.Println(\"original\", v.Abs())\n\n\tv.Scale(c)\n\tfmt.Println(v.Abs())\n\n\tScale(&v, 1/c)\n\tfmt.Println(\"rescaled\", Abs(v))\n\n\tp := &Vertex{3,4}\n\tp.Scale(3)\n\tScale(p,8)\n\n\tfmt.Println(v,p)\n}", "func (self *ComponentScaleMinMax) SetScaleMinMax(minX interface{}, minY interface{}, maxX interface{}, maxY interface{}) {\n self.Object.Call(\"setScaleMinMax\", minX, minY, maxX, maxY)\n}", "func (m *PrinterDefaults) SetScaling(value *PrintScaling)() {\n err := m.GetBackingStore().Set(\"scaling\", value)\n if err != nil {\n panic(err)\n }\n}", "func (z *Int) SetFromBig(int *big.Int) bool {\n\tz.SetBytes(int.Bytes())\n\tif int.Sign() == -1 {\n\t\tz.Neg()\n\t}\n\treturn int.BitLen() > 256\n}", "func HexScale(a hex, k int) hex {\n\treturn NewHex(a.q*k, a.r*k)\n}", "func ratScale(x *big.Rat, exp int) {\n\tif exp < 0 {\n\t\tx.Inv(x)\n\t\tratScale(x, -exp)\n\t\tx.Inv(x)\n\t\treturn\n\t}\n\tfor exp >= 9 {\n\t\tx.Quo(x, bigRatBillion)\n\t\texp -= 9\n\t}\n\tfor exp >= 1 {\n\t\tx.Quo(x, bigRatTen)\n\t\texp--\n\t}\n}", "func scale(bytes int64) (scaled int64, scale string) {\n\tif bytes < 0 {\n\t\tscaled, scale = uscale(uint64(bytes * -1))\n\t\tscaled *= -1\n\t} else {\n\t\tscaled, scale = uscale(uint64(bytes))\n\t}\n\treturn\n}", "func TestScale(t *testing.T) {\n\tvar i, j uint\n\tfor i = 0; i < 100; i++ {\n\t\ta := makeRandomVector(i)\n\t\tx := rand.ExpFloat64()\n\t\tb := Scale(a, x)\n\n\t\tfor j = 0; j < i; j++ {\n\t\t\tif b.dims[j] != a.dims[j]*x {\n\t\t\t\tt.Error(\"Scalar Multiplication failed, \",\n\t\t\t\t\t\"didn't get expected values.\")\n\t\t\t\tt.Logf(\"%f * %f != %f\", a.dims[j], x, b.dims[j])\n\t\t\t}\n\t\t}\n\n\t\t// Test in-place scalar multiplication\n\t\tb = a.Copy()\n\t\tb.Scale(x)\n\n\t\tfor j = 0; j < i; j++ {\n\t\t\tif b.dims[j] != a.dims[j]*x {\n\t\t\t\tt.Error(\"In-place Scalar Multiplication failed, \",\n\t\t\t\t\t\"didn't get expected values.\")\n\t\t\t\tt.Logf(\"%f * %f != %f\", a.dims[j], x, b.dims[j])\n\t\t\t}\n\t\t}\n\t}\n}", "func SetBits(z *big.Int, abs []big.Word) *big.Int {\n\treturn z.SetBits(abs)\n}", "func (m *ItemItemsItemWorkbookFunctionsComplexPostRequestBody) SetSuffix(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"suffix\", value)\n if err != nil {\n panic(err)\n }\n}", "func (p *point) scaleBy(factor int) {\n\tp.x *= factor\n\tp.y *= factor\n}" ]
[ "0.7482123", "0.7046453", "0.6483148", "0.62212074", "0.60076684", "0.6001548", "0.59609586", "0.58952105", "0.58950853", "0.5844871", "0.58230865", "0.57487625", "0.565793", "0.5607472", "0.556866", "0.55051416", "0.54992694", "0.5419335", "0.5405035", "0.53465384", "0.5341255", "0.53226614", "0.52976096", "0.52859807", "0.5261658", "0.5259906", "0.5236173", "0.5235123", "0.5212707", "0.51977867", "0.5192598", "0.5179468", "0.51629525", "0.51530087", "0.51408964", "0.5124239", "0.5121738", "0.5106834", "0.5106251", "0.51051736", "0.5100678", "0.5049326", "0.50450724", "0.5030579", "0.502865", "0.50235534", "0.5014809", "0.50087994", "0.50047934", "0.5003835", "0.500317", "0.4990041", "0.49803153", "0.49785042", "0.49776837", "0.49551", "0.49358296", "0.49255145", "0.4921595", "0.49197707", "0.49121884", "0.49048212", "0.4897135", "0.4893271", "0.48922205", "0.48841667", "0.4882561", "0.4881855", "0.48809335", "0.4880355", "0.48763928", "0.48699564", "0.48464546", "0.48464546", "0.48464546", "0.48464546", "0.48464546", "0.48464546", "0.48464546", "0.48315176", "0.4825769", "0.48145896", "0.48107195", "0.48104405", "0.48052806", "0.48003945", "0.4780563", "0.4777363", "0.477469", "0.47708812", "0.4768409", "0.4762133", "0.47496858", "0.4746782", "0.47264358", "0.47212893", "0.47148097", "0.4713862", "0.46990442", "0.46966875" ]
0.7995192
0
SetFloat sets z to exactly x and returns z.
func (z *Big) SetFloat(x *big.Float) *Big { if x.IsInf() { if x.Signbit() { z.form = ninf } else { z.form = pinf } return z } neg := x.Signbit() if x.Sign() == 0 { if neg { z.form |= signbit } z.compact = 0 z.precision = 1 return z } z.exp = 0 x0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec) x0.Abs(x0) if !x.IsInt() { for !x0.IsInt() { x0.Mul(x0, c.TenFloat) z.exp-- } } if mant, acc := x0.Uint64(); acc == big.Exact { z.compact = mant z.precision = arith.Length(mant) } else { z.compact = c.Inflated x0.Int(&z.unscaled) z.precision = arith.BigLength(&z.unscaled) } z.form = finite if neg { z.form |= signbit } return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Float) Set(x *Float) *Float {}", "func (z *Float) SetFloat64(x float64) *Float {}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (obj *Value) SetFloat(v float32) {\n\tobj.Candy().Guify(\"g_value_set_float\", obj, v)\n}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (c *Cell) SetFloat(n float64) {\n\tc.SetFloatWithFormat(n, \"0.00e+00\")\n}", "func NewFloat(x float64) *Float { return new(Float).SetFloat64(x) }", "func (z *Float) SetRat(x *Rat) *Float {}", "func (f *Float) Set(x *Float) *Float {\n\tf.doinit()\n\tC.mpf_set(&f.i[0], &x.i[0])\n\treturn f\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func (se *SimpleElement) SetFloat(value float64) {\n\tse.value = formatFloat(value)\n}", "func (s *Smpval) SetFloat(f float64) bool {\n\tif s.flag == Float && s.val.CanSet() {\n\t\ts.val.SetFloat(f)\n\t\ts.f = s.val.Float()\n\t\treturn true\n\t}\n\treturn false\n}", "func (v *Value) SetFloat(val float32) {\n\tC.g_value_set_float(v.Native(), C.gfloat(val))\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func (recv *Value) SetFloat(vFloat float32) {\n\tc_v_float := (C.gfloat)(vFloat)\n\n\tC.g_value_set_float((*C.GValue)(recv.native), c_v_float)\n\n\treturn\n}", "func (me *TPositiveFloatType) Set(s string) { (*xsdt.Float)(me).Set(s) }", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func (z *Float) Copy(x *Float) *Float {}", "func (c *CellValue) SetFloat(v float32) {\n\tc.IntVal = 0\n\tc.FloatVal = v\n\tc.StringVal = \"\"\n}", "func (s *Slider) Float(f *Float) *Slider {\n\ts.float = f\n\treturn s\n}", "func (x *Big) Float(z *big.Float) *big.Float {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Float)\n\t}\n\n\tswitch x.form {\n\tcase finite, finite | signbit:\n\t\tif x.isZero() {\n\t\t\tz.SetUint64(0)\n\t\t} else {\n\t\t\tz.SetRat(x.Rat(nil))\n\t\t}\n\tcase pinf, ninf:\n\t\tz.SetInf(x.form == pinf)\n\tdefault: // snan, qnan, ssnan, sqnan:\n\t\tz.SetUint64(0)\n\t}\n\treturn z\n}", "func setFloat(data [2]string, f func(float64)) error {\n\tval, err := strconv.ParseFloat(strings.TrimSpace(data[1]), 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"code %s: %s\", data[0], err.Error())\n\t}\n\tf(val)\n\treturn nil\n}", "func (z *Float) SetInt64(x int64) *Float {}", "func NewFloat(x float64) *Float {}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (z *Float) SetUint64(x uint64) *Float {}", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func FloatSetString(z *big.Float, s string) (*big.Float, bool)", "func (c *Context) Float(v float64) *AST {\n\t//TODO: test if this could work\n\treturn &AST{\n\t\trawCtx: c.raw,\n\t\trawAST: C.Z3_mk_real(c.raw, C.int(v), C.int(1)),\n\t}\n}", "func (c *Config) SetFloat(k string, f float64) {\n\tc.SetString(k, strconv.FormatFloat(f, 'E', -1, 64))\n}", "func (v *Vector) Set(x, y, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (jz *Jzon) Float() (f float64, err error) {\n\tif jz.Type != JzTypeFlt {\n\t\treturn f, expectTypeOf(JzTypeInt, jz.Type)\n\t}\n\n\treturn jz.data.(float64), nil\n}", "func SetFloatField(env *C.JNIEnv, obj C.jobject, fieldID C.jfieldID, val C.jfloat) {\n\tC._GoJniSetFloatField(env, obj, fieldID, val)\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func (v *missingValue) SetFloat(value float64) bool {\n\treturn false\n}", "func NewFloat(x float64) *big.Float", "func SetStaticFloatField(env *C.JNIEnv, clazz C.jclass, fieldID C.jfieldID, value C.jfloat) {\n\tC._GoJniSetStaticFloatField(env, clazz, fieldID, value)\n}", "func Float(name string, value float, usage string) *float {\n\tp := new(float);\n\tFloatVar(p, name, value, usage);\n\treturn p;\n}", "func Float(flag string, value float64, description string) *float64 {\n\tvar v float64\n\tFloatVar(&v, flag, value, description)\n\treturn &v\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func FloatMul(z *big.Float, x, y *big.Float,) *big.Float", "func (v Base) Float() float64 {\n\treturn float64(v)\n}", "func (c *Constructor[_]) Float(name string, value float64, help string) *float64 {\n\tp := new(float64)\n\tc.FloatVar(p, name, value, help)\n\treturn p\n}", "func (e ChainEntry) Float(k string, v float64) ChainEntry {\n\tif e.disabled {\n\t\treturn e\n\t}\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func (f *Float32Value) Set(s string) error {\n\tv, err := strconv.ParseFloat(s, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*f = Float32Value(float32(v))\n\treturn err\n}", "func (e Entry) Float(k string, v float64) Entry {\n\te.enc.FloatKey(k, v)\n\treturn e\n}", "func (v *Vec3i) Set(x, y, z int32) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func Float(v float64) *float64 {\n\treturn &v\n}", "func (d *DSP) SetParameterFloat(index int, value float64) error {\n\tres := C.FMOD_DSP_SetParameterFloat(d.cptr, C.int(index), C.float(value))\n\treturn errs[res]\n}", "func (f *Float) SetFloat64(x float64) *Float {\n\tf.doinit()\n\tC.mpf_set_d(&f.i[0], C.double(x))\n\treturn f\n}", "func (tr Row) ForceFloat(nn int) (val float64) {\n\tval, _ = tr.FloatErr(nn)\n\treturn\n}", "func NewFloat(typ *types.FloatType, x float64) *ConstFloat {\n\tif math.IsNaN(x) {\n\t\t// TODO: store sign of NaN?\n\t\treturn &ConstFloat{Typ: typ, NaN: true}\n\t}\n\treturn &ConstFloat{Typ: typ, X: big.NewFloat(x)}\n}", "func Float(value float64) *float64 {\n\treturn New(value).(*float64)\n}", "func FloatAbs(z *big.Float, x *big.Float,) *big.Float", "func (c *Cell) SetFloatWithFormat(n float64, format string) {\n\tc.Value = strconv.FormatFloat(n, 'e', -1, 64)\n\tc.numFmt = format\n\tc.formula = \"\"\n\tc.cellType = CellTypeNumeric\n}", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setZero(sign, 0)\n\t}\n\tif math.IsNaN(x) {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setNaN(0, qnan|sign, 0)\n\t}\n\tif math.IsInf(x, 0) {\n\t\tif math.IsInf(x, 1) {\n\t\t\tz.form = pinf\n\t\t} else {\n\t\t\tz.form = ninf\n\t\t}\n\t\treturn z\n\t}\n\n\t// The gist of the following is lifted from math/big/rat.go, but adapted for\n\t// base-10 decimals.\n\n\tconst expMask = 1<<11 - 1\n\tbits := math.Float64bits(x)\n\tmantissa := bits & (1<<52 - 1)\n\texp := int((bits >> 52) & expMask)\n\tif exp == 0 { // denormal\n\t\texp -= 1022\n\t} else { // normal\n\t\tmantissa |= 1 << 52\n\t\texp -= 1023\n\t}\n\n\tif mantissa == 0 {\n\t\treturn z.SetUint64(0)\n\t}\n\n\tshift := 52 - exp\n\tfor mantissa&1 == 0 && shift > 0 {\n\t\tmantissa >>= 1\n\t\tshift--\n\t}\n\n\tz.exp = 0\n\tz.form = finite | form(bits>>63)\n\n\tif shift > 0 {\n\t\tz.unscaled.SetUint64(uint64(shift))\n\t\tz.unscaled.Exp(c.FiveInt, &z.unscaled, nil)\n\t\tarith.Mul(&z.unscaled, &z.unscaled, mantissa)\n\t\tz.exp = -shift\n\t} else {\n\t\t// TODO(eric): figure out why this doesn't work for _some_ numbers. See\n\t\t// https://github.com/ericlagergren/decimal/issues/89\n\t\t//\n\t\t// z.compact = mantissa << uint(-shift)\n\t\t// z.precision = arith.Length(z.compact)\n\n\t\tz.compact = c.Inflated\n\t\tz.unscaled.SetUint64(mantissa)\n\t\tz.unscaled.Lsh(&z.unscaled, uint(-shift))\n\t}\n\treturn z.norm()\n}", "func NewFloat(v float64) Float {\n\treturn Float{v, true}\n}", "func FloatAdd(z *big.Float, x, y *big.Float,) *big.Float", "func (squo *SurveyQuestionUpdateOne) SetFloatData(f float64) *SurveyQuestionUpdateOne {\n\tsquo.float_data = &f\n\tsquo.addfloat_data = nil\n\treturn squo\n}", "func (client PrimitiveClient) PutFloat(complexBody FloatWrapper) (result autorest.Response, err error) {\n req, err := client.PutFloatPreparer(complexBody)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutFloat\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.PutFloatSender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutFloat\", resp, \"Failure sending request\")\n }\n\n result, err = client.PutFloatResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"complexgroup.PrimitiveClient\", \"PutFloat\", resp, \"Failure responding to request\")\n }\n\n return\n}", "func (f *Float64Value) Set(s string) error {\n\tv, err := strconv.ParseFloat(s, 64)\n\t*f = Float64Value(v)\n\treturn err\n}", "func (r *HashJsonCodecRedisController) SetSomeFloat(key string, someFloat float32) (err error) {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// set SomeFloat field\n\tr.m.SomeFloat = someFloat\n\t_, err = conn.Do(\"HSET\", key, \"SomeFloat\", someFloat)\n\n\treturn\n}", "func (d *DSP) ParameterFloat(index C.int, value *C.float, valuestr *C.char, valuestrlen C.int) error {\n\t//FMOD_RESULT F_API FMOD_DSP_GetParameterFloat(FMOD_DSP *dsp, int index, float *value, char *valuestr, int valuestrlen);\n\treturn ErrNoImpl\n}", "func (c Cube) Set(x, y, z int, val []float64) {\n\tc.Data[x][y][z] = val\n}", "func (c *Color) SetFloat64(r, g, b, a float64) {\n\tc.SetUInt8(uint8(r*255.0), uint8(g*255.0), uint8(b*255.0), uint8(a*255.0))\n}", "func (matrix *XGDMatrix) SetFloatInfo(field string, values []float32) error {\n\tcstr := C.CString(field)\n\tdefer C.free(unsafe.Pointer(cstr))\n\n\tres := C.XGDMatrixSetFloatInfo(matrix.handle, cstr, (*C.float)(&values[0]), C.bst_ulong(len(values)))\n\tif err := checkError(res); err != nil {\n\t\treturn err\n\t}\n\truntime.KeepAlive(values)\n\n\treturn nil\n}", "func (me TPositiveFloatType) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "func (n *Number) Float() float64 {\n\treturn n.floating\n}", "func (t *Type) Float(defaultValue ...float64) FloatAccessor {\n\tnv := &NullFloat{}\n\tif nv.Error = t.err; t.err != nil {\n\t\treturn nv\n\t}\n\tvalueTo := t.toFloat(reflect.Float64)\n\tnv = &NullFloat{FloatCommon{Error: valueTo.Err()}}\n\tif defaultFloat(nv, defaultValue...) {\n\t\treturn nv\n\t}\n\tv := valueTo.V()\n\tnv.P = &v\n\treturn nv\n}", "func (m *Money) Setf(f float64) *Money {\n\tfDPf := f * DPf\n\tr := int64(f * DPf)\n\treturn m.Set(Rnd(r, fDPf-float64(r)))\n}", "func (f Fixed) Float() float64 {\n\tif f.IsNaN() {\n\t\treturn math.NaN()\n\t}\n\treturn float64(f.fp) / float64(scale)\n}", "func (f Fixed) Float() float64 {\n\tif f.IsNaN() {\n\t\treturn math.NaN()\n\t}\n\treturn float64(f.fp) / float64(scale)\n}", "func (c Currency) Setf(f float64) Currency {\n\tfDPf := f * c.dpf\n\tr := int64(f * c.dpf)\n\tc.Valid = true\n\treturn c.Set(rnd(r, fDPf-float64(r)))\n}", "func (access FloatAccess) Set(row int, val float64) {\n access.rawData[access.indices[row]] = val\n}", "func Float(f float64) *float64 {\n\treturn &f\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func WriteFloat(buffer []byte, offset int, value float32) {\n WriteUInt32(buffer, offset, math.Float32bits(value))\n}", "func (f *Flags) Float(spec string, p *float64, name, usage string) {\n\tf.addOption(spec, name, usage, func(name, value string) error {\n\t\tf, err := strconv.ParseFloat(value, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid %s argument '%s'\", name, value)\n\t\t}\n\t\t*p = f\n\t\treturn nil\n\t})\n}", "func (c *C) Float() Type {\n\treturn FloatT(4)\n}", "func (uuo *UserUpdateOne) SetFloats(f []float64) *UserUpdateOne {\n\tuuo.floats = &f\n\treturn uuo\n}", "func (uuo *UserUpdateOne) SetFloats(f []float64) *UserUpdateOne {\n\tuuo.floats = &f\n\treturn uuo\n}", "func (s *Smpval) Float() float64 {\n\treturn s.f\n}", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func (o *FakeObject) Float() float64 { return o.Value.(float64) }", "func (v Value) Float() float64 {\n\tpanic(message)\n}", "func (cuo *CommentUpdateOne) SetUniqueFloat(f float64) *CommentUpdateOne {\n\tcuo.unique_float = &f\n\tcuo.addunique_float = nil\n\treturn cuo\n}", "func (uu *UserUpdate) SetFloats(f []float64) *UserUpdate {\n\tuu.floats = &f\n\treturn uu\n}", "func (uu *UserUpdate) SetFloats(f []float64) *UserUpdate {\n\tuu.floats = &f\n\treturn uu\n}", "func ZeroFloat(v interface{}) float64 {\n\tf, err := Float64(v)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn f\n}", "func (v Value) Float() float64 {\n\treturn v.v.Float()\n}", "func (s *Float32Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Float32Value, err = cast.ToFloat32E(v)\n\treturn err\n}", "func FloatInt(x *big.Float, z *big.Int,) (*big.Int, big.Accuracy,)" ]
[ "0.795142", "0.78136986", "0.7702954", "0.7409077", "0.6878095", "0.6817161", "0.6814346", "0.6796111", "0.6742635", "0.6722081", "0.6688294", "0.6603496", "0.65328836", "0.65287864", "0.6486636", "0.64737475", "0.6465528", "0.64144754", "0.6405877", "0.63998175", "0.6334951", "0.62872016", "0.62755644", "0.6244811", "0.62223375", "0.62006056", "0.614193", "0.6105228", "0.6092638", "0.60565835", "0.6042012", "0.60222787", "0.60208833", "0.59673065", "0.5930779", "0.5921771", "0.5855987", "0.58388907", "0.5838107", "0.5792874", "0.5758774", "0.57246554", "0.5706769", "0.56764364", "0.5640615", "0.5630048", "0.55820316", "0.5573671", "0.556647", "0.5560779", "0.55504537", "0.55494744", "0.5543415", "0.5535164", "0.55104923", "0.54918367", "0.54917866", "0.54795456", "0.5453287", "0.54199195", "0.5388992", "0.5384829", "0.53742945", "0.5364763", "0.5358582", "0.5356895", "0.5352408", "0.5341667", "0.53387856", "0.5337413", "0.5332949", "0.53321457", "0.53318757", "0.53308004", "0.5329865", "0.5327006", "0.532678", "0.53196514", "0.53196514", "0.5309335", "0.5306776", "0.5295959", "0.5287436", "0.52834773", "0.5283344", "0.5274354", "0.5250242", "0.5242852", "0.5242852", "0.5241507", "0.52403677", "0.52387774", "0.52258754", "0.5185635", "0.5179825", "0.5179825", "0.51797676", "0.51735073", "0.51657426", "0.5164405" ]
0.7365888
4
SetFloat64 sets z to exactly x.
func (z *Big) SetFloat64(x float64) *Big { if x == 0 { var sign form if math.Signbit(x) { sign = signbit } return z.setZero(sign, 0) } if math.IsNaN(x) { var sign form if math.Signbit(x) { sign = signbit } return z.setNaN(0, qnan|sign, 0) } if math.IsInf(x, 0) { if math.IsInf(x, 1) { z.form = pinf } else { z.form = ninf } return z } // The gist of the following is lifted from math/big/rat.go, but adapted for // base-10 decimals. const expMask = 1<<11 - 1 bits := math.Float64bits(x) mantissa := bits & (1<<52 - 1) exp := int((bits >> 52) & expMask) if exp == 0 { // denormal exp -= 1022 } else { // normal mantissa |= 1 << 52 exp -= 1023 } if mantissa == 0 { return z.SetUint64(0) } shift := 52 - exp for mantissa&1 == 0 && shift > 0 { mantissa >>= 1 shift-- } z.exp = 0 z.form = finite | form(bits>>63) if shift > 0 { z.unscaled.SetUint64(uint64(shift)) z.unscaled.Exp(c.FiveInt, &z.unscaled, nil) arith.Mul(&z.unscaled, &z.unscaled, mantissa) z.exp = -shift } else { // TODO(eric): figure out why this doesn't work for _some_ numbers. See // https://github.com/ericlagergren/decimal/issues/89 // // z.compact = mantissa << uint(-shift) // z.precision = arith.Length(z.compact) z.compact = c.Inflated z.unscaled.SetUint64(mantissa) z.unscaled.Lsh(&z.unscaled, uint(-shift)) } return z.norm() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetFloat64(x float64) *Float {}", "func (z *Float) SetUint64(x uint64) *Float {}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Float) SetInt64(x int64) *Float {}", "func (f *Float) SetFloat64(x float64) *Float {\n\tf.doinit()\n\tC.mpf_set_d(&f.i[0], C.double(x))\n\treturn f\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (z *Float) Set(x *Float) *Float {}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func (c *Color) SetFloat64(r, g, b, a float64) {\n\tc.SetUInt8(uint8(r*255.0), uint8(g*255.0), uint8(b*255.0), uint8(a*255.0))\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func (cv *ConVar) SetFloat64(value float64) error {\n\treturn cv.write(reflect.Float64, value, 2)\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (feature Feature) SetFieldFloat64(index int, value float64) {\n\tC.OGR_F_SetFieldDouble(feature.cval, C.int(index), C.double(value))\n}", "func (instance *Instance) SetFloat64(fieldName string, value float64) error {\n\tfieldNameCStr := C.CString(fieldName)\n\tdefer C.free(unsafe.Pointer(fieldNameCStr))\n\n\tretcode := int(C.RTI_Connector_set_number_into_samples(unsafe.Pointer(instance.output.connector.native), instance.output.nameCStr, fieldNameCStr, C.double(value)))\n\treturn checkRetcode(retcode)\n}", "func (z *Big) SetUint64(x uint64) *Big {\n\tz.compact = x\n\tif x == c.Inflated {\n\t\tz.unscaled.SetUint64(x)\n\t}\n\tz.precision = arith.Length(x)\n\tz.exp = 0\n\tz.form = finite\n\treturn z\n}", "func (ndf *NDFlagSet) ZVFloat64(name string, example float64, usage string) *float64 {\n\tvar fv float64\n\tndf.ZVFloat64Var(&fv, name, example, usage)\n\treturn &fv\n}", "func FloatCopy(z *big.Float, x *big.Float,) *big.Float", "func (c *Cell) SetFloat(n float64) {\n\tc.SetFloatWithFormat(n, \"0.00e+00\")\n}", "func (z *Rat) SetUint64(x uint64) *Rat {}", "func (ndf *NDFlagSet) ZVFloat64Var(fv *float64, name string, example float64, usage string) {\n\tf := &zvff{fv: fv, example: strconv.FormatFloat(example, 'g', -1, 64)}\n\tndf.Var(f, name, usage)\n}", "func (z *Rat) SetFrac64(a, b int64) *Rat {}", "func (f *Flagger) Float64(name, shorthand string, value float64, usage string) {\n\tf.cmd.Flags().Float64P(name, shorthand, value, usage)\n\tf.cfg.BindPFlag(name, f.cmd.Flags().Lookup(name))\n}", "func NewFloat(x float64) *Float { return new(Float).SetFloat64(x) }", "func (f *Float64Value) Set(s string) error {\n\tv, err := strconv.ParseFloat(s, 64)\n\t*f = Float64Value(v)\n\treturn err\n}", "func (cl *CommandLineInterface) Float64FlagOnFlagSet(flagSet *pflag.FlagSet, name string, shorthand *string, defaultValue *float64, description string) {\n\tif defaultValue == nil {\n\t\tcl.nilDefaults[name] = true\n\t\tdefaultValue = cl.Float64Me(0.0)\n\t}\n\tif shorthand != nil {\n\t\tcl.Flags[name] = flagSet.Float64P(name, string(*shorthand), *defaultValue, description)\n\t\treturn\n\t}\n\tcl.Flags[name] = flagSet.Float64(name, *defaultValue, description)\n}", "func (s *Smpval) SetFloat(f float64) bool {\n\tif s.flag == Float && s.val.CanSet() {\n\t\ts.val.SetFloat(f)\n\t\ts.f = s.val.Float()\n\t\treturn true\n\t}\n\treturn false\n}", "func (v *Value) SetFloat(val float32) {\n\tC.g_value_set_float(v.Native(), C.gfloat(val))\n}", "func (obj *Value) SetFloat(v float32) {\n\tobj.Candy().Guify(\"g_value_set_float\", obj, v)\n}", "func (f *Float) SetInt64(x int64) *Float {\n\tf.doinit()\n\tC.mpf_set_si(&f.i[0], C.long(x))\n\treturn f\n}", "func (se *SimpleElement) SetFloat(value float64) {\n\tse.value = formatFloat(value)\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func (w *Writer) Float64(n float64) {\n\tw.buf = strconv.AppendFloat(w.buf, float64(n), 'g', -1, 64)\n}", "func (z *Float64) SetReal(a float64) *Float64 {\n\tz.l = a\n\treturn z\n}", "func (s *StressFlag) Float64(name string, def float64, usage string) *float64 {\n\tv := def\n\treturn &v\n}", "func (v *Vector) Set(x, y, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (f *Float) Set(x *Float) *Float {\n\tf.doinit()\n\tC.mpf_set(&f.i[0], &x.i[0])\n\treturn f\n}", "func (i *InsertFactBuilder) OFloat64(f float64, unitID uint64) *InsertFactBuilder {\n\ti.fact.Object = AFloat64(f, unitID)\n\treturn i\n}", "func (bw *BufWriter) Float64(f float64) {\n\tif bw.Error != nil {\n\t\treturn\n\t}\n\tbw.stringBuf, bw.Error = Float64(f, bw.stringBuf[:0])\n\tif bw.Error != nil {\n\t\treturn\n\t}\n\t_, bw.Error = bw.writer.Write(bw.stringBuf)\n}", "func (me *TPositiveFloatType) Set(s string) { (*xsdt.Float)(me).Set(s) }", "func (v Float) Float64() float64 {\n\treturn v.v\n}", "func (lus *LastUpdatedSelect) Float64X(ctx context.Context) float64 {\n\tv, err := lus.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func FloatMul(z *big.Float, x, y *big.Float,) *big.Float", "func (m *Message) putFloat64(v float64) {\n\tb := m.bufferForPut(8)\n\tdefer b.Advance(8)\n\n\tbinary.LittleEndian.PutUint64(b.Bytes[b.Offset:], math.Float64bits(v))\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func (z *Int) SetUint64(x uint64) *Int {}", "func (f Float) Float64() float64 {\n\tpanic(\"not yet implemented\")\n}", "func (c *Configurator) Float64(name string, value float64, usage string) *float64 {\n\tp := new(float64)\n\n\tc.Float64Var(p, name, value, usage)\n\n\treturn p\n}", "func FloatFloat64(val float64) (out *big.Float, err error) {\n\tout = new(big.Float).SetFloat64(val)\n\treturn\n}", "func (v *Float64Value) Set(target *float64) {\n\tif v.fs.Changed(v.name) {\n\t\t*target = v.value\n\t}\n}", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func Float64(v *Value, def float64) float64 {\n\tf, err := v.Float64()\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn f\n}", "func FloatQuo(z *big.Float, x, y *big.Float,) *big.Float", "func (_e *MockWriteBufferXmlBased_Expecter) WriteFloat64(logicalName interface{}, bitLength interface{}, value interface{}, writerArgs ...interface{}) *MockWriteBufferXmlBased_WriteFloat64_Call {\n\treturn &MockWriteBufferXmlBased_WriteFloat64_Call{Call: _e.mock.On(\"WriteFloat64\",\n\t\tappend([]interface{}{logicalName, bitLength, value}, writerArgs...)...)}\n}", "func SetFloatField(env *C.JNIEnv, obj C.jobject, fieldID C.jfieldID, val C.jfloat) {\n\tC._GoJniSetFloatField(env, obj, fieldID, val)\n}", "func (uls *UserLogSelect) Float64X(ctx context.Context) float64 {\n\tv, err := uls.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x *Rat) Float64() (f float64, exact bool) {}", "func (hs *HarborSelect) Float64X(ctx context.Context) float64 {\n\tv, err := hs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (w *Writer) WriteFloat64(v float64) error {\n\treturn binary.Write(w.out, w.bo, &v)\n}", "func setFloat(data [2]string, f func(float64)) error {\n\tval, err := strconv.ParseFloat(strings.TrimSpace(data[1]), 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"code %s: %s\", data[0], err.Error())\n\t}\n\tf(val)\n\treturn nil\n}", "func (access FloatAccess) Set(row int, val float64) {\n access.rawData[access.indices[row]] = val\n}", "func (lbs *LatestBlockSelect) Float64X(ctx context.Context) float64 {\n\tv, err := lbs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (_e *MockWriteBufferJsonBased_Expecter) WriteFloat64(logicalName interface{}, bitLength interface{}, value interface{}, writerArgs ...interface{}) *MockWriteBufferJsonBased_WriteFloat64_Call {\n\treturn &MockWriteBufferJsonBased_WriteFloat64_Call{Call: _e.mock.On(\"WriteFloat64\",\n\t\tappend([]interface{}{logicalName, bitLength, value}, writerArgs...)...)}\n}", "func (ss *ServerSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ss.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (fs *FlagSet) Float64Var(name string, def float64, usage string) *Float64Value {\n\tv := &Float64Value{\n\t\tname: name,\n\t\tfs: fs.fs,\n\t}\n\tfs.fs.Float64Var(&v.value, name, def, usage)\n\treturn v\n}", "func (wfs *WithFieldsSelect) Float64X(ctx context.Context) float64 {\n\tv, err := wfs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func (ws *WifiSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ws.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (p *Stream) WriteFloat64(value float64) {\n\tif value == 0 {\n\t\tp.writeFrame[p.writeIndex] = 4\n\t\tp.writeIndex++\n\t\tif p.writeIndex == streamBlockSize {\n\t\t\tp.gotoNextWriteFrame()\n\t\t}\n\t} else {\n\t\tv := math.Float64bits(value)\n\t\tif p.writeIndex < streamBlockSize-9 {\n\t\t\tb := p.writeFrame[p.writeIndex:]\n\t\t\tb[0] = 5\n\t\t\tb[1] = byte(v)\n\t\t\tb[2] = byte(v >> 8)\n\t\t\tb[3] = byte(v >> 16)\n\t\t\tb[4] = byte(v >> 24)\n\t\t\tb[5] = byte(v >> 32)\n\t\t\tb[6] = byte(v >> 40)\n\t\t\tb[7] = byte(v >> 48)\n\t\t\tb[8] = byte(v >> 56)\n\t\t\tp.writeIndex += 9\n\t\t} else {\n\t\t\tp.PutBytes([]byte{\n\t\t\t\t5,\n\t\t\t\tbyte(v),\n\t\t\t\tbyte(v >> 8),\n\t\t\t\tbyte(v >> 16),\n\t\t\t\tbyte(v >> 24),\n\t\t\t\tbyte(v >> 32),\n\t\t\t\tbyte(v >> 40),\n\t\t\t\tbyte(v >> 48),\n\t\t\t\tbyte(v >> 56),\n\t\t\t})\n\t\t}\n\t}\n}", "func eeNumFloat64(v float64) (n eeNum) {\r\n\t*n.float64() = v\r\n\treturn\r\n}", "func (s *Float64Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Float64Value, err = cast.ToFloat64E(v)\n\treturn err\n}", "func (gs *GoodsSelect) Float64X(ctx context.Context) float64 {\n\tv, err := gs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (v Derive) Float64() float64 {\n\treturn float64(v)\n}", "func (c *Config) SetFloat(k string, f float64) {\n\tc.SetString(k, strconv.FormatFloat(f, 'E', -1, 64))\n}", "func (urs *UserRoleSelect) Float64X(ctx context.Context) float64 {\n\tv, err := urs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func SetStaticFloatField(env *C.JNIEnv, clazz C.jclass, fieldID C.jfieldID, value C.jfloat) {\n\tC._GoJniSetStaticFloatField(env, clazz, fieldID, value)\n}", "func Float64(name string, value float64, usage string) *float64 {\n\tp := new(float64);\n\tFloat64Var(p, name, value, usage);\n\treturn p;\n}", "func (ups *UnsavedPostSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ups.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (recv *Value) SetFloat(vFloat float32) {\n\tc_v_float := (C.gfloat)(vFloat)\n\n\tC.g_value_set_float((*C.GValue)(recv.native), c_v_float)\n\n\treturn\n}", "func (pgs *PlayGroupSelect) Float64X(ctx context.Context) float64 {\n\tv, err := pgs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (nss *NamespaceSecretSelect) Float64X(ctx context.Context) float64 {\n\tv, err := nss.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rls *RuleLimitSelect) Float64X(ctx context.Context) float64 {\n\tv, err := rls.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (nims *NetInterfaceModeSelect) Float64X(ctx context.Context) float64 {\n\tv, err := nims.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (vs *VehicleSelect) Float64X(ctx context.Context) float64 {\n\tv, err := vs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (r *Registers) setFlagZ(bit bool) {\n\tif bit {\n\t\tr.F |= zeroFlag\n\t} else {\n\t\tr.F = r.F &^ zeroFlag\n\t}\n}", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (ous *OrgUnitSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ous.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (w *ByteWriter) WriteFloat64(val float64, offset int) (int, error) {\n\treturn w.WriteVal(val, offset)\n}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func (wts *WorkerTypeSelect) Float64X(ctx context.Context) float64 {\n\tv, err := wts.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ws *WordSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ws.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (hm *HM) WriteFloat(addr int, val float64) error {\n\tbuf := make([]byte, int(unsafe.Sizeof(float64(0))))\n\tbinary.BigEndian.PutUint64(buf[:], math.Float64bits(val))\n\treturn hm.shm.WriteN(addr, buf)\n}", "func NewFloat(x float64) *big.Float" ]
[ "0.8568957", "0.7604048", "0.74524355", "0.73438364", "0.72247237", "0.7088781", "0.68426555", "0.66933036", "0.65595174", "0.65009296", "0.6499476", "0.6490124", "0.64856577", "0.6448265", "0.63436514", "0.63082755", "0.61101353", "0.60744774", "0.60336155", "0.5992921", "0.59590507", "0.5862474", "0.58621097", "0.5833603", "0.57960135", "0.576526", "0.57624876", "0.575504", "0.57362497", "0.5719863", "0.5717043", "0.57117563", "0.5663717", "0.56605136", "0.56159544", "0.56143105", "0.561307", "0.56094164", "0.55935705", "0.55661136", "0.5561981", "0.55584353", "0.555621", "0.55363804", "0.5526753", "0.5526648", "0.55257505", "0.55244917", "0.5490444", "0.5489681", "0.5476986", "0.5459533", "0.54508054", "0.5450083", "0.5441377", "0.54244214", "0.54195553", "0.5403161", "0.53862673", "0.5381856", "0.53710735", "0.53689873", "0.53566754", "0.5351116", "0.5342593", "0.5341159", "0.53336805", "0.5326706", "0.53261256", "0.5325568", "0.5325415", "0.53212994", "0.53209895", "0.53186494", "0.531669", "0.53141254", "0.53022295", "0.5292356", "0.5292057", "0.5289166", "0.5281323", "0.5272192", "0.52693933", "0.52598804", "0.5258144", "0.52571774", "0.52569216", "0.52568966", "0.52473336", "0.5234755", "0.52337104", "0.5229062", "0.52207834", "0.52204144", "0.52065456", "0.5201778", "0.52004373", "0.5197374", "0.5197231", "0.51963013" ]
0.68706334
6
SetInf sets z to Inf if signbit is set or +Inf is signbit is not set, and returns z.
func (z *Big) SetInf(signbit bool) *Big { if signbit { z.form = ninf } else { z.form = pinf } return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetInf(signbit bool) *Float {}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func (x *Big) IsInf(sign int) bool {\n\treturn sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf\n}", "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func Inf() complex128 {\n\tinf := math.Inf(1)\n\treturn complex(inf, inf)\n}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func (x *Float) IsInf() bool {}", "func IsInf(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsInf\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (space RealIntervalSpace) Inf() float64 {\n\treturn space.Min\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func FloatIsInf(x *big.Float,) bool", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func (e stringElement) IsInf(sign int) bool {\n\tswitch strings.ToLower(e.e) {\n\tcase \"inf\", \"-inf\", \"+inf\":\n\t\tf, err := strconv.ParseFloat(e.e, 64)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn math.IsInf(f, sign)\n\t}\n\treturn false\n}", "func (p *g1JacExtended) setInfinity() *g1JacExtended {\n\tp.X.SetOne()\n\tp.Y.SetOne()\n\tp.ZZ = fp.Element{}\n\tp.ZZZ = fp.Element{}\n\treturn p\n}", "func posInf() float64 {\n\treturn math.Inf(1) // argument specifies positive infinity\n}", "func (Integer) IsPosInf() bool {\n\treturn false\n}", "func Inf32(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf32\n\t} else {\n\t\tv = uvneginf32\n\t}\n\treturn Float32frombits(v)\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func Sinf(a float64) float64 {\n\treturn float64(math.Sin(float64(a)))\n}", "func Minf(a, b float32) float32", "func Inf(a, b interface{}, f Func) bool {\n\treturn f(a, b) == -1\n}", "func (p *PointProj) setInfinity() *PointProj {\n\tp.X.SetZero()\n\tp.Y.SetOne()\n\tp.Z.SetOne()\n\treturn p\n}", "func (*BigInt) IsPosInf() bool {\n\treturn false\n}", "func IsInfinite(f float64, sign int) bool {\n\n\treturn math.IsInf(f, sign)\n}", "func Inf32(sign int) float32 {\n\treturn float32(math.Inf(sign))\n}", "func (z *Big) SetNaN(signal bool) *Big {\n\tif signal {\n\t\tz.form = snan\n\t} else {\n\t\tz.form = qnan\n\t}\n\tz.compact = 0 // payload\n\treturn z\n}", "func Loginf(s string) {\n\n\twritelog(s, INF)\n\treturn\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (r *Registers) setFlagZ(bit bool) {\n\tif bit {\n\t\tr.F |= zeroFlag\n\t} else {\n\t\tr.F = r.F &^ zeroFlag\n\t}\n}", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setZero(sign, 0)\n\t}\n\tif math.IsNaN(x) {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setNaN(0, qnan|sign, 0)\n\t}\n\tif math.IsInf(x, 0) {\n\t\tif math.IsInf(x, 1) {\n\t\t\tz.form = pinf\n\t\t} else {\n\t\t\tz.form = ninf\n\t\t}\n\t\treturn z\n\t}\n\n\t// The gist of the following is lifted from math/big/rat.go, but adapted for\n\t// base-10 decimals.\n\n\tconst expMask = 1<<11 - 1\n\tbits := math.Float64bits(x)\n\tmantissa := bits & (1<<52 - 1)\n\texp := int((bits >> 52) & expMask)\n\tif exp == 0 { // denormal\n\t\texp -= 1022\n\t} else { // normal\n\t\tmantissa |= 1 << 52\n\t\texp -= 1023\n\t}\n\n\tif mantissa == 0 {\n\t\treturn z.SetUint64(0)\n\t}\n\n\tshift := 52 - exp\n\tfor mantissa&1 == 0 && shift > 0 {\n\t\tmantissa >>= 1\n\t\tshift--\n\t}\n\n\tz.exp = 0\n\tz.form = finite | form(bits>>63)\n\n\tif shift > 0 {\n\t\tz.unscaled.SetUint64(uint64(shift))\n\t\tz.unscaled.Exp(c.FiveInt, &z.unscaled, nil)\n\t\tarith.Mul(&z.unscaled, &z.unscaled, mantissa)\n\t\tz.exp = -shift\n\t} else {\n\t\t// TODO(eric): figure out why this doesn't work for _some_ numbers. See\n\t\t// https://github.com/ericlagergren/decimal/issues/89\n\t\t//\n\t\t// z.compact = mantissa << uint(-shift)\n\t\t// z.precision = arith.Length(z.compact)\n\n\t\tz.compact = c.Inflated\n\t\tz.unscaled.SetUint64(mantissa)\n\t\tz.unscaled.Lsh(&z.unscaled, uint(-shift))\n\t}\n\treturn z.norm()\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func FloatSign(x *big.Float,) int", "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func Int(num cty.Value) (cty.Value, error) {\n\tif num == cty.PositiveInfinity || num == cty.NegativeInfinity {\n\t\treturn cty.NilVal, fmt.Errorf(\"can't truncate infinity to an integer\")\n\t}\n\treturn IntFunc.Call([]cty.Value{num})\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Float) SetInt64(x int64) *Float {}", "func Infinity() Point {\n\treturn Point{1, 0}\n}", "func (z *Numeric) SetInt(x int) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tif x < 0 {\n\t\tz.sign = numericNegative\n\t} else {\n\t\tz.sign = numericPositive\n\t}\n\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := mathh.AbsInt16(int16(x % numericBase))\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}", "func NewInfinityValue() InfinityValue {\n\treturn infinityValue\n}", "func FloatSetInt(z *big.Float, x *big.Int,) *big.Float", "func (z *Float64) Inv(y *Float64) *Float64 {\n\tif y.IsZeroDivisor() {\n\t\tpanic(zeroDivisorInverse)\n\t}\n\treturn z.Divide(z.Conj(y), y.Quad())\n}", "func (x *Big) Float(z *big.Float) *big.Float {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Float)\n\t}\n\n\tswitch x.form {\n\tcase finite, finite | signbit:\n\t\tif x.isZero() {\n\t\t\tz.SetUint64(0)\n\t\t} else {\n\t\t\tz.SetRat(x.Rat(nil))\n\t\t}\n\tcase pinf, ninf:\n\t\tz.SetInf(x.form == pinf)\n\tdefault: // snan, qnan, ssnan, sqnan:\n\t\tz.SetUint64(0)\n\t}\n\treturn z\n}", "func SignExtend(x *big.Int, n uint) *big.Int {\n\tsignBit := n - 1\n\t// single bit set at sign bit position\n\tmask := new(big.Int).Lsh(big1, signBit)\n\t// all bits below sign bit set to 1 all above (including sign bit) set to 0\n\tmask.Sub(mask, big1)\n\tif x.Bit(int(signBit)) == 1 {\n\t\t// Number represented is negative - set all bits above sign bit (including sign bit)\n\t\treturn x.Or(x, mask.Not(mask))\n\t} else {\n\t\t// Number represented is positive - clear all bits above sign bit (including sign bit)\n\t\treturn x.And(x, mask)\n\t}\n}", "func (g *G1) SetIdentity() { g.x = ff.Fp{}; g.y.SetOne(); g.z = ff.Fp{} }", "func Infoln(v ...interface{}) {\n\tlog.Infoln(v...)\n}", "func FloatSignbit(x *big.Float,) bool", "func IsInFinite(arg float64, ch int) bool {\n\treturn math.IsInf(arg, ch)\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (x *Float) Signbit() bool {}", "func (z *Float) Set(x *Float) *Float {}", "func Infoln(v ...interface{}) {\n\tl.outputln(LInfo, v...)\n}", "func (z *Rat) SetInt(x *Int) *Rat {}", "func (z *Big) setNaN(c Condition, f form, p Payload) *Big {\n\tz.form = f\n\tz.compact = uint64(p)\n\tz.Context.Conditions |= c\n\tif z.Context.OperatingMode == Go {\n\t\tpanic(ErrNaN{Msg: z.Context.Conditions.String()})\n\t}\n\treturn z\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (z *Float) SetFloat64(x float64) *Float {}", "func Infoln(v ...interface{}) {\n\t_ = info.Output(2, fmt.Sprintln(v...))\n}", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func (cpu *CPU) set_Z(i uint16) {\r\n\tcpu.regs[2] = (cpu.regs[2] & 0xfd) | ((i & 1) << 1)\r\n}", "func IsFinite(arg float64, ch int) bool {\n\treturn !math.IsInf(arg, ch)\n}", "func (p *G1Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func Infoln(val ...interface{}) error {\n\tlog := logger.Get()\n\tlog.Infoln(val...)\n\treturn nil\n}", "func (v *Vec3i) SetNegate() {\n\tv.X = -v.X\n\tv.Y = -v.Y\n\tv.Z = -v.Z\n}", "func (d Direction) Infinity() string { return infty[d] }", "func (v Verbosity) Infoln(args ...interface{}) {\n\tif v {\n\t\tinfoLog.Output(CallDepth+1, fmt.Sprintln(args...))\n\t}\n}", "func (c curve) IsAtInfinity(X, Y *big.Int) bool {\n\treturn X.Sign() == 0 && Y.Sign() == 0\n}", "func Infoln(v ...interface{}) {\n\tif std.level >= InfoLevel {\n\t\tstd.Output(std.callDepth, fmt.Sprintln(v...), InfoLevel)\n\t}\n}", "func (p *G2Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func Infoln(output string) {\n\tInfod(output, nil)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func (_DayLimitMock *DayLimitMockTransactor) SetDailyLimit(opts *bind.TransactOpts, _newLimit *big.Int) (*types.Transaction, error) {\n\treturn _DayLimitMock.contract.Transact(opts, \"setDailyLimit\", _newLimit)\n}", "func Exp(o, z *big.Float) *big.Float {\n\tif o.Prec() == 0 {\n\t\to.SetPrec(z.Prec())\n\t}\n\tif z.Sign() == 0 {\n\t\treturn o.SetFloat64(1)\n\t}\n\tif z.IsInf() {\n\t\tif z.Sign() < 0 {\n\t\t\treturn o.Set(&gzero)\n\t\t}\n\t\treturn o.Set(z)\n\t}\n\n\tp := o\n\tif p == z {\n\t\t// We need z for Newton's algorithm, so ensure we don't overwrite it.\n\t\tp = new(big.Float).SetPrec(z.Prec())\n\t}\n\t// try to get initial estimate using IEEE-754 math\n\t// TODO: save work (and an import of math) by checking the exponent of z\n\tzf, _ := z.Float64()\n\tzf = math.Exp(zf)\n\tif math.IsInf(zf, 1) || zf == 0 {\n\t\t// too big or too small for IEEE-754 math,\n\t\t// perform argument reduction using\n\t\t// e^{2z} = (e^z)²\n\t\thalfZ := quicksh(new(big.Float), z, -1).SetPrec(p.Prec() + 64)\n\t\t// TODO: avoid recursion\n\t\thalfExp := Exp(halfZ, halfZ)\n\t\treturn p.Mul(halfExp, halfExp)\n\t}\n\t// we got a nice IEEE-754 estimate\n\tguess := big.NewFloat(zf)\n\n\t// f(t)/f'(t) = t*(log(t) - z)\n\tf := func(t *big.Float) *big.Float {\n\t\tp.Sub(Log(new(big.Float), t), z)\n\t\treturn p.Mul(p, t)\n\t}\n\n\tx := newton(f, guess, z.Prec()) // TODO: make newton operate in place\n\n\treturn o.Set(x)\n}", "func (z *Int) SetBit(x *Int, i int, b uint) *Int {}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (f *Int64) Set(val int64) {\n\tf.set(-1, val, false)\n}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func (i Int) Sign() int {\n\treturn i.i.Sign()\n}", "func Infoln(args ...interface{}) {\n\tNewDefaultEntry().Infoln(args...)\n}", "func (z *Float) Neg(x *Float) *Float {}", "func Benchmark_FindNaNOrInf(b *testing.B) {\n\tfuncs := []taggedMultiBenchVarargsFunc{\n\t\t{\n\t\t\tf: findNaNOrInfSimdSubtask,\n\t\t\ttag: \"SIMD\",\n\t\t},\n\t\t{\n\t\t\tf: findNaNOrInfBitwiseSubtask,\n\t\t\ttag: \"Bitwise\",\n\t\t},\n\t\t{\n\t\t\tf: findNaNOrInfStandardSubtask,\n\t\t\ttag: \"Standard\",\n\t\t},\n\t}\n\trand.Seed(1)\n\tfor _, f := range funcs {\n\t\tmultiBenchmarkVarargs(f.f, f.tag+\"Long\", 100000, func() interface{} {\n\t\t\tmain := make([]float64, 30000)\n\t\t\t// Results were overly influenced by RNG if the number of NaNs/infs in\n\t\t\t// the slice was not controlled.\n\t\t\tfor i := 0; i < 30; i++ {\n\t\t\t\tfor {\n\t\t\t\t\tpos := rand.Intn(len(main))\n\t\t\t\t\tif main[pos] != math.Inf(0) {\n\t\t\t\t\t\tmain[pos] = math.Inf(0)\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\treturn float64Args{\n\t\t\t\tmain: main,\n\t\t\t}\n\t\t}, b)\n\t}\n}", "func (z *Rat) Inv(x *Rat) *Rat {\n\t// possible: panic(\"division by zero\")\n}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func softfloat_propagateNaNF128UI(uiA64, uiA0, uiB64, uiB0 uint64) Uint128 {\n\tvar isSigNaNA bool\n\tvar uiZ Uint128\n\n\tisSigNaNA = softfloat_isSigNaNF128UI(uiA64, uiA0)\n\tif isSigNaNA || softfloat_isSigNaNF128UI(uiB64, uiB0) {\n\t\tsoftfloat_raiseFlags(softfloat_flag_invalid)\n\t\tif isSigNaNA {\n\t\t\tuiZ.High = uiA64\n\t\t\tuiZ.Low = uiA0\n\t\t\tuiZ.High |= uint64(0x0000800000000000)\n\t\t\treturn uiZ\n\t\t}\n\t}\n\n\tif isNaNF128UI(uiA64, uiA0) {\n\t\tuiZ.High = uiA64\n\t\tuiZ.Low = uiA0\n\t} else {\n\t\tuiZ.High = uiB64\n\t\tuiZ.Low = uiB0\n\t}\n\n\tuiZ.High |= uint64(0x0000800000000000)\n\treturn uiZ\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func (_DayLimitMock *DayLimitMockTransactorSession) SetDailyLimit(_newLimit *big.Int) (*types.Transaction, error) {\n\treturn _DayLimitMock.Contract.SetDailyLimit(&_DayLimitMock.TransactOpts, _newLimit)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func SignInt(v int) int {\n\tif v < 0 {\n\t\treturn -1\n\t}\n\tif v > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (l *Log) Infoln(args ...interface{}) {\n\tl.logger.Infoln(args...)\n}", "func IntSetBits(z *big.Int, abs []big.Word,) *big.Int" ]
[ "0.8629199", "0.82180965", "0.67190284", "0.6182511", "0.61708623", "0.6162603", "0.602588", "0.6004949", "0.5986634", "0.58150524", "0.5814855", "0.57910305", "0.57887775", "0.5758183", "0.5607472", "0.56050515", "0.54215986", "0.5413703", "0.5351654", "0.5299949", "0.5245655", "0.5211314", "0.52015316", "0.51677734", "0.51321733", "0.5129403", "0.506536", "0.5031688", "0.5016308", "0.5006633", "0.5003992", "0.4972039", "0.49608284", "0.49112502", "0.48135576", "0.4739796", "0.47388312", "0.47349393", "0.47300354", "0.47207072", "0.47136366", "0.46276626", "0.46226877", "0.46226668", "0.46141648", "0.4537689", "0.4516855", "0.45157972", "0.45134026", "0.4496158", "0.44906104", "0.4484336", "0.44644752", "0.44630244", "0.4462131", "0.44608498", "0.4437426", "0.44121245", "0.4402606", "0.4384639", "0.4378495", "0.43751895", "0.4372873", "0.4368959", "0.43629265", "0.43530422", "0.4352174", "0.43499112", "0.43461788", "0.4336512", "0.4323048", "0.43187663", "0.43113038", "0.43084374", "0.4301713", "0.43008405", "0.43002018", "0.4291037", "0.4291037", "0.4276834", "0.42759064", "0.42751256", "0.42746603", "0.42658114", "0.42305967", "0.4216576", "0.4214534", "0.4210141", "0.42026097", "0.41845533", "0.4165571", "0.4163467", "0.41403028", "0.41394722", "0.41201884", "0.411993", "0.411797", "0.41163185", "0.41073218", "0.41031456" ]
0.8384886
1
SetMantScale sets z to the given value and scale.
func (z *Big) SetMantScale(value int64, scale int) *Big { z.SetUint64(arith.Abs(value)) z.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64 if value < 0 { z.form |= signbit } return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big {\n\t// Do this first in case value == z.unscaled. Don't want to clobber the sign.\n\tz.form = finite\n\tif value.Sign() < 0 {\n\t\tz.form |= signbit\n\t}\n\n\tz.unscaled.Abs(value)\n\tz.compact = c.Inflated\n\tz.precision = arith.BigLength(value)\n\n\tif z.unscaled.IsUint64() {\n\t\tif v := z.unscaled.Uint64(); v != c.Inflated {\n\t\t\tz.compact = v\n\t\t}\n\t}\n\n\tz.exp = -scale\n\treturn z\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (z *Big) SetScale(scale int) *Big {\n\tz.exp = -scale\n\treturn z\n}", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (tr *trooper) setScale(scale float64) { tr.part.SetScale(scale, scale, scale) }", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func (self *TileSprite) SetTileScaleA(member *Point) {\n self.Object.Set(\"tileScale\", member)\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (self *Tween) SetTimeScaleA(member int) {\n self.Object.Set(\"timeScale\", member)\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (self *ComponentScaleMinMax) SetScaleMaxA(member *Point) {\n self.Object.Set(\"scaleMax\", member)\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (self *ComponentScaleMinMax) SetScaleMinMax(minX interface{}, minY interface{}, maxX interface{}, maxY interface{}) {\n self.Object.Call(\"setScaleMinMax\", minX, minY, maxX, maxY)\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func MatrixScale(x, y, z float32) Matrix {\n\tresult := NewMatrix(\n\t\tx, 0.0, 0.0, 0.0,\n\t\t0.0, y, 0.0, 0.0,\n\t\t0.0, 0.0, z, 0.0,\n\t\t0.0, 0.0, 0.0, 1.0)\n\n\treturn result\n}", "func (v Vec3) Scale(s float64) Vec3 {\n\treturn Vec3{v[0] * s, v[1] * s, v[2] * s}\n}", "func (fpsc *FloorPlanScaleCreate) SetScaleInMeters(f float64) *FloorPlanScaleCreate {\n\tfpsc.mutation.SetScaleInMeters(f)\n\treturn fpsc\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (t *Transform) SetScaleXY(x float64, y float64) ITransform {\n\treturn t.SetScale(NewVector(x, y))\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func SetMpzValue(model ModelT, t TermT, val *MpzT) int32 {\n\treturn int32(C.yices_model_set_mpzp(ymodel(model), C.term_t(t), (*C.mpz_t)(unsafe.Pointer(val))))\n}", "func (p *Plane) Scale(scaleVec mgl32.Vec3) {\n\tp.model.Scale = scaleVec\n\tp.centroid = CalculateCentroid(p.vertexValues.Vertices, p.model.Scale)\n\tp.boundingBox = ScaleBoundingBox(p.boundingBox, scaleVec)\n}", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func Scale(v Vec) *Mtx {\n\treturn NewMat(\n\t\tv.X, 0, 0, 0,\n\t\t0, v.Y, 0, 0,\n\t\t0, 0, v.Z, 0,\n\t\t0, 0, 0, 1,\n\t)\n}", "func Scale(s Frac, m M) M {\n\tm = CopyMatrix(m)\n\n\tfor r := 1; r <= m.Rows(); r++ {\n\t\tm.MultiplyRow(r, s)\n\t}\n\n\treturn m\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (s *Scale) SetValue(v float64) *Scale {\n\ts.Value = &v\n\treturn s\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (v *Vec4) Scale(s float32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\tv.W *= s\n}", "func (sprite *Sprite) SetScaling(xScale, yScale float64) {\n\n\tsprite.shape.SetScaling(xScale, yScale)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (self *ComponentScaleMinMax) SetScaleMinA(member *Point) {\n self.Object.Set(\"scaleMin\", member)\n}", "func (this *RectangleShape) SetScale(scale Vector2f) {\n\tC.sfRectangleShape_setScale(this.cptr, scale.toC())\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func (r *RAM) SetAmplScaleFactor(x uint16) {\n\tbinary.BigEndian.PutUint16(r[0:2], x<<2)\n}", "func (m *PrinterDefaults) SetScaling(value *PrintScaling)() {\n err := m.GetBackingStore().Set(\"scaling\", value)\n if err != nil {\n panic(err)\n }\n}", "func (v Vector) Scale(scale float64) Vector {\n\treturn Vector{\n\t\tX: v.X * scale,\n\t\tY: v.Y * scale,\n\t\tZ: v.Z * scale}\n}", "func (v *ScaleButton) SetValue(value float64) {\n\tC.gtk_scale_button_set_value(v.native(), C.gdouble(value))\n}", "func (a *ReplaySnapshotArgs) SetScale(scale float64) *ReplaySnapshotArgs {\n\ta.Scale = &scale\n\treturn a\n}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (t *Transform) Scale() lmath.Vec3 {\n\tt.access.RLock()\n\ts := t.scale\n\tt.access.RUnlock()\n\treturn s\n}", "func (p *point) scaleBy(factor int) {\n\tp.x *= factor\n\tp.y *= factor\n}", "func (nt nodeTasks) setScale(node *Node, scale, buffer int) {\n\tst := nt[node]\n\tst.Lock()\n\tdefer st.RUnlock()\n\n\tcurrScale := len(st.buffers)\n\n\t// Increase the number of tasks for the given node.\n\t// a scale of 1 only adds a buffer with no scale.\n\tif scale > currScale {\n\t\tfor ; scale > currScale; currScale++ {\n\t\t\ttask := make(chan Record, buffer)\n\t\t\tst.buffers = append(st.buffers, task)\n\t\t\tgo func() {\n\t\t\t\tfor record := range task {\n\t\t\t\t\tnode.forward(record)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif scale < currScale {\n\t\tfor ; scale < currScale; currScale-- {\n\t\t\tclose(st.buffers[currScale-1])\n\t\t\tst.buffers = st.buffers[:currScale-1]\n\t\t}\n\t}\n}", "func ScaleFunc(v *Vertex, f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func (v *Vec3i) SetDim(dim Dims, value int32) {\n\tswitch dim {\n\tcase X:\n\t\tv.X = value\n\tcase Y:\n\t\tv.Y = value\n\tcase Z:\n\t\tv.Z = value\n\tdefault:\n\t\tpanic(\"dim is out of range: \")\n\t}\n}", "func Vec3Scale(s float32, a Vec3) (v Vec3) {\n\tv[0] = a[0] * s\n\tv[1] = a[1] * s\n\tv[2] = a[2] * s\n\treturn\n}", "func scale(val float64, min float64, max float64, outMin float64, outMax float64) float64 {\r\n\tdenom := 1.0\r\n\ty := 0.0\r\n\tif outMin - min != 0 {\r\n\t\tdenom = outMin - min\r\n\t\ty = (outMax - max) / denom * val - min + outMin\r\n\t} else {\r\n\t\ty = outMax / max * val - min + outMin\r\n\t}\r\n\treturn y\r\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (self *TileSprite) SetTileScaleOffsetA(member *Point) {\n self.Object.Set(\"tileScaleOffset\", member)\n}", "func (c *canvasRenderer) Scale(amount sprec.Vec2) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.ScaleMat4(amount.X, amount.Y, 1.0),\n\t)\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func (m *Map) SetMagnetVal(loc Location) {\n\tincAnt := func(row, col int) int {\n\t\tif m.Item[m.FromRowCol(row, col)].IsAnt() {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}\n\tm.DoInRadRet(loc, 7, incAnt)\n\n}", "func Mat3Scale(out, a, v []float64) []float64 {\n\tx := v[0]\n\ty := v[1]\n\n\tout[0] = x * a[0]\n\tout[1] = x * a[1]\n\tout[2] = x * a[2]\n\n\tout[3] = y * a[3]\n\tout[4] = y * a[4]\n\tout[5] = y * a[5]\n\n\tout[6] = a[6]\n\tout[7] = a[7]\n\tout[8] = a[8]\n\treturn out\n}", "func (v Vector) Scale(c float64) Vector {\n\tfor i, x := range v {\n\t\tv[i] = x * c\n\t}\n\treturn v\n}", "func (self Transform) Scale(scaleX, scaleY float32) {\n\tC.sfTransform_scale(self.Cref, C.float(scaleX), C.float(scaleY))\n}", "func main() {\n\tv := Vertex{1, 2}\n\tc := float64(rand.Intn(1337))\n\n\tfmt.Println(\"original\", v.Abs())\n\n\tv.Scale(c)\n\tfmt.Println(v.Abs())\n\n\tScale(&v, 1/c)\n\tfmt.Println(\"rescaled\", Abs(v))\n\n\tp := &Vertex{3,4}\n\tp.Scale(3)\n\tScale(p,8)\n\n\tfmt.Println(v,p)\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func (v *Vec3i) SetMulScalar(s int32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n}", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat" ]
[ "0.68702483", "0.6248807", "0.61674476", "0.6146303", "0.6134963", "0.60448337", "0.60083556", "0.58896357", "0.58430636", "0.5758922", "0.56517684", "0.56401706", "0.55845803", "0.5564209", "0.5545746", "0.54657805", "0.5404176", "0.5345362", "0.5323023", "0.53002053", "0.52696687", "0.5223504", "0.5203177", "0.51688623", "0.5164057", "0.51404446", "0.5138695", "0.5126029", "0.5122572", "0.51196206", "0.5116785", "0.51078147", "0.51046216", "0.507917", "0.5060714", "0.505388", "0.50457823", "0.50347173", "0.50294495", "0.5024468", "0.50237143", "0.5023365", "0.50223225", "0.5014211", "0.49787223", "0.49768952", "0.49767327", "0.49762252", "0.49605656", "0.49593115", "0.4959021", "0.49539158", "0.49467757", "0.493767", "0.493767", "0.493767", "0.493767", "0.493767", "0.493767", "0.493767", "0.4937591", "0.49298197", "0.49116722", "0.48972905", "0.48827976", "0.48802242", "0.48800585", "0.48778072", "0.48698547", "0.48669705", "0.4834289", "0.4822949", "0.48028955", "0.479571", "0.47839966", "0.4769853", "0.47580525", "0.47554508", "0.47508723", "0.47187358", "0.47072008", "0.47020316", "0.4702024", "0.46869364", "0.46838662", "0.4671671", "0.46697387", "0.46548772", "0.46513823", "0.46510002", "0.46290404", "0.46234208", "0.46182242", "0.46142864", "0.45885634", "0.457882", "0.45532298", "0.45423687", "0.45159706", "0.45152563" ]
0.76997876
0
setNaN is an internal NaNsetting method that panics when the OperatingMode is Go.
func (z *Big) setNaN(c Condition, f form, p Payload) *Big { z.form = f z.compact = uint64(p) z.Context.Conditions |= c if z.Context.OperatingMode == Go { panic(ErrNaN{Msg: z.Context.Conditions.String()}) } return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Big) SetNaN(signal bool) *Big {\n\tif signal {\n\t\tz.form = snan\n\t} else {\n\t\tz.form = qnan\n\t}\n\tz.compact = 0 // payload\n\treturn z\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func (x *Big) IsNaN(quiet int) bool {\n\treturn quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func (result Result) NaN() Result {\r\n\tresult.AvgDelay = math.NaN()\r\n\tresult.MinDelay = math.NaN()\r\n\tresult.MaxDelay = math.NaN()\r\n\treturn result\r\n}", "func NaN() float32 { return Float32frombits(uvnan) }", "func (g *PCPGauge) MustSet(val float64) {\n\tif err := g.Set(val); err != nil {\n\t\tpanic(err)\n\t}\n}", "func IsNan(arg float64) bool {\n\treturn math.IsNaN(arg)\n}", "func (v Value) IsNaN() bool {\n\treturn v.v.Kind() == reflect.Float64 && math.IsNaN(v.v.Float())\n}", "func (p *g1JacExtended) setInfinity() *g1JacExtended {\n\tp.X.SetOne()\n\tp.Y.SetOne()\n\tp.ZZ = fp.Element{}\n\tp.ZZZ = fp.Element{}\n\treturn p\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func signal(x *decimal.Big, c decimal.Condition, err error) *decimal.Big {\n\tswitch ctx := &x.Context; ctx.OperatingMode {\n\tcase decimal.Go:\n\t\t// Go mode always panics on NaNs.\n\t\tif _, ok := err.(decimal.ErrNaN); ok {\n\t\t\tpanic(err)\n\t\t}\n\tcase decimal.GDA:\n\t\tctx.Conditions = c\n\t\tif c&ctx.Traps != 0 {\n\t\t\tctx.Err = err\n\t\t}\n\tdefault:\n\t\tctx.Conditions = c | decimal.InvalidContext\n\t\tctx.Err = fmt.Errorf(\"invalid OperatingMode: %d\", ctx.OperatingMode)\n\t\t// TODO(eric): Add a SetNaN method?\n\t\tx.SetString(\"qNaN\")\n\t}\n\treturn x\n}", "func (o InstanceDenyMaintenancePeriodTimeOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceDenyMaintenancePeriodTime) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (p *PointProj) setInfinity() *PointProj {\n\tp.X.SetZero()\n\tp.Y.SetOne()\n\tp.Z.SetOne()\n\treturn p\n}", "func fillNaNDense(m *mat.Dense) {\n\tr, c := m.Dims()\n\tfor i := 0; i < r; i++ {\n\t\tfor j := 0; j < c; j++ {\n\t\t\tm.Set(i, j, math.NaN())\n\t\t}\n\t}\n}", "func (e stringElement) IsNaN() bool {\n\tif !e.valid {\n\t\treturn true\n\t}\n\tf, err := strconv.ParseFloat(e.e, 64)\n\tif err == nil {\n\t\treturn math.IsNaN(f)\n\t}\n\treturn true\n}", "func (g *PCPGaugeVector) MustSet(val float64, instance string) {\n\tif err := g.Set(val, instance); err != nil {\n\t\tpanic(err)\n\t}\n}", "func IsNaN(f float32) (is bool) {\n\t// IEEE 754 says that only NaNs satisfy `f != f`.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf`\n\treturn f != f\n}", "func (vm *vm) setNmiMask(nmiMask byte) {\n\t// Reset is always allowed:\n\tvm.nmiMask = nmiMask | resetNmiMask\n\tvm.updateNmiSeen()\n}", "func ReplaceNaNs(data *FilteredData, replacementType NaNReplacement) *FilteredData {\n\t// go does not marshal NaN values properly so make them empty\n\tnumericColumns := make([]int, 0)\n\tfor _, c := range data.Columns {\n\t\tif model.IsNumerical(c.Type) {\n\t\t\tnumericColumns = append(numericColumns, c.Index)\n\t\t}\n\t}\n\n\tif len(numericColumns) > 0 {\n\t\tfor _, r := range data.Values {\n\t\t\tfor _, nc := range numericColumns {\n\t\t\t\tf, ok := r[nc].Value.(float64)\n\t\t\t\tif ok && math.IsNaN(f) {\n\t\t\t\t\tif replacementType == Null {\n\t\t\t\t\t\tr[nc].Value = nil\n\t\t\t\t\t} else if replacementType == EmptyString {\n\t\t\t\t\t\tr[nc].Value = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn data\n}", "func IsNan(f float64) bool {\n\n\treturn math.IsNaN(f)\n}", "func (o InstanceDenyMaintenancePeriodTimePtrOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *InstanceDenyMaintenancePeriodTime) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Nanos\n\t}).(pulumi.IntPtrOutput)\n}", "func (ms DoubleDataPoint) SetValue(v float64) {\n\t(*ms.orig).Value = v\n}", "func (s *Float64Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Float64Value, err = cast.ToFloat64E(v)\n\treturn err\n}", "func nanChecker(want, got float64) bool {\n\ta, b, c := math.IsNaN(want), math.IsNaN(got), (want == got)\n\treturn (a && b) || (!a && !b && c)\n}", "func (ms Int64DataPoint) SetValue(v int64) {\n\t(*ms.orig).Value = v\n}", "func (vals PendingValues) lockSet(inst, prop ident.Id, nilVal, want interface{}) (err error) {\n\tif reflect.TypeOf(nilVal) != reflect.TypeOf(want) {\n\t\terr = SetValueMismatch(inst, prop, nilVal, want)\n\t} else if curr, have := vals[prop]; have && curr != want {\n\t\terr = SetValueChanged(inst, prop, curr, want)\n\t} else {\n\t\tvals[prop] = want\n\t}\n\treturn err\n}", "func (z *Big) SetInf(signbit bool) *Big {\n\tif signbit {\n\t\tz.form = ninf\n\t} else {\n\t\tz.form = pinf\n\t}\n\treturn z\n}", "func NaN32() float32 { return Float32frombits(uvnan32) }", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func isNaN(val string) bool {\n\tif val == nan {\n\t\treturn true\n\t}\n\n\t_, err := strconv.ParseFloat(val, 64)\n\n\treturn err != nil\n}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func (m *DeviceHealthScriptRunSummary) SetNoIssueDetectedDeviceCount(value *int32)() {\n err := m.GetBackingStore().Set(\"noIssueDetectedDeviceCount\", value)\n if err != nil {\n panic(err)\n }\n}", "func IsNan(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsNan\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (z *Big) CheckNaNs(x, y *Big) bool {\n\treturn z.invalidContext(z.Context) || z.checkNaNs(x, y, 0)\n}", "func NaN32() float32 {\n\treturn float32(math.NaN())\n}", "func (z *Float) SetInt64(x int64) *Float {}", "func (v *Value) SetNull() {\n\tC.zj_SetNull(v.V)\n}", "func (o InstanceMaintenancePolicyWeeklyMaintenanceWindowStartTimeOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceMaintenancePolicyWeeklyMaintenanceWindowStartTime) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (o InstanceMaintenancePolicyWeeklyMaintenanceWindowStartTimeOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceMaintenancePolicyWeeklyMaintenanceWindowStartTime) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (m *matrix) SetValue(i, j int, v float64) (err error) {\n\tif ok, err := m.checkBounds(i, j); !ok {\n\t\treturn err\n\t}\n\tm.matrix[i][j] = v\n\treturn err\n}", "func (na *NArray) SetValue(v float32) *NArray {\n\n\tfor i := range na.Data {\n\t\tna.Data[i] = v\n\t}\n\treturn na\n}", "func (o TransferJobScheduleStartTimeOfDayPtrOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *TransferJobScheduleStartTimeOfDay) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Nanos\n\t}).(pulumi.IntPtrOutput)\n}", "func (o InstanceMaintenanceWindowStartTimeOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceMaintenanceWindowStartTime) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (m *MacOSMinimumOperatingSystem) SetV120(value *bool)() {\n err := m.GetBackingStore().Set(\"v12_0\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *Int64Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Int64Value, err = cast.ToInt64E(v)\n\treturn err\n}", "func (z *Float) SetFloat64(x float64) *Float {}", "func (m *DeviceOperatingSystemSummary) SetUnknownCount(value *int32)() {\n err := m.GetBackingStore().Set(\"unknownCount\", value)\n if err != nil {\n panic(err)\n }\n}", "func (g *PCPGauge) Set(val float64) error {\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\treturn g.set(val)\n}", "func (ms HistogramBucketExemplar) SetValue(v float64) {\n\t(*ms.orig).Value = v\n}", "func mpsetexp(a *Mpflt, exp int) {\n\tif int(int16(exp)) != exp {\n\t\tif exp > 0 {\n\t\t\tYyerror(\"float constant is too large\")\n\t\t\ta.Exp = 0x7fff\n\t\t} else {\n\t\t\tMpmovecflt(a, 0)\n\t\t}\n\t} else {\n\t\ta.Exp = int16(exp)\n\t}\n}", "func (c *PCPCounterVector) MustSet(val int64, instance string) {\n\tif err := c.Set(val, instance); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (this HashFloat) SetIfEmpty(val float64) <-chan bool {\n\treturn BoolCommand(this.parent, this.args(\"hsetnx\", ftoa(val))...)\n}", "func (o TransferJobScheduleStartTimeOfDayOutput) Nanos() pulumi.IntOutput {\n\treturn o.ApplyT(func(v TransferJobScheduleStartTimeOfDay) int { return v.Nanos }).(pulumi.IntOutput)\n}", "func NOP(emu *Emulator) {\n\temu.Registers.M = 1\n\temu.Registers.T = 4\n}", "func (m *Map) SetMagnetVal(loc Location) {\n\tincAnt := func(row, col int) int {\n\t\tif m.Item[m.FromRowCol(row, col)].IsAnt() {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}\n\tm.DoInRadRet(loc, 7, incAnt)\n\n}", "func (_KeepRegistry *KeepRegistryTransactor) SetOperatorContractPanicButton(opts *bind.TransactOpts, _operatorContract common.Address, _panicButton common.Address) (*types.Transaction, error) {\n\treturn _KeepRegistry.contract.Transact(opts, \"setOperatorContractPanicButton\", _operatorContract, _panicButton)\n}", "func Nanotime() int64 {\n\treturn nanotime()\n}", "func Nanotime() int64 {\n\treturn nanotime()\n}", "func Nanosec() int64 {\n\treturn syscall.Nanosec()\n}", "func (m *MacOSMinimumOperatingSystem) SetV1010(value *bool)() {\n err := m.GetBackingStore().Set(\"v10_10\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetNumberValue(target, newvalue reflect.Value) error {\n\tif pkg.IsNumber(target) && pkg.IsNumber(newvalue) {\n\t\tswitch target.Type().Kind() {\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tif pkg.GetBaseKind(newvalue) == reflect.Uint64 {\n\t\t\t\ttarget.SetInt(int64(newvalue.Uint()))\n\t\t\t} else if pkg.GetBaseKind(newvalue) == reflect.Float64 {\n\t\t\t\ttarget.SetInt(int64(newvalue.Float()))\n\t\t\t} else {\n\t\t\t\ttarget.SetInt(newvalue.Int())\n\t\t\t}\n\n\t\t\treturn nil\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tif pkg.GetBaseKind(newvalue) == reflect.Uint64 {\n\t\t\t\ttarget.SetUint(newvalue.Uint())\n\t\t\t} else if pkg.GetBaseKind(newvalue) == reflect.Float64 {\n\t\t\t\ttarget.SetUint(uint64(newvalue.Float()))\n\t\t\t} else {\n\t\t\t\ttarget.SetUint(uint64(newvalue.Int()))\n\t\t\t}\n\n\t\t\treturn nil\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tif pkg.GetBaseKind(newvalue) == reflect.Uint64 {\n\t\t\t\ttarget.SetFloat(float64(newvalue.Uint()))\n\t\t\t} else if pkg.GetBaseKind(newvalue) == reflect.Float64 {\n\t\t\t\ttarget.SetFloat(newvalue.Float())\n\t\t\t} else {\n\t\t\t\ttarget.SetFloat(float64(newvalue.Int()))\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"this line should not be reached\")\n\t}\n\n\treturn fmt.Errorf(\"this function only used for assigning number data to number variable\")\n}", "func (m *PCPSingletonMetric) MustSet(val interface{}) {\n\tif err := m.Set(val); err != nil {\n\t\tpanic(err)\n\t}\n}", "func IsNaN32(f float32) (is bool) {\n\tx := Float32bits(f)\n\treturn x&uvinf32 == uvinf32 && x != uvinf32 && x != uvneginf32\n}", "func (f *Int64) Set(val int64) {\n\tf.set(-1, val, false)\n}", "func (f Float) IsNaN() bool {\n\t// NaN + NaN should be NaN in consideration\n\treturn math.IsNaN(f.high) || math.IsNaN(f.low)\n}", "func TestJsonVisNinGoGoToGoOptNativeDefault(t *testing.T) {\n\ttestJsonGoGoToGo{\n\t\tgogomsg: gogovisNinOptNativeDefault,\n\t\tnewGomsg: newGoProtoNinOptNativeDefault,\n\t\tgomsg: govisNinOptNativeDefault,\n\t\tvis: true,\n\t}.test(t)\n}", "func (a *Array64) NaNMean(axis ...int) *Array64 {\n\tswitch {\n\tcase a.valAxis(&axis, \"Sum\"):\n\t\treturn a\n\t}\n\treturn a.NaNSum(axis...).Div(a.NaNCount(axis...))\n}", "func (filterdev *NetworkTap) SetImmediate(m int) error {\n\t_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(filterdev.device.Fd()), syscall.BIOCIMMEDIATE, uintptr(unsafe.Pointer(&m)))\n\tif err != 0 {\n\t\treturn syscall.Errno(err)\n\t}\n\treturn nil\n}", "func (pw *PixelWand) SetMagentaQuantum(magenta Quantum) {\n\tC.PixelSetMagentaQuantum(pw.pw, C.Quantum(magenta))\n\truntime.KeepAlive(pw)\n}", "func (v *Value) SetDouble(val float64) {\n\tC.g_value_set_double(v.Native(), C.gdouble(val))\n}", "func (n Noop) Set(_ *net.IPNet) error {\n\treturn nil\n}", "func (m *DeviceCompliancePolicySettingStateSummary) SetNotApplicableDeviceCount(value *int32)() {\n err := m.GetBackingStore().Set(\"notApplicableDeviceCount\", value)\n if err != nil {\n panic(err)\n }\n}", "func (self *Map) SetValueIfNonZero(key string, value interface{}) (typeutil.Variant, bool) {\n\tself.lock()\n\tdefer self.unlock()\n\n\tif !typeutil.IsZero(value) {\n\t\treturn self.set(key, value), true\n\t} else {\n\t\treturn self.Get(key), false\n\t}\n}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func (o InstanceMaintenanceWindowStartTimePtrOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *InstanceMaintenanceWindowStartTime) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Nanos\n\t}).(pulumi.IntPtrOutput)\n}", "func (c *Cell) SetFloat(n float64) {\n\tc.SetFloatWithFormat(n, \"0.00e+00\")\n}", "func (a Vec2) IsNaN() bool {\n\treturn math.IsNaN(a.X) || math.IsNaN(a.Y)\n}", "func (o DurationOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v Duration) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (_Registry *RegistryTransactor) SetOperatorContractPanicButton(opts *bind.TransactOpts, _operatorContract common.Address, _panicButton common.Address) (*types.Transaction, error) {\n\treturn _Registry.contract.Transact(opts, \"setOperatorContractPanicButton\", _operatorContract, _panicButton)\n}", "func (mtr *Dppdpp1intreg1Metrics) SetErrOhiSopNoEop(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"ErrOhiSopNoEop\"))\n\treturn nil\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func VirtualSetNoop(value interface{}, doc bson.M) error {\n\treturn nil\n}", "func (s *CurrentMetricData) SetValue(v float64) *CurrentMetricData {\n\ts.Value = &v\n\treturn s\n}", "func (self *Graphics) SetOutOfBoundsKillA(member bool) {\n self.Object.Set(\"outOfBoundsKill\", member)\n}", "func (m *MockCache) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetNX\", ctx, key, value, expiration)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func MulNoNan(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"MulNoNan\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (s *serverMetricsRecorder) SetEPS(val float64) {\n\tif val < 0 {\n\t\tif logger.V(2) {\n\t\t\tlogger.Infof(\"Ignoring EPS value out of range: %v\", val)\n\t\t}\n\t\treturn\n\t}\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.state.EPS = val\n}", "func (s *Float32Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Float32Value, err = cast.ToFloat32E(v)\n\treturn err\n}", "func (cv *ConVar) SetFloat64(value float64) error {\n\treturn cv.write(reflect.Float64, value, 2)\n}", "func (s Series) IsNaN() []bool {\n\tret := make([]bool, s.Len())\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.elements.Elem(i).IsNaN()\n\t}\n\treturn ret\n}", "func (loc *LogOddsCell) Set(val float64) {\n\tloc.logOddsVal = val\n}", "func (mtr *Dprdpr1intreg1Metrics) SetErrOhiSopNoEop(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"ErrOhiSopNoEop\"))\n\treturn nil\n}", "func (mtr *Dprdpr1intreg1Metrics) SetErrPktinSopNoEop(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"ErrPktinSopNoEop\"))\n\treturn nil\n}", "func (neuron *Neuron) SetValue(x float64) {\n\tneuron.Value = &x\n}", "func (s *MetricDatum) SetValue(v float64) *MetricDatum {\n\ts.Value = &v\n\treturn s\n}", "func IsNaN32(f float32) (is bool) {\n\treturn math.IsNaN(float64(f))\n}", "func (m *MacOSMinimumOperatingSystem) SetV1011(value *bool)() {\n err := m.GetBackingStore().Set(\"v10_11\", value)\n if err != nil {\n panic(err)\n }\n}" ]
[ "0.75140935", "0.5479909", "0.5413603", "0.5412807", "0.5314413", "0.5270599", "0.514888", "0.5118978", "0.4997433", "0.49969953", "0.4986642", "0.4976145", "0.4972884", "0.49156773", "0.47601044", "0.47450122", "0.4738099", "0.47066548", "0.46945947", "0.46789107", "0.4656505", "0.46537852", "0.4644791", "0.45681256", "0.4559489", "0.45519966", "0.4525892", "0.45178112", "0.4490156", "0.44895154", "0.44672486", "0.4464437", "0.44567877", "0.4438408", "0.4371259", "0.4370551", "0.4340616", "0.4324829", "0.43157205", "0.4314963", "0.4314963", "0.4313779", "0.43121326", "0.43069795", "0.4304486", "0.43006298", "0.42919588", "0.42886204", "0.42831826", "0.42756963", "0.42736515", "0.42700002", "0.42645735", "0.42607257", "0.42601442", "0.42596292", "0.42594436", "0.4259088", "0.42534757", "0.42534757", "0.4251376", "0.4244656", "0.42413405", "0.42373005", "0.423184", "0.42283893", "0.42243594", "0.42157543", "0.42143285", "0.42121705", "0.42066815", "0.4198767", "0.41848153", "0.41820458", "0.4181664", "0.4164045", "0.4160918", "0.41606125", "0.41564253", "0.41534358", "0.41457874", "0.41452906", "0.41418678", "0.41418678", "0.4141538", "0.4137012", "0.41335306", "0.41318992", "0.41266426", "0.412273", "0.41219532", "0.412129", "0.41208163", "0.41204107", "0.41203135", "0.41141245", "0.41128075", "0.41082868", "0.41074297", "0.41068968" ]
0.77540654
0
SetNaN sets z to a signaling NaN if signal is true or quiet NaN otherwise and returns z. No conditions are raised.
func (z *Big) SetNaN(signal bool) *Big { if signal { z.form = snan } else { z.form = qnan } z.compact = 0 // payload return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Big) setNaN(c Condition, f form, p Payload) *Big {\n\tz.form = f\n\tz.compact = uint64(p)\n\tz.Context.Conditions |= c\n\tif z.Context.OperatingMode == Go {\n\t\tpanic(ErrNaN{Msg: z.Context.Conditions.String()})\n\t}\n\treturn z\n}", "func (x *Big) IsNaN(quiet int) bool {\n\treturn quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (result Result) NaN() Result {\r\n\tresult.AvgDelay = math.NaN()\r\n\tresult.MinDelay = math.NaN()\r\n\tresult.MaxDelay = math.NaN()\r\n\treturn result\r\n}", "func NaN() float32 { return Float32frombits(uvnan) }", "func signal(x *decimal.Big, c decimal.Condition, err error) *decimal.Big {\n\tswitch ctx := &x.Context; ctx.OperatingMode {\n\tcase decimal.Go:\n\t\t// Go mode always panics on NaNs.\n\t\tif _, ok := err.(decimal.ErrNaN); ok {\n\t\t\tpanic(err)\n\t\t}\n\tcase decimal.GDA:\n\t\tctx.Conditions = c\n\t\tif c&ctx.Traps != 0 {\n\t\t\tctx.Err = err\n\t\t}\n\tdefault:\n\t\tctx.Conditions = c | decimal.InvalidContext\n\t\tctx.Err = fmt.Errorf(\"invalid OperatingMode: %d\", ctx.OperatingMode)\n\t\t// TODO(eric): Add a SetNaN method?\n\t\tx.SetString(\"qNaN\")\n\t}\n\treturn x\n}", "func (Integer) IsNaN() bool {\n\treturn false\n}", "func IsNan(arg float64) bool {\n\treturn math.IsNaN(arg)\n}", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func (v Value) IsNaN() bool {\n\treturn v.v.Kind() == reflect.Float64 && math.IsNaN(v.v.Float())\n}", "func nanChecker(want, got float64) bool {\n\ta, b, c := math.IsNaN(want), math.IsNaN(got), (want == got)\n\treturn (a && b) || (!a && !b && c)\n}", "func IsNan(f float64) bool {\n\n\treturn math.IsNaN(f)\n}", "func IsNan(scope *Scope, x tf.Output) (y tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"IsNan\",\n\t\tInput: []tf.Input{\n\t\t\tx,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func IsNaN(f float32) (is bool) {\n\t// IEEE 754 says that only NaNs satisfy `f != f`.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf`\n\treturn f != f\n}", "func softfloat_propagateNaNF128UI(uiA64, uiA0, uiB64, uiB0 uint64) Uint128 {\n\tvar isSigNaNA bool\n\tvar uiZ Uint128\n\n\tisSigNaNA = softfloat_isSigNaNF128UI(uiA64, uiA0)\n\tif isSigNaNA || softfloat_isSigNaNF128UI(uiB64, uiB0) {\n\t\tsoftfloat_raiseFlags(softfloat_flag_invalid)\n\t\tif isSigNaNA {\n\t\t\tuiZ.High = uiA64\n\t\t\tuiZ.Low = uiA0\n\t\t\tuiZ.High |= uint64(0x0000800000000000)\n\t\t\treturn uiZ\n\t\t}\n\t}\n\n\tif isNaNF128UI(uiA64, uiA0) {\n\t\tuiZ.High = uiA64\n\t\tuiZ.Low = uiA0\n\t} else {\n\t\tuiZ.High = uiB64\n\t\tuiZ.Low = uiB0\n\t}\n\n\tuiZ.High |= uint64(0x0000800000000000)\n\treturn uiZ\n}", "func (s Series) IsNaN() []bool {\n\tret := make([]bool, s.Len())\n\tfor i := 0; i < s.Len(); i++ {\n\t\tret[i] = s.elements.Elem(i).IsNaN()\n\t}\n\treturn ret\n}", "func ReplaceNaNs(data *FilteredData, replacementType NaNReplacement) *FilteredData {\n\t// go does not marshal NaN values properly so make them empty\n\tnumericColumns := make([]int, 0)\n\tfor _, c := range data.Columns {\n\t\tif model.IsNumerical(c.Type) {\n\t\t\tnumericColumns = append(numericColumns, c.Index)\n\t\t}\n\t}\n\n\tif len(numericColumns) > 0 {\n\t\tfor _, r := range data.Values {\n\t\t\tfor _, nc := range numericColumns {\n\t\t\t\tf, ok := r[nc].Value.(float64)\n\t\t\t\tif ok && math.IsNaN(f) {\n\t\t\t\t\tif replacementType == Null {\n\t\t\t\t\t\tr[nc].Value = nil\n\t\t\t\t\t} else if replacementType == EmptyString {\n\t\t\t\t\t\tr[nc].Value = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn data\n}", "func (z *Big) CheckNaNs(x, y *Big) bool {\n\treturn z.invalidContext(z.Context) || z.checkNaNs(x, y, 0)\n}", "func (p *g1JacExtended) setInfinity() *g1JacExtended {\n\tp.X.SetOne()\n\tp.Y.SetOne()\n\tp.ZZ = fp.Element{}\n\tp.ZZZ = fp.Element{}\n\treturn p\n}", "func JNZ(r operand.Op) { ctx.JNZ(r) }", "func (this HashFloat) SetIfEmpty(val float64) <-chan bool {\n\treturn BoolCommand(this.parent, this.args(\"hsetnx\", ftoa(val))...)\n}", "func MulNoNan(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"MulNoNan\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (p *PointProj) setInfinity() *PointProj {\n\tp.X.SetZero()\n\tp.Y.SetOne()\n\tp.Z.SetOne()\n\treturn p\n}", "func (f Float) IsNaN() bool {\n\t// NaN + NaN should be NaN in consideration\n\treturn math.IsNaN(f.high) || math.IsNaN(f.low)\n}", "func (e stringElement) IsNaN() bool {\n\tif !e.valid {\n\t\treturn true\n\t}\n\tf, err := strconv.ParseFloat(e.e, 64)\n\tif err == nil {\n\t\treturn math.IsNaN(f)\n\t}\n\treturn true\n}", "func (a *Array64) NaNMean(axis ...int) *Array64 {\n\tswitch {\n\tcase a.valAxis(&axis, \"Sum\"):\n\t\treturn a\n\t}\n\treturn a.NaNSum(axis...).Div(a.NaNCount(axis...))\n}", "func NaN32() float32 { return Float32frombits(uvnan32) }", "func (z *Big) SetInf(signbit bool) *Big {\n\tif signbit {\n\t\tz.form = ninf\n\t} else {\n\t\tz.form = pinf\n\t}\n\treturn z\n}", "func (s Series) HasNaN() bool {\n\tfor i := 0; i < s.Len(); i++ {\n\t\tif s.elements.Elem(i).IsNaN() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (ac *AlertCreate) SetNillableTemp(f *float64) *AlertCreate {\n\tif f != nil {\n\t\tac.SetTemp(*f)\n\t}\n\treturn ac\n}", "func (v *Value) SetNull() {\n\tC.zj_SetNull(v.V)\n}", "func (r *Registers) setFlagZ(bit bool) {\n\tif bit {\n\t\tr.F |= zeroFlag\n\t} else {\n\t\tr.F = r.F &^ zeroFlag\n\t}\n}", "func (v *Vec3i) SetNegate() {\n\tv.X = -v.X\n\tv.Y = -v.Y\n\tv.Z = -v.Z\n}", "func (z *Float) SetFloat64(x float64) *Float {}", "func (this *Tidy) Quiet(val bool) (bool, error) {\n\treturn this.optSetBool(C.TidyQuiet, cBool(val))\n}", "func FloatValNotNil() predicate.Property {\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldFloatVal)))\n\t})\n}", "func NewSetNull(elementType attr.Type) SetValue {\n\treturn SetValue{\n\t\telementType: elementType,\n\t\tstate: attr.ValueStateNull,\n\t}\n}", "func Inf() complex128 {\n\tinf := math.Inf(1)\n\treturn complex(inf, inf)\n}", "func (z *Float) Mul(x, y *Float) *Float {\n\t// possible: panic(ErrNaN{\"multiplication of zero with infinity\"})\n}", "func (c *Cond) Signal() {\n\tc.Do(func() {})\n}", "func (x *Float) IsInf() bool {}", "func (a Vec2) IsNaN() bool {\n\treturn math.IsNaN(a.X) || math.IsNaN(a.Y)\n}", "func (z *Float) Neg(x *Float) *Float {}", "func toFloatMaybe(v starlark.Value) (float64, bool) {\n\treturn starlark.AsFloat(v)\n}", "func toFloatMaybe(v starlark.Value) (float64, bool) {\n\treturn starlark.AsFloat(v)\n}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func (s *Series) NotNa() *Series {\n\tdata := make([]interface{}, 0, s.Len())\n\tfor _, val := range s.Data {\n\t\tif val != nil {\n\t\t\tdata = append(data, true)\n\t\t} else {\n\t\t\tdata = append(data, false)\n\t\t}\n\t}\n\n\tboolS := s.ShallowCopy()\n\tboolS.Data = data\n\tboolS.column.Dtype = base.Bool\n\tboolS.column.ColIndex = 0\n\tboolS.column.Name = helpers.FunctionNameWrapper(\"notna\", s.column.Name)\n\n\treturn boolS\n}", "func fillNaNDense(m *mat.Dense) {\n\tr, c := m.Dims()\n\tfor i := 0; i < r; i++ {\n\t\tfor j := 0; j < c; j++ {\n\t\t\tm.Set(i, j, math.NaN())\n\t\t}\n\t}\n}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func (g *PCPGauge) MustSet(val float64) {\n\tif err := g.Set(val); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (o *Credit1099Payer) SetTinNil() {\n\to.Tin.Set(nil)\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func isNaN(val string) bool {\n\tif val == nan {\n\t\treturn true\n\t}\n\n\t_, err := strconv.ParseFloat(val, 64)\n\n\treturn err != nil\n}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func SetMpzValue(model ModelT, t TermT, val *MpzT) int32 {\n\treturn int32(C.yices_model_set_mpzp(ymodel(model), C.term_t(t), (*C.mpz_t)(unsafe.Pointer(val))))\n}", "func FloatValIsNil() predicate.Property {\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldFloatVal)))\n\t})\n}", "func (squo *SurveyQuestionUpdateOne) SetNillableFloatData(f *float64) *SurveyQuestionUpdateOne {\n\tif f != nil {\n\t\tsquo.SetFloatData(*f)\n\t}\n\treturn squo\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func isNaN(f float64) bool {\n\treturn f != f\n}", "func IsNaN32(f float32) (is bool) {\n\tx := Float32bits(f)\n\treturn x&uvinf32 == uvinf32 && x != uvinf32 && x != uvneginf32\n}", "func (o *TagModelStore) SetLatitudeNil() {\n\to.Latitude.Set(nil)\n}", "func encodeFloats(data map[string]any) {\n\tfor k, v := range data {\n\t\tswitch v := v.(type) {\n\t\tcase float64:\n\t\t\tif math.IsNaN(v) || math.IsInf(v, 0) {\n\t\t\t\tdata[k] = nil\n\t\t\t}\n\t\t}\n\t}\n}", "func Stz(c *CPU) {\n\tc.Set(c.EffAddr, 0)\n}", "func (z *Float) SetRat(x *Rat) *Float {}", "func signal() {\n\tnoEvents = true\n}", "func (in *ActionLocationIndexInput) SetEnvironmentNil(set bool) *ActionLocationIndexInput {\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[\"Environment\"] = nil\n\t\tin.SelectParameters(\"Environment\")\n\t} else {\n\t\tdelete(in._nilParameters, \"Environment\")\n\t}\n\treturn in\n}", "func (ms DoubleDataPoint) SetValue(v float64) {\n\t(*ms.orig).Value = v\n}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (z *Float) Set(x *Float) *Float {}", "func (c *Context) JNZ(r operand.Op) {\n\tc.addinstruction(x86.JNZ(r))\n}", "func (in *ActionIpAddressIndexInput) SetNetworkNil(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[\"Network\"] = nil\n\t\tin.SelectParameters(\"Network\")\n\t} else {\n\t\tdelete(in._nilParameters, \"Network\")\n\t}\n\treturn in\n}", "func (m *ZoneproductMutation) ResetZonestock() {\n\tm.zonestock = nil\n\tm.removedzonestock = nil\n}", "func (g *PCPGaugeVector) MustSet(val float64, instance string) {\n\tif err := g.Set(val, instance); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (gau *GithubAssetUpdate) SetNillableState(s *string) *GithubAssetUpdate {\n\tif s != nil {\n\t\tgau.SetState(*s)\n\t}\n\treturn gau\n}", "func (a *Array64) NaNSum(axis ...int) *Array64 {\n\tif a.valAxis(&axis, \"NaNSum\") {\n\t\treturn a\n\t}\n\n\tns := func(d []float64) (r float64) {\n\t\tflag := false\n\t\tfor _, v := range d {\n\t\t\tif !math.IsNaN(v) {\n\t\t\t\tflag = true\n\t\t\t\tr += v\n\t\t\t}\n\t\t}\n\t\tif flag {\n\t\t\treturn r\n\t\t}\n\t\treturn math.NaN()\n\t}\n\n\treturn a.Fold(ns, axis...)\n\n}", "func (gauo *GithubAssetUpdateOne) SetNillableState(s *string) *GithubAssetUpdateOne {\n\tif s != nil {\n\t\tgauo.SetState(*s)\n\t}\n\treturn gauo\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (in *ActionUserClusterResourceIndexInput) SetEnvironmentNil(set bool) *ActionUserClusterResourceIndexInput {\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[\"Environment\"] = nil\n\t\tin.SelectParameters(\"Environment\")\n\t} else {\n\t\tdelete(in._nilParameters, \"Environment\")\n\t}\n\treturn in\n}", "func (huo *HistorytakingUpdateOne) SetTemp(f float32) *HistorytakingUpdateOne {\n\thuo.mutation.ResetTemp()\n\thuo.mutation.SetTemp(f)\n\treturn huo\n}", "func Selectznz(out1 *[3]uint64, arg1 uint1, arg2 *[3]uint64, arg3 *[3]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n}", "func NilFloat() Float {\n\treturn Float{0, false}\n}", "func Selectznz(out1 *[4]uint64, arg1 uint1, arg2 *[4]uint64, arg3 *[4]uint64) {\n\tvar x1 uint64\n\tcmovznzU64(&x1, arg1, arg2[0], arg3[0])\n\tvar x2 uint64\n\tcmovznzU64(&x2, arg1, arg2[1], arg3[1])\n\tvar x3 uint64\n\tcmovznzU64(&x3, arg1, arg2[2], arg3[2])\n\tvar x4 uint64\n\tcmovznzU64(&x4, arg1, arg2[3], arg3[3])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n\tout1[3] = x4\n}", "func mungeSetZeroValue(i int, rec []interface{}, destMeta sqlz.RecordMeta) {\n\t// REVISIT: do we need to do special handling for kind.Datetime\n\t// and kind.Time (e.g. \"00:00\" for time)?\n\tz := reflect.Zero(destMeta[i].ScanType()).Interface()\n\trec[i] = z\n}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func (dt *DateTime) Nanosecond() *Number {\n\topChain := dt.chain.enter(\"Nanosecond()\")\n\tdefer opChain.leave()\n\n\tif opChain.failed() {\n\t\treturn newNumber(opChain, float64(0))\n\t}\n\n\treturn newNumber(opChain, float64(dt.value.Nanosecond()))\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (o InstanceDenyMaintenancePeriodTimeOutput) Nanos() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceDenyMaintenancePeriodTime) *int { return v.Nanos }).(pulumi.IntPtrOutput)\n}", "func (hu *HistorytakingUpdate) SetTemp(f float32) *HistorytakingUpdate {\n\thu.mutation.ResetTemp()\n\thu.mutation.SetTemp(f)\n\treturn hu\n}", "func (jz *Jzon) Null() (n Any, err error) {\n\tif jz.Type != JzTypeNul {\n\t\treturn nil, expectTypeOf(JzTypeNul, jz.Type)\n\t}\n\n\treturn nil, nil\n}", "func (n *NullableGeneric) SetNull() {\n\tvar defaultValue generic.T\n\tn.data = defaultValue\n\tn.notNull = false\n}", "func softfloat_commonNaNToExtF80UI(aPtr *commonNaN) Uint128 {\n\tvar uiZ Uint128\n\tif aPtr.sign {\n\t\tuiZ.High = uint64(1)<<15 | 0x7FFF\n\t} else {\n\t\tuiZ.High = 0x7FFF\n\t}\n\n\tuiZ.Low = uint64(0xC000000000000000) | aPtr.v64>>1\n\treturn uiZ\n}", "func Float64NoNonePtr(s float64) *float64 {\n\tif s == 0 {\n\t\treturn nil\n\t}\n\treturn &s\n}", "func (ac *AlertCreate) SetTemp(f float64) *AlertCreate {\n\tac.mutation.SetTemp(f)\n\treturn ac\n}", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func (kf *HybridKF) SetNoise(n Noise) {\n\tkf.Noise = n\n}", "func (o *TagModelStore) SetDateNil() {\n\to.Date.Set(nil)\n}", "func NaN32() float32 {\n\treturn float32(math.NaN())\n}" ]
[ "0.74239993", "0.6201739", "0.5968852", "0.5890181", "0.54903305", "0.5423392", "0.52285933", "0.51462054", "0.5133921", "0.51028574", "0.49785635", "0.48616007", "0.48463738", "0.48407465", "0.48036268", "0.4778241", "0.47490975", "0.46815753", "0.46608052", "0.46586132", "0.46561804", "0.46438763", "0.46427283", "0.46276522", "0.46254313", "0.45471072", "0.4432026", "0.4398276", "0.43905205", "0.4384138", "0.43690795", "0.4351727", "0.43487194", "0.4347092", "0.43427986", "0.43199658", "0.4300508", "0.42819133", "0.42766383", "0.42658263", "0.42631173", "0.4238805", "0.42378306", "0.42145652", "0.4204663", "0.4204663", "0.41931248", "0.41771758", "0.4169261", "0.41683832", "0.41574472", "0.4152979", "0.41291103", "0.41252303", "0.4077341", "0.40738136", "0.40618074", "0.40582868", "0.40571117", "0.40571117", "0.4055048", "0.40544885", "0.40460742", "0.40424284", "0.40407687", "0.40317103", "0.40250367", "0.4024061", "0.4012692", "0.40072042", "0.39888066", "0.3983363", "0.39813069", "0.39796597", "0.3976719", "0.39681602", "0.3965625", "0.39612612", "0.39602205", "0.39599118", "0.39389408", "0.3927281", "0.391265", "0.39050764", "0.39021635", "0.3896795", "0.38906106", "0.38803902", "0.38758153", "0.38720724", "0.38632986", "0.3855718", "0.38541377", "0.38540256", "0.38468578", "0.38464907", "0.38444448", "0.38440287", "0.38384214", "0.3835661" ]
0.8064771
0
SetRat sets z to to the possibly rounded value of x and return z.
func (z *Big) SetRat(x *big.Rat) *Big { if x.IsInt() { return z.Context.round(z.SetBigMantScale(x.Num(), 0)) } var num, denom Big num.SetBigMantScale(x.Num(), 0) denom.SetBigMantScale(x.Denom(), 0) return z.Quo(&num, &denom) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Float) SetRat(x *Rat) *Float {}", "func FloatSetRat(z *big.Float, x *big.Rat,) *big.Float", "func RatSet(z *big.Rat, x *big.Rat,) *big.Rat", "func RatSetFrac(z *big.Rat, a, b *big.Int,) *big.Rat", "func (z *Rat) Set(x *Rat) *Rat {}", "func (z *Rat) SetFrac(a, b *Int) *Rat {}", "func RatSetInt(z *big.Rat, x *big.Int,) *big.Rat", "func (z *Rat) SetFrac64(a, b int64) *Rat {}", "func (k Keeper) SetRat(ctx sdk.Context, key string, value sdk.Rat) {\n\tk.paramsKeeper.Setter().SetRat(ctx, MakeFeeKey(key), value)\n}", "func (z *Rat) SetFloat64(f float64) *Rat {}", "func FloatRat(x *big.Float, z *big.Rat,) (*big.Rat, big.Accuracy,)", "func (z *Rat) SetInt(x *Int) *Rat {}", "func (x *Float) Rat(z *Rat) (*Rat, Accuracy) {\n\t// possible: panic(\"unreachable\")\n}", "func (x *Big) Rat(z *big.Rat) *big.Rat {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif z == nil {\n\t\tz = new(big.Rat)\n\t}\n\n\tif !x.IsFinite() {\n\t\treturn z.SetInt64(0)\n\t}\n\n\t// Fast path for decimals <= math.MaxInt64.\n\tif x.IsInt() {\n\t\tif u, ok := x.Int64(); ok {\n\t\t\t// If profiled we can call scalex ourselves and save the overhead of\n\t\t\t// calling Int64. But I doubt it'll matter much.\n\t\t\treturn z.SetInt64(u)\n\t\t}\n\t}\n\n\tnum := new(big.Int)\n\tif x.isCompact() {\n\t\tnum.SetUint64(x.compact)\n\t} else {\n\t\tnum.Set(&x.unscaled)\n\t}\n\tif x.exp > 0 {\n\t\tarith.MulBigPow10(num, num, uint64(x.exp))\n\t}\n\tif x.Signbit() {\n\t\tnum.Neg(num)\n\t}\n\n\tdenom := c.OneInt\n\tif x.exp < 0 {\n\t\tdenom = new(big.Int)\n\t\tif shift, ok := arith.Pow10(uint64(-x.exp)); ok {\n\t\t\tdenom.SetUint64(shift)\n\t\t} else {\n\t\t\tdenom.Set(arith.BigPow10(uint64(-x.exp)))\n\t\t}\n\t}\n\treturn z.SetFrac(num, denom)\n}", "func MakeRat(x interface{}) Value {\n\treturn &ratVal{constant.Make(x)}\n}", "func (z *Rat) Mul(x, y *Rat) *Rat {}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func RatSetString(z *big.Rat, s string) (*big.Rat, bool)", "func RatMul(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (d Decimal) Rat() *big.Rat {\n\td.ensureInitialized()\n\tif d.exp <= 0 {\n\t\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\t\tdenom := new(big.Int).Exp(tenInt, big.NewInt(-int64(d.exp)), nil)\n\t\treturn new(big.Rat).SetFrac(d.value, denom)\n\t}\n\n\tmul := new(big.Int).Exp(tenInt, big.NewInt(int64(d.exp)), nil)\n\tnum := new(big.Int).Mul(d.value, mul)\n\treturn new(big.Rat).SetFrac(num, oneInt)\n}", "func (d Decimal) Rat() *big.Rat {\n\td.ensureInitialized()\n\tif d.exp <= 0 {\n\t\t// NOTE(vadim): must negate after casting to prevent int32 overflow\n\t\tdenom := new(big.Int).Exp(tenInt, big.NewInt(-int64(d.exp)), nil)\n\t\treturn new(big.Rat).SetFrac(d.value, denom)\n\t}\n\n\tmul := new(big.Int).Exp(tenInt, big.NewInt(int64(d.exp)), nil)\n\tnum := new(big.Int).Mul(d.value, mul)\n\treturn new(big.Rat).SetFrac(num, oneInt)\n}", "func (v Value) Rat() *big.Rat {\n\tn := big.NewInt(int64(v.num))\n\tif v.negative {\n\t\tn.Neg(n)\n\t}\n\n\td := big.NewInt(1)\n\tif v.offset < 0 {\n\t\td.Exp(big.NewInt(10), big.NewInt(-v.offset), nil)\n\t} else if v.offset > 0 {\n\t\tmult := big.NewInt(1)\n\t\tmult.Exp(big.NewInt(10), big.NewInt(v.offset), nil)\n\t\tn.Mul(n, mult)\n\t}\n\n\tres := big.NewRat(0, 1)\n\tres.SetFrac(n, d)\n\treturn res\n}", "func RatQuo(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (z *Big) Set(x *Big) *Big { return z.Context.round(z.Copy(x)) }", "func (z *Float) Set(x *Float) *Float {}", "func (t Target) Rat() *big.Rat {\n\treturn new(big.Rat).SetInt(t.Int())\n}", "func (z *Rat) SetUint64(x uint64) *Rat {}", "func MakeRatFromString(x string) Value {\n\tv := constant.MakeFromLiteral(x, gotoken.FLOAT, 0)\n\tif v.Kind() != Unknown {\n\t\tv = &ratVal{v}\n\t}\n\treturn v\n}", "func RatNum(x *big.Rat,) *big.Int", "func FloatSetMode(z *big.Float, mode big.RoundingMode,) *big.Float", "func RatNeg(z *big.Rat, x *big.Rat,) *big.Rat", "func RatAdd(z *big.Rat, x, y *big.Rat,) *big.Rat", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func RatAbs(z *big.Rat, x *big.Rat,) *big.Rat", "func Real(x Value) Value {\n\tif _, ok := x.(*ratVal); ok {\n\t\treturn x\n\t}\n\treturn constant.Real(x)\n}", "func (z *Rat) Add(x, y *Rat) *Rat {}", "func (z *Float) SetMode(mode RoundingMode) *Float {}", "func FloatSetPrec(z *big.Float, prec uint) *big.Float", "func RatSign(x *big.Rat,) int", "func (z *Rat) Abs(x *Rat) *Rat {}", "func (c *Channel) SetRound(i int) {\n\tc.round = i\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func RatInv(z *big.Rat, x *big.Rat,) *big.Rat", "func NewRat(a, b int64) *Rat {}", "func (z *Float) SetFloat64(x float64) *Float {}", "func RatRatString(x *big.Rat,) string", "func (z *Float64) Set(y *Float64) *Float64 {\n\tz.l = y.l\n\tz.r = y.r\n\treturn z\n}", "func (r *Radix) set(v interface{}) {\n\tr.value = v\n}", "func (sr *StatusRegister) setZ(val byte) {\n\tif val == 0 {\n\t\tsr.z = 1\n\t} else {\n\t\tsr.z = 0\n\t}\n}", "func (x *Rat) Sign() int {}", "func (p *ProcStat) setZ(data int) {\n\tif data == 0 {\n\t\tp.z = 1\n\t} else {\n\t\tp.z = 0\n\t}\n}", "func ToRat(v Value) (Rat, error) {\n\tswitch v := v.(type) {\n\tcase Rat:\n\t\treturn v, nil\n\tcase String:\n\t\tr := big.Rat{}\n\t\t_, err := fmt.Sscanln(string(v), &r)\n\t\tif err != nil {\n\t\t\treturn Rat{}, fmt.Errorf(\"%s cannot be parsed as rat\", v.Repr())\n\t\t}\n\t\treturn Rat{&r}, nil\n\tdefault:\n\t\treturn Rat{}, errOnlyStrOrRat\n\t}\n}", "func (z *Float) SetInt(x *Int) *Float {}", "func (x *Rat) RatString() string {}", "func (x *Rat) Float64() (f float64, exact bool) {}", "func ToRat(v Value) (Rat, error) {\n\tswitch v := v.(type) {\n\tcase Rat:\n\t\treturn v, nil\n\tcase String:\n\t\tr := big.Rat{}\n\t\t_, err := fmt.Sscanln(string(v), &r)\n\t\tif err != nil {\n\t\t\treturn Rat{}, fmt.Errorf(\"%s cannot be parsed as rat\", v.Repr())\n\t\t}\n\t\treturn Rat{&r}, nil\n\tdefault:\n\t\treturn Rat{}, ErrOnlyStrOrRat\n\t}\n}", "func RatScan(z *big.Rat, s fmt.ScanState, ch rune) error", "func (k Keeper) GetRat(ctx sdk.Context, key string) sdk.Rat {\n\tr, err := k.paramsKeeper.Getter().GetRat(ctx, MakeFeeKey(key))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func setBigRatFromFloatString(s string) (br BigRat, err error) {\n\t// Be safe: Verify that it is floating-point, because otherwise\n\t// we need to honor ibase.\n\tif !strings.ContainsAny(s, \".eE\") {\n\t\t// Most likely a number like \"08\".\n\t\tErrorf(\"bad number syntax: %s\", s)\n\t}\n\tvar ok bool\n\tr, ok := big.NewRat(0, 1).SetString(s)\n\tif !ok {\n\t\treturn BigRat{}, errors.New(\"floating-point number syntax\")\n\t}\n\treturn BigRat{r}, nil\n}", "func SetCurrentTimeRounded(v interface{}) {\n\tn := now().Truncate(time.Second)\n\n\tswitch t := v.(type) {\n\tcase *time.Time:\n\t\t*t = n\n\tcase **time.Time:\n\t\t_ = t\n\t\t*t = &n\n\t}\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func (m *M) Set(r, c int, v Frac) {\n\tr, c = r-1, c-1\n\tm.values[r*m.c+c] = v.Reduce()\n}", "func NewRat(a, b int64) *big.Rat", "func Shift(x Value, op token.Token, s uint) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tvx := v.Value\n\t\tval := constant.Val(vx)\n\t\tif rat, ok := val.(*big.Rat); ok && rat.IsInt() {\n\t\t\tvx = constant.Num(vx)\n\t\t}\n\t\tret := constant.Shift(vx, gotoken.Token(op), s)\n\t\treturn &ratVal{ret}\n\t}\n\treturn constant.Shift(x, gotoken.Token(op), s)\n}", "func Ring(r orb.Ring, z maptile.Zoom) (maptile.Set, error) {\n\tif len(r) == 0 {\n\t\treturn make(maptile.Set), nil\n\t}\n\n\treturn Polygon(orb.Polygon{r}, z)\n}", "func Val(x Value) interface{} {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Val(x)\n}", "func RatSub(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (z *Rat) Neg(x *Rat) *Rat {}", "func Num(x Value) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Num(x)\n}", "func (x *Rat) Num() *Int {}", "func Round(x float64) float64 {\n\n\treturn math.Floor(x + 0.5)\n}", "func ratScale(x *big.Rat, exp int) {\n\tif exp < 0 {\n\t\tx.Inv(x)\n\t\tratScale(x, -exp)\n\t\tx.Inv(x)\n\t\treturn\n\t}\n\tfor exp >= 9 {\n\t\tx.Quo(x, bigRatBillion)\n\t\texp -= 9\n\t}\n\tfor exp >= 1 {\n\t\tx.Quo(x, bigRatTen)\n\t\texp--\n\t}\n}", "func RatString(x *big.Rat,) string", "func SqrtZ(x, z float64) float64 {\n\treturn z - (math.Pow(z, 2)-x)/(2*z)\n}", "func roundFloat(x float64, prec int) float64 {\n\tvar rounder float64\n\tpow := math.Pow(10, float64(prec))\n\tintermed := x * pow\n\t_, frac := math.Modf(intermed)\n\tx = .5\n\tif frac < 0.0 {\n\t\tx = -.5\n\t}\n\tif frac >= x {\n\t\trounder = math.Ceil(intermed)\n\t} else {\n\t\trounder = math.Floor(intermed)\n\t}\n\n\treturn rounder / pow\n}", "func (v *value) set(val interface{}) Value {\n\tswitch val.(type) {\n\tcase int:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase int64:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(int64))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float64:\n\t\tv.valueType = Real\n\t\tfloatVal := val.(float64)\n\t\tv.real = floatVal\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase float32:\n\t\tv.valueType = Real\n\t\tv.real = float64(val.(float32))\n\t\tv.imaginary = 0\n\t\tbreak\n\tcase complex128:\n\t\tv.valueType = Complex\n\t\tcomplexVal := val.(complex128)\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tcase complex64:\n\t\tv.valueType = Complex\n\t\tcomplexVal := complex128(val.(complex64))\n\t\tv.real = real(complexVal)\n\t\timagValue := imag(complexVal)\n\t\tif imagValue == 0 {\n\t\t\tv.valueType = Real\n\t\t}\n\t\tv.imaginary = imagValue\n\t\tbreak\n\tdefault:\n\t\treturn Zero()\n\t}\n\tv.precision = 1\n\treturn v\n}", "func (c *Composite) AtZ(x, y, z int) float32 {\n\tif x < 0 || y < 0 || z < 0 || x >= c.Dx || y >= c.Dy || z >= c.Dz {\n\t\treturn NaN\n\t}\n\treturn c.DataZ[z][y][x]\n}", "func (z *Float) SetInt64(x int64) *Float {}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func Round(x float64) float64 {\n\treturn math.Floor(x + 0.5)\n}", "func (b *ballotMaster) setCurrentRound(round uint64) {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\n\tb.round = round\n}", "func (me *Tangle360Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func (z *Big) SetFloat(x *big.Float) *Big {\n\tif x.IsInf() {\n\t\tif x.Signbit() {\n\t\t\tz.form = ninf\n\t\t} else {\n\t\t\tz.form = pinf\n\t\t}\n\t\treturn z\n\t}\n\n\tneg := x.Signbit()\n\tif x.Sign() == 0 {\n\t\tif neg {\n\t\t\tz.form |= signbit\n\t\t}\n\t\tz.compact = 0\n\t\tz.precision = 1\n\t\treturn z\n\t}\n\n\tz.exp = 0\n\tx0 := new(big.Float).Copy(x).SetPrec(big.MaxPrec)\n\tx0.Abs(x0)\n\tif !x.IsInt() {\n\t\tfor !x0.IsInt() {\n\t\t\tx0.Mul(x0, c.TenFloat)\n\t\t\tz.exp--\n\t\t}\n\t}\n\n\tif mant, acc := x0.Uint64(); acc == big.Exact {\n\t\tz.compact = mant\n\t\tz.precision = arith.Length(mant)\n\t} else {\n\t\tz.compact = c.Inflated\n\t\tx0.Int(&z.unscaled)\n\t\tz.precision = arith.BigLength(&z.unscaled)\n\t}\n\tz.form = finite\n\tif neg {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (m *MockClient) RoundAt(_ time.Time) uint64 {\n\treturn 0\n}", "func (x *Rat) Cmp(y *Rat) int {}", "func (adaType *AdaSuperType) SetFractional(x uint32) {\n}", "func (r *Registers) setFlagZ(bit bool) {\n\tif bit {\n\t\tr.F |= zeroFlag\n\t} else {\n\t\tr.F = r.F &^ zeroFlag\n\t}\n}", "func rationalm(x float64) float64 {\n\tconst (\n\t\ta0 = -7.81417672390744\n\t\ta1 = 253.88810188892484\n\t\ta2 = 657.9493176902304\n\n\t\tb0 = 1\n\t\tb1 = -60.43958713690808\n\t\tb2 = 99.9856708310761\n\t\tb3 = 682.6073999909428\n\t\tb4 = 962.1784396969866\n\t\tb5 = 1477.9341280760887\n\t)\n\n\treturn (a0 + x*(a1+x*a2)) / (b0 + x*(b1+x*(b2+x*(b3+x*(b4+x*b5)))))\n}", "func (metaNode *MetaNode) SetCarry(carry float64) {\n\tmetaNode.Lock()\n\tdefer metaNode.Unlock()\n\tmetaNode.Carry = carry\n}", "func RatDenom(x *big.Rat,) *big.Int", "func (z *Float64) SetUnreal(b float64) *Float64 {\n\tz.r = b\n\treturn z\n}", "func Set(z, x *big.Int) *big.Int {\n\treturn z.Set(x)\n}", "func ToFloat(x Value) Value {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.ToFloat(x)\n}", "func (z *Decimal) Sqrt(x *Decimal) *Decimal {\n\tif debugDecimal {\n\t\tx.validate()\n\t}\n\n\tif z.prec == 0 {\n\t\tz.prec = x.prec\n\t}\n\n\tif x.Sign() == -1 {\n\t\t// following IEEE754-2008 (section 7.2)\n\t\tpanic(ErrNaN{\"square root of negative operand\"})\n\t}\n\n\t// handle ±0 and +∞\n\tif x.form != finite {\n\t\tz.acc = Exact\n\t\tz.form = x.form\n\t\tz.neg = x.neg // IEEE754-2008 requires √±0 = ±0\n\t\treturn z\n\t}\n\n\t// MantExp sets the argument's precision to the receiver's, and\n\t// when z.prec > x.prec this will lower z.prec. Restore it after\n\t// the MantExp call.\n\tprec := z.prec\n\tb := x.MantExp(z)\n\tz.prec = prec\n\n\t// Compute √(z·10**b) as\n\t// √( z)·10**(½b) if b is even\n\t// √(10z)·10**(⌊½b⌋) if b > 0 is odd\n\t// √(z/10)·10**(⌈½b⌉) if b < 0 is odd\n\tswitch b % 2 {\n\tcase 0:\n\t\t// nothing to do\n\tcase 1:\n\t\tz.exp++\n\tcase -1:\n\t\tz.exp--\n\t}\n\t// 0.01 <= z < 10.0\n\n\t// Unlike with big.Float, solving x² - z = 0 directly is faster only for\n\t// very small precisions (<_DW/2).\n\t//\n\t// Solve 1/x² - z = 0 instead.\n\tz.sqrtInverse(z)\n\n\t// restore precision and re-attach halved exponent\n\treturn z.SetMantExp(z, b/2)\n}", "func FloatSetMantExp(z *big.Float, mant *big.Float, exp int) *big.Float", "func (v *Value10) Set(s string) error {\n\tz, err := Parse10(s)\n\tif err == nil {\n\t\t*v = Value10(z)\n\t}\n\treturn err\n}", "func (f *Float) Set(x *Float) *Float {\n\tf.doinit()\n\tC.mpf_set(&f.i[0], &x.i[0])\n\treturn f\n}", "func (z *Numeric) SetInt(x int) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tif x < 0 {\n\t\tz.sign = numericNegative\n\t} else {\n\t\tz.sign = numericPositive\n\t}\n\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := mathh.AbsInt16(int16(x % numericBase))\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}", "func (v *Vector3) Set(x float64, y float64, z float64) {\n\tv.X = x\n\tv.Y = y\n\tv.Z = z\n}", "func (me *Tangle90Type) Set(s string) { (*xsdt.Double)(me).Set(s) }" ]
[ "0.83360916", "0.7740379", "0.7161458", "0.7090396", "0.70478415", "0.6948242", "0.6323682", "0.61933255", "0.61871076", "0.60385567", "0.59962004", "0.5915905", "0.5885793", "0.58185494", "0.581638", "0.57433975", "0.54851097", "0.545949", "0.5458787", "0.53350526", "0.53350526", "0.53308856", "0.53182507", "0.52789134", "0.52643585", "0.51701945", "0.5159182", "0.5129235", "0.5045343", "0.50271356", "0.50055575", "0.49290714", "0.49012214", "0.48526263", "0.48380437", "0.48357806", "0.48238897", "0.4821111", "0.47652066", "0.47316355", "0.47005156", "0.46900988", "0.4682111", "0.45749587", "0.45671666", "0.45503056", "0.4533012", "0.45286587", "0.45025843", "0.44901186", "0.44701344", "0.44391227", "0.44370222", "0.44347903", "0.4407237", "0.44031784", "0.43954924", "0.4391954", "0.43800128", "0.43774396", "0.43637753", "0.43536803", "0.43452364", "0.43433237", "0.433131", "0.43093884", "0.42933753", "0.42377687", "0.42277938", "0.4225511", "0.42170098", "0.4199904", "0.4198476", "0.41830483", "0.41813353", "0.41736582", "0.41715103", "0.4167957", "0.41644984", "0.41502386", "0.41108057", "0.41048938", "0.40916818", "0.40785068", "0.4067549", "0.40664536", "0.4056683", "0.40272933", "0.4015676", "0.4009922", "0.40054488", "0.39914346", "0.39885432", "0.39697546", "0.39633068", "0.3957563", "0.39570162", "0.39532816", "0.39388633", "0.39382318" ]
0.7430601
2
SetScale sets z's scale to scale and returns z.
func (z *Big) SetScale(scale int) *Big { z.exp = -scale return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (v Vector) Scale(scale float64) Vector {\n\treturn Vector{\n\t\tX: v.X * scale,\n\t\tY: v.Y * scale,\n\t\tZ: v.Z * scale}\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (tr *trooper) setScale(scale float64) { tr.part.SetScale(scale, scale, scale) }", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (t *Transform) Scale() lmath.Vec3 {\n\tt.access.RLock()\n\ts := t.scale\n\tt.access.RUnlock()\n\treturn s\n}", "func (v Vec3) Scale(s float64) Vec3 {\n\treturn Vec3{v[0] * s, v[1] * s, v[2] * s}\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (a *ReplaySnapshotArgs) SetScale(scale float64) *ReplaySnapshotArgs {\n\ta.Scale = &scale\n\treturn a\n}", "func (p *Plane) Scale(scaleVec mgl32.Vec3) {\n\tp.model.Scale = scaleVec\n\tp.centroid = CalculateCentroid(p.vertexValues.Vertices, p.model.Scale)\n\tp.boundingBox = ScaleBoundingBox(p.boundingBox, scaleVec)\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (v *Vec4) Scale(s float32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\tv.W *= s\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (this *RectangleShape) SetScale(scale Vector2f) {\n\tC.sfRectangleShape_setScale(this.cptr, scale.toC())\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (z *Big) SetMantScale(value int64, scale int) *Big {\n\tz.SetUint64(arith.Abs(value))\n\tz.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64\n\tif value < 0 {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func (self *TileSprite) SetTileScaleA(member *Point) {\n self.Object.Set(\"tileScale\", member)\n}", "func (t *Transform) GetScale() *Vector {\n\treturn t.Scale\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (q1 Quat) Scale(c float32) Quat {\n\treturn Quat{q1.W * c, Vec3{q1.V[0] * c, q1.V[1] * c, q1.V[2] * c}}\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (self Transform) Scale(scaleX, scaleY float32) {\n\tC.sfTransform_scale(self.Cref, C.float(scaleX), C.float(scaleY))\n}", "func MatrixScale(x, y, z float32) Matrix {\n\tresult := NewMatrix(\n\t\tx, 0.0, 0.0, 0.0,\n\t\t0.0, y, 0.0, 0.0,\n\t\t0.0, 0.0, z, 0.0,\n\t\t0.0, 0.0, 0.0, 1.0)\n\n\treturn result\n}", "func (t *Transform) SetScaleXY(x float64, y float64) ITransform {\n\treturn t.SetScale(NewVector(x, y))\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (p Point) Scale(s Length) Point {\n\treturn Point{p.X * s, p.Y * s}\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func (p Point) Scale(s float64) Point {\n\treturn NewPoint(p.X*s, p.Y*s)\n}", "func (this *Transformable) GetScale() (scale Vector2f) {\n\tscale.fromC(C.sfTransformable_getScale(this.cptr))\n\treturn\n}", "func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big {\n\t// Do this first in case value == z.unscaled. Don't want to clobber the sign.\n\tz.form = finite\n\tif value.Sign() < 0 {\n\t\tz.form |= signbit\n\t}\n\n\tz.unscaled.Abs(value)\n\tz.compact = c.Inflated\n\tz.precision = arith.BigLength(value)\n\n\tif z.unscaled.IsUint64() {\n\t\tif v := z.unscaled.Uint64(); v != c.Inflated {\n\t\t\tz.compact = v\n\t\t}\n\t}\n\n\tz.exp = -scale\n\treturn z\n}", "func (p *Proc) Scale(x, y float64) {\n\tp.stk.scale(x, y)\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (sprite *Sprite) SetScaling(xScale, yScale float64) {\n\n\tsprite.shape.SetScaling(xScale, yScale)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (self *Rectangle) Scale(x int) *Rectangle{\n return &Rectangle{self.Object.Call(\"scale\", x)}\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (self *Tween) SetTimeScaleA(member int) {\n self.Object.Set(\"timeScale\", member)\n}", "func Scale(A float64, x *Matrix) (*Matrix, error) {\n\tout, _ := New(x.RowCount, x.ColCount, nil)\n\n\tfor rowID := 0; rowID < x.RowCount; rowID++ {\n\t\tfor colID := 0; colID < x.ColCount; colID++ {\n\t\t\tout.Matrix[rowID][colID] = A * x.Matrix[rowID][colID]\n\t\t}\n\t}\n\n\treturn out, nil\n}", "func (o ContainerOutput) Scale() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Container) pulumi.IntOutput { return v.Scale }).(pulumi.IntOutput)\n}", "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Scale(s Frac, m M) M {\n\tm = CopyMatrix(m)\n\n\tfor r := 1; r <= m.Rows(); r++ {\n\t\tm.MultiplyRow(r, s)\n\t}\n\n\treturn m\n}", "func Vec3Scale(s float32, a Vec3) (v Vec3) {\n\tv[0] = a[0] * s\n\tv[1] = a[1] * s\n\tv[2] = a[2] * s\n\treturn\n}", "func Vector3Scale(v Vector3, scale float32) Vector3 {\n\treturn NewVector3(v.X*scale, v.Y*scale, v.Z*scale)\n}", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (c *canvasRenderer) Scale(amount sprec.Vec2) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.ScaleMat4(amount.X, amount.Y, 1.0),\n\t)\n}", "func (v Vector) Scale(c float64) Vector {\n\tfor i, x := range v {\n\t\tv[i] = x * c\n\t}\n\treturn v\n}", "func (blk *Block) Scale(sx, sy float64) {\n\tops := contentstream.NewContentCreator().\n\t\tScale(sx, sy).\n\t\tOperations()\n\n\t*blk.contents = append(*ops, *blk.contents...)\n\tblk.contents.WrapIfNeeded()\n\n\tblk.width *= sx\n\tblk.height *= sy\n}", "func Scale(v Vec) *Mtx {\n\treturn NewMat(\n\t\tv.X, 0, 0, 0,\n\t\t0, v.Y, 0, 0,\n\t\t0, 0, v.Z, 0,\n\t\t0, 0, 0, 1,\n\t)\n}", "func (p Point) Scale(f float64) Point {\n\treturn Point{p[0] * f, p[1] * f, p[2] * f}\n}", "func (v *V_elem) Scale(ofs, scale *[3]float32) *[3]int {\n\treturn &[3]int{\n\t\tint((v.x[0] + ofs[0]) * scale[0]),\n\t\tint((v.x[1] + ofs[1]) * scale[1]),\n\t\tint((v.x[2] + ofs[2]) * scale[2]),\n\t}\n}", "func Scale(X *mat.Dense) *mat.Dense {\n\tXout, _ := NewStandardScaler().FitTransform(X, nil)\n\treturn Xout\n}", "func (self *ComponentScaleMinMax) SetScaleMaxA(member *Point) {\n self.Object.Set(\"scaleMax\", member)\n}", "func Scale(f float64, d Number) Number {\n\treturn Number{Real: f * d.Real, E1mag: f * d.E1mag, E2mag: f * d.E2mag, E1E2mag: f * d.E1E2mag}\n}", "func (p *P1D) Scale(factor float64) {\n\tp.bng.scaleW(factor)\n}", "func (k *kubectlContext) Scale(resource string, scale uint) error {\n\tout, err := k.do(\"scale\", fmt.Sprintf(\"--replicas=%d\", scale), resource)\n\tk.t.Log(string(out))\n\treturn err\n}", "func ScaleFunc(v *Vertex, f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (client *VirtualMachineScaleSetsClientMock) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string) (result compute.VirtualMachineScaleSet, rerr *retry.Error) {\n\tcapacity := int64(2)\n\tname := \"Standard_D8_V3\" // typo to test case-insensitive lookup\n\tlocation := \"switzerlandwest\"\n\tproperties := compute.VirtualMachineScaleSetProperties{}\n\treturn compute.VirtualMachineScaleSet{\n\t\tName: &vmScaleSetName,\n\t\tSku: &compute.Sku{\n\t\t\tCapacity: &capacity,\n\t\t\tName: &name,\n\t\t},\n\t\tLocation: &location,\n\t\tVirtualMachineScaleSetProperties: &properties,\n\t}, nil\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}", "func (c *Circle) Scale(f float64) {\n\tc.radius *= f\n}", "func (tfs *tiflashScaler) Scale(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSet, newSet *apps.StatefulSet) error {\n\tscaling, _, _, _ := scaleOne(oldSet, newSet)\n\tif scaling > 0 {\n\t\treturn tfs.ScaleOut(tc, oldSet, newSet)\n\t} else if scaling < 0 {\n\t\treturn tfs.ScaleIn(tc, oldSet, newSet)\n\t}\n\t// we only sync auto scaler annotations when we are finishing syncing scaling\n\treturn tfs.SyncAutoScalerAnn(tc, oldSet)\n}", "func (c *LinehaulCostComputation) Scale(factor float64) {\n\tc.BaseLinehaul = c.BaseLinehaul.MultiplyFloat64(factor)\n\tc.OriginLinehaulFactor = c.OriginLinehaulFactor.MultiplyFloat64(factor)\n\tc.DestinationLinehaulFactor = c.DestinationLinehaulFactor.MultiplyFloat64(factor)\n\tc.ShorthaulCharge = c.ShorthaulCharge.MultiplyFloat64(factor)\n\tc.LinehaulChargeTotal = c.LinehaulChargeTotal.MultiplyFloat64(factor)\n}", "func (b *Base) Scale(w http.ResponseWriter, r *http.Request) {\n\tb.log.Printf(\"%s %s -> %s\", r.Method, r.URL.Path, r.RemoteAddr)\n\n\tsOptions, pOptions, kOptions, oOptions := render.SetDefaultScaleOptions()\n\n\tpv := render.PageVars{\n\t\tTitle: \"Practice Scales and Arpeggios\", // default scale initially displayed is A Major\n\t\tScalearp: \"Scale\",\n\t\tPitch: \"Major\",\n\t\tKey: \"A\",\n\t\tScaleImgPath: \"img/scale/major/a1.png\",\n\t\tGifPath: \"\",\n\t\tAudioPath: \"mp3/scale/major/a1.mp3\",\n\t\tAudioPath2: \"mp3/drone/a1.mp3\",\n\t\tLeftLabel: \"Listen to Major scale\",\n\t\tRightLabel: \"Listen to Drone\",\n\t\tScaleOptions: sOptions,\n\t\tPitchOptions: pOptions,\n\t\tKeyOptions: kOptions,\n\t\tOctaveOptions: oOptions,\n\t}\n\n\tif err := render.Render(w, \"scale.html\", pv); err != nil {\n\t\tb.log.Printf(\"%s %s -> %s : ERROR : %v\", r.Method, r.URL.Path, r.RemoteAddr, err)\n\t\treturn\n\t}\n}", "func (r Rectangle) Scale(factor float64) Rectangle {\n\treturn Rectangle{\n\t\tMin: r.Min.Mul(factor),\n\t\tMax: r.Max.Mul(factor),\n\t}\n}", "func (w *windowImpl) Scale(dr image.Rectangle, src screen.Texture, sr image.Rectangle, op draw.Op, opts *screen.DrawOptions) {\n\tpanic(\"not implemented\") // TODO: Implement\n}" ]
[ "0.70505315", "0.6758108", "0.6713929", "0.6677079", "0.66562027", "0.6576691", "0.6392196", "0.62601715", "0.62386155", "0.6198014", "0.61925036", "0.6184184", "0.61688167", "0.60977143", "0.6028688", "0.6024583", "0.59383476", "0.59314585", "0.59158814", "0.58420074", "0.58122396", "0.57850003", "0.5771679", "0.57689637", "0.57377243", "0.57369524", "0.5711291", "0.57044923", "0.569411", "0.56288105", "0.56245583", "0.5617885", "0.56165344", "0.5607169", "0.55815953", "0.55424213", "0.5524269", "0.5510172", "0.5504948", "0.5495425", "0.54911315", "0.5483814", "0.5468141", "0.5459792", "0.5458921", "0.5458851", "0.54585433", "0.54435676", "0.5443284", "0.5443284", "0.5443284", "0.5443284", "0.5443284", "0.5443284", "0.5443284", "0.5443255", "0.54395884", "0.5438889", "0.5437757", "0.5436158", "0.54319113", "0.54268014", "0.5423813", "0.5421458", "0.54046106", "0.54029214", "0.5382518", "0.53808594", "0.5374127", "0.5370418", "0.5369362", "0.5350769", "0.53187513", "0.53108793", "0.5293597", "0.52934414", "0.5282286", "0.5268286", "0.52681816", "0.52574766", "0.5254122", "0.5253015", "0.5209573", "0.51968807", "0.5176479", "0.5132437", "0.5102668", "0.5073555", "0.5059761", "0.50272405", "0.5025173", "0.5010585", "0.4994419", "0.49886173", "0.49759576", "0.49591136", "0.4943649", "0.49221358", "0.49134642", "0.48732963" ]
0.6945619
1
SetString sets z to the value of s, returning z and a bool indicating success. s must be a string in one of the following formats: 1.234 1234 1.234e+5 1.234E5 0.000001234 Inf NaN qNaN sNaN Each value may be preceded by an optional sign, ``'' or ``+''. ``Inf'' and ``NaN'' map to ``+Inf'' and ``qNaN'', respectively. NaN values may have optional diagnostic information, represented as trailing digits; for example, ``NaN123''. These digits are otherwise ignored but are included for robustness.
func (z *Big) SetString(s string) (*Big, bool) { if err := z.scan(strings.NewReader(s)); err != nil { return nil, false } return z, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func FloatSetString(z *big.Float, s string) (*big.Float, bool)", "func RatSetString(z *big.Rat, s string) (*big.Rat, bool)", "func (f *Float) SetString(s string, base int) error {\n\tf.doinit()\n\tif base < 2 || base > 36 {\n\t\treturn os.ErrInvalid\n\t}\n\tp := C.CString(s)\n\tdefer C.free(unsafe.Pointer(p))\n\tif C.mpf_set_str(&f.i[0], p, C.int(base)) < 0 {\n\t\treturn os.ErrInvalid\n\t}\n\treturn nil\n}", "func SetString(z *big.Int, s string, base int) (*big.Int, bool) {\n\treturn z.SetString(s, base)\n}", "func (z *E12) SetString(s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11 string) *E12 {\n\tz.C0.SetString(s0, s1, s2, s3, s4, s5)\n\tz.C1.SetString(s6, s7, s8, s9, s10, s11)\n\treturn z\n}", "func (e *Eth) SetString(s string, base int) (*Eth, bool) {\n\tw, ok := e.ToInt().SetString(s, base)\n\treturn (*Eth)(w), ok\n}", "func IntSetString(z *big.Int, s string, base int) (*big.Int, bool)", "func (z *Int) SetString(s string, base int) (*Int, bool) {}", "func (f *Float64Value) Set(s string) error {\n\tv, err := strconv.ParseFloat(s, 64)\n\t*f = Float64Value(v)\n\treturn err\n}", "func (f *Float32Value) Set(s string) error {\n\tv, err := strconv.ParseFloat(s, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*f = Float32Value(float32(v))\n\treturn err\n}", "func SetValueFromStr(value reflect.Value, s string) error {\n\tswitch value.Interface().(type) {\n\tcase bool:\n\t\tval, err := strconv.ParseBool(s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetBool(val)\n\tcase float32:\n\t\tval, err := strconv.ParseFloat(s, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetFloat(val)\n\tcase float64:\n\t\tval, err := strconv.ParseFloat(s, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetFloat(val)\n\tcase int, int32:\n\t\tval, err := strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetInt(val)\n\tcase int8:\n\t\tval, err := strconv.ParseInt(s, 10, 8)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetInt(val)\n\tcase int16:\n\t\tval, err := strconv.ParseInt(s, 10, 16)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetInt(val)\n\tcase int64:\n\t\tval, err := strconv.ParseInt(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetInt(val)\n\tcase uint, uint32:\n\t\tval, err := strconv.ParseUint(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetUint(val)\n\tcase uint8:\n\t\tval, err := strconv.ParseUint(s, 10, 8)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetUint(val)\n\tcase uint16:\n\t\tval, err := strconv.ParseUint(s, 10, 16)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetUint(val)\n\tcase uint64:\n\t\tval, err := strconv.ParseUint(s, 10, 16)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.SetUint(val)\n\tcase string:\n\t\tvalue.SetString(s)\n\tcase []byte:\n\t\tvalue.SetBytes([]byte(s))\n\tcase []int32:\n\t\tvar val []int32\n\t\tvar err = json.Unmarshal([]byte(s), &val)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.Set(reflect.ValueOf(val))\n\tdefault:\n\t\treturn fmt.Errorf(\"unkown-type :%v\", reflect.TypeOf(value))\n\t}\n\treturn nil\n}", "func (v *Value) SetStr(str string) bool {\n\tret := C.zj_SetStrFast(v.V, C.CString(str))\n\tif ret == true {\n\t\treturn true\n\t}\n\treturn false\n}", "func (me *TPositiveFloatType) Set(s string) { (*xsdt.Float)(me).Set(s) }", "func (v *Value10) Set(s string) error {\n\tz, err := Parse10(s)\n\tif err == nil {\n\t\t*v = Value10(z)\n\t}\n\treturn err\n}", "func (z *Element22) SetString(s string) *Element22 {\n\tx, ok := new(big.Int).SetString(s, 10)\n\tif !ok {\n\t\tpanic(\"Element22.SetString failed -> can't parse number in base10 into a big.Int\")\n\t}\n\treturn z.SetBigInt(x)\n}", "func (z *E6) SetString(s1, s2, s3, s4, s5, s6 string) *E6 {\n\tz.B0.SetString(s1, s2)\n\tz.B1.SetString(s3, s4)\n\tz.B2.SetString(s5, s6)\n\treturn z\n}", "func (b *Array) SetString(s string, base int) (*Array, bool) {\n\t_, succ := b.Int.SetString(s, base)\n\treturn b, succ\n}", "func setPrimitive(val reflect.Value, s string) (err error) {\n\n\tswitch val.Type().Kind() {\n\t\tcase reflect.Bool:\n\t\t\tswitch strings.ToLower(s) {\n\t\t\t\tcase \"n\", \"no\", \"f\", \"false\", \"off\":\n\t\t\t\t\tval.SetBool(false)\n\t\t\t\tcase \"y\", \"yes\", \"t\", \"true\", \"on\", \"\":\n\t\t\t\t\tval.SetBool(true)\n\t\t\t\tdefault:\n\t\t\t\t\terr = fmt.Errorf(\"not a boolean value\")\n\t\t\t}\n\t\tcase reflect.Uint64:\n\t\t\tvar i uint64\n\t\t\tif i, err = convUint(s, 64); err == nil {\n\t\t\t\tval.SetUint(i)\n\t\t\t}\n\t\tcase reflect.Int64:\n\t\t\tswitch val.Type().String() {\n\t\t\tdefault:\n\t\t\t\tvar i int64\n\t\t\t\tif i, err = convInt(s, 64); err == nil {\n\t\t\t\t\tval.SetInt(i)\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Uint32:\n\t\t\tvar i uint64\n\t\t\tif i, err = convUint(s, 32); err == nil {\n\t\t\t\tval.SetUint(i)\n\t\t\t}\n\t\tcase reflect.Uint:\n\t\t\tvar i uint64\n\t\t\tif i, err = convUint(s, 0); err == nil {\n\t\t\t\tval.SetUint(i)\n\t\t\t}\n\t\tcase reflect.Int:\n\t\t\tvar i int64\n\t\t\tif i, err = convInt(s, 0); err == nil {\n\t\t\t\tval.SetInt(i)\n\t\t\t}\n\t\tcase reflect.Float64:\n\t\t\tvar fl float64\n\t\t\tif fl, err = convFloat(s); err == nil {\n\t\t\t\tval.SetFloat(fl)\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\tif len(s) > 0 && s[0] == '\"' {\n\t\t\t\ts, err = strconv.Unquote(s)\n\t\t\t\tif err == nil {\n\t\t\t\t\tval.SetString(s)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tval.SetString(s)\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"unsupported type %s\",\n\t\t\t\t\t\tval.Type().String())\n\t}\n\treturn\n}", "func (c *Cell) SetString(s string) {\n\tc.Value = s\n\tc.formula = \"\"\n\tc.cellType = CellTypeString\n}", "func (obj *Value) SetString(v string) {\n\tobj.Candy().Guify(\"g_value_set_string\", obj, v)\n}", "func (l *settableString) Set(s string) error {\n\tl.s = s\n\tl.isSet = true\n\treturn nil\n}", "func SetString(key string, val string) error {\n\terr := SetStringWithExpire(key, val, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (v *value) SetString(value string) bool {\n\ttmp := C.CString(value)\n\treturn (bool)(C.setStringValue(C.uint32(v.cRef.homeId), C.uint64(v.cRef.valueId.id), tmp))\n}", "func (v *missingValue) SetString(value string) bool {\n\treturn false\n}", "func (val *float32Value) Set(str string) error {\n\tv, err := strconv.ParseFloat(str, 32)\n\t*val = float32Value(v)\n\treturn errs.Wrap(err)\n}", "func (me *TMaskValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (f *transformingValue) Set(s string) error {\n\treturn f.Value.Set(f.fn(s))\n}", "func (me *TSAFPTUNNumber) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (s *NullString) Set(value string) {\n\ts.s.Valid = true\n\ts.s.String = value\n}", "func setBigRatFromFloatString(s string) (br BigRat, err error) {\n\t// Be safe: Verify that it is floating-point, because otherwise\n\t// we need to honor ibase.\n\tif !strings.ContainsAny(s, \".eE\") {\n\t\t// Most likely a number like \"08\".\n\t\tErrorf(\"bad number syntax: %s\", s)\n\t}\n\tvar ok bool\n\tr, ok := big.NewRat(0, 1).SetString(s)\n\tif !ok {\n\t\treturn BigRat{}, errors.New(\"floating-point number syntax\")\n\t}\n\treturn BigRat{r}, nil\n}", "func spSetString(obj unsafe.Pointer, path *C.char, val unsafe.Pointer, size int) bool {\n\treturn C.sp_setstring(obj, path, val, C.int(size)) == 0\n}", "func (me *TSpacingValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (g *ginGzipWriter) WriteString(s string) (int, error) {\n\treturn g.wrapper.Write([]byte(s))\n}", "func (sf *String) Set(x string) error {\n\tsf.Value = x\n\tsf.set = true\n\treturn nil\n}", "func StringSet(flg *flag.FlagSet, name string, value string, usage string, aliases ...string) *Value {\n\treturn newString(flg.Var, name, value, usage, aliases...)\n}", "func ValidPositiveFloatStr(val string) bool {\n\tvar validFloat = regexp.MustCompile(`^[+]?([0-9]+(\\.[0-9]+)?)$`)\n\treturn validFloat.MatchString(val)\n}", "func (i *InMemory) SetString(key, value string) {\n\ti.lock.Lock()\n\tdefer i.lock.Unlock()\n\n\ti.data[key] = value\n}", "func (me *TNumberOptionalNumberType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (v *JSONValue) SetString(val string) {\n\n\tv.RawMessage = []byte{'\"'}\n\tv.RawMessage = append(v.RawMessage, val...)\n\tv.RawMessage = append(v.RawMessage, '\"')\n\n\tv.valString = val\n\tv.dataType = stringDataType\n}", "func FloatParse(z *big.Float, s string, base int) (*big.Float, int, error)", "func Float(str string) bool {\n\t_, err := strconv.ParseFloat(str, 0)\n\treturn err == nil\n}", "func (me *TOpacityValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (m FieldMap) SetString(tag Tag, value string) FieldMap {\n\treturn m.SetField(tag, FIXString(value))\n}", "func (imf *ImprFloat) FromString(valStr string) *ImprFloat {\n\timf.resetFlag()\n\tif !ValidPositiveFloatStr(valStr) {\n\t\terr := fmt.Errorf(\"ImprFloat warning: Bad float string %v, use default value\", valStr)\n\t\tlog.Println(err)\n\t\timf.err = err\n\t\tvalStr = \"0\"\n\t}\n\tvalStr = strings.TrimSpace(valStr)\n\timf.data = []byte(valStr)\n\t//fill '.'\n\tsize := len(imf.data)\n\tpos := bytes.Index(imf.data, []byte(\".\"))\n\tif pos == -1 { // no '.' so assume '.' in the end\n\t\timf.data = append(imf.data, '.')\n\t\tpos = size\n\t}\n\timf.pos = pos\n\treturn imf\n}", "func String(s string) bool {\n\tfor i := 0; i < len(s); i++ {\n\t\tif b := s[i]; b < '0' || b > '9' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func SetString(filename, JSONpath, value string) error {\n\tjf, err := NewFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn jf.SetString(JSONpath, value)\n}", "func (v *Value) SetNumStr(num string) bool {\n\tret := C.zj_SetNumStrFast(v.V, C.CString(num))\n\tif ret == true {\n\t\treturn true\n\t}\n\treturn false\n}", "func (v *Value) SetString(val string) {\n\tcstr := C.CString(val)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tC.g_value_set_string(v.Native(), (*C.gchar)(cstr))\n}", "func ValidFloatStr(val string) bool {\n\tvar validFloat = regexp.MustCompile(`^[-+]?([0-9]+(\\.[0-9]+)?)$`)\n\treturn validFloat.MatchString(val)\n}", "func FloatSet(z *big.Float, x *big.Float,) *big.Float", "func (me *TFilterValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (a *Mpflt) SetString(as string)", "func (s *StringValue) Set(val string) error {\n\t*s = StringValue(val)\n\treturn nil\n}", "func (me *TNumbersType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (s *SliceStrings) Set(str string) error {\n\tfargs := func(c rune) bool {\n\t\treturn c == ',' || c == ';'\n\t}\n\t// get function\n\tslice := strings.FieldsFunc(str, fargs)\n\t*s = append(*s, slice...)\n\treturn nil\n}", "func (me *Tangle90Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func (dt *DateTime) Set(s string) error {\n\ts = strings.TrimSpace(s)\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tt, err := time.Parse(\"2006-01-02 15:04:05\", s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaler.DateTime.Set: cannot parse \\\"%s\\\"\", s)\n\t}\n\t*dt = DateTime(t)\n\treturn nil\n}", "func StringAsFloat(s string, decimalSeparator, thousandsSeparator rune) float64 {\n\tif s == \"\" {\n\t\treturn 0.0\n\t}\n\n\tconst maxLength = 20\n\n\tif len([]rune(s)) > maxLength {\n\t\ts = s[0:maxLength]\n\t}\n\n\ts = strings.Replace(s, string(thousandsSeparator), \"\", -1)\n\n\ts = strings.Replace(s, string(decimalSeparator), \".\", -1)\n\n\tif f, err := strconv.ParseFloat(s, 64); err == nil {\n\t\treturn f\n\t}\n\n\treturn 0.0\n}", "func (s *String) Set(str string) {\n\ts.Value = []byte(str)\n\ts.Length = int32(len(s.Value))\n}", "func (me *TNumberOrPercentageType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func StringFloat(from string, defaultValue ...float64) FloatAccessor {\n\tnv := &NullFloat{}\n\tpv, err := strconv.ParseFloat(from, 64)\n\tnv.Error = err\n\tif defaultFloat(nv, defaultValue...) {\n\t\treturn nv\n\t}\n\tv := pv\n\tnv.P = &v\n\treturn nv\n}", "func (recv *Value) SetString(vString string) {\n\tc_v_string := C.CString(vString)\n\tdefer C.free(unsafe.Pointer(c_v_string))\n\n\tC.g_value_set_string((*C.GValue)(recv.native), c_v_string)\n\n\treturn\n}", "func (c *Color) SetString(str string, base color.Color) error {\n\tif len(str) == 0 { // consider it null\n\t\tc.SetToNil()\n\t\treturn nil\n\t}\n\t// pr := prof.Start(\"Color.SetString\")\n\t// defer pr.End()\n\tlstr := strings.ToLower(str)\n\tswitch {\n\tcase lstr[0] == '#':\n\t\treturn c.ParseHex(str)\n\tcase strings.HasPrefix(lstr, \"hsl(\"):\n\t\tval := lstr[4:]\n\t\tval = strings.TrimRight(val, \")\")\n\t\tformat := \"%d,%d,%d\"\n\t\tvar h, s, l int\n\t\tfmt.Sscanf(val, format, &h, &s, &l)\n\t\tc.SetHSL(float32(h), float32(s)/100.0, float32(l)/100.0)\n\tcase strings.HasPrefix(lstr, \"rgb(\"):\n\t\tval := lstr[4:]\n\t\tval = strings.TrimRight(val, \")\")\n\t\tval = strings.Trim(val, \"%\")\n\t\tvar r, g, b, a int\n\t\ta = 255\n\t\tformat := \"%d,%d,%d\"\n\t\tif strings.Count(val, \",\") == 4 {\n\t\t\tformat = \"%d,%d,%d,%d\"\n\t\t\tfmt.Sscanf(val, format, &r, &g, &b, &a)\n\t\t} else {\n\t\t\tfmt.Sscanf(val, format, &r, &g, &b)\n\t\t}\n\t\tc.SetUInt8(uint8(r), uint8(g), uint8(b), uint8(a))\n\tcase strings.HasPrefix(lstr, \"rgba(\"):\n\t\tval := lstr[5:]\n\t\tval = strings.TrimRight(val, \")\")\n\t\tval = strings.Trim(val, \"%\")\n\t\tvar r, g, b, a int\n\t\tformat := \"%d,%d,%d,%d\"\n\t\tfmt.Sscanf(val, format, &r, &g, &b, &a)\n\t\tc.SetUInt8(uint8(r), uint8(g), uint8(b), uint8(a))\n\tcase strings.HasPrefix(lstr, \"pref(\"):\n\t\tval := lstr[5:]\n\t\tval = strings.TrimRight(val, \")\")\n\t\tclr := ThePrefs.PrefColor(val)\n\t\tif clr != nil {\n\t\t\t*c = *clr\n\t\t}\n\tdefault:\n\t\tif hidx := strings.Index(lstr, \"-\"); hidx > 0 {\n\t\t\tcmd := lstr[:hidx]\n\t\t\tpctstr := lstr[hidx+1:]\n\t\t\tpct, gotpct := kit.ToFloat32(pctstr)\n\t\t\tswitch cmd {\n\t\t\tcase \"lighter\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Lighter(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"darker\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Darker(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"highlight\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Highlight(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"samelight\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Samelight(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"saturate\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Saturate(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"pastel\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Pastel(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"clearer\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Clearer(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"opaquer\":\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tc.SetColor(c.Opaquer(pct))\n\t\t\t\treturn nil\n\t\t\tcase \"blend\":\n\t\t\t\tif base != nil {\n\t\t\t\t\tc.SetColor(base)\n\t\t\t\t}\n\t\t\t\tclridx := strings.Index(pctstr, \"-\")\n\t\t\t\tif clridx < 0 {\n\t\t\t\t\terr := fmt.Errorf(\"gi.Color.SetString -- blend color spec not found -- format is: blend-PCT-color, got: %v -- PCT-color is: %v\", lstr, pctstr)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tpctstr = lstr[hidx+1 : clridx]\n\t\t\t\tpct, gotpct = kit.ToFloat32(pctstr)\n\t\t\t\tcvtPctStringErr(gotpct, pctstr)\n\t\t\t\tclrstr := lstr[clridx+1:]\n\t\t\t\tothc, err := ColorFromString(clrstr, base)\n\t\t\t\tc.SetColor(c.Blend(pct, &othc))\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tswitch lstr {\n\t\tcase \"none\", \"off\":\n\t\t\tc.SetToNil()\n\t\t\treturn nil\n\t\tcase \"transparent\":\n\t\t\tc.SetUInt8(0xFF, 0xFF, 0xFF, 0)\n\t\t\treturn nil\n\t\tcase \"inverse\":\n\t\t\tif base != nil {\n\t\t\t\tc.SetColor(base)\n\t\t\t}\n\t\t\tc.SetColor(c.Inverse())\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn c.SetName(lstr)\n\t\t}\n\t}\n\treturn nil\n}", "func (me *TcoordinatesType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (me *TBaselineShiftValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (c *MetaConfig) WriteString(s string) (int, error) {\n\treturn c.Write([]byte(s))\n}", "func (u256 *Uint256) Set(s string) error {\n\t// TODO It would be really nice to give more guidance here, e.g. the number\n\t// TODO is too big vs simply invalid.\n\tint, ok := math.ParseBig256(s)\n\tif !ok || len(s) == 0 || int.Sign() == -1 {\n\t\treturn fmt.Errorf(\n\t\t\t\"[%v] must be a positive 256-bit or smaller hex or decimal string\",\n\t\t\ts,\n\t\t)\n\t}\n\n\tu256.Uint = int\n\treturn nil\n}", "func (c *CellValue) SetString(v string) {\n\tc.IntVal = 0\n\tc.FloatVal = 0\n\tc.StringVal = v\n}", "func (zr *ZRequest) SetCookieString(str string) *ZRequest {\n\tif zr.ended {\n\t\treturn zr\n\t}\n\tstr = strings.Trim(strings.TrimSpace(str), \";\")\n\tlst := strings.Split(str, \"; \")\n\tfor _, v := range lst {\n\t\ttmp := strings.SplitN(v, \"=\", 2)\n\t\tif len(tmp) == 2 {\n\t\t\tzr.SetCookie(&http.Cookie{Name: tmp[0], Value: tmp[1]})\n\t\t}\n\t}\n\treturn zr\n}", "func (l *Link) SetString(s string, base int) (*Link, bool) {\n\tw, ok := (*big.Int)(l).SetString(s, base)\n\treturn (*Link)(w), ok\n}", "func NewSetString() *SetString {\n\treturn &SetString{\n\t\tcache: make(map[string]bool),\n\t}\n}", "func (s *Smpval) SetStr(str string) bool {\n\tif s.flag == Str && s.val.CanSet() {\n\t\ts.val.SetString(str)\n\t\ts.s = s.val.String()\n\t\treturn true\n\t}\n\treturn false\n}", "func (me *TSAFmonetaryType) Set(s string) { (*xsdt.Decimal)(me).Set(s) }", "func (se *SimpleElement) SetString(value string) {\n\tse.value = value\n}", "func (flg *Var) Set(s string) error {\n\ts = strings.TrimSpace(s)\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tvar bs []byte\n\tif strings.HasPrefix(s, \"@\") {\n\t\tvar err error\n\t\tbs, err = ioutil.ReadFile(s[1:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tbs = []byte(s)\n\t}\n\tbuf := bytes.NewBuffer(bs)\n\tdecoder := json.NewDecoder(buf)\n\tif flg.UseNumber {\n\t\tdecoder.UseNumber()\n\t}\n\tvar v interface{}\n\tif err := decoder.Decode(&v); err != nil {\n\t\treturn err\n\t}\n\tflg.Value = &v\n\treturn nil\n}", "func (jf *JFile) SetString(JSONpath, value string) error {\n\t_, parentNode, err := jf.rootnode.GetNodes(JSONpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm, ok := parentNode.CheckMap()\n\tif !ok {\n\t\treturn errors.New(\"Parent is not a map: \" + JSONpath)\n\t}\n\n\t// Set the string\n\tm[lastpart(JSONpath)] = value\n\n\tnewdata, err := jf.rootnode.PrettyJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn jf.Write(newdata)\n}", "func IsFloat(str string) bool {\n\treturn str != \"\" && rxFloat.MatchString(str)\n}", "func (key Key) SetString(sp *string) error {\n\tval, ok := key.Lookup()\n\tif !ok {\n\t\treturn fmt.Errorf(\"missing environment variable %s\", key)\n\t}\n\t*sp = val\n\treturn nil\n}", "func (z *Float) Set(x *Float) *Float {}", "func (me *TPointsType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (v *Value2) Set(s string) error {\n\tz, err := Parse2(s)\n\tif err == nil {\n\t\t*v = Value2(z)\n\t}\n\treturn err\n}", "func (s *MockStorage) PutString(key, value string) {\n\ts.dataStore[key] = []byte(value)\n}", "func (s String) Float() float64 {\n\tf, err := cast.ToFloat64E(string(s))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (me *TSAFdecimalType) Set(s string) { (*xsdt.Decimal)(me).Set(s) }", "func (me *TCoordinatesType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (me *TimezoneType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func setFloat(data [2]string, f func(float64)) error {\n\tval, err := strconv.ParseFloat(strings.TrimSpace(data[1]), 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"code %s: %s\", data[0], err.Error())\n\t}\n\tf(val)\n\treturn nil\n}", "func (me *TCoordinateType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (me *TMarkerValueType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (m *Value) WithString(v string) *Value {\n\tm.KindMock = func() xmlrpc.Kind { return xmlrpc.String }\n\tm.StringMock = func() string { return v }\n\treturn m\n}", "func FloatString(x *big.Float,) string", "func TestFloat(tst *testing.T) {\n\n\t// Test bool\n\tf, err := StringToFloat(\"1.256898\")\n\tbrtesting.AssertEqual(tst, err, nil, \"StringToFloat failed\")\n\tbrtesting.AssertEqual(tst, f, 1.256898, \"StringToFloat failed\")\n\tf, err = StringToFloat(\"go-bedrock\")\n\tbrtesting.AssertNotEqual(tst, err, nil, \"StringToFloat failed\")\n}", "func (self *Encoder) SetValidateString(f bool) {\n if f {\n self.Opts |= ValidateString\n } else {\n self.Opts &= ^ValidateString\n }\n}", "func (e *stringElement) Set(value interface{}) error {\n\te.valid = true\n\tif value == nil {\n\t\te.valid = false\n\t\treturn nil\n\t}\n\tswitch value.(type) {\n\tcase string:\n\t\tif value.(string) == Nil {\n\t\t\te.valid = false\n\t\t} else {\n\t\t\te.e = string(value.(string))\n\t\t}\n\tcase int:\n\t\te.e = strconv.Itoa(value.(int))\n\tcase int64:\n\t\te.e = strconv.FormatInt(value.(int64), 10)\n\tcase uint64:\n\t\te.e = strconv.FormatUint(value.(uint64), 10)\n\tcase float32:\n\t\te.e = strconv.FormatFloat(float64(value.(float32)), 'f', 6, 64)\n\tcase float64:\n\t\te.e = strconv.FormatFloat(value.(float64), 'f', 6, 64)\n\tcase bool:\n\t\tb := value.(bool)\n\t\tif b {\n\t\t\te.e = \"true\"\n\t\t} else {\n\t\t\te.e = \"false\"\n\t\t}\n\tcase NaNElement:\n\t\te.e = \"NaN\"\n\tcase Element:\n\t\tif value.(Element).IsValid() {\n\t\t\tv, err := value.(Element).String()\n\t\t\tif err != nil {\n\t\t\t\te.valid = false\n\t\t\t\treturn err\n\t\t\t}\n\t\t\te.e = v\n\t\t} else {\n\t\t\te.valid = false\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\te.valid = false\n\t\treturn fmt.Errorf(\"Unsupported type '%T' conversion to a string\", value)\n\t}\n\treturn nil\n}", "func (i *IntValue) Set(s string) error {\n\tv, err := strconv.ParseInt(s, 0, 64)\n\t*i = IntValue(v)\n\treturn err\n}", "func (me *TSAFPTPortugueseVatNumber) Set(s string) { (*xsdt.Integer)(me).Set(s) }", "func (t *VSStrStr) IsSet() bool {\n\treturn true\n}", "func (d *DateValue) Set(s string) error {\n\tv, err := time.Parse(\"2006-01-02\", s)\n\t*d = DateValue(v)\n\treturn err\n}", "func (me *Tangle360Type) Set(s string) { (*xsdt.Double)(me).Set(s) }", "func StringIsNumeric(s string) bool {\n\t_, err := strconv.ParseFloat(s, 64)\n\treturn err == nil\n}" ]
[ "0.7824855", "0.7118221", "0.60867715", "0.5958156", "0.583567", "0.579007", "0.56625277", "0.5600679", "0.55482984", "0.5476491", "0.5296352", "0.5292799", "0.5216194", "0.5213179", "0.52104795", "0.51960665", "0.5156387", "0.5130611", "0.512982", "0.51194686", "0.5075163", "0.5066507", "0.50629544", "0.50622857", "0.5039291", "0.5022932", "0.49958223", "0.4981777", "0.4953234", "0.49413493", "0.49371856", "0.4935933", "0.49357867", "0.49340236", "0.49290004", "0.49232945", "0.49218407", "0.49047872", "0.48868024", "0.48653492", "0.48591107", "0.48509604", "0.48404676", "0.48344165", "0.483103", "0.48212373", "0.48192692", "0.4801819", "0.47913873", "0.47846383", "0.4761224", "0.47595066", "0.4745083", "0.474402", "0.47440144", "0.4743641", "0.47420838", "0.47390282", "0.4737821", "0.47298673", "0.47280717", "0.47178394", "0.4703781", "0.47007293", "0.46985793", "0.46968397", "0.46926045", "0.4692439", "0.46919006", "0.46856508", "0.46715885", "0.46687728", "0.46685886", "0.46636093", "0.46595505", "0.4657438", "0.4653262", "0.46474943", "0.46405217", "0.46392027", "0.46341497", "0.46272072", "0.46154588", "0.46037883", "0.4603128", "0.4600727", "0.4588636", "0.45855758", "0.4575975", "0.45751318", "0.45717764", "0.457103", "0.45695153", "0.45686364", "0.455644", "0.45558283", "0.45553517", "0.45490015", "0.4546837", "0.454459" ]
0.613978
2
SetUint64 is shorthand for SetMantScale(x, 0) for an unsigned integer.
func (z *Big) SetUint64(x uint64) *Big { z.compact = x if x == c.Inflated { z.unscaled.SetUint64(x) } z.precision = arith.Length(x) z.exp = 0 z.form = finite return z }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (z *Rat) SetUint64(x uint64) *Rat {}", "func (z *Int) SetUint64(x uint64) *Int {}", "func SetUint64(z *big.Int, x uint64) *big.Int {\n\treturn z.SetUint64(x)\n}", "func (z *Element22) SetUint64(v uint64) *Element22 {\n\tz[0] = v\n\tz[1] = 0\n\tz[2] = 0\n\tz[3] = 0\n\tz[4] = 0\n\tz[5] = 0\n\tz[6] = 0\n\tz[7] = 0\n\tz[8] = 0\n\tz[9] = 0\n\tz[10] = 0\n\tz[11] = 0\n\tz[12] = 0\n\tz[13] = 0\n\tz[14] = 0\n\tz[15] = 0\n\tz[16] = 0\n\tz[17] = 0\n\tz[18] = 0\n\tz[19] = 0\n\tz[20] = 0\n\tz[21] = 0\n\treturn z.ToMont()\n}", "func (z *Float) SetUint64(x uint64) *Float {}", "func (n *Uint256) SetUint64(n2 uint64) *Uint256 {\n\tn.n[0] = n2\n\tn.n[1] = 0\n\tn.n[2] = 0\n\tn.n[3] = 0\n\treturn n\n}", "func (z *Int) SetUint64(x uint64) *Int {\n\tz[3], z[2], z[1], z[0] = 0, 0, 0, x\n\treturn z\n}", "func (obj *Value) SetUint64(v uint64) {\n\tobj.Candy().Guify(\"g_value_set_uint64\", obj, v)\n}", "func (r *raftLog) SetUint64(k []byte, v uint64) error {\n\treturn r.setUint64(confBucket, k, v)\n}", "func (i *UInt64) Set(v uint64) {\n\t*i = UInt64(v)\n}", "func (i *InmemStore) SetUint64(key []byte, val uint64) error {\n\ti.l.Lock()\n\tdefer i.l.Unlock()\n\ti.kvInt[string(key)] = val\n\treturn nil\n}", "func (instance *Instance) SetUint64(fieldName string, value uint64) error {\n\tfieldNameCStr := C.CString(fieldName)\n\tdefer C.free(unsafe.Pointer(fieldNameCStr))\n\n\tretcode := int(C.RTI_Connector_set_number_into_samples(unsafe.Pointer(instance.output.connector.native), instance.output.nameCStr, fieldNameCStr, C.double(value)))\n\treturn checkRetcode(retcode)\n}", "func (b *BadgerStore) SetUint64(key []byte, val uint64) error {\n\treturn b.Set(key, uint64ToBytes(val))\n}", "func (b *BadgerStore) SetUint64(key []byte, val uint64) error {\n\treturn b.Set(key, uint64ToBytes(val))\n}", "func (b *raftBadger) SetUint64(key []byte, val uint64) error {\n\treturn b.SetRaw(u64KeyOf(key), uint64ToBytes(val))\n}", "func (recv *Value) SetUint64(vUint64 uint64) {\n\tc_v_uint64 := (C.guint64)(vUint64)\n\n\tC.g_value_set_uint64((*C.GValue)(recv.native), c_v_uint64)\n\n\treturn\n}", "func (f *Uint64) Set(val uint64) {\n\tf.set(-1, val, false)\n}", "func (z *Big) SetMantScale(value int64, scale int) *Big {\n\tz.SetUint64(arith.Abs(value))\n\tz.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64\n\tif value < 0 {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (z *Numeric) SetUint(x uint) *Numeric {\n\tif x == 0 {\n\t\treturn z.SetZero()\n\t}\n\n\tz.sign = numericPositive\n\tz.weight = -1\n\tz.digits = make([]int16, 0, 1) // as x!=0 there is at least 1 1000-base digit\n\tfor x != 0 {\n\t\td := int16(x % numericBase)\n\t\tx /= numericBase\n\t\tif d != 0 || len(z.digits) > 0 { // avoid tailing zero\n\t\t\tz.digits = append([]int16{d}, z.digits...)\n\t\t}\n\t\tz.weight++\n\t}\n\n\treturn z\n}", "func (v *Uint64) Set(s string) error {\n\tx, err := ParseUint64(s)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\t*v = x\n\treturn nil\n}", "func NewUint64(vals ...uint64) Uint64 {\n\tsize := max(len(vals), minSize)\n\tset := Uint64{\n\t\tm: make(map[uint64]struct{}, size),\n\t}\n\tset.Add(vals...)\n\treturn set\n}", "func NewUint64Set(items ...uint64) Uint64Set {\n\tss := Uint64Set{}\n\tss.Insert(items...)\n\treturn ss\n}", "func (s *EnvVarSet) Uint64(name string, value uint64, usage string) *uint64 {\n\tp := new(uint64)\n\n\ts.Uint64Var(p, name, value, usage)\n\n\treturn p\n}", "func (f *FlagSet) Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\tp := new(uint64)\n\tf.Uint64Var(p, name, alias, value, usage, fn)\n\treturn p\n}", "func BlsmskU64(a uint64) uint64 {\n\tpanic(\"not implemented\")\n}", "func (tr Row) ForceUint64(nn int) (val uint64) {\n\tval, _ = tr.Uint64Err(nn)\n\treturn\n}", "func (db *DB) PutUint64(key string, value uint64) (err error) {\n\ts := strconv.FormatUint(value, 10)\n\treturn db.PutStr(key, s)\n}", "func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big {\n\t// Do this first in case value == z.unscaled. Don't want to clobber the sign.\n\tz.form = finite\n\tif value.Sign() < 0 {\n\t\tz.form |= signbit\n\t}\n\n\tz.unscaled.Abs(value)\n\tz.compact = c.Inflated\n\tz.precision = arith.BigLength(value)\n\n\tif z.unscaled.IsUint64() {\n\t\tif v := z.unscaled.Uint64(); v != c.Inflated {\n\t\t\tz.compact = v\n\t\t}\n\t}\n\n\tz.exp = -scale\n\treturn z\n}", "func SetInt64(z *big.Int, x int64) *big.Int {\n\treturn z.SetInt64(x)\n}", "func (obj *Value) SetUlong(v uint64) {\n\tobj.Candy().Guify(\"g_value_set_ulong\", obj, v)\n}", "func SetBvUint64Value(model ModelT, t TermT, val uint64) int32 {\n\treturn int32(C.yices_model_set_bv_uint64(ymodel(model), C.term_t(t), C.uint64_t(val)))\n}", "func opUI64Bitclear(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadUI64(fp, expr.Inputs[0]) &^ ReadUI64(fp, expr.Inputs[1])\n\tWriteUI64(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "func NewUint64Setting(name string, description string, fallback uint64) *Uint64Setting {\n\treturn &Uint64Setting{\n\t\tBaseSetting: &BaseSetting{\n\t\t\tNameValue: name,\n\t\t\tDescriptionValue: description,\n\t\t},\n\t\tUint64Value: &fallback,\n\t}\n}", "func UInt64Put(p []byte, n uint64) {\n\tbinary.LittleEndian.PutUint64(p, n)\n}", "func (z *Rat) SetInt64(x int64) *Rat {}", "func (z *Float) SetInt64(x int64) *Float {}", "func Uint64Arg(register Register, name string, options ...ArgOptionApplyer) *uint64 {\n\tp := new(uint64)\n\t_ = Uint64ArgVar(register, p, name, options...)\n\treturn p\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn ex.FlagSet.Uint64(name, value, usage)\n}", "func Uint64(u *uint64) uint64 {\n\tif u == nil {\n\t\treturn 0\n\t}\n\treturn *u\n}", "func Uint64(n, min, max uint64) uint64 {\n\tif n < min {\n\t\tn = min\n\t} else if n > max {\n\t\tn = max\n\t}\n\treturn n\n}", "func (m *Mmap) WriteUint64(start int64, val uint64) error {\n\tbinary.LittleEndian.PutUint64(m.MmapBytes[start:start+8], val)\n\treturn nil\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\tp := new(uint64);\n\tUint64Var(p, name, value, usage);\n\treturn p;\n}", "func (z *Big) SetFloat64(x float64) *Big {\n\tif x == 0 {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setZero(sign, 0)\n\t}\n\tif math.IsNaN(x) {\n\t\tvar sign form\n\t\tif math.Signbit(x) {\n\t\t\tsign = signbit\n\t\t}\n\t\treturn z.setNaN(0, qnan|sign, 0)\n\t}\n\tif math.IsInf(x, 0) {\n\t\tif math.IsInf(x, 1) {\n\t\t\tz.form = pinf\n\t\t} else {\n\t\t\tz.form = ninf\n\t\t}\n\t\treturn z\n\t}\n\n\t// The gist of the following is lifted from math/big/rat.go, but adapted for\n\t// base-10 decimals.\n\n\tconst expMask = 1<<11 - 1\n\tbits := math.Float64bits(x)\n\tmantissa := bits & (1<<52 - 1)\n\texp := int((bits >> 52) & expMask)\n\tif exp == 0 { // denormal\n\t\texp -= 1022\n\t} else { // normal\n\t\tmantissa |= 1 << 52\n\t\texp -= 1023\n\t}\n\n\tif mantissa == 0 {\n\t\treturn z.SetUint64(0)\n\t}\n\n\tshift := 52 - exp\n\tfor mantissa&1 == 0 && shift > 0 {\n\t\tmantissa >>= 1\n\t\tshift--\n\t}\n\n\tz.exp = 0\n\tz.form = finite | form(bits>>63)\n\n\tif shift > 0 {\n\t\tz.unscaled.SetUint64(uint64(shift))\n\t\tz.unscaled.Exp(c.FiveInt, &z.unscaled, nil)\n\t\tarith.Mul(&z.unscaled, &z.unscaled, mantissa)\n\t\tz.exp = -shift\n\t} else {\n\t\t// TODO(eric): figure out why this doesn't work for _some_ numbers. See\n\t\t// https://github.com/ericlagergren/decimal/issues/89\n\t\t//\n\t\t// z.compact = mantissa << uint(-shift)\n\t\t// z.precision = arith.Length(z.compact)\n\n\t\tz.compact = c.Inflated\n\t\tz.unscaled.SetUint64(mantissa)\n\t\tz.unscaled.Lsh(&z.unscaled, uint(-shift))\n\t}\n\treturn z.norm()\n}", "func MakeUint64(x uint64) Value {\n\treturn constant.MakeUint64(x)\n}", "func (z *Int) SetInt64(x int64) *Int {}", "func Uint64(v *uint64) uint64 {\n\tif v != nil {\n\t\treturn *v\n\t}\n\treturn 0\n}", "func (v *Value) SetUInt64(val uint64) {\n\tC.g_value_set_uint64(v.Native(), C.guint64(val))\n}", "func (recv *Value) SetUlong(vUlong uint64) {\n\tc_v_ulong := (C.gulong)(vUlong)\n\n\tC.g_value_set_ulong((*C.GValue)(recv.native), c_v_ulong)\n\n\treturn\n}", "func (recv *Value) SetInt64(vInt64 int64) {\n\tc_v_int64 := (C.gint64)(vInt64)\n\n\tC.g_value_set_int64((*C.GValue)(recv.native), c_v_int64)\n\n\treturn\n}", "func NewUInt64Set() UInt64Set {\n\treturn make(map[uint64]struct{})\n}", "func Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\treturn CommandLine.Uint64(name, alias, value, usage, fn)\n}", "func (s *Streamer) Uint64(v uint64) *Streamer {\n\tif s.Error != nil {\n\t\treturn s\n\t}\n\ts.onVal()\n\ts.buffer = appendUint64(s.buffer, v)\n\treturn s\n}", "func (w *Packer) PutUint64(v uint64) {\n\tbinary.LittleEndian.PutUint64(w.scratch[:], v)\n\t_, _ = w.buf.Write(w.scratch[:8])\n}", "func (m *Message) putUint64(v uint64) {\n\tb := m.bufferForPut(8)\n\tdefer b.Advance(8)\n\n\tbinary.LittleEndian.PutUint64(b.Bytes[b.Offset:], v)\n}", "func (s *EnvVarSet) Uint64Var(p *uint64, name string, value uint64, usage string) {\n\ts.Var(newUint64Value(value, p), name, usage)\n}", "func NewUint64WithSize(size int) Uint64 {\n\tset := Uint64{\n\t\tm: make(map[uint64]struct{}, size),\n\t}\n\treturn set\n}", "func Uint64(flag string, value uint64, description string) *uint64 {\n\tvar v uint64\n\tUint64Var(&v, flag, value, description)\n\treturn &v\n}", "func (f *Float) SetInt64(x int64) *Float {\n\tf.doinit()\n\tC.mpf_set_si(&f.i[0], C.long(x))\n\treturn f\n}", "func Uint64(x *big.Int) uint64 {\n\treturn x.Uint64()\n}", "func (f *FlagSet) Uint64Var(p *uint64, name string, alias rune, value uint64, usage string, fn Callback) {\n\tf.Var(newUint64Value(value, p), name, alias, usage, fn)\n}", "func TestUnset64(t *testing.T) {\n\thm, _ := NewHashMap(64)\n\ttestUnsetN(testN, hm)\n}", "func (w *Writer) Uint64(n uint64) {\n\tw.buf = strconv.AppendUint(w.buf, uint64(n), 10)\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn Environment.Uint64(name, value, usage)\n}", "func (s *Uint64Setting) SetValue(v interface{}) error {\n\tvar err error\n\t*s.Uint64Value, err = cast.ToUint64E(v)\n\treturn err\n}", "func (a *api) SetInt64(raw bool) {\n\ta.Commentf(\"%s constructs a field element from an integer.\", rawname(\"SetInt64\", raw))\n\ta.rawcomment(raw)\n\ta.Printf(\"func (x %s) %s(y int64) %s\", a.PointerType(), rawname(\"SetInt64\", raw), a.PointerType())\n\ta.EnterBlock()\n\ta.Linef(\"x.%s(big.NewInt(y))\", rawname(\"SetInt\", raw))\n\ta.Linef(\"return x\")\n\ta.LeaveBlock()\n}", "func (s *Smpval) SetUint(u uint64) bool {\n\tif s.flag == Uint && s.val.CanSet() {\n\t\ts.val.SetUint(u)\n\t\ts.u = s.val.Uint()\n\t\treturn true\n\t}\n\treturn false\n}", "func SetE() {\n e.SetUint64(65537)\n}", "func StoreUint64(addr *uint64, val uint64)", "func (u Uint64) Uint64() uint64 {\n\treturn uint64(u)\n}", "func NewUint64(x uint64) *Numeric {\n\tvar r Numeric\n\treturn r.SetUint64(x)\n}", "func MulUint64(a, b uint64) uint64 {\n\treturn native(\"mul64.circ\", a, b)\n}", "func (i *Int64) Set(v int64) {\n\t*i = Int64(v)\n}", "func (r *HashJsonCodecRedisController) SetSomeUint64(key string, someUint64 uint64) (err error) {\n\t// redis conn\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t// set SomeUint64 field\n\tr.m.SomeUint64 = someUint64\n\t_, err = conn.Do(\"HSET\", key, \"SomeUint64\", someUint64)\n\n\treturn\n}", "func (bw *BufWriter) Uint64(val uint64) {\n\tif bw.Error != nil {\n\t\treturn\n\t}\n\t_, bw.Error = bw.writer.WriteString(strconv.FormatUint(val, 10))\n}", "func NewUint64(store *store.Store, cfgPath string) *Uint64 {\n\tf := &Uint64{}\n\tf.init(store, f.mapCfgValue, cfgPath)\n\treturn f\n}", "func SetBigInt(gauge prometheus.Gauge, arg *big.Int) {\n\tgauge.Set(float64(arg.Int64()))\n}", "func WriteUInt64(buffer []byte, offset int, value uint64) {\n buffer[offset + 0] = byte(value >> 0)\n buffer[offset + 1] = byte(value >> 8)\n buffer[offset + 2] = byte(value >> 16)\n buffer[offset + 3] = byte(value >> 24)\n buffer[offset + 4] = byte(value >> 32)\n buffer[offset + 5] = byte(value >> 40)\n buffer[offset + 6] = byte(value >> 48)\n buffer[offset + 7] = byte(value >> 56)\n}", "func (x *Int) Uint64() uint64 {}", "func (v *Value) SetInt64(val int64) {\n\tC.g_value_set_int64(v.Native(), C.gint64(val))\n}", "func (e *Encoder) PutUint64(v uint64) {\n\tbinary.LittleEndian.PutUint64(e.tmp[:8], v)\n\te.write(e.tmp[:8])\n}", "func TestSet64(t *testing.T) {\n\thm, _ := NewHashMap(64)\n\ttestSetN(testN, hm)\n}", "func MinMaxUint64(x, min, max uint64) uint64 { return x }", "func Uint64(name string, defaultValue uint64) uint64 {\n\tif strVal, ok := os.LookupEnv(name); ok {\n\t\tif i64, err := strconv.ParseUint(strVal, 10, 64); err == nil {\n\t\t\treturn i64\n\t\t}\n\t}\n\n\treturn defaultValue\n}", "func (obj *Value) SetInt64(v int64) {\n\tobj.Candy().Guify(\"g_value_set_int64\", obj, v)\n}", "func SwapUint64(addr *uint64, new uint64) (old uint64)", "func (p *PCG64) Uint64() uint64 {\n\tp.multiply()\n\tp.add()\n\t// XOR high and low 64 bits together and rotate right by high 6 bits of state.\n\treturn bits.RotateLeft64(p.high^p.low, -int(p.high>>58))\n}", "func (instance *Instance) SetInt64(fieldName string, value int64) error {\n\tfieldNameCStr := C.CString(fieldName)\n\tdefer C.free(unsafe.Pointer(fieldNameCStr))\n\n\tretcode := int(C.RTI_Connector_set_number_into_samples(unsafe.Pointer(instance.output.connector.native), instance.output.nameCStr, fieldNameCStr, C.double(value)))\n\treturn checkRetcode(retcode)\n}", "func Uint64Map(src map[string]*uint64) map[string]uint64 {\n\tdst := make(map[string]uint64)\n\tfor k, val := range src {\n\t\tif val != nil {\n\t\t\tdst[k] = *val\n\t\t}\n\t}\n\treturn dst\n}", "func UInt64(v uint64) *uint64 {\n\treturn &v\n}", "func PutUint64(buf []byte, v uint64) (n int) {\n\tif v >= uint64(1)<<56 {\n\t\tbuf[0] = 0\n\t\tbinary.LittleEndian.PutUint64(buf[1:], v)\n\t\treturn 9\n\t}\n\n\tbitCount := bits.Len64(v)\n\te := (bitCount + (bitCount >> 3)) >> 3\n\n\tv = v<<1 | 1\n\tv <<= uint(e)\n\tbinary.LittleEndian.PutUint64(buf, v)\n\n\treturn e + 1\n}", "func Uint64Strict(name string, defaultValue uint64) (uint64, error) {\n\tif strVal, ok := os.LookupEnv(name); ok {\n\t\ti64, err := strconv.ParseUint(strVal, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\treturn i64, nil\n\t}\n\n\treturn defaultValue, nil\n}", "func (ndf *NDFlagSet) ZVUint64(name string, example uint64, usage string) *uint64 {\n\tvar uiv uint64\n\tndf.ZVUint64Var(&uiv, name, example, usage)\n\treturn &uiv\n}", "func (o *OutputState) ApplyUint64(applier interface{}) Uint64Output {\n\treturn o.ApplyT(applier).(Uint64Output)\n}", "func (elt *Element) Uint64(defaultValue ...uint64) (uint64, error) {\n\tdefValue := func() *uint64 {\n\t\tif len(defaultValue) == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn &defaultValue[0]\n\t}\n\tdef := defValue()\n\tif elt.Value == nil {\n\t\tdef := defValue()\n\t\tif def == nil {\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongPathError(elt.Path)\n\t\t}\n\t\treturn *def, nil\n\t}\n\tv, ok := elt.Value.(uint64)\n\tif !ok {\n\t\tif def == nil{\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongTypeError(\"uint64\", elt.Value)\n\t\t}\n\t\treturn *def, nil\n\t}\n\treturn v, nil\n}", "func (m Measurement) AddUInt64(name string, value uint64) Measurement {\n\tm.fieldSet[name] = value\n\treturn m\n}", "func MeasureUInt64(name string, field string, value uint64) Measurement {\n\treturn NewMeasurement(name).AddUInt64(field, value)\n}", "func Uint64Var(pv *uint64, flag string, value uint64, description string) {\n\tshort, long, err := parseSingleFlag(flag)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*pv = value\n\tflags = append(flags, &optionUint64{\n\t\tdescription: description,\n\t\tlong: long,\n\t\tshort: short,\n\t\tpv: pv,\n\t\tdef: value,\n\t})\n}", "func Uint64(val interface{}) uint64 {\r\n\r\n\tswitch t := val.(type) {\r\n\tcase int:\r\n\t\treturn uint64(t)\r\n\tcase int8:\r\n\t\treturn uint64(t)\r\n\tcase int16:\r\n\t\treturn uint64(t)\r\n\tcase int32:\r\n\t\treturn uint64(t)\r\n\tcase int64:\r\n\t\treturn uint64(t)\r\n\tcase uint:\r\n\t\treturn uint64(t)\r\n\tcase uint8:\r\n\t\treturn uint64(t)\r\n\tcase uint16:\r\n\t\treturn uint64(t)\r\n\tcase uint32:\r\n\t\treturn uint64(t)\r\n\tcase uint64:\r\n\t\treturn uint64(t)\r\n\tcase float32:\r\n\t\treturn uint64(t)\r\n\tcase float64:\r\n\t\treturn uint64(t)\r\n\tcase bool:\r\n\t\tif t == true {\r\n\t\t\treturn uint64(1)\r\n\t\t}\r\n\t\treturn uint64(0)\r\n\tdefault:\r\n\t\ts := String(val)\r\n\t\ti, _ := strconv.ParseUint(s, 10, 64)\r\n\t\treturn i\r\n\t}\r\n\r\n\tpanic(\"Reached\")\r\n\r\n}", "func (k *Key) MustUint64(defaultVal ...uint64) uint64 {\n\tval, err := k.Uint64()\n\tif len(defaultVal) > 0 && err != nil {\n\t\treturn defaultVal[0]\n\t}\n\treturn val\n}", "func (f *Form) Uint64(param string, defaultValue uint64) uint64 {\n\tvals, ok := f.values[param]\n\tif !ok {\n\t\treturn defaultValue\n\t}\n\tparamVal, err := strconv.ParseUint(vals[0], 10, 64)\n\tif err != nil {\n\t\tf.err = err\n\t\treturn defaultValue\n\t}\n\treturn paramVal\n}" ]
[ "0.73395187", "0.729106", "0.71818507", "0.7126499", "0.7075077", "0.7042647", "0.70083535", "0.6851255", "0.67058647", "0.6661966", "0.66220045", "0.6615672", "0.6601334", "0.6601334", "0.6547794", "0.6539059", "0.6418768", "0.6283617", "0.6243698", "0.60050946", "0.5908653", "0.5895906", "0.5894423", "0.58922976", "0.5887399", "0.58824605", "0.5873813", "0.58594567", "0.57799745", "0.57791924", "0.5760424", "0.57602686", "0.570306", "0.56954265", "0.5668762", "0.5640737", "0.56165457", "0.5599003", "0.55922997", "0.5590744", "0.5576781", "0.55742246", "0.5566248", "0.5540406", "0.55360824", "0.55102575", "0.55036426", "0.54997206", "0.5495614", "0.5487139", "0.54833066", "0.54827094", "0.5473257", "0.547304", "0.54729795", "0.5471479", "0.5423795", "0.5421905", "0.5420549", "0.5414295", "0.54135895", "0.54073906", "0.53807014", "0.5369502", "0.5366286", "0.5356398", "0.5350636", "0.5341826", "0.53358847", "0.53356045", "0.53251225", "0.5320802", "0.5319009", "0.53138244", "0.5304425", "0.5290728", "0.5288417", "0.5279596", "0.52791697", "0.52784705", "0.52665323", "0.52619517", "0.52617097", "0.52556425", "0.52520496", "0.5251493", "0.52492446", "0.52453625", "0.5235756", "0.5230465", "0.5223726", "0.5216712", "0.5214174", "0.5209273", "0.5206562", "0.5202932", "0.52009666", "0.5197353", "0.5190998", "0.5177977" ]
0.7513824
0
ord returns similar to Sign except Inf is 2 and +Inf is +2.
func (x *Big) ord(abs bool) int { if x.form&inf != 0 { if x.form == pinf || abs { return +2 } return -2 } r := x.Sign() if abs && r < 0 { r = -r } return r }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (x *Int) Sign() int {}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func dorthInfty(p0, p2 Point) Point {\n\treturn Point{signf(p2.X - p0.X), -signf(p2.Y - p0.Y)}\n}", "func FloatSign(x *big.Float,) int", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func IntSign(x *big.Int,) int", "func abs(n int) int {\n\ty := n >> 31\n\treturn (n ^ y) - y\n}", "func (x *Rat) Sign() int {}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func iAbs(x int) int { if x >= 0 { return x } else { return -x } }", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (i Int) Sign() int {\n\treturn i.i.Sign()\n}", "func (p Point) Sign() (int64) {\n\tnum, _ :=strconv.Atoi(string(p.Val[len(p.Val)-1]))\n\ttempnum:= (int64(num)/128)\n\treturn tempnum\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func Abs(x int32) int32 {\n\t// Patented (!) : return (x ^ (x >> 31)) - (x >> 31)\n\treturn (x + (x >> 31)) ^ (x >> 31)\n}", "func Sign(x *big.Int) int {\n\treturn x.Sign()\n}", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func direction(k1 collection.Comparer, k2 interface{}) int {\n\treturn math.Signum(math.Signum(k1.Compare(k2) + 1))\n}", "func RatSign(x *big.Rat,) int", "func Inf32(sign int) float32 {\n\treturn float32(math.Inf(sign))\n}", "func abs(i int) int {\n\tif i < 0 {\n\t\treturn -i\n\t}\n\treturn i\n}", "func abs(i int) int {\n\tif i < 0 {\n\t\treturn -i\n\t}\n\treturn i\n}", "func abs(v int) int {\n\tif v < 0 {\n\t\treturn -v\n\t}\n\treturn v\n}", "func opI16Abs(expr *CXExpression, fp int) {\n\tV0 := ReadI16(fp, expr.Inputs[0])\n\tsign := V0 >> 15\n\toutB0 := (V0 ^ sign) - sign\n\tWriteI16(GetOffset_i16(fp, expr.Outputs[0]), outB0)\n}", "func Abs(operand int) int {\n\tif operand < 0 {\n\t\treturn operand * -1\n\t}\n\treturn operand\n}", "func IntToIeeeFloat(i int) [10]byte {\n\tb := [10]byte{}\n\tnum := float64(i)\n\n\tvar sign int\n\tvar expon int\n\tvar fMant, fsMant float64\n\tvar hiMant, loMant uint\n\n\tif num < 0 {\n\t\tsign = 0x8000\n\t} else {\n\t\tsign = 0\n\t}\n\n\tif num == 0 {\n\t\texpon = 0\n\t\thiMant = 0\n\t\tloMant = 0\n\t} else {\n\t\tfMant, expon = math.Frexp(num)\n\t\tif (expon > 16384) || !(fMant < 1) { /* Infinity or NaN */\n\t\t\texpon = sign | 0x7FFF\n\t\t\thiMant = 0\n\t\t\tloMant = 0 /* infinity */\n\t\t} else { /* Finite */\n\t\t\texpon += 16382\n\t\t\tif expon < 0 { /* denormalized */\n\t\t\t\tfMant = math.Ldexp(fMant, expon)\n\t\t\t\texpon = 0\n\t\t\t}\n\t\t\texpon |= sign\n\t\t\tfMant = math.Ldexp(fMant, 32)\n\t\t\tfsMant = math.Floor(fMant)\n\t\t\thiMant = uint(fsMant)\n\t\t\tfMant = math.Ldexp(fMant-fsMant, 32)\n\t\t\tfsMant = math.Floor(fMant)\n\t\t\tloMant = uint(fsMant)\n\t\t}\n\t}\n\n\tb[0] = byte(expon >> 8)\n\tb[1] = byte(expon)\n\tb[2] = byte(hiMant >> 24)\n\tb[3] = byte(hiMant >> 16)\n\tb[4] = byte(hiMant >> 8)\n\tb[5] = byte(hiMant)\n\tb[6] = byte(loMant >> 24)\n\tb[7] = byte(loMant >> 16)\n\tb[8] = byte(loMant >> 8)\n\tb[9] = byte(loMant)\n\n\treturn b\n}", "func abs(val int) int {\n\tif val < 0 {\n\t\treturn -val\n\t}\n\treturn val\n}", "func Iabs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func (_ElvTradable *ElvTradableCaller) OrdinalOfToken(opts *bind.CallOpts, tokenId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ElvTradable.contract.Call(opts, &out, \"ordinalOfToken\", tokenId)\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}", "func crypto_sign_direct(sm []uint8, m []uint8, n int, sk []uint8) int {\n\tvar h = make([]uint8, 64)\n\tvar r = make([]uint8, 64)\n\tvar x = make([]int64, 64)\n\tvar p = [][]int64{gf(), gf(), gf(), gf()}\n\n\tfor i := 0; i < n; i++ {\n\t\tsm[64+i] = m[i]\n\t}\n\n\tfor i := 0; i < 32; i++ {\n\t\tsm[32+i] = sk[i]\n\t}\n\n\tcrypto_hash(r, sm[32:], n+32)\n\n\treduce(r)\n\n\tscalarbase(p, r)\n\n\tpack(sm, p)\n\n\tfor i := 0; i < 32; i++ {\n\t\tsm[i+32] = sk[32+i]\n\t}\n\n\tcrypto_hash(h, sm, n+64)\n\treduce(h)\n\n\tfor i := 0; i < 64; i++ {\n\t\tx[i] = 0\n\t}\n\n\tfor i := 0; i < 32; i++ {\n\t\tx[i] = int64(r[i])\n\t}\n\n\tfor i := 0; i < 32; i++ {\n\t\tfor j := 0; j < 32; j++ {\n\t\t\tx[i+j] += int64(h[i]) * int64(sk[j])\n\t\t}\n\t}\n\n\tvar tmp = sm[32:]\n\tmodL(tmp, x)\n\tfor i := 0; i < len(tmp); i++ {\n\t\tsm[32+i] = tmp[i]\n\t}\n\n\treturn n + 64\n\n}", "func (z *Int) Abs(x *Int) *Int {}", "func abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func sign() int {\n\ts := -1 + rand.Intn(2)\n\tif s == 0 {\n\t\ts++\n\t}\n\treturn s\n}", "func ord(c byte) int {\n\treturn int(c - '0')\n}", "func ord(c byte) int {\n\treturn int(c - '0')\n}", "func deg(v uint32) int {\n\tf := [...]uint32{0, 10241, 491582, 712794, 831695, 948446, 1032189, 1048576}\n\td := [...]int{0, 1, 2, 3, 4, 10, 11, 40}\n\n\tfor j := 1; j < len(f)-1; j++ {\n\t\tif v < f[j] {\n\t\t\treturn d[j]\n\t\t}\n\t}\n\n\treturn d[len(d)-1]\n}", "func abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func abs(n int32) int32 {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func abs(x int64) int64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(n int) int {\n\tif n >= 0 {\n\t\treturn n\n\t}\n\treturn -1 * n\n}", "func abs(x int64) int64 {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func abs(n int64) int64 {\n\treturn int64(math.Abs(float64(n)))\n}", "func abs(x int) int {\r\n\tif x < 0 {\r\n\t\treturn -x\r\n\t}\r\n\treturn x\r\n}", "func oppositeDirection(direction int) int {\n return (direction + 2) % 4\n}", "func cmp(x, y *Big, abs bool) int {\n\tif debug {\n\t\tx.validate()\n\t\ty.validate()\n\t}\n\n\tif x == y {\n\t\treturn 0\n\t}\n\n\t// NaN cmp x\n\t// z cmp NaN\n\t// NaN cmp NaN\n\tif (x.form|y.form)&nan != 0 {\n\t\treturn 0\n\t}\n\n\t// Fast path: Catches non-finite forms like zero and ±Inf, possibly signed.\n\txs := x.ord(abs)\n\tys := y.ord(abs)\n\tif xs != ys {\n\t\tif xs > ys {\n\t\t\treturn +1\n\t\t}\n\t\treturn -1\n\t}\n\tswitch xs {\n\tcase 0, +2, -2:\n\t\treturn 0\n\tdefault:\n\t\tr := cmpabs(x, y)\n\t\tif xs < 0 && !abs {\n\t\t\tr = -r\n\t\t}\n\t\treturn r\n\t}\n}", "func abs(a int) int {\r\n if a < 0 {\r\n return -a\r\n }\r\n return a\r\n}", "func KXNORD(k, k1, k2 operand.Op) { ctx.KXNORD(k, k1, k2) }", "func to2(off uint32, bits int) int {\n\tvar off2 int\n\t// fmt.Printf(\"off: %x bits: %d %x\\n\", off, bits, (1<<bits))\n\t// if (off >= (1 << bits)) { \n\tif ((off & (1 << (bits))) != 0) { \n\t\t// off = off - (1<<(bits))\n\t\t// off = ^off & ((1<<bits)-1)\n\t\toff = off ^ ((1<<(bits+1))-1) // invert all bits of number incl. sign\n \t\toff2 = -int(off+1)\n\t} else {\n\t\toff2 = int(off)\n\t}\n\treturn off2\n}", "func abs(x int) int {\n\tif x < 0{\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func abs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func abs(num int64) int64 {\n\tif num < 0 {\n\t\treturn -num\n\t}\n\treturn num\n}", "func (v Posit16x2) Exp() []int16 {\n\tout := make([]int16, 2)\n\tfor i, posit := range v.impl {\n\t\tout[i] = posit.Exp()\n\t}\n\treturn out\n}", "func SignInt(v int) int {\n\tif v < 0 {\n\t\treturn -1\n\t}\n\tif v > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func abs(n int) int {\n if n > 0 {\n return n\n }\n\n return -n\n}", "func (c *curve) coordSign(i *mod.Int) uint {\n\treturn i.V.Bit(0)\n}", "func ToNegative(n []float64) ([]int, []int) {\n\tniz := make([]int, len(n))\n\tk := make([]int, len(n)-1)\n\tf := []int{}\n\n\tfor i, v := range n {\n\t\tif v > 0 {\n\t\t\tniz[i] = 1\n\t\t} else {\n\t\t\tniz[i] = 0\n\t\t}\n\t}\n\n\tk1 := niz[1:]\n\tk2 := niz[0 : len(niz)-1]\n\tfor i := 0; i < len(niz)-1; i++ {\n\t\tk[i] = k1[i] - k2[i]\n\t\tif k[i] < 0 {\n\t\t\tf = append(f, i)\n\t\t}\n\t}\n\treturn f, k\n}", "func abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func AbsInt64(v int64) int64 {\n\ty := v >> 63 // y ← x >> 63\n\treturn (v ^ y) - y // (x ⨁ y) - y\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func Abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func log2(x uint) uint {\n\tif x == 0 {\n\t\treturn 0\n\t}\n\n\tk := uint(0)\n\tfor (x >> k) > 0 {\n\t\tk += 1\n\t}\n\treturn k - 1\n}", "func Abs(x complex64) float32 { return math.Hypot(real(x), imag(x)) }", "func XorDist(a [20]byte, b [20]byte) *big.Int {\n\ttoReturn := big.NewInt(0)\n\tfor i := 0; i < 20; i++ {\n\t\tres := a[19-i] ^ b[19-i]\n\t\ttmp := big.NewInt(int64(res))\n\t\ttoReturn.Add(toReturn, tmp.Lsh(tmp, uint(8*i)))\n\t}\n\treturn toReturn\n}", "func VPORD(ops ...operand.Op) { ctx.VPORD(ops...) }", "func opp(dir int) int {\r\n\treturn 1 - dir\r\n}", "func ilog2(v int) uint64 {\n\tvar r uint64\n\tfor ; v != 0; v >>= 1 {\n\t\tr++\n\t}\n\treturn r\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func opp(dir int) int {\n\treturn 1 - dir\n}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func zigzag64(v int64) uint64 {\n\tif v < 0 {\n\t\treturn uint64(-v)*2 - 1\n\t} else {\n\t\treturn uint64(v) * 2\n\t}\n}", "func (_ElvTradableLocal *ElvTradableLocalCaller) OrdinalOfToken(opts *bind.CallOpts, tokenId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ElvTradableLocal.contract.Call(opts, &out, \"ordinalOfToken\", tokenId)\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}", "func absInt(i int) int {\n\tif i > 0 {\n\t\treturn i\n\t}\n\treturn i * -1\n}", "func Abs(a int) int {\n\treturn neogointernal.Opcode1(\"ABS\", a).(int)\n}", "func main() {\n\tt := []int{1, -2, -5, -4, -3, 3, 3, 5}\n\tres := fourSum2(t, -11)\n\tfmt.Println(res)\n}", "func Copysign(x, y float32) float32 {\n\treturn float32(math.Copysign(float64(x), float64(y)))\n}", "func posEquiv(lit sat.Lit) sat.Lit {\n\tif lit < 0 {\n\t\treturn -2*lit - 2\n\t} else {\n\t\treturn 2*lit - 1\n\t}\n}", "func getord(input byte) int {\n\tLOWER_OFFSET := 87\n\tDIGIT_OFFSET := 48\n\tUPPER_OFFSET := 29\n\tvar result int\n\tif input <= 57 && input >= 48 {\n\t\tresult = int(input) - DIGIT_OFFSET\n\t} else if input >= 97 && input <= 122 {\n\t\tresult = int(input) - LOWER_OFFSET\n\t} else if input >= 65 && input <= 90 {\n\t\tresult = int(input) - UPPER_OFFSET\n\t} else {\n\t\tfmt.Printf(\"Dafux is this\\n\")\n\t\tresult = 0\n\t}\n\t//fmt.Printf(\"%c as base10 is %d\\n\", input, result)\n\treturn result\n}", "func inverterSinal(numero int) int {\n\treturn numero * -1\n}", "func reverse(x int) int {\n\txStr := strconv.Itoa(abs(x))\n\trunes := []rune(xStr)\n\n\tfor i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {\n\t\trunes[i], runes[j] = runes[j], runes[i]\n\t}\n\n\tres, _ := strconv.Atoi(string(runes))\n\n\t// math.MinInt32 == -(1 << 31)\n\t// math.MaxInt32 == (1 << 31) - 1\n\tif res < math.MinInt32 || res > math.MaxInt32 { // overflow\n\t\treturn 0\n\t}\n\n\tif x < 0 {\n\t\treturn -res\n\t}\n\treturn res\n}", "func (v Base) Ordinal() int {\n\tswitch v {\n\tcase A:\n\t\treturn 0\n\tcase C:\n\t\treturn 1\n\tcase G:\n\t\treturn 2\n\tcase T:\n\t\treturn 3\n\t}\n\treturn -1\n}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func exp2s(log int) int {\n\tvar value uint\n\n\tif log < 0 {\n\t\treturn -exp2s(-log)\n\t}\n\n\tvalue = uint(exp2_table[log&0xff] | 0x100)\n\n\tlog >>= 8\n\tif log <= 9 {\n\t\treturn int((value >> uint(9-log)))\n\t} else {\n\t\treturn int((value << uint(log-9)))\n\t}\n\n\treturn 0 // again, cannot actually reach this line, but keeps the compiler happy :)\n}", "func Sign(a int) int {\n\treturn neogointernal.Opcode1(\"SIGN\", a).(int)\n}", "func diff(f int) int {\n\tn := float64(f)\n\n\tvar other int\n\tfor i := 1; i <= f; i++ {\n\t\tother += i * i\n\t}\n\n\treturn int(math.Pow((n*(n+1)/2), 2)) - other\n}", "func reverse1(x int) int {\n\tvar s string\n\tif x < 0 {\n\t\ts = strconv.Itoa(-x)\n\t} else {\n\t\ts = strconv.Itoa(x)\n\t}\n\n\tbs := []byte(s)\n\thead := 0\n\ttail := len(bs) - 1\n\tfor head < tail {\n\t\tbs[head], bs[tail] = bs[tail], bs[head]\n\t\thead++\n\t\ttail--\n\t}\n\trs := string(bs)\n\tif x < 0 {\n\t\trs = \"-\" + rs\n\t}\n\ty, err := strconv.Atoi(rs)\n\tif err != nil {\n\t\tfmt.Println(err, rs)\n\t}\n\tif y > math.MaxInt32 || y < math.MinInt32 {\n\t\treturn 0\n\t}\n\treturn y\n}", "func absInt(v int) int {\n\tif v < 0 {\n\t\treturn -v\n\t}\n\treturn v\n}", "func Pow(x, y float64) float64 {\n\t// TODO: x or y NaN, ±Inf, maybe ±0.\n\tswitch {\n\tcase y == 0:\n\t\treturn 1\n\tcase y == 1:\n\t\treturn x\n\tcase x == 0 && y > 0:\n\t\treturn 0\n\tcase x == 0 && y < 0:\n\t\treturn Inf(1)\n\tcase y == 0.5:\n\t\treturn Sqrt(x)\n\tcase y == -0.5:\n\t\treturn 1 / Sqrt(x)\n\t}\n\n\tabsy := y;\n\tflip := false;\n\tif absy < 0 {\n\t\tabsy = -absy;\n\t\tflip = true;\n\t}\n\tyi, yf := Modf(absy);\n\tif yf != 0 && x < 0 {\n\t\treturn NaN()\n\t}\n\tif yi >= 1<<63 {\n\t\treturn Exp(y * Log(x))\n\t}\n\n\t// ans = a1 * 2^ae (= 1 for now).\n\ta1 := float64(1);\n\tae := 0;\n\n\t// ans *= x^yf\n\tif yf != 0 {\n\t\tif yf > 0.5 {\n\t\t\tyf--;\n\t\t\tyi++;\n\t\t}\n\t\ta1 = Exp(yf * Log(x));\n\t}\n\n\t// ans *= x^yi\n\t// by multiplying in successive squarings\n\t// of x according to bits of yi.\n\t// accumulate powers of two into exp.\n\tx1, xe := Frexp(x);\n\tfor i := int64(yi); i != 0; i >>= 1 {\n\t\tif i&1 == 1 {\n\t\t\ta1 *= x1;\n\t\t\tae += xe;\n\t\t}\n\t\tx1 *= x1;\n\t\txe <<= 1;\n\t\tif x1 < .5 {\n\t\t\tx1 += x1;\n\t\t\txe--;\n\t\t}\n\t}\n\n\t// ans = a1*2^ae\n\t// if flip { ans = 1 / ans }\n\t// but in the opposite order\n\tif flip {\n\t\ta1 = 1 / a1;\n\t\tae = -ae;\n\t}\n\treturn Ldexp(a1, ae);\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func zig(i uint32, j uint32) uint32 {\n\tif (i > 0x4000) || (j > 0x4000) {\n\t\tpanic(\"overflow\")\n\t}\n\tn := i + j\n\treturn ((n * (n + 1)) / 2) + j\n}", "func Neg(n int) int { return -n }", "func Abs(v int) int {\n\tif v > 0 {\n\t\treturn v\n\t}\n\treturn -v\n}", "func derivativeTanh(val float64) float64 {\n\treturn 1 - math.Pow(math.Tanh(val), 2)\n}", "func Abs(arg float64) float64 {\n\treturn math.Abs(arg)\n}", "func IAbs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\tif n == 0 {\n\t\treturn 0\n\t}\n\treturn n\n}" ]
[ "0.5777227", "0.5188269", "0.5188086", "0.5187969", "0.5134426", "0.5134426", "0.5123668", "0.50739413", "0.5066013", "0.5023007", "0.49716365", "0.49370477", "0.4899399", "0.48936492", "0.48849803", "0.4878196", "0.4849733", "0.48319378", "0.4806844", "0.47824758", "0.47790515", "0.47624612", "0.47624612", "0.4756174", "0.47528294", "0.47525376", "0.4728738", "0.4710167", "0.4699453", "0.46958962", "0.46874788", "0.46859086", "0.46840763", "0.46652648", "0.4662709", "0.4662709", "0.46621913", "0.46577984", "0.46505603", "0.46450323", "0.46292964", "0.46246567", "0.46098745", "0.4601418", "0.4600628", "0.45933178", "0.4583196", "0.45791134", "0.45691663", "0.45664978", "0.45614722", "0.45614722", "0.45614722", "0.45563114", "0.45563114", "0.4552184", "0.45355713", "0.4535252", "0.45339245", "0.45337966", "0.4523598", "0.45212275", "0.45170602", "0.4509993", "0.4488898", "0.4484265", "0.44833797", "0.4482109", "0.44722262", "0.44603235", "0.44506913", "0.44447714", "0.4441548", "0.443662", "0.44045362", "0.4404362", "0.4397124", "0.4391449", "0.43769914", "0.43562138", "0.43540597", "0.4349229", "0.43491575", "0.43412474", "0.43320224", "0.43291304", "0.43214878", "0.43189156", "0.4302817", "0.43019804", "0.42923698", "0.42872527", "0.42807963", "0.42807963", "0.42804128", "0.42785606", "0.42774424", "0.4276407", "0.4269772", "0.4269688" ]
0.71257085
0
Sign returns: 1 if x 0 No distinction is made between +0 and 0. The result is undefined if x is a NaN value.
func (x *Big) Sign() int { if debug { x.validate() } if (x.IsFinite() && x.isZero()) || x.IsNaN(0) { return 0 } if x.form&signbit != 0 { return -1 } return 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func PositiveOrNull(x int32) int32 {\n\t// return (x & ((-x) >> 31))\n\treturn x & ^(x >> 31)\n}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func (x *Int) Sign() int {}", "func abs(x int64) int64 {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func FloatSign(x *big.Float,) int", "func SignInt(v int) int {\n\tif v < 0 {\n\t\treturn -1\n\t}\n\tif v > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func iAbs(x int) int { if x >= 0 { return x } else { return -x } }", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\tif x == 0 {\n\t\treturn 0 // return correctly abs(-0)\n\t}\n\treturn x\n}", "func Sign(x *big.Int) int {\n\treturn x.Sign()\n}", "func (x *Float) Signbit() bool {}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\tx = -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0{\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x > 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func abs(x int64) int64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (x *Rat) Sign() int {}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\r\n\tif x < 0 {\r\n\t\treturn -x\r\n\t}\r\n\treturn x\r\n}", "func SignInt32(x int32) int32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (x IntRange) justZero() bool {\n\treturn x[0] != nil && x[1] != nil && x[0].Sign() == 0 && x[1].Sign() == 0\n}", "func Abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func RatSign(x *big.Rat,) int", "func (p Point) Sign() (int64) {\n\tnum, _ :=strconv.Atoi(string(p.Val[len(p.Val)-1]))\n\ttempnum:= (int64(num)/128)\n\treturn tempnum\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func (g *Graph) Softsign(x Node) Node {\n\treturn g.NewOperator(fn.NewSoftsign(x), x)\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func sign() int {\n\ts := -1 + rand.Intn(2)\n\tif s == 0 {\n\t\ts++\n\t}\n\treturn s\n}", "func Abs(x int64) int64 {\n\ta := int64(x)\n\tif a < 0 {\n\t\treturn (-a)\n\t}\n\treturn (a)\n}", "func IsZero(x float64) bool {\n\treturn EQ(x, 0)\n}", "func FloatSignbit(x *big.Float,) bool", "func (x *Float) IsInf() bool {}", "func nonZeroToAllOnes(x uint32) uint32 {\n\treturn ((x - 1) >> 31) - 1\n}", "func nonZeroToAllOnes(x uint32) uint32 {\n\treturn ((x - 1) >> 31) - 1\n}", "func hasChangeOfSign(u, w float64) bool {\n\treturn (u < 0 && w > 0) || (u > 0 && w < 0)\n}", "func Abs(x int32) int32 {\n\t// Patented (!) : return (x ^ (x >> 31)) - (x >> 31)\n\treturn (x + (x >> 31)) ^ (x >> 31)\n}", "func (i Int) Sign() int {\n\treturn i.i.Sign()\n}", "func PSIGND(mx, x operand.Op) { ctx.PSIGND(mx, x) }", "func (this *unsignedFixed) zero() bool {\n\tm := this.mantissa\n\tresult := m == 0\n\treturn result\n}", "func IntSign(x *big.Int,) int", "func Zero(n float64) bool {\n\treturn NegEpsilon64 <= n && n <= Epsilon64\n}", "func (z *Int) Abs(x *Int) *Int {}", "func (z *Float) Neg(x *Float) *Float {}", "func (m *Money) Sign() int {\n\tif m.M < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func Copysign(x, y float32) float32 {\n\treturn float32(math.Copysign(float64(x), float64(y)))\n}", "func (q *Quantity) Sign() int {\n\tif q.d.Dec != nil {\n\t\treturn q.d.Dec.Sign()\n\t}\n\treturn q.i.Sign()\n}", "func (c *curve) coordSign(i *mod.Int) uint {\n\treturn i.V.Bit(0)\n}", "func Abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func abs(n int) int {\n if n > 0 {\n return n\n }\n\n return -n\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func Abs[T constraints.Number](x T) T {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func Sabs(x, eps float64) float64 {\n\ts := 0.0\n\tif x > 0.0 {\n\t\ts = 1.0\n\t} else if x < 0.0 {\n\t\ts = -1.0\n\t}\n\treturn x * x / (s*x + eps)\n}", "func (sp positiveRealSpace) Sup() float64 {\n\treturn math.Inf(+1)\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func abs(a int) int {\r\n if a < 0 {\r\n return -a\r\n }\r\n return a\r\n}", "func Sign(a int) int {\n\treturn neogointernal.Opcode1(\"SIGN\", a).(int)\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func PSIGNW(mx, x operand.Op) { ctx.PSIGNW(mx, x) }", "func (z *Float) Abs(x *Float) *Float {}", "func Signum[T ifs.NumberTypes](number T) int {\n\tif number < 0 {\n\t\treturn -1\n\t} else if number > 0 {\n\t\treturn 1\n\t} else {\n\t\treturn 0\n\t}\n}", "func (z *Int) Neg(x *Int) *Int {}", "func (this pos) Apply(x Any) Any {\n\t//return x.(int) > 0\n\treturn x.(Int).Gt(Zero{})\n}", "func FloorAtZero(x *float64) bool {\n\tif *x < 0 {\n\t\t*x = 0.0\n\t\treturn true\n\t}\n\treturn false\n}", "func Infinity() Point {\n\treturn Point{1, 0}\n}", "func (c Currency) Sign() int {\n\tif c.m < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func absInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func (i Int) IsZero() bool {\n\treturn i.i.Sign() == 0\n}", "func Inf32(sign int) float32 {\n\treturn float32(math.Inf(sign))\n}", "func ZeroSmall(x, y, epsilon float64) float64 {\n\tif Abs(x)/y < epsilon {\n\t\treturn 0\n\t}\n\treturn x\n}", "func Abs(operand int) int {\n\tif operand < 0 {\n\t\treturn operand * -1\n\t}\n\treturn operand\n}", "func Abs(v int) int {\n\tif v > 0 {\n\t\treturn v\n\t}\n\treturn -v\n}", "func (z *Int) Sgt(x *Int) bool {\n\tzSign := z.Sign()\n\txSign := x.Sign()\n\n\tswitch {\n\tcase zSign >= 0 && xSign < 0:\n\t\treturn true\n\tcase zSign < 0 && xSign >= 0:\n\t\treturn false\n\tdefault:\n\t\treturn z.Gt(x)\n\t}\n}", "func goAbs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x float32) float32 {\n\tux := *(*uint32)(unsafe.Pointer(&x)) & 0x7FFFFFFF\n\treturn *(*float32)(unsafe.Pointer(&ux))\n}" ]
[ "0.7989132", "0.75590163", "0.7203545", "0.70914", "0.70914", "0.7074754", "0.70662683", "0.6580768", "0.6564695", "0.6531949", "0.6505666", "0.64202595", "0.6416973", "0.63917357", "0.6371356", "0.6346127", "0.6341612", "0.63316786", "0.62732047", "0.6267306", "0.62441814", "0.6221001", "0.62152594", "0.6200743", "0.61877877", "0.61877877", "0.61877877", "0.6181978", "0.61751443", "0.61370885", "0.61370885", "0.61370885", "0.61370885", "0.61370885", "0.61370885", "0.61370885", "0.61370885", "0.6066404", "0.60541075", "0.60305315", "0.60215896", "0.5967765", "0.5959922", "0.59293383", "0.59260905", "0.59260905", "0.5922546", "0.5835758", "0.58308756", "0.5821084", "0.5798686", "0.5790654", "0.5790654", "0.5760544", "0.5750557", "0.57337654", "0.5715863", "0.5685045", "0.56695753", "0.5664159", "0.5644271", "0.5627953", "0.56268626", "0.5615968", "0.56120586", "0.55935377", "0.55842614", "0.5582593", "0.5577729", "0.55676997", "0.5564827", "0.556371", "0.55592954", "0.55453855", "0.5529387", "0.5528469", "0.5517981", "0.551391", "0.551391", "0.5506682", "0.54952246", "0.5492866", "0.5473537", "0.5471596", "0.5471269", "0.54675204", "0.54613817", "0.54586786", "0.54215086", "0.5408845", "0.5408845", "0.5408845", "0.54043126", "0.5402772", "0.53877175", "0.5384953", "0.5353142", "0.5346958", "0.5315724", "0.53132325" ]
0.6561281
9
Signbit reports whether x is negative, negative zero, negative infinity, or negative NaN.
func (x *Big) Signbit() bool { if debug { x.validate() } return x.form&signbit != 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (x *Float) Signbit() bool {}", "func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func FloatSignbit(x *big.Float,) bool", "func (f Float) Signbit() bool {\n\t// 0b1000000000000000\n\treturn f.se&0x8000 != 0\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func Signbit(a float64) bool {\n\treturn math.Signbit(float64(a))\n}", "func (x *Big) Sign() int {\n\tif debug {\n\t\tx.validate()\n\t}\n\n\tif (x.IsFinite() && x.isZero()) || x.IsNaN(0) {\n\t\treturn 0\n\t}\n\tif x.form&signbit != 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (f Float) Signbit() bool {\n\t// first bit is sign bit: 0b1000000000000000\n\treturn f.bits&0x8000 != 0\n}", "func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func SignFloat(x float32) float32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func FloatSign(x *big.Float,) int", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func (f Fixed) Sign() int {\n\tif f.IsNaN() {\n\t\treturn 0\n\t}\n\treturn f.Cmp(ZERO)\n}", "func calcSign(val float64) float64 {\n\tif val > 0 {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func Sign(x *big.Int) int {\n\treturn x.Sign()\n}", "func Sign(v float32) float32 {\n\tif v >= 0.0 {\n\t\treturn 1.0\n\t}\n\treturn -1.0\n}", "func Sign(x Value) int {\n\tif v, ok := x.(*ratVal); ok {\n\t\tx = v.Value\n\t}\n\treturn constant.Sign(x)\n}", "func (x *Big) IsInf(sign int) bool {\n\treturn sign >= 0 && x.form == pinf || sign <= 0 && x.form == ninf\n}", "func RatSign(x *big.Rat,) int", "func SignInt(v int) int {\n\tif v < 0 {\n\t\treturn -1\n\t}\n\tif v > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (z *Int) Sign() int {\n\tif z.IsZero() {\n\t\treturn 0\n\t}\n\tif z.Lt(SignedMin) {\n\t\treturn 1\n\t}\n\treturn -1\n}", "func (x *Int) Sign() int {}", "func (x *Big) IsFinite() bool { return x.form & ^signbit == 0 }", "func SignExtend(x *big.Int, n uint) *big.Int {\n\tsignBit := n - 1\n\t// single bit set at sign bit position\n\tmask := new(big.Int).Lsh(big1, signBit)\n\t// all bits below sign bit set to 1 all above (including sign bit) set to 0\n\tmask.Sub(mask, big1)\n\tif x.Bit(int(signBit)) == 1 {\n\t\t// Number represented is negative - set all bits above sign bit (including sign bit)\n\t\treturn x.Or(x, mask.Not(mask))\n\t} else {\n\t\t// Number represented is positive - clear all bits above sign bit (including sign bit)\n\t\treturn x.And(x, mask)\n\t}\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func (d Decimal) Sign() int {\n\tif d.value == nil {\n\t\treturn 0\n\t}\n\treturn d.value.Sign()\n}", "func IsNeg(x float64) bool {\n\treturn LT(x, 0)\n}", "func IntSign(x *big.Int,) int", "func (x *Float) IsInf() bool {}", "func (p Point) Sign() (int64) {\n\tnum, _ :=strconv.Atoi(string(p.Val[len(p.Val)-1]))\n\ttempnum:= (int64(num)/128)\n\treturn tempnum\n}", "func (x *Rat) Sign() int {}", "func Signbit32(x float32) bool {\n\treturn Float32bits(x)&(1<<31) != 0\n}", "func (z *Float) SetInf(signbit bool) *Float {}", "func IsInf(x complex128) bool {\n\tif math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {\n\t\treturn true\n\t}\n\treturn false\n}", "func IsSigned(t Type) bool {\n\treturn int(t)&(flagIsIntegral|flagIsUnsigned) == flagIsIntegral\n}", "func hasChangeOfSign(u, w float64) bool {\n\treturn (u < 0 && w > 0) || (u > 0 && w < 0)\n}", "func (x IntRange) justZero() bool {\n\treturn x[0] != nil && x[1] != nil && x[0].Sign() == 0 && x[1].Sign() == 0\n}", "func (c *curve) coordSign(i *mod.Int) uint {\n\treturn i.V.Bit(0)\n}", "func signExtend(v uint64, bit int) uint64 {\n\tb := signBits[bit]\n\tif v&b.signBit != 0 {\n\t\treturn v | b.ones\n\t}\n\treturn v\n}", "func (this *unsignedFixed) zero() bool {\n\tm := this.mantissa\n\tresult := m == 0\n\treturn result\n}", "func (v Value) IsSigned() bool {\n\treturn IsSigned(v.typ)\n}", "func (i Int) Sign() int {\n\treturn i.i.Sign()\n}", "func FloatIsInf(x *big.Float,) bool", "func (m *Money) Sign() int {\n\tif m.M < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (*BigInt) IsNegInf() bool {\n\treturn false\n}", "func (g *Graph) Softsign(x Node) Node {\n\treturn g.NewOperator(fn.NewSoftsign(x), x)\n}", "func IsInf(f float32, sign int) bool {\n\t// Test for infinity by comparing against maximum float.\n\t// To avoid the floating-point hardware, could use:\n\t//\t`x := Float32bits(f)`\n\t//\t`return sign >= 0 && x == uvinf || sign <= 0 && x == uvneginf`\n\treturn sign >= 0 && f > MaxFloat32 || sign <= 0 && f < -MaxFloat32\n}", "func SignInt32(x int32) int32 {\r\n\tif x > 0 {\r\n\t\treturn 1\r\n\t} else if x < 0 {\r\n\t\treturn -1\r\n\t} else {\r\n\t\treturn 0\r\n\t}\r\n}", "func IsZero(x float64) bool {\n\treturn EQ(x, 0)\n}", "func (z *Int) Sgt(x *Int) bool {\n\tzSign := z.Sign()\n\txSign := x.Sign()\n\n\tswitch {\n\tcase zSign >= 0 && xSign < 0:\n\t\treturn true\n\tcase zSign < 0 && xSign >= 0:\n\t\treturn false\n\tdefault:\n\t\treturn z.Gt(x)\n\t}\n}", "func Inf(sign int) float32 {\n\tvar v uint32\n\tif sign >= 0 {\n\t\tv = uvinf\n\t} else {\n\t\tv = uvneginf\n\t}\n\treturn Float32frombits(v)\n}", "func Signum[T ifs.NumberTypes](number T) int {\n\tif number < 0 {\n\t\treturn -1\n\t} else if number > 0 {\n\t\treturn 1\n\t} else {\n\t\treturn 0\n\t}\n}", "func Zero(n float64) bool {\n\treturn NegEpsilon64 <= n && n <= Epsilon64\n}", "func SignBit(out1 *uint1, arg1 *[3]uint64) {\n\tx1 := uint1((arg1[2] >> 63))\n\t*out1 = x1\n}", "func PositiveOrNull(x int32) int32 {\n\t// return (x & ((-x) >> 31))\n\treturn x & ^(x >> 31)\n}", "func IsFinite(f float64, sign int) bool {\n\n\treturn !math.IsInf(f, sign)\n}", "func (z *Float) Neg(x *Float) *Float {}", "func Copysign(x, y float32) float32 {\n\treturn float32(math.Copysign(float64(x), float64(y)))\n}", "func (c Currency) Sign() int {\n\tif c.m < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (z *Big) Neg(x *Big) *Big {\n\tif debug {\n\t\tx.validate()\n\t}\n\tif !z.invalidContext(z.Context) && !z.checkNaNs(x, x, negation) {\n\t\txform := x.form // copy in case z == x\n\t\tz.copyAbs(x)\n\t\tif !z.IsFinite() || z.compact != 0 || z.Context.RoundingMode == ToNegativeInf {\n\t\t\tz.form = xform ^ signbit\n\t\t}\n\t}\n\treturn z.Context.round(z)\n}", "func (i Int) IsZero() bool {\n\treturn i.i.Sign() == 0\n}", "func sign() int {\n\ts := -1 + rand.Intn(2)\n\tif s == 0 {\n\t\ts++\n\t}\n\treturn s\n}", "func (c curve) IsAtInfinity(X, Y *big.Int) bool {\n\treturn X.Sign() == 0 && Y.Sign() == 0\n}", "func FloatNeg(z *big.Float, x *big.Float,) *big.Float", "func (*BigInt) IsNaN() bool {\n\treturn false\n}", "func IsInf32(f float32, sign int) bool {\n\tx := Float32bits(f)\n\treturn sign >= 0 && x == uvinf32 || sign <= 0 && x == uvneginf32\n}", "func (n *Number) Zero() bool {\n\tif n.isInteger {\n\t\treturn n.integer.Cmp(&big.Int{}) == 0\n\t} else {\n\t\treturn n.floating == 0\n\t}\n}", "func (q *Quantity) Sign() int {\n\tif q.d.Dec != nil {\n\t\treturn q.d.Dec.Sign()\n\t}\n\treturn q.i.Sign()\n}", "func (sp booleanSpace) Inf() float64 {\n\treturn 0\n}", "func isNegativeInt(n *int) bool {\n\treturn n != nil && *n < 0\n}", "func (sp positiveRealSpace) Inf() float64 {\n\treturn 0\n}", "func iAbs(x int) int { if x >= 0 { return x } else { return -x } }", "func IsInfinite(f float64, sign int) bool {\n\n\treturn math.IsInf(f, sign)\n}", "func checkVar( x float64 ) bool {\n\n\tif x > 0 && x != math.Inf(-1) && x != math.Inf(1) {\n\n\t\treturn true\n\t}\n\treturn false\n}", "func Copysign(x, y float32) float32 {\n\tconst sign = 1 << 31\n\treturn math.Float32frombits(math.Float32bits(x)&^sign | math.Float32bits(y)&sign)\n}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func (Integer) IsNegInf() bool {\n\treturn false\n}", "func Sign(a int) int {\n\treturn neogointernal.Opcode1(\"SIGN\", a).(int)\n}", "func (f Float) IsZero() bool {\n\treturn !f.Valid\n}", "func (p *G1Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (f Float32) IsZero() bool {\n\treturn !f.Valid\n}", "func isPositive(num int) bool {\n\treturn num > 0\n}", "func SignExtend(x uint16, bitCount uint) uint16 {\n\tif ((x >> (bitCount - 1)) & 1) > 0 {\n\t\tx |= (0xFFFF << bitCount)\n\t}\n\treturn x\n}", "func abs(x int64) int64 {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format\n\t//\n\t// 0b000000000000001 - 0b111111111111110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-16383) * 1.mant_2\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b111111111111111\n\tcase 0x7FFF:\n\t\t// Inf or NaN\n\t\tif f.m == 0x8000000000000000 {\n\t\t\t// +-Inf\n\t\t\t// 10 zero\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\t// 10 non-zero\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b000000000000000\n\tcase 0x0000:\n\t\tif f.m == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-16382) * 0.mant_2\n\t\texponent = -16382\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\tlead := f.Lead()\n\tfrac := f.Frac()\n\ts := fmt.Sprintf(\"%s0b%d.%063bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func (x IntRange) ContainsNegative() bool {\n\tif x[0] == nil {\n\t\treturn true\n\t}\n\tif x[0].Sign() >= 0 {\n\t\treturn false\n\t}\n\treturn x[1] == nil || x[0].Cmp(x[1]) <= 0\n}", "func FloatSetInf(z *big.Float, signbit bool) *big.Float", "func (e Extrinsic) IsSigned() bool {\n\treturn e.Version&ExtrinsicBitSigned == ExtrinsicBitSigned\n}", "func (x *Big) IsNaN(quiet int) bool {\n\treturn quiet >= 0 && x.form&qnan == qnan || quiet <= 0 && x.form&snan == snan\n}", "func PSIGND(mx, x operand.Op) { ctx.PSIGND(mx, x) }", "func (z *Int) Neg(x *Int) *Int {}", "func (p *G2Affine) IsInfinity() bool {\n\treturn p.X.IsZero() && p.Y.IsZero()\n}", "func (f Frac) IsZero() bool {\n\treturn f.n == 0\n}", "func PSIGNB(mx, x operand.Op) { ctx.PSIGNB(mx, x) }", "func (f Float) Big() (x *big.Float, nan bool) {\n\tsignbit := f.Signbit()\n\texp := f.Exp()\n\tfrac := f.Frac()\n\tx = big.NewFloat(0)\n\tx.SetPrec(precision)\n\tx.SetMode(big.ToNearestEven)\n\n\t// ref: https://en.wikipedia.org/wiki/Half-precision_floating-point_format#Exponent_encoding\n\t//\n\t// 0b00001 - 0b11110\n\t// Normalized number.\n\t//\n\t// (-1)^signbit * 2^(exp-15) * 1.mant_2\n\tlead := 1\n\texponent := exp - bias\n\n\tswitch exp {\n\t// 0b11111\n\tcase 0x1F:\n\t\t// Inf or NaN\n\t\tif frac == 0 {\n\t\t\t// +-Inf\n\t\t\tx.SetInf(signbit)\n\t\t\treturn x, false\n\t\t}\n\t\t// +-NaN\n\t\tif signbit {\n\t\t\tx.Neg(x)\n\t\t}\n\t\treturn x, true\n\t// 0b00000\n\tcase 0x00:\n\t\tif frac == 0 {\n\t\t\t// +-Zero\n\t\t\tif signbit {\n\t\t\t\tx.Neg(x)\n\t\t\t}\n\t\t\treturn x, false\n\t\t}\n\t\t// Denormalized number.\n\t\t//\n\t\t// (-1)^signbit * 2^(-14) * 0.mant_2\n\t\tlead = 0\n\t\texponent = -14\n\t}\n\n\t// number = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .\n\tsign := \"+\"\n\tif signbit {\n\t\tsign = \"-\"\n\t}\n\ts := fmt.Sprintf(\"%s0b%d.%010bp%d\", sign, lead, frac, exponent)\n\tif _, _, err := x.Parse(s, 0); err != nil {\n\t\tpanic(err)\n\t}\n\treturn x, false\n}", "func (i NullInt) IsZero() bool {\n\treturn !i.Valid\n}", "func nonZeroToAllOnes(x uint32) uint32 {\n\treturn ((x - 1) >> 31) - 1\n}", "func nonZeroToAllOnes(x uint32) uint32 {\n\treturn ((x - 1) >> 31) - 1\n}", "func IsInf32(f float32, sign int) bool {\n\treturn math.IsInf(float64(f), sign)\n}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\tx = -x\n\t}\n\treturn x\n}" ]
[ "0.77398324", "0.7594668", "0.74128157", "0.7371722", "0.7361564", "0.7361564", "0.7284012", "0.72452277", "0.71969754", "0.6993791", "0.68733305", "0.6861012", "0.6861012", "0.68431103", "0.66814494", "0.66291636", "0.63777107", "0.6142583", "0.61321634", "0.6102929", "0.60692453", "0.6067799", "0.60023427", "0.5967364", "0.5936848", "0.5936848", "0.59104043", "0.5907155", "0.5830463", "0.58258176", "0.58252716", "0.5824433", "0.5808874", "0.5788711", "0.5739812", "0.5691771", "0.56906927", "0.5677402", "0.5670512", "0.56701416", "0.5665786", "0.56632775", "0.5625105", "0.56098264", "0.5594797", "0.5590807", "0.5585335", "0.5578643", "0.5577875", "0.5576222", "0.5570133", "0.5562179", "0.55450165", "0.55229837", "0.55070126", "0.55055416", "0.5495689", "0.54768217", "0.5467798", "0.54649764", "0.54639536", "0.5455543", "0.5446513", "0.5409567", "0.5380804", "0.5358736", "0.53518593", "0.5347679", "0.53373426", "0.53372806", "0.5332181", "0.5315342", "0.5304555", "0.52810097", "0.52702355", "0.52627456", "0.5254607", "0.52482265", "0.52456933", "0.5212242", "0.5208855", "0.52045065", "0.51961553", "0.5195849", "0.51919854", "0.51803523", "0.5171955", "0.5170353", "0.5151543", "0.51400536", "0.5137655", "0.5129295", "0.51210064", "0.5113593", "0.5112046", "0.51119864", "0.5094072", "0.5094072", "0.5091915", "0.507837" ]
0.68379724
14
String returns the string representation of x. It's equivalent to the %s verb discussed in the Format method's documentation. Special cases depend on the OperatingMode.
func (x *Big) String() string { if x == nil { return "<nil>" } var ( b = new(strings.Builder) f = formatter{w: b, prec: x.Precision(), width: noWidth} e = sciE[x.Context.OperatingMode] ) b.Grow(x.Precision()) f.format(x, normal, e) return b.String() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (nims *NetInterfaceModeSelect) StringX(ctx context.Context) string {\n\tv, err := nims.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (nimgb *NetInterfaceModeGroupBy) StringX(ctx context.Context) string {\n\tv, err := nimgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rrs *ReserveRoomSelect) StringX(ctx context.Context) string {\n\tv, err := rrs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (irs *InstanceRuntimeSelect) StringX(ctx context.Context) string {\n\tv, err := irs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rrgb *ReserveRoomGroupBy) StringX(ctx context.Context) string {\n\tv, err := rrgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x Type) String() string {\n\treturn fmt.Sprintf(\"%#x.%08x\", int32(x>>int32Size), uint32(x))\n}", "func (goas *GroupOfAgeSelect) StringX(ctx context.Context) string {\n\tv, err := goas.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ous *OrgUnitSelect) StringX(ctx context.Context) string {\n\tv, err := ous.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ess *EventSeveritySelect) StringX(ctx context.Context) string {\n\tv, err := ess.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (irgb *InstanceRuntimeGroupBy) StringX(ctx context.Context) string {\n\tv, err := irgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ss *ServerSelect) StringX(ctx context.Context) string {\n\tv, err := ss.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (vs *VehicleSelect) StringX(ctx context.Context) string {\n\tv, err := vs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (gs *GoodsSelect) StringX(ctx context.Context) string {\n\tv, err := gs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rs *RentSelect) StringX(ctx context.Context) string {\n\tv, err := rs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wfgb *WithFieldsGroupBy) StringX(ctx context.Context) string {\n\tv, err := wfgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (s *selector) StringX(ctx context.Context) string {\n\tv, err := s.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wfs *WithFieldsSelect) StringX(ctx context.Context) string {\n\tv, err := wfs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ros *RestaurantOwnerSelect) StringX(ctx context.Context) string {\n\tv, err := ros.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rs *ReceiptSelect) StringX(ctx context.Context) string {\n\tv, err := rs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wgb *WifiGroupBy) StringX(ctx context.Context) string {\n\tv, err := wgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (nss *NamespaceSecretSelect) StringX(ctx context.Context) string {\n\tv, err := nss.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ws *WifiSelect) StringX(ctx context.Context) string {\n\tv, err := ws.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (fds *FurnitureDetailSelect) StringX(ctx context.Context) string {\n\tv, err := fds.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (hs *HarborSelect) StringX(ctx context.Context) string {\n\tv, err := hs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (vgb *VehicleGroupBy) StringX(ctx context.Context) string {\n\tv, err := vgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (fdgb *FurnitureDetailGroupBy) StringX(ctx context.Context) string {\n\tv, err := fdgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rgb *ReceiptGroupBy) StringX(ctx context.Context) string {\n\tv, err := rgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (lus *LastUpdatedSelect) StringX(ctx context.Context) string {\n\tv, err := lus.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ougb *OrgUnitGroupBy) StringX(ctx context.Context) string {\n\tv, err := ougb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (fs *ForumSelect) StringX(ctx context.Context) string {\n\tv, err := fs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (degb *DentalExpenseGroupBy) StringX(ctx context.Context) string {\n\tv, err := degb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (dagb *DrugAllergyGroupBy) StringX(ctx context.Context) string {\n\tv, err := dagb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rls *RuleLimitSelect) StringX(ctx context.Context) string {\n\tv, err := rls.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rgb *RentGroupBy) StringX(ctx context.Context) string {\n\tv, err := rgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x XID) String() string {\n\tdst := make([]byte, 20)\n\tx.encode(dst)\n\treturn b2s(dst)\n}", "func (ecps *EntityContactPointSelect) StringX(ctx context.Context) string {\n\tv, err := ecps.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (goagb *GroupOfAgeGroupBy) StringX(ctx context.Context) string {\n\tv, err := goagb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (lbs *LatestBlockSelect) StringX(ctx context.Context) string {\n\tv, err := lbs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (esgb *EventSeverityGroupBy) StringX(ctx context.Context) string {\n\tv, err := esgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rogb *RestaurantOwnerGroupBy) StringX(ctx context.Context) string {\n\tv, err := rogb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x Kind) String() string {\n\tif str, ok := _KindMap[x]; ok {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"Kind(%d)\", x)\n}", "func (wews *WorkflowEventsWaitSelect) StringX(ctx context.Context) string {\n\tv, err := wews.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (uls *UserLogSelect) StringX(ctx context.Context) string {\n\tv, err := uls.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (lbgb *LatestBlockGroupBy) StringX(ctx context.Context) string {\n\tv, err := lbgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\n}", "func (des *DentalExpenseSelect) StringX(ctx context.Context) string {\n\tv, err := des.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func X(x string) {\n\tfmt.Println(x)\n}", "func (kss *KqiSourceSelect) StringX(ctx context.Context) string {\n\tv, err := kss.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func ToString(ctx context.Context,\n\tscope Scope, x interface{}) string {\n\tswitch t := x.(type) {\n\tcase fmt.Stringer:\n\t\treturn t.String()\n\n\t\t// Reduce any LazyExpr to materialized types\n\tcase LazyExpr:\n\t\treturn ToString(ctx, scope, t.Reduce(ctx))\n\n\tcase Materializer:\n\t\treturn ToString(ctx, scope, t.Materialize(ctx, scope))\n\n\t\t// Materialize stored queries into an array.\n\tcase StoredQuery:\n\t\treturn ToString(ctx, scope, Materialize(ctx, scope, t))\n\n\t\t// A dict may expose a callable as a member - we just\n\t\t// call it lazily if it is here.\n\tcase func() Any:\n\t\treturn ToString(ctx, scope, t())\n\n\tcase StringProtocol:\n\t\treturn t.ToString(scope)\n\n\tcase string:\n\t\treturn t\n\n\tcase *string:\n\t\treturn *t\n\n\tcase []byte:\n\t\treturn string(t)\n\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", t)\n\t}\n}", "func (x Number) String() string {\n\tif str, ok := _NumberMap[x]; ok {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"Number(%d)\", x)\n}", "func (ps *ParticipantSelect) StringX(ctx context.Context) string {\n\tv, err := ps.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wgb *WorkflowGroupBy) StringX(ctx context.Context) string {\n\tv, err := wgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (nsgb *NamespaceSecretGroupBy) StringX(ctx context.Context) string {\n\tv, err := nsgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ws *WorkflowSelect) StringX(ctx context.Context) string {\n\tv, err := ws.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (sgb *ServerGroupBy) StringX(ctx context.Context) string {\n\tv, err := sgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rlgb *RuleLimitGroupBy) StringX(ctx context.Context) string {\n\tv, err := rlgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ggb *GoodsGroupBy) StringX(ctx context.Context) string {\n\tv, err := ggb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func ToString(x string) string {\n\treturn string(x)\n}", "func (rs *RemedySelect) StringX(ctx context.Context) string {\n\tv, err := rs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (fgb *ForumGroupBy) StringX(ctx context.Context) string {\n\tv, err := fgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ulgb *UserLogGroupBy) StringX(ctx context.Context) string {\n\tv, err := ulgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wewgb *WorkflowEventsWaitGroupBy) StringX(ctx context.Context) string {\n\tv, err := wewgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (lugb *LastUpdatedGroupBy) StringX(ctx context.Context) string {\n\tv, err := lugb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (das *DrugAllergySelect) StringX(ctx context.Context) string {\n\tv, err := das.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ksgb *KqiSourceGroupBy) StringX(ctx context.Context) string {\n\tv, err := ksgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (pggb *PlayGroupGroupBy) StringX(ctx context.Context) string {\n\tv, err := pggb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (pgs *PlayGroupSelect) StringX(ctx context.Context) string {\n\tv, err := pgs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (v Version) String() string {\n\ts := strconv.Itoa(v.Major) + \".\" + strconv.Itoa(v.Minor)\n\tif v.Patch > 0 {\n\t\ts += \".\" + strconv.Itoa(v.Patch)\n\t}\n\tif v.PreRelease != \"\" {\n\t\ts += v.PreRelease\n\t}\n\n\treturn s\n}", "func (oups *OrgUnitPositionSelect) StringX(ctx context.Context) string {\n\tv, err := oups.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x ContextKey) String() string {\n\tif str, ok := _ContextKeyMap[x]; ok {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"ContextKey(%d)\", x)\n}", "func (bgb *BrowserGroupBy) StringX(ctx context.Context) string {\n\tv, err := bgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (v Version) String() string {\n\tvs := fmt.Sprintf(\"%d.%d.%d\", v.major, v.minor, v.patch)\n\tif len(v.preRelease) > 0 {\n\t\tvs += \"-\" + v.PreRelease()\n\t}\n\tif len(v.metadata) > 0 {\n\t\tvs += Metadata + v.Metadata()\n\t}\n\treturn vs\n}", "func exprString(x ebnf.Expression) string {\n\tswitch x := x.(type) {\n\tcase *ebnf.Production:\n\t\treturn fmt.Sprintf(\"%v = %v .\", exprString(x.Name), exprString(x.Expr))\n\tcase ebnf.Alternative:\n\t\tbuf := strings.Builder{}\n\t\tfor i, e := range x {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(\" | \")\n\t\t\t}\n\t\t\tbuf.WriteString(exprString(e))\n\t\t}\n\t\treturn buf.String()\n\tcase ebnf.Sequence:\n\t\tbuf := strings.Builder{}\n\t\tfor i, e := range x {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteString(\" \")\n\t\t\t}\n\t\t\tbuf.WriteString(exprString(e))\n\t\t}\n\t\treturn buf.String()\n\tcase *ebnf.Name:\n\t\treturn x.String\n\tcase *ebnf.Token:\n\t\treturn fmt.Sprintf(\"%q\", x.String)\n\tcase *ebnf.Range:\n\t\treturn fmt.Sprintf(\"%v … %v\", exprString(x.Begin), exprString(x.End))\n\tcase *ebnf.Group:\n\t\treturn fmt.Sprintf(\"( %v )\", exprString(x.Body))\n\tcase *ebnf.Option:\n\t\treturn fmt.Sprintf(\"[ %v ]\", exprString(x.Body))\n\tcase *ebnf.Repetition:\n\t\treturn fmt.Sprintf(\"{ %v }\", exprString(x.Body))\n\tdefault:\n\t\tpanic(fmt.Errorf(\"support for expression %T not yet implemented\", x))\n\t}\n}", "func (igs *ItemGroupSelect) StringX(ctx context.Context) string {\n\tv, err := igs.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (rgb *RemedyGroupBy) StringX(ctx context.Context) string {\n\tv, err := rgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (v IPVSVersion) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (ms *StatusImpl) String() string {\n\tms.mutex.Lock()\n\tdefer ms.mutex.Unlock()\n\n\treturn fmt.Sprintf(\"State=%s, Context=%d, Sys=%t\", ms.state, ms.context, ms.systemChannel)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (hgb *HarborGroupBy) StringX(ctx context.Context) string {\n\tv, err := hgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x EnvironmentType) String() string {\n\tif str, ok := _EnvironmentTypeMap[x]; ok {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"EnvironmentType(%d)\", x)\n}", "func (wgb *WidgetGroupBy) StringX(ctx context.Context) string {\n\tv, err := wgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (oupgb *OrgUnitPositionGroupBy) StringX(ctx context.Context) string {\n\tv, err := oupgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (s stamp) String() string {\n\tv := strings.Join(\n\t\t[]string{\n\t\t\tstrconv.Itoa(major),\n\t\t\tstrconv.Itoa(minor),\n\t\t\tstrconv.Itoa(patch),\n\t\t},\n\t\t\".\",\n\t)\n\tif prerelease != \"\" {\n\t\tv = fmt.Sprintf(\"%s-%s\", v, prerelease)\n\t}\n\treturn v\n}", "func (wtgb *WorkerTypeGroupBy) StringX(ctx context.Context) string {\n\tv, err := wtgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (wts *WorkerTypeSelect) StringX(ctx context.Context) string {\n\tv, err := wts.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (pgb *ParticipantGroupBy) StringX(ctx context.Context) string {\n\tv, err := pgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ecpgb *EntityContactPointGroupBy) StringX(ctx context.Context) string {\n\tv, err := ecpgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (es *EntitySelect) StringX(ctx context.Context) string {\n\tv, err := es.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (os OS) String() string {\n\treturn fmt.Sprintf(\"%s:%s\", os.Vendor, os.Version)\n}", "func (p *Platform) String() string {\n\treturn fmt.Sprintf(\"GoOS: %v, Kernel: %v, Core: %v, Platform: %v, OS: %v, Hostname: %v, CPUs: %v\",\n\t\tp.GoOS, p.Kernel, p.Core, p.Platform, p.OS, p.Hostname, p.CPUs)\n}", "func (wgb *WordGroupBy) StringX(ctx context.Context) string {\n\tv, err := wgb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (sigb *SubItemGroupBy) StringX(ctx context.Context) string {\n\tv, err := sigb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (iggb *ItemGroupGroupBy) StringX(ctx context.Context) string {\n\tv, err := iggb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (s OS) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (x ForeignKeyReference_Action) String() string {\n\tswitch x {\n\tcase ForeignKeyReference_RESTRICT:\n\t\treturn \"RESTRICT\"\n\tcase ForeignKeyReference_SET_DEFAULT:\n\t\treturn \"SET DEFAULT\"\n\tcase ForeignKeyReference_SET_NULL:\n\t\treturn \"SET NULL\"\n\tcase ForeignKeyReference_CASCADE:\n\t\treturn \"CASCADE\"\n\tdefault:\n\t\treturn strconv.Itoa(int(x))\n\t}\n}", "func (egb *EntityGroupBy) StringX(ctx context.Context) string {\n\tv, err := egb.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (x Group) String() string {\n\tif str, ok := _GroupMap[x]; ok {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"Group(%d)\", x)\n}", "func (ws *WidgetSelect) StringX(ctx context.Context) string {\n\tv, err := ws.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (kls *K8sLabelSelect) StringX(ctx context.Context) string {\n\tv, err := kls.String(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}" ]
[ "0.67269456", "0.66737294", "0.64220047", "0.64161074", "0.6334801", "0.62773335", "0.6265041", "0.6250889", "0.62411124", "0.62329996", "0.622916", "0.6224346", "0.622223", "0.62054604", "0.62054104", "0.62021345", "0.61967856", "0.6195242", "0.61898804", "0.61781365", "0.6160492", "0.6159669", "0.61549366", "0.61534464", "0.61482275", "0.6142421", "0.6125438", "0.61242795", "0.6123954", "0.61068314", "0.6098653", "0.60949945", "0.6090331", "0.6084282", "0.6074819", "0.6073602", "0.6069754", "0.60697305", "0.6061166", "0.6051385", "0.60434014", "0.60409665", "0.6037907", "0.60196847", "0.6017259", "0.60110885", "0.6010152", "0.60083", "0.6005089", "0.6003593", "0.600017", "0.59972847", "0.5981594", "0.596387", "0.5960318", "0.5953689", "0.5951888", "0.59465426", "0.5931472", "0.5924322", "0.5923095", "0.59211344", "0.5910598", "0.5905245", "0.59007895", "0.5896813", "0.58913004", "0.58849007", "0.58829033", "0.5879151", "0.5874321", "0.58732224", "0.587111", "0.58640814", "0.58545816", "0.58489305", "0.5847847", "0.5847629", "0.5847629", "0.5846617", "0.58409554", "0.5836697", "0.58348006", "0.58334255", "0.5826777", "0.5818005", "0.5810711", "0.58104324", "0.5796768", "0.5792367", "0.5786508", "0.57838964", "0.57838416", "0.5760035", "0.5760027", "0.57559276", "0.5754206", "0.57516915", "0.57514614", "0.5742494" ]
0.630778
5
Sub sets z to x y and returns z.
func (z *Big) Sub(x, y *Big) *Big { return z.Context.Sub(z, x, y) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sub(z, x, y *Elt)", "func (v *Vec3i) SetSub(other Vec3i) {\n\tv.X -= other.X\n\tv.Y -= other.Y\n\tv.Z -= other.Z\n}", "func (z *Int) Sub(x, y *Int) *Int {}", "func (v Vec3i) Sub(other Vec3i) Vec3i {\n\treturn Vec3i{v.X - other.X, v.Y - other.Y, v.Z - other.Z}\n}", "func (u *Vec3) Sub(v *Vec3) *Vec3 {\n\ts := Vec3{\n\t\tu.X - v.X,\n\t\tu.Y - v.Y,\n\t\tu.Z - v.Z,\n\t}\n\treturn &s\n}", "func (v Vec3) Sub(v2 Vec3) Vec3 {\n\treturn Vec3{X: v.X - v2.X, Y: v.Y - v2.Y, Z: v.Z - v2.Z}\n}", "func (v Vector3D) Sub(other Vector3D) Vector3D {\n\treturn Vector3D{\n\t\tx: v.x - other.x,\n\t\ty: v.y - other.y,\n\t\tz: v.z - other.z,\n\t}\n}", "func RatSub(z *big.Rat, x, y *big.Rat,) *big.Rat", "func (v1 Vec3) Sub(v2 Vec3) *Vec3 {\n\treturn &Vec3{e: [3]float32{v1.X() - v2.X(), v1.Y() - v2.Y(), v1.Z() - v2.Z()}}\n}", "func (z *E12) Sub(x, y *E12) *E12 {\n\tz.C0.Sub(&x.C0, &y.C0)\n\tz.C1.Sub(&x.C1, &y.C1)\n\treturn z\n}", "func (p Vector3) Sub(o Vector3) Vector3 {\n\treturn Vector3{p.X - o.X, p.Y - o.Y, p.Z - o.Z}\n}", "func FloatSub(z *big.Float, x, y *big.Float,) *big.Float", "func (z *Float64) Sub(x, y *Float64) *Float64 {\n\tz.l = x.l - y.l\n\tz.r = x.r - y.r\n\treturn z\n}", "func (p *Point) Sub(p2 Point) {\n\tp.X -= p2.X\n\tp.Y -= p2.Y\n\tp.Z -= p2.Z\n}", "func (z *E6) Sub(x, y *E6) *E6 {\n\tz.B0.Sub(&x.B0, &y.B0)\n\tz.B1.Sub(&x.B1, &y.B1)\n\tz.B2.Sub(&x.B2, &y.B2)\n\treturn z\n}", "func IntSub(z *big.Int, x, y *big.Int,) *big.Int", "func (v Vec3) Sub(w Vec3) Vec3 {\n\treturn Vec3{v[0] - w[0], v[1] - w[1], v[2] - w[2]}\n}", "func (z *Rat) Sub(x, y *Rat) *Rat {}", "func (z *BiComplex) Sub(x, y *BiComplex) *BiComplex {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "func (p Point3) Sub(ps ...Point3) Point3 {\n\tfor _, p2 := range ps {\n\t\tp[0] -= p2[0]\n\t\tp[1] -= p2[1]\n\t\tp[2] -= p2[2]\n\t}\n\treturn p\n}", "func (z *Int) Sub(x, y *Int) {\n\tvar underflow bool\n\n\tz[0], underflow = u64Sub(x[0], y[0], underflow)\n\tz[1], underflow = u64Sub(x[1], y[1], underflow)\n\tz[2], underflow = u64Sub(x[2], y[2], underflow)\n\tif underflow {\n\t\tz[3] = x[3] - y[3] - 1\n\t} else {\n\t\tz[3] = x[3] - y[3]\n\t}\n}", "func (u Vec) Sub(v Vec) Vec {\n\treturn Vec{\n\t\tu.X - v.X,\n\t\tu.Y - v.Y,\n\t}\n}", "func (t *Tuple) Sub(o *Tuple) *Tuple {\n\treturn &Tuple{\n\t\tt.x - o.x,\n\t\tt.y - o.y,\n\t\tt.z - o.z,\n\t\tt.w - o.w,\n\t}\n\n}", "func (v Vec2) Sub(x Vec2) Vec2 {\n\treturn Vec2{v[0] - x[0], v[1] - x[1]}\n}", "func (z fermat) Sub(x, y fermat) fermat {\n\tif len(z) != len(x) {\n\t\tpanic(\"Add: len(z) != len(x)\")\n\t}\n\tn := len(y) - 1\n\tb := subVV(z[:n], x[:n], y[:n])\n\tb += y[n]\n\t// If b > 0, we need to subtract b<<n, which is the same as adding b.\n\tz[n] = x[n]\n\tif z[0] <= ^big.Word(0)-b {\n\t\tz[0] += b\n\t} else {\n\t\taddVW(z, z, b)\n\t}\n\tz.norm()\n\treturn z\n}", "func (v Vec) Sub(other Vec) Vec {\n\treturn v.Copy().SubBy(other)\n}", "func (v *V) Sub(x *V) *V {\n\tif !IsVSameShape(x, v) {\n\t\tpanic(ErrShape)\n\t}\n\tfor i, e := range x.Data {\n\t\tv.Data[i] -= e\n\t}\n\treturn v\n}", "func (x Dec) Sub(y Dec) (Dec, error) {\n\tvar z Dec\n\t_, err := apd.BaseContext.Sub(&z.dec, &x.dec, &y.dec)\n\treturn z, errorsmod.Wrap(err, \"decimal subtraction error\")\n}", "func (t Torus) Sub(a, b Point) Point {\n\ta, b = t.normPair(a, b)\n\treturn a.Sub(b)\n}", "func (v1 *Vec) Sub(v2 *Vec) *Vec {\n\treturn Sub(v1, v2)\n}", "func (q Quat) Sub(other Quat) Quat {\n\treturn Quat{q.W - other.W, q.X - other.X, q.Y - other.Y, q.Z - other.Z}\n}", "func (p Point) Sub(q Point) Point { return Point{p.X - q.X, p.Y - q.Y} }", "func (v Vec2) Sub(other Vec2) Vec2 {\n\treturn Vec2{v.X - other.X, v.Y - other.Y}\n}", "func (t Tuple) Sub(o Tuple) Tuple {\n\tif t.IsVector() && o.IsPoint() {\n\t\tpanic(\"cannot subtract point from vector\")\n\t}\n\treturn Tuple{t.X - o.X, t.Y - o.Y, t.Z - o.Z, t.W - o.W}\n}", "func (p Point) Sub(q Point) Point {\n\treturn Point{p.X - q.X, p.Y - q.Y}\n}", "func (p Point) Sub(q Point) Point {\n\treturn Point{p.X - q.X, p.Y - q.Y}\n}", "func (p Point) Sub(q Point) Point {\n\treturn Point{X: p.X - q.X, Y: p.Y - q.Y}\n}", "func (z *InfraHamilton) Sub(x, y *InfraHamilton) *InfraHamilton {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "func (z *Perplex) Sub(x, y *Perplex) *Perplex {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "func (v Posit8x4) Sub(x Posit8x4) Posit8x4 {\n\tout := Posit8x4{impl: make([]Posit8, 4)}\n\tfor i, posit := range v.impl {\n\t\tout.impl[i] = posit.Sub(x.impl[i])\n\t}\n\treturn out\n}", "func Sub(cX, cY *ristretto.Point) ristretto.Point {\n\tvar subPoint ristretto.Point\n\tsubPoint.Sub(cX, cY)\n\treturn subPoint\n}", "func Vec3Sub(a, b Vec3) (v Vec3) {\n\tv[0] = a[0] - b[0]\n\tv[1] = a[1] - b[1]\n\tv[2] = a[2] - b[2]\n\n\treturn\n}", "func (a Vec2) Sub(b Vec2) Vec2 {\n\treturn Vec2{a.X - b.X, a.Y - b.Y}\n}", "func (p *Point) Sub(to *Point) *Point {\n\treturn &Point{p.X - to.X, p.Y - to.Y}\n}", "func (p Point2) Sub(ps ...Point2) Point2 {\n\tfor _, p2 := range ps {\n\t\tp[0] -= p2[0]\n\t\tp[1] -= p2[1]\n\t}\n\treturn p\n}", "func (x IntRange) Sub(y IntRange) (z IntRange) {\n\tif x.Empty() || y.Empty() {\n\t\treturn makeEmptyRange()\n\t}\n\tif x[0] != nil && y[1] != nil && (x[1] != nil || y[0] != nil) {\n\t\tz[0] = big.NewInt(0).Sub(x[0], y[1])\n\t}\n\tif x[1] != nil && y[0] != nil && (x[0] != nil || y[1] != nil) {\n\t\tz[1] = big.NewInt(0).Sub(x[1], y[0])\n\t}\n\treturn z\n}", "func (n *bigNumber) sub(x *bigNumber, y *bigNumber) *bigNumber {\n\treturn n.subRaw(x, y).bias(2).weakReduce()\n}", "func (v Vector) Sub(o Vector) *Vector {\n\treturn &Vector{v[0] - o[0], v[1] - o[1], v[2] - o[2]}\n}", "func (u UDim) Sub(v UDim) UDim {\n\treturn UDim{\n\t\tScale: u.Scale - v.Scale,\n\t\tOffset: u.Offset - v.Offset,\n\t}\n}", "func Sub(x, y *Money) *Money {\n\tz := Money{}\n\treturn &z\n}", "func (v *Vec3i) SetSubScalar(s int32) {\n\tv.X -= s\n\tv.Y -= s\n\tv.Z -= s\n}", "func (b *Slice) Sub(top, bot int) *Slice {\n\tif top < 0 || bot < top {\n\t\treturn nil\n\t}\n\treturn &Slice{\n\t\tbuffer: b.buffer,\n\t\ttop: b.top + top,\n\t\tbot: b.top + bot,\n\t\tcap: b.cap,\n\t}\n}", "func (ec *ECPoint) Sub(first, second *ECPoint) *ECPoint {\n\tec.checkNil()\n\tif first.Equal(second) {\n\t\tec.X = big.NewInt(0)\n\t\tec.Y = big.NewInt(0)\n\t\tec.Curve = first.Curve\n\t\treturn ec\n\t}\n\tnegation := new(ECPoint).Negation(second)\n\tec.X, ec.Y = first.Curve.Add(negation.X, negation.Y, first.X, first.Y)\n\tec.Curve = first.Curve\n\n\treturn ec\n}", "func (p Point) Sub(other Point) Point {\n\treturn Pt(p.X-other.X, p.Y-other.Y)\n}", "func Sub(scope *Scope, x tf.Output, y tf.Output) (z tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Sub\",\n\t\tInput: []tf.Input{\n\t\t\tx, y,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (p *Int64) Sub(q, r *Int64) *Int64 {\n\tx := new(Int64).Set(q)\n\ty := new(Int64).Set(r)\n\tz := NewInt64()\n\tfor n, a := range x.c {\n\t\tif b, ok := y.Coeff(n); ok {\n\t\t\tz.SetCoeff(n, a-b)\n\t\t} else {\n\t\t\tz.SetCoeff(n, a)\n\t\t}\n\t}\n\tfor n, b := range y.c {\n\t\tif _, ok := x.Coeff(n); !ok {\n\t\t\tz.SetCoeff(n, -b)\n\t\t}\n\t}\n\treturn p.Set(z)\n}", "func (z *Element22) Sub(x, y *Element22) *Element22 {\n\tvar b uint64\n\tz[0], b = bits.Sub64(x[0], y[0], 0)\n\tz[1], b = bits.Sub64(x[1], y[1], b)\n\tz[2], b = bits.Sub64(x[2], y[2], b)\n\tz[3], b = bits.Sub64(x[3], y[3], b)\n\tz[4], b = bits.Sub64(x[4], y[4], b)\n\tz[5], b = bits.Sub64(x[5], y[5], b)\n\tz[6], b = bits.Sub64(x[6], y[6], b)\n\tz[7], b = bits.Sub64(x[7], y[7], b)\n\tz[8], b = bits.Sub64(x[8], y[8], b)\n\tz[9], b = bits.Sub64(x[9], y[9], b)\n\tz[10], b = bits.Sub64(x[10], y[10], b)\n\tz[11], b = bits.Sub64(x[11], y[11], b)\n\tz[12], b = bits.Sub64(x[12], y[12], b)\n\tz[13], b = bits.Sub64(x[13], y[13], b)\n\tz[14], b = bits.Sub64(x[14], y[14], b)\n\tz[15], b = bits.Sub64(x[15], y[15], b)\n\tz[16], b = bits.Sub64(x[16], y[16], b)\n\tz[17], b = bits.Sub64(x[17], y[17], b)\n\tz[18], b = bits.Sub64(x[18], y[18], b)\n\tz[19], b = bits.Sub64(x[19], y[19], b)\n\tz[20], b = bits.Sub64(x[20], y[20], b)\n\tz[21], b = bits.Sub64(x[21], y[21], b)\n\tif b != 0 {\n\t\tvar c uint64\n\t\tz[0], c = bits.Add64(z[0], 9062599614324828209, 0)\n\t\tz[1], c = bits.Add64(z[1], 952425709649632109, c)\n\t\tz[2], c = bits.Add64(z[2], 13987751354083916656, c)\n\t\tz[3], c = bits.Add64(z[3], 9476693002504986527, c)\n\t\tz[4], c = bits.Add64(z[4], 17899356805776864267, c)\n\t\tz[5], c = bits.Add64(z[5], 2607080593922027197, c)\n\t\tz[6], c = bits.Add64(z[6], 6852504016717314360, c)\n\t\tz[7], c = bits.Add64(z[7], 366248478184989226, c)\n\t\tz[8], c = bits.Add64(z[8], 2672987780203805083, c)\n\t\tz[9], c = bits.Add64(z[9], 14115032483094903896, c)\n\t\tz[10], c = bits.Add64(z[10], 8062699450825609015, c)\n\t\tz[11], c = bits.Add64(z[11], 8413249848292746549, c)\n\t\tz[12], c = bits.Add64(z[12], 11172154229712803058, c)\n\t\tz[13], c = bits.Add64(z[13], 18137346262305431037, c)\n\t\tz[14], c = bits.Add64(z[14], 123227702747754650, c)\n\t\tz[15], c = bits.Add64(z[15], 7409464670784690235, c)\n\t\tz[16], c = bits.Add64(z[16], 243347369443125979, c)\n\t\tz[17], c = bits.Add64(z[17], 200317109320159479, c)\n\t\tz[18], c = bits.Add64(z[18], 17492726232193822651, c)\n\t\tz[19], c = bits.Add64(z[19], 17666595880400198649, c)\n\t\tz[20], c = bits.Add64(z[20], 1619463007483089584, c)\n\t\tz[21], _ = bits.Add64(z[21], 7910025299994333900, c)\n\t}\n\treturn z\n}", "func sub(x, y int) int {\n\treturn x - y\n}", "func (v Posit16x2) Sub(x Posit16x2) Posit16x2 {\n\tout := Posit16x2{impl: make([]Posit16, 2)}\n\tfor i, posit := range v.impl {\n\t\tout.impl[i] = posit.Sub(x.impl[i])\n\t}\n\treturn out\n}", "func sub(x, y int) (answer int, err error) {\n\tanswer = x - y\n\treturn\n}", "func (z *polyGF2) Sub(a, b *polyGF2) *polyGF2 {\n\treturn z.Add(a, b)\n}", "func (v *Vector) Sub(rhs *Vector) *Vector {\n\tif rhs == nil {\n\t\treturn v\n\t}\n\tif v == nil {\n\t\tv = &Vector{\n\t\t\tword: \"\",\n\t\t\tvec: make([]float64, len(rhs.vec)),\n\t\t\telems: nil,\n\t\t}\n\t}\n\n\tl := min(len(v.vec), len(rhs.vec))\n\tvec := make([]float64, l)\n\tcopy(vec, v.vec)\n\tsaxpy(l, -1, rhs.vec, 1, vec, 1)\n\telems := make([]string, len(v.elems)+len(rhs.elems))\n\telems = append(elems, rhs.elems...)\n\telems = append(elems, v.elems...)\n\treturn &Vector{\n\t\tword: v.word + \" - \" + rhs.word,\n\t\tvec: vec,\n\t\telems: elems,\n\t}\n}", "func (c *Chunk) Unset(x, y, z uint8) {\n\tc.Solid[x][y] &^= 1 << z\n}", "func (v Vec3i) SubScalar(s int32) Vec3i {\n\treturn Vec3i{v.X - s, v.Y - s, v.Z - s}\n}", "func Sub3D(a, b Vec3) Vec3 {\n\treturn Vec3{a[0] - b[0], a[1] - b[1], a[2] - b[2]}\n}", "func (v1 Vector2) Sub(v2 Vector2) Vector2 {\n\treturn Vector2{v1.X - v2.X, v1.Y - v2.Y}\n}", "func (rg Range) Sub(p Point) Range {\n\trg.Max = rg.Max.Sub(p)\n\trg.Min = rg.Min.Sub(p)\n\treturn rg\n}", "func (v1 *Vec3f) Subtract(v2 Vec3f) Vec3f {\n\tX := v1.X - v2.X\n\tY := v1.Y - v2.Y\n\tZ := v1.Z - v2.Z\n\n\tv := Vec3f{X, Y, Z}\n\n\treturn v\n}", "func (p *G2Jac) Sub(curve *Curve, a G2Jac) *G2Jac {\n\ta.Y.Neg(&a.Y)\n\tp.Add(curve, &a)\n\treturn p\n}", "func Sub(x, y *big.Int) *big.Int {\n\treturn new(big.Int).Sub(x, y)\n}", "func (c *Clac) Sub() error {\n\treturn c.applyFloat(2, func(vals []value.Value) (value.Value, error) {\n\t\treturn binary(vals[1], \"-\", vals[0])\n\t})\n}", "func VSUBPD_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VSUBPD_Z(mxyz, xyz, k, xyz1) }", "func karatsubaSub(z, x nat, n int) {\n\tif c := subVV(z[0:n], z, x); c != 0 {\n\t\tsubVW(z[n:n+n>>1], z[n:], c)\n\t}\n}", "func (cal *Calculate) sub(value float64) (result float64) {\n\tif len(cal.Arg) == 2 {\n\t\treturn (cal.Arg[0] - cal.Arg[1])\n\t} else if len(cal.Arg) == 1 {\n\t\treturn (value - cal.Arg[0])\n\t}\n\n\tlog.Fatalln(\"Please check the data format of the calculation unit\")\n\treturn\n}", "func (f *Float) Sub(x, y *Float) *Float {\n\tx.doinit()\n\ty.doinit()\n\tf.doinit()\n\tC.mpf_sub(&f.i[0], &x.i[0], &y.i[0])\n\treturn f\n}", "func Sub(x, y int) int {\n\treturn x - y\n}", "func SubPrivately(H *ristretto.Point, rX, rY *ristretto.Scalar, vX, vY *big.Int) ristretto.Point {\n\tvar rDif ristretto.Scalar\n\tvar vDif big.Int\n\trDif.Sub(rY, rX)\n\tvDif.Sub(vX, vY)\n\tvDif.Mod(&vDif, n25519)\n\n\tvar vScalar ristretto.Scalar\n\tvar rPoint ristretto.Point\n\tvScalar.SetBigInt(&vDif)\n\n\trPoint.ScalarMultBase(&rDif)\n\tvar vPoint, result ristretto.Point\n\tvPoint.ScalarMult(H, &vScalar)\n\tresult.Add(&rPoint, &vPoint)\n\treturn result\n}", "func SubInto(ctx *build.Context, z, x, y ir.Int, b ir.Register) {\n\tvar bin ir.Operand = ir.Flag(0)\n\tfor i := 0; i < z.Len(); i++ {\n\t\tctx.SUB(ir.Limb(x, i), ir.Limb(y, i), bin, z.Limb(i), b)\n\t\tbin = b\n\t}\n}", "func (a *EncryptedVec) Sub(b *EncryptedVec) (*EncryptedVec, error) {\n\n\tif len(a.Coords) != len(b.Coords) {\n\t\treturn nil, errors.New(\"cannot add vectors of different length\")\n\t}\n\n\tpk := a.Pk\n\tres := make([]*paillier.Ciphertext, len(a.Coords))\n\n\tfor i := range a.Coords {\n\t\tres[i] = pk.Sub(a.Coords[i], b.Coords[i])\n\t}\n\n\treturn &EncryptedVec{\n\t\tPk: pk,\n\t\tCoords: res,\n\t}, nil\n}", "func (v Vector) Subtract(other Vector) Vector {\n\treturn Vector{\n\t\tX: v.X - other.X,\n\t\tY: v.Y - other.Y,\n\t\tZ: v.Z - other.Z,\n\t}\n}", "func (v Vec) SubBy(other Vec) Vec {\n\tassertSameLen(v, other)\n\tfor i, val := range other {\n\t\tv[i] -= val\n\t}\n\treturn v\n}", "func (ai *Arith) Sub(decimal1 *ZnDecimal, others ...*ZnDecimal) *ZnDecimal {\n\tvar result = copyZnDecimal(decimal1)\n\tif len(others) == 0 {\n\t\treturn result\n\t}\n\n\tfor _, item := range others {\n\t\tr1, r2 := rescalePair(result, item)\n\t\tresult.co.Sub(r1.co, r2.co)\n\t\tresult.exp = r1.exp\n\t}\n\treturn result\n}", "func (n *Uint256) Sub(n2 *Uint256) *Uint256 {\n\tvar borrow uint64\n\tn.n[0], borrow = bits.Sub64(n.n[0], n2.n[0], borrow)\n\tn.n[1], borrow = bits.Sub64(n.n[1], n2.n[1], borrow)\n\tn.n[2], borrow = bits.Sub64(n.n[2], n2.n[2], borrow)\n\tn.n[3], _ = bits.Sub64(n.n[3], n2.n[3], borrow)\n\treturn n\n}", "func Sub(v1, v2 *Vec) *Vec {\n\tnegV2 := Negate(v2)\n\treturn Add(v1, negV2)\n}", "func (v Vec) SSub(val float64) Vec {\n\treturn v.Copy().SSubBy(val)\n}", "func VSUBPS_Z(mxyz, xyz, k, xyz1 operand.Op) { ctx.VSUBPS_Z(mxyz, xyz, k, xyz1) }", "func VSUBPD_RZ_SAE_Z(z, z1, k, z2 operand.Op) { ctx.VSUBPD_RZ_SAE_Z(z, z1, k, z2) }", "func Sub(x, y reflect.Value) reflect.Value {\n\tmustSameType(x, y)\n\tz := reflect.New(x.Type()).Elem()\n\tswitch x.Type().Kind() {\n\tcase reflect.Int:\n\t\txx := int(x.Int())\n\t\tyy := int(y.Int())\n\t\tzz := int64(xx - yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int8:\n\t\txx := int8(x.Int())\n\t\tyy := int8(y.Int())\n\t\tzz := int64(xx - yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int16:\n\t\txx := int16(x.Int())\n\t\tyy := int16(y.Int())\n\t\tzz := int64(xx - yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int32:\n\t\txx := int32(x.Int())\n\t\tyy := int32(y.Int())\n\t\tzz := int64(xx - yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Int64:\n\t\txx := int64(x.Int())\n\t\tyy := int64(y.Int())\n\t\tzz := int64(xx - yy)\n\t\tz.SetInt(zz)\n\t\treturn z\n\tcase reflect.Uint:\n\t\txx := uint(x.Uint())\n\t\tyy := uint(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint8:\n\t\txx := uint8(x.Uint())\n\t\tyy := uint8(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint16:\n\t\txx := uint16(x.Uint())\n\t\tyy := uint16(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint32:\n\t\txx := uint32(x.Uint())\n\t\tyy := uint32(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uint64:\n\t\txx := uint64(x.Uint())\n\t\tyy := uint64(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Uintptr:\n\t\txx := uintptr(x.Uint())\n\t\tyy := uintptr(y.Uint())\n\t\tzz := uint64(xx - yy)\n\t\tz.SetUint(zz)\n\t\treturn z\n\tcase reflect.Float32:\n\t\txx := float32(x.Float())\n\t\tyy := float32(y.Float())\n\t\tzz := float64(xx - yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Float64:\n\t\txx := float64(x.Float())\n\t\tyy := float64(y.Float())\n\t\tzz := float64(xx - yy)\n\t\tz.SetFloat(zz)\n\t\treturn z\n\tcase reflect.Complex64:\n\t\txx := complex64(x.Complex())\n\t\tyy := complex64(y.Complex())\n\t\tzz := complex128(xx - yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\tcase reflect.Complex128:\n\t\txx := complex128(x.Complex())\n\t\tyy := complex128(y.Complex())\n\t\tzz := complex128(xx - yy)\n\t\tz.SetComplex(zz)\n\t\treturn z\n\t}\n\tpanic(fmt.Sprintf(\"operator - not defined on %v\", x.Type()))\n}", "func (vn *VecN) Sub(dst *VecN, addend *VecN) *VecN {\n\tif vn == nil || addend == nil {\n\t\treturn nil\n\t}\n\tsize := intMin(len(vn.vec), len(addend.vec))\n\tdst = dst.Resize(size)\n\n\tfor i := 0; i < size; i++ {\n\t\tdst.vec[i] = vn.vec[i] - addend.vec[i]\n\t}\n\n\treturn dst\n}", "func (p *G1Jac) SubAssign(a *G1Jac) *G1Jac {\n\tvar tmp G1Jac\n\ttmp.Set(a)\n\ttmp.Y.Neg(&tmp.Y)\n\tp.AddAssign(&tmp)\n\treturn p\n}", "func (f *tmplFuncs) sub(x, y int) int { return x - y }", "func VSUBSS_Z(mx, x, k, x1 operand.Op) { ctx.VSUBSS_Z(mx, x, k, x1) }", "func (c *Context) VSUBPD_Z(mxyz, xyz, k, xyz1 operand.Op) {\n\tc.addinstruction(x86.VSUBPD_Z(mxyz, xyz, k, xyz1))\n}", "func (f Fixed8) Sub(g Fixed8) Fixed8 {\n\treturn f - g\n}", "func sub(a, b big.Int) big.Int {\n\treturn *big.NewInt(1).Sub(&a, &b)\n}", "func Sub(minuend, subtrahend *big.Int) *big.Int { return I().Sub(minuend, subtrahend) }", "func sub(a, b Poly) Poly {\n\tvar c Poly\n\tfor i := 0; i < n; i++ {\n\t\tc[i] = a[i] - b[i]\n\t}\n\treturn c\n}", "func (a Balance) Sub(b *Balance) Balance {\n\tfor i, v := range b {\n\t\ta[i] -= v\n\t}\n\treturn a\n}", "func Sub(out1 *LooseFieldElement, arg1 *TightFieldElement, arg2 *TightFieldElement) {\n\tx1 := ((0x1ffffffffff6 + arg1[0]) - arg2[0])\n\tx2 := ((0xffffffffffe + arg1[1]) - arg2[1])\n\tx3 := ((0xffffffffffe + arg1[2]) - arg2[2])\n\tout1[0] = x1\n\tout1[1] = x2\n\tout1[2] = x3\n}", "func (dt DateTime) Sub(u DateTime) time.Duration {\n\treturn dt.src.Sub(u.src)\n}" ]
[ "0.73003036", "0.7089744", "0.6911011", "0.6789992", "0.67244226", "0.6708758", "0.65887916", "0.65609795", "0.64671993", "0.6458616", "0.64492327", "0.6433949", "0.6428546", "0.64146143", "0.6404549", "0.63840085", "0.62998414", "0.6273318", "0.62339556", "0.60979605", "0.6039775", "0.601795", "0.601016", "0.59430283", "0.5898544", "0.58375496", "0.5827115", "0.5788438", "0.5779882", "0.57565707", "0.575006", "0.57410574", "0.5739762", "0.5734038", "0.57258093", "0.57258093", "0.5722227", "0.57165724", "0.56895226", "0.5657714", "0.5650997", "0.5625054", "0.56193537", "0.5592084", "0.55747515", "0.5569586", "0.5546692", "0.552093", "0.55181235", "0.55094784", "0.547723", "0.54735386", "0.5471954", "0.54697704", "0.54520935", "0.54518795", "0.54487854", "0.543495", "0.53884614", "0.5373807", "0.53719646", "0.53704417", "0.5370359", "0.5363049", "0.53505313", "0.53129494", "0.5270282", "0.526527", "0.5258938", "0.5257774", "0.5241399", "0.5235306", "0.52249527", "0.52211684", "0.5197865", "0.5189578", "0.51679283", "0.51506984", "0.51505154", "0.51483834", "0.51320434", "0.51309466", "0.51184833", "0.51120496", "0.50903267", "0.50900865", "0.5072327", "0.50675446", "0.5064106", "0.50609297", "0.50476307", "0.5045556", "0.5038773", "0.5029535", "0.5019845", "0.5007157", "0.5006487", "0.4997278", "0.4984169", "0.49790797" ]
0.68231016
3
validate ensures x's internal state is correct. There's no need for it to have good performance since it's for debug == true only.
func (x *Big) validate() { defer func() { if err := recover(); err != nil { pc, _, _, ok := runtime.Caller(4) if caller := runtime.FuncForPC(pc); ok && caller != nil { fmt.Println("called by:", caller.Name()) } type Big struct { Context Context unscaled big.Int compact uint64 exp int precision int form form } fmt.Printf("%#v\n", (*Big)(x)) panic(err) } }() switch x.form { case finite, finite | signbit: if x.isInflated() { if x.unscaled.IsUint64() && x.unscaled.Uint64() != c.Inflated { panic(fmt.Sprintf("inflated but unscaled == %d", x.unscaled.Uint64())) } if x.unscaled.Sign() < 0 { panic("x.unscaled.Sign() < 0") } if bl, xp := arith.BigLength(&x.unscaled), x.precision; bl != xp { panic(fmt.Sprintf("BigLength (%d) != x.Precision (%d)", bl, xp)) } } if x.isCompact() { if bl, xp := arith.Length(x.compact), x.Precision(); bl != xp { panic(fmt.Sprintf("BigLength (%d) != x.Precision() (%d)", bl, xp)) } } case snan, ssnan, qnan, sqnan, pinf, ninf: // OK case nan: panic(x.form.String()) default: panic(fmt.Sprintf("invalid form %s", x.form)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c layout) validate() error {\n\tlog.Println(\"[CONFIG] Validating...\")\n\tvar stateNames = make(map[string]struct{})\n\tfor _, state := range c.States {\n\t\t// Address must be given\n\t\tif state.Address == \"\" {\n\t\t\treturn fmt.Errorf(\"[CONFIG] no address: '%s'\", state.Name)\n\t\t}\n\t\t// Address must be unique\n\t\tif _, exists := stateNames[state.Address]; exists {\n\t\t\treturn fmt.Errorf(\"[CONFIG] statename conflict, please check: '%s'\", state.Name)\n\t\t}\n\t}\n\treturn nil\n}", "func TestValidate(t *testing.T) {\n\tstate := &config.State{\n\t\tName: \"schweinsteiger\",\n\t\tPrevious: \"a\",\n\t\tRoot: \"b\",\n\t\tOrigin: \"c\",\n\t\tCurrentLink: \"d\",\n\t\tHelper: \"e\",\n\t}\n\tif err := state.Validate(); err != nil {\n\t\tt.Errorf(\"Config state %v failed to validate: %v\", state, err)\n\t}\n\tstate.Root = \"\"\n\tif err := state.Validate(); err == nil {\n\t\tt.Errorf(\"Config state %v should have failed to validate.\", state)\n\t}\n\tstate.Root, state.CurrentLink = \"a\", \"\"\n\tif err := state.Validate(); err == nil {\n\t\tt.Errorf(\"Confi stateg %v should have failed to validate.\", state)\n\t}\n\tstate.CurrentLink, state.Name = \"d\", \"\"\n\tif err := state.Validate(); err == nil {\n\t\tt.Errorf(\"Config state %v should have failed to validate.\", state)\n\t}\n\tstate.Name, state.Helper = \"anything\", \"\"\n\tif err := state.Validate(); err == nil {\n\t\tt.Errorf(\"Config state %v should have failed to validate.\", state)\n\t}\n}", "func (b *batData) validate() error {\n\tif !checkSize(b.HighestCellVoltage, voltFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid Highest Cell Voltage: %v\", b.HighestCellVoltage)\n\t}\n\n\tif !checkSize(b.LowestCellVoltage, voltFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid Lowest Cell Voltage: %v\", b.LowestCellVoltage)\n\t}\n\n\tif !checkSize(b.SysMaxTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Max Temperature: %v\", b.SysMaxTemperature)\n\t}\n\n\tif !checkSize(b.SysAvgTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Average Temperature: %v\", b.SysAvgTemperature)\n\t}\n\n\tif !checkSize(b.SysMinTemperature, tempFactor, 2) {\n\t\treturn fmt.Errorf(\"Invalid System Min Temperature: %v\", b.SysMinTemperature)\n\t}\n\n\treturn nil\n}", "func (st *State) Validate() error {\n\tif len(st.unused) == 0 {\n\t\treturn nil\n\t}\n\tnames := make([]string, 0, len(st.unused))\n\tfor name := range st.unused {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\treturn ErrVariableUnused.New(names)\n}", "func (cfg *Config) validate() error {\n\tif cfg.Range&^rangebits != 0 && cfg.Range != 1 {\n\t\treturn ErrBadRange\n\t}\n\treturn nil\n}", "func (mod ModSteadyState) Validate() error {\n\t// Check the selection method presence\n\tif mod.Selector == nil {\n\t\treturn errors.New(\"'Selector' cannot be nil\")\n\t}\n\t// Check the crossover method presence\n\tif mod.Crossover == nil {\n\t\treturn errors.New(\"'Crossover' cannot be nil\")\n\t}\n\t// Check the mutation rate in the presence of a mutator\n\tif mod.Mutator != nil && (mod.MutRate < 0 || mod.MutRate > 1) {\n\t\treturn errors.New(\"'MutRate' should belong to the [0, 1] interval\")\n\t}\n\treturn nil\n}", "func (m *MissingData) Validate(state interfaces.IState) int {\n\treturn 1\n}", "func (v Variable) validate() error {\n\tif err := v.FromCFN.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"from_cfn\": %w`, err)\n\t}\n\treturn nil\n}", "func (m *State) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Name\n\n\t// no validation rules for X\n\n\t// no validation rules for Y\n\n\t// no validation rules for Z\n\n\t// no validation rules for Rx\n\n\t// no validation rules for Ry\n\n\t// no validation rules for Rz\n\n\t// no validation rules for TransitionSpeed\n\n\treturn nil\n}", "func (config configuration) validate() error {\n\t_, err := govalidator.ValidateStruct(&config)\n\treturn err\n}", "func (q FIFOAdvanceConfigOrBool) validate() error {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn q.Advanced.validate()\n}", "func (sm *StateMachine) validate() []error {\n\tvalidationErrors := make([]error, 0)\n\tif sm.stateDefinitionError != nil {\n\t\tvalidationErrors = append(validationErrors, sm.stateDefinitionError)\n\t}\n\treturn validationErrors\n}", "func (e EFSConfigOrBool) validate() error {\n\tif e.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn e.Advanced.validate()\n}", "func (r Range) validate() error {\n\tif r.IsEmpty() {\n\t\treturn nil\n\t}\n\tif !r.RangeConfig.IsEmpty() {\n\t\treturn r.RangeConfig.validate()\n\t}\n\treturn r.Value.validate()\n}", "func (f Downstream) validate() error {\n\tif f.BounceIntervalHour < 1 && f.BounceIntervalHour != 0 {\n\t\treturn errors.New(\"invalid downstream.bounceIntervalHour value, should >= 1\")\n\t}\n\n\tif f.BounceIntervalHour > 48 {\n\t\treturn errors.New(\"invalid downstream.bounceIntervalHour value, should <= 48(two days)\")\n\t}\n\n\tif f.NotifyMaxLimit < 10 && f.NotifyMaxLimit != 0 {\n\t\treturn errors.New(\"invalid downstream.notifyMaxLimit value, should >= 10\")\n\t}\n\n\treturn nil\n}", "func (gs GenesisState) Validate() error {\r\n\tif err := host.PortIdentifierValidator(gs.PortId); err != nil {\r\n\t\treturn err\r\n\t}\r\n\tif err := gs.DenomTraces.Validate(); err != nil {\r\n\t\treturn err\r\n\t}\r\n\treturn gs.Params.Validate()\r\n}", "func (m *meta) validate() error {\n\tif m.magic != magic {\n\t\treturn ErrInvalid\n\t} else if m.version != version {\n\t\treturn ErrVersionMismatch\n\t} else if m.checksum != m.sum64() {\n\t\treturn ErrChecksum\n\t}\n\treturn nil\n}", "func (r Record) validate(now time.Time) error {\n\tvar err error\n\n\t// Validate that certain fields are set.\n\tif r.Organization == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing Organization\"))\n\t}\n\tif r.Environment == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing Environment\"))\n\t}\n\tif r.GatewayFlowID == \"\" {\n\t\terr = errorset.Append(err, errors.New(\"missing GatewayFlowID\"))\n\t}\n\tif r.ClientReceivedStartTimestamp == 0 {\n\t\terr = errorset.Append(err, errors.New(\"missing ClientReceivedStartTimestamp\"))\n\t}\n\tif r.ClientReceivedEndTimestamp == 0 {\n\t\terr = errorset.Append(err, errors.New(\"missing ClientReceivedEndTimestamp\"))\n\t}\n\tif r.ClientReceivedStartTimestamp > r.ClientReceivedEndTimestamp {\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp > ClientReceivedEndTimestamp\"))\n\t}\n\n\t// Validate that timestamps make sense.\n\tts := time.Unix(r.ClientReceivedStartTimestamp/1000, 0)\n\tif ts.After(now.Add(time.Minute)) { // allow a minute of tolerance\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp cannot be in the future\"))\n\t}\n\tif ts.Before(now.Add(-90 * 24 * time.Hour)) {\n\t\terr = errorset.Append(err, errors.New(\"ClientReceivedStartTimestamp cannot be more than 90 days old\"))\n\t}\n\n\tfor _, attr := range r.Attributes {\n\t\tif validateErr := validateAttribute(attr); validateErr != nil {\n\t\t\terr = errorset.Append(err, validateErr)\n\t\t}\n\t}\n\n\treturn err\n}", "func (a FIFOTopicAdvanceConfig) validate() error {\n\treturn nil\n}", "func (c *chainConfig) validate() error {\n\tswitch {\n\tcase c.NodeUrl == \"\":\n\t\treturn errors.New(\"empty node url\")\n\tcase c.BlockQueryDepth < 1 || c.BlockQueryDepth > 1000:\n\t\treturn errors.New(\"block query depth out of range\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (lm MatchReleaseLimiter) validate() error {\n\tif lm.QPS <= 0 {\n\t\treturn errors.New(\"invalid matchReleaseLimiter.qps value, should >= 1\")\n\t}\n\n\tif lm.Burst <= 0 {\n\t\treturn errors.New(\"invalid matchReleaseLimiter.burst value, should >= 1\")\n\t}\n\n\tif lm.WaitTimeMil <= 0 {\n\t\treturn errors.New(\"invalid matchReleaseLimiter.waitTimeMil value, should >= 1\")\n\t}\n\n\treturn nil\n}", "func (p *PaymentNeed) validate() error {\n\tif p.BeneficiaryID == 0 {\n\t\treturn fmt.Errorf(\"beneficiary ID nul\")\n\t}\n\tif p.Value == 0 {\n\t\treturn fmt.Errorf(\"value nul\")\n\t}\n\treturn nil\n}", "func (lm Limiter) validate() error {\n\tif lm.QPS <= 0 {\n\t\treturn errors.New(\"invalid QPS value, should >= 1\")\n\t}\n\n\tif lm.Burst <= 0 {\n\t\treturn errors.New(\"invalid Burst value, should >= 1\")\n\t}\n\n\treturn nil\n}", "func (c *BoxPlot) Validate() {\n\tc.XAxisList[0].Data = c.xAxisData\n\tc.Assets.Validate(c.AssetsHost)\n}", "func (s *Kalman1State) Valid() (ok bool) {\n\treturn true\n}", "func (w *XPubWallet) Validate() error {\n\treturn w.Meta.validate()\n}", "func (e ExecuteCommand) validate() error {\n\tif !e.Config.IsEmpty() {\n\t\treturn e.Config.validate()\n\t}\n\treturn nil\n}", "func valid(state State) bool {\n\tswitch {\n\tcase state.left.m < 0 || state.left.c < 0 || state.right.m < 0 || state.right.c < 0:\n\t\treturn false\n\tcase state.left.m > 0 && state.left.c > state.left.m:\n\t\treturn false\n\tcase state.right.m > 0 && state.right.c > state.right.m:\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func (gs GenesisState) Validate() error {\n\tif gs.BaseFee.IsNegative() {\n\t\treturn fmt.Errorf(\"base fee cannot be negative: %s\", gs.BaseFee)\n\t}\n\n\treturn gs.Params.Validate()\n}", "func (i ImageWithHealthcheck) validate() error {\n\tif err := i.Image.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *dryrunOptions) validate() error {\n\tif o.userWPAName == \"\" && o.labelSelector == \"\" && !o.allWPA {\n\t\treturn fmt.Errorf(\"the watermarkpodautoscaler name or label-selector is required\")\n\t}\n\n\treturn nil\n}", "func (p *ArtAddressPacket) validate() error {\n\tif err := p.Header.validate(); err != nil {\n\t\treturn err\n\t}\n\tif p.OpCode != code.OpAddress {\n\t\treturn errInvalidOpCode\n\t}\n\treturn nil\n}", "func (o *Virtualserver) validate(dbRecord *common.DbRecord) (ok bool, err error) {\n\t////////////////////////////////////////////////////////////////////////////\n\t// Marshal data interface.\n\t////////////////////////////////////////////////////////////////////////////\n\tvar data virtualserver.Data\n\terr = shared.MarshalInterface(dbRecord.Data, &data)\n\tif err != nil {\n\t\treturn\n\t}\n\t////////////////////////////////////////////////////////////////////////////\n\t// Test required fields.\n\t////////////////////////////////////////////////////////////////////////////\n\tok = true\n\trequired := make(map[string]bool)\n\trequired[\"ProductCode\"] = false\n\trequired[\"IP\"] = false\n\trequired[\"Port\"] = false\n\trequired[\"LoadBalancerIP\"] = false\n\trequired[\"Name\"] = false\n\t////////////////////////////////////////////////////////////////////////////\n\tif data.ProductCode != 0 {\n\t\trequired[\"ProductCode\"] = true\n\t}\n\tif len(dbRecord.LoadBalancerIP) > 0 {\n\t\trequired[\"LoadBalancerIP\"] = true\n\t}\n\tif len(data.Ports) != 0 {\n\t\trequired[\"Port\"] = true\n\t}\n\tif data.IP != \"\" {\n\t\trequired[\"IP\"] = true\n\t}\n\tif data.Name != \"\" {\n\t\trequired[\"Name\"] = true\n\t}\n\tfor _, val := range required {\n\t\tif val == false {\n\t\t\tok = false\n\t\t}\n\t}\n\tif !ok {\n\t\terr = fmt.Errorf(\"missing required fields - %+v\", required)\n\t}\n\treturn\n}", "func (r RequestDrivenWebServiceHttpConfig) validate() error {\n\tif err := r.HealthCheckConfiguration.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn r.Private.validate()\n}", "func (c *EffectScatter) Validate() {\n\tc.XAxisList[0].Data = c.xAxisData\n\tc.Assets.Validate(c.AssetsHost)\n}", "func (ContainerHealthCheck) validate() error {\n\treturn nil\n}", "func (s State) Valid() bool {\n\treturn s >= 0\n}", "func (c *Config) valid() error {\n\tif c.Score == nil {\n\t\treturn errors.New(\"Expected Score to not be nil\")\n\t}\n\tif c.Sampler == nil {\n\t\treturn errors.New(\"Expected Sampler to not be nil\")\n\t}\n\treturn nil\n}", "func (gs GenesisState) Validate() error {\n\tseenDelegations := make(map[string]bool)\n\tseenMissCounters := make(map[string]bool)\n\tseenAggregates := make(map[string]bool)\n\n\tfor i, feederDelegation := range gs.FeederDelegations {\n\t\tif seenDelegations[feederDelegation.Validator] {\n\t\t\treturn fmt.Errorf(\"duplicated feeder delegation for validator %s at index %d\", feederDelegation.Validator, i)\n\t\t}\n\n\t\tdelegateAddr, err := sdk.AccAddressFromBech32(feederDelegation.Delegate)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid feeder delegate at index %d: %w\", i, err)\n\t\t}\n\n\t\tvalidatorAddr, err := sdk.ValAddressFromBech32(feederDelegation.Validator)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid feeder validator at index %d: %w\", i, err)\n\t\t}\n\n\t\tif delegateAddr.Equals(validatorAddr) {\n\t\t\treturn fmt.Errorf(\"delegate address %s cannot be equal to validator address %s\", feederDelegation.Delegate, feederDelegation.Validator)\n\t\t}\n\t\tseenDelegations[feederDelegation.Validator] = true\n\t}\n\n\tfor i, missCounter := range gs.MissCounters {\n\t\tif seenMissCounters[missCounter.Validator] {\n\t\t\treturn fmt.Errorf(\"duplicated miss counter for validator %s at index %d\", missCounter.Validator, i)\n\t\t}\n\n\t\tif missCounter.Misses < 0 {\n\t\t\treturn fmt.Errorf(\"miss counter for validator %s cannot be negative: %d\", missCounter.Validator, missCounter.Misses)\n\t\t}\n\n\t\tif _, err := sdk.ValAddressFromBech32(missCounter.Validator); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid feeder at index %d: %w\", i, err)\n\t\t}\n\n\t\tseenMissCounters[missCounter.Validator] = true\n\t}\n\n\tif err := gs.Params.ValidateBasic(); err != nil {\n\t\treturn err\n\t}\n\n\tsupportedTypes := make(map[string]bool)\n\n\tfor _, dataType := range gs.Params.DataTypes {\n\t\tsupportedTypes[dataType] = true\n\t}\n\n\tfor _, aggregate := range gs.Aggregates {\n\t\tif aggregate.Height < 1 {\n\t\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, \"height (%d) cannot be zero or negative\", aggregate.Height)\n\t\t}\n\n\t\toracleData := aggregate.Data\n\t\tdataID := oracleData.GetID()\n\n\t\tif seenAggregates[dataID] {\n\t\t\treturn sdkerrors.Wrap(ErrDuplicatedOracleData, dataID)\n\t\t}\n\n\t\tif !supportedTypes[oracleData.Type()] {\n\t\t\treturn sdkerrors.Wrap(ErrUnsupportedDataType, oracleData.Type())\n\t\t}\n\n\t\tif err := oracleData.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tseenAggregates[dataID] = true\n\t}\n\n\treturn nil\n}", "func (DockerBuildArgs) validate() error {\n\treturn nil\n}", "func validate(b *protocol.Block, initialSetup bool) error {\n\n\t//This mutex is necessary that own-mined blocks and received blocks from the network are not\n\t//validated concurrently.\n\tblockValidation.Lock()\n\tdefer blockValidation.Unlock()\n\n\tif storage.ReadClosedBlock(b.Hash) != nil {\n\t\tlogger.Printf(\"Received block (%x) has already been validated.\\n\", b.Hash[0:8])\n\t\treturn errors.New(\"Received Block has already been validated.\")\n\t}\n\n\t//Prepare datastructure to fill tx payloads.\n\tblockDataMap := make(map[[32]byte]blockData)\n\n\t//Get the right branch, and a list of blocks to rollback (if necessary).\n\tblocksToRollback, blocksToValidate, err := getBlockSequences(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(blocksToRollback) > 0 {\n\t\tlogger.Printf(\" _____________________\")\n\t\tlogger.Printf(\"| Blocks To Rollback: |________________________________________________\")\n\t\tfor _, block := range blocksToRollback {\n\t\t\tlogger.Printf(\"| - %x |\", block.Hash)\n\t\t}\n\t\tlogger.Printf(\"|______________________________________________________________________|\")\n\t\tlogger.Printf(\" _____________________\")\n\t\tlogger.Printf(\"| Blocks To Validate: |________________________________________________\")\n\t\tfor _, block := range blocksToValidate {\n\t\t\tlogger.Printf(\"| - %x |\", block.Hash)\n\t\t}\n\t\tlogger.Printf(\"|______________________________________________________________________|\")\n\t}\n\n\t//Verify block time is dynamic and corresponds to system time at the time of retrieval.\n\t//If we are syncing or far behind, we cannot do this dynamic check,\n\t//therefore we include a boolean uptodate. If it's true we consider ourselves uptodate and\n\t//do dynamic time checking.\n\tif len(blocksToValidate) > DELAYED_BLOCKS {\n\t\tuptodate = false\n\t} else {\n\t\tuptodate = true\n\t}\n\n\t//No rollback needed, just a new block to validate.\n\tif len(blocksToRollback) == 0 {\n\t\tfor i, block := range blocksToValidate {\n\t\t\t//Fetching payload data from the txs (if necessary, ask other miners).\n\t\t\taccTxs, fundsTxs, configTxs, stakeTxs, aggTxs, aggregatedFundsTxSlice, err := preValidate(block, initialSetup)\n\n\t\t\t//Check if the validator that added the block has previously voted on different competing chains (find slashing proof).\n\t\t\t//The proof will be stored in the global slashing dictionary.\n\t\t\tif block.Height > 0 {\n\t\t\t\tseekSlashingProof(block)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tblockDataMap[block.Hash] = blockData{accTxs, fundsTxs, configTxs, stakeTxs, aggTxs, aggregatedFundsTxSlice,block}\n\t\t\tif err := validateState(blockDataMap[block.Hash], initialSetup); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpostValidate(blockDataMap[block.Hash], initialSetup)\n\t\t\tif i != len(blocksToValidate)-1 {\n\t\t\t\tlogger.Printf(\"Validated block (During Validation of other block %v): %vState:\\n%v\", b.Hash[0:8] , block, getState())\n\t\t\t}\n\t\t}\n\t} else {\n\t\t//Rollback\n\t\tfor _, block := range blocksToRollback {\n\t\t\tif err := rollback(block); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t//Validation of new chain\n\t\tfor _, block := range blocksToValidate {\n\t\t\t//Fetching payload data from the txs (if necessary, ask other miners).\n\t\t\taccTxs, fundsTxs, configTxs, stakeTxs, aggTxs, aggregatedFundsTxSlice, err := preValidate(block, initialSetup)\n\n\t\t\t//Check if the validator that added the block has previously voted on different competing chains (find slashing proof).\n\t\t\t//The proof will be stored in the global slashing dictionary.\n\t\t\tif block.Height > 0 {\n\t\t\t\tseekSlashingProof(block)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tblockDataMap[block.Hash] = blockData{accTxs, fundsTxs, configTxs, stakeTxs, aggTxs, aggregatedFundsTxSlice,block}\n\t\t\tif err := validateState(blockDataMap[block.Hash], initialSetup); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpostValidate(blockDataMap[block.Hash], initialSetup)\n\t\t\t//logger.Printf(\"Validated block (after rollback): %x\", block.Hash[0:8])\n\t\t\tlogger.Printf(\"Validated block (after rollback for block %v): %vState:\\n%v\", b.Hash[0:8], block, getState())\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *GenesisState) Validate() error {\n\tif err := s.Params.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c config) validate() error {\n\tif c.MinPort <= 0 || c.MaxPort <= 0 {\n\t\treturn errors.New(\"min Port and Max Port values are required\")\n\t}\n\tif c.MaxPort < c.MinPort {\n\t\treturn errors.New(\"max Port cannot be set less that the Min Port\")\n\t}\n\treturn nil\n}", "func (gs GenesisState) Validate() error {\n\t// this line is used by starport scaffolding # genesis/types/validate\n\t// Check for duplicated ID in cdp\n\t// cdpIdMap := make(map[string]bool)\n\n\t// for _, elem := range gs.CdpList {\n\t// \tif _, ok := cdpIdMap[elem.Id]; ok {\n\t// \t\treturn fmt.Errorf(\"duplicated id for cdp\")\n\t// \t}\n\t// \tcdpIdMap[elem.Id] = true\n\t// }\n\n\t// return nil\n\n\tif err := gs.Params.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := Cdps(gs.Cdps).Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := Deposits(gs.Deposits).Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := GenesisAccumulationTimes(gs.PreviousAccumulationTimes).Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := GenesisTotalPrincipals(gs.TotalPrincipals).Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := sdk.ValidateDenom(gs.DebtDenom); err != nil {\n\t\treturn fmt.Errorf(fmt.Sprintf(\"debt denom invalid: %v\", err))\n\t}\n\n\tif err := sdk.ValidateDenom(gs.GovDenom); err != nil {\n\t\treturn fmt.Errorf(fmt.Sprintf(\"gov denom invalid: %v\", err))\n\t}\n\n\treturn nil\n}", "func (c *Config) validate() error {\n\tdataDir, err := filepath.Abs(c.DataDir)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tlogFile, err := filepath.Abs(c.Log.File.Filename)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\trel, err := filepath.Rel(dataDir, filepath.Dir(logFile))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tif !strings.HasPrefix(rel, \"..\") {\n\t\treturn errors.New(\"log directory shouldn't be the subdirectory of data directory\")\n\t}\n\n\treturn nil\n}", "func (cfg fromCFN) validate() error {\n\tif cfg.isEmpty() {\n\t\treturn nil\n\t}\n\tif len(aws.StringValue(cfg.Name)) == 0 {\n\t\treturn errors.New(\"name cannot be an empty string\")\n\t}\n\treturn nil\n}", "func (d DeadLetterQueue) validate() error {\n\tif d.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (s *settingsProvider) validate() {\n\tif s.bus == nil {\n\t\tpanic(\"Service bus is not configured\")\n\t}\n\n\ts.cron = utils.NewCron()\n\n\tif s.isWorker {\n\t\ts.validateWorkerSettings()\n\t} else {\n\t\ts.validateMasterSettings()\n\t}\n}", "func (o *options) validate() error {\n\treturn nil\n}", "func (c *Config) validate() error {\n\treturn ValidateConfig(c).ToAggregate()\n}", "func (h txApproveHandler) validate() error {\n\tif h.issuerKP == nil {\n\t\treturn errors.New(\"issuer keypair cannot be nil\")\n\t}\n\tif h.assetCode == \"\" {\n\t\treturn errors.New(\"asset code cannot be empty\")\n\t}\n\tif h.horizonClient == nil {\n\t\treturn errors.New(\"horizon client cannot be nil\")\n\t}\n\tif h.networkPassphrase == \"\" {\n\t\treturn errors.New(\"network passphrase cannot be empty\")\n\t}\n\tif h.db == nil {\n\t\treturn errors.New(\"database cannot be nil\")\n\t}\n\tif h.kycThreshold <= 0 {\n\t\treturn errors.New(\"kyc threshold cannot be less than or equal to zero\")\n\t}\n\tif h.baseURL == \"\" {\n\t\treturn errors.New(\"base url cannot be empty\")\n\t}\n\treturn nil\n}", "func (s Secret) validate() error {\n\treturn nil\n}", "func (q FIFOAdvanceConfig) validate() error {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\n\tif err := q.validateHighThroughputFIFO(); err != nil {\n\t\treturn err\n\t}\n\tif err := q.validateDeduplicationScope(); err != nil {\n\t\treturn err\n\t}\n\tif err := q.validateFIFOThroughputLimit(); err != nil {\n\t\treturn err\n\t}\n\tif aws.StringValue(q.FIFOThroughputLimit) == sqsFIFOThroughputLimitPerMessageGroupID && aws.StringValue(q.DeduplicationScope) == sqsDeduplicationScopeQueue {\n\t\treturn fmt.Errorf(`\"throughput_limit\" must be set to \"perQueue\" when \"deduplication_scope\" is set to \"queue\"`)\n\t}\n\treturn nil\n}", "func (m *MsgPing) Validate(interfaces.IState) int {\n\treturn 0\n}", "func (c *ArithmeticController) validate() (x, y int, err error) {\n\tif x, err = c.GetInt(\"x\"); err != nil {\n\t\terr = fmt.Errorf(\"'%s' is not a valid integer\", c.GetString(\"x\"))\n\t\treturn\n\t} else if y, err = c.GetInt(\"y\"); err != nil {\n\t\terr = fmt.Errorf(\"'%s' is not a valid integer\", c.GetString(\"y\"))\n\t\treturn\n\t}\n\treturn\n}", "func (tg Timing) validate() error {\n\tvar err error\n\tif tg.length != len(tg.ts) {\n\t\terr = errors.New(\"ts is wrong length\")\n\t}\n\tif tg.length != len(tg.te) {\n\t\terr = errors.New(\"te is wrong length\")\n\t}\n\tif tg.length != len(tg.Td) {\n\t\terr = errors.New(\"Td is wrong length\")\n\t}\n\tfor i, _ := range tg.te {\n\t\tif tg.te[i].Sub(tg.ts[i]) < 0 {\n\t\t\terr = errors.New(\"time travel detected\")\n\t\t}\n\t}\n\treturn err\n}", "func validateMetrics(m *Metrics) error {\n\tif !m.initialized {\n\t\treturn errors.New(\"Metrics struct is not initialized\")\n\t}\n\n\treturn nil\n}", "func (n NetworkConfig) validate() error {\n\tif n.IsEmpty() {\n\t\treturn nil\n\t}\n\tif err := n.VPC.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"vpc\": %w`, err)\n\t}\n\tif err := n.Connect.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"connect\": %w`, err)\n\t}\n\treturn nil\n}", "func (tcr *TinkerbellClusterReconciler) validate() error {\n\tif tcr.Log == nil {\n\t\treturn fmt.Errorf(\"logger is nil\")\n\t}\n\n\tif tcr.Client == nil {\n\t\treturn fmt.Errorf(\"client is nil\")\n\t}\n\n\treturn nil\n}", "func (m *DataPoint) Validate() error {\n\treturn m.validate(false)\n}", "func (e *storageExecutor) validation() error {\n\t// check input shardIDs if empty\n\tif len(e.ctx.shardIDs) == 0 {\n\t\treturn errNoShardID\n\t}\n\tnumOfShards := e.database.NumOfShards()\n\t// check engine has shard\n\tif numOfShards == 0 {\n\t\treturn errNoShardInDatabase\n\t}\n\n\treturn nil\n}", "func (q SQSQueueOrBool) validate() error {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn q.Advanced.validate()\n}", "func (m *SXG) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetCertificate()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: \"Certificate\",\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.GetPrivateKey()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: \"PrivateKey\",\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.GetDuration()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: \"Duration\",\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 MiRecordSize\n\n\tif utf8.RuneCountInString(m.GetCborUrl()) < 1 {\n\t\treturn SXGValidationError{\n\t\t\tfield: \"CborUrl\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif !strings.HasPrefix(m.GetCborUrl(), \"/\") {\n\t\treturn SXGValidationError{\n\t\t\tfield: \"CborUrl\",\n\t\t\treason: \"value does not have prefix \\\"/\\\"\",\n\t\t}\n\t}\n\n\tif utf8.RuneCountInString(m.GetValidityUrl()) < 1 {\n\t\treturn SXGValidationError{\n\t\t\tfield: \"ValidityUrl\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif !strings.HasPrefix(m.GetValidityUrl(), \"/\") {\n\t\treturn SXGValidationError{\n\t\t\tfield: \"ValidityUrl\",\n\t\t\treason: \"value does not have prefix \\\"/\\\"\",\n\t\t}\n\t}\n\n\tif m.GetClientCanAcceptSxgHeader() != \"\" {\n\n\t\tif !_SXG_ClientCanAcceptSxgHeader_Pattern.MatchString(m.GetClientCanAcceptSxgHeader()) {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: \"ClientCanAcceptSxgHeader\",\n\t\t\t\treason: \"value does not match regex pattern \\\"^[^\\\\x00\\\\n\\\\r]*$\\\"\",\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif m.GetShouldEncodeSxgHeader() != \"\" {\n\n\t\tif !_SXG_ShouldEncodeSxgHeader_Pattern.MatchString(m.GetShouldEncodeSxgHeader()) {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: \"ShouldEncodeSxgHeader\",\n\t\t\t\treason: \"value does not match regex pattern \\\"^[^\\\\x00\\\\n\\\\r]*$\\\"\",\n\t\t\t}\n\t\t}\n\n\t}\n\n\tfor idx, item := range m.GetHeaderPrefixFilters() {\n\t\t_, _ = idx, item\n\n\t\tif !_SXG_HeaderPrefixFilters_Pattern.MatchString(item) {\n\t\t\treturn SXGValidationError{\n\t\t\t\tfield: fmt.Sprintf(\"HeaderPrefixFilters[%v]\", idx),\n\t\t\t\treason: \"value does not match regex pattern \\\"^[^\\\\x00\\\\n\\\\r]*$\\\"\",\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (b BuildArgsOrString) validate() error {\n\tif b.isEmpty() {\n\t\treturn nil\n\t}\n\tif !b.BuildArgs.isEmpty() {\n\t\treturn b.BuildArgs.validate()\n\t}\n\treturn nil\n}", "func (s *State) Validate() error {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tvar result error\n\n\t// !!!! FOR DEVELOPERS !!!!\n\t//\n\t// Any errors returned from this Validate function will BLOCK TERRAFORM\n\t// from loading a state file. Therefore, this should only contain checks\n\t// that are only resolvable through manual intervention.\n\t//\n\t// !!!! FOR DEVELOPERS !!!!\n\n\t// Make sure there are no duplicate module states. We open a new\n\t// block here so we can use basic variable names and future validations\n\t// can do the same.\n\t{\n\t\tfound := make(map[string]struct{})\n\t\tfor _, ms := range s.Modules {\n\t\t\tif ms == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tkey := strings.Join(ms.Path, \".\")\n\t\t\tif _, ok := found[key]; ok {\n\t\t\t\tresult = multierror.Append(result, fmt.Errorf(\n\t\t\t\t\tstrings.TrimSpace(stateValidateErrMultiModule), key))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfound[key] = struct{}{}\n\t\t}\n\t}\n\n\treturn result\n}", "func (SecurityGroupsConfig) validate() error {\n\treturn nil\n}", "func (gs GenesisState) Validate() error {\n\t// Check for duplicated index in proposedUpgrade\n\tproposedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.ProposedUpgradeList {\n\t\tindex := string(ProposedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := proposedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for proposedUpgrade\")\n\t\t}\n\n\t\tproposedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// Check for duplicated index in approvedUpgrade\n\tapprovedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.ApprovedUpgradeList {\n\t\tindex := string(ApprovedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := approvedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for approvedUpgrade\")\n\t\t}\n\n\t\tapprovedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// Check for duplicated index in rejectedUpgrade\n\trejectedUpgradeIndexMap := make(map[string]struct{})\n\n\tfor _, elem := range gs.RejectedUpgradeList {\n\t\tindex := string(RejectedUpgradeKey(elem.Plan.Name))\n\t\tif _, ok := rejectedUpgradeIndexMap[index]; ok {\n\t\t\treturn fmt.Errorf(\"duplicated index for rejectedUpgrade\")\n\t\t}\n\t\trejectedUpgradeIndexMap[index] = struct{}{}\n\t}\n\t// this line is used by starport scaffolding # genesis/types/validate\n\n\treturn nil\n}", "func (m *Instance) Validate() error {\n\treturn m.validate(false)\n}", "func (q SQSQueue) validate() error {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\tif err := q.DeadLetter.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"dead_letter\": %w`, err)\n\t}\n\treturn q.FIFO.validate()\n}", "func (gs GenesisState) Validate() error {\n\tif len(gs.GetModuleOwners()) == 0 {\n\t\treturn errors.New(\"module owner size cannot be the zero\")\n\t}\n\n\tfor _, moduleOwner := range gs.GetModuleOwners() {\n\t\terr := moduleOwner.Validate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (v Volume) validate() error {\n\tif err := v.EFS.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"efs\": %w`, err)\n\t}\n\treturn v.MountPointOpts.validate()\n}", "func (ExecuteCommandConfig) validate() error {\n\treturn nil\n}", "func (w WorkerService) validate() error {\n\tvar err error\n\tif err = w.WorkerServiceConfig.validate(); err != nil {\n\t\treturn err\n\t}\n\tif err = w.Workload.validate(); err != nil {\n\t\treturn err\n\t}\n\tif err = validateContainerDeps(validateDependenciesOpts{\n\t\tsidecarConfig: w.Sidecars,\n\t\timageConfig: w.ImageConfig.Image,\n\t\tmainContainerName: aws.StringValue(w.Name),\n\t\tlogging: w.Logging,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"validate container dependencies: %w\", err)\n\t}\n\tif err = validateExposedPorts(validateExposedPortsOpts{\n\t\tsidecarConfig: w.Sidecars,\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"validate unique exposed ports: %w\", err)\n\t}\n\treturn nil\n}", "func (EntryPointOverride) validate() error {\n\treturn nil\n}", "func (x *Money) Validate() error {\n\tif err := x.Currency.Validate(); err != nil {\n\t\treturn err\n\t}\n\treturn x.Amount.Validate()\n}", "func (c *RaftConfig) validate() error {\n\tif c.ID == 0 {\n\t\treturn errors.New(\"ID is required\")\n\t}\n\tif len(c.Peers) == 0 {\n\t\treturn errors.New(\"Peers is required\")\n\t}\n\t/*if c.Storage == nil {\n\t\treturn errors.New(\"Storage is required\")\n\t}\n\tif c.StateMachine == nil {\n\t\treturn errors.New(\"StateMachine is required\")\n\t}*/\n\n\treturn nil\n}", "func (b *batInfo) validate() error {\n\tif b.ModelType != \"C\" && b.ModelType != \"R\" {\n\t\treturn fmt.Errorf(\"Invalid Model Type: %v\", b.ModelType)\n\t}\n\n\tif !checkSize(b.FirmwareVersion, 1, 2) {\n\t\treturn fmt.Errorf(\"Invalid Firmware Version: %v\", b.FirmwareVersion)\n\t}\n\n\tif !checkSize(b.SerialNumber, 1, 4) {\n\t\treturn fmt.Errorf(\"Invalid Serial Number: %v\", b.SerialNumber)\n\t}\n\n\treturn nil\n}", "func validate(nr int, r Range, v int) error {\n\tif got, want := v, r.Start+valueOffset; got != want {\n\t\treturn fmt.Errorf(\"segment %d has key %d, value %d (expected %d)\", nr, r.Start, got, want)\n\t}\n\treturn nil\n}", "func (r *Result) validate(errMsg *[]string, parentField string) {\n\tjn := resultJsonMap\n\taddErrMessage(errMsg, len(r.Key) > 0 && hasNonEmptyKV(r.Key), \"field '%s' must be non-empty and must not have empty keys or values\", parentField+\".\"+jn[\"Key\"])\n\taddErrMessage(errMsg, hasNonEmptyKV(r.Options), \"field '%s' must not have empty keys or values\", parentField+\".\"+jn[\"Options\"])\n\taddErrMessage(errMsg, regExHexadecimal.MatchString(string(r.Digest)), \"field '%s' must be hexadecimal\", parentField+\".\"+jn[\"Digest\"])\n}", "func (v rdwsVpcConfig) validate() error {\n\tif v.isEmpty() {\n\t\treturn nil\n\t}\n\tif err := v.Placement.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"placement\": %w`, err)\n\t}\n\treturn nil\n}", "func (s StaticSite) validate() error {\n\tif err := s.StaticSiteConfig.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn s.Workload.validate()\n}", "func (xdc *XxxDemoCreate) check() error {\n\tif _, ok := xdc.mutation.IsDel(); !ok {\n\t\treturn &ValidationError{Name: \"is_del\", err: errors.New(\"ent: missing required field \\\"is_del\\\"\")}\n\t}\n\tif _, ok := xdc.mutation.Memo(); !ok {\n\t\treturn &ValidationError{Name: \"memo\", err: errors.New(\"ent: missing required field \\\"memo\\\"\")}\n\t}\n\tif v, ok := xdc.mutation.Memo(); ok {\n\t\tif err := xxxdemo.MemoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"memo\", err: fmt.Errorf(\"ent: validator failed for field \\\"memo\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := xdc.mutation.Sort(); !ok {\n\t\treturn &ValidationError{Name: \"sort\", err: errors.New(\"ent: missing required field \\\"sort\\\"\")}\n\t}\n\tif _, ok := xdc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := xdc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := xdc.mutation.Code(); !ok {\n\t\treturn &ValidationError{Name: \"code\", err: errors.New(\"ent: missing required field \\\"code\\\"\")}\n\t}\n\tif v, ok := xdc.mutation.Code(); ok {\n\t\tif err := xxxdemo.CodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"code\", err: fmt.Errorf(\"ent: validator failed for field \\\"code\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := xdc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := xdc.mutation.Name(); ok {\n\t\tif err := xxxdemo.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := xdc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := xdc.mutation.ID(); ok {\n\t\tif err := xxxdemo.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *DBStateMissing) Validate(state interfaces.IState) int {\n\tif m.DBHeightStart > m.DBHeightEnd {\n\t\treturn -1\n\t}\n\treturn 1\n}", "func (s SecretForDockerRegistryGeneratorV1) validate() error {\n\tif len(s.Name) == 0 {\n\t\treturn fmt.Errorf(\"name must be specified\")\n\t}\n\tif len(s.Username) == 0 {\n\t\treturn fmt.Errorf(\"username must be specified\")\n\t}\n\tif len(s.Password) == 0 {\n\t\treturn fmt.Errorf(\"password must be specified\")\n\t}\n\tif len(s.Server) == 0 {\n\t\treturn fmt.Errorf(\"server must be specified\")\n\t}\n\treturn nil\n}", "func (s SecurityGroupsIDsOrConfig) validate() error {\n\tif s.isEmpty() {\n\t\treturn nil\n\t}\n\treturn s.AdvancedConfig.validate()\n}", "func (r *Node) validate() field.ErrorList {\n\tvar nodeErrors field.ErrorList\n\n\tif r.Spec.Validator {\n\t\t// validate rpc must be disabled if node is validator\n\t\tif r.Spec.RPC {\n\t\t\terr := field.Invalid(field.NewPath(\"spec\").Child(\"rpc\"), r.Spec.RPC, \"must be false if node is validator\")\n\t\t\tnodeErrors = append(nodeErrors, err)\n\t\t}\n\t\t// validate ws must be disabled if node is validator\n\t\tif r.Spec.WS {\n\t\t\terr := field.Invalid(field.NewPath(\"spec\").Child(\"ws\"), r.Spec.WS, \"must be false if node is validator\")\n\t\t\tnodeErrors = append(nodeErrors, err)\n\t\t}\n\t\t// validate pruning must be disabled if node is validator\n\t\tif pruning := r.Spec.Pruning; pruning != nil && *pruning {\n\t\t\terr := field.Invalid(field.NewPath(\"spec\").Child(\"pruning\"), r.Spec.Pruning, \"must be false if node is validator\")\n\t\t\tnodeErrors = append(nodeErrors, err)\n\t\t}\n\n\t}\n\n\treturn nodeErrors\n}", "func (d Draw) Validate() error {\n\tif d.TicketsSold < d.Participants {\n\t\treturn fmt.Errorf(\"tickets sold cannot be less then the participants\")\n\t}\n\n\terr := d.Prize.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif d.EndTime.IsZero() {\n\t\treturn fmt.Errorf(\"invalid draw end time\")\n\t}\n\n\treturn nil\n}", "func TestValidateState(t *testing.T) {\n\tclientset, err := k8sutils.MustGetClientset()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tconfig := k8sutils.MustGetRestConfig(t)\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)\n\tdefer cancel()\n\n\tvalidator, err := validate.CreateValidator(ctx, clientset, config, namespace, *cniType, *restartCase, *osType)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := validator.Validate(ctx); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func (v vpcConfig) validate() error {\n\tif v.isEmpty() {\n\t\treturn nil\n\t}\n\tif err := v.Placement.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"placement\": %w`, err)\n\t}\n\tif err := v.SecurityGroups.validate(); err != nil {\n\t\treturn fmt.Errorf(`validate \"security_groups\": %w`, err)\n\t}\n\treturn nil\n}", "func (m *SupportZipXO) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (f FIFOTopicAdvanceConfigOrBool) validate() error {\n\tif f.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn f.Advanced.validate()\n}", "func (fc FSLocalCache) validate() error {\n\n\tif fc.ReleasedInstanceCacheTTLSec > 600 {\n\t\treturn errors.New(\"invalid fsLocalCache.releasedInstanceCacheTTLSec value, should <= 600\")\n\t}\n\n\tif fc.PublishedStrategyCacheTTLSec > 600 {\n\t\treturn errors.New(\"invalid fsLocalCache.publishedStrategyCacheTTLSec value, should <= 600\")\n\t}\n\n\treturn nil\n}", "func (o Observability) validate() error {\n\tif o.isEmpty() {\n\t\treturn nil\n\t}\n\tfor _, validVendor := range tracingValidVendors {\n\t\tif strings.EqualFold(aws.StringValue(o.Tracing), validVendor) {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"invalid tracing vendor %s: %s %s\",\n\t\taws.StringValue(o.Tracing),\n\t\tenglish.PluralWord(len(tracingValidVendors), \"the valid vendor is\", \"valid vendors are\"),\n\t\tenglish.WordSeries(tracingValidVendors, \"and\"))\n}", "func (s SidecarMountPoint) validate() error {\n\tif aws.StringValue(s.SourceVolume) == \"\" {\n\t\treturn &errFieldMustBeSpecified{\n\t\t\tmissingField: \"source_volume\",\n\t\t}\n\t}\n\treturn s.MountPointOpts.validate()\n}", "func (m Shape) Validate() error {\n\treturn validation.Errors{\n\t\t\"coordinates\": validation.Validate(\n\t\t\tm.Coordinates,\n\t\t),\n\t}.Filter()\n}", "func (r RequestDrivenWebService) validate() error {\n\tif err := r.RequestDrivenWebServiceConfig.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn r.Workload.validate()\n}", "func (sd *storageDetails) validate(log logging.Logger, engineCount int, minNrSSDs int) error {\n\tlog.Debugf(\"numa to pmem mappings: %v\", sd.numaPMems)\n\tif len(sd.numaPMems) < engineCount {\n\t\treturn errors.Errorf(errInsufNrPMemGroups, sd.numaPMems, engineCount, len(sd.numaPMems))\n\t}\n\n\tif minNrSSDs == 0 {\n\t\t// set empty ssd lists and skip validation\n\t\tlog.Debug(\"nvme disabled, skip validation\")\n\n\t\tfor nn := 0; nn < engineCount; nn++ {\n\t\t\tsd.numaSSDs[nn] = []string{}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tfor nn := 0; nn < engineCount; nn++ {\n\t\tssds, exists := sd.numaSSDs[nn]\n\t\tif !exists {\n\t\t\tsd.numaSSDs[nn] = []string{} // populate empty lists for missing entries\n\t\t}\n\t\tlog.Debugf(\"ssds bound to numa %d: %v\", nn, ssds)\n\n\t\tif len(ssds) < minNrSSDs {\n\t\t\treturn errors.Errorf(errInsufNrSSDs, nn, minNrSSDs, len(ssds))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (opts resourceOptions) validate() error {\n\t// Check that the required flags did not get a flag as their value.\n\t// We can safely look for a '-' as the first char as none of the fields accepts it.\n\t// NOTE: We must do this for all the required flags first or we may output the wrong\n\t// error as flags may seem to be missing because Cobra assigned them to another flag.\n\tif strings.HasPrefix(opts.Group, \"-\") {\n\t\treturn fmt.Errorf(groupPresent)\n\t}\n\tif strings.HasPrefix(opts.Version, \"-\") {\n\t\treturn fmt.Errorf(versionPresent)\n\t}\n\tif strings.HasPrefix(opts.Kind, \"-\") {\n\t\treturn fmt.Errorf(kindPresent)\n\t}\n\n\t// We do not check here if the GVK values are empty because that would\n\t// make them mandatory and some plugins may want to set default values.\n\t// Instead, this is checked by resource.GVK.Validate()\n\n\treturn nil\n}", "func (o *conversionOptions) validate() error {\r\n\tif o.goalID == 0 && len(o.goalName) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldID, fieldName)\r\n\t} else if o.goalID == 0 && o.tonicPowUserID > 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute: %s\", fieldID)\r\n\t} else if o.tonicPowUserID == 0 && len(o.tncpwSession) == 0 {\r\n\t\treturn fmt.Errorf(\"missing required attribute(s): %s or %s\", fieldVisitorSessionGUID, fieldUserID)\r\n\t}\r\n\treturn nil\r\n}", "func (m *FilterStateRule) Validate() error {\n\treturn m.validate(false)\n}" ]
[ "0.6207214", "0.61084396", "0.6083325", "0.6044888", "0.60177207", "0.60151553", "0.59733284", "0.5963761", "0.5963745", "0.59573025", "0.5941212", "0.5924549", "0.5916653", "0.5896575", "0.58810246", "0.5852411", "0.5833823", "0.5823494", "0.57954365", "0.578536", "0.5776891", "0.57551944", "0.5744473", "0.5719483", "0.5708868", "0.5700047", "0.5685761", "0.5678584", "0.5675618", "0.5670099", "0.56686586", "0.5668604", "0.5660787", "0.5638807", "0.562918", "0.5625762", "0.5618611", "0.561564", "0.5597591", "0.5593056", "0.5585717", "0.5580171", "0.5578517", "0.5570032", "0.5568138", "0.5556442", "0.5553374", "0.5538444", "0.5536271", "0.5531994", "0.5527575", "0.5516325", "0.551252", "0.5509143", "0.5506389", "0.5505022", "0.54984874", "0.5478862", "0.5474368", "0.54738736", "0.5473517", "0.5470263", "0.5467822", "0.5461485", "0.5461364", "0.54606396", "0.5459811", "0.5458842", "0.5450898", "0.5448615", "0.5439937", "0.5436643", "0.5436119", "0.54352975", "0.5429955", "0.5429812", "0.5425355", "0.5414215", "0.5413601", "0.54047555", "0.53985214", "0.53963995", "0.5395258", "0.5394361", "0.5392768", "0.53915346", "0.5391188", "0.5389138", "0.5388039", "0.538523", "0.5383524", "0.5382299", "0.5379287", "0.53779024", "0.53735423", "0.5368985", "0.5362", "0.53581536", "0.535724", "0.5353084" ]
0.64266586
0
%n: name %i: info %s(15:08) start in the golang time format %e(15:08) end in the golang time format %c: category
func (ev *Event) Format(format string) string { return fmt.Sprintf("Start um %s - Name %s\n", ev.Start.Format("15:04"), ev.Name) //return fmt.Sprintf("Start um %s - Name %s\n%s\n", ev.Start.Format("15:04"), ev.Name, ev.Info) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Info(format string, v ...interface{}) {\n\tnow := time.Now()\n\tfmt.Printf(\"%04d/%02d/%02d %02d:%02d:%02d \", now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second())\n\tfmt.Printf(format + \"\\n\", v ...)\n}", "func timeFormat(i interface{}) string {\n\tif i == nil {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"%s\", i)\n}", "func Format(t *time.Time, f string) string {\n\tvar (\n\t\tbuf bytes.Buffer\n\t\ts scanner.Scanner\n\t)\n\n\tif t == nil {\n\t\tnow := time.Now()\n\t\tt = &now\n\t}\n\n\ts.Init(strings.NewReader(f))\n\ts.IsIdentRune = func(ch rune, i int) bool {\n\t\treturn (ch == '%' && i <= 1) || (unicode.IsLetter(ch) && i == 1)\n\t}\n\n\t// Honor all white space characters.\n\ts.Whitespace = 0\n\n\tfor tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {\n\t\ttxt := s.TokenText()\n\t\tif len(txt) < 2 || !strings.HasPrefix(txt, \"%\") {\n\t\t\tbuf.WriteString(txt)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf.WriteString(formats.Apply(*t, txt[1:]))\n\t}\n\n\treturn buf.String()\n}", "func timeFormatter(t time.Time) string {\n\treturn time.Now().Format(time.RFC822)\n}", "func (f DefaultFormatter) Format(event *Event) string {\n\tyear, month, day := event.Time.Date()\n\thour, minute, second := event.Time.Clock()\n\tlevelString := event.Level.String()\n\trightAlignedLevel := strings.Repeat(\" \", 8-len(levelString)) + levelString\n\tmsg := event.Msg\n\tif len(event.Args) > 0 {\n\t\tmsg = fmt.Sprintf(event.Msg, event.Args...)\n\t}\n\tlines := strings.Split(msg, \"\\n\")\n\tfor i, line := range lines {\n\t\tlines[i] = \"\\t\" + line\n\t}\n\tmsg = strings.Join(lines, \"\\n\")\n\treturn fmt.Sprintf(\n\t\t\"%d-%02d-%02d %02d:%02d:%02d: %s: %s: at %s in %s, line %d:\\n%s\\n\\n\",\n\t\tyear, month, day, hour, minute, second,\n\t\trightAlignedLevel, event.Name, event.FuncName,\n\t\tfilepath.Base(event.File), event.Line,\n\t\tstrings.TrimRightFunc(msg, unicode.IsSpace))\n}", "func humanReadableTime(time int) string {\n\treturn fmt.Sprintf(\"%0.2d:%0.2d:%0.2d:%0.2d\", getDays(&time),\n\t\tgetHours(&time), getMinutes(&time), getSeconds(&time))\n}", "func toElapsedLabel(rfc850time string) string {\n\tcreated, err := time.Parse(time.RFC850, rfc850time)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\telapsed := time.Now().UTC().Sub(created.UTC())\n\tseconds := elapsed.Seconds()\n\tminutes := elapsed.Minutes()\n\thours := elapsed.Hours()\n\tdays := hours / 24\n\tweeks := days / 7\n\tmonths := weeks / 4\n\tyears := months / 12\n\n\tif math.Trunc(years) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(years), plural(int64(years), \"year\"))\n\t} else if math.Trunc(months) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(months), plural(int64(months), \"month\"))\n\t} else if math.Trunc(weeks) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(weeks), plural(int64(weeks), \"week\"))\n\t} else if math.Trunc(days) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(days), plural(int64(days), \"day\"))\n\t} else if math.Trunc(hours) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(hours), plural(int64(hours), \"hour\"))\n\t} else if math.Trunc(minutes) > 0 {\n\t\treturn fmt.Sprintf(\"%d %s ago\", int64(minutes), plural(int64(minutes), \"minute\"))\n\t}\n\treturn fmt.Sprintf(\"%d %s ago\", int64(seconds), plural(int64(seconds), \"second\"))\n}", "func debugLog(c context.Context, str *string, format string, args ...interface{}) {\n\tprefix := clock.Now(c).UTC().Format(\"[15:04:05.000] \")\n\t*str += prefix + fmt.Sprintf(format+\"\\n\", args...)\n}", "func (tf timeFormatter) Format(t time.Time) string {\n\tif tf {\n\t\treturn t.Format(time.RFC3339)\n\t}\n\treturn fmt.Sprintf(\"%s ago\", units.HumanDuration(time.Now().UTC().Sub(t.UTC())))\n}", "func timeTrack(start time.Time, n int, name string) {\n\tloopNS := time.Since(start).Nanoseconds() / int64(n)\n\tfmt.Printf(\"%s: %d\\n\", name, loopNS)\n}", "func (t TimeInfo) Format(f string) string {\n\n\tr := []rune(f)\n\tvar s string\n\tfor _, v := range r {\n\t\tswitch v {\n\t\tcase 'Y':\n\t\t\ts += t.Year\n\t\tcase 'm':\n\t\t\ts += t.Month\n\t\tcase 'd':\n\t\t\ts += t.Day\n\t\tcase 'H':\n\t\t\ts += t.Hour\n\t\tcase 'i':\n\t\t\ts += t.Minute\n\t\tcase 's':\n\t\t\ts += t.Second\n\t\tdefault:\n\t\t\ts += string(v)\n\n\t\t}\n\t}\n\n\treturn s\n\n}", "func (r *ApacheLogRecord) formattedTimeRequest() (string, string) {\n\treturn r.time.Format(timeFormat), fmt.Sprintf(requestFormat, r.method, r.uri, r.protocol)\n}", "func formatTime(second int) string {\n\thh := second / 3600\n\tmm := second % 3600 / 60\n\tss := second % 60\n\treturn fmt.Sprintf(\"%02d:%02d:%02d\", hh, mm, ss)\n}", "func logName(t time.Time) (name string) {\n\t// name = fmt.Sprintf(\"%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d\",\n\t// \tprogram,\n\t// \thost,\n\t// \tuserName,\n\t// \ttag,\n\t// \tt.Year(),\n\t// \tt.Month(),\n\t// \tt.Day(),\n\t// \tt.Hour(),\n\t// \tt.Minute(),\n\t// \tt.Second(),\n\t// \tpid)\n\t// 按大小分隔 文件名格式 20180102-183824.log\n\t// 按日期分隔 文件名格式 20180102.log\n\n\tformat := \"%02d%02d%02d\"\n\tif logging.fileNum > 0 {\n\t\tformat += fmt.Sprintf(\".%d\", logging.fileNum)\n\t}\n\n\tname = fmt.Sprintf(format+\".log\",\n\t\tt.Year(),\n\t\tt.Month(),\n\t\tt.Day(),\n\t)\n\n\treturn\n}", "func toLog(context string, str string) {\n\tnow := time.Now()\n\n\tfmt.Println(\"[\" + now.Format(time.RFC822) + \"] \" + context + \": \" + str)\n}", "func Info(format string, v ...interface{}) {\n\tmsg := fmt.Sprintf(\"[I]\"+format, v...)\n\tlog.Println(msg)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s \\n\", name, elapsed)\n}", "func timeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s took %s\\n\", name, elapsed)\n}", "func timeInWords(h int32, m int32) string {\n if m == 0 {\n return numberToString(h) + \" o' clock\"\n }\n\n var next_h int32 = h + 1\n if h == 12 {\n next_h = 1\n }\n\n var min_str = \"minutes\" \n if m == 1 {\n min_str = \"minute\"\n }\n\n if m % 15 == 0 {\n switch m {\n case 15:\n return \"quarter past \" + numberToString(h)\n case 30:\n return \"half past \" + numberToString(h)\n case 45:\n return \"quarter to \" + numberToString(next_h)\n }\n } else if m > 30 {\n return numberToString(60 - m) + \" \" + min_str + \" to \" + numberToString(next_h)\n }\n \n return numberToString(m) + \" \" + min_str + \" past \" + numberToString(h)\n}", "func timeTrack(start time.Time, name string) {\n\tif ShellConfig.Bench {\n\t\tfmt.Fprintf(term, \"%s Method %s took %s %s\\n\", au.Bold(au.Blue(string(\"Δ\"))), au.Bold(au.Blue(name)), time.Since(start), au.Bold(au.Blue(string(\"Δ\"))))\n\t}\n}", "func timeString(t time.Time, c *color.Color) string {\n\treturn c.SprintfFunc()(t.Format(\"2006-01-02 15:04 MST\"))\n}", "func prettyLatency(min, avg, max int64) string {\n\treturn fmt.Sprintf(\"%-11s%-11s%-11s\", prettyDuration(min), prettyDuration(avg), prettyDuration(max))\n}", "func Log(format string, a ...interface{}) {\n\ts := fmt.Sprintf(format, a...)\n\ts = fmt.Sprintf(\"%v: %s\", time.Now().Format(\"2006-01-02T15:04:05.000\"), s)\n\tfmt.Println(s)\n}", "func formatLogMessage(class int, format string, args ...interface{}) string {\n\tif class < 0 || class >= len(loggers) {\n\t\tWriteLog(InternalLogger, \"ERROR: Invalid LogMessage() class %d\", class)\n\n\t\treturn \"\"\n\t}\n\n\tclassName := loggers[class].name\n\ts := fmt.Sprintf(format, args...)\n\n\tsequenceMux.Lock()\n\tdefer sequenceMux.Unlock()\n\n\tsequence = sequence + 1\n\tsequenceString := fmt.Sprintf(\"%d\", sequence)\n\n\tif LogTimeStampFormat == \"\" {\n\t\tLogTimeStampFormat = \"2006-01-02 15:04:05\"\n\t}\n\n\ts = fmt.Sprintf(\"[%s] %-5s %-7s: %s\", time.Now().Format(LogTimeStampFormat), sequenceString, className, s)\n\n\treturn s\n}", "func HumanizeTime(then time.Time) string {\n\tnow := time.Now()\n\n\tlbl := \"ago\"\n\tdiff := now.Unix() - then.Unix()\n\tif then.After(now) {\n\t\tlbl = \"from now\"\n\t\tdiff = then.Unix() - now.Unix()\n\t}\n\n\tswitch {\n\n\tcase diff <= 0:\n\t\treturn \"now\"\n\tcase diff <= 2:\n\t\treturn fmt.Sprintf(\"1 second %s\", lbl)\n\tcase diff < 1*Minute:\n\t\treturn fmt.Sprintf(\"%d seconds %s\", diff, lbl)\n\n\tcase diff < 2*Minute:\n\t\treturn fmt.Sprintf(\"1 minute %s\", lbl)\n\tcase diff < 1*Hour:\n\t\treturn fmt.Sprintf(\"%d minutes %s\", diff/Minute, lbl)\n\n\tcase diff < 2*Hour:\n\t\treturn fmt.Sprintf(\"1 hour %s\", lbl)\n\tcase diff < 1*Day:\n\t\treturn fmt.Sprintf(\"%d hours %s\", diff/Hour, lbl)\n\n\tcase diff < 2*Day:\n\t\treturn fmt.Sprintf(\"1 day %s\", lbl)\n\tcase diff < 1*Week:\n\t\treturn fmt.Sprintf(\"%d days %s\", diff/Day, lbl)\n\n\tcase diff < 2*Week:\n\t\treturn fmt.Sprintf(\"1 week %s\", lbl)\n\tcase diff < 1*Month:\n\t\treturn fmt.Sprintf(\"%d weeks %s\", diff/Week, lbl)\n\n\tcase diff < 2*Month:\n\t\treturn fmt.Sprintf(\"1 month %s\", lbl)\n\tcase diff < 1*Year:\n\t\treturn fmt.Sprintf(\"%d months %s\", diff/Month, lbl)\n\n\tcase diff < 18*Month:\n\t\treturn fmt.Sprintf(\"1 year %s\", lbl)\n\t}\n\treturn then.String()\n}", "func relativeTime(t time.Time) string {\n\tconst day = 24 * time.Hour\n\td := time.Now().Sub(t)\n\tswitch {\n\tcase d < time.Second:\n\t\treturn \"just now\"\n\tcase d < 2*time.Second:\n\t\treturn \"one second ago\"\n\tcase d < time.Minute:\n\t\treturn fmt.Sprintf(\"%d seconds ago\", d/time.Second)\n\tcase d < 2*time.Minute:\n\t\treturn \"one minute ago\"\n\tcase d < time.Hour:\n\t\treturn fmt.Sprintf(\"%d minutes ago\", d/time.Minute)\n\tcase d < 2*time.Hour:\n\t\treturn \"one hour ago\"\n\tcase d < day:\n\t\treturn fmt.Sprintf(\"%d hours ago\", d/time.Hour)\n\tcase d < 2*day:\n\t\treturn \"one day ago\"\n\t}\n\treturn fmt.Sprintf(\"%d days ago\", d/day)\n}", "func relativeTime(t time.Time) string {\n\tconst day = 24 * time.Hour\n\td := time.Now().Sub(t)\n\tswitch {\n\tcase d < time.Second:\n\t\treturn \"just now\"\n\tcase d < 2*time.Second:\n\t\treturn \"one second ago\"\n\tcase d < time.Minute:\n\t\treturn fmt.Sprintf(\"%d seconds ago\", d/time.Second)\n\tcase d < 2*time.Minute:\n\t\treturn \"one minute ago\"\n\tcase d < time.Hour:\n\t\treturn fmt.Sprintf(\"%d minutes ago\", d/time.Minute)\n\tcase d < 2*time.Hour:\n\t\treturn \"one hour ago\"\n\tcase d < day:\n\t\treturn fmt.Sprintf(\"%d hours ago\", d/time.Hour)\n\tcase d < 2*day:\n\t\treturn \"one day ago\"\n\t}\n\treturn fmt.Sprintf(\"%d days ago\", d/day)\n}", "func (t Time) String() string {\n\tseconds := float64(t.Second) + float64(t.Millisecond)/1000\n\treturn fmt.Sprintf(\"%02d:%02d:%07.4f\", t.Hour, t.Minute, seconds)\n}", "func getTimeInfo(activity *driveactivity.DriveActivity) string {\n\tif activity.Timestamp != \"\" {\n\t\treturn activity.Timestamp\n\t}\n\tif activity.TimeRange != nil {\n\t\treturn activity.TimeRange.EndTime\n\t}\n\treturn \"unknown\"\n}", "func TimeTrack(start time.Time, name string, writer io.Writer) {\n\telapsed := time.Since(start)\n\tmessage := fmt.Sprintf(\"\\n%s took %s\", name, elapsed)\n\tif writer == nil {\n\t\tfmt.Println(message)\n\t} else {\n\t\twriter.Write([]byte(message))\n\t}\n}", "func sigarUptimeFormatString(u sigar.Uptime) string {\n\tuptime := uint64(u.Length)\n\tdays := uptime / (60 * 60 * 24)\n\n\ts := \"\"\n\tif days != 0 {\n\t\tend := \"\"\n\t\tif days > 1 {\n\t\t\tend = \"s\"\n\t\t}\n\t\ts = fmt.Sprintf(\"%d day%s, \", days, end)\n\t}\n\n\tminutes := uptime / 60\n\thours := minutes / 60\n\thours %= 24\n\tminutes %= 60\n\n\ts += fmt.Sprintf(\"%2d:%02d\", hours, minutes)\n\treturn s\n}", "func formatTimeString(in int) string {\n\tvar buf bytes.Buffer\n\n\tif h := in / 3600; h < 10 {\n\t\tbuf.WriteString(\"0\" + strconv.Itoa(h))\n\t} else {\n\t\tbuf.WriteString(strconv.Itoa(h))\n\t}\n\tbuf.WriteString(\":\")\n\tlt := in % 3600\n\tif m := lt / 60; m < 10 {\n\t\tbuf.WriteString(\"0\" + strconv.Itoa(m))\n\t} else {\n\t\tbuf.WriteString(strconv.Itoa(m))\n\t}\n\tbuf.WriteString(\":\")\n\tif s := lt % 60; s < 10 {\n\t\tbuf.WriteString(\"0\" + strconv.Itoa(s))\n\t} else {\n\t\tbuf.WriteString(strconv.Itoa(s))\n\t}\n\treturn buf.String()\n}", "func (t Time) Format(ft string) string {\n\tp := epoch.Add(time.Second * time.Duration(t))\n\tif ft == \"\" {\n\t\tft = \"02 Jan 2006 15:04:05\"\n\t}\n\treturn p.In(time.UTC).Format(ft)\n}", "func (ch ConfigHistoryEntry) CreateTimeFormatted() string {\n\treturn ch.CreateTime.Format(http.TimeFormat)\n}", "func formatTime(t time.Time) string {\n\treturn fmt.Sprintf(\"%04d%02d%02d%02d%02d\", t.Year(), t.Month(),\n\t\tt.Day(), t.Hour(), t.Minute())\n}", "func (t Time) Draw() string { return t.time.Format(\"Mon 2 Jan, 15:04\") }", "func (s *Status) Time() string {\n\tp := s.Position\n\td := s.Duration\n\treturn fmt.Sprintf(\"%02d:%02d / %02d:%02d\", p/60, p%60, d/60, d%60)\n}", "func FormatTmsp(num int) string {\n\treturn \"date_format(?,'%Y-%m-%d %H:%i:%s.%f')\"\n}", "func msgPrefix() string {\n\treturn fmt.Sprintf(\"glog: %s: \", time.Now().Format(\"15:04:05.00000\"))\n}", "func formatDuration(d time.Duration) string {\n\t//calculate values\n\tmilliseconds := int64(d/time.Millisecond) % 1000\n\tseconds := int64(d.Seconds()) % 60\n\tminutes := int64(d.Minutes()) % 60\n\thours := int64(d.Hours()) % 24\n\tvar str string = \"\"\n\t//only add values if they are not 0\n\tif hours != 0 {\n\t\tstr = fmt.Sprintf(\"%s%d%s\", str, hours, \" h \")\n\t}\n\tif minutes != 0 {\n\t\tstr = fmt.Sprintf(\"%s%d%s\", str, minutes, \" min \")\n\t}\n\tif seconds != 0 {\n\t\tstr = fmt.Sprintf(\"%s%d%s\", str, seconds, \" sec \")\n\t}\n\tif milliseconds != 0 {\n\t\tstr = fmt.Sprintf(\"%s%d%s\", str, milliseconds, \" ms \")\n\t}\n\t//var str string = fmt.Sprintf(\"%d%s%d%s%d%s%d%s\", hours, \" h \", minutes, \" min \", seconds, \" sec \", milliseconds, \" ms\")\n\treturn str\n}", "func printInfo(tk task, idx, total int) int {\n\tclear()\n\tfmt.Println()\n\tprintSummary(tk, idx, total)\n\n\tstarted, err := time.Parse(stamp, tk.Created)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfinished := time.Now()\n\tif len(tk.Completed) > 0 {\n\t\tfinished, err = time.Parse(stamp, tk.Completed)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tfmt.Println()\n\tif len(tk.Description) > 60 {\n\t\tfmt.Printf(\"Description: %s\\n\", tk.Description)\n\t}\n\tfmt.Printf(\"Tags: \")\n\tntags := make([]string, 0, 10)\n\tfor _, t := range tk.Tags {\n\t\tif isNormalTag(t) {\n\t\t\tntags = append(ntags, t)\n\t\t}\n\t}\n\tfor i, t := range ntags {\n\t\tcolor.New(color.FgRed+color.Attribute(i)).Printf(\" %s\", t)\n\t}\n\tfmt.Println()\n\tfmt.Printf(\"Started: %s\\n\", started.Format(format))\n\tif len(tk.Completed) > 0 {\n\t\tnow := time.Now().UTC()\n\t\tfmt.Printf(\"Completed: %s [%vago]\\n\", finished.Format(format), age(now.Sub(finished)))\n\t}\n\tfmt.Printf(\"Age: %v\\n\", age(finished.Sub(started)))\n\tfmt.Printf(\"UUID: %s\\n\", tk.Uuid)\n\tfmt.Printf(\"XID: %s\\n\", tk.Xid)\n\tfmt.Println()\n\n\tshort.Print(\"task\", true)\n\tr := make([]byte, 1)\n\tos.Stdin.Read(r)\n\n\tins, _ := short.MapsTo(rune(r[0]), \"task\")\n\tswitch ins {\n\tcase \"back\":\n\t\treturn -1\n\tcase \"quit\":\n\t\treturn total\n\tcase \"description\":\n\t\treturn tk.editDescription()\n\tcase \"assigned\":\n\t\treturn tk.editAssigned()\n\tcase \"project\":\n\t\treturn tk.editProject()\n\tcase \"color\":\n\t\treturn tk.editTaskColor()\n\tcase \"tags\":\n\t\treturn tk.editTags()\n\tcase \"reviewed\":\n\t\treturn tk.toggleReviewed()\n\tcase \"delete\":\n\t\treturn tk.deleteTask()\n\tcase \"done\":\n\t\treturn tk.toggleDone()\n\tcase \"disputed\":\n\t\treturn tk.toggleDisputed()\n\tdefault:\n\t\treturn 1\n\t}\n}", "func TimeTracker(start time.Time, name string, logger *log.Logger) {\r\n\telapsed := time.Since(start)\r\n\tlogger.Printf(\"%s took %v Hr, %v Min, %v Sec\", name, int64(elapsed/time.Hour), int64(elapsed/time.Minute), int64(elapsed/time.Second))\r\n}", "func formatTime(t time.Time) string {\n\tzone, _ := t.Zone()\n\t// NOTE: Tried to use time#Format(), but it is very weird implementation.\n\t// Third-party libraries seem not to be maintained.\n\treturn fmt.Sprintf(\n\t\t\"%d%02d%02d_%02d%02d_%02d_%06d_%s\",\n\t\tt.Year(), t.Month(), t.Day(),\n\t\tt.Hour(), t.Minute(),\n\t\tt.Second(),\n\t\tt.Nanosecond() / 1000,\n\t\tzone,\n\t)\n}", "func FormatTime(t int64) (f string) {\n\tts := time.Unix(t, 0)\n\tnow := time.Now()\n\tdiff := now.Unix() - ts.Unix()\n\tvar unit string\n\tvar m int64\n\tif diff < 60 {\n\t\tunit = \"second\"\n\t\tm = 1\n\t} else if diff < 3600 {\n\t\tunit = \"minute\"\n\t\tm = 60\n\t} else if diff < 86400 {\n\t\tunit = \"hour\"\n\t\tm = 3600\n\t} else if diff < 604800 {\n\t\tunit = \"day\"\n\t\tm = 86400\n\t} else if diff < 31556926 {\n\t\tunit = \"month\"\n\t\tm = 604800\n\t} else {\n\t\tunit = \"year\"\n\t\tm = 31556926\n\t}\n\tm = diff / m\n\tif m == 1 {\n\t\tif unit == \"hour\" {\n\t\t\tf = \"an hour ago\"\n\t\t} else {\n\t\t\tf = \"a \" + unit + \" ago\"\n\t\t}\n\t} else {\n\t\tf = fmt.Sprintf(\"%d %ss ago\", m, unit)\n\t}\n\treturn\n}", "func TimeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tlogrus.Infof(\"%s took %s to complete ingest\", name, elapsed)\n}", "func formatTime(t time.Time) string {\n\tif t.Unix() < 1 {\n\t\t// It's more confusing to display the UNIX epoch or a zero value than nothing\n\t\treturn \"\"\n\t}\n\t// Return ISO_8601 time format GH-3806\n\treturn t.Format(\"2006-01-02T15:04:05Z07:00\")\n}", "func (schedule *HumanReadableSchedule) String() string{\n format := \"3:04 PM\"\n var scheduleString string\n for dayNum, dailyOpenHours := range schedule {\n scheduleString += dayStrings[dayNum] + \": \"\n for _,openHours := range dailyOpenHours {\n scheduleString += openHours.StartTime.Format(format) + \" - \" + openHours.EndTime.Format(format)\n }\n scheduleString += \"\\n\"\n\n }\n \n return scheduleString\n}", "func (c *Calendar) Format(t time.Time, str string) string {\n\tres := t.Format(str)\n\tday := c.Query(t.Year(), int(t.Month()), t.Day())\n\n\tfor _, dayName := range NormalDays {\n\t\tres = strings.ReplaceAll(res, dayName, day)\n\t\tres = strings.ReplaceAll(res, dayName[:3], day[:3])\n\t}\n\n\tres = strings.ReplaceAll(res, \"%a\", t.Weekday().String()[:3])\n\tres = strings.ReplaceAll(res, \"%A\", t.Weekday().String())\n\n\treturn res\n}", "func Startf(format string, args ...interface{}) { logRaw(LevelStart, 2, format, args...) }", "func Format(s string, t time.Time) string {\n\trawtime := C.long(t.Unix())\n\tvar info *C.struct_tm\n\tC.ctime(&rawtime)\n\tinfo = C.localtime(&rawtime)\n\tbuf := new(C.char)\n\tformat := C.CString(s)\n\tdefer C.free(unsafe.Pointer(format))\n\tmaxsize := C.ulong(256)\n\tC.strftime(buf, maxsize, format, info)\n\treturn C.GoString(buf)\n}", "func timeFmt(w io.Writer, x interface{}, format string) {\n\t// note: os.Dir.Mtime_ns is in uint64 in ns!\n\ttemplate.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String()))\n}", "func STime(t time.Time) string {\n\t_, month, day := t.Date()\n\thour, minute, second := t.Clock()\n\treturn fmt.Sprintf(\"%02d%02d %02d:%02d:%02d\", int(month), day, hour, minute, second)\n}", "func (l *Logger) formatHeader(buf *[]byte, t time.Time, file string, line int) {\n\t*buf = append(*buf, l.prefix...)\n\tif l.flag&(Ldate|Ltime|Lmicroseconds) != 0 {\n\t\tif l.flag&LUTC != 0 {\n\t\t\tt = t.UTC()\n\t\t}\n\t\tif l.flag&Ldate != 0 {\n\t\t\tyear, month, day := t.Date()\n\t\t\titoa(buf, year, 4)\n\t\t\t*buf = append(*buf, '/')\n\t\t\titoa(buf, int(month), 2)\n\t\t\t*buf = append(*buf, '/')\n\t\t\titoa(buf, day, 2)\n\t\t\t*buf = append(*buf, ' ')\n\t\t}\n\t\tif l.flag&(Ltime|Lmicroseconds) != 0 {\n\t\t\thour, min, sec := t.Clock()\n\t\t\titoa(buf, hour, 2)\n\t\t\t*buf = append(*buf, ':')\n\t\t\titoa(buf, min, 2)\n\t\t\t*buf = append(*buf, ':')\n\t\t\titoa(buf, sec, 2)\n\t\t\tif l.flag&Lmicroseconds != 0 {\n\t\t\t\t*buf = append(*buf, '.')\n\t\t\t\titoa(buf, t.Nanosecond()/1e3, 6)\n\t\t\t}\n\t\t\t*buf = append(*buf, ' ')\n\t\t}\n\t}\n\tif l.flag&(Lshortfile|Llongfile) != 0 {\n\t\tif l.flag&Lshortfile != 0 {\n\t\t\tshort := file\n\t\t\tfor i := len(file) - 1; i > 0; i-- {\n\t\t\t\tif file[i] == '/' {\n\t\t\t\t\tshort = file[i+1:]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfile = short\n\t\t}\n\t\t*buf = append(*buf, file...)\n\t\t*buf = append(*buf, ':')\n\t\titoa(buf, line, -1)\n\t\t*buf = append(*buf, \": \"...)\n\t}\n}", "func TimeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tfmt.Println(name, \"took\", elapsed, \", result: \")\n\tfmt.Println()\n}", "func getTime(data string) {\n\ttime := time.Now()\n\tfecha := fmt.Sprintf(\"%02d:%02d:%02d\",\n\t\ttime.Hour(), time.Minute(), time.Second())\n\trequest := \"[ \" + fecha + \" ]\" + \" \" + data\n\tfmt.Println(request)\n\n}", "func TI() string {\n\t//return time.Now().In(time.FixedZone(\"CST\", 28800)).Format(\"\\r[01-02 15:04:05] \")\n\treturn time.Now().In(time.FixedZone(\"CST\", 28800)).Format(\"[01-02 15:04:05] \")\n}", "func printf(format string, args ...interface{}) {\n\tok := logLevel <= 1\n\n\tif ok {\n\t\tif !logNoTime {\n\t\t\ttimestampedFormat := strings.Join([]string{time.Now().Format(ISO8601Format), format}, \" \")\n\t\t\tlogger.Printf(timestampedFormat, args...)\n\t\t} else {\n\t\t\tlogger.Printf(format, args...)\n\t\t}\n\t}\n}", "func formatStrftime(in string) string {\n\treplacements := map[string]string{\n\t\t\"%p\": \"PM\",\n\t\t\"%Y\": \"2006\",\n\t\t\"%y\": \"06\",\n\t\t\"%m\": \"01\",\n\t\t\"%d\": \"02\",\n\t\t\"%H\": \"15\",\n\t\t\"%M\": \"04\",\n\t\t\"%S\": \"05\",\n\t}\n\n\tout := in\n\n\tfor bad, good := range replacements {\n\t\tout = strings.ReplaceAll(out, bad, good)\n\t}\n\treturn out\n}", "func timeInWords(h int32, m int32) string {\n\tif m == 0 {\n\t\treturn fmt.Sprintf(\"%s o' clock\", words[h])\n\t}\n\tif 1 <= m && m <= 30 {\n\t\treturn fmt.Sprintf(\"%s past %s\", suffix(m), words[h])\n\t}\n\tif m > 30 {\n\t\treturn fmt.Sprintf(\"%s to %s\", suffix(int32(math.Abs(float64(m)-60))), words[h+1])\n\t}\n\n\treturn \"\"\n}", "func formatTime(t time.Time) string {\n\treturn t.UTC().Format(\"2006-01-02T15:04:05Z\")\n}", "func Info(format string, a ...interface{}) {\n\tprefix := blue(info)\n\tlog.Println(prefix, fmt.Sprintf(format, a...))\n}", "func TimeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\n\tfmt.Printf(\"%s took %s\\n\", name, elapsed)\n}", "func infoKindFmt(w io.Writer, x interface{}, format string) {\n\tfmt.Fprintf(w, infoKinds[x.(SpotKind)])\t// infoKind entries are html-escaped\n}", "func formatTimeDifference(first, second time.Time, d time.Duration) string {\n\treturn second.Truncate(d).Sub(first.Truncate(d)).String()\n}", "func genTitle(now time.Time, b *bytes.Buffer) {\n\tb.WriteString(now.Format(timeLayout))\n\n\tb.WriteString(sep)\n\tb.WriteString(strconv.Itoa(getBatteryPercentage()))\n\tb.WriteString(\"%\")\n}", "func buildTimestring(t []string) string {\n\t//Get the length of the time arguments\n\tl := len(t)\n\n\t//The return string\n\trtn := \"\"\n\n\t//The different time granularities\n\tyear := \"\"\n\tmonth := \"\"\n\tday := \"\"\n\thour := \"\"\n\tminute := \"\"\n\tsecond := \"\"\n\n\tswitch l {\n\t//Year only\n\tcase 1:\n\t\tyear = t[0]\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t//year month\n\tcase 2:\n\t\tyear = t[0]\n\t\tmonth = leftPad2Len(t[1], \"0\", 2)\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t\t//Check the month is properly formatted\n\t\tif len(month) == 2 {\n\t\t\trtn += month\n\t\t}\n\t//year month day\n\tcase 3:\n\t\tyear = t[0]\n\t\tmonth = leftPad2Len(t[1], \"0\", 2)\n\t\tday = leftPad2Len(t[2], \"0\", 2)\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t\t//Check the month is properly formatted\n\t\tif len(month) == 2 {\n\t\t\trtn += month\n\t\t}\n\t\t//Check the day is properly formatted\n\t\tif len(day) == 2 {\n\t\t\trtn += day\n\t\t}\n\t//year month day hour\n\tcase 4:\n\t\tyear = t[0]\n\t\tmonth = leftPad2Len(t[1], \"0\", 2)\n\t\tday = leftPad2Len(t[2], \"0\", 2)\n\t\thour = leftPad2Len(t[3], \"0\", 2)\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t\t//Check the month is properly formatted\n\t\tif len(month) == 2 {\n\t\t\trtn += month\n\t\t}\n\t\t//Check the day is properly formatted\n\t\tif len(day) == 2 {\n\t\t\trtn += day\n\t\t}\n\t\t//Check the hour is properly formatted\n\t\tif len(hour) == 2 {\n\t\t\trtn += hour\n\t\t}\n\t//year month day hour minute\n\tcase 5:\n\t\tyear = t[0]\n\t\tmonth = leftPad2Len(t[1], \"0\", 2)\n\t\tday = leftPad2Len(t[2], \"0\", 2)\n\t\thour = leftPad2Len(t[3], \"0\", 2)\n\t\tminute = leftPad2Len(t[4], \"0\", 2)\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t\t//Check the month is properly formatted\n\t\tif len(month) == 2 {\n\t\t\trtn += month\n\t\t}\n\t\t//Check the day is properly formatted\n\t\tif len(day) == 2 {\n\t\t\trtn += day\n\t\t}\n\t\t//Check the hour is properly formatted\n\t\tif len(hour) == 2 {\n\t\t\trtn += hour\n\t\t}\n\t\t//Check the minute is properly formatted\n\t\tif len(minute) == 2 {\n\t\t\trtn += minute\n\t\t}\n\t//year month day hour minute second\n\tcase 6:\n\t\tyear = t[0]\n\t\tmonth = leftPad2Len(t[1], \"0\", 2)\n\t\tday = leftPad2Len(t[2], \"0\", 2)\n\t\thour = leftPad2Len(t[3], \"0\", 2)\n\t\tminute = leftPad2Len(t[4], \"0\", 2)\n\t\tsecond = leftPad2Len(t[5], \"0\", 2)\n\t\t//Check year is properly formatted\n\t\tif len(year) == 4 {\n\t\t\trtn += year\n\t\t}\n\t\t//Check the month is properly formatted\n\t\tif len(month) == 2 {\n\t\t\trtn += month\n\t\t}\n\t\t//Check the day is properly formatted\n\t\tif len(day) == 2 {\n\t\t\trtn += day\n\t\t}\n\t\t//Check the hour is properly formatted\n\t\tif len(hour) == 2 {\n\t\t\trtn += hour\n\t\t}\n\t\t//Check the minute is properly formatted\n\t\tif len(minute) == 2 {\n\t\t\trtn += minute\n\t\t}\n\t\t//Check the second is properly formatted\n\t\tif len(second) == 2 {\n\t\t\trtn += second\n\t\t}\n\t}\n\treturn rtn\n}", "func main() {\n p := fmt.Println\n\n // Here’s a basic example of formatting a time according to RFC3339.\n t := time.Now()\n p(t.Format(\"2006-01-02T15:04:05Z07:00\"))\n\n // Format uses an example-based layout approach; it takes a formatted \n // version of the reference time Mon Jan 2 15:04:05 MST 2006 to determine \n // the general pattern with which to format the given time. The example \n // time must be exactly as shown: the year 2006, 15 for the hour, Monday \n // for the day of the week, etc. Here are a few more examples of time \n // formatting.\n p(t.Format(\"3:04PM\"))\n p(t.Format(\"Mon Jan _2 15:04:05 2006\"))\n p(t.Format(\"2006-01-02T15:04:05.999999-07:00\"))\n\n // For purely numeric representations you can also use standard \n // string formatting with the extracted components of the time value.\n fmt.Printf(\"%d-%02d-%02dT%02d:%02d:%02d-00:00\\n\",\n t.Year(), t.Month(),t.Day(),\n t.Hour(), t.Minute(), t.Second())\n\n // Time parsing uses the same example-based approach as Formating. \n // These examples parse times rendered with some of the layouts used above.\n withNanos := \"2006-01-02T15:04:05.999999999-07:00\"\n t1, e := time.Parse(withNanos,\n \"2012-11-01T22:08:41.117442+00:00\")\n p(t1)\n kitchen := \"3:04PM\"\n t2, e := time.Parse(kitchen, \"8:41PM\")\n p(t2)\n\n // Parse will return an error on malformed input explaining the \n // parsing problem.\n ansic := \"Mon Jan _2 15:04:05 2006\"\n _, e = time.Parse(ansic, \"8:41PM\")\n p(e)\n\n // There are several predefined formats that you can use for both \n // formatting and parsing.\n p(t.Format(time.Kitchen))\n}", "func (ColourFormatter) Format(span Span) string {\n\tduration, _ := time.ParseDuration(fmt.Sprintf(\"%dns\", span.Duration))\n\n\ttags := \"\"\n\n\tfor k, v := range span.Meta {\n\t\ttags = fmt.Sprintf(\"%s %s:%s\", tags, color.CyanString(k), strconv.Quote(v))\n\t}\n\n\treturn fmt.Sprintf(\n\t\t\"[Trace] %s %s %s %s %s %s%s\\n\",\n\t\tcolor.HiCyanString(span.Service),\n\t\tcolor.GreenString(span.Operation),\n\t\tcolor.MagentaString(span.Resource),\n\t\tcolor.WhiteString(span.Type),\n\t\tcolor.YellowString(\"%s\", duration),\n\t\tcolor.WhiteString(\"%d / %d\", span.ParentID, span.SpanID),\n\t\ttags,\n\t)\n}", "func main() {\n\tconst now = 1589570165\n\n\ttimeStamp := time.Unix(now, 0).UTC()\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Scan()\n\ts := scanner.Text()\n\n\telapsedTime := strings.Replace(s, \"мин.\", \"m\", 1)\n\telapsedTime = strings.Replace(elapsedTime, \"сек.\", \"s\", 1)\n\telapsedTime = strings.Replace(elapsedTime, \" \", \"\", -1)\n\n\tdur, err := time.ParseDuration(elapsedTime)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//dur.Round(time.Hour).Hours()\n\tunitedDate := timeStamp.Add(dur)\n\n\tfmt.Println(unitedDate.Format(time.UnixDate))\n\n}", "func repl(match string, t time.Time) string {\n\tif match == \"%%\" {\n\t\treturn \"%\"\n\t}\n\n\tformatFunc, ok := formats[match]\n\tif ok {\n\t\treturn formatFunc(t)\n\t}\n\treturn formatNanoForMatch(match, t)\n}", "func usage() string {\n\treturn `\n\n Usage:\n ./qdawslogs [-logGroupName xxx] [-field xx]* -filter FILTER_CLAUSE or -messageFilter [-startTime epoch/RFC3339] [-endTime epoch/RFC3339] [-limit xxx] [-region xxx]\n\n Required: -filter or -messageFilter. \n\n Filter must be a complete filter clause. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html\n MessageFilter is the value to be included in the like clause.\n\n -field is optional. Can be specified multiple times. When specified, it should be one of the following: @timestamp, @message, @logStream or @ingestionTime\n\n -startTime/-endTime can be either an integer for the epoch time in seconds or RFC 3339 format (which is the case of graphQL datetime value\n\n Optional with provided values:\n logGroupName = /aws/ecs/prod-rt\n region=us-east-1\n field = @timestamp, @message, @logStream\n startTime = 1hour before now\n endTime = now\n\n\n -------------------\n Example:\n\n [1] Getting fields timestamp, message from the log group /aws/ecs/stage-rt within the previous hour of the given epoch time: \n\n\t\t ./qdawslogs -logGroupName /aws/ecs/stage-rt -field @timestamp -field @message -filter \"@message like /19062412_5Xi2eYcEc6/\" -endTime 1560322977 -limit 1000\n \n\n\n\n [2] Getting default fields (timestamp, message, logStream) from the default log group /aws/ecs/prod-rt with startTime 2019-06-12T06:47:12.000Z, filtering \n messages containing 19062412_5Xi2eYcEc6:\n\n\t\t ./qdawslogs.mac -startTime \"2019-06-12T06:47:12.000Z\" -messageFilter 19062412_5Xi2eYcEc6\n\n\n\n\n [3] Getting default fields (timestamp, message, logStream) from the default log group /aws/ecs/prod-rt with startTime 2019-06-12T06:47:12.000Z, filtering \n messages containing 19062412_5Xi2eYcEc6 AND logStream contains \"coord\":\n\n ./qdawslogs.mac -startTime \"2019-06-12T06:47:12.000Z\" -messageFilter 19062412_5Xi2eYcEc6 -filter \"@logStream like /coord/\"\n \n\n`\n}", "func TimeTrack(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tlog.Printf(\"%s took %s\", name, elapsed)\n}", "func humanDate(t time.Time) string {\n\treturn t.Format(\"Jan 02 2006 at 15:04\")\n}", "func timeTrack(start time.Time, action string) {\n\telapsed := time.Since(start)\n\tfmt.Printf(\"%s done in %v\\n\", action, elapsed)\n}", "func formatTimeout(d time.Duration) (string, error) {\n\tif d > time.Hour {\n\t\treturn \"\", fmt.Errorf(\"timeout must be one hour or less\")\n\t}\n\tif d == time.Hour {\n\t\treturn \"01:00:00\", nil\n\t}\n\tif d < time.Minute {\n\t\treturn fmt.Sprintf(\"00:00:%02.0f\", d.Seconds()), nil\n\t}\n\ttMinutes := d.Truncate(time.Minute)\n\n\ttSeconds := d - tMinutes\n\treturn fmt.Sprintf(\"00:%02.0f:%02.0f)\", tMinutes.Minutes(), tSeconds.Seconds()), nil\n}", "func formatTimeout(d time.Duration) (string, error) {\n\tif d > time.Hour {\n\t\treturn \"\", fmt.Errorf(\"timeout must be one hour or less\")\n\t}\n\tif d == time.Hour {\n\t\treturn \"01:00:00\", nil\n\t}\n\tif d < time.Minute {\n\t\treturn fmt.Sprintf(\"00:00:%02.0f\", d.Seconds()), nil\n\t}\n\ttMinutes := d.Truncate(time.Minute)\n\n\ttSeconds := d - tMinutes\n\treturn fmt.Sprintf(\"00:%02.0f:%02.0f)\", tMinutes.Minutes(), tSeconds.Seconds()), nil\n}", "func formatLog(level string, format string, v ...interface{}) string {\n\tvar msg string\n\tif len(v) > 0 {\n\t\tmsg = fmt.Sprintf(format, v...)\n\t} else {\n\t\t// Don't run the message through fmt.Sprintf if no args were\n\t\t// supplied. This avoids the %!(MISSING) spam that fmt adds if\n\t\t// it sees an unmatched formatting string (e.g. a %s without a\n\t\t// matching arg). This makes it easy to log.Info(someVariable)\n\t\t// without worrying about junk in the output should it contain\n\t\t// a % sign.\n\t\tmsg = format\n\t}\n\ttimestr := time.Now().UTC().Format(\"2006-01-02 15:04:05.000000\")\n\treturn fmt.Sprintf(\"%s [%s]: %s\\n\", timestr, level, msg)\n}", "func (t TimeOfDay) String() string {\n\td := time.Duration(t)\n\thour := d / time.Hour\n\tmin := (d % time.Hour) / time.Minute\n\treturn fmt.Sprintf(\"%02d:%02d\", hour, min)\n}", "func timeDisplay(t time.Time) string {\n\tif t.IsZero() {\n\t\treturn \"\"\n\t}\n\treturn t.Format(\"3:04pm\")\n}", "func HumanizeTime(t time.Time) string {\n\t// Decide on the day of month string ending \n\tdayEnding := \"\"\n\tswitch (t.Day() % 10) {\n\tcase 1:\n\t\tdayEnding = \"st\"\n\tcase 2:\n\t\tdayEnding = \"nd\"\n\tcase 3:\n\t\tdayEnding = \"rd\"\n\tdefault:\n\t\tdayEnding = \"th\"\n\t}\n\n\treturn fmt.Sprintf(\n\t\t\"%s %d%s, %d\", \n\t\tt.Month(), \n\t\tt.Day(), \n\t\tdayEnding, \n\t\tt.Year(),\n\t)\n}", "func (t *Time) Format(format string) string {\n\trunes := []rune(format)\n\tbuffer := bytes.NewBuffer(nil)\n\tfor i := 0; i < len(runes); {\n\t\tswitch runes[i] {\n\t\tcase '\\\\':\n\t\t\tif i < len(runes)-1 {\n\t\t\t\tbuffer.WriteRune(runes[i+1])\n\t\t\t\ti += 2\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn buffer.String()\n\t\t\t}\n\t\tcase 'W':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.WeeksOfYear()))\n\t\tcase 'z':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.DayOfYear()))\n\t\tcase 't':\n\t\t\tbuffer.WriteString(strconv.Itoa(t.DaysInMonth()))\n\t\tcase 'U':\n\t\t\tbuffer.WriteString(strconv.FormatInt(t.Unix(), 10))\n\t\tdefault:\n\t\t\tif runes[i] > 255 {\n\t\t\t\tbuffer.WriteRune(runes[i])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif f, ok := formats[byte(runes[i])]; ok {\n\t\t\t\tresult := t.Time.Format(f)\n\t\t\t\t// Particular chars should be handled here.\n\t\t\t\tswitch runes[i] {\n\t\t\t\tcase 'j':\n\t\t\t\t\tfor _, s := range []string{\"=j=0\", \"=j=\"} {\n\t\t\t\t\t\tresult = strings.Replace(result, s, \"\", -1)\n\t\t\t\t\t}\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\tcase 'G':\n\t\t\t\t\tfor _, s := range []string{\"=G=0\", \"=G=\"} {\n\t\t\t\t\t\tresult = strings.Replace(result, s, \"\", -1)\n\t\t\t\t\t}\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\tcase 'u':\n\t\t\t\t\tbuffer.WriteString(strings.Replace(result, \"=u=.\", \"\", -1))\n\t\t\t\tcase 'w':\n\t\t\t\t\tbuffer.WriteString(weekMap[result])\n\t\t\t\tcase 'N':\n\t\t\t\t\tbuffer.WriteString(strings.Replace(weekMap[result], \"0\", \"7\", -1))\n\t\t\t\tcase 'S':\n\t\t\t\t\tbuffer.WriteString(formatMonthDaySuffixMap(result))\n\t\t\t\tdefault:\n\t\t\t\t\tbuffer.WriteString(result)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbuffer.WriteRune(runes[i])\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\treturn buffer.String()\n}", "func timeConversion(s string) string {\n\tlayout1 := \"3:04:05PM\"\n\tlayout2 := \"15:04:05\"\n\n\tfmt.Println(\"S =\", s)\n\tt, _ := time.Parse(layout1, s)\n\t//fmt.Println(t.Format(layout2))\n\t//fmt.Println(t.Format(layout2))\n\t//fmt.Println(t)\n\treturn t.Format(layout2)\n}", "func formatData(t time.Time) string {\n\treturn t.Format(\"2006-02-01\")\n}", "func humanDate(t time.Time) string {\n\treturn t.Format(\"02 Jan 2006 at 15:04\")\n}", "func (t epochTime) Format(str string) string {\n\treturn time.Time(t).Format(str)\n}", "func parseUnixTimeString(ref *ShapeRef, memName, v string) string {\n\tref.API.AddSDKImport(\"private/protocol\")\n\treturn fmt.Sprintf(\"%s: %s,\\n\", memName, inlineParseModeledTime(protocol.UnixTimeFormatName, v))\n}", "func Format(t time.Time) string {\n\treturn t.Format(\"2006-01-02T15:04:05.999999999Z07:00\")\n}", "func FormatTime(t time.Time) string {\n\treturn fmt.Sprintf(`\"%s\"`, t.UTC().Format(GerritTimestampLayout))\n}", "func logHeader(format string, a ...interface{}) {\n\tn, _ := fmt.Printf(format+\"\\n\", a...)\n\tfmt.Println(strings.Repeat(\"-\", n-1))\n}", "func timeToFormat(t int64, f string) string {\n\tutc, err := time.LoadLocation(\"UTC\")\n\tif err != nil {\n\t\tlog.Println(\"time.LoadLocation failed:\", err)\n\t\treturn \"\"\n\t}\n\tparsedTime := time.Unix(t, 0)\n\treturn escape(parsedTime.In(utc).Format(f))\n}", "func TrackTime(start time.Time, name string) {\n\telapsed := time.Since(start)\n\tlog.Printf(\"%s took %s to complete\", name, elapsed)\n}", "func logInfo(format string, v ...interface{}) {\n\ts := fmt.Sprintf(format, v...)\n\tlogger.Println(s)\n}", "func GetTimeString() string {\n\tt := time.Now()\n\ttimeString := fmt.Sprintf(\"%d %s %d, %d:%d:%d\", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())\n\treturn timeString\n}" ]
[ "0.60300833", "0.5984522", "0.56032693", "0.5509569", "0.5505164", "0.54530114", "0.5419605", "0.54179835", "0.54158646", "0.54091454", "0.539712", "0.53604996", "0.53587306", "0.5345082", "0.5297486", "0.5289144", "0.52756804", "0.52756804", "0.52756804", "0.52756804", "0.52756804", "0.52756804", "0.52756804", "0.52756804", "0.5252052", "0.5251977", "0.524969", "0.52476233", "0.5246774", "0.524615", "0.52448994", "0.5237618", "0.5227925", "0.5227925", "0.52274466", "0.5222128", "0.52158356", "0.5204222", "0.52004325", "0.519785", "0.5196011", "0.519161", "0.518108", "0.51756895", "0.5175614", "0.51704824", "0.5161909", "0.5155872", "0.51519245", "0.51504195", "0.5145981", "0.5123217", "0.511757", "0.5107791", "0.51067173", "0.51064235", "0.51063895", "0.51060325", "0.5092931", "0.5088345", "0.50835544", "0.50714105", "0.50662595", "0.50533724", "0.5048206", "0.50432104", "0.50413454", "0.50337017", "0.50238043", "0.50196177", "0.50194967", "0.5008146", "0.5005769", "0.49992767", "0.49938536", "0.49899733", "0.4985628", "0.49734548", "0.49647874", "0.49581006", "0.49566197", "0.4952644", "0.4952644", "0.49513733", "0.49395564", "0.4938808", "0.49360463", "0.4931323", "0.49248734", "0.4924312", "0.49236417", "0.49173942", "0.4913305", "0.4910943", "0.49106416", "0.49073622", "0.49051797", "0.49022698", "0.48929816", "0.48927724" ]
0.61823803
0
GetId returns the Id field if nonnil, zero value otherwise.
func (o *MicrosoftGraphWorkbookComment) GetId() string { if o == nil || o.Id == nil { var ret string return ret } return *o.Id }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *SingleSelectFieldField) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *SingleSelectFieldField) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ProdutoVM) GetId() int64 {\n\tif o == nil || o.Id.Get() == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id.Get()\n}", "func (reading_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*Reading).Id, nil\n}", "func (m *Device) GetId() (val string, set bool) {\n\tif m.Id == nil {\n\t\treturn\n\t}\n\n\treturn *m.Id, true\n}", "func (s *Object) GetId() ObjectID {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Id\n}", "func (entity_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*Entity).Id, nil\n}", "func (testEntityRelated_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*TestEntityRelated).Id, nil\n}", "func (o *View) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *LocalDatabaseProvider) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (testStringIdEntity_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn objectbox.StringIdConvertToDatabaseValue(object.(*TestStringIdEntity).Id), nil\n}", "func (o *EntityId) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *EntityId) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *EventoDTO) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Domain) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (e *Element) GetId() uint64 {\n\treturn e.Id\n}", "func (n *Node) GetId() int {\n\treturn n.id\n}", "func (o *ProformaArray) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Wireless) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (testEntityInline_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*TestEntityInline).Id, nil\n}", "func (o *Invoice) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *ModelsUser) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Invoice) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *FileversionFileversion) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *User) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *User) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *GetMessagesAllOf) GetId() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Id\n}", "func (o *CartaoProduto) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *ProdutoVM) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id.Get(), o.Id.IsSet()\n}", "func (m *Mob) GetId() int {\n\treturn m.Id\n}", "func (event_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*Event).Id, nil\n}", "func (o *CartaoProduto) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *UserDisco) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *EventoDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (m *DiscoveredSensitiveType) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "func (o *ActionDTO) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *ViewCustomFieldTask) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Platform) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *Domain) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *View) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *LocalDatabaseProvider) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Service) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *Replication) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (m *SmsLogRow) GetId()(*string) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *BulletinDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (x *QueryAccountAddressByIDRequest) GetId() int64 {\n\tif x != nil {\n\t\treturn x.Id\n\t}\n\treturn 0\n}", "func (o *BulletinDTO) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Venda) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Permissao) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Vm) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (a HassEntity) GetID() string { return a.ID }", "func (o *Venda) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (s *Source) GetID() int64 {\n\tif s == nil || s.ID == nil {\n\t\treturn 0\n\t}\n\treturn *s.ID\n}", "func (o *Project) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *EmbeddedUnitModel) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *Ga4ghChemotherapy) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Vm) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *ErrorResponseWeb) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *ViewMilestone) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *ReportingTaskEntity) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Url) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *DeviceNode) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Metric) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewTag) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *AddOn) GetID() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2 != 0\n\tif ok {\n\t\tvalue = o.id\n\t}\n\treturn\n}", "func (o *ReportingTaskEntity) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *UserDisco) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewCustomFieldTask) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func getId(val reflect.Value) (id int, err error) {\n\tfld := val.FieldByName(\"ID\")\n\tif !fld.IsValid() || fld.Kind() != reflect.Int {\n\t\treturn 0, fmt.Errorf(\"%T is missing a field `ID int`\", val.Type())\n\t}\n\tid = int(fld.Int())\n\treturn\n}", "func (e GenericPersistable) GetID() string {\n\t\treturn e.ID\n\t}", "func (o *ViewSampleProject) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (mdl *Model) GetID() interface{} {\n\treturn mdl.id\n}", "func (o *PlatformImage) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (m *AgedAccountsPayable) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "func (t tag) GetId() string {\n return t.GetAttr(\"id\")\n}", "func (o *Platform) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *LogicalDatabaseResponse) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *HclFirmware) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (s Strategy) GetIDField(coralName string) string {\n\treturn s.Map.Entities[coralName].ID\n}", "func (u *UserEmpty) GetID() (value int64) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.ID\n}", "func (p *Project) GetID() int64 {\n\tif p == nil || p.ID == nil {\n\t\treturn 0\n\t}\n\treturn *p.ID\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ModelsUser) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (d UserData) ID() int64 {\n\tval := d.ModelData.Get(models.NewFieldName(\"ID\", \"id\"))\n\tif !d.Has(models.NewFieldName(\"ID\", \"id\")) {\n\t\treturn *new(int64)\n\t}\n\treturn val.(int64)\n}", "func (o *CompartimentoHistorico) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *Project) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Metric) GetId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "func (o *ReservationModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ProformaArray) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Snippet) GetId() int32 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *UserInvitationResponseData) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *CompartimentoHistorico) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (m *PortalNotification) GetId()(*string) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *EmbeddedUnitModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Tag) 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}", "func (o *ViewMilestone) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Tag) GetId() int64 {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (u *User) GetID() int64 {\n\tif u == nil || u.ID == nil {\n\t\treturn 0\n\t}\n\treturn *u.ID\n}", "func (m *PaymentTerm) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "func (o *Permissao) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}" ]
[ "0.6953976", "0.67168885", "0.66161835", "0.660102", "0.6598684", "0.6574584", "0.65456045", "0.6534216", "0.652696", "0.64897794", "0.64836514", "0.6436118", "0.6433812", "0.63791615", "0.63787955", "0.63447875", "0.6341663", "0.63393587", "0.6339328", "0.6337854", "0.63315", "0.63313144", "0.63300234", "0.6327539", "0.6314641", "0.6314641", "0.6302939", "0.63020915", "0.62887263", "0.62719643", "0.6268991", "0.6252837", "0.62527245", "0.6252048", "0.62444013", "0.62384737", "0.62311685", "0.62304854", "0.6222979", "0.6216241", "0.61992395", "0.6193274", "0.6188329", "0.61797786", "0.61734945", "0.6172686", "0.6165196", "0.6156001", "0.6148079", "0.6142838", "0.61409533", "0.61306715", "0.6109133", "0.61067724", "0.6104936", "0.6104122", "0.61036456", "0.60995907", "0.6096071", "0.60915416", "0.60880005", "0.60875595", "0.60754955", "0.6063834", "0.60557526", "0.60509634", "0.6048751", "0.6044585", "0.6040335", "0.6038628", "0.60385144", "0.6035036", "0.60350144", "0.6034013", "0.6033127", "0.603035", "0.6029881", "0.6021591", "0.6020046", "0.6018803", "0.6018559", "0.60145867", "0.60145867", "0.601323", "0.6008328", "0.6007798", "0.60022044", "0.6001173", "0.5997362", "0.5994682", "0.5993871", "0.5992846", "0.5991701", "0.5976094", "0.59759885", "0.5975444", "0.5974789", "0.5961784", "0.59613985", "0.59599024", "0.5949871" ]
0.0
-1
GetIdOk returns a tuple with the Id field if it's nonnil, zero value otherwise and a boolean to check if the value has been set.
func (o *MicrosoftGraphWorkbookComment) GetIdOk() (string, bool) { if o == nil || o.Id == nil { var ret string return ret, false } return *o.Id, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *SingleSelectFieldField) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ProdutoVM) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id.Get(), o.Id.IsSet()\n}", "func (o *LocalDatabaseProvider) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *EntityId) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Domain) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Ga4ghChemotherapy) 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}", "func (o *UserDisco) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ModelsUser) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ProjectApiKey) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Replication) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Tag) 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}", "func (o *View) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *EventoDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Platform) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Venda) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Permissao) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ParameterContextDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PartialApplicationKey) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Vm) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *CredentialsResponseElement) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *VerifiableAddress) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewCustomFieldTask) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Invitation) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Project) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *NotificationConfig) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ReservationModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *LogicalDatabaseResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Account) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *IdentityAccount) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Invoice) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *HclFirmware) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewTag) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Rule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ReportingTaskEntity) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Metric) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *CompartimentoHistorico) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *GetMessagesAllOf) GetIdOk() (*interface{}, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewSampleProject) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewMilestone) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Environment) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PolylineMap) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *UserInvitationResponseData) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *RecurrenceRepetition) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Authorization) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *EmbeddedUnitModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *BulletinDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Channel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Snippet) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *FileversionFileversion) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *CustconfTimePseudoStreaming) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *NormalizedProjectRevisionHook) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ProformaArray) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *WafPolicyGroup) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ActionDTO) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SessionDevice) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Ga4ghTumourboard) 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}", "func (o *MemberResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Hdd) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Ga4ghFeature) 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}", "func (o *Run) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *CartaoProduto) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *DeviceNode) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ComponentReferenceDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Url) 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}", "func (o *TokenResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *AuthenticationResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ErrorResponseWeb) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Application) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *IncomeVerificationWebhookStatus) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *PlatformImage) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewUserDashboard) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ShortenBitlinkBodyAllOf) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *MonitorSearchResult) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *VmRestorePoint) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TeamSubject) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ReconciliationTarget) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *CustconfDynamicCacheRule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewPortfolioCard) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Cluster) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Transfer) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *DashboardReportStub) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TenantExternalView) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PostWebhook) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *RiskRulesListAllOfData) GetIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.Id) {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PostUserGroupAdminRequest) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Comment) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *NotificationProjectBudgetNotification) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *UiIntegrationCreatedModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *MicrosoftGraphSharedPcConfiguration) 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}", "func (o *KanbanViewView) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ModelsBackupSchedule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SmscSession) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ClientProvidedEnhancedTransaction) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *IamUserAuthorization) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ZoneZone) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SubDescriptionDto) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *CustconfOriginPullHost) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *MicrosoftGraphEducationUser) 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}", "func (o *ViewProjectBudget) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}" ]
[ "0.78224844", "0.77446544", "0.7714638", "0.76874846", "0.7682164", "0.76202273", "0.76202273", "0.75946486", "0.75638247", "0.7550405", "0.7548159", "0.7534694", "0.7534606", "0.7528571", "0.7521218", "0.7514315", "0.7492807", "0.7488628", "0.7481412", "0.7471156", "0.7463993", "0.7457754", "0.7442402", "0.74375725", "0.7435825", "0.74304396", "0.7414959", "0.7413317", "0.7413085", "0.7411749", "0.7410785", "0.74086475", "0.74076825", "0.7405622", "0.7401661", "0.7389336", "0.7384015", "0.7365462", "0.73574156", "0.7337011", "0.73365986", "0.7327954", "0.7305335", "0.73051715", "0.7302807", "0.73001546", "0.72985566", "0.72979414", "0.72963977", "0.72963506", "0.7292039", "0.72870755", "0.72769934", "0.72761357", "0.7268828", "0.7268707", "0.72660875", "0.72650754", "0.7249715", "0.7246054", "0.7244914", "0.72285694", "0.7212066", "0.7207106", "0.7204114", "0.7203139", "0.7202747", "0.7200582", "0.71955955", "0.7193505", "0.71906596", "0.71848536", "0.7177639", "0.71715975", "0.71498376", "0.71478426", "0.7139435", "0.7127991", "0.7124273", "0.71238035", "0.7122576", "0.7118879", "0.7114919", "0.7101439", "0.7101375", "0.70935154", "0.7091062", "0.708373", "0.7076929", "0.7070224", "0.7069337", "0.70529115", "0.7047204", "0.7039941", "0.70381874", "0.700524", "0.70029366", "0.70025146", "0.69983757", "0.6997784", "0.6994127" ]
0.0
-1
HasId returns a boolean if a field has been set.
func (o *MicrosoftGraphWorkbookComment) HasId() bool { if o != nil && o.Id != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *User) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ModelsUser) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LocalDatabaseProvider) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *EventoDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Invoice) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UserDisco) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasID() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"ID\", \"id\"))\n}", "func (o *Permissao) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ReportingTaskEntity) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Domain) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewUserDashboard) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BulletinDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewSampleProject) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghChemotherapy) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphEducationUser) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Rule) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Run) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectBudget) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Venda) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ParameterContextDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Invitation) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghTumourboard) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Authorization) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Tag) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UserInvitationResponseData) HasId() bool {\n\treturn o != nil && o.Id != nil\n}", "func (o *Ga4ghFeature) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WafPolicyGroup) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *IdentityAccount) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NormalizedProjectRevisionHook) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProdutoVM) HasId() bool {\n\tif o != nil && o.Id.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ActionDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Snippet) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Link) HasId() (ok bool) {\n\treturn t.id != nil\n\n}", "func (o *EntityId) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ComponentReferenceDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *User) HasID() bool { return c.ID > 0 }", "func (o *IamUserAuthorization) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CredentialsResponseElement) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TenantExternalView) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewPortfolioCard) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TenantWithOfferWeb) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CustconfDynamicCacheRule) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewTag) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CartaoProduto) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PartialApplicationKey) HasId() bool {\n\treturn o != nil && o.Id != nil\n}", "func (o *InlineResponse20049Post) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *HclFirmware) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ShortenBitlinkBodyAllOf) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20034Milestone) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Environment) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ReconciliationTarget) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CustconfOriginPullHost) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RecurrenceRepetition) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FileversionFileversion) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphItemReference) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20027Person) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CompartimentoHistorico) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProformaArray) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MonitorSearchResult) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Comment) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DeviceNode) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotificationConfig) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PolylineMap) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20033Milestones) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *GetMessagesAllOf) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *V1VolumeClaim) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ControllerServiceReferencingComponentDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphListItem) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FlowBreadcrumbDTO) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Url) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PlatformImage) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphEducationSchool) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RiskRulesListAllOfData) HasId() bool {\n\tif o != nil && !IsNil(o.Id) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Hdd) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphSharedPcConfiguration) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotificationProjectBudgetNotification) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CustconfTimePseudoStreaming) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Cluster) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ModelsBackupSchedule) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20014Projects) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse2004People) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20051TodoItems) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ZoneZone) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *VmResizeZone) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphMailSearchFolder) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasCustomfieldId() bool {\n\tif o != nil && o.CustomfieldId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Path) HasID() bool {\n\treturn len(p.ID) > 0\n}", "func (c EtcdConf) HasID() bool {\n\treturn c.ID > 0\n}", "func (o *Ga4ghFeature) HasFeatureSetId() bool {\n\tif o != nil && o.FeatureSetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AutocompleteIngredientSearch200ResponseInner) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasLockdownId() bool {\n\tif o != nil && o.LockdownId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DnsViewparamDataData) HasServerId() bool {\n\tif o != nil && o.ServerId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageSasExpander) HasExpanderId() bool {\n\tif o != nil && o.ExpanderId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ClassMemberReference) HasOdataId() bool {\n\tif o != nil && o.OdataId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasEmployeeId() bool {\n\tif o != nil && o.EmployeeId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.7803682", "0.7803682", "0.7782001", "0.77493006", "0.76640564", "0.7561576", "0.7555614", "0.7519684", "0.7519557", "0.751327", "0.74863374", "0.748026", "0.74574", "0.745003", "0.7444921", "0.7437811", "0.7413338", "0.74073607", "0.7393123", "0.7382991", "0.7362027", "0.7348461", "0.7314421", "0.7302638", "0.7299986", "0.72945714", "0.72812545", "0.7280374", "0.72612774", "0.7248204", "0.7244216", "0.72322094", "0.7229699", "0.72205615", "0.7219892", "0.72130704", "0.72116876", "0.72075367", "0.7206388", "0.7204398", "0.7203236", "0.7176401", "0.71713585", "0.71675336", "0.71670157", "0.71643853", "0.7146106", "0.71429515", "0.7142358", "0.71339214", "0.7115583", "0.7100551", "0.7095988", "0.7092151", "0.708805", "0.7086706", "0.70839846", "0.70693827", "0.7064524", "0.70391285", "0.70353085", "0.70227015", "0.7014274", "0.70135665", "0.70115703", "0.70077217", "0.70034426", "0.69917935", "0.6979367", "0.6963261", "0.6957534", "0.6943763", "0.6932252", "0.6930523", "0.692886", "0.6918092", "0.6906896", "0.68579984", "0.68109995", "0.68010956", "0.6778937", "0.6760913", "0.673472", "0.6710886", "0.6692153", "0.66408867", "0.6630476", "0.6598553", "0.6553699", "0.6536191", "0.64674014", "0.6441568", "0.64409316", "0.6370913", "0.63279", "0.6316329", "0.6300502", "0.62775064", "0.6262633", "0.6248685" ]
0.64817476
90
SetId gets a reference to the given string and assigns it to the Id field.
func (o *MicrosoftGraphWorkbookComment) SetId(v string) { o.Id = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (me *TartIdType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func TestGetSetID(t *testing.T) {\n\tid := ID(\"someid\")\n\tvar r Record\n\tr.Set(&id)\n\n\tvar id2 ID\n\trequire.NoError(t, r.Load(&id2))\n\tassert.Equal(t, id, id2)\n}", "func (p *Process) CmdSetID(pac teoapi.Packet) (err error) {\n\tdata := pac.RemoveTrailingZero(pac.Data())\n\trequest := cdb.KeyValue{Cmd: pac.Cmd()}\n\tif err = request.UnmarshalText(data); err != nil {\n\t\treturn\n\t} else if err = p.tcdb.SetID(request.Key, request.Value); err != nil {\n\t\treturn\n\t}\n\t// Return only Value for text requests and all fields for json\n\tresponce := request\n\tresponce.Value = nil\n\tif !request.RequestInJSON {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), responce.Value)\n\t} else if retdata, err := responce.MarshalText(); err == nil {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), retdata)\n\t}\n\treturn\n}", "func (m *ParentLabelDetails) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (testStringIdEntity_EntityInfo) SetId(object interface{}, id uint64) {\n\tobject.(*TestStringIdEntity).Id = objectbox.StringIdConvertToEntityProperty(id)\n}", "func (o SegmentResponseOutput) SetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SegmentResponse) string { return v.SetId }).(pulumi.StringOutput)\n}", "func (m *AuthenticationContext) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ChatMessageAttachment) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *DiscoveredSensitiveType) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *PortalNotification) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (p *PointsSgMutator) SetId(val uint64) bool { //nolint:dupl false positive\n\tif val != p.Id {\n\t\tp.mutations = append(p.mutations, A.X{`=`, 0, val})\n\t\tp.Id = val\n\t\treturn true\n\t}\n\treturn false\n}", "func (me *TSAFPTGLAccountID) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (m *TermStoreRequestBuilder) SetsById(id string)(*i619b375874405f8a48a2830bcc3f479ceef5c227f0ff2205d5561454de690fef.SetItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"set%2Did\"] = id\n }\n return i619b375874405f8a48a2830bcc3f479ceef5c227f0ff2205d5561454de690fef.NewSetItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (m MemoryStore) setId(model gomdi.Model) {\n\ttotal := m[model.Table()].Len()\n\tmodel.SetId(strconv.Itoa(total))\n}", "func (me *TartIdTypeInt) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (s UserSet) SetID(value int64) {\n\ts.RecordCollection.Set(models.NewFieldName(\"ID\", \"id\"), value)\n}", "func (t *tag) SetId(id string) *tag {\n t.SetAttr(\"id\", id)\n return t\n}", "func (s *CreateTestSetDiscrepancyReportOutput) SetTestSetId(v string) *CreateTestSetDiscrepancyReportOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func NewStringID(v string) ID { return ID{name: v} }", "func (s *CreateTestSetDiscrepancyReportInput) SetTestSetId(v string) *CreateTestSetDiscrepancyReportInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (r *ModifyAppGeneralSettingByIdRequest) SetId(id int) {\n r.Id = &id\n}", "func (o *Ga4ghFeature) SetFeatureSetId(v string) {\n\to.FeatureSetId = &v\n}", "func (m *StoreItemRequestBuilder) SetsById(id string)(*ib6b55dfc35d41e5306edb4c31882d97fa855e36e1f8d413bfb9bdb0f532f0d2c.SetItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"set%2Did\"] = id\n }\n return ib6b55dfc35d41e5306edb4c31882d97fa855e36e1f8d413bfb9bdb0f532f0d2c.NewSetItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (s *DescribeTestSetDiscrepancyReportOutput) SetTestSetId(v string) *DescribeTestSetDiscrepancyReportOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (testEntityRelated_EntityInfo) SetId(object interface{}, id uint64) {\n\tobject.(*TestEntityRelated).Id = id\n}", "func (s *TestSetSummary) SetTestSetId(v string) *TestSetSummary {\n\ts.TestSetId = &v\n\treturn s\n}", "func (tcdb *Teocdb) SetID(key string, value []byte) (err error) {\n\tnextID, err := strconv.Atoi(string(value))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn tcdb.session.Query(`UPDATE ids SET next_id = ? WHERE id_name = ?`,\n\t\tnextID, key).Exec()\n}", "func SetID(clientID string) {\n\tfmt.Println(\"Setting clientID\")\n\ttID = clientID\n}", "func (m *PaymentTerm) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *UpdateTestSetInput) SetTestSetId(v string) *UpdateTestSetInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (m *AgedAccountsPayable) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (t *Transaction) SetID() {\n\t// Create some data as a buffer and a hash variable\n\tvar d bytes.Buffer\n\tvar h [32]byte\n\n\t// Create a new encoder, passing the data to it\n\tvar e = gob.NewEncoder(&d)\n\n\t// Encode the transaction, handling any errors\n\terr := e.Encode(t)\n\tHandleError(err)\n\n\t// Create a hash with the datas bytes and assign to the transaction\n\th = sha256.Sum256(d.Bytes())\n\tt.ID = h[:]\n\n}", "func (rmd ResourceMetaData) SetID(formatter resourceids.Id) {\n\trmd.ResourceData.SetId(formatter.ID())\n}", "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencoder := gob.NewEncoder(&encoded)\n\terr := encoder.Encode(tx)\n\tHandle(err)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "func (me *TArtIdTypeUnion4) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (s *DescribeTestSetInput) SetTestSetId(v string) *DescribeTestSetInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (me *TArtIdTypeUnion) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (me *TArtIdTypeUnion1) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (s *ListTestSetRecordsInput) SetTestSetId(v string) *ListTestSetRecordsInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (s *UpdateTestSetOutput) SetTestSetId(v string) *UpdateTestSetOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (plgf PLGridFacade) SetId(smRecord *SMRecord, id string) {\n\tsmRecord.JobID = id\n}", "func (m *SmsLogRow) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *DeleteTestSetInput) SetTestSetId(v string) *DeleteTestSetInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (tx *Transaction) SetID() error {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := json.NewEncoder(&encoded)\n\tif err := enc.Encode(tx); err != nil {\n\t\treturn err\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.id = hash[:]\n\treturn nil\n}", "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tencode := gob.NewEncoder(&encoded)\n\terr := encode.Encode(tx)\n\tif err != nil {\n\t\tlog.Panic()\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "func (reading_EntityInfo) SetId(object interface{}, id uint64) error {\n\tobject.(*Reading).Id = id\n\treturn nil\n}", "func (s *TestExecutionSummary) SetTestSetId(v string) *TestExecutionSummary {\n\ts.TestSetId = &v\n\treturn s\n}", "func (s *DescribeTestExecutionOutput) SetTestSetId(v string) *DescribeTestExecutionOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (t *Tkeyid) Set(key string, id uint) {\n\tt.idtokey[id] = key\n\tt.keytoid[key] = id\n}", "func (entity_EntityInfo) SetId(object interface{}, id uint64) {\n\tobject.(*Entity).Id = id\n}", "func (s *QuickUnionSet) SetID(element, id int) {\n\ts.ids[element] = id\n}", "func (s *DescribeTestSetOutput) SetTestSetId(v string) *DescribeTestSetOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (me *TAttlistELocationIDEIdType) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (s *StartTestExecutionOutput) SetTestSetId(v string) *StartTestExecutionOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func SetID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (m *Setting) SetSettingId(value *string)() {\n err := m.GetBackingStore().Set(\"settingId\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetByID(db XODB, id NullInt64) (*Set, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, baseSetSize, block, booster, code, isFoilOnly, isForeignOnly, isNonFoilOnly, isOnlineOnly, isPartialPreview, keyruneCode, mcmId, mcmIdExtras, mcmName, mtgoCode, name, parentCode, releaseDate, sealedProduct, tcgplayerGroupId, totalSetSize, type ` +\n\t\t`FROM sets ` +\n\t\t`WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\ts := Set{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&s.ID, &s.Basesetsize, &s.Block, &s.Booster, &s.Code, &s.Isfoilonly, &s.Isforeignonly, &s.Isnonfoilonly, &s.Isonlineonly, &s.Ispartialpreview, &s.Keyrunecode, &s.Mcmid, &s.Mcmidextras, &s.Mcmname, &s.Mtgocode, &s.Name, &s.Parentcode, &s.Releasedate, &s.Sealedproduct, &s.Tcgplayergroupid, &s.Totalsetsize, &s.Type)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &s, nil\n}", "func (s *StartTestExecutionInput) SetTestSetId(v string) *StartTestExecutionInput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (m *DeviceManagementResourceAccessProfileAssignment) SetSourceId(value *string)() {\n err := m.GetBackingStore().Set(\"sourceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *TestSetExportSpecification) SetTestSetId(v string) *TestSetExportSpecification {\n\ts.TestSetId = &v\n\treturn s\n}", "func (obj *SObject) setID(id string) {\n\t(*obj)[sobjectIDKey] = id\n}", "func (m *ProgramControl) SetControlId(value *string)() {\n err := m.GetBackingStore().Set(\"controlId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (testEntityInline_EntityInfo) SetId(object interface{}, id uint64) {\n\tobject.(*TestEntityInline).Id = id\n}", "func (me *TArtIdTypeUnion2) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (s *DescribeTestSetGenerationOutput) SetTestSetId(v string) *DescribeTestSetGenerationOutput {\n\ts.TestSetId = &v\n\treturn s\n}", "func (r *Response) SetID(id string) { r.id = id }", "func (this *TriggerAction) SetId(id int64) {\n this.id = id\n}", "func (o *DependencyMap) SetIdentifier(id string) {\n\n}", "func (me *TSAFPTProductID) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (ci *ConnectionInfo) SetID(id string) (bool, uint64) {\n\tif id == \"\" {\n\t\tpanic(\"empty id not allowed\")\n\t}\n\tci.Lock()\n\tif ci.id != \"\" {\n\t\tci.Unlock()\n\t\tpanic(\"SetID called twice\")\n\t}\n\tci.id = id\n\tci.Unlock()\n\n\treturn ci.serveconn.server.bindID(ci.serveconn, id)\n}", "func (r postQueryIDString) Set(value string) postSetParams {\n\n\treturn postSetParams{\n\t\tdata: builder.Field{\n\t\t\tName: \"id\",\n\t\t\tValue: value,\n\t\t},\n\t}\n\n}", "func (mdl *Model) SetID(id interface{}) {\n\tmdl.id = id\n}", "func (d *InMemoryTaskDB) AssignId(_ context.Context, t *types.Task) error {\n\tif t.Id != \"\" {\n\t\treturn fmt.Errorf(\"Task Id already assigned: %v\", t.Id)\n\t}\n\tt.Id = uuid.New().String()\n\treturn nil\n}", "func (g *Group) SetID(id string) error {\n\tgroupID, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.ID = uint(groupID)\n\treturn nil\n}", "func (mySource *Source) SetID(val string) {\n\tmySource.IDvar = val\n}", "func (m *DeviceConfigurationAssignment) SetSourceId(value *string)() {\n err := m.GetBackingStore().Set(\"sourceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o ElastigroupMultaiTargetSetOutput) TargetSetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ElastigroupMultaiTargetSet) string { return v.TargetSetId }).(pulumi.StringOutput)\n}", "func (xdc *XxxDemoCreate) SetID(s string) *XxxDemoCreate {\n\txdc.mutation.SetID(s)\n\treturn xdc\n}", "func (s *Sensor) setID(id int) { *s = Sensor{id: id} }", "func (m *ItemTranslateExchangeIdsPostRequestBody) SetSourceIdType(value *iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ExchangeIdFormat)() {\n err := m.GetBackingStore().Set(\"sourceIdType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *DeviceManagementSettingDependency) SetDefinitionId(value *string)() {\n err := m.GetBackingStore().Set(\"definitionId\", value)\n if err != nil {\n panic(err)\n }\n}", "func idSpecSetSave(db fgae.FlightDB, idspecstrings []string) (string, error) {\n\tctx := db.Ctx()\n\tincompletekey := db.Backend.NewIncompleteKey(ctx, \"IdSpecSet\", nil)\n\n\tdata := IdSpecSetStruct{IdSpecStrings:idspecstrings}\n\t\n\tif finalkey,err := db.Backend.Put(ctx, incompletekey, &data); err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn finalkey.Encode(), nil\n\t}\n}", "func (me *TArtIdTypeUnion3) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (packet *DefensaPacket) SetID(id int64) {\n\tpacket.ID = id\n}", "func (me *TArtIdTypeUnion5) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (r resourceFactory) setStateID(resourceLocalData *schema.ResourceData, payload map[string]interface{}) error {\n\tresourceSchema, err := r.openAPIResource.getResourceSchema()\n\tif err != nil {\n\t\treturn err\n\t}\n\tidentifierProperty, err := resourceSchema.getResourceIdentifier()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif payload[identifierProperty] == nil {\n\t\treturn fmt.Errorf(\"response object returned from the API is missing mandatory identifier property '%s'\", identifierProperty)\n\t}\n\n\tswitch payload[identifierProperty].(type) {\n\tcase int:\n\t\tresourceLocalData.SetId(strconv.Itoa(payload[identifierProperty].(int)))\n\tcase float64:\n\t\tresourceLocalData.SetId(strconv.Itoa(int(payload[identifierProperty].(float64))))\n\tdefault:\n\t\tresourceLocalData.SetId(payload[identifierProperty].(string))\n\t}\n\treturn nil\n}", "func FromString(s string) (SemanticID, error) {\n\treturn fromStringWithParams(s, DefaultIDProvider, true)\n}", "func (_options *GetSourceOptions) SetID(id string) *GetSourceOptions {\n\t_options.ID = core.StringPtr(id)\n\treturn _options\n}", "func (o *RenderTemplate) SetIdentifier(id string) {\n\n}", "func (workItemType *WorkItemType) SetID(id string) error {\n workItemType.ID = bson.ObjectIdHex(id)\n return nil\n}", "func (this *AppItem) Set(field string, value interface{}) {\n switch field {\n case \"id\":\n this.SetId(value.(int64))\n break\n }\n}", "func (m *TeamworkTag) SetTeamId(value *string)() {\n err := m.GetBackingStore().Set(\"teamId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (baseModel *BaseModel) SetID() {\n\tif baseModel.ID.Hex() == \"\" || !baseModel.ID.Valid() {\n\t\tbaseModel.ID = bson.NewObjectId()\n\t\tbaseModel.CreatedAt = time.Now()\n\t}\n}", "func ByIdString(id string) *Entity {\n\tparsedId := base.IdHex(id)\n\tif parsedId == nil {\n\t\treturn nil\n\t}\n\treturn ById(parsedId)\n}", "func ID(s string) string {\n\treturn strcase.ToSnake(s)\n}", "func (o *APICheck) SetIdentifier(id string) {\n\n}", "func (m *User) SetEmployeeId(value *string)() {\n m.employeeId = value\n}", "func SetFromString(id string) ConfigOption {\n\t// YYMMDD GGGG C 8 L\n\t// |\n\t// legacy bit, always there, ignore.\n\tconst (\n\t\tdateIndex = 0\n\t\tdateLength = 6\n\t\tgenderIndex = 6\n\t\tgenderLength = 4\n\t\tcitizenIndex = 10\n\t\tcitizenLength = 1\n\t\tluhnIndex = 12\n\t\tluhnLength = 1\n\t\tidLength = 13\n\t)\n\n\treturn func(idNumber *IDNumber) error {\n\t\tif len(id) != idLength {\n\t\t\treturn ErrIncorrectIDStringLength\n\t\t}\n\t\tdateString := id[dateIndex : dateIndex+dateLength]\n\t\tt, err := time.Parse(\"060102\", dateString)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidNumber.birthdate = t\n\n\t\tgenderCode, err := strconv.ParseInt(id[genderIndex:genderIndex+genderLength], 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidNumber.gender = GenderCode(genderCode)\n\n\t\tcitizenship, err := strconv.ParseInt(id[citizenIndex:citizenIndex+citizenLength], 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidNumber.citizenship = Citizenship(citizenship)\n\n\t\tluhnNumber, err := strconv.ParseInt(id[luhnIndex:luhnIndex+luhnLength], 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tidNumber.luhnValue = int(luhnNumber)\n\t\treturn nil\n\t}\n}", "func (me *TArtIdTypeUnion6) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (o *Poke) SetIdentifier(id string) {\n\n}", "func (me *TSAFPTJournalID) Set(s string) { (*xsdt.String)(me).Set(s) }" ]
[ "0.671707", "0.66311085", "0.65961593", "0.654557", "0.64179665", "0.6402706", "0.6308949", "0.6239355", "0.62046885", "0.6100801", "0.6075291", "0.60554713", "0.6033761", "0.6030782", "0.6029326", "0.59943116", "0.59880346", "0.5944602", "0.5934843", "0.5913901", "0.5906217", "0.5893819", "0.5876806", "0.5860115", "0.58520323", "0.58363616", "0.58362854", "0.58338857", "0.5829261", "0.5816212", "0.5790206", "0.57740796", "0.5766311", "0.57628655", "0.5757762", "0.5757484", "0.57552344", "0.5738666", "0.57321054", "0.57234436", "0.572042", "0.5709384", "0.5698846", "0.56889015", "0.56837094", "0.56763613", "0.56671435", "0.5662643", "0.5658361", "0.5656344", "0.5645137", "0.5641994", "0.5620847", "0.56122303", "0.56082", "0.5607186", "0.5604957", "0.5595329", "0.5585707", "0.5573791", "0.55666745", "0.55660844", "0.55544895", "0.5551951", "0.5538258", "0.55203664", "0.55027556", "0.5498133", "0.5496285", "0.5495732", "0.5485759", "0.5485642", "0.5481817", "0.5480019", "0.54732215", "0.5463401", "0.5460345", "0.545105", "0.543293", "0.54157573", "0.54125696", "0.5405062", "0.540488", "0.53952825", "0.53948635", "0.53933847", "0.5392909", "0.53926635", "0.5382426", "0.5376005", "0.5370103", "0.5354169", "0.5351058", "0.5343315", "0.53331083", "0.53271997", "0.532657", "0.53240126", "0.53141266", "0.5311215", "0.5306133" ]
0.0
-1
GetContent returns the Content field if nonnil, zero value otherwise.
func (o *MicrosoftGraphWorkbookComment) GetContent() string { if o == nil || o.Content == nil { var ret string return ret } return *o.Content }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *GetMessagesAllOf) GetContent() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Content\n}", "func (b *Blob) GetContent() string {\n\tif b == nil || b.Content == nil {\n\t\treturn \"\"\n\t}\n\treturn *b.Content\n}", "func (m Model) GetContent() string {\n\treturn m.Content\n}", "func (m Model) GetContent() string {\n\treturn m.Content\n}", "func (o *SimpleStringWeb) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (t *TreeEntry) GetContent() string {\n\tif t == nil || t.Content == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Content\n}", "func (msg *Message) GetContent() interface{} {\n\treturn msg.Content\n}", "func (g *GistFile) GetContent() string {\n\tif g == nil || g.Content == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.Content\n}", "func (m *ChatMessageAttachment) GetContent()(*string) {\n val, err := m.GetBackingStore().Get(\"content\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (p *Page) GetContent() string {\n\treturn p.Content\n}", "func (c *Content) Get() []byte {\n\tc.RLock()\n\tdefer c.RUnlock()\n\treturn c.page\n}", "func (this *SIPMessage) GetContent() string {\n\tif this.messageContentObject != nil {\n\t\treturn this.messageContentObject.(string)\n\t} else if this.messageContentBytes != nil {\n\t\treturn string(this.messageContentBytes)\n\t} else if this.messageContent != \"\" {\n\t\treturn this.messageContent\n\t} else {\n\t\treturn \"\"\n\t}\n}", "func (p *Post) GetContent() string {\n\treturn p.Content\n}", "func (a *Action) GetContent() string {\n\treturn a.Content\n}", "func (obj *Variable) GetContent(ctx context.Context) (*AlfaNumString, error) {\n\tresult := &struct {\n\t\tContent *AlfaNumString `json:\"qContent\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetContent\", result)\n\treturn result.Content, err\n}", "func (r *Reaction) GetContent() string {\n\tif r == nil || r.Content == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Content\n}", "func (o *SimpleStringWeb) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (r *RepositoryLicense) GetContent() string {\n\tif r == nil || r.Content == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Content\n}", "func (statics AssestStruct) GetContent(name string) string {\n\ts, err := statics.GetAssestFile(name)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn s.Content\n}", "func (o *Comment) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (m *MsgSubmitProposal) GetContent() Content {\n\tcontent, ok := m.Content.GetCachedValue().(Content)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn content\n}", "func (o *GetMessagesAllOf) GetContentOk() (*interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Content, true\n}", "func GetContent(host, path string, requiredCode int) ([]byte, error) {\n\tresp, err := GetRequest(host, path)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tdata, err := out(resp, requiredCode)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\treturn data, nil\n}", "func (o *Comment) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (r *RepositoryContentResponse) GetContent() *RepositoryContent {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.Content\n}", "func (Adapter MockPage) GetContent() (string, error) {\n\treturn Adapter.FakeContent, Adapter.ContentError\n}", "func (o *DriveItemVersion) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (m *CallTranscript) GetContent()([]byte) {\n val, err := m.GetBackingStore().Get(\"content\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]byte)\n }\n return nil\n}", "func (editor *Editor) GetContent(index int) string {\n\treturn editor.inst.Call(\"getContent\", index).String()\n}", "func (c *ClaimContent) Get(id string) error {\n\treturn get(claimContentDB, c, id)\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n reader, err := d.Reader(ctx, path, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ioutil.ReadAll(reader)\n}", "func (f *File) GetContent() []byte {\n\tif f.WasTransformed() {\n\t\treturn f.Bytes\n\t}\n\n\tcontent, readErr := ioutil.ReadFile(f.Path)\n\tif readErr != nil {\n\t\tfmt.Println(\"Could not read file content of \", f.Path, \" file system returned error: \", readErr)\n\t\treturn []byte{}\n\t}\n\n\treturn content\n}", "func (o *FileDto) GetContent() []string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (v *Version) GetContent(ctx context.Context) ([]byte, error) {\n\tlock := v.Chart.Space.SpaceManager.Lock.Get(v.Chart.Space.Name(), v.Chart.Name(), v.Number())\n\tif !lock.RLock(v.Chart.Space.SpaceManager.LockTimeout) {\n\t\treturn nil, ErrorLocking.Format(\"version\", v.Chart.Space.Name()+\"/\"+v.Chart.Name()+\"/\"+v.Number())\n\t}\n\tdefer lock.RUnlock()\n\tif err := v.Validate(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tpath := path.Join(v.Prefix, chartPackageName)\n\tdata, err := v.Chart.Space.SpaceManager.Backend.GetContent(ctx, path)\n\tif err != nil {\n\t\treturn nil, ErrorContentNotFound.Format(v.Prefix)\n\t}\n\treturn data, nil\n}", "func (o *ViewSampleProject) GetContentOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *FileDto) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *MicrosoftGraphVisualInfo) GetContent() AnyOfobject {\n\tif o == nil || o.Content == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (r *ClipRepository) GetContent(clip *decryptor.Clip) (io.ReadCloser, error) {\n\tif clip == nil {\n\t\treturn nil, ErrClipUndefined\n\t}\n\tif clip.Module == nil {\n\t\treturn nil, ErrModuleUndefined\n\t}\n\tif clip.Module.Course == nil {\n\t\treturn nil, ErrCourseUndefined\n\t}\n\tf, err := r.FileOpen(filepath.Join(r.Path, clip.Module.Course.ID, computeModuleHash(clip.Module), fmt.Sprintf(\"%v.psv\", clip.ID)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f, nil\n}", "func (m *Minio) GetContent(ctx context.Context, bucketName, fileName string) ([]byte, error) {\n\tobject, err := m.client.GetObject(ctx, bucketName, fileName, minio.GetObjectOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif _, err := buf.ReadFrom(object); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "func (o *MicrosoftGraphWorkbookComment) GetContentOk() (string, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (o *ResourceIdTagsJsonTags) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (o *ViewSampleProject) GetContent() map[string]interface{} {\n\tif o == nil || o.Content == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (api *ContentsAPI) GetContent(path string) (*Contents, error) {\n\treturn api.GetContentByRef(path, \"\")\n}", "func (s *Service) GetContent(c context.Context, likeSubType int, likes map[int64]*model.Like, ids []int64, wids []int64, mids []int64) (err error) {\n\tswitch likeSubType {\n\tcase model.PICTURE, model.PICTURELIKE, model.DRAWYOO, model.DRAWYOOLIKE, model.TEXT, model.TEXTLIKE, model.QUESTION:\n\t\terr = s.accountAndContent(c, ids, mids, likes)\n\tcase model.VIDEO, model.VIDEOLIKE, model.ONLINEVOTE, model.VIDEO2, model.PHONEVIDEO, model.SMALLVIDEO:\n\t\terr = s.archiveWithTag(c, wids, likes)\n\tcase model.ARTICLE:\n\t\terr = s.articles(c, wids, likes)\n\tcase model.MUSIC:\n\t\terr = s.musicsAndAct(c, wids, mids, likes)\n\tdefault:\n\t\terr = ecode.RequestErr\n\t}\n\treturn\n}", "func (o *DriveItemVersion) GetContentOk() (string, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (m *WorkbookCommentReply) GetContent()(*string) {\n return m.content\n}", "func (r *ClipRepository) GetContent(clip *decryptor.Clip) (io.ReadCloser, error) {\n\tf, err := os.Open(filepath.Join(r.Path, clip.Module.Course.ID, computeModuleHash(clip.Module), fmt.Sprintf(\"%v.psv\", clip.ID)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f, nil\n}", "func (r *regulator) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.GetContent(ctx, path)\n}", "func (d *GetResult) Content(valuePtr interface{}) error {\n\treturn DefaultDecode(d.contents, d.flags, valuePtr)\n}", "func (r *URIRef) Content() Content {\n\tif r.bytes == nil {\n\t\treturn NilContent{}\n\t}\n\tbc := ByteContent(r.bytes)\n\treturn &bc\n}", "func (pb *PostBody) Content() string {\n\tif pb == nil {\n\t\treturn \"\"\n\t}\n\treturn pb.body\n}", "func GetContent(url string, data ...interface{}) string {\n\treturn RequestContent(\"GET\", url, data...)\n}", "func (b *BufferPool) GetContent() []byte {\n\treturn b.Data\n}", "func (obj *request) Content() Content {\n\treturn obj.content\n}", "func (cs *CasServer) GetContent(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n\tdata, err := ioutil.ReadFile(fmt.Sprintf(\"./%s/%s\", cs.casFolder, ps.ByName(cs.casParam)))\n\n\tif err == nil {\n\t\t_, err := w.Write(data)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\n\t} else {\n\t\tlog.Error(err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\n\t\t_, err := w.Write([]byte(http.StatusText(http.StatusNotFound)))\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}\n}", "func (o *JsonEnvironment) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *InlineResponse20051TodoItems) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tdefer debugTime()()\n\treader, err := d.shell.Cat(d.fullPath(path))\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tcontent, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"Got content %s: %s\", path, content)\n\n\treturn content, nil\n}", "func (o *MicrosoftGraphVisualInfo) GetContentOk() (AnyOfobject, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tpath = path[1:]\n\tbaseUrl := qiniu.MakeBaseUrl(d.Config.Domain,path)\n\tfmt.Print(baseUrl)\n\tres, err := http.Get(baseUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontent, err := ioutil.ReadAll(res.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn content, nil\n}", "func (o FileContentBufferResponsePtrOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FileContentBufferResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Content\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *KrakenStorageDriver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tlog.Debugf(\"(*KrakenStorageDriver).GetContent %s\", path)\n\tpathType, pathSubType, err := ParsePath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data []byte\n\tswitch pathType {\n\tcase _manifests:\n\t\tdata, err = d.manifests.getDigest(path, pathSubType)\n\tcase _uploads:\n\t\tdata, err = d.uploads.getContent(path, pathSubType)\n\tcase _layers:\n\t\tdata, err = d.blobs.getDigest(path)\n\tcase _blobs:\n\t\tdata, err = d.blobs.getContent(ctx, path)\n\tdefault:\n\t\treturn nil, InvalidRequestError{path}\n\t}\n\tif err != nil {\n\t\treturn nil, toDriverError(err, path)\n\t}\n\treturn data, nil\n}", "func (this Comment) GetContent() string {\n\tif len(this) == 0 {\n\t\treturn \"\"\n\t}\n\ts := []byte(this)\n\tif isLineComment(string(this)) {\n\t\treturn string(s[2 : len(s)-1])\n\t}\n\treturn string(s[2 : len(s)-2])\n}", "func (o FileContentBufferPtrOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FileContentBuffer) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Content\n\t}).(pulumi.StringPtrOutput)\n}", "func GetContent(url string, timeout uint) ([]byte, error) {\n\tresp, err := GetResp(url, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\treturn io.ReadAll(resp.Body)\n}", "func GetContent(url string) ([]byte, error) {\n\tr, err := GetContentReader(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Close()\n\treturn ioutil.ReadAll(r)\n}", "func (o *ResourceIdTagsJsonTags) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (r *Document) Content() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"content\"])\n}", "func (base *Base) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tctx, done := dcontext.WithTrace(ctx)\n\tdefer done(\"%s.GetContent(%q)\", base.Name(), path)\n\n\tif !storagedriver.PathRegexp.MatchString(path) {\n\t\treturn nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}\n\t}\n\n\tstart := time.Now()\n\tb, e := base.StorageDriver.GetContent(ctx, path)\n\tstorageAction.WithValues(base.Name(), \"GetContent\").UpdateSince(start)\n\treturn b, base.setDriverName(e)\n}", "func (p *ParseData) Content() string {\n\treturn p.content\n}", "func GetContent(fullUrl string) (*Content, string, error) {\n\n\t// My own Cient with my own Transport\n\t// Just to abort very slow responses\n\ttransport := http.Transport{\n\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(network, addr, time.Duration(10*time.Second))\n\t\t},\n\t}\n\n\tclient := http.Client{\n\t\tTransport: &transport,\n\t}\n\n\tresp, err := client.Get(fullUrl)\n\tif err != nil {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Desculpe, ocorreu ao tentar recuperar a pagina referente a URL passada. %s.\", err))\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Desculpe, mas a pagina passada respondeu indevidamente. O Status Code recebido foi: %d.\", resp.StatusCode))\n\t}\n\n\treader, err := charset.NewReader(resp.Body, resp.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Erro ao decodificar o charset da pagina. %s.\", err))\n\t}\n\n\tcontent := &Content{}\n\timageUrl := \"\"\n\n\t// This function create a Tokenizer for an io.Reader, obs. HTML should be UTF-8\n\tz := html.NewTokenizer(reader)\n\tfor {\n\t\ttokenType := z.Next()\n\n\t\tif tokenType == html.ErrorToken {\n\t\t\tif z.Err() == io.EOF { // EVERTHINGS WORKS WELL!\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Ops, we've got something wrong, it isn't an EOF token\n\t\t\treturn nil, \"\", errors.New(\n\t\t\t\tfmt.Sprintf(\"Desculpe, mas ocorreu um erro ao extrair as tags HTML da pagina passada. %s.\", z.Err()))\n\t\t}\n\n\t\tswitch tokenType {\n\t\tcase html.StartTagToken, html.SelfClosingTagToken:\n\n\t\t\ttoken := z.Token()\n\t\t\t// Check if it is an title tag opennig, it's the fastest way to compare bytes\n\t\t\tif token.Data == \"title\" {\n\t\t\t\t// log.Printf(\"TAG: '%v'\\n\", token.Data)\n\t\t\t\tnextTokenType := z.Next()\n\t\t\t\tif nextTokenType == html.TextToken {\n\t\t\t\t\tnextToken := z.Token()\n\t\t\t\t\tcontent.Title = strings.TrimSpace(nextToken.Data)\n\t\t\t\t\t// log.Println(\"<title> = \" + content.Title)\n\t\t\t\t}\n\n\t\t\t} else if token.Data == \"meta\" {\n\t\t\t\tkey := \"\"\n\t\t\t\tvalue := \"\"\n\n\t\t\t\t// log.Printf(\"NewMeta: %s : \", token.String())\n\n\t\t\t\t// Extracting this meta data information\n\t\t\t\tfor _, attr := range token.Attr {\n\t\t\t\t\tswitch attr.Key {\n\t\t\t\t\tcase \"property\", \"name\":\n\t\t\t\t\t\tkey = attr.Val\n\t\t\t\t\tcase \"content\":\n\t\t\t\t\t\tvalue = attr.Val\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch key {\n\n\t\t\t\tcase \"title\", \"og:title\", \"twitter:title\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\tcontent.Title = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Title: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\n\t\t\t\tcase \"og:site_name\", \"twitter:domain\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\t//content.SiteName = strings.TrimSpace(value)\n\t\t\t\t\t\t//log.Printf(\"Site Name: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\n\t\t\t\tcase \"description\", \"og:description\", \"twitter:description\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\tcontent.Description = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Description: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\tcase \"og:image\", \"twitter:image\", \"twitter:image:src\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\timageUrl = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Image: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\tcase \"og:url\", \"twitter:url\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\t// Not used, cause user could use a redirect service\n\t\t\t\t\t\t// fullUrl = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Url: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Limiting the size of Title and Description to 250 characters\n\tif len(content.Title) > 250 {\n\t\tcontent.Title = content.Title[0:250]\n\t}\n\tif len(content.Description) > 250 {\n\t\tcontent.Description = content.Description[0:250]\n\t}\n\t// If content description is empty, lets full fill with something\n\tif len(content.Description) == 0 {\n\t\tcontent.Description = \"Veja o conteudo completo...\"\n\t}\n\n\t// Adding the host of this content\n\tcontent.Host = resp.Request.URL.Host\n\n\tlog.Printf(\"Title: %s\\n description: %s\\n host:%s\\n imageUrl:%s\\n\",\n\t\tcontent.Title, content.Description, content.Host, imageUrl)\n\n\treturn content, imageUrl, nil\n}", "func (obj *Variable) GetContentRaw(ctx context.Context) (json.RawMessage, error) {\n\tresult := &struct {\n\t\tContent json.RawMessage `json:\"qContent\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetContent\", result)\n\treturn result.Content, err\n}", "func (s *Conn) GetMsgContent(link *Link) (content []byte, err error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\tbuf := pool.BufPoolCopy.Get().([]byte)\n\tif n, err := s.ReadFrom(buf, link.De, link.Crypt, link.Rate); err == nil {\n\t\tcontent = buf[:n]\n\t}\n\treturn\n}", "func (u Unboxed) Content() Type {\n\treturn u.content\n}", "func (m *FileAssessmentRequest) GetContentData()(*string) {\n return m.contentData\n}", "func (o *GetMessagesAllOf) GetMatchContent() string {\n\tif o == nil || o.MatchContent == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.MatchContent\n}", "func (s *schema) Content() []byte {\n\treturn s.content\n}", "func (o *JsonEnvironment) GetContent() []string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (this *SIPMessage) GetMessageContent() string {\n\t// throws UnsupportedEncodingException {\n\tif this.messageContent == \"\" && this.messageContentBytes == nil {\n\t\treturn \"\"\n\t} else if this.messageContent == \"\" {\n\t\t//contentTypeHeader := this.nameTable[strings.ToLower(core.SIPHeaderNames_CONTENT_TYPE)].(*header.ContentType)\n\t\t//if contentTypeHeader != nil {\n\t\t// String charSet = contentTypeHeader.GetCharSet();\n\t\t// if (charSet != nil) {\n\t\t// this.messageContent =\n\t\t// new String(messageContentBytes,charSet);\n\t\t// } else {\n\t\t// this.messageContent =\n\t\t// new String(messageContentBytes,header.SIPConstants_DEFAULT_ENCODING);\n\t\t// }\n\t\t// } else this.messageContent =\n\t\t// new String(messageContentBytes,header.SIPConstants_DEFAULT_ENCODING);\n\t\tthis.messageContent = string(this.messageContentBytes)\n\t}\n\treturn this.messageContent\n}", "func (obj *subElement) Content() Content {\n\treturn obj.content\n}", "func (cs *contentStore) Get(ct ContentType, key string) ([]byte, error) {\n\treturn cs.store.Get(getContentKeyPrefix(ct, key))\n}", "func (cs *contentStore) Get(ct ContentType, key string) ([]byte, error) {\n\treturn cs.store.Get(getContentKeyPrefix(ct, key))\n}", "func (m *ChatMessageAttachment) GetContentUrl()(*string) {\n val, err := m.GetBackingStore().Get(\"contentUrl\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (afs *assetFiles) GetContent(name string) []byte {\n\ts, err := afs.GetAssetFile(name)\n\tif err != nil {\n\t\treturn []byte(\"\")\n\t}\n\treturn s.Content()\n}", "func (obj *Variable) GetRawContent(ctx context.Context) (string, error) {\n\tresult := &struct {\n\t\tReturn string `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetRawContent\", result)\n\treturn result.Return, err\n}", "func (msg *Message) GetContentData() ([]byte, error) {\n\tif data, ok := msg.Content.([]byte); ok {\n\t\treturn data, nil\n\t}\n\n\tif data, ok := msg.Content.(string); ok {\n\t\treturn []byte(data), nil\n\t}\n\n\tdata, err := json.Marshal(msg.Content)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal message content failed: %s\", err)\n\t}\n\treturn data, nil\n}", "func (o FileContentBufferOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FileContentBuffer) *string { return v.Content }).(pulumi.StringPtrOutput)\n}", "func (mr CounterResult) Content() uint64 {\n\treturn mr.content\n}", "func (response *BaseResponse) GetContentString() string {\n\treturn response.contentString\n}", "func (o LookupDocumentResultOutput) Content() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v LookupDocumentResult) interface{} { return v.Content }).(pulumi.AnyOutput)\n}", "func (label *LabelWidget) GetContent() string {\n\treturn label.content\n}", "func (msg *Message) Content() []byte {\n\treturn msg.content\n}", "func (r *Response) Content() (string, error) {\n\tb, err := r.Body()\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\treturn string(b), nil\n}", "func (obj *codeMatch) Content() string {\n\treturn obj.content\n}", "func (o *LogList4hostResult) GetContentAccess() bool {\n\tif o == nil || o.ContentAccess == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.ContentAccess\n}", "func (o ApiImportPtrOutput) ContentValue() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ApiImport) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ContentValue\n\t}).(pulumi.StringPtrOutput)\n}", "func (b *BlankLine) Content() []byte {\n\treturn nil\n}", "func (obj *GenericVariable) GetRawContent(ctx context.Context) (string, error) {\n\tresult := &struct {\n\t\tReturn string `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetRawContent\", result)\n\treturn result.Return, err\n}", "func (client *Client) GetContent(path string) *VoidResponse {\n\tendpoint := client.baseURL + fmt.Sprintf(EndpointGetContent, client.accessToken, path)\n\trequest := gorequest.New().Get(endpoint).Set(UserAgentHeader, UserAgent+\"/\"+Version)\n\n\treturn &VoidResponse{\n\t\tClient: client,\n\t\tRequest: request,\n\t}\n}", "func (f *File) Content() []byte {\n\treturn f.content\n}" ]
[ "0.72860307", "0.72528857", "0.71743584", "0.71743584", "0.7036505", "0.6993604", "0.6942331", "0.6921864", "0.6866991", "0.68316424", "0.68258965", "0.68150693", "0.6804708", "0.6711301", "0.6673907", "0.6668974", "0.66565114", "0.6635864", "0.6627516", "0.6609262", "0.6601221", "0.6586927", "0.6520879", "0.6517385", "0.6516852", "0.6510826", "0.64668745", "0.6456724", "0.64523757", "0.64477485", "0.64416605", "0.643509", "0.64188427", "0.63896", "0.63857263", "0.63325006", "0.63024366", "0.629409", "0.62805855", "0.6264423", "0.6247213", "0.6246857", "0.62286973", "0.6220453", "0.6199511", "0.61926866", "0.61862135", "0.6179111", "0.616806", "0.6163262", "0.61539495", "0.6147185", "0.61416215", "0.61240447", "0.6088208", "0.6049652", "0.6049222", "0.6039675", "0.6033032", "0.6028917", "0.60248685", "0.59995043", "0.5998833", "0.5997102", "0.5993679", "0.5985749", "0.5972455", "0.5962013", "0.59615433", "0.5945463", "0.5923053", "0.58993274", "0.58876103", "0.5866152", "0.5865723", "0.58643216", "0.58526075", "0.5845604", "0.58369744", "0.5803541", "0.57958597", "0.57958597", "0.5775802", "0.5762477", "0.5739136", "0.57340723", "0.57298636", "0.572776", "0.5724351", "0.5718968", "0.57102454", "0.56867504", "0.5677527", "0.5647633", "0.56469434", "0.5621486", "0.5609084", "0.5604355", "0.5604137", "0.5603978" ]
0.602728
60
GetContentOk returns a tuple with the Content field if it's nonnil, zero value otherwise and a boolean to check if the value has been set.
func (o *MicrosoftGraphWorkbookComment) GetContentOk() (string, bool) { if o == nil || o.Content == nil { var ret string return ret, false } return *o.Content, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ViewSampleProject) GetContentOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *GetMessagesAllOf) GetContentOk() (*interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Content, true\n}", "func (o *SimpleStringWeb) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *Comment) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *DriveItemVersion) GetContentOk() (string, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (o *FileDto) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *JsonEnvironment) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *ResourceIdTagsJsonTags) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *MicrosoftGraphVisualInfo) GetContentOk() (AnyOfobject, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (o *InlineResponse20051TodoItems) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *GetMessagesAllOf) GetMatchContentOk() (*string, bool) {\n\tif o == nil || o.MatchContent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MatchContent, true\n}", "func (o *LogList4hostResult) GetContentAccessOk() (*bool, bool) {\n\tif o == nil || o.ContentAccess == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentAccess, true\n}", "func (o *EmailAction) GetContentTemplateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentTemplate, true\n}", "func (o *ImageImportManifest) GetContentsOk() (*ImportContentDigests, bool) {\n\tif o == nil || o.Contents == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Contents, true\n}", "func (o *GetMessagesAllOf) GetContentTypeOk() (*interface{}, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentType, true\n}", "func (o *InvalidMessageError) GetRawContentOk() (*string, bool) {\n\tif o == nil || o.RawContent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RawContent, true\n}", "func (o *Content) GetContentCategoryOk() (*string, bool) {\n\tif o == nil || o.ContentCategory == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentCategory, true\n}", "func (o *Content) GetHasParametersOk() (*bool, bool) {\n\tif o == nil || o.HasParameters == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HasParameters, true\n}", "func (o *RetrievedFile) GetB64ContentOk() (*string, bool) {\n\tif o == nil || o.B64Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.B64Content, true\n}", "func (o *Content) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *FileDto) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphWorkbookComment) GetContentTypeOk() (string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (o *LogContent) GetMessageOk() (*string, bool) {\n\tif o == nil || o.Message == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Message, true\n}", "func (o *CompartimentoHistorico) GetMensagemOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Mensagem.Get(), o.Mensagem.IsSet()\n}", "func (o *Content) GetPyVersionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PyVersion.Get(), o.PyVersion.IsSet()\n}", "func (o *Content) GetUrlOk() (*string, bool) {\n\tif o == nil || o.Url == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Url, true\n}", "func (o *InlineResponse20049Post) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (o *GetMessagesAllOf) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) GetTitleOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Title.Get(), o.Title.IsSet()\n}", "func (o *GetProjectNoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *WhatsAppPhoneWhatsAppApiContent) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (this *SIPMessage) HasContent() bool {\n\treturn this.messageContent != \"\" || this.messageContentBytes != nil\n}", "func (o *InlineResponse200115) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (o *LogContent) GetHostOk() (*string, bool) {\n\tif o == nil || o.Host == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Host, true\n}", "func (o *SharedSecretSet3) GetContentProviderIdOk() (*int32, bool) {\n\tif o == nil || o.ContentProviderId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentProviderId, true\n}", "func (o *Content) GetRunAsOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RunAs.Get(), o.RunAs.IsSet()\n}", "func (o *CustomVendaResultado) GetOk() bool {\n\tif o == nil || o.Ok == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Ok\n}", "func (o *WhatsAppEmailWhatsAppApiContent) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *Permissao) GetDescricaoOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Descricao.Get(), o.Descricao.IsSet()\n}", "func (o *Content) GetBundleIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BundleId.Get(), o.BundleId.IsSet()\n}", "func (o *LastMileAccelerationOptions) GetContentTypesOk() (*[]string, bool) {\n\tif o == nil || o.ContentTypes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentTypes, true\n}", "func (o *InlineResponse200115) GetCanEditContentsOk() (*bool, bool) {\n\tif o == nil || o.CanEditContents == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CanEditContents, true\n}", "func (o *SharedSecretSetCreate) GetContentProviderIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentProviderId, true\n}", "func (o *Content) GetInitTimeoutOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InitTimeout.Get(), o.InitTimeout.IsSet()\n}", "func (o *Content) GetConnectionTimeoutOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ConnectionTimeout.Get(), o.ConnectionTimeout.IsSet()\n}", "func (o *SimpleStringWeb) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s Stored) Ok() bool {\n\treturn s.Type.Ok() && s.Encoding.Ok()\n}", "func (o *Content) GetAppModeOk() (*string, bool) {\n\tif o == nil || o.AppMode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AppMode, true\n}", "func (o *ViewSampleProject) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "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}", "func (o *UploadResponse) GetValueOk() (*NFT, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "func (o *JsonEnvironment) GetPublishedOk() (*bool, bool) {\n\tif o == nil || o.Published == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Published, true\n}", "func (o *ContentProviderReadDetailed) GetContentProviderIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentProviderId, true\n}", "func (o *Content) GetRVersionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RVersion.Get(), o.RVersion.IsSet()\n}", "func (o *Transfer) GetMetadataOk() (*map[string]string, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Metadata, true\n}", "func (o *RequestStatusMetadata) GetMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Message, true\n}", "func (o *ViewCustomFieldTask) GetValueOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "func (o *JsonEnvironment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ContentProvider2) GetContentProviderIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentProviderId, true\n}", "func (o *Content) GetCreatedTimeOk() (*time.Time, bool) {\n\tif o == nil || o.CreatedTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedTime, true\n}", "func (o *ResetPasswordNoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *CustomfieldCustomFieldsResponse) GetMetaOk() (*ViewMeta, bool) {\n\tif o == nil || o.Meta == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Meta, true\n}", "func (o *EventoDTO) GetMensagemOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Mensagem.Get(), o.Mensagem.IsSet()\n}", "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}", "func (o *ProdutoVM) GetDescricaoOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Descricao.Get(), o.Descricao.IsSet()\n}", "func (o *InlineObject901) GetValueIfTrueOk() (AnyOfobject, bool) {\n\tif o == nil || o.ValueIfTrue == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.ValueIfTrue, true\n}", "func (o *CustomVendaResultado) GetMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Message.Get(), o.Message.IsSet()\n}", "func (o *CustomVendaResultado) GetOkOk() (*bool, bool) {\n\tif o == nil || o.Ok == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Ok, true\n}", "func (o *UploadResponse) GetOk() bool {\n\tif o == nil || o.Ok == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Ok\n}", "func (o *Content) GetIdleTimeoutOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IdleTimeout.Get(), o.IdleTimeout.IsSet()\n}", "func (o *SchemaDefinitionRestDto) GetMetadataOk() (*map[string]string, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metadata, true\n}", "func (o *Permissao) GetChaveOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Chave.Get(), o.Chave.IsSet()\n}", "func (o *ResourceIdTagsJsonTags) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DriveItemVersion) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProjectApiKey) GetValueOk() (*string, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "func (o *InlineResponse20051TodoItems) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Cause) GetDisplayMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayMessage.Get(), o.DisplayMessage.IsSet()\n}", "func (o *Content) GetAccessTypeOk() (*string, bool) {\n\tif o == nil || o.AccessType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AccessType, true\n}", "func (o *Content) GetGuidOk() (*string, bool) {\n\tif o == nil || o.Guid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Guid, true\n}", "func (o *SyntheticsBrowserTest) GetMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Message, true\n}", "func (o *DeferredResultVoid) GetSetOrExpiredOk() (*bool, bool) {\n\tif o == nil || o.SetOrExpired == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SetOrExpired, true\n}", "func (o *NewData) GetMetadataOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metadata, true\n}", "func (o *Comment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SmsPreviewRequest) GetTextOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Text, true\n}", "func (o *RepositoryPasswordValidationResult) GetIsSuccessOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsSuccess, true\n}", "func (o *ViewProjectActivePages) GetMessagesOk() (*bool, bool) {\n\tif o == nil || o.Messages == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Messages, true\n}", "func (o *ViewMilestone) GetCanCompleteOk() (*bool, bool) {\n\tif o == nil || o.CanComplete == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CanComplete, true\n}", "func (o *DeleteBundleCustomFieldsNoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *FormField) GetResponseOk() (*string, bool) {\n\tif o == nil || o.Response == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Response, true\n}", "func (o *InlineObject54) GetGetOk() (*string, bool) {\n\tif o == nil || o.Get == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Get, true\n}", "func (o *UpdateRepository3NoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *DisplayInfo) GetIsDefaultOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsDefault, true\n}", "func (o *NewData) GetValueOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "func (o *Content) GetLoadFactorOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LoadFactor.Get(), o.LoadFactor.IsSet()\n}", "func (o *SignupNoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *CheckoutResponse) GetMetadataOk() (map[string]interface{}, bool) {\n\tif o == nil || IsNil(o.Metadata) {\n\t\treturn map[string]interface{}{}, false\n\t}\n\treturn o.Metadata, true\n}", "func (o *CustomVendaResultado) HasOk() bool {\n\tif o != nil && o.Ok != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghChemotherapy) GetCreatedOk() (string, bool) {\n\tif o == nil || o.Created == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Created, true\n}", "func (o *MicrosoftGraphListItem) GetContentTypeOk() (AnyOfmicrosoftGraphContentTypeInfo, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret AnyOfmicrosoftGraphContentTypeInfo\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (o *GetMessagesAllOf) GetContent() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Content\n}" ]
[ "0.80017406", "0.79408884", "0.7936158", "0.7891302", "0.783001", "0.76929504", "0.76466423", "0.75997", "0.7336739", "0.72340393", "0.70073485", "0.6810419", "0.6604012", "0.645862", "0.62594706", "0.6246274", "0.6177604", "0.6143385", "0.611876", "0.60643893", "0.60283494", "0.5985063", "0.59338814", "0.58549273", "0.58533454", "0.58447427", "0.5838585", "0.5834113", "0.582012", "0.5819846", "0.5801913", "0.5796291", "0.578698", "0.5782134", "0.5778314", "0.57695216", "0.57644075", "0.5748706", "0.57457703", "0.57334304", "0.5722199", "0.5721777", "0.57136667", "0.5711394", "0.5703626", "0.56635195", "0.56418073", "0.56367725", "0.56225544", "0.5611106", "0.55947715", "0.5578889", "0.5561623", "0.5548756", "0.5543568", "0.5540207", "0.55400807", "0.55353534", "0.553018", "0.552673", "0.5521017", "0.5512273", "0.5505315", "0.5488665", "0.5484024", "0.5480939", "0.547557", "0.54712266", "0.54687893", "0.54627854", "0.54605836", "0.5433315", "0.5430548", "0.5430162", "0.54219866", "0.5409787", "0.539696", "0.5369855", "0.53692824", "0.53590554", "0.53556955", "0.5355525", "0.5352897", "0.53432435", "0.53368574", "0.5336169", "0.53253794", "0.53244495", "0.53178966", "0.5311958", "0.53088707", "0.5303146", "0.5300726", "0.5299792", "0.5294417", "0.5289788", "0.52877766", "0.52842027", "0.52835053", "0.5283117" ]
0.7436027
8
HasContent returns a boolean if a field has been set.
func (o *MicrosoftGraphWorkbookComment) HasContent() bool { if o != nil && o.Content != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ViewSampleProject) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SimpleStringWeb) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DriveItemVersion) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FileDto) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *GetMessagesAllOf) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (this *SIPMessage) HasContent() bool {\n\treturn this.messageContent != \"\" || this.messageContentBytes != nil\n}", "func (o *Comment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *JsonEnvironment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ResourceIdTagsJsonTags) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphVisualInfo) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20051TodoItems) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LogList4hostResult) HasContentAccess() bool {\n\tif o != nil && o.ContentAccess != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (dct *DjangoContentType) Exists() bool {\n\treturn dct._exists\n}", "func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool {\n\treturn o != nil && o.Field != nil\n}", "func (o *RiskRulesListAllOfData) HasField() bool {\n\tif o != nil && !IsNil(o.Field) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := r.Form.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *Content) HasTitle() bool {\n\tif o != nil && o.Title.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasLoadFactor() bool {\n\tif o != nil && o.LoadFactor.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *Configuration) Has(field string) bool {\n\tout := getField(c.App, field)\n\tif out == nil {\n\t\tout = getField(c.Base, field)\n\t}\n\n\treturn out != nil\n}", "func (o *Content) HasHasParameters() bool {\n\tif o != nil && o.HasParameters != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Structx) HasField(name string) bool {\n\t_, ok := s.value.Type().FieldByName(name)\n\treturn ok\n}", "func (o *GetMessagesAllOf) HasMatchContent() bool {\n\tif o != nil && o.MatchContent != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FormField) HasResponse() bool {\n\tif o != nil && o.Response != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ImageImportManifest) HasContents() bool {\n\tif o != nil && o.Contents != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasInitTimeout() bool {\n\tif o != nil && o.InitTimeout.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StatusDescriptorDTO) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasValue(field reflect.Value) bool {\n\tswitch field.Kind() {\n\tcase reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func:\n\t\treturn !field.IsNil()\n\tdefault:\n\t\treturn field.IsValid() && field.Interface() != reflect.Zero(field.Type()).Interface()\n\t}\n}", "func (o *ViewMetaPage) HasCount() bool {\n\tif o != nil && o.Count != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (field Field) IsDefined() bool {\n\treturn field.Var != nil\n}", "func (o *ViewCustomFieldTask) HasCustomfield() bool {\n\tif o != nil && o.Customfield != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasMaxProcesses() bool {\n\tif o != nil && o.MaxProcesses.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LogContent) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasValue() bool {\n\tif o != nil && o.Value != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMetaPage) HasHasMore() bool {\n\tif o != nil && o.HasMore != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) GetHasParameters() bool {\n\tif o == nil || o.HasParameters == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.HasParameters\n}", "func (o *Content) HasRunAsCurrentUser() bool {\n\tif o != nil && o.RunAsCurrentUser != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_Metadata) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.Metadata.description\":\n\t\treturn x.Description != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.denom_units\":\n\t\treturn len(x.DenomUnits) != 0\n\tcase \"cosmos.bank.v1beta1.Metadata.base\":\n\t\treturn x.Base != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.display\":\n\t\treturn x.Display != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.name\":\n\t\treturn x.Name != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.symbol\":\n\t\treturn x.Symbol != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.uri\":\n\t\treturn x.Uri != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.uri_hash\":\n\t\treturn x.UriHash != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Metadata does not contain field %s\", fd.FullName()))\n\t}\n}", "func IsHasField(st interface{}, fieldName string) bool {\n\treturn HasField(st, fieldName)\n}", "func (o *Content) HasRunAs() bool {\n\tif o != nil && o.RunAs.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasAppMode() bool {\n\tif o != nil && o.AppMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *ccMetric) HasField(key string) bool {\n\t_, ok := m.fields[key]\n\treturn ok\n}", "func (s *Struct) HasField(name string) bool {\n\tfor _, f := range s.Fields {\n\t\tif f.Name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *Content) HasGuid() bool {\n\tif o != nil && o.Guid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *MockedMetadataClient) IDHasContent(id string, content []byte) bool {\n\treturn string(m.data[id]) == string(content)\n}", "func (o *Content) HasUrl() bool {\n\tif o != nil && o.Url != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasContentCategory() bool {\n\tif o != nil && o.ContentCategory != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasTitle() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Title\", \"title_id\"))\n}", "func (o *Content) HasReadTimeout() bool {\n\tif o != nil && o.ReadTimeout.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PortalSignInCustomization) HasText() bool {\n\tif o != nil && o.Text != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasCreatedTime() bool {\n\tif o != nil && o.CreatedTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FormField) HasConfig() bool {\n\tif o != nil && o.Config != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasCanEditContents() bool {\n\tif o != nil && o.CanEditContents != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphListItem) HasFields() bool {\n\tif o != nil && o.Fields != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LogContent) HasHost() bool {\n\tif o != nil && o.Host != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (dcc *DoorCompiledContent) Exists() bool {\n\treturn dcc._exists\n}", "func (m *Model) HasField(field string) (bool, error) {\n\treturn m.db.GetCore().HasField(m.GetCtx(), m.tablesInit, field)\n}", "func (o *RetrievedFile) HasB64Content() bool {\n\tif o != nil && o.B64Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *GroupWidgetDefinition) HasShowTitle() bool {\n\tif o != nil && o.ShowTitle != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Permissao) HasDescricao() bool {\n\tif o != nil && o.Descricao.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ls Set) Has(field string) bool {\n\t_, exists := ls[field]\n\treturn exists\n}", "func (o *CustomfieldRequest) HasCustomfield() bool {\n\tif o != nil && o.Customfield != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasCanEdit() bool {\n\tif o != nil && o.CanEdit != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FieldError) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n *node) isSet() bool {\n\treturn n.children == nil\n}", "func (o *Content) HasMinProcesses() bool {\n\tif o != nil && o.MinProcesses.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UploadResponse) HasValue() bool {\n\tif o != nil && o.Value != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineObject1187) HasFields() bool {\n\tif o != nil && o.Fields != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (w *Wrapper) Has() (has bool, err error) {\n\terr = w.Limit(1).Get()\n\tif err != nil {\n\t\thas = false\n\t\treturn\n\t}\n\tif w.Count() > 0 {\n\t\thas = true\n\t\treturn\n\t}\n\treturn\n}", "func (d UserData) HasStreet() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Street\", \"street\"))\n}", "func (d UserData) HasRef() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Ref\", \"ref\"))\n}", "func (o *OutputField) HasValue() bool {\n\tif o != nil && !IsNil(o.Value) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *PKGBUILD) HasValue(name string) bool {\n\treturn p.info.HasValue(name)\n}", "func (s SourceFilesystems) IsContent(filename string) bool {\n\treturn s.Content.Contains(filename)\n}", "func (set *ContentTypeSet) Has(contentType ContentType) bool {\n\tif set == nil {\n\t\treturn false\n\t}\n\tfor _, c := range set.set {\n\t\tif c == contentType {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d UserData) HasImage() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Image\", \"image\"))\n}", "func (o *Content) HasAccessType() bool {\n\tif o != nil && o.AccessType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasCanComplete() bool {\n\tif o != nil && o.CanComplete != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasBundleId() bool {\n\tif o != nil && o.BundleId.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m NoSides) HasText() bool {\n\treturn m.Has(tag.Text)\n}", "func (o *CreateTemplateRequestEntity) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (e PartialContent) IsPartialContent() {}", "func (o *ViewTag) HasCount() bool {\n\tif o != nil && o.Count != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Post) HasBody() bool {\n\tif o != nil && o.Body != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Post) HasHasAttachments() bool {\n\tif o != nil && o.HasAttachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f ExtensionField) IsSet() bool {\n\treturn f.typ != nil\n}", "func (o *LastMileAccelerationOptions) HasContentTypes() bool {\n\tif o != nil && o.ContentTypes != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20034Milestone) HasCanEdit() bool {\n\tif o != nil && o.CanEdit != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n *node) HasMeta() bool {\n\treturn n.meta != nil\n}", "func (o *ViewMilestone) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasPyVersion() bool {\n\tif o != nil && o.PyVersion.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m Maybe[T]) HasValue() bool {\n\treturn m.hasValue\n}", "func (o *CustomfieldCustomFieldsResponse) HasMeta() bool {\n\tif o != nil && o.Meta != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d *Datastore) Has(key datastore.Key) (bool, error) {\n\tdata, err := d.Get(key)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn data != nil, nil\n}", "func (o *ViewMetaPage) GetHasMore() bool {\n\tif o == nil || o.HasMore == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.HasMore\n}", "func (o *Content) HasRole() bool {\n\tif o != nil && o.Role != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasCustomfieldId() bool {\n\tif o != nil && o.CustomfieldId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasMaxConnsPerProcess() bool {\n\tif o != nil && o.MaxConnsPerProcess.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MessagesBaseTopicLinks) HasText() bool {\n\tif o != nil && o.Text != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SubDescriptionDto) HasShortText() bool {\n\tif o != nil && !IsNil(o.ShortText) {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.7470532", "0.71649307", "0.7099103", "0.70884323", "0.70447147", "0.6985137", "0.6899113", "0.6840653", "0.68236077", "0.6785173", "0.6721902", "0.63561416", "0.6296834", "0.6254155", "0.6204622", "0.61749446", "0.6151084", "0.60795254", "0.6074527", "0.6074329", "0.60727316", "0.60539407", "0.6045862", "0.6000121", "0.5987393", "0.59859717", "0.597583", "0.5947831", "0.5947398", "0.5908585", "0.5863859", "0.582278", "0.58199495", "0.5806726", "0.5784484", "0.577205", "0.5766389", "0.5757176", "0.5756587", "0.57535803", "0.5741123", "0.57099926", "0.5702495", "0.57020766", "0.56994385", "0.56955904", "0.56943375", "0.56852645", "0.56850845", "0.5684874", "0.56734425", "0.5666475", "0.5663622", "0.56625265", "0.56453675", "0.56330854", "0.56283236", "0.55845374", "0.5565116", "0.5564246", "0.5559628", "0.5557948", "0.55567086", "0.55496484", "0.554376", "0.55425704", "0.5534886", "0.5521807", "0.5510145", "0.5508722", "0.55086297", "0.5506527", "0.5500398", "0.54989964", "0.5496916", "0.54850286", "0.54841334", "0.5476761", "0.5472467", "0.54722136", "0.5466856", "0.5458201", "0.5454755", "0.5449472", "0.54478496", "0.5446684", "0.54446983", "0.5443962", "0.54299223", "0.54276836", "0.5423253", "0.5421053", "0.54182637", "0.5418008", "0.54152966", "0.5414128", "0.54140353", "0.54122126", "0.5406154", "0.5406013" ]
0.63925993
11
SetContent gets a reference to the given string and assigns it to the Content field.
func (o *MicrosoftGraphWorkbookComment) SetContent(v string) { o.Content = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *ChatMessageAttachment) SetContent(value *string)() {\n err := m.GetBackingStore().Set(\"content\", value)\n if err != nil {\n panic(err)\n }\n}", "func (editor *Editor) SetContent(html string, index int) {\n\teditor.inst.Call(\"setContent\", html, index)\n}", "func (m *WorkbookCommentReply) SetContent(value *string)() {\n m.content = value\n}", "func (m *CallTranscript) SetContent(value []byte)() {\n err := m.GetBackingStore().Set(\"content\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *Card) SetContent(obj fyne.CanvasObject) {\n\tc.Content = obj\n\n\tc.Refresh()\n}", "func (ggc *GithubGistCreate) SetContent(s string) *GithubGistCreate {\n\tggc.mutation.SetContent(s)\n\treturn ggc\n}", "func (c *clipboard) SetContent(content string) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(r.(error).Error() + \"ssss\")\n\t\t}\n\t}()\n\n\tglfw.SetClipboardString(content)\n}", "func (p *ParseData) SetContent(c string) {\n\tp.content = c\n}", "func (e *Element) SetContent(content []byte) {\n\tif len(e.children) > 0 {\n\t\treturn\n\t}\n\te.content = content\n}", "func (cfc *CustomerFollowCreate) SetContent(s string) *CustomerFollowCreate {\n\tcfc.mutation.SetContent(s)\n\treturn cfc\n}", "func (m *Model) SetContent(content string) {\n\tm.Content = content\n}", "func (m *Model) SetContent(content string) {\n\tm.Content = content\n}", "func (this *SIPMessage) SetContent(content interface{}, contentTypeHeader header.ContentTypeHeader) { //throws ParseException {\n\t//if content == nil) throw new NullPointerException(\"nil content\");\n\tthis.SetHeader(contentTypeHeader)\n\tlength := -1\n\tif s, ok := content.(string); ok {\n\t\tthis.messageContent = s\n\t\tlength = len(s)\n\t} else if b, ok := content.([]byte); ok {\n\t\tthis.messageContentBytes = b\n\t\tlength = len(b)\n\t} else {\n\t\tpanic(\"Don't support GenericObject\")\n\t\t//this.messageContentObject = content\n\t\t//length = len(content.(core.GenericObject).String())\n\t}\n\n\t//try {\n\n\t// if (content instanceof String )\n\t// length = ((String)content).length();\n\t// else if (content instanceof byte[])\n\t// length = ((byte[])content).length;\n\t// else\n\t// length = content.toString().length();\n\n\tif length != -1 {\n\t\tthis.contentLengthHeader.SetContentLength(length)\n\t}\n\t// } catch (InvalidArgumentException ex) {}\n\n}", "func (ds *dedupedStorage) setContent(hash zerodisk.Hash, content []byte) error {\n\tcmd := ardb.Command(command.Set, hash.Bytes(), content)\n\treturn ardb.Error(ds.cluster.DoFor(int64(hash[0]), cmd))\n}", "func (ac *AnswerCreate) SetContent(s string) *AnswerCreate {\n\tac.mutation.SetContent(s)\n\treturn ac\n}", "func (f *File) SetContent(content []byte) {\n\tf.content = content\n}", "func (m *MsgSubmitProposal) SetContent(content Content) error {\n\tmsg, ok := content.(proto.Message)\n\tif !ok {\n\t\treturn fmt.Errorf(\"can't proto marshal %T\", msg)\n\t}\n\tany, err := codectypes.NewAnyWithValue(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.Content = any\n\treturn nil\n}", "func (m *FileAssessmentRequest) SetContentData(value *string)() {\n m.contentData = value\n}", "func (label *LabelWidget) SetContent(content string) {\n\tlabel.content = content\n\tlabel.needsRepaint = true\n}", "func (u *GithubGistUpsert) SetContent(v string) *GithubGistUpsert {\n\tu.Set(githubgist.FieldContent, v)\n\treturn u\n}", "func (ac *ArticleCreate) SetContent(s string) *ArticleCreate {\n\tac.mutation.SetContent(s)\n\treturn ac\n}", "func (m *ChatMessageAttachment) SetContentUrl(value *string)() {\n err := m.GetBackingStore().Set(\"contentUrl\", value)\n if err != nil {\n panic(err)\n }\n}", "func Set(ctx context.Context, client *ent.Client, input *model.SetContentSettingIn) (*ent.ContentSetting, error) {\n\tcontentSetting, err := ContentSetting(ctx, client, input.Name)\n\n\tif err != nil {\n\t\tif ent.IsNotFound(err) {\n\t\t\treturn Create(ctx, client, input)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn contentSetting.Update().\n\t\tSetValue(input.Value).\n\t\tSave(ctx)\n}", "func SetContent(x, y int, mainc rune, combc []rune, style tcell.Style) {\n\tif !Screen.CanDisplay(mainc, true) {\n\t\tmainc = '�'\n\t}\n\n\tScreen.SetContent(x, y, mainc, combc, style)\n\tif UseFake() && lastCursor.x == x && lastCursor.y == y {\n\t\tlastCursor.r = mainc\n\t\tlastCursor.style = style\n\t\tlastCursor.combc = combc\n\t}\n}", "func (pu *PostUpdate) SetContent(s string) *PostUpdate {\n\tpu.mutation.SetContent(s)\n\treturn pu\n}", "func (pu *PostUpdate) SetContent(s string) *PostUpdate {\n\tpu.mutation.SetContent(s)\n\treturn pu\n}", "func (o *SimpleStringWeb) SetContent(v string) {\n\to.Content = &v\n}", "func (puo *PostUpdateOne) SetContent(s string) *PostUpdateOne {\n\tpuo.mutation.SetContent(s)\n\treturn puo\n}", "func (puo *PostUpdateOne) SetContent(s string) *PostUpdateOne {\n\tpuo.mutation.SetContent(s)\n\treturn puo\n}", "func (r postQueryContentString) Set(value string) postSetParams {\n\n\treturn postSetParams{\n\t\tdata: builder.Field{\n\t\t\tName: \"content\",\n\t\t\tValue: value,\n\t\t},\n\t}\n\n}", "func (u *GithubGistUpsertOne) SetContent(v string) *GithubGistUpsertOne {\n\treturn u.Update(func(s *GithubGistUpsert) {\n\t\ts.SetContent(v)\n\t})\n}", "func (d *DiscordWebhook) SetContent(content string) {\n\td.Content = content\n}", "func (m *CallTranscript) SetMetadataContent(value []byte)() {\n err := m.GetBackingStore().Set(\"metadataContent\", value)\n if err != nil {\n panic(err)\n }\n}", "func (upuo *UnsavedPostUpdateOne) SetContent(s string) *UnsavedPostUpdateOne {\n\tupuo.mutation.SetContent(s)\n\treturn upuo\n}", "func (r *AlibabaSecurityJaqRpCloudRphitAPIRequest) SetContent(_content string) error {\n\tr._content = _content\n\tr.Set(\"content\", _content)\n\treturn nil\n}", "func (m *FileAttachment) SetContentId(value *string)() {\n err := m.GetBackingStore().Set(\"contentId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (me *TContentTypeType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne {\n\tauo.mutation.SetContent(s)\n\treturn auo\n}", "func (auo *ArticleUpdateOne) SetContent(s string) *ArticleUpdateOne {\n\tauo.mutation.SetContent(s)\n\treturn auo\n}", "func (ec *ExperienceCreate) SetContent(s string) *ExperienceCreate {\n\tec.mutation.SetContent(s)\n\treturn ec\n}", "func (c *AdapterFile) SetContent(content string, file ...string) {\n\tname := DefaultConfigFileName\n\tif len(file) > 0 {\n\t\tname = file[0]\n\t}\n\t// Clear file cache for instances which cached `name`.\n\tlocalInstances.LockFunc(func(m map[string]interface{}) {\n\t\tif customConfigContentMap.Contains(name) {\n\t\t\tfor _, v := range m {\n\t\t\t\tif configInstance, ok := v.(*Config); ok {\n\t\t\t\t\tif fileConfig, ok := configInstance.GetAdapter().(*AdapterFile); ok {\n\t\t\t\t\t\tfileConfig.jsonMap.Remove(name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcustomConfigContentMap.Set(name, content)\n\t})\n}", "func (f *File) SetFileContent(ref BlobRef) *File {\n\tupdated := *f\n\tupdated.Children, _ = f.Children.Insert(Edge{Name: \"blob\", Ref: ref})\n\treturn &updated\n}", "func (m *FileAttachment) SetContentLocation(value *string)() {\n err := m.GetBackingStore().Set(\"contentLocation\", value)\n if err != nil {\n panic(err)\n }\n}", "func (ufc *UIFlexboxContainer) SetContent(setup FlexboxContainer) {\n\tif ufc._state.Slots != nil {\n\t\tfor _, v := range ufc._state.Slots {\n\t\t\tif v.Element != nil {\n\t\t\t\tufc.ThisUILayoutElementComponentDetails.Detach(v.Element)\n\t\t\t}\n\t\t}\n\t}\n\tufc._state = setup\n\tfor _, v := range setup.Slots {\n\t\tif v.Element != nil {\n\t\t\tufc.ThisUILayoutElementComponentDetails.Attach(v.Element)\n\t\t}\n\t}\n\tufc.FyLSubelementChanged()\n}", "func (upu *UnsavedPostUpdate) SetContent(s string) *UnsavedPostUpdate {\n\tupu.mutation.SetContent(s)\n\treturn upu\n}", "func (o *PollersPostParams) SetContent(content *models.Poller20PartialPoller) {\n\to.Content = content\n}", "func (c *Sender) EmitContent(s string) {\n\tc.content = s\n}", "func (o *JsonEnvironment) SetContent(v []string) {\n\to.Content = &v\n}", "func (object Object) Content(value string, language string) Object {\n\treturn object.Map(as.PropertyContent, value, language)\n}", "func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate {\n\tau.mutation.SetContent(s)\n\treturn au\n}", "func (au *ArticleUpdate) SetContent(s string) *ArticleUpdate {\n\tau.mutation.SetContent(s)\n\treturn au\n}", "func (m *AttachmentItem) SetContentId(value *string)() {\n m.contentId = value\n}", "func Content(id int, newFilePath string, newCName string) error {\n\t//if we choose to edit and include when it was edited, we can change the timestamp to the current one, to base future edits off\n\tstmt, err := mysqlBus.DB.Prepare(\"UPDATE Content SET file_path = ?, content_name = ? WHERE id = ?\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = stmt.Exec(newFilePath, newCName, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "func (ufc *UIOverlayContainer) SetContent(npp Frame, setup []UILayoutElement) {\n\tif ufc._state != nil {\n\t\tfor _, v := range ufc._state {\n\t\t\tufc.ThisUILayoutElementComponentDetails.Detach(v)\n\t\t}\n\t}\n\tufc._state = setup\n\tufc._framing = npp\n\tufc.ThisUIPanelDetails.Clipping = npp.FyFClipping()\n\tfor _, v := range setup {\n\t\tufc.ThisUILayoutElementComponentDetails.Attach(v)\n\t}\n\tufc.FyLSubelementChanged()\n}", "func (o *FileDto) SetContent(v []string) {\n\to.Content = &v\n}", "func (w *BodyPart) Set(s string) {\n\tw.Reset()\n\tw.WriteString(s)\n}", "func (r *URIRef) Content() Content {\n\tif r.bytes == nil {\n\t\treturn NilContent{}\n\t}\n\tbc := ByteContent(r.bytes)\n\treturn &bc\n}", "func (u *GithubGistUpsertBulk) SetContent(v string) *GithubGistUpsertBulk {\n\treturn u.Update(func(s *GithubGistUpsert) {\n\t\ts.SetContent(v)\n\t})\n}", "func (s *StringReference) SetValue(v string) *StringReference {\n\ts.Value = &v\n\treturn s\n}", "func Content(v string) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldContent), v))\n\t})\n}", "func (_Bucket *BucketTransactor) SetFileContent(opts *bind.TransactOpts, _fileId *big.Int, _storageRef string, _fileSize *big.Int) (*types.Transaction, error) {\n\treturn _Bucket.contract.Transact(opts, \"setFileContent\", _fileId, _storageRef, _fileSize)\n}", "func (t *Text) SetText(text string) {\n\tt.Content = str.NString(text)\n\tt.Dirty()\n}", "func (o *ResourceIdTagsJsonTags) SetContent(v string) {\n\to.Content = &v\n}", "func (d *driver) PutContent(ctx context.Context, path string, contents []byte) error {\n\tdefer debugTime()()\n\tcontentHash, err := d.shell.Add(bytes.NewReader(contents))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// strip off leading slash\n\tpath = path[1:]\n\n\td.rootlock.Lock()\n\tdefer d.rootlock.Unlock()\n\tnroot, err := d.shell.PatchLink(d.roothash, path, contentHash, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.roothash = nroot\n\td.publishHash(nroot)\n\treturn nil\n}", "func (this *SIPMessage) SetMessageContent(content string) {\n\t//int clength = (content == nil? 0: content.length());\n\t//try {\n\tthis.contentLengthHeader.SetContentLength(len(content))\n\t// } catch (InvalidArgumentException ex) {}\n\tthis.messageContent = content\n\tthis.messageContentBytes = nil\n\tthis.messageContentObject = nil\n}", "func PutContent(url string, data ...interface{}) string {\n\treturn RequestContent(\"PUT\", url, data...)\n}", "func (me *TxsdPresentationAttributesTextContentElementsTextAnchor) Set(s string) {\n\t(*xsdt.String)(me).Set(s)\n}", "func (me *TxsdTaxonomyReference) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (r *regulator) PutContent(ctx context.Context, path string, content []byte) error {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.PutContent(ctx, path, content)\n}", "func (s *Reference) SetValue(v string) *Reference {\n\ts.Value = &v\n\treturn s\n}", "func (o *Comment) SetContent(v string) {\n\to.Content = &v\n}", "func (form *FormData) Content(filename string, target *string, defaultValue string) *FormData {\n\tvar path string\n\tform.path(filename, &path)\n\n\tif path == \"\" {\n\t\t*target = defaultValue\n\n\t\treturn form\n\t}\n\n\treturn form.readFile(path, filename, target)\n}", "func NewContent(chainContent *ChainContent, sequence int) *Content {\n\treturn &Content{\n\t\tLabel: chainContent.Label,\n\t\tType: fmt.Sprintf(\"%v\", chainContent.Value[0]),\n\t\tValue: fmt.Sprintf(\"%v\", chainContent.Value[1]),\n\t\tContentSequence: sequence,\n\t\tDType: []string{\"Content\"},\n\t}\n}", "func StringContent(s string) proto.Message {\n\treturn &StringContentType{Value: s}\n}", "func (c *ClaimContent) Set() error {\n\treturn set(claimContentDB, c.ID(), c)\n}", "func (self *CommitMessagePanelDriver) Content(expected *TextMatcher) *CommitMessagePanelDriver {\n\tself.getViewDriver().Content(expected)\n\n\treturn self\n}", "func (w *BodyPart) Set(s string) {\n\t*w = []byte(s)\n}", "func (s *UpdateModelCardInput) SetContent(v string) *UpdateModelCardInput {\n\ts.Content = &v\n\treturn s\n}", "func (d *GetResult) Content(valuePtr interface{}) error {\n\treturn DefaultDecode(d.contents, d.flags, valuePtr)\n}", "func (obj *set) Content() SetContent {\n\treturn obj.content\n}", "func (dr *Templates) Set(templateid string, templatecontent string) {\n\tdr.templates[templateid] = templatecontent\n}", "func (c *CommentBlock) ContentString() string {\n\treturn string(c.content)\n}", "func (c *Classifier) AddContent(name string, content []byte) {\n\tdoc := tokenize(content)\n\tc.addDocument(name, doc)\n}", "func (client *Client) SetCrossdomainContent(request *SetCrossdomainContentRequest) (_result *SetCrossdomainContentResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &SetCrossdomainContentResponse{}\n\t_body, _err := client.SetCrossdomainContentWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (_LvRecording *LvRecordingTransactor) SetContentAddress(opts *bind.TransactOpts, _contentAddress common.Address) (*types.Transaction, error) {\n\treturn _LvRecording.contract.Transact(opts, \"setContentAddress\", _contentAddress)\n}", "func (s *CreateModelCardInput) SetContent(v string) *CreateModelCardInput {\n\ts.Content = &v\n\treturn s\n}", "func ReplaceContent(selector string, block html.Block) (*Response, error) {\n\tout, err := html.RenderMinifiedString(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := &Response{\n\t\tHTML: []HTMLUpdate{\n\t\t\t{\n\t\t\t\tOperation: HTMLReplaceContent,\n\t\t\t\tSelector: selector,\n\t\t\t\tContent: out,\n\t\t\t},\n\t\t},\n\t}\n\treturn ret, nil\n}", "func (m *ChatMessageAttachment) SetContentType(value *string)() {\n err := m.GetBackingStore().Set(\"contentType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *ModelCard) SetContent(v string) *ModelCard {\n\ts.Content = &v\n\treturn s\n}", "func (self Text) SetString(s string) {\n\tC.sfText_setString(self.Cref, C.CString(s))\n}", "func (m *DeviceHealthAttestationState) SetContentVersion(value *string)() {\n err := m.GetBackingStore().Set(\"contentVersion\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *SimpleStringWeb) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (ct *ContentTypes) RegisterContent(fileName string, contentType ml.ContentType) {\n\tif fileName[0] != '/' {\n\t\tfileName = \"/\" + fileName\n\t}\n\n\tct.ml.Overrides = append(ct.ml.Overrides, &ml.TypeOverride{\n\t\tPartName: fileName,\n\t\tContentType: contentType,\n\t})\n\n\tct.file.MarkAsUpdated()\n}", "func NewContent(\n\tinitialContent lease.ReadProxy,\n\tclock timeutil.Clock) (mc Content) {\n\tmc = &mutableContent{\n\t\tclock: clock,\n\t\tinitialContent: initialContent,\n\t\tdirtyThreshold: initialContent.Size(),\n\t}\n\n\treturn\n}", "func (f *File) SetSourceForContent(content []byte) {\n\tstr := string(content)\n\tstart, n := 0, len(str)\n\tvar source []string\n\tfor i := 0; i < n; i++ {\n\t\tif str[i] == '\\n' {\n\t\t\tsource = append(source, str[start:i])\n\t\t\t// skip '\\n'\n\t\t\tstart = i + 1\n\t\t}\n\t}\n\tif start < n {\n\t\tsource = append(source, str[start:])\n\t}\n\tf.SetSource(source)\n}", "func (ebox *Editbox) SetText(s string) {\n\tebox.editor.setText(s)\n}", "func (e *Element) ContentString() string {\n\treturn string(e.content)\n}", "func (m *WorkbookCommentReply) SetContentType(value *string)() {\n m.contentType = value\n}", "func (s *DnaString) SetValue(str string) {\n\ts.Value = str\n}", "func (s *ContactFlow) SetContent(v string) *ContactFlow {\n\ts.Content = &v\n\treturn s\n}" ]
[ "0.7248469", "0.71384996", "0.70648813", "0.6927052", "0.66024256", "0.652039", "0.6448842", "0.6412562", "0.62967324", "0.6257796", "0.6246422", "0.6246422", "0.6213247", "0.6145128", "0.6068305", "0.6034914", "0.6027223", "0.6008623", "0.6007775", "0.59951055", "0.5994749", "0.599401", "0.59855723", "0.5971244", "0.59367824", "0.59367824", "0.588292", "0.5880873", "0.5880873", "0.5860251", "0.5859567", "0.5810886", "0.5804069", "0.5776465", "0.57606775", "0.5753009", "0.57482624", "0.5734799", "0.5734799", "0.57210785", "0.5719878", "0.56708467", "0.56640744", "0.5663101", "0.5653563", "0.5653014", "0.5651786", "0.56419873", "0.5630071", "0.56182593", "0.56182593", "0.5616231", "0.5593977", "0.5581138", "0.54993474", "0.5461683", "0.54285556", "0.54105914", "0.5388175", "0.53835833", "0.5379273", "0.53307617", "0.53303856", "0.5306697", "0.530593", "0.52970374", "0.52934915", "0.52557313", "0.524", "0.5235787", "0.52326566", "0.5227946", "0.5218777", "0.5213109", "0.5203438", "0.5200121", "0.5192736", "0.5188028", "0.51833445", "0.5166508", "0.5165116", "0.51498437", "0.5146397", "0.51462436", "0.5139145", "0.5130217", "0.5117248", "0.51168", "0.50980914", "0.50847536", "0.5079097", "0.5075675", "0.50664157", "0.50586057", "0.5044227", "0.50213003", "0.5014101", "0.50121236", "0.4991394", "0.49880975" ]
0.5150617
81
SetContentExplicitNull (un)sets Content to be considered as explicit "null" value when serializing to JSON (pass true as argument to set this, false to unset) The Content value is set to nil even if false is passed
func (o *MicrosoftGraphWorkbookComment) SetContentExplicitNull(b bool) { o.Content = nil o.isExplicitNullContent = b }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *MicrosoftGraphVisualInfo) SetContentExplicitNull(b bool) {\n\to.Content = nil\n\to.isExplicitNullContent = b\n}", "func (o *DriveItemVersion) SetContentExplicitNull(b bool) {\n\to.Content = nil\n\to.isExplicitNullContent = b\n}", "func (o *InlineObject901) SetValueIfTrueExplicitNull(b bool) {\n\to.ValueIfTrue = nil\n\to.isExplicitNullValueIfTrue = b\n}", "func (o *MicrosoftGraphListItem) SetContentTypeExplicitNull(b bool) {\n\to.ContentType = nil\n\to.isExplicitNullContentType = b\n}", "func (o *InlineObject901) SetValueIfFalseExplicitNull(b bool) {\n\to.ValueIfFalse = nil\n\to.isExplicitNullValueIfFalse = b\n}", "func (o *Post) SetBodyExplicitNull(b bool) {\n\to.Body = nil\n\to.isExplicitNullBody = b\n}", "func (o *MicrosoftGraphTeamFunSettings) SetGiphyContentRatingExplicitNull(b bool) {\n\to.GiphyContentRating = nil\n\to.isExplicitNullGiphyContentRating = b\n}", "func (o *InlineObject869) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "func (o *InlineObject885) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "func (o *MicrosoftGraphModifiedProperty) SetNewValueExplicitNull(b bool) {\n\to.NewValue = nil\n\to.isExplicitNullNewValue = b\n}", "func (o *InlineObject999) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "func (o *WorkbookChart) SetFormatExplicitNull(b bool) {\n\to.Format = nil\n\to.isExplicitNullFormat = b\n}", "func (upuo *UnsavedPostUpdateOne) SetNillableContent(s *string) *UnsavedPostUpdateOne {\n\tif s != nil {\n\t\tupuo.SetContent(*s)\n\t}\n\treturn upuo\n}", "func (o *User) SetSettingsExplicitNull(b bool) {\n\to.Settings = nil\n\to.isExplicitNullSettings = b\n}", "func (upu *UnsavedPostUpdate) SetNillableContent(s *string) *UnsavedPostUpdate {\n\tif s != nil {\n\t\tupu.SetContent(*s)\n\t}\n\treturn upu\n}", "func (o *User) SetPhotoExplicitNull(b bool) {\n\to.Photo = nil\n\to.isExplicitNullPhoto = b\n}", "func (o *User) SetCityExplicitNull(b bool) {\n\to.City = nil\n\to.isExplicitNullCity = b\n}", "func (o *MicrosoftGraphVerifiedDomain) SetTypeExplicitNull(b bool) {\n\to.Type = nil\n\to.isExplicitNullType = b\n}", "func (o *User) SetStateExplicitNull(b bool) {\n\to.State = nil\n\to.isExplicitNullState = b\n}", "func (o *Post) SetSenderExplicitNull(b bool) {\n\to.Sender = nil\n\to.isExplicitNullSender = b\n}", "func (auo *ArticleUpdateOne) SetNillableContent(s *string) *ArticleUpdateOne {\n\tif s != nil {\n\t\tauo.SetContent(*s)\n\t}\n\treturn auo\n}", "func (auo *ArticleUpdateOne) SetNillableContent(s *string) *ArticleUpdateOne {\n\tif s != nil {\n\t\tauo.SetContent(*s)\n\t}\n\treturn auo\n}", "func (au *ArticleUpdate) SetNillableContent(s *string) *ArticleUpdate {\n\tif s != nil {\n\t\tau.SetContent(*s)\n\t}\n\treturn au\n}", "func (au *ArticleUpdate) SetNillableContent(s *string) *ArticleUpdate {\n\tif s != nil {\n\t\tau.SetContent(*s)\n\t}\n\treturn au\n}", "func (o *Post) SetInReplyToExplicitNull(b bool) {\n\to.InReplyTo = nil\n\to.isExplicitNullInReplyTo = b\n}", "func (o *MicrosoftGraphVisualInfo) SetBackgroundColorExplicitNull(b bool) {\n\to.BackgroundColor = nil\n\to.isExplicitNullBackgroundColor = b\n}", "func (o *MicrosoftGraphVisualInfo) SetAttributionExplicitNull(b bool) {\n\to.Attribution = nil\n\to.isExplicitNullAttribution = b\n}", "func (o *InlineObject885) SetCumulativeExplicitNull(b bool) {\n\to.Cumulative = nil\n\to.isExplicitNullCumulative = b\n}", "func (o *User) SetAboutMeExplicitNull(b bool) {\n\to.AboutMe = nil\n\to.isExplicitNullAboutMe = b\n}", "func (o *MicrosoftGraphTeamFunSettings) SetAllowGiphyExplicitNull(b bool) {\n\to.AllowGiphy = nil\n\to.isExplicitNullAllowGiphy = b\n}", "func (o *InlineObject869) SetCumulativeExplicitNull(b bool) {\n\to.Cumulative = nil\n\to.isExplicitNullCumulative = b\n}", "func (o *MicrosoftGraphVerifiedDomain) SetIsDefaultExplicitNull(b bool) {\n\to.IsDefault = nil\n\to.isExplicitNullIsDefault = b\n}", "func (o *WorkbookChart) SetAxesExplicitNull(b bool) {\n\to.Axes = nil\n\to.isExplicitNullAxes = b\n}", "func (o *BaseItem) SetCreatedByUserExplicitNull(b bool) {\n\to.CreatedByUser = nil\n\to.isExplicitNullCreatedByUser = b\n}", "func (o *InlineObject901) SetLogicalTestExplicitNull(b bool) {\n\to.LogicalTest = nil\n\to.isExplicitNullLogicalTest = b\n}", "func (v *JSONValue) SetNull() {\n\tv.RawMessage = []byte(\"null\")\n\tv.dataType = nullDataType\n}", "func (o *MicrosoftGraphSharedPcConfiguration) SetMaintenanceStartTimeExplicitNull(b bool) {\n\to.MaintenanceStartTime = nil\n\to.isExplicitNullMaintenanceStartTime = b\n}", "func (o *MicrosoftGraphChoiceColumn) SetAllowTextEntryExplicitNull(b bool) {\n\to.AllowTextEntry = nil\n\to.isExplicitNullAllowTextEntry = b\n}", "func (o *WorkbookChart) SetTitleExplicitNull(b bool) {\n\to.Title = nil\n\to.isExplicitNullTitle = b\n}", "func (o *InlineObject753) SetCostExplicitNull(b bool) {\n\to.Cost = nil\n\to.isExplicitNullCost = b\n}", "func (o *WindowsMobileMsi) SetCommandLineExplicitNull(b bool) {\n\to.CommandLine = nil\n\to.isExplicitNullCommandLine = b\n}", "func (o *MicrosoftGraphItemReference) SetPathExplicitNull(b bool) {\n\to.Path = nil\n\to.isExplicitNullPath = b\n}", "func (o *User) SetStreetAddressExplicitNull(b bool) {\n\to.StreetAddress = nil\n\to.isExplicitNullStreetAddress = b\n}", "func (o *MicrosoftGraphListItem) SetCreatedByUserExplicitNull(b bool) {\n\to.CreatedByUser = nil\n\to.isExplicitNullCreatedByUser = b\n}", "func (o *DriveItemVersion) SetSizeExplicitNull(b bool) {\n\to.Size = nil\n\to.isExplicitNullSize = b\n}", "func (o *BaseItem) SetETagExplicitNull(b bool) {\n\to.ETag = nil\n\to.isExplicitNullETag = b\n}", "func (o *User) SetMySiteExplicitNull(b bool) {\n\to.MySite = nil\n\to.isExplicitNullMySite = b\n}", "func (o *MicrosoftGraphEducationSchool) SetPhoneExplicitNull(b bool) {\n\to.Phone = nil\n\to.isExplicitNullPhone = b\n}", "func (o *InlineObject753) SetBasisExplicitNull(b bool) {\n\to.Basis = nil\n\to.isExplicitNullBasis = b\n}", "func (o *User) SetMailboxSettingsExplicitNull(b bool) {\n\to.MailboxSettings = nil\n\to.isExplicitNullMailboxSettings = b\n}", "func (o *MicrosoftGraphListItem) SetETagExplicitNull(b bool) {\n\to.ETag = nil\n\to.isExplicitNullETag = b\n}", "func (o *InlineObject741) SetItemExplicitNull(b bool) {\n\to.Item = nil\n\to.isExplicitNullItem = b\n}", "func (o *MicrosoftGraphEducationUser) SetUserExplicitNull(b bool) {\n\to.User = nil\n\to.isExplicitNullUser = b\n}", "func (o *MicrosoftGraphListItem) SetFieldsExplicitNull(b bool) {\n\to.Fields = nil\n\to.isExplicitNullFields = b\n}", "func (n *NullableGeneric) SetNull() {\n\tvar defaultValue generic.T\n\tn.data = defaultValue\n\tn.notNull = false\n}", "func (o *Windows10CompliancePolicy) SetOsMinimumVersionExplicitNull(b bool) {\n\to.OsMinimumVersion = nil\n\to.isExplicitNullOsMinimumVersion = b\n}", "func (o *Windows10CompliancePolicy) SetMobileOsMinimumVersionExplicitNull(b bool) {\n\to.MobileOsMinimumVersion = nil\n\to.isExplicitNullMobileOsMinimumVersion = b\n}", "func (o *BaseItem) SetParentReferenceExplicitNull(b bool) {\n\to.ParentReference = nil\n\to.isExplicitNullParentReference = b\n}", "func (o *MicrosoftGraphChoiceColumn) SetDisplayAsExplicitNull(b bool) {\n\to.DisplayAs = nil\n\to.isExplicitNullDisplayAs = b\n}", "func (o *MicrosoftGraphVerifiedDomain) SetIsInitialExplicitNull(b bool) {\n\to.IsInitial = nil\n\to.isExplicitNullIsInitial = b\n}", "func (o *HealthCheckResult) SetNullableMessageExplicitNull(b bool) {\n\to.NullableMessage = nil\n\to.isExplicitNullNullableMessage = b\n}", "func (o *Post) SetConversationThreadIdExplicitNull(b bool) {\n\to.ConversationThreadId = nil\n\to.isExplicitNullConversationThreadId = b\n}", "func (o *InlineObject871) SetProbabilityExplicitNull(b bool) {\n\to.Probability = nil\n\to.isExplicitNullProbability = b\n}", "func (o *DaylightTimeZoneOffset) SetDaylightBiasExplicitNull(b bool) {\n\to.DaylightBias = nil\n\to.isExplicitNullDaylightBias = b\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) SetOsMinimumVersionExplicitNull(b bool) {\n\to.OsMinimumVersion = nil\n\to.isExplicitNullOsMinimumVersion = b\n}", "func (o *Post) SetConversationIdExplicitNull(b bool) {\n\to.ConversationId = nil\n\to.isExplicitNullConversationId = b\n}", "func (o *User) SetInferenceClassificationExplicitNull(b bool) {\n\to.InferenceClassification = nil\n\to.isExplicitNullInferenceClassification = b\n}", "func (o *MicrosoftGraphEducationSchool) SetAddressExplicitNull(b bool) {\n\to.Address = nil\n\to.isExplicitNullAddress = b\n}", "func (o *MicrosoftGraphAppListItem) SetPublisherExplicitNull(b bool) {\n\to.Publisher = nil\n\to.isExplicitNullPublisher = b\n}", "func (o *User) SetOutlookExplicitNull(b bool) {\n\to.Outlook = nil\n\to.isExplicitNullOutlook = b\n}", "func (o *MicrosoftGraphVerifiedDomain) SetCapabilitiesExplicitNull(b bool) {\n\to.Capabilities = nil\n\to.isExplicitNullCapabilities = b\n}", "func (o *User) SetCountryExplicitNull(b bool) {\n\to.Country = nil\n\to.isExplicitNullCountry = b\n}", "func (o *MicrosoftGraphControlScore) SetControlCategoryExplicitNull(b bool) {\n\to.ControlCategory = nil\n\to.isExplicitNullControlCategory = b\n}", "func (o *User) SetInsightsExplicitNull(b bool) {\n\to.Insights = nil\n\to.isExplicitNullInsights = b\n}", "func (o *InlineObject794) SetValuesExplicitNull(b bool) {\n\to.Values = nil\n\to.isExplicitNullValues = b\n}", "func (o *User) SetManagerExplicitNull(b bool) {\n\to.Manager = nil\n\to.isExplicitNullManager = b\n}", "func (o *MicrosoftGraphListItem) SetParentReferenceExplicitNull(b bool) {\n\to.ParentReference = nil\n\to.isExplicitNullParentReference = b\n}", "func (o *MicrosoftGraphModifiedProperty) SetOldValueExplicitNull(b bool) {\n\to.OldValue = nil\n\to.isExplicitNullOldValue = b\n}", "func (o *User) SetDriveExplicitNull(b bool) {\n\to.Drive = nil\n\to.isExplicitNullDrive = b\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) SetMobileOsMinimumVersionExplicitNull(b bool) {\n\to.MobileOsMinimumVersion = nil\n\to.isExplicitNullMobileOsMinimumVersion = b\n}", "func (o *BaseItem) SetLastModifiedByUserExplicitNull(b bool) {\n\to.LastModifiedByUser = nil\n\to.isExplicitNullLastModifiedByUser = b\n}", "func (o *InlineObject985) SetValuesExplicitNull(b bool) {\n\to.Values = nil\n\to.isExplicitNullValues = b\n}", "func (o *BaseItem) SetLastModifiedByExplicitNull(b bool) {\n\to.LastModifiedBy = nil\n\to.isExplicitNullLastModifiedBy = b\n}", "func (ns *NullString) SetNull() {\n\n\tif ns == nil {\n\t\t*ns = NullString{}\n\t}\n\n\tns.Text = \"\"\n\tns.IsNotNull = false\n\n}", "func (o *MicrosoftGraphUsageDetails) SetLastModifiedDateTimeExplicitNull(b bool) {\n\to.LastModifiedDateTime = nil\n\to.isExplicitNullLastModifiedDateTime = b\n}", "func (o *User) SetCalendarExplicitNull(b bool) {\n\to.Calendar = nil\n\to.isExplicitNullCalendar = b\n}", "func (o *PlannerTaskDetails) SetPreviewTypeExplicitNull(b bool) {\n\to.PreviewType = nil\n\to.isExplicitNullPreviewType = b\n}", "func (o *User) SetPostalCodeExplicitNull(b bool) {\n\to.PostalCode = nil\n\to.isExplicitNullPostalCode = b\n}", "func (o *User) SetMobilePhoneExplicitNull(b bool) {\n\to.MobilePhone = nil\n\to.isExplicitNullMobilePhone = b\n}", "func (o *User) SetUsageLocationExplicitNull(b bool) {\n\to.UsageLocation = nil\n\to.isExplicitNullUsageLocation = b\n}", "func (o *SecureScore) SetCreatedDateTimeExplicitNull(b bool) {\n\to.CreatedDateTime = nil\n\to.isExplicitNullCreatedDateTime = b\n}", "func (o *BaseItem) SetWebUrlExplicitNull(b bool) {\n\to.WebUrl = nil\n\to.isExplicitNullWebUrl = b\n}", "func (o *MicrosoftGraphPrivacyProfile) SetStatementUrlExplicitNull(b bool) {\n\to.StatementUrl = nil\n\to.isExplicitNullStatementUrl = b\n}", "func (o *Content) SetTitleNil() {\n\to.Title.Set(nil)\n}", "func (o *MicrosoftGraphListItem) SetLastModifiedByUserExplicitNull(b bool) {\n\to.LastModifiedByUser = nil\n\to.isExplicitNullLastModifiedByUser = b\n}", "func (o *MicrosoftGraphEducationUser) SetMobilePhoneExplicitNull(b bool) {\n\to.MobilePhone = nil\n\to.isExplicitNullMobilePhone = b\n}", "func (o *WorkbookChart) SetWorksheetExplicitNull(b bool) {\n\to.Worksheet = nil\n\to.isExplicitNullWorksheet = b\n}", "func (o *MicrosoftGraphItemReference) SetShareIdExplicitNull(b bool) {\n\to.ShareId = nil\n\to.isExplicitNullShareId = b\n}", "func (o *User) SetUserTypeExplicitNull(b bool) {\n\to.UserType = nil\n\to.isExplicitNullUserType = b\n}", "func (o *MicrosoftGraphWorkbookSortField) SetColorExplicitNull(b bool) {\n\to.Color = nil\n\to.isExplicitNullColor = b\n}" ]
[ "0.76932585", "0.7527978", "0.6653902", "0.6630438", "0.6555314", "0.64957523", "0.6343414", "0.63400555", "0.6285292", "0.6185744", "0.61630803", "0.6076197", "0.5954041", "0.5881144", "0.58613396", "0.5819549", "0.5816799", "0.5776044", "0.5772046", "0.57659173", "0.5751211", "0.5751211", "0.57115513", "0.57115513", "0.5682589", "0.5666406", "0.5659715", "0.56520176", "0.56514597", "0.5635245", "0.56222993", "0.55679286", "0.55419016", "0.55140704", "0.5497951", "0.54813474", "0.5472961", "0.5444277", "0.5432031", "0.54151624", "0.54088885", "0.5407724", "0.5404504", "0.53997165", "0.53930247", "0.5385498", "0.53769416", "0.53761905", "0.5339825", "0.5338342", "0.53358364", "0.533369", "0.5323819", "0.53232634", "0.5317374", "0.5304812", "0.52986324", "0.5291899", "0.5291836", "0.528561", "0.5239473", "0.5236425", "0.5232569", "0.52288866", "0.52261907", "0.52173364", "0.52030665", "0.51889986", "0.51859224", "0.5178151", "0.5166739", "0.51661164", "0.51660246", "0.5161505", "0.5147838", "0.5136202", "0.5136107", "0.51229954", "0.5116929", "0.5116163", "0.51138014", "0.5106721", "0.5102203", "0.50991213", "0.5089337", "0.507208", "0.50570107", "0.50492644", "0.50415856", "0.50412095", "0.5038551", "0.503669", "0.5030945", "0.50302243", "0.5008705", "0.50041765", "0.50033313", "0.49903896", "0.4988627", "0.49877968" ]
0.76145333
1
GetContentType returns the ContentType field if nonnil, zero value otherwise.
func (o *MicrosoftGraphWorkbookComment) GetContentType() string { if o == nil || o.ContentType == nil { var ret string return ret } return *o.ContentType }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *GetMessagesAllOf) GetContentType() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.ContentType\n}", "func (r *ReleaseAsset) GetContentType() string {\n\tif r == nil || r.ContentType == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.ContentType\n}", "func (o *InlineResponse200115) GetContentType() string {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ContentType\n}", "func (m *ThreatAssessmentRequest) GetContentType()(*ThreatAssessmentContentType) {\n val, err := m.GetBackingStore().Get(\"contentType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ThreatAssessmentContentType)\n }\n return nil\n}", "func (req *DronaRequest) GetContentType() string {\n\treq.Lock()\n\tdefer req.Unlock()\n\treturn req.contentType\n}", "func (o *InlineResponse20049Post) GetContentType() string {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ContentType\n}", "func (x *Message) GetContentType() string {\n\tif v, ok := x.Header[ContentType]; ok && v != \"\" {\n\t\treturn v\n\t}\n\treturn encoding.ContentTypeJSON\n}", "func (m *ChatMessageAttachment) GetContentType()(*string) {\n val, err := m.GetBackingStore().Get(\"contentType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *ThreatAssessmentRequest) GetContentType()(*ThreatAssessmentContentType) {\n return m.contentType\n}", "func (m *AttachmentItem) GetContentType()(*string) {\n return m.contentType\n}", "func (promise AttachmentPromise) GetContentType() string {\n\tif ret, ok := promise.params[\"content-type\"]; ok {\n\t\treturn ret\n\t}\n\treturn \"\"\n}", "func (m *Gzip) GetContentType() []string {\n\tif m != nil {\n\t\treturn m.ContentType\n\t}\n\treturn nil\n}", "func (m *PrinterDefaults) GetContentType()(*string) {\n val, err := m.GetBackingStore().Get(\"contentType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (pb *PostBody) ContentType() string {\n\tif pb == nil {\n\t\treturn \"\"\n\t}\n\treturn pb.contentType\n}", "func (m MediaType) ContentType() string {\n\tif len(m.Type) > 0 && m.Charset != \"\" {\n\t\treturn fmt.Sprintf(\"%s; charset=%s\", m.Type, m.Charset)\n\t}\n\treturn m.Type\n}", "func (h *ResponseHeader) ContentType() []byte {\n\tcontentType := h.contentType\n\tif !h.noDefaultContentType && len(h.contentType) == 0 {\n\t\tcontentType = defaultContentType\n\t}\n\treturn contentType\n}", "func (req *Request) GetContentType() string {\n\treturn req.Req.Header.Get(\"Content-Type\")\n}", "func (s *Structured) GetContentType() string {\n\treturn s.cloudEvent.ContentType\n}", "func (c *Context) ContentType() string {\n\treturn filterFlags(c.GetHeader(\"Content-Type\"))\n}", "func GetContentType(r *http.Request) string {\n\treturn filteFlag(r.Header.Get(\"Content-Type\"))\n}", "func (o *S3UploadOpts) GetContentType() *string {\n\treturn getStrPtr(o.ContentType)\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) GetContentType(opts *bind.CallOpts, position *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"getContentType\", position)\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}", "func (pstFile *File) GetContentType() ([]byte, error) {\n\tcontentType, err := pstFile.Read(2, 8)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif bytes.Equal(contentType, ContentTypePST) {\n\t\treturn ContentTypePST, nil\n\t} else if bytes.Equal(contentType, ContentTypeOST) {\n\t\treturn ContentTypeOST, nil\n\t} else if bytes.Equal(contentType, ContentTypePAB) {\n\t\treturn ContentTypePAB, nil\n\t} else {\n\t\treturn nil, errors.New(\"unsupported content type\")\n\t}\n}", "func (c *Context) ContentType() string {\n\treturn filterFlags(c.requestHeader(\"Content-Type\"))\n}", "func GetContentTypeHeader(header http.Header) string {\n\tcontentType := header.Get(ContentTypeHeader)\n\tif len(contentType) > 0 {\n\t\treturn contentType\n\t}\n\treturn DefaultContentType\n}", "func (o *MicrosoftGraphListItem) GetContentType() AnyOfmicrosoftGraphContentTypeInfo {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret AnyOfmicrosoftGraphContentTypeInfo\n\t\treturn ret\n\t}\n\treturn *o.ContentType\n}", "func (req *Request) ContentType() string {\n\tif req == nil {\n\t\treturn \"\"\n\t}\n\n\tif req._contentType == \"\" {\n\t\tcontentType := req.Request.Header.Get(\"Content-Type\")\n\n\t\tif contentType == \"\" {\n\t\t\treq._contentType = \"text/html\"\n\t\t} else {\n\t\t\treq._contentType = strings.ToLower(strings.TrimSpace(strings.Split(contentType, \";\")[0]))\n\t\t}\n\t}\n\n\treturn req._contentType\n}", "func (json Json) getContentType() (contentType string) {\n\treturn json.contentType\n}", "func (sct *ContentSniffer) ContentType() (string, bool) {\n\tif sct.sniffed {\n\t\treturn sct.ctype, sct.ctype != \"\"\n\t}\n\tsct.sniffed = true\n\t// If ReadAll hits EOF, it returns err==nil.\n\tsct.start, sct.err = ioutil.ReadAll(io.LimitReader(sct.r, sniffBuffSize))\n\n\t// Don't try to detect the content type based on possibly incomplete data.\n\tif sct.err != nil {\n\t\treturn \"\", false\n\t}\n\n\tsct.ctype = http.DetectContentType(sct.start)\n\treturn sct.ctype, true\n}", "func (o *MicrosoftGraphWorkbookComment) GetContentTypeOk() (string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (r *Request) ContentType() string {\n\treturn r.contentType\n}", "func (config *Config) ContentType() ContentType {\n\treturn config.contentType\n}", "func (lf *localFile) ContentType() string {\n\tif lf.matcher != nil && lf.matcher.ContentType != \"\" {\n\t\treturn lf.matcher.ContentType\n\t}\n\n\text := filepath.Ext(lf.NativePath)\n\tif mimeType, _, found := lf.mediaTypes.GetFirstBySuffix(strings.TrimPrefix(ext, \".\")); found {\n\t\treturn mimeType.Type\n\t}\n\n\treturn mime.TypeByExtension(ext)\n}", "func (h *RequestHeader) ContentType() []byte {\n\tif h.disableSpecialHeader {\n\t\treturn peekArgBytes(h.h, []byte(HeaderContentType))\n\t}\n\treturn h.contentType\n}", "func (o *InlineResponse200115) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (e *msgpackEncoder) ContentType() string {\n\treturn e.contentType\n}", "func (p *Part) ContentType() string {\n\tctype := C.gmime_get_content_type_string(p.gmimePart)\n\tdefer C.g_free(C.gpointer(unsafe.Pointer(ctype)))\n\treturn C.GoString(ctype)\n}", "func (o *InlineResponse20049Post) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (o *GetMessagesAllOf) GetContentTypeOk() (*interface{}, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentType, true\n}", "func getContentTypeMiddleware(contentType string, strictCheck bool) middlewares.MiddlewareFunc {\n\treturn middlewares.NewContentType(&middlewares.ContentTypeOptions{\n\t\tContentType: contentType,\n\t\tStrict: strictCheck,\n\t})\n}", "func ContentType(absoluteFilePath string) (string, error) {\n\tout, err := os.Open(path.Clean(absoluteFilePath))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer out.Close()\n\n\t// Only the first 512 bytes are used to sniff the content type.\n\tbuffer := make([]byte, 512)\n\n\t_, err = out.Read(buffer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Use the net/http package's handy DectectContentType function. Always returns a valid\n\t// content-type by returning \"application/octet-stream\" if no others seemed to match.\n\tcontentType := http.DetectContentType(buffer)\n\n\treturn contentType, nil\n}", "func (_AccessIndexor *AccessIndexorCaller) GetContentType(opts *bind.CallOpts, position *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _AccessIndexor.contract.Call(opts, &out, \"getContentType\", position)\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}", "func (s funcRenderer) ContentType() string {\n\treturn s.contentType\n}", "func (o BlobOutput) ContentType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Blob) pulumi.StringPtrOutput { return v.ContentType }).(pulumi.StringPtrOutput)\n}", "func (o *MicrosoftGraphListItem) GetContentTypeOk() (AnyOfmicrosoftGraphContentTypeInfo, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret AnyOfmicrosoftGraphContentTypeInfo\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (m *WorkbookCommentReply) GetContentType()(*string) {\n return m.contentType\n}", "func getContentType(r *http.Request) string {\n\theaderValue := r.Header.Get(\"Content-Type\")\n\tif headerValue == \"\" {\n\t\treturn \"\"\n\t}\n\n\theaderValueSplit := strings.Split(headerValue, \";\")\n\treturn headerValueSplit[0]\n}", "func (ctx *Context) ContentType(val string, unique bool) {\n\tvar ctype string\n\tif strings.ContainsRune(val, '/') {\n\t\tctype = val\n\t} else {\n\t\tif !strings.HasPrefix(val, \".\") {\n\t\t\tval = \".\" + val\n\t\t}\n\t\tctype = mime.TypeByExtension(val)\n\t}\n\tif ctype != \"\" {\n\t\tctx.SetHeader(\"Content-Type\", ctype, unique)\n\t}\n}", "func (_BaseContent *BaseContentCaller) ContentType(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContent.contract.Call(opts, &out, \"contentType\")\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}", "func (imr *InvokeMethodResponse) ContentType() string {\n\tm := imr.r.Message\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\n\tcontentType := m.ContentType\n\n\tif m.Data != nil && m.Data.TypeUrl != \"\" {\n\t\tcontentType = ProtobufContentType\n\t}\n\n\treturn contentType\n}", "func (this *Context) ContentType(val string) string {\n\tvar ctype string\n\tif strings.ContainsRune(val, '/') {\n\t\tctype = val\n\t} else {\n\t\tif !strings.HasPrefix(val, \".\") {\n\t\t\tval = \".\" + val\n\t\t}\n\t\tctype = mime.TypeByExtension(val)\n\t}\n\tif ctype != \"\" {\n\t\tthis.Header().Set(\"Content-Type\", ctype)\n\t}\n\treturn ctype\n}", "func (this *SIPMessage) GetContentTypeHeader() header.ContentTypeHeader {\n\treturn this.GetHeader(core.SIPHeaderNames_CONTENT_TYPE).(header.ContentTypeHeader)\n}", "func GetContentType(str string) (ContentType, error) {\n\tmediaType, _, err := mime.ParseMediaType(str)\n\treturn ContentType(mediaType), err\n}", "func (_BaseAccessWallet *BaseAccessWalletCaller) GetContentType(opts *bind.CallOpts, position *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWallet.contract.Call(opts, &out, \"getContentType\", position)\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}", "func (r *RepositoryContent) GetType() string {\n\tif r == nil || r.Type == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Type\n}", "func (p profiler) ContentType() string {\n\tif p.debug > 0 && p.which != \"profile\" {\n\t\treturn \"text/plain; charset=utf-8\"\n\t}\n\treturn \"application/octet-stream\"\n}", "func (e *jsonEncoder) ContentType() string {\n\treturn e.contentType\n}", "func (o ApiOperationRequestRepresentationOutput) ContentType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApiOperationRequestRepresentation) string { return v.ContentType }).(pulumi.StringOutput)\n}", "func (o ApiOperationResponseRepresentationOutput) ContentType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApiOperationResponseRepresentation) string { return v.ContentType }).(pulumi.StringOutput)\n}", "func (m *ThreatAssessmentRequest) SetContentType(value *ThreatAssessmentContentType)() {\n m.contentType = value\n}", "func (m *AttachmentItem) SetContentType(value *string)() {\n m.contentType = value\n}", "func getRequestContentType(r *http.Request) string {\n\tct := r.Header.Get(\"Content-Type\")\n\tif ct != \"\" {\n\t\treturn ct\n\t} else {\n\t\treturn DEFAULT_CONTENT_TYPE\n\t}\n}", "func (set *ContentTypeSet) Type() ContentType {\n\tif set == nil {\n\t\treturn \"\"\n\t}\n\tp := set.pos\n\tif p >= len(set.set) {\n\t\tp = len(set.set) - 1\n\t} else if p <= 0 {\n\t\tp = 0\n\t}\n\treturn set.set[p]\n}", "func ContentType(contentType string) Option {\n\treturn Opt(\"content_type\", contentType)\n}", "func (o *GetMessagesAllOf) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (res *ResponseRecorder) ContentType() string {\n\treturn res.Header().Get(\"Content-Type\")\n}", "func (r *Request) contentType() int {\n\tif r.Method == \"HEAD\" || r.Method == \"OPTIONS\" {\n\t\treturn contentNone\n\t}\n\n\tct := r.Header.Get(\"content-type\")\n\tif strings.Contains(ct, \"application/x-www-form-urlencoded\") {\n\t\treturn contentFormData\n\t}\n\n\tif strings.Contains(ct, \"multipart/form-data\") {\n\t\treturn contentMultipart\n\t}\n\n\treturn contentStream\n}", "func (o *WhatsAppEmailWhatsAppApiContent) 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}", "func (o *Object) MimeType(ctx context.Context) string {\n\treturn o.contentType\n}", "func (lfs ListFilesystemSchema) ContentType() string {\n\treturn lfs.rawResponse.Header.Get(\"Content-Type\")\n}", "func (dr DownloadResponse) ContentType() string {\n\treturn dr.dr.ContentType()\n}", "func (dr downloadResponse) ContentType() string {\n\treturn dr.rawResponse.Header.Get(\"Content-Type\")\n}", "func (c *SimpleXmlCodec) ContentType() string {\n\treturn constants.ContentTypeXML\n}", "func (o *MicrosoftGraphWorkbookComment) SetContentType(v string) {\n\to.ContentType = &v\n}", "func GetFileContentType(out *os.File) (string, error) {\n\t// Only the first 512 bytes are used to sniff the content type.\n\tbuffer := make([]byte, 512)\n\n\t_, err := out.Read(buffer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Use the net/http package's handy DectectContentType function. Always returns a valid\n\t// content-type by returning \"application/octet-stream\" if no others seemed to match.\n\tcontentType := http.DetectContentType(buffer)\n\n\treturn contentType, nil\n}", "func (s *MetricsSource) SetContentType(v string) *MetricsSource {\n\ts.ContentType = &v\n\treturn s\n}", "func HTTPGetContentType(input interface{}) string {\n\tvar (\n\t\theader http.Header\n\t)\n\n\tswitch input.(type) {\n\tcase *http.Request:\n\t\theader = input.(*http.Request).Header\n\tcase *http.Response:\n\t\theader = input.(*http.Response).Header\n\tcase http.ResponseWriter:\n\t\theader = input.(http.ResponseWriter).Header()\n\tdefault:\n\t\treturn \"\"\n\t}\n\n\tcontentType := header.Get(\"Content-Type\")\n\n\tindex := strings.Index(contentType, \";\")\n\tif index != -1 {\n\t\treturn contentType[:index]\n\t}\n\n\treturn contentType\n}", "func GetRequestContentType(r *http.Request, dflt ContentType) ContentType {\n\tif contentType, ok := r.Context().Value(ContentTypeCtxKey).(ContentType); ok && contentType != \"\" {\n\t\treturn contentType\n\t}\n\tct, err := GetContentType(r.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn dflt\n\t}\n\treturn ct\n}", "func (e *HTTPResponseEvent) ContentType() string {\n\treturn e.contentType\n}", "func (s *Channel) SetContentType(v string) *Channel {\n\ts.ContentType = &v\n\treturn s\n}", "func (o *MicrosoftGraphWorkbookComment) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WhatsAppPhoneWhatsAppApiContent) 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}", "func (m *SerializationWriterFactoryRegistry) GetValidContentType() (string, error) {\n\treturn \"\", errors.New(\"the registry supports multiple content types. Get the registered factory instead\")\n}", "func getFileContentType(out io.Reader) (string, error) {\n\t// Only the first 512 bytes are used to sniff the content type.\n\tbuffer := make([]byte, 512)\n\n\t_, err := out.Read(buffer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Use the net/http package's handy DectectContentType function. Always returns a valid\n\t// content-type by returning \"application/octet-stream\" if no others seemed to match.\n\tcontentType := http.DetectContentType(buffer)\n\n\treturn contentType, nil\n}", "func LookupContentType(ctx *pulumi.Context, args *LookupContentTypeArgs, opts ...pulumi.InvokeOption) (*LookupContentTypeResult, error) {\n\tvar rv LookupContentTypeResult\n\terr := ctx.Invoke(\"azure-native:apimanagement/v20210101preview:getContentType\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func ContentType(mimeType mime.Type, additionalParams ...params.Header) (string, string) {\n\tif len(additionalParams) > 0 {\n\t\treturn \"Content-Type\", fmt.Sprintf(\"%v%v\", mimeType, params.Aggregate(additionalParams))\n\t} else {\n\t\treturn \"Content-Type\", string(mimeType)\n\t}\n}", "func (o *InlineResponse200115) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *UtteranceBotResponse) SetContentType(v string) *UtteranceBotResponse {\n\ts.ContentType = &v\n\treturn s\n}", "func (s *AutoMLChannel) SetContentType(v string) *AutoMLChannel {\n\ts.ContentType = &v\n\treturn s\n}", "func (r reportLog) RequestContentType() string {\n\tif r.RequestHeaders != nil {\n\t\tfor k, v := range r.RequestHeaders {\n\t\t\tif strings.ToLower(k) == \"content-type\" {\n\t\t\t\treturn v\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "func (p *DubboCodec) GetContentTypeID() byte {\n\treturn Hessian2\n}", "func (s *ChatMessage) SetContentType(v string) *ChatMessage {\n\ts.ContentType = &v\n\treturn s\n}", "func (s *GetProfileOutput) SetContentType(v string) *GetProfileOutput {\n\ts.ContentType = &v\n\treturn s\n}", "func (r *Request) SetContentType() *Request {\n\tif nil != r.err {\n\t\treturn r\n\t}\n\tr.contentTypeFlag = true\n\treturn r\n}", "func (s *AutoMLJobChannel) SetContentType(v string) *AutoMLJobChannel {\n\ts.ContentType = &v\n\treturn s\n}", "func (o *PostApplyManifestParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func ContentType(value string) Option {\n\treturn setHeader(\"Content-Type\", value)\n}", "func (o *InlineResponse200115) SetContentType(v string) {\n\to.ContentType = &v\n}", "func (o *InlineResponse20049Post) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20049Post) SetContentType(v string) {\n\to.ContentType = &v\n}" ]
[ "0.7752258", "0.7363014", "0.7343811", "0.7250318", "0.72422904", "0.72274965", "0.7166052", "0.7135691", "0.71105003", "0.70960563", "0.70768976", "0.70522594", "0.69677293", "0.6942977", "0.69010484", "0.6865125", "0.6849224", "0.6791845", "0.67761767", "0.67645895", "0.6715945", "0.6699078", "0.66990733", "0.66824704", "0.66550857", "0.6602939", "0.659188", "0.657778", "0.6563551", "0.65520525", "0.65441847", "0.65371746", "0.64184666", "0.6404937", "0.64015025", "0.6386592", "0.6385975", "0.63633955", "0.6351423", "0.6321942", "0.6319863", "0.63174087", "0.62811106", "0.62688357", "0.6238272", "0.62069935", "0.620088", "0.61680245", "0.61677086", "0.61497116", "0.61409175", "0.61365986", "0.61341256", "0.613303", "0.6109209", "0.6100698", "0.60859025", "0.6064799", "0.60385346", "0.6016811", "0.5981315", "0.5978518", "0.5966505", "0.59660697", "0.5944908", "0.59317875", "0.5917075", "0.59102684", "0.58786225", "0.5868473", "0.5863198", "0.5816519", "0.5813868", "0.58076346", "0.580201", "0.5791263", "0.578816", "0.5779654", "0.5763856", "0.5750738", "0.5742181", "0.57338077", "0.5733525", "0.57285905", "0.57260704", "0.57038337", "0.5689064", "0.5687415", "0.568045", "0.5676816", "0.5646486", "0.5639109", "0.5638389", "0.5636616", "0.5636123", "0.5635138", "0.5629269", "0.56075555", "0.560665", "0.559051" ]
0.69808453
12
GetContentTypeOk returns a tuple with the ContentType field if it's nonnil, zero value otherwise and a boolean to check if the value has been set.
func (o *MicrosoftGraphWorkbookComment) GetContentTypeOk() (string, bool) { if o == nil || o.ContentType == nil { var ret string return ret, false } return *o.ContentType, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *GetMessagesAllOf) GetContentTypeOk() (*interface{}, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentType, true\n}", "func (o *InlineResponse20049Post) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (o *InlineResponse200115) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func (o *MicrosoftGraphListItem) GetContentTypeOk() (AnyOfmicrosoftGraphContentTypeInfo, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret AnyOfmicrosoftGraphContentTypeInfo\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (o *WhatsAppEmailWhatsAppApiContent) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *WhatsAppPhoneWhatsAppApiContent) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *LastMileAccelerationOptions) GetContentTypesOk() (*[]string, bool) {\n\tif o == nil || o.ContentTypes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentTypes, true\n}", "func (o *WhatsAppTemplateButtonWhatsAppApiContent) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *StorageHyperFlexStorageContainer) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (r *Reply) IsContentTypeSet() bool {\n\treturn len(r.ContType) > 0\n}", "func (o *View) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *CatalogEntry) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *ModelsBackupSchedule) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *NotebookMetadata) GetTypeOk() (*NotebookMetadataType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type.Get(), o.Type.IsSet()\n}", "func (o *KanbanViewView) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *ShowSystem) GetTypeOk() (*string, bool) {\n\tif o == nil || IsNil(o.Type) {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *PartialApplicationKey) GetTypeOk() (*ApplicationKeysType, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *Application) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *MaintenanceWindowSchedule) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *ViewProjectBudget) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *VersionedControllerService) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *GetMessagesAllOf) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *VerificationTraits) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *SecretValue) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *DriveItemVersion) GetContentOk() (string, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func (sct *ContentSniffer) ContentType() (string, bool) {\n\tif sct.sniffed {\n\t\treturn sct.ctype, sct.ctype != \"\"\n\t}\n\tsct.sniffed = true\n\t// If ReadAll hits EOF, it returns err==nil.\n\tsct.start, sct.err = ioutil.ReadAll(io.LimitReader(sct.r, sniffBuffSize))\n\n\t// Don't try to detect the content type based on possibly incomplete data.\n\tif sct.err != nil {\n\t\treturn \"\", false\n\t}\n\n\tsct.ctype = http.DetectContentType(sct.start)\n\treturn sct.ctype, true\n}", "func (o *TransactionResult) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *Ga4ghChemotherapy) GetTypeOk() (string, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "func (o *ControllerServiceAPI) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *MicrosoftGraphVerifiedDomain) GetTypeOk() (string, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "func (o *GroupReplaceRequest) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *FormField) GetFieldTypeOk() (*string, bool) {\n\tif o == nil || o.FieldType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FieldType, true\n}", "func (o *FileDto) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *SimpleStringWeb) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *ViewSampleProject) GetContentOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *StorageEnclosure) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *JsonEnvironment) GetContentOk() (*[]string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *IssueJobStatus) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *ApiResponse) GetTypeOk() (string, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "func (o *PlatformImage) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *ApiResponse) GetTypeOk() (*string, bool) {\n\tif o == nil || IsNil(o.Type) {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *SmsTracking) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *StorageRemoteKeySetting) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *WorkflowBuildTaskMeta) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *CheckoutResponse) GetTypeOk() (*string, bool) {\n\tif o == nil || IsNil(o.Type) {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *WidgetMarker) GetDisplayTypeOk() (*string, bool) {\n\tif o == nil || o.DisplayType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayType, true\n}", "func (o *SoftwarerepositoryCategoryMapper) GetFileTypeOk() (*string, bool) {\n\tif o == nil || o.FileType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileType, true\n}", "func (o *FeedbackFeedbackPost) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *SingleSelectFieldField) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *WorkflowBuildTaskMeta) GetWorkflowTypeOk() (*string, bool) {\n\tif o == nil || o.WorkflowType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.WorkflowType, true\n}", "func (o *EmailAction) GetContentTemplateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ContentTemplate, true\n}", "func (o *DeploymentsCondition) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *GetMessagesAllOf) GetContentOk() (*interface{}, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Content, true\n}", "func (o *PairAnyValueAnyValue) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *MetricDefaultAggregation) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *Content) GetContentCategoryOk() (*string, bool) {\n\tif o == nil || o.ContentCategory == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentCategory, true\n}", "func (o *WorkflowCliCommandAllOf) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *EntityId) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *ResourceIdTagsJsonTags) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func HasContentType(r *http.Request, mimetype string) bool {\n\tcontentType := r.Header.Get(\"Content-type\")\n\tif contentType == \"\" {\n\t\treturn mimetype == ContentType.ApplicationOctetStream\n\t}\n\tfor _, v := range strings.Split(contentType, \",\") {\n\t\tt, _, err := mime.ParseMediaType(v)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif t == mimetype {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *MortgageInterestRate) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type.Get(), o.Type.IsSet()\n}", "func (o *PaymentMethodCardRequest) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *CloudVolumeInstanceAttachment) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *InlineResponse200115) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Wireless) GetTypeOk() (string, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "func (o *WorkflowBuildTaskMeta) GetTaskTypeOk() (*string, bool) {\n\tif o == nil || o.TaskType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TaskType, true\n}", "func (o *CredentialsResponseElement) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *Comment) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (o *Invoice) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *Content) GetAccessTypeOk() (*string, bool) {\n\tif o == nil || o.AccessType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AccessType, true\n}", "func (o *Transfer) GetTypeOk() (*TransferType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *Service) GetTypeOk() (string, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "func (o *GetMessagesAllOf) GetContentType() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.ContentType\n}", "func (o *TransactionSplit) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func PossibleContentTypes(firstByte byte) (ct ContentTypeOptions) {\n\tif firstByte == 0 {\n\t\treturn 0\n\t}\n\n\tswitch {\n\tcase firstByte < '\\t' /* 9 */ :\n\t\t// not a text\n\t\tif firstByte&^maskWireType == 0 {\n\t\t\treturn 0\n\t\t}\n\tcase firstByte >= legalUtf8:\n\t\tct |= ContentOptionText\n\tcase firstByte < illegalUtf8FirstByte:\n\t\tct |= ContentOptionText\n\t}\n\n\tswitch WireType(firstByte & maskWireType) {\n\tcase WireVarint:\n\t\tif ct&ContentOptionText == 0 && firstByte >= illegalUtf8FirstByte {\n\t\t\tct |= ContentOptionNotation\n\t\t}\n\t\tct |= ContentOptionMessage\n\tcase WireFixed64, WireBytes, WireFixed32, WireStartGroup:\n\t\tct |= ContentOptionMessage\n\tcase WireEndGroup:\n\t\tif ct&ContentOptionText == 0 {\n\t\t\tct |= ContentOptionNotation\n\t\t}\n\t}\n\treturn ct\n}", "func HasContentType(request *http.Request, mimetype string) bool {\n\tcontentType := request.Header.Get(\"Content-type\")\n\tif contentType == \"\" {\n\t\treturn mimetype == DefaultMimeType\n\t}\n\treturn strings.EqualFold(contentType, mimetype)\n}", "func (o *RuleActionStore) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *WorkflowSolutionActionDefinition) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *WorkflowCustomDataProperty) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *FirmwareHttpServer) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (h *ResponseHeader) ContentType() []byte {\n\tcontentType := h.contentType\n\tif !h.noDefaultContentType && len(h.contentType) == 0 {\n\t\tcontentType = defaultContentType\n\t}\n\treturn contentType\n}", "func (o *GetMessagesAllOf) GetTypeOk() (*interface{}, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *NotificationConfig) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *CalendareventsIdJsonEventReminders) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *GroupWidgetDefinition) GetTypeOk() (*GroupWidgetDefinitionType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *StoragePhysicalDiskExtension) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *SoftwareTechs) GetVerbatimTypeOk() (*string, bool) {\n\tif o == nil || o.VerbatimType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VerbatimType, true\n}", "func (o *WorkflowServiceItemActionInstance) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *DeviceParameterValue) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *StorageHyperFlexStorageContainer) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *Account) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *WorkflowCatalogServiceRequest) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *InstallTemplateJobJob) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (ct ContentType) IsValid() error {\n\tswitch ct {\n\tcase Collection, Credential, DIDResolutionResponse, Metadata, Connection, Key:\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid content type '%s', supported types are %s\", ct,\n\t\t[]ContentType{Collection, Credential, DIDResolutionResponse, Metadata, Connection, Key})\n}", "func (o *InlineResponse20049Post) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UserActionNamingPlaceholderProcessingStep) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "func (o *ConnectorpackUpgradeImpact) GetObjectTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ObjectType, true\n}", "func (o *PaymentMethodCash) GetTypeOk() (*string, bool) {\n\tif o == nil || IsNil(o.Type) {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "func (o *RecurrenceRepetition) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}" ]
[ "0.78817636", "0.7724221", "0.77228767", "0.74312943", "0.6998404", "0.6843948", "0.6809836", "0.6389326", "0.63586456", "0.6267725", "0.62641394", "0.6243983", "0.62135416", "0.6205149", "0.616409", "0.61460066", "0.61456543", "0.61446464", "0.6105975", "0.6096652", "0.6080192", "0.6048211", "0.6045212", "0.6033548", "0.6022732", "0.5970504", "0.5969168", "0.59672695", "0.59648216", "0.595207", "0.59513336", "0.59454477", "0.5939614", "0.5936997", "0.592897", "0.59141016", "0.5912341", "0.59036684", "0.5900601", "0.5898534", "0.58852196", "0.58832324", "0.58820695", "0.58814764", "0.58777016", "0.5872096", "0.587105", "0.58694905", "0.58631825", "0.58598286", "0.585678", "0.58546543", "0.5851663", "0.5849151", "0.5842793", "0.584211", "0.58312285", "0.5831198", "0.5829749", "0.5827369", "0.58237064", "0.58230406", "0.58183026", "0.5812364", "0.5810282", "0.5806866", "0.580535", "0.57987416", "0.5797495", "0.5790115", "0.5786665", "0.5783613", "0.5783535", "0.57809335", "0.57795537", "0.5772809", "0.5766952", "0.57663745", "0.5764587", "0.57520527", "0.5748968", "0.5743062", "0.5717303", "0.5715323", "0.5715304", "0.5713993", "0.5709716", "0.5702039", "0.5700567", "0.5699438", "0.5698138", "0.5692172", "0.5691132", "0.56891984", "0.5687088", "0.5685373", "0.5685043", "0.5670256", "0.5664506", "0.5663539" ]
0.76570076
3
HasContentType returns a boolean if a field has been set.
func (o *MicrosoftGraphWorkbookComment) HasContentType() bool { if o != nil && o.ContentType != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *InlineResponse20049Post) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *GetMessagesAllOf) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphListItem) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *Reply) IsContentTypeSet() bool {\n\treturn len(r.ContType) > 0\n}", "func HasContentType(request *http.Request, mimetype string) bool {\n\tcontentType := request.Header.Get(\"Content-type\")\n\tif contentType == \"\" {\n\t\treturn mimetype == DefaultMimeType\n\t}\n\treturn strings.EqualFold(contentType, mimetype)\n}", "func (dct *DjangoContentType) Exists() bool {\n\treturn dct._exists\n}", "func HasContentType(r *http.Request, mimetype string) bool {\n\tcontentType := r.Header.Get(\"Content-type\")\n\tif contentType == \"\" {\n\t\treturn mimetype == ContentType.ApplicationOctetStream\n\t}\n\tfor _, v := range strings.Split(contentType, \",\") {\n\t\tt, _, err := mime.ParseMediaType(v)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif t == mimetype {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *LastMileAccelerationOptions) HasContentTypes() bool {\n\tif o != nil && o.ContentTypes != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (set *ContentTypeSet) Has(contentType ContentType) bool {\n\tif set == nil {\n\t\treturn false\n\t}\n\tfor _, c := range set.set {\n\t\tif c == contentType {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *FormField) HasFieldType() bool {\n\tif o != nil && o.FieldType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WhatsAppEmailWhatsAppApiContent) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WhatsAppPhoneWhatsAppApiContent) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FileDto) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f ExtensionField) IsSet() bool {\n\treturn f.typ != nil\n}", "func (set *ContentTypeSet) StringHas(mediaType string) bool {\n\tct, _, err := mime.ParseMediaType(mediaType)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn set.Has(ContentType(ct))\n}", "func HasCharset(ft *FieldType) bool {\n\tswitch ft.GetType() {\n\tcase mysql.TypeVarchar, mysql.TypeString, mysql.TypeVarString, mysql.TypeBlob,\n\t\tmysql.TypeTinyBlob, mysql.TypeMediumBlob, mysql.TypeLongBlob:\n\t\treturn !mysql.HasBinaryFlag(ft.flag)\n\tcase mysql.TypeEnum, mysql.TypeSet:\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *ShowSystem) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ctx *Context) IsUpload() bool {\r\n\treturn strings.Contains(ctx.HeaderParam(HeaderContentType), MIMEMultipartForm)\r\n}", "func (o *Content) HasAccessType() bool {\n\tif o != nil && o.AccessType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *JsonEnvironment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasType() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Type\", \"type\"))\n}", "func (o *ViewSampleProject) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SoftwarerepositoryCategoryMapper) HasFileType() bool {\n\tif o != nil && o.FileType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ct ContentType) IsValid() error {\n\tswitch ct {\n\tcase Collection, Credential, DIDDocument, Metadata, Connection:\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid content type '%s', supported types are %s\", ct,\n\t\t[]ContentType{Collection, Credential, DIDDocument, Metadata, Connection})\n}", "func (contentType ContentType) Is(mimeType string) bool {\n\tmediaType, _, err := mime.ParseMediaType(mimeType)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn string(contentType) == mediaType\n}", "func (o *Content) HasInitTimeout() bool {\n\tif o != nil && o.InitTimeout.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DriveItemVersion) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdCounterSimpleContentExtensionType) IsFlow() bool { return me.String() == \"flow\" }", "func (input *Input) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func (ct ContentType) IsValid() error {\n\tswitch ct {\n\tcase Collection, Credential, DIDResolutionResponse, Metadata, Connection, Key:\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid content type '%s', supported types are %s\", ct,\n\t\t[]ContentType{Collection, Credential, DIDResolutionResponse, Metadata, Connection, Key})\n}", "func (o *ViewProjectBudget) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SimpleStringWeb) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSite() bool { return me.String() == \"site\" }", "func (o *PartialApplicationKey) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "func (m CrossOrderCancelReplaceRequest) HasSettlmntTyp() bool {\n\treturn m.Has(tag.SettlmntTyp)\n}", "func (this *SIPMessage) HasContent() bool {\n\treturn this.messageContent != \"\" || this.messageContentBytes != nil\n}", "func (o *UserInvitationResponseData) HasType() bool {\n\treturn o != nil && o.Type != nil\n}", "func (o *EntityId) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghFeature) HasFeatureType() bool {\n\tif o != nil && o.FeatureType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n Name) HasType() bool {\n\t_, s := n.GetLookupAndType()\n\treturn s != \"\"\n}", "func (o *WidgetMarker) HasDisplayType() bool {\n\tif o != nil && o.DisplayType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CatalogEntry) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (input *BeegoInput) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func (o *Content) HasContentCategory() bool {\n\tif o != nil && o.ContentCategory != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Invoice) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotebookMetadata) HasType() bool {\n\tif o != nil && o.Type.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsContentTypeText(contentType string) bool {\n\tfor _, v := range textContentTypes {\n\t\tif strings.Contains(contentType, v) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *SoftwareTechs) HasVerbatimType() bool {\n\tif o != nil && o.VerbatimType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowBuildTaskMeta) HasTaskType() bool {\n\tif o != nil && o.TaskType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (mi Mimes) HasType(typ string) bool {\n\tfor _, d := range mi {\n\t\tif d.Type == typ {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (me TxsdCounterSimpleContentExtensionType) IsHost() bool { return me.String() == \"host\" }", "func (o *GroupReplaceRequest) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ApiResponse) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsHasField(st interface{}, fieldName string) bool {\n\treturn HasField(st, fieldName)\n}", "func (o *Wireless) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageHyperFlexStorageContainer) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphVerifiedDomain) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghChemotherapy) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func ContentTypeIs(typ string, types ...string) RespCondition {\n\ttypes = append(types, typ)\n\treturn RespConditionFunc(func(resp *http.Response, ctx *ProxyCtx) bool {\n\t\tif resp == nil {\n\t\t\treturn false\n\t\t}\n\t\tcontentType := resp.Header.Get(\"Content-Type\")\n\t\tfor _, typ := range types {\n\t\t\tif contentType == typ || strings.HasPrefix(contentType, typ+\";\") {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "func (o *ViewProjectBudget) HasExpenseType() bool {\n\tif o != nil && o.ExpenseType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *GetMessagesAllOf) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ApiResponse) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ControllerServiceAPI) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c ContentType) Is(c1 ContentType) bool {\n\treturn c == c1\n}", "func (o *Service) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ResourceIdTagsJsonTags) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20051TodoItems) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphWorkbookComment) GetContentTypeOk() (string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.ContentType, true\n}", "func (d UserData) HasCompanyType() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CompanyType\", \"company_type\"))\n}", "func (me TxsdCounterSimpleContentExtensionType) IsOrganization() bool {\n\treturn me.String() == \"organization\"\n}", "func (o *SmsTracking) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SharedSecretSet3) HasContentProviderId() bool {\n\tif o != nil && o.ContentProviderId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageEnclosure) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *VersionedControllerService) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CheckoutResponse) HasType() bool {\n\tif o != nil && !IsNil(o.Type) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphVisualInfo) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20049Post) GetContentTypeOk() (*string, bool) {\n\tif o == nil || o.ContentType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ContentType, true\n}", "func IsCloudEventContentType(contentType string) bool {\n\treturn isContentType(contentType, CloudEventContentType)\n}", "func (m NoMDEntries) HasMDEntryType() bool {\n\treturn m.Has(tag.MDEntryType)\n}", "func IsJSONContentType(contentType string) bool {\n\treturn isContentType(contentType, JSONContentType)\n}", "func (o *Content) HasRunAs() bool {\n\tif o != nil && o.RunAs.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasCreatedTime() bool {\n\tif o != nil && o.CreatedTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r FieldType) IsRequired() bool {\n\treturn r == FieldType_Required\n}", "func Test(contentType string) bool {\n\tdbMatched := false\n\n\texts, err := mime.ExtensionsByType(contentType)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tfor _, ext := range exts {\n\t\t// all exts returned by mime.ExtensionsByType are always\n\t\t// start with \".\"\n\t\tif entry, ok := mimedb.DB[ext[1:]]; ok {\n\t\t\tdbMatched = true\n\n\t\t\tif entry.Compressible {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\tif !dbMatched && compressibleTypeRegExp.MatchString(contentType) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool {\n\treturn o != nil && o.Field != nil\n}", "func CheckAuthorizedContentType(h http.Header) error {\n\tct := findContentType(h.Get(\"Content-Type\"), MultipartFormDataContentType)\n\tif ct == \"\" {\n\t\treturn &notAuthorizedContentTypeError{}\n\t}\n\n\treturn nil\n}", "func (me TxsdImpactSimpleContentExtensionType) IsUser() bool { return me.String() == \"user\" }", "func (o *SecretValue) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Post) HasExtensions() bool {\n\tif o != nil && o.Extensions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasGuid() bool {\n\tif o != nil && o.Guid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StoragePhysicalDiskAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowCliCommandAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := r.Form.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (f *Field) HasInternalType() bool {\n\treturn isInternalType(f.Type)\n}", "func (o *GetMessagesAllOf) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Content) HasLoadFactor() bool {\n\tif o != nil && o.LoadFactor.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphEducationUser) HasUserType() bool {\n\tif o != nil && o.UserType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowBuildTaskMeta) HasWorkflowType() bool {\n\tif o != nil && o.WorkflowType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MonitorSearchResult) HasType() bool {\n\tif o != nil && o.Type != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.7573786", "0.7540341", "0.7538529", "0.7398957", "0.7365539", "0.70325786", "0.69804555", "0.67823416", "0.6748523", "0.67033076", "0.66077507", "0.6190773", "0.6122035", "0.61136115", "0.61129403", "0.60410094", "0.59980243", "0.59320676", "0.589925", "0.5887395", "0.58785355", "0.5872963", "0.5854071", "0.5799749", "0.57765484", "0.57663023", "0.5762127", "0.5737611", "0.5728429", "0.571883", "0.5713842", "0.5699633", "0.56973", "0.56928855", "0.56708705", "0.56683624", "0.5642155", "0.5641776", "0.563566", "0.56257284", "0.5617702", "0.56127", "0.55995566", "0.5590543", "0.5581137", "0.55770856", "0.5574944", "0.5571368", "0.5562202", "0.55504215", "0.5543729", "0.5537164", "0.55370253", "0.55352163", "0.553518", "0.5533308", "0.5525017", "0.55189127", "0.5499718", "0.5485345", "0.54852706", "0.5472706", "0.5462974", "0.5461997", "0.54602927", "0.54574335", "0.54562414", "0.54503495", "0.544161", "0.54398626", "0.54289436", "0.5420086", "0.54170257", "0.5412806", "0.5398034", "0.5393775", "0.53898484", "0.5383496", "0.5374148", "0.5367991", "0.53633523", "0.53596145", "0.53560597", "0.53548455", "0.5347898", "0.53390175", "0.5338189", "0.5336776", "0.53297603", "0.5322947", "0.5320018", "0.531552", "0.53128856", "0.53064626", "0.5303886", "0.52870756", "0.5286105", "0.52711225", "0.5268159", "0.52680314" ]
0.72122514
5
SetContentType gets a reference to the given string and assigns it to the ContentType field.
func (o *MicrosoftGraphWorkbookComment) SetContentType(v string) { o.ContentType = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Action) SetContentType(val string) string {\n\tvar ctype string\n\tif strings.ContainsRune(val, '/') {\n\t\tctype = val\n\t} else {\n\t\tif !strings.HasPrefix(val, \".\") {\n\t\t\tval = \".\" + val\n\t\t}\n\t\tctype = mime.TypeByExtension(val)\n\t}\n\tif ctype != \"\" {\n\t\tc.SetHeader(\"Content-Type\", ctype)\n\t}\n\treturn ctype\n}", "func (m *AttachmentItem) SetContentType(value *string)() {\n m.contentType = value\n}", "func (m *ChatMessageAttachment) SetContentType(value *string)() {\n err := m.GetBackingStore().Set(\"contentType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ThreatAssessmentRequest) SetContentType(value *ThreatAssessmentContentType)() {\n m.contentType = value\n}", "func (m *ThreatAssessmentRequest) SetContentType(value *ThreatAssessmentContentType)() {\n err := m.GetBackingStore().Set(\"contentType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *PrinterDefaults) SetContentType(value *string)() {\n err := m.GetBackingStore().Set(\"contentType\", value)\n if err != nil {\n panic(err)\n }\n}", "func (req *Request) SetContentType(val string) {\n\treq.contentType = val\n}", "func (m *WorkbookCommentReply) SetContentType(value *string)() {\n m.contentType = value\n}", "func (me *TContentTypeType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (r *Request) SetContentType() *Request {\n\tif nil != r.err {\n\t\treturn r\n\t}\n\tr.contentTypeFlag = true\n\treturn r\n}", "func SetContentType(contentType ContentType) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tr = r.WithContext(context.WithValue(r.Context(), ContentTypeCtxKey, contentType))\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func (_options *ToneOptions) SetContentType(contentType string) *ToneOptions {\n\t_options.ContentType = core.StringPtr(contentType)\n\treturn _options\n}", "func (ctx *Context) SetContentType(contentType string) {\n\tctx.AddHeader(HeaderContentType, contentType)\n}", "func (h *RequestHeader) SetContentType(contentType string) {\n\th.contentType = append(h.contentType[:0], contentType...)\n}", "func (h *ResponseHeader) SetContentType(contentType string) {\n\th.contentType = append(h.contentType[:0], contentType...)\n}", "func (zr *ZRequest) SetContentType(contentType string) *ZRequest {\n\tif zr.ended {\n\t\treturn zr\n\t}\n\tzr.headers.Set(HdrContentType, contentType)\n\treturn zr\n}", "func (c *Context) SetContentType(contentType string) {\n\tc.RequestCtx.SetContentType(contentType)\n}", "func (o *UpdateWidgetParams) SetContentType(contentType *string) {\n\to.ContentType = contentType\n}", "func (o *PostApplyManifestParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func (gauo *GithubAssetUpdateOne) SetContentType(s string) *GithubAssetUpdateOne {\n\tgauo.mutation.SetContentType(s)\n\treturn gauo\n}", "func (gau *GithubAssetUpdate) SetContentType(s string) *GithubAssetUpdate {\n\tgau.mutation.SetContentType(s)\n\treturn gau\n}", "func (o *CreateWidgetParams) SetContentType(contentType *string) {\n\to.ContentType = contentType\n}", "func (req *Request) SetContentType(ct string) {\n\treq.Req.Header.Set(\"Content-Type\", ct)\n}", "func ContentType(ct string) ChangeOption {\n\treturn changeOption{\n\t\tapplier: applierFunc(\n\t\t\tfunc(caller caller, co interface{}) {\n\t\t\t\tco.(*secret.UpdateSetRequest).ContentType = ct\n\t\t\t},\n\t\t),\n\t}\n}", "func (fc *FileCreate) SetContentType(s string) *FileCreate {\n\tfc.mutation.SetContentType(s)\n\treturn fc\n}", "func (o *CreateScriptParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func SetContentType(contentType string) ResponseFunc {\n\treturn SetResponseHeader(\"Content-Type\", contentType)\n}", "func (ctx *Context) ContentType(val string, unique bool) {\n\tvar ctype string\n\tif strings.ContainsRune(val, '/') {\n\t\tctype = val\n\t} else {\n\t\tif !strings.HasPrefix(val, \".\") {\n\t\t\tval = \".\" + val\n\t\t}\n\t\tctype = mime.TypeByExtension(val)\n\t}\n\tif ctype != \"\" {\n\t\tctx.SetHeader(\"Content-Type\", ctype, unique)\n\t}\n}", "func ContentType(value string) Option {\n\treturn setHeader(\"Content-Type\", value)\n}", "func (o *GetContentSourcesUsingGETParams) SetContentType(contentType *string) {\n\to.ContentType = contentType\n}", "func SetContentTypeParser(contentType string, parser RequestParseFunc) {\n\tif parser != nil {\n\t\tparsers[contentType] = parser\n\t}\n}", "func SetContentTypeHeader(w http.ResponseWriter, header http.Header) {\n\tcontentType := header.Get(ContentTypeHeader)\n\tif mediaType, _, err := mime.ParseMediaType(contentType); err == nil {\n\t\tw.Header().Set(ContentTypeHeader, mediaType)\n\t\treturn\n\t}\n\tw.Header().Set(ContentTypeHeader, DefaultContentType)\n}", "func ContentType(contentType string) Option {\n\treturn Opt(\"content_type\", contentType)\n}", "func ContentType(val string) Option {\n\treturn func(c *Config) {\n\t\tc.ContentType = val\n\t}\n}", "func (o *MarketDataSubscribeMarketDataParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func WithContentType(v string) (p Pair) {\n\treturn Pair{Key: \"content_type\", Value: v}\n}", "func (s *Channel) SetContentType(v string) *Channel {\n\ts.ContentType = &v\n\treturn s\n}", "func SetContentType(w http.ResponseWriter, asset string) {\n\text := filepath.Ext(asset)\n\tswitch ext {\n\tcase \".png\":\n\t\tfallthrough\n\tcase \".gif\":\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"image/%s\", ext))\n\tcase \".woff\":\n\t\tfallthrough\n\tcase \".woff2\":\n\t\tfallthrough\n\tcase \".eot\":\n\t\tfallthrough\n\tcase \".ttf\":\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"font/%s\", ext))\n\tcase \".svg\":\n\t\tw.Header().Set(\"Content-Type\", \"image/svg+xml\")\n\tcase \".css\":\n\t\tw.Header().Set(\"Content-Type\", \"text/css\")\n\tcase \".js\":\n\t\tw.Header().Set(\"Content-Type\", \"text/javascript\")\n\tdefault:\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t}\n}", "func (o *GetAnOrderProductParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func SetContentTypeHeader(w http.ResponseWriter, filePath string) {\n\tw.Header().Set(\n\t\t\"Content-Type\",\n\t\tcontentTypes[strings.ToLower(path.Ext(filePath))],\n\t)\n}", "func (this *Context) ContentType(val string) string {\n\tvar ctype string\n\tif strings.ContainsRune(val, '/') {\n\t\tctype = val\n\t} else {\n\t\tif !strings.HasPrefix(val, \".\") {\n\t\t\tval = \".\" + val\n\t\t}\n\t\tctype = mime.TypeByExtension(val)\n\t}\n\tif ctype != \"\" {\n\t\tthis.Header().Set(\"Content-Type\", ctype)\n\t}\n\treturn ctype\n}", "func (o *GetAOrderStatusParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func (_BaseContent *BaseContentFilterer) FilterSetContentType(opts *bind.FilterOpts) (*BaseContentSetContentTypeIterator, error) {\n\n\tlogs, sub, err := _BaseContent.contract.FilterLogs(opts, \"SetContentType\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BaseContentSetContentTypeIterator{contract: _BaseContent.contract, event: \"SetContentType\", logs: logs, sub: sub}, nil\n}", "func (o *TradingTableSubscribeTradingTableParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func ContentType(ct string) Option {\n\treturn func(o *Options) {\n\t\to.ContentType = ct\n\t}\n}", "func PostContentType(value string) PostOption {\n\treturn setMultipartField(\"Content-Type\", value)\n}", "func (o *TradingTableUnsubscribeTradingTableParams) SetContentType(contentType string) {\n\to.ContentType = contentType\n}", "func setContentType(next http.Handler, contentType string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif _, exists := w.Header()[\"Content-Type\"]; !exists {\n\t\t\tw.Header().Set(\"Content-Type\", contentType)\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func (s *GetProfileOutput) SetContentType(v string) *GetProfileOutput {\n\ts.ContentType = &v\n\treturn s\n}", "func WithContentType(contentType string) Option {\n\treturn func(o *opts) {\n\t\to.contentType = contentType\n\t}\n}", "func (_BaseContent *BaseContentFilterer) WatchSetContentType(opts *bind.WatchOpts, sink chan<- *BaseContentSetContentType) (event.Subscription, error) {\n\n\tlogs, sub, err := _BaseContent.contract.WatchLogs(opts, \"SetContentType\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BaseContentSetContentType)\n\t\t\t\tif err := _BaseContent.contract.UnpackLog(event, \"SetContentType\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "func (s *UtteranceBotResponse) SetContentType(v string) *UtteranceBotResponse {\n\ts.ContentType = &v\n\treturn s\n}", "func (o *InlineResponse20049Post) SetContentType(v string) {\n\to.ContentType = &v\n}", "func (o *InlineResponse200115) SetContentType(v string) {\n\to.ContentType = &v\n}", "func (s *MetricsSource) SetContentType(v string) *MetricsSource {\n\ts.ContentType = &v\n\treturn s\n}", "func (s *ChatMessage) SetContentType(v string) *ChatMessage {\n\ts.ContentType = &v\n\treturn s\n}", "func (s *AutoMLJobChannel) SetContentType(v string) *AutoMLJobChannel {\n\ts.ContentType = &v\n\treturn s\n}", "func ContentType(contentType string) Option {\n\treturn func(router *Router) {\n\t\trouter.ContentType = contentType\n\t}\n}", "func (s *InferenceExperimentDataStorageConfig) SetContentType(v *CaptureContentTypeHeader) *InferenceExperimentDataStorageConfig {\n\ts.ContentType = v\n\treturn s\n}", "func (s *AutoMLChannel) SetContentType(v string) *AutoMLChannel {\n\ts.ContentType = &v\n\treturn s\n}", "func (me *TxsdMimeTypeSequenceType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (_BaseAccessWallet *BaseAccessWalletTransactor) SetContentTypeRights(opts *bind.TransactOpts, obj common.Address, access_type uint8, access uint8) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"setContentTypeRights\", obj, access_type, access)\n}", "func (r *Request) ContentType(contentType string) *Request {\n\tnormalizedKey := textproto.CanonicalMIMEHeaderKey(\"Content-Type\")\n\tr.headers[normalizedKey] = []string{contentType}\n\treturn r\n}", "func (s *TransformInput) SetContentType(v string) *TransformInput {\n\ts.ContentType = &v\n\treturn s\n}", "func AddContentType(extension string, value string) {\n\tif extension[0] != '.' {\n\t\tlog.Fatalln(\"(AddContentType) The first character of an extension have to be '.', but:\", extension)\n\t}\n\n\tcontentTypes[extension] = value\n}", "func (m *sdt) SetType(val string) {\n\n}", "func (o *MicrosoftGraphListItem) SetContentType(v AnyOfmicrosoftGraphContentTypeInfo) {\n\to.ContentType = &v\n}", "func (s *PostAgentProfileInput) SetContentType(v string) *PostAgentProfileInput {\n\ts.ContentType = &v\n\treturn s\n}", "func SetContentType(w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupTransactor) SetContentTypeRights(opts *bind.TransactOpts, obj common.Address, access_type uint8, access uint8) (*types.Transaction, error) {\n\treturn _BaseAccessControlGroup.contract.Transact(opts, \"setContentTypeRights\", obj, access_type, access)\n}", "func (s *SendNotificationActionDefinition) SetContentType(v string) *SendNotificationActionDefinition {\n\ts.ContentType = &v\n\treturn s\n}", "func WithContentType(contentType string) EnforcerOption {\n\treturn func(e *Enforcer) {\n\t\te.contentType = contentType\n\t}\n}", "func (info *Info) SetMimeType(mimeType string) {\n\tinfo.Attributes[\"content-type\"] = mimeType\n}", "func (s *FileSource) SetContentType(v string) *FileSource {\n\ts.ContentType = &v\n\treturn s\n}", "func (c *Ctx) ContentType(extension string, charset ...string) *Ctx {\n\tif len(charset) > 0 {\n\t\tc.Response.Header.SetContentType(GetMIME(extension) + \"; charset=\" + charset[0])\n\t} else {\n\t\tc.Response.Header.SetContentType(GetMIME(extension))\n\t}\n\treturn c\n}", "func ContentTypeFromString(mediaType string) (ContentType, error) {\n\tmediaType, _, err := mime.ParseMediaType(mediaType)\n\treturn ContentType(mediaType), err\n}", "func NewContentTypeSet(types ...string) *ContentTypeSet {\n\tif len(types) == 0 {\n\t\treturn nil\n\t}\n\tset := &ContentTypeSet{\n\t\tset: make([]ContentType, 0, len(types)),\n\t\tpos: -1,\n\t}\nallTypes:\n\tfor _, t := range types {\n\t\tmediaType, _, err := mime.ParseMediaType(t)\n\t\tif err != nil {\n\t\t\t// skip types that can not be parsed\n\t\t\tcontinue\n\t\t}\n\t\t// Let's make sure we have not seen this type before.\n\t\tfor _, tt := range set.set {\n\t\t\tif tt == ContentType(mediaType) {\n\t\t\t\t// Don't add it to the set, already exists\n\t\t\t\tcontinue allTypes\n\t\t\t}\n\t\t}\n\t\tset.set = append(set.set, ContentType(mediaType))\n\t}\n\tif len(set.set) == 0 {\n\t\treturn nil\n\t}\n\treturn set\n}", "func (_AccessIndexor *AccessIndexorTransactor) SetContentTypeRights(opts *bind.TransactOpts, obj common.Address, access_type uint8, access uint8) (*types.Transaction, error) {\n\treturn _AccessIndexor.contract.Transact(opts, \"setContentTypeRights\", obj, access_type, access)\n}", "func (f *Format) SetType(formatType string) {\n\n\tchosenFormat := strings.ToLower(formatType)\n\tswitch chosenFormat {\n\n\tcase \"text\":\n\t\tf.Type = \"text\"\n\tcase \"json\":\n\t\tf.Type = \"json\"\n\n\tdefault:\n\t\tfmt.Println(\"Invalid type used, defaulting to text.\")\n\t\tf.Type = \"text\"\n\t}\n}", "func WithContentType(ct string) UploadOptionFunc {\n\treturn func(w *storage.Writer) { w.ContentType = ct }\n}", "func (o *ExtrasSavedFiltersListParams) SetContentTypeIDLte(contentTypeIDLte *string) {\n\to.ContentTypeIDLte = contentTypeIDLte\n}", "func (i *CreationInfo) SetType(str string) {\n\tC.alt_IResource_CreationInfo_SetType(i.altInfoPtr, C.CString(str))\n\ti.Type = str\n}", "func (m MediaType) ContentType() string {\n\tif len(m.Type) > 0 && m.Charset != \"\" {\n\t\treturn fmt.Sprintf(\"%s; charset=%s\", m.Type, m.Charset)\n\t}\n\treturn m.Type\n}", "func (m *List) SetContentTypes(value []ContentTypeable)() {\n m.contentTypes = value\n}", "func (_BaseContent *BaseContentFilterer) ParseSetContentType(log types.Log) (*BaseContentSetContentType, error) {\n\tevent := new(BaseContentSetContentType)\n\tif err := _BaseContent.contract.UnpackLog(event, \"SetContentType\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (r *Response) ContentType(mediaType string, charset ...string) *Response {\n\topChain := r.chain.enter(\"ContentType()\")\n\tdefer opChain.leave()\n\n\tif opChain.failed() {\n\t\treturn r\n\t}\n\n\tif len(charset) > 1 {\n\t\topChain.fail(AssertionFailure{\n\t\t\tType: AssertUsage,\n\t\t\tErrors: []error{\n\t\t\t\terrors.New(\"unexpected multiple charset arguments\"),\n\t\t\t},\n\t\t})\n\t\treturn r\n\t}\n\n\tr.checkContentType(opChain, mediaType, charset...)\n\n\treturn r\n}", "func (h *RequestHeader) SetContentTypeBytes(contentType []byte) {\n\th.contentType = append(h.contentType[:0], contentType...)\n}", "func (me *TMediaDescType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (h *ResponseHeader) SetContentTypeBytes(contentType []byte) {\n\th.contentType = append(h.contentType[:0], contentType...)\n}", "func (c *Chunk) SetType(typ [4]byte) {\n\tc.typ = make([]byte, 4)\n\tc.typ[0] = typ[0]\n\tc.typ[1] = typ[1]\n\tc.typ[2] = typ[2]\n\tc.typ[3] = typ[3]\n}", "func (_m *AppFunctionContext) SetResponseContentType(_a0 string) {\n\t_m.Called(_a0)\n}", "func SetOfContentTypes(types ...ContentType) *ContentTypeSet {\n\tif len(types) == 0 {\n\t\treturn nil\n\t}\n\tset := &ContentTypeSet{\n\t\tset: make([]ContentType, 0, len(types)),\n\t\tpos: -1,\n\t}\nallTypes:\n\tfor _, t := range types {\n\t\t// Let's make sure we have not seen this type before.\n\t\tfor _, tt := range set.set {\n\t\t\tif tt == t {\n\t\t\t\t// Don't add it to the set, already exists\n\t\t\t\tcontinue allTypes\n\t\t\t}\n\t\t}\n\t\tset.set = append(set.set, t)\n\t}\n\tif len(set.set) == 0 {\n\t\treturn nil\n\t}\n\treturn set\n}", "func (m *RecurrencePattern) SetType(value *RecurrencePatternType)() {\n m.type_escaped = value\n}", "func (o *ExtrasSavedFiltersListParams) SetContentTypeID(contentTypeID *string) {\n\to.ContentTypeID = contentTypeID\n}", "func (b *Block) SetType(typeName string) {\n\tnameTok := newIdentToken(typeName)\n\tnameObj := newIdentifier(nameTok)\n\tb.typeName.ReplaceWith(nameObj)\n}", "func (m *endpoint) SetType(val string) {\n}", "func (me *TURLType) Set(s string) { (*xsdt.AnyURI)(me).Set(s) }", "func ContentType(mimeType mime.Type, additionalParams ...params.Header) (string, string) {\n\tif len(additionalParams) > 0 {\n\t\treturn \"Content-Type\", fmt.Sprintf(\"%v%v\", mimeType, params.Aggregate(additionalParams))\n\t} else {\n\t\treturn \"Content-Type\", string(mimeType)\n\t}\n}", "func (_BaseContent *BaseContentCaller) ContentType(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContent.contract.Call(opts, &out, \"contentType\")\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}", "func (p *Part) ContentType() string {\n\tctype := C.gmime_get_content_type_string(p.gmimePart)\n\tdefer C.g_free(C.gpointer(unsafe.Pointer(ctype)))\n\treturn C.GoString(ctype)\n}" ]
[ "0.78430754", "0.7798161", "0.7772444", "0.77703106", "0.7654774", "0.75559455", "0.752631", "0.744577", "0.7419545", "0.7359129", "0.73229665", "0.7292025", "0.7183151", "0.71086603", "0.7099292", "0.706196", "0.7061862", "0.7051272", "0.69764537", "0.6964467", "0.68886405", "0.687715", "0.68637097", "0.6852571", "0.67979854", "0.67947006", "0.67767745", "0.67603034", "0.6668717", "0.666674", "0.6645329", "0.6644774", "0.65846074", "0.656296", "0.65193635", "0.6519093", "0.6485603", "0.64819866", "0.64624214", "0.6424792", "0.63931054", "0.6389866", "0.6361781", "0.6349092", "0.63403285", "0.6337776", "0.6310985", "0.6268338", "0.62665504", "0.6258687", "0.62177646", "0.6198371", "0.61886466", "0.618581", "0.61835784", "0.6147922", "0.6143307", "0.6132179", "0.60766643", "0.6068994", "0.60235304", "0.60198265", "0.6011961", "0.60095125", "0.6002267", "0.5998561", "0.59971106", "0.599015", "0.5970409", "0.5960367", "0.5914043", "0.5868958", "0.5853163", "0.5849267", "0.582049", "0.58191836", "0.5758056", "0.5750409", "0.5739054", "0.5725602", "0.5725164", "0.57200027", "0.5693567", "0.5689152", "0.56889284", "0.5687957", "0.5676293", "0.5673539", "0.567086", "0.56036586", "0.5600644", "0.5591236", "0.5586142", "0.55282277", "0.5519209", "0.5510111", "0.5494848", "0.5451641", "0.54503185", "0.544512" ]
0.6297317
47
GetReplies returns the Replies field if nonnil, zero value otherwise.
func (o *MicrosoftGraphWorkbookComment) GetReplies() []MicrosoftGraphWorkbookCommentReply { if o == nil || o.Replies == nil { var ret []MicrosoftGraphWorkbookCommentReply return ret } return *o.Replies }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MessageReplies) GetReplies() (value int) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Replies\n}", "func GetReplies(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcommentID := params[\"comment_id\"]\n\n\tif commentID == \"\" {\n\t\tmsg := map[string]string{\"error\": \"comment id required\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\tvar comment comments.Comment\n\n\tcomment.ID = commentID\n\n\terr := comment.GetReplies()\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(comment.Replies)\n\n\treturn\n\n}", "func (e Elem) Replies(raw *tg.Client) *messages.GetRepliesQueryBuilder {\n\treturn messages.NewQueryBuilder(raw).GetReplies(e.Peer)\n}", "func (m *ChatMessage) GetReplies()([]ChatMessageable) {\n return m.replies\n}", "func (r *Result) Replies() []*Reply {\n return r.replies\n}", "func (o *MicrosoftGraphWorkbookComment) SetReplies(v []MicrosoftGraphWorkbookCommentReply) {\n\to.Replies = &v\n}", "func (o *MicrosoftGraphWorkbookComment) GetRepliesOk() ([]MicrosoftGraphWorkbookCommentReply, bool) {\n\tif o == nil || o.Replies == nil {\n\t\tvar ret []MicrosoftGraphWorkbookCommentReply\n\t\treturn ret, false\n\t}\n\treturn *o.Replies, true\n}", "func (m *MessageReplies) GetRepliesPts() (value int) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.RepliesPts\n}", "func GetPredefinedReplies(channelID string, replies *[]api.PredefinedDailyReply) error {\n\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\t// Assume bucket exists and has keys\n\t\tb := tx.Bucket([]byte(\"predefinedreplies\"))\n\t\tif b == nil {\n\t\t\treturn fmt.Errorf(\"dbutils: bucket predefinedreplies not created\")\n\t\t}\n\n\t\td := b.Cursor()\n\t\tvar reply api.PredefinedDailyReply\n\n\t\tfor k, v := d.First(); k != nil; k, v = d.Next() {\n\n\t\t\tbuf := *bytes.NewBuffer(v)\n\t\t\tdec := gob.NewDecoder(&buf)\n\t\t\tdec.Decode(&reply)\n\t\t\tif reply.ChannelID == channelID {\n\t\t\t\t*replies = append(*replies, reply)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn err\n}", "func (repo *commentRepository) GetReplies(commentID int, by string, order string, limit, offset int) ([]*comment.Comment, error) {\n\tresult, err := (*repo.secondaryRepo).GetReplies(commentID, by, order, limit, offset)\n\tif err == nil {\n\t\tfor _, c := range result {\n\t\t\trepo.cache[c.ID] = *c\n\t\t}\n\t}\n\treturn result, err\n}", "func NewGetRepliesParams() *GetRepliesParams {\n\treturn &GetRepliesParams{}\n}", "func (m *MailTips) GetAutomaticReplies()(AutomaticRepliesMailTipsable) {\n val, err := m.GetBackingStore().Get(\"automaticReplies\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(AutomaticRepliesMailTipsable)\n }\n return nil\n}", "func NewGetRepliesIDOK() *GetRepliesIDOK {\n\treturn &GetRepliesIDOK{}\n}", "func (r *helloProtoResolver) Replies(ctx context.Context, obj *hello_pb.Hello) ([]*hello_pb.Hello, error) {\n\tpanic(\"not implemented\")\n}", "func NewGetRepliesIDNotFound() *GetRepliesIDNotFound {\n\treturn &GetRepliesIDNotFound{}\n}", "func (m *MessageReplies) GetComments() (value bool) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Flags.Has(0)\n}", "func (o *MicrosoftGraphWorkbookComment) HasReplies() bool {\n\tif o != nil && o.Replies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "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}", "func (d *Dao) Replies(c context.Context, oids []int64, rpIds []int64) (rpMap map[int64]*model.Reply, err error) {\n\thitMap := make(map[int64][]int64)\n\tfor i, oid := range oids {\n\t\thitMap[hit(oid)] = append(hitMap[hit(oid)], rpIds[i])\n\t}\n\trpMap = make(map[int64]*model.Reply, len(rpIds))\n\tfor hit, ids := range hitMap {\n\t\tvar rows *xsql.Rows\n\t\trows, err = d.db.Query(c, fmt.Sprintf(_selRepliesSQL, hit, xstr.JoinInts(ids)))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor rows.Next() {\n\t\t\tr := &model.Reply{}\n\t\t\tif err = rows.Scan(&r.ID, &r.Oid, &r.Type, &r.Mid, &r.Root, &r.Parent, &r.Dialog, &r.Count, &r.RCount, &r.Like, &r.Floor, &r.State, &r.Attr, &r.CTime, &r.MTime); err != nil {\n\t\t\t\trows.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t\trpMap[r.ID] = r\n\t\t}\n\t\tif err = rows.Err(); err != nil {\n\t\t\trows.Close()\n\t\t\treturn\n\t\t}\n\t\trows.Close()\n\t}\n\treturn\n}", "func (m *MessageReplies) GetRecentRepliers() (value []PeerClass, ok bool) {\n\tif m == nil {\n\t\treturn\n\t}\n\tif !m.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn m.RecentRepliers, true\n}", "func (o *BalanceResponse) GetRetained() []BalanceCommonField {\n\tif o == nil || IsNil(o.Retained) {\n\t\tvar ret []BalanceCommonField\n\t\treturn ret\n\t}\n\treturn o.Retained\n}", "func NewGetRepliesIDUnauthorized() *GetRepliesIDUnauthorized {\n\treturn &GetRepliesIDUnauthorized{}\n}", "func (m *ChatMessage) SetReplies(value []ChatMessageable)() {\n m.replies = value\n}", "func (_m *ReceiptStore) GetReceipts(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\t_m.Called(res, req, params)\n}", "func (client *ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsGetOptions) (ReplicationResponse, error) {\n\treq, err := client.getCreateRequest(ctx, resourceGroupName, registryName, replicationName, options)\n\tif err != nil {\n\t\treturn ReplicationResponse{}, err\n\t}\n\tresp, err := client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\treturn ReplicationResponse{}, err\n\t}\n\tif !resp.HasStatusCode(http.StatusOK) {\n\t\treturn ReplicationResponse{}, client.getHandleError(resp)\n\t}\n\treturn client.getHandleResponse(resp)\n}", "func (db *DB) GetReplicatedPulse(ctx context.Context) (core.PulseNumber, error) {\n\tbuf, err := db.get(ctx, prefixkey(scopeIDSystem, []byte{sysReplicatedPulse}))\n\tif err != nil {\n\t\tif err == ErrNotFound {\n\t\t\terr = nil\n\t\t}\n\t\treturn 0, err\n\t}\n\treturn core.NewPulseNumber(buf), nil\n}", "func (o AtlasMapSpecPtrOutput) Replicas() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *AtlasMapSpec) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Replicas\n\t}).(pulumi.IntPtrOutput)\n}", "func (db *DB) GetReplicatedPulse(ctx context.Context, jet core.RecordID) (core.PulseNumber, error) {\n\tk := prefixkey(scopeIDSystem, jet[:], []byte{sysReplicatedPulse})\n\tbuf, err := db.get(ctx, k)\n\tif err != nil {\n\t\tif err == ErrNotFound {\n\t\t\terr = nil\n\t\t}\n\t\treturn 0, err\n\t}\n\treturn core.NewPulseNumber(buf), nil\n}", "func NewGetRepliesIDForbidden() *GetRepliesIDForbidden {\n\treturn &GetRepliesIDForbidden{}\n}", "func (a *Client) GetReceipts(params *GetReceiptsParams, authInfo runtime.ClientAuthInfoWriter) (*GetReceiptsOK, *GetReceiptsNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetReceiptsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getReceipts\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/accounts/{koronaAccountId}/receipts\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetReceiptsReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *GetReceiptsOK:\n\t\treturn value, nil, nil\n\tcase *GetReceiptsNoContent:\n\t\treturn nil, value, nil\n\t}\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 receipts: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (_m *Pipeline_mgr_iface) AllReplications() []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\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]string)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (o ApplicationSpecRolloutplanRolloutbatchesOutput) Replicas() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ApplicationSpecRolloutplanRolloutbatches) interface{} { return v.Replicas }).(pulumi.AnyOutput)\n}", "func (prf *proof) getResponses(pr []abstract.Scalar, r []abstract.Scalar) error {\n\tif pr == nil {\n\t\tfor i := range r {\n\t\t\tif r[i] != nil {\n\t\t\t\tif e := prf.vc.Get(r[i]); e != nil {\n\t\t\t\t\treturn e\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Server) GetRipped(ctx context.Context, req *pbcdp.GetRippedRequest) (*pbcdp.GetRippedResponse, error) {\n\treturn &pbcdp.GetRippedResponse{Ripped: s.rips}, nil\n}", "func (c *CommentMetaData) LoadReplies(u *User) error {\n\tvar replies CommentList\n\tif _, err := Comments().Filter(\"replyto\", c.Id).RelatedSel(\"user\").OrderBy(\"date\").All(&replies); err != nil {\n\t\treturn err\n\t}\n\tif err := c.ReadVoteData(u); err != nil {\n\t\tbeego.Error(err)\n\t}\n\tc.Replies = *replies.ToMetaData()\n\t// load replies recursively\n\tfor i := range c.Replies {\n\t\tif err := c.Replies[i].LoadReplies(u); err != nil {\n\t\t\tbeego.Error(err)\n\t\t}\n\t}\n\treturn nil\n}", "func (_m *MockHistoryEngine) GetReplicationMessages(ctx context.Context, taskID int64) (*replicator.ReplicationMessages, error) {\n\tret := _m.Called(ctx, taskID)\n\n\tvar r0 *replicator.ReplicationMessages\n\tif rf, ok := ret.Get(0).(func(int64) *replicator.ReplicationMessages); ok {\n\t\tr0 = rf(taskID)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*replicator.ReplicationMessages)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(int64) error); ok {\n\t\tr1 = rf(taskID)\n\t} else {\n\t\tr1 = ret.Error(0)\n\t}\n\n\treturn r0, r1\n}", "func (o VirtualDatabaseSpecPtrOutput) Replicas() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpec) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Replicas\n\t}).(pulumi.IntPtrOutput)\n}", "func Replies(r chan inter.ConnectorMessage) RequestOption {\n\treturn func(o *RequestOptions) {\n\t\to.Replies = r\n\t\to.ProcessReplies = false\n\t}\n}", "func (c *ControlPlaneContract) Replicas() *ControlPlaneReplicas {\n\treturn &ControlPlaneReplicas{}\n}", "func (o *GetMessagesAllOf) GetReactions() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Reactions\n}", "func (m Message) GetRepurchaseTerm(f *field.RepurchaseTermField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseTerm(f *field.RepurchaseTermField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseTerm(f *field.RepurchaseTermField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseTerm(f *field.RepurchaseTermField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func GetRps(ctx *pulumi.Context) int {\n\tv, err := config.TryInt(ctx, \"cloudflare:rps\")\n\tif err == nil {\n\t\treturn v\n\t}\n\tvar value int\n\tif d := internal.GetEnvOrDefault(4, internal.ParseEnvInt, \"CLOUDFLARE_RPS\"); d != nil {\n\t\tvalue = d.(int)\n\t}\n\treturn value\n}", "func (o *ViewProjectBudget) GetRepeatsRemaining() int32 {\n\tif o == nil || o.RepeatsRemaining == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.RepeatsRemaining\n}", "func (r *CompanyAgedAccountsReceivableCollectionRequest) Get(ctx context.Context) ([]AgedAccountsReceivable, error) {\n\treturn r.GetN(ctx, 0)\n}", "func NewGetRepliesIDBadRequest() *GetRepliesIDBadRequest {\n\treturn &GetRepliesIDBadRequest{}\n}", "func (_m *MockBackend) GetReceipts(ctx context.Context, blockNr uint64) types.Receipts {\n\tret := _m.Called(ctx, blockNr)\n\n\tvar r0 types.Receipts\n\tif rf, ok := ret.Get(0).(func(context.Context, uint64) types.Receipts); ok {\n\t\tr0 = rf(ctx, blockNr)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(types.Receipts)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (i *Issue) GetReactions() *Reactions {\n\tif i == nil {\n\t\treturn nil\n\t}\n\treturn i.Reactions\n}", "func (c *client) GetRetryMsgs(ctx context.Context, r *WorkerGetRetryMsgsRequest) (*WorkerGetRetryMsgsReply, error) {\n\treq, err := c.prepareRequest(http.MethodPost, \"/api/v1/worker/messages/retry\", r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error in preparing request\")\n\t}\n\n\tstatus, resp, err := c.do(ctx, req, defaultHeaders)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error in doing request\")\n\t}\n\n\tswitch status {\n\tcase http.StatusNotFound:\n\t\treturn nil, ErrJobNotFound{errors.New(\"job not found\")}\n\tcase http.StatusServiceUnavailable:\n\t\treturn nil, ErrServiceUnavailable{errors.New(\"service unavailable\")}\n\tcase http.StatusOK:\n\t\trep := new(WorkerGetRetryMsgsReply)\n\t\terr := json.Unmarshal(resp, rep)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to unmarshall response\")\n\t\t}\n\t\treturn rep, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"bad response code: %v\", status)\n\t}\n}", "func (s *sponsor) GetReputation() int {\n\treturn s.reputation.GetAmount()\n}", "func (m Message) GetRepurchaseRate(f *field.RepurchaseRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseRate(f *field.RepurchaseRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseRate(f *field.RepurchaseRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m Message) GetRepurchaseRate(f *field.RepurchaseRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesChatMessageItemRequestBuilder) Replies()(*TeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesItemRepliesRequestBuilder) {\n return NewTeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesItemRepliesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (o *InlineResponse200115) GetReactions() InlineResponse2008Reactions {\n\tif o == nil || o.Reactions == nil {\n\t\tvar ret InlineResponse2008Reactions\n\t\treturn ret\n\t}\n\treturn *o.Reactions\n}", "func (o *GetRepliesParams) WithStartup(startup bool) *GetRepliesParams {\n\to.Startup = startup\n\treturn o\n}", "func (t ThriftHandler) GetReplicationMessages(ctx context.Context, request *replicator.GetReplicationMessagesRequest) (response *replicator.GetReplicationMessagesResponse, err error) {\n\tresponse, err = t.h.GetReplicationMessages(ctx, request)\n\treturn response, thrift.FromError(err)\n}", "func (_e *MockQueryCoord_Expecter) GetReplicas(ctx interface{}, req interface{}) *MockQueryCoord_GetReplicas_Call {\n\treturn &MockQueryCoord_GetReplicas_Call{Call: _e.mock.On(\"GetReplicas\", ctx, req)}\n}", "func (o QperfSpecServerConfigurationResourcesPtrOutput) Limits() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *QperfSpecServerConfigurationResources) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Limits\n\t}).(pulumi.StringMapOutput)\n}", "func (s *Service) repliesMap(c context.Context, oid int64, tp int8, rpIDs []int64) (res map[int64]*model.Reply, err error) {\n\tif len(rpIDs) == 0 {\n\t\treturn\n\t}\n\tres, missIDs, err := s.dao.Mc.GetMultiReply(c, rpIDs)\n\tif err != nil {\n\t\tlog.Error(\"s.dao.Mc.GetMultiReply(%d,%d,%d) error(%v)\", oid, tp, rpIDs, err)\n\t\terr = nil\n\t\tres = make(map[int64]*model.Reply, len(rpIDs))\n\t\tmissIDs = rpIDs\n\t}\n\tif len(missIDs) > 0 {\n\t\tvar (\n\t\t\tmrp map[int64]*model.Reply\n\t\t\tmrc map[int64]*model.Content\n\t\t)\n\t\tif mrp, err = s.dao.Reply.GetByIds(c, oid, tp, missIDs); err != nil {\n\t\t\tlog.Error(\"s.reply.GetByIds(%d,%d,%d) error(%v)\", oid, tp, rpIDs, err)\n\t\t\treturn\n\t\t}\n\t\tif mrc, err = s.dao.Content.GetByIds(c, oid, missIDs); err != nil {\n\t\t\tlog.Error(\"s.content.GetByIds(%d,%d) error(%v)\", oid, rpIDs, err)\n\t\t\treturn\n\t\t}\n\t\trs := make([]*model.Reply, 0, len(missIDs))\n\t\tfor _, rpID := range missIDs {\n\t\t\tif rp, ok := mrp[rpID]; ok {\n\t\t\t\trp.Content = mrc[rpID]\n\t\t\t\tres[rpID] = rp\n\t\t\t\trs = append(rs, rp.Clone())\n\t\t\t}\n\t\t}\n\t\t// asynchronized add reply cache\n\t\tselect {\n\t\tcase s.replyChan <- replyChan{rps: rs}:\n\t\tdefault:\n\t\t\tlog.Warn(\"s.replyChan is full\")\n\t\t}\n\t}\n\treturn\n}", "func (s *Service) JumpReplies(c context.Context, mid, oid, rpID int64, tp int8, ps, sndPs int, escape bool) (roots, hots []*model.Reply, topAdmin, topUpper *model.Reply, sub *model.Subject, pn, sndPn, total int, err error) {\n\tvar (\n\t\trootPos, sndPos int\n\t\trootRp, rp *model.Reply\n\t\tfixedSeconds []*model.Reply\n\t)\n\tif !model.LegalSubjectType(tp) {\n\t\terr = ecode.ReplyIllegalSubType\n\t\treturn\n\t}\n\tif sub, err = s.Subject(c, oid, tp); err != nil {\n\t\treturn\n\t}\n\tif rp, err = s.ReplyContent(c, oid, rpID, tp); err != nil {\n\t\treturn\n\t}\n\tif rp.Root == 0 && rp.Parent == 0 {\n\t\trootPos = s.getReplyPos(c, sub, rp)\n\t} else {\n\t\tif rootRp, err = s.ReplyContent(c, oid, rp.Root, tp); err != nil {\n\t\t\treturn\n\t\t}\n\t\trootPos = s.getReplyPos(c, sub, rootRp)\n\t\tsndPos = s.getReplyPosByRoot(c, rootRp, rp)\n\t}\n\t// root page number\n\tpn = (rootPos-1)/ps + 1\n\t// second page number\n\tif sndPos > sndPs {\n\t\tsndPn = (sndPos-1)/sndPs + 1\n\t} else {\n\t\tsndPn = 1\n\t}\n\t// get reply content\n\troots, seconds, total, err := s.rootReplies(c, sub, mid, model.SortByFloor, pn, ps, 1, sndPs)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rootRp != nil && rootRp.RCount > 0 {\n\t\tif fixedSeconds, err = s.repliesByRoot(c, oid, rootRp.RpID, tp, sndPn, sndPs); err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, rp := range roots {\n\t\t\tif rp.RpID == rootRp.RpID {\n\t\t\t\trp.Replies = fixedSeconds\n\t\t\t}\n\t\t}\n\t}\n\t// top and hots\n\ttopAdmin, topUpper, hots, hseconds, err := s.topAndHots(c, sub, mid, true, true)\n\tif err != nil {\n\t\tlog.Error(\"s.topAndHots(%d,%d,%d) error(%v)\", oid, tp, mid, err)\n\t\terr = nil // degrade\n\t}\n\trs := make([]*model.Reply, 0, len(roots)+len(seconds)+len(hseconds)+len(fixedSeconds)+2)\n\trs = append(rs, roots...)\n\trs = append(rs, seconds...)\n\trs = append(rs, hseconds...)\n\trs = append(rs, hots...)\n\trs = append(rs, fixedSeconds...)\n\tif topAdmin != nil {\n\t\trs = append(rs, topAdmin)\n\t}\n\tif topUpper != nil {\n\t\trs = append(rs, topUpper)\n\t}\n\tif err = s.buildReply(c, sub, rs, mid, escape); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r *AccessReviewReviewersCollectionRequest) Get(ctx context.Context) ([]AccessReviewReviewer, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil)\n}", "func (r *RepositoryComment) GetReactions() *Reactions {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.Reactions\n}", "func (*MessageReplies) TypeName() string {\n\treturn \"messageReplies\"\n}", "func (o *ControllersUpdateStorageOptionsTemplateRequest) GetRepl() int32 {\n\tif o == nil || o.Repl == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Repl\n}", "func (r *CompanyDimensionsCollectionRequest) Get(ctx context.Context) ([]Dimension, error) {\n\treturn r.GetN(ctx, 0)\n}", "func (s *Service) RootReplies(c context.Context, params *model.PageParams) (page *model.PageResult, err error) {\n\tif !model.LegalSubjectType(params.Type) {\n\t\terr = ecode.ReplyIllegalSubType\n\t\treturn\n\t}\n\tsub, err := s.Subject(c, params.Oid, params.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\ttopAdmin, topUpper, hots, hseconds, err := s.topAndHots(c, sub, params.Mid, params.NeedHot, params.NeedSecond)\n\tif err != nil {\n\t\tlog.Error(\"s.topAndHots(%+v) error(%v)\", params, err)\n\t\terr = nil // degrade\n\t}\n\troots, seconds, total, err := s.rootReplies(c, sub, params.Mid, params.Sort, params.PageNum, params.PageSize, 1, s.sndDefCnt)\n\tif err != nil {\n\t\treturn\n\t}\n\trs := make([]*model.Reply, 0, len(roots)+len(hots)+len(hseconds)+len(seconds)+2)\n\trs = append(rs, hots...)\n\trs = append(rs, roots...)\n\trs = append(rs, hseconds...)\n\trs = append(rs, seconds...)\n\tif topAdmin != nil {\n\t\trs = append(rs, topAdmin)\n\t}\n\tif topUpper != nil {\n\t\trs = append(rs, topUpper)\n\t}\n\tif err = s.buildReply(c, sub, rs, params.Mid, params.Escape); err != nil {\n\t\treturn\n\t}\n\tpage = &model.PageResult{\n\t\tSubject: sub,\n\t\tTopAdmin: topAdmin,\n\t\tTopUpper: topUpper,\n\t\tHots: hots,\n\t\tRoots: roots,\n\t\tTotal: total,\n\t\tAllCount: sub.ACount,\n\t}\n\treturn\n}", "func (o AtlasMapSpecOutput) Replicas() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v AtlasMapSpec) *int { return v.Replicas }).(pulumi.IntPtrOutput)\n}", "func (o *GetRepliesParams) WithOnlyaccepted(onlyaccepted bool) *GetRepliesParams {\n\to.Onlyaccepted = onlyaccepted\n\treturn o\n}", "func (ctx *TestCtx) MockReplies(dataList []*HandleReplies) {\n\tvar sendControlPing bool\n\n\tctx.MockVpp.MockReplyHandler(func(request mock.MessageDTO) (reply []byte, msgID uint16, prepared bool) {\n\t\t// Following types are not automatically stored in mock adapter's map and will be sent with empty MsgName\n\t\t// TODO: initialize mock adapter's map with these\n\t\tswitch request.MsgID {\n\t\tcase 100:\n\t\t\trequest.MsgName = \"control_ping\"\n\t\tcase 101:\n\t\t\trequest.MsgName = \"control_ping_reply\"\n\t\tcase 200:\n\t\t\trequest.MsgName = \"sw_interface_dump\"\n\t\tcase 201:\n\t\t\trequest.MsgName = \"sw_interface_details\"\n\t\t}\n\n\t\tif request.MsgName == \"\" {\n\t\t\tlog.DefaultLogger().Fatalf(\"mockHandler received request (ID: %v) with empty MsgName, check if compatibility check is done before using this request\", request.MsgID)\n\t\t}\n\n\t\tif sendControlPing {\n\t\t\tsendControlPing = false\n\t\t\tdata := ctx.PingReplyMsg\n\t\t\treply, err := ctx.MockVpp.ReplyBytes(request, data)\n\t\t\tExpect(err).To(BeNil())\n\t\t\tmsgID, err := ctx.MockVpp.GetMsgID(data.GetMessageName(), data.GetCrcString())\n\t\t\tExpect(err).To(BeNil())\n\t\t\treturn reply, msgID, true\n\t\t}\n\n\t\tfor _, dataMock := range dataList {\n\t\t\tif request.MsgName == dataMock.Name {\n\t\t\t\t// Send control ping next iteration if set\n\t\t\t\tsendControlPing = dataMock.Ping\n\t\t\t\tif len(dataMock.Messages) > 0 {\n\t\t\t\t\tlog.DefaultLogger().Infof(\" MOCK HANDLER: mocking %d messages\", len(dataMock.Messages))\n\t\t\t\t\tctx.MockVpp.MockReply(dataMock.Messages...)\n\t\t\t\t\treturn nil, 0, false\n\t\t\t\t}\n\t\t\t\tif dataMock.Message == nil {\n\t\t\t\t\treturn nil, 0, false\n\t\t\t\t}\n\t\t\t\tmsgID, err := ctx.MockVpp.GetMsgID(dataMock.Message.GetMessageName(), dataMock.Message.GetCrcString())\n\t\t\t\tExpect(err).To(BeNil())\n\t\t\t\treply, err := ctx.MockVpp.ReplyBytes(request, dataMock.Message)\n\t\t\t\tExpect(err).To(BeNil())\n\t\t\t\treturn reply, msgID, true\n\t\t\t}\n\t\t}\n\n\t\tif strings.HasSuffix(request.MsgName, \"_dump\") {\n\t\t\tsendControlPing = true\n\t\t\treturn nil, 0, false\n\t\t}\n\n\t\tvar err error\n\t\treplyMsg, id, ok := ctx.MockVpp.ReplyFor(\"\", request.MsgName)\n\t\tif ok {\n\t\t\treply, err = ctx.MockVpp.ReplyBytes(request, replyMsg)\n\t\t\tExpect(err).To(BeNil())\n\t\t\tmsgID = id\n\t\t\tprepared = true\n\t\t} else {\n\t\t\tlog.DefaultLogger().Warnf(\"NO REPLY FOR %v FOUND\", request.MsgName)\n\t\t}\n\n\t\treturn reply, msgID, prepared\n\t})\n}", "func (_m *MockQueryCoord) GetReplicas(ctx context.Context, req *milvuspb.GetReplicasRequest) (*milvuspb.GetReplicasResponse, error) {\n\tret := _m.Called(ctx, req)\n\n\tvar r0 *milvuspb.GetReplicasResponse\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetReplicasRequest) (*milvuspb.GetReplicasResponse, error)); ok {\n\t\treturn rf(ctx, req)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetReplicasRequest) *milvuspb.GetReplicasResponse); ok {\n\t\tr0 = rf(ctx, req)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*milvuspb.GetReplicasResponse)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetReplicasRequest) error); ok {\n\t\tr1 = rf(ctx, req)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (r *PolicyAppliesToCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {\n\treturn r.GetN(ctx, 0)\n}", "func (p *PullRequestComment) GetReactions() *Reactions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Reactions\n}", "func (m SecurityListRequest) GetRepurchaseTerm() (v int, err quickfix.MessageRejectError) {\n\tvar f field.RepurchaseTermField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (c *ReviewClient) Get(ctx context.Context, id int32) (*Review, error) {\n\treturn c.Query().Where(review.ID(id)).Only(ctx)\n}", "func (m Message) GetNoLegs(f *field.NoLegsField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "func (o QperfSpecClientConfigurationResourcesPtrOutput) Limits() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *QperfSpecClientConfigurationResources) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Limits\n\t}).(pulumi.StringMapOutput)\n}", "func (o GoogleCloudRetailV2alphaProductResponseOutput) RetrievableFields() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaProductResponse) string { return v.RetrievableFields }).(pulumi.StringOutput)\n}", "func (r *ControlPlaneReplicas) Get(obj *unstructured.Unstructured) (*int64, error) {\n\tvalue, ok, err := unstructured.NestedInt64(obj.UnstructuredContent(), r.Path()...)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to retrieve control plane replicas\")\n\t}\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"%s not found\", \".\"+strings.Join(r.Path(), \".\"))\n\t}\n\treturn &value, nil\n}", "func (t *Thread) replies(DB *gorm.DB) { DB.Debug().Model(&t).Related(&t.Replies) }", "func (fp *BatchGetLimitPoolsResponse_FieldTerminalPath) Get(source *BatchGetLimitPoolsResponse) (values []interface{}) {\n\tif source != nil {\n\t\tswitch fp.selector {\n\t\tcase BatchGetLimitPoolsResponse_FieldPathSelectorLimitPools:\n\t\t\tfor _, value := range source.GetLimitPools() {\n\t\t\t\tvalues = append(values, value)\n\t\t\t}\n\t\tcase BatchGetLimitPoolsResponse_FieldPathSelectorMissing:\n\t\t\tfor _, value := range source.GetMissing() {\n\t\t\t\tvalues = append(values, value)\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetLimitPoolsResponse: %d\", fp.selector))\n\t\t}\n\t}\n\treturn\n}", "func GetRepos(params reposapi.GetReposParams) middleware.Responder {\n\t/*\n\t\treposCollection, err := data.GetRepos()\n\t\tif err != nil {\n\t\t\tlog.Error(\"unable to get Repos collection: \", err)\n\t\t\treturn reposapi.NewGetAllReposDefault(http.StatusInternalServerError).WithPayload(internalServerErrorPayload())\n\t\t}\n\t\tvar repos []*data.Repo\n\t\treposCollection.FindAll(&repos)\n\t\tresources := helpers.MakeRepoResources(repos)\n\n\t\tpayload := handlers.DataResourcesBody(resources)\n\t\treturn reposapi.NewGetAllReposOK().WithPayload(payload)\n\t*/\n\treturn middleware.NotImplemented(\"operation handlers.repos.GetRepos has not yet been implemented\")\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *ProxyConfig) GetResources() *Resources {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (s *Service) SecondReplies(c context.Context, mid, oid, rootID, jumpID int64, tp int8, pn, ps int, escape bool) (seconds []*model.Reply, root *model.Reply, upMid int64, toPn int, err error) {\n\tvar (\n\t\tok bool\n\t\tsub *model.Subject\n\t\tjump *model.Reply\n\t)\n\tif !model.LegalSubjectType(tp) {\n\t\terr = ecode.ReplyIllegalSubType\n\t\treturn\n\t}\n\tif sub, err = s.Subject(c, oid, tp); err != nil {\n\t\treturn\n\t}\n\t// jump to the child reply page list\n\tif jumpID > 0 {\n\t\tif jump, err = s.ReplyContent(c, oid, jumpID, tp); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif jump.Root == 0 {\n\t\t\troot = jump\n\t\t\tpn = 1\n\t\t} else {\n\t\t\tif root, err = s.ReplyContent(c, oid, jump.Root, tp); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif pos := s.getReplyPosByRoot(c, root, jump); pos > ps {\n\t\t\t\tpn = (pos-1)/ps + 1\n\t\t\t} else {\n\t\t\t\tpn = 1\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif root, err = s.ReplyContent(c, oid, rootID, tp); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif root.Root != 0 {\n\t\t\tif root, err = s.ReplyContent(c, oid, root.Root, tp); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tif root.IsDeleted() {\n\t\terr = ecode.ReplyDeleted\n\t\treturn\n\t}\n\tupMid = sub.Mid\n\ttoPn = pn\n\t// get reply second reply content\n\trootMap := make(map[int64]*model.Reply, 1)\n\trootMap[root.RpID] = root\n\tsecondMap, _, _ := s.secondReplies(c, sub, rootMap, mid, pn, ps)\n\tif seconds, ok = secondMap[root.RpID]; !ok {\n\t\tseconds = _emptyReplies\n\t}\n\t// get reply dependency info\n\trs := make([]*model.Reply, 0, len(seconds)+1)\n\trs = append(rs, root)\n\trs = append(rs, seconds...)\n\tif err = s.buildReply(c, sub, rs, mid, escape); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r Receipts) Len() int { return len(r) }", "func (n *resPool) GetSlackDemand() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.slackDemand\n}", "func (o ArgoCDSpecRepoResourcesPtrOutput) Limits() ArgoCDSpecRepoResourcesLimitsMapOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpecRepoResources) map[string]ArgoCDSpecRepoResourcesLimits {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Limits\n\t}).(ArgoCDSpecRepoResourcesLimitsMapOutput)\n}", "func (f *IpsecClient) GetRemotes() (*SdewanIpsecRemotes, error) {\n\tvar response string\n\tvar err error\n\tresponse, err = f.OpenwrtClient.Get(ipsecBaseURL + \"remotes\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar sdewanIpsecRemotes SdewanIpsecRemotes\n\terr = json.Unmarshal([]byte(response), &sdewanIpsecRemotes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &sdewanIpsecRemotes, nil\n}", "func (c *Client) GetRPS() int32 {\n\treturn atomic.LoadInt32(&c.rps)\n}" ]
[ "0.769033", "0.68471485", "0.6440696", "0.63884795", "0.6322101", "0.63199073", "0.60624564", "0.5966768", "0.5865303", "0.5838394", "0.5683662", "0.5631738", "0.54620546", "0.53774023", "0.5307289", "0.52935123", "0.5277589", "0.52607006", "0.52401686", "0.49955958", "0.49627483", "0.4890006", "0.48770612", "0.48642114", "0.4828215", "0.4826953", "0.4815661", "0.4806204", "0.4786606", "0.46790013", "0.46662268", "0.46539527", "0.46414545", "0.46413112", "0.46236163", "0.45984876", "0.45936522", "0.45760015", "0.4538889", "0.45321432", "0.45191675", "0.45191675", "0.45191675", "0.45191675", "0.4515078", "0.4515033", "0.45122626", "0.45059142", "0.45054385", "0.4470075", "0.44677633", "0.44613424", "0.4458094", "0.4458094", "0.4458094", "0.4458094", "0.4439013", "0.44371584", "0.44308394", "0.44281414", "0.44105113", "0.44022477", "0.44015047", "0.4379791", "0.43731022", "0.4366053", "0.4354071", "0.4350709", "0.4345824", "0.43446013", "0.43356794", "0.43298405", "0.43248218", "0.43247327", "0.43243146", "0.4321616", "0.43166944", "0.43144053", "0.43069676", "0.43049806", "0.4292566", "0.42879218", "0.42830843", "0.42731258", "0.42658803", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42578328", "0.42481506", "0.424598", "0.42413878", "0.42402682", "0.42391092", "0.42353365" ]
0.6689372
2
GetRepliesOk returns a tuple with the Replies field if it's nonnil, zero value otherwise and a boolean to check if the value has been set.
func (o *MicrosoftGraphWorkbookComment) GetRepliesOk() ([]MicrosoftGraphWorkbookCommentReply, bool) { if o == nil || o.Replies == nil { var ret []MicrosoftGraphWorkbookCommentReply return ret, false } return *o.Replies, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGetRepliesIDOK() *GetRepliesIDOK {\n\treturn &GetRepliesIDOK{}\n}", "func (m *MessageReplies) GetReplies() (value int) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Replies\n}", "func (o *GetMessagesAllOf) GetReactionsOk() (*interface{}, bool) {\n\tif o == nil || o.Reactions == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Reactions, true\n}", "func (o *BalanceResponse) GetPendingOk() ([]BalanceCommonField, bool) {\n\tif o == nil || IsNil(o.Pending) {\n\t\treturn nil, false\n\t}\n\treturn o.Pending, true\n}", "func (o *InlineResponse200115) GetReactionsOk() (*InlineResponse2008Reactions, bool) {\n\tif o == nil || o.Reactions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reactions, true\n}", "func (o *VulnUpdateNotification) GetTriesOk() (*int32, bool) {\n\tif o == nil || o.Tries == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tries, true\n}", "func (o *BalanceResponse) GetRetainedOk() ([]BalanceCommonField, bool) {\n\tif o == nil || IsNil(o.Retained) {\n\t\treturn nil, false\n\t}\n\treturn o.Retained, true\n}", "func (o *MicrosoftGraphWorkbookComment) HasReplies() bool {\n\tif o != nil && o.Replies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20085) GetReactionsOk() (*InlineResponse20085Reactions, bool) {\n\tif o == nil || o.Reactions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reactions, true\n}", "func (o *ViewProjectBudget) GetRepeatsRemainingOk() (*int32, bool) {\n\tif o == nil || o.RepeatsRemaining == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RepeatsRemaining, true\n}", "func (o *ControllersUpdateStorageOptionsTemplateRequest) GetReplOk() (*int32, bool) {\n\tif o == nil || o.Repl == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Repl, true\n}", "func (o *ViewReactionsForObject) GetCountsOk() (*ViewReactionsForObjectCounter, bool) {\n\tif o == nil || o.Counts == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Counts, true\n}", "func (o *NotificationConfig) GetReceiversOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Receivers, true\n}", "func (o *PayloadNullableInt64Slice) GetSetOk() (*bool, bool) {\n\tif o == nil || o.Set == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Set, true\n}", "func (o *ApplianceImageBundleAllOf) GetNotesOk() (*string, bool) {\n\tif o == nil || o.Notes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notes, true\n}", "func (o *User) GetInterestsOk() ([]string, bool) {\n\tif o == nil || o.Interests == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.Interests, true\n}", "func (o *BaseReportTransaction) GetPendingOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Pending, true\n}", "func (o *User) GetResponsibilitiesOk() ([]string, bool) {\n\tif o == nil || o.Responsibilities == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.Responsibilities, true\n}", "func (o *BudgetProjectBudgetsResponseIncluded) GetNotificationsOk() (*map[string]ViewProjectBudgetNotification, bool) {\n\tif o == nil || o.Notifications == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notifications, true\n}", "func (o *PostWebhook) GetPrRescopedOk() (*bool, bool) {\n\tif o == nil || o.PrRescoped == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrRescoped, true\n}", "func (o *SecurityMonitoringRuleCase) GetNotificationsOk() (*[]string, bool) {\n\tif o == nil || o.Notifications == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Notifications, true\n}", "func (o *Transaction) GetPendingOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Pending, true\n}", "func (o *LocalDatabaseProvider) GetNotesOk() (*string, bool) {\n\tif o == nil || o.Notes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notes, true\n}", "func (o *Job) GetRetriesOk() (*int32, bool) {\n\tif o == nil || o.Retries == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Retries, true\n}", "func GetReplies(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcommentID := params[\"comment_id\"]\n\n\tif commentID == \"\" {\n\t\tmsg := map[string]string{\"error\": \"comment id required\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\tvar comment comments.Comment\n\n\tcomment.ID = commentID\n\n\terr := comment.GetReplies()\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(comment.Replies)\n\n\treturn\n\n}", "func (o *Service) GetCommentsOk() (string, bool) {\n\tif o == nil || o.Comments == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Comments, true\n}", "func (o *LinkPrivateIpsRequest) GetDryRunOk() (*bool, bool) {\n\tif o == nil || o.DryRun == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DryRun, true\n}", "func (o *NotificationAllOf) GetFieldsOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Fields == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Fields, true\n}", "func (o *MicrosoftGraphWorkbookComment) SetReplies(v []MicrosoftGraphWorkbookCommentReply) {\n\to.Replies = &v\n}", "func (o *PostWebhook) GetPrReopenedOk() (*bool, bool) {\n\tif o == nil || o.PrReopened == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrReopened, true\n}", "func (o *ViewMilestone) GetResponsiblePartyIdsOk() (*[]int32, bool) {\n\tif o == nil || o.ResponsiblePartyIds == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponsiblePartyIds, true\n}", "func (o *VulnUpdateNotification) GetMaxTriesOk() (*int32, bool) {\n\tif o == nil || o.MaxTries == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MaxTries, true\n}", "func (o *BalanceResponse) GetTemporarilyRetainedOk() ([]BalanceCommonField, bool) {\n\tif o == nil || IsNil(o.TemporarilyRetained) {\n\t\treturn nil, false\n\t}\n\treturn o.TemporarilyRetained, true\n}", "func (o *ViewProjectBudget) GetNotificationsOk() (*[]ViewRelationship, bool) {\n\tif o == nil || o.Notifications == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Notifications, true\n}", "func (o *W2) GetRetirementPlanOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RetirementPlan.Get(), o.RetirementPlan.IsSet()\n}", "func (o *W2) GetNonqualifiedPlansOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NonqualifiedPlans.Get(), o.NonqualifiedPlans.IsSet()\n}", "func (o *ProvenanceRequestDTO) GetIncrementalResultsOk() (*bool, bool) {\n\tif o == nil || o.IncrementalResults == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IncrementalResults, true\n}", "func (m *MessageReplies) GetComments() (value bool) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Flags.Has(0)\n}", "func (o *VersionedConnection) GetCommentsOk() (*string, bool) {\n\tif o == nil || o.Comments == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comments, true\n}", "func (o *ContainerUpdateOKBody) GetWarningsOk() ([]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Warnings, true\n}", "func (o *Permissao) GetRefPermissaoOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RefPermissao.Get(), o.RefPermissao.IsSet()\n}", "func (o *VulnUpdateNotificationPayloadAllOf) GetAnnotationsOk() (map[string]interface{}, bool) {\n\tif o == nil || o.Annotations == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Annotations, true\n}", "func (o *Invoice) GetCorrectionsOk() ([]string, bool) {\n\tif o == nil || o.Corrections == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Corrections, true\n}", "func (o *PayloadDescriptionMetadata) GetCertifiedOk() (*bool, bool) {\n\tif o == nil || o.Certified == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Certified, true\n}", "func (o *MonitorSearchResult) GetNotificationsOk() (*[]MonitorSearchResultNotification, bool) {\n\tif o == nil || o.Notifications == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Notifications, true\n}", "func (o *ProcessorSignalDecisionReportRequest) GetInitiatedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Initiated, true\n}", "func (o *ProblemFeedQueryResult) GetProblemsOk() (*[]Problem, bool) {\n\tif o == nil || o.Problems == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Problems, true\n}", "func (o *MicrosoftGraphWorkbookComment) GetReplies() []MicrosoftGraphWorkbookCommentReply {\n\tif o == nil || o.Replies == nil {\n\t\tvar ret []MicrosoftGraphWorkbookCommentReply\n\t\treturn ret\n\t}\n\treturn *o.Replies\n}", "func (r *Result) Replies() []*Reply {\n return r.replies\n}", "func (o *ViewProjectBudget) GetIsRepeatingOk() (*bool, bool) {\n\tif o == nil || o.IsRepeating == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsRepeating, true\n}", "func (r *helloProtoResolver) Replies(ctx context.Context, obj *hello_pb.Hello) ([]*hello_pb.Hello, error) {\n\tpanic(\"not implemented\")\n}", "func (m *MessageReplies) GetRepliesPts() (value int) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.RepliesPts\n}", "func (o *InlineResponse20034Milestone) GetResponsiblePartyIdsOk() (*string, bool) {\n\tif o == nil || o.ResponsiblePartyIds == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponsiblePartyIds, true\n}", "func (o *DeviceNode) GetResourcesOk() (*[]map[string]interface{}, bool) {\n\tif o == nil || o.Resources == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Resources, true\n}", "func (o *AccountDashboardStatistic) GetReferralsOk() ([]AccountDashboardStatisticReferrals, bool) {\n\tif o == nil || o.Referrals == nil {\n\t\tvar ret []AccountDashboardStatisticReferrals\n\t\treturn ret, false\n\t}\n\treturn *o.Referrals, true\n}", "func (o *InlineObject985) GetValuesOk() (AnyOfobject, bool) {\n\tif o == nil || o.Values == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Values, true\n}", "func (o *LoyaltySubLedger) GetPendingPointsOk() ([]LoyaltyLedgerEntry, bool) {\n\tif o == nil || o.PendingPoints == nil {\n\t\tvar ret []LoyaltyLedgerEntry\n\t\treturn ret, false\n\t}\n\treturn *o.PendingPoints, true\n}", "func (o *PostWebhook) GetPrUpdatedOk() (*bool, bool) {\n\tif o == nil || o.PrUpdated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrUpdated, true\n}", "func (o *LocalDatabaseProvider) GetDnsServersOk() ([]string, bool) {\n\tif o == nil || o.DnsServers == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DnsServers, true\n}", "func (o *PatchedUpdateWorkspaceInvitation) GetPermissionsOk() (*string, bool) {\n\tif o == nil || IsNil(o.Permissions) {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "func (o *RoleWithAccess) GetModifiedOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Modified, true\n}", "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}", "func (o *W2) GetAllocatedTipsOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AllocatedTips.Get(), o.AllocatedTips.IsSet()\n}", "func (o *VersionedControllerService) GetCommentsOk() (*string, bool) {\n\tif o == nil || o.Comments == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comments, true\n}", "func (o *FiltersVmGroup) GetDescriptionsOk() (*[]string, bool) {\n\tif o == nil || o.Descriptions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Descriptions, true\n}", "func (sr *SearchResponse) IsOk() bool {\n\t// Empty responses (meaning no matches) are not errors...\n\treturn len(sr.Documents) > 0\n}", "func (o *InstanceStatusKubernetes) GetReplicasetsOk() (*[]KubernetesReplicaSet, bool) {\n\tif o == nil || o.Replicasets == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Replicasets, true\n}", "func (o *ConditionRequestRateCondition) GetIpsOk() (*[]string, bool) {\n\tif o == nil || o.Ips == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Ips, true\n}", "func (o *SnapmirrorRelationshipModifyDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "func (o *SnapmirrorRelationshipModifyAccepted) IsSuccess() bool {\n\treturn true\n}", "func (o *GetProductsOffersDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "func (o *PatchV1PostMortemsReportsReportIDFieldsFieldIDOK) IsSuccess() bool {\n\treturn true\n}", "func (o *RecurrenceRepetition) GetOccurrencesOk() (*[]time.Time, bool) {\n\tif o == nil || o.Occurrences == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Occurrences, true\n}", "func (o *CartaoProduto) GetRefProdutoOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RefProduto.Get(), o.RefProduto.IsSet()\n}", "func (o *NodeUpdate) GetDnsServersOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DnsServers, true\n}", "func (o *NewCoupons) GetLimitsOk() ([]LimitConfig, bool) {\n\tif o == nil || o.Limits == nil {\n\t\tvar ret []LimitConfig\n\t\treturn ret, false\n\t}\n\treturn *o.Limits, true\n}", "func (o *InlineResponse20034Milestone) GetResponsiblePartyNamesOk() (*string, bool) {\n\tif o == nil || o.ResponsiblePartyNames == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ResponsiblePartyNames, true\n}", "func (o *SchemaDefinitionRestDto) GetPropertiesOk() (*map[string]PropertyDefinition, bool) {\n\tif o == nil || o.Properties == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Properties, true\n}", "func (o *CheckoutResponse) GetRecurrentOk() (*bool, bool) {\n\tif o == nil || IsNil(o.Recurrent) {\n\t\treturn nil, false\n\t}\n\treturn o.Recurrent, true\n}", "func (o *NotificationAllOf) GetDoneOk() (*bool, bool) {\n\tif o == nil || o.Done == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Done, true\n}", "func (o *ViewProjectActivePages) GetMessagesOk() (*bool, bool) {\n\tif o == nil || o.Messages == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Messages, true\n}", "func (o *Account) GetAllowWithdrawalsOk() (*bool, bool) {\n\tif o == nil || o.AllowWithdrawals == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AllowWithdrawals, true\n}", "func (o *InlineResponse20014Projects) GetStarredOk() (*bool, bool) {\n\tif o == nil || o.Starred == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Starred, true\n}", "func (o *Service) GetCredentialsOk() (map[string]map[string]bool, bool) {\n\tif o == nil || o.Credentials == nil {\n\t\tvar ret map[string]map[string]bool\n\t\treturn ret, false\n\t}\n\treturn *o.Credentials, true\n}", "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}", "func (o *WorkflowServiceItemActionInstance) GetMessagesOk() ([]ServiceitemMessage, bool) {\n\tif o == nil || o.Messages == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Messages, true\n}", "func (o *WafTrafficPolicy) GetIpReputationOk() (*string, bool) {\n\tif o == nil || o.IpReputation == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IpReputation, true\n}", "func (o *Replication) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *FiltersApiLog) GetResponseStatusCodesOk() ([]int64, bool) {\n\tif o == nil || o.ResponseStatusCodes == nil {\n\t\tvar ret []int64\n\t\treturn ret, false\n\t}\n\treturn *o.ResponseStatusCodes, true\n}", "func (m *ChatMessage) GetReplies()([]ChatMessageable) {\n return m.replies\n}", "func (o *SummaryResponse) GetUnreadOk() (*SummaryUnreadResponse, bool) {\n\tif o == nil || o.Unread == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Unread, true\n}", "func (o *CreditBankIncomeTransaction) GetPendingOk() (*bool, bool) {\n\tif o == nil || o.Pending == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Pending, true\n}", "func (o *UpdateServerCertificateRequest) GetDryRunOk() (*bool, bool) {\n\tif o == nil || o.DryRun == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DryRun, true\n}", "func (o *TransactionSplit) GetReconciledOk() (*bool, bool) {\n\tif o == nil || o.Reconciled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reconciled, true\n}", "func (o *WorkflowCatalogServiceRequest) GetMessagesOk() ([]ServicerequestMessage, bool) {\n\tif o == nil || o.Messages == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Messages, true\n}", "func (o *InlineObject794) GetValuesOk() (AnyOfobject, bool) {\n\tif o == nil || o.Values == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.Values, true\n}", "func ReplyOk(message ...string) *Reply {\n\tif len(message) == 0 {\n\t\tmessage = []string{\"Ok\"}\n\t}\n\treturn &Reply{250, message, nil}\n}", "func (o *UpdateRepository24NoContent) IsSuccess() bool {\n\treturn true\n}", "func (o *W2) GetMedicareWagesAndTipsOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MedicareWagesAndTips.Get(), o.MedicareWagesAndTips.IsSet()\n}", "func (e Elem) Replies(raw *tg.Client) *messages.GetRepliesQueryBuilder {\n\treturn messages.NewQueryBuilder(raw).GetReplies(e.Peer)\n}" ]
[ "0.6417596", "0.6255426", "0.5950571", "0.5895809", "0.58705825", "0.58232564", "0.5774508", "0.570393", "0.5547826", "0.5493874", "0.5454028", "0.5406109", "0.5384522", "0.5354651", "0.5348693", "0.5334422", "0.5319017", "0.53096014", "0.52918345", "0.5283456", "0.52464116", "0.5246202", "0.5244036", "0.521777", "0.5216245", "0.520253", "0.5201622", "0.5188348", "0.51838285", "0.5165712", "0.5163371", "0.51483744", "0.5143306", "0.51381254", "0.5114409", "0.51089513", "0.5107708", "0.51033103", "0.50916505", "0.50815344", "0.508056", "0.50800276", "0.50783074", "0.50714856", "0.5063127", "0.5059168", "0.50405604", "0.5035339", "0.50332296", "0.50330824", "0.50248337", "0.50202286", "0.50192225", "0.5007589", "0.5000565", "0.50001496", "0.49945557", "0.49896175", "0.49881253", "0.49814296", "0.49729985", "0.49655557", "0.49605402", "0.49587485", "0.49565285", "0.4948353", "0.4946546", "0.49426714", "0.49368623", "0.49207366", "0.49195495", "0.4913666", "0.49074244", "0.49010247", "0.48982894", "0.48977983", "0.48967", "0.48947182", "0.48886138", "0.4880418", "0.48785564", "0.48777947", "0.4859395", "0.48523533", "0.48517624", "0.48453218", "0.4844625", "0.48427218", "0.4841811", "0.48412657", "0.4836453", "0.48360035", "0.48333013", "0.48313236", "0.48304155", "0.482378", "0.48192653", "0.4815984", "0.48137715", "0.48118252" ]
0.7425649
0
HasReplies returns a boolean if a field has been set.
func (o *MicrosoftGraphWorkbookComment) HasReplies() bool { if o != nil && o.Replies != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m SecurityListRequest) HasRepurchaseTerm() bool {\n\treturn m.Has(tag.RepurchaseTerm)\n}", "func (m CrossOrderCancelReplaceRequest) HasRepurchaseTerm() bool {\n\treturn m.Has(tag.RepurchaseTerm)\n}", "func (o *PostWebhook) HasPrRescoped() bool {\n\tif o != nil && o.PrRescoped != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m SecurityListRequest) HasRepurchaseRate() bool {\n\treturn m.Has(tag.RepurchaseRate)\n}", "func (o *RetroInquiryResponseSchema) HasRetroInquiryResponse() bool {\n\tif o != nil && o.RetroInquiryResponse != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasRepurchaseRate() bool {\n\treturn m.Has(tag.RepurchaseRate)\n}", "func (o *ControllersUpdateStorageOptionsTemplateRequest) HasRepl() bool {\n\tif o != nil && o.Repl != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *ViewMilestone) HasResponsiblePartyIds() bool {\n\tif o != nil && o.ResponsiblePartyIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_ValidatorCurrentRewardsRecord) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.rewards\":\n\t\treturn x.Rewards != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord does not contain field %s\", fd.FullName()))\n\t}\n}", "func (w *Wrapper) Has() (has bool, err error) {\n\terr = w.Limit(1).Get()\n\tif err != nil {\n\t\thas = false\n\t\treturn\n\t}\n\tif w.Count() > 0 {\n\t\thas = true\n\t\treturn\n\t}\n\treturn\n}", "func Has(db sql.Executor, ref types.PoetProofRef) (bool, error) {\n\tenc := func(stmt *sql.Statement) {\n\t\tstmt.BindBytes(1, ref[:])\n\t}\n\trows, err := db.Exec(\"select 1 from poets where ref = ?1;\", enc, nil)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"has: %w\", err)\n\t}\n\treturn rows > 0, nil\n}", "func (o *PostWebhook) HasPrReopened() bool {\n\tif o != nil && o.PrReopened != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgDepositValidatorRewardsPool) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.depositor\":\n\t\treturn x.Depositor != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool does not contain field %s\", fd.FullName()))\n\t}\n}", "func (this *Collection) Has(fields interface{}) (bool, error) {\n\tsession, err := mgo.Dial(this.address)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer session.Close()\n\tsession.SetSafe(&mgo.Safe{})\n\tcollection := session.DB(this.database).C(this.collection)\n\tif count, err := collection.Find(fields).Limit(1).Count(); err != nil {\n\t\treturn false, err\n\t} else if count != 1 {\n\t\treturn false, nil\n\t} else {\n\t\treturn true, nil\n\t}\n}", "func (o *BalanceResponse) HasRetained() bool {\n\tif o != nil && !IsNil(o.Retained) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_Supply) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.Supply.total\":\n\t\treturn len(x.Total) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Supply\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Supply does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *InlineResponse20034Milestone) HasResponsiblePartyIds() bool {\n\tif o != nil && o.ResponsiblePartyIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_ValidatorOutstandingRewardsRecord) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards\":\n\t\treturn len(x.OutstandingRewards) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *ViewProjectBudget) HasRepeatsRemaining() bool {\n\tif o != nil && o.RepeatsRemaining != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgDepositValidatorRewardsPoolResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryParamsResponse.params\":\n\t\treturn x.Params != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryParamsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryParamsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (r Record) Has(key string) bool {\n\tif r.dropped {\n\t\tlog.Fatalf(\"Int called on dropped record\")\n\t}\n\n\tval, ok := r.values[key]\n\tif !ok {\n\t\treturn false\n\t}\n\n\tswitch val := val.(type) {\n\tcase nil:\n\t\treturn false\n\tcase []interface{}:\n\t\treturn len(val) > 0\n\tcase map[string]interface{}:\n\t\treturn len(val) > 0\n\t}\n\n\treturn true\n}", "func (m *Message) HasResponded() bool {\n\treturn atomic.LoadInt32(&m.responded) == 1\n}", "func (m *Message) HasResponded() bool {\n\treturn atomic.LoadInt32(&m.responded) == 1\n}", "func (o *ViewProjectBudget) HasIsRepeating() bool {\n\tif o != nil && o.IsRepeating != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20034Milestone) HasResponsiblePartyNames() bool {\n\tif o != nil && o.ResponsiblePartyNames != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FormField) HasResponse() bool {\n\tif o != nil && o.Response != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *W2) HasRetirementPlan() bool {\n\tif o != nil && o.RetirementPlan.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasResponsibleParties() bool {\n\tif o != nil && o.ResponsibleParties != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_EventRetire) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.retirer\":\n\t\treturn x.Retirer != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.batch_denom\":\n\t\treturn x.BatchDenom != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.amount\":\n\t\treturn x.Amount != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.location\":\n\t\treturn x.Location != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.EventRetire\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.EventRetire does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *PayloadNullableInt64Slice) HasSet() bool {\n\tif o != nil && o.Set != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ls Set) Has(field string) bool {\n\t_, exists := ls[field]\n\treturn exists\n}", "func (x *fastReflection_ValidatorHistoricalRewardsRecord) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.period\":\n\t\treturn x.Period != uint64(0)\n\tcase \"cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.rewards\":\n\t\treturn x.Rewards != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *NotificationAllOf) HasFields() bool {\n\tif o != nil && o.Fields != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RiskRulesListAllOfData) HasField() bool {\n\tif o != nil && !IsNil(o.Field) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgWithdrawValidatorCommissionResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *SourceMongoDb) HasRetrieveFullDocument() bool {\n\tif o != nil && !IsNil(o.RetrieveFullDocument) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProvenanceRequestDTO) HasIncrementalResults() bool {\n\tif o != nil && o.IncrementalResults != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LinkPrivateIpsRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *V0037JobProperties) HasRequeue() bool {\n\tif o != nil && o.Requeue != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BudgetProjectBudgetsResponseIncluded) HasNotifications() bool {\n\tif o != nil && o.Notifications != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasPartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Partner\", \"partner_id\"))\n}", "func (p ByName) HasBeenSet() bool {\n\treturn len(p.whereIsParamSet) > 0\n}", "func (x *fastReflection_MsgWithdrawDelegatorReward) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.delegator_address\":\n\t\treturn x.DelegatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_QueryAccountsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountsResponse.accounts\":\n\t\treturn len(x.Accounts) != 0\n\tcase \"cosmos.auth.v1beta1.QueryAccountsResponse.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := r.Form.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *Permissao) HasRefPermissao() bool {\n\tif o != nil && o.RefPermissao.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasResponsibilities() bool {\n\tif o != nil && o.Responsibilities != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProvenanceRequestDTO) HasMaxResults() bool {\n\tif o != nil && o.MaxResults != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BalanceResponse) HasPending() bool {\n\tif o != nil && !IsNil(o.Pending) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *Configuration) Has(field string) bool {\n\tout := getField(c.App, field)\n\tif out == nil {\n\t\tout = getField(c.Base, field)\n\t}\n\n\treturn out != nil\n}", "func (o *StatusDescriptorDTO) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_QueryModuleAccountsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryModuleAccountsResponse.accounts\":\n\t\treturn len(x.Accounts) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryModuleAccountsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryModuleAccountsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *InlineResponse20034Milestone) HasCanComplete() bool {\n\tif o != nil && o.CanComplete != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LinkPublicIpRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *OnpremUpgradePhase) HasRetryCount() bool {\n\tif o != nil && o.RetryCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UpdateLoginFlowWithCodeMethod) HasResend() bool {\n\tif o != nil && o.Resend != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FormulaLimit) HasCount() bool {\n\treturn o != nil && o.Count != nil\n}", "func (r Result) HasResource() bool {\n\treturn r.Resource.UID != \"\"\n}", "func (o *UpdatesV3Request) HasRepositoryList() bool {\n\tif o != nil && o.RepositoryList != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_SendEnabled) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.SendEnabled.denom\":\n\t\treturn x.Denom != \"\"\n\tcase \"cosmos.bank.v1beta1.SendEnabled.enabled\":\n\t\treturn x.Enabled != false\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.SendEnabled\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.SendEnabled does not contain field %s\", fd.FullName()))\n\t}\n}", "func HasPrescriptions() predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(PrescriptionsTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, PrescriptionsTable, PrescriptionsColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (x *fastReflection_MsgCommunityPoolSpendResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *CustomfieldCustomFieldsResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (field Field) IsDefined() bool {\n\treturn field.Var != nil\n}", "func (o *LocalDatabaseProvider) HasDnsServers() bool {\n\tif o != nil && o.DnsServers != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotebookResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasReactions() bool {\n\tif o != nil && o.Reactions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Replication) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RecurrenceRepetition) HasOccurrences() bool {\n\tif o != nil && o.Occurrences != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20033Milestones) HasResponsiblePartyIds() bool {\n\tif o != nil && o.ResponsiblePartyIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CreateLoadBalancerListenersRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasRef() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Ref\", \"ref\"))\n}", "func (o *AssigneeFormAssigneesResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UpdateVpnConnectionRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PostWebhook) HasPrUpdated() bool {\n\tif o != nil && o.PrUpdated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasCanComplete() bool {\n\tif o != nil && o.CanComplete != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DeferredResultVoid) HasSetOrExpired() bool {\n\tif o != nil && o.SetOrExpired != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssigneeResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CheckoutResponse) HasRecurrent() bool {\n\tif o != nil && !IsNil(o.Recurrent) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Subscription) HasSubscription(ctx context.Context, resourceId string) (bool, error) {\n\tsession := s.client.session()\n\tdefer session.Close()\n\n\tsession.SetMode(mgo.Monotonic, true)\n\tcount, err := session.\n\t\tDB(s.database).\n\t\tC(s.collection).\n\t\tFind(bson.M{\"resource.id\": resourceId}).\n\t\tCount()\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn false, &errMemory{message: fmt.Sprintf(\n\t\t\t\t\"subscriptions not found for resource '%s'\", resourceId), notFound: true,\n\t\t\t}\n\t\t}\n\t\treturn false, err\n\t}\n\treturn count > 0, nil\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_QueryAccountsRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountsRequest.pagination\":\n\t\treturn x.Pagination != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountsRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountsRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *InlineResponse20085) HasReactions() bool {\n\tif o != nil && o.Reactions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SummaryResponse) HasUnread() bool {\n\tif o != nil && o.Unread != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotebookNotebooksResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_DelegatorWithdrawInfo) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.DelegatorWithdrawInfo.delegator_address\":\n\t\treturn x.DelegatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.DelegatorWithdrawInfo.withdraw_address\":\n\t\treturn x.WithdrawAddress != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.DelegatorWithdrawInfo\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.DelegatorWithdrawInfo does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *InlineResponse20049Post) HasNumNotified() bool {\n\tif o != nil && o.NumNotified != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryParamsRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryParamsRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *VulnUpdateNotification) HasRecordStateVal() bool {\n\tif o != nil && o.RecordStateVal.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BulkCreatePayloadAuthentications) HasResourceName() bool {\n\tif o != nil && o.ResourceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasPending(ctx context.Context, userID, courseID string) (exists bool, err error) {\n\t// language=SQL\n\terr = pgctx.QueryRow(ctx, `\n\t\tselect exists (\n\t\t\tselect 1\n\t\t\tfrom payments\n\t\t\twhere user_id = $1 and course_id = $2 and status = $3\n\t\t)\n\t`, userID, courseID, Pending).Scan(&exists)\n\treturn\n}", "func (p *Manager) Has(r interface{}) bool {\n\thost := \"\"\n\tport := \"\"\n\tswitch r.(type) {\n\tcase string:\n\t\tresult := p.parseURL(r.(string))\n\t\thost = result.Host\n\t\tport = result.Port\n\tcase Proxy:\n\t\thost = r.(Proxy).Host\n\t\tport = r.(Proxy).Port\n\t}\n\tfor _, proxy := range p.List {\n\t\tif proxy.Host == host && port == proxy.Port {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *VulnUpdateNotification) HasMaxTries() bool {\n\tif o != nil && o.MaxTries != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (obj *expense) HasRemaining() bool {\n\treturn obj.remaining != nil\n}", "func (o *VulnerabilitiesRequest) HasRepositoryList() bool {\n\tif o != nil && o.RepositoryList != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *protoObj) IsSet(field ref.Val) ref.Val {\n\tprotoFieldName, ok := field.(String)\n\tif !ok {\n\t\treturn MaybeNoSuchOverloadErr(field)\n\t}\n\tprotoFieldStr := string(protoFieldName)\n\tfd, found := o.typeDesc.FieldByName(protoFieldStr)\n\tif !found {\n\t\treturn NewErr(\"no such field '%s'\", field)\n\t}\n\tif fd.IsSet(o.value) {\n\t\treturn True\n\t}\n\treturn False\n}", "func (o *GitRepositoryResponseList) HasResults() bool {\n\tif o != nil && o.Results != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r Ref) NotSet() bool {\n\treturn r.ID == \"\" && r.Name == \"\"\n}" ]
[ "0.6166356", "0.60873276", "0.60239065", "0.6015529", "0.59779763", "0.5946915", "0.5864806", "0.5815077", "0.5794932", "0.5744371", "0.57413405", "0.5729629", "0.56734383", "0.56452215", "0.56445", "0.5633605", "0.56222725", "0.56136966", "0.56040984", "0.55954725", "0.55771244", "0.5573549", "0.55651295", "0.55531263", "0.55531263", "0.55391824", "0.55321395", "0.5520098", "0.5502507", "0.548524", "0.5468287", "0.5467252", "0.5452571", "0.545041", "0.54465806", "0.5446077", "0.5446019", "0.54279804", "0.54196835", "0.54151475", "0.5413512", "0.5412062", "0.5405583", "0.54037434", "0.53797996", "0.53782815", "0.5376345", "0.5375749", "0.53730273", "0.5372966", "0.5343027", "0.53416616", "0.53326553", "0.5325485", "0.53042346", "0.53033483", "0.52970386", "0.529258", "0.5292361", "0.52716583", "0.5263368", "0.5252919", "0.52518976", "0.5249168", "0.5245988", "0.52435523", "0.52354383", "0.5230548", "0.5228045", "0.5222852", "0.52209675", "0.521527", "0.5213947", "0.5209608", "0.5206993", "0.5206063", "0.52048457", "0.5192632", "0.5190005", "0.51897484", "0.5189322", "0.51846844", "0.51810545", "0.51807785", "0.51762", "0.5175263", "0.5170006", "0.5167788", "0.51674765", "0.516718", "0.51639813", "0.51599306", "0.5154557", "0.5147872", "0.51394844", "0.5138933", "0.5138486", "0.5135887", "0.51339227", "0.51315343" ]
0.6954371
0
SetReplies gets a reference to the given []MicrosoftGraphWorkbookCommentReply and assigns it to the Replies field.
func (o *MicrosoftGraphWorkbookComment) SetReplies(v []MicrosoftGraphWorkbookCommentReply) { o.Replies = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *ChatMessage) SetReplies(value []ChatMessageable)() {\n m.replies = value\n}", "func (o *MicrosoftGraphWorkbookComment) GetReplies() []MicrosoftGraphWorkbookCommentReply {\n\tif o == nil || o.Replies == nil {\n\t\tvar ret []MicrosoftGraphWorkbookCommentReply\n\t\treturn ret\n\t}\n\treturn *o.Replies\n}", "func (m *Workbook) SetComments(value []WorkbookCommentable)() {\n m.comments = value\n}", "func (o *MicrosoftGraphWorkbookComment) GetRepliesOk() ([]MicrosoftGraphWorkbookCommentReply, bool) {\n\tif o == nil || o.Replies == nil {\n\t\tvar ret []MicrosoftGraphWorkbookCommentReply\n\t\treturn ret, false\n\t}\n\treturn *o.Replies, true\n}", "func (o *MicrosoftGraphWorkbookComment) HasReplies() bool {\n\tif o != nil && o.Replies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func NewWorkbookCommentReply()(*WorkbookCommentReply) {\n m := &WorkbookCommentReply{\n Entity: *NewEntity(),\n }\n return m\n}", "func (m *MessageReplies) SetComments(value bool) {\n\tif value {\n\t\tm.Flags.Set(0)\n\t\tm.Comments = true\n\t} else {\n\t\tm.Flags.Unset(0)\n\t\tm.Comments = false\n\t}\n}", "func Replies(r chan inter.ConnectorMessage) RequestOption {\n\treturn func(o *RequestOptions) {\n\t\to.Replies = r\n\t\to.ProcessReplies = false\n\t}\n}", "func (c *CommentMetaData) LoadReplies(u *User) error {\n\tvar replies CommentList\n\tif _, err := Comments().Filter(\"replyto\", c.Id).RelatedSel(\"user\").OrderBy(\"date\").All(&replies); err != nil {\n\t\treturn err\n\t}\n\tif err := c.ReadVoteData(u); err != nil {\n\t\tbeego.Error(err)\n\t}\n\tc.Replies = *replies.ToMetaData()\n\t// load replies recursively\n\tfor i := range c.Replies {\n\t\tif err := c.Replies[i].LoadReplies(u); err != nil {\n\t\t\tbeego.Error(err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *MessageReplies) SetFlags() {\n\tif !(m.Comments == false) {\n\t\tm.Flags.Set(0)\n\t}\n\tif !(m.RecentRepliers == nil) {\n\t\tm.Flags.Set(1)\n\t}\n\tif !(m.ChannelID == 0) {\n\t\tm.Flags.Set(0)\n\t}\n\tif !(m.MaxID == 0) {\n\t\tm.Flags.Set(2)\n\t}\n\tif !(m.ReadMaxID == 0) {\n\t\tm.Flags.Set(3)\n\t}\n}", "func (m *MailTips) SetAutomaticReplies(value AutomaticRepliesMailTipsable)() {\n err := m.GetBackingStore().Set(\"automaticReplies\", value)\n if err != nil {\n panic(err)\n }\n}", "func (r *Result) Replies() []*Reply {\n return r.replies\n}", "func (repo *commentRepository) GetReplies(commentID int, by string, order string, limit, offset int) ([]*comment.Comment, error) {\n\tresult, err := (*repo.secondaryRepo).GetReplies(commentID, by, order, limit, offset)\n\tif err == nil {\n\t\tfor _, c := range result {\n\t\t\trepo.cache[c.ID] = *c\n\t\t}\n\t}\n\treturn result, err\n}", "func (e Elem) Replies(raw *tg.Client) *messages.GetRepliesQueryBuilder {\n\treturn messages.NewQueryBuilder(raw).GetReplies(e.Peer)\n}", "func (m *MessageReplies) GetReplies() (value int) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Replies\n}", "func (m *ChatMessage) GetReplies()([]ChatMessageable) {\n return m.replies\n}", "func GetReplies(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcommentID := params[\"comment_id\"]\n\n\tif commentID == \"\" {\n\t\tmsg := map[string]string{\"error\": \"comment id required\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\tvar comment comments.Comment\n\n\tcomment.ID = commentID\n\n\terr := comment.GetReplies()\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(comment.Replies)\n\n\treturn\n\n}", "func (d *Dao) Replies(c context.Context, oids []int64, rpIds []int64) (rpMap map[int64]*model.Reply, err error) {\n\thitMap := make(map[int64][]int64)\n\tfor i, oid := range oids {\n\t\thitMap[hit(oid)] = append(hitMap[hit(oid)], rpIds[i])\n\t}\n\trpMap = make(map[int64]*model.Reply, len(rpIds))\n\tfor hit, ids := range hitMap {\n\t\tvar rows *xsql.Rows\n\t\trows, err = d.db.Query(c, fmt.Sprintf(_selRepliesSQL, hit, xstr.JoinInts(ids)))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor rows.Next() {\n\t\t\tr := &model.Reply{}\n\t\t\tif err = rows.Scan(&r.ID, &r.Oid, &r.Type, &r.Mid, &r.Root, &r.Parent, &r.Dialog, &r.Count, &r.RCount, &r.Like, &r.Floor, &r.State, &r.Attr, &r.CTime, &r.MTime); err != nil {\n\t\t\t\trows.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t\trpMap[r.ID] = r\n\t\t}\n\t\tif err = rows.Err(); err != nil {\n\t\t\trows.Close()\n\t\t\treturn\n\t\t}\n\t\trows.Close()\n\t}\n\treturn\n}", "func (m *WorkbookCommentReply) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"content\", m.GetContent())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"contentType\", m.GetContentType())\n if err != nil {\n return err\n }\n }\n return nil\n}", "func (m *WorkbookCommentReply) SetContent(value *string)() {\n m.content = value\n}", "func DecodeGetCommentsReply(payload []byte) (*GetCommentsReply, error) {\n\tvar gcr GetCommentsReply\n\n\terr := json.Unmarshal(payload, &gcr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &gcr, nil\n}", "func DecodeCensorCommentReply(payload []byte) (*CensorCommentReply, error) {\n\tvar ccr CensorCommentReply\n\terr := json.Unmarshal(payload, &ccr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ccr, nil\n}", "func (m *ChatMessage) SetReactions(value []ChatMessageReactionable)() {\n m.reactions = value\n}", "func (s *DescribeReplicationConfigurationsOutput) SetReplications(v []*ReplicationConfigurationDescription) *DescribeReplicationConfigurationsOutput {\n\ts.Replications = v\n\treturn s\n}", "func DefaultPatchSetComment(ctx context.Context, objects []*Comment, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*Comment, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*Comment, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchComment(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func EncodeGetCommentsReply(gcr GetCommentsReply) ([]byte, error) {\n\treturn json.Marshal(gcr)\n}", "func (s LoginSession) Reply(r Replier, comment string) error {\n\treq := &request{\n\t\turl: \"https://www.reddit.com/api/comment\",\n\t\tvalues: &url.Values{\n\t\t\t\"thing_id\": {r.replyID()},\n\t\t\t\"text\": {comment},\n\t\t\t\"uh\": {s.modhash},\n\t\t},\n\t\tcookie: s.cookie,\n\t\tuseragent: s.useragent,\n\t}\n\n\tbody, err := req.getResponse()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !strings.Contains(body.String(), \"data\") {\n\t\treturn errors.New(\"failed to post comment\")\n\t}\n\n\treturn nil\n}", "func (m *MessageReplies) SetRecentRepliers(value []PeerClass) {\n\tm.Flags.Set(1)\n\tm.RecentRepliers = value\n}", "func (a *SetDocumentContentReply) UnmarshalJSON(b []byte) error {\n\ttype Copy SetDocumentContentReply\n\tc := &Copy{}\n\terr := json.Unmarshal(b, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = SetDocumentContentReply(*c)\n\treturn nil\n}", "func (o *InlineResponse200115) SetReactions(v InlineResponse2008Reactions) {\n\to.Reactions = &v\n}", "func (s *Service) repliesMap(c context.Context, oid int64, tp int8, rpIDs []int64) (res map[int64]*model.Reply, err error) {\n\tif len(rpIDs) == 0 {\n\t\treturn\n\t}\n\tres, missIDs, err := s.dao.Mc.GetMultiReply(c, rpIDs)\n\tif err != nil {\n\t\tlog.Error(\"s.dao.Mc.GetMultiReply(%d,%d,%d) error(%v)\", oid, tp, rpIDs, err)\n\t\terr = nil\n\t\tres = make(map[int64]*model.Reply, len(rpIDs))\n\t\tmissIDs = rpIDs\n\t}\n\tif len(missIDs) > 0 {\n\t\tvar (\n\t\t\tmrp map[int64]*model.Reply\n\t\t\tmrc map[int64]*model.Content\n\t\t)\n\t\tif mrp, err = s.dao.Reply.GetByIds(c, oid, tp, missIDs); err != nil {\n\t\t\tlog.Error(\"s.reply.GetByIds(%d,%d,%d) error(%v)\", oid, tp, rpIDs, err)\n\t\t\treturn\n\t\t}\n\t\tif mrc, err = s.dao.Content.GetByIds(c, oid, missIDs); err != nil {\n\t\t\tlog.Error(\"s.content.GetByIds(%d,%d) error(%v)\", oid, rpIDs, err)\n\t\t\treturn\n\t\t}\n\t\trs := make([]*model.Reply, 0, len(missIDs))\n\t\tfor _, rpID := range missIDs {\n\t\t\tif rp, ok := mrp[rpID]; ok {\n\t\t\t\trp.Content = mrc[rpID]\n\t\t\t\tres[rpID] = rp\n\t\t\t\trs = append(rs, rp.Clone())\n\t\t\t}\n\t\t}\n\t\t// asynchronized add reply cache\n\t\tselect {\n\t\tcase s.replyChan <- replyChan{rps: rs}:\n\t\tdefault:\n\t\t\tlog.Warn(\"s.replyChan is full\")\n\t\t}\n\t}\n\treturn\n}", "func (p *_Posts) SetComments(ctx context.Context, db database.DB, model *Post, relations ...*Comment) error {\n\tif model == nil {\n\t\treturn errors.Wrap(query.ErrNoModels, \"provided nil model\")\n\t}\n\t// Check if primary key has zero value.\n\tif model.IsPrimaryKeyZero() {\n\t\treturn errors.Wrap(mapping.ErrFieldValue, \"model's: 'Post' primary key value has zero value\")\n\t}\n\trelationField, err := p.Model.RelationByIndex(6)\n\tif err != nil {\n\t\treturn err\n\t}\n\tq := query.NewScope(p.Model, model)\n\tif len(relations) == 0 {\n\t\treturn errors.Wrap(query.ErrNoModels, \"no relation models provided\")\n\t}\n\trelationModels := make([]mapping.Model, len(relations))\n\tfor i, relation := range relations {\n\t\tif relation.IsPrimaryKeyZero() {\n\t\t\treturn errors.Wrap(mapping.ErrFieldValue, \"one of relation 'Comments' model has zero value primary field\")\n\t\t}\n\t\trelationModels[i] = relation\n\t}\n\trelationSetter, ok := db.(database.QueryRelationSetter)\n\tif !ok {\n\t\treturn errors.WrapDetf(query.ErrInternal, \"DB doesn't implement QueryRelationSetter interface: %T\", db)\n\t}\n\treturn relationSetter.QuerySetRelations(ctx, q, relationField, relationModels...)\n}", "func ReplyDest(replyDst cty.Value) SubscriptionOption {\n\treturn func(o *unstructured.Unstructured) {\n\t\tif !replyDst.IsNull() {\n\t\t\treply := DecodeDestination(replyDst)\n\t\t\t_ = unstructured.SetNestedMap(o.Object, reply, \"spec\", \"reply\", \"ref\")\n\t\t}\n\t}\n}", "func (r *helloProtoResolver) Replies(ctx context.Context, obj *hello_pb.Hello) ([]*hello_pb.Hello, error) {\n\tpanic(\"not implemented\")\n}", "func (d *Deogracias) CommentReply(m *reddit.Message) error {\n\terr := d.bot.Reply(m.Name, d.getReplyQuote())\n\tif err != nil {\n\t\tlog.Println(errors.WithStack(errors.Errorf(\"failed to reply back: %v\", err)))\n\t}\n\treturn nil\n}", "func (m *MessageReplies) GetComments() (value bool) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Flags.Has(0)\n}", "func NewRevReply_List(s *capnp.Segment, sz int32) (RevReply_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz)\n\treturn RevReply_List{l}, err\n}", "func (ctx *TestCtx) MockReplies(dataList []*HandleReplies) {\n\tvar sendControlPing bool\n\n\tctx.MockVpp.MockReplyHandler(func(request mock.MessageDTO) (reply []byte, msgID uint16, prepared bool) {\n\t\t// Following types are not automatically stored in mock adapter's map and will be sent with empty MsgName\n\t\t// TODO: initialize mock adapter's map with these\n\t\tswitch request.MsgID {\n\t\tcase 100:\n\t\t\trequest.MsgName = \"control_ping\"\n\t\tcase 101:\n\t\t\trequest.MsgName = \"control_ping_reply\"\n\t\tcase 200:\n\t\t\trequest.MsgName = \"sw_interface_dump\"\n\t\tcase 201:\n\t\t\trequest.MsgName = \"sw_interface_details\"\n\t\t}\n\n\t\tif request.MsgName == \"\" {\n\t\t\tlog.DefaultLogger().Fatalf(\"mockHandler received request (ID: %v) with empty MsgName, check if compatibility check is done before using this request\", request.MsgID)\n\t\t}\n\n\t\tif sendControlPing {\n\t\t\tsendControlPing = false\n\t\t\tdata := ctx.PingReplyMsg\n\t\t\treply, err := ctx.MockVpp.ReplyBytes(request, data)\n\t\t\tExpect(err).To(BeNil())\n\t\t\tmsgID, err := ctx.MockVpp.GetMsgID(data.GetMessageName(), data.GetCrcString())\n\t\t\tExpect(err).To(BeNil())\n\t\t\treturn reply, msgID, true\n\t\t}\n\n\t\tfor _, dataMock := range dataList {\n\t\t\tif request.MsgName == dataMock.Name {\n\t\t\t\t// Send control ping next iteration if set\n\t\t\t\tsendControlPing = dataMock.Ping\n\t\t\t\tif len(dataMock.Messages) > 0 {\n\t\t\t\t\tlog.DefaultLogger().Infof(\" MOCK HANDLER: mocking %d messages\", len(dataMock.Messages))\n\t\t\t\t\tctx.MockVpp.MockReply(dataMock.Messages...)\n\t\t\t\t\treturn nil, 0, false\n\t\t\t\t}\n\t\t\t\tif dataMock.Message == nil {\n\t\t\t\t\treturn nil, 0, false\n\t\t\t\t}\n\t\t\t\tmsgID, err := ctx.MockVpp.GetMsgID(dataMock.Message.GetMessageName(), dataMock.Message.GetCrcString())\n\t\t\t\tExpect(err).To(BeNil())\n\t\t\t\treply, err := ctx.MockVpp.ReplyBytes(request, dataMock.Message)\n\t\t\t\tExpect(err).To(BeNil())\n\t\t\t\treturn reply, msgID, true\n\t\t\t}\n\t\t}\n\n\t\tif strings.HasSuffix(request.MsgName, \"_dump\") {\n\t\t\tsendControlPing = true\n\t\t\treturn nil, 0, false\n\t\t}\n\n\t\tvar err error\n\t\treplyMsg, id, ok := ctx.MockVpp.ReplyFor(\"\", request.MsgName)\n\t\tif ok {\n\t\t\treply, err = ctx.MockVpp.ReplyBytes(request, replyMsg)\n\t\t\tExpect(err).To(BeNil())\n\t\t\tmsgID = id\n\t\t\tprepared = true\n\t\t} else {\n\t\t\tlog.DefaultLogger().Warnf(\"NO REPLY FOR %v FOUND\", request.MsgName)\n\t\t}\n\n\t\treturn reply, msgID, prepared\n\t})\n}", "func (r *bitroute) UseOptionsReplies(enabled bool) {\n\tr.optionsRepliesEnabled = enabled\n}", "func (p *postsQueryBuilder) SetComments(_comments ...*Comment) error {\n\tif p.err != nil {\n\t\treturn p.err\n\t}\n\trelation, err := NRN_Posts.Model.RelationByIndex(6)\n\tif err != nil {\n\t\treturn errors.Wrapf(mapping.ErrInternal, \"getting 'Comments' relation by index for model 'Post' failed: %v\", err)\n\t}\n\tmodels := make([]mapping.Model, len(_comments))\n\tfor i := range _comments {\n\t\tmodels[i] = _comments[i]\n\t}\n\treturn p.builder.SetRelations(relation, models...)\n}", "func (s *Service) ReplyHots(c context.Context, oid int64, typ int8, pn, ps int) (sub *model.Subject, res []*model.Reply, err error) {\n\tif !model.LegalSubjectType(typ) {\n\t\terr = ecode.ReplyIllegalSubType\n\t\treturn\n\t}\n\tif sub, err = s.Subject(c, oid, typ); err != nil {\n\t\tlog.Error(\"s.Subject(%d,%d) error(%v)\", oid, typ, err)\n\t\treturn\n\t}\n\thotIDs, _, err := s.rootReplyIDs(c, sub, model.SortByLike, pn, ps, false)\n\tif err != nil {\n\t\treturn\n\t}\n\trootMap, err := s.repliesMap(c, sub.Oid, sub.Type, hotIDs)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, rpID := range hotIDs {\n\t\tif rp, ok := rootMap[rpID]; ok {\n\t\t\tres = append(res, rp)\n\t\t}\n\t}\n\tif len(res) == 0 {\n\t\tres = _emptyReplies\n\t}\n\treturn\n}", "func GetPredefinedReplies(channelID string, replies *[]api.PredefinedDailyReply) error {\n\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\t// Assume bucket exists and has keys\n\t\tb := tx.Bucket([]byte(\"predefinedreplies\"))\n\t\tif b == nil {\n\t\t\treturn fmt.Errorf(\"dbutils: bucket predefinedreplies not created\")\n\t\t}\n\n\t\td := b.Cursor()\n\t\tvar reply api.PredefinedDailyReply\n\n\t\tfor k, v := d.First(); k != nil; k, v = d.Next() {\n\n\t\t\tbuf := *bytes.NewBuffer(v)\n\t\t\tdec := gob.NewDecoder(&buf)\n\t\t\tdec.Decode(&reply)\n\t\t\tif reply.ChannelID == channelID {\n\t\t\t\t*replies = append(*replies, reply)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn err\n}", "func (c *ChannelMessage) DeleteReplies() error {\n\tmr := NewMessageReply()\n\tmr.MessageId = c.Id\n\n\t// list returns ChannelMessage\n\tmessageReplies, err := mr.ListAll()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// delete message replies\n\tfor _, replyMessage := range messageReplies {\n\t\terr := replyMessage.DeleteMessageAndDependencies(false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (s *MessagesSendMessageRequest) SetReplyMarkup(value ReplyMarkupClass) {\n\ts.Flags.Set(2)\n\ts.ReplyMarkup = value\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesChatMessageItemRequestBuilder) Replies()(*TeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesItemRepliesRequestBuilder) {\n return NewTeamTemplatesItemDefinitionsItemTeamDefinitionPrimaryChannelMessagesItemRepliesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (o *InlineResponse20085) SetReactions(v InlineResponse20085Reactions) {\n\to.Reactions = &v\n}", "func (b *Builder) SetReceipts(rm map[hash.Hash32B]*action.Receipt) *Builder {\n\tb.blk.Receipts = make(map[hash.Hash32B]*action.Receipt)\n\tfor h, r := range rm {\n\t\tb.blk.Receipts[h] = r\n\t}\n\treturn b\n}", "func (void *VoidResponse) SetReplyMarkup(inline [][]InlineKeyboardButton) *VoidResponse {\n\tbody := JSON{\n\t\t\"reply_markup\": JSON{\n\t\t\t\"inline_keyboard\": inline,\n\t\t},\n\t}\n\tvoid.Request = void.Request.Send(body)\n\n\treturn void\n}", "func (m *MailboxSettings) SetAutomaticRepliesSetting(value AutomaticRepliesSettingable)() {\n err := m.GetBackingStore().Set(\"automaticRepliesSetting\", value)\n if err != nil {\n panic(err)\n }\n}", "func Set(id string, ad bool, show bool, recv bool) (err error) {\n\tobjectID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = mongo.Update(\"blotter\", \"comments\", bson.M{\"_id\": objectID}, bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"recv\": recv,\n\t\t\t\"ad\": ad,\n\t\t\t\"show\": show,\n\t\t},\n\t}, nil)\n\treturn\n}", "func CreateWorkbookCommentReplyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWorkbookCommentReply(), nil\n}", "func NewReplyReader(mongoClient *mongo.Client) *ReplyReader {\n\treturn &ReplyReader{\n\t\tmongoClient: mongoClient,\n\t}\n}", "func (m *MockRestAPI) PostRobotComments(c context.Context, host, change, revision string, runID int64, comments []*track.Comment) error {\n\tm.LastComments = comments\n\treturn nil\n}", "func (m *Messenger) SendWithReplies(to Recipient, message string, replies []QuickReply, messagingType MessagingType, tags ...string) error {\n\tresponse := &Response{\n\t\ttoken: m.token,\n\t\tto: to,\n\t}\n\n\treturn response.TextWithReplies(message, replies, messagingType, tags...)\n}", "func EncodeCensorCommentReply(ccr CensorCommentReply) ([]byte, error) {\n\treturn json.Marshal(ccr)\n}", "func (b *GroupsSetCallbackSettingsBuilder) WallReplyRestore(v bool) *GroupsSetCallbackSettingsBuilder {\n\tb.Params[\"wall_reply_restore\"] = v\n\treturn b\n}", "func (m *Workbook) GetComments()([]WorkbookCommentable) {\n return m.comments\n}", "func (s *Service) JumpReplies(c context.Context, mid, oid, rpID int64, tp int8, ps, sndPs int, escape bool) (roots, hots []*model.Reply, topAdmin, topUpper *model.Reply, sub *model.Subject, pn, sndPn, total int, err error) {\n\tvar (\n\t\trootPos, sndPos int\n\t\trootRp, rp *model.Reply\n\t\tfixedSeconds []*model.Reply\n\t)\n\tif !model.LegalSubjectType(tp) {\n\t\terr = ecode.ReplyIllegalSubType\n\t\treturn\n\t}\n\tif sub, err = s.Subject(c, oid, tp); err != nil {\n\t\treturn\n\t}\n\tif rp, err = s.ReplyContent(c, oid, rpID, tp); err != nil {\n\t\treturn\n\t}\n\tif rp.Root == 0 && rp.Parent == 0 {\n\t\trootPos = s.getReplyPos(c, sub, rp)\n\t} else {\n\t\tif rootRp, err = s.ReplyContent(c, oid, rp.Root, tp); err != nil {\n\t\t\treturn\n\t\t}\n\t\trootPos = s.getReplyPos(c, sub, rootRp)\n\t\tsndPos = s.getReplyPosByRoot(c, rootRp, rp)\n\t}\n\t// root page number\n\tpn = (rootPos-1)/ps + 1\n\t// second page number\n\tif sndPos > sndPs {\n\t\tsndPn = (sndPos-1)/sndPs + 1\n\t} else {\n\t\tsndPn = 1\n\t}\n\t// get reply content\n\troots, seconds, total, err := s.rootReplies(c, sub, mid, model.SortByFloor, pn, ps, 1, sndPs)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rootRp != nil && rootRp.RCount > 0 {\n\t\tif fixedSeconds, err = s.repliesByRoot(c, oid, rootRp.RpID, tp, sndPn, sndPs); err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, rp := range roots {\n\t\t\tif rp.RpID == rootRp.RpID {\n\t\t\t\trp.Replies = fixedSeconds\n\t\t\t}\n\t\t}\n\t}\n\t// top and hots\n\ttopAdmin, topUpper, hots, hseconds, err := s.topAndHots(c, sub, mid, true, true)\n\tif err != nil {\n\t\tlog.Error(\"s.topAndHots(%d,%d,%d) error(%v)\", oid, tp, mid, err)\n\t\terr = nil // degrade\n\t}\n\trs := make([]*model.Reply, 0, len(roots)+len(seconds)+len(hseconds)+len(fixedSeconds)+2)\n\trs = append(rs, roots...)\n\trs = append(rs, seconds...)\n\trs = append(rs, hseconds...)\n\trs = append(rs, hots...)\n\trs = append(rs, fixedSeconds...)\n\tif topAdmin != nil {\n\t\trs = append(rs, topAdmin)\n\t}\n\tif topUpper != nil {\n\t\trs = append(rs, topUpper)\n\t}\n\tif err = s.buildReply(c, sub, rs, mid, escape); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r *RepositoryComment) GetReactions() *Reactions {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.Reactions\n}", "func (m Message) ReplyDocument(filepath string) {\n\tmessage := &ReplyMessage{}\n\tmsg := tgbotapi.NewDocumentUpload(m.Chat.ID, filepath)\n\tmessage.msg = msg\n\tm.replies <- message\n}", "func (m CrossOrderCancelReplaceRequest) SetRepurchaseTerm(v int) {\n\tm.Set(field.NewRepurchaseTerm(v))\n}", "func (d *Docs) SetComments(comments *ast.CommentGroup) {\n\td.Comment = getComments(comments)\n}", "func (b *GroupsSetLongPollSettingsBuilder) WallReplyRestore(v bool) *GroupsSetLongPollSettingsBuilder {\n\tb.Params[\"wall_reply_restore\"] = v\n\treturn b\n}", "func (m *MessageReplies) FillFrom(from interface {\n\tGetComments() (value bool)\n\tGetReplies() (value int)\n\tGetRepliesPts() (value int)\n\tGetRecentRepliers() (value []PeerClass, ok bool)\n\tGetChannelID() (value int64, ok bool)\n\tGetMaxID() (value int, ok bool)\n\tGetReadMaxID() (value int, ok bool)\n}) {\n\tm.Comments = from.GetComments()\n\tm.Replies = from.GetReplies()\n\tm.RepliesPts = from.GetRepliesPts()\n\tif val, ok := from.GetRecentRepliers(); ok {\n\t\tm.RecentRepliers = val\n\t}\n\n\tif val, ok := from.GetChannelID(); ok {\n\t\tm.ChannelID = val\n\t}\n\n\tif val, ok := from.GetMaxID(); ok {\n\t\tm.MaxID = val\n\t}\n\n\tif val, ok := from.GetReadMaxID(); ok {\n\t\tm.ReadMaxID = val\n\t}\n\n}", "func DecodeNewCommentReply(payload []byte) (*NewCommentReply, error) {\n\tvar ncr NewCommentReply\n\n\terr := json.Unmarshal(payload, &ncr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ncr, nil\n}", "func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.amount\":\n\t\tlv := value.List()\n\t\tclv := lv.(*_MsgWithdrawDelegatorRewardResponse_1_list)\n\t\tx.Amount = *clv.list\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *VersionedConnection) SetComments(v string) {\n\to.Comments = &v\n}", "func (o *VersionedControllerService) SetComments(v string) {\n\to.Comments = &v\n}", "func (node *RenameTable) SetComments(comments Comments) {\n\t// irrelevant\n}", "func (m *MockClient) ListPullRequestComments(org, repo string, number int) ([]github.ReviewComment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPullRequestComments\", org, repo, number)\n\tret0, _ := ret[0].([]github.ReviewComment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (a *GetResourceContentReply) UnmarshalJSON(b []byte) error {\n\ttype Copy GetResourceContentReply\n\tc := &Copy{}\n\terr := json.Unmarshal(b, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = GetResourceContentReply(*c)\n\treturn nil\n}", "func (j *DSGitHub) EnrichPullRequestComments(ctx *Ctx, pull map[string]interface{}, comments []map[string]interface{}, affs bool) (richItems []interface{}, err error) {\n\t// type: category, type(_), item_type( ), pull_request_comment=true\n\t// copy pull request: github_repo, repo_name, repository\n\t// copy comment: created_at, updated_at, body, body_analyzed, author_association, url, html_url\n\t// identify: id, id_in_repo, pull_request_comment_id, url_id\n\t// standard: metadata..., origin, project, project_slug, uuid\n\t// parent: pull_request_id, pull_request_number\n\t// calc: n_reactions\n\t// identity: author_... -> commenter_...,\n\t// common: is_github_pull_request=1, is_github_pull_request_comment=1\n\tiID, _ := pull[\"id\"]\n\tid, _ := iID.(string)\n\tiPullID, _ := pull[\"pull_request_id\"]\n\tpullID := int(iPullID.(float64))\n\tpullNumber, _ := pull[\"id_in_repo\"]\n\tiNumber, _ := pullNumber.(int)\n\tiGithubRepo, _ := pull[\"github_repo\"]\n\tgithubRepo, _ := iGithubRepo.(string)\n\tcopyPullFields := []string{\"category\", \"github_repo\", \"repo_name\", \"repository\", \"repo_short_name\"}\n\tcopyCommentFields := []string{\"created_at\", \"updated_at\", \"body\", \"body_analyzed\", \"author_association\", \"url\", \"html_url\"}\n\tfor _, comment := range comments {\n\t\trich := make(map[string]interface{})\n\t\tfor _, field := range RawFields {\n\t\t\tv, _ := pull[field]\n\t\t\trich[field] = v\n\t\t}\n\t\tfor _, field := range copyPullFields {\n\t\t\trich[field], _ = pull[field]\n\t\t}\n\t\tfor _, field := range copyCommentFields {\n\t\t\trich[field], _ = comment[field]\n\t\t}\n\t\tif ctx.Project != \"\" {\n\t\t\trich[\"project\"] = ctx.Project\n\t\t}\n\t\trich[\"type\"] = \"pull_request_comment\"\n\t\trich[\"item_type\"] = \"pull request comment\"\n\t\trich[\"pull_request_comment\"] = true\n\t\trich[\"pull_request_created_at\"], _ = pull[\"created_at\"]\n\t\trich[\"pull_request_id\"] = pullID\n\t\trich[\"pull_request_number\"] = pullNumber\n\t\tiCID, _ := comment[\"id\"]\n\t\tcid := int64(iCID.(float64))\n\t\trich[\"id_in_repo\"] = cid\n\t\trich[\"pull_request_comment_id\"] = cid\n\t\trich[\"id\"] = id + \"/comment/\" + fmt.Sprintf(\"%d\", cid)\n\t\trich[\"url_id\"] = fmt.Sprintf(\"%s/pulls/%d/comments/%d\", githubRepo, iNumber, cid)\n\t\treactions := 0\n\t\tiReactions, ok := Dig(comment, []string{\"reactions\", \"total_count\"}, false, true)\n\t\tif ok {\n\t\t\treactions = int(iReactions.(float64))\n\t\t}\n\t\trich[\"n_reactions\"] = reactions\n\t\trich[\"commenter_association\"], _ = comment[\"author_association\"]\n\t\trich[\"commenter_login\"], _ = Dig(comment, []string{\"user\", \"login\"}, false, true)\n\t\tiCommenterData, ok := comment[\"user_data\"]\n\t\tif ok && iCommenterData != nil {\n\t\t\tuser, _ := iCommenterData.(map[string]interface{})\n\t\t\trich[\"author_login\"], _ = user[\"login\"]\n\t\t\trich[\"author_name\"], _ = user[\"name\"]\n\t\t\trich[\"author_avatar_url\"], _ = user[\"avatar_url\"]\n\t\t\trich[\"commenter_avatar_url\"] = rich[\"author_avatar_url\"]\n\t\t\trich[\"commenter_name\"], _ = user[\"name\"]\n\t\t\trich[\"commenter_domain\"] = nil\n\t\t\tiEmail, ok := user[\"email\"]\n\t\t\tif ok {\n\t\t\t\temail, _ := iEmail.(string)\n\t\t\t\tary := strings.Split(email, \"@\")\n\t\t\t\tif len(ary) > 1 {\n\t\t\t\t\trich[\"commenter_domain\"] = strings.TrimSpace(ary[1])\n\t\t\t\t}\n\t\t\t}\n\t\t\trich[\"commenter_org\"], _ = user[\"company\"]\n\t\t\trich[\"commenter_location\"], _ = user[\"location\"]\n\t\t\trich[\"commenter_geolocation\"] = nil\n\t\t} else {\n\t\t\trich[\"author_login\"] = nil\n\t\t\trich[\"author_name\"] = nil\n\t\t\trich[\"author_avatar_url\"] = nil\n\t\t\trich[\"commenter_avatar_url\"] = nil\n\t\t\trich[\"commenter_name\"] = nil\n\t\t\trich[\"commenter_domain\"] = nil\n\t\t\trich[\"commenter_org\"] = nil\n\t\t\trich[\"commenter_location\"] = nil\n\t\t\trich[\"commenter_geolocation\"] = nil\n\t\t}\n\t\tiCreatedAt, _ := comment[\"created_at\"]\n\t\tcreatedAt, _ := TimeParseInterfaceString(iCreatedAt)\n\t\trich[j.DateField(ctx)] = createdAt\n\t\tif affs {\n\t\t\tauthorKey := \"user_data\"\n\t\t\tvar affsItems map[string]interface{}\n\t\t\taffsItems, err = j.AffsItems(ctx, comment, GitHubPullRequestCommentRoles, createdAt)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor prop, value := range affsItems {\n\t\t\t\trich[prop] = value\n\t\t\t}\n\t\t\tfor _, suff := range AffsFields {\n\t\t\t\trich[Author+suff] = rich[authorKey+suff]\n\t\t\t\trich[\"commenter\"+suff] = rich[authorKey+suff]\n\t\t\t}\n\t\t\torgsKey := authorKey + MultiOrgNames\n\t\t\t_, ok := Dig(rich, []string{orgsKey}, false, true)\n\t\t\tif !ok {\n\t\t\t\trich[orgsKey] = []interface{}{}\n\t\t\t}\n\t\t}\n\t\tfor prop, value := range CommonFields(j, createdAt, j.Category) {\n\t\t\trich[prop] = value\n\t\t}\n\t\tfor prop, value := range CommonFields(j, createdAt, j.Category+\"_comment\") {\n\t\t\trich[prop] = value\n\t\t}\n\t\trichItems = append(richItems, rich)\n\t}\n\treturn\n}", "func (b *OperationMutator) Responses(v Responses) *OperationMutator {\n\tb.proxy.responses = v\n\treturn b\n}", "func (node *AlterView) SetComments(comments Comments) {\n\tnode.Comments = comments.Parsed()\n}", "func (s *WindowsDesktopServiceV3) SetProxyIDs(proxyIDs []string) {\n\ts.Spec.ProxyIDs = proxyIDs\n}", "func unmarshalCommentsResponseToBlogComments(v *CommentsResponse) *blog.Comments {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &blog.Comments{\n\t\tID: v.ID,\n\t\tComments: v.Comments,\n\t}\n\n\treturn res\n}", "func SetRepos(r *[]Repo) {\n\trepos = r\n}", "func UpdateReply(w http.ResponseWriter, r *http.Request) {\n\tsessionID := r.Header.Get(\"sessionID\")\n\tuser, err := getUserFromSession(sessionID)\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tif !user.Active {\n\t\tmsg := map[string]string{\"error\": \"Sorry your account isn't activated yet\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tid := r.URL.Query().Get(\"id\")\n\n\tif id == \"\" {\n\t\tmsg := map[string]string{\"error\": \"id required\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tvar reply = &comments.Reply{ID: id}\n\n\terr = reply.Get()\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tif user.DisplayName != reply.Username {\n\t\tmsg := map[string]string{\"error\": \"Sorry you're not authorized to view this page\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\terr = json.NewDecoder(r.Body).Decode(&reply)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\terr = reply.Update()\n\n\tif err != nil {\n\t\tmsg := map[string]string{\"error\": \"Sorry there was an internal server error\"}\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(msg)\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(reply)\n\n}", "func (p *PullRequestComment) GetReactions() *Reactions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Reactions\n}", "func (m *WorkbookCommentReply) GetContent()(*string) {\n return m.content\n}", "func (t *Thread) replies(DB *gorm.DB) { DB.Debug().Model(&t).Related(&t.Replies) }", "func (me *TAttlistCommentsCorrectionsRefType) Set(s string) { (*xsdt.Token)(me).Set(s) }", "func (node *RevertMigration) SetComments(comments Comments) {\n\tnode.Comments = comments.Parsed()\n}", "func (m SecurityListRequest) SetRepurchaseTerm(v int) {\n\tm.Set(field.NewRepurchaseTerm(v))\n}", "func (a *HipchatAdapter) Reply(res *Response, strings ...string) error {\n\tnewStrings := make([]string, len(strings))\n\tfor _, str := range strings {\n\t\tnewStrings = append(newStrings, res.UserID()+`: `+str)\n\t}\n\n\ta.Send(res, newStrings...)\n\n\treturn nil\n}", "func (node *DropView) SetComments(comments Comments) {\n\tnode.Comments = comments.Parsed()\n}", "func (a *NamespacesApiService) SetReplicatorDispatchRate(ctx _context.Context, tenant string, namespace string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/namespaces/{tenant}/{namespace}/replicatorDispatchRate\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"tenant\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", tenant)), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"namespace\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", namespace)), -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{}\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 nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (o *Service) SetComments(v string) {\n\to.Comments = &v\n}", "func (a *ReloadReply) UnmarshalJSON(b []byte) error {\n\ttype Copy ReloadReply\n\tc := &Copy{}\n\terr := json.Unmarshal(b, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = ReloadReply(*c)\n\treturn nil\n}", "func GetCommentsSlice() []Comment {\n\treturn comments\n}", "func (ac *AnswerCreate) SetResponses(s []string) *AnswerCreate {\n\tac.mutation.SetResponses(s)\n\treturn ac\n}", "func unmarshalCommentsResponseBodyToBlogComments(v *CommentsResponseBody) *blog.Comments {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &blog.Comments{\n\t\tID: v.ID,\n\t\tComments: v.Comments,\n\t}\n\n\treturn res\n}", "func (b *UpdateBuilder) Comments(comments []string) *UpdateBuilder {\n\tb.Update.Comments = comments\n\treturn b\n}", "func (o ArgoCDSpecRepoResourcesPtrOutput) Limits() ArgoCDSpecRepoResourcesLimitsMapOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpecRepoResources) map[string]ArgoCDSpecRepoResourcesLimits {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Limits\n\t}).(ArgoCDSpecRepoResourcesLimitsMapOutput)\n}", "func (m *UnifiedRoleManagementPolicyNotificationRule) SetNotificationRecipients(value []string)() {\n m.notificationRecipients = value\n}", "func (s *AppServerV3) SetProxyIDs(proxyIDs []string) {\n\ts.Spec.ProxyIDs = proxyIDs\n}", "func (d *Dao) Reply(c context.Context, oid, rpID int64) (r *model.Reply, err error) {\n\tr = new(model.Reply)\n\trow := d.db.QueryRow(c, fmt.Sprintf(_selReplySQL, hit(oid)), rpID)\n\tif err = row.Scan(&r.ID, &r.Oid, &r.Type, &r.Mid, &r.Root, &r.Parent, &r.Dialog, &r.Count, &r.RCount, &r.Like, &r.Hate, &r.Floor, &r.State, &r.Attr, &r.CTime, &r.MTime); err != nil {\n\t\tif err == xsql.ErrNoRows {\n\t\t\tr = nil\n\t\t\terr = nil\n\t\t}\n\t}\n\treturn\n}", "func (o *GetReposOwnerRepoIssuesNumberCommentsOK) SetPayload(payload models.IssuesComments) {\n\to.Payload = payload\n}", "func (m *MockPullRequestClient) ListPullRequestComments(org, repo string, number int) ([]github.ReviewComment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPullRequestComments\", org, repo, number)\n\tret0, _ := ret[0].([]github.ReviewComment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func FindCommentReactions(issueID, commentID int64) (ReactionList, int64, error) {\n\treturn FindReactions(db.DefaultContext, FindReactionsOptions{\n\t\tIssueID: issueID,\n\t\tCommentID: commentID,\n\t})\n}" ]
[ "0.7325392", "0.71738416", "0.5862128", "0.5842886", "0.5820806", "0.5809152", "0.5734729", "0.5624805", "0.55994105", "0.5487002", "0.5420558", "0.5414529", "0.5323386", "0.53125703", "0.5285075", "0.52696323", "0.52277744", "0.5119111", "0.51165307", "0.5108387", "0.5073747", "0.49680328", "0.4964034", "0.48883897", "0.48529127", "0.48273203", "0.48186636", "0.4764848", "0.4713396", "0.468936", "0.46784514", "0.46691936", "0.46206897", "0.46109504", "0.45861295", "0.4581318", "0.45564896", "0.45479226", "0.45451474", "0.45448563", "0.4522114", "0.4494911", "0.44919407", "0.44858438", "0.44814128", "0.4433782", "0.44207287", "0.44180968", "0.4414573", "0.44136816", "0.43787825", "0.43609643", "0.43603197", "0.4342827", "0.43339548", "0.43334007", "0.4328974", "0.43268406", "0.43184772", "0.43171275", "0.4304156", "0.4280555", "0.42619562", "0.4257441", "0.42563286", "0.4248393", "0.42344254", "0.42277098", "0.42164594", "0.41836265", "0.4177942", "0.4174394", "0.415695", "0.41498646", "0.41484404", "0.41453853", "0.41279137", "0.4116091", "0.41123703", "0.40993768", "0.4098829", "0.4088223", "0.40805814", "0.4076569", "0.40721926", "0.40714753", "0.4067649", "0.40660796", "0.40659907", "0.4064187", "0.40640926", "0.40639275", "0.40550974", "0.40474755", "0.4036969", "0.4029827", "0.40247232", "0.40246585", "0.40185592", "0.4008414" ]
0.8394965
0
MarshalJSON returns the JSON representation of the model.
func (o MicrosoftGraphWorkbookComment) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id } if o.Content == nil { if o.isExplicitNullContent { toSerialize["content"] = o.Content } } else { toSerialize["content"] = o.Content } if o.ContentType != nil { toSerialize["contentType"] = o.ContentType } if o.Replies != nil { toSerialize["replies"] = o.Replies } return json.Marshal(toSerialize) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m Model) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"kind\", m.Kind)\n\tpopulate(objectMap, \"model\", m.Model)\n\tpopulate(objectMap, \"skuName\", m.SKUName)\n\treturn json.Marshal(objectMap)\n}", "func (m *Model) MarshalJSON() ([]byte, error) {\n\tif m.data == nil {\n\t\tdata, err := json.Marshal(m.Values)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.data = data\n\t}\n\treturn m.data, nil\n}", "func (v Model) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson82a45abeEncodeGithubComOvhCdsSdk(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (mVar Model) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif mVar.Sku != nil {\n\t\tobjectMap[\"sku\"] = mVar.Sku\n\t}\n\tif mVar.Kind != \"\" {\n\t\tobjectMap[\"kind\"] = mVar.Kind\n\t}\n\tif mVar.Properties != nil {\n\t\tobjectMap[\"properties\"] = mVar.Properties\n\t}\n\tif mVar.Location != nil {\n\t\tobjectMap[\"location\"] = mVar.Location\n\t}\n\tif mVar.Tags != nil {\n\t\tobjectMap[\"tags\"] = mVar.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (v PostGet) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v ShadowModelSt) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonB7ed31d3EncodeMevericcoreMccommon5(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (d DeploymentModel) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"callRateLimit\", d.CallRateLimit)\n\tpopulate(objectMap, \"format\", d.Format)\n\tpopulate(objectMap, \"name\", d.Name)\n\tpopulate(objectMap, \"source\", d.Source)\n\tpopulate(objectMap, \"version\", d.Version)\n\treturn json.Marshal(objectMap)\n}", "func (a AccountModel) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"baseModel\", a.BaseModel)\n\tpopulate(objectMap, \"capabilities\", a.Capabilities)\n\tpopulate(objectMap, \"deprecation\", a.Deprecation)\n\tpopulate(objectMap, \"format\", a.Format)\n\tpopulate(objectMap, \"maxCapacity\", a.MaxCapacity)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"version\", a.Version)\n\treturn json.Marshal(objectMap)\n}", "func (v PostGets) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels11(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (a AccountModel) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"baseModel\", a.BaseModel)\n\tpopulate(objectMap, \"callRateLimit\", a.CallRateLimit)\n\tpopulate(objectMap, \"capabilities\", a.Capabilities)\n\tpopulate(objectMap, \"deprecation\", a.Deprecation)\n\tpopulate(objectMap, \"finetuneCapabilities\", a.FinetuneCapabilities)\n\tpopulate(objectMap, \"format\", a.Format)\n\tpopulate(objectMap, \"isDefaultVersion\", a.IsDefaultVersion)\n\tpopulate(objectMap, \"lifecycleStatus\", a.LifecycleStatus)\n\tpopulate(objectMap, \"maxCapacity\", a.MaxCapacity)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"skus\", a.SKUs)\n\tpopulate(objectMap, \"source\", a.Source)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"version\", a.Version)\n\treturn json.Marshal(objectMap)\n}", "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels9(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (mpm MachinePropertiesModel) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif mpm.LocationData != nil {\n\t\tobjectMap[\"locationData\"] = mpm.LocationData\n\t}\n\tif mpm.OsProfile != nil {\n\t\tobjectMap[\"osProfile\"] = mpm.OsProfile\n\t}\n\tif mpm.VMID != nil {\n\t\tobjectMap[\"vmId\"] = mpm.VMID\n\t}\n\tif mpm.ClientPublicKey != nil {\n\t\tobjectMap[\"clientPublicKey\"] = mpm.ClientPublicKey\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (v NewPost) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels12(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m ModelListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", m.NextLink)\n\tpopulate(objectMap, \"value\", m.Value)\n\treturn json.Marshal(objectMap)\n}", "func (l ModelList) MarshalJSON() ([]byte, error) {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tbuf.WriteString(\"{\\n\")\n\tfor i, each := range l.List {\n\t\tbuf.WriteString(\"\\\"\")\n\t\tbuf.WriteString(each.Name)\n\t\tbuf.WriteString(\"\\\": \")\n\t\tencoder.Encode(each.Model)\n\t\tif i < len(l.List)-1 {\n\t\t\tbuf.WriteString(\",\\n\")\n\t\t}\n\t}\n\tbuf.WriteString(\"}\")\n\treturn buf.Bytes(), nil\n}", "func (m *Model) JSON() string {\n\tret := \"\"\n\tif m.Emm != nil {\n\t\tret += m.Emm.JSON()\n\t}\n\tif m.Snow != nil {\n\t\tret += m.Snow.JSON()\n\t}\n\treturn ret\n}", "func (rmwaps ResourceModelWithAllowedPropertySetIdentity)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(rmwaps.Type != \"\") {\n objectMap[\"type\"] = rmwaps.Type\n }\n return json.Marshal(objectMap)\n }", "func (v PostParams) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels10(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Posts) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels5(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m ModelSKU) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"capacity\", m.Capacity)\n\tpopulateTimeRFC3339(objectMap, \"deprecationDate\", m.DeprecationDate)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"rateLimits\", m.RateLimits)\n\tpopulate(objectMap, \"usageName\", m.UsageName)\n\treturn json.Marshal(objectMap)\n}", "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Posts) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v PostUpdate) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Related) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComMailcoursesTechnoparkDbmsForumGeneratedModels8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Model) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson82a45abeEncodeGithubComOvhCdsSdk(w, v)\n}", "func (v PostGets) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels(w, v)\n}", "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Vote) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Visit) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonE564fc13EncodeGithubComLa0rgHighloadcupModel1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (model User) ToJSON() ([]byte, error) {\n\tb, err := json.Marshal(model)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b, nil\n}", "func (a App) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"identity\", a.Identity)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"sku\", a.SKU)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "func (v Fruit) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels11(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v NewUser) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels10(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v PostUpdate) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (i Identity)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(i.Type != \"\") {\n objectMap[\"type\"] = i.Type\n }\n return json.Marshal(objectMap)\n }", "func (v ProductToAdd) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (sc *Contract) Marshal() ([]byte, error) {\n\treturn json.Marshal(sc)\n}", "func (v Resume) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson39b3a2f5EncodeGithubComGoParkMailRu20202MVVMGitModelsModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (a AccountModelListResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", a.NextLink)\n\tpopulate(objectMap, \"value\", a.Value)\n\treturn json.Marshal(objectMap)\n}", "func (v ShadowModelSt) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonB7ed31d3EncodeMevericcoreMccommon5(w, v)\n}", "func (v Stash) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeDrhyuComIndexerModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Info) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels13(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels3(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (s SyncIdentityProviderProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"resources\", s.Resources)\n\treturn json.Marshal(objectMap)\n}", "func (v Pet) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson14a1085EncodeGithubComIamStubborNPetstoreDbModels1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (t Transform) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"properties\", t.Properties)\n\tpopulate(objectMap, \"systemData\", t.SystemData)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "func (m Meta) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(map[string]interface{}{\n\t\t\"version\": m.Version,\n\t\t\"created\": m.Created.Format(\"2006-01-02T15:04:05.000Z\"),\n\t\t\"lastModified\": m.LastModified.Format(\"2006-01-02T15:04:05.000Z\"),\n\t})\n}", "func (mepm MachineExtensionPropertiesModel) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif mepm.ForceUpdateTag != nil {\n\t\tobjectMap[\"forceUpdateTag\"] = mepm.ForceUpdateTag\n\t}\n\tif mepm.Publisher != nil {\n\t\tobjectMap[\"publisher\"] = mepm.Publisher\n\t}\n\tif mepm.Type != nil {\n\t\tobjectMap[\"type\"] = mepm.Type\n\t}\n\tif mepm.TypeHandlerVersion != nil {\n\t\tobjectMap[\"typeHandlerVersion\"] = mepm.TypeHandlerVersion\n\t}\n\tif mepm.AutoUpgradeMinorVersion != nil {\n\t\tobjectMap[\"autoUpgradeMinorVersion\"] = mepm.AutoUpgradeMinorVersion\n\t}\n\tif mepm.Settings != nil {\n\t\tobjectMap[\"settings\"] = mepm.Settings\n\t}\n\tif mepm.ProtectedSettings != nil {\n\t\tobjectMap[\"protectedSettings\"] = mepm.ProtectedSettings\n\t}\n\tif mepm.InstanceView != nil {\n\t\tobjectMap[\"instanceView\"] = mepm.InstanceView\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (v Msg) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (s SyncIdentityProviderUpdate) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\treturn json.Marshal(objectMap)\n}", "func (p Product) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\treturn json.Marshal(objectMap)\n}", "func (v Users) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (rmwaps ResourceModelWithAllowedPropertySet)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(rmwaps.Location != nil) {\n objectMap[\"location\"] = rmwaps.Location\n }\n if(rmwaps.ManagedBy != nil) {\n objectMap[\"managedBy\"] = rmwaps.ManagedBy\n }\n if(rmwaps.Kind != nil) {\n objectMap[\"kind\"] = rmwaps.Kind\n }\n if(rmwaps.Tags != nil) {\n objectMap[\"tags\"] = rmwaps.Tags\n }\n if(rmwaps.Identity != nil) {\n objectMap[\"identity\"] = rmwaps.Identity\n }\n if(rmwaps.Sku != nil) {\n objectMap[\"sku\"] = rmwaps.Sku\n }\n if(rmwaps.Plan != nil) {\n objectMap[\"plan\"] = rmwaps.Plan\n }\n return json.Marshal(objectMap)\n }", "func (v Join) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer21(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (s *Ingrediant) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(*s)\n}", "func (dmc DeviceModelCriterion) MarshalJSON() ([]byte, error) {\n\tdmc.Type = TypeDeviceModel\n\tobjectMap := make(map[string]interface{})\n\tif dmc.Name != nil {\n\t\tobjectMap[\"name\"] = dmc.Name\n\t}\n\tif dmc.Type != \"\" {\n\t\tobjectMap[\"type\"] = dmc.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (v Search) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson2f147938EncodeGithubComGoParkMailRu20202CodeExpressInternalModels(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m ModelDeprecationInfo) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"fineTune\", m.FineTune)\n\tpopulate(objectMap, \"inference\", m.Inference)\n\treturn json.Marshal(objectMap)\n}", "func (l LiveOutput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", l.ID)\n\tpopulate(objectMap, \"name\", l.Name)\n\tpopulate(objectMap, \"properties\", l.Properties)\n\tpopulate(objectMap, \"systemData\", l.SystemData)\n\tpopulate(objectMap, \"type\", l.Type)\n\treturn json.Marshal(objectMap)\n}", "func (a AppPatch) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"identity\", a.Identity)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"sku\", a.SKU)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\treturn json.Marshal(objectMap)\n}", "func (v PostFull) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComMailcoursesTechnoparkDbmsForumGeneratedModels7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Group) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels10(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (this *K8SObjectMeta) MarshalJSON() ([]byte, error) {\n\tstr, err := CommonMarshaler.MarshalToString(this)\n\treturn []byte(str), err\n}", "func (a Attributes) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeUnix(objectMap, \"created\", a.Created)\n\tpopulate(objectMap, \"enabled\", a.Enabled)\n\tpopulateTimeUnix(objectMap, \"exp\", a.Expires)\n\tpopulateTimeUnix(objectMap, \"nbf\", a.NotBefore)\n\tpopulateTimeUnix(objectMap, \"updated\", a.Updated)\n\treturn json.Marshal(objectMap)\n}", "func (u UserAssignedManagedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"clientId\", u.ClientID)\n\tpopulate(objectMap, \"principalId\", u.PrincipalID)\n\treturn json.Marshal(objectMap)\n}", "func (a AppProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"applicationId\", a.ApplicationID)\n\tpopulate(objectMap, \"displayName\", a.DisplayName)\n\tpopulate(objectMap, \"state\", a.State)\n\tpopulate(objectMap, \"subdomain\", a.Subdomain)\n\tpopulate(objectMap, \"template\", a.Template)\n\treturn json.Marshal(objectMap)\n}", "func (m MachinePoolProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"resources\", m.Resources)\n\treturn json.Marshal(objectMap)\n}", "func (v PostSet) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels9(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v SignInData) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncode20191OPGPlus2InternalPkgModels6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (cat CatAPTrue) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif cat.Friendly != nil {\n\t\tobjectMap[\"friendly\"] = cat.Friendly\n\t}\n\tif cat.ID != nil {\n\t\tobjectMap[\"id\"] = cat.ID\n\t}\n\tif cat.Name != nil {\n\t\tobjectMap[\"name\"] = cat.Name\n\t}\n\tfor k, v := range cat.AdditionalProperties {\n\t\tobjectMap[k] = v\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (op OpRetain) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(op.Fields)\n}", "func (v Posts) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson783c1624EncodeGithubComGobwasVk(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (d Database)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(d.DatabaseProperties != nil) {\n objectMap[\"properties\"] = d.DatabaseProperties\n }\n return json.Marshal(objectMap)\n }", "func (attr Attributes) MarshalJSON() ([]byte, error) {\n\ttype Alias Attributes // type alias to prevent infinite recursion\n\tvar toMarshal interface{}\n\tif attr.additionalAttributes == nil {\n\t\ttoMarshal = Alias(attr)\n\t} else {\n\t\tattrMap, err := toMap(Alias(attr))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttoMarshal = merge(attrMap, attr.additionalAttributes)\n\t}\n\treturn json.Marshal(toMarshal)\n}", "func (v PostGet) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson5a72dc82EncodeGithubComTimRazumovTechnoparkDBAppModels1(w, v)\n}", "func (s SyncSetProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"resources\", s.Resources)\n\treturn json.Marshal(objectMap)\n}", "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComMailcoursesTechnoparkDbmsForumGeneratedModels2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (s SyncIdentityProvider) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "func (v Post) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson783c1624EncodeGithubComGobwasVk7(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"clientId\", u.ClientID)\n\tpopulate(objectMap, \"principalId\", u.PrincipalID)\n\treturn json.Marshal(objectMap)\n}", "func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"clientId\", u.ClientID)\n\tpopulate(objectMap, \"principalId\", u.PrincipalID)\n\treturn json.Marshal(objectMap)\n}", "func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"clientId\", u.ClientID)\n\tpopulate(objectMap, \"principalId\", u.PrincipalID)\n\treturn json.Marshal(objectMap)\n}", "func (v Post) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels11(w, v)\n}", "func (v UserSet) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Ingredient) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeBackendInternalModels8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m *HardwareVendorModel) ToJSON() (string, error) {\n\treturn codec.ToJSON(m)\n}", "func (spbi SuccessfulPropertyBatchInfo) MarshalJSON() ([]byte, error) {\n\tspbi.Kind = KindSuccessful\n\tobjectMap := make(map[string]interface{})\n\tif spbi.Properties != nil {\n\t\tobjectMap[\"Properties\"] = spbi.Properties\n\t}\n\tif spbi.Kind != \"\" {\n\t\tobjectMap[\"Kind\"] = spbi.Kind\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (m MachinePool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "func (v Vote) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC80ae7adEncodeGithubComDeiklovTechDbRomanovAndrGolangModels1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m CreateCapabilityPresentationRequest) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\taO0, err := swag.WriteJSON(m.CapabilityPresentationForPUT)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO0)\n\tvar dataAO1 struct {\n\t\tID *string `json:\"id\"`\n\n\t\tVersion Version `json:\"version\"`\n\t}\n\n\tdataAO1.ID = m.ID\n\n\tdataAO1.Version = m.Version\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "func (l ModelPropertyList) MarshalJSON() ([]byte, error) {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tbuf.WriteString(\"{\\n\")\n\tfor i, each := range l.List {\n\t\tbuf.WriteString(\"\\\"\")\n\t\tbuf.WriteString(each.Name)\n\t\tbuf.WriteString(\"\\\": \")\n\t\tencoder.Encode(each.Property)\n\t\tif i < len(l.List)-1 {\n\t\t\tbuf.WriteString(\",\\n\")\n\t\t}\n\t}\n\tbuf.WriteString(\"}\")\n\treturn buf.Bytes(), nil\n}", "func (self *InMemoryMatrializer) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(self.rows)\n}", "func (i IDPSQueryObject) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"filters\", i.Filters)\n\tpopulate(objectMap, \"orderBy\", i.OrderBy)\n\tpopulate(objectMap, \"resultsPerPage\", i.ResultsPerPage)\n\tpopulate(objectMap, \"search\", i.Search)\n\tpopulate(objectMap, \"skip\", i.Skip)\n\treturn json.Marshal(objectMap)\n}", "func (m MachinePoolUpdate) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\treturn json.Marshal(objectMap)\n}", "func (s SyncStorageKeysInput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\treturn json.Marshal(objectMap)\n}", "func (v VisitArray) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonE564fc13EncodeGithubComLa0rgHighloadcupModel(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v User) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson393a2a40EncodeCodegen(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (v Error) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDbProjectPkgModels15(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}" ]
[ "0.71582407", "0.71279377", "0.7047187", "0.68152744", "0.6574039", "0.6569073", "0.6527679", "0.6508534", "0.6501809", "0.64460707", "0.6431052", "0.6413172", "0.64060473", "0.63677573", "0.63509995", "0.6297178", "0.6292525", "0.62651086", "0.6256976", "0.62447673", "0.6218444", "0.62004256", "0.61700547", "0.6131832", "0.6103981", "0.6089946", "0.6089392", "0.6086914", "0.60766196", "0.60669416", "0.60418916", "0.6041479", "0.6016754", "0.60076725", "0.60068786", "0.59999686", "0.599947", "0.59954774", "0.59898657", "0.5987286", "0.5985165", "0.5957043", "0.59562564", "0.59520686", "0.5944706", "0.5943658", "0.59266436", "0.5907682", "0.5901325", "0.5892545", "0.5890202", "0.58895767", "0.58883744", "0.5888214", "0.5885389", "0.5881271", "0.58667755", "0.5861725", "0.5861218", "0.5855319", "0.58536065", "0.5841756", "0.58358175", "0.5834712", "0.5833727", "0.5833669", "0.58295536", "0.5829422", "0.582833", "0.58196604", "0.5818862", "0.5815702", "0.5810486", "0.58093655", "0.5809286", "0.58070576", "0.58060336", "0.58053386", "0.5804473", "0.58032703", "0.5801537", "0.58001786", "0.5787206", "0.5787206", "0.5787206", "0.5785639", "0.57849497", "0.57766217", "0.5773575", "0.576813", "0.5763385", "0.57590985", "0.5758059", "0.57580197", "0.57578593", "0.5757292", "0.5747072", "0.5741495", "0.574141", "0.57413656", "0.57393134" ]
0.0
-1
HandleGetAllTableNames is an endpoint handler which return all the collection(table) names for specified data base
func HandleGetAllTableNames(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] crud := modules.DB() collections, err := crud.GetCollections(ctx, dbAlias) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } cols := make([]string, len(collections)) for i, value := range collections { cols[i] = value.TableName } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: cols}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *HbaseClient) GetTableNames() (r [][]byte, err error) {\n\tif err = p.sendGetTableNames(); err != nil {\n\t\treturn\n\t}\n\treturn p.recvGetTableNames()\n}", "func (th *TableHandler) GetTables(c echo.Context) (err error) {\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\tlimit, offset, err := getLimitAndOffest(c)\n\tif err != nil {\n\t\tzap.L().Error(errInvalidRequest.Error(), zap.Error(err))\n\t\treturn c.JSON(http.StatusBadRequest, presenter.ErrResp(reqID, err))\n\t}\n\t// Query database\n\tdata, err := th.dbSvc.ListTables(c.Request().Context(), limit, offset)\n\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Map response fields\n\tvar tables []*presenter.Table\n\tfor _, d := range data {\n\t\ttables = append(tables, &presenter.Table{\n\t\t\tTableID: d.TableID,\n\t\t\tCapacity: d.Capacity,\n\t\t})\n\t}\n\n\t// Return ok\n\treturn c.JSON(http.StatusOK, tables)\n}", "func GetListByTableName(tablename string) *sql.Rows {\r\n\tresult, err := ConnectDB().Query(cmdSelect + tablename)\r\n\tcheckerr(err)\r\n\tdefer ConnectDB().Close()\r\n\treturn result\r\n}", "func (p *CockroachDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error) {\n\tPrintName(\"TableNames\")\n\txt := conformCockroachDB(schema)\n\tfor i := 0; i <= 2; i++ {\n\t\tp.dbConn.Exec(xt[i])\n\t}\n\tvar names []string\n\tDbN = schema\n\tquery := fmt.Sprintf(`select table_name from ` + schema + `.rveg_table where table_schema = $1`)\n\targs := []interface{}{schema}\n\tif len(whitelist) > 0 {\n\t\tquery += fmt.Sprintf(\" and table_name in (%s);\", strmangle.Placeholders(true, len(whitelist), 2, 1))\n\t\tfor _, w := range whitelist {\n\t\t\targs = append(args, w)\n\t\t}\n\t} else if len(blacklist) > 0 {\n\t\tquery += fmt.Sprintf(\" and table_name not in (%s);\", strmangle.Placeholders(true, len(blacklist), 2, 1))\n\t\tfor _, b := range blacklist {\n\t\t\targs = append(args, b)\n\t\t}\n\t}\n\n\trows, err := p.dbConn.Query(query, args...)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar name string\n\t\tif err := rows.Scan(&name); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnames = append(names, name)\n\t}\n\n\treturn names, nil\n\n\treturn names, nil\n}", "func (conn *Connection) tableNames() ([]string, error) {\n\tdatabase := conn.DBName()\n\tvar tx *gorm.DB\n\tswitch conn.Name() {\n\tcase drivers.SQLite:\n\t\ttx = conn.Table(\"sqlite_master\").\n\t\t\tSelect(\"tbl_name\").\n\t\t\tWhere(\"type = ?\", \"table\").\n\t\t\tWhere(\"tbl_name NOT LIKE ?\", \"sqlite_%\")\n\tcase drivers.Postgres:\n\t\tdatabase = \"public\"\n\t\tfallthrough\n\tdefault:\n\t\ttx = conn.Table(\"information_schema.tables\").\n\t\t\tSelect(\"table_name\").\n\t\t\tWhere(\"table_type = ?\", \"BASE TABLE\").\n\t\t\tWhere(\"table_schema = ?\", database)\n\t}\n\tvar names []string\n\terr := tx.Scan(&names).Error\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn names, nil\n}", "func ListTablesHandler(w http.ResponseWriter, req *http.Request) {\n\tif bbpd_runinfo.BBPDAbortIfClosed(w) {\n\t\treturn\n\t}\n\tif req.Method == \"GET\" {\n\t\tlistTables_GET_Handler(w, req)\n\t} else if req.Method == \"POST\" {\n\t\tlistTables_POST_Handler(w, req)\n\t} else {\n\t\te := fmt.Sprintf(\"list_tables_route.ListTablesHandler:bad method %s\", req.Method)\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t}\n}", "func getTableNamesPattern() string {\n rval := \"\"\n idx := 0\n for k, _ := range tableNames {\n if ( idx > 0 ){\n rval += \"|\"\n }\n rval += k\n idx++\n }\n \n return rval\n}", "func (c *ChromeIndexedDB) RequestDatabaseNames(securityOrigin string) ([]string, error) {\n paramRequest := make(map[string]interface{}, 1)\n paramRequest[\"securityOrigin\"] = securityOrigin\n recvCh, _ := sendCustomReturn(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"IndexedDB.requestDatabaseNames\", Params: paramRequest})\n resp := <-recvCh\n\n var chromeData struct {\n Result struct { \n DatabaseNames []string \n }\n }\n\n err := json.Unmarshal(resp.Data, &chromeData)\n if err != nil {\n cerr := &ChromeErrorResponse{}\n chromeError := json.Unmarshal(resp.Data, cerr)\n if chromeError == nil && cerr.Error != nil {\n return nil, &ChromeRequestErr{Resp: cerr}\n }\n return nil, err\n }\n\n return chromeData.Result.DatabaseNames, nil\n}", "func listTables_GET_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_table_route.ListTablesHandler:cannot parse path.\" +\n\t\t\t\"try /list?ExclusiveStartTableName=$T&Limit=$L\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\tqueryMap := make(map[string]string)\n\tfor k, v := range req.URL.Query() {\n\t\tqueryMap[strings.ToLower(k)] = v[0]\n\t}\n\n\tq_estn, estn_exists := queryMap[strings.ToLower(list.EXCLUSIVE_START_TABLE_NAME)]\n\testn := \"\"\n\tif estn_exists {\n\t\testn = q_estn\n\t}\n\tq_limit, limit_exists := queryMap[strings.ToLower(list.LIMIT)]\n\tlimit := uint64(0)\n\tif limit_exists {\n\t\tlimit_conv, conv_err := strconv.ParseUint(q_limit, 10, 64)\n\t\tif conv_err != nil {\n\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler bad limit %s\", q_limit)\n\t\t\tlog.Printf(e)\n\t\t} else {\n\t\t\tlimit = limit_conv\n\t\t\tif limit > DEFAULT_LIMIT {\n\t\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler: high limit %d\", limit_conv)\n\t\t\t\tlog.Printf(e)\n\t\t\t\tlimit = DEFAULT_LIMIT\n\t\t\t}\n\t\t}\n\t}\n\n\tl := list.List{\n\t\tLimit: limit,\n\t\tExclusiveStartTableName: estn}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_GET_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_GET_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.listTable_GET_Handler %s\", mr_err.Error())\n\t\tlog.Printf(e)\n\t}\n}", "func (d casandraSQLDialect) GetTables(manager Manager, datastore string) ([]string, error) {\n\tvar rows = make([]nameRecord, 0)\n\terr := manager.ReadAll(&rows, d.tablesSQL, []interface{}{datastore}, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result = make([]string, 0)\n\tfor _, row := range rows {\n\t\tif len(row.Name) > 0 {\n\t\t\tresult = append(result, row.Name)\n\t\t}\n\t}\n\treturn result, nil\n}", "func (s *DBService) ListTables(ctx context.Context, req *dpb.ListTablesRequest) (*dpb.ListTablesResponse, error) {\n\tif err := s.Client.Ping(ctx, readpref.Primary()); err != nil {\n\t\treturn nil, status.Errorf(codes.FailedPrecondition, \"failed to connect to MongoDB client: %s\", err)\n\t}\n\tif tables, err := s.Client.Database(db).ListCollectionNames(ctx, bsonx.Doc{}); err == nil {\n\t\treturn &dpb.ListTablesResponse{Tables: tables}, err\n\t}\n\treturn &dpb.ListTablesResponse{}, status.Errorf(codes.NotFound, \"could not find tables\")\n}", "func (r *Resource) getAllHandler(c *gin.Context) {\n // get restaurant_id query param (empty string if not provided)\n restaurantID := c.Query(\"restaurant_id\")\n\n // return all tables if no restaurant_id query param, else get all tables\n // for specific restaurant\n if restaurantID == \"\" {\n // fetch all from database\n tables, err := r.db.GetAllTables()\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, tables)\n } else {\n // parse restaurant ID query param\n id, err := strconv.ParseInt(\n restaurantID,\n 10,\n 64,\n )\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": \"Bad ID\"})\n return\n }\n\n // fetch all from database\n tables, err := r.db.GetAllTablesForRestaurantID(id)\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, tables)\n }\n}", "func (d sqlDatastoreDialect) GetTables(manager Manager, datastore string) ([]string, error) {\n\tvar rows = make([]nameRecord, 0)\n\terr := manager.ReadAll(&rows, d.tablesSQL, []interface{}{datastore}, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar result = make([]string, 0)\n\tfor _, row := range rows {\n\t\tif len(row.Name) > 0 {\n\t\t\tresult = append(result, row.Name)\n\t\t}\n\t}\n\treturn result, nil\n}", "func GetSQLAgentNames() {\n\tfmt.Printf(\"Executing GetSQLAgentNames\")\n\n}", "func handleGetMultitenantDatabases(c *Context, w http.ResponseWriter, r *http.Request) {\n\tpaging, err := parsePaging(r.URL)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to parse paging parameters\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfilter := &model.MultitenantDatabaseFilter{\n\t\tVpcID: parseString(r.URL, \"vpc_id\", \"\"),\n\t\tDatabaseType: parseString(r.URL, \"database_type\", \"\"),\n\t\tPaging: paging,\n\t\tMaxInstallationsLimit: model.NoInstallationsLimit,\n\t}\n\n\tmultitenantDatabases, err := c.Store.GetMultitenantDatabases(filter)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to query multitenant databases\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif multitenantDatabases == nil {\n\t\tmultitenantDatabases = []*model.MultitenantDatabase{}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\toutputJSON(c, w, multitenantDatabases)\n}", "func (gen *General) TablesNames() []string {\n\ttables := make([]string, len(gen.Tables))\n\ti := 0\n\tfor key := range gen.Tables {\n\t\ttables[i] = key\n\t\ti++\n\t}\n\treturn tables\n}", "func RequestDatabaseNames(frame *cdp.Frame, securityOrigin string, timeout time.Duration) (*indexeddb.RequestDatabaseNamesReply, error) {\n\taction := cdp.NewAction(\n\t\t[]cdp.Event{},\n\t\t[]cdp.Command{\n\t\t\tcdp.Command{ID: frame.RequestID.GetNext(), Method: indexeddb.CommandIndexedDBRequestDatabaseNames, Params: &indexeddb.RequestDatabaseNamesArgs{SecurityOrigin: securityOrigin}, Reply: &indexeddb.RequestDatabaseNamesReply{}, Timeout: timeout},\n\t\t})\n\terr := action.Run(frame)\n\tif err != nil {\n\t\tframe.Browser.Log.Print(err)\n\t\treturn nil, err\n\t}\n\treturn action.Commands[0].Reply.(*indexeddb.RequestDatabaseNamesReply), nil\n}", "func (p *ThriftHiveMetastoreClient) GetIndexNames(ctx context.Context, db_name string, tbl_name string, max_indexes int16) (r []string, err error) {\n var _args116 ThriftHiveMetastoreGetIndexNamesArgs\n _args116.DbName = db_name\n _args116.TblName = tbl_name\n _args116.MaxIndexes = max_indexes\n var _result117 ThriftHiveMetastoreGetIndexNamesResult\n if err = p.Client_().Call(ctx, \"get_index_names\", &_args116, &_result117); err != nil {\n return\n }\n switch {\n case _result117.O2!= nil:\n return r, _result117.O2\n }\n\n return _result117.GetSuccess(), nil\n}", "func (d *DynamoDB) GetAllNames(table string) ([]string, error) {\n\titems, err := d.Scan(table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar names []string\n\tfor _, item := range items {\n\t\tnames = append(names, *item[\"name\"].S)\n\t}\n\n\treturn names, nil\n}", "func (client GroupClient) ListTables(accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableList, err error) {\n\treq, err := client.ListTablesPreparer(accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListTables\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListTablesSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListTables\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListTablesResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListTables\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (d *PostgresDbDropper) GetDbNames() ([]string, error) {\n\n\treturn getDbNames(postgres, d.connString, postgresQueryDatabases)\n}", "func (c *Container) GetClusterTables(ctx echo.Context) error {\n tableListResponse := models.ClusterTableListResponse{\n Data: []models.ClusterTable{},\n }\n tablesFuture := make(chan helpers.TablesFuture)\n go helpers.GetTablesFuture(helpers.HOST, true, tablesFuture)\n tablesListStruct := <-tablesFuture\n if tablesListStruct.Error != nil {\n return ctx.String(http.StatusInternalServerError, tablesListStruct.Error.Error())\n }\n // For now, we only show user and index tables.\n tablesList := append(tablesListStruct.Tables.User, tablesListStruct.Tables.Index...)\n api := ctx.QueryParam(\"api\")\n switch api {\n case \"YSQL\":\n for _, table := range tablesList {\n if table.YsqlOid != \"\" {\n tableListResponse.Data = append(tableListResponse.Data,\n models.ClusterTable{\n Name: table.TableName,\n Keyspace: table.Keyspace,\n Type: models.YBAPIENUM_YSQL,\n SizeBytes: table.OnDiskSize.WalFilesSizeBytes +\n table.OnDiskSize.SstFilesSizeBytes,\n })\n }\n }\n case \"YCQL\":\n for _, table := range tablesList {\n if table.YsqlOid == \"\" {\n tableListResponse.Data = append(tableListResponse.Data,\n models.ClusterTable{\n Name: table.TableName,\n Keyspace: table.Keyspace,\n Type: models.YBAPIENUM_YCQL,\n SizeBytes: table.OnDiskSize.WalFilesSizeBytes +\n table.OnDiskSize.SstFilesSizeBytes,\n })\n }\n }\n }\n return ctx.JSON(http.StatusOK, tableListResponse)\n}", "func (apiHandler *ApiHandler) handleGetNamespaces(\n\trequest *restful.Request, response *restful.Response) {\n\n\tresult, err := GetNamespaceList(apiHandler.client)\n\tif err != nil {\n\t\thandleInternalError(response, err)\n\t\treturn\n\t}\n\n\tresponse.WriteHeaderAndEntity(http.StatusCreated, result)\n}", "func HandleGetTableRules(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbAlias\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcol := \"\"\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\n\t\tdbConfig, err := syncMan.GetCollectionRules(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func (api *APIServer) httpTablesHandler(w http.ResponseWriter, r *http.Request) {\n\ttables, err := getTables(api.config)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"tables\", err)\n\t\treturn\n\t}\n\tsendResponse(w, http.StatusOK, tables)\n}", "func (client *GremlinResourcesClient) listGremlinDatabasesHandleResponse(resp *http.Response) (GremlinResourcesClientListGremlinDatabasesResponse, error) {\n\tresult := GremlinResourcesClientListGremlinDatabasesResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.GremlinDatabaseListResult); err != nil {\n\t\treturn GremlinResourcesClientListGremlinDatabasesResponse{}, err\n\t}\n\treturn result, nil\n}", "func (a *adapter) GetTableName() string {\n\treturn a.database\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func (m *SQLiteProvider) Tables(schema string) ([]string, error) {\n\ttables := []string{}\n\n\trows, err := m.DB.Query(\"SELECT DISTINCT tbl_name FROM sqlite_master ORDER BY tbl_name\")\n\tif err != nil {\n\t\treturn tables, err\n\t}\n\tdefer func() {\n\t\tif ioErr := rows.Close(); err == nil {\n\t\t\terr = ioErr\n\t\t}\n\t}()\n\n\tfor rows.Next() {\n\t\ttable := \"\"\n\n\t\t_ = rows.Scan(&table)\n\t\ttables = append(tables, table)\n\t}\n\n\treturn tables, nil\n}", "func (serviceWrapper UtilsApiImplWrapper) GetAllNamespaces(w http.ResponseWriter, r *http.Request) {\n serviceWrapper.svcImpl.GetAllNamespaces(w, r)\n}", "func tenantAllHandler(formatter *render.Render) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tsetupResponse(&w, req)\n\t\n\t\tif (*req).Method == \"OPTIONS\" {\n\t\t\tfmt.Println(\"PREFLIGHT Request\")\n\t\t\treturn\n\t\t}\n\n\t\tsession, err := mgo.Dial(mongodb_server)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tdefer session.Close()\n\t\tsession.SetMode(mgo.Monotonic, true)\n\t\tvar result []Tenant\n\t\tc := session.DB(mongodb_database).C(mongodb_collection)\n\t\terr = c.Find(bson.M{}).All(&result)\n\t\tif err != nil {\n\t\t\tfmt.Println(\" Error: \", err)\n\t\t\tformatter.JSON(w, http.StatusBadRequest, \"Not Found\")\n\t\t}\n\t\tfmt.Println(\"All Tenants:\", result)\n\t\tformatter.JSON(w, http.StatusOK, result)\n\t\t\n\t}\n}", "func (a *ApiDB) GetallUserName(w http.ResponseWriter, r *http.Request) {\n\t// Query()[\"key\"] will return an array of items,\n\t// we only want the single item.\n\n\tallusername := BUSINESS.GetAllUserName(a.Db)\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tif allusername == nil {\n\t\t//w.WriteHeader(http.StatusBadRequest)\n\t\tio.WriteString(w, `{\"message\":\"get all username unsuccess\"}`)\n\t\treturn\n\t}\n\ttype result struct {\n\t\tMessage string `json:\"message\"`\n\t\tData []string `json:\"data\"`\n\t}\n\tResult, _ := json.Marshal(result{Message: \"get all username success\", Data: allusername})\n\t//w.WriteHeader(200)\n\tio.WriteString(w, string(Result))\n}", "func (sp *SessionProvider) DatabaseNames() ([]string, error) {\n\tsession, err := sp.GetSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsession.SetSocketTimeout(0)\n\tdefer session.Close()\n\treturn session.DatabaseNames()\n}", "func (p *Oracle) TableNamesQuery() string {\n\treturn `SELECT table_name\n\tFROM\n\t\tall_tables\n\tWHERE\n\t\towner IN (SELECT sys_context('userenv', 'current_schema') from dual)`\n}", "func (m *PostgreSQLProvider) Tables(schema string) ([]string, error) {\n\tschema = m.nameOf(schema)\n\ttables := []string{}\n\n\tquery := &bytes.Buffer{}\n\tquery.WriteString(\"SELECT table_name FROM information_schema.tables \")\n\tquery.WriteString(\"WHERE table_schema = $1 \")\n\tquery.WriteString(\"ORDER BY table_name\")\n\n\trows, err := m.DB.Query(query.String(), schema)\n\tif err != nil {\n\t\treturn tables, err\n\t}\n\n\tdefer func() {\n\t\tif ioErr := rows.Close(); err == nil {\n\t\t\terr = ioErr\n\t\t}\n\t}()\n\n\tfor rows.Next() {\n\t\ttable := \"\"\n\n\t\t_ = rows.Scan(&table)\n\t\ttables = append(tables, table)\n\t}\n\n\treturn tables, nil\n}", "func (db Database) GetTables() []Table {\n\tif db.Tables != nil {\n\t\treturn db.Tables\n\t}\n\trows, err := Con.Query(\"SHOW TABLES IN \" + db.Name)\n\tutils.CheckError(err)\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar table string\n\t\trows.Scan(&table)\n\t\tdb.Tables = append(db.Tables, Table{Name: table, Database: db})\n\t}\n\treturn db.Tables\n}", "func DynamoDBListAllHandler(client dynamodb.DynamoDB, fallback http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tallRecords := dynamo.GetAllMappings(&client)\n\t\t//w.Header().Set(\"Content-Type\", \"application/html\")\n\t\tlistAll(allRecords, w)\n\t}\n}", "func (h *Handler) PrestoListSchemaNames(ctx context.Context) (r []string, err error) {\n\tfi, err := ioutil.ReadDir(h.BaseDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = make([]string, len(fi))\n\tfor idx, f := range fi {\n\t\tr[idx] = f.Name()\n\t}\n\treturn r, nil\n}", "func (d *dbBase) GetTables(db dbQuerier) (map[string]bool, error) {\n\ttables := make(map[string]bool)\n\tquery := d.ins.ShowTablesQuery()\n\trows, err := db.Query(query)\n\tif err != nil {\n\t\treturn tables, err\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar table string\n\t\terr := rows.Scan(&table)\n\t\tif err != nil {\n\t\t\treturn tables, err\n\t\t}\n\t\tif table != \"\" {\n\t\t\ttables[table] = true\n\t\t}\n\t}\n\n\treturn tables, nil\n}", "func (p *planner) getAllNames(ctx context.Context) (map[sqlbase.ID]namespaceKey, error) {\n\tnamespace := map[sqlbase.ID]namespaceKey{}\n\trows, _ /* cols */, err := p.queryRows(ctx, `SELECT id, \"parentID\", name FROM system.namespace`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, r := range rows {\n\t\tid, parentID, name := tree.MustBeDInt(r[0]), tree.MustBeDInt(r[1]), tree.MustBeDString(r[2])\n\t\tnamespace[sqlbase.ID(id)] = namespaceKey{\n\t\t\tparentID: sqlbase.ID(parentID),\n\t\t\tname: string(name),\n\t\t}\n\t}\n\treturn namespace, nil\n}", "func (p *Proxy) handleShowTables(session *driver.Session, query string, node *sqlparser.Show) (*sqltypes.Result, error) {\n// router := spanner.router\n\tast := node\n\n\tdatabase := session.Schema()\n\tif !ast.Database.IsEmpty() {\n\t\tdatabase = ast.Database.Name.String()\n\t}\n\tif database == \"\" {\n\t\treturn nil, sqldb.NewSQLError(sqldb.ER_NO_DB_ERROR)\n\t}\n\t// Check the database ACL.\n// if err := router.DatabaseACL(database); err != nil {\n// \t return nil, err\n// }\n\n\t// For validating the query works, we send it to the backend and check the error.\n\trewritten := fmt.Sprintf(\"SHOW TABLES FROM %s\", database)\n\t_, err := p.ExecuteScatter(rewritten)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "func (client GroupClient) ListTablesResponder(resp *http.Response) (result USQLTableList, 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}", "func GetDbTableName(table string) string {\n\tenvOverride := os.Getenv(table)\n\tif envOverride != \"\" {\n\t\treturn envOverride\n\t}\n\n\treturn table\n}", "func convertTablesToTableNames(tables []Table) []string {\n\ttableNames := []string{}\n\tfor _, table := range tables {\n\t\ttableNames = append(tableNames, table.name)\n\t}\n\treturn tableNames\n}", "func Tables(ctx *cli.Context) error {\n\tif len(ctx.String(\"database\")) == 0 {\n\t\treturn errors.New(\"database flag is required\")\n\t}\n\tclient := *cmd.DefaultOptions().Client\n\ttReq := client.NewRequest(ctx.String(\"store\"), \"Store.Tables\", &storeproto.TablesRequest{\n\t\tDatabase: ctx.String(\"database\"),\n\t})\n\ttRsp := &storeproto.TablesResponse{}\n\tif err := client.Call(context.TODO(), tReq, tRsp); err != nil {\n\t\treturn err\n\t}\n\tfor _, table := range tRsp.Tables {\n\t\tfmt.Println(table)\n\t}\n\treturn nil\n}", "func listTables_POST_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_tables_route.listTables_POST_Handler:cannot parse path. try /batch-get-item\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbodybytes, read_err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif read_err != nil && read_err != io.EOF {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler err reading req body: %s\", read_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar l list.List\n\n\tum_err := json.Unmarshal(bodybytes, &l)\n\tif um_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler unmarshal err on %s to Get %s\", string(bodybytes), um_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_POST_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_POST_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler %s\",\n\t\t\tmr_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (ram *Ram) TableNames() []string {\n\tvar names []string\n\n\tfor k := range ram.tables {\n\t\tnames = append(names, k)\n\t}\n\n\treturn names\n}", "func ListNames(db *bolt.DB) ([]string, error) {\n\treturn dbutil.ListNames(db, dbutil.TOTPBucket)\n}", "func (sp *SessionProvider) CollectionNames(dbName string) ([]string, error) {\n\tsession, err := sp.GetSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer session.Close()\n\tsession.SetSocketTimeout(0)\n\treturn session.DB(dbName).CollectionNames()\n}", "func tablesHandler(w http.ResponseWriter, r *http.Request) {\n\tsourcesManageHandler(w, r, ast.TypeTable)\n}", "func listNamespacesHandler(context context.Context, settings *helm_env.EnvSettings, logger *logrus.Entry) (int, interface{}, error) {\n\ttoken := context.Value(\"token\").(string)\n\tif token == \"\" {\n\t\tlogger.Debug(\"No X-Dataporten-Token header not present\")\n\t\treturn http.StatusBadRequest, nil, fmt.Errorf(\"missing X-Dataporten-Token\")\n\t}\n\tgroupsResp, err := dataporten.RequestGroups(token, logger)\n\tif err != nil {\n\t\treturn groupsResp.StatusCode, nil, err\n\t}\n\tif groupsResp.StatusCode != 200 {\n\t\treturn groupsResp.StatusCode, nil, fmt.Errorf(groupsResp.Status)\n\t}\n\tuserGroups, err := dataporten.ParseGroupResult(groupsResp.Body, logger)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, nil, err\n\t}\n\n\tnamespaceSubjectMapping, err := config.LoadNamespaceMappings(\"./\" + namespaceMappingFile)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, nil, fmt.Errorf(\"could not load namespace to subject mapping\")\n\t}\n\n\tallowedNamespaces := make([]*config.NamespaceMapping, 0)\n\tfor _, n := range namespaceSubjectMapping {\n\t\tfor _, ag := range n.AllowedSubjects {\n\t\t\tfor _, ug := range userGroups {\n\t\t\t\tif ag == ug.GroupId {\n\t\t\t\t\tallowedNamespaces = append(allowedNamespaces, n)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn http.StatusOK, allowedNamespaces, nil\n}", "func (shim *QueryDirectClient) ListTables(ctx context.Context, in *Empty, opts ...grpc.CallOption) (Query_ListTablesClient, error) {\n md, _ := metadata.FromOutgoingContext(ctx)\n ictx := metadata.NewIncomingContext(ctx, md)\n\n\tw := &directQueryListTables{ictx, make(chan *TableInfo, 100), in, nil}\n if shim.streamServerInt != nil {\n go func() {\n defer w.close()\n info := grpc.StreamServerInfo{\n FullMethod: \"/gripql.Query/ListTables\",\n IsServerStream: true,\n }\n w.e = shim.streamServerInt(shim.server, w, &info, _Query_ListTables_Handler)\n } ()\n return w, nil\n }\n\tgo func() {\n defer w.close()\n\t\tw.e = shim.server.ListTables(in, w)\n\t}()\n\treturn w, nil\n}", "func (c *tableClient) ListTables(ctx context.Context) ([]string, error) {\n\tresponse, err := c.client.IndexNames()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn response, nil\n}", "func GetAllKtpHandler(ctx context.Context) ([]*models.Ktp, error) {\n\tvar ktp []*models.Ktp\n\tres := database.DB.Find(&ktp)\n\n\tif res.Error != nil {\n\t\treturn nil, res.Error\n\t}\n\n\treturn ktp, nil\n}", "func (m *MockDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error) {\n\tif len(whitelist) > 0 {\n\t\treturn whitelist, nil\n\t}\n\ttables := []string{\"pilots\", \"jets\", \"airports\", \"licenses\", \"hangars\", \"languages\", \"pilot_languages\"}\n\treturn strmangle.SetComplement(tables, blacklist), nil\n}", "func (p *ThriftHiveMetastoreClient) GetPartitionNames(ctx context.Context, db_name string, tbl_name string, max_parts int16) (r []string, err error) {\n var _args88 ThriftHiveMetastoreGetPartitionNamesArgs\n _args88.DbName = db_name\n _args88.TblName = tbl_name\n _args88.MaxParts = max_parts\n var _result89 ThriftHiveMetastoreGetPartitionNamesResult\n if err = p.Client_().Call(ctx, \"get_partition_names\", &_args88, &_result89); err != nil {\n return\n }\n switch {\n case _result89.O2!= nil:\n return r, _result89.O2\n }\n\n return _result89.GetSuccess(), nil\n}", "func GetAllKeys(dbFileName string, BucketName string) []string {\n\tvar keys []string\n\tdb, err := bolt.Open(dbFileName, 0444, nil)\n\tdefer db.Close()\n\n\tif err != nil {\n\t\tlog.ErrLog(err)\n\t}\n\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(BucketName))\n\t\tc := b.Cursor()\n\n\t\tfor k, _ := c.First(); k != nil; k, _ = c.Next() {\n\t\t\tkeys = append(keys, string(k))\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn keys\n}", "func getTableName(object interface{}) string {\n\tstringName := fmt.Sprintf(\"%ss\", strings.ToLower(getType(object)))\n\treturn stringName\n}", "func (ac *AdminClient) Tables(ctx context.Context) ([]string, error) {\n\tctx = metadata.NewContext(ctx, ac.md)\n\tprefix := ac.instancePrefix()\n\treq := &btapb.ListTablesRequest{\n\t\tParent: prefix,\n\t}\n\tres, err := ac.tClient.ListTables(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames := make([]string, 0, len(res.Tables))\n\tfor _, tbl := range res.Tables {\n\t\tnames = append(names, strings.TrimPrefix(tbl.Name, prefix+\"/tables/\"))\n\t}\n\treturn names, nil\n}", "func (c *ModelHandler) HandleGetAllModels(w http.ResponseWriter, r *http.Request) {\n\tvar models []server.Model\n\tstatus := r.URL.Query().Get(\"status\")\n\tfmt.Println(\"status: \", status)\n\tif status != \"\" {\n\t\tmodels, _ = c.ModelService.GetModelsByStatus(status)\n\t} else {\n\t\tmodels, _ = c.ModelService.GetModels()\n\t}\n\n\trender.JSON(w, r, models)\n}", "func (m *MySQLProvider) Tables(schema string) ([]string, error) {\n\tvar (\n\t\ttables []string\n\t\terr error\n\t)\n\n\tif schema == \"\" {\n\t\tif schema, err = m.database(); err != nil {\n\t\t\treturn tables, err\n\t\t}\n\t}\n\n\tquery := &bytes.Buffer{}\n\tquery.WriteString(\"SELECT table_name FROM information_schema.tables \")\n\tquery.WriteString(\"WHERE table_schema = ? and table_type = ? \")\n\tquery.WriteString(\"ORDER BY table_name\")\n\n\trows, err := m.DB.Query(query.String(), schema, \"BASE TABLE\")\n\tif err != nil {\n\t\treturn tables, err\n\t}\n\tdefer func() {\n\t\tif ioErr := rows.Close(); err == nil {\n\t\t\terr = ioErr\n\t\t}\n\t}()\n\n\tfor rows.Next() {\n\t\ttable := \"\"\n\n\t\t_ = rows.Scan(&table)\n\t\ttables = append(tables, table)\n\t}\n\n\treturn tables, nil\n}", "func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tcrud := modules.DB()\n\t\tif err := crud.DeleteTable(ctx, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (srv *PolicyDBServer) ListBaseNames(\n\tctx context.Context,\n\tnetworkId *orcprotos.NetworkID,\n) (*protos.ChargingRuleNameSet, error) {\n\ttable := datastore.GetTableName(networkId.GetId(), CHARGING_RULE_BASE_NAME_TABLE)\n\tkeys, err := srv.store.ListKeys(table)\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn &protos.ChargingRuleNameSet{}, status.Errorf(\n\t\t\tcodes.Aborted, \"Error listing Base Names %s, for network: %s\", err, networkId.GetId())\n\t}\n\treturn &protos.ChargingRuleNameSet{RuleNames: keys}, nil\n}", "func (ch *ClickHouse) GetTables() ([]Table, error) {\n\tvar tables []Table\n\tif err := ch.conn.Select(&tables, \"SELECT database, name, is_temporary, data_path, metadata_path FROM system.tables WHERE database != 'system';\"); err != nil {\n\t\treturn nil, err\n\t}\n\treturn tables, nil\n}", "func (m *ModelProvider) Tables(schema string) ([]string, error) {\n\treturn m.Provider.Tables(schema)\n}", "func SqlserverTables(ctx context.Context, db DB, schema, kind string) ([]*Table, error) {\n\t// query\n\tconst sqlstr = `SELECT ` +\n\t\t`(CASE xtype ` +\n\t\t`WHEN 'U' THEN 'table' ` +\n\t\t`WHEN 'V' THEN 'view' ` +\n\t\t`END) AS type, ` +\n\t\t`name AS table_name ` +\n\t\t`FROM sysobjects ` +\n\t\t`WHERE SCHEMA_NAME(uid) = @p1 ` +\n\t\t`AND (CASE xtype ` +\n\t\t`WHEN 'U' THEN 'table' ` +\n\t\t`WHEN 'V' THEN 'view' ` +\n\t\t`END) = LOWER(@p2)`\n\t// run\n\tlogf(sqlstr, schema, kind)\n\trows, err := db.QueryContext(ctx, sqlstr, schema, kind)\n\tif err != nil {\n\t\treturn nil, logerror(err)\n\t}\n\tdefer rows.Close()\n\t// load results\n\tvar res []*Table\n\tfor rows.Next() {\n\t\tvar t Table\n\t\t// scan\n\t\tif err := rows.Scan(&t.Type, &t.TableName); err != nil {\n\t\t\treturn nil, logerror(err)\n\t\t}\n\t\tres = append(res, &t)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, logerror(err)\n\t}\n\treturn res, nil\n}", "func (o GetDatabasesResultOutput) Names() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetDatabasesResult) []string { return v.Names }).(pulumi.StringArrayOutput)\n}", "func (h *HTTPApi) listDatabase(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tdbs := h.storageNode.Datasources[ps.ByName(\"datasource\")].GetMeta().ListDatabases()\n\n\t// Now we need to return the results\n\tif bytes, err := json.Marshal(dbs); err != nil {\n\t\t// TODO: log this better?\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(bytes)\n\t}\n}", "func (client *SQLResourcesClient) listSQLDatabasesHandleResponse(resp *http.Response) (SQLResourcesClientListSQLDatabasesResponse, error) {\n\tresult := SQLResourcesClientListSQLDatabasesResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseListResult); err != nil {\n\t\treturn SQLResourcesClientListSQLDatabasesResponse{}, err\n\t}\n\treturn result, nil\n}", "func (lbase *Logbase) GetCatalogNames() (names []string, err error) {\n\tvar nscan int = 0 // Number of file objects scanned\n\n\tfindCatalogFile := func(fpath string, fileInfo os.FileInfo, inerr error) (err error) {\n\t\tstat, err := os.Stat(fpath)\n\t\tif err != nil {return}\n\n\t\tif nscan > 0 && stat.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tnscan++\n\n\t\tfname := filepath.Base(fpath)\n\t\tif strings.HasPrefix(fname, CATALOG_FILENAME_PREFIX) {\n\t\t\tcatname := strings.TrimPrefix(fname, CATALOG_FILENAME_PREFIX)\n\t\t\tif catname != MASTER_CATALOG_NAME {\n\t\t\t\tnames = append(names, catname)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\terr = filepath.Walk(lbase.abspath, findCatalogFile)\n\treturn\n}", "func GetControlNames(db *bolt.DB) map[string]string {\n\treturn GetAll(db, ControlNames)\n}", "func GetAllHandler(w http.ResponseWriter,r *http.Request){\n var members []Member\n\n // create connection\n client, err := CreateConnection()\n\tCheck(err)\n\n\t// select db and collection\n\tcHotel := client.Database(database).Collection(collection)\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\t// get all documents\n\tcursor,err := cHotel.Find(ctx, bson.M{})\n\tCheck(err)\n\n\terr = cursor.All(ctx,&members)\n\tCheck(err)\n\n\t// set headers\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Method\", \"GET\")\n\tw.WriteHeader(http.StatusOK)\n\n\t//render template\n\tRenderTemp(w,\"index\",\"base\",members)\n}", "func queryTables(db *sql.DB) ([]string, error) {\n\tvar tables []string\n\n\trows, err := db.Query(\"SHOW FULL TABLES\")\n\tif err != nil {\n\t\treturn tables, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar tableName, tableType string\n\n\t\terr := rows.Scan(&tableName, &tableType)\n\t\tif err != nil {\n\t\t\treturn tables, err\n\t\t}\n\n\t\tif tableType == \"BASE TABLE\" {\n\t\t\ttables = append(tables, tableName)\n\t\t}\n\t}\n\n\treturn tables, nil\n}", "func (m *MockClientInterface) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, filter}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListDatabaseNames\", varargs...)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func doGetAllIpKeys(d *db.DB, dbSpec *db.TableSpec) ([]db.Key, error) {\n\n var keys []db.Key\n\n intfTable, err := d.GetTable(dbSpec)\n if err != nil {\n return keys, err\n }\n\n keys, err = intfTable.GetKeys()\n log.Infof(\"Found %d INTF table keys\", len(keys))\n return keys, err\n}", "func TestHandler_Tables(t *testing.T) {\n\tdb := pie.NewDatabase()\n\th := pie.NewHandler(db)\n\tw := httptest.NewRecorder()\n\n\t// Create tables.\n\tdb.CreateTable(\"bob\", nil)\n\tdb.CreateTable(\"susy\", nil)\n\n\t// Retrieve list of tables.\n\tr, _ := http.NewRequest(\"GET\", \"/tables\", nil)\n\th.ServeHTTP(w, r)\n\n\t// Verify the request was successful.\n\tif w.Code != http.StatusOK {\n\t\tt.Fatalf(\"unexpected status: %d\", w)\n\t} else if !strings.Contains(w.Body.String(), `<li><a href=\"/tables/bob\">bob</a></li>`) {\n\t\tt.Fatalf(\"table 'bob' not found\")\n\t} else if !strings.Contains(w.Body.String(), `<li><a href=\"/tables/susy\">susy</a></li>`) {\n\t\tt.Fatalf(\"table 'susy' not found\")\n\t}\n}", "func (api *packetframeProvider) GetNameservers(domain string) ([]*models.Nameserver, error) {\n\treturn models.ToNameservers(defaultNameServerNames)\n}", "func (d Database) GetAll() ([]string, error) {\n\tif d.connection == nil {\n\t\treturn nil, errors.New(\"connection not initialized\")\n\t}\n\n\tkeys, err := d.connection.Keys(d.ctx, \"*\").Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn keys, nil\n}", "func GetSQLISNames() {\n\tfmt.Printf(\"Executing GetSQLISNames\")\n\n}", "func GetAll(collection string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"GET\" {\n\t\t\tWriteResponseMessage(w, \"this action works only with get method\", \"action works only for Post method\", 400, false)\n\t\t\treturn\n\t\t}\n\t\tresult, err := dbSession.FindAll(collection)\n\n\t\tif err != nil {\n\t\t\tWriteResponseMessage(w, \"error in db connection\", err.Error(), 400, false)\n\t\t\treturn\n\t\t}\n\n\t\tif len(result) < 1 {\n\t\t\tWriteResponseMessage(w, \"no data available\", \"no data available\", 400, false)\n\t\t\treturn\n\t\t}\n\t\tjData, err := json.Marshal(result)\n\t\tif err != nil {\n\t\t\tWriteResponseMessage(w, \"error in reading the result\", err.Error(), 400, false)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(jData)\n\t})\n}", "func GetSQLASNames() {\n\tfmt.Printf(\"Executing GetSQLASNames\")\n\n}", "func LoadAllNames(db gorp.SqlExecutor, store cache.Store, projID int64) (sdk.IDNames, error) {\n\tquery := `SELECT pipeline.id, pipeline.name, pipeline.description\n\t\t\t FROM pipeline\n\t\t\t WHERE project_id = $1\n\t\t\t ORDER BY pipeline.name`\n\n\tvar res sdk.IDNames\n\tif _, err := db.Select(&res, query, projID); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn res, nil\n\t\t}\n\t\treturn nil, sdk.WrapError(err, \"application.loadpipelinenames\")\n\t}\n\n\treturn res, nil\n}", "func GetAllTables() []*table.Table {\n\treturn []*table.Table{SingleMetricTable}\n}", "func (mh *MetadataHandler) HandleGetAllMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tres, err := mh.Repository.GetAll()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\treturn\n\t}\n\tif res == nil {\n\t\t// no resources found\n\t\tw.WriteHeader(http.StatusNotFound) // 404\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK) // 200\n\tyaml.NewEncoder(w).Encode(res)\n}", "func DBTableIter(ctx *Context, db Database, cb func(Table) (cont bool, err error)) error {\n\tnames, err := db.GetTableNames(ctx)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range names {\n\t\ttbl, ok, err := db.GetTableInsensitive(ctx, name)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if !ok {\n\t\t\treturn ErrTableNotFound.New(name)\n\t\t}\n\n\t\tcont, err := cb(tbl)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !cont {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetAllUsers(dbmap *gorp.DbMap) func(w http.ResponseWriter, r *http.Request) {\n\n return usersHandler(nil, func(r *http.Request) *[]models.User {\n var users []models.User\n _, dbError := dbmap.Select(&users, \"select * from \\\"user\\\"\")\n if dbError != nil {\n log.Print(dbError)\n }\n\n return &users\n })\n\n}", "func (client GroupClient) ListTablesSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func GetSQLRSNames() {\n\tfmt.Printf(\"Executing GetSQLRSNames\")\n\n}", "func GetTableDBMap(ctx context.Context) model.TableDBMap {\n\tinfo := GetDBInfo(ctx)\n\n\ttbMap := map[string][]string{}\n\n\tfor _, h := range info.Hosts {\n\t\tfor _, db := range h.Databases {\n\t\t\tfor _, tb := range db.Tables {\n\t\t\t\ttDbs := []string{}\n\t\t\t\tif v, ok := tbMap[tb]; ok {\n\t\t\t\t\ttDbs = v\n\t\t\t\t}\n\t\t\t\ttDbs = append(tDbs, db.Name)\n\t\t\t\ttbMap[tb] = tDbs\n\t\t\t}\n\t\t}\n\t}\n\n\treturn model.TableDBMap(tbMap)\n}", "func (a *DatabaseTablesApiService) ListDatabaseTablesExecute(r ApiListDatabaseTablesRequest) ([]Table, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []Table\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DatabaseTablesApiService.ListDatabaseTables\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/database/tables/database/{database_id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"database_id\"+\"}\", url.PathEscape(parameterValueToString(r.databaseId, \"databaseId\")), -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\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 := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.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 GetDatabaseTableField400Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\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 ListDatabaseTables404Response\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\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\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}", "func (c *Client) GetColumns(dbTableName string) (columns []string, err error) {\n\ttype describeTable struct {\n\t\tData []map[string]string `json:\"data\"`\n\t}\n\n\tvar desc describeTable\n\n\terr = c.Do(http.MethodGet, nil, \"applicaiton/json\", &desc, \"/?query=DESCRIBE%%20%s%%20FORMAT%%20JSON\", dbTableName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get describe of %s: %v\", dbTableName, err)\n\t}\n\n\tfor _, column := range desc.Data {\n\t\tfor key, value := range column {\n\t\t\tif key == \"name\" {\n\t\t\t\tcolumns = append(columns, value)\n\t\t\t}\n\t\t}\n\t}\n\treturn columns, nil\n}", "func generateHandler(w http.ResponseWriter, r *http.Request) {\n\ttableName := r.URL.Path[len(\"/\"):]\n\trows := sqlToJson.GetRows(username, password, environment, tableName)\n\tfmt.Printf(\"%s\", sqlToJson.MakeJsonByteArray(rows))\n}", "func runListDB(cmd *cobra.Command) {\n\tcmd.Println(\"Getting Set List\")\n\n\tnames, err := query.GetNames(\"\", conn)\n\tif err != nil {\n\t\tcmd.Println(\"Getting Set List : \", err)\n\t\treturn\n\t}\n\n\tcmd.Println(\"\")\n\n\tfor _, name := range names {\n\t\tcmd.Println(name)\n\t}\n\n\tcmd.Println(\"\")\n}", "func (m *FileSource) Tables() []string { return m.tablenames }", "func (lc LowerCaseConvention) TableName(typeName string) string {\n\treturn lc.Convert(typeName)\n}", "func (lt *ListTables) All() ([]string, error) {\n\tctx, cancel := defaultContext()\n\tdefer cancel()\n\treturn lt.AllWithContext(ctx)\n}", "func (d *DynamoDBMetastore) GetTableName() string {\n\treturn d.tableName\n}", "func (th *TableHandler) EmptyTables(c echo.Context) (err error) {\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\t// Query database\n\terr = th.dbSvc.EmptyTables(c.Request().Context())\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Return ok\n\treturn c.JSON(http.StatusOK, \"Tables emptied!\")\n}", "func (c *TypeRessource) TableName() string {\n\treturn \"typeressources\"\n}", "func (sc SnakeCaseConvention) TableName(typeName string) string {\n\treturn sc.Convert(typeName)\n}" ]
[ "0.62497705", "0.57808363", "0.5736392", "0.56477576", "0.56258976", "0.5623935", "0.5459001", "0.5458035", "0.5439536", "0.5350748", "0.53380686", "0.5328151", "0.5307771", "0.5295626", "0.5273486", "0.5226321", "0.52094626", "0.52069426", "0.5204705", "0.5194583", "0.51853234", "0.5172572", "0.5156829", "0.51553434", "0.51533943", "0.51345503", "0.5119488", "0.5109702", "0.50952345", "0.5085565", "0.50557286", "0.503938", "0.50181973", "0.5015942", "0.50087124", "0.49895254", "0.4985539", "0.49792877", "0.49695733", "0.49688798", "0.49672374", "0.4962188", "0.49569833", "0.49544114", "0.49285543", "0.49051398", "0.4896355", "0.489375", "0.4883562", "0.48815814", "0.48788896", "0.4866448", "0.48658493", "0.48608887", "0.4842892", "0.48368925", "0.48272556", "0.4811775", "0.48115328", "0.48028314", "0.4802028", "0.48003256", "0.47967625", "0.47867322", "0.47831753", "0.47819912", "0.47565094", "0.47502077", "0.47475132", "0.4741241", "0.4737427", "0.47301152", "0.47296974", "0.47279957", "0.47258037", "0.4717849", "0.47133452", "0.4693258", "0.4685001", "0.46822435", "0.46813804", "0.46738875", "0.4666842", "0.46644565", "0.4653298", "0.46531993", "0.46511012", "0.4645398", "0.46448144", "0.46290866", "0.46278605", "0.4618087", "0.46173233", "0.4615115", "0.4610536", "0.46076828", "0.46043152", "0.45984703", "0.45966697", "0.45946637" ]
0.8256925
0
HandleGetDatabaseConnectionState gives the status of connection state of client
func HandleGetDatabaseConnectionState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] crud := modules.DB() connState := crud.GetConnectionState(ctx, dbAlias) _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: connState}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ConnConnectionState(c *tls.Conn,) tls.ConnectionState", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetConnectionState() string {\n\tif o == nil || o.ConnectionState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ConnectionState\n}", "func (m *ExternalConnection) GetState()(*ConnectionState) {\n return m.state\n}", "func (cli *FakeDatabaseClient) CheckDatabaseState(ctx context.Context, in *dbdpb.CheckDatabaseStateRequest, opts ...grpc.CallOption) (*dbdpb.CheckDatabaseStateResponse, error) {\n\tpanic(\"implement me\")\n}", "func (cc *ClientConn) GetState() connectivity.State {\n\treturn cc.csMgr.getState()\n}", "func (c *Client) GetState() string {\n\treturn c.conn.GetState().String()\n}", "func (q *worldstateQueryProcessor) getDBStatus(dbName string) (*types.GetDBStatusResponse, error) {\n\t// ACL is meaningless here as this call is to check whether a DB exist. Even with ACL,\n\t// the user can infer the information.\n\treturn &types.GetDBStatusResponse{\n\t\tExist: q.isDBExists(dbName),\n\t}, nil\n}", "func (c *Client) TLSConnectionState() (state tls.ConnectionState, ok bool) {\n\ttc, ok := c.conn.(*tls.Conn)\n\tif !ok {\n\t\treturn\n\t}\n\treturn tc.ConnectionState(), true\n}", "func (database *SqlDatabase) GetStatus() genruntime.ConvertibleStatus {\n\treturn &database.Status\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetConnectionStateOk() (*string, bool) {\n\tif o == nil || o.ConnectionState == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ConnectionState, true\n}", "func (c *Conn) TLSConnectionState() (state tls.ConnectionState, ok bool) {\n\ttc, ok := c.conn.(*tls.Conn)\n\tif !ok {\n\t\treturn\n\t}\n\treturn tc.ConnectionState(), true\n}", "func GetConnectionState(startTLSType, connectName, connectTo, clientCert, clientKey string) (*tls.ConnectionState, error) {\n\tvar state *tls.ConnectionState\n\tvar err error\n\tvar tlsConfig *tls.Config\n\n\tswitch startTLSType {\n\tcase \"postgres\", \"psql\":\n\t\t// No tlsConfig needed for postgres, but all others do.\n\tdefault:\n\t\ttlsConfig, err = tlsConfigForConnect(connectName, clientCert, clientKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tswitch startTLSType {\n\tcase \"\":\n\t\tconn, err := tls.Dial(\"tcp\", connectTo, tlsConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error connecting: %v\\n\", err)\n\t\t}\n\t\tdefer conn.Close()\n\t\ts := conn.ConnectionState()\n\t\tstate = &s\n\tcase \"ldap\":\n\t\tl, err := ldap.Dial(\"tcp\", connectTo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer l.Close()\n\n\t\terr = l.StartTLS(tlsConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstate, err = l.TLSConnectionState()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"LDAP Connection isn't TLS after we successfully called StartTLS (%s)\", err.Error()))\n\t\t}\n\tcase \"mysql\":\n\t\tmysql.RegisterTLSConfig(\"certigo\", tlsConfig)\n\t\tstate, err = mysql.DumpTLS(fmt.Sprintf(\"certigo@tcp(%s)/?tls=certigo\", connectTo))\n\tcase \"postgres\", \"psql\":\n\t\t// Setting sslmode to \"require\" skips verification.\n\t\turl := fmt.Sprintf(\"postgres://certigo@%s/?sslmode=require\", connectTo)\n\t\tif clientCert != \"\" {\n\t\t\turl += fmt.Sprintf(\"&sslcert=%s\", clientCert)\n\t\t}\n\t\tif clientKey != \"\" {\n\t\t\turl += fmt.Sprintf(\"&sslkey=%s\", clientCert)\n\t\t}\n\t\tstate, err = pq.DumpTLS(url)\n\tcase \"smtp\":\n\t\tclient, err := smtp.Dial(connectTo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = client.StartTLS(tlsConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsmtpState, ok := client.TLSConnectionState()\n\t\tif !ok {\n\t\t\tpanic(\"SMTP Connection isn't TLS after we successfully called StartTLS\")\n\t\t}\n\t\tstate = &smtpState\n\tcase \"ftp\":\n\t\tstate, err = dumpAuthTLSFromFTP(connectTo, tlsConfig)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"error connecting: unknown StartTLS protocol '%s'\\n\", startTLSType)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error connecting: %v\\n\", err)\n\t}\n\n\treturn state, nil\n}", "func (o LookupCustomKeyStoreResultOutput) ConnectionState() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupCustomKeyStoreResult) string { return v.ConnectionState }).(pulumi.StringOutput)\n}", "func (c *Client) GetState() connectivity.State {\n\treturn c.grpcClient.GetState()\n}", "func (a *Agent) dbState() (_DBState, error) {\n\tswitch mode := viper.GetString(config.KeyPGMode); mode {\n\tcase \"primary\":\n\t\treturn _DBStatePrimary, nil\n\tcase \"follower\":\n\t\treturn _DBStateFollower, nil\n\tcase \"auto\":\n\t\tbreak\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid mode: %q\", mode))\n\t}\n\n\tvar inRecovery bool\n\tif err := a.pool.QueryRowEx(a.shutdownCtx, \"SELECT pg_is_in_recovery()\", nil).Scan(&inRecovery); err != nil {\n\t\treturn _DBStateUnknown, errors.Wrap(err, \"unable to execute primary check\")\n\t}\n\n\tswitch inRecovery {\n\tcase true:\n\t\tmetrics.DBStats.DBState.Set(\"follower\")\n\t\treturn _DBStateFollower, nil\n\tcase false:\n\t\tmetrics.DBStats.DBState.Set(\"primary\")\n\t\treturn _DBStatePrimary, nil\n\tdefault:\n\t\tpanic(\"what is logic?\")\n\t}\n}", "func (c *Client) State() ConnState {\n\treturn c.state\n}", "func (p RPCServer) GetConnectionStatus(ctx context.Context, in *empty.Empty) (*pb.ConnectionStatus, error) {\n\treturn &pb.ConnectionStatus{Connected: p.service.IsConnected()}, nil\n}", "func (c *Conn) State() State {\n\treturn c.state\n}", "func (c *Connection) GetState() State {\n\treturn c.state\n}", "func (p *BeeswaxServiceClient) GetState(handle *QueryHandle) (r QueryState, err error) {\n\tif err = p.sendGetState(handle); err != nil {\n\t\treturn\n\t}\n\treturn p.recvGetState()\n}", "func (o EndpointAttachmentOutput) ConnectionState() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.ConnectionState }).(pulumi.StringOutput)\n}", "func (d *ReplicaAPI) GetReplicaState(c *gin.Context) {\n\tvar param struct {\n\t\tDB string `form:\"db\" binding:\"required\"`\n\t}\n\terr := c.ShouldBindQuery(&param)\n\tif err != nil {\n\t\thttppkg.Error(c, err)\n\t\treturn\n\t}\n\trs := d.walMgr.GetReplicaState(param.DB)\n\thttppkg.OK(c, rs)\n}", "func DBCheck(next http.HandlerFunc) http.HandlerFunc {\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tif db.ConnectionCheck() == 0 {\n\t\t\thttp.Error(w, \"DB Connection lost.\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\n\t}\n\n}", "func (m *CloudPcConnection) GetHealthCheckStatus()(*string) {\n val, err := m.GetBackingStore().Get(\"healthCheckStatus\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func getDatabaseConnection(c context.Context) (*sql.DB, error) {\n\t// Update the database pointer if the database settings have changed. This operation is costly, but should be rare.\n\t// Done here to ensure that a connection established with an outdated connection string is closed as soon as possible.\n\tsettings, err := settings.Get(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconnectionString := fmt.Sprintf(\"%s:%s@cloudsql(%s)/%s\", settings.Username, settings.Password, settings.Server, settings.Database)\n\n\t// If the connection string matches what we expect, the current pointer is correct so just return it.\n\tdbLock.RLock()\n\tif connectionString == dbConnectionString {\n\t\tdefer dbLock.RUnlock()\n\t\treturn db, nil\n\t}\n\tdbLock.RUnlock()\n\n\t// The connection string doesn't match so the db pointer needs to be created or updated.\n\tdbLock.Lock()\n\tdefer dbLock.Unlock()\n\n\t// Releasing the read lock may have allowed another concurrent request to grab the write lock first so it's\n\t// possible we no longer need to do anything. Check again while holding the write lock.\n\tif connectionString == dbConnectionString {\n\t\treturn db, nil\n\t}\n\n\tif db != nil {\n\t\tif err := db.Close(); err != nil {\n\t\t\tlogging.Warningf(c, \"Failed to close the previous database connection: %s\", err.Error())\n\t\t}\n\t}\n\tdb, err = sql.Open(\"mysql\", connectionString)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open a new database connection: %s\", err.Error())\n\t}\n\n\t// AppEngine limit.\n\tdb.SetMaxOpenConns(12)\n\tdbConnectionString = connectionString\n\treturn db, nil\n}", "func (extDb *Database) checkStatus() error {\n\tif atomic.LoadInt32(&extDb.isReady) == cDatabaseStateReconnect {\n\t\treturn ErrReconInProcess\n\t}\n\tdb := extDb.getDb()\n\tif atomic.LoadInt32(&extDb.isReady) == cDatabaseStateNotReady || db == nil {\n\t\tif err := extDb.Reconnect(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (ConnectionState) Values() []ConnectionState {\n\treturn []ConnectionState{\n\t\t\"CREATING\",\n\t\t\"UPDATING\",\n\t\t\"DELETING\",\n\t\t\"AUTHORIZED\",\n\t\t\"DEAUTHORIZED\",\n\t\t\"AUTHORIZING\",\n\t\t\"DEAUTHORIZING\",\n\t}\n}", "func (consensus *Consensus) getConsensusStateMessageHandler(remoteMessage *node.RemoteMessage) ([]byte, bool, error) {\n\tledgerHeight := ledger.DefaultLedger.Store.GetHeight()\n\tledgerBlockHash := ledger.DefaultLedger.Store.GetHeaderHashByHeight(ledgerHeight)\n\tconsensusHeight := consensus.GetExpectedHeight()\n\tsyncState := consensus.localNode.GetSyncState()\n\n\treplyMsg, err := NewGetConsensusStateReply(ledgerHeight, ledgerBlockHash, consensusHeight, syncState)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\treplyBuf, err := consensus.localNode.SerializeMessage(replyMsg, true)\n\treturn replyBuf, false, err\n}", "func (rpcServer RpcServer) handleGetConnectionCount(params interface{}, closeChan <-chan struct{}) (interface{}, *RPCError) {\n\tLogger.log.Infof(\"handleGetConnectionCount params: %+v\", params)\n\tif rpcServer.config.ConnMgr == nil || rpcServer.config.ConnMgr.ListeningPeer == nil {\n\t\treturn 0, nil\n\t}\n\tresult := 0\n\tlisteningPeer := rpcServer.config.ConnMgr.ListeningPeer\n\tresult += len(listeningPeer.PeerConns)\n\tLogger.log.Infof(\"handleGetConnectionCount result: %+v\", result)\n\treturn result, nil\n}", "func (e *Engine) GetPeerConnectionStatus(peerKey string) *Status {\n\te.peerMux.Lock()\n\tdefer e.peerMux.Unlock()\n\n\tconn, exists := e.conns[peerKey]\n\tif exists && conn != nil {\n\t\treturn &conn.Status\n\t}\n\n\treturn nil\n}", "func (container *SqlDatabaseContainer) GetStatus() genruntime.ConvertibleStatus {\n\treturn &container.Status\n}", "func StatusCheck(ctx context.Context, db *DB) error {\n\tctx, span := otel.Tracer(\"database\").Start(ctx, \"foundation.database.statuscheck\")\n\tdefer span.End()\n\n\t// First check we can ping the database.\n\tvar pingError error\n\tfor attempts := 1; ; attempts++ {\n\t\tpingError = db.Ping(ctx)\n\t\tif pingError == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Duration(attempts) * 100 * time.Millisecond)\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n\n\t// Make sure we didn't timeout or be cancelled.\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\t// Run a simple query to determine connectivity. Running this query forces\n\t// a round trip to the database.\n\tconst q = `SELECT true`\n\tvar tmp bool\n\treturn db.QueryRow(ctx, q).Scan(&tmp)\n}", "func onDatabaseConfig(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\trequires := getDBLocalProxyRequirement(tc, database)\n\t// \"tsh db config\" prints out instructions for native clients to connect to\n\t// the remote proxy directly. Return errors here when direct connection\n\t// does NOT work (e.g. when ALPN local proxy is required).\n\tif requires.localProxy {\n\t\tmsg := formatDbCmdUnsupported(cf, database, requires.localProxyReasons...)\n\t\treturn trace.BadParameter(msg)\n\t}\n\n\thost, port := tc.DatabaseProxyHostPort(*database)\n\trootCluster, err := tc.RootClusterName(cf.Context)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tformat := strings.ToLower(cf.Format)\n\tswitch format {\n\tcase dbFormatCommand:\n\t\tcmd, err := dbcmd.NewCmdBuilder(tc, profile, database, rootCluster,\n\t\t\tdbcmd.WithPrintFormat(),\n\t\t\tdbcmd.WithLogger(log),\n\t\t).GetConnectCommand()\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(strings.Join(cmd.Env, \" \"), cmd.Path, strings.Join(cmd.Args[1:], \" \"))\n\tcase dbFormatJSON, dbFormatYAML:\n\t\tconfigInfo := &dbConfigInfo{\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName),\n\t\t\tprofile.KeyPath(),\n\t\t}\n\t\tout, err := serializeDatabaseConfig(configInfo, format)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(out)\n\tdefault:\n\t\tfmt.Printf(`Name: %v\nHost: %v\nPort: %v\nUser: %v\nDatabase: %v\nCA: %v\nCert: %v\nKey: %v\n`,\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName), profile.KeyPath())\n\t}\n\treturn nil\n}", "func (p *proxy) checkState() error {\n\tp.adminConn.writeCmd(\"CLUSTER INFO\")\n\treply, err := p.adminConn.readReply()\n\tif err != nil {\n\t\treturn err\n\t}\n\treply_body := reply.([]uint8)\n\tfor _, line := range strings.Split(string(reply_body), \"\\r\\n\") {\n\t\tline_arr := strings.Split(line, \":\")\n\t\tif line_arr[0] == \"cluster_state\" {\n\t\t\tif line_arr[1] != \"ok\" {\n\t\t\t\treturn protocolError(string(reply_body))\n\t\t\t} else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\treturn protocolError(\"checkState should never run up to here\")\n}", "func status() {\n\tgetDBVersion()\n}", "func (cs ClientState) VerifyConnectionState(\n\tstore sdk.KVStore,\n\tcdc codec.Marshaler,\n\t_ uint64,\n\tprefix commitmentexported.Prefix,\n\t_ []byte,\n\tconnectionID string,\n\tconnectionEnd connectionexported.ConnectionI,\n\t_ clientexported.ConsensusState,\n) error {\n\tpath, err := commitmenttypes.ApplyPrefix(prefix, host.ConnectionPath(connectionID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbz := store.Get([]byte(path.String()))\n\tif bz == nil {\n\t\treturn sdkerrors.Wrapf(clienttypes.ErrFailedConnectionStateVerification, \"not found for path %s\", path)\n\t}\n\n\tvar prevConnection connectiontypes.ConnectionEnd\n\terr = cdc.UnmarshalBinaryBare(bz, &prevConnection)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif connectionEnd != &prevConnection {\n\t\treturn sdkerrors.Wrapf(\n\t\t\tclienttypes.ErrFailedConnectionStateVerification,\n\t\t\t\"connection end ≠ previous stored connection: \\n%v\\n≠\\n%v\", connectionEnd, prevConnection,\n\t\t)\n\t}\n\n\treturn nil\n}", "func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tdbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func GetDBConnection(databaseURL string) (*sql.DB, error) {\n var db *sql.DB\n appEnv, err := cfenv.Current()\n if err != nil {\n db, err = sql.Open(\"mysql\", databaseURL+\"?parseTime=true\")\n if err != nil {\n return nil, err\n }\n } else {\n mysqlEnv, err := appEnv.Services.WithName(\"hero-mysql\")\n if err != nil {\n return nil, err\n }\n mysqlPort := \"\"\n if val, ok := mysqlEnv.Credentials[\"port\"].(string); ok {\n mysqlPort = val\n } else {\n mysqlPort = strconv.FormatFloat(mysqlEnv.Credentials[\"port\"].(float64), 'f', -1, 64)\n }\n db, err = sql.Open(\"mysql\", mysqlEnv.Credentials[\"username\"].(string)+\":\"+mysqlEnv.Credentials[\"password\"].(string)+\"@tcp(\"+mysqlEnv.Credentials[\"hostname\"].(string)+\":\"+mysqlPort+\")/\"+mysqlEnv.Credentials[\"name\"].(string)+\"?parseTime=true\")\n if err != nil {\n return nil, err\n }\n }\n\n err = db.Ping()\n if err != nil {\n db.Close()\n return nil, err\n }\n\n return db, nil\n}", "func getDBHandle() (*sql.DB, error) {\n\t\n\tconnectionString := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\tglobal_cfg.Database.Host,\n\t\tglobal_cfg.Database.Port,\n\t\tglobal_cfg.Database.User,\n\t\tglobal_cfg.Database.Password,\n\t\tglobal_cfg.Database.DBName)\n\n\tcontext, err := sql.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\terr = context.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn context, err\n}", "func CheckConnectionDB() int {\n\terr := MongoCN.Ping(context.TODO(), nil)\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn 1\n}", "func newConnectionState(factory ZookeeperFactory, ensembleProvider ensemble.Provider, sessionTimeout time.Duration, connectionTimeout time.Duration) *connState {\n\treturn &connState{\n\t\tparentWatchers: events.New(),\n\t\tconn: &connHandle{factory: factory, ensembleProvider: ensembleProvider, sessionTimeout: sessionTimeout},\n\t\tconnectionTimeout: connectionTimeout,\n\t\terrorQueue: list.New(),\n\t}\n}", "func (o NetworkManagerScopeConnectionOutput) ConnectionState() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkManagerScopeConnection) pulumi.StringOutput { return v.ConnectionState }).(pulumi.StringOutput)\n}", "func testDBConnection(conn *TestConnection) TestConnectionResponse {\n\tconnectionString := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\"password=%s dbname=%s sslmode=disable\",\n\t\tconn.Host,\n\t\tconn.Port,\n\t\tconn.User,\n\t\tconn.Password,\n\t\tconn.DBName)\n\n\t// Response object\n\tvar response TestConnectionResponse\n\tresponse.Valid = true\n\n\tcontext, err := sql.Open(\"postgres\", connectionString)\n\tif (err != nil) {\n\t\tresponse.Valid = false\n\t\treturn response\n\t}\n\t\t\n\terr = context.Ping()\n\tif (err != nil) {\n\t\tresponse.Valid = false\n\t\treturn response\n\t}\n\n\treturn response\n}", "func (c *Client) GetState() (int, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), c.rpcTimeout)\n\tdefer cancel()\n\treq := &pb.EmptyReq{}\n\tres, err := c.rpcClient.GetState(ctx, req)\n\treturn int(res.GetState()), err\n}", "func (a API) GetConnectionCountChk() (isNew bool) {\n\tselect {\n\tcase o := <-a.Ch.(chan GetConnectionCountRes):\n\t\tif o.Err != nil {\n\t\t\ta.Result = o.Err\n\t\t} else {\n\t\t\ta.Result = o.Res\n\t\t}\n\t\tisNew = true\n\tdefault:\n\t}\n\treturn\n}", "func (db *DatabaseClient) GetDatabaseInfo(ctx context.Context, databasePath string) (*DatabaseInfo, error) {\n\tvar databaseInfo DatabaseInfo\n\tdatabaseInfo.Path = databasePath\n\n\tgetDatabaseRequest := &databasepb.GetDatabaseRequest{\n\t\tName: databasePath,\n\t}\n\n\tresp, err := db.databaseAdminClient.GetDatabase(ctx, getDatabaseRequest)\n\tif err != nil {\n\t\treturn &databaseInfo, fmt.Errorf(\"DatabaseAdminClient.GetDatabase(%v) error: %v\", databasePath, err)\n\t}\n\tlogDatabaseStateLoad(ctx, databasePath)\n\n\tdatabaseInfo.State = resp.GetState().String()\n\n\ttc, err := NewTableClient(ctx, databasePath)\n\tif err != nil {\n\t\treturn &databaseInfo, err\n\t}\n\n\tif ctx.Value(\"no-tables\") == false {\n\t\ttables, err := tc.GetTableInfos(ctx)\n\t\tif err != nil {\n\t\t\treturn &databaseInfo, err\n\t\t}\n\t\tdatabaseInfo.Tables = tables\n\t}\n\n\treturn &databaseInfo, nil\n}", "func (c *client) DatabaseVersion(ctx context.Context) (driver.Version, error) {\n\turl := c.createURL(\"/database-version\", nil)\n\n\tvar result DatabaseVersionResponse\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn \"\", maskAny(err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn \"\", maskAny(err)\n\t}\n\tif err := c.handleResponse(resp, \"GET\", url, &result); err != nil {\n\t\treturn \"\", maskAny(err)\n\t}\n\n\treturn result.Version, nil\n}", "func (p *peer) Status() tmconn.ConnectionStatus {\r\n\treturn p.mconn.Status()\r\n}", "func TestDbConnection(username, password, hostname, database, instance, port string) (string, error) {\n\tquery := url.Values{}\n\tquery.Add(\"database\", database)\n\tquery.Add(\"port\", port)\n\n\tu := &url.URL{\n\t\tScheme: \"sqlserver\",\n\t\tUser: url.UserPassword(username, password),\n\t\tHost: hostname,\n\t\tRawQuery: query.Encode(),\n\t}\n\tif instance != \"\" {\n\t\tu.Path = instance\n\t}\n\n\tcondb, errdb := sql.Open(\"mssql\", u.String())\n\tif errdb != nil {\n\t\treturn \"\", errdb\n\t}\n\n\tdefer condb.Close()\n\n\tvar sqlversion string\n\n\trows, err := condb.Query(\"select @@version\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor rows.Next() {\n\t\terr := rows.Scan(&sqlversion)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn sqlversion, nil\n\t}\n\treturn \"\", errors.New(\"No rows returned\")\n}", "func GetCompleteDatabaseVersion() (dbVersion, dbFlag int, err error) {\n\tversionTableExists, err := doesTableExist(\"database_version\")\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tif versionTableExists {\n\t\tdatabaseVersion, versionError := getDatabaseVersion(GochanVersionKeyConstant)\n\t\tif versionError != nil {\n\t\t\treturn 0, 0, ErrInvalidVersion\n\t\t}\n\t\tif databaseVersion < targetDatabaseVersion {\n\t\t\treturn databaseVersion, DBModernButBehind, nil\n\t\t}\n\t\tif databaseVersion > targetDatabaseVersion {\n\t\t\treturn databaseVersion, DBModernButAhead, nil\n\t\t}\n\t\treturn databaseVersion, DBUpToDate, nil\n\t}\n\tisOldDesign, err := doesTableExist(\"info\")\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tif isOldDesign {\n\t\treturn 0, DBIsPreApril, nil\n\t}\n\t//No old or current database versioning tables found.\n\tif config.Config.DBprefix != \"\" {\n\t\t//Check if any gochan tables exist\n\t\tgochanTableExists, err := doesGochanPrefixTableExist()\n\t\tif err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t\tif gochanTableExists {\n\t\t\treturn 0, DBCorrupted, nil\n\t\t}\n\t}\n\treturn 0, DBClean, nil\n}", "func (c *HWStatsHandler) GetConnectionCount() int {\n\tc.mutex.RLock()\n\tval := c.connCount\n\tc.mutex.RUnlock()\n\n\treturn val\n}", "func onDatabaseEnv(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif !dbprofile.IsSupported(*database) {\n\t\treturn trace.BadParameter(formatDbCmdUnsupportedDBProtocol(cf, database))\n\t}\n\trequires := getDBLocalProxyRequirement(tc, database)\n\tif requires.localProxy {\n\t\treturn trace.BadParameter(formatDbCmdUnsupported(cf, database, requires.localProxyReasons...))\n\t}\n\n\tenv, err := dbprofile.Env(tc, *database)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tformat := strings.ToLower(cf.Format)\n\tswitch format {\n\tcase dbFormatText, \"\":\n\t\tfor k, v := range env {\n\t\t\tfmt.Printf(\"export %v=%v\\n\", k, v)\n\t\t}\n\tcase dbFormatJSON, dbFormatYAML:\n\t\tout, err := serializeDatabaseEnvironment(env, format)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(out)\n\tdefault:\n\t\treturn trace.BadParameter(\"unsupported format %q\", cf.Format)\n\t}\n\n\treturn nil\n}", "func NewDatabase(client *mongo.Client) *mongo.Database {\n\treturn client.Database(\"service_state\")\n}", "func GetDBVersion(conf *DBConf) (int64, error) {\n\n\tdb, err := OpenDBFromDBConf(conf)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tdefer db.Close()\n\n\tversion, err := EnsureDBVersion(conf, db)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn version, nil\n}", "func isConnected(db *sql.DB) bool {\n\treturn db.Ping() == nil\n}", "func GetDatabaseConnection(env string) string {\n\tswitch env {\n\tcase \"development\":\n\t\treturn developmentDBConString\n\tcase \"test\":\n\t\treturn testDBString\n\tdefault:\n\t\treturn developmentDBConString\n\t}\n}", "func CheckDB(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif bd.CheckConnection() == false {\n\t\t\thttp.Error(w, \"Lost database connection\", 500)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "func (_DelegationController *DelegationControllerCaller) GetState(opts *bind.CallOpts, delegationId *big.Int) (uint8, error) {\n\tvar (\n\t\tret0 = new(uint8)\n\t)\n\tout := ret0\n\terr := _DelegationController.contract.Call(opts, out, \"getState\", delegationId)\n\treturn *ret0, err\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) HasConnectionState() bool {\n\tif o != nil && o.ConnectionState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func getSwitch(db *sql.DB) (int, error) {\n\tvar result int\n\tquery := fmt.Sprintf(\"SELECT %s FROM %s LIMIT 1\", config.SwitchDBCol, config.SwitchDBTable)\n\tif err := db.QueryRow(query).Scan(&result); err != nil {\n\t\treturn -1, err\n\t}\n\treturn result, nil\n}", "func (db *StakeDatabase) DBState() (uint32, *chainhash.Hash, error) {\n\tdb.nodeMtx.RLock()\n\tdefer db.nodeMtx.RUnlock()\n\n\treturn db.dbState()\n}", "func onDatabaseConnect(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\troute, database, err := getDatabaseInfo(cf, tc, cf.DatabaseService)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif route.Protocol == defaults.ProtocolDynamoDB {\n\t\treturn trace.BadParameter(formatDbCmdUnsupportedDBProtocol(cf, route))\n\t}\n\n\trequires := getDBLocalProxyRequirement(tc, route, withConnectRequirements(cf.Context, tc, route))\n\tif err := maybeDatabaseLogin(cf, tc, profile, route, requires); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\trootClusterName, err := tc.RootClusterName(cf.Context)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\t// To avoid termination of background DB teleport proxy when a SIGINT is received don't use the cf.Context.\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\topts, err := maybeStartLocalProxy(ctx, cf, tc, profile, route, database, rootClusterName, requires)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\topts = append(opts, dbcmd.WithLogger(log))\n\n\tif opts, err = maybeAddDBUserPassword(database, opts); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tbb := dbcmd.NewCmdBuilder(tc, profile, route, rootClusterName, opts...)\n\tcmd, err := bb.GetConnectCommand()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tlog.Debug(cmd.String())\n\n\tcmd.Stdout = os.Stdout\n\tcmd.Stdin = os.Stdin\n\n\t// Use io.MultiWriter to duplicate stderr to the capture writer. The\n\t// captured stderr can be used for diagnosing command failures. The capture\n\t// writer captures up to a fixed number to limit memory usage.\n\tpeakStderr := utils.NewCaptureNBytesWriter(dbcmd.PeakStderrSize)\n\tcmd.Stderr = io.MultiWriter(os.Stderr, peakStderr)\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\treturn dbcmd.ConvertCommandError(cmd, err, string(peakStderr.Bytes()))\n\t}\n\treturn nil\n}", "func getDbClient(connectionInfo string) *sqlx.DB {\n\n\t// dataSource := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", dbUser, dbPasswd, dbAddr, dbPort, dbName)\n\n\tclient, err := sqlx.Open(\"mysql\", connectionInfo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = client.Ping(); err != nil {\n\t\tpanic(err)\n\t}\n\t// See \"Important settings\" section.\n\tclient.SetConnMaxLifetime(time.Minute * 3)\n\tclient.SetMaxOpenConns(10)\n\tclient.SetMaxIdleConns(10)\n\treturn client\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func GetState(conn db.Connection, channel string) (State, error) {\n\tvar state State\n\n\tif testStateLoadError != nil {\n\t\treturn state, testStateLoadError\n\t}\n\n\terr := db.Get(conn, StateKey(channel), &state)\n\treturn state, err\n}", "func (s *Server) getConnection() {\n\n\terr := s.db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(\"Could not ping db: \", err.Error())\n\t}\n\tlog.Println(\"Ping successful\")\n}", "func DBClient() driver.Client {\n\tclient := GetState(\"dbClient\")\n\treturn client.(driver.Client)\n}", "func (client GroupClient) GetDatabaseResponder(resp *http.Response) (result USQLDatabase, 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}", "func QueryClientState(\n\tclientCtx client.Context, clientID string, prove bool,\n) (types.StateResponse, error) {\n\treq := abci.RequestQuery{\n\t\tPath: \"store/ibc/key\",\n\t\tData: host.FullKeyClientPath(clientID, host.KeyClientState()),\n\t\tProve: prove,\n\t}\n\n\tres, err := clientCtx.QueryABCI(req)\n\tif err != nil {\n\t\treturn types.StateResponse{}, err\n\t}\n\n\tvar clientState exported.ClientState\n\tif err := clientCtx.Codec.UnmarshalBinaryBare(res.Value, &clientState); err != nil {\n\t\treturn types.StateResponse{}, err\n\t}\n\n\tclientStateRes := types.NewClientStateResponse(clientID, clientState, res.Proof, res.Height)\n\n\treturn clientStateRes, nil\n}", "func (hc *LegacyHealthCheckImpl) GetConnection(key string) queryservice.QueryService {\n\thc.mu.Lock()\n\tdefer hc.mu.Unlock()\n\n\tth := hc.addrToHealth[key]\n\tif th == nil {\n\t\treturn nil\n\t}\n\treturn th.conn\n}", "func (s *System) connState(c net.Conn, state http.ConnState) {\n\tif s.Config.Verbose {\n\t\ts.Log.Println(state, c.LocalAddr(), c.RemoteAddr())\n\t}\n\tswitch state {\n\tcase http.StateActive: // increment counters\n\t\t//go s.counters.Up(\"total\", \"active\")\n\tcase http.StateClosed:\n\t\t//go func() { // make the active connections counter a little less boring\n\t\t//\t<-time.After(durationactive)\n\t\t//\ts.counters.Down(\"active\")\n\t\t//}()\n\t\te := c.Close() // dont wait around to close a connection\n\t\tif e != nil {\n\t\t\ts.Log.Println(e)\n\t\t}\n\tcase http.StateIdle:\n\t\te := c.Close() // dont wait around for stale clients to close a connection\n\t\tif e != nil {\n\t\t\ts.Log.Println(e)\n\t\t}\n\tcase http.StateNew:\n\tdefault:\n\t\ts.Log.Println(\"Got new alien state:\", state.String())\n\t}\n}", "func (h *HTTP) State() *ConnectivityState {\n\treturn h.ConnectivityState\n}", "func (client *SQLResourcesClient) getSQLDatabaseHandleResponse(resp *http.Response) (SQLResourcesClientGetSQLDatabaseResponse, error) {\n\tresult := SQLResourcesClientGetSQLDatabaseResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseGetResults); err != nil {\n\t\treturn SQLResourcesClientGetSQLDatabaseResponse{}, err\n\t}\n\treturn result, nil\n}", "func isDbConnected() bool {\n\treturn Session != nil && DB != nil\n}", "func (c *Client) GetDBVersion(db *sql.DB) (int64, error) {\n\n\trows, err := c.Dialect.dbVersionQuery(db, c.TableName)\n\tif err != nil {\n\t\treturn 0, c.createVersionTable(db)\n\t}\n\tdefer rows.Close()\n\n\t// The most recent record for each migration specifies\n\t// whether it has been applied or rolled back.\n\t// The first version we find that has been applied is the current version.\n\n\ttoSkip := make([]int64, 0)\n\n\tfor rows.Next() {\n\t\tvar row MigrationRecord\n\t\tif err = rows.Scan(&row.VersionId, &row.IsApplied); err != nil {\n\t\t\tlog.Fatal(\"error scanning rows:\", err)\n\t\t}\n\n\t\t// have we already marked this version to be skipped?\n\t\tskip := false\n\t\tfor _, v := range toSkip {\n\t\t\tif v == row.VersionId {\n\t\t\t\tskip = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif skip {\n\t\t\tcontinue\n\t\t}\n\n\t\t// if version has been applied we're done\n\t\tif row.IsApplied {\n\t\t\treturn row.VersionId, nil\n\t\t}\n\n\t\t// latest version of migration has not been applied.\n\t\ttoSkip = append(toSkip, row.VersionId)\n\t}\n\n\tpanic(\"unreachable\")\n}", "func (m *MysqlProxy) GetStatus() (map[string]interface{}, error) {\n result := map[string]interface{}{}\n\n result[\"main\"] = redis.EncodeData(m)\n tables := []string{}\n shardDB := []string{}\n\n for _, table := range m.Tables {\n tables = append(tables, redis.EncodeData(table))\n }\n\n for _, db := range m.ShardDBs {\n shardDB = append(shardDB, redis.EncodeData(db))\n }\n\n result[\"tables\"] = tables\n result[\"sharddbs\"] = shardDB\n\n return result, nil\n}", "func HealthCheck(w http.ResponseWriter, r *http.Request) {\n\tdbUp := DBClient.Check()\n\n\tif dbUp {\n\t\tdata, _ := json.Marshal(healthCheckResponse{Status: \"UP\"})\n\t\twriteJSONResponse(w, http.StatusOK, data)\n\t} else {\n\t\tdata, _ := json.Marshal(healthCheckResponse{Status: \"Database not accessible\"})\n\t\twriteJSONResponse(w, http.StatusServiceUnavailable, data)\n\t}\n}", "func (keyDB *KeyDB) Status() (\n\tautoVacuum string,\n\tfreelistCount int64,\n\terr error,\n) {\n\treturn encdb.Status(keyDB.encDB)\n}", "func (cli *FakeDatabaseClient) GetDatabaseName(ctx context.Context, in *dbdpb.GetDatabaseNameRequest, opts ...grpc.CallOption) (*dbdpb.GetDatabaseNameResponse, error) {\n\tpanic(\"implement me\")\n}", "func GetConnectionPoolLogDB() (*sql.DB, error) {\n\n\tif dbLogConf.InitSuccess == false {\n\t\tinitLogDB()\n\t}\n\n\treturn dbLogConf.Conn, dbLogConf.Err\n}", "func VerifyDB(next http.HandlerFunc) http.HandlerFunc {\r\n\treturn func(w http.ResponseWriter, r *http.Request) {\r\n\t\tif db.VerifyConnection() == false {\r\n\t\t\thttp.Error(w, \"Lost connection with database\", 500)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tnext.ServeHTTP(w, r)\r\n\t}\r\n}", "func OpenDatabaseClient(ctx context.Context, c *ConnectionInfo) *mongo.Client {\n\tlog.Println(\"Getting Inside Mongo Connection..............\")\n\t//connStr := fmt.Sprintf(\"mongodb://%s:%s@%s:%s/%s?sslmode=disable\", c.User, c.Password, c.Host, c.Port, c.Name)\n\tconnStr := fmt.Sprintf(\"mongodb://%s:%s\", c.Host, c.Port)\n\tdb, err := mongo.Connect(ctx, options.Client().ApplyURI(connStr))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil\n\t}\n\tif err := db.Ping(ctx, nil); err != nil {\n\t\tlog.Fatal(fmt.Errorf(\"\\nFail to connect the database.\\nPlease make sure the connection info is valid %#v\", c))\n\t\treturn nil\n\t}\n\treturn db\n}", "func (c *Client) State() State {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.state\n}", "func CheckDBConnection() error {\n\tinMemConn, err := GetDBConnection(InMemory)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create InMemory DB connection: %v\", err)\n\t}\n\tonDiskConn, err := GetDBConnection(OnDisk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create OnDisk DB connection: %v\", err)\n\t}\n\n\tif err := inMemConn.Ping(); err != nil {\n\t\treturn fmt.Errorf(\"unable to ping InMemory DB: %v\", err)\n\t}\n\tif err := onDiskConn.Ping(); err != nil {\n\t\treturn fmt.Errorf(\"unable to ping OnDisk DB: %v\", err)\n\t}\n\n\treturn nil\n}", "func (s *SshConnection) GetConnectionStatus() string {\n\ts.connectionStatusMU.Lock()\n\tdefer s.connectionStatusMU.Unlock()\n\treturn s.connectionStatus\n}", "func (client *LDClient) GetDataSourceStatusProvider() interfaces.DataSourceStatusProvider {\n\treturn client.dataSourceStatusProvider\n}", "func (db *DatabaseClient) GetDatabaseInfos(ctx context.Context, databasePaths []string) ([]*DatabaseInfo, error) {\n\tdatabaseInfos := make([]*DatabaseInfo, len(databasePaths))\n\terrs, ctx := errgroup.WithContext(ctx)\n\tfor databaseIdx := range databasePaths {\n\t\tdatabaseIdx := databaseIdx // https://golang.org/doc/faq#closures_and_goroutines\n\n\t\tsetupDatabaseInfo := func(idx int) error {\n\t\t\tdbInfo, err := db.GetDatabaseInfo(ctx, databasePaths[idx])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdatabaseInfos[idx] = dbInfo\n\t\t\treturn nil\n\t\t}\n\n\t\tif ctx.Value(\"no-goroutines\") == true {\n\t\t\tif err := setupDatabaseInfo(databaseIdx); err != nil {\n\t\t\t\treturn databaseInfos, err\n\t\t\t}\n\t\t} else {\n\t\t\terrs.Go(func() error {\n\t\t\t\treturn setupDatabaseInfo(databaseIdx)\n\t\t\t})\n\t\t}\n\t}\n\terr := errs.Wait()\n\treturn databaseInfos, err\n}", "func GetConnToControlDB() (conn redis.Conn) {\n\trepo = Get()\n\tconn = repo.Get()\n\tconn.Do(\"SELECT\", config.RerestConf.RedisDatabaseControl)\n\treturn\n}", "func (c ConnInfo) TLS() *tls.ConnectionState {\n\tif c.tlsState != nil {\n\t\treturn c.tlsState\n\t}\n\ttlsConn, ok := c.netConn.(tlsConnectionStater)\n\tif !ok {\n\t\treturn nil\n\t}\n\tcs := tlsConn.ConnectionState()\n\t// See the caveat in tlsConnectionStater.\n\tif cs.Version == 0 {\n\t\treturn nil\n\t}\n\treturn &cs\n}", "func dbVersion(db *sql.DB, dataType string) (v int, table string) {\n\ttable, err := whatTable(dataType)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsqlStmt := `SELECT version FROM status WHERE table_name = ?`\n\terr = db.QueryRow(sqlStmt, table).Scan(&v)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func dbWait(db *sql.DB) error {\n\tdeadline := time.Now().Add(dbTimeout)\n\tvar err error\n\tfor tries := 0; time.Now().Before(deadline); tries++ {\n\t\terr = db.Ping()\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tlevel.Warn(util_log.Logger).Log(\"msg\", \"db connection not established, retrying...\", \"err\", err)\n\t\ttime.Sleep(time.Second << uint(tries))\n\t}\n\treturn errors.Wrapf(err, \"db connection not established after %s\", dbTimeout)\n}", "func (conn *Conn) StateTracker() state.Tracker {\n\treturn conn.st\n}", "func CheckConnection() int {\n err := MongoConnection.Ping(context.TODO(), nil)\n if err != nil {\n return 0\n }\n return 1\n}", "func statusHandler(c buffalo.Context) error {\n\tif !models.IsDBConnected() {\n\t\treturn c.Render(http.StatusInternalServerError, r.JSON(map[string]string{\"status\": \"error\"}))\n\t}\n\treturn c.Render(200, r.JSON(map[string]string{\"status\": \"good\"}))\n}", "func (self PostgresDatabase) getDBVersion() (version int) {\n var val string\n var vers int64\n err := self.conn.QueryRow(\"SELECT value FROM Settings WHERE name = $1\", \"version\").Scan(&val)\n if err == nil {\n vers, err = strconv.ParseInt(val, 10, 32)\n if err == nil {\n version = int(vers)\n } else {\n log.Fatal(\"cannot figure out db version\", err)\n }\n } else {\n version = -1\n }\n return\n}", "func (h *handler) Health(ctx context.Context) error {\n\treturn h.dbClient.Ping()\n}", "func getDatabaseInfo(cf *CLIConf, tc *client.TeleportClient, dbName string) (*tlsca.RouteToDatabase, types.Database, error) {\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err == nil {\n\t\tswitch database.Protocol {\n\t\tcase defaults.ProtocolCassandra:\n\t\t\t// Cassandra CLI connection require database resource to determine\n\t\t\t// if the target database is AWS hosted in order to skip the password prompt.\n\t\tdefault:\n\t\t\treturn database, nil, nil\n\t\t}\n\t}\n\tif err != nil && !trace.IsNotFound(err) {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tdb, err := getDatabase(cf, tc, dbName)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\tusername := cf.DatabaseUser\n\tdatabaseName := cf.DatabaseName\n\tif database != nil {\n\t\tif username == \"\" {\n\t\t\tusername = database.Username\n\t\t}\n\t\tif databaseName == \"\" {\n\t\t\tdatabaseName = database.Database\n\t\t}\n\t}\n\n\treturn &tlsca.RouteToDatabase{\n\t\tServiceName: db.GetName(),\n\t\tProtocol: db.GetProtocol(),\n\t\tUsername: username,\n\t\tDatabase: databaseName,\n\t}, db, nil\n}", "func (db *CassandraDB) GetState(userid gocql.UUID) (*State, error) {\n\tstate := State{Id: userid}\n\terr := db.Session.Query(`\n select gamesPlayed, score from User where id = ?`,\n\t\tstate.Id).Scan(&state.GamesPlayed, &state.Highscore)\n\treturn &state, err\n}", "func (m *MockLDAPClient) TLSConnectionState() (tls.ConnectionState, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TLSConnectionState\")\n\tret0, _ := ret[0].(tls.ConnectionState)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}" ]
[ "0.61654705", "0.60577226", "0.60476184", "0.5804549", "0.57145476", "0.56411034", "0.5468413", "0.543951", "0.5418034", "0.54064167", "0.5388684", "0.5274031", "0.52640116", "0.52092063", "0.52074766", "0.5177916", "0.50860906", "0.5077236", "0.50597227", "0.5044706", "0.50252736", "0.50217074", "0.5017502", "0.5009798", "0.49931467", "0.4985852", "0.49795493", "0.4969108", "0.49551585", "0.4952472", "0.49337706", "0.4911615", "0.49079114", "0.49060288", "0.48987404", "0.4887481", "0.48762515", "0.48616853", "0.48563123", "0.48201856", "0.48025241", "0.4786199", "0.4783693", "0.47641835", "0.475634", "0.47482705", "0.4732639", "0.47112525", "0.47080684", "0.4707493", "0.46733153", "0.4671452", "0.46708924", "0.46664998", "0.46531358", "0.46496707", "0.4635479", "0.46342072", "0.46313685", "0.4630641", "0.46255136", "0.46253207", "0.46233803", "0.46160987", "0.46160987", "0.46160987", "0.461416", "0.4613107", "0.46094042", "0.46075094", "0.45928714", "0.45837343", "0.45837113", "0.45801768", "0.45759806", "0.45759785", "0.45728648", "0.45711094", "0.45709154", "0.45628333", "0.4562541", "0.45520744", "0.45455006", "0.4534407", "0.4532935", "0.4525622", "0.45251903", "0.45226818", "0.45213604", "0.45159847", "0.4507126", "0.45047772", "0.45042357", "0.44987598", "0.44932526", "0.4490392", "0.4488234", "0.44869336", "0.4482842", "0.44811895" ]
0.7872185
0
HandleDeleteTable is an endpoint handler which deletes a table in specified database & removes it from config
func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] col := vars["col"] crud := modules.DB() if err := crud.DeleteTable(ctx, dbAlias, col); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } if err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DeleteTableHandler(w http.ResponseWriter, req *http.Request) {\n\tif bbpd_runinfo.BBPDAbortIfClosed(w) {\n\t\treturn\n\t}\n\tif req.Method == \"POST\" {\n\t\tdeleteTable_POST_Handler(w, req)\n\t} else {\n\t\te := fmt.Sprintf(\"delete_table_route.DeleteTablesHandler:bad method %s\", req.Method)\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t}\n}", "func deleteTable_POST_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"delete_table_route.deleteTable_POST_Handler:cannot parse path. try /desc-table\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbodybytes, read_err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif read_err != nil && read_err != io.EOF {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler err reading req body: %s\", read_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\td := delete_table.NewDeleteTable()\n\n\tum_err := json.Unmarshal(bodybytes, d)\n\tif um_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler unmarshal err on %s to Get %s\", string(bodybytes), um_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresp_body, code, resp_err := d.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"delete_table_route.deleteTable_POST_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tdelete_table.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler %s\",\n\t\t\tmr_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func HandleRemoveDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.RemoveDatabaseConfig(ctx, projectID, dbAlias); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func deleteAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to delete config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n _, err = db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n if err := db.DeleteConfigByAppId(appId); err != nil {\n log.Error(fmt.Errorf(\"unable to delete config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully delete config\"})\n}", "func (s *Server) CleanTableHandler(c echo.Context) error {\n\tvar tableName = c.Param(\"tablename\")\n\n\tgo func() {\n\t\tfor {\n\t\t\tn, err := sqlutils.TableDelRecordsBatch(s.DB, tableName, s.Cfg.TableRecordsLifeTimeDays, s.Cfg.TableRecordsDelBatchSize)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"table %s delete records batch err: %s\", tableName, err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t//if no records were removed\n\t\t\tif n == 0 {\n\t\t\t\tlogrus.Infof(\"table %s was successfully cleaned up\", tableName)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlogrus.Infof(\"successfull remove %d record in table %s\", n, tableName)\n\n\t\t\t//Non blocked removal - make pauses between delete transactions\n\t\t\ttime.Sleep(time.Duration(s.Cfg.TableRecordsRemovePause) * time.Millisecond)\n\t\t}\n\t}()\n\n\tresp := types.NewJSONResponse(false, fmt.Sprintf(\"table %s cleanup was scheduled. For more information please refer to app console logs.\", tableName))\n\treturn c.JSON(http.StatusOK, resp)\n}", "func (b *Backend) Delete(request *frames.DeleteRequest) error {\n\n\terr := backends.ValidateRequest(\"kv\", request.Proto, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontainer, path, err := b.newConnection(request.Proto.Session, request.Password.Get(), request.Token.Get(), request.Proto.Table, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn v3ioutils.DeleteTable(b.logger, container, path, request.Proto.Filter, b.numWorkers, b.numWorkers*b.updateWorkersPerVN, request.Proto.IfMissing == frames.IgnoreError)\n\t// TODO: delete the table directory entry if filter == \"\"\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func DeleteTable(w io.Writer, dynamodbAPI *dynamodb.DynamoDB, tableName string) error {\n\tfmt.Fprintf(w, \"deleting table, %v ... \", tableName)\n\tinput := &dynamodb.DeleteTableInput{\n\t\tTableName: aws.String(tableName),\n\t}\n\n\tif _, err := dynamodbAPI.DeleteTable(input); err != nil {\n\t\tif v, ok := err.(awserr.Error); ok {\n\t\t\tswitch v.Code() {\n\t\t\tcase dynamodb.ErrCodeResourceInUseException:\n\t\t\t\tfmt.Fprintln(w, \"in use, try again later\")\n\t\t\tcase dynamodb.ErrCodeResourceNotFoundException:\n\t\t\t\tfmt.Fprintln(w, \"not found, ok\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tfmt.Fprintf(w, \"failed, %v\\n\", err)\n\t\treturn nil\n\t}\n\n\tfmt.Fprintln(w, \"ok\")\n\treturn nil\n}", "func (h *Handler) serveDeleteDatabase(w http.ResponseWriter, r *http.Request) {\n\tname := r.URL.Query().Get(\":name\")\n\tif err := h.server.DeleteDatabase(name); err != ErrDatabaseNotFound {\n\t\th.error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t} else if err != nil {\n\t\th.error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (r *Router) DeleteHandler(c *gin.Context) {\n\tnDeleted, err := r.store.Stat().Delete()\n\tif err != nil {\n\t\trespond(c, http.StatusInternalServerError, \"\", err.Error())\n\t\treturn\n\t}\n\n\trespond(c, http.StatusOK, map[string]int{\n\t\t\"rows deleted\": nDeleted,\n\t}, \"\")\n}", "func (hh *HealthCheckHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\tuuid := utils.ExtractUUID(r.URL.String())\n\thh.db.Delete(uuid)\n}", "func (a *DatabaseTablesApiService) DeleteDatabaseTableExecute(r ApiDeleteDatabaseTableRequest) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DatabaseTablesApiService.DeleteDatabaseTable\")\n\tif err != nil {\n\t\treturn nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/database/tables/{table_id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"table_id\"+\"}\", url.PathEscape(parameterValueToString(r.tableId, \"tableId\")), -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\tif r.clientSessionId != nil {\n\t\tparameterAddToHeaderOrQuery(localVarHeaderParams, \"ClientSessionId\", r.clientSessionId, \"\")\n\t}\n\tif r.clientUndoRedoActionGroupId != nil {\n\t\tparameterAddToHeaderOrQuery(localVarHeaderParams, \"ClientUndoRedoActionGroupId\", r.clientUndoRedoActionGroupId, \"\")\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := io.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn 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 DeleteDatabaseTableRow400Response\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ListDatabaseTableFields404Response\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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (t *table) Delete(router.Route) error {\n\treturn nil\n}", "func (srv *Server) handleDelete(res http.ResponseWriter, req *http.Request) {\n\tfor _, rute := range srv.routeDeletes {\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\tres.WriteHeader(http.StatusNotFound)\n}", "func AppDeleteHandler(context utils.Context, w http.ResponseWriter, r *http.Request) {\n\n\tdbConn := context.DBConn\n\tdbBucket := context.DBBucketApp\n\n\tvars := mux.Vars(r)\n\n\tenv := vars[\"environment\"]\n\tapp := vars[\"application\"]\n\n\tkey := []byte(env + \"_\" + app)\n\n\tif err := database.DeleteDBValue(dbConn, dbBucket, key); err != nil {\n\t\tlog.LogInfo.Printf(\"Failed to read db value: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"200 - OK: valued deleted or was not found\"))\n\n}", "func (c *Cache) HandleDelete(ctx *fasthttp.RequestCtx) {\n\tc.Remove(ctx.UserValue(\"key\").(string))\n}", "func DeleteHandler(db *sql.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tuser, err := delete(db, vars[\"id\"])\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(w, \"%v\\n\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(user)\n\t\treturn\n\t}\n}", "func (t *TestHandler) ObjectDeleted(obj interface{}) {\n\n\ttableName := strings.Split(obj.(string), \"/\")[1]\n\tfmt.Println(\"Object deleted\")\n\tfmt.Println(tableName)\n\t// fmt.Println(tableName)\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"eu-west-1\"),\n\t\tCredentials: credentials.NewSharedCredentials(\"\", \"saml\"),\n\t})\n\n\t// Create DynamoDB client\n\tsvc := dynamodb.New(sess)\n\n\tinput := &dynamodb.DeleteTableInput{\n\t\tTableName: aws.String(tableName),\n\t}\n\tresult, err := svc.DeleteTable(input)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\t// if aerr, ok := err.(awserr.Error); ok {\n\t// \tswitch aerr.Code() {\n\t// \tcase dynamodb.ErrCodeResourceInUseException:\n\t// \t\tfmt.Println(dynamodb.ErrCodeResourceInUseException, aerr.Error())\n\t// \tcase dynamodb.ErrCodeResourceNotFoundException:\n\t// \t\tfmt.Println(dynamodb.ErrCodeResourceNotFoundException, aerr.Error())\n\t// \tcase dynamodb.ErrCodeLimitExceededException:\n\t// \t\tfmt.Println(dynamodb.ErrCodeLimitExceededException, aerr.Error())\n\t// \tcase dynamodb.ErrCodeInternalServerError:\n\t// \t\tfmt.Println(dynamodb.ErrCodeInternalServerError, aerr.Error())\n\t// \tdefault:\n\t// \t\tfmt.Println(aerr.Error())\n\t// \t}\n\t// } else {\n\t// \t// Print the error, cast err to awserr.Error to get the Code and\n\t// \t// Message from an error.\n\t// \tfmt.Println(err.Error())\n\t// }\n\t// return\n\t// }\n\tfmt.Println(result)\n\tfmt.Println(\"TestHandler.ObjectDeleted\")\n}", "func (d *DBClient) DeleteAllRecordsHandler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {\n\terr := d.Cache.DeleteData()\n\n\tvar en Entry\n\ten.ActionType = ActionTypeWipeDB\n\ten.Message = \"wipe\"\n\ten.Time = time.Now()\n\n\tif err := d.Hooks.Fire(ActionTypeWipeDB, &en); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"error\": err.Error(),\n\t\t\t\"message\": en.Message,\n\t\t\t\"actionType\": ActionTypeWipeDB,\n\t\t}).Error(\"failed to fire hook\")\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar response messageResponse\n\tif err != nil {\n\t\tif err.Error() == \"bucket not found\" {\n\t\t\tresponse.Message = fmt.Sprintf(\"No records found\")\n\t\t\tw.WriteHeader(200)\n\t\t} else {\n\t\t\tresponse.Message = fmt.Sprintf(\"Something went wrong: %s\", err.Error())\n\t\t\tw.WriteHeader(500)\n\t\t}\n\t} else {\n\t\tresponse.Message = \"Proxy cache deleted successfuly\"\n\t\tw.WriteHeader(200)\n\t}\n\tb, err := json.Marshal(response)\n\n\tw.Write(b)\n\treturn\n}", "func FileDeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\n\tfileSha1 := r.Form.Get(\"filehash\")\n\tfileMeta := meta.GetFileMeta(fileSha1)\n\n\t//delete file from disk\n\terr := os.Remove(fileMeta.FileAddr)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// delete file index\n\tmeta.RemoveFileMeta(fileSha1)\n\n\tw.WriteHeader(http.StatusOK)\n}", "func (shareXRouter *ShareXRouter) handleDelete(writer http.ResponseWriter, request *http.Request) {\n\t//get the delete reference\n\tdeleteReference, ok := mux.Vars(request)[deleteReferenceVar]\n\tif !ok {\n\t\thttp.Error(writer, \"400 Bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t//delete the entry\n\terr := shareXRouter.Storage.Delete(deleteReference)\n\tif err != nil {\n\t\tshareXRouter.sendInternalError(writer, fmt.Sprintf(\"deleting entry with call reference %v\", strconv.Quote(deleteReference)), err)\n\t\treturn\n\t}\n\twriter.WriteHeader(http.StatusOK)\n}", "func (p *SignalChannel) HandleDelete(req Request, customer *models.Customer) (res Response, err error) {\n\tlog.Debug(\"[HandleDelete] SignalChannel\")\n\treturn p.forward(req, customer)\n}", "func DepupulateHandler(res http.ResponseWriter, req *http.Request) {\n\tnumPups := parseOrDefault(req, numParam, 100)\n\terr := db.DeleteEntries(numPups)\n\tif err != nil {\n\t\tmessage := \"Could not delete from Pets table \" + err.Error()\n\t\tmessageResponseJSON(res, http.StatusBadRequest, message)\n\t\treturn\n\t}\n\tjsonResponse(res, http.StatusOK, \"Entries from pets table deleted\")\n\treturn\n}", "func DeleteTable(tableName string, client *dynamodb.DynamoDB) error {\n\ttableCreateDeleteSemaphore.Acquire()\n\tdefer tableCreateDeleteSemaphore.Release()\n\n\t_, err := client.DeleteTable(&dynamodb.DeleteTableInput{TableName: aws.String(tableName)})\n\treturn err\n}", "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tid, ok := request.PathParameters[players.TableKey]\n\tif !ok {\n\t\treturn utils.HTTPResponse(\"Please provide an 'id'\", http.StatusBadRequest), nil\n\t}\n\n\tsess := session.Must(session.NewSession())\n\tdb := dynamodb.New(sess)\n\n\t_, err := db.DeleteItem(&dynamodb.DeleteItemInput{\n\t\tTableName: aws.String(players.TableName),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\tplayers.TableKey: {\n\t\t\t\tS: aws.String(id),\n\t\t\t},\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn utils.HTTPResponse(err.Error(), http.StatusServiceUnavailable), nil\n\t}\n\n\treturn utils.HTTPResponse(\"Player deleted\", http.StatusAccepted), nil\n}", "func MakeDeleteHandler(cfg *types.Config, back types.ServerlessBackend) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// First get the Service\n\t\tservice, _ := back.ReadService(c.Param(\"serviceName\"))\n\n\t\tif err := back.DeleteService(c.Param(\"serviceName\")); err != nil {\n\t\t\t// Check if error is caused because the service is not found\n\t\t\tif errors.IsNotFound(err) || errors.IsGone(err) {\n\t\t\t\tc.Status(http.StatusNotFound)\n\t\t\t} else {\n\t\t\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Disable input notifications\n\t\tif err := disableInputNotifications(service.GetMinIOWebhookARN(), service.Input, service.StorageProviders.MinIO[types.DefaultProvider]); err != nil {\n\t\t\tlog.Printf(\"Error disabling MinIO input notifications for service \\\"%s\\\": %v\\n\", service.Name, err)\n\t\t}\n\n\t\t// Remove the service's webhook in MinIO config and restart the server\n\t\tif err := removeMinIOWebhook(service.Name, cfg); err != nil {\n\t\t\tlog.Printf(\"Error removing MinIO webhook for service \\\"%s\\\": %v\\n\", service.Name, err)\n\t\t}\n\n\t\t// Add Yunikorn queue if enabled\n\t\tif cfg.YunikornEnable {\n\t\t\tif err := utils.DeleteYunikornQueue(cfg, back.GetKubeClientset(), service); err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t}\n\n\t\tc.Status(http.StatusNoContent)\n\t}\n}", "func (c *ContrailConfig) Delete(fqNameTable *FQNameTableType, uuidTable *UUIDTableType) error {\n\tdelete(*uuidTable, c.UUID)\n\tdelete((*fqNameTable)[c.Type], fmt.Sprintf(\"%s:%s\", strings.Join(c.FqName, \":\"), c.UUID))\n\treturn nil\n}", "func (a *Client) DeleteTable(params *DeleteTableParams) (*DeleteTableOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteTableParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteTable\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/tables/{tableName}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteTableReader{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.(*DeleteTableOK)\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 deleteTable: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (t *SimpleChaincode) deleteTable(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of auguments, Expencting 1, the name of the table\")\n\t}\n\n\ttableName := args[0]\n\n\terr := stub.DeleteTable(tableName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Delete a table operation failed. %s\", err)\n\t}\n\n\treturn nil, nil\n}", "func (a *Adapter) DeleteTable() error {\n\tparams := &dynamodb.DeleteTableInput{\n\t\tTableName: aws.String(a.DataSourceName),\n\t}\n\t_, err := a.Service.DeleteTable(params)\n\treturn err\n}", "func (m *Manager) DelHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"Not support method\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tr.ParseForm()\n\tfuncName := r.FormValue(\"funcName\")\n\n\terr := m.platformManager.DeleteFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\terr = m.scheduler.DeleteFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write([]byte(\"Delete Successful\"))\n\n\treturn\n}", "func (mh *MetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvars := mux.Vars(r)\n\tvar (\n\t\tappID string\n\t\tok bool\n\t)\n\tif appID, ok = vars[\"appID\"]; !ok {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\terr := mh.Repository.Delete(appID)\n\tif err != nil {\n\t\tif err == repository.ErrIDNotFound {\n\t\t\tw.WriteHeader(http.StatusConflict) // 409\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\t}\n\t\tyaml.NewEncoder(w).Encode(err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent) // 204\n}", "func (l *Log) deleteTable(ctx context.Context, tableName string, wait bool) error {\n\ttn := aws.String(tableName)\n\t_, err := l.svc.DeleteTableWithContext(ctx, &dynamodb.DeleteTableInput{TableName: tn})\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif wait {\n\t\treturn trace.Wrap(\n\t\t\tl.svc.WaitUntilTableNotExistsWithContext(ctx, &dynamodb.DescribeTableInput{TableName: tn}))\n\t}\n\treturn nil\n}", "func (follower *Follower) OnDelete(m *Message, w io.Writer) (err error) {\n\tfollower.mutex.Lock()\n\tdelete(follower.table, m.GetKey())\n\tfollower.mutex.Unlock()\n\n\tlog.Printf(\"Table after Delete: %v\\n\", follower.table)\n\treturn nil\n}", "func (cmd *CommandDelete) Handler(profile *user.Profile, ui terminal.UI, clients cli.Clients) error {\n\tapp, err := cli.ResolveApp(ui, clients.Realm, cmd.inputs.Filter())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallowedIPs, err := clients.Realm.AllowedIPs(app.GroupID, app.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tselectedAllowedIPs, err := cmd.inputs.resolveAllowedIP(ui, allowedIPs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(selectedAllowedIPs) == 0 {\n\t\treturn errors.New(\"no IP addresses or CIDR blocks to delete\")\n\t}\n\n\toutputs := make([]deleteAllowedIPOutput, len(selectedAllowedIPs))\n\tfor i, allowedIP := range selectedAllowedIPs {\n\t\terr := clients.Realm.AllowedIPDelete(app.GroupID, app.ID, allowedIP.ID)\n\t\toutputs[i] = deleteAllowedIPOutput{allowedIP, err}\n\t}\n\n\ttableRows := make([]map[string]interface{}, 0, len(outputs))\n\tfor _, output := range outputs {\n\t\trow := map[string]interface{}{\n\t\t\theaderAddress: output.allowedIP.Address,\n\t\t\theaderComment: output.allowedIP.Comment,\n\t\t}\n\t\tvar deleted bool\n\t\tvar err error\n\t\tif output.err != nil {\n\t\t\terr = output.err\n\t\t} else {\n\t\t\tdeleted = true\n\t\t}\n\n\t\trow[headerDeleted] = deleted\n\t\trow[headerDetails] = err\n\t\ttableRows = append(tableRows, row)\n\t}\n\n\tui.Print(terminal.NewTableLog(\n\t\tfmt.Sprintf(\"Deleted %d IP address(es) and/or CIDR block(s)\", len(outputs)),\n\t\tdeleteTableHeaders,\n\t\ttableRows...,\n\t))\n\n\treturn nil\n}", "func (h *Handler) DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tctx, cancel := context.WithCancel(r.Context())\n\tdefer cancel()\n\n\tvar err error\n\n\trole, err := auth.GetRole(r)\n\tif err != nil {\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorBadRequest.Error())\n\t\treturn\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t_ = response.HTTPError(w, http.StatusBadGateway, response.ErrTimeout.Error())\n\t\treturn\n\tdefault:\n\t\terr = h.service.Delete(ctx, role, id)\n\t}\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\trender.JSON(w, r, render.M{})\n}", "func DeleteHandler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// Pass the call to the model with params found in the path\n\tid := request.PathParameters[\"id\"]\n\tfmt.Println(\"Path vars: \", id)\n\terr := course.Delete(id)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to find course, %v\", err))\n\t}\n\n\tmsg := fmt.Sprintf(\"Deleted course with id: %s \\n\", id)\n\treturn events.APIGatewayProxyResponse{Body: msg, StatusCode: 200}, nil\n}", "func handleDelete(args ...string) (string, error) {\n\tkey := args[0]\n\n\terr := GetCurrentStore().Delete(key)\n\treturn \"\", err\n}", "func HandleGetAllTableNames(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tcollections, err := crud.GetCollections(ctx, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcols := make([]string, len(collections))\n\t\tfor i, value := range collections {\n\t\t\tcols[i] = value.TableName\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: cols})\n\t}\n}", "func (ctrl *APIController) deleteURLHandler(c *gin.Context) {\n\tvar uri deleteURLReq\n\tif err := c.ShouldBindUri(&uri); err != nil {\n\t\tfmt.Println(\"failed to bind uri :\", err.Error())\n\t\tc.Status(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// test invalid ID\n\tif !checkValidID(uri.ID) {\n\t\tfmt.Println(\"requested ID is invalid\")\n\t\tc.Status(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// test against bloom filter\n\tif !checkCuckoo(uri.ID, ctrl.filter) {\n\t\tfmt.Println(\"requested ID does not exist\")\n\t\tc.Status(http.StatusNotFound)\n\t\treturn\n\t}\n\tif err := ctrl.db.DeleteURL(c.Request.Context(), uri.ID); err != nil {\n\t\tfmt.Println(\"delete url failed :\", err.Msg)\n\t\tc.Status(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tc.Status(http.StatusOK)\n}", "func MakeDeleteHandler(client rancher.BridgeClient) VarsHandler {\n\treturn func(w http.ResponseWriter, r *http.Request, vars map[string]string) {\n\n\t\tdefer r.Body.Close()\n\n\t\tbody, _ := ioutil.ReadAll(r.Body)\n\n\t\trequest := requests.DeleteFunctionRequest{}\n\t\terr := json.Unmarshal(body, &request)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif len(request.FunctionName) == 0 {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// This makes sure we don't delete non-labelled deployments\n\t\tservice, findErr := client.FindServiceByName(request.FunctionName)\n\t\tif findErr != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t} else if service == nil {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tdelErr := client.DeleteService(service)\n\t\tif delErr != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n}", "func (h Handler) Delete(s string) error {\n\treturn nil\n}", "func HandleDelete(\n\trepos core.RepositoryStore,\n\tbuilds core.BuildStore,\n\tstages core.StageStore,\n\tsteps core.StepStore,\n\tlogs core.LogStore,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tnamespace = chi.URLParam(r, \"owner\")\n\t\t\tname = chi.URLParam(r, \"name\")\n\t\t)\n\t\tnumber, err := strconv.ParseInt(chi.URLParam(r, \"number\"), 10, 64)\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\tstageNumber, err := strconv.Atoi(chi.URLParam(r, \"stage\"))\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\tstepNumber, err := strconv.Atoi(chi.URLParam(r, \"step\"))\n\t\tif err != nil {\n\t\t\trender.BadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\trepo, err := repos.FindName(r.Context(), namespace, name)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tbuild, err := builds.FindNumber(r.Context(), repo.ID, number)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tstage, err := stages.FindNumber(r.Context(), build.ID, stageNumber)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\tstep, err := steps.FindNumber(r.Context(), stage.ID, stepNumber)\n\t\tif err != nil {\n\t\t\trender.NotFound(w, err)\n\t\t\treturn\n\t\t}\n\t\terr = logs.Delete(r.Context(), step.ID)\n\t\tif err != nil {\n\t\t\trender.InternalError(w, err)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(204)\n\t}\n}", "func makeDeleteTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-tag\", http1.NewServer(endpoints.DeleteTagEndpoint, decodeDeleteTagRequest, encodeDeleteTagResponse, options...))\n}", "func (router *Router) DeleteFunc(path string, handler http.HandlerFunc) {\n\trouter.Handle(\"DELETE\", path, handler)\n}", "func Delete(route string, do interface{}) *handler {\n\treturn handlerByMethod(&route, do, \"DELETE\")\n}", "func HandleDelete(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tfmt.Println(\"In handleDelete\")\r\n\tif r.Method != http.MethodGet {\r\n\t\tmsg := fmt.Sprintf(\"Method %s not supported on this action %s\\n\", r.Method, r.URL.Path)\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n\tMutex.RLock()\r\n\tdefer Mutex.RUnlock()\r\n\tif len(AddrBook) == 0 {\r\n\t\tmsg := fmt.Sprintf(\"Address book is empty\\n\")\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tfirstName := r.URL.Query().Get(\"name\")\r\n\tif firstName == \"\" {\r\n\t\tmsg := \"Name not provided as part of the query\\n\"\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tif _, ok := AddrBook[firstName]; ok {\r\n\t\tdelete(AddrBook, firstName)\r\n\t\tmsg := fmt.Sprintf(\"%s deleted from the address book\", firstName)\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusOK)\r\n\t} else {\r\n\t\tmsg := fmt.Sprintf(\"%s not found in the address book\", firstName)\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t}\r\n}", "func handleDelete(w http.ResponseWriter, r *http.Request) (err error) {\n\n\t// 베이스 경로 문자에서 숫자로\n\tid, err := strconv.Atoi(path.Base(r.URL.Path))\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 일단 가져오기\n\tpost, err := retrieve(id)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 이걸 구지 post 에서 해야하나? 음..\n\terr = post.delete()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 완료 때리기\n\tw.WriteHeader(200)\n\treturn\n}", "func (f5 *BigIP) handleDelete(msg comm.Message) comm.Message {\n\tswitch f5.UpdateMode {\n\tcase vsUpdateMode:\n\t\tm := f5.handleVSDelete(msg)\n\t\treturn m\n\tcase policyUpdateMode:\n\t\tm := f5.handleGlobalPolicyDelete(msg)\n\t\treturn m\n\tdefault:\n\t\tmsg.Error = fmt.Sprintf(\"unsupported updateMode %v\", f5.UpdateMode)\n\t\treturn msg\n\t}\n}", "func deleteDeviceHandler(devices map[string]*Device) http.HandlerFunc {\n\treturn func(respWriter http.ResponseWriter, request *http.Request) {\n\t\tmac := request.FormValue(\"physaddr\")\n\t\tif mac == \"\" {\n\t\t\thttp.Error(respWriter, \"Specify Physical device's address\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tdelete(devices, mac)\n\t\tresponse := StatusResponse{\n\t\t\tOK: true,\n\t\t\tMessage: \"Device successfully deleted.\",\n\t\t}\n\t\tbytes, err := json.Marshal(&response)\n\t\tif err != nil {\n\t\t\thttp.Error(respWriter, \"Can't marshall response json: \"+err.Error(), http.StatusInternalServerError)\n\t\t}\n\t\trespWriter.Header().Add(\"Content-Type\", \"application/json\")\n\t\trespWriter.Write(bytes)\n\t}\n}", "func taskDeleteHandler(w http.ResponseWriter, r *http.Request) {\r\n\r\n\tdn := getRequestParam(r, \"model\")\r\n\ttn := getRequestParam(r, \"task\")\r\n\r\n\t// delete modeling task\r\n\tok, err := theCatalog.DeleteTask(dn, tn)\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Task delete failed \"+dn+\": \"+tn, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\tif ok {\r\n\t\tw.Header().Set(\"Content-Location\", \"/api/model/\"+dn+\"/task/\"+tn)\r\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\r\n\t}\r\n}", "func handleDeleteOnDb(db *leveldb.DB, before *pb.BytePair, ev *replication.BinlogEvent, i int) error {\n\toldData, err := db.Get(before.Key, nil)\n\tif err != nil {\n\t\t// key not found in db\n\t\tbefore.Value = genValue(i, ev)\n\n\t\tunit := &pb.BytesUnit{\n\t\t\tTp: DeleteRowsEvent,\n\t\t\tKey: before.Key,\n\t\t\tBefore: before,\n\t\t\tAfter: nil,\n\t\t}\n\t\tlog.Debug(\"delete put key \", before.Key)\n\n\t\tdata, _ := proto.Marshal(unit)\n\t\treturn db.Put(unit.Key, data, nil)\n\t}\n\n\toldUnit := &pb.BytesUnit{}\n\tif err := proto.Unmarshal(oldData, oldUnit); err != nil {\n\t\treturn err\n\t}\n\n\tswitch oldUnit.Tp {\n\tcase WriteRowsEvent:\n\t\treturn db.Delete(before.Key, nil)\n\tcase UpdateRowsEvent: // update + delete => delete before\n\t\tnewUnit := &pb.BytesUnit{\n\t\t\tTp: DeleteRowsEvent,\n\t\t\tKey: oldUnit.Before.Key,\n\t\t\tBefore: oldUnit.Before,\n\t\t\tAfter: nil,\n\t\t}\n\n\t\tdata, _ := proto.Marshal(newUnit)\n\t\treturn db.Put(newUnit.Key, data, nil)\n\t}\n\n\treturn nil\n}", "func (s *Server) HandleDeleteService() http.HandlerFunc {\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(), 60*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\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tserviceID := vars[\"serviceId\"]\n\t\tversion := vars[\"version\"]\n\n\t\tif err := s.driver.DeleteService(ctx, projectID, serviceID, version); err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to apply service\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, http.StatusOK, w)\n\t}\n}", "func DeleteTodoHandler(c *gin.Context) {\n\ttodoID := c.Param(\"id\")\n\tif err := todo.Delete(todoID); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, \"\")\n}", "func (app *App) deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tbaseErr := \"deleteHandler fails: %v\"\n\n\tid, err := app.assets.Tokens.RetrieveAccountIDFromRequest(r.Context(), r)\n\tif err != nil {\n\t\tlog.Printf(baseErr, err)\n\t\tswitch {\n\t\tcase errors.Is(err, tokens.AuthHeaderError):\n\t\t\tapi.Error2(w, api.AuthHeaderError)\n\t\tcase errors.Is(err, tokens.ErrDoesNotExist):\n\t\t\tapi.Error2(w, api.NotExistError)\n\t\tdefault:\n\t\t\tapi.Error2(w, api.DatabaseError)\n\t\t}\n\t\treturn\n\t}\n\n\tif err := app.deleteAccount(r.Context(), id); err != nil {\n\t\tapi.Error2(w, api.DatabaseError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (h *Handler) Delete(path string, f func(w http.ResponseWriter, r *http.Request)) {\n\tpath = configuration.Instance.Service.Path + path\n\tlog.Println(\"Adding '\" + path + \"' as DELETE path\")\n\th.Router.HandleFunc(path, f).Methods(\"DELETE\")\n}", "func DeleteHandler(basePath string, w http.ResponseWriter, r *http.Request) {\n\tFilesLock.RLock()\n\tval, ok := Files.Get(fileKey(r.URL))\n\tFilesLock.RUnlock()\n\n\tif !ok {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tf := val.(*File)\n\n\tFilesLock.Lock()\n\tFiles.Remove(fileKey(r.URL))\n\tFilesLock.Unlock()\n\n\tf.RemoveFromDisk(basePath)\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (api *APIServer) httpDeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tif locked := api.lock.TryAcquire(1); !locked {\n\t\tlog.Println(ErrAPILocked)\n\t\twriteError(w, http.StatusLocked, \"delete\", ErrAPILocked)\n\t\treturn\n\t}\n\tdefer api.lock.Release(1)\n\tapi.status.start(\"delete\")\n\tvar err error\n\tvars := mux.Vars(r)\n\tswitch vars[\"where\"] {\n\tcase \"local\":\n\t\terr = RemoveBackupLocal(api.config, vars[\"name\"])\n\tcase \"remote\":\n\t\terr = RemoveBackupRemote(api.config, vars[\"name\"])\n\tdefault:\n\t\terr = fmt.Errorf(\"Backup location must be 'local' or 'remote'\")\n\t}\n\tapi.status.stop(err)\n\tif err != nil {\n\t\tlog.Printf(\"delete backup error: %+v\\n\", err)\n\t\twriteError(w, http.StatusInternalServerError, \"delete\", err)\n\t\treturn\n\t}\n\tsendResponse(w, http.StatusOK, struct {\n\t\tStatus string `json:\"status\"`\n\t\tOperation string `json:\"operation\"`\n\t\tBackupName string `json:\"backup_name\"`\n\t\tLocation string `json:\"location\"`\n\t}{\n\t\tStatus: \"success\",\n\t\tOperation: \"delete\",\n\t\tBackupName: vars[\"name\"],\n\t\tLocation: vars[\"where\"],\n\t})\n}", "func handleDeleteSchedule(resp http.ResponseWriter, request *http.Request) {\n\tcors := handleCors(resp, request)\n\tif cors {\n\t\treturn\n\t}\n\n\tlocation := strings.Split(request.URL.String(), \"/\")\n\n\tvar workflowId string\n\tif location[1] == \"api\" {\n\t\tif len(location) <= 4 {\n\t\t\tresp.WriteHeader(401)\n\t\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\t\treturn\n\t\t}\n\n\t\tworkflowId = location[4]\n\t}\n\n\tif len(workflowId) != 32 {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false, \"message\": \"ID not valid\"}`))\n\t\treturn\n\t}\n\n\tctx := context.Background()\n\terr := DeleteKey(ctx, \"schedules\", workflowId)\n\tif err != nil {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false, \"message\": \"Can't delete\"}`))\n\t\treturn\n\t}\n\n\t// FIXME - remove schedule too\n\n\tresp.WriteHeader(200)\n\tresp.Write([]byte(`{\"success\": true, \"message\": \"Deleted webhook\"}`))\n}", "func JSONDeleteTblProduct(c *gin.Context) {\n\tDb, err := config.DbConnect()\n\tif err != nil {\n\t\tpanic(\"Not Connect database\")\n\t}\n\tparamID := c.Param(\"id\")\n\tquery := `DELETE FROM tabelproduct WHERE id ='` + paramID + `';`\n\tupdDB, err := Db.Query(query)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer updDB.Close()\n\tDb.Close()\n\tc.JSON(http.StatusOK, \"Delete record successfully\")\n}", "func (c *KubeVirtController) genericDeleteHandler(obj interface{}, expecter *controller.UIDTrackingControllerExpectations) {\n\to, err := validateDeleteObject(obj)\n\tif err != nil {\n\t\tlog.Log.Reason(err).Error(\"Failed to process delete notification\")\n\t\treturn\n\t}\n\n\tk, err := controller.KeyFunc(o)\n\tif err != nil {\n\t\tlog.Log.Reason(err).Errorf(\"could not extract key from k8s object\")\n\t\treturn\n\t}\n\n\tkey, err := c.getKubeVirtKey()\n\tif key != \"\" && err == nil {\n\t\tif expecter != nil {\n\t\t\texpecter.DeletionObserved(key, k)\n\t\t}\n\t\tc.queue.AddAfter(key, defaultAddDelay)\n\t}\n}", "func (s *server) handleAlertDelete() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tkeyVal := s.getJSONRequestBody(r, w)\n\t\tAlertID := keyVal[\"id\"].(string)\n\n\t\terr := s.database.AlertDelete(AlertID)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tActiveAlerts = s.database.GetActiveAlerts()\n\n\t\ts.respondWithJSON(w, http.StatusOK, ActiveAlerts)\n\t}\n}", "func (app *App) Delete(url string, handler handlerFunc) {\n\trequestRegexp := app.craterRouter.normalizeRoute(url)\n\tapp.craterRequestHandler.handleDelete(requestRegexp, func(w http.ResponseWriter, r *http.Request) {\n\t\tapp.serveRequest(w, r, handler, requestRegexp)\n\t})\n}", "func (s *GoJobServer) handleDelete(conn net.Conn, cmdReader *bufio.Reader) {\n\t// DELETE<\\0><id>\n\tjobID, err := data.ParseUint64(cmdReader)\n\tif err != nil {\n\t\terrorResponse(conn, \"Malformed DELETE command: failed to parse job ID\")\n\t\treturn\n\t}\n\n\terr = s.queue.DeleteJob(jobID)\n\tif err != nil {\n\t\terrorResponse(conn, fmt.Sprintf(\"Job %v already deleted\", jobID))\n\t\treturn\n\t}\n\n\tconn.Write(data.PackString(\"OK\"))\n}", "func (r *AlertsConfigReconciler) HandleDelete(ctx context.Context, alertsConfig *alertmanagerv1alpha1.AlertsConfig) error {\n\tlog := log.Logger(ctx, \"controllers\", \"alertsconfig_controller\", \"HandleDelete\")\n\tlog = log.WithValues(\"alertsConfig_cr\", alertsConfig.Name, \"namespace\", alertsConfig.Namespace)\n\t// Lets check the status of the CR and\n\t// retrieve all the alerts associated with this CR and delete it\n\t//Check if any alerts were created with this config\n\tif len(alertsConfig.Status.AlertsStatus) > 0 {\n\t\t//Call wavefront api and delete the alerts one by one\n\t\tfor _, alert := range alertsConfig.Status.AlertsStatus {\n\t\t\tif err := r.DeleteIndividualAlert(ctx, alertsConfig.Name, alert, alertsConfig.Namespace); err != nil {\n\t\t\t\tlog.Error(err, \"skipping alert deletion\", \"alertID\", alert.ID)\n\t\t\t\t// Just skip it for now\n\t\t\t\t// this is too opinionated but we don't want to stop the delete execution for other alerts as well\n\t\t\t\t// if there is any valid reasons not to skip it, we can look into it in future\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ok. Lets delete the finalizer so controller can delete the custom object\n\tlog.Info(\"Removing finalizer from WavefrontAlert\")\n\talertsConfig.ObjectMeta.Finalizers = utils.RemoveString(alertsConfig.ObjectMeta.Finalizers, alertsConfigFinalizerName)\n\tr.CommonClient.UpdateMeta(ctx, alertsConfig)\n\tlog.Info(\"Successfully deleted wfAlert\")\n\tr.Recorder.Event(alertsConfig, v1.EventTypeNormal, \"Deleted\", \"Successfully deleted WavefrontAlert\")\n\treturn nil\n}", "func DeleteTable(name string, db *sql.DB) error {\n\tsqlStmt := \"DROP TABLE IF EXISTS \\\"\" + name + \"\\\";\"\n\t_, err := db.Exec(sqlStmt)\n\treturn err\n}", "func (e *EventHandlerFuncs) OnDelete(table string, row Model) {\n\tif e.DeleteFunc != nil {\n\t\te.DeleteFunc(table, row)\n\t}\n}", "func HandleDeleteTask(w http.ResponseWriter, r *http.Request) {\n\tlog.Root.Info(\"HandleDeleteTask BEGIN\")\n\n\tif r.Method != http.MethodPost {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tHttpResponseError(w, ErrNotFound)\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\tbody, _ := ioutil.ReadAll(r.Body)\n\n\tdata := make(map[string]interface{})\n\terr := json.Unmarshal(body, &data)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleDeleteTask Parse HTTP request body error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\telem, ok := data[\"taskID\"]\n\tif !ok {\n\t\tlog.Root.Error(\"HandleDeleteTask HTTP form data error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\ttaskID := elem.(string)\n\terr = node.DeleteTask(taskID)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleDeleteTask Delete task error. TaskID: %v\", taskID)\n\t\tHttpResponseError(w, ErrServer)\n\t\treturn\n\t}\n\n\tlog.Root.Info(\"HandleDeleteTask END\")\n\tHttpResponseOk(w)\n\treturn\n}", "func DeleteSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\n\tindexer.RemoveIndexer(index)\n\tif err := conf.DeleteSchema(index); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": \"schema deleted\",\n\t\t\"index\": index,\n\t})\n}", "func (h *Handler) serveDeleteDBUser(w http.ResponseWriter, r *http.Request) {}", "func handlerAdminDeleteTrack(w http.ResponseWriter, r *http.Request) {\n\tsession, err := mgo.Dial(db.HostURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\t//Deletes all tracks in db\n\t_, err = session.DB(db.Databasename).C(db.TrackCollectionName).RemoveAll(bson.M{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "func (s *InMemoryHandler) Delete(tenant, functionName string) (string, error) {\n\tkey, err := model.GetKeyFromNames(tenant, functionName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn s.DeleteByKey(key)\n}", "func (h *Handlers) DeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\th.DBClient.DeletePerson(vars[\"id\"])\n\thttp.Redirect(w, r, \"/\", http.StatusMovedPermanently)\n}", "func (adm *admin) deleteBackendHandler(w http.ResponseWriter, r *http.Request) {\n\tif adm.backendAdmin == nil {\n\t\tadm.sendNotImplementedResponse(w)\n\t\treturn\n\t}\n\tif !adm.isHTTPPost(w, r) {\n\t\treturn\n\t}\n\tbid, res := processBkActionRequest(w, r, adm.backendAdmin.DeleteBackend)\n\tif bid != \"\" && res == common.ResultSuccess {\n\t\tgo adm.manager.abortAllBackendConnections(bid)\n\t}\n}", "func (net *NetworkComponentInput) DeleteRouteTable(con aws.EstablishConnectionInput) error {\n\n\tec2, seserr := con.EstablishConnection()\n\tif seserr != nil {\n\t\treturn seserr\n\t}\n\n\tfor _, route := range net.RouteTableIds {\n\t\terr := ec2.DeleteRouteTable(\n\t\t\t&aws.DescribeNetworkInput{\n\t\t\t\tRouteTableIds: []string{route},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//Waiting till reoutetables deletion is successfully completed\n\t\troutewait, routwaiterr := ec2.WaitUntilRoutTableDeleted(\n\t\t\t&aws.DescribeNetworkInput{\n\t\t\t\tRouteTableIds: []string{route},\n\t\t\t},\n\t\t)\n\t\tif routwaiterr != nil {\n\t\t\treturn routwaiterr\n\t\t}\n\t\tif routewait == false {\n\t\t\treturn fmt.Errorf(\"An error occurred while deleting a routetable\")\n\t\t}\n\t}\n\treturn nil\n}", "func (app *Application) handlerDeletePage(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\n\tpageID := chi.URLParam(req, \"pageID\")\n\tif err := app.DB.Delete(ctx, pageID); err != nil {\n\t\terrorOut(err, resp)\n\t\treturn\n\t}\n\n\tresult := api.DeletePageResponse{}\n\tresult.SetOk()\n\tokOut(result, resp)\n}", "func (de *DefaultEndpointHandler) HandleDELETE(w http.ResponseWriter, r *http.Request, resources []string) {\n\thttp.Error(w, \"Method Not Allowed\", http.StatusMethodNotAllowed)\n}", "func resourceKeboolaTableauWriterTableDelete(d *schema.ResourceData, meta interface{}) error {\n\tlog.Printf(\"[INFO] Clearing Tableau Writer Tables in Keboola: %s\", d.Id())\n\n\twriterID := d.Get(\"writer_id\").(string)\n\n\tclient := meta.(*KBCClient)\n\tdestroyResponse, err := client.DeleteFromSyrup(fmt.Sprintf(\"tde-exporter/v2/%s/tables/%s\", writerID, d.Id()))\n\n\tif hasErrors(err, destroyResponse) {\n\t\treturn extractError(err, destroyResponse)\n\t}\n\n\td.SetId(\"\")\n\n\treturn nil\n}", "func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func (t Table) Delete(d Data) error {\n\tdb, err := openDB(t.Config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\tsqlQuery := fmt.Sprintf(`DELETE FROM %s WHERE %s=$1`, t.Name, d.Key)\n\t_, err = db.Exec(sqlQuery, d.KeyVal)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (serv *Server) DELETE(url string, handlers ...Handler) {\n\tserv.Handle(\"DELETE\", url, handlers...)\n}", "func (apiHandler *ApiHandler) handleDeleteReplicaSet(\n\trequest *restful.Request, response *restful.Response) {\n\n\tnamespace := request.PathParameter(\"namespace\")\n\treplicaSet := request.PathParameter(\"replicaSet\")\n\n\tif err := DeleteReplicaSetWithPods(apiHandler.client, namespace, replicaSet); err != nil {\n\t\thandleInternalError(response, err)\n\t\treturn\n\t}\n\n\tresponse.WriteHeader(http.StatusOK)\n}", "func (h appHandler) deleteAppHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tprojectName := vars[\"project-name\"]\n\tcompositeAppName := vars[\"composite-app-name\"]\n\tcompositeAppVersion := vars[\"version\"]\n\tname := vars[\"app-name\"]\n\n\terr := h.client.DeleteApp(name, projectName, compositeAppName, compositeAppVersion)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (c *MockRouteTablesClient) Delete(ctx context.Context, resourceGroupName, routeTableName string) error {\n\t// Ignore resourceGroupName for simplicity.\n\tif _, ok := c.RTs[routeTableName]; !ok {\n\t\treturn fmt.Errorf(\"%s does not exist\", routeTableName)\n\t}\n\tdelete(c.RTs, routeTableName)\n\treturn nil\n}", "func (c *Config) Delete(ctx context.Context, req *proto.DeleteRequest, rsp *proto.DeleteResponse) error {\n\tif req.Change == nil {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete err: invalid change\")\n\t}\n\n\tif len(req.Change.Id) == 0 {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete err: invalid id\")\n\t}\n\n\tif err := db.Delete(req.Change); err != nil {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete commit err: %s\", err)\n\t}\n\n\treturn nil\n}", "func (i instanceHandler) deleteHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid := vars[\"instID\"]\n\n\terr := i.client.Delete(id)\n\tif err != nil {\n\t\tlog.Error(\"Error Deleting Instance\", log.Fields{\n\t\t\t\"error\": err,\n\t\t})\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusAccepted)\n}", "func (tr *Transport) Delete(url string, fn HandlerFunc, options ...HandlerOption) {\n\ttr.mux.Handler(net_http.MethodDelete, url, encapsulate(fn, tr.options, options))\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func makeDeleteHandler(m *mux.Router, endpoints endpoint.Endpoints, options []http.ServerOption) {\n\tm.Methods(\"DELETE\", \"OPTIONS\").Path(\"/departments/{id}\").Handler(\n\t\thandlers.CORS(\n\t\t\thandlers.AllowedMethods([]string{\"DELETE\"}),\n\t\t\thandlers.AllowedHeaders([]string{\"Content-Type\", \"Content-Length\"}),\n\t\t\thandlers.AllowedOrigins([]string{\"*\"}),\n\t\t)(http.NewServer(endpoints.DeleteEndpoint, decodeDeleteRequest, encodeDeleteResponse, options...)))\n}", "func (s *Service) HandleDelete(w http.ResponseWriter, r *http.Request) {\n\terr := s.subscriptionRepository.Delete(r.Context(), s.getResourceID(r), s.getSubscriptionID(r))\n\tif err != nil {\n\t\tstatus := http.StatusInternalServerError\n\t\tif errRepo, ok := err.(flare.SubscriptionRepositoryError); ok && errRepo.NotFound() {\n\t\t\tstatus = http.StatusNotFound\n\t\t}\n\n\t\ts.writer.Error(w, \"error during subscription delete\", err, status)\n\t\treturn\n\t}\n\n\ts.writer.Response(w, nil, http.StatusNoContent, nil)\n}", "func DeleteTrigger(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received a DELETE. Working. \")\n}", "func (s *WebService) Delete(route string, handler interface{}) {\r\n\ts.addRoute(route, \"DELETE\", handler)\r\n}", "func (t BlobsTable) Delete(ctx context.Context, query string, args ...interface{}) error {\n\treturn t.driver.delete(ctx, query, args...)\n}", "func (api *Api) Delete(path string, endpoint http.HandlerFunc, queries ...string) {\n\tapi.Router.HandleFunc(path, endpoint).Methods(\"DELETE\").Queries(queries...)\n}", "func HandleDeletePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tid := r.URL.Query().Get(\"id\")\n\tif id == \"\" {\n\t\thttp.Error(w, \"id parameter is not found\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tresult, err := Db.Exec(\"DELETE FROM people WHERE id=?\", id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"ERROR in deleting person %s\", err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\trows, _ := result.RowsAffected()\n\tfmt.Printf(\"person deleted. %d rows affected !\", rows)\n\tw.WriteHeader(http.StatusOK)\n}", "func DeleteDocumentHandler(index, typeName, endpoint string, r *http.Request, s server.PGElasticServer) (response interface{}, err error) {\n\tdocumentID := endpoint\n\tdocumentObject, err := s.GetDBClient().DeleteDocument(index, typeName, documentID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif documentObject != nil {\n\t\tresponse = documentGetResponse{\n\t\t\tIndex: index,\n\t\t\tType: typeName,\n\t\t\tID: documentObject.ID,\n\t\t\tVersion: documentObject.Version,\n\t\t\tFound: true,\n\t\t\tDocument: documentObject.Document,\n\t\t}\n\t} else {\n\t\tresponse = documentGetResponse{\n\t\t\tIndex: index,\n\t\t\tType: typeName,\n\t\t\tFound: false,\n\t\t}\n\n\t}\n\treturn response, nil\n}", "func Delete(table string) string {\n\treturn \" DELETE FROM \" + table\n}", "func (p *ThriftHiveMetastoreClient) DropTable(ctx context.Context, dbname string, name string, deleteData bool) (err error) {\n var _args58 ThriftHiveMetastoreDropTableArgs\n _args58.Dbname = dbname\n _args58.Name = name\n _args58.DeleteData = deleteData\n var _result59 ThriftHiveMetastoreDropTableResult\n if err = p.Client_().Call(ctx, \"drop_table\", &_args58, &_result59); err != nil {\n return\n }\n switch {\n case _result59.O1!= nil:\n return _result59.O1\n case _result59.O3!= nil:\n return _result59.O3\n }\n\n return nil\n}", "func HandleDeleteSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/software_configs/e2fe5553-a481-4549-9d0f-e208de3d98d1\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"DELETE\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusNoContent)\n\t})\n}", "func DeleteHandler(w http.ResponseWriter, r *http.Request, serv *AppServer) {\n\tsession, err := r.Cookie(\"UserID\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdelID, err := strconv.Atoi(session.Value)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tserv.DeleteUser(delID)\n\n\tLogoutHandler(w, r, serv)\n}" ]
[ "0.6963174", "0.676391", "0.62355494", "0.62247586", "0.59905803", "0.59797716", "0.58880305", "0.5785819", "0.578474", "0.5781386", "0.5774196", "0.5727618", "0.57153195", "0.56381917", "0.5621189", "0.5557837", "0.554666", "0.5542971", "0.55374545", "0.5530049", "0.5524039", "0.55104655", "0.54963994", "0.5481403", "0.54576385", "0.54575765", "0.5455661", "0.54546314", "0.54476786", "0.5429888", "0.5425354", "0.54250556", "0.54128414", "0.5396802", "0.5394078", "0.5381264", "0.5371157", "0.5369379", "0.53298485", "0.5326275", "0.53158695", "0.53087616", "0.5304763", "0.52948844", "0.528127", "0.5253261", "0.5251483", "0.5246516", "0.52451307", "0.5236952", "0.52309334", "0.5218673", "0.5213949", "0.5213536", "0.5209433", "0.52026767", "0.5195258", "0.5173009", "0.5164444", "0.51593494", "0.5158534", "0.5157329", "0.51534534", "0.5152522", "0.515247", "0.5150839", "0.5149938", "0.51468676", "0.5139909", "0.5137879", "0.51241463", "0.5123782", "0.511463", "0.5113297", "0.50981116", "0.50952715", "0.5093812", "0.5092981", "0.50875765", "0.50873303", "0.50853497", "0.50792444", "0.50737655", "0.50719553", "0.5068136", "0.50560397", "0.5054682", "0.505458", "0.5042139", "0.5041348", "0.50385225", "0.50372595", "0.5035541", "0.5024771", "0.50210404", "0.50109166", "0.4998465", "0.49955228", "0.49882355", "0.4988072" ]
0.8042683
0
HandleSetDatabaseConfig is an endpoint handler which updates database config & connects to database
func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) v := config.CrudStub{} _ = json.NewDecoder(r.Body).Decode(&v) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] if err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tdbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func (config *Config) configureDB(viperRegistry *viper.Viper) error {\n\tdbConfig := &DatabaseSetting{}\n\tdb := viperRegistry.Sub(\"db\")\n\n\tif err := db.Unmarshal(dbConfig); err != nil {\n\t\treturn err\n\t}\n\n\tif !db.IsSet(\"user\") {\n\t\tif !viperRegistry.IsSet(\"DB_USER\") {\n\t\t\treturn errors.New(\"database user not set\")\n\t\t}\n\n\t\tdbConfig.User = viperRegistry.GetString(\"DB_USER\")\n\t}\n\n\tif !db.IsSet(\"password\") {\n\t\tif !viperRegistry.IsSet(\"DB_PASSWORD\") {\n\t\t\treturn errors.New(\"database password not set\")\n\t\t}\n\n\t\tdbConfig.Password = viperRegistry.GetString(\"DB_PASSWORD\")\n\t}\n\n\tif !db.IsSet(\"name\") {\n\t\tif !viperRegistry.IsSet(\"DB_NAME\") {\n\t\t\treturn errors.New(\"database name not set\")\n\t\t}\n\n\t\tdbConfig.Name = viperRegistry.GetString(\"DB_NAME\")\n\t}\n\n\tif !db.IsSet(\"address\") {\n\t\tif !viperRegistry.IsSet(\"DB_ADDRESS\") {\n\t\t\treturn errors.New(\"database address not set\")\n\t\t}\n\n\t\tdbConfig.Address = viperRegistry.GetString(\"DB_ADDRESS\")\n\t}\n\n\tconfig.Database = dbConfig\n\n\treturn nil\n}", "func SetDatabaseConfig(datab Database) (error) {\n\tdb, err := sql.Open(\"mysql\", datab.Username+\":\"+datab.Password+\"@/\"+datab.Database)\n\tdefer db.Close()\n\tif (err == nil) {\n\t\tdatabase = datab\n\t\tfmt.Println(\"Able to open Connection to database\")\n\t}\n\treturn err\n}", "func onDatabaseConfig(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\trequires := getDBLocalProxyRequirement(tc, database)\n\t// \"tsh db config\" prints out instructions for native clients to connect to\n\t// the remote proxy directly. Return errors here when direct connection\n\t// does NOT work (e.g. when ALPN local proxy is required).\n\tif requires.localProxy {\n\t\tmsg := formatDbCmdUnsupported(cf, database, requires.localProxyReasons...)\n\t\treturn trace.BadParameter(msg)\n\t}\n\n\thost, port := tc.DatabaseProxyHostPort(*database)\n\trootCluster, err := tc.RootClusterName(cf.Context)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tformat := strings.ToLower(cf.Format)\n\tswitch format {\n\tcase dbFormatCommand:\n\t\tcmd, err := dbcmd.NewCmdBuilder(tc, profile, database, rootCluster,\n\t\t\tdbcmd.WithPrintFormat(),\n\t\t\tdbcmd.WithLogger(log),\n\t\t).GetConnectCommand()\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(strings.Join(cmd.Env, \" \"), cmd.Path, strings.Join(cmd.Args[1:], \" \"))\n\tcase dbFormatJSON, dbFormatYAML:\n\t\tconfigInfo := &dbConfigInfo{\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName),\n\t\t\tprofile.KeyPath(),\n\t\t}\n\t\tout, err := serializeDatabaseConfig(configInfo, format)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(out)\n\tdefault:\n\t\tfmt.Printf(`Name: %v\nHost: %v\nPort: %v\nUser: %v\nDatabase: %v\nCA: %v\nCert: %v\nKey: %v\n`,\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName), profile.KeyPath())\n\t}\n\treturn nil\n}", "func HandleRemoveDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.RemoveDatabaseConfig(ctx, projectID, dbAlias); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func (m *Modules) SetDatabaseConfig(ctx context.Context, projectID string, databaseConfigs config.DatabaseConfigs, schemaConfigs config.DatabaseSchemas, ruleConfigs config.DatabaseRules, prepConfigs config.DatabasePreparedQueries) error {\n\tmodule, err := m.loadModule(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn module.SetDatabaseConfig(ctx, projectID, databaseConfigs, schemaConfigs, ruleConfigs, prepConfigs)\n}", "func configureDatabase(conf dbConfig) error {\n\tif err := db.NewInstance(conf.Type, conf.Dsn); err != nil {\n\t\treturn err\n\t}\n\n\tif err := settings.Init(); err != nil {\n\t\treturn err\n\t}\n\n\tpersistSettings := func() {\n\t\tif err := settings.Persist(); err != nil {\n\t\t\tlog.ERROR.Println(\"cannot save settings:\", err)\n\t\t}\n\t}\n\n\t// persist unsaved settings on shutdown\n\tshutdown.Register(persistSettings)\n\n\t// persist unsaved settings every 30 minutes\n\tgo func() {\n\t\tfor range time.Tick(30 * time.Minute) {\n\t\t\tpersistSettings()\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (pg *PostgresqlDb) config() *domain.ErrHandler {\n var port string\n ok := false\n pg.host, ok = os.LookupEnv(dbhost)\n if !ok {\n return &domain.ErrHandler{2, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n port, ok = os.LookupEnv(dbport)\n if !ok {\n return &domain.ErrHandler{3, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.port, _ = strconv.Atoi(port)\n pg.user, ok = os.LookupEnv(dbuser)\n if !ok {\n return &domain.ErrHandler{4, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.pass, ok = os.LookupEnv(dbpass)\n if !ok {\n return &domain.ErrHandler{5, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.dbname, ok = os.LookupEnv(dbname)\n if !ok {\n return &domain.ErrHandler{6, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n return nil\n}", "func HandleSetEventingConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-config\", \"modify\", map[string]string{\"project\": projectID})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := new(config.Eventing)\n\t\t_ = json.NewDecoder(r.Body).Decode(c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingConfig(ctx, projectID, c.DBAlias, c.Enabled, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (p Config) SetDB(conn *gorm.DB) {\n\tdb = conn\n}", "func withConfig(getDB func() *sql.DB, handle func(getDB func() *sql.DB, w http.ResponseWriter, r *http.Request, ps httprouter.Params)) httprouter.Handle {\n\treturn httprouter.Handle(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thandle(getDB, w, r, ps)\n\t},\n\t)\n}", "func TestSetConfigHandler(t *testing.T) {\n\tadminTestBed, err := prepareAdminXLTestBed()\n\tif err != nil {\n\t\tt.Fatal(\"Failed to initialize a single node XL backend for admin handler tests.\")\n\t}\n\tdefer adminTestBed.TearDown()\n\n\t// Initialize admin peers to make admin RPC calls.\n\tglobalMinioAddr = \"127.0.0.1:9000\"\n\tinitGlobalAdminPeers(mustGetNewEndpointList(\"http://127.0.0.1:9000/d1\"))\n\n\t// SetConfigHandler restarts minio setup - need to start a\n\t// signal receiver to receive on globalServiceSignalCh.\n\tgo testServiceSignalReceiver(restartCmd, t)\n\n\t// Prepare query params for set-config mgmt REST API.\n\tqueryVal := url.Values{}\n\tqueryVal.Set(\"config\", \"\")\n\n\treq, err := buildAdminRequest(queryVal, \"set\", http.MethodPut, int64(len(configJSON)),\n\t\tbytes.NewReader(configJSON))\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to construct get-config object request - %v\", err)\n\t}\n\n\trec := httptest.NewRecorder()\n\tadminTestBed.mux.ServeHTTP(rec, req)\n\tif rec.Code != http.StatusOK {\n\t\tt.Errorf(\"Expected to succeed but failed with %d\", rec.Code)\n\t}\n\n\tresult := setConfigResult{}\n\terr = json.NewDecoder(rec.Body).Decode(&result)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to decode set config result json %v\", err)\n\t}\n\n\tif !result.Status {\n\t\tt.Error(\"Expected set-config to succeed, but failed\")\n\t}\n}", "func InitConfig() (DbConnection, APIServerInfo) {\n\t// Default configurations\n\tdbConnection := DbConnection{\n\t\tUser: \"tankyou_poc\",\n\t\tDatabase: \"tankyou_poc\",\n\t\tPassword: \"tankyou_poc\",\n\t\tHost: \"0.0.0.0\",\n\t\tPort: \"5432\",\n\t\tDefaultTimeZone: \"Europe/Paris\",\n\t}\n\tAPIServer := APIServerInfo{\n\t\tHostname: \"0.0.0.0\",\n\t\tPort: \"3000\",\n\t\tJWTSecretKey: \"MagicalTokenIsTheBest\",\n\t}\n\t// Default host for DB in Docker containers\n\tif os.Getenv(\"ENVTYPE\") == \"container\" {\n\t\tlog.Print(\"<><><><> Setting host to container default \\n\")\n\t\tdbConnection.Host = \"database\"\n\t}\n\t// Get values set in env\n\tif apiPort := os.Getenv(\"API_PORT\"); apiPort != \"\" {\n\t\tlog.Print(\"<><><><> Setting api port \\n\")\n\t\tAPIServer.Port = apiPort\n\t}\n\tif apiHostname := os.Getenv(\"API_HOST\"); apiHostname != \"\" {\n\t\tlog.Print(\"<><><><> Setting api hostname \\n\")\n\t\tAPIServer.Hostname = apiHostname\n\t}\n\tif jwtSecret := os.Getenv(\"JWT_SECRET\"); jwtSecret != \"\" {\n\t\tlog.Print(\"<><><><> Setting JWT secret \\n\")\n\t\tAPIServer.JWTSecretKey = jwtSecret\n\t}\n\t// Will be erased if user is not root\n\tif dbRootPassword := os.Getenv(\"MYSQL_ROOT_PASSWORD\"); dbRootPassword != \"\" {\n\t\tlog.Print(\"<><><><> Setting db root password \\n\")\n\t\tdbConnection.Password = dbRootPassword\n\t}\n\tif dbUser := os.Getenv(\"MYSQL_USER\"); dbUser != \"\" {\n\t\tlog.Print(\"<><><><> Setting db user and user password \\n\")\n\t\tdbConnection.User = dbUser\n\t\t// Can be empty. Should be define when user is define\n\t\tdbConnection.Password = os.Getenv(\"MYSQL_PASSWORD\")\n\t}\n\tif dbName := os.Getenv(\"MYSQL_DATABASE\"); dbName != \"\" {\n\t\tlog.Print(\"<><><><> Setting db name \\n\")\n\t\tdbConnection.Database = dbName\n\t}\n\tif dbPort := os.Getenv(\"MYSQL_PORT\"); dbPort != \"\" {\n\t\tlog.Print(\"<><><><> Setting db port \\n\")\n\t\tdbConnection.Port = dbPort\n\t}\n\tif dbHost := os.Getenv(\"MYSQL_HOST\"); dbHost != \"\" {\n\t\tlog.Print(\"<><><><> Setting db host \\n\")\n\t\tdbConnection.Host = dbHost\n\t}\n\tif defTimeZone := os.Getenv(\"DEFAULT_TIME_ZONE\"); defTimeZone != \"\" {\n\t\tlog.Print(\"<><><><> Setting db host \\n\")\n\t\tdbConnection.DefaultTimeZone = defTimeZone\n\t}\n\n\t// Return new configs\n\treturn dbConnection, APIServer\n}", "func (database *Database) setConfigs(environment string) {\n\tswitch environment {\n\tcase \"test\":\n\t\tdatabase.host = os.Getenv(\"TEST_DB_HOST\")\n\t\tdatabase.port = os.Getenv(\"TEST_DB_PORT\")\n\t\tdatabase.username = os.Getenv(\"TEST_DB_USERNAME\")\n\t\tdatabase.password = os.Getenv(\"TEST_DB_PASSWORD\")\n\t\tdatabase.name = os.Getenv(\"TEST_DB_NAME\")\n\tdefault:\n\t\tdatabase.host = os.Getenv(\"DB_HOST\")\n\t\tdatabase.port = os.Getenv(\"DB_PORT\")\n\t\tdatabase.username = os.Getenv(\"DB_USERNAME\")\n\t\tdatabase.password = os.Getenv(\"DB_PASSWORD\")\n\t\tdatabase.name = os.Getenv(\"DB_NAME\")\n\t}\n}", "func (m *Modules) SetDatabaseSchemaConfig(ctx context.Context, projectID string, schemaConfigs config.DatabaseSchemas) error {\n\tmodule, err := m.loadModule(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn module.SetDatabaseSchemaConfig(ctx, projectID, schemaConfigs)\n}", "func (s *Manager) SetDatabaseConnection(ctx context.Context, project, dbAlias string, v config.CrudStub) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update database config\n\tcoll, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\tprojectConfig.Modules.Crud[dbAlias] = &config.CrudStub{Conn: v.Conn, Enabled: v.Enabled, Collections: map[string]*config.TableRule{}, Type: v.Type}\n\t} else {\n\t\tcoll.Conn = v.Conn\n\t\tcoll.Enabled = v.Enabled\n\t\tcoll.Type = v.Type\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func DBConfig(globalConfig *viper.Viper) (config *mysql.Config, err error) {\n\t// Env variables are not loaded if the keys do not exist in the config file\n\t// To fix this issue, instead of loading config files and overriding with env vars,\n\t// we load all possible keys (with their default value), override with config files,\n\t// and then environmenent variables.\n\temptyConfig := &map[string]interface{}{}\n\tif err = mapstructure.Decode(mysql.NewConfig(), &emptyConfig); err != nil {\n\t\treturn // unexpected\n\t}\n\tvConfig := viper.New()\n\t_ = vConfig.MergeConfigMap(*emptyConfig) // the function always return nil\n\tif conf := globalConfig.GetStringMap(databaseConfigKey); conf != nil {\n\t\t_ = vConfig.MergeConfigMap(conf)\n\t}\n\tvConfig.SetEnvPrefix(fmt.Sprintf(\"%s_%s_\", envPrefix, databaseConfigKey))\n\tvConfig.AutomaticEnv()\n\terr = vConfig.Unmarshal(&config)\n\treturn\n}", "func WithDatabase(db persistence.Service) Config {\n\treturn func(r *router) {\n\t\tr.db = db\n\t}\n}", "func (this *dataStore) SetConnPool(configFile string) (error) {\r\n\r\n\tif err := utils.LoadConfig(this.connPool, configFile); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tthis.connPool.ConnMaxLifetime *= time.Second\r\n\r\n\tif this.connPool.MaxOpenConns < this.connPool.MaxIdleConns {\r\n\t\tthis.connPool.MaxIdleConns = this.connPool.MaxOpenConns\r\n\t}\r\n\r\n\tthis.SetMaxOpenConns(this.connPool.MaxOpenConns)\r\n\tthis.SetMaxIdleConns(this.connPool.MaxIdleConns)\r\n\tthis.SetConnMaxLifetime(this.connPool.ConnMaxLifetime)\r\n\r\n\treturn nil\r\n}", "func Configure(url string, name string) {\n\tendpoint = url\n\tdbName = name\n}", "func ConfigPOST(db *sqlx.DB, ctx *gin.Context) {\n\n var (\n err error\n jsonRequest ConfigPOSTRequest\n )\n\n // parse setting param\n var setting string = strings.ToLower(ctx.Param(\"setting\"))\n\n // parse request\n\n err = ctx.BindJSON(&jsonRequest)\n if err != nil {\n\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status\": http.StatusBadRequest,\n \"developerMessage\": err.Error(),\n \"userMessage\": \"bad JSON input\",\n })\n ctx.Error(err)\n return\n }\n\n err = SetConfig(db, setting, jsonRequest.Value)\n switch {\n case err == ErrConfigEmptyStringSetting:\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status\": http.StatusBadRequest,\n \"developerMessage\": err.Error(),\n \"userMessage\": \"given config setting is an empty string\",\n })\n ctx.Error(err)\n case err != nil:\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"status\": http.StatusInternalServerError,\n \"developerMessage\": err.Error(),\n \"userMessage\": \"unable to set config setting\",\n })\n ctx.Error(err)\n return\n }\n\n ctx.JSON(http.StatusOK, gin.H{\n \"setting\": setting,\n \"value\": jsonRequest.Value,\n })\n}", "func (adm *admin) backendConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tif adm.backendAdmin == nil {\n\t\tadm.sendNotImplementedResponse(w)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tbid := beIDRe.FindStringSubmatch(r.URL.RequestURI())\n\tfmt.Fprint(w, adm.backendAdmin.BackendConfig(bid[3]))\n}", "func (db *Database) config() {\n\tdb.Driver = os.Getenv(\"DB_DRIVER\")\n\tdb.Host = os.Getenv(\"DB_HOST\")\n\tdb.Port = os.Getenv(\"DB_PORT\")\n\tdb.User = os.Getenv(\"DB_USER\")\n\tdb.Password = os.Getenv(\"DB_PASSWORD\")\n\tdb.Name = os.Getenv(\"DB_NAME\")\n}", "func HandleGetDatabaseConnectionState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tconnState := crud.GetConnectionState(ctx, dbAlias)\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: connState})\n\t}\n}", "func (d DB) SetConfig(ctx context.Context, userID string, cfg userconfig.Config) error {\n\tif !cfg.RulesConfig.FormatVersion.IsValid() {\n\t\treturn fmt.Errorf(\"invalid rule format version %v\", cfg.RulesConfig.FormatVersion)\n\t}\n\tcfgBytes, err := json.Marshal(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = d.Insert(\"configs\").\n\t\tColumns(\"owner_id\", \"owner_type\", \"subsystem\", \"config\").\n\t\tValues(userID, entityType, subsystem, cfgBytes).\n\t\tExec()\n\treturn err\n}", "func Config(connurl string, ssldir string) (err error) {\n\tif err = Close(); err != nil {\n\t\treturn\n\t}\n\n\tu, err := url.Parse(connurl)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tquery := u.Query()\n\tquery.Set(\"sslmode\", \"require\")\n\tu.RawQuery = query.Encode()\n\n\tdriverName := u.Scheme\n\tu.Scheme = \"\"\n\tdataSourceName := strings.TrimPrefix(u.String(), \"//\")\n\tif driverName == \"postgres\" {\n\t\tdataSourceName = driverName + \"://\" + dataSourceName\n\t}\n\tif db, err = sqlx.Open(driverName, dataSourceName); err != nil {\n\t\treturn ErrDatabaseOpenFailed1.New(err, connurl)\n\t}\n\n\tif err = db.Ping(); err != nil {\n\t\treturn ErrDatabasePingFailed1.New(err, connurl)\n\t}\n\n\tdb.SetMaxOpenConns(20)\n\n\treturn\n}", "func Setup() {\n\tnow := time.Now()\n\tvar err error\n\tfmt.Print(setting.FileConfigSetting.Database)\n\tconnectionstring := fmt.Sprintf(\n\t\t\"user=%s password=%s dbname=%s sslmode=disable host=%s port=%s\",\n\t\tsetting.FileConfigSetting.Database.User,\n\t\tsetting.FileConfigSetting.Database.Password,\n\t\tsetting.FileConfigSetting.Database.Name,\n\t\tsetting.FileConfigSetting.Database.Host,\n\t\tsetting.FileConfigSetting.Database.Port)\n\tfmt.Printf(\"%s\", connectionstring)\n\tConn, err = gorm.Open(setting.FileConfigSetting.Database.Type, connectionstring)\n\tif err != nil {\n\t\tlog.Printf(\"connection.setup err : %v\", err)\n\t\tpanic(err)\n\t}\n\tgorm.DefaultTableNameHandler = func(db *gorm.DB, defaultTableName string) string {\n\t\treturn setting.FileConfigSetting.Database.TablePrefix + defaultTableName\n\t}\n\tConn.SingularTable(true)\n\tConn.DB().SetMaxIdleConns(10)\n\tConn.DB().SetMaxOpenConns(100)\n\n\tgo autoMigrate()\n\n\ttimeSpent := time.Since(now)\n\tlog.Printf(\"Config database is ready in %v\", timeSpent)\n\n}", "func InitDBConfig(driverName, dbName, dataSource string) {\n\tonce.Do(func() {\n\t\tif err := orm.RegisterDriver(driverName, orm.DRSqlite); err != nil {\n\t\t\tklog.Exitf(\"Failed to register driver: %v\", err)\n\t\t}\n\t\tif err := orm.RegisterDataBase(\n\t\t\tdbName,\n\t\t\tdriverName,\n\t\t\tdataSource); err != nil {\n\t\t\tklog.Exitf(\"Failed to register db: %v\", err)\n\t\t}\n\t\t// sync database schema\n\t\tif err := orm.RunSyncdb(dbName, false, true); err != nil {\n\t\t\tklog.Errorf(\"run sync db error %v\", err)\n\t\t}\n\t\t// create orm\n\t\tDBAccess = orm.NewOrm()\n\t\tif err := DBAccess.Using(dbName); err != nil {\n\t\t\tklog.Errorf(\"Using db access error %v\", err)\n\t\t}\n\t})\n}", "func (s *Server) ConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\t// copy current config, this allows for setting only a subset of the whole config\n\t\tvar cfg regenbox.Config = s.Regenbox.Config()\n\t\terr := json.NewDecoder(r.Body).Decode(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error decoding json:\", err)\n\t\t\thttp.Error(w, \"couldn't decode provided json\", http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\tif !s.Regenbox.Stopped() {\n\t\t\thttp.Error(w, \"regenbox must be stopped first\", http.StatusNotAcceptable)\n\t\t\treturn\n\t\t}\n\t\terr = s.Regenbox.SetConfig(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error setting config:\", err)\n\t\t\thttp.Error(w, \"error setting config (internal)\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// save newly set config - todo ? huston we have design issues\n\t\t//err = util.WriteTomlFile(cfg, s.cfg)\n\t\t//if err != nil {\n\t\t//\tlog.Println(\"error writing config:\", err)\n\t\t//}\n\t\tbreak\n\tcase http.MethodGet:\n\t\tbreak\n\tdefault:\n\t\thttp.Error(w, fmt.Sprintf(\"unexpected http-method (%s)\", r.Method), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// encode regenbox config regardless of http method\n\tw.WriteHeader(200)\n\t_ = json.NewEncoder(w).Encode(s.Regenbox.Config())\n\treturn\n}", "func (a *AuthHandler) setConfig(config AuthHandlerConfig) {\n\ta.config = config\n}", "func (server *MUDServer) SetConfig( config *conf.ConfigFile ) error {\n if( server == nil ) {\n return MUDServerError {\n time.Now(),\n \"ConfigFile provided to SetConfig is nil!\",\n }\n }\n\n requiredFields := [...][3]string {\n { \"server\", \"port\", \"int\" },\n { \"database\", \"host\", \"string\" },\n { \"database\", \"user\", \"string\" },\n { \"database\", \"password\", \"string\" },\n { \"database\", \"database\", \"string\" },\n { \"users\", \"timeout\", \"int\" },\n }\n\n // Create slice to contain errors for fields.\n fieldErrors := make( []error, len( requiredFields ) )\n\n // Check required fields for errors\n for _, y := range requiredFields {\n var err error\n\n if( y[2] == \"int\" ) {\n _, err = config.GetInt( y[0], y[1] )\n } else if( y[2] == \"string\" ) {\n _, err = config.GetString( y[0], y[1] )\n }\n\n if( err != nil ) {\n fieldErrors = append( fieldErrors, err )\n }\n }\n\n\n // Loop trough errors and generate error message out of them.\n if( len( fieldErrors ) > 0 ) {\n var errorCount = 0\n errorBuf := bytes.NewBufferString( \"\\n\\tFollowing errors occured when checking fields of the configuration file:\\n\" )\n\n for _, e := range fieldErrors {\n if( e == nil ) {\n continue\n }\n fmt.Fprintf( errorBuf, \"\\t - %s\\n\", e.Error() )\n errorCount++\n }\n\n if( errorCount > 0 ) {\n return MUDServerError {\n time.Now(),\n errorBuf.String(),\n }\n }\n }\n\n server.config = config\n return nil\n}", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func SetDB(db *config.DatabaseCfg) {\n\tdbc = db\n}", "func setupConfigHandlers(r *mux.Router) {\n\tr.HandleFunc(\"/config\", settingshttp.Server.GetFullSystemProbeConfig(getAggregatedNamespaces()...)).Methods(\"GET\")\n\tr.HandleFunc(\"/config/list-runtime\", settingshttp.Server.ListConfigurable).Methods(\"GET\")\n\tr.HandleFunc(\"/config/{setting}\", settingshttp.Server.GetValue).Methods(\"GET\")\n\tr.HandleFunc(\"/config/{setting}\", settingshttp.Server.SetValue).Methods(\"POST\")\n}", "func newConfigHandler() *configHandler {\n return &configHandler {\n database: map[string]Config{},\n }\n}", "func (s *Manager) SetEventingConfig(ctx context.Context, project, dbAlias string, enabled bool, params model.RequestParams) (int, error) {\n\t// Check if the request has been hijacked\n\thookResponse := s.integrationMan.InvokeHook(ctx, params)\n\tif hookResponse.CheckResponse() {\n\t\t// Check if an error occurred\n\t\tif err := hookResponse.Error(); err != nil {\n\t\t\treturn hookResponse.Status(), err\n\t\t}\n\n\t\t// Gracefully return\n\t\treturn hookResponse.Status(), nil\n\t}\n\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\n\tdbConfig, p := s.checkIfDbAliasExists(projectConfig.DatabaseConfigs, dbAlias)\n\tif !p && enabled {\n\t\treturn http.StatusBadRequest, helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf(\"Unknown db alias (%s) provided while setting eventing config\", dbAlias), nil, nil)\n\t}\n\n\tprojectConfig.EventingConfig.DBAlias = dbAlias\n\tprojectConfig.EventingConfig.Enabled = enabled\n\n\tif err := s.modules.SetEventingConfig(ctx, project, projectConfig.EventingConfig, projectConfig.EventingRules, projectConfig.EventingSchemas, projectConfig.EventingTriggers); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif enabled {\n\t\tif err := s.applySchemas(ctx, project, dbAlias, projectConfig, config.CrudStub{\n\t\t\tCollections: map[string]*config.TableRule{\n\t\t\t\tutils.TableEventingLogs: {Schema: utils.SchemaEventLogs, Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}},\n\t\t\t\tutils.TableInvocationLogs: {Schema: utils.SchemaInvocationLogs, Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}},\n\t\t\t},\n\t\t\tDBName: dbConfig.DBName,\n\t\t}); err != nil {\n\t\t\treturn http.StatusInternalServerError, err\n\t\t}\n\t\tstatus, err := s.setCollectionRules(ctx, projectConfig, project, dbAlias, utils.TableEventingLogs, &config.DatabaseRule{Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}})\n\t\tif err != nil {\n\t\t\treturn status, err\n\t\t}\n\t\tstatus, err = s.setCollectionRules(ctx, projectConfig, project, dbAlias, utils.TableInvocationLogs, &config.DatabaseRule{Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}})\n\t\tif err != nil {\n\t\t\treturn status, err\n\t\t}\n\t}\n\n\tresourceID := config.GenerateResourceID(s.clusterID, project, config.ResourceEventingConfig, \"eventing\")\n\tif err := s.store.SetResource(ctx, resourceID, projectConfig.EventingConfig); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func (c *configHandler) createNewConfig(w http.ResponseWriter, r *http.Request) {\n log.Printf(\"received /configs POST request from %v\", r.Host)\n requestbody, err := ioutil.ReadAll(r.Body)\n defer r.Body.Close()\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n w.Write([]byte(err.Error()))\n return\n }\n\n // check request's content-type\n content := r.Header.Get(\"content-type\")\n if content != \"application/json\" {\n w.WriteHeader(http.StatusUnsupportedMediaType)\n w.Write([]byte(err.Error()))\n return\n }\n\n var newconfig Config\n err = json.Unmarshal(requestbody, &newconfig)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n w.Write([]byte(err.Error()))\n return\n }\n\n c.Lock()\n c.database[newconfig.Name] = newconfig\n c.Unlock()\n log.Print(\"Created new config successfully and added to database \", c.database)\n\n w.WriteHeader(http.StatusOK)\n}", "func configureConnectionPool(dbPool *sql.DB) {\n\t// [START cloud_sql_mysql_databasesql_limit]\n\n\t// Set maximum number of connections in idle connection pool.\n\tdbPool.SetMaxIdleConns(5)\n\n\t// Set maximum number of open connections to the database.\n\tdbPool.SetMaxOpenConns(7)\n\n\t// [END cloud_sql_mysql_databasesql_limit]\n\n\t// [START cloud_sql_mysql_databasesql_lifetime]\n\n\t// Set Maximum time (in seconds) that a connection can remain open.\n\tdbPool.SetConnMaxLifetime(1800)\n\n\t// [END cloud_sql_mysql_databasesql_lifetime]\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func addAppConfigHandler(ctx *gin.Context) {\n log.Info(\"received request to generate new app config\")\n var config struct{\n AppName string `json:\"app_name\" binding:\"required\"`\n Config map[string]interface{} `json:\"config\" binding:\"required\"`\n }\n // parse config from request body\n if err := ctx.ShouldBind(&config); err != nil {\n log.Error(fmt.Errorf(\"unable to parse config from request body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n appId, err := db.AddNewConfig(config.AppName, config.Config)\n if err != nil {\n log.Error(fmt.Errorf(\"unable to register new app config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"status_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n\n ctx.JSON(http.StatusCreated, gin.H{\n \"http_code\": http.StatusCreated, \"app_id\": appId})\n}", "func (api *APIServer) httpConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tconfig := api.config\n\tconfig.ClickHouse.Password = \"***\"\n\tconfig.API.Password = \"***\"\n\tconfig.S3.SecretKey = \"***\"\n\tconfig.GCS.CredentialsJSON = \"***\"\n\tconfig.COS.SecretKey = \"***\"\n\tconfig.FTP.Password = \"***\"\n\tbody, err := yaml.Marshal(&config)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"config\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=UTF-8\")\n\tw.Header().Set(\"Cache-Control\", \"no-store, no-cache, must-revalidate\")\n\tw.Header().Set(\"Pragma\", \"no-cache\")\n\tfmt.Fprintln(w, string(body))\n}", "func DatabaseConfiguration() *sql.DB {\n\tconn, err := sql.Open(\"mysql\", \"TestUser:12345678@tcp/LOGGER\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\treturn conn\n}", "func postConfig(c *gin.Context) {\n\tvar result bson.M\n\terr := c.BindJSON(&result)\n\tif err == nil {\n\t\terr := updateConfiguration(result)\n\t\tif err != nil {\n\t\t\tc.JSON(500, gin.H{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t\t\"ok\": 0,\n\t\t\t})\n\t\t} else {\n\t\t\tc.JSON(200, result)\n\t\t}\n\t}\n}", "func ConnectDatabase(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx, cancel := context.WithCancel(r.Context())\n\t\tdefer cancel()\n\t\tr = r.WithContext(ctx)\n\n\t\tdbConnection, err := config.DB.Connect(r.Context())\n\t\tif err != nil {\n\t\t\tpanic(srverror.New(err, 500, \"Error M1\", \"Failed to Connect to Database\"))\n\t\t}\n\t\tdefer dbConnection.Close(r.Context())\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.DATABASE, dbConnection))\n\n\t\tfilebase := dbConnection.File()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.FILE, filebase))\n\n\t\townerbase := dbConnection.Owner()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.OWNER, ownerbase))\n\n\t\tstorebase := dbConnection.Store()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.STORE, storebase))\n\n\t\tcontentbase := dbConnection.Content()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.CONTENT, contentbase))\n\n\t\ttagbase := dbConnection.Tag()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.TAG, tagbase))\n\n\t\tviewbase := dbConnection.View()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.VIEW, viewbase))\n\n\t\tacronymbase := dbConnection.Acronym()\n\t\tr = r.WithContext(context.WithValue(r.Context(), types.ACRONYM, acronymbase))\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func initAppDB() {\n\n\t// Init config data\n\tdbConf := GetDBConfig()\n\tdbConf.IsAppDB = true\n\n\tdbPoolApp, err := initSocketConnectionPool(dbConf)\n\tif err != nil {\n\t\tlog.Println(\"initial dbConnApp fail : \", err.Error())\n\t} else {\n\t\tlog.Println(\"initial dbConnApp successful\")\n\t\tdbConf.Conn = dbPoolApp\n\t\tdbConf.InitSuccess = true\n\t}\n\n\tdbConf.Err = err\n\n\t// Keep instance\n\tdbAppConf = dbConf\n}", "func ProcessDBServerConfiguration(data [][]string, err error) string {\n\tif err != nil {\n\t\tfmt.Println(fmt.Errorf(\"encountered error while processing Databse Configuration : %v\", err))\n\t\treturn \"\"\n\t}\n\n\tport, _ := strconv.Atoi(data[3][1])\n\n\treturn fmt.Sprintf(\"%s:%s@tcp(%s:%d)/\",\n\t\tdata[0][1],\n\t\tdata[1][1],\n\t\tdata[2][1],\n\t\tport)\n}", "func initLogDB() {\n\n\t// Init config data\n\tdbConf := GetDBConfig()\n\tdbConf.IsAppDB = false\n\n\tdbPoolApp, err := initSocketConnectionPool(dbConf)\n\tif err != nil {\n\t\tlog.Println(\"initial dbConnLog fail : \", err.Error())\n\t} else {\n\t\tlog.Println(\"initial dbConnLog successful\")\n\t\tdbConf.Conn = dbPoolApp\n\t\tdbConf.InitSuccess = true\n\t}\n\n\tdbConf.Err = err\n\n\t// Keep instance\n\tdbLogConf = dbConf\n}", "func configureConnectionPool(dbPool *sql.DB) {\n\t// [START cloud_sql_postgres_databasesql_limit]\n\n\t// Set maximum number of connections in idle connection pool.\n\tdbPool.SetMaxIdleConns(2)\n\n\t// Set maximum number of open connections to the database.\n\tdbPool.SetMaxOpenConns(3)\n\n\t// [END cloud_sql_postgres_databasesql_limit]\n\n\t// [START cloud_sql_postgres_databasesql_lifetime]\n\n\t// Set Maximum time (in seconds) that a connection can remain open.\n\tdbPool.SetConnMaxLifetime(1800)\n\n\t// [END cloud_sql_postgres_databasesql_lifetime]\n}", "func configureConnectionPool(dbPool *sql.DB) {\n\t// [START cloud_sql_postgres_databasesql_limit]\n\n\t// Set maximum number of connections in idle connection pool.\n\tdbPool.SetMaxIdleConns(5)\n\n\t// Set maximum number of open connections to the database.\n\tdbPool.SetMaxOpenConns(7)\n\n\t// [END cloud_sql_postgres_databasesql_limit]\n\n\t// [START cloud_sql_postgres_databasesql_lifetime]\n\n\t// Set Maximum time (in seconds) that a connection can remain open.\n\tdbPool.SetConnMaxLifetime(1800)\n\n\t// [END cloud_sql_postgres_databasesql_lifetime]\n}", "func (rt *RestTester) ReplaceDbConfig(dbName string, config DbConfig) *TestResponse {\n\tdbcJSON, err := base.JSONMarshal(config)\n\trequire.NoError(rt.TB, err)\n\tresp := rt.SendAdminRequest(http.MethodPut, fmt.Sprintf(\"/%s/_config\", dbName), string(dbcJSON))\n\treturn resp\n}", "func (s *Manager) SetEventingConfig(ctx context.Context, project, dbAlias string, enabled bool, params model.RequestParams) (int, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\tdbConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok && enabled {\n\t\treturn http.StatusBadRequest, helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf(\"Unknown db alias (%s) provided while setting eventing config\", dbAlias), nil, nil)\n\t}\n\n\tprojectConfig.Modules.Eventing.DBAlias = dbAlias\n\tprojectConfig.Modules.Eventing.Enabled = enabled\n\n\tif err := s.modules.SetEventingConfig(project, &projectConfig.Modules.Eventing); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif enabled {\n\t\tif err := s.applySchemas(ctx, project, dbAlias, projectConfig, config.CrudStub{\n\t\t\tCollections: map[string]*config.TableRule{\n\t\t\t\tutils.TableEventingLogs: {Schema: utils.SchemaEventLogs, Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}},\n\t\t\t\tutils.TableInvocationLogs: {Schema: utils.SchemaInvocationLogs, Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}},\n\t\t\t},\n\t\t\tDBName: dbConfig.DBName,\n\t\t}); err != nil {\n\t\t\treturn http.StatusInternalServerError, err\n\t\t}\n\t\tstatus, err := s.setCollectionRules(ctx, projectConfig, project, dbAlias, utils.TableEventingLogs, &config.TableRule{Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}})\n\t\tif err != nil {\n\t\t\treturn status, err\n\t\t}\n\t\tstatus, err = s.setCollectionRules(ctx, projectConfig, project, dbAlias, utils.TableInvocationLogs, &config.TableRule{Rules: map[string]*config.Rule{\"create\": {Rule: \"deny\"}, \"read\": {Rule: \"deny\"}, \"update\": {Rule: \"deny\"}, \"delete\": {Rule: \"deny\"}}})\n\t\tif err != nil {\n\t\t\treturn status, err\n\t\t}\n\t}\n\n\tif err := s.setProject(ctx, projectConfig); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func newDatabaseConfig() *databaseConfig {\n\treturn &databaseConfig {\n\t\thost: viper.GetString(\"DB_HOST\"),\n\t\tport: getIntOrPanic(\"DB_PORT\"),\n\t\tname: viper.GetString(\"DB_NAME\"),\n\t\tusername: viper.GetString(\"DB_USER\"),\n\t\tpassword: viper.GetString(\"DB_PASSWORD\"),\n\t\tmaxPoolSize: getIntOrPanic(\"DB_POOL\"),\n\t}\n}", "func (m *Modules) SetDatabasePreparedQueryConfig(ctx context.Context, projectID string, prepConfigs config.DatabasePreparedQueries) error {\n\tmodule, err := m.loadModule(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn module.SetDatabasePreparedQueryConfig(ctx, prepConfigs)\n}", "func (c *Config) Bind(f *pflag.FlagSet) {\n\tc.BaseConfig.Bind(f)\n\n\t// We set the targetDB based on the value in the incoming HTTP\n\t// request.\n\tif err := f.MarkHidden(\"targetDB\"); err != nil {\n\t\tpanic(err)\n\t}\n\n\tf.IntVar(&c.IdealFlushBatchSize, \"idealFlushBatchSize\", defaultFlushBatchSize,\n\t\t\"try to apply at least this many mutations per resolved-timestamp window\")\n\tf.IntVar(&c.NDJsonBuffer, \"ndjsonBufferSize\", defaultNDJsonBuffer,\n\t\t\"the maximum amount of data to buffer while reading a single line of ndjson input; \"+\n\t\t\t\"increase when source cluster has large blob values\")\n\tf.Var(ident.NewValue(\"resolved_timestamps\", &c.MetaTableName), \"metaTable\",\n\t\t\"the name of the table in which to store resolved timestamps\")\n\tf.IntVar(&c.SelectBatchSize, \"selectBatchSize\", defaultSelectBatchSize,\n\t\t\"the number of rows to select at once when reading staged data\")\n}", "func SetDB(db *sql.DB) {\n\tproductionDB = db\n}", "func SetupDatabase(mgr ctrl.Manager, o controller.Options) error {\n\tname := managed.ControllerName(svcapitypes.DatabaseGroupKind)\n\topts := []option{\n\t\tfunc(e *external) {\n\t\t\te.preObserve = preObserve\n\t\t\te.postObserve = postObserve\n\t\t\te.preDelete = preDelete\n\t\t\te.postCreate = postCreate\n\t\t\te.preCreate = preCreate\n\t\t\te.lateInitialize = lateInitialize\n\t\t\te.isUpToDate = isUpToDate\n\t\t\te.preUpdate = preUpdate\n\t\t},\n\t}\n\n\tcps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())}\n\tif o.Features.Enabled(features.EnableAlphaExternalSecretStores) {\n\t\tcps = append(cps, connection.NewDetailsManager(mgr.GetClient(), v1alpha1.StoreConfigGroupVersionKind))\n\t}\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tNamed(name).\n\t\tWithOptions(o.ForControllerRuntime()).\n\t\tFor(&svcapitypes.Database{}).\n\t\tComplete(managed.NewReconciler(mgr,\n\t\t\tresource.ManagedKind(svcapitypes.DatabaseGroupVersionKind),\n\t\t\tmanaged.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),\n\t\t\tmanaged.WithPollInterval(o.PollInterval),\n\t\t\tmanaged.WithLogger(o.Logger.WithValues(\"controller\", name)),\n\t\t\tmanaged.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))),\n\t\t\tmanaged.WithConnectionPublishers(cps...)))\n}", "func (application *Application) ApplyDatabase(c *web.C, h http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tc.Env[\"DBSession\"] = application.DBSession\n\t\tc.Env[\"Config\"] = application.Configuration\n\n\t\th.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func DBconfig() DBcfg {\n\th := viper.GetString(\"local-host\")\n\t// maybe it's a windows thing\n\t// \"HOST\" is being return with quotes around the [\"string\"]\n\th2 := util.Trim(viper.GetString(\"HOST\"), \"\\\"\")\n\tvar sfg *viper.Viper\n\tif h == h2 {\n\t\tsfg = viper.Sub(\"app-db-local\")\n\t} else {\n\t\tsfg = viper.Sub(\"app-db-dev\")\n\t}\n\n\treturn dbSettings(sfg)\n}", "func (c *ContrailConfig) UpdateDB(uuidTable *UUIDTableType) error {\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tj, err := c.Map(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t(*uuidTable)[c.UUID] = j\n\treturn nil\n}", "func initMultitenantDatabases(apiRouter *mux.Router, context *Context) {\n\taddContext := func(handler contextHandlerFunc) *contextHandler {\n\t\treturn newContextHandler(context, handler)\n\t}\n\n\tMultitenantDatabasesRouter := apiRouter.PathPrefix(\"/multitenant_databases\").Subrouter()\n\tMultitenantDatabasesRouter.Handle(\"\", addContext(handleGetMultitenantDatabases)).Methods(\"GET\")\n\n\tMultitenantDatabaseRouter := apiRouter.PathPrefix(\"/multitenant_database/{multitenant_database:[A-Za-z0-9]{26}}\").Subrouter()\n\tMultitenantDatabaseRouter.Handle(\"\", addContext(handleGetMultitenantDatabase)).Methods(\"GET\")\n\tMultitenantDatabaseRouter.Handle(\"\", addContext(handleUpdateMultitenantDatabase)).Methods(\"PUT\")\n\tMultitenantDatabaseRouter.Handle(\"\", addContext(handleDeleteMultitenantDatabase)).Methods(\"DELETE\")\n}", "func (throttler *Throttler) InitDBConfig(keyspace, shard string) {\n\tthrottler.keyspace = keyspace\n\tthrottler.shard = shard\n}", "func Set(database Type) error {\n\tdbName = database.InfluxDb\n\tif err := dbName.Initialize(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func HandleSetPreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.PreparedQuery{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.SetPreparedQueries(ctx, project, dbAlias, id, &v); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func (config *Configuration) LoadConfig() (err error) {\n\n\tif webserverHost, ok := os.LookupEnv(AppPrefix + \"_WEBSERVER_HOST\"); ok {\n\t\tconfig.Webserver.Host = webserverHost\n\t}\n\n\tif webserverPort, ok := os.LookupEnv(AppPrefix + \"_WEBSERVER_PORT\"); ok {\n\t\tconfig.Webserver.Port, err = strconv.Atoi(webserverPort)\n\t\tif err != nil || config.Webserver.Port <= 0 || config.Webserver.Port > 1<<16-1 {\n\t\t\treturn fmt.Errorf(\"configuration error: [webserver port] input not allowed <%s>\", webserverPort)\n\t\t}\n\t}\n\n\tif devMode, ok := os.LookupEnv(AppPrefix + \"_OPTIONS_DEV_MODE\"); ok {\n\t\tconfig.Options.DevMode, err = strconv.ParseBool(devMode)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"configuration error: [options devmode] unrecognizable boolean <%s>\", devMode)\n\t\t}\n\t}\n\n\tif logLevel, ok := os.LookupEnv(AppPrefix + \"_OPTIONS_LOG_LEVEL\"); ok {\n\t\tconfig.Options.LogLevel, err = ParseLogLevel(logLevel)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"configuration error: [options loglevel] unrecognized log level\")\n\t\t}\n\t}\n\n\tif dbHost, ok := os.LookupEnv(AppPrefix + \"_DATABASE_HOST\"); ok {\n\t\tconfig.Database.Host = dbHost\n\t} else {\n\t\treturn fmt.Errorf(\"configuration error: [database host] mandatory config parameter missing\")\n\t}\n\n\tif dbPort, ok := os.LookupEnv(AppPrefix + \"_DATABASE_PORT\"); ok {\n\t\tconfig.Database.Port, err = strconv.Atoi(dbPort)\n\t\tif err != nil || config.Database.Port <= 0 || config.Database.Port > 1<<16-1 {\n\t\t\treturn fmt.Errorf(\"configuration error: [database port] input not allowed <%s>\", dbPort)\n\t\t}\n\t}\n\n\tif dbUsername, ok := os.LookupEnv(AppPrefix + \"_DATABASE_USERNAME\"); ok {\n\t\tconfig.Database.Username = dbUsername\n\t} else {\n\t\treturn fmt.Errorf(\"configuration error: [database username] mandatory config parameter missing\")\n\t}\n\n\tif dbPassword, ok := os.LookupEnv(AppPrefix + \"_DATABASE_PASSWORD\"); ok {\n\t\tconfig.Database.Password = dbPassword\n\t} else {\n\t\treturn fmt.Errorf(\"configuration error: [database password] mandatory config parameter missing\")\n\t}\n\n\tif dbName, ok := os.LookupEnv(AppPrefix + \"_DATABASE_DBNAME\"); ok {\n\t\tconfig.Database.DBName = dbName\n\t} else {\n\t\treturn fmt.Errorf(\"configuration error: [database dbname] mandatory config parameter missing\")\n\t}\n\n\treturn nil\n}", "func DefaultServiceConfigFromEnv() Server {\n\tconfigOnce.Do(func() {\n\t\tconfig = Server{\n\t\t\tDatabase: Database{\n\t\t\t\tHost: util.GetEnv(\"PGHOST\", \"postgres\"),\n\t\t\t\tPort: util.GetEnvAsInt(\"PGPORT\", 5432),\n\t\t\t\tDatabase: util.GetEnv(\"PGDATABASE\", \"development\"),\n\t\t\t\tUsername: util.GetEnv(\"PGUSER\", \"dbuser\"),\n\t\t\t\tPassword: util.GetEnv(\"PGPASSWORD\", \"\"),\n\t\t\t\tAdditionalParams: map[string]string{\n\t\t\t\t\t\"sslmode\": util.GetEnv(\"PGSSLMODE\", \"disable\"),\n\t\t\t\t},\n\t\t\t\tMaxOpenConns: util.GetEnvAsInt(\"DB_MAX_OPEN_CONNS\", runtime.NumCPU()*2),\n\t\t\t\tMaxIdleConns: util.GetEnvAsInt(\"DB_MAX_IDLE_CONNS\", 1),\n\t\t\t\tConnMaxLifetime: time.Second * time.Duration(util.GetEnvAsInt(\"DB_CONN_MAX_LIFETIME_SEC\", 60)),\n\t\t\t},\n\t\t\tEcho: EchoServer{\n\t\t\t\tDebug: util.GetEnvAsBool(\"SERVER_ECHO_DEBUG\", false),\n\t\t\t\tListenAddress: util.GetEnv(\"SERVER_ECHO_LISTEN_ADDRESS\", \":8080\"),\n\t\t\t\tHideInternalServerErrorDetails: util.GetEnvAsBool(\"SERVER_ECHO_HIDE_INTERNAL_SERVER_ERROR_DETAILS\", true),\n\t\t\t\tBaseURL: util.GetEnv(\"SERVER_ECHO_BASE_URL\", \"http://localhost:8080\"),\n\t\t\t\tEnableCORSMiddleware: util.GetEnvAsBool(\"SERVER_ECHO_ENABLE_CORS_MIDDLEWARE\", true),\n\t\t\t\tEnableLoggerMiddleware: util.GetEnvAsBool(\"SERVER_ECHO_ENABLE_LOGGER_MIDDLEWARE\", true),\n\t\t\t\tEnableRecoverMiddleware: util.GetEnvAsBool(\"SERVER_ECHO_ENABLE_RECOVER_MIDDLEWARE\", true),\n\t\t\t\tEnableRequestIDMiddleware: util.GetEnvAsBool(\"SERVER_ECHO_ENABLE_REQUEST_ID_MIDDLEWARE\", true),\n\t\t\t\tEnableTrailingSlashMiddleware: util.GetEnvAsBool(\"SERVER_ECHO_ENABLE_TRAILING_SLASH_MIDDLEWARE\", true),\n\t\t\t},\n\t\t\tPaths: PathsServer{\n\t\t\t\t// Please ALWAYS work with ABSOLUTE (ABS) paths from ENV_VARS (however you may resolve a project-relative to absolute for the default value)\n\t\t\t\tAPIBaseDirAbs: util.GetEnv(\"SERVER_PATHS_API_BASE_DIR_ABS\", filepath.Join(util.GetProjectRootDir(), \"/api\")), // /app/api (swagger.yml)\n\t\t\t\tMntBaseDirAbs: util.GetEnv(\"SERVER_PATHS_MNT_BASE_DIR_ABS\", filepath.Join(util.GetProjectRootDir(), \"/assets/mnt\")), // /app/assets/mnt (user-generated content)\n\t\t\t},\n\t\t\tAuth: AuthServer{\n\t\t\t\tAccessTokenValidity: time.Second * time.Duration(util.GetEnvAsInt(\"SERVER_AUTH_ACCESS_TOKEN_VALIDITY\", 86400)),\n\t\t\t\tPasswordResetTokenValidity: time.Second * time.Duration(util.GetEnvAsInt(\"SERVER_AUTH_PASSWORD_RESET_TOKEN_VALIDITY\", 900)),\n\t\t\t\tDefaultUserScopes: util.GetEnvAsStringArr(\"SERVER_AUTH_DEFAULT_USER_SCOPES\", []string{\"app\"}),\n\t\t\t\tLastAuthenticatedAtThreshold: time.Second * time.Duration(util.GetEnvAsInt(\"SERVER_AUTH_LAST_AUTHENTICATED_AT_THRESHOLD\", 900)),\n\t\t\t},\n\t\t\tManagement: ManagementServer{\n\t\t\t\tSecret: util.GetMgmtSecret(\"SERVER_MANAGEMENT_SECRET\"),\n\t\t\t},\n\t\t\tMailer: Mailer{\n\t\t\t\tDefaultSender: util.GetEnv(\"SERVER_MAILER_DEFAULT_SENDER\", \"[email protected]\"),\n\t\t\t\tSend: util.GetEnvAsBool(\"SERVER_MAILER_SEND\", true),\n\t\t\t\tWebTemplatesEmailBaseDirAbs: util.GetEnv(\"SERVER_MAILER_WEB_TEMPLATES_EMAIL_BASE_DIR_ABS\", filepath.Join(util.GetProjectRootDir(), \"/web/templates/email\")), // /app/web/templates/email\n\t\t\t\tTransporter: util.GetEnvEnum(\"SERVER_MAILER_TRANSPORTER\", MailerTransporterMock.String(), []string{MailerTransporterSMTP.String(), MailerTransporterMock.String()}),\n\t\t\t},\n\t\t\tSMTP: transport.SMTPMailTransportConfig{\n\t\t\t\tHost: util.GetEnv(\"SERVER_SMTP_HOST\", \"mailhog\"),\n\t\t\t\tPort: util.GetEnvAsInt(\"SERVER_SMTP_PORT\", 1025),\n\t\t\t\tUsername: util.GetEnv(\"SERVER_SMTP_USERNAME\", \"\"),\n\t\t\t\tPassword: util.GetEnv(\"SERVER_SMTP_PASSWORD\", \"\"),\n\t\t\t\tAuthType: transport.SMTPAuthTypeFromString(util.GetEnv(\"SERVER_SMTP_AUTH_TYPE\", transport.SMTPAuthTypeNone.String())),\n\t\t\t\tUseTLS: util.GetEnvAsBool(\"SERVER_SMTP_USE_TLS\", false),\n\t\t\t\tTLSConfig: nil,\n\t\t\t},\n\t\t\tFrontend: FrontendServer{\n\t\t\t\tBaseURL: util.GetEnv(\"SERVER_FRONTEND_BASE_URL\", \"http://localhost:3000\"),\n\t\t\t\tPasswordResetEndpoint: util.GetEnv(\"SERVER_FRONTEND_PASSWORD_RESET_ENDPOINT\", \"/set-new-password\"),\n\t\t\t},\n\t\t\tLogger: LoggerServer{\n\t\t\t\tLevel: util.LogLevelFromString(util.GetEnv(\"SERVER_LOGGER_LEVEL\", zerolog.DebugLevel.String())),\n\t\t\t\tRequestLevel: util.LogLevelFromString(util.GetEnv(\"SERVER_LOGGER_REQUEST_LEVEL\", zerolog.DebugLevel.String())),\n\t\t\t\tLogRequestBody: util.GetEnvAsBool(\"SERVER_LOGGER_LOG_REQUEST_BODY\", false),\n\t\t\t\tLogRequestHeader: util.GetEnvAsBool(\"SERVER_LOGGER_LOG_REQUEST_HEADER\", false),\n\t\t\t\tLogRequestQuery: util.GetEnvAsBool(\"SERVER_LOGGER_LOG_REQUEST_QUERY\", false),\n\t\t\t\tLogResponseBody: util.GetEnvAsBool(\"SERVER_LOGGER_LOG_RESPONSE_BODY\", false),\n\t\t\t\tLogResponseHeader: util.GetEnvAsBool(\"SERVER_LOGGER_LOG_RESPONSE_HEADER\", false),\n\t\t\t\tPrettyPrintConsole: util.GetEnvAsBool(\"SERVER_LOGGER_PRETTY_PRINT_CONSOLE\", false),\n\t\t\t},\n\t\t\tPush: PushService{\n\t\t\t\tUseFCMProvider: util.GetEnvAsBool(\"SERVER_PUSH_USE_FCM\", false),\n\t\t\t\tUseMockProvider: util.GetEnvAsBool(\"SERVER_PUSH_USE_MOCK\", true),\n\t\t\t},\n\t\t\tFCMConfig: provider.FCMConfig{\n\t\t\t\tGoogleApplicationCredentials: util.GetEnv(\"GOOGLE_APPLICATION_CREDENTIALS\", \"\"),\n\t\t\t\tProjectID: util.GetEnv(\"SERVER_FCM_PROJECT_ID\", \"no-fcm-project-id-set\"),\n\t\t\t\tValidateOnly: util.GetEnvAsBool(\"SERVER_FCM_VALIDATE_ONLY\", true),\n\t\t\t},\n\t\t}\n\n\t})\n\n\treturn config\n}", "func (storage *Storage) SetDbPath(dbPath string) {\n}", "func (s *syncer) dbSetup() error {\n\ts.logger.Info(\"Connecting to the database\")\n\n\tsqlDB, err := sql.Open(\"sqlite3_with_fk\", s.config.Database)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Setup the DB struct\n\ts.db = sqlDB\n\n\t// We don't want multiple clients during setup\n\ts.db.SetMaxOpenConns(1)\n\n\t// Test the connection\n\terr = s.db.Ping()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the DB schema (if needed)\n\t_, err = s.db.Exec(schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set the connection limit for the DB pool\n\ts.db.SetMaxOpenConns(10)\n\n\treturn nil\n}", "func (r *RealEnv) SetDBHandle(h *db.DBHandle) {\n\tr.dbHandle = h\n}", "func Database(cnf config.DatabaseConfig) Configurator {\n\treturn func(instance *Storage) (err error) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\tswitch v := r.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\terr = v\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.New(\"unknown panic\")\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tinstance.exec = internal.New(cnf.DriverName())\n\t\tinstance.db, err = sql.Open(cnf.DriverName(), string(cnf.DSN))\n\t\tif err == nil {\n\t\t\tinstance.db.SetMaxOpenConns(cnf.MaxOpenConns)\n\t\t\tinstance.db.SetMaxIdleConns(cnf.MaxIdleConns)\n\t\t\tinstance.db.SetConnMaxLifetime(cnf.ConnMaxLifetime)\n\t\t}\n\t\treturn\n\t}\n}", "func dbConfig() (map[string]string, error) {\n\tconf := make(map[string]string)\n\thost, ok := os.LookupEnv(dbhost)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBHOST environment variable required\")\n\t}\n\tport, ok := os.LookupEnv(dbport)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBPORT environment variable required\")\n\t}\n\tuser, ok := os.LookupEnv(dbuser)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBUSER environment variable required\")\n\t}\n\tpassword, ok := os.LookupEnv(dbpass)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBPASS environment variable required\")\n\t}\n\tname, ok := os.LookupEnv(dbname)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBNAME environment variable required\")\n\t}\n\tconf[dbhost] = host\n\tconf[dbport] = port\n\tconf[dbuser] = user\n\tconf[dbpass] = password\n\tconf[dbname] = name\n\treturn conf, nil\n}", "func (conf *config) GetDBConfig() DB {\n\treturn conf.DB\n}", "func setConfigDefaults() {\n\tif viper.GetString(\"postgres.sslmode\") == \"\" {\n\t\tviper.Set(\"postgres.sslmode\", \"require\")\n\t}\n\tif viper.GetInt(\"postgres.port\") == 0 {\n\t\tviper.Set(\"postgres.port\", 5432)\n\t}\n\tif viper.GetString(\"mysql.sslmode\") == \"\" {\n\t\tviper.Set(\"mysql.sslmode\", \"true\")\n\t}\n\tif viper.GetInt(\"mysql.port\") == 0 {\n\t\tviper.Set(\"mysql.port\", 3306)\n\t}\n}", "func (sys *IAMSys) PolicyDBSet(name, policy string) error {\n\tobjectAPI := newObjectLayerFn()\n\tif objectAPI == nil {\n\t\treturn errServerNotInitialized\n\t}\n\n\tsys.Lock()\n\tdefer sys.Unlock()\n\n\treturn sys.policyDBSet(objectAPI, name, policy, false)\n}", "func handleConfigurationChangeEvent(event cloudevents.Event, shkeptncontext string, data *keptnevents.ConfigurationChangeEventData, logger *keptnutils.Logger) error {\n\tlogger.Info(fmt.Sprintf(\"Handling Configuration Changed Event: %s\", event.Context.GetID()));\n\n\treturn nil\n}", "func (cfg *Config) loadDBConfig() error {\n\tswitch cfg.DB.T {\n\tcase \"leveldb\":\n\t\tcfg.DB.Type = LEVELDB\n\t\tif cfg.DB.LevelDB.Dir == \"\" {\n\t\t\tif !cfg.Debug {\n\t\t\t\treturn errors.New(\"leveldb path is not setted\")\n\t\t\t}\n\t\t\tcfg.DB.LevelDB.Dir = getDefaultLevelDBPath()\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupport db type: %s\", cfg.DB.T)\n\t}\n\treturn nil\n}", "func DBSetup() error {\n\tlog.Info(\"Starting DB Setup\")\n\tconfigDBDir := path.Join(CliVal.DataDir, \"config\")\n\tfilesDBDir := path.Join(CliVal.DataDir, \"files\")\n\t_, Err := os.Stat(CliVal.DataDir)\n\tif Err != nil {\n\t\tif err := createDataDir(CliVal.DataDir); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tconfigDBopts := badger.DefaultOptions\n\tconfigDBopts.Dir = configDBDir\n\tconfigDBopts.ValueDir = path.Join(configDBDir, \"value\")\n\t//configDBopts.Logger = log.StandardLogger()\n\tconfigDB, err := badger.Open(configDBopts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsftpdata.InitConfigDB(sftpdata.BadgerDB{\n\t\tConfigDB: configDB,\n\t})\n\tfilesDBopts := badger.DefaultOptions\n\tfilesDBopts.Dir = filesDBDir\n\tfilesDBopts.ValueDir = path.Join(filesDBDir, \"value\")\n\t//filesDBopts.Logger = log.StandardLogger()\n\tfilesDB, err := badger.Open(filesDBopts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsftpdata.InitFilesDB(sftpdata.BadgerDB{\n\t\tFilesDB: filesDB,\n\t})\n\tlog.Info(\"Databases initialized.\")\n\treturn nil\n}", "func (db *DB) SetConfig(key string, value string, valueType string) error {\n\tinsertQuery := \"insert into \" + config.ConfigTable + \" (key, value, value_type) values ($1, $2) returning id\"\n\tvar id int64\n\terr := db.QueryRow(context.Background(), insertQuery, key, value, valueType).Scan(&id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func getAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request for config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n // get config from database and return\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n config, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"data\": config})\n}", "func InitDatabase(cfg *config.HorizonConfig) (AgbotDatabase, error) {\n\n\tif cfg.IsBoltDBConfigured() {\n\t\tdbObj := DatabaseProviders[\"bolt\"]\n\t\treturn dbObj, dbObj.Initialize(cfg)\n\n\t} else if cfg.IsPostgresqlConfigured() {\n\t\tdbObj := DatabaseProviders[\"postgresql\"]\n\t\treturn dbObj, dbObj.Initialize(cfg)\n\n\t}\n\treturn nil, errors.New(fmt.Sprintf(\"neither bolt DB nor Postgresql DB is configured correctly.\"))\n\n}", "func (tqsc *Controller) InitDBConfig(target *querypb.Target, dbcfgs *dbconfigs.DBConfigs, _ mysqlctl.MysqlDaemon) error {\n\ttqsc.mu.Lock()\n\tdefer tqsc.mu.Unlock()\n\n\ttqsc.target = proto.Clone(target).(*querypb.Target)\n\treturn nil\n}", "func (rt *RestTester) CreateDatabase(dbName string, config DbConfig) *TestResponse {\n\tdbcJSON, err := base.JSONMarshal(config)\n\trequire.NoError(rt.TB, err)\n\tresp := rt.SendAdminRequest(http.MethodPut, fmt.Sprintf(\"/%s/\", dbName), string(dbcJSON))\n\treturn resp\n}", "func handleSet(updatedConfig ygot.ValidatedGoStruct, existingConfig ygot.ValidatedGoStruct) error {\n\t// TODO: Handle delta change. Currently the GNMI server only supports replacing root.\n\tofficeConfig, ok := updatedConfig.(*ocstruct.Office)\n\tif !ok {\n\t\treturn errors.New(\"new configuration has invalid type\")\n\t}\n\n\tconfigString, err := ygot.EmitJSON(officeConfig, &ygot.EmitJSONConfig{\n\t\tFormat: ygot.RFC7951,\n\t\tIndent: \" \",\n\t\tRFC7951Config: &ygot.RFC7951JSONConfig{\n\t\t\tAppendModuleName: false,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Received a new configuration:\\n%v\\n\", configString)\n\n\t// TODO: Validate the OpenConfig module.\n\tdeviceConfig := context.GetDeviceConfig()\n\n\t// Check and clean up the existing configuration.\n\tvar changedVLANIDs []int\n\texistingVLANIDs, err := cmdRunner.VLANOnIntf(deviceConfig.ETHINTFName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to fetch the existing VLAN with error (%v), may need to reboot the device.\", err)\n\t}\n\n\tresetIntf := false\n\tnewVLANIDs := ocutil.VLANIDs(officeConfig)\n\tif ocutil.VLANChanged(existingVLANIDs, newVLANIDs) {\n\t\tlog.Infof(\"VLAN changes (%v -> %v) on interface %s.\", existingVLANIDs, newVLANIDs, deviceConfig.ETHINTFName)\n\t\tchangedVLANIDs = existingVLANIDs\n\t\tresetIntf = true\n\t} else {\n\t\tlog.Infof(\"No VLAN change on interface %s.\", deviceConfig.ETHINTFName)\n\t}\n\n\t// Clean up the existing configuration.\n\tservice.CleanupConfig(deviceConfig.ETHINTFName, changedVLANIDs)\n\n\t// Wait for link to be available again.\n\ttime.Sleep(5 * time.Second)\n\n\t// Process the incoming configuration.\n\tif err = service.ApplyConfig(officeConfig, resetIntf, deviceConfig.Hostname, deviceConfig.ETHINTFName,\n\t\tdeviceConfig.WLANINTFName); err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"Device configuration succeeded.\")\n\n\t// Save the succeeded config file.\n\tif err := syscmd.SaveToFile(runFolder, apConfigFileName, configString); err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"Saved the configuration to file.\")\n\treturn nil\n}", "func (s *session) HandleStartup(dbList database.DatabaseList) (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ts.ErrorHandle(err)\n\t\t\ts.mr.CloseConnection()\n\t\t}\n\t}()\n\n\tuser, ok := s.connParams[\"user\"]\n\tif !ok || user == \"\" {\n\t\treturn pserr.ErrUsernameNotprovided\n\t}\n\ts.username = user\n\tdb, ok := s.connParams[\"database\"]\n\tif !ok {\n\t\treturn pserr.ErrDBNotprovided\n\t}\n\ts.database, err = dbList.GetByName(db)\n\tif err != nil {\n\t\tif errors.Is(err, database.ErrDatabaseNotExists) {\n\t\t\treturn pserr.ErrDBNotExists\n\t\t}\n\t\treturn err\n\t}\n\ts.log.Debugf(\"selected %s database\", s.database.GetName())\n\n\tif _, err = s.writeMessage(bm.AuthenticationCleartextPassword()); err != nil {\n\t\treturn err\n\t}\n\tmsg, _, err := s.nextMessage()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif pw, ok := msg.(fm.PasswordMsg); ok {\n\t\tif !ok || pw.GetSecret() == \"\" {\n\t\t\treturn pserr.ErrPwNotprovided\n\t\t}\n\t\tusr, err := s.getUser([]byte(s.username))\n\t\tif err != nil {\n\t\t\tif strings.Contains(err.Error(), \"key not found\") {\n\t\t\t\treturn pserr.ErrUsernameNotFound\n\t\t\t}\n\t\t}\n\t\tif err := usr.ComparePasswords([]byte(pw.GetSecret())); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.log.Debugf(\"authentication successful for %s\", s.username)\n\t\tif _, err := s.writeMessage(bm.AuthenticationOk()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif _, err := s.writeMessage(bm.ParameterStatus([]byte(\"standard_conforming_strings\"), []byte(\"on\"))); err != nil {\n\t\treturn err\n\t}\n\tif _, err := s.writeMessage(bm.ParameterStatus([]byte(\"client_encoding\"), []byte(\"UTF8\"))); err != nil {\n\t\treturn err\n\t}\n\t// todo this is needed by jdbc driver. Here is added the minor supported version at the moment\n\tif _, err := s.writeMessage(bm.ParameterStatus([]byte(\"server_version\"), []byte(pgmeta.PgsqlProtocolVersion))); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cfg *Config) SetFromURL(url *url.URL) error {\n\tsplitted := strings.Split(url.Host, \".\")\n\tif len(splitted) != 2 {\n\t\treturn trace.BadParameter(\"invalid athena address, supported format is 'athena://database.table', got %q\", url.Host)\n\t}\n\tcfg.Database, cfg.TableName = splitted[0], splitted[1]\n\n\tif region := url.Query().Get(\"region\"); region != \"\" {\n\t\tcfg.Region = region\n\t}\n\ttopicARN := url.Query().Get(\"topicArn\")\n\tif topicARN != \"\" {\n\t\tcfg.TopicARN = topicARN\n\t}\n\tlargeEventsS3 := url.Query().Get(\"largeEventsS3\")\n\tif largeEventsS3 != \"\" {\n\t\tcfg.LargeEventsS3 = largeEventsS3\n\t}\n\n\tlocationS3 := url.Query().Get(\"locationS3\")\n\tif locationS3 != \"\" {\n\t\tcfg.LocationS3 = locationS3\n\t}\n\tqueryResultsS3 := url.Query().Get(\"queryResultsS3\")\n\tif queryResultsS3 != \"\" {\n\t\tcfg.QueryResultsS3 = queryResultsS3\n\t}\n\tworkgroup := url.Query().Get(\"workgroup\")\n\tif workgroup != \"\" {\n\t\tcfg.Workgroup = workgroup\n\t}\n\tgetQueryResultsInterval := url.Query().Get(\"getQueryResultsInterval\")\n\tif getQueryResultsInterval != \"\" {\n\t\tdur, err := time.ParseDuration(getQueryResultsInterval)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid getQueryResultsInterval value: %v\", err)\n\t\t}\n\t\tcfg.GetQueryResultsInterval = dur\n\t}\n\trefillAmountInString := url.Query().Get(\"limiterRefillAmount\")\n\tif refillAmountInString != \"\" {\n\t\trefillAmount, err := strconv.Atoi(refillAmountInString)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid limiterRefillAmount value (it must be int): %v\", err)\n\t\t}\n\t\tcfg.LimiterRefillAmount = refillAmount\n\t}\n\trefillTimeInString := url.Query().Get(\"limiterRefillTime\")\n\tif refillTimeInString != \"\" {\n\t\tdur, err := time.ParseDuration(refillTimeInString)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid limiterRefillTime value: %v\", err)\n\t\t}\n\t\tcfg.LimiterRefillTime = dur\n\t}\n\tburstInString := url.Query().Get(\"limiterBurst\")\n\tif burstInString != \"\" {\n\t\tburst, err := strconv.Atoi(burstInString)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid limiterBurst value (it must be int): %v\", err)\n\t\t}\n\t\tcfg.LimiterBurst = burst\n\t}\n\n\tqueueURL := url.Query().Get(\"queueURL\")\n\tif queueURL != \"\" {\n\t\tcfg.QueueURL = queueURL\n\t}\n\tbatchMaxItems := url.Query().Get(\"batchMaxItems\")\n\tif batchMaxItems != \"\" {\n\t\tintMaxItems, err := strconv.Atoi(batchMaxItems)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid batchMaxItems value (it must be int): %v\", err)\n\t\t}\n\t\tcfg.BatchMaxItems = intMaxItems\n\t}\n\tbatchMaxInterval := url.Query().Get(\"batchMaxInterval\")\n\tif batchMaxInterval != \"\" {\n\t\tdur, err := time.ParseDuration(batchMaxInterval)\n\t\tif err != nil {\n\t\t\treturn trace.BadParameter(\"invalid batchMaxInterval value: %v\", err)\n\t\t}\n\t\tcfg.BatchMaxInterval = dur\n\t}\n\n\treturn nil\n}", "func modifyAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to modify config %s\", ctx.Param(\"appId\")))\n var request struct{Operation []map[string]interface{} `json:\"operation\" binding:\"required\"`}\n // parse config from request body\n if err := ctx.ShouldBind(&request); err != nil {\n log.Error(fmt.Errorf(\"unable to extract JSON Patch from body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n current, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // perform JSON patch on config\n updated, err := PatchConfig(current, request.Operation)\n if err != nil {\n switch err {\n case ErrInvalidJSONConfig, ErrInvalidPatch:\n log.Warn(fmt.Sprintf(\"cannot process JSON Patch %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"http_code\": http.StatusBadRequest, \"message\": \"Invalid JSON Patch Operation\"})\n default:\n log.Error(fmt.Errorf(\"unable to apply JSON Patch: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // update config in postgres database\n if err := db.UpdateConfigByAppId(appId, updated); err != nil {\n log.Error(fmt.Errorf(\"unable to updated config in database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully updated config\"})\n}", "func InitDatabase(dsn string) error {\n\tfmt.Println(\"Init db connection\")\n\t// config := mysql.NewConfig()\n\t// config.User = username\n\t// config.Passwd = password\n\t// config.Net = protocol\n\t// config.Addr = host\n\t// config.DBName = database\n\t// config.Params = map[string]string{\n\t// \t\"charset\": charset,\n\t// \t\"parseTime\": \"True\",\n\t// }\n\tdb, err := gorm.Open(\"sqlite3\", dsn)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tDbConn = db\n\treturn nil\n}", "func SetConfig() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Set(\"CorsOrigin\", \"*\")\n\t\tc.Set(\"Verbose\", true)\n\t\tc.Next()\n\t}\n}", "func init() {\n // parser config\n var confFile string\n flag.StringVar(&confFile, \"c\", \"conf/tcpserver.yaml\", \"config file\")\n flag.Parse()\n\n err := utils.ConfParser(confFile, &config)\n if err != nil {\n fmt.Println(\"parser config failed:\", err.Error())\n os.Exit(-1)\n }\n\n // init db\n conninfo := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?charset=utf8\", config.Db.User, config.Db.Passwd, config.Db.Host, config.Db.Db)\n db, err = gorm.Open(\"mysql\", conninfo)\n if err != nil {\n fmt.Println(\"connect to db failed:\", err.Error())\n os.Exit(-1)\n }\n db.DB().SetMaxIdleConns(config.Db.Conn.Maxidle)\n db.DB().SetMaxOpenConns(config.Db.Conn.Maxopen)\n db.LogMode(true)\n}", "func (s *server) setConfig(sc *ServerConfig) {\n\ts.configStore.Store(*sc)\n}", "func HandleGetConfigurations(pool *proxyPool)gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t config:=*pool.c\n\t\t RenderConfigTable(c.Writer,\"proxy ip pool configurations\",config)\n\t}\n}", "func WithDatabase(database string) ConfigOption {\n\treturn func(c *Config) {\n\t\tc.database = database\n\t}\n}", "func setConnectionConfigs(ctx context.Context, dbConn *core_database.DatabaseConn) {\n\tdbConn.Engine.FullSaveAssociations = true\n\tdbConn.Engine.SkipDefaultTransaction = false\n\tdbConn.Engine.PrepareStmt = true\n\tdbConn.Engine.DisableAutomaticPing = false\n\tdbConn.Engine = dbConn.Engine.Set(\"gorm:auto_preload\", true)\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}" ]
[ "0.6874534", "0.63710827", "0.6368821", "0.6250105", "0.60468185", "0.5916883", "0.584699", "0.56245667", "0.56034696", "0.5554565", "0.5424244", "0.5418453", "0.53364885", "0.5325168", "0.5322918", "0.5299924", "0.5292995", "0.5275958", "0.52436614", "0.52342105", "0.5167328", "0.51614463", "0.5159835", "0.51212484", "0.5113531", "0.51114666", "0.51033586", "0.5091564", "0.5090582", "0.5086533", "0.5084487", "0.50793654", "0.50692654", "0.5055762", "0.5047421", "0.50440264", "0.503831", "0.50366515", "0.50081116", "0.49905992", "0.49703342", "0.49520656", "0.4946214", "0.4940691", "0.49321786", "0.4875141", "0.48583254", "0.48576412", "0.48565686", "0.4846128", "0.48445413", "0.48198324", "0.4819351", "0.48091525", "0.4808038", "0.48046532", "0.4804438", "0.47964734", "0.4792794", "0.4779502", "0.47758582", "0.47736377", "0.4772693", "0.47663173", "0.47637263", "0.47633907", "0.4760562", "0.4749767", "0.47472525", "0.4744822", "0.47309563", "0.47252235", "0.4713622", "0.47126195", "0.469228", "0.46892488", "0.46846396", "0.4677298", "0.46748167", "0.46726277", "0.46667448", "0.46654788", "0.46601284", "0.46542585", "0.46515056", "0.46459472", "0.46395493", "0.46332398", "0.46318835", "0.46285", "0.46216828", "0.46166426", "0.46155065", "0.46155065", "0.46155065", "0.46155065", "0.46155065", "0.46155065", "0.46155065", "0.46155065" ]
0.8562628
0
HandleGetDatabaseConfig returns handler to get Database Collection
func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() // get project id and dbType from url vars := mux.Vars(r) projectID := vars["project"] dbAlias := "" dbAliasQuery, exists := r.URL.Query()["dbAlias"] if exists { dbAlias = dbAliasQuery[0] } dbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (s *Manager) GetDatabaseConfig(ctx context.Context, project, dbAlias string) ([]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" {\n\t\tdbConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"specified dbAlias (%s) not present in config\", dbAlias)\n\t\t}\n\t\treturn []interface{}{config.Crud{dbAlias: {Enabled: dbConfig.Enabled, Conn: dbConfig.Conn, Type: dbConfig.Type}}}, nil\n\t}\n\n\tservices := []interface{}{}\n\tfor key, value := range projectConfig.Modules.Crud {\n\t\tservices = append(services, config.Crud{key: {Enabled: value.Enabled, Conn: value.Conn, Type: value.Type}})\n\t}\n\treturn services, nil\n}", "func (conf *config) GetDBConfig() DB {\n\treturn conf.DB\n}", "func GetDB() DB {\n\treturn Configurations.DB\n}", "func HandleRemoveDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.RemoveDatabaseConfig(ctx, projectID, dbAlias); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func (s *BoltState) GetDBConfig() (*DBConfig, error) {\n\tif !s.valid {\n\t\treturn nil, define.ErrDBClosed\n\t}\n\n\tcfg := new(DBConfig)\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tconfigBucket, err := getRuntimeConfigBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Some of these may be nil\n\t\t// When we convert to string, Go will coerce them to \"\"\n\t\t// That's probably fine - we could raise an error if the key is\n\t\t// missing, but just not including it is also OK.\n\t\tlibpodRoot := configBucket.Get(staticDirKey)\n\t\tlibpodTmp := configBucket.Get(tmpDirKey)\n\t\tstorageRoot := configBucket.Get(graphRootKey)\n\t\tstorageTmp := configBucket.Get(runRootKey)\n\t\tgraphDriver := configBucket.Get(graphDriverKey)\n\t\tvolumePath := configBucket.Get(volPathKey)\n\n\t\tcfg.LibpodRoot = string(libpodRoot)\n\t\tcfg.LibpodTmp = string(libpodTmp)\n\t\tcfg.StorageRoot = string(storageRoot)\n\t\tcfg.StorageTmp = string(storageTmp)\n\t\tcfg.GraphDriver = string(graphDriver)\n\t\tcfg.VolumePath = string(volumePath)\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cfg, nil\n}", "func HandleGetDatabaseConnectionState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tconnState := crud.GetConnectionState(ctx, dbAlias)\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: connState})\n\t}\n}", "func DBConfig(globalConfig *viper.Viper) (config *mysql.Config, err error) {\n\t// Env variables are not loaded if the keys do not exist in the config file\n\t// To fix this issue, instead of loading config files and overriding with env vars,\n\t// we load all possible keys (with their default value), override with config files,\n\t// and then environmenent variables.\n\temptyConfig := &map[string]interface{}{}\n\tif err = mapstructure.Decode(mysql.NewConfig(), &emptyConfig); err != nil {\n\t\treturn // unexpected\n\t}\n\tvConfig := viper.New()\n\t_ = vConfig.MergeConfigMap(*emptyConfig) // the function always return nil\n\tif conf := globalConfig.GetStringMap(databaseConfigKey); conf != nil {\n\t\t_ = vConfig.MergeConfigMap(conf)\n\t}\n\tvConfig.SetEnvPrefix(fmt.Sprintf(\"%s_%s_\", envPrefix, databaseConfigKey))\n\tvConfig.AutomaticEnv()\n\terr = vConfig.Unmarshal(&config)\n\treturn\n}", "func GetConfigHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tconfigName := ps.ByName(\"config\")\n\n\tconfiguration, err := ubus.UciGetConfig(uci.ConfigType(configName))\n\tif err != nil {\n\t\trend.JSON(w, http.StatusOK, map[string]string{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\trend.JSON(w, http.StatusOK, configuration)\n}", "func (extDb *Database) GetConfig() *Config {\n\treturn extDb.config\n}", "func getAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request for config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n // get config from database and return\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n config, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"data\": config})\n}", "func (c *ConfigurationStruct) GetDatabaseInfo() config.DatabaseInfo {\n\treturn c.Databases\n}", "func ReadConfig() Database {\n\treturn databases\n}", "func GetDBServerConfig() DBServerConfig {\n\n\tconfigFile, err := os.Open(\"config/db_config.json\")\n\tif err != nil {\n fmt.Println(\"opening config file: \", err.Error())\n }\n\n jsonParser := json.NewDecoder(configFile)\n\n config := DBServerConfig{}\n if err := jsonParser.Decode(&config); err != nil {\n \tfmt.Println(\"decoding config file: \", err.Error())\n }\n\n return config\n\n}", "func onDatabaseConfig(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\trequires := getDBLocalProxyRequirement(tc, database)\n\t// \"tsh db config\" prints out instructions for native clients to connect to\n\t// the remote proxy directly. Return errors here when direct connection\n\t// does NOT work (e.g. when ALPN local proxy is required).\n\tif requires.localProxy {\n\t\tmsg := formatDbCmdUnsupported(cf, database, requires.localProxyReasons...)\n\t\treturn trace.BadParameter(msg)\n\t}\n\n\thost, port := tc.DatabaseProxyHostPort(*database)\n\trootCluster, err := tc.RootClusterName(cf.Context)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tformat := strings.ToLower(cf.Format)\n\tswitch format {\n\tcase dbFormatCommand:\n\t\tcmd, err := dbcmd.NewCmdBuilder(tc, profile, database, rootCluster,\n\t\t\tdbcmd.WithPrintFormat(),\n\t\t\tdbcmd.WithLogger(log),\n\t\t).GetConnectCommand()\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(strings.Join(cmd.Env, \" \"), cmd.Path, strings.Join(cmd.Args[1:], \" \"))\n\tcase dbFormatJSON, dbFormatYAML:\n\t\tconfigInfo := &dbConfigInfo{\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName),\n\t\t\tprofile.KeyPath(),\n\t\t}\n\t\tout, err := serializeDatabaseConfig(configInfo, format)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(out)\n\tdefault:\n\t\tfmt.Printf(`Name: %v\nHost: %v\nPort: %v\nUser: %v\nDatabase: %v\nCA: %v\nCert: %v\nKey: %v\n`,\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName), profile.KeyPath())\n\t}\n\treturn nil\n}", "func newConfigHandler() *configHandler {\n return &configHandler {\n database: map[string]Config{},\n }\n}", "func (config *Config) configureDB(viperRegistry *viper.Viper) error {\n\tdbConfig := &DatabaseSetting{}\n\tdb := viperRegistry.Sub(\"db\")\n\n\tif err := db.Unmarshal(dbConfig); err != nil {\n\t\treturn err\n\t}\n\n\tif !db.IsSet(\"user\") {\n\t\tif !viperRegistry.IsSet(\"DB_USER\") {\n\t\t\treturn errors.New(\"database user not set\")\n\t\t}\n\n\t\tdbConfig.User = viperRegistry.GetString(\"DB_USER\")\n\t}\n\n\tif !db.IsSet(\"password\") {\n\t\tif !viperRegistry.IsSet(\"DB_PASSWORD\") {\n\t\t\treturn errors.New(\"database password not set\")\n\t\t}\n\n\t\tdbConfig.Password = viperRegistry.GetString(\"DB_PASSWORD\")\n\t}\n\n\tif !db.IsSet(\"name\") {\n\t\tif !viperRegistry.IsSet(\"DB_NAME\") {\n\t\t\treturn errors.New(\"database name not set\")\n\t\t}\n\n\t\tdbConfig.Name = viperRegistry.GetString(\"DB_NAME\")\n\t}\n\n\tif !db.IsSet(\"address\") {\n\t\tif !viperRegistry.IsSet(\"DB_ADDRESS\") {\n\t\t\treturn errors.New(\"database address not set\")\n\t\t}\n\n\t\tdbConfig.Address = viperRegistry.GetString(\"DB_ADDRESS\")\n\t}\n\n\tconfig.Database = dbConfig\n\n\treturn nil\n}", "func GetDBConfig() datastore.DBConfiguration {\n\tconfig := datastore.DBConfiguration{}\n\tconfig.DBName = os.Getenv(\"MongoDBName\")\n\tconfig.HostID = os.Getenv(\"MongoHostID\")\n\tconfig.PORT = os.Getenv(\"MongoPORT\")\n\tconfig.Password = os.Getenv(\"MongoPassword\")\n\tconfig.Username = os.Getenv(\"MongoUsername\")\n\treturn config\n}", "func (h *handler) getDatabase(dbName string) *mgo.Database {\n\treturn h.dbClient.DB(dbName)\n}", "func GetDatabase(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"postgresql:database\")\n}", "func DBconfig() DBcfg {\n\th := viper.GetString(\"local-host\")\n\t// maybe it's a windows thing\n\t// \"HOST\" is being return with quotes around the [\"string\"]\n\th2 := util.Trim(viper.GetString(\"HOST\"), \"\\\"\")\n\tvar sfg *viper.Viper\n\tif h == h2 {\n\t\tsfg = viper.Sub(\"app-db-local\")\n\t} else {\n\t\tsfg = viper.Sub(\"app-db-dev\")\n\t}\n\n\treturn dbSettings(sfg)\n}", "func (c *Config) DB() *database.Config {\n\treturn c.Database\n}", "func GetDB(logger logrus.FieldLogger, config *viper.Viper, dbOrNil pginterfaces.DB, dbCtxOrNil pginterfaces.CtxWrapper) (*pg.Client, error) {\n\tl := logger.WithFields(logrus.Fields{\n\t\t\"operation\": \"configureDatabase\",\n\t\t\"host\": config.GetString(\"extensions.pg.host\"),\n\t\t\"port\": config.GetString(\"extensions.pg.port\"),\n\t})\n\tl.Debug(\"connecting to DB...\")\n\tclient, err := pg.NewClient(\"extensions.pg\", config, dbOrNil, nil, dbCtxOrNil)\n\tif err != nil {\n\t\tl.WithError(err).Error(\"connection to database failed\")\n\t\treturn nil, err\n\t}\n\tif dbOrNil != nil {\n\t\tclient.DB = dbOrNil\n\t}\n\tl.Info(\"successfully connected to database\")\n\treturn client, nil\n}", "func dbConfig() (map[string]string, error) {\n\tconf := make(map[string]string)\n\thost, ok := os.LookupEnv(dbhost)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBHOST environment variable required\")\n\t}\n\tport, ok := os.LookupEnv(dbport)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBPORT environment variable required\")\n\t}\n\tuser, ok := os.LookupEnv(dbuser)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBUSER environment variable required\")\n\t}\n\tpassword, ok := os.LookupEnv(dbpass)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBPASS environment variable required\")\n\t}\n\tname, ok := os.LookupEnv(dbname)\n\tif !ok {\n\t\treturn nil, errors.New(\"DBNAME environment variable required\")\n\t}\n\tconf[dbhost] = host\n\tconf[dbport] = port\n\tconf[dbuser] = user\n\tconf[dbpass] = password\n\tconf[dbname] = name\n\treturn conf, nil\n}", "func ReadConfig() MongoDB {\n\treturn databases\n}", "func (client RecommendedElasticPoolsClient) GetDatabasesResponder(resp *http.Response) (result Database, 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}", "func GetDatabase(config Config, database string) (*client.Database, error) {\n\tclient, err := GetClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.GetDatabase(context.Background(), database)\n}", "func HandleGetConfigurations(pool *proxyPool)gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t config:=*pool.c\n\t\t RenderConfigTable(c.Writer,\"proxy ip pool configurations\",config)\n\t}\n}", "func (manager *defaultDocumentManager) GetDB() *mgo.Database {\n\treturn manager.database\n}", "func GetDB(c *gin.Context) *mgo.Database {\n\treturn c.MustGet(dbKey).(*mgo.Database)\n}", "func (s *AdapterConfig) DB() base.DBInterface {\n\treturn adapterConfigDB\n}", "func GetDB(config JSONConfigurationDB) (*gorm.DB, error) {\n\t// Generate DB connection string\n\tpostgresDSN := fmt.Sprintf(\n\t\tDBString, config.Host, config.Port, config.Name, config.Username, config.Password)\n\t// Connect to DB\n\tdb, err := gorm.Open(DBDialect, postgresDSN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Performance settings for DB access\n\tdb.DB().SetMaxIdleConns(config.MaxIdleConns)\n\tdb.DB().SetMaxOpenConns(config.MaxOpenConns)\n\tdb.DB().SetConnMaxLifetime(time.Second * time.Duration(config.ConnMaxLifetime))\n\n\treturn db, nil\n}", "func MongoConfig() *mgo.Database {\n\tdb, err := config.GetMongoDB()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn db\n}", "func HandleQueryAlgConfigGet(c *gin.Context) {\n\tlog.HTTP.Info(\"HandleQueryAlgConfigGet BEGIN\")\n\tdeviceID, err := strconv.ParseInt(c.Param(\"did\"), 10, 64)\n\tif err != nil {\n\t\tlog.HTTP.Error(err)\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"err\": errcode.ErrParams.Code,\n\t\t\t\"errMsg\": errcode.ErrParams.String,\n\t\t})\n\t\treturn\n\t}\n\n\talgID, algConfig, err := dao.QueryAlgConfig(int(deviceID))\n\tif err != nil {\n\t\tlog.HTTP.Error(err)\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"err\": errcode.ErrQueryAlgConfig.Code,\n\t\t\t\"errMsg\": errcode.ErrQueryAlgConfig.String,\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"err\": \t errcode.ErrNoError.Code,\n\t\t\"errMsg\": \t errcode.ErrNoError.String,\n\t\t\"algID\": \t algID,\n\t\t\"algConfig\": algConfig,\n\t})\n\treturn\n}", "func (app *application) GetDB() *components.Database {\n\treturn app.GetDBInterface().(*components.Database)\n}", "func GetDatabase(databaseName string, conn Conn) (Database, error) {\n\tvar d = Database{\n\t\tName: databaseName,\n\t\tSchemas: make([]Schema, 0),\n\t}\n\tschemas, err := conn.GetSchemaNames()\n\tif err != nil {\n\t\treturn d, err\n\t}\n\tfor _, schemaName := range schemas {\n\t\tschema, err := GetSchema(schemaName, conn)\n\t\tif err != nil {\n\t\t\treturn d, err\n\t\t}\n\t\td.Schemas = append(d.Schemas, schema)\n\t}\n\treturn d, nil\n}", "func (c *configHandler) filterConfig(w http.ResponseWriter, r *http.Request) *Config {\n urllen := strings.Split(r.URL.String(), \"/\")\n if len(urllen) !=3 {\n w.WriteHeader(http.StatusNotFound)\n log.Print(\"Bad request\")\n }\n\n c.Lock()\n reqconfig, ok := c.database[urllen[2]]\n c.Unlock()\n if !ok {\n w.WriteHeader(http.StatusNotFound)\n log.Print(\"Failed fetching the desired config\")\n }\n\n return &reqconfig\n}", "func Get() (*Config, error) {\n\tif cfg != nil {\n\t\treturn cfg, nil\n\t}\n\n\tcfg = &Config{\n\t\tBindAddr: \"localhost:25500\",\n\t\tGracefulShutdownTimeout: 5 * time.Second,\n\t\tHealthCheckInterval: 30 * time.Second,\n\t\tHealthCheckCriticalTimeout: 90 * time.Second,\n\t\tDefaultMaxLimit: 1000,\n\t\tDefaultLimit: 20,\n\t\tDefaultOffset: 0,\n\t\tMongoConfig: MongoConfig{\n\t\t\tBindAddr: \"localhost:27017\",\n\t\t\tCollection: \"areas\",\n\t\t\tDatabase: \"areas\",\n\t\t},\n\t}\n\n\treturn cfg, envconfig.Process(\"\", cfg)\n}", "func (c *configHandler) queryDatabase(w http.ResponseWriter, r *http.Request) {\n if r.Method != \"GET\" {\n w.WriteHeader(http.StatusMethodNotAllowed)\n w.Write([]byte(\"Method not allowed\"))\n return\n }\n params := strings.Split(strings.Split(r.URL.String(), \"?\")[1], \".\")\n if params[0] != \"metadata\" {\n log.Print(\"wrong query\")\n w.WriteHeader(http.StatusBadRequest)\n w.Write([]byte(\"bad Request. Please query metadata\"))\n return\n }\n lastparam := strings.Split(params[len(params)-1], \"=\")[0]\n searchvalue := strings.Split(params[len(params)-1], \"=\")[1]\n\n // list of configs that matches the query\n reqConfigs := []Config{}\n\n c.Lock()\n for _, config := range c.database {\n meta := config.Metadata\n var parse func(metadata map[string]interface{})\n parse = func(metadata map[string]interface{}) {\n for key, val := range metadata {\n // switch case for matching data type\n switch actualVal := val.(type) {\n case map[string]interface{}:\n if key == params[len(params)-2] {\n if actualVal[lastparam] == searchvalue {\n reqConfigs = append(reqConfigs, config)\n log.Print(reqConfigs)\n break\n }\n }\n parse(val.(map[string]interface{}))\n default:\n if len(params) == 2 {\n if key == lastparam {\n if actualVal == searchvalue {\n reqConfigs = append(reqConfigs, config)\n log.Print(reqConfigs)\n break\n }\n }\n }\n }\n }\n }\n parse(meta)\n }\n c.Unlock()\n\n responsejson, err := json.Marshal(reqConfigs)\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n w.Write([]byte(err.Error()))\n return\n }\n w.Header().Add(\"content-type\", \"application/json\")\n w.WriteHeader(http.StatusOK)\n w.Write(responsejson)\n}", "func (CTRL *BaseController) GetDB(db ...string) orm.Ormer {\n\tCTRL.db = database.MainDatabase.Orm\n\tif len(db) > 0 {\n\t\tif db[0] == \"master\" {\n\t\t\tdb[0] = \"default\"\n\t\t}\n\t\tCTRL.db.Using(db[0])\n\t}\n\treturn CTRL.db\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func GetHandleConfig(actions chan Action, responses chan ActionResponse) http.HandlerFunc {\n\t// I return the handler, decorated with the list of endpoints\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// I get the agent name from the query...\n\t\tvars := mux.Vars(r)\n\t\tagentName := vars[\"agentName\"]\n\t\t// ... and I add a new action to process\n\t\tactions <- Action{\n\t\t\tType: ActionConfig,\n\t\t\tPayload: agentName,\n\t\t}\n\t\t// I get the response and I return it\n\t\twriteActionResponse(w, <-responses)\n\t}\n}", "func ConfigGET(db *sqlx.DB, ctx *gin.Context) {\n\n var err error\n\n // parse id param\n var setting string = strings.ToLower(ctx.Param(\"setting\"))\n\n var config *Config\n config, err = GetConfig(db, setting)\n switch {\n case err == ErrConfigNoSuchSetting:\n ctx.JSON(http.StatusNotFound, gin.H{\n \"status\": http.StatusNotFound,\n \"developerMessage\": err.Error(),\n \"userMessage\": \"unable to find config setting\",\n })\n return\n case err != nil:\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"status\": http.StatusInternalServerError,\n \"developerMessage\": err.Error(),\n \"userMessage\": \"unable to retrieve config setting\",\n })\n ctx.Error(err)\n return\n }\n\n ctx.JSON(http.StatusOK, gin.H{\n \"setting\": config.Setting,\n \"value\": config.Value,\n })\n}", "func (cfg *Config) loadDBConfig() error {\n\tswitch cfg.DB.T {\n\tcase \"leveldb\":\n\t\tcfg.DB.Type = LEVELDB\n\t\tif cfg.DB.LevelDB.Dir == \"\" {\n\t\t\tif !cfg.Debug {\n\t\t\t\treturn errors.New(\"leveldb path is not setted\")\n\t\t\t}\n\t\t\tcfg.DB.LevelDB.Dir = getDefaultLevelDBPath()\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupport db type: %s\", cfg.DB.T)\n\t}\n\treturn nil\n}", "func (c *ConfigImpl) DB() db.QInterface {\n\tif c.db != nil {\n\t\treturn c.db\n\t}\n\n\tlog := c.Log()\n\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tdatabase := &DB{}\n\tif err := env.Parse(database); err != nil {\n\t\tlog.WithError(err).Error(\"failed to get db data from env\")\n\t\tpanic(err)\n\t}\n\n\terr := database.validate()\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"failed to validate db client\")\n\t\tpanic(err)\n\t}\n\n\trepo, err := db.New(database.Info())\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"failed to setup db\")\n\t\tpanic(err)\n\t}\n\n\tc.db = repo\n\n\treturn c.db\n}", "func (c *httpClient) Database() string {\n\treturn c.config.Database\n}", "func handleGetMultitenantDatabases(c *Context, w http.ResponseWriter, r *http.Request) {\n\tpaging, err := parsePaging(r.URL)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to parse paging parameters\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfilter := &model.MultitenantDatabaseFilter{\n\t\tVpcID: parseString(r.URL, \"vpc_id\", \"\"),\n\t\tDatabaseType: parseString(r.URL, \"database_type\", \"\"),\n\t\tPaging: paging,\n\t\tMaxInstallationsLimit: model.NoInstallationsLimit,\n\t}\n\n\tmultitenantDatabases, err := c.Store.GetMultitenantDatabases(filter)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to query multitenant databases\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif multitenantDatabases == nil {\n\t\tmultitenantDatabases = []*model.MultitenantDatabase{}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\toutputJSON(c, w, multitenantDatabases)\n}", "func NewConfig() Database {\n\tconfigOnce.Do(func() {\n\t\t// FIXME , we are planing to use logrusHelper. Seems we still\n\t\t// need missing some initialization for logrus. But it repors error as\n\t\t// follow:\n\t\t// # github.com/heirko/go-contrib/logrusHelper\n\t\t// undefined: logrus_mate.LoggerConfig\n\t\t// var c = logrusHelper.UnmarshalConfiguration(viper) // Unmarshal configuration from Viper\n\t\t// logrusHelper.SetConfig(logrus.StandardLogger(), c) // for e.g. apply it to logrus default instance\n\n\t\tviper.UnmarshalKey(\"database\", db)\n\t})\n\n\treturn *db\n}", "func (client GroupClient) GetDatabaseResponder(resp *http.Response) (result USQLDatabase, 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}", "func (controller *Controller) GetDbMap(c web.C) *gorp.DbMap {\n\treturn c.Env[\"DbMap\"].(*gorp.DbMap)\n}", "func getDbConfig(appEnv string) DBConfig {\n\tdbURL := dbConfig[appEnv].DbURL\n\tif dbURL == \"\" && appEnv != \"production\" {\n\t\treturn DBConfig{\n\t\t\tDialect: getEnv(\"DB_TYPE\", \"postgres\"),\n\t\t\tUsername: getEnv(\"DB_USER\", \"\"),\n\t\t\tPassword: getEnv(\"DB_PASS\", \"\"),\n\t\t\tDbName: getEnv(\"DB_DEV\", \"\"),\n\t\t\tDbHost: getEnv(\"DB_HOST\", \"localhost\"),\n\t\t\tLogging: getEnvAsBool(\"DB_LOGGING\", false),\n\t\t}\n\t}\n\tparsedURL, err := url.Parse(dbURL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tpassword, _ := parsedURL.User.Password()\n\thost, _, _ := net.SplitHostPort(parsedURL.Host)\n\treturn DBConfig{\n\t\tUsername: parsedURL.User.Username(),\n\t\tPassword: password,\n\t\tDbName: parsedURL.Path[1:],\n\t\tDbHost: host,\n\t\tLogging: getEnvAsBool(\"DB_LOGGING\", false),\n\t}\n}", "func HandleGetEventingConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-config\", \"read\", map[string]string{\"project\": projectID})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\t// get project config\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, e, err := syncMan.GetEventingConfig(ctx, projectID, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: []interface{}{e}})\n\t}\n}", "func (c *configHandler) getAllConfigs(w http.ResponseWriter, r *http.Request) {\n log.Printf(\"received /configs GET request from %v\", r.Host)\n configs := make([]Config, len(c.database))\n\n c.Lock()\n i :=0\n for _, config := range c.database {\n configs[i] = config\n i++\n }\n c.Unlock()\n\n responsejson, err := json.Marshal(configs)\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n w.Write([]byte(err.Error()))\n }\n\n w.Header().Add(\"content-type\", \"application/json\")\n w.WriteHeader(http.StatusOK)\n w.Write(responsejson)\n}", "func withConfig(getDB func() *sql.DB, handle func(getDB func() *sql.DB, w http.ResponseWriter, r *http.Request, ps httprouter.Params)) httprouter.Handle {\n\treturn httprouter.Handle(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\thandle(getDB, w, r, ps)\n\t},\n\t)\n}", "func (mc *MongoClient) GetCollectionHandler(name string) *mongo.Collection {\n\tif name == \"\" {\n\t\tmc.logger.Fatalw(\"you have not set mongodb collection name\")\n\t}\n\treturn mc.getDbHandler().Collection(name)\n}", "func GetConnectionPoolAppDB() (*sql.DB, error) {\n\n\tif dbAppConf.InitSuccess == false {\n\t\tinitAppDB()\n\t}\n\n\treturn dbAppConf.Conn, dbAppConf.Err\n}", "func (c *Config) GetDatabasePath() string {\n\treturn c.strings[dbPathVar]\n}", "func getDBHandle() (*sql.DB, error) {\n\t\n\tconnectionString := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\tglobal_cfg.Database.Host,\n\t\tglobal_cfg.Database.Port,\n\t\tglobal_cfg.Database.User,\n\t\tglobal_cfg.Database.Password,\n\t\tglobal_cfg.Database.DBName)\n\n\tcontext, err := sql.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\terr = context.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn context, err\n}", "func GetDB(host string, user string, port int, sslmode string, dbName string, password string) (interfaces.Database, error) {\n\tif _db == nil {\n\t\tvar err error\n\t\t_db, err = InitDb(host, user, port, sslmode, dbName, password)\n\t\tif err != nil {\n\t\t\t_db = nil\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn _db, nil\n}", "func (d DB) GetConfig(ctx context.Context, userID string) (userconfig.View, error) {\n\tvar cfgView userconfig.View\n\tvar cfgBytes []byte\n\tvar deletedAt pq.NullTime\n\terr := d.Select(\"id\", \"config\", \"deleted_at\").\n\t\tFrom(\"configs\").\n\t\tWhere(squirrel.And{allConfigs, squirrel.Eq{\"owner_id\": userID}}).\n\t\tOrderBy(\"id DESC\").\n\t\tLimit(1).\n\t\tQueryRow().Scan(&cfgView.ID, &cfgBytes, &deletedAt)\n\tif err != nil {\n\t\treturn cfgView, err\n\t}\n\tcfgView.DeletedAt = deletedAt.Time\n\terr = json.Unmarshal(cfgBytes, &cfgView.Config)\n\treturn cfgView, err\n}", "func getDB(dbName string) Database {\n\treturn getKDB()\n}", "func newDatabaseConfig() *databaseConfig {\n\treturn &databaseConfig {\n\t\thost: viper.GetString(\"DB_HOST\"),\n\t\tport: getIntOrPanic(\"DB_PORT\"),\n\t\tname: viper.GetString(\"DB_NAME\"),\n\t\tusername: viper.GetString(\"DB_USER\"),\n\t\tpassword: viper.GetString(\"DB_PASSWORD\"),\n\t\tmaxPoolSize: getIntOrPanic(\"DB_POOL\"),\n\t}\n}", "func GetDBConfig() MyDBConfig {\n\tconfig := MyDBConfig{\n\t\tIP: getEnvString(\"DB_IP\", \"\"),\n\t\tUsername: getEnvString(\"DB_USERNAME\", \"\"),\n\t\tPassword: getEnvString(\"DB_PASSWORD\", \"\"),\n\t\tPort: getEnvInt(\"DB_PORT\", 0),\n\t\tTimeout: getEnvInt(\"DB_TIMEOUT\", 0),\n\t\tName: getEnvString(\"DB_NAME\", \"\"),\n\t}\n\treturn config\n}", "func GetDB(name string) DB {\n\treturn data.dbDict[name]\n}", "func GetDBConfig() *DBConfiguration {\n\treturn &DBConfiguration{\n\t\tUsername: os.Getenv(\"DB_USERNAME\"),\n\t\tPassword: os.Getenv(\"DB_PASSWORD\"),\n\t\tPort: os.Getenv(\"DB_PORT\"),\n\t\tHost: os.Getenv(\"DB_HOST\"),\n\t\tDBName: os.Getenv(\"DB_NAME\"),\n\t}\n}", "func DBConfig(t *testing.T, d drivers.Driver) *config.Config {\n\tc := Config(t)\n\tif d == \"\" {\n\t\td = c.DB.Driver\n\t}\n\treturn configDB(t, c, d)\n}", "func ReadConfig() Info {\n\treturn databases\n}", "func (client *MongoDBResourcesClient) getMongoDBDatabaseHandleResponse(resp *azcore.Response) (MongoDBResourcesGetMongoDBDatabaseResponse, error) {\n\tresult := MongoDBResourcesGetMongoDBDatabaseResponse{RawResponse: resp.Response}\n\tif err := resp.UnmarshalAsJSON(&result.MongoDBDatabaseGetResults); err != nil {\n\t\treturn MongoDBResourcesGetMongoDBDatabaseResponse{}, err\n\t}\n\treturn result, nil\n}", "func (c *Config) GetDatabaseURL() string {\n\treturn fmt.Sprintf(\"mongodb+srv://%s:%s@%s/%s\", c.mongoUsername, c.mongoPassword, c.mongoURI, c.Database)\n}", "func GetDBPersistHandler() *DBPersistHandler {\n\tif _handler == nil {\n\t\t_handlerOnce.Do(func() {\n\t\t\th := &DBPersistHandler{\n\t\t\t\thandlerMap: make(map[string]reflect.Value),\n\t\t\t}\n\t\t\tlvRepo := lv.GetLvRepository()\n\t\t\th.handlerMap[\"lv-create\"] = reflect.ValueOf(lvRepo.Create)\n\t\t\th.handlerMap[\"lv-update\"] = reflect.ValueOf(lvRepo.Save)\n\t\t\th.handlerMap[\"lv-update-used\"] = reflect.ValueOf(lvRepo.UpdateUsed)\n\t\t\th.handlerMap[\"lv-update-pr\"] = reflect.ValueOf(lvRepo.UpdatePr)\n\t\t\th.handlerMap[\"lv-delete\"] = reflect.ValueOf(lvRepo.Delete)\n\n\t\t\tpvcRepo := k8spvc.GetPvcRepository()\n\t\t\th.handlerMap[\"pvc-update-pr\"] = reflect.ValueOf(pvcRepo.UpdatePrKey)\n\t\t\th.handlerMap[\"pvc-create\"] = reflect.ValueOf(pvcRepo.Create)\n\t\t\th.handlerMap[\"pvc-delete\"] = reflect.ValueOf(pvcRepo.Delete)\n\t\t\th.handlerMap[\"pvc-update-capacity\"] = reflect.ValueOf(pvcRepo.UpdateCapacity)\n\t\t\th.handlerMap[\"pvc-update-status\"] = reflect.ValueOf(pvcRepo.UpdateStatus)\n\n\t\t\tpvRepo := k8spvc.GetPvRepository()\n\t\t\th.handlerMap[\"pv-create\"] = reflect.ValueOf(pvRepo.CreateOrUpdate)\n\t\t\th.handlerMap[\"pv-delete\"] = reflect.ValueOf(pvRepo.Delete)\n\n\t\t\tpvcStatusRepo := k8spvc.GetPvcStatusRepository()\n\t\t\th.handlerMap[\"pvc-status-create\"] = reflect.ValueOf(pvcStatusRepo.Create)\n\n\t\t\t_handler = h\n\t\t})\n\t}\n\treturn _handler\n}", "func DBHandler(fallback http.Handler) (http.HandlerFunc, error) {\n\tdb, err := postgresconnection.Getconn()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpaths := make(map[string]string)\n\tsqlStatement := `SELECT id, path, url FROM urls;`\n\trows, err := db.Query(sqlStatement)\n\tif err != nil {\n\t\t// handle this error better than this\n\t\tpanic(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar path, url string\n\t\terr = rows.Scan(&id, &path, &url)\n\t\tif err != nil {\n\t\t\t// handle this error\n\t\t\tpanic(err)\n\t\t}\n\t\tpaths[path] = url\n\t}\n\t// get any error encountered during iteration\n\terr = rows.Err()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn MapHandler(paths, fallback), nil\n}", "func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) {\n\treq, err := client.GetPreparer(resourceGroupName, serverName, databaseName, expand)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesClient\", \"Get\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (fn GetConfigurationsHandlerFunc) Handle(params GetConfigurationsParams) middleware.Responder {\n\treturn fn(params)\n}", "func (adm *admin) backendConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tif adm.backendAdmin == nil {\n\t\tadm.sendNotImplementedResponse(w)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tbid := beIDRe.FindStringSubmatch(r.URL.RequestURI())\n\tfmt.Fprint(w, adm.backendAdmin.BackendConfig(bid[3]))\n}", "func GetDatabase(image liferay.Image, datastore string) DatabaseImage {\n\tif datastore == \"mysql\" {\n\t\treturn MySQL{LpnType: image.GetType()}\n\t} else if datastore == \"postgresql\" {\n\t\treturn PostgreSQL{LpnType: image.GetType()}\n\t}\n\n\treturn nil\n}", "func (pg *PostgresqlDb) config() *domain.ErrHandler {\n var port string\n ok := false\n pg.host, ok = os.LookupEnv(dbhost)\n if !ok {\n return &domain.ErrHandler{2, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n port, ok = os.LookupEnv(dbport)\n if !ok {\n return &domain.ErrHandler{3, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.port, _ = strconv.Atoi(port)\n pg.user, ok = os.LookupEnv(dbuser)\n if !ok {\n return &domain.ErrHandler{4, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.pass, ok = os.LookupEnv(dbpass)\n if !ok {\n return &domain.ErrHandler{5, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n pg.dbname, ok = os.LookupEnv(dbname)\n if !ok {\n return &domain.ErrHandler{6, \"func (pg PostgresqlDb)\", \"config\", \"\"}\n }\n return nil\n}", "func (dao *SysConfigDao) DB() gdb.DB {\n\treturn g.DB(dao.group)\n}", "func (f *MongoFactory) GetDatabase() *mongo.Database {\n\tif f.Client == nil {\n\t\tf.Client = f.GetClient()\n\t}\n\n\tdatabase := f.Client.Database(f.Context.Database)\n\n\tif database == nil {\n\t\tlog.Fatal(\"There was an error getting the database \" + f.Context.Database)\n\t}\n\n\tf.Database = database\n\n\treturn database\n}", "func (mp *MongoPool) GetDatabase() (*mongo.Database, error) {\n\tconn, err := mp.CreateConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn.Database(constants.DBName), err\n}", "func (context *handlerContext) DB() *pop.Connection {\n\treturn context.db\n}", "func Get(c context.Context) *sql.DB {\n\treturn c.Value(&dbKey).(*sql.DB)\n}", "func DB() martini.Handler {\n session, err := mgo.Dial(\"mongodb://localhost\")\n if err != nil {\n panic(err)\n }\n\n return func(c martini.Context) {\n s := session.Clone()\n c.Map(s.DB(\"buildnumber\"))\n defer s.Close()\n c.Next()\n }\n}", "func (app *Application) GetConfig() *Config {\n return app.config\n}", "func (rt *RestTester) GetDatabase() *db.DatabaseContext {\n\n\tfor _, database := range rt.ServerContext().AllDatabases() {\n\t\treturn database\n\t}\n\treturn nil\n}", "func MakeDbHandler(fn func(http.ResponseWriter, *http.Request, *AppServer), serv *AppServer) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfn(w, r, serv)\n\t}\n}", "func DatabaseConfiguration() *sql.DB {\n\tconn, err := sql.Open(\"mysql\", \"TestUser:12345678@tcp/LOGGER\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\treturn conn\n}", "func Database(name ...string) gdb.DB {\n\tconfig := Config()\n\tgroup := gdb.DEFAULT_GROUP_NAME\n\tif len(name) > 0 && name[0] != \"\" {\n\t\tgroup = name[0]\n\t}\n\tinstanceKey := fmt.Sprintf(\"%s.%s\", gFRAME_CORE_COMPONENT_NAME_DATABASE, group)\n\tdb := instances.GetOrSetFuncLock(instanceKey, func() interface{} {\n\t\t// Configuration already exists.\n\t\tif gdb.GetConfig(group) != nil {\n\t\t\tdb, err := gdb.Instance(group)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\treturn db\n\t\t}\n\t\tm := config.GetMap(\"database\")\n\t\tif m == nil {\n\t\t\tpanic(`database init failed: \"database\" node not found, is config file or configuration missing?`)\n\t\t}\n\t\t// Parse <m> as map-slice and adds it to gdb's global configurations.\n\t\tfor group, groupConfig := range m {\n\t\t\tcg := gdb.ConfigGroup{}\n\t\t\tswitch value := groupConfig.(type) {\n\t\t\tcase []interface{}:\n\t\t\t\tfor _, v := range value {\n\t\t\t\t\tif node := parseDBConfigNode(v); node != nil {\n\t\t\t\t\t\tcg = append(cg, *node)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase map[string]interface{}:\n\t\t\t\tif node := parseDBConfigNode(value); node != nil {\n\t\t\t\t\tcg = append(cg, *node)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(cg) > 0 {\n\t\t\t\tintlog.Printf(\"%s, %#v\", group, cg)\n\t\t\t\tgdb.SetConfigGroup(group, cg)\n\t\t\t}\n\t\t}\n\t\t// Parse <m> as a single node configuration,\n\t\t// which is the default group configuration.\n\t\tif node := parseDBConfigNode(m); node != nil {\n\t\t\tcg := gdb.ConfigGroup{}\n\t\t\tif node.LinkInfo != \"\" || node.Host != \"\" {\n\t\t\t\tcg = append(cg, *node)\n\t\t\t}\n\t\t\tif len(cg) > 0 {\n\t\t\t\tintlog.Printf(\"%s, %#v\", gdb.DEFAULT_GROUP_NAME, cg)\n\t\t\t\tgdb.SetConfigGroup(gdb.DEFAULT_GROUP_NAME, cg)\n\t\t\t}\n\t\t}\n\n\t\tif db, err := gdb.New(name...); err == nil {\n\t\t\t// Initialize logger for ORM.\n\t\t\tm := config.GetMap(fmt.Sprintf(\"database.%s\", qn_logGER_NODE_NAME))\n\t\t\tif m == nil {\n\t\t\t\tm = config.GetMap(qn_logGER_NODE_NAME)\n\t\t\t}\n\t\t\tif m != nil {\n\t\t\t\tif err := db.GetLogger().SetConfigWithMap(m); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn db\n\t\t} else {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn nil\n\t})\n\tif db != nil {\n\t\treturn db.(gdb.DB)\n\t}\n\treturn nil\n}", "func getDatabaseInfo(cf *CLIConf, tc *client.TeleportClient, dbName string) (*tlsca.RouteToDatabase, types.Database, error) {\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err == nil {\n\t\tswitch database.Protocol {\n\t\tcase defaults.ProtocolCassandra:\n\t\t\t// Cassandra CLI connection require database resource to determine\n\t\t\t// if the target database is AWS hosted in order to skip the password prompt.\n\t\tdefault:\n\t\t\treturn database, nil, nil\n\t\t}\n\t}\n\tif err != nil && !trace.IsNotFound(err) {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\tdb, err := getDatabase(cf, tc, dbName)\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\tusername := cf.DatabaseUser\n\tdatabaseName := cf.DatabaseName\n\tif database != nil {\n\t\tif username == \"\" {\n\t\t\tusername = database.Username\n\t\t}\n\t\tif databaseName == \"\" {\n\t\t\tdatabaseName = database.Database\n\t\t}\n\t}\n\n\treturn &tlsca.RouteToDatabase{\n\t\tServiceName: db.GetName(),\n\t\tProtocol: db.GetProtocol(),\n\t\tUsername: username,\n\t\tDatabase: databaseName,\n\t}, db, nil\n}", "func Get(req *http.Request, key interface{}) (*mgo.Database, error) {\n\tdb, ok := context.Get(req, key).(*mgo.Database)\n\tif !ok {\n\t\treturn nil, ErrInvalidContext\n\t}\n\n\treturn db, nil\n}", "func GetDB() (couch.Database, os.Error) {\n\treturn couch.NewDatabase(Settings.DatabaseAddress(), \"5984\", Settings.Database())\n}", "func (e *engine) GetDatabase(databaseName string) (Database, bool) {\n\titem, _ := e.databases.Load(databaseName)\n\tdb, ok := item.(Database)\n\treturn db, ok\n}", "func GetDatabase() (*leveldb.DB, error) {\n databasePath, err := GetDatabasePath()\n if err != nil {\n return nil, err\n }\n\n db, err := leveldb.OpenFile(databasePath, nil)\n if err != nil {\n return nil, err\n }\n\n return db, err\n}", "func GetDb() (db *gorm.DB, err error) {\n\tdbInfo := GetConfig().Database\n\tswitch dbInfo.DbType {\n\tcase \"mysql\":\n\t\tdb, err = gorm.Open(dbInfo.DbType, utils.StringsJoin(\n\t\t\tdbInfo.DbUser,\n\t\t\t\":\",\n\t\t\tdbInfo.DbPwd,\n\t\t\t\"@/\",\n\t\t\tdbInfo.DbName,\n\t\t\t\"?charset=\",\n\t\t\tdbInfo.DbChart,\n\t\t\t\"&parseTime=True&loc=Local\"))\n\t\tdefer db.Close()\n\t}\n\treturn db, err\n}", "func (cll *databaseCollector) GetDatabase() *bolt.DB {\n\treturn cll.Db\n}", "func Database(cnf config.DatabaseConfig) Configurator {\n\treturn func(instance *Storage) (err error) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\tswitch v := r.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\terr = v\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.New(\"unknown panic\")\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tinstance.exec = internal.New(cnf.DriverName())\n\t\tinstance.db, err = sql.Open(cnf.DriverName(), string(cnf.DSN))\n\t\tif err == nil {\n\t\t\tinstance.db.SetMaxOpenConns(cnf.MaxOpenConns)\n\t\t\tinstance.db.SetMaxIdleConns(cnf.MaxIdleConns)\n\t\t\tinstance.db.SetConnMaxLifetime(cnf.ConnMaxLifetime)\n\t\t}\n\t\treturn\n\t}\n}", "func Get(name string) *DB {\n\tdbMutex.Lock()\n\tdefer dbMutex.Unlock()\n\n\tdb := dataSources[name]\n\tif db == nil {\n\t\tdb = &DB{\n\t\t\ttypes: make(map[string]interface{}),\n\t\t\tdynamicers: make(map[string]Dynamicer),\n\t\t}\n\t\tdataSources[name] = db\n\t}\n\treturn db\n}", "func (repo *mongoBaseRepo) GetDb() interface{} {\n\treturn repo.collection.Database()\n}", "func (c *Configurations) GetDbURI() string {\n\tif c.Database.URL != \"\" {\n\t\treturn c.Database.URL\n\t}\n\treturn fmt.Sprintf(\"host=%s port=%d user=%s dbname=%s sslmode=disable\",\n\t\tc.Database.Host, c.Database.Port, c.Database.Username, c.Database.Name)\n}", "func DB(name ...string) *sqlx.DB {\n\tif len(name) == 0 {\n\t\tif defaultDB == nil {\n\t\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", defaultConn))\n\t\t}\n\n\t\treturn defaultDB\n\t}\n\n\tv, ok := dbmap.Load(name[0])\n\n\tif !ok {\n\t\tlogger.Panic(fmt.Sprintf(\"yiigo: unknown db.%s (forgotten configure?)\", name[0]))\n\t}\n\n\treturn v.(*sqlx.DB)\n}", "func GetDBConnection(dbFlag DbType) (*persistencemgr.ConnPool, *errors.Error) {\n\tswitch dbFlag {\n\tcase InMemory:\n\t\tpool, err := persistencemgr.GetDBConnection(persistencemgr.InMemory)\n\t\treturn pool, err\n\tcase OnDisk:\n\t\tpool, err := persistencemgr.GetDBConnection(persistencemgr.OnDisk)\n\t\treturn pool, err\n\tdefault:\n\t\treturn nil, errors.PackError(errors.UndefinedErrorType, \"error invalid db type selection\")\n\t}\n}" ]
[ "0.67008924", "0.66117525", "0.6582587", "0.6033728", "0.5969824", "0.5961549", "0.5924019", "0.5892341", "0.5854782", "0.58050245", "0.5772277", "0.5765756", "0.5734855", "0.5729053", "0.5716585", "0.5699538", "0.5699309", "0.5600536", "0.5580118", "0.55763507", "0.5571217", "0.55216056", "0.55100286", "0.5474802", "0.54581165", "0.5450664", "0.54147404", "0.54058576", "0.54045266", "0.5380426", "0.53717625", "0.5356657", "0.53537285", "0.5340045", "0.5334835", "0.53215194", "0.53162724", "0.53154427", "0.53129184", "0.5307514", "0.5296774", "0.5293541", "0.5274808", "0.5267743", "0.525692", "0.52469206", "0.52447236", "0.5237017", "0.522435", "0.5218398", "0.52170694", "0.5212051", "0.5205134", "0.519774", "0.51931876", "0.5192693", "0.51821977", "0.5177596", "0.51761085", "0.51696235", "0.5160013", "0.51594096", "0.51578695", "0.5150247", "0.51485854", "0.51481956", "0.51377773", "0.51361203", "0.51335007", "0.5124199", "0.5122963", "0.5121607", "0.51209056", "0.51156074", "0.51078767", "0.5097404", "0.5081045", "0.5078842", "0.50631905", "0.5063094", "0.50521874", "0.5051473", "0.5045796", "0.5045539", "0.5038238", "0.503738", "0.50362766", "0.5023944", "0.5019366", "0.50180167", "0.5015449", "0.5009484", "0.50071985", "0.50053287", "0.50022364", "0.49970022", "0.49957386", "0.49914697", "0.49833646", "0.49740356" ]
0.8210549
0
HandleRemoveDatabaseConfig is an endpoint handler which removes database config
func HandleRemoveDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { defer utils.CloseTheCloser(r.Body) // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] if err := syncman.RemoveDatabaseConfig(ctx, projectID, dbAlias); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) // return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Manager) RemoveDatabaseConfig(ctx context.Context, project, dbAlias string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update database config\n\tdelete(projectConfig.Modules.Crud, dbAlias)\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func deleteAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to delete config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n _, err = db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n if err := db.DeleteConfigByAppId(appId); err != nil {\n log.Error(fmt.Errorf(\"unable to delete config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully delete config\"})\n}", "func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tdbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func (e *EndpointPopulator) RemoveConfig(project string) error {\n\treturn nil\n}", "func (h *HTTPApi) removeDatabase(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tdbname := ps.ByName(\"dbname\")\n\n\t// TODO: there is a race condition here, as we are checking the meta -- unless we do lots of locking\n\t// we'll leave this in place for now, until we have some more specific errors that we can type\n\t// switch around to give meaningful error messages\n\tif err := h.storageNode.Datasources[ps.ByName(\"datasource\")].EnsureDoesntExistDatabase(r.Context(), dbname); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t}\n}", "func (c *DQLConfig) Remove(name string) error {\n\t// remove from DQLConfig\n\tdelete(c.Schemas, name)\n\n\t// remove from ServerlessConfig\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.RemoveFunction(name).Write()\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (x *Rest) ConfigurationRemove(w http.ResponseWriter, r *http.Request,\n\tparams httprouter.Params) {\n\tdefer panicCatcher(w)\n\n\trequest := msg.New(r, params)\n\trequest.Section = msg.SectionConfiguration\n\trequest.Action = msg.ActionRemove\n\trequest.Configuration.ID = strings.ToLower(params.ByName(`ID`))\n\n\tif _, err := uuid.FromString(request.Configuration.ID); err != nil {\n\t\tx.replyBadRequest(&w, &request, err)\n\t\treturn\n\t}\n\n\t// request body may contain request flag overrides, API protocol v1\n\t// has no request body support\n\tif request.Version != msg.ProtocolOne {\n\t\tcReq := v2.NewConfigurationRequest()\n\t\tif err := decodeJSONBody(r, &cReq); err != nil {\n\t\t\tx.replyBadRequest(&w, &request, err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := resolveFlags(&cReq, &request); err != nil {\n\t\t\tx.replyBadRequest(&w, &request, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tx.somaSetFeedbackURL(&request)\n\n\tif !x.isAuthorized(&request) {\n\t\tx.replyForbidden(&w, &request, nil)\n\t\treturn\n\t}\n\n\thandler := x.handlerMap.Get(`configuration_w`)\n\thandler.Intake() <- request\n\tresult := <-request.Reply\n\tx.respond(&w, &result)\n}", "func (c *Config) Delete(ctx context.Context, req *proto.DeleteRequest, rsp *proto.DeleteResponse) error {\n\tif req.Change == nil {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete err: invalid change\")\n\t}\n\n\tif len(req.Change.Id) == 0 {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete err: invalid id\")\n\t}\n\n\tif err := db.Delete(req.Change); err != nil {\n\t\treturn fmt.Errorf(\"[Delete] config srv delete commit err: %s\", err)\n\t}\n\n\treturn nil\n}", "func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) }", "func (api *API) DeleteConfig(request *restful.Request, response *restful.Response) {\n\n\tparams := request.PathParameters()\n\tk, err := setup(params)\n\tif err != nil {\n\t\tapi.writeError(http.StatusBadRequest, err.Error(), response)\n\t\treturn\n\t}\n\n\tglog.V(2).Infof(\"Deleting config from Istio registry: %+v\", k)\n\t// TODO: incorrect use with new registry\n\tif err = api.registry.Delete(k.Kind, k.Name); err != nil {\n\t\tswitch err.(type) {\n\t\tcase *model.ItemNotFoundError:\n\t\t\tapi.writeError(http.StatusNotFound, err.Error(), response)\n\t\tdefault:\n\t\t\tapi.writeError(http.StatusInternalServerError, err.Error(), response)\n\t\t}\n\t\treturn\n\t}\n\tresponse.WriteHeader(http.StatusOK)\n}", "func RemoveHostAndDatabase(ctx context.Context, pmfs ...DBOption) error {\n\tpm := getParam(pmfs...)\n\n\tconf, err := getConfig(ctx, pm.ConfFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar ho *host\n\tfor _, h := range conf.Hosts {\n\t\tif h.User == pm.User &&\n\t\t\th.Password == pm.Password &&\n\t\t\th.Address == pm.Address &&\n\t\t\th.Port == pm.Port &&\n\t\t\th.Protocol == pm.Protocol {\n\t\t\tho = h\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif ho == nil {\n\t\treturn ErrWrap(\n\t\t\tfmt.Errorf(\"none data parameter:%#v\", pm),\n\t\t\tUserInputError,\n\t\t)\n\t}\n\n\thostKey := ho.Key\n\n\tvar db *database\n\n\tdbs := make([]*database, 0, len(conf.Databases))\n\n\t// add Database Info\n\tfor _, d := range conf.Databases {\n\t\tif d.HostKey == hostKey && d.Name == pm.Database {\n\t\t\tdb = d\n\t\t\tcontinue\n\t\t}\n\t\tdbs = append(dbs, d)\n\t}\n\n\tif db == nil {\n\t\treturn ErrWrap(\n\t\t\tfmt.Errorf(\"none database data parameter:%#v\", pm),\n\t\t\tUserInputError,\n\t\t)\n\t}\n\tconf.Databases = dbs\n\n\treturn setConfig(ctx, conf, pm.ConfFilePath)\n}", "func RemoveUserConfig(db Database, userHash string) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"UserHash\"] = userHash\n\treturn db.DeleteRecord(pconst.DbConfig, pconst.TbAccess, criteria)\n}", "func TestClient_RemoveDatabase(t *testing.T) {\n\tteardown := setup()\n\tdefer teardown()\n\tmux.HandleFunc(\"/databases\", http.HandlerFunc(getDatabasesHandler))\n\tmux.HandleFunc(\"/databases/foo\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdbCheck := false\n\t\tfor _, db := range databases {\n\t\t\tif db.InstanceName == \"foo\" {\n\t\t\t\tdbCheck = true\n\t\t\t\tb, err := json.Marshal(&db)\n\t\t\t\tif err != nil {\n\t\t\t\t\thttp.Error(w, \"failed to marshal response\", http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw.Write(b)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif !dbCheck {\n\t\t\thttp.Error(w, \"database not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t})\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tremoveDbRequest := models.RemoveDatabaseRequest{}\n\t\terr := json.NewDecoder(r.Body).Decode(&removeDbRequest)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"failed to parse json\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tfor index, db := range databases {\n\t\t\tif db.InstanceName == removeDbRequest.InstanceName {\n\t\t\t\tdatabases = append(databases[:index], databases[index+1:]...)\n\t\t\t}\n\t\t}\n\t})\n\tremoveDataBaseReq := models.RemoveDatabaseRequest{\n\t\tAction: \"remove\",\n\t\tInstanceName: \"foo\",\n\t\tUsername: \"foo\",\n\t}\n\terr := client.RemoveDatabase(removeDataBaseReq)\n\tif err != nil {\n\t\tt.Errorf(\"failed to remove database: %s\", err.Error())\n\t\tt.FailNow()\n\t}\n\tdbs, err := client.GetDatabases()\n\tif err != nil {\n\t\tt.Errorf(\"failed to get databases: %s\", err.Error())\n\t\tt.FailNow()\n\t}\n\tif len(dbs) != 1 {\n\t\tt.Errorf(\"too many databases\")\n\t\tt.FailNow()\n\t}\n\t_, err = client.GetDatabase(\"foo\")\n\tif err == nil {\n\t\tt.Errorf(\"should have failed\")\n\t\tt.FailNow()\n\t}\n}", "func (h *Handler) serveDeleteDatabase(w http.ResponseWriter, r *http.Request) {\n\tname := r.URL.Query().Get(\":name\")\n\tif err := h.server.DeleteDatabase(name); err != ErrDatabaseNotFound {\n\t\th.error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t} else if err != nil {\n\t\th.error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (s *Server) HandleUninstall(w http.ResponseWriter, req *http.Request) {\n\ttenantID := bone.GetValue(req, \"tenantID\")\n\ts.Log.Debugf(\"starting uninstall: %s\", tenantID)\n\n\ttenants := s.NewTenants()\n\tif err := tenants.Del(tenantID); err != nil {\n\t\ts.Log.Debugf(\"error: %s\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts.Log.Debugf(\"uninstalled: %s\", tenantID)\n}", "func (c *ConfigDatabase) drop() error {\n\treturn dropDB(c.DBConfig)\n}", "func (h *DeleteServerHandlerImpl) Handle(params server.DeleteServerParams, principal interface{}) middleware.Responder {\n\tt := \"\"\n\tv := int64(0)\n\tif params.TransactionID != nil {\n\t\tt = *params.TransactionID\n\t}\n\tif params.Version != nil {\n\t\tv = *params.Version\n\t}\n\n\tif t != \"\" && *params.ForceReload {\n\t\tmsg := \"Both force_reload and transaction specified, specify only one\"\n\t\tc := misc.ErrHTTPBadRequest\n\t\te := &models.Error{\n\t\t\tMessage: &msg,\n\t\t\tCode: &c,\n\t\t}\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tconfiguration, err := h.Client.Configuration()\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tpType, pName, err := serverTypeParams(params.Backend, params.ParentType, params.ParentName)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\terr = configuration.DeleteServer(params.Name, pType, pName, t, v)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tif params.TransactionID == nil {\n\t\tif *params.ForceReload {\n\t\t\terr := h.ReloadAgent.ForceReload()\n\t\t\tif err != nil {\n\t\t\t\te := misc.HandleError(err)\n\t\t\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t\t\t}\n\t\t\treturn server.NewDeleteServerNoContent()\n\t\t}\n\t\trID := h.ReloadAgent.Reload()\n\t\treturn server.NewDeleteServerAccepted().WithReloadID(rID)\n\t}\n\treturn server.NewDeleteServerAccepted()\n}", "func HandleRemovePreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.RemovePreparedQueries(ctx, project, dbAlias, id); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func (c *DQLConfig) RemoveResource(resourceName string, deleteTable bool) error {\n\t// remove from DQLConfig\n\tdelete(c.Resources, resourceName)\n\n\t// delete table\n\tif deleteTable {\n\t\tsvc := c.connectDB()\n\t\tresult, err := svc.ListTables(&dynamodb.ListTablesInput{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, t := range result.TableNames {\n\t\t\tif strings.HasPrefix(*t, c.ProjectName+\"-\"+flect.New(resourceName).Pluralize().Camelize().String()) {\n\t\t\t\tc.deleteTable(svc, *t)\n\t\t\t}\n\t\t}\n\t}\n\n\t// remove from ServerlessConfig\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.removeResource(resourceName).Write()\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\n\tv := mux.Vars(r)\n\tidentifier := v[\"identifier\"]\n\n\tjsonpath := path.Join(a.ConfigDir, fmt.Sprintf(\"%s.json\", identifier))\n\tjsonpathexists := true\n\n\tconfigpath := path.Join(a.ConfigDir, fmt.Sprintf(\"%s.conf\", identifier))\n\tconfigpathexists := true\n\n\tif _, err = os.Stat(jsonpath); os.IsNotExist(err) {\n\t\tjsonpathexists = false\n\t}\n\tif err != nil && !os.IsNotExist(err) {\n\t\terr = errors.Wrapf(err, \"error checking file %s\", jsonpath)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif _, err = os.Stat(configpath); os.IsNotExist(err) {\n\t\tconfigpathexists = false\n\t}\n\tif err != nil && !os.IsNotExist(err) {\n\t\terr = errors.Wrapf(err, \"error checking file %s\", configpath)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif jsonpathexists {\n\t\tif err = os.Remove(jsonpath); err != nil {\n\t\t\terr = errors.Wrapf(err, \"error removing file %s\", jsonpath)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif configpathexists {\n\t\tif err = os.Remove(configpath); err != nil {\n\t\t\terr = errors.Wrapf(err, \"error removing file %s\", configpath)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif jsonpathexists || configpathexists {\n\t\tif err = a.SignalContainers(); err != nil {\n\t\t\terr = errors.Wrap(err, \"error HUPing container(s)\")\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "func AppDeleteHandler(context utils.Context, w http.ResponseWriter, r *http.Request) {\n\n\tdbConn := context.DBConn\n\tdbBucket := context.DBBucketApp\n\n\tvars := mux.Vars(r)\n\n\tenv := vars[\"environment\"]\n\tapp := vars[\"application\"]\n\n\tkey := []byte(env + \"_\" + app)\n\n\tif err := database.DeleteDBValue(dbConn, dbBucket, key); err != nil {\n\t\tlog.LogInfo.Printf(\"Failed to read db value: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"200 - OK: valued deleted or was not found\"))\n\n}", "func HandleDeleteCollectorConfigurationOutput(\n\tuser *graylog.User, lgc *logic.Logic, r *http.Request, ps Params,\n) (interface{}, int, error) {\n\tid := ps.PathParam(\"collectorConfigurationID\")\n\toutputID := ps.PathParam(\"collectorConfigurationOutputID\")\n\t// TODO authorize\n\tsc, err := lgc.DeleteCollectorConfigurationOutput(id, outputID)\n\tif err != nil {\n\t\treturn nil, sc, err\n\t}\n\tif err := lgc.Save(); err != nil {\n\t\treturn nil, 500, err\n\t}\n\treturn nil, sc, nil\n}", "func (s *HeadsUpServerController) removeFromAPIServerConfig() error {\n\tnewConfig, err := s.configAccess.GetStartingConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewConfig = newConfig.DeepCopy()\n\tif err := model.ValidateAPIServerName(s.apiServerName); err != nil {\n\t\treturn err\n\t}\n\n\tname := string(s.apiServerName)\n\tdelete(newConfig.Contexts, name)\n\tdelete(newConfig.AuthInfos, name)\n\tdelete(newConfig.Clusters, name)\n\n\treturn clientcmd.ModifyConfig(s.configAccess, *newConfig, true)\n}", "func RemoveBlockchainDB() error {\n\treturn os.Remove(conf.DB_FILE)\n}", "func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tcrud := modules.DB()\n\t\tif err := crud.DeleteTable(ctx, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (_obj *WebApiAuth) SysConfig_Delete(req *SysConfig, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = req.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_Delete\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func DeleteWorkloadconfig(cfg *WorkloadConfig,\n\terrorhandler ErrorHandler,\n\tdb *bolt.DB) bool {\n\n\tglog.V(5).Infof(apiLogString(fmt.Sprintf(\"WorkloadConfig DELETE: %v\", &cfg)))\n\n\t// Validate the input strings. The variables map is ignored.\n\tif cfg.WorkloadURL == \"\" {\n\t\treturn errorhandler(NewAPIUserInputError(\"not specified\", \"workload_url\"))\n\t} else if cfg.Version == \"\" {\n\t\treturn errorhandler(NewAPIUserInputError(\"not specified\", \"workload_version\"))\n\t} else if !policy.IsVersionString(cfg.Version) && !policy.IsVersionExpression(cfg.Version) {\n\t\treturn errorhandler(NewAPIUserInputError(fmt.Sprintf(\"workload_version %v is not a valid version string\", cfg.Version), \"workload_version\"))\n\t}\n\n\t// Convert the input version to a full version expression if it is not already a full expression.\n\tvExp, verr := policy.Version_Expression_Factory(cfg.Version)\n\tif verr != nil {\n\t\treturn errorhandler(NewAPIUserInputError(fmt.Sprintf(\"workload_version %v error converting to full version expression, error: %v\", cfg.Version, verr), \"workload_version\"))\n\t}\n\n\t// Find the target record\n\texistingCfg, err := persistence.FindWorkloadConfig(db, cfg.WorkloadURL, cfg.Org, vExp.Get_expression())\n\tif err != nil {\n\t\treturn errorhandler(NewSystemError(fmt.Sprintf(\"Unable to read workloadconfig object, error: %v\", err)))\n\t} else if existingCfg == nil {\n\t\treturn errorhandler(NewNotFoundError(\"WorkloadConfig not found\", \"workloadconfig\"))\n\t} else {\n\t\tglog.V(5).Infof(apiLogString(fmt.Sprintf(\"WorkloadConfig deleting: %v\", &cfg)))\n\t\tpersistence.DeleteWorkloadConfig(db, cfg.WorkloadURL, cfg.Org, vExp.Get_expression())\n\t\treturn false\n\t}\n\n}", "func DeleteConfig(host string, verifyTLS bool, apiKey string, project string, config string) Error {\n\tvar params []queryParam\n\tparams = append(params, queryParam{Key: \"project\", Value: project})\n\tparams = append(params, queryParam{Key: \"config\", Value: config})\n\n\turl, err := generateURL(host, \"/v3/configs/config\", params)\n\tif err != nil {\n\t\treturn Error{Err: err, Message: \"Unable to generate url\"}\n\t}\n\n\tstatusCode, _, response, err := DeleteRequest(url, verifyTLS, apiKeyHeader(apiKey), nil)\n\tif err != nil {\n\t\treturn Error{Err: err, Message: \"Unable to delete config\", Code: statusCode}\n\t}\n\n\tvar result map[string]interface{}\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\treturn Error{Err: err, Message: \"Unable to parse API response\", Code: statusCode}\n\t}\n\n\treturn Error{}\n}", "func (mux *ServeMux) HandleRemove(pattern string) {\n\tif pattern == \"\" {\n\t\tpanic(\"dns: invalid pattern \" + pattern)\n\t}\n\tmux.m.Lock()\n\tdelete(mux.z, CanonicalName(pattern))\n\tmux.m.Unlock()\n}", "func processConfigMapDelete(cc *configController, configMap *v1.ConfigMap) error {\n\tlogrus.Infof(\"Processing Delete configmap %s/%s\", configMap.ObjectMeta.Namespace, configMap.ObjectMeta.Name)\n\t// Drop all info from removed config map\n\tcc.vfs.vfs = map[string]*VF{}\n\tcc.configCh <- configMessage{op: operationDeleteAll, pciAddr: \"\", vf: VF{}}\n\n\treturn nil\n}", "func RemoveHvacConfig(db Database, mac string) error {\n\tcriteria := make(map[string]interface{})\n\tcriteria[\"Mac\"] = mac\n\treturn db.DeleteRecord(pconst.DbConfig, pconst.TbHvacs, criteria)\n}", "func (m *Module) CloseConfig() error {\n\t// Acquire a lock\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Close the pub sub client\n\tm.pubsubClient.Close()\n\n\t// erase map\n\tm.processingEvents.Range(func(key interface{}, value interface{}) bool {\n\t\tm.processingEvents.Delete(key)\n\t\treturn true\n\t})\n\n\tfor k := range m.schemas {\n\t\tdelete(m.schemas, k)\n\t}\n\tfor k := range m.config.Rules {\n\t\tdelete(m.config.Rules, k)\n\t}\n\tfor k := range m.config.InternalRules {\n\t\tdelete(m.config.InternalRules, k)\n\t}\n\tfor k := range m.config.SecurityRules {\n\t\tdelete(m.config.SecurityRules, k)\n\t}\n\tfor k := range m.config.Schemas {\n\t\tdelete(m.config.Schemas, k)\n\t}\n\tm.tickerIntent.Stop()\n\tm.tickerStaged.Stop()\n\treturn nil\n}", "func (p *EscalationConfig) Delete(req *Request) {\n\n\terr := p.pipeline.UpdateConfig(func(conf *config.AppConfig) error {\n\t\tvars := mux.Vars(req.r)\n\t\tid, ok := vars[\"id\"]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Must append escalation id %s\", req.r.URL)\n\t\t}\n\n\t\tlogrus.Info(\"Removing escalation: %s\", id)\n\t\tdelete(conf.Escalations, id)\n\t\treturn nil\n\n\t}, req.u)\n\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\thttp.Error(req.w, err.Error(), http.StatusBadRequest)\n\t}\n}", "func (w *wireguardServerConfig) Delete(name string) error {\n\treturn w.store.Del(path.Join(w.prefix, name))\n}", "func (e *EndpointMapManager) RemoveDatapathMapping(endpointID uint16) error {\n\treturn policymap.RemoveGlobalMapping(uint32(endpointID), option.Config.EnableEnvoyConfig)\n}", "func (cm *PollingProjectConfigManager) RemoveOnProjectConfigUpdate(id int) error {\n\tif err := cm.notificationCenter.RemoveHandler(id, notification.ProjectConfigUpdate); err != nil {\n\t\tcmLogger.Warning(\"Problem with removing notification handler\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d DB) DeactivateConfig(ctx context.Context, userID string) error {\n\tcfg, err := d.GetConfig(ctx, userID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn d.SetDeletedAtConfig(ctx, userID, pq.NullTime{Time: time.Now(), Valid: true}, cfg.Config)\n}", "func DropDatabase(c Config) error {\n\tdb, err := pop.Connect(c.Environment)\n\tif err != nil {\n\t\treturn err\n\t}\n\texists, err := exists(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn nil\n\t}\n\treturn db.Dialect.DropDB()\n}", "func RemoveConfigFile() {\n\tpath := GetUserConfigPath()\n\n\terr := os.Remove(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn\n\t\t}\n\t}\n\tExpect(err).ShouldNot(HaveOccurred())\n}", "func (mh *MetadataHandler) HandleDeleteMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvars := mux.Vars(r)\n\tvar (\n\t\tappID string\n\t\tok bool\n\t)\n\tif appID, ok = vars[\"appID\"]; !ok {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\terr := mh.Repository.Delete(appID)\n\tif err != nil {\n\t\tif err == repository.ErrIDNotFound {\n\t\t\tw.WriteHeader(http.StatusConflict) // 409\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\t}\n\t\tyaml.NewEncoder(w).Encode(err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent) // 204\n}", "func HandleRemoveContest(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\tsession := getMongoS()\n\t\tdefer session.Close()\n\t\tc := session.DB(\"oj\").C(\"contests\")\n\t\terr := c.Remove(bson.M{\"contestid\": r.Form[\"contestID\"][0]})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func OnFileRemoveDB(filehash string) bool {\n\treturn mydb.OnFileRemoved(filehash)\n}", "func DeprovisionHandler(c *gin.Context) {\n\tvar planInfo = model.PlanID{}\n\terr := json.Unmarshal([]byte(c.Query(\"plan_id\")), &planInfo)\n\tif err != nil {\n\t\tlog.Panic(fmt.Sprintf(\"Unable to unmarshal PlanID: %s\", err))\n\t}\n\tserviceName := planInfo.LibsServiceName\n\n\tinstanceID := c.Param(\"instanceID\")\n\tvolumeID, err := libstoragewrapper.GetVolumeID(NewLibsClient(), serviceName, instanceID)\n\tif err != nil {\n\t\tlog.Panic(fmt.Sprintf(\"error service instance with ID %s does not exist. %s\", instanceID, err))\n\t}\n\n\terr = libstoragewrapper.RemoveVolume(NewLibsClient(), serviceName, volumeID)\n\tif err != nil {\n\t\tlog.Panic(\"error removing volume using libstorage\", err)\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{})\n}", "func (h *adminHub) Remove(c AdminConn) error {\n\th.Lock()\n\tdefer h.Unlock()\n\tdelete(h.connections, c.UID())\n\treturn nil\n}", "func handlerAdminDeleteTrack(w http.ResponseWriter, r *http.Request) {\n\tsession, err := mgo.Dial(db.HostURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\t//Deletes all tracks in db\n\t_, err = session.DB(db.Databasename).C(db.TrackCollectionName).RemoveAll(bson.M{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "func (hh *HealthCheckHandler) Delete(w http.ResponseWriter, r *http.Request) {\n\tuuid := utils.ExtractUUID(r.URL.String())\n\thh.db.Delete(uuid)\n}", "func (config *Config) configureDB(viperRegistry *viper.Viper) error {\n\tdbConfig := &DatabaseSetting{}\n\tdb := viperRegistry.Sub(\"db\")\n\n\tif err := db.Unmarshal(dbConfig); err != nil {\n\t\treturn err\n\t}\n\n\tif !db.IsSet(\"user\") {\n\t\tif !viperRegistry.IsSet(\"DB_USER\") {\n\t\t\treturn errors.New(\"database user not set\")\n\t\t}\n\n\t\tdbConfig.User = viperRegistry.GetString(\"DB_USER\")\n\t}\n\n\tif !db.IsSet(\"password\") {\n\t\tif !viperRegistry.IsSet(\"DB_PASSWORD\") {\n\t\t\treturn errors.New(\"database password not set\")\n\t\t}\n\n\t\tdbConfig.Password = viperRegistry.GetString(\"DB_PASSWORD\")\n\t}\n\n\tif !db.IsSet(\"name\") {\n\t\tif !viperRegistry.IsSet(\"DB_NAME\") {\n\t\t\treturn errors.New(\"database name not set\")\n\t\t}\n\n\t\tdbConfig.Name = viperRegistry.GetString(\"DB_NAME\")\n\t}\n\n\tif !db.IsSet(\"address\") {\n\t\tif !viperRegistry.IsSet(\"DB_ADDRESS\") {\n\t\t\treturn errors.New(\"database address not set\")\n\t\t}\n\n\t\tdbConfig.Address = viperRegistry.GetString(\"DB_ADDRESS\")\n\t}\n\n\tconfig.Database = dbConfig\n\n\treturn nil\n}", "func Remove(configPath string, kind Kind) error {\n\tif kind == Daemon {\n\t\terr := isRoot()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err := run(\"unload\", configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.Remove(configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func HandleGetDatabaseConnectionState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tconnState := crud.GetConnectionState(ctx, dbAlias)\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: connState})\n\t}\n}", "func (rt *RestTester) ReplaceDbConfig(dbName string, config DbConfig) *TestResponse {\n\tdbcJSON, err := base.JSONMarshal(config)\n\trequire.NoError(rt.TB, err)\n\tresp := rt.SendAdminRequest(http.MethodPut, fmt.Sprintf(\"/%s/_config\", dbName), string(dbcJSON))\n\treturn resp\n}", "func (m *RestConfigModel) RemoveConfigByKey(key string) {\n\tm.initOptionalConfigs()\n\tdelete(m.optionalConfigs, key)\n}", "func (c *Client) PostDeleteConfig(cfg *intent.Config) error {\n\treturn c.doPost(master.DelConfigRESTEndpoint, cfg)\n}", "func removeProductHandle(response http.ResponseWriter, request *http.Request) {\n\torderId := strings.Split(request.URL.Path, \"/\")[3]\n\tlog.Printf(\"Remove product for order %s!\", orderId)\n\tdecoder := json.NewDecoder(request.Body)\n\tremoveProductCommand := commands.RemoveProduct{}\n\terr := decoder.Decode(&removeProductCommand)\n\tif err != nil {\n\t\twriteErrorResponse(response, err)\n\t}\n\torder := <-orderHandler.RemoveProductInOrder(OrderId{Id: orderId}, removeProductCommand)\n\twriteResponse(response, order)\n}", "func onDatabaseLogout(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tactiveDatabases, err := profile.DatabasesForCluster(tc.SiteName)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif profile.IsVirtual {\n\t\tlog.Info(\"Note: an identity file is in use (`-i ...`); will only update database config files.\")\n\t}\n\n\tvar logout []tlsca.RouteToDatabase\n\t// If database name wasn't given on the command line, log out of all.\n\tif cf.DatabaseService == \"\" {\n\t\tlogout = activeDatabases\n\t} else {\n\t\tfor _, db := range activeDatabases {\n\t\t\tif db.ServiceName == cf.DatabaseService {\n\t\t\t\tlogout = append(logout, db)\n\t\t\t}\n\t\t}\n\t\tif len(logout) == 0 {\n\t\t\treturn trace.BadParameter(\"Not logged into database %q\",\n\t\t\t\ttc.DatabaseService)\n\t\t}\n\t}\n\tfor _, db := range logout {\n\t\tif err := databaseLogout(tc, db, profile.IsVirtual); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\tif len(logout) == 1 {\n\t\tfmt.Println(\"Logged out of database\", logout[0].ServiceName)\n\t} else {\n\t\tfmt.Println(\"Logged out of all databases\")\n\t}\n\treturn nil\n}", "func DeleteConfig(changeId, id, path, userMech, userId, message string) error {\n\tconfigs, err := DefaultRepository.ReadConfig([]string{id})\n\tif err != nil || len(configs) != 1 {\n\t\treturn fmt.Errorf(\"Error getting config with id: %v\", id)\n\t}\n\n\tvar decoded map[string]interface{}\n\terr = json.Unmarshal(configs[0].Body, &decoded)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error decoding config: %v\", err)\n\t}\n\n\tif path != \"\" {\n\t\t// Walk until we find the node we want\n\t\t// return early if we can't find it\n\t\tparts := strings.Split(path, \"/\")\n\t\tnode := decoded\n\t\tok := true\n\t\tfor _, part := range parts[:len(parts)-1] {\n\t\t\tnode, ok = node[part].(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn ErrPathNotFound\n\t\t\t}\n\t\t}\n\t\tdelete(node, parts[len(parts)-1])\n\t} else {\n\t\t// No path, drop everything\n\t\tdecoded = make(map[string]interface{})\n\t}\n\n\tencoded, err := json.Marshal(decoded)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error encoding config: %v\", err)\n\t}\n\n\toldConfig, err := readConfigAtPath(configs[0].Body, path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config at path %s : %s \", path, err.Error())\n\t}\n\n\terr = DefaultRepository.UpdateConfig(&ChangeSet{\n\t\tId: id,\n\t\tBody: encoded,\n\t\tTimestamp: time.Now(),\n\t\tUserMech: userMech,\n\t\tUserId: userId,\n\t\tMessage: message,\n\t\tChangeId: changeId,\n\t\tPath: path,\n\t\tOldConfig: oldConfig,\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error saving config: %v\", err)\n\t}\n\n\treturn nil\n}", "func (d FileConfigurator) RemoveConfig(currentNode node.Node) error {\n\tidentityPath := filepath.Join(currentNode.NodeDirectory(), ConfigsDirectory)\n\tfmt.Printf(\"Removing directory %q\\n\", identityPath)\n\treturn os.RemoveAll(identityPath)\n}", "func (rs *routeServer) removeRoutesHandler(w http.ResponseWriter, req *http.Request) {\n\tlog.Printf(\"Deleting routes at %s\\n\", req.URL.Path)\n\n\tloc := mux.Vars(req)[\"location\"]\n\n\tmediatype, _, err := mime.ParseMediaType(req.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif mediatype != \"application/json\" {\n\t\thttp.Error(w, \"requires application/json Content-Type\", http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tdec := json.NewDecoder(req.Body)\n\tvar routes []string\n\tif err := dec.Decode(&routes); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif rs.store.RemoveRoutes(loc, routes) != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func DeleteUserSettingHandle(c *fiber.Ctx) error {\n\n\t// params from /userSettings/:userSettingId\n\tuserSettingId := c.Params(\"userSettingId\")\n\tif userSettingId == \"\" {\n\t\terrorMessage := fmt.Sprintf(\"UserSetting Id is required!\")\n\t\tlog.Error(errorMessage)\n\t\treturn c.Status(http.StatusBadRequest).JSON(utils.Error(\"userSettingIdRequired\", \"userSettingId is Required!\"))\n\t}\n\n\tuserSettingUUID, uuidErr := uuid.FromString(userSettingId)\n\tif uuidErr != nil {\n\t\terrorMessage := fmt.Sprintf(\"UUID Error %s\", uuidErr.Error())\n\t\tlog.Error(errorMessage)\n\t\treturn c.Status(http.StatusBadRequest).JSON(utils.Error(\"canNotParseUUID\", \"Can not parse UUID!\"))\n\t}\n\n\t// Create service\n\tuserSettingService, serviceErr := service.NewUserSettingService(database.Db)\n\tif serviceErr != nil {\n\t\terrorMessage := fmt.Sprintf(\"UserSetting Service Error %s\", serviceErr.Error())\n\t\tlog.Error(errorMessage)\n\t\treturn c.Status(http.StatusInternalServerError).JSON(utils.Error(\"internal/userSettingService\", \"Error happened while creating userSettingService!\"))\n\n\t}\n\n\tcurrentUser, ok := c.Locals(\"user\").(types.UserContext)\n\tif !ok {\n\t\tlog.Error(\"[DeleteUserSettingHandle] Can not get current user\")\n\t\treturn c.Status(http.StatusBadRequest).JSON(utils.Error(\"invalidCurrentUser\",\n\t\t\t\"Can not get current user\"))\n\t}\n\n\tif err := userSettingService.DeleteUserSettingByOwner(currentUser.UserID, userSettingUUID); err != nil {\n\t\terrorMessage := fmt.Sprintf(\"Delete UserSetting Error %s\", err.Error())\n\t\tlog.Error(errorMessage)\n\t\treturn c.Status(http.StatusInternalServerError).JSON(utils.Error(\"deleteUserSetting\", \"Error happened while removing UserSetting!\"))\n\n\t}\n\treturn c.SendStatus(http.StatusOK)\n\n}", "func (client *XenClient) PBDRemoveFromOtherConfig(self string, key string) (err error) {\n\t_, err = client.APICall(\"PBD.remove_from_other_config\", self, key)\n\tif err != nil {\n\t\treturn\n\t}\n\t// no return result\n\treturn\n}", "func (m *Manager) DelHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\thttp.Error(w, \"Not support method\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tr.ParseForm()\n\tfuncName := r.FormValue(\"funcName\")\n\n\terr := m.platformManager.DeleteFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\terr = m.scheduler.DeleteFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write([]byte(\"Delete Successful\"))\n\n\treturn\n}", "func (drv *Driver) DropDatabase() error {\n\tpath := ConnectionString(drv.databaseURL)\n\tfmt.Fprintf(drv.log, \"Dropping: %s\\n\", path)\n\n\texists, err := drv.DatabaseExists()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn nil\n\t}\n\n\treturn os.Remove(path)\n}", "func DisConfDel(c *gin.Context) {\n\tpath := disconfDir + \"\" + c.Query(\"path\")\n\terr := os.RemoveAll(path)\n\tif err != nil {\n\t\tlogrus.Error(\"error remove all files in the path.\")\n\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, struct {\n\t\tMessage string\n\t}{\"disconf del is ok.\"})\n}", "func RemoveConfig(name ...string) {\n\tgroup := DefaultGroupName\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Remove(group)\n\tinstances.Remove(group)\n\n\tintlog.Printf(`RemoveConfig: %s`, group)\n}", "func (cc *ConfigClient) RemoveHandler(key string) error {\n\tif cc.shutdownInvoked {\n\t\treturn errors.New(\"all connections have been closed via Close()\")\n\t}\n\n\tcc.removeCh <- key\n\treturn nil\n}", "func removeVolumeConfig(volumeID string) error {\n\tvolumeFile := path.Join(VolumeDir, volumeID+\".conf\")\n\tif utils.IsFileExisting(volumeFile) {\n\t\ttimeStr := time.Now().Format(\"2006-01-02-15:04:05\")\n\t\tremoveFile := path.Join(VolumeDirRemove, volumeID+\"-\"+timeStr+\".conf\")\n\t\tif err := os.Rename(volumeFile, removeFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (drv ClickHouseDriver) DropDatabase(u *url.URL) error {\n\tname := drv.databaseName(u)\n\tfmt.Printf(\"Dropping: %s\\n\", name)\n\n\tdb, err := drv.openClickHouseDB(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer mustClose(db)\n\n\t_, err = db.Exec(\"drop database if exists \" + clickhouseQuoteIdentifier(name))\n\n\treturn err\n}", "func UnsetConfig() cli.Command {\n\tr := routesCmd{}\n\treturn cli.Command{\n\t\tName: \"route\",\n\t\tUsage: \"Remove a configuration key for this route\",\n\t\tDescription: \"This command unsets configurations for a route.\",\n\t\tAliases: []string{\"routes\", \"r\"},\n\t\tCategory: \"MANAGEMENT COMMAND\",\n\t\tBefore: func(c *cli.Context) error {\n\t\t\tvar err error\n\t\t\tr.provider, err = client.CurrentProvider()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tr.client = r.provider.APIClient()\n\t\t\treturn nil\n\t\t},\n\t\tArgsUsage: \"<app-name> </path> <key>\",\n\t\tAction: r.unsetConfig,\n\t}\n}", "func (h *ConnectionPoolsHandler) Delete(ctx context.Context, project, serviceName, poolName string) error {\n\tpath := buildPath(\"project\", project, \"service\", serviceName, \"connection_pool\", poolName)\n\tbts, err := h.client.doDeleteRequest(ctx, path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn checkAPIResponse(bts, nil)\n}", "func removeHandler(s *search.SearchServer, w http.ResponseWriter, r *http.Request) {\n\tparams := r.URL.Query()\n\tcollection := params.Get(\"collection\")\n\n\tif collection == \"\" {\n\t\trespondWithError(w, r, \"Collection query parameter is required\")\n\t\treturn\n\t}\n\n\tif !s.Exists(collection) {\n\t\trespondWithError(w, r, \"Collection does not exist\")\n\t\treturn\n\t}\n\n\tdocid := params.Get(\"docid\")\n\tif docid == \"\" {\n\t\trespondWithError(w, r, \"docid query parameter is required\")\n\t\treturn\n\t}\n\n\ts.Remove(collection, docid)\n\trespondWithSuccess(w, r, \"Document removed\")\n}", "func handleDeleteSchedule(resp http.ResponseWriter, request *http.Request) {\n\tcors := handleCors(resp, request)\n\tif cors {\n\t\treturn\n\t}\n\n\tlocation := strings.Split(request.URL.String(), \"/\")\n\n\tvar workflowId string\n\tif location[1] == \"api\" {\n\t\tif len(location) <= 4 {\n\t\t\tresp.WriteHeader(401)\n\t\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\t\treturn\n\t\t}\n\n\t\tworkflowId = location[4]\n\t}\n\n\tif len(workflowId) != 32 {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false, \"message\": \"ID not valid\"}`))\n\t\treturn\n\t}\n\n\tctx := context.Background()\n\terr := DeleteKey(ctx, \"schedules\", workflowId)\n\tif err != nil {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false, \"message\": \"Can't delete\"}`))\n\t\treturn\n\t}\n\n\t// FIXME - remove schedule too\n\n\tresp.WriteHeader(200)\n\tresp.Write([]byte(`{\"success\": true, \"message\": \"Deleted webhook\"}`))\n}", "func (s *API) DeleteDatabase(req *DeleteDatabaseRequest, opts ...scw.RequestOption) error {\n\tvar err error\n\n\tif req.Region == \"\" {\n\t\tdefaultRegion, _ := s.client.GetDefaultRegion()\n\t\treq.Region = defaultRegion\n\t}\n\n\tif fmt.Sprint(req.Region) == \"\" {\n\t\treturn errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.InstanceID) == \"\" {\n\t\treturn errors.New(\"field InstanceID cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.Name) == \"\" {\n\t\treturn errors.New(\"field Name cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"DELETE\",\n\t\tPath: \"/rdb/v1/regions/\" + fmt.Sprint(req.Region) + \"/instances/\" + fmt.Sprint(req.InstanceID) + \"/databases/\" + fmt.Sprint(req.Name) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = s.client.Do(scwReq, nil, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (rww *ResourceWebhookRegister) RemoveResourceWebhookConfiguration() error {\n\tvar err error\n\t// check informer cache\n\tconfigName := rww.webhookRegistrationClient.GetResourceMutatingWebhookConfigName()\n\tconfig, err := rww.mWebhookConfigLister.Get(configName)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"failed to list mutating webhook config: %v\", err)\n\t\treturn err\n\t}\n\tif config == nil {\n\t\t// as no resource is found\n\t\treturn nil\n\t}\n\terr = rww.webhookRegistrationClient.RemoveResourceMutatingWebhookConfiguration()\n\tif err != nil {\n\t\treturn err\n\t}\n\tglog.V(3).Info(\"removed resource webhook configuration\")\n\treturn nil\n}", "func (c *configHandler) createNewConfig(w http.ResponseWriter, r *http.Request) {\n log.Printf(\"received /configs POST request from %v\", r.Host)\n requestbody, err := ioutil.ReadAll(r.Body)\n defer r.Body.Close()\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n w.Write([]byte(err.Error()))\n return\n }\n\n // check request's content-type\n content := r.Header.Get(\"content-type\")\n if content != \"application/json\" {\n w.WriteHeader(http.StatusUnsupportedMediaType)\n w.Write([]byte(err.Error()))\n return\n }\n\n var newconfig Config\n err = json.Unmarshal(requestbody, &newconfig)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n w.Write([]byte(err.Error()))\n return\n }\n\n c.Lock()\n c.database[newconfig.Name] = newconfig\n c.Unlock()\n log.Print(\"Created new config successfully and added to database \", c.database)\n\n w.WriteHeader(http.StatusOK)\n}", "func (a *IAMApiService) DeleteLDAPConfiguration(ctx context.Context) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = http.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/acs/api/v1/ldap/config\"\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, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn 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 == 0 {\n\t\t\tvar v IamError\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 localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func RemoveConfig(name ...string) {\n\tgroup := DEFAULT_GROUP_NAME\n\tif len(name) > 0 {\n\t\tgroup = name[0]\n\t}\n\tconfigs.Remove(group)\n\tinstances.Remove(group)\n}", "func (controller AppsController) RemoveVersion(c *gin.Context) {\n\t//app_id := c.Params.ByName(\"app_id\")\n\t//versionstring := c.Params.ByName(\"versionstring\")\n\n}", "func (m *hostConfiguredContainer) removeConfigurationContainer() error {\n\ts, err := m.configContainer.Status()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking if container exists: %w\", err)\n\t}\n\n\tif s.ID == \"\" {\n\t\treturn nil\n\t}\n\n\treturn m.configContainer.Delete()\n}", "func (ctx *Context) deleteConfigMaps(obj interface{}) {\n\tlog.Logger.Debug(\"configMap deleted\")\n}", "func (f5 *BigIP) handleDelete(msg comm.Message) comm.Message {\n\tswitch f5.UpdateMode {\n\tcase vsUpdateMode:\n\t\tm := f5.handleVSDelete(msg)\n\t\treturn m\n\tcase policyUpdateMode:\n\t\tm := f5.handleGlobalPolicyDelete(msg)\n\t\treturn m\n\tdefault:\n\t\tmsg.Error = fmt.Sprintf(\"unsupported updateMode %v\", f5.UpdateMode)\n\t\treturn msg\n\t}\n}", "func (o *PersistConfig) RemoveSchedulerCfg(tp string) {}", "func (m *bpfEndpointManager) onPolicyRemove(msg *proto.ActivePolicyRemove) {\n\tpolID := *msg.Id\n\tlog.WithField(\"id\", polID).Debug(\"Policy removed\")\n\tm.markPolicyUsersDirty(polID)\n\tdelete(m.policies, polID)\n\tdelete(m.policiesToWorkloads, polID)\n}", "func (r *rdsRoute) Remove(ns, topic, address string, version uint64) error {\n\tkey := r.getRoutePrefix(ns, topic)\n\trds := r.rdc.Get(util.W, key)\n\tdefer rds.Close()\n\tpreVersion, err := redis.Uint64(rds.Do(\"HGET\", key, address))\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tif preVersion < version {\n\t\t_, err = rds.Do(\"HDEL\", key, address)\n\t\treturn err\n\t}\n\treturn ErrUnexpectedDelete\n}", "func (a *HyperflexApiService) DeleteHyperflexUcsmConfigPolicy(ctx context.Context, moid string) ApiDeleteHyperflexUcsmConfigPolicyRequest {\n\treturn ApiDeleteHyperflexUcsmConfigPolicyRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func DeleteDB(dbFileName string) error {\n\tconfigDir := configdir.New(vendorName, projectName)\n\tfileDir = configDir.QueryCacheFolder()\n\tdbFile = filepath.FromSlash(fileDir.Path + \"/\" + dbFileName)\n\tlogging.Log(fmt.Sprintf(\"Deleting %v\", dbFile))\n\treturn os.Remove(dbFile)\n}", "func (plugin *Plugin) Del(args *cniSkel.CmdArgs) error {\n\t// Parse network configuration.\n\tnetConfig, err := config.New(args)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to parse netconfig from args: %v.\", err)\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Executing DEL with netconfig: %+v ContainerID:%v Netns:%v IfName:%v Args:%v.\",\n\t\tnetConfig, args.ContainerID, args.Netns, args.IfName, args.Args)\n\n\tvar vpcENI *eni.ENI\n\t// If existing network is to be used then ENI is not required.\n\tif !netConfig.UseExistingNetwork {\n\t\t// Find the ENI.\n\t\tvpcENI, err = eni.NewENI(args.IfName, netConfig.ENIMACAddress)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to find ENI %s: %v.\", netConfig.ENIName, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Call operating system specific handler.\n\tnb := plugin.nb\n\n\tnw := network.Network{\n\t\tName: netConfig.Name,\n\t\tENI: vpcENI,\n\t\tUseExisting: netConfig.UseExistingNetwork,\n\t}\n\n\tep := network.Endpoint{\n\t\tContainerID: args.ContainerID,\n\t\tNetNSName: args.Netns,\n\t\tIPAddresses: netConfig.ENIIPAddresses,\n\t\tMACAddress: netConfig.ENIMACAddress,\n\t}\n\n\terr = nb.DeleteEndpoint(&nw, &ep)\n\tif err != nil {\n\t\t// DEL is best-effort. Log and ignore the failure.\n\t\tlog.Errorf(\"Failed to delete endpoint, ignoring: %v.\", err)\n\t}\n\n\t// Do not delete pre-existing networks.\n\tif !nw.UseExisting {\n\t\terr = nb.DeleteNetwork(&nw)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to delete network: %v.\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (d *HephyCmd) ConfigUnset(appID string, configVars []string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Print(\"Removing config... \")\n\n\tquit := progress(d.WOut)\n\n\tconfigObj := api.Config{}\n\n\tvaluesMap := make(map[string]interface{})\n\n\tfor _, configVar := range configVars {\n\t\tvaluesMap[configVar] = nil\n\t}\n\n\tconfigObj.Values = valuesMap\n\n\t_, err = config.Set(s.Client, appID, configObj)\n\tquit <- true\n\t<-quit\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\td.Print(\"done\\n\\n\")\n\n\treturn d.ConfigList(appID, \"\")\n}", "func DisconnectHandler(w http.ResponseWriter, r *http.Request) {\n\tdb := Connect()\n\tdefer db.Close()\n\n\tcanAccess, account := ValidateAuth(db, r, w)\n\tif !canAccess {\n\t\treturn\n\t}\n\n\terr := UnlinkAnyConnection(db, account, 0)\n\tif err != nil {\n\t\tlog.Printf(\"UnlinkAnyConnection failed: %s\", err)\n\t\thttp.Error(w, \"could not unlink connection\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstateResponse := &StateResponse{}\n\tif err := json.NewEncoder(w).Encode(stateResponse); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (api *configurationsnapshotAPI) Delete(obj *cluster.ConfigurationSnapshot) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().ConfigurationSnapshot().Delete(context.Background(), &obj.ObjectMeta)\n\t\treturn err\n\t}\n\n\tapi.ct.handleConfigurationSnapshotEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\treturn nil\n}", "func (s *peerRESTServer) RemoveBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) {\n\tif !s.IsValid(w, r) {\n\t\ts.writeErrorResponse(w, errors.New(\"Invalid request\"))\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tbucketName := vars[peerRESTBucket]\n\tif bucketName == \"\" {\n\t\ts.writeErrorResponse(w, errors.New(\"Bucket name is missing\"))\n\t\treturn\n\t}\n\n\tglobalLifecycleSys.Remove(bucketName)\n\tw.(http.Flusher).Flush()\n}", "func addAppConfigHandler(ctx *gin.Context) {\n log.Info(\"received request to generate new app config\")\n var config struct{\n AppName string `json:\"app_name\" binding:\"required\"`\n Config map[string]interface{} `json:\"config\" binding:\"required\"`\n }\n // parse config from request body\n if err := ctx.ShouldBind(&config); err != nil {\n log.Error(fmt.Errorf(\"unable to parse config from request body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n appId, err := db.AddNewConfig(config.AppName, config.Config)\n if err != nil {\n log.Error(fmt.Errorf(\"unable to register new app config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"status_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n\n ctx.JSON(http.StatusCreated, gin.H{\n \"http_code\": http.StatusCreated, \"app_id\": appId})\n}", "func (databaseConfig *DatabaseConfig) Close() error {\n\tvar oldDb = databaseConfig.db\n\tdatabaseConfig.db = nil\n\n\treturn oldDb.Close()\n}", "func (r *AlertsConfigReconciler) HandleDelete(ctx context.Context, alertsConfig *alertmanagerv1alpha1.AlertsConfig) error {\n\tlog := log.Logger(ctx, \"controllers\", \"alertsconfig_controller\", \"HandleDelete\")\n\tlog = log.WithValues(\"alertsConfig_cr\", alertsConfig.Name, \"namespace\", alertsConfig.Namespace)\n\t// Lets check the status of the CR and\n\t// retrieve all the alerts associated with this CR and delete it\n\t//Check if any alerts were created with this config\n\tif len(alertsConfig.Status.AlertsStatus) > 0 {\n\t\t//Call wavefront api and delete the alerts one by one\n\t\tfor _, alert := range alertsConfig.Status.AlertsStatus {\n\t\t\tif err := r.DeleteIndividualAlert(ctx, alertsConfig.Name, alert, alertsConfig.Namespace); err != nil {\n\t\t\t\tlog.Error(err, \"skipping alert deletion\", \"alertID\", alert.ID)\n\t\t\t\t// Just skip it for now\n\t\t\t\t// this is too opinionated but we don't want to stop the delete execution for other alerts as well\n\t\t\t\t// if there is any valid reasons not to skip it, we can look into it in future\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ok. Lets delete the finalizer so controller can delete the custom object\n\tlog.Info(\"Removing finalizer from WavefrontAlert\")\n\talertsConfig.ObjectMeta.Finalizers = utils.RemoveString(alertsConfig.ObjectMeta.Finalizers, alertsConfigFinalizerName)\n\tr.CommonClient.UpdateMeta(ctx, alertsConfig)\n\tlog.Info(\"Successfully deleted wfAlert\")\n\tr.Recorder.Event(alertsConfig, v1.EventTypeNormal, \"Deleted\", \"Successfully deleted WavefrontAlert\")\n\treturn nil\n}", "func (a *MaintenanceWindowApiService) RemoveMaintenanceWindowConfigExecute(r ApiRemoveMaintenanceWindowConfigRequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MaintenanceWindowApiService.RemoveMaintenanceWindowConfig\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/maintenance/{uid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"uid\"+\"}\", _neturl.PathEscape(parameterToString(r.uid, \"\")), -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{}\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 nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn 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 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 localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func DeletePgAdminHandler(w http.ResponseWriter, r *http.Request) {\n\t// swagger:operation DELETE /pgadmin pgadminservice pgadmin-delete\n\t/*```\n\t Delete pgadmin from a cluster\n\t*/\n\t// ---\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: \"Delete PgAdmin Request\"\n\t// in: \"body\"\n\t// schema:\n\t// \"$ref\": \"#/definitions/DeletePgAdminRequest\"\n\t// responses:\n\t// '200':\n\t// description: Output\n\t// schema:\n\t// \"$ref\": \"#/definitions/DeletePgAdminResponse\"\n\tvar ns string\n\tlog.Debug(\"pgadminservice.DeletePgAdminHandler called\")\n\tusername, err := apiserver.Authn(apiserver.DELETE_PGADMIN_PERM, w, r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Restricted\"`)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tvar request msgs.DeletePgAdminRequest\n\t_ = json.NewDecoder(r.Body).Decode(&request)\n\n\tresp := msgs.DeletePgAdminResponse{}\n\n\tif request.ClientVersion != msgs.PGO_VERSION {\n\t\tresp.SetError(apiserver.VERSION_MISMATCH_ERROR)\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tns, err = apiserver.GetNamespace(apiserver.Clientset, username, request.Namespace)\n\tif err != nil {\n\t\tresp.SetError(err.Error())\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tresp = DeletePgAdmin(&request, ns)\n\tjson.NewEncoder(w).Encode(resp)\n\n}", "func onDatabaseConfig(cf *CLIConf) error {\n\ttc, err := makeClient(cf, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tprofile, err := tc.ProfileStatus()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tdatabase, err := pickActiveDatabase(cf)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\trequires := getDBLocalProxyRequirement(tc, database)\n\t// \"tsh db config\" prints out instructions for native clients to connect to\n\t// the remote proxy directly. Return errors here when direct connection\n\t// does NOT work (e.g. when ALPN local proxy is required).\n\tif requires.localProxy {\n\t\tmsg := formatDbCmdUnsupported(cf, database, requires.localProxyReasons...)\n\t\treturn trace.BadParameter(msg)\n\t}\n\n\thost, port := tc.DatabaseProxyHostPort(*database)\n\trootCluster, err := tc.RootClusterName(cf.Context)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tformat := strings.ToLower(cf.Format)\n\tswitch format {\n\tcase dbFormatCommand:\n\t\tcmd, err := dbcmd.NewCmdBuilder(tc, profile, database, rootCluster,\n\t\t\tdbcmd.WithPrintFormat(),\n\t\t\tdbcmd.WithLogger(log),\n\t\t).GetConnectCommand()\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(strings.Join(cmd.Env, \" \"), cmd.Path, strings.Join(cmd.Args[1:], \" \"))\n\tcase dbFormatJSON, dbFormatYAML:\n\t\tconfigInfo := &dbConfigInfo{\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName),\n\t\t\tprofile.KeyPath(),\n\t\t}\n\t\tout, err := serializeDatabaseConfig(configInfo, format)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Println(out)\n\tdefault:\n\t\tfmt.Printf(`Name: %v\nHost: %v\nPort: %v\nUser: %v\nDatabase: %v\nCA: %v\nCert: %v\nKey: %v\n`,\n\t\t\tdatabase.ServiceName, host, port, database.Username,\n\t\t\tdatabase.Database, profile.CACertPathForCluster(rootCluster),\n\t\t\tprofile.DatabaseCertPathForCluster(tc.SiteName, database.ServiceName), profile.KeyPath())\n\t}\n\treturn nil\n}", "func (l *LinuxConfig) UninstallConfig() error {\n\tfilename := installPath + l.DeviceName\n\n\t// See if a conf is installed\n\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\t// Remove the unused conf file\n\tif err := os.Remove(filename); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Config) CloseDB() error {\n\treturn c.db.Close()\n}", "func (ibmAnalyticsEngineApi *IbmAnalyticsEngineApiV2) DeleteLoggingConfig(deleteLoggingConfigOptions *DeleteLoggingConfigOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteLoggingConfigOptions, \"deleteLoggingConfigOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteLoggingConfigOptions, \"deleteLoggingConfigOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathSegments := []string{\"v2/analytics_engines\", \"log_config\"}\n\tpathParameters := []string{*deleteLoggingConfigOptions.InstanceGuid}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\t_, err = builder.ConstructHTTPURL(ibmAnalyticsEngineApi.Service.Options.URL, pathSegments, pathParameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteLoggingConfigOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"ibm_analytics_engine_api\", \"V2\", \"DeleteLoggingConfig\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = ibmAnalyticsEngineApi.Service.Request(request, nil)\n\n\treturn\n}" ]
[ "0.6576037", "0.6371723", "0.61062604", "0.6095322", "0.5963287", "0.5880917", "0.5838892", "0.58317995", "0.55250084", "0.54430795", "0.54256356", "0.5418952", "0.53683305", "0.5244312", "0.5226952", "0.5185141", "0.5163748", "0.51410645", "0.51362616", "0.5135068", "0.5116978", "0.5104949", "0.50486994", "0.50370467", "0.5025201", "0.5001923", "0.496516", "0.4964672", "0.49438643", "0.49420503", "0.49020126", "0.48926714", "0.48894644", "0.48886472", "0.4885734", "0.48788452", "0.48629877", "0.48596543", "0.4844285", "0.48238254", "0.48134223", "0.47749308", "0.47691622", "0.4756631", "0.4740151", "0.4732571", "0.47139296", "0.47025052", "0.46928", "0.46869928", "0.46808285", "0.46722287", "0.46614948", "0.46574983", "0.4656497", "0.46488193", "0.464414", "0.46436295", "0.46426558", "0.46400556", "0.46377125", "0.46356642", "0.4632653", "0.4628452", "0.4615964", "0.46138763", "0.46078277", "0.4594489", "0.45929468", "0.4582503", "0.4579692", "0.4570793", "0.45682243", "0.45500797", "0.45285553", "0.4523069", "0.45219633", "0.45193955", "0.4516844", "0.4514602", "0.4512999", "0.45111808", "0.4507109", "0.45067024", "0.45066172", "0.45045978", "0.45035392", "0.44965756", "0.44897008", "0.44894415", "0.4488761", "0.4488211", "0.44876435", "0.44836453", "0.44829965", "0.4478247", "0.44781953", "0.447726", "0.44761515", "0.44739106" ]
0.87260914
0
HandleGetPreparedQuery returns handler to get PreparedQuery
func HandleGetPreparedQuery(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusUnauthorized) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) defer cancel() // get project id and dbType from url vars := mux.Vars(r) projectID := vars["project"] dbAlias := "" dbAliasQuery, exists := r.URL.Query()["dbAlias"] if exists { dbAlias = dbAliasQuery[0] } idQuery, exists := r.URL.Query()["id"] id := "" if exists { id = idQuery[0] } result, err := syncMan.GetPreparedQuery(ctx, projectID, dbAlias, id) if err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusInternalServerError) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) _ = json.NewEncoder(w).Encode(model.Response{Result: result}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *HTTPServer) preparedQueryGet(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQuerySpecificRequest{\n\t\tQueryID: id,\n\t}\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.Get\", &args, &reply); err != nil {\n\t\t// We have to check the string since the RPC sheds\n\t\t// the specific error type.\n\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\treturn reply.Queries, nil\n}", "func (h ProxyHandler) HandleStmtPrepare(query string) (int, int, interface{}, error) {\n\tfmt.Println(\"prep: \", query)\n\treturn 0, 0, nil, fmt.Errorf(\"not supported now\")\n}", "func (s *HTTPServer) PreparedQuerySpecific(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tif req.Method == \"OPTIONS\" {\n\t\treturn s.preparedQuerySpecificOptions(resp, req), nil\n\t}\n\n\tpath := req.URL.Path\n\tid := strings.TrimPrefix(path, \"/v1/query/\")\n\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/execute\")\n\t\treturn s.preparedQueryExecute(id, resp, req)\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/explain\")\n\t\treturn s.preparedQueryExplain(id, resp, req)\n\n\tdefault:\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\treturn s.preparedQueryGet(id, resp, req)\n\n\t\tcase \"PUT\":\n\t\t\treturn s.preparedQueryUpdate(id, resp, req)\n\n\t\tcase \"DELETE\":\n\t\t\treturn s.preparedQueryDelete(id, resp, req)\n\n\t\tdefault:\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"PUT\", \"DELETE\"}}\n\t\t}\n\t}\n}", "func HandleSetPreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.PreparedQuery{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.SetPreparedQueries(ctx, project, dbAlias, id, &v); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func (t *QueryCommand) GetHandler() interfaces.Handler {\n\treturn func(s interfaces.Bot, m interfaces.Message, matches []string) {\n\t\tconn, err := s.GetGonduit()\n\t\tif err != nil {\n\t\t\ts.Excuse(m, err)\n\t\t\treturn\n\t\t}\n\n\t\tres, err := conn.ConduitQuery()\n\t\tif err != nil {\n\t\t\ts.Excuse(m, err)\n\t\t\treturn\n\t\t}\n\n\t\tmessage := \"Available Conduit methods:\\n\"\n\n\t\tfor methodName, method := range *res {\n\t\t\tmessage = message + fmt.Sprintf(\n\t\t\t\t\"• *%s*:\\n\\t_%s_\\n\",\n\t\t\t\tmethodName,\n\t\t\t\tmethod.Description,\n\t\t\t)\n\t\t}\n\n\t\ts.Post(m.GetChannel(), message, messages.IconTasks, true)\n\t}\n}", "func (c *Cursor) HandleStmtPrepare(query string) (params int, columns int, context interface{}, err error) {\n\t// TODO(xq26144), not implemented\n\t// According to the libmysql standard: https://github.com/mysql/mysql-server/blob/8.0/libmysql/libmysql.cc#L1599\n\t// the COM_STMT_PREPARE should return the correct bind parameter count (which can be implemented by newly created parser)\n\t// and should return the correct number of return fields (which can not be implemented right now with new query plan logic embedded)\n\n\terr = my.NewError(my.ER_NOT_SUPPORTED_YET, \"stmt prepare is not supported yet\")\n\treturn\n}", "func (s *HTTPServer) preparedQueryExecute(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryExecuteRequest{\n\t\tQueryIDOrName: id,\n\t\tAgent: structs.QuerySource{\n\t\t\tNode: s.agent.config.NodeName,\n\t\t\tDatacenter: s.agent.config.Datacenter,\n\t\t\tSegment: s.agent.config.SegmentName,\n\t\t},\n\t}\n\ts.parseSource(req, &args.Source)\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\tif err := parseLimit(req, &args.Limit); err != nil {\n\t\treturn nil, fmt.Errorf(\"Bad limit: %s\", err)\n\t}\n\n\tparams := req.URL.Query()\n\tif raw := params.Get(\"connect\"); raw != \"\" {\n\t\tval, err := strconv.ParseBool(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error parsing 'connect' value: %s\", err)\n\t\t}\n\n\t\targs.Connect = val\n\t}\n\n\tvar reply structs.PreparedQueryExecuteResponse\n\tdefer setMeta(resp, &reply.QueryMeta)\n\n\tif args.QueryOptions.UseCache {\n\t\traw, m, err := s.agent.cache.Get(cachetype.PreparedQueryName, &args)\n\t\tif err != nil {\n\t\t\t// Don't return error if StaleIfError is set and we are within it and had\n\t\t\t// a cached value.\n\t\t\tif raw != nil && m.Hit && args.QueryOptions.StaleIfError > m.Age {\n\t\t\t\t// Fall through to the happy path below\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tdefer setCacheMeta(resp, &m)\n\t\tr, ok := raw.(*structs.PreparedQueryExecuteResponse)\n\t\tif !ok {\n\t\t\t// This should never happen, but we want to protect against panics\n\t\t\treturn nil, fmt.Errorf(\"internal error: response type not correct\")\n\t\t}\n\t\treply = *r\n\t} else {\n\tRETRY_ONCE:\n\t\tif err := s.agent.RPC(\"PreparedQuery.Execute\", &args, &reply); err != nil {\n\t\t\t// We have to check the string since the RPC sheds\n\t\t\t// the specific error type.\n\t\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\t\targs.AllowStale = false\n\t\t\targs.MaxStaleDuration = 0\n\t\t\tgoto RETRY_ONCE\n\t\t}\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Note that we translate using the DC that the results came from, since\n\t// a query can fail over to a different DC than where the execute request\n\t// was sent to. That's why we use the reply's DC and not the one from\n\t// the args.\n\ts.agent.TranslateAddresses(reply.Datacenter, reply.Nodes)\n\n\t// Use empty list instead of nil.\n\tif reply.Nodes == nil {\n\t\treply.Nodes = make(structs.CheckServiceNodes, 0)\n\t}\n\treturn reply, nil\n}", "func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tswitch req.Method {\n\tcase \"POST\":\n\t\treturn s.preparedQueryCreate(resp, req)\n\n\tcase \"GET\":\n\t\treturn s.preparedQueryList(resp, req)\n\n\tdefault:\n\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"POST\"}}\n\t}\n}", "func (c *Cruder) getPreparedStatement(crudType string, request *CrudRequest) *sql.Stmt {\n\tkey := c.generateStatementKey(crudType, request)\n\tfoundStatement := c.preparedStatements[key]\n\n\tif foundStatement == nil {\n\t\tfoundStatement = c.generatePreparedStatement(crudType, request)\n\t\tc.preparedStatements[key] = foundStatement\n\t}\n\n\treturn foundStatement\n}", "func (w *Wrapper) prepare(query string) string {\n\tw.connLock.RLock()\n\tdefer w.connLock.RUnlock()\n\n\tswitch w.prepareType {\n\tcase dbUnknown:\n\t\tw.prepareType = examineDB(w.connection)\n\t\tif w.prepareType == dbUnknown {\n\t\t\tpanic(UnknownDatabase)\n\t\t}\n\t\treturn w.prepare(query)\n\tcase dbPostgres:\n\t\treturn query\n\tcase dbMysql:\n\t\treturn postgresRegex.ReplaceAllString(query, \"?\")\n\t}\n\tpanic(\"unreachable\")\n}", "func (h *ProxyHandler) HandleQuery(query string) (*go_mysql.Result, error) {\n\tfmt.Println(\"Exec Q: \", query)\n\treturn h.remoteConn.Execute(query)\n}", "func (h StmtHandle) Query(ctx context.Context, args ...interface{}) (*pgx.Rows, error) {\n\th.check()\n\tp := h.s.sr.mcp.Get()\n\tswitch h.s.sr.method {\n\tcase prepare:\n\t\treturn p.QueryEx(ctx, h.s.prepared.Name, nil /* options */, args...)\n\n\tcase noprepare:\n\t\treturn p.QueryEx(ctx, h.s.sql, nil /* options */, args...)\n\n\tcase simple:\n\t\treturn p.QueryEx(ctx, h.s.sql, simpleProtocolOpt, args...)\n\n\tdefault:\n\t\tpanic(\"invalid method\")\n\t}\n}", "func (e QueryPlugins) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error) {\n\t// do the query\n\tif request.Bank != nil {\n\t\treturn e.Bank(ctx, request.Bank)\n\t}\n\tif request.Custom != nil {\n\t\treturn e.Custom(ctx, request.Custom)\n\t}\n\tif request.IBC != nil {\n\t\treturn e.IBC(ctx, caller, request.IBC)\n\t}\n\tif request.Staking != nil {\n\t\treturn e.Staking(ctx, request.Staking)\n\t}\n\tif request.Stargate != nil {\n\t\treturn e.Stargate(ctx, request.Stargate)\n\t}\n\tif request.Wasm != nil {\n\t\treturn e.Wasm(ctx, request.Wasm)\n\t}\n\treturn nil, wasmvmtypes.Unknown{}\n}", "func HandleRemovePreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.RemovePreparedQueries(ctx, project, dbAlias, id); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func getParamsHandler(clientCtx client.Context) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tclientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tres, height, err := clientCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryParams), nil)\n\t\tif rest.CheckInternalServerError(w, err) {\n\t\t\treturn\n\t\t}\n\n\t\tclientCtx = clientCtx.WithHeight(height)\n\t\trest.PostProcessResponse(w, clientCtx, res)\n\t}\n}", "func (s *HTTPServer) preparedQueryCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryRequest{\n\t\tOp: structs.PreparedQueryCreate,\n\t}\n\ts.parseDC(req, &args.Datacenter)\n\ts.parseToken(req, &args.Token)\n\tif err := decodeBody(req, &args.Query, nil); err != nil {\n\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(resp, \"Request decode failed: %v\", err)\n\t\treturn nil, nil\n\t}\n\n\tvar reply string\n\tif err := s.agent.RPC(\"PreparedQuery.Apply\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn preparedQueryCreateResponse{reply}, nil\n}", "func GetQueryHandlers(s *Server) *datasource.QueryTypeMux {\n\tmux := datasource.NewQueryTypeMux()\n\n\t// This could be a map[models.QueryType]datasource.QueryHandlerFunc and then a loop to handle all of them.\n\tmux.HandleFunc(models.QueryDatabaseMeasurements, s.HandleDatabaseMeasurements)\n\tmux.HandleFunc(models.QueryProcessMeasurements, s.HandleProcessMeasurements)\n\tmux.HandleFunc(models.QueryDiskMeasurements, s.HandleDiskMeasurements)\n\n\treturn mux\n}", "func GetSqlHandler() SqlHandler {\n\treturn &sqlManager{}\n}", "func prepareQuery(data types.DataGet, queryArgs *[]interface{}, queryCountArgs *[]interface{},\n\tloginId int64, nestingLevel int) (string, string, error) {\n\n\t// check for authorized access, READ(1) for GET\n\tfor _, expr := range data.Expressions {\n\t\tif expr.AttributeId.Status == pgtype.Present && !authorizedAttribute(loginId, expr.AttributeId.Bytes, 1) {\n\t\t\treturn \"\", \"\", errors.New(handler.ErrUnauthorized)\n\t\t}\n\t}\n\n\tvar (\n\t\tinSelect []string // select expressions\n\t\tinJoin []string // relation joins\n\t\tmapIndex_relId = make(map[int]uuid.UUID) // map of all relations by index\n\t)\n\n\t// check source relation and module\n\trel, exists := cache.RelationIdMap[data.RelationId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t}\n\n\tmod, exists := cache.ModuleIdMap[rel.ModuleId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"module does not exist\")\n\t}\n\n\t// JOIN relations connected via relationship attributes\n\tmapIndex_relId[data.IndexSource] = data.RelationId\n\tfor _, join := range data.Joins {\n\t\tif join.IndexFrom == -1 { // source relation need not be joined\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := joinRelation(mapIndex_relId, join, &inJoin, nestingLevel); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\t// define relation code for source relation\n\t// source relation might have index != 0 (for GET from joined relation)\n\trelCode := getRelationCode(data.IndexSource, nestingLevel)\n\n\t// build WHERE lines\n\t// before SELECT expressions because these are excluded from count query\n\t// SQL arguments are numbered ($1, $2, ...) with no way to skip any (? placeholder is not allowed);\n\t// excluded sub queries arguments from SELECT expressions causes missing argument numbers\n\tqueryWhere := \"\"\n\tif err := buildWhere(data.Filters, queryArgs, queryCountArgs, loginId,\n\t\tnestingLevel, &queryWhere); err != nil {\n\n\t\treturn \"\", \"\", err\n\t}\n\n\t// process SELECT expressions\n\tmapIndex_agg := make(map[int]bool) // map of indexes with aggregation\n\tmapIndex_aggRecords := make(map[int]bool) // map of indexes with record aggregation\n\tfor pos, expr := range data.Expressions {\n\n\t\t// non-attribute expression\n\t\tif expr.AttributeId.Status != pgtype.Present {\n\n\t\t\t// in expressions of main query, disable SQL arguments for count query\n\t\t\t// count query has no sub queries with arguments and only 1 expression: COUNT(*)\n\t\t\tqueryCountArgsOptional := queryCountArgs\n\t\t\tif nestingLevel == 0 {\n\t\t\t\tqueryCountArgsOptional = nil\n\t\t\t}\n\n\t\t\tsubQuery, _, err := prepareQuery(expr.Query, queryArgs,\n\t\t\t\tqueryCountArgsOptional, loginId, nestingLevel+1)\n\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", \"\", err\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(\"(\\n%s\\n) AS %s\",\n\t\t\t\tsubQuery, getExpressionCodeSelect(pos)))\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// attribute expression\n\t\tif err := selectAttribute(pos, expr, mapIndex_relId, &inSelect,\n\t\t\tnestingLevel); err != nil {\n\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif expr.Aggregator.Status == pgtype.Present {\n\t\t\tmapIndex_agg[expr.Index] = true\n\t\t}\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\tmapIndex_aggRecords[expr.Index] = true\n\t\t}\n\t}\n\n\t// SELECT relation tupel IDs after attributes on main query\n\tif nestingLevel == 0 {\n\t\tfor index, relId := range mapIndex_relId {\n\n\t\t\t// if an aggregation function is used on any index, we cannot deliver record IDs\n\t\t\t// unless a record aggregation functions is used on this specific relation index\n\t\t\t_, recordAggExists := mapIndex_aggRecords[index]\n\t\t\tif len(mapIndex_agg) != 0 && !recordAggExists {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif _, exists := cache.RelationIdMap[relId]; !exists {\n\t\t\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(`\"%s\".\"id\" AS %s`,\n\t\t\t\tgetRelationCode(index, nestingLevel),\n\t\t\t\tgetTupelIdCode(index, nestingLevel)))\n\t\t}\n\t}\n\n\t// build GROUP BY line\n\tqueryGroup := \"\"\n\tgroupByItems := make([]string, 0)\n\tfor i, expr := range data.Expressions {\n\n\t\tif expr.AttributeId.Status != pgtype.Present || (!expr.GroupBy && expr.Aggregator.Status != pgtype.Present) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// group by record ID if record must be kept during aggregation\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\trelId := getTupelIdCode(expr.Index, nestingLevel)\n\n\t\t\tif !tools.StringInSlice(relId, groupByItems) {\n\t\t\t\tgroupByItems = append(groupByItems, relId)\n\t\t\t}\n\t\t}\n\n\t\t// group by requested attribute\n\t\tif expr.GroupBy {\n\t\t\tgroupByItems = append(groupByItems, getExpressionCodeSelect(i))\n\t\t}\n\t}\n\tif len(groupByItems) != 0 {\n\t\tqueryGroup = fmt.Sprintf(\"\\nGROUP BY %s\", strings.Join(groupByItems, \", \"))\n\t}\n\n\t// build ORDER BY, LIMIT, OFFSET lines\n\tqueryOrder, queryLimit, queryOffset := \"\", \"\", \"\"\n\tif err := buildOrderLimitOffset(data, nestingLevel, &queryOrder, &queryLimit, &queryOffset); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// build data query\n\tquery := fmt.Sprintf(\n\t\t`SELECT %s`+\"\\n\"+\n\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s%s%s%s%s`,\n\t\tstrings.Join(inSelect, `, `), // SELECT\n\t\tmod.Name, rel.Name, relCode, // FROM\n\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\tqueryWhere, // WHERE\n\t\tqueryGroup, // GROUP BY\n\t\tqueryOrder, // ORDER BY\n\t\tqueryLimit, // LIMIT\n\t\tqueryOffset) // OFFSET\n\n\t// build totals query (not relevant for sub queries)\n\tqueryCount := \"\"\n\tif nestingLevel == 0 {\n\n\t\t// distinct to keep count for source relation records correct independent of joins\n\t\tqueryCount = fmt.Sprintf(\n\t\t\t`SELECT COUNT(DISTINCT \"%s\".\"%s\")`+\"\\n\"+\n\t\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s`,\n\t\t\tgetRelationCode(data.IndexSource, nestingLevel), lookups.PkName, // SELECT\n\t\t\tmod.Name, rel.Name, relCode, // FROM\n\t\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\t\tqueryWhere) // WHERE\n\n\t}\n\n\t// add intendation for nested sub queries\n\tif nestingLevel != 0 {\n\t\tindent := strings.Repeat(\"\\t\", nestingLevel)\n\t\tquery = indent + regexp.MustCompile(`\\r?\\n`).ReplaceAllString(query, \"\\n\"+indent)\n\t}\n\treturn query, queryCount, nil\n}", "func (t *explainTablet) HandleQuery(c *mysql.Conn, query string, callback func(*sqltypes.Result) error) error {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\n\t// If query is part of rejected list then return error right away.\n\tif err := t.db.GetRejectedQueryResult(query); err != nil {\n\t\treturn err\n\t}\n\n\t// If query is expected to have a specific result then return the result.\n\tif result := t.db.GetQueryResult(query); result != nil {\n\t\tif f := result.BeforeFunc; f != nil {\n\t\t\tf()\n\t\t}\n\t\treturn callback(result.Result)\n\t}\n\n\t// return result if query is part of defined pattern.\n\tif userCallback, expResult, ok, err := t.db.GetQueryPatternResult(query); ok {\n\t\tif userCallback != nil {\n\t\t\tuserCallback(query)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn callback(expResult.Result)\n\t}\n\n\tif !strings.Contains(query, \"1 != 1\") {\n\t\tt.mysqlQueries = append(t.mysqlQueries, &MysqlQuery{\n\t\t\tTime: t.currentTime,\n\t\t\tSQL: query,\n\t\t})\n\t}\n\n\t// return the pre-computed results for any schema introspection queries\n\ttEnv := t.vte.getGlobalTabletEnv()\n\tresult := tEnv.getResult(query)\n\tif result != nil {\n\t\treturn callback(result)\n\t}\n\n\tswitch sqlparser.Preview(query) {\n\tcase sqlparser.StmtSelect:\n\t\tvar err error\n\t\tresult, err = t.handleSelect(query)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase sqlparser.StmtBegin, sqlparser.StmtCommit, sqlparser.StmtSet,\n\t\tsqlparser.StmtSavepoint, sqlparser.StmtSRollback, sqlparser.StmtRelease:\n\t\tresult = &sqltypes.Result{}\n\tcase sqlparser.StmtShow:\n\t\tresult = &sqltypes.Result{Fields: sqltypes.MakeTestFields(\"\", \"\")}\n\tcase sqlparser.StmtInsert, sqlparser.StmtReplace, sqlparser.StmtUpdate, sqlparser.StmtDelete:\n\t\tresult = &sqltypes.Result{\n\t\t\tRowsAffected: 1,\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported query %s\", query)\n\t}\n\n\treturn callback(result)\n}", "func (my *MySQL) Prepare(sql string) (stmt *Statement, err os.Error) {\n defer my.unlock()\n my.lock()\n\n if my.conn == nil {\n return nil, NOT_CONN_ERROR\n }\n if my.unreaded_rows {\n return nil, UNREADED_ROWS_ERROR\n }\n\n stmt, err = my.prepare(sql)\n if err != nil {\n return\n }\n // Connect statement with database handler\n my.stmt_map[stmt.id] = stmt\n // Save SQL for reconnect\n stmt.sql = sql\n\n return\n}", "func (h *Handler) QueryEventHandle(name string, eventHandler EventHandler) {\n\th.EventHandle(\"query\", name, eventHandler)\n}", "func (c *Conn) handleQuery(query string, args []driver.Value) (driver.Rows, error) {\n\tvar (\n\t\tb []byte\n\t\terr error\n\t)\n\n\t// reset the protocol packet sequence number\n\tc.resetSeqno()\n\n\tif b, err = c.createComQuery(replacePlaceholders(query, args)); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// send COM_QUERY to the server\n\tif err := c.writePacket(b); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.handleQueryResponse()\n}", "func (h ProxyHandler) HandleStmtExecute(context interface{}, query string, args []interface{}) (*go_mysql.Result, error) {\n\tfmt.Println(\"context: \", context, \" query: \", query, \" args:\", args)\n\treturn nil, fmt.Errorf(\"not supported now\")\n}", "func InstrumentQueryDataHandler(handler backend.QueryDataHandler) backend.QueryDataHandler {\n\tif handler == nil {\n\t\treturn nil\n\t}\n\n\treturn backend.QueryDataHandlerFunc(func(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {\n\t\tvar resp *backend.QueryDataResponse\n\t\terr := InstrumentQueryDataRequest(req.PluginContext.PluginID, func() (innerErr error) {\n\t\t\tresp, innerErr = handler.QueryData(ctx, req)\n\t\t\treturn\n\t\t})\n\t\treturn resp, err\n\t})\n}", "func handleQuery() func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tresult := graphql.Do(graphql.Params{\n\t\t\tSchema: createSchema(),\n\t\t\tRequestString: r.URL.Query().Get(\"query\"),\n\t\t})\n\t\terr := json.NewEncoder(w).Encode(result)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error Serializing result\")\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (s *HTTPServer) preparedQueryUpdate(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryRequest{\n\t\tOp: structs.PreparedQueryUpdate,\n\t}\n\ts.parseDC(req, &args.Datacenter)\n\ts.parseToken(req, &args.Token)\n\tif req.ContentLength > 0 {\n\t\tif err := decodeBody(req, &args.Query, nil); err != nil {\n\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\tfmt.Fprintf(resp, \"Request decode failed: %v\", err)\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tif args.Query == nil {\n\t\targs.Query = &structs.PreparedQuery{}\n\t}\n\n\t// Take the ID from the URL, not the embedded one.\n\targs.Query.ID = id\n\n\tvar reply string\n\tif err := s.agent.RPC(\"PreparedQuery.Apply\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "func (c *Cursor) HandleQuery(query string) (r *my.Result, err error) {\n\tvar processed bool\n\n\tlog.WithField(\"query\", query).Info(\"received query\")\n\n\tif r, processed, err = c.handleSpecialQuery(query); processed {\n\t\treturn\n\t}\n\n\tvar conn *sql.DB\n\n\tif conn, err = c.ensureDatabase(); err != nil {\n\t\treturn\n\t}\n\n\t// as normal query\n\tif readQuery.MatchString(query) {\n\t\tvar rows *sql.Rows\n\t\tif rows, err = conn.Query(query); err != nil {\n\t\t\terr = my.NewError(my.ER_UNKNOWN_ERROR, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// build result set\n\t\treturn c.buildResultSet(rows)\n\t}\n\n\tvar result sql.Result\n\tif result, err = conn.Exec(query); err != nil {\n\t\terr = my.NewError(my.ER_UNKNOWN_ERROR, err.Error())\n\t\treturn\n\t}\n\n\tlastInsertID, _ := result.LastInsertId()\n\taffectedRows, _ := result.RowsAffected()\n\n\tr = &my.Result{\n\t\tStatus: 0,\n\t\tInsertId: uint64(lastInsertID),\n\t\tAffectedRows: uint64(affectedRows),\n\t\tResultset: nil,\n\t}\n\n\treturn\n}", "func HandleQueryAlgConfigGet(c *gin.Context) {\n\tlog.HTTP.Info(\"HandleQueryAlgConfigGet BEGIN\")\n\tdeviceID, err := strconv.ParseInt(c.Param(\"did\"), 10, 64)\n\tif err != nil {\n\t\tlog.HTTP.Error(err)\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"err\": errcode.ErrParams.Code,\n\t\t\t\"errMsg\": errcode.ErrParams.String,\n\t\t})\n\t\treturn\n\t}\n\n\talgID, algConfig, err := dao.QueryAlgConfig(int(deviceID))\n\tif err != nil {\n\t\tlog.HTTP.Error(err)\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"err\": errcode.ErrQueryAlgConfig.Code,\n\t\t\t\"errMsg\": errcode.ErrQueryAlgConfig.String,\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"err\": \t errcode.ErrNoError.Code,\n\t\t\"errMsg\": \t errcode.ErrNoError.String,\n\t\t\"algID\": \t algID,\n\t\t\"algConfig\": algConfig,\n\t})\n\treturn\n}", "func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {\n\n\tmux.Handle(\"GET\", pattern_Query_GroupInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupInfo_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupMembers_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupMembers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupsByAdmin_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VoteByProposalVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_VoteByProposalVoter_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VoteByProposalVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByProposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_VotesByProposal_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByProposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_VotesByVoter_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_GroupsByMember_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_TallyResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_TallyResult_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Groups_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tdbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func GetHTTPHandler(r ResolverRoot, db *DB, migrations []*gormigrate.Migration, res http.ResponseWriter, req *http.Request) {\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tlog.Debug().Msgf(\"Path base: %s\", path.Base(req.URL.Path))\n\t}\n\texecutableSchema := NewExecutableSchema(Config{Resolvers: r})\n\tgqlHandler := handler.New(executableSchema)\n\tgqlHandler.AddTransport(transport.Websocket{\n\t\tKeepAlivePingInterval: 10 * time.Second,\n\t})\n\tgqlHandler.AddTransport(transport.Options{})\n\tgqlHandler.AddTransport(transport.GET{})\n\tgqlHandler.AddTransport(transport.POST{})\n\tgqlHandler.AddTransport(transport.MultipartForm{})\n\tgqlHandler.Use(extension.FixedComplexityLimit(300))\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tgqlHandler.Use(extension.Introspection{})\n\t}\n\tgqlHandler.Use(apollotracing.Tracer{})\n\tgqlHandler.Use(extension.AutomaticPersistedQuery{\n\t\tCache: lru.New(100),\n\t})\n\tloaders := GetLoaders(db)\n\tif os.Getenv(\"EXPOSE_MIGRATION_ENDPOINT\") == \"true\" {\n\t\tif path.Base(req.URL.Path) == \"migrate\" {\n\t\t\terr := db.Migrate(migrations)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t\tif path.Base(req.URL.Path) == \"automigrate\" {\n\t\t\terr := db.AutoMigrate()\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t}\n\tgqlBasePath := os.Getenv(\"API_GRAPHQL_BASE_RESOURCE\")\n\tif gqlBasePath == \"\" {\n\t\tgqlBasePath = \"graphql\"\n\t}\n\tif path.Base(req.URL.Path) == gqlBasePath {\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tgqlHandler.ServeHTTP(res, req)\n\t}\n\n\tif os.Getenv(\"EXPOSE_PLAYGROUND_ENDPOINT\") == \"true\" && path.Base(req.URL.Path) == \"playground\" {\n\t\tplaygroundHandler := playground.Handler(\"GraphQL playground\", gqlBasePath)\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tif req.Method == \"GET\" {\n\t\t\tplaygroundHandler(res, req)\n\t\t}\n\t}\n}", "func (h *Handler) HandleExecuteQueryOnPrivateData(txID, ns string, config *pb.StaticCollectionConfig, query string) (commonledger.ResultsIterator, bool, error) {\n\tswitch config.Type {\n\tcase pb.CollectionType_COL_TRANSIENT:\n\t\tlogger.Debugf(\"Collection [%s:%s] is a TransientData store. Rich queries are not supported for transient data\", ns, config.Name)\n\t\treturn nil, true, errors.New(\"rich queries not supported on transient data\")\n\tcase pb.CollectionType_COL_DCAS:\n\t\tfallthrough\n\tcase pb.CollectionType_COL_OFFLEDGER:\n\t\tlogger.Debugf(\"Collection [%s:%s] is an off-ledger store. Returning results for query [%s]\", ns, config.Name, query)\n\t\tvalues, err := h.executeQuery(txID, ns, config.Name, query)\n\t\treturn values, true, err\n\tdefault:\n\t\treturn nil, false, nil\n\t}\n}", "func (c Conn) QueryHandler(q Query, h string) (*QueryResponse, error) {\n\tcl := c.HTTPClient\n\tif cl == nil {\n\t\tcl = http.DefaultClient\n\t}\n\n\tu, err := c.URL.Parse(h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// copy the query into a url.Values because it's rude to modify someone elses map\n\tp := url.Values{}\n\tfor k, v := range q {\n\t\tp[k] = v\n\t}\n\n\tp.Set(\"wt\", \"json\")\n\tp.Set(\"json.nl\", \"arrarr\")\n\n\tu.RawQuery = p.Encode()\n\n\tresp, err := cl.Get(u.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer flush(resp.Body)\n\n\tif resp.StatusCode >= http.StatusBadRequest {\n\t\treturn nil, ErrHTTPStatus(resp.Status)\n\t}\n\n\tqr := new(QueryResponse)\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(qr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn qr, err\n}", "func (lq LoggingQueryable) Prepare(query string) (stmt *sql.Stmt, err error) {\n\tstmt, err = lq.Q.Prepare(query)\n\tlog.Printf(\"SQL: Prepare(%v) -> %v\\n\", query, err)\n\treturn stmt, err\n}", "func (eng *MongoEngine) HandleGETData(requestedId string) (interface{}, error) {\n\tsession, err := mgo.Dial(eng.ConnectionAddress)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to connect to database.\")\n\t}\n\tdefer session.Close()\n\tcollection := session.DB(eng.DatabaseName).C(eng.CollectionName)\n\n\tif len(requestedId) > 0 {\n\t\tsingleObject := make(map[string]interface{})\n\t\trequestedId, err := strconv.Atoi(requestedId)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to parse provided object ID.\")\n\t\t}\n\t\tobjId := bson.M{\"id\": requestedId}\n\t\tif err := collection.Find(objId).One(&singleObject); err != nil {\n\t\t\treturn nil, errors.New(\"Object with provided ID not found.\")\n\t\t}\n\t\treturn singleObject, nil\n\t} else {\n\t\tobjectList := make([]map[string]interface{}, eng.PerPage)\n\t\tif err := collection.Find(bson.M{}).Sort(\"-id\").Limit(eng.PerPage).All(&objectList); err != nil {\n\t\t\treturn nil, errors.New(\"Failed to fetch data from collection\")\n\t\t}\n\t\treturn objectList, nil\n\t}\n\treturn nil, nil\n}", "func GetHandler(c *gin.Context) {\n\t// The actual response goes here\n\tresp := QueryResponse{\n\t\tStatus: StatusOK,\n\t\tMessage: \"10-4 good buddy\",\n\t}\n\tc.JSON(http.StatusOK, resp)\n}", "func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))\n}", "func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))\n}", "func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))\n}", "func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))\n}", "func internalSQLGet(d *Daemon, r *http.Request) response.Response {\n\ts := d.State()\n\n\tdatabase := r.FormValue(\"database\")\n\n\tif !shared.StringInSlice(database, []string{\"local\", \"global\"}) {\n\t\treturn response.BadRequest(fmt.Errorf(\"Invalid database\"))\n\t}\n\n\tschemaFormValue := r.FormValue(\"schema\")\n\tschemaOnly, err := strconv.Atoi(schemaFormValue)\n\tif err != nil {\n\t\tschemaOnly = 0\n\t}\n\n\tvar db *sql.DB\n\tif database == \"global\" {\n\t\tdb = s.DB.Cluster.DB()\n\t} else {\n\t\tdb = s.DB.Node.DB()\n\t}\n\n\ttx, err := db.BeginTx(r.Context(), nil)\n\tif err != nil {\n\t\treturn response.SmartError(fmt.Errorf(\"Failed to start transaction: %w\", err))\n\t}\n\n\tdefer func() { _ = tx.Rollback() }()\n\n\tdump, err := query.Dump(r.Context(), tx, schemaOnly == 1)\n\tif err != nil {\n\t\treturn response.SmartError(fmt.Errorf(\"Failed dump database %s: %w\", database, err))\n\t}\n\n\treturn response.SyncResponse(true, internalSQLDump{Text: dump})\n}", "func (r *queryImpl) Handler(p schema.QueryHandlerFieldResolverParams) (interface{}, error) {\n\tctx := contextWithNamespace(p.Context, p.Args.Namespace)\n\tres, err := r.svc.HandlerClient.FetchHandler(ctx, p.Args.Name)\n\treturn handleFetchResult(res, err)\n}", "func (this *StmtManager) PrepareOnce(preparer sqlPreparer, querySQL string, parentId int64) (resultStmt *Stmt, wasCached bool, err error) {\n\tvar cacheKey = \"\"\n\tif parentId == 0 {\n\t\tcacheKey = \"0$\" + querySQL\n\t} else {\n\t\tcacheKey = strconv.FormatInt(parentId, 10) + \"$\" + querySQL\n\t}\n\n\t// check if exists\n\tthis.locker.RLock()\n\tstmt, ok := this.stmtMap[cacheKey]\n\tif ok {\n\t\tstmt.accessAt = timestamp\n\t\tthis.locker.RUnlock()\n\t\treturn stmt, true, nil\n\t}\n\tthis.locker.RUnlock()\n\n\tif ShowPreparedStatements {\n\t\tlogs.Println(\"[DB]prepare \" + querySQL)\n\t}\n\n\tsqlStmt, err := preparer.Prepare(querySQL)\n\tif err != nil {\n\t\tif IsPrepareError(err) {\n\t\t\t// purge once\n\t\t\tthis.purge()\n\n\t\t\t// retry\n\t\t\tsqlStmt, err = preparer.Prepare(querySQL)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t}\n\tstmt = NewStmt(sqlStmt)\n\n\tthis.locker.Lock()\n\tdefer this.locker.Unlock()\n\n\t// exists, check again\n\t_, exists := this.stmtMap[cacheKey]\n\tif exists {\n\t\treturn stmt, false, nil\n\t}\n\n\t// should we purge old statements?\n\tif len(this.stmtMap) >= this.maxCount {\n\t\tthis.purge()\n\n\t\t// still full\n\t\tif len(this.stmtMap) >= this.maxCount {\n\t\t\treturn stmt, false, nil\n\t\t}\n\t}\n\n\t// put stmt into cache map\n\tthis.stmtMap[cacheKey] = stmt\n\tif parentId > 0 {\n\t\tthis.subMap[parentId] = append(this.subMap[parentId], cacheKey)\n\t}\n\n\treturn stmt, true, nil\n}", "func (m *Middleware) GetHandler(metadata middleware.Metadata) (func(h fasthttp.RequestHandler) fasthttp.RequestHandler, error) {\n\tmeta, err := m.getNativeMetadata(metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlimiter := tollbooth.NewLimiter(meta.MaxRequestsPerSecond, nil)\n\n\treturn func(h fasthttp.RequestHandler) fasthttp.RequestHandler {\n\t\tlimitHandler := tollbooth.LimitFuncHandler(limiter, nethttpadaptor.NewNetHTTPHandlerFunc(m.logger, h))\n\t\twrappedHandler := fasthttpadaptor.NewFastHTTPHandlerFunc(limitHandler.ServeHTTP)\n\n\t\treturn func(ctx *fasthttp.RequestCtx) {\n\t\t\twrappedHandler(ctx)\n\t\t}\n\t}, nil\n}", "func (s *HTTPServer) preparedQueryList(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tvar args structs.DCSpecificRequest\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.List\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Use empty list instead of nil.\n\tif reply.Queries == nil {\n\t\treply.Queries = make(structs.PreparedQueries, 0)\n\t}\n\treturn reply.Queries, nil\n}", "func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_PendingRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_PendingRounds_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_PendingRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastFinalizedRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_LastFinalizedRound_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastFinalizedRound_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Round_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Round_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Round_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_AllRounds_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllClaims_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_AllClaims_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllClaims_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Claim_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Claim_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryDelegeateAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_QueryDelegeateAddress_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryDelegeateAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryValidatorAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_QueryValidatorAddress_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryValidatorAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (t *TikvHandlerTool) GetHandle(tb table.PhysicalTable, params map[string]string, values url.Values) (kv.Handle, error) {\n\tvar handle kv.Handle\n\tif intHandleStr, ok := params[Handle]; ok {\n\t\tif tb.Meta().IsCommonHandle {\n\t\t\treturn nil, errors.BadRequestf(\"For clustered index tables, please use query strings to specify the column values.\")\n\t\t}\n\t\tintHandle, err := strconv.ParseInt(intHandleStr, 0, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\thandle = kv.IntHandle(intHandle)\n\t} else {\n\t\ttblInfo := tb.Meta()\n\t\tpkIdx := tables.FindPrimaryIndex(tblInfo)\n\t\tif pkIdx == nil || !tblInfo.IsCommonHandle {\n\t\t\treturn nil, errors.BadRequestf(\"Clustered common handle not found.\")\n\t\t}\n\t\tcols := tblInfo.Cols()\n\t\tpkCols := make([]*model.ColumnInfo, 0, len(pkIdx.Columns))\n\t\tfor _, idxCol := range pkIdx.Columns {\n\t\t\tpkCols = append(pkCols, cols[idxCol.Offset])\n\t\t}\n\t\tsc := new(stmtctx.StatementContext)\n\t\tsc.TimeZone = time.UTC\n\t\tpkDts, err := t.formValue2DatumRow(sc, values, pkCols)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\ttablecodec.TruncateIndexValues(tblInfo, pkIdx, pkDts)\n\t\tvar handleBytes []byte\n\t\thandleBytes, err = codec.EncodeKey(sc, nil, pkDts...)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\thandle, err = kv.NewCommonHandle(handleBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t}\n\treturn handle, nil\n}", "func (r *QueryRequest) isPrepared() bool {\n\treturn r.PreparedStatement != nil\n}", "func (h StmtHandle) QueryRow(ctx context.Context, args ...interface{}) *pgx.Row {\n\th.check()\n\tp := h.s.sr.mcp.Get()\n\tswitch h.s.sr.method {\n\tcase prepare:\n\t\treturn p.QueryRowEx(ctx, h.s.prepared.Name, nil /* options */, args...)\n\n\tcase noprepare:\n\t\treturn p.QueryRowEx(ctx, h.s.sql, nil /* options */, args...)\n\n\tcase simple:\n\t\treturn p.QueryRowEx(ctx, h.s.sql, simpleProtocolOpt, args...)\n\n\tdefault:\n\t\tpanic(\"invalid method\")\n\t}\n}", "func Handler() func(ctx *routing.Context) error {\n\treturn func(ctx *routing.Context) error {\n\t\t// r.URL.Query().Get(\"query\")\n\t\tprint(ctx.Request.URI().QueryString())\n\t\tresult := executeQuery(string(ctx.Request.URI().QueryString()), schema)\n\t\tjson.NewEncoder(ctx.Response.BodyWriter()).Encode(result)\n\t\treturn nil\n\t}\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_GroupInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupMembers_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupMembers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VoteByProposalVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VoteByProposalVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VoteByProposalVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByProposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByProposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByProposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByMember_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_TallyResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Groups_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func getHandler() *service.Handler {\n\thandler, err := service.GetConnection(service.GetConfigFromProperties())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn handler\n}", "func (s *Server) sqlHandler(w http.ResponseWriter, req *http.Request) {\n if(s.block) {\n time.Sleep(1000000* time.Second)\n }\n\n\tquery, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't read body: %s\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tif s.leader != s.listen {\n\n\t\tcs, errLeader := transport.Encode(s.leader)\n\t\t\n\t\tif errLeader != nil {\n\t\t\thttp.Error(w, \"Only the primary can service queries, but this is a secondary\", http.StatusBadRequest)\t\n\t\t\tlog.Printf(\"Leader ain't present?: %s\", errLeader)\n\t\t\treturn\n\t\t}\n\n\t\t//_, errLeaderHealthCheck := s.client.SafeGet(cs, \"/healthcheck\") \n\n //if errLeaderHealthCheck != nil {\n // http.Error(w, \"Primary is down\", http.StatusBadRequest)\t\n // return\n //}\n\n\t\tbody, errLResp := s.client.SafePost(cs, \"/sql\", bytes.NewBufferString(string(query)))\n\t\tif errLResp != nil {\n s.block = true\n http.Error(w, \"Can't forward request to primary, gotta block now\", http.StatusBadRequest)\t\n return \n\t//\t log.Printf(\"Didn't get reply from leader: %s\", errLResp)\n\t\t}\n\n formatted := fmt.Sprintf(\"%s\", body)\n resp := []byte(formatted)\n\n\t\tw.Write(resp)\n\t\treturn\n\n\t} else {\n\n\t\tlog.Debugf(\"Primary Received query: %#v\", string(query))\n\t\tresp, err := s.execute(query)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t}\n\n\t\tw.Write(resp)\n\t\treturn\n\t}\n}", "func (db MySQL) PreparedQuery(query string) (*sql.Stmt, error) {\n\tstmt, err := db.SQL.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn stmt, nil\n}", "func QueryEventHandle(name string, eventHandler EventHandler) {\n\tDefaultHandler.QueryEventHandle(name, eventHandler)\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Bonds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Bonds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_BondsDetailed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_BondsDetailed_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_BondsDetailed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Bond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Bond_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Bond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Batch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Batch_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Batch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_LastBatch_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastBatch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CurrentPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_CurrentPrice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CurrentPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CurrentReserve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_CurrentReserve_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CurrentReserve_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AvailableReserve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AvailableReserve_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AvailableReserve_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CustomPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_CustomPrice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CustomPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_BuyPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_BuyPrice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_BuyPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_SellReturn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_SellReturn_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_SellReturn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_SwapReturn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_SwapReturn_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_SwapReturn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AlphaMaximums_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AlphaMaximums_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AlphaMaximums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (this *NamedParameterQuery) GetParsedQuery() (string) {\n\treturn this.revisedQuery\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_PendingRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_PendingRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_PendingRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastFinalizedRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_LastFinalizedRound_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastFinalizedRound_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Round_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Round_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Round_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllClaims_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllClaims_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllClaims_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Claim_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Claim_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryDelegeateAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryDelegeateAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryDelegeateAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryValidatorAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryValidatorAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryValidatorAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func GetResponder(proto string, state common.QueryState) (common.QueryResponder, error) {\n\tswitch proto {\n\tcase \"sqp\":\n\t\treturn sqp.NewQueryResponder(state)\n\t}\n\treturn nil, fmt.Errorf(\"%w: %s\", ErrProtoNotFound, proto)\n}", "func SQLHandler(pathUrls []PathURL, fallback http.Handler) (http.HandlerFunc, error) {\n\t// convert pathUrls into a map\n\tpathsToUrls := buildPathsMap(pathUrls)\n\n\t// re-use the MapHandler\n\t// * now return the newly padded pathsToUrls\n\t// * while returning it in a format that makes it look like you were calling MapHandler in the first place\n\treturn MapHandler(pathsToUrls, fallback), nil\n}", "func HandleRequest(query []byte, conn *DatabaseConnection) {\n\tlog.Printf(\"Handling raw query: %s\", query)\n\tlog.Printf(\"Parsing request...\")\n\trequest, err := grammar.ParseRequest(query)\n\tlog.Printf(\"Parsed request\")\n\tvar response grammar.Response\n\n\tif err != nil {\n\t\tlog.Printf(\"Error in request parsing! %s\", err.Error())\n\t\tresponse.Type = grammar.UNKNOWN_TYPE_RESPONSE\n\t\tresponse.Status = grammar.RESP_STATUS_ERR_INVALID_QUERY\n\t\tresponse.Data = err.Error()\n\t\tconn.Write(grammar.GetBufferFromResponse(response))\n\t}\n\n\tswitch request.Type {\n\tcase grammar.AUTH_REQUEST:\n\t\t// AUTH {username} {password}\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_AUTH_REQUEST, false, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in AUTH request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\t\tusername := request.RequestData[0]\n\t\tpassword := request.RequestData[1]\n\t\t// bucketname := tokens[2]\n\t\tlog.Printf(\"Client wants to authenticate.<username>:<password> %s:%s\", username, password)\n\n\t\tauthRequest := AuthRequest{Username: username, Password: password, Conn: conn}\n\t\tresponse = processAuthRequest(authRequest)\n\tcase grammar.SET_REQUEST:\n\t\t// SET {key} {value} [ttl] [nooverride]\n\t\trequest.Type = grammar.SET_RESPONSE\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_SET_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in SET request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tkey := request.RequestData[0]\n\t\tvalue := request.RequestData[1]\n\t\tlog.Printf(\"Setting %s:%s\", key, value)\n\t\tsetRequest := SetRequest{Key: key, Value: value, Conn: conn}\n\t\tresponse = processSetRequest(setRequest)\n\n\tcase grammar.GET_REQUEST:\n\t\t// GET {key}\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_GET_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in GET request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tkey := request.RequestData[0]\n\t\tlog.Printf(\"Client wants to get key '%s'\", key)\n\t\tgetRequest := GetRequest{Key: key, Conn: conn}\n\t\tresponse = processGetRequest(getRequest)\n\n\tcase grammar.DELETE_REQUEST:\n\t\t// DELETE {key}\n\t\tlog.Println(\"Client wants to delete a bucket/key\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_DELETE_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in DELETE request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\t\t// TODO implement\n\tcase grammar.CREATE_BUCKET_REQUEST:\n\t\tlog.Println(\"Client wants to create a bucket\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_CREATE_BUCKET_REQUEST, true, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in CREATE bucket request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tbucketName := request.RequestData[0]\n\t\tcreateBucketRequest := CreateBucketRequest{BucketName: bucketName, Conn: conn}\n\n\t\tresponse = processCreateBucketRequest(createBucketRequest)\n\tcase grammar.CREATE_USER_REQUEST:\n\t\tlog.Printf(\"Client wants to create a user\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_CREATE_USER_REQUEST, false, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in CREATE user request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tusername := request.RequestData[0]\n\t\tpassword := request.RequestData[1]\n\t\tcreateUserRequest := CreateUserRequest{Username: username, Password: password, Conn: conn}\n\n\t\tresponse = processCreateUserRequest(createUserRequest)\n\tcase grammar.USE_REQUEST:\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_USE_REQUEST, true, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in USE request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tbucketname := request.RequestData[0]\n\t\tif bucketname == SALTS_BUCKET || bucketname == USERS_BUCKET {\n\t\t\tresponse.Status = grammar.RESP_STATUS_ERR_UNAUTHORIZED\n\t\t\tbreak\n\t\t}\n\n\t\tuseRequest := UseRequest{BucketName: bucketname, Conn: conn}\n\t\tresponse = processUseRequest(useRequest)\n\tdefault:\n\t\tlog.Printf(illegalRequestTemplate, request.Type)\n\t\tresponse.Type = grammar.UNKNOWN_TYPE_RESPONSE\n\t\tresponse.Status = grammar.RESP_STATUS_ERR_UNKNOWN_COMMAND\n\t}\n\tif response.Status != 0 {\n\t\tlog.Printf(\"Error in request. status: %d\", response.Status)\n\t}\n\tconn.Write(grammar.GetBufferFromResponse(response))\n\tlog.Printf(\"Wrote buffer: %s to client\", grammar.GetBufferFromResponse(response))\n\n}", "func HandleQueryData(ctx context.Context, d Datasource, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {\n\tresponses := backend.Responses{}\n\tfor _, v := range req.Queries {\n\t\tresponses[v.RefID] = dfutil.FrameResponseWithError(processQuery(ctx, d, v))\n\t}\n\n\treturn &backend.QueryDataResponse{\n\t\tResponses: responses,\n\t}, nil\n}", "func queryPostsParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryParams)\n\t\tres, height, err := cliCtx.QueryWithData(route, nil)\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, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tcliCtx = cliCtx.WithHeight(height)\n\t\trest.PostProcessResponse(w, cliCtx, res)\n\t}\n}", "func queryPostHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tpostID := vars[\"postID\"]\n\n\t\troute := fmt.Sprintf(\"custom/%s/%s/%s\", types.QuerierRoute, types.QueryPost, postID)\n\t\tres, height, err := cliCtx.QueryWithData(route, nil)\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, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tcliCtx = cliCtx.WithHeight(height)\n\t\trest.PostProcessResponse(w, cliCtx, res)\n\t}\n}", "func (client *SQLResourcesClient) getSQLDatabaseHandleResponse(resp *http.Response) (SQLResourcesClientGetSQLDatabaseResponse, error) {\n\tresult := SQLResourcesClientGetSQLDatabaseResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseGetResults); err != nil {\n\t\treturn SQLResourcesClientGetSQLDatabaseResponse{}, err\n\t}\n\treturn result, nil\n}", "func (s *HTTPServer) preparedQuerySpecificOptions(resp http.ResponseWriter, req *http.Request) interface{} {\n\tpath := req.URL.Path\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tdefault:\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\", \"PUT\", \"DELETE\"}, \",\"))\n\t\treturn resp\n\t}\n}", "func (c *Connection) RawQuery(stmt string, args ...interface{}) *Query {\n\treturn Q(c).RawQuery(stmt, args...)\n}", "func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Bonds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Bonds_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_BondsDetailed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_BondsDetailed_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_BondsDetailed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Bond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Bond_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Bond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Batch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_Batch_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Batch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_LastBatch_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastBatch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CurrentPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_CurrentPrice_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CurrentPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CurrentReserve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_CurrentReserve_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CurrentReserve_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AvailableReserve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_AvailableReserve_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AvailableReserve_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_CustomPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_CustomPrice_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_CustomPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_BuyPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_BuyPrice_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_BuyPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_SellReturn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_SellReturn_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_SellReturn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_SwapReturn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_SwapReturn_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_SwapReturn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AlphaMaximums_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Query_AlphaMaximums_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AlphaMaximums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (h *Handler) QueryEventHandleFunc(name string, eventHandler func(Event)) {\n\th.EventHandleFunc(\"query\", name, eventHandler)\n}", "func (eh *EventHandler) GetHandler(c *gin.Context) {\n\tvar err error\n\tdestinationIDs, ok := c.GetQuery(\"destination_ids\")\n\tif !ok {\n\t\tc.JSON(http.StatusBadRequest, middleware.ErrResponse(\"destination_ids is required parameter\", nil))\n\t\treturn\n\t}\n\n\tif destinationIDs == \"\" {\n\t\tc.JSON(http.StatusOK, CachedEventsResponse{Events: []CachedEvent{}})\n\t\treturn\n\t}\n\n\tstart := time.Time{}\n\tstartStr := c.Query(\"start\")\n\tif startStr != \"\" {\n\t\tstart, err = time.Parse(time.RFC3339Nano, startStr)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Error parsing start query param [%s] in events cache handler: %v\", startStr, err)\n\t\t\tc.JSON(http.StatusBadRequest, middleware.ErrResponse(\"Error parsing start query parameter. Accepted datetime format: \"+timestamp.Layout, err))\n\t\t\treturn\n\t\t}\n\t}\n\n\tend := time.Now().UTC()\n\tendStr := c.Query(\"end\")\n\tif endStr != \"\" {\n\t\tend, err = time.Parse(time.RFC3339Nano, endStr)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Error parsing end query param [%s] in events cache handler: %v\", endStr, err)\n\t\t\tc.JSON(http.StatusBadRequest, middleware.ErrResponse(\"Error parsing end query parameter. Accepted datetime format: \"+timestamp.Layout, err))\n\t\t\treturn\n\t\t}\n\t}\n\n\tlimitStr := c.Query(\"limit\")\n\tvar limit int\n\tif limitStr == \"\" {\n\t\tlimit = defaultLimit\n\t} else {\n\t\tlimit, err = strconv.Atoi(limitStr)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Error parsing limit [%s] to int in events cache handler: %v\", limitStr, err)\n\t\t\tc.JSON(http.StatusBadRequest, middleware.ErrResponse(\"limit must be int\", nil))\n\t\t\treturn\n\t\t}\n\t}\n\n\tresponse := CachedEventsResponse{Events: []CachedEvent{}}\n\tfor _, destinationID := range strings.Split(destinationIDs, \",\") {\n\t\teventsArray := eh.eventsCache.GetN(destinationID, start, end, limit)\n\t\tfor _, event := range eventsArray {\n\t\t\tresponse.Events = append(response.Events, CachedEvent{\n\t\t\t\tOriginal: []byte(event.Original),\n\t\t\t\tSuccess: []byte(event.Success),\n\t\t\t\tError: event.Error,\n\t\t\t})\n\t\t}\n\t\tresponse.ResponseEvents += len(eventsArray)\n\t\tresponse.TotalEvents += eh.eventsCache.GetTotal(destinationID)\n\t}\n\n\tc.JSON(http.StatusOK, response)\n}", "func (stmt *statement) Query(ctx context.Context, db Executor, handler func(rows *sql.Rows)) error {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\t// Fetch rows\n\trows, err := db.QueryContext(ctx, stmt.String(), stmt.args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Iterate through rows of returned dataset\n\tfor rows.Next() {\n\t\tif len(stmt.dest) > 0 {\n\t\t\terr = rows.Scan(stmt.dest...)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Call a callback function\n\t\thandler(rows)\n\t}\n\t// Check for errors during rows \"Close\".\n\t// This may be more important if multiple statements are executed\n\t// in a single batch and rows were written as well as read.\n\tif closeErr := rows.Close(); closeErr != nil {\n\t\treturn closeErr\n\t}\n\n\t// Check for row scan errors.\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check for errors during row iteration.\n\treturn rows.Err()\n}", "func (b *bot) prepare(query string) (*sql.Stmt, error) {\n\treturn b.DB.client.Prepare(query)\n}", "func (client GroupClient) GetProcedureResponder(resp *http.Response) (result USQLProcedure, 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}", "func QueryHandler(w http.ResponseWriter, r *http.Request) {\n\tdb := Connect()\n\tdefer db.Close()\n\n\tcanAccess, account := ValidateAuth(db, r, w)\n\tif !canAccess {\n\t\treturn\n\t}\n\n\tconnection, err := GetConnection(db, account.Id)\n\tif err != nil {\n\t\tif isBadConn(err, false) {\n\t\t\tpanic(err);\n\t\t\treturn;\n\t\t}\n\t\tstateResponse := &StateResponse{\n\t\t\tPeerId: 0,\n\t\t\tStatus: \"\",\n\t\t\tShouldFetch: false,\n\t\t\tShouldPeerFetch: false,\n\t\t}\n\t\tif err := json.NewEncoder(w).Encode(stateResponse); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn;\n\t}\n\n\tpeerId := connection.GetPeerId(account.Id)\n\tstatus := \"\"\n\tif connection.Status == PENDING {\n\t\tif connection.InviteeId == account.Id {\n\t\t\tstatus = \"pendingWithMe\"\n\t\t} else {\n\t\t\tstatus = \"pendingWithPeer\"\n\t\t}\n\t} else {\n\t\tstatus = \"connected\"\n\t}\n\n\tstateResponse := &StateResponse{\n\t\tPeerId: peerId,\n\t\tStatus: status,\n\t}\n\terr = CompleteFetchResponse(stateResponse, db, connection, account)\n\tif err != nil {\n\t\tlog.Printf(\"QueryPayload failed: %s\", err)\n\t\thttp.Error(w, \"could not query payload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err := json.NewEncoder(w).Encode(stateResponse); err != nil {\n\t\tpanic(err)\n\t}\n}", "func HandleClientQueryTime(pkt *packet.ClientQueryTime, state *system.State) ([]interfaces.ServerPacket, error) {\n\treturn []interfaces.ServerPacket{new(packet.ServerQueryTimeResponse)}, nil\n}", "func HandleQuery() graphql.Fields {\n\tqueryFields := make(graphql.Fields)\n\n\tHandleAnimeQuery(&queryFields)\n\t// anime.HandleQuery(&queryFields)\n\t// question.HandleQuery(&queryFields)\n\n\treturn queryFields\n}", "func getDBHandle() (*sql.DB, error) {\n\t\n\tconnectionString := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\tglobal_cfg.Database.Host,\n\t\tglobal_cfg.Database.Port,\n\t\tglobal_cfg.Database.User,\n\t\tglobal_cfg.Database.Password,\n\t\tglobal_cfg.Database.DBName)\n\n\tcontext, err := sql.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\terr = context.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn context, err\n}", "func (pbft *PBFT) HandlePrepareRPC(args CommandArgs, reply *RPCReply) error {\n\tlog.Print(\"Getting to handle prepare\\n\")\n\n\tif pbft.isChangingView() {\n\t\treturn nil\n\t}\n\n\tpbft.commandRecieved <- true\n\tprepareArgs, ok := args.SpecificArguments.(PrepareCommandArg)\n\tif !ok {\n\t\tlog.Fatal(\"[handlePrePrepareRPC] preprepare command args failed\")\n\t}\n\n\t// verify the signatures\n\tsignatureArg := verifySignatureArg{\n\t\tgeneric: prepareArgs,\n\t}\n\tif !pbft.verifySignatures(&signatureArg, args.R_firstSig, args.S_secondSig, prepareArgs.SenderIndex) {\n\t\tlog.Print(\"[HandlePrepareRPC] signatures of the prepare command args don't match\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLock.Lock()\n\tdefer pbft.serverLock.Unlock()\n\n\tlogEntryItem, ok1 := pbft.serverLog[prepareArgs.SequenceNumber]\n\n\t// A replica (including the primary) accepts prepare messages and adds them to its log\n\t// provided their signatures are correct, their view number equals the replica’s current view,\n\t// and their sequence number is between h and H.\n\n\t// do nothing if we did not receive a preprepare\n\tif !ok1 {\n\t\tlog.Print(\"[HandlePrepareRPC] did not recieve a preprepare\")\n\t\treturn nil\n\t}\n\n\t// do not accept of different views, or different signatures\n\tif (prepareArgs.View != pbft.view) || (prepareArgs.Digest != logEntryItem.commandDigest) {\n\t\tlog.Print(\"[HandlePrepareRPC] saw different view or different digest\")\n\t\treturn nil\n\t}\n\tif _, ok2 := logEntryItem.prepareArgs[prepareArgs.SenderIndex]; ok2 {\n\t\tlog.Print(\"[HandlePrepareRPC] already received from this server\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLog[prepareArgs.SequenceNumber].prepareArgs[prepareArgs.SenderIndex] = args\n\n\t// return if already prepared\n\tif len(logEntryItem.prepareArgs) > pbft.calculateMajority() {\n\t\tpbft.persist()\n\t\tlog.Printf(\"[HandlePrepareRPC] already prepared, so exiting\")\n\t\treturn nil\n\t}\n\n\t// We define the predicate prepared to be true iff replica has inserted in its\n\t// log: the request, a pre-prepare for in view with sequence number, and 2f\n\t// prepares from different backups that match the pre-prepare. The replicas verify\n\t// whether the prepares match the pre-prepare by checking that they have the\n\t// same view, sequence number, and digest\n\n\t// go into the commit phase for this command after 2F + 1 replies\n\tcommitArgs := CommitArg{\n\t\tView: pbft.view,\n\t\tSequenceNumber: prepareArgs.SequenceNumber,\n\t\tDigest: prepareArgs.Digest,\n\t\tSenderIndex: pbft.serverID,\n\t\tTimestamp: prepareArgs.Timestamp,\n\t}\n\n\tcommitArg := pbft.makeArguments(commitArgs)\n\tpbft.serverLog[prepareArgs.SequenceNumber].commitArgs[pbft.serverID] = commitArg\n\n\tgo pbft.sendRPCs(commitArg, COMMIT)\n\tpbft.persist()\n\n\tlog.Print(\"returning from prepare\\n\")\n\treturn nil\n}", "func DBHandler(fallback http.Handler) (http.HandlerFunc, error) {\n\tdb, err := postgresconnection.Getconn()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpaths := make(map[string]string)\n\tsqlStatement := `SELECT id, path, url FROM urls;`\n\trows, err := db.Query(sqlStatement)\n\tif err != nil {\n\t\t// handle this error better than this\n\t\tpanic(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar path, url string\n\t\terr = rows.Scan(&id, &path, &url)\n\t\tif err != nil {\n\t\t\t// handle this error\n\t\t\tpanic(err)\n\t\t}\n\t\tpaths[path] = url\n\t}\n\t// get any error encountered during iteration\n\terr = rows.Err()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn MapHandler(paths, fallback), nil\n}", "func (dbi *DB) Get(sqls string, arg ...string) (string, error) {\r\n\tif dbi.status == false {\r\n\t\treturn \"\", errors.New(\"database was not opened.\")\r\n\t}\r\n\r\n\t// start select\r\n\tdbi.createOperation(\"DB_SELECT\")\r\n\tdbi.data.reqSql = sqls\r\n\t// data\r\n\tdbi.data.commPrepare()\r\n\t// communicate\r\n\tif dbi.data.comm() == false {\r\n\t\tdbi.Close()\r\n\t\treturn \"\", errors.New(dbi.Sqlerrm)\r\n\t}\r\n\t// parse\r\n\tdbi.data.commParse()\r\n\tdbi.parseError()\r\n\r\n\tif dbi.Sqlcode != 0 {\r\n\t\treturn \"\", errors.New(dbi.Sqlerrm)\r\n\t}\r\n\r\n\tif len(dbi.data.outVar) > 0 {\r\n\t\treturn dbi.data.outVar[0], nil\r\n\t}\r\n\treturn \"\", nil\r\n}", "func (stmt *statement) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {\n\treturn stmt.conn.QueryContext(ctx, stmt.query, args)\n}", "func (client *GremlinResourcesClient) getGremlinDatabaseHandleResponse(resp *http.Response) (GremlinResourcesClientGetGremlinDatabaseResponse, error) {\n\tresult := GremlinResourcesClientGetGremlinDatabaseResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.GremlinDatabaseGetResults); err != nil {\n\t\treturn GremlinResourcesClientGetGremlinDatabaseResponse{}, err\n\t}\n\treturn result, nil\n}", "func (db *DB) Prepare(name string) (*pgx.PreparedStatement, error) {\n\tq, err := db.qm.getQuery(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq.ps, err = db.Pool.Prepare(name, q.sql)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn q.ps, nil\n}", "func (p *Proxy) HandleGetChunk(w resp.ResponseWriter, c *resp.Command) {\n\t// Response with pong to confirm the preflight test.\n\t// w.AppendBulkString(protocol.CMD_PONG)\n\t// if err := w.Flush(); err != nil {\n\t// \t// Network error, abandon request\n\t// \treturn\n\t// }\n\n\tclient := redeo.GetClient(c.Context())\n\tvar i util.Int\n\tseq, _ := c.Arg(i.Int()).Int()\n\tkey := c.Arg(i.Add1()).String()\n\treqId := c.Arg(i.Add1()).String()\n\tdChunkId, _ := c.Arg(i.Add1()).Int()\n\tchunkId := strconv.FormatInt(dChunkId, 10)\n\n\t// Start couting time.\n\tcollectorEntry, _ := collector.CollectRequest(collector.LogRequestStart, nil, protocol.CMD_GET, reqId, chunkId, time.Now().UnixNano())\n\n\t// key is \"key\"+\"chunkId\"\n\tmeta, ok := p.placer.Get(key, int(dChunkId))\n\tif !ok {\n\t\tp.log.Warn(\"KEY %s@%s not found\", chunkId, key)\n\t\tserver.NewNilResponse(w, seq).Flush()\n\t\treturn\n\t}\n\n\t// Validate the version of meta matches.\n\tcounter := global.ReqCoordinator.Register(reqId, protocol.CMD_GET, meta.DChunks, meta.PChunks, meta)\n\tif counter.Meta.(*metastore.Meta).Version() != meta.Version() {\n\t\tmeta = counter.Meta.(*metastore.Meta)\n\t}\n\n\t// Validate if the chunk id is still valid for the returned meta.\n\tif dChunkId >= int64(meta.NumChunks()) {\n\t\tserver.NewNilResponse(w, seq).Flush()\n\t\treturn\n\t}\n\n\tlambdaDest := meta.Placement[dChunkId]\n\tchunkKey := meta.ChunkKey(int(dChunkId))\n\treq := types.GetRequest(client)\n\treq.Seq = seq\n\treq.Id.ReqId = reqId\n\treq.Id.ChunkId = chunkId\n\treq.InsId = uint64(lambdaDest)\n\treq.Cmd = protocol.CMD_GET\n\treq.BodySize = meta.ChunkSize\n\treq.Key = chunkKey\n\treq.CollectorEntry = collectorEntry\n\treq.Info = meta\n\treq.RequestGroup = counter\n\t// Update counter\n\tcounter.Requests[dChunkId] = req\n\n\tp.log.Debug(\"HandleGet %v(%d): %s from %d\", reqId, dChunkId, chunkKey, lambdaDest)\n\n\tif p.cache != nil {\n\t\t// Query the persist cache.\n\t\tcached, first := p.cache.GetOrCreate(meta.ChunkKey(int(dChunkId)), meta.ChunkSize)\n\t\tif first {\n\t\t\t// Only the first of concurrent requests will be sent to lambda.\n\t\t\tp.log.Debug(\"Persisting %v to cache %s\", &req.Id, cached.Key())\n\t\t\treq.PersistChunk = cached\n\t\t} else {\n\t\t\tgo p.waitForCache(req, cached, counter)\n\t\t\tp.log.Debug(\"Serving %v from cache %s\", &req.Id, cached.Key())\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Validate the status of meta. If evicted, replace. All chunks will be replaced, so fulfill shortcut is not applicable here.\n\t// Not all placers support eviction.\n\t// NOTE: Since no delete request is provided, delection will only happen in cache mode.\n\tif meta.IsDeleted() {\n\t\t// Unlikely, just to be safe\n\t\tp.log.Debug(\"replace evicted chunk %s\", chunkKey)\n\n\t\t_, postProcess, err := p.placer.Place(meta, int(dChunkId), req.ToRecover())\n\t\tif err != nil {\n\t\t\tp.log.Warn(\"Failed to re-place %v: %v\", &req.Id, err)\n\t\t\treq.SetErrorResponse(err)\n\t\t\treturn\n\t\t}\n\t\tif postProcess != nil {\n\t\t\tpostProcess(p.dropEvicted)\n\t\t}\n\t\treturn\n\t}\n\n\t// Check late chunk request. Continue if persist chunk is available.\n\tif counter.IsFulfilled() && !req.MustRequest() {\n\t\t// Unlikely, just to be safe\n\t\tp.log.Debug(\"late request %v\", reqId)\n\t\treq.Abandon() // counter will be released on abandoning (req.Cleanup set).\n\t\treturn\n\t}\n\n\t// Send request to lambda channel\n\n\t// Validate the status of the instance\n\tinstance := p.cluster.Instance(uint64(lambdaDest))\n\tvar err error\n\t// No long we care if instance is reclaimed or not. Reclaimed instance will be delegated.\n\tif instance == nil {\n\t\terr = lambdastore.ErrInstanceClosed\n\t} else {\n\t\t// If reclaimed, instance will try delegate and relocate chunk concurrently, return ErrRelocationFailed if failed.\n\t\terr = p.placer.Dispatch(instance, req)\n\t}\n\tif err != nil && err != lambdastore.ErrQueueTimeout && err != lambdastore.ErrRelocationFailed {\n\t\t// In some cases, the instance doesn't try relocating, relocate the chunk as failover.\n\t\treq.Option = 0\n\t\t_, err = p.relocate(req, meta, int(dChunkId), chunkKey, fmt.Sprintf(\"Instance(%d) failed: %v\", lambdaDest, err))\n\t}\n\tif err != nil {\n\t\tp.log.Warn(\"Failed to dispatch %v: %v\", req.Id, err)\n\t\treq.SetErrorResponse(err)\n\t}\n}", "func handleQuery(schema *graphql.Schema, w http.ResponseWriter, r *http.Request, db database.DB) {\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Must provide graphql query in request body\", 400)\n\t\treturn\n\t}\n\n\t// Read and close JSON request body\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tdefer func() {\n\t\t_ = r.Body.Close()\n\t}()\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"%d error request: %v\", http.StatusBadRequest, err)\n\t\tlog.Error(msg)\n\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar req data\n\tif err := json.Unmarshal(body, &req); err != nil {\n\t\tmsg := fmt.Sprintf(\"Unmarshal request: %v\", err)\n\t\tlog.Error(msg)\n\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Execute graphql query\n\tresult := graphql.Do(graphql.Params{\n\t\tSchema: *schema,\n\t\tRequestString: req.Query,\n\t\tVariableValues: req.Variables,\n\t\tOperationName: req.Operation,\n\t\tContext: context.WithValue(context.Background(), \"database\", db), //nolint\n\t})\n\n\t//// Error check\n\t//if len(result.Errors) > 0 {\n\t//\tlog.\n\t//\t\tWithField(\"query\", req.Query).\n\t//\t\tWithField(\"variables\", req.Variables).\n\t//\t\tWithField(\"operation\", req.Operation).\n\t//\t\tWithField(\"errors\", result.Errors).Error(\"Execute query error(s)\")\n\t//}\n\n\trender.JSON(w, r, result)\n}", "func (base preplinkableHandler) Prepare(handlerFunc ...PrepFunc) preplinkableHandler {\n\treturn preplinkableHandler(getPrepFunc(http.HandlerFunc(base), handlerFunc...))\n}", "func (p *PreparedQuery) Apply(ctx context.Context) (*types.Response, error) {\n\treturn p.config.Transport.DoDBRequest(ctx, p.httpMeta, p.preparedQueryeReq())\n}", "func (core *Core) handleGet(query *MessageQuery) {\n\n\tif verbose {\n\t\tlog.Println(\"Getting\", query.Target)\n\t}\n\n\t// Retrieve corresponding statistic, and format the value\n\tval := strconv.FormatInt(core.stats[query.Target], 10)\n\tquery.clt.Reply(&MessageReply{Status: \"OK\", Value: val})\n}", "func (p *Proxy) handleShowCreateDatabase(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error) {\n\treturn p.ExecuteSingle(query)\n}", "func (s SQLError) GetQuery() string {\n\treturn s.sql\n}", "func (c *ConnWrapper) Prepare(query string) (driver.Stmt, error) {\n\tstmt, err := c.Conn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn StmtWrapper{Stmt: stmt, ctx: emptyCtx, query: query, dsn: c.dsn, integration: c.integration}, nil\n}", "func (client *SQLResourcesClient) getSQLStoredProcedureHandleResponse(resp *http.Response) (SQLResourcesClientGetSQLStoredProcedureResponse, error) {\n\tresult := SQLResourcesClientGetSQLStoredProcedureResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SQLStoredProcedureGetResults); err != nil {\n\t\treturn SQLResourcesClientGetSQLStoredProcedureResponse{}, err\n\t}\n\treturn result, nil\n}", "func (r *analyticsDeferredResultHandle) executeHandle(req *gocbcore.HttpRequest, valuePtr interface{}) error {\n\tresp, err := r.provider.DoHttpRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjsonDec := json.NewDecoder(resp.Body)\n\terr = jsonDec.Decode(valuePtr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = resp.Body.Close()\n\tif err != nil {\n\t\tlogDebugf(\"Failed to close socket (%s)\", err)\n\t}\n\n\treturn nil\n}", "func (core *ZPDCoreImpl) HandleStatement(ctx context.Context, connID string, msgReq *zpd_proto.StatementRequest) ([]byte, error) {\n\tcc := core.getClientConn(connID)\n\tif cc == nil {\n\t\treturn nil, error_zpd.ErrClientNoExists\n\t}\n\n\treturn cc.Handle(ctx, msgReq)\n}", "func (c *conn) Prepare(query string) (driver.Stmt, error) {\n\treturn c.prepare(query)\n}", "func (c *Conn) Prepare(q string) (driver.Stmt, error) {\n\tif q == \"\" {\n\t\t// No query to prepare.\n\t\treturn nil, io.EOF\n\t}\n\treturn &Stmt{Db: c, SrcQuery: q}, nil\n}", "func getDBQuery(r *http.Request, config rql.Config) (*rql.Params, error) {\n\tvar (\n\t\tb []byte\n\t\terr error\n\t)\n\tif v := r.URL.Query().Get(\"query\"); v != \"\" {\n\t\tb, err = base64.StdEncoding.DecodeString(v)\n\t} else {\n\t\tb, err = ioutil.ReadAll(io.LimitReader(r.Body, 1<<12))\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif b == nil || len(b) == 0 {\n\t\tb = []byte(\"{}\")\n\t}\n\t// MustNewParser panics if the configuration is invalid.\n\tQueryParser := rql.MustNewParser(config)\n\treturn QueryParser.Parse(b)\n}", "func (this *DbAdapter) Get(dest interface{}, query string, args ...interface{}) error {\n\tstarted := time.Now()\n\tdbMonitoring := this.Slave()\n\terr := dbMonitoring.Db.Get(dest, query, args...)\n\tdbMonitoring.addRequest(err, started)\n\treturn err\n}", "func (w WasmVMQueryHandlerFn) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error) {\n\treturn w(ctx, caller, request)\n}" ]
[ "0.6333289", "0.60487014", "0.58324856", "0.5713246", "0.55893195", "0.54791415", "0.540371", "0.5313706", "0.52738476", "0.5233486", "0.51003546", "0.507614", "0.5065565", "0.50296164", "0.49401554", "0.4906983", "0.49013954", "0.48929992", "0.48616147", "0.48577946", "0.4839466", "0.4818589", "0.48068944", "0.4773358", "0.47557366", "0.4719536", "0.47170785", "0.47161186", "0.47123846", "0.46898207", "0.46861148", "0.46851844", "0.4675842", "0.46702117", "0.4667201", "0.46490362", "0.46479756", "0.46425313", "0.46425313", "0.46425313", "0.46425313", "0.4641818", "0.4636561", "0.46299037", "0.46215624", "0.4619235", "0.46165785", "0.46118617", "0.45856884", "0.45742208", "0.45650625", "0.45515218", "0.4549053", "0.45340762", "0.45151016", "0.45121098", "0.4508069", "0.45059514", "0.44978464", "0.44903025", "0.448491", "0.44753832", "0.44743726", "0.4471763", "0.44492167", "0.4438484", "0.44375288", "0.44336265", "0.4429122", "0.44194227", "0.43960342", "0.43878856", "0.43788365", "0.43743333", "0.43689618", "0.4358445", "0.43567204", "0.43530443", "0.43479818", "0.4340061", "0.43370286", "0.43053102", "0.42974153", "0.42950246", "0.4283087", "0.4280908", "0.42746028", "0.426956", "0.4263975", "0.4247168", "0.4244843", "0.42439044", "0.4230258", "0.42275283", "0.42274207", "0.42176524", "0.42118627", "0.42111352", "0.42001557", "0.4199957" ]
0.72330827
0
HandleSetPreparedQueries is an endpoint handler which updates database PreparedQueries
func HandleSetPreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) v := config.PreparedQuery{} _ = json.NewDecoder(r.Body).Decode(&v) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusUnauthorized) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] project := vars["project"] id := vars["id"] if err := syncman.SetPreparedQueries(ctx, project, dbAlias, id, &v); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusInternalServerError) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) // http status codee _ = json.NewEncoder(w).Encode(map[string]interface{}{}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (h ProxyHandler) HandleStmtPrepare(query string) (int, int, interface{}, error) {\n\tfmt.Println(\"prep: \", query)\n\treturn 0, 0, nil, fmt.Errorf(\"not supported now\")\n}", "func HandleRemovePreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.RemovePreparedQueries(ctx, project, dbAlias, id); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func (s *HTTPServer) PreparedQuerySpecific(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tif req.Method == \"OPTIONS\" {\n\t\treturn s.preparedQuerySpecificOptions(resp, req), nil\n\t}\n\n\tpath := req.URL.Path\n\tid := strings.TrimPrefix(path, \"/v1/query/\")\n\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/execute\")\n\t\treturn s.preparedQueryExecute(id, resp, req)\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/explain\")\n\t\treturn s.preparedQueryExplain(id, resp, req)\n\n\tdefault:\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\treturn s.preparedQueryGet(id, resp, req)\n\n\t\tcase \"PUT\":\n\t\t\treturn s.preparedQueryUpdate(id, resp, req)\n\n\t\tcase \"DELETE\":\n\t\t\treturn s.preparedQueryDelete(id, resp, req)\n\n\t\tdefault:\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"PUT\", \"DELETE\"}}\n\t\t}\n\t}\n}", "func HandleGetPreparedQuery(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tidQuery, exists := r.URL.Query()[\"id\"]\n\t\tid := \"\"\n\t\tif exists {\n\t\t\tid = idQuery[0]\n\t\t}\n\t\tresult, err := syncMan.GetPreparedQuery(ctx, projectID, dbAlias, id)\n\t\tif err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\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}", "func (c *Cursor) HandleStmtPrepare(query string) (params int, columns int, context interface{}, err error) {\n\t// TODO(xq26144), not implemented\n\t// According to the libmysql standard: https://github.com/mysql/mysql-server/blob/8.0/libmysql/libmysql.cc#L1599\n\t// the COM_STMT_PREPARE should return the correct bind parameter count (which can be implemented by newly created parser)\n\t// and should return the correct number of return fields (which can not be implemented right now with new query plan logic embedded)\n\n\terr = my.NewError(my.ER_NOT_SUPPORTED_YET, \"stmt prepare is not supported yet\")\n\treturn\n}", "func (dbi *DB) Prepare(sqls string, arg ...string) {\r\n\tif dbi.status == false {\r\n\t\treturn\r\n\t}\r\n\r\n\tdbi.createOperation(\"DB_PREPARE\")\r\n\t// bind variables\r\n\tdbi.data.reqSql = sqls\r\n\tdbi.data.inVar = arg\r\n\t// data\r\n\tdbi.data.commPrepare()\r\n\t// communicate\r\n\tif dbi.data.comm() == false {\r\n\t\tdbi.Close()\r\n\t}\r\n\t// parse\r\n\tdbi.data.commParse()\r\n}", "func (s *HTTPServer) preparedQueryList(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tvar args structs.DCSpecificRequest\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.List\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Use empty list instead of nil.\n\tif reply.Queries == nil {\n\t\treply.Queries = make(structs.PreparedQueries, 0)\n\t}\n\treturn reply.Queries, nil\n}", "func PrepareStatements(db *sql.DB, preparedStmts map[string]*sql.Stmt, unpreparedStmts map[string]string) error {\n var key string\n var value string\n var err error\n var stmt *sql.Stmt\n\n for key, value = range unpreparedStmts {\n stmt, err = db.Prepare(value)\n\n if err != nil {\n return err\n }\n\n preparedStmts[key] = stmt\n }\n\n return nil\n}", "func (db *EdDb) buildPreparedStatements() (err error) {\n\n\tfor title, sqlCommand := range db.preparedStatements() {\n\t\tdb.statements[title], err = db.dbConn.PrepareNamed(sqlCommand)\n\t\tif err != nil {\n\t\t\tlog.Fatal(fmt.Sprint(\"buildPreparedStatement:\", title, \" \", err))\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (m *Modules) SetDatabasePreparedQueryConfig(ctx context.Context, projectID string, prepConfigs config.DatabasePreparedQueries) error {\n\tmodule, err := m.loadModule(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn module.SetDatabasePreparedQueryConfig(ctx, prepConfigs)\n}", "func (e *Execute) OptimizePreparedPlan(ctx context.contextctx, sctx causetnetctx.contextctx, is schemaReplicant.SchemaReplicant) error {\n\tvars := sctx.GetCausetNetVars()\n\tif e.Name != \"\" {\n\t\te.ExecID = vars.PreparedStmtNameToID[e.Name]\n\t}\n\tpreparedPointer, ok := vars.PreparedStmts[e.ExecID]\n\tif !ok {\n\t\treturn errors.Trace(ErrStmtNotFound)\n\t}\n\tpreparedObj, ok := preparedPointer.(*CachedPrepareStmt)\n\tif !ok {\n\t\treturn errors.Errorf(\"invalid CachedPrepareStmt type\")\n\t}\n\tprepared := preparedObj.PreparedAst\n\tvars.StmtCtx.StmtType = prepared.StmtType\n\n\tparamLen := len(e.PrepareParams)\n\tif paramLen > 0 {\n\t\t// for binary protocol execute, argument is placed in vars.PrepareParams\n\t\tif len(prepared.Params) != paramLen {\n\t\t\treturn errors.Trace(ErrWrongParamCount)\n\t\t}\n\t\tvars.PreparedParams = e.PrepareParams\n\t\tfor i, val := range vars.PreparedParams {\n\t\t\tparam := prepared.Params[i].(*driver.ParamMarkerExpr)\n\t\t\tparam.Datum = val\n\t\t\tparam.InExecute = true\n\t\t}\n\t} else {\n\t\t// for `execute stmt using @a, @b, @c`, using value in e.UsingVars\n\t\tif len(prepared.Params) != len(e.UsingVars) {\n\t\t\treturn errors.Trace(ErrWrongParamCount)\n\t\t}\n\n\t\tfor i, usingVar := range e.UsingVars {\n\t\t\tval, err := usingVar.Eval(soliton.Row{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tparam := prepared.Params[i].(*driver.ParamMarkerExpr)\n\t\t\tparam.Datum = val\n\t\t\tparam.InExecute = true\n\t\t\tvars.PreparedParams = append(vars.PreparedParams, val)\n\t\t}\n\t}\n\n\tif prepared.SchemaVersion != is.SchemaMetaVersion() {\n\t\t// In order to avoid some correctness issues, we have to clear the\n\t\t// cached plan once the schema version is changed.\n\t\t// Cached plan in prepared struct does NOT have a \"cache key\" with\n\t\t// schema version like prepared plan cache key\n\t\tprepared.CachedPlan = nil\n\t\tpreparedObj.Interlock = nil\n\t\t// If the schema version has changed we need to preprocess it again,\n\t\t// if this time it failed, the real reason for the error is schema changed.\n\t\terr := Preprocess(sctx, prepared.Stmt, is, InPrepare)\n\t\tif err != nil {\n\t\t\treturn ErrSchemaChanged.GenWithStack(\"Schema change caused error: %s\", err.Error())\n\t\t}\n\t\tprepared.SchemaVersion = is.SchemaMetaVersion()\n\t}\n\terr := e.getPhysicalPlan(ctx, sctx, is, preparedObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.Stmt = prepared.Stmt\n\treturn nil\n}", "func ConfigureStatements(unpreparedStmts map[string]string) {\n // User Repositories.\n AddCreateUserRepositoryStatement(unpreparedStmts)\n AddGetAllUserRepositoriesStatements(unpreparedStmts)\n AddUpdateUserRepositoryStatement(unpreparedStmts)\n AddDeleteUserRepositoryStatement(unpreparedStmts)\n\n // Repositories\n AddCreateRepositoryStatement(unpreparedStmts)\n AddGetRepositoryStatement(unpreparedStmts)\n AddUpdateRepositoryStatement(unpreparedStmts)\n AddDeleteRepositoryStatement(unpreparedStmts)\n}", "func (h *HTTPTester) Prepare(stmt string, bSz int, tx bool) error {\n\ts := make([]string, bSz)\n\tfor i := 0; i < len(s); i++ {\n\t\ts[i] = stmt\n\t}\n\n\tb, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\th.br = bytes.NewReader(b)\n\n\tif tx {\n\t\th.url = h.url + \"?transaction\"\n\t}\n\n\treturn nil\n}", "func (s *HTTPServer) preparedQueryExecute(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryExecuteRequest{\n\t\tQueryIDOrName: id,\n\t\tAgent: structs.QuerySource{\n\t\t\tNode: s.agent.config.NodeName,\n\t\t\tDatacenter: s.agent.config.Datacenter,\n\t\t\tSegment: s.agent.config.SegmentName,\n\t\t},\n\t}\n\ts.parseSource(req, &args.Source)\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\tif err := parseLimit(req, &args.Limit); err != nil {\n\t\treturn nil, fmt.Errorf(\"Bad limit: %s\", err)\n\t}\n\n\tparams := req.URL.Query()\n\tif raw := params.Get(\"connect\"); raw != \"\" {\n\t\tval, err := strconv.ParseBool(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error parsing 'connect' value: %s\", err)\n\t\t}\n\n\t\targs.Connect = val\n\t}\n\n\tvar reply structs.PreparedQueryExecuteResponse\n\tdefer setMeta(resp, &reply.QueryMeta)\n\n\tif args.QueryOptions.UseCache {\n\t\traw, m, err := s.agent.cache.Get(cachetype.PreparedQueryName, &args)\n\t\tif err != nil {\n\t\t\t// Don't return error if StaleIfError is set and we are within it and had\n\t\t\t// a cached value.\n\t\t\tif raw != nil && m.Hit && args.QueryOptions.StaleIfError > m.Age {\n\t\t\t\t// Fall through to the happy path below\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tdefer setCacheMeta(resp, &m)\n\t\tr, ok := raw.(*structs.PreparedQueryExecuteResponse)\n\t\tif !ok {\n\t\t\t// This should never happen, but we want to protect against panics\n\t\t\treturn nil, fmt.Errorf(\"internal error: response type not correct\")\n\t\t}\n\t\treply = *r\n\t} else {\n\tRETRY_ONCE:\n\t\tif err := s.agent.RPC(\"PreparedQuery.Execute\", &args, &reply); err != nil {\n\t\t\t// We have to check the string since the RPC sheds\n\t\t\t// the specific error type.\n\t\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\t\targs.AllowStale = false\n\t\t\targs.MaxStaleDuration = 0\n\t\t\tgoto RETRY_ONCE\n\t\t}\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Note that we translate using the DC that the results came from, since\n\t// a query can fail over to a different DC than where the execute request\n\t// was sent to. That's why we use the reply's DC and not the one from\n\t// the args.\n\ts.agent.TranslateAddresses(reply.Datacenter, reply.Nodes)\n\n\t// Use empty list instead of nil.\n\tif reply.Nodes == nil {\n\t\treply.Nodes = make(structs.CheckServiceNodes, 0)\n\t}\n\treturn reply, nil\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tswitch req.Method {\n\tcase \"POST\":\n\t\treturn s.preparedQueryCreate(resp, req)\n\n\tcase \"GET\":\n\t\treturn s.preparedQueryList(resp, req)\n\n\tdefault:\n\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"POST\"}}\n\t}\n}", "func (my *MySQL) Prepare(sql string) (stmt *Statement, err os.Error) {\n defer my.unlock()\n my.lock()\n\n if my.conn == nil {\n return nil, NOT_CONN_ERROR\n }\n if my.unreaded_rows {\n return nil, UNREADED_ROWS_ERROR\n }\n\n stmt, err = my.prepare(sql)\n if err != nil {\n return\n }\n // Connect statement with database handler\n my.stmt_map[stmt.id] = stmt\n // Save SQL for reconnect\n stmt.sql = sql\n\n return\n}", "func (s *HTTPServer) preparedQueryUpdate(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryRequest{\n\t\tOp: structs.PreparedQueryUpdate,\n\t}\n\ts.parseDC(req, &args.Datacenter)\n\ts.parseToken(req, &args.Token)\n\tif req.ContentLength > 0 {\n\t\tif err := decodeBody(req, &args.Query, nil); err != nil {\n\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\tfmt.Fprintf(resp, \"Request decode failed: %v\", err)\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tif args.Query == nil {\n\t\targs.Query = &structs.PreparedQuery{}\n\t}\n\n\t// Take the ID from the URL, not the embedded one.\n\targs.Query.ID = id\n\n\tvar reply string\n\tif err := s.agent.RPC(\"PreparedQuery.Apply\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "func (core *Core) handleSet(query *MessageQuery) {\n\n\tif verbose {\n\t\tlog.Println(\"Setting\", query.Target)\n\t}\n\tvar reply *MessageReply\n\n\t// Parse integer\n\tif n, err := strconv.ParseInt(query.Arg, 10, 64); err != nil {\n\t\treply = &MessageReply{Status: \"KO\", Error: \"Invalid number\"}\n\t} else {\n\t\t// Update corresponding statistic\n\t\tcore.stats[query.Target] = n\n\t\treply = &MessageReply{Status: \"OK\"}\n\t}\n\tquery.clt.Reply(reply)\n}", "func PrepareAllQueries(ctx context.Context, p preparer) error {\n\tif _, err := p.Prepare(ctx, backtickSQL, backtickSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'Backtick': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickQuoteBacktickSQL, backtickQuoteBacktickSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickQuoteBacktick': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickNewlineSQL, backtickNewlineSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickNewline': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickDoubleQuoteSQL, backtickDoubleQuoteSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickDoubleQuote': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickBackslashNSQL, backtickBackslashNSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickBackslashN': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, illegalNameSymbolsSQL, illegalNameSymbolsSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'IllegalNameSymbols': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, badEnumNameSQL, badEnumNameSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BadEnumName': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, goKeywordSQL, goKeywordSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'GoKeyword': %w\", err)\n\t}\n\treturn nil\n}", "func (b *bot) prepare(query string) (*sql.Stmt, error) {\n\treturn b.DB.client.Prepare(query)\n}", "func (s *Server) sqlHandler(w http.ResponseWriter, req *http.Request) {\n if(s.block) {\n time.Sleep(1000000* time.Second)\n }\n\n\tquery, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't read body: %s\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tif s.leader != s.listen {\n\n\t\tcs, errLeader := transport.Encode(s.leader)\n\t\t\n\t\tif errLeader != nil {\n\t\t\thttp.Error(w, \"Only the primary can service queries, but this is a secondary\", http.StatusBadRequest)\t\n\t\t\tlog.Printf(\"Leader ain't present?: %s\", errLeader)\n\t\t\treturn\n\t\t}\n\n\t\t//_, errLeaderHealthCheck := s.client.SafeGet(cs, \"/healthcheck\") \n\n //if errLeaderHealthCheck != nil {\n // http.Error(w, \"Primary is down\", http.StatusBadRequest)\t\n // return\n //}\n\n\t\tbody, errLResp := s.client.SafePost(cs, \"/sql\", bytes.NewBufferString(string(query)))\n\t\tif errLResp != nil {\n s.block = true\n http.Error(w, \"Can't forward request to primary, gotta block now\", http.StatusBadRequest)\t\n return \n\t//\t log.Printf(\"Didn't get reply from leader: %s\", errLResp)\n\t\t}\n\n formatted := fmt.Sprintf(\"%s\", body)\n resp := []byte(formatted)\n\n\t\tw.Write(resp)\n\t\treturn\n\n\t} else {\n\n\t\tlog.Debugf(\"Primary Received query: %#v\", string(query))\n\t\tresp, err := s.execute(query)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t}\n\n\t\tw.Write(resp)\n\t\treturn\n\t}\n}", "func (pbft *PBFT) HandlePrepareRPC(args CommandArgs, reply *RPCReply) error {\n\tlog.Print(\"Getting to handle prepare\\n\")\n\n\tif pbft.isChangingView() {\n\t\treturn nil\n\t}\n\n\tpbft.commandRecieved <- true\n\tprepareArgs, ok := args.SpecificArguments.(PrepareCommandArg)\n\tif !ok {\n\t\tlog.Fatal(\"[handlePrePrepareRPC] preprepare command args failed\")\n\t}\n\n\t// verify the signatures\n\tsignatureArg := verifySignatureArg{\n\t\tgeneric: prepareArgs,\n\t}\n\tif !pbft.verifySignatures(&signatureArg, args.R_firstSig, args.S_secondSig, prepareArgs.SenderIndex) {\n\t\tlog.Print(\"[HandlePrepareRPC] signatures of the prepare command args don't match\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLock.Lock()\n\tdefer pbft.serverLock.Unlock()\n\n\tlogEntryItem, ok1 := pbft.serverLog[prepareArgs.SequenceNumber]\n\n\t// A replica (including the primary) accepts prepare messages and adds them to its log\n\t// provided their signatures are correct, their view number equals the replica’s current view,\n\t// and their sequence number is between h and H.\n\n\t// do nothing if we did not receive a preprepare\n\tif !ok1 {\n\t\tlog.Print(\"[HandlePrepareRPC] did not recieve a preprepare\")\n\t\treturn nil\n\t}\n\n\t// do not accept of different views, or different signatures\n\tif (prepareArgs.View != pbft.view) || (prepareArgs.Digest != logEntryItem.commandDigest) {\n\t\tlog.Print(\"[HandlePrepareRPC] saw different view or different digest\")\n\t\treturn nil\n\t}\n\tif _, ok2 := logEntryItem.prepareArgs[prepareArgs.SenderIndex]; ok2 {\n\t\tlog.Print(\"[HandlePrepareRPC] already received from this server\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLog[prepareArgs.SequenceNumber].prepareArgs[prepareArgs.SenderIndex] = args\n\n\t// return if already prepared\n\tif len(logEntryItem.prepareArgs) > pbft.calculateMajority() {\n\t\tpbft.persist()\n\t\tlog.Printf(\"[HandlePrepareRPC] already prepared, so exiting\")\n\t\treturn nil\n\t}\n\n\t// We define the predicate prepared to be true iff replica has inserted in its\n\t// log: the request, a pre-prepare for in view with sequence number, and 2f\n\t// prepares from different backups that match the pre-prepare. The replicas verify\n\t// whether the prepares match the pre-prepare by checking that they have the\n\t// same view, sequence number, and digest\n\n\t// go into the commit phase for this command after 2F + 1 replies\n\tcommitArgs := CommitArg{\n\t\tView: pbft.view,\n\t\tSequenceNumber: prepareArgs.SequenceNumber,\n\t\tDigest: prepareArgs.Digest,\n\t\tSenderIndex: pbft.serverID,\n\t\tTimestamp: prepareArgs.Timestamp,\n\t}\n\n\tcommitArg := pbft.makeArguments(commitArgs)\n\tpbft.serverLog[prepareArgs.SequenceNumber].commitArgs[pbft.serverID] = commitArg\n\n\tgo pbft.sendRPCs(commitArg, COMMIT)\n\tpbft.persist()\n\n\tlog.Print(\"returning from prepare\\n\")\n\treturn nil\n}", "func (h ProxyHandler) HandleStmtExecute(context interface{}, query string, args []interface{}) (*go_mysql.Result, error) {\n\tfmt.Println(\"context: \", context, \" query: \", query, \" args:\", args)\n\treturn nil, fmt.Errorf(\"not supported now\")\n}", "func prepareStmts(db *sql.DB, unprepared map[string]string) (map[string]*sql.Stmt, error) {\n\tprepared := map[string]*sql.Stmt{}\n\tfor k, v := range unprepared {\n\t\tstmt, err := db.Prepare(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprepared[k] = stmt\n\t}\n\n\treturn prepared, nil\n}", "func PrepareAdmin() error {\n\n\tUnPreparedStatements := make(map[string]string, 0)\n\n\tUnPreparedStatements[\"getID\"] = \"select LAST_INSERT_ID() AS id\"\n\tUnPreparedStatements[\"authenticateUserStmt\"] = \"select * from user where username=? and encpassword=? and isActive = 1\"\n\tUnPreparedStatements[\"getUserByIDStmt\"] = \"select * from user where id=?\"\n\tUnPreparedStatements[\"getUserByUsernameStmt\"] = \"select * from user where username=?\"\n\tUnPreparedStatements[\"getUserByEmailStmt\"] = \"select * from user where email=?\"\n\tUnPreparedStatements[\"allUserStmt\"] = \"select * from user\"\n\tUnPreparedStatements[\"getAllModulesStmt\"] = \"select * from module order by module\"\n\tUnPreparedStatements[\"userModulesStmt\"] = \"select module.* from module inner join user_module on module.id = user_module.moduleID where user_module.userID = ? order by module\"\n\tUnPreparedStatements[\"setUserPasswordStmt\"] = \"update user set encpassword = ? where id = ?\"\n\tUnPreparedStatements[\"registerUserStmt\"] = \"insert into user (username,email,fname,lname,isActive,superUser) VALUES (?,?,?,?,0,0)\"\n\tUnPreparedStatements[\"getAllUserStmt\"] = \"select * from user order by fname, lname\"\n\tUnPreparedStatements[\"setUserStatusStmt\"] = \"update user set isActive = ? WHERE id = ?\"\n\tUnPreparedStatements[\"clearUserModuleStmt\"] = \"delete from user_module WHERE userid = ?\"\n\tUnPreparedStatements[\"deleteUserStmt\"] = \"delete from user WHERE id = ?\"\n\tUnPreparedStatements[\"addUserStmt\"] = \"insert into user (username,email,fname,lname,biography,photo,isActive,superUser) VALUES (?,?,?,?,?,?,?,?)\"\n\tUnPreparedStatements[\"updateUserStmt\"] = \"update user set username=?, email=?, fname=?, lname=?, biography=?, photo=?, isActive=?, superUser=? WHERE id = ?\"\n\tUnPreparedStatements[\"addModuleToUserStmt\"] = \"insert into user_module (userID,moduleID) VALUES (?,?)\"\n\n\tif !AdminDb.Raw.IsConnected() {\n\t\tAdminDb.Raw.Connect()\n\t}\n\n\tc := make(chan int)\n\n\tfor stmtname, stmtsql := range UnPreparedStatements {\n\t\tgo PrepareAdminStatement(stmtname, stmtsql, c)\n\t}\n\n\tfor _, _ = range UnPreparedStatements {\n\t\t<-c\n\t}\n\n\treturn nil\n}", "func EncodePrepare(request *Message, db uint64, sql string) {\n\trequest.putUint64(db)\n\trequest.putString(sql)\n\n\trequest.putHeader(bindings.RequestPrepare)\n}", "func (p *Proxy) HandleSetChunk(w resp.ResponseWriter, c *resp.CommandStream) {\n\tclient := redeo.GetClient(c.Context())\n\n\t// Get args\n\tseq, _ := c.NextArg().Int()\n\tkey, _ := c.NextArg().String()\n\treqId, _ := c.NextArg().String()\n\tsize, _ := c.NextArg().Int()\n\tdChunkId, _ := c.NextArg().Int()\n\tchunkId := strconv.FormatInt(dChunkId, 10)\n\tdataChunks, _ := c.NextArg().Int()\n\tparityChunks, _ := c.NextArg().Int()\n\tlambdaId, _ := c.NextArg().Int()\n\trandBase, _ := c.NextArg().Int()\n\n\tbodyStream, err := c.Next()\n\tif err != nil {\n\t\tp.log.Error(\"Error on get value reader: %v\", err)\n\t\treturn\n\t}\n\n\tp.log.Debug(\"HandleSet %s(%d): %d@%s\", reqId, dChunkId, dChunkId, key)\n\n\t// Start counting time.\n\tcollectEntry, _ := collector.CollectRequest(collector.LogRequestStart, nil, protocol.CMD_SET, reqId, chunkId, time.Now().UnixNano())\n\n\tprepared := p.placer.NewMeta(reqId,\n\t\tkey, size, int(dataChunks), int(parityChunks), int(dChunkId), int64(bodyStream.Len()), uint64(lambdaId), int(randBase))\n\tprepared.SetTimout(protocol.GetBodyTimeout(bodyStream.Len())) // Set timeout for the operation to be considered as failed.\n\t// Added by Tianium: 20221102\n\t// We need the counter to figure out when the object is fully stored.\n\tcounter := global.ReqCoordinator.Register(reqId, protocol.CMD_SET, prepared.DChunks, prepared.PChunks, nil)\n\n\t// Updated by Tianium: 20221102\n\t// req.Key will not be set until we get meta and have information about the version.\n\treq := types.GetRequest(client)\n\treq.Seq = seq\n\treq.Id.ReqId = reqId\n\treq.Id.ChunkId = chunkId\n\treq.InsId = uint64(lambdaId)\n\treq.Cmd = protocol.CMD_SET\n\treq.BodyStream = bodyStream\n\treq.BodyStream.(resp.Holdable).Hold() // Hold to prevent being closed\n\treq.CollectorEntry = collectEntry\n\treq.Info = prepared\n\t// Added by Tianium: 20221102\n\t// Add counter support.\n\treq.RequestGroup = counter // Set cleanup so the counter can always be released.\n\tcounter.Requests[dChunkId] = req\n\tbodyStream = nil // Don't use bodyStream anymore, req.BodyStream can be updated in InsertAndPlace().\n\n\t// Check if the chunk key(key + chunkId) exists, base of slice will only be calculated once.\n\tmeta, postProcess, err := p.placer.InsertAndPlace(key, prepared, req)\n\tif req.PersistChunk != nil {\n\t\tdefer req.PersistChunk.GetInterceptor().Close()\n\t}\n\tif err != nil && err == metastore.ErrConcurrentCreation {\n\t\t// Later concurrent setting will be automatically abandoned and return the same result as the earlier one.\n\t\treq.BodyStream.(resp.Holdable).Unhold() // bodyStream now will automatically be closed.\n\t\treq.BodyStream.Close() // Ensure client request finished before set response.\n\t\tmeta.Wait()\n\t\tif meta.IsValid() {\n\t\t\treq.SetResponse(req.ToConcurrentSetResponse(meta.Placement[dChunkId]))\n\t\t} else {\n\t\t\treq.SetErrorResponse(types.ErrMaxAttemptsReached)\n\t\t}\n\t\treturn\n\t} else if err != nil {\n\t\treq.BodyStream.(resp.Holdable).Unhold()\n\t\treq.BodyStream.Close() // Ensure client request finished before set response.\n\t\tserver.NewErrorResponse(w, seq, err.Error()).Flush()\n\t\treturn\n\t} else if meta.IsDeleted() {\n\t\treq.BodyStream.(resp.Holdable).Unhold()\n\t\treq.BodyStream.Close() // Ensure client request finished before set response.\n\t\t// Object may be deleted during PUT in a rare case in cache mode (COS is disabled) such as:\n\t\t// T1: Some chunks are set.\n\t\t// T2: The placer decides to evict this object (in rare case) by DELETE it.\n\t\t// T3: We get a deleted meta.\n\t\tserver.NewErrorResponse(w, seq, \"KEY %s not set to lambda store, may got evicted before all chunks are set.\", meta.ChunkKey(int(dChunkId))).Flush()\n\t\treturn\n\t}\n\n\tif postProcess != nil {\n\t\tgo postProcess(p.dropEvicted)\n\t\t// continue\n\t}\n}", "func HandleRequest(query []byte, conn *DatabaseConnection) {\n\tlog.Printf(\"Handling raw query: %s\", query)\n\tlog.Printf(\"Parsing request...\")\n\trequest, err := grammar.ParseRequest(query)\n\tlog.Printf(\"Parsed request\")\n\tvar response grammar.Response\n\n\tif err != nil {\n\t\tlog.Printf(\"Error in request parsing! %s\", err.Error())\n\t\tresponse.Type = grammar.UNKNOWN_TYPE_RESPONSE\n\t\tresponse.Status = grammar.RESP_STATUS_ERR_INVALID_QUERY\n\t\tresponse.Data = err.Error()\n\t\tconn.Write(grammar.GetBufferFromResponse(response))\n\t}\n\n\tswitch request.Type {\n\tcase grammar.AUTH_REQUEST:\n\t\t// AUTH {username} {password}\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_AUTH_REQUEST, false, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in AUTH request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\t\tusername := request.RequestData[0]\n\t\tpassword := request.RequestData[1]\n\t\t// bucketname := tokens[2]\n\t\tlog.Printf(\"Client wants to authenticate.<username>:<password> %s:%s\", username, password)\n\n\t\tauthRequest := AuthRequest{Username: username, Password: password, Conn: conn}\n\t\tresponse = processAuthRequest(authRequest)\n\tcase grammar.SET_REQUEST:\n\t\t// SET {key} {value} [ttl] [nooverride]\n\t\trequest.Type = grammar.SET_RESPONSE\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_SET_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in SET request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tkey := request.RequestData[0]\n\t\tvalue := request.RequestData[1]\n\t\tlog.Printf(\"Setting %s:%s\", key, value)\n\t\tsetRequest := SetRequest{Key: key, Value: value, Conn: conn}\n\t\tresponse = processSetRequest(setRequest)\n\n\tcase grammar.GET_REQUEST:\n\t\t// GET {key}\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_GET_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in GET request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tkey := request.RequestData[0]\n\t\tlog.Printf(\"Client wants to get key '%s'\", key)\n\t\tgetRequest := GetRequest{Key: key, Conn: conn}\n\t\tresponse = processGetRequest(getRequest)\n\n\tcase grammar.DELETE_REQUEST:\n\t\t// DELETE {key}\n\t\tlog.Println(\"Client wants to delete a bucket/key\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_DELETE_REQUEST, true, true)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in DELETE request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\t\t// TODO implement\n\tcase grammar.CREATE_BUCKET_REQUEST:\n\t\tlog.Println(\"Client wants to create a bucket\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_CREATE_BUCKET_REQUEST, true, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in CREATE bucket request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tbucketName := request.RequestData[0]\n\t\tcreateBucketRequest := CreateBucketRequest{BucketName: bucketName, Conn: conn}\n\n\t\tresponse = processCreateBucketRequest(createBucketRequest)\n\tcase grammar.CREATE_USER_REQUEST:\n\t\tlog.Printf(\"Client wants to create a user\")\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_CREATE_USER_REQUEST, false, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in CREATE user request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tusername := request.RequestData[0]\n\t\tpassword := request.RequestData[1]\n\t\tcreateUserRequest := CreateUserRequest{Username: username, Password: password, Conn: conn}\n\n\t\tresponse = processCreateUserRequest(createUserRequest)\n\tcase grammar.USE_REQUEST:\n\t\terrorStatus := checkRequirements(request, conn, grammar.LENGTH_OF_USE_REQUEST, true, false)\n\t\tif errorStatus != 0 {\n\t\t\tlog.Printf(\"Error in USE request! %d\", errorStatus)\n\t\t\tresponse.Status = errorStatus\n\t\t\tbreak\n\t\t}\n\n\t\tbucketname := request.RequestData[0]\n\t\tif bucketname == SALTS_BUCKET || bucketname == USERS_BUCKET {\n\t\t\tresponse.Status = grammar.RESP_STATUS_ERR_UNAUTHORIZED\n\t\t\tbreak\n\t\t}\n\n\t\tuseRequest := UseRequest{BucketName: bucketname, Conn: conn}\n\t\tresponse = processUseRequest(useRequest)\n\tdefault:\n\t\tlog.Printf(illegalRequestTemplate, request.Type)\n\t\tresponse.Type = grammar.UNKNOWN_TYPE_RESPONSE\n\t\tresponse.Status = grammar.RESP_STATUS_ERR_UNKNOWN_COMMAND\n\t}\n\tif response.Status != 0 {\n\t\tlog.Printf(\"Error in request. status: %d\", response.Status)\n\t}\n\tconn.Write(grammar.GetBufferFromResponse(response))\n\tlog.Printf(\"Wrote buffer: %s to client\", grammar.GetBufferFromResponse(response))\n\n}", "func (this *dataStore) Prepare(queryFile string) (error) {\r\n\r\n\tvar queries map[string]map[string]*query\r\n\r\n\tif err := utils.LoadConfig(&queries, queryFile); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tfor modelName := range queries {\r\n\r\n\t\tif this.namedStmts[modelName] == nil {\r\n\t\t\tthis.namedStmts[modelName] = make(map[string]*namedStmt)\r\n\t\t}\r\n\r\n\t\tfor queryName, query := range queries[modelName] {\r\n\r\n\t\t\tif stmt, err := this.PrepareNamed(query.String()); err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t} else {\r\n\t\t\t\tthis.namedStmts[modelName][queryName] = &namedStmt{\r\n\t\t\t\t\tNamedStmt: stmt,\r\n\t\t\t\t\tquery: query,\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "func execPrepareStmt(prepStmt string) {\n\tif db == nil {\n\t\tdb = getDB()\n\t}\n\n\tstmt, err := db.Prepare(prepStmt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = stmt.Exec()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (s *HTTPServer) preparedQuerySpecificOptions(resp http.ResponseWriter, req *http.Request) interface{} {\n\tpath := req.URL.Path\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tdefault:\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\", \"PUT\", \"DELETE\"}, \",\"))\n\t\treturn resp\n\t}\n}", "func (s *HTTPServer) preparedQueryGet(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQuerySpecificRequest{\n\t\tQueryID: id,\n\t}\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.Get\", &args, &reply); err != nil {\n\t\t// We have to check the string since the RPC sheds\n\t\t// the specific error type.\n\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\treturn reply.Queries, nil\n}", "func (db *DB) Prepare(name string) (*pgx.PreparedStatement, error) {\n\tq, err := db.qm.getQuery(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq.ps, err = db.Pool.Prepare(name, q.sql)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn q.ps, nil\n}", "func (r *Reader) prepareStatement(\n\tctx context.Context,\n\tdb *sql.DB,\n\tstoreID uint64,\n\topts *options.ReaderOptions,\n) error {\n\tfilter := \"\"\n\tif opts.FilterByEventType {\n\t\ttypes := strings.Join(escapeStrings(opts.EventTypes), `, `)\n\t\tfilter = `AND e.event_type IN (` + types + `)`\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t`SELECT\n\t\t\tf.offset,\n\t\t\tf.time,\n\t\t\te.event_type,\n\t\t\te.content_type,\n\t\t\te.body,\n\t\t\tCURRENT_TIMESTAMP(6)\n\t\tFROM fact AS f\n\t\tINNER JOIN event AS e\n\t\tON e.id = f.event_id\n\t\t%s\n\t\tWHERE f.store_id = %d\n\t\t\tAND f.stream = %s\n\t\t\tAND f.offset >= ?\n\t\tORDER BY offset\n\t\tLIMIT %d`,\n\t\tfilter,\n\t\tstoreID,\n\t\tescapeString(r.addr.Stream),\n\t\tcap(r.facts),\n\t)\n\n\tstmt, err := db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.stmt = stmt\n\n\treturn nil\n}", "func (lq LoggingQueryable) Prepare(query string) (stmt *sql.Stmt, err error) {\n\tstmt, err = lq.Q.Prepare(query)\n\tlog.Printf(\"SQL: Prepare(%v) -> %v\\n\", query, err)\n\treturn stmt, err\n}", "func (w *Wrapper) prepare(query string) string {\n\tw.connLock.RLock()\n\tdefer w.connLock.RUnlock()\n\n\tswitch w.prepareType {\n\tcase dbUnknown:\n\t\tw.prepareType = examineDB(w.connection)\n\t\tif w.prepareType == dbUnknown {\n\t\t\tpanic(UnknownDatabase)\n\t\t}\n\t\treturn w.prepare(query)\n\tcase dbPostgres:\n\t\treturn query\n\tcase dbMysql:\n\t\treturn postgresRegex.ReplaceAllString(query, \"?\")\n\t}\n\tpanic(\"unreachable\")\n}", "func Prepare(p Preparer, query string) (st *sql.Stmt, err error) {\n\tst, err = p.Prepare(query)\n\terr = interpretError(err)\n\treturn\n}", "func (stmt *PreparedStmt) PrepareStatement(db *sql.DB) error {\n\tvar err error\n\tstmt.NodeStmt, err = PrepareNodeStmt(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstmt.FmediaStmt, err = PrepareFmStmt(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstmt.NLStmt, err = PrepareNLStmt(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstmt.FvStmt, err = PrepareFvStmt(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstmt.ConvStmt, err = PrepareConvStmt(db)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ses *Ses) PrepAndQry(sql string, params ...interface{}) (rset *Rset, err error) {\n\tses.log(_drv.Cfg().Log.Ses.PrepAndQry)\n\terr = ses.checkClosed()\n\tif err != nil {\n\t\treturn nil, errE(err)\n\t}\n\tstmt, err := ses.Prep(sql)\n\tif err != nil {\n\t\tdefer stmt.Close()\n\t\treturn nil, errE(err)\n\t}\n\trset, err = stmt.Qry(params...)\n\tif err != nil {\n\t\tdefer stmt.Close()\n\t\treturn nil, errE(err)\n\t}\n\trset.autoClose = true\n\treturn rset, nil\n}", "func (v *connection) Prepare(query string) (driver.Stmt, error) {\n\treturn v.PrepareContext(context.Background(), query)\n}", "func (c *conn) Prepare(query string) (s driver.Stmt, err error) {\n\treturn c.prepare(context.Background(), query)\n}", "func (t *explainTablet) CommitPrepared(ctx context.Context, target *querypb.Target, dtid string) (err error) {\n\tt.mu.Lock()\n\tt.currentTime = t.vte.batchTime.Wait()\n\tt.mu.Unlock()\n\treturn t.tsv.CommitPrepared(ctx, target, dtid)\n}", "func Prepare() {\n\tsch, e := graphql.NewSchema(*Schema)\n\tif e != nil {\n\t\tlogger.Panic(\"graphql.NewSchema\",\n\t\t\tzap.Error(e),\n\t\t\tzap.Any(\"schema\", Schema),\n\t\t)\n\t}\n\tSchema = nil\n\n\tlogrus.SetLevel(logrus.PanicLevel)\n\tsubManager = gqlsub.NewManager(context.Background(), &sch, subHandlers)\n\thttp.Handle(\"/subscriptions\", graphqlws.NewHandler(graphqlws.HandlerConfig{\n\t\tSubscriptionManager: subManager,\n\t}))\n\n\thttp.Handle(\"/\", handler.New(&handler.Config{\n\t\tSchema: &sch,\n\t\tPretty: true,\n\t\tPlaygroundConfig: handler.NewDefaultPlaygroundConfig(),\n\t}))\n}", "func (db *DB) PrepareAll() (ps []*pgx.PreparedStatement, err error) {\n\tmsg := []string{}\n\tfor name, query := range db.qm {\n\t\tp, e := db.Prepare(name)\n\t\tif e != nil {\n\t\t\tm := []string{\n\t\t\t\t\"Error in preparing statement:\",\n\t\t\t\tname,\n\t\t\t\t\"; With query:\",\n\t\t\t\tquery.sql,\n\t\t\t}\n\t\t\tmsg = append(msg, strings.Join(m, \" \"))\n\t\t} else {\n\t\t\tps = append(ps, p)\n\t\t}\n\t}\n\tif len(msg) > 0 {\n\t\terr = errors.New(strings.Join(msg, \"\\n\"))\n\t}\n\treturn\n}", "func (c *Conn) Prepare(query string) (driver.Stmt, error) {\n\ttransformed, _, err := c.transform(context.Background(), query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.ctxConn.Prepare(transformed)\n}", "func (b *Backend) adjustConnectionPoolParameters() (err error) {\n\t// Get generic \"database/sql\" database handle\n\tsqlDB, err := b.db.DB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get SQL DB handle : %s\", err)\n\t}\n\n\tif b.Config.MaxIdleConns > 0 {\n\t\tsqlDB.SetMaxIdleConns(b.Config.MaxIdleConns)\n\t}\n\n\tif b.Config.MaxOpenConns > 0 {\n\t\t// Need at least a few because of https://github.com/mattn/go-sqlite3/issues/569\n\t\tsqlDB.SetMaxOpenConns(b.Config.MaxOpenConns)\n\t}\n\n\treturn nil\n}", "func SQLHandler(pathUrls []PathURL, fallback http.Handler) (http.HandlerFunc, error) {\n\t// convert pathUrls into a map\n\tpathsToUrls := buildPathsMap(pathUrls)\n\n\t// re-use the MapHandler\n\t// * now return the newly padded pathsToUrls\n\t// * while returning it in a format that makes it look like you were calling MapHandler in the first place\n\treturn MapHandler(pathsToUrls, fallback), nil\n}", "func (s *Msg) Prepare(queryPrepared string) error {\n\ts.QueryPrepared = OrString(queryPrepared, s.QueryPrepared)\n\treturn s.CallDtm(&s.MsgData, \"prepare\")\n}", "func AllowQueries(dbconfig dbconfigs.DBConfig, schemaOverrides []SchemaOverride, qrs *QueryRules) {\n\tdefer logError()\n\tSqlQueryRpcService.allowQueries(dbconfig, schemaOverrides, qrs)\n}", "func (db *DB) PrepareQueries(filePath, bucketName string) error {\n\n\tn1qlFiles, err := walk(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, f := range n1qlFiles {\n\t\tc, err := ioutil.ReadFile(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// substitute the bucket name.\n\t\tquery := string(c)\n\t\tquery = strings.ReplaceAll(query, \"bucket_name\", bucketName)\n\n\t\tname := filepath.Base(f)\n\t\tswitch name {\n\t\tcase \"user-activities.n1ql\":\n\t\t\tdb.N1QLQuery.UserActivities = query\n\t\tcase \"ano-user-activities.n1ql\":\n\t\t\tdb.N1QLQuery.AnoUserActivities = query\n\t\t}\n\t}\n\n\treturn nil\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_GroupInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupMembers_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupMembers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VoteByProposalVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VoteByProposalVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VoteByProposalVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByProposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByProposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByProposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByMember_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_TallyResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Groups_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (this *StmtManager) PrepareOnce(preparer sqlPreparer, querySQL string, parentId int64) (resultStmt *Stmt, wasCached bool, err error) {\n\tvar cacheKey = \"\"\n\tif parentId == 0 {\n\t\tcacheKey = \"0$\" + querySQL\n\t} else {\n\t\tcacheKey = strconv.FormatInt(parentId, 10) + \"$\" + querySQL\n\t}\n\n\t// check if exists\n\tthis.locker.RLock()\n\tstmt, ok := this.stmtMap[cacheKey]\n\tif ok {\n\t\tstmt.accessAt = timestamp\n\t\tthis.locker.RUnlock()\n\t\treturn stmt, true, nil\n\t}\n\tthis.locker.RUnlock()\n\n\tif ShowPreparedStatements {\n\t\tlogs.Println(\"[DB]prepare \" + querySQL)\n\t}\n\n\tsqlStmt, err := preparer.Prepare(querySQL)\n\tif err != nil {\n\t\tif IsPrepareError(err) {\n\t\t\t// purge once\n\t\t\tthis.purge()\n\n\t\t\t// retry\n\t\t\tsqlStmt, err = preparer.Prepare(querySQL)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t}\n\tstmt = NewStmt(sqlStmt)\n\n\tthis.locker.Lock()\n\tdefer this.locker.Unlock()\n\n\t// exists, check again\n\t_, exists := this.stmtMap[cacheKey]\n\tif exists {\n\t\treturn stmt, false, nil\n\t}\n\n\t// should we purge old statements?\n\tif len(this.stmtMap) >= this.maxCount {\n\t\tthis.purge()\n\n\t\t// still full\n\t\tif len(this.stmtMap) >= this.maxCount {\n\t\t\treturn stmt, false, nil\n\t\t}\n\t}\n\n\t// put stmt into cache map\n\tthis.stmtMap[cacheKey] = stmt\n\tif parentId > 0 {\n\t\tthis.subMap[parentId] = append(this.subMap[parentId], cacheKey)\n\t}\n\n\treturn stmt, true, nil\n}", "func (c *sqlmock) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {\n\tex, err := c.prepare(query)\n\tif ex != nil {\n\t\tselect {\n\t\tcase <-time.After(ex.delay):\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &statement{c, ex, query}, nil\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ErrCancelled\n\t\t}\n\t}\n\n\treturn nil, err\n}", "func (c *Conn) Prepare(ctx context.Context, name, sql string) (sd *pgconn.StatementDescription, err error) {\n\tif c.prepareTracer != nil {\n\t\tctx = c.prepareTracer.TracePrepareStart(ctx, c, TracePrepareStartData{Name: name, SQL: sql})\n\t}\n\n\tif name != \"\" {\n\t\tvar ok bool\n\t\tif sd, ok = c.preparedStatements[name]; ok && sd.SQL == sql {\n\t\t\tif c.prepareTracer != nil {\n\t\t\t\tc.prepareTracer.TracePrepareEnd(ctx, c, TracePrepareEndData{AlreadyPrepared: true})\n\t\t\t}\n\t\t\treturn sd, nil\n\t\t}\n\t}\n\n\tif c.prepareTracer != nil {\n\t\tdefer func() {\n\t\t\tc.prepareTracer.TracePrepareEnd(ctx, c, TracePrepareEndData{Err: err})\n\t\t}()\n\t}\n\n\tsd, err = c.pgConn.Prepare(ctx, name, sql, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif name != \"\" {\n\t\tc.preparedStatements[name] = sd\n\t}\n\n\treturn sd, nil\n}", "func (c *authenticatedConnection) prepare(ctx context.Context) error {\n\tc.prepareMutex.Lock()\n\tdefer c.prepareMutex.Unlock()\n\tif c.prepared == 0 {\n\t\t// We need to prepare first\n\t\tif err := c.auth.Prepare(ctx, c.conn); err != nil {\n\t\t\t// Authentication failed\n\t\t\treturn driver.WithStack(err)\n\t\t}\n\t\t// We're now prepared\n\t\tatomic.StoreInt32(&c.prepared, 1)\n\t} else {\n\t\t// We're already prepared, do nothing\n\t}\n\treturn nil\n}", "func (c *conn) Prepare(query string) (driver.Stmt, error) {\n\treturn c.prepare(query)\n}", "func (mc *MysqlConn) handleParams() (err error) {\n\tfor param, val := range mc.cfg.Params {\n\t\tswitch param {\n\t\t// Charset\n\t\tcase \"charset\":\n\t\t\tcharsets := strings.Split(val, \",\")\n\t\t\tfor i := range charsets {\n\t\t\t\t// ignore errors here - a charset may not exist\n\t\t\t\terr = mc.exec(\"SET NAMES \" + charsets[i])\n\t\t\t\tif err == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t// System Vars\n\t\tdefault:\n\t\t\terr = mc.exec(\"SET \" + param + \"=\" + val + \"\")\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "func (ses *Ses) PrepAndExeP(sql string, params ...interface{}) (rowsAffected uint64, err error) {\n\treturn ses.prepAndExe(sql, true, params...)\n}", "func (s *Server) sqlHandler(w http.ResponseWriter, req *http.Request) {\n\tstate := s.cluster.State()\n\tif state != \"primary\" {\n\t\thttp.Error(w, \"Only the primary can service queries, but this is a \"+state, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tquery, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't read body: %s\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tlog.Debugf(\"[%s] Received query: %#v\", s.cluster.State(), string(query))\n\tresp, err := s.execute(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tr := &Replicate{\n\t\tSelf: s.cluster.self,\n\t\tQuery: query,\n\t}\n\tfor _, member := range s.cluster.members {\n\t\tb := util.JSONEncode(r)\n\t\t_, err := s.client.SafePost(member.ConnectionString, \"/replicate\", b)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Couldn't replicate query to %v: %s\", member, err)\n\t\t}\n\t}\n\n\tlog.Debugf(\"[%s] Returning response to %#v: %#v\", s.cluster.State(), string(query), string(resp))\n\tw.Write(resp)\n}", "func setQueryOptions(c *clients.Client, optionsName string, options handle.Handle, response handle.ResponseHandle) error {\n\treq, err := util.BuildRequestFromHandle(c, \"PUT\", \"/config/query/\"+optionsName, options)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn util.Execute(c, req, response)\n}", "func (db *DB) PrepareQuery(ctx context.Context, query SQLQuery) (*sql.Stmt, error) {\n\tif err := query.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.getReplica().PrepareContext(ctx, query.String())\n}", "func (tr *SQLDatabase) SetParameters(params map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Spec.ForProvider)\n}", "func (statement *CreateIndexStatement) Prepare() *PreparedStatement {\n\treturn &PreparedStatement{\n\t\tconnection: statement.connection,\n\t\tcommand: statement.buildCommandText()}\n}", "func (tr *SQLStoredProcedure) SetParameters(params map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Spec.ForProvider)\n}", "func (c *Conn) Prepare(query string) (driver.Stmt, error) {\n\treturn c.PrepareContext(context.Background(), query)\n}", "func (db *DB) Prepare(query string) (*sql.Stmt, error) {\n\treturn db.master.Prepare(query)\n}", "func (sd *SelectDataset) Prepared(prepared bool) *SelectDataset {\n\tret := sd.copy(sd.clauses)\n\tret.isPrepared = prepared\n\treturn ret\n}", "func (c *Column) prepareSQLStatement(step int, tableName string, columnPresent bool) (string, error) {\n\tlog.Debugln(\"Executing \", c.Name, \" with step --> \", step)\n\tvar statement string\n\tif step == 1 {\n\t\t// This is the step where the column is added without a default value\n\t\t// statement = \"ALTER TABLE %s ADD %s %s\"%(table_name, self.column_name, self.datatype)\n\t\tstatement = fmt.Sprintf(\"ALTER TABLE %s ADD %s %s\", tableName, c.Name, c.Datatype)\n\t} else if step == 2 {\n\t\t// This is the step where a default value is set for the column\n\t\t// statement = cursor.mogrify(\"ALTER TABLE %(table)s ALTER COLUMN %(column)s SET DEFAULT %(value)s\", {\"table\" : AsIs(table_name), \"column\" : AsIs(self.column_name), \"value\" : AsIs(self.default_value)})\n\t\tif c.DefaultExists {\n\t\t\tstatement = fmt.Sprintf(\"ALTER TABLE %s ALTER COLUMN %s SET DEFAULT %s\", tableName, c.Name, c.DefaultValue)\n\t\t}\n\t} else if step == 3 {\n\t\t// This is the step where the default value is updated for all the existing rows\n\t\t// statement = cursor.mogrify(\"UPDATE %(table)s SET %(column)s = %(value)s\", {\"table\" : AsIs(table_name), \"column\" : AsIs(self.column_name), \"value\" : AsIs(self.default_value)})\n\t\tif c.DefaultExists && !columnPresent {\n\t\t\tstatement = fmt.Sprintf(\"UPDATE %s SET %s = %s\", tableName, c.Name, c.DefaultValue)\n\t\t}\n\t} else if step == 4 {\n\t\t// This is the step where the sequence is altered, in case sequence_restart is > 0 and datatype is either bigserial or serial\n\t\t// statement = cursor.mogrify(\"ALTER SEQUENCE %(sequence_name)s RESTART WITH %(value)s\", {\"sequence_name\" : AsIs(sequence_name), \"value\" : self.sequence_restart})\n\t\tif strings.Contains(c.Datatype, \"serial\") {\n\t\t\tstatement = fmt.Sprintf(\"ALTER SEQUENCE %s RESTART WITH %d\", tableName+\"_\"+c.Name+\"_seq\", c.SequenceRestart)\n\t\t}\n\t} else if step == 5 {\n\t\t// This is the step where a unique constraint is added, in case the column in unique\n\t\tif c.IsUnique {\n\t\t\t// statement = \"ALTER TABLE %s ADD UNIQUE (%s)\"%(table_name, self.column_name)\n\t\t\tconstraint := Constraint{Name: fmt.Sprintf(\"%s_%s_unique\", tableName, c.Name), Value: fmt.Sprintf(\"UNIQUE (%s)\", c.Name)}\n\t\t\tstatement = fmt.Sprintf(\"%s; %s\", constraint.createDropRule(tableName), constraint.createAddRule(tableName))\n\t\t\t// statement = fmt.Sprintf(\"ALTER TABLE %s ADD UNIQUE (%s)\", tableName, c.Name)\n\t\t}\n\t} else if step == 6 {\n\t\t// This is the step where a primary key constraint is added, in case the column is a primary key\n\t\tif c.IsPrimary {\n\t\t\t// statement = \"ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY(%s)\"%(table_name, table_name + \"_\" +self.column_name, self.column_name)\n\t\t\tstatement = fmt.Sprintf(\"ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY(%s)\", tableName, tableName+\"_\"+c.Name, c.Name)\n\t\t}\n\t} else if step == 7 {\n\t\t// This is the step where NOT NULL is applied to a particular column\n\t\tif c.IsNotNull {\n\t\t\t// statement = \"ALTER TABLE %s ALTER COLUMN %s SET NOT NULL\"%(table_name, self.column_name)\n\t\t\tstatement = fmt.Sprintf(\"ALTER TABLE %s ALTER COLUMN %s SET NOT NULL\", tableName, c.Name)\n\t\t}\n\t} else if step == 8 {\n\t\t// This is the step where the index is created on this column\n\t\tif c.IndexRequired {\n\t\t\tif len(c.IndexType) > 0 {\n\t\t\t\tstatement = fmt.Sprintf(\"CREATE INDEX IF NOT EXISTS %s_%s_index ON %s USING %s(%s)\", tableName, c.Name, tableName, c.IndexType, c.Name)\n\t\t\t} else {\n\t\t\t\tstatement = fmt.Sprintf(\"CREATE INDEX IF NOT EXISTS %s_%s_index ON %s (%s)\", tableName, c.Name, tableName, c.Name)\n\t\t\t}\n\t\t}\n\t} else if step == 101 {\n\t\t// This is the step where the column's datatype is altered\n\t\tif strings.Contains(c.Datatype, \"serial\") {\n\t\t\terrorStatement := fmt.Sprintf(\"Can't modify datatype to SERIAL versions, while modifying \\nTable --> %s \\nColumn --> %s \\nDatatype --> %s\", tableName, c.Name, c.Datatype)\n\t\t\terr := errors.New(errorStatement)\n\t\t\treturn \"\", err\n\t\t}\n\t\t// statement = \"ALTER TABLE %s ALTER COLUMN %s TYPE %s USING %s::%s\"%(table_name, self.column_name, self.datatype, self.column_name, altered_datatype)\n\t\tstatement = fmt.Sprintf(\"ALTER TABLE %s ALTER COLUMN %s TYPE %s USING %s::%s\", tableName, c.Name, c.Datatype, c.Name, c.Datatype)\n\t}\n\n\tlog.Debugln(\"In prepareSQLStatement, statement is \\n\", statement)\n\treturn statement, nil\n}", "func (v *connection) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {\n\n\ts, err := newStmt(v, query)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif v.usePreparedStmts {\n\t\tif err = s.prepareAndDescribe(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn s, nil\n}", "func (e *Msg) acceptsPreparedSet() BallotSet {\n\tvar result BallotSet\n\tf := func(topic *PrepTopic) {\n\t\tif !topic.P.IsZero() {\n\t\t\tresult = result.Add(topic.P)\n\t\t\tif !topic.PP.IsZero() {\n\t\t\t\tresult = result.Add(topic.PP)\n\t\t\t}\n\t\t}\n\t\tif topic.HN > 0 {\n\t\t\tresult = result.Add(Ballot{N: topic.HN, X: topic.B.X})\n\t\t}\n\t}\n\tswitch topic := e.T.(type) {\n\tcase *NomPrepTopic:\n\t\tf(&topic.PrepTopic)\n\n\tcase *PrepTopic:\n\t\tf(topic)\n\n\tcase *CommitTopic:\n\t\tresult = result.Add(Ballot{N: topic.PN, X: topic.B.X})\n\t\tresult = result.Add(Ballot{N: topic.HN, X: topic.B.X})\n\n\tcase *ExtTopic:\n\t\tresult = result.Add(Ballot{N: math.MaxInt32, X: topic.C.X})\n\t}\n\treturn result\n}", "func (h *httpConnect) prepareBatch(ctx context.Context, query string, opts driver.PrepareBatchOptions, release func(*connect, error), acquire func(context.Context) (*connect, error)) (driver.Batch, error) {\n\tmatches := httpInsertRe.FindStringSubmatch(query)\n\tif len(matches) < 3 {\n\t\treturn nil, errors.New(\"cannot get table name from query\")\n\t}\n\ttableName := matches[1]\n\tvar rColumns []string\n\tif matches[2] != \"\" {\n\t\tcolMatch := strings.TrimSuffix(strings.TrimPrefix(matches[2], \"(\"), \")\")\n\t\trColumns = strings.Split(colMatch, \",\")\n\t\tfor i := range rColumns {\n\t\t\trColumns[i] = strings.TrimSpace(rColumns[i])\n\t\t}\n\t}\n\tquery = \"INSERT INTO \" + tableName + \" FORMAT Native\"\n\tqueryTableSchema := \"DESCRIBE TABLE \" + tableName\n\tr, err := h.query(ctx, release, queryTableSchema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblock := &proto.Block{}\n\n\t// get Table columns and types\n\tcolumns := make(map[string]string)\n\tvar colNames []string\n\tfor r.Next() {\n\t\tvar (\n\t\t\tcolName string\n\t\t\tcolType string\n\t\t\tignore string\n\t\t)\n\n\t\tif err = r.Scan(&colName, &colType, &ignore, &ignore, &ignore, &ignore, &ignore); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcolNames = append(colNames, colName)\n\t\tcolumns[colName] = colType\n\t}\n\n\tswitch len(rColumns) {\n\tcase 0:\n\t\tfor _, colName := range colNames {\n\t\t\tif err = block.AddColumn(colName, column.Type(columns[colName])); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t// user has requested specific columns so only include these\n\t\tfor _, colName := range rColumns {\n\t\t\tif colType, ok := columns[colName]; ok {\n\t\t\t\tif err = block.AddColumn(colName, column.Type(colType)); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"column %s is not present in the table %s\", colName, tableName)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &httpBatch{\n\t\tctx: ctx,\n\t\tconn: h,\n\t\tstructMap: &structMap{},\n\t\tblock: block,\n\t\tquery: query,\n\t}, nil\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_PendingRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_PendingRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_PendingRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastFinalizedRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_LastFinalizedRound_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastFinalizedRound_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Round_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Round_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Round_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllClaims_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllClaims_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllClaims_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Claim_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Claim_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryDelegeateAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryDelegeateAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryDelegeateAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryValidatorAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryValidatorAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryValidatorAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func testPreparedStmt(t *testing.T) {\n\tdb.tearDown()\n\tdb.mustExec(\"CREATE TABLE t (count INT)\")\n\tsel, err := db.Prepare(\"SELECT count FROM t ORDER BY count DESC\")\n\tif err != nil {\n\t\tt.Fatalf(\"prepare 1: %v\", err)\n\t}\n\tins, err := db.Prepare(db.q(\"INSERT INTO t (count) VALUES (?)\"))\n\tif err != nil {\n\t\tt.Fatalf(\"prepare 2: %v\", err)\n\t}\n\n\tfor n := 1; n <= 3; n++ {\n\t\tif _, err := ins.Exec(n); err != nil {\n\t\t\tt.Fatalf(\"insert(%d) = %v\", n, err)\n\t\t}\n\t}\n\n\tconst nRuns = 10\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < nRuns; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor j := 0; j < 10; j++ {\n\t\t\t\tcount := 0\n\t\t\t\tif err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {\n\t\t\t\t\tt.Errorf(\"Query: %v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif _, err := ins.Exec(rand.Intn(100)); err != nil {\n\t\t\t\t\tt.Errorf(\"Insert: %v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n}", "func (m *MockSession) ExecutePreparedStmt(ctx context.Context, stmtID uint32, param []types.Datum) (sqlexec.RecordSet, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ExecutePreparedStmt\", ctx, stmtID, param)\n\tret0, _ := ret[0].(sqlexec.RecordSet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (db *BotDB) Prepare(s string) (*sql.Stmt, error) {\n\tstatement, err := db.db.Prepare(s)\n\tif err != nil {\n\t\tfmt.Println(\"Preparing: \", s, \"\\nSQL Error: \", err.Error())\n\t}\n\treturn statement, err\n}", "func (tr *SQLContainer) SetParameters(params map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Spec.ForProvider)\n}", "func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) {\n\t// Management tokens can see everything with no filtering.\n\tif f.authorizer.ACLWrite() {\n\t\treturn\n\t}\n\n\t// Otherwise, we need to see what the token has access to.\n\tret := make(structs.PreparedQueries, 0, len(*queries))\n\tfor _, query := range *queries {\n\t\t// If no prefix ACL applies to this query then filter it, since\n\t\t// we know at this point the user doesn't have a management\n\t\t// token, otherwise see what the policy says.\n\t\tprefix, ok := query.GetACLPrefix()\n\t\tif !ok || !f.authorizer.PreparedQueryRead(prefix) {\n\t\t\tf.logger.Printf(\"[DEBUG] consul: dropping prepared query %q from result due to ACLs\", query.ID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Redact any tokens if necessary. We make a copy of just the\n\t\t// pointer so we don't mess with the caller's slice.\n\t\tfinal := query\n\t\tf.redactPreparedQueryTokens(&final)\n\t\tret = append(ret, final)\n\t}\n\t*queries = ret\n}", "func SetConnectionPoolParams(size, overflow int) {\n\n\tif size > 0 {\n\t\tPoolSize = size\n\t}\n\n\tif overflow > 0 {\n\t\tPoolOverflow = overflow\n\t}\n}", "func statementCtx(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstID := chi.URLParam(r, \"stID\")\n\t\tvar stmt model.Statement\n\t\terr := driver.DoOne(&stmt, stID, driver.GetOne)\n\t\tif err != nil {\n\t\t\thttp.Error(w, http.StatusText(404), 404)\n\t\t\treturn\n\t\t}\n\t\tctx := context.WithValue(r.Context(), statementContext, &stmt)\n\t\tlog.Printf(\"Data from DB: %+v with ID: %v\", stmt, stID)\n\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func (db *DB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {\n\treturn db.master.PrepareContext(ctx, query)\n}", "func setSafeSession(conn *sql.DB) {\n\tfor _, query := range []string{StatementTimeoutQuery, LockTimeoutQuery, DeadlockTimeoutQuery, LogMinDurationQuery} {\n\t\t_, err := conn.Exec(query)\n\t\t// Trying to SET superuser-only parameters without SUPERUSER privileges will lead to error, but it's not critical.\n\t\t// Notice about occurred error, clear it and go ahead.\n\t\tif err, ok := err.(*pq.Error); ok {\n\t\t\tfmt.Printf(\"%s: %s\\nSTATEMENT: %s\\n\", err.Severity, err.Message, query)\n\t\t}\n\t\t//err = nil\n\t}\n}", "func (c *ConnWrapper) Prepare(query string) (driver.Stmt, error) {\n\tstmt, err := c.Conn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn StmtWrapper{Stmt: stmt, ctx: emptyCtx, query: query, dsn: c.dsn, integration: c.integration}, nil\n}", "func prepareQuery(data types.DataGet, queryArgs *[]interface{}, queryCountArgs *[]interface{},\n\tloginId int64, nestingLevel int) (string, string, error) {\n\n\t// check for authorized access, READ(1) for GET\n\tfor _, expr := range data.Expressions {\n\t\tif expr.AttributeId.Status == pgtype.Present && !authorizedAttribute(loginId, expr.AttributeId.Bytes, 1) {\n\t\t\treturn \"\", \"\", errors.New(handler.ErrUnauthorized)\n\t\t}\n\t}\n\n\tvar (\n\t\tinSelect []string // select expressions\n\t\tinJoin []string // relation joins\n\t\tmapIndex_relId = make(map[int]uuid.UUID) // map of all relations by index\n\t)\n\n\t// check source relation and module\n\trel, exists := cache.RelationIdMap[data.RelationId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t}\n\n\tmod, exists := cache.ModuleIdMap[rel.ModuleId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"module does not exist\")\n\t}\n\n\t// JOIN relations connected via relationship attributes\n\tmapIndex_relId[data.IndexSource] = data.RelationId\n\tfor _, join := range data.Joins {\n\t\tif join.IndexFrom == -1 { // source relation need not be joined\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := joinRelation(mapIndex_relId, join, &inJoin, nestingLevel); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\t// define relation code for source relation\n\t// source relation might have index != 0 (for GET from joined relation)\n\trelCode := getRelationCode(data.IndexSource, nestingLevel)\n\n\t// build WHERE lines\n\t// before SELECT expressions because these are excluded from count query\n\t// SQL arguments are numbered ($1, $2, ...) with no way to skip any (? placeholder is not allowed);\n\t// excluded sub queries arguments from SELECT expressions causes missing argument numbers\n\tqueryWhere := \"\"\n\tif err := buildWhere(data.Filters, queryArgs, queryCountArgs, loginId,\n\t\tnestingLevel, &queryWhere); err != nil {\n\n\t\treturn \"\", \"\", err\n\t}\n\n\t// process SELECT expressions\n\tmapIndex_agg := make(map[int]bool) // map of indexes with aggregation\n\tmapIndex_aggRecords := make(map[int]bool) // map of indexes with record aggregation\n\tfor pos, expr := range data.Expressions {\n\n\t\t// non-attribute expression\n\t\tif expr.AttributeId.Status != pgtype.Present {\n\n\t\t\t// in expressions of main query, disable SQL arguments for count query\n\t\t\t// count query has no sub queries with arguments and only 1 expression: COUNT(*)\n\t\t\tqueryCountArgsOptional := queryCountArgs\n\t\t\tif nestingLevel == 0 {\n\t\t\t\tqueryCountArgsOptional = nil\n\t\t\t}\n\n\t\t\tsubQuery, _, err := prepareQuery(expr.Query, queryArgs,\n\t\t\t\tqueryCountArgsOptional, loginId, nestingLevel+1)\n\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", \"\", err\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(\"(\\n%s\\n) AS %s\",\n\t\t\t\tsubQuery, getExpressionCodeSelect(pos)))\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// attribute expression\n\t\tif err := selectAttribute(pos, expr, mapIndex_relId, &inSelect,\n\t\t\tnestingLevel); err != nil {\n\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif expr.Aggregator.Status == pgtype.Present {\n\t\t\tmapIndex_agg[expr.Index] = true\n\t\t}\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\tmapIndex_aggRecords[expr.Index] = true\n\t\t}\n\t}\n\n\t// SELECT relation tupel IDs after attributes on main query\n\tif nestingLevel == 0 {\n\t\tfor index, relId := range mapIndex_relId {\n\n\t\t\t// if an aggregation function is used on any index, we cannot deliver record IDs\n\t\t\t// unless a record aggregation functions is used on this specific relation index\n\t\t\t_, recordAggExists := mapIndex_aggRecords[index]\n\t\t\tif len(mapIndex_agg) != 0 && !recordAggExists {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif _, exists := cache.RelationIdMap[relId]; !exists {\n\t\t\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(`\"%s\".\"id\" AS %s`,\n\t\t\t\tgetRelationCode(index, nestingLevel),\n\t\t\t\tgetTupelIdCode(index, nestingLevel)))\n\t\t}\n\t}\n\n\t// build GROUP BY line\n\tqueryGroup := \"\"\n\tgroupByItems := make([]string, 0)\n\tfor i, expr := range data.Expressions {\n\n\t\tif expr.AttributeId.Status != pgtype.Present || (!expr.GroupBy && expr.Aggregator.Status != pgtype.Present) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// group by record ID if record must be kept during aggregation\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\trelId := getTupelIdCode(expr.Index, nestingLevel)\n\n\t\t\tif !tools.StringInSlice(relId, groupByItems) {\n\t\t\t\tgroupByItems = append(groupByItems, relId)\n\t\t\t}\n\t\t}\n\n\t\t// group by requested attribute\n\t\tif expr.GroupBy {\n\t\t\tgroupByItems = append(groupByItems, getExpressionCodeSelect(i))\n\t\t}\n\t}\n\tif len(groupByItems) != 0 {\n\t\tqueryGroup = fmt.Sprintf(\"\\nGROUP BY %s\", strings.Join(groupByItems, \", \"))\n\t}\n\n\t// build ORDER BY, LIMIT, OFFSET lines\n\tqueryOrder, queryLimit, queryOffset := \"\", \"\", \"\"\n\tif err := buildOrderLimitOffset(data, nestingLevel, &queryOrder, &queryLimit, &queryOffset); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// build data query\n\tquery := fmt.Sprintf(\n\t\t`SELECT %s`+\"\\n\"+\n\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s%s%s%s%s`,\n\t\tstrings.Join(inSelect, `, `), // SELECT\n\t\tmod.Name, rel.Name, relCode, // FROM\n\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\tqueryWhere, // WHERE\n\t\tqueryGroup, // GROUP BY\n\t\tqueryOrder, // ORDER BY\n\t\tqueryLimit, // LIMIT\n\t\tqueryOffset) // OFFSET\n\n\t// build totals query (not relevant for sub queries)\n\tqueryCount := \"\"\n\tif nestingLevel == 0 {\n\n\t\t// distinct to keep count for source relation records correct independent of joins\n\t\tqueryCount = fmt.Sprintf(\n\t\t\t`SELECT COUNT(DISTINCT \"%s\".\"%s\")`+\"\\n\"+\n\t\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s`,\n\t\t\tgetRelationCode(data.IndexSource, nestingLevel), lookups.PkName, // SELECT\n\t\t\tmod.Name, rel.Name, relCode, // FROM\n\t\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\t\tqueryWhere) // WHERE\n\n\t}\n\n\t// add intendation for nested sub queries\n\tif nestingLevel != 0 {\n\t\tindent := strings.Repeat(\"\\t\", nestingLevel)\n\t\tquery = indent + regexp.MustCompile(`\\r?\\n`).ReplaceAllString(query, \"\\n\"+indent)\n\t}\n\treturn query, queryCount, nil\n}", "func (s *Server) Set(_ context.Context, request *rpcLimit.SetLimitsRequest) (*rpcLimit.SetLimitsResponse, error) {\n\ttx := s.db.Begin()\n\tsrv := s.limitService.WrapContext(tx)\n\n\tfor _, data := range request.Limits {\n\t\tval, err := requestLimitToValue(data.Limit)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\t\tid := requestIdToLimitId(data.LimitId)\n\t\tif !id.IsUnique() {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, limit.ErrIdIncomplete\n\t\t}\n\t\t_, err = srv.FindOne(id)\n\t\t// create new if not found\n\t\tif errors.Cause(err) == limit.ErrNotFound {\n\t\t\terr = srv.Create(val, id)\n\t\t\tif err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\terr = srv.UpdateOne(val, id)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\ttx.Commit()\n\treturn &rpcLimit.SetLimitsResponse{}, nil\n}", "func (db *DB) Prepare(query string) (Stmt, error) {\n\tstmts := make([]*sql.Stmt, len(db.cpdbs))\n\n\terr := scatter(len(db.cpdbs), func(i int) (err error) {\n\t\tstmts[i], err = db.cpdbs[i].db.Prepare(query)\n\t\treturn errors.WithStack(err)\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &stmt{db: db, stmts: stmts}, nil\n}", "func (db *TestDB) Prepare(query string) (gorpish.IStmt, error) {\n\targs := db.Called(query)\n\treturn args.Get(0).(gorpish.IStmt), args.Error(1)\n}", "func preparex(conn *db, stmt Stmt) (*sqlx.Stmt, error) {\n\tif conn.tx != nil {\n\t\treturn conn.tx.Preparex(stmt.String())\n\t}\n\n\treturn (*conn.dbx).Preparex(stmt.String())\n}", "func (ses *Ses) Prep(sql string, gcts ...GoColumnType) (stmt *Stmt, err error) {\n\tif ses == nil {\n\t\treturn nil, er(\"ses may not be nil.\")\n\t}\n\tdefer func() {\n\t\tif value := recover(); value != nil {\n\t\t\terr = errR(value)\n\t\t}\n\t}()\n\tses.log(_drv.Cfg().Log.Ses.Prep, sql)\n\terr = ses.checkClosed()\n\tif err != nil {\n\t\treturn nil, errE(err)\n\t}\n\tocistmt := (*C.OCIStmt)(nil)\n\tcSql := C.CString(sql) // prepare sql text with statement handle\n\tses.RLock()\n\tenv := ses.Env()\n\tr := C.OCIStmtPrepare2(\n\t\tses.ocisvcctx, // OCISvcCtx *svchp,\n\t\t&ocistmt, // OCIStmt *stmtp,\n\t\tenv.ocierr, // OCIError *errhp,\n\t\t(*C.OraText)(unsafe.Pointer(cSql)), // const OraText *stmt,\n\t\tC.ub4(len(sql)), // ub4 stmt_len,\n\t\tnil, // const OraText *key,\n\t\tC.ub4(0), // ub4 keylen,\n\t\tC.OCI_NTV_SYNTAX, // ub4 language,\n\t\tC.OCI_DEFAULT) // ub4 mode );\n\tses.RUnlock()\n\tC.free(unsafe.Pointer(cSql))\n\tif r == C.OCI_ERROR {\n\t\treturn nil, errE(env.ociError())\n\t}\n\t// set stmt struct\n\tstmt = _drv.stmtPool.Get().(*Stmt)\n\tstmtCfg := ses.Cfg().StmtCfg\n\tstmt.SetCfg(StmtCfg{}) // reset - always inherit from ses.Cfg().\n\tstmt.cmu.Lock()\n\tdefer stmt.cmu.Unlock()\n\tstmt.Lock()\n\tstmt.ocistmt = (*C.OCIStmt)(ocistmt)\n\tses.RLock()\n\tstmt.env.Store(env)\n\tstmt.ses = ses\n\tif ses.srv.IsUTF8() && stmtCfg.stringPtrBufferSize > 1000 {\n\t\tstmt.stringPtrBufferSize = 1000\n\t}\n\tses.RUnlock()\n\tstmt.sql = sql\n\tstmt.gcts = gcts\n\tif stmt.id == 0 {\n\t\tstmt.id = _drv.stmtId.nextId()\n\t}\n\tstmt.Unlock()\n\tst, err := stmt.attr(2, C.OCI_ATTR_STMT_TYPE) // determine statement type\n\tif err != nil {\n\t\treturn nil, errE(err)\n\t}\n\tstmt.Lock()\n\tstmt.stmtType = *((*C.ub2)(st))\n\tstmt.Unlock()\n\n\tC.free(unsafe.Pointer(st))\n\tses.openStmts.add(stmt)\n\n\t//ses.logF(true, \"\\n ses.cfg=%#v\\nstmt.cfg=%#v\", ses.Cfg().StmtCfg, stmt.Cfg())\n\n\treturn stmt, nil\n}", "func (database *Database) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {\n\treturn database.db.PrepareContext(ctx, query)\n}", "func (r *QueryRequest) isPrepared() bool {\n\treturn r.PreparedStatement != nil\n}", "func (ctx *HijackRequest) SetQuery(pairs ...interface{}) *HijackRequest {\n\tctx.req.Query(pairs...)\n\treturn ctx\n}", "func (db *DB) initMysqlStmts() error {\n\tvar err error\n\tdb.levelJobsStmt, err = db.DB.Prepare(\"SELECT Level,RealEndTime,JobBytes FROM Job WHERE ClientID=? AND Level=? ORDER BY RealEndTime\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb.clientsStmt, err = db.DB.Prepare(\"SELECT ClientID, Name from Client\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func SetHandlers(s *http.ServeMux) {\n\tnotificationRequestPool = &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\treturn new(sendManyRequest)\n\t\t},\n\t}\n\ts.HandleFunc(\"/json\", jsonHandler)\n\ts.HandleFunc(\"/send\", sendHandler)\n\ts.HandleFunc(\"/sendMany\", sendManyHandler)\n\ts.HandleFunc(\"/home\", homeHandler)\n\n}", "func (h *Handler) serveQuery(w http.ResponseWriter, r *http.Request) {\n\t// TODO: Authentication.\n\n\t// Parse query from query string.\n\tvalues := r.URL.Query()\n\tqueries, err := parser.ParseQuery(values.Get(\"q\"))\n\tif err != nil {\n\t\th.error(w, \"parse error: \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Retrieve database from server.\n\tdb := h.server.Database(values.Get(\":db\"))\n\tif db == nil {\n\t\th.error(w, ErrDatabaseNotFound.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Parse the time precision from the query params.\n\tprecision, err := parseTimePrecision(values.Get(\"time_precision\"))\n\tif err != nil {\n\t\th.error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Create processor for writing data out.\n\tvar p engine.Processor\n\tif r.URL.Query().Get(\"chunked\") == \"true\" {\n\t\tp = &chunkWriterProcessor{w, precision, false, (values.Get(\"pretty\") == \"true\")}\n\t} else {\n\t\tp = &pointsWriterProcessor{make(map[string]*protocol.Series), w, precision, (values.Get(\"pretty\") == \"true\")}\n\t}\n\n\t// Execute query against the database.\n\tfor _, q := range queries {\n\t\tif err := db.ExecuteQuery(nil, q, p); err != nil {\n\t\t\th.error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Mark processor as complete. Print error, if applicable.\n\tif err := p.Close(); err != nil {\n\t\th.error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func (c *Conn) Prepare(query string) (driver.Stmt, error) {\n\tstmt, err := parse(query)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse: %w\", err)\n\t}\n\treturn stmt, nil\n}", "func (tr *SQLFunction) SetParameters(params map[string]interface{}) error {\n\tp, err := json.TFParser.Marshal(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.TFParser.Unmarshal(p, &tr.Spec.ForProvider)\n}", "func (db *DB) PrepareQueryForMaster(ctx context.Context, query SQLQuery) (*sql.Stmt, error) {\n\tif err := query.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.master.PrepareContext(ctx, query.String())\n}", "func (database *Database) Prepare(query string) (*sql.Stmt, error) {\n\treturn database.PrepareContext(context.Background(), query)\n}", "func (con *dbAccess) prepareDatabase() {\n\tcon.createCommandListTable()\n\tcon.createAmharicWordsTable()\n\tcon.truncateCommandListTable()\n\tcon.truncateAmharicWordsTable()\n\tcon.insertCommandList()\n\tcon.insertAmharicWords()\n\n}" ]
[ "0.6229541", "0.5962847", "0.58610016", "0.58486795", "0.5682206", "0.5546938", "0.54039687", "0.53830296", "0.5369521", "0.53393453", "0.5308527", "0.53072625", "0.5303313", "0.53032124", "0.5291541", "0.52078277", "0.5170898", "0.5154273", "0.5126583", "0.5117485", "0.5011228", "0.49935886", "0.49859756", "0.49806878", "0.49686506", "0.495755", "0.49425718", "0.49289593", "0.492809", "0.49221915", "0.49199042", "0.49064475", "0.48766232", "0.48733684", "0.48570403", "0.48411626", "0.4819197", "0.48029348", "0.478202", "0.47776806", "0.4751469", "0.4748968", "0.47463548", "0.47365907", "0.47148615", "0.47045782", "0.467326", "0.46716666", "0.4670866", "0.46516716", "0.46480593", "0.46463668", "0.46449533", "0.46444494", "0.46403822", "0.4629568", "0.46177498", "0.4615879", "0.46034235", "0.4588878", "0.45865613", "0.45788312", "0.45730934", "0.45421833", "0.45297518", "0.45191434", "0.45080596", "0.45068845", "0.4505096", "0.4505084", "0.45000815", "0.449585", "0.4489944", "0.44895992", "0.4484586", "0.4481478", "0.44781736", "0.44764906", "0.44739658", "0.44630906", "0.44583175", "0.44534057", "0.4451656", "0.44271398", "0.4422736", "0.44214287", "0.44180545", "0.4414473", "0.4414019", "0.44017184", "0.43958712", "0.4395038", "0.43898293", "0.43765607", "0.43709686", "0.43613634", "0.4358657", "0.4358343", "0.43436068", "0.43324414" ]
0.81889164
0
HandleRemovePreparedQueries is an endpoint handler which removes database PreparedQueries
func HandleRemovePreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { defer utils.CloseTheCloser(r.Body) // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusUnauthorized) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] project := vars["project"] id := vars["id"] if err := syncman.RemovePreparedQueries(ctx, project, dbAlias, id); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusInternalServerError) _ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()}) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) // http status codee _ = json.NewEncoder(w).Encode(map[string]interface{}{}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleSetPreparedQueries(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.PreparedQuery{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tproject := vars[\"project\"]\n\t\tid := vars[\"id\"]\n\n\t\tif err := syncman.SetPreparedQueries(ctx, project, dbAlias, id, &v); err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK) // http status codee\n\t\t_ = json.NewEncoder(w).Encode(map[string]interface{}{})\n\t}\n}", "func (s *HTTPServer) preparedQueryDelete(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryRequest{\n\t\tOp: structs.PreparedQueryDelete,\n\t\tQuery: &structs.PreparedQuery{\n\t\t\tID: id,\n\t\t},\n\t}\n\ts.parseDC(req, &args.Datacenter)\n\ts.parseToken(req, &args.Token)\n\n\tvar reply string\n\tif err := s.agent.RPC(\"PreparedQuery.Apply\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "func (h ProxyHandler) HandleStmtPrepare(query string) (int, int, interface{}, error) {\n\tfmt.Println(\"prep: \", query)\n\treturn 0, 0, nil, fmt.Errorf(\"not supported now\")\n}", "func HandleRemove(pattern string) { DefaultServeMux.HandleRemove(pattern) }", "func HandleRemoveDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.RemoveDatabaseConfig(ctx, projectID, dbAlias); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func HandleGetPreparedQuery(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_ = json.NewEncoder(w).Encode(map[string]string{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tidQuery, exists := r.URL.Query()[\"id\"]\n\t\tid := \"\"\n\t\tif exists {\n\t\t\tid = idQuery[0]\n\t\t}\n\t\tresult, err := syncMan.GetPreparedQuery(ctx, projectID, dbAlias, id)\n\t\tif err != nil {\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\": err.Error()})\n\t\t\treturn\n\t\t}\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}", "func (c *Cursor) HandleStmtPrepare(query string) (params int, columns int, context interface{}, err error) {\n\t// TODO(xq26144), not implemented\n\t// According to the libmysql standard: https://github.com/mysql/mysql-server/blob/8.0/libmysql/libmysql.cc#L1599\n\t// the COM_STMT_PREPARE should return the correct bind parameter count (which can be implemented by newly created parser)\n\t// and should return the correct number of return fields (which can not be implemented right now with new query plan logic embedded)\n\n\terr = my.NewError(my.ER_NOT_SUPPORTED_YET, \"stmt prepare is not supported yet\")\n\treturn\n}", "func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) {\n\t// Management tokens can see everything with no filtering.\n\tif f.authorizer.ACLWrite() {\n\t\treturn\n\t}\n\n\t// Otherwise, we need to see what the token has access to.\n\tret := make(structs.PreparedQueries, 0, len(*queries))\n\tfor _, query := range *queries {\n\t\t// If no prefix ACL applies to this query then filter it, since\n\t\t// we know at this point the user doesn't have a management\n\t\t// token, otherwise see what the policy says.\n\t\tprefix, ok := query.GetACLPrefix()\n\t\tif !ok || !f.authorizer.PreparedQueryRead(prefix) {\n\t\t\tf.logger.Printf(\"[DEBUG] consul: dropping prepared query %q from result due to ACLs\", query.ID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Redact any tokens if necessary. We make a copy of just the\n\t\t// pointer so we don't mess with the caller's slice.\n\t\tfinal := query\n\t\tf.redactPreparedQueryTokens(&final)\n\t\tret = append(ret, final)\n\t}\n\t*queries = ret\n}", "func (s *HTTPServer) PreparedQuerySpecific(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tif req.Method == \"OPTIONS\" {\n\t\treturn s.preparedQuerySpecificOptions(resp, req), nil\n\t}\n\n\tpath := req.URL.Path\n\tid := strings.TrimPrefix(path, \"/v1/query/\")\n\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/execute\")\n\t\treturn s.preparedQueryExecute(id, resp, req)\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tif req.Method != \"GET\" {\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\"}}\n\t\t}\n\t\tid = strings.TrimSuffix(id, \"/explain\")\n\t\treturn s.preparedQueryExplain(id, resp, req)\n\n\tdefault:\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\treturn s.preparedQueryGet(id, resp, req)\n\n\t\tcase \"PUT\":\n\t\t\treturn s.preparedQueryUpdate(id, resp, req)\n\n\t\tcase \"DELETE\":\n\t\t\treturn s.preparedQueryDelete(id, resp, req)\n\n\t\tdefault:\n\t\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"PUT\", \"DELETE\"}}\n\t\t}\n\t}\n}", "func (s *HTTPServer) preparedQueryList(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tvar args structs.DCSpecificRequest\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.List\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Use empty list instead of nil.\n\tif reply.Queries == nil {\n\t\treply.Queries = make(structs.PreparedQueries, 0)\n\t}\n\treturn reply.Queries, nil\n}", "func (e *Execute) OptimizePreparedPlan(ctx context.contextctx, sctx causetnetctx.contextctx, is schemaReplicant.SchemaReplicant) error {\n\tvars := sctx.GetCausetNetVars()\n\tif e.Name != \"\" {\n\t\te.ExecID = vars.PreparedStmtNameToID[e.Name]\n\t}\n\tpreparedPointer, ok := vars.PreparedStmts[e.ExecID]\n\tif !ok {\n\t\treturn errors.Trace(ErrStmtNotFound)\n\t}\n\tpreparedObj, ok := preparedPointer.(*CachedPrepareStmt)\n\tif !ok {\n\t\treturn errors.Errorf(\"invalid CachedPrepareStmt type\")\n\t}\n\tprepared := preparedObj.PreparedAst\n\tvars.StmtCtx.StmtType = prepared.StmtType\n\n\tparamLen := len(e.PrepareParams)\n\tif paramLen > 0 {\n\t\t// for binary protocol execute, argument is placed in vars.PrepareParams\n\t\tif len(prepared.Params) != paramLen {\n\t\t\treturn errors.Trace(ErrWrongParamCount)\n\t\t}\n\t\tvars.PreparedParams = e.PrepareParams\n\t\tfor i, val := range vars.PreparedParams {\n\t\t\tparam := prepared.Params[i].(*driver.ParamMarkerExpr)\n\t\t\tparam.Datum = val\n\t\t\tparam.InExecute = true\n\t\t}\n\t} else {\n\t\t// for `execute stmt using @a, @b, @c`, using value in e.UsingVars\n\t\tif len(prepared.Params) != len(e.UsingVars) {\n\t\t\treturn errors.Trace(ErrWrongParamCount)\n\t\t}\n\n\t\tfor i, usingVar := range e.UsingVars {\n\t\t\tval, err := usingVar.Eval(soliton.Row{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tparam := prepared.Params[i].(*driver.ParamMarkerExpr)\n\t\t\tparam.Datum = val\n\t\t\tparam.InExecute = true\n\t\t\tvars.PreparedParams = append(vars.PreparedParams, val)\n\t\t}\n\t}\n\n\tif prepared.SchemaVersion != is.SchemaMetaVersion() {\n\t\t// In order to avoid some correctness issues, we have to clear the\n\t\t// cached plan once the schema version is changed.\n\t\t// Cached plan in prepared struct does NOT have a \"cache key\" with\n\t\t// schema version like prepared plan cache key\n\t\tprepared.CachedPlan = nil\n\t\tpreparedObj.Interlock = nil\n\t\t// If the schema version has changed we need to preprocess it again,\n\t\t// if this time it failed, the real reason for the error is schema changed.\n\t\terr := Preprocess(sctx, prepared.Stmt, is, InPrepare)\n\t\tif err != nil {\n\t\t\treturn ErrSchemaChanged.GenWithStack(\"Schema change caused error: %s\", err.Error())\n\t\t}\n\t\tprepared.SchemaVersion = is.SchemaMetaVersion()\n\t}\n\terr := e.getPhysicalPlan(ctx, sctx, is, preparedObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.Stmt = prepared.Stmt\n\treturn nil\n}", "func RawPostHandler(w http.ResponseWriter, req *http.Request) {\n\traw.RawPostReq(w, req, delete_table.DELETETABLE_ENDPOINT)\n}", "func handlerAdminDeleteTrack(w http.ResponseWriter, r *http.Request) {\n\tsession, err := mgo.Dial(db.HostURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\t//Deletes all tracks in db\n\t_, err = session.DB(db.Databasename).C(db.TrackCollectionName).RemoveAll(bson.M{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n}", "func FinalizeSQSSpan(req *request.Request) {\n\tsp, ok := instana.SpanFromContext(req.Context())\n\tif !ok {\n\t\treturn\n\t}\n\tdefer sp.Finish()\n\n\tif req.Error != nil {\n\t\tsp.LogFields(otlog.Error(req.Error))\n\t\tsp.SetTag(sqsError, req.Error.Error())\n\t}\n\n\tif req.DataFilled() {\n\t\tswitch data := req.Data.(type) {\n\t\tcase *sqs.GetQueueUrlOutput:\n\t\t\tsp.SetTag(sqsQueue, aws.StringValue(data.QueueUrl))\n\t\tcase *sqs.CreateQueueOutput:\n\t\t\tsp.SetTag(sqsQueue, aws.StringValue(data.QueueUrl))\n\t\tcase *sqs.ReceiveMessageOutput:\n\t\t\tsp.SetTag(sqsSize, len(data.Messages))\n\t\t}\n\t}\n}", "func (h ProxyHandler) HandleStmtExecute(context interface{}, query string, args []interface{}) (*go_mysql.Result, error) {\n\tfmt.Println(\"context: \", context, \" query: \", query, \" args:\", args)\n\treturn nil, fmt.Errorf(\"not supported now\")\n}", "func PrepareAdmin() error {\n\n\tUnPreparedStatements := make(map[string]string, 0)\n\n\tUnPreparedStatements[\"getID\"] = \"select LAST_INSERT_ID() AS id\"\n\tUnPreparedStatements[\"authenticateUserStmt\"] = \"select * from user where username=? and encpassword=? and isActive = 1\"\n\tUnPreparedStatements[\"getUserByIDStmt\"] = \"select * from user where id=?\"\n\tUnPreparedStatements[\"getUserByUsernameStmt\"] = \"select * from user where username=?\"\n\tUnPreparedStatements[\"getUserByEmailStmt\"] = \"select * from user where email=?\"\n\tUnPreparedStatements[\"allUserStmt\"] = \"select * from user\"\n\tUnPreparedStatements[\"getAllModulesStmt\"] = \"select * from module order by module\"\n\tUnPreparedStatements[\"userModulesStmt\"] = \"select module.* from module inner join user_module on module.id = user_module.moduleID where user_module.userID = ? order by module\"\n\tUnPreparedStatements[\"setUserPasswordStmt\"] = \"update user set encpassword = ? where id = ?\"\n\tUnPreparedStatements[\"registerUserStmt\"] = \"insert into user (username,email,fname,lname,isActive,superUser) VALUES (?,?,?,?,0,0)\"\n\tUnPreparedStatements[\"getAllUserStmt\"] = \"select * from user order by fname, lname\"\n\tUnPreparedStatements[\"setUserStatusStmt\"] = \"update user set isActive = ? WHERE id = ?\"\n\tUnPreparedStatements[\"clearUserModuleStmt\"] = \"delete from user_module WHERE userid = ?\"\n\tUnPreparedStatements[\"deleteUserStmt\"] = \"delete from user WHERE id = ?\"\n\tUnPreparedStatements[\"addUserStmt\"] = \"insert into user (username,email,fname,lname,biography,photo,isActive,superUser) VALUES (?,?,?,?,?,?,?,?)\"\n\tUnPreparedStatements[\"updateUserStmt\"] = \"update user set username=?, email=?, fname=?, lname=?, biography=?, photo=?, isActive=?, superUser=? WHERE id = ?\"\n\tUnPreparedStatements[\"addModuleToUserStmt\"] = \"insert into user_module (userID,moduleID) VALUES (?,?)\"\n\n\tif !AdminDb.Raw.IsConnected() {\n\t\tAdminDb.Raw.Connect()\n\t}\n\n\tc := make(chan int)\n\n\tfor stmtname, stmtsql := range UnPreparedStatements {\n\t\tgo PrepareAdminStatement(stmtname, stmtsql, c)\n\t}\n\n\tfor _, _ = range UnPreparedStatements {\n\t\t<-c\n\t}\n\n\treturn nil\n}", "func SQLHandler(pathUrls []PathURL, fallback http.Handler) (http.HandlerFunc, error) {\n\t// convert pathUrls into a map\n\tpathsToUrls := buildPathsMap(pathUrls)\n\n\t// re-use the MapHandler\n\t// * now return the newly padded pathsToUrls\n\t// * while returning it in a format that makes it look like you were calling MapHandler in the first place\n\treturn MapHandler(pathsToUrls, fallback), nil\n}", "func (mux *ServeMux) HandleRemove(pattern string) {\n\tif pattern == \"\" {\n\t\tpanic(\"dns: invalid pattern \" + pattern)\n\t}\n\tmux.m.Lock()\n\tdelete(mux.z, CanonicalName(pattern))\n\tmux.m.Unlock()\n}", "func (w *WebSocketService) ProcessPackets(rw http.ResponseWriter, r *http.Request) {\n\tq, _ := url.ParseQuery(r.URL.RawQuery)\n\n\tif isWebSocketRequest(r) {\n\t\trw.Header().Set(\"Upgrades\", strings.Join(proc, \";\"))\n\n\t\tagent, ok := r.Header[\"User-Agent\"]\n\n\t\tif ok {\n\t\t\tag := strings.Join(agent, \";\")\n\t\t\tmsie := strings.Index(ag, \";MSIE\")\n\t\t\ttrident := strings.Index(ag, \"Trident/\")\n\n\t\t\tif msie != -1 || trident != -1 {\n\t\t\t\trw.Header().Set(\"X-XSS-Protection\", \"0\")\n\t\t\t}\n\t\t}\n\n\t\torigin, ok := r.Header[\"Origin\"]\n\n\t\tif ok {\n\t\t\trw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", strings.Join(origin, \";\"))\n\t\t} else {\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t}\n\n\t\tu, err := webSocketUpgrade.Upgrade(rw, r, nil)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.Route.IssueRequestPath(r.URL.Path, func(pack *grids.GridPacket) {\n\t\t\tpack.Set(\"Ws\", u)\n\t\t\tpack.Set(\"Req\", r)\n\t\t\tpack.Set(\"Res\", rw)\n\t\t\tCollectHTTPBody(r, pack)\n\t\t})\n\t}\n}", "func DepupulateHandler(res http.ResponseWriter, req *http.Request) {\n\tnumPups := parseOrDefault(req, numParam, 100)\n\terr := db.DeleteEntries(numPups)\n\tif err != nil {\n\t\tmessage := \"Could not delete from Pets table \" + err.Error()\n\t\tmessageResponseJSON(res, http.StatusBadRequest, message)\n\t\treturn\n\t}\n\tjsonResponse(res, http.StatusOK, \"Entries from pets table deleted\")\n\treturn\n}", "func removeHandler(s *search.SearchServer, w http.ResponseWriter, r *http.Request) {\n\tparams := r.URL.Query()\n\tcollection := params.Get(\"collection\")\n\n\tif collection == \"\" {\n\t\trespondWithError(w, r, \"Collection query parameter is required\")\n\t\treturn\n\t}\n\n\tif !s.Exists(collection) {\n\t\trespondWithError(w, r, \"Collection does not exist\")\n\t\treturn\n\t}\n\n\tdocid := params.Get(\"docid\")\n\tif docid == \"\" {\n\t\trespondWithError(w, r, \"docid query parameter is required\")\n\t\treturn\n\t}\n\n\ts.Remove(collection, docid)\n\trespondWithSuccess(w, r, \"Document removed\")\n}", "func (h *ProxyHandler) HandleStmtClose(context interface{}) error {\n\tfmt.Println(\"Close context: \", context)\n\treturn nil\n}", "func DeleteQueries(n int32, ids *uint32) {\n\tsyscall.Syscall(gpDeleteQueries, 2, uintptr(n), uintptr(unsafe.Pointer(ids)), 0)\n}", "func (acraCensor *AcraCensor) RemoveHandler(handler QueryHandlerInterface) {\n\tfor index, handlerFromRange := range acraCensor.handlers {\n\t\tif handlerFromRange == handler {\n\t\t\tacraCensor.handlers = append(acraCensor.handlers[:index], acraCensor.handlers[index+1:]...)\n\t\t}\n\t}\n}", "func (pbft *PBFT) HandlePrepareRPC(args CommandArgs, reply *RPCReply) error {\n\tlog.Print(\"Getting to handle prepare\\n\")\n\n\tif pbft.isChangingView() {\n\t\treturn nil\n\t}\n\n\tpbft.commandRecieved <- true\n\tprepareArgs, ok := args.SpecificArguments.(PrepareCommandArg)\n\tif !ok {\n\t\tlog.Fatal(\"[handlePrePrepareRPC] preprepare command args failed\")\n\t}\n\n\t// verify the signatures\n\tsignatureArg := verifySignatureArg{\n\t\tgeneric: prepareArgs,\n\t}\n\tif !pbft.verifySignatures(&signatureArg, args.R_firstSig, args.S_secondSig, prepareArgs.SenderIndex) {\n\t\tlog.Print(\"[HandlePrepareRPC] signatures of the prepare command args don't match\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLock.Lock()\n\tdefer pbft.serverLock.Unlock()\n\n\tlogEntryItem, ok1 := pbft.serverLog[prepareArgs.SequenceNumber]\n\n\t// A replica (including the primary) accepts prepare messages and adds them to its log\n\t// provided their signatures are correct, their view number equals the replica’s current view,\n\t// and their sequence number is between h and H.\n\n\t// do nothing if we did not receive a preprepare\n\tif !ok1 {\n\t\tlog.Print(\"[HandlePrepareRPC] did not recieve a preprepare\")\n\t\treturn nil\n\t}\n\n\t// do not accept of different views, or different signatures\n\tif (prepareArgs.View != pbft.view) || (prepareArgs.Digest != logEntryItem.commandDigest) {\n\t\tlog.Print(\"[HandlePrepareRPC] saw different view or different digest\")\n\t\treturn nil\n\t}\n\tif _, ok2 := logEntryItem.prepareArgs[prepareArgs.SenderIndex]; ok2 {\n\t\tlog.Print(\"[HandlePrepareRPC] already received from this server\")\n\t\treturn nil\n\t}\n\n\tpbft.serverLog[prepareArgs.SequenceNumber].prepareArgs[prepareArgs.SenderIndex] = args\n\n\t// return if already prepared\n\tif len(logEntryItem.prepareArgs) > pbft.calculateMajority() {\n\t\tpbft.persist()\n\t\tlog.Printf(\"[HandlePrepareRPC] already prepared, so exiting\")\n\t\treturn nil\n\t}\n\n\t// We define the predicate prepared to be true iff replica has inserted in its\n\t// log: the request, a pre-prepare for in view with sequence number, and 2f\n\t// prepares from different backups that match the pre-prepare. The replicas verify\n\t// whether the prepares match the pre-prepare by checking that they have the\n\t// same view, sequence number, and digest\n\n\t// go into the commit phase for this command after 2F + 1 replies\n\tcommitArgs := CommitArg{\n\t\tView: pbft.view,\n\t\tSequenceNumber: prepareArgs.SequenceNumber,\n\t\tDigest: prepareArgs.Digest,\n\t\tSenderIndex: pbft.serverID,\n\t\tTimestamp: prepareArgs.Timestamp,\n\t}\n\n\tcommitArg := pbft.makeArguments(commitArgs)\n\tpbft.serverLog[prepareArgs.SequenceNumber].commitArgs[pbft.serverID] = commitArg\n\n\tgo pbft.sendRPCs(commitArg, COMMIT)\n\tpbft.persist()\n\n\tlog.Print(\"returning from prepare\\n\")\n\treturn nil\n}", "func (srv *Server) handleDelete(res http.ResponseWriter, req *http.Request) {\n\tfor _, rute := range srv.routeDeletes {\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\tres.WriteHeader(http.StatusNotFound)\n}", "func (s *HTTPServer) preparedQuerySpecificOptions(resp http.ResponseWriter, req *http.Request) interface{} {\n\tpath := req.URL.Path\n\tswitch {\n\tcase strings.HasSuffix(path, \"/execute\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tcase strings.HasSuffix(path, \"/explain\"):\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\"}, \",\"))\n\t\treturn resp\n\n\tdefault:\n\t\tresp.Header().Add(\"Allow\", strings.Join([]string{\"OPTIONS\", \"GET\", \"PUT\", \"DELETE\"}, \",\"))\n\t\treturn resp\n\t}\n}", "func (c *Conn) Deallocate(ctx context.Context, name string) error {\n\tdelete(c.preparedStatements, name)\n\t_, err := c.pgConn.Exec(ctx, \"deallocate \"+quoteIdentifier(name)).ReadAll()\n\treturn err\n}", "func HandleRemoveContest(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\tsession := getMongoS()\n\t\tdefer session.Close()\n\t\tc := session.DB(\"oj\").C(\"contests\")\n\t\terr := c.Remove(bson.M{\"contestid\": r.Form[\"contestID\"][0]})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func DestroyPost(w http.ResponseWriter, r *http.Request) {\n\n\tdb, err := sqlx.Connect(\"postgres\", connStr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(r)\n\tquery := \"delete from posts where id=\" + params[\"id\"]\n\n\tdb.MustExec(query)\n}", "func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tcrud := modules.DB()\n\t\tif err := crud.DeleteTable(ctx, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (s *HTTPServer) preparedQueryExecute(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryExecuteRequest{\n\t\tQueryIDOrName: id,\n\t\tAgent: structs.QuerySource{\n\t\t\tNode: s.agent.config.NodeName,\n\t\t\tDatacenter: s.agent.config.Datacenter,\n\t\t\tSegment: s.agent.config.SegmentName,\n\t\t},\n\t}\n\ts.parseSource(req, &args.Source)\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\tif err := parseLimit(req, &args.Limit); err != nil {\n\t\treturn nil, fmt.Errorf(\"Bad limit: %s\", err)\n\t}\n\n\tparams := req.URL.Query()\n\tif raw := params.Get(\"connect\"); raw != \"\" {\n\t\tval, err := strconv.ParseBool(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error parsing 'connect' value: %s\", err)\n\t\t}\n\n\t\targs.Connect = val\n\t}\n\n\tvar reply structs.PreparedQueryExecuteResponse\n\tdefer setMeta(resp, &reply.QueryMeta)\n\n\tif args.QueryOptions.UseCache {\n\t\traw, m, err := s.agent.cache.Get(cachetype.PreparedQueryName, &args)\n\t\tif err != nil {\n\t\t\t// Don't return error if StaleIfError is set and we are within it and had\n\t\t\t// a cached value.\n\t\t\tif raw != nil && m.Hit && args.QueryOptions.StaleIfError > m.Age {\n\t\t\t\t// Fall through to the happy path below\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tdefer setCacheMeta(resp, &m)\n\t\tr, ok := raw.(*structs.PreparedQueryExecuteResponse)\n\t\tif !ok {\n\t\t\t// This should never happen, but we want to protect against panics\n\t\t\treturn nil, fmt.Errorf(\"internal error: response type not correct\")\n\t\t}\n\t\treply = *r\n\t} else {\n\tRETRY_ONCE:\n\t\tif err := s.agent.RPC(\"PreparedQuery.Execute\", &args, &reply); err != nil {\n\t\t\t// We have to check the string since the RPC sheds\n\t\t\t// the specific error type.\n\t\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\t\targs.AllowStale = false\n\t\t\targs.MaxStaleDuration = 0\n\t\t\tgoto RETRY_ONCE\n\t\t}\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\n\t// Note that we translate using the DC that the results came from, since\n\t// a query can fail over to a different DC than where the execute request\n\t// was sent to. That's why we use the reply's DC and not the one from\n\t// the args.\n\ts.agent.TranslateAddresses(reply.Datacenter, reply.Nodes)\n\n\t// Use empty list instead of nil.\n\tif reply.Nodes == nil {\n\t\treply.Nodes = make(structs.CheckServiceNodes, 0)\n\t}\n\treturn reply, nil\n}", "func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\tswitch req.Method {\n\tcase \"POST\":\n\t\treturn s.preparedQueryCreate(resp, req)\n\n\tcase \"GET\":\n\t\treturn s.preparedQueryList(resp, req)\n\n\tdefault:\n\t\treturn nil, MethodNotAllowedError{req.Method, []string{\"GET\", \"POST\"}}\n\t}\n}", "func Prepare() {\n\tsch, e := graphql.NewSchema(*Schema)\n\tif e != nil {\n\t\tlogger.Panic(\"graphql.NewSchema\",\n\t\t\tzap.Error(e),\n\t\t\tzap.Any(\"schema\", Schema),\n\t\t)\n\t}\n\tSchema = nil\n\n\tlogrus.SetLevel(logrus.PanicLevel)\n\tsubManager = gqlsub.NewManager(context.Background(), &sch, subHandlers)\n\thttp.Handle(\"/subscriptions\", graphqlws.NewHandler(graphqlws.HandlerConfig{\n\t\tSubscriptionManager: subManager,\n\t}))\n\n\thttp.Handle(\"/\", handler.New(&handler.Config{\n\t\tSchema: &sch,\n\t\tPretty: true,\n\t\tPlaygroundConfig: handler.NewDefaultPlaygroundConfig(),\n\t}))\n}", "func deleteTable_POST_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"delete_table_route.deleteTable_POST_Handler:cannot parse path. try /desc-table\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbodybytes, read_err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif read_err != nil && read_err != io.EOF {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler err reading req body: %s\", read_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\td := delete_table.NewDeleteTable()\n\n\tum_err := json.Unmarshal(bodybytes, d)\n\tif um_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler unmarshal err on %s to Get %s\", string(bodybytes), um_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresp_body, code, resp_err := d.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"delete_table_route.deleteTable_POST_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tdelete_table.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"delete_table_route.deleteTable_POST_Handler %s\",\n\t\t\tmr_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func PrepareAllQueries(ctx context.Context, p preparer) error {\n\tif _, err := p.Prepare(ctx, backtickSQL, backtickSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'Backtick': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickQuoteBacktickSQL, backtickQuoteBacktickSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickQuoteBacktick': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickNewlineSQL, backtickNewlineSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickNewline': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickDoubleQuoteSQL, backtickDoubleQuoteSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickDoubleQuote': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, backtickBackslashNSQL, backtickBackslashNSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BacktickBackslashN': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, illegalNameSymbolsSQL, illegalNameSymbolsSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'IllegalNameSymbols': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, badEnumNameSQL, badEnumNameSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'BadEnumName': %w\", err)\n\t}\n\tif _, err := p.Prepare(ctx, goKeywordSQL, goKeywordSQL); err != nil {\n\t\treturn fmt.Errorf(\"prepare query 'GoKeyword': %w\", err)\n\t}\n\treturn nil\n}", "func (db *DB) DropQuery(name string) (err error) {\n\tif db.qm[name].isPrepared() {\n\t\terr = db.Pool.Deallocate(name)\n\t}\n\tmutex.Lock()\n\tdelete(db.qm, name)\n\tmutex.Unlock()\n\treturn\n}", "func (h *Handler) serveDeleteDatabase(w http.ResponseWriter, r *http.Request) {\n\tname := r.URL.Query().Get(\":name\")\n\tif err := h.server.DeleteDatabase(name); err != ErrDatabaseNotFound {\n\t\th.error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t} else if err != nil {\n\t\th.error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (s *HTTPServer) preparedQueryGet(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQuerySpecificRequest{\n\t\tQueryID: id,\n\t}\n\tif done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {\n\t\treturn nil, nil\n\t}\n\n\tvar reply structs.IndexedPreparedQueries\n\tdefer setMeta(resp, &reply.QueryMeta)\nRETRY_ONCE:\n\tif err := s.agent.RPC(\"PreparedQuery.Get\", &args, &reply); err != nil {\n\t\t// We have to check the string since the RPC sheds\n\t\t// the specific error type.\n\t\tif err.Error() == consul.ErrQueryNotFound.Error() {\n\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\tfmt.Fprint(resp, err.Error())\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tif args.QueryOptions.AllowStale && args.MaxStaleDuration > 0 && args.MaxStaleDuration < reply.LastContact {\n\t\targs.AllowStale = false\n\t\targs.MaxStaleDuration = 0\n\t\tgoto RETRY_ONCE\n\t}\n\treply.ConsistencyLevel = args.QueryOptions.ConsistencyLevel()\n\treturn reply.Queries, nil\n}", "func (m *bpfEndpointManager) onPolicyRemove(msg *proto.ActivePolicyRemove) {\n\tpolID := *msg.Id\n\tlog.WithField(\"id\", polID).Debug(\"Policy removed\")\n\tm.markPolicyUsersDirty(polID)\n\tdelete(m.policies, polID)\n\tdelete(m.policiesToWorkloads, polID)\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_PendingRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_PendingRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_PendingRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_LastFinalizedRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_LastFinalizedRound_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_LastFinalizedRound_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Round_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Round_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Round_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllRounds_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_AllClaims_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_AllClaims_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_AllClaims_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Claim_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Claim_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Claim_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryDelegeateAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryDelegeateAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryDelegeateAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_QueryValidatorAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_QueryValidatorAddress_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_QueryValidatorAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (c *DQLConfig) Remove(name string) error {\n\t// remove from DQLConfig\n\tdelete(c.Schemas, name)\n\n\t// remove from ServerlessConfig\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.RemoveFunction(name).Write()\n}", "func (dbi *DB) Prepare(sqls string, arg ...string) {\r\n\tif dbi.status == false {\r\n\t\treturn\r\n\t}\r\n\r\n\tdbi.createOperation(\"DB_PREPARE\")\r\n\t// bind variables\r\n\tdbi.data.reqSql = sqls\r\n\tdbi.data.inVar = arg\r\n\t// data\r\n\tdbi.data.commPrepare()\r\n\t// communicate\r\n\tif dbi.data.comm() == false {\r\n\t\tdbi.Close()\r\n\t}\r\n\t// parse\r\n\tdbi.data.commParse()\r\n}", "func DeleteUserProfileHandler(w http.ResponseWriter, r *http.Request) {\n\n}", "func prepareQuery(data types.DataGet, queryArgs *[]interface{}, queryCountArgs *[]interface{},\n\tloginId int64, nestingLevel int) (string, string, error) {\n\n\t// check for authorized access, READ(1) for GET\n\tfor _, expr := range data.Expressions {\n\t\tif expr.AttributeId.Status == pgtype.Present && !authorizedAttribute(loginId, expr.AttributeId.Bytes, 1) {\n\t\t\treturn \"\", \"\", errors.New(handler.ErrUnauthorized)\n\t\t}\n\t}\n\n\tvar (\n\t\tinSelect []string // select expressions\n\t\tinJoin []string // relation joins\n\t\tmapIndex_relId = make(map[int]uuid.UUID) // map of all relations by index\n\t)\n\n\t// check source relation and module\n\trel, exists := cache.RelationIdMap[data.RelationId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t}\n\n\tmod, exists := cache.ModuleIdMap[rel.ModuleId]\n\tif !exists {\n\t\treturn \"\", \"\", errors.New(\"module does not exist\")\n\t}\n\n\t// JOIN relations connected via relationship attributes\n\tmapIndex_relId[data.IndexSource] = data.RelationId\n\tfor _, join := range data.Joins {\n\t\tif join.IndexFrom == -1 { // source relation need not be joined\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := joinRelation(mapIndex_relId, join, &inJoin, nestingLevel); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t}\n\n\t// define relation code for source relation\n\t// source relation might have index != 0 (for GET from joined relation)\n\trelCode := getRelationCode(data.IndexSource, nestingLevel)\n\n\t// build WHERE lines\n\t// before SELECT expressions because these are excluded from count query\n\t// SQL arguments are numbered ($1, $2, ...) with no way to skip any (? placeholder is not allowed);\n\t// excluded sub queries arguments from SELECT expressions causes missing argument numbers\n\tqueryWhere := \"\"\n\tif err := buildWhere(data.Filters, queryArgs, queryCountArgs, loginId,\n\t\tnestingLevel, &queryWhere); err != nil {\n\n\t\treturn \"\", \"\", err\n\t}\n\n\t// process SELECT expressions\n\tmapIndex_agg := make(map[int]bool) // map of indexes with aggregation\n\tmapIndex_aggRecords := make(map[int]bool) // map of indexes with record aggregation\n\tfor pos, expr := range data.Expressions {\n\n\t\t// non-attribute expression\n\t\tif expr.AttributeId.Status != pgtype.Present {\n\n\t\t\t// in expressions of main query, disable SQL arguments for count query\n\t\t\t// count query has no sub queries with arguments and only 1 expression: COUNT(*)\n\t\t\tqueryCountArgsOptional := queryCountArgs\n\t\t\tif nestingLevel == 0 {\n\t\t\t\tqueryCountArgsOptional = nil\n\t\t\t}\n\n\t\t\tsubQuery, _, err := prepareQuery(expr.Query, queryArgs,\n\t\t\t\tqueryCountArgsOptional, loginId, nestingLevel+1)\n\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", \"\", err\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(\"(\\n%s\\n) AS %s\",\n\t\t\t\tsubQuery, getExpressionCodeSelect(pos)))\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// attribute expression\n\t\tif err := selectAttribute(pos, expr, mapIndex_relId, &inSelect,\n\t\t\tnestingLevel); err != nil {\n\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif expr.Aggregator.Status == pgtype.Present {\n\t\t\tmapIndex_agg[expr.Index] = true\n\t\t}\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\tmapIndex_aggRecords[expr.Index] = true\n\t\t}\n\t}\n\n\t// SELECT relation tupel IDs after attributes on main query\n\tif nestingLevel == 0 {\n\t\tfor index, relId := range mapIndex_relId {\n\n\t\t\t// if an aggregation function is used on any index, we cannot deliver record IDs\n\t\t\t// unless a record aggregation functions is used on this specific relation index\n\t\t\t_, recordAggExists := mapIndex_aggRecords[index]\n\t\t\tif len(mapIndex_agg) != 0 && !recordAggExists {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif _, exists := cache.RelationIdMap[relId]; !exists {\n\t\t\t\treturn \"\", \"\", errors.New(\"relation does not exist\")\n\t\t\t}\n\t\t\tinSelect = append(inSelect, fmt.Sprintf(`\"%s\".\"id\" AS %s`,\n\t\t\t\tgetRelationCode(index, nestingLevel),\n\t\t\t\tgetTupelIdCode(index, nestingLevel)))\n\t\t}\n\t}\n\n\t// build GROUP BY line\n\tqueryGroup := \"\"\n\tgroupByItems := make([]string, 0)\n\tfor i, expr := range data.Expressions {\n\n\t\tif expr.AttributeId.Status != pgtype.Present || (!expr.GroupBy && expr.Aggregator.Status != pgtype.Present) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// group by record ID if record must be kept during aggregation\n\t\tif expr.Aggregator.String == \"record\" {\n\t\t\trelId := getTupelIdCode(expr.Index, nestingLevel)\n\n\t\t\tif !tools.StringInSlice(relId, groupByItems) {\n\t\t\t\tgroupByItems = append(groupByItems, relId)\n\t\t\t}\n\t\t}\n\n\t\t// group by requested attribute\n\t\tif expr.GroupBy {\n\t\t\tgroupByItems = append(groupByItems, getExpressionCodeSelect(i))\n\t\t}\n\t}\n\tif len(groupByItems) != 0 {\n\t\tqueryGroup = fmt.Sprintf(\"\\nGROUP BY %s\", strings.Join(groupByItems, \", \"))\n\t}\n\n\t// build ORDER BY, LIMIT, OFFSET lines\n\tqueryOrder, queryLimit, queryOffset := \"\", \"\", \"\"\n\tif err := buildOrderLimitOffset(data, nestingLevel, &queryOrder, &queryLimit, &queryOffset); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// build data query\n\tquery := fmt.Sprintf(\n\t\t`SELECT %s`+\"\\n\"+\n\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s%s%s%s%s`,\n\t\tstrings.Join(inSelect, `, `), // SELECT\n\t\tmod.Name, rel.Name, relCode, // FROM\n\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\tqueryWhere, // WHERE\n\t\tqueryGroup, // GROUP BY\n\t\tqueryOrder, // ORDER BY\n\t\tqueryLimit, // LIMIT\n\t\tqueryOffset) // OFFSET\n\n\t// build totals query (not relevant for sub queries)\n\tqueryCount := \"\"\n\tif nestingLevel == 0 {\n\n\t\t// distinct to keep count for source relation records correct independent of joins\n\t\tqueryCount = fmt.Sprintf(\n\t\t\t`SELECT COUNT(DISTINCT \"%s\".\"%s\")`+\"\\n\"+\n\t\t\t\t`FROM \"%s\".\"%s\" AS \"%s\" %s%s`,\n\t\t\tgetRelationCode(data.IndexSource, nestingLevel), lookups.PkName, // SELECT\n\t\t\tmod.Name, rel.Name, relCode, // FROM\n\t\t\tstrings.Join(inJoin, \"\"), // JOINS\n\t\t\tqueryWhere) // WHERE\n\n\t}\n\n\t// add intendation for nested sub queries\n\tif nestingLevel != 0 {\n\t\tindent := strings.Repeat(\"\\t\", nestingLevel)\n\t\tquery = indent + regexp.MustCompile(`\\r?\\n`).ReplaceAllString(query, \"\\n\"+indent)\n\t}\n\treturn query, queryCount, nil\n}", "func (s *Server) CleanTableHandler(c echo.Context) error {\n\tvar tableName = c.Param(\"tablename\")\n\n\tgo func() {\n\t\tfor {\n\t\t\tn, err := sqlutils.TableDelRecordsBatch(s.DB, tableName, s.Cfg.TableRecordsLifeTimeDays, s.Cfg.TableRecordsDelBatchSize)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"table %s delete records batch err: %s\", tableName, err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t//if no records were removed\n\t\t\tif n == 0 {\n\t\t\t\tlogrus.Infof(\"table %s was successfully cleaned up\", tableName)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlogrus.Infof(\"successfull remove %d record in table %s\", n, tableName)\n\n\t\t\t//Non blocked removal - make pauses between delete transactions\n\t\t\ttime.Sleep(time.Duration(s.Cfg.TableRecordsRemovePause) * time.Millisecond)\n\t\t}\n\t}()\n\n\tresp := types.NewJSONResponse(false, fmt.Sprintf(\"table %s cleanup was scheduled. For more information please refer to app console logs.\", tableName))\n\treturn c.JSON(http.StatusOK, resp)\n}", "func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {\n\n\tmux.Handle(\"GET\", pattern_Query_GroupInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupMembers_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupMembers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VoteByProposalVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VoteByProposalVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VoteByProposalVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByProposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByProposal_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByProposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_VotesByVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_VotesByVoter_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_VotesByVoter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_GroupsByMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_GroupsByMember_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_TallyResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_TallyResult_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_TallyResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Query_Groups_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (a *adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\tselector := map[string]interface{}{\n\t\t\"ptype\": ptype,\n\t}\n\tif fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[0-fieldIndex] != \"\" {\n\t\t\tselector[\"v0\"] = fieldValues[0-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[1-fieldIndex] != \"\" {\n\t\t\tselector[\"v1\"] = fieldValues[1-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[2-fieldIndex] != \"\" {\n\t\t\tselector[\"v2\"] = fieldValues[2-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[3-fieldIndex] != \"\" {\n\t\t\tselector[\"v3\"] = fieldValues[3-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[4-fieldIndex] != \"\" {\n\t\t\tselector[\"v4\"] = fieldValues[4-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[5-fieldIndex] != \"\" {\n\t\t\tselector[\"v5\"] = fieldValues[5-fieldIndex]\n\t\t}\n\t}\n\n\tif _, err := a.collection.RemoveAll(context.Background(), selector); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (w *Wrapper) prepare(query string) string {\n\tw.connLock.RLock()\n\tdefer w.connLock.RUnlock()\n\n\tswitch w.prepareType {\n\tcase dbUnknown:\n\t\tw.prepareType = examineDB(w.connection)\n\t\tif w.prepareType == dbUnknown {\n\t\t\tpanic(UnknownDatabase)\n\t\t}\n\t\treturn w.prepare(query)\n\tcase dbPostgres:\n\t\treturn query\n\tcase dbMysql:\n\t\treturn postgresRegex.ReplaceAllString(query, \"?\")\n\t}\n\tpanic(\"unreachable\")\n}", "func removeProductHandle(response http.ResponseWriter, request *http.Request) {\n\torderId := strings.Split(request.URL.Path, \"/\")[3]\n\tlog.Printf(\"Remove product for order %s!\", orderId)\n\tdecoder := json.NewDecoder(request.Body)\n\tremoveProductCommand := commands.RemoveProduct{}\n\terr := decoder.Decode(&removeProductCommand)\n\tif err != nil {\n\t\twriteErrorResponse(response, err)\n\t}\n\torder := <-orderHandler.RemoveProductInOrder(OrderId{Id: orderId}, removeProductCommand)\n\twriteResponse(response, order)\n}", "func DisallowQueries(forRestart bool) {\n\tdefer logError()\n\tSqlQueryRpcService.disallowQueries(forRestart)\n}", "func (h *HTTPApi) removeDatabase(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tdbname := ps.ByName(\"dbname\")\n\n\t// TODO: there is a race condition here, as we are checking the meta -- unless we do lots of locking\n\t// we'll leave this in place for now, until we have some more specific errors that we can type\n\t// switch around to give meaningful error messages\n\tif err := h.storageNode.Datasources[ps.ByName(\"datasource\")].EnsureDoesntExistDatabase(r.Context(), dbname); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t}\n}", "func execPrepareStmt(prepStmt string) {\n\tif db == nil {\n\t\tdb = getDB()\n\t}\n\n\tstmt, err := db.Prepare(prepStmt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = stmt.Exec()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (a *adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\tselector := make(map[string]interface{})\n\tselector[\"ptype\"] = ptype\n\n\tif fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[0-fieldIndex] != \"\" {\n\t\t\tselector[\"v0\"] = fieldValues[0-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[1-fieldIndex] != \"\" {\n\t\t\tselector[\"v1\"] = fieldValues[1-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[2-fieldIndex] != \"\" {\n\t\t\tselector[\"v2\"] = fieldValues[2-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[3-fieldIndex] != \"\" {\n\t\t\tselector[\"v3\"] = fieldValues[3-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[4-fieldIndex] != \"\" {\n\t\t\tselector[\"v4\"] = fieldValues[4-fieldIndex]\n\t\t}\n\t}\n\tif fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {\n\t\tif fieldValues[5-fieldIndex] != \"\" {\n\t\t\tselector[\"v5\"] = fieldValues[5-fieldIndex]\n\t\t}\n\t}\n\n\tctx := context.TODO()\n\t_, err := a.collection.DeleteMany(ctx, selector)\n\treturn err\n}", "func (c *Conn) DeallocateAll(ctx context.Context) error {\n\tc.preparedStatements = map[string]*pgconn.StatementDescription{}\n\tif c.config.StatementCacheCapacity > 0 {\n\t\tc.statementCache = stmtcache.NewLRUCache(c.config.StatementCacheCapacity)\n\t}\n\tif c.config.DescriptionCacheCapacity > 0 {\n\t\tc.descriptionCache = stmtcache.NewLRUCache(c.config.DescriptionCacheCapacity)\n\t}\n\t_, err := c.pgConn.Exec(ctx, \"deallocate all\").ReadAll()\n\treturn err\n}", "func (stmt *Statement) Delete() (err os.Error) {\n defer stmt.db.unlock()\n defer catchOsError(&err)\n\n stmt.db.lock()\n if stmt.db.conn == nil {\n return NOT_CONN_ERROR\n }\n if stmt.db.unreaded_rows {\n return UNREADED_ROWS_ERROR\n }\n\n // Allways delete statement on client side, even if\n // the command return an error.\n defer func() {\n // Delete statement from stmt_map\n stmt.db.stmt_map[stmt.id] = nil, false\n // Invalidate handler\n *stmt = Statement{}\n } ()\n\n // Send command\n stmt.db.sendCmd(_COM_STMT_CLOSE, stmt.id)\n return\n}", "func Cleanup(w http.ResponseWriter, r *http.Request) {\n\tdb.DropTables()\n}", "func Cleanup(w http.ResponseWriter, r *http.Request) {\n\tdb.DropTables()\n}", "func (s *HTTPServer) preparedQueryUpdate(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {\n\targs := structs.PreparedQueryRequest{\n\t\tOp: structs.PreparedQueryUpdate,\n\t}\n\ts.parseDC(req, &args.Datacenter)\n\ts.parseToken(req, &args.Token)\n\tif req.ContentLength > 0 {\n\t\tif err := decodeBody(req, &args.Query, nil); err != nil {\n\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\tfmt.Fprintf(resp, \"Request decode failed: %v\", err)\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tif args.Query == nil {\n\t\targs.Query = &structs.PreparedQuery{}\n\t}\n\n\t// Take the ID from the URL, not the embedded one.\n\targs.Query.ID = id\n\n\tvar reply string\n\tif err := s.agent.RPC(\"PreparedQuery.Apply\", &args, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, nil\n}", "func (rs *routeServer) removeRoutesHandler(w http.ResponseWriter, req *http.Request) {\n\tlog.Printf(\"Deleting routes at %s\\n\", req.URL.Path)\n\n\tloc := mux.Vars(req)[\"location\"]\n\n\tmediatype, _, err := mime.ParseMediaType(req.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif mediatype != \"application/json\" {\n\t\thttp.Error(w, \"requires application/json Content-Type\", http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tdec := json.NewDecoder(req.Body)\n\tvar routes []string\n\tif err := dec.Decode(&routes); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif rs.store.RemoveRoutes(loc, routes) != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func (bu *BankdetailUpdate) RemoveStatementIDs(ids ...int) *BankdetailUpdate {\n\tbu.mutation.RemoveStatementIDs(ids...)\n\treturn bu\n}", "func (buo *BankdetailUpdateOne) RemoveStatementIDs(ids ...int) *BankdetailUpdateOne {\n\tbuo.mutation.RemoveStatementIDs(ids...)\n\treturn buo\n}", "func (s *Server) sqlHandler(w http.ResponseWriter, req *http.Request) {\n if(s.block) {\n time.Sleep(1000000* time.Second)\n }\n\n\tquery, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't read body: %s\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tif s.leader != s.listen {\n\n\t\tcs, errLeader := transport.Encode(s.leader)\n\t\t\n\t\tif errLeader != nil {\n\t\t\thttp.Error(w, \"Only the primary can service queries, but this is a secondary\", http.StatusBadRequest)\t\n\t\t\tlog.Printf(\"Leader ain't present?: %s\", errLeader)\n\t\t\treturn\n\t\t}\n\n\t\t//_, errLeaderHealthCheck := s.client.SafeGet(cs, \"/healthcheck\") \n\n //if errLeaderHealthCheck != nil {\n // http.Error(w, \"Primary is down\", http.StatusBadRequest)\t\n // return\n //}\n\n\t\tbody, errLResp := s.client.SafePost(cs, \"/sql\", bytes.NewBufferString(string(query)))\n\t\tif errLResp != nil {\n s.block = true\n http.Error(w, \"Can't forward request to primary, gotta block now\", http.StatusBadRequest)\t\n return \n\t//\t log.Printf(\"Didn't get reply from leader: %s\", errLResp)\n\t\t}\n\n formatted := fmt.Sprintf(\"%s\", body)\n resp := []byte(formatted)\n\n\t\tw.Write(resp)\n\t\treturn\n\n\t} else {\n\n\t\tlog.Debugf(\"Primary Received query: %#v\", string(query))\n\t\tresp, err := s.execute(query)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t}\n\n\t\tw.Write(resp)\n\t\treturn\n\t}\n}", "func DeleteQueries(n int32, ids *uint32) {\n C.glowDeleteQueries(gpDeleteQueries, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(ids)))\n}", "func TestClient_RemoveDatabase(t *testing.T) {\n\tteardown := setup()\n\tdefer teardown()\n\tmux.HandleFunc(\"/databases\", http.HandlerFunc(getDatabasesHandler))\n\tmux.HandleFunc(\"/databases/foo\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tdbCheck := false\n\t\tfor _, db := range databases {\n\t\t\tif db.InstanceName == \"foo\" {\n\t\t\t\tdbCheck = true\n\t\t\t\tb, err := json.Marshal(&db)\n\t\t\t\tif err != nil {\n\t\t\t\t\thttp.Error(w, \"failed to marshal response\", http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw.Write(b)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif !dbCheck {\n\t\t\thttp.Error(w, \"database not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t})\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tremoveDbRequest := models.RemoveDatabaseRequest{}\n\t\terr := json.NewDecoder(r.Body).Decode(&removeDbRequest)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"failed to parse json\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tfor index, db := range databases {\n\t\t\tif db.InstanceName == removeDbRequest.InstanceName {\n\t\t\t\tdatabases = append(databases[:index], databases[index+1:]...)\n\t\t\t}\n\t\t}\n\t})\n\tremoveDataBaseReq := models.RemoveDatabaseRequest{\n\t\tAction: \"remove\",\n\t\tInstanceName: \"foo\",\n\t\tUsername: \"foo\",\n\t}\n\terr := client.RemoveDatabase(removeDataBaseReq)\n\tif err != nil {\n\t\tt.Errorf(\"failed to remove database: %s\", err.Error())\n\t\tt.FailNow()\n\t}\n\tdbs, err := client.GetDatabases()\n\tif err != nil {\n\t\tt.Errorf(\"failed to get databases: %s\", err.Error())\n\t\tt.FailNow()\n\t}\n\tif len(dbs) != 1 {\n\t\tt.Errorf(\"too many databases\")\n\t\tt.FailNow()\n\t}\n\t_, err = client.GetDatabase(\"foo\")\n\tif err == nil {\n\t\tt.Errorf(\"should have failed\")\n\t\tt.FailNow()\n\t}\n}", "func (h *handle) deQueue(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Dequeue start...\")\n\tfor len(h.reqQueue) > 0 {\n\n\t\treq := h.reqQueue[0]\n\t\tresp := h.respQueue[0]\n\t\t// accoding to request type divided\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\tlog.Println(\"GET request pass to port:3000\")\n\t\t\tlink := \"http://app-svc:3000\" + req.URL.String()\n\t\t\tr, err := http.Get(link)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"GET method request err : \", err)\n\t\t\t}\n\t\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"response body read error : \", err)\n\t\t\t}\n\t\t\tresp.Write(body)\n\n\t\tcase \"POST\", \"PUT\", \"DELETE\":\n\t\t\tlog.Println(\"Request pass to port: 50002\")\n\t\t\tlink := \"http://app-svc:50002\"\n\t\t\turl, _ := url.Parse(link)\n\t\t\tproxy := httputil.NewSingleHostReverseProxy(url)\n\t\t\tproxy.ServeHTTP(resp, &req)\n\t\tdefault:\n\t\t\tlog.Println(\"Unauthoried request!!. \", req.Method)\n\t\t}\n\t\th.reqQueue = h.reqQueue[1:] // remove request\n\t\th.respQueue = h.respQueue[1:] // remove response\n\n\t}\n\t// cancel the context then create new context\n\tcancel()\n\tctx, cancel = context.WithCancel(context.Background())\n}", "func (tqsc *Controller) UnRegisterQueryRuleSource(ruleSource string) {\n}", "func (aMgr *AdminMgr) HandlerDeleteAllTracks(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"content-type\", \"text/plain\")\n\ttrackCount, err := aMgr.DB.DeleteAllTracks()\n\tif err != nil {\n\t\thttp.Error(w, \"error getting count from database\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfmt.Fprint(w, trackCount)\n}", "func drop(res http.ResponseWriter, req *http.Request) {\n\tstmt, err := db.Prepare(`DROP TABLE customer ;`)\n\tcheck(err)\n\tdefer stmt.Close()\n\t_, err = stmt.Exec()\n\tfmt.Fprintln(res, \"Table is deleted\")\n}", "func (s *Server) sqlHandler(w http.ResponseWriter, req *http.Request) {\n\tstate := s.cluster.State()\n\tif state != \"primary\" {\n\t\thttp.Error(w, \"Only the primary can service queries, but this is a \"+state, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tquery, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't read body: %s\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tlog.Debugf(\"[%s] Received query: %#v\", s.cluster.State(), string(query))\n\tresp, err := s.execute(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\n\tr := &Replicate{\n\t\tSelf: s.cluster.self,\n\t\tQuery: query,\n\t}\n\tfor _, member := range s.cluster.members {\n\t\tb := util.JSONEncode(r)\n\t\t_, err := s.client.SafePost(member.ConnectionString, \"/replicate\", b)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Couldn't replicate query to %v: %s\", member, err)\n\t\t}\n\t}\n\n\tlog.Debugf(\"[%s] Returning response to %#v: %#v\", s.cluster.State(), string(query), string(resp))\n\tw.Write(resp)\n}", "func deleteAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to delete config %s\", ctx.Param(\"appId\")))\n\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n _, err = db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n if err := db.DeleteConfigByAppId(appId); err != nil {\n log.Error(fmt.Errorf(\"unable to delete config: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully delete config\"})\n}", "func (dao *sqlimpl) Del(meta *idm.UserMeta) (e error) {\n\tstmt := dao.GetStmt(\"DeleteMeta\")\n\tif stmt == nil {\n\t\treturn fmt.Errorf(\"Unknown statement\")\n\t}\n\tdefer stmt.Close()\n\n\tif _, e := stmt.Exec(meta.Uuid); e != nil {\n\t\treturn e\n\t} else if e := dao.DeletePoliciesForResource(meta.Uuid); e != nil {\n\t\treturn e\n\t}\n\treturn nil\n}", "func (h *Handler) serveDeleteDBUser(w http.ResponseWriter, r *http.Request) {}", "func (b *RawBackend) handleRawDelete(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {\n\tpath := data.Get(\"path\").(string)\n\n\tif b.recoveryMode {\n\t\tb.logger.Info(\"deleting\", \"path\", path)\n\t}\n\n\t// Prevent access of protected paths\n\tfor _, p := range protectedPaths {\n\t\tif strings.HasPrefix(path, p) {\n\t\t\terr := fmt.Sprintf(\"cannot delete '%s'\", path)\n\t\t\treturn logical.ErrorResponse(err), logical.ErrInvalidRequest\n\t\t}\n\t}\n\n\tif err := b.barrier.Delete(ctx, path); err != nil {\n\t\treturn handleErrorNoReadOnlyForward(err)\n\t}\n\treturn nil, nil\n}", "func (tqsc *Controller) ClearQueryPlanCache() {\n}", "func (h *Handler) serveDeleteSeries(w http.ResponseWriter, r *http.Request) {}", "func TestDestroyHandler(t *testing.T) {\n\tid := \"c79c54de-39ae-46b0-90e5-9f84c77f6974\"\n\tparams := httprouter.Params{\n\t\thttprouter.Param{Key: \"id\", Value: id},\n\t}\n\ts := Subscription{\n\t\tEventType: \"test_type\",\n\t\tContext: \"test_context\",\n\t}\n\n\th := Handler{\n\t\tdb: MockDatabase{\n\t\t\ts: s,\n\t\t\tgetID: id,\n\t\t},\n\t}\n\n\treq, w := newReqParams(\"GET\")\n\n\th.Destroy(w, req, params)\n\n\tcases := []struct {\n\t\tlabel, actual, expected interface{}\n\t}{\n\t\t{\"Response code\", w.Code, 200},\n\t\t{\"Response body contains context\", strings.Contains(w.Body.String(), s.Context), true},\n\t\t{\"Response body contains event type\", strings.Contains(w.Body.String(), s.EventType), true},\n\t}\n\th.Index(w, req, httprouter.Params{})\n\n\ttestCases(t, cases)\n\tcases = []struct {\n\t\tlabel, actual, expected interface{}\n\t}{\n\t\t{\"Response body doesn't contain the id\", strings.Contains(w.Body.String(), id), false},\n\t}\n\ttestCases(t, cases)\n}", "func PrepareForDeleteUser(roundTripper *mhttp.MockRoundTripper, rootURL, userName, user, passwd string) (\n\tresponse *http.Response) {\n\trequest, _ := http.NewRequest(http.MethodPost, fmt.Sprintf(\"%s/securityRealm/user/%s/doDelete\", rootURL, userName), nil)\n\trequest.Header.Add(httpdownloader.ContentType, httpdownloader.ApplicationForm)\n\tresponse = PrepareCommonPost(request, \"\", roundTripper, user, passwd, rootURL)\n\treturn\n}", "func (h *rawContainerHandler) Cleanup() {}", "func (sp *SessionProvider) Remove(db, c string, q interface{}) error {\n\tsession, err := sp.GetSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\t_, err = session.DB(db).C(c).RemoveAll(q)\n\treturn err\n}", "func DeleteQueries(n int32, ids *uint32) {\n\tC.glowDeleteQueries(gpDeleteQueries, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(ids)))\n}", "func DeleteQueries(n int32, ids *uint32) {\n\tC.glowDeleteQueries(gpDeleteQueries, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(ids)))\n}", "func onDataSourceDelete(ctx context.Context, deletedSource string) {\n\n\t// TODO - find a way to delete datasources - surely a config watch\n\n\tlog.Logger(ctx).Info(\"Sync = Send Event Server-wide for \" + deletedSource)\n\tcl := defaults.NewClient()\n\tcl.Publish(ctx, cl.NewPublication(common.TOPIC_DATASOURCE_EVENT, &object.DataSourceEvent{\n\t\tType: object.DataSourceEvent_DELETE,\n\t\tName: deletedSource,\n\t}))\n\n}", "func (c ConsumerInterceptor) PostUnbind(bindID string) {\n\tc.cleanUpConfig(bindID, func(index int, err error) bool {\n\t\treturn err != nil && index > 2\n\t})\n}", "func (s *session) handleQUIT(args []string) error {\n\tbye := func() error {\n\t\ts.state = stateTerminateConnection\n\t\treturn s.respondOK(\"dewey POP3 server signing off\")\n\t}\n\tif s.state == stateAuthorization {\n\t\treturn bye()\n\t}\n\ts.state = stateUpdate // so that no future calls will succeed\n\tvar delMsg []uint64\n\tfor key := range s.markedDeleted {\n\t\tdelMsg = append(delMsg, key)\n\t}\n\tif err := s.handler.DeleteMessages(delMsg); err != nil {\n\t\treturn err\n\t}\n\treturn bye()\n}", "func HandleQueryData(ctx context.Context, d Datasource, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {\n\tresponses := backend.Responses{}\n\tfor _, v := range req.Queries {\n\t\tresponses[v.RefID] = dfutil.FrameResponseWithError(processQuery(ctx, d, v))\n\t}\n\n\treturn &backend.QueryDataResponse{\n\t\tResponses: responses,\n\t}, nil\n}", "func (bs Bindings) Remove() {\n\tfor _, b := range bs {\n\t\tb.Remove()\n\t}\n}", "func DeprovisionHandler(c *gin.Context) {\n\tvar planInfo = model.PlanID{}\n\terr := json.Unmarshal([]byte(c.Query(\"plan_id\")), &planInfo)\n\tif err != nil {\n\t\tlog.Panic(fmt.Sprintf(\"Unable to unmarshal PlanID: %s\", err))\n\t}\n\tserviceName := planInfo.LibsServiceName\n\n\tinstanceID := c.Param(\"instanceID\")\n\tvolumeID, err := libstoragewrapper.GetVolumeID(NewLibsClient(), serviceName, instanceID)\n\tif err != nil {\n\t\tlog.Panic(fmt.Sprintf(\"error service instance with ID %s does not exist. %s\", instanceID, err))\n\t}\n\n\terr = libstoragewrapper.RemoveVolume(NewLibsClient(), serviceName, volumeID)\n\tif err != nil {\n\t\tlog.Panic(\"error removing volume using libstorage\", err)\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{})\n}", "func (h *DeleteServerHandlerImpl) Handle(params server.DeleteServerParams, principal interface{}) middleware.Responder {\n\tt := \"\"\n\tv := int64(0)\n\tif params.TransactionID != nil {\n\t\tt = *params.TransactionID\n\t}\n\tif params.Version != nil {\n\t\tv = *params.Version\n\t}\n\n\tif t != \"\" && *params.ForceReload {\n\t\tmsg := \"Both force_reload and transaction specified, specify only one\"\n\t\tc := misc.ErrHTTPBadRequest\n\t\te := &models.Error{\n\t\t\tMessage: &msg,\n\t\t\tCode: &c,\n\t\t}\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tconfiguration, err := h.Client.Configuration()\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tpType, pName, err := serverTypeParams(params.Backend, params.ParentType, params.ParentName)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\terr = configuration.DeleteServer(params.Name, pType, pName, t, v)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tif params.TransactionID == nil {\n\t\tif *params.ForceReload {\n\t\t\terr := h.ReloadAgent.ForceReload()\n\t\t\tif err != nil {\n\t\t\t\te := misc.HandleError(err)\n\t\t\t\treturn server.NewDeleteServerDefault(int(*e.Code)).WithPayload(e)\n\t\t\t}\n\t\t\treturn server.NewDeleteServerNoContent()\n\t\t}\n\t\trID := h.ReloadAgent.Reload()\n\t\treturn server.NewDeleteServerAccepted().WithReloadID(rID)\n\t}\n\treturn server.NewDeleteServerAccepted()\n}", "func (db *EdDb) buildPreparedStatements() (err error) {\n\n\tfor title, sqlCommand := range db.preparedStatements() {\n\t\tdb.statements[title], err = db.dbConn.PrepareNamed(sqlCommand)\n\t\tif err != nil {\n\t\t\tlog.Fatal(fmt.Sprint(\"buildPreparedStatement:\", title, \" \", err))\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (p *SQLResourcesDeleteSQLDatabasePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (r *Route) prepare() {\n\tif r.middlewareHandlers != nil {\n\t\tr.hasMiddleware = true\n\t}\n\tconvertedMiddleware := MiddlewareHandlerFunc(func(ctx *Context, next Handler) {\n\t\tr.handler.Serve(ctx)\n\t\t//except itself\n\t\tif r.middlewareHandlers != nil && len(r.middlewareHandlers) > 1 {\n\t\t\tnext.Serve(ctx)\n\t\t}\n\t})\n\n\tr.Use(convertedMiddleware)\n\n}", "func (c *Cursor) HandleStmtExecute(context interface{}, query string, args []interface{}) (result *my.Result, err error) {\n\t// same to COM_STMT_PREPARE\n\terr = my.NewError(my.ER_NOT_SUPPORTED_YET, \"stmt execute is not supported yet\")\n\treturn\n}", "func (r *Reader) prepareStatement(\n\tctx context.Context,\n\tdb *sql.DB,\n\tstoreID uint64,\n\topts *options.ReaderOptions,\n) error {\n\tfilter := \"\"\n\tif opts.FilterByEventType {\n\t\ttypes := strings.Join(escapeStrings(opts.EventTypes), `, `)\n\t\tfilter = `AND e.event_type IN (` + types + `)`\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t`SELECT\n\t\t\tf.offset,\n\t\t\tf.time,\n\t\t\te.event_type,\n\t\t\te.content_type,\n\t\t\te.body,\n\t\t\tCURRENT_TIMESTAMP(6)\n\t\tFROM fact AS f\n\t\tINNER JOIN event AS e\n\t\tON e.id = f.event_id\n\t\t%s\n\t\tWHERE f.store_id = %d\n\t\t\tAND f.stream = %s\n\t\t\tAND f.offset >= ?\n\t\tORDER BY offset\n\t\tLIMIT %d`,\n\t\tfilter,\n\t\tstoreID,\n\t\tescapeString(r.addr.Stream),\n\t\tcap(r.facts),\n\t)\n\n\tstmt, err := db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.stmt = stmt\n\n\treturn nil\n}", "func DeleteTableHandler(w http.ResponseWriter, req *http.Request) {\n\tif bbpd_runinfo.BBPDAbortIfClosed(w) {\n\t\treturn\n\t}\n\tif req.Method == \"POST\" {\n\t\tdeleteTable_POST_Handler(w, req)\n\t} else {\n\t\te := fmt.Sprintf(\"delete_table_route.DeleteTablesHandler:bad method %s\", req.Method)\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t}\n}", "func RemoveAll(collection string, query interface{}) error {\n\tsession, db, err := GetGlobalSessionFactory().GetSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\t_, err = db.C(collection).RemoveAll(query)\n\treturn err\n}", "func destroyHandler(s *search.SearchServer, w http.ResponseWriter, r *http.Request) {\n\tparams := r.URL.Query()\n\tcollection := params.Get(\"collection\")\n\n\tif collection == \"\" {\n\t\trespondWithError(w, r, \"Collection query parameter is required\")\n\t\treturn\n\t}\n\n\tif !s.Exists(collection) {\n\t\trespondWithError(w, r, \"Collection does not exist\")\n\t\treturn\n\t}\n\n\ts.Destroy(collection)\n\trespondWithSuccess(w, r, \"collection destroyed\")\n}", "func (sc *ServerConn) deleteSubscriptions() {\n\tsc.ntfnHandlersMtx.Lock()\n\tdefer sc.ntfnHandlersMtx.Unlock()\n\tfor method, cs := range sc.ntfnHandlers {\n\t\tfor _, c := range cs {\n\t\t\tclose(c) // sub handler loop receives nil immediately\n\t\t}\n\t\tdelete(sc.ntfnHandlers, method)\n\t}\n}", "func prepareStmts(db *sql.DB, unprepared map[string]string) (map[string]*sql.Stmt, error) {\n\tprepared := map[string]*sql.Stmt{}\n\tfor k, v := range unprepared {\n\t\tstmt, err := db.Prepare(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprepared[k] = stmt\n\t}\n\n\treturn prepared, nil\n}", "func PrepareStatements(db *sql.DB, preparedStmts map[string]*sql.Stmt, unpreparedStmts map[string]string) error {\n var key string\n var value string\n var err error\n var stmt *sql.Stmt\n\n for key, value = range unpreparedStmts {\n stmt, err = db.Prepare(value)\n\n if err != nil {\n return err\n }\n\n preparedStmts[key] = stmt\n }\n\n return nil\n}" ]
[ "0.5888563", "0.5686316", "0.5609039", "0.54530954", "0.54413426", "0.53977615", "0.51517636", "0.50869685", "0.4974192", "0.4917651", "0.46468815", "0.46307215", "0.45987618", "0.4592117", "0.4565425", "0.4542091", "0.45192263", "0.4510304", "0.45095384", "0.44702333", "0.44648066", "0.4451642", "0.4440039", "0.44278276", "0.44060498", "0.43798956", "0.4358428", "0.4355933", "0.43519324", "0.43487668", "0.43464652", "0.43459475", "0.43241203", "0.43198267", "0.431897", "0.4316596", "0.43159258", "0.43156314", "0.42967162", "0.42830783", "0.42699203", "0.4264992", "0.42613855", "0.4260616", "0.42405507", "0.42311814", "0.4222949", "0.4220092", "0.4220076", "0.42142212", "0.42118743", "0.42115182", "0.4207554", "0.41886765", "0.41882077", "0.4187745", "0.4187118", "0.4187118", "0.41800463", "0.41781735", "0.417626", "0.41710567", "0.41705889", "0.41666403", "0.4162496", "0.4160743", "0.41490585", "0.4147692", "0.41469988", "0.41457012", "0.4145653", "0.41427717", "0.41361117", "0.41287827", "0.41271323", "0.41271174", "0.41145685", "0.41134813", "0.4106305", "0.41013846", "0.40916157", "0.40916157", "0.40889892", "0.408685", "0.40844324", "0.40844065", "0.40806162", "0.40796867", "0.40778682", "0.40774935", "0.40744847", "0.40708205", "0.4061791", "0.4061077", "0.40599266", "0.40577263", "0.40507495", "0.4050332", "0.40493", "0.40475762" ]
0.8162098
0
HandleModifySchema is an endpoint handler which updates the existing schema & updates the config
func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) v := config.TableRule{} _ = json.NewDecoder(r.Body).Decode(&v) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] col := vars["col"] // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() logicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } schema := modules.Schema() if err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } if err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func HandleReloadSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tschema := modules.Schema()\n\t\tcolResult, err := syncman.SetReloadSchema(ctx, dbAlias, projectID, schema)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: colResult})\n\t\t// return\n\t}\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func SchemaUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tupdatedSchema := schemas.Schema{}\n\n\terr = json.NewDecoder(r.Body).Decode(&updatedSchema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif updatedSchema.FullName != \"\" {\n\t\t_, schemaName, err := schemas.ExtractSchema(updatedSchema.FullName)\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tupdatedSchema.Name = schemaName\n\t}\n\n\tschema, err := schemas.Update(schemasList.Schemas[0], updatedSchema.Name, updatedSchema.Type, updatedSchema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func AlterSchema(dg *dgo.Dgraph, ctx *context.Context, schema *string) error {\n\top := &api.Operation{}\n\top.Schema = *schema\n\terr := dg.Alter(*ctx, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (gc *GraphClient) UpdateSchema(sg schema.SchemaGraph) error {\n\trequestBody := PutGraphSchemaRequestBody{}\n\trequestBody.Schema = sg\n\n\tb, err := json.Marshal(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to marshall request body\")\n\t}\n\n\treq, err := gc.newRequest(context.Background(), \"PUT\", \"/api/graph/schema\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := gc.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode == http.StatusUnauthorized {\n\t\treturn fmt.Errorf(\"Unauthorized access. Check your auth token\")\n\t} else if res.StatusCode == http.StatusTooManyRequests {\n\t\treturn ErrTooManyRequests\n\t} else if res.StatusCode != http.StatusOK {\n\t\treturn handleUnexpectedResponse(res)\n\t}\n\treturn nil\n}", "func updateSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tif params.database == schema.DryrunDBName {\n\t\tp := *params\n\t\tif err := doCreateDatabase(p, p.database); err != nil {\n\t\t\treturn handleErr(fmt.Errorf(\"error creating dryrun database: %v\", err))\n\t\t}\n\t\tdefer doDropDatabase(p, p.database)\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Update(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func SchemaChange(svc string, cluster string, sdb string, table string, inputType string, output string, version int, formatType string, alter string, dst string) error {\n\tvar ts types.TableSchema\n\tvar rs string\n\tvar err error\n\n\tif rs, err = schema.GetRaw(&db.Loc{Cluster: cluster, Service: svc, Name: sdb}, table, inputType); log.E(err) {\n\t\treturn err\n\t}\n\n\tif !schema.MutateTable(state.GetDB(), svc, sdb, table, alter, &ts, &rs) {\n\t\treturn fmt.Errorf(\"error applying alter table\")\n\t}\n\n\tavroSchema, err := schema.ConvertToAvroFromSchema(&ts, formatType)\n\tif log.E(err) {\n\t\treturn err\n\t}\n\n\toutputSchemaName, err := encoder.GetOutputSchemaName(svc, sdb, table, inputType, output, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dst == \"state\" || dst == \"all\" {\n\t\terr = state.UpdateSchema(outputSchemaName, formatType, string(avroSchema))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"Change schema for(%v,%v,%v,%v,%v,%v) = %s, from %v\", svc, sdb, table, inputType, output, version, avroSchema, alter)\n\treturn nil\n}", "func (s *Manager) SetModifySchema(ctx context.Context, project, dbAlias, col, schema string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update schema in config\n\tcollection, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn errors.New(\"specified database not present in config\")\n\t}\n\tif collection.Collections == nil {\n\t\tcollection.Collections = map[string]*config.TableRule{}\n\t}\n\ttemp, ok := collection.Collections[col]\n\tif !ok {\n\t\tcollection.Collections[col] = &config.TableRule{Schema: schema, Rules: map[string]*config.Rule{}}\n\t} else {\n\t\ttemp.Schema = schema\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func Update(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tfor i, elem := range schema {\n\t\tif elem.Config.Name == params[\"name\"] {\n\t\t\tschema = append(schema[:i], schema[i+1:]...)\n\t\t\tvar updateSchema Schema\n\t\t\tjson.NewDecoder(r.Body).Decode(&updateSchema)\n\t\t\tupdateSchema.Config.Name = params[\"name\"]\n\t\t\tschema = append(schema, updateSchema)\n\t\t\tjson.NewEncoder(w).Encode(updateSchema)\n\t\t\treturn\n\t\t}\n\t}\n}", "func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error {\n\tgvk := schema.GroupVersionKind{\n\t\tGroup: crd.Spec.Group,\n\t\tVersion: GetVersionFromCRD(crd),\n\t\tKind: crd.Spec.Names.Kind,\n\t}\n\tif schemaRef.GVK.String() != gvk.String() {\n\t\treturn fmt.Errorf(\"unexpected mismatch of GVK when updating schema reference for controller, old GVK = %s, new GVK = %s\", schemaRef.GVK.String(), gvk.String())\n\t}\n\tschemaRef.CRD = crd\n\tschemaRef.JsonSchema = GetOpenAPIV3SchemaFromCRD(crd)\n\treturn nil\n}", "func PutSchema(registry sources.Registry, graphUpdater *knowledge.GraphUpdater, sem *semaphore.Weighted) http.HandlerFunc {\n\treturn handleUpdate(registry, func(ctx context.Context, source string, body io.Reader) error {\n\t\trequestBody := client.PutGraphSchemaRequestBody{}\n\t\tif err := json.NewDecoder(body).Decode(&requestBody); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// TODO(c.michaud): verify compatibility of the schema with graph updates\n\t\terr := graphUpdater.UpdateSchema(ctx, source, requestBody.Schema)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to update the schema: %v\", err)\n\t\t}\n\n\t\tlabels := prometheus.Labels{\"source\": source}\n\t\tmetrics.GraphUpdateSchemaUpdatedCounter.\n\t\t\tWith(labels).\n\t\t\tInc()\n\t\treturn nil\n\t}, sem, \"update_schema\")\n}", "func (tqsc *Controller) ReloadSchema(ctx context.Context) error {\n\treturn nil\n}", "func HandleInspectCollectionSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tcol := vars[\"col\"]\n\t\tprojectID := vars[\"project\"]\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\ts, err := schema.SchemaInspection(ctx, dbAlias, logicalDBName, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetSchemaInspection(ctx, projectID, dbAlias, col, s); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: s})\n\t\t// return\n\t}\n}", "func UpdateSchemaDescriptor(schema *descriptorpb.DescriptorProto) AppendOption {\n\treturn func(pw *pendingWrite) {\n\t\tpw.newSchema = schema\n\t}\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func UpdateSchema(gqlConfig GraphQLConfig, schemaConfig schema.Config) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\terr := ready.Validate(ctx, gqlConfig.URL, 5*time.Second)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"waiting for database to be ready, database timed out or does not exist\")\n\t}\n\n\tgql := NewGraphQL(gqlConfig)\n\n\tschema, err := schema.New(gql, schemaConfig)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"preparing schema\")\n\t}\n\n\tif err := schema.Create(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"creating schema\")\n\t}\n\n\treturn nil\n}", "func (s *Manager) SetModifyAllSchema(ctx context.Context, dbAlias, project string, v config.CrudStub) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.applySchemas(ctx, project, dbAlias, projectConfig, v); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func (fmd *FakeMysqlDaemon) ApplySchemaChange(ctx context.Context, dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tbeforeSchema, err := fmd.SchemaFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdbaCon, err := fmd.GetDbaConnection(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = fmd.db.HandleQuery(dbaCon.Conn, change.SQL, func(*sqltypes.Result) error { return nil }); err != nil {\n\t\treturn nil, err\n\t}\n\n\tafterSchema, err := fmd.SchemaFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &tabletmanagerdatapb.SchemaChangeResult{\n\t\tBeforeSchema: beforeSchema,\n\t\tAfterSchema: afterSchema}, nil\n}", "func RenameSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\tnewIndex := c.Param(\"newIndex\")\n\tif _, err := conf.LoadSchema(index); err != nil {\n\t\tc.Error(http.StatusNotFound, fmt.Sprintf(\"index %s not found\", index))\n\t\treturn\n\t}\n\tif _, err := conf.LoadSchema(newIndex); err == nil {\n\t\tc.Error(http.StatusInternalServerError, fmt.Sprintf(\"index %s alreday exists\", newIndex))\n\t\treturn\n\t}\n\n\tindexer.LruRemove(index)\n\tindexer.RemoveIndexer(index)\n\n\tif err := conf.RenameSchema(index, newIndex); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": fmt.Sprintf(\"index %s renamed to %s OK\", index, newIndex),\n\t})\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}", "func (s *Manager) SetReloadSchema(ctx context.Context, dbAlias, project string, schemaArg *schema.Schema) (map[string]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollectionConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn nil, errors.New(\"specified database not present in config\")\n\t}\n\tcolResult := map[string]interface{}{}\n\tfor colName, colValue := range collectionConfig.Collections {\n\t\tif colName == \"default\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult, err := schemaArg.SchemaInspection(ctx, dbAlias, project, colName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set new schema in config & return in response body\n\t\tcolValue.Schema = result\n\t\tcolResult[colName] = result\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn colResult, s.setProject(ctx, projectConfig)\n}", "func (s *Service) reloadSchema(pkg factset.Package, schemaVersion *factset.PackageVersion) error {\n\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Debugf(\"Reloading schema for package: %s\", pkg.Product)\n\tif err := s.db.DropTablesWithProductAndBundle(pkg.Product, pkg.Bundle); err != nil {\n\t\treturn err\n\t}\n\tschemaFileDetails := s.getSchemaDetails(pkg, schemaVersion)\n\tschemaFileArchive, err := s.factset.Download(*schemaFileDetails, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tschemaFiles, err := s.unzipFile(schemaFileArchive, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, file := range schemaFiles {\n\t\tif strings.HasSuffix(file, \".sql\") {\n\t\t\tfileContents, err := ioutil.ReadFile(file)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithFields(log.Fields{\"fs_product\": pkg.Product}).Errorf(\"Could not read file: %s\", file)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = s.db.CreateTablesFromSchema(fileContents, pkg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Infof(\"Updated schema for product %s to version v%d_%d\", pkg.Product, schemaVersion.FeedVersion, schemaVersion.Sequence)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func (p *planner) writeSchemaChange(\n\tctx context.Context, tableDesc *tabledesc.Mutable, mutationID descpb.MutationID, jobDesc string,\n) error {\n\tif !p.EvalContext().TxnImplicit {\n\t\ttelemetry.Inc(sqltelemetry.SchemaChangeInExplicitTxnCounter)\n\t}\n\tif tableDesc.Dropped() {\n\t\t// We don't allow schema changes on a dropped table.\n\t\treturn errors.Errorf(\"no schema changes allowed on table %q as it is being dropped\",\n\t\t\ttableDesc.Name)\n\t}\n\tif !tableDesc.IsNew() {\n\t\tif err := p.createOrUpdateSchemaChangeJob(ctx, tableDesc, jobDesc, mutationID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn p.writeTableDesc(ctx, tableDesc)\n}", "func (db *DatabaseModel) SetSchema(schema *ovsdb.DatabaseSchema) []error {\n\tdb.mutex.Lock()\n\tdefer db.mutex.Unlock()\n\terrors := db.client.validate(schema)\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\tdb.schema = schema\n\tdb.mapper = mapper.NewMapper(schema)\n\terrs := db.generateModelInfo()\n\tif len(errs) > 0 {\n\t\tdb.schema = nil\n\t\tdb.mapper = nil\n\t\treturn errs\n\t}\n\treturn []error{}\n}", "func (s *Manager) SetEventingSchema(ctx context.Context, project string, evType string, schema string, params model.RequestParams) (int, error) {\n\t// Check if the request has been hijacked\n\thookResponse := s.integrationMan.InvokeHook(ctx, params)\n\tif hookResponse.CheckResponse() {\n\t\t// Check if an error occurred\n\t\tif err := hookResponse.Error(); err != nil {\n\t\t\treturn hookResponse.Status(), err\n\t\t}\n\n\t\t// Gracefully return\n\t\treturn hookResponse.Status(), nil\n\t}\n\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\n\tresourceID := config.GenerateResourceID(s.clusterID, project, config.ResourceEventingSchema, evType)\n\tv := &config.EventingSchema{Schema: schema, ID: evType}\n\tif projectConfig.EventingSchemas == nil {\n\t\tprojectConfig.EventingSchemas = config.EventingSchemas{resourceID: v}\n\t} else {\n\t\tprojectConfig.EventingSchemas[resourceID] = v\n\t}\n\n\tif err := s.modules.SetEventingSchemaConfig(ctx, project, projectConfig.EventingSchemas); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif err := s.store.SetResource(ctx, resourceID, v); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func modifyAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to modify config %s\", ctx.Param(\"appId\")))\n var request struct{Operation []map[string]interface{} `json:\"operation\" binding:\"required\"`}\n // parse config from request body\n if err := ctx.ShouldBind(&request); err != nil {\n log.Error(fmt.Errorf(\"unable to extract JSON Patch from body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n current, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // perform JSON patch on config\n updated, err := PatchConfig(current, request.Operation)\n if err != nil {\n switch err {\n case ErrInvalidJSONConfig, ErrInvalidPatch:\n log.Warn(fmt.Sprintf(\"cannot process JSON Patch %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"http_code\": http.StatusBadRequest, \"message\": \"Invalid JSON Patch Operation\"})\n default:\n log.Error(fmt.Errorf(\"unable to apply JSON Patch: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // update config in postgres database\n if err := db.UpdateConfigByAppId(appId, updated); err != nil {\n log.Error(fmt.Errorf(\"unable to updated config in database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully updated config\"})\n}", "func (mh *MetadataHandler) HandlePutMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvar payload metadata.ApplicationMetadata\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\terr = yaml.Unmarshal(b, &payload)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\t// validate the payload first\n\tvalid, desc := payload.IsValid()\n\tif !valid {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\tyaml.NewEncoder(w).Encode(desc)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tvar (\n\t\tappID string\n\t\tok bool\n\t)\n\tif appID, ok = vars[\"appID\"]; !ok {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\tpayload.ApplicationID = appID\n\n\terr = mh.Repository.Update(appID, &payload)\n\tif err != nil {\n\t\tif err == repository.ErrIDNotFound {\n\t\t\tw.WriteHeader(http.StatusConflict) // 409\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\t}\n\t\tyaml.NewEncoder(w).Encode(err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK) // 200\n\tyaml.NewEncoder(w).Encode(payload)\n}", "func (c *Client) UpdateSchemaDevice(ctx context.Context, path string, payload *UpdateDeviceSourceSchemaPayload) (*http.Response, error) {\n\treq, err := c.NewUpdateSchemaDeviceRequest(ctx, path, payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "func (m *ExternalConnection) SetSchema(value Schemaable)() {\n m.schema = value\n}", "func generateGoSchemaFile(schema map[string]interface{}, config Config) {\r\n var obj map[string]interface{}\r\n var schemas = make(map[string]interface{})\r\n var outString = \"package main\\n\\nvar schemas = `\\n\"\r\n\r\n var filename = config.Schemas.GoSchemaFilename\r\n var apiFunctions = config.Schemas.API\r\n var elementNames = config.Schemas.GoSchemaElements\r\n \r\n var functionKey = \"API\"\r\n var objectModelKey = \"objectModelSchemas\"\r\n \r\n schemas[functionKey] = interface{}(make(map[string]interface{}))\r\n schemas[objectModelKey] = interface{}(make(map[string]interface{}))\r\n\r\n fmt.Printf(\"Generate Go SCHEMA file %s for: \\n %s and: \\n %s\\n\", filename, apiFunctions, elementNames)\r\n\r\n // grab the event API functions for input\r\n for i := range apiFunctions {\r\n functionSchemaName := \"#/definitions/API/\" + apiFunctions[i]\r\n functionName := apiFunctions[i]\r\n obj = getObject(schema, functionSchemaName)\r\n if obj == nil {\r\n fmt.Printf(\"** WARN ** %s returned nil from getObject\\n\", functionSchemaName)\r\n return\r\n }\r\n schemas[functionKey].(map[string]interface{})[functionName] = obj \r\n } \r\n\r\n // grab the elements requested (these are useful separately even though\r\n // they obviously appear already as part of the event API functions)\r\n for i := range elementNames {\r\n elementName := elementNames[i]\r\n obj = getObject(schema, elementName)\r\n if obj == nil {\r\n fmt.Printf(\"** ERR ** %s returned nil from getObject\\n\", elementName)\r\n return\r\n }\r\n schemas[objectModelKey].(map[string]interface{})[elementName] = obj \r\n }\r\n \r\n // marshal for output to file \r\n schemaOut, err := json.MarshalIndent(&schemas, \"\", \" \")\r\n if err != nil {\r\n fmt.Printf(\"** ERR ** cannot marshal schema file output for writing\\n\")\r\n return\r\n }\r\n outString += string(schemaOut) + \"`\"\r\n ioutil.WriteFile(filename, []byte(outString), 0644)\r\n}", "func (p *planner) notifySchemaChange(\n\ttableDesc *sqlbase.TableDescriptor, mutationID sqlbase.MutationID,\n) {\n\tsc := SchemaChanger{\n\t\ttableID: tableDesc.GetID(),\n\t\tmutationID: mutationID,\n\t\tnodeID: p.extendedEvalCtx.NodeID,\n\t\tleaseMgr: p.LeaseMgr(),\n\t\tjobRegistry: p.ExecCfg().JobRegistry,\n\t\tleaseHolderCache: p.ExecCfg().LeaseHolderCache,\n\t\trangeDescriptorCache: p.ExecCfg().RangeDescriptorCache,\n\t\tclock: p.ExecCfg().Clock,\n\t\tsettings: p.ExecCfg().Settings,\n\t\texecCfg: p.ExecCfg(),\n\t}\n\tp.extendedEvalCtx.SchemaChangers.queueSchemaChanger(sc)\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func (ar *AppendResult) UpdatedSchema(ctx context.Context) (*storagepb.TableSchema, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase <-ar.Ready():\n\t\tif ar.response != nil {\n\t\t\tif schema := ar.response.GetUpdatedSchema(); schema != nil {\n\t\t\t\treturn proto.Clone(schema).(*storagepb.TableSchema), nil\n\t\t\t}\n\t\t}\n\t\treturn nil, nil\n\t}\n}", "func HandleModify(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tfmt.Println(\"In handleModify\")\r\n\tvar ab AddressBook\r\n\tif r.Method != http.MethodPost {\r\n\t\terr := fmt.Sprintf(\"Method %s not supported on this action %s\\n\", r.Method, r.URL.Path)\r\n\t\tfmt.Printf(\"%s\", err)\r\n\t\thttp.Error(w, err, http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n\r\n\tif err := json.NewDecoder(r.Body).Decode(&ab); err != nil {\r\n\t\tmsg := fmt.Sprintf(\"Error %s while decoding json\\n\", err.Error())\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tif ab.FirstName == \"\" {\r\n\t\tmsg := \"Name not provided as part of the query\\n\"\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tMutex.RLock()\r\n\tdefer Mutex.RUnlock()\r\n\tif len(AddrBook) == 0 {\r\n\t\tmsg := fmt.Sprintf(\"Address book is empty nothing to modify\\n\")\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tif abTmp, ok := AddrBook[ab.FirstName]; !ok {\r\n\t\tmsg := fmt.Sprintf(\"%s not found in the Address book, nothing to modify\\n\", abTmp.FirstName)\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\tabTmp, _ := AddrBook[ab.FirstName]\r\n\tif ab.LastName != \"\" && abTmp.LastName != ab.LastName {\r\n\t\tabTmp.LastName = ab.LastName\r\n\t}\r\n\tif ab.Email != \"\" && abTmp.Email != ab.Email {\r\n\t\tabTmp.Email = ab.Email\r\n\t}\r\n\tif ab.PhoneNumber != 0 && abTmp.PhoneNumber != ab.PhoneNumber {\r\n\t\tabTmp.PhoneNumber = ab.PhoneNumber\r\n\t}\r\n\tAddrBook[ab.FirstName] = abTmp\r\n\tmsg := fmt.Sprintf(\"Modified name %s present in the address book\\n\", ab.FirstName)\r\n\tfmt.Printf(\"%s\", msg)\r\n\thttp.Error(w, msg, http.StatusOK)\r\n}", "func setupSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Setup(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func (h *MutatingHandler) Handle(ctx context.Context, req admission.Request) admission.Response {\n\tdefaulter := GetDefaulter(req.Kind.String())\n\tif defaulter == nil {\n\t\treturn admission.Denied(\"crd has webhook configured, but the controller does not register the corresponding processing logic and refuses the operation by default.\")\n\t}\n\n\t// Get the object in the request\n\tobj := defaulter.Obj.DeepCopyObject()\n\terr := h.decoder.Decode(req, obj)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusBadRequest, err)\n\t}\n\n\t// Default the object\n\tdefaulter.Helper.Default(obj)\n\tmarshalled, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusInternalServerError, err)\n\t}\n\n\t// Create the patch\n\treturn admission.PatchResponseFromRaw(req.Object.Raw, marshalled)\n}", "func UpdateSchema() error {\r\n\tif !conf.Config.IsOBSMaster() {\r\n\t\tb := &Block{}\r\n\t\tif found, err := b.GetMaxBlock(); !found {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\treturn migration.UpdateMigrate(&MigrationHistory{})\r\n}", "func (fn DocumentUpdateHandlerFunc) Handle(params DocumentUpdateParams) middleware.Responder {\n\treturn fn(params)\n}", "func UpdateSchemaDevicePath(id int) string {\n\tparam0 := strconv.Itoa(id)\n\n\treturn fmt.Sprintf(\"/sources/devices/%s/schemas\", param0)\n}", "func (un *Decoder) SetSchema(e *yang.Entry) { un.schema = e }", "func (manager *Manager) registerSchema(schema *Schema) error {\n\tif _, ok := manager.schemas[schema.ID]; ok {\n\t\tlog.Warning(\"Overwriting schema %s\", schema.ID)\n\t\treturn nil\n\t}\n\tmanager.schemas[schema.ID] = schema\n\tmanager.schemaOrder = append(manager.schemaOrder, schema.ID)\n\tbaseURL := \"/\"\n\tif schema.Parent != \"\" {\n\t\tparentSchema, ok := manager.schema(schema.Parent)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Parent schema %s of %s not found\", schema.Parent, schema.ID)\n\t\t}\n\t\tschema.SetParentSchema(parentSchema)\n\t}\n\tif schema.NamespaceID != \"\" {\n\t\tnamespace, ok := manager.namespace(schema.NamespaceID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Namespace schema %s of %s not found\", schema.NamespaceID, schema.ID)\n\t\t}\n\t\tschema.SetNamespace(namespace)\n\t\tbaseURL = schema.Namespace.GetFullPrefix() + \"/\"\n\t}\n\tif schema.Prefix != \"\" {\n\t\tbaseURL = baseURL + strings.TrimPrefix(schema.Prefix, \"/\") + \"/\"\n\t}\n\tschema.URL = baseURL + schema.Plural\n\tif schema.Parent != \"\" {\n\t\tschema.URLWithParents = baseURL + strings.TrimPrefix(schema.GetParentURL(), \"/\") + \"/\" + schema.Plural\n\t} else {\n\t\tschema.URLWithParents = schema.URL\n\t}\n\treturn nil\n}", "func (fn UpdateAppAutoScaleHandlerFunc) Handle(params UpdateAppAutoScaleParams, principal interface{}) middleware.Responder {\n\treturn fn(params, principal)\n}", "func ReloadSchema() {\n\tdefer logError()\n\tSqlQueryRpcService.qe.schemaInfo.triggerReload()\n}", "func (api *APIServer) httpConfigUpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tif locked := api.lock.TryAcquire(1); !locked {\n\t\tlog.Println(ErrAPILocked)\n\t\twriteError(w, http.StatusServiceUnavailable, \"update\", ErrAPILocked)\n\t\treturn\n\t}\n\tdefer api.lock.Release(1)\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"reading body error: %v\", err))\n\t\treturn\n\t}\n\n\tnewConfig := DefaultConfig()\n\tif err := yaml.Unmarshal(body, &newConfig); err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"error parsing new config: %v\", err))\n\t\treturn\n\t}\n\n\tif err := validateConfig(newConfig); err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"error validating new config: %v\", err))\n\t\treturn\n\t}\n\tlog.Printf(\"Applying new valid config\")\n\tapi.config = *newConfig\n\tapi.restart <- struct{}{}\n}", "func UpdateCommentHandle(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.CommentModel\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\tcommentService, serviceErr := service.NewCommentService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\n\t\tupdatedComment := &domain.Comment{\n\t\t\tObjectId: model.ObjectId,\n\t\t\tOwnerUserId: req.UserID,\n\t\t\tPostId: model.PostId,\n\t\t\tScore: model.Score,\n\t\t\tText: model.Text,\n\t\t\tOwnerDisplayName: req.DisplayName,\n\t\t\tOwnerAvatar: req.Avatar,\n\t\t\tDeleted: model.Deleted,\n\t\t\tDeletedDate: model.DeletedDate,\n\t\t\tCreatedDate: model.CreatedDate,\n\t\t\tLastUpdated: model.LastUpdated,\n\t\t}\n\n\t\tif err := commentService.UpdateCommentById(updatedComment); err != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Update Comment Error %s\", err.Error())\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"updateCommentError\", 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}", "func (s *Manager) SetEventingSchema(ctx context.Context, project string, evType string, schema string, params model.RequestParams) (int, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\n\tif len(projectConfig.Modules.Eventing.Schemas) != 0 {\n\t\tprojectConfig.Modules.Eventing.Schemas[evType] = config.SchemaObject{Schema: schema, ID: evType}\n\t} else {\n\t\tprojectConfig.Modules.Eventing.Schemas = map[string]config.SchemaObject{\n\t\t\tevType: {Schema: schema, ID: evType},\n\t\t}\n\t}\n\n\tif err := s.modules.SetEventingConfig(project, &projectConfig.Modules.Eventing); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif err := s.setProject(ctx, projectConfig); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func (mutator *Mutator) Handle(ctx context.Context, req types.Request) types.Response {\n\tdeployment := &appsv1.Deployment{}\n\n\tif err := mutator.Decoder.Decode(req, deployment); err != nil {\n\t\treturn admission.ErrorResponse(http.StatusBadRequest, err)\n\t}\n\n\tif err := mutate(deployment); err != nil {\n\t\treturn admission.ErrorResponse(http.StatusInternalServerError, err)\n\t}\n\n\tpatch, err := json.Marshal(deployment)\n\tif err != nil {\n\t\treturn admission.ErrorResponse(http.StatusInternalServerError, err)\n\t}\n\n\treturn third_party.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, patch)\n}", "func appSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\thost, err := config.GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := []link{\n\t\t{\"href\": host + \"/apps/{name}/log\", \"method\": \"GET\", \"rel\": \"log\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"GET\", \"rel\": \"get_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"POST\", \"rel\": \"set_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"DELETE\", \"rel\": \"unset_env\"},\n\t\t{\"href\": host + \"/apps/{name}/restart\", \"method\": \"GET\", \"rel\": \"restart\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"POST\", \"rel\": \"update\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"DELETE\", \"rel\": \"delete\"},\n\t\t{\"href\": host + \"/apps/{name}/run\", \"method\": \"POST\", \"rel\": \"run\"},\n\t}\n\ts := schema{\n\t\tTitle: \"app schema\",\n\t\tType: \"object\",\n\t\tLinks: l,\n\t\tRequired: []string{\"platform\", \"name\"},\n\t\tProperties: map[string]property{\n\t\t\t\"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"platform\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"ip\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"cname\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func (h *ReplaceServerHandlerImpl) Handle(params server.ReplaceServerParams, principal interface{}) middleware.Responder {\n\tt := \"\"\n\tv := int64(0)\n\tif params.TransactionID != nil {\n\t\tt = *params.TransactionID\n\t}\n\tif params.Version != nil {\n\t\tv = *params.Version\n\t}\n\n\tif t != \"\" && *params.ForceReload {\n\t\tmsg := \"Both force_reload and transaction specified, specify only one\"\n\t\tc := misc.ErrHTTPBadRequest\n\t\te := &models.Error{\n\t\t\tMessage: &msg,\n\t\t\tCode: &c,\n\t\t}\n\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tconfiguration, err := h.Client.Configuration()\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tpType, pName, err := serverTypeParams(params.Backend, params.ParentType, params.ParentName)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\t_, ondisk, err := configuration.GetServer(params.Name, pType, pName, t)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\terr = configuration.EditServer(params.Name, pType, pName, params.Data, t, v)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t}\n\tif params.TransactionID == nil {\n\t\treload := changeThroughRuntimeAPI(*params.Data, *ondisk, pType, \"\", h.Client)\n\t\tif reload {\n\t\t\tif *params.ForceReload {\n\t\t\t\terr := h.ReloadAgent.ForceReload()\n\t\t\t\tif err != nil {\n\t\t\t\t\te := misc.HandleError(err)\n\t\t\t\t\treturn server.NewReplaceServerDefault(int(*e.Code)).WithPayload(e)\n\t\t\t\t}\n\t\t\t\treturn server.NewReplaceServerOK().WithPayload(params.Data)\n\t\t\t}\n\t\t\trID := h.ReloadAgent.Reload()\n\t\t\treturn server.NewReplaceServerAccepted().WithReloadID(rID).WithPayload(params.Data)\n\t\t}\n\t\treturn server.NewReplaceServerOK().WithPayload(params.Data)\n\t}\n\treturn server.NewReplaceServerAccepted().WithPayload(params.Data)\n}", "func (app *Application) HandleDescriptorWrite(srvUUID string, charUUID string, descUUID string, value []byte) *CallbackError {\n\tif app.config.DescWriteFunc == nil {\n\t\treturn NewCallbackError(-1, \"No callback registered.\")\n\t}\n\n\terr := app.config.DescWriteFunc(app, srvUUID, charUUID, descUUID, value)\n\tif err != nil {\n\t\treturn NewCallbackError(-2, err.Error())\n\t}\n\n\treturn nil\n}", "func (m *SynchronizationJob) SetSchema(value SynchronizationSchemaable)() {\n err := m.GetBackingStore().Set(\"schema\", value)\n if err != nil {\n panic(err)\n }\n}", "func (RestController *RestController) ModifyDataType(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tRestController.databaseController.UltimateLock()\n\tdefer RestController.databaseController.UltimateUnlock()\n\terrorsBucket := configuration.NewCompositeError()\n\tdataType := model.DataType{}\n\terr01 := json.NewDecoder(r.Body).Decode(&dataType)\n\tif err01 != nil {\n\t\terrorsBucket.AddError(1, fmt.Sprint(err01))\n\t}\n\tid, err02 := strconv.Atoi(p.ByName(\"id\"))\n\tif err02 != nil {\n\t\terrorsBucket.AddError(1, fmt.Sprint(err02))\n\t}\n\terr03 := errorsBucket.Evaluate()\n\tif err03 == nil {\n\t\terr04 := RestController.databaseController.ModifyDataType(uint(id), &dataType)\n\t\tif err04 == nil {\n\t\t\tw.WriteHeader(200)\n\t\t\tRestController.deviceManager.ModifyDataTypeName(uint(id), dataType.Name)\n\t\t\tif !dataType.Forecasting {\n\t\t\t\tRestController.deviceManager.TurnOffPrediction(uint(id))\n\t\t\t}\n\t\t} else {\n\t\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\t\tw.WriteHeader(400)\n\t\t\tfmt.Fprintf(w, \"%v\", err04)\n\t\t}\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\tw.WriteHeader(400)\n\t\tfmt.Fprintf(w, \"%v\", err03)\n\t}\n}", "func (fn PatchCoreV1NamespacedConfigMapHandlerFunc) Handle(params PatchCoreV1NamespacedConfigMapParams) middleware.Responder {\n\treturn fn(params)\n}", "func UpdateSchemaInfo(db rdbmstool.DbHandlerProxy, docInfo *SchemaInfo) error {\n\trow := db.QueryRow(`SELECT COUNT(id) FROM doc_schema WHERE id = ?`, docInfo.ID)\n\tvar tmpInt int\n\terr := row.Scan(&tmpInt)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn ErrSchemaInfoNotFound{msg: fmt.Sprintf(\"%s not found in database\", docInfo.Name)}\n\t\t}\n\n\t\treturn err\n\t}\n\n\tif tmpInt == 0 {\n\t\treturn ErrSchemaInfoNotFound{msg: fmt.Sprintf(\"%s not found in database\", docInfo.Name)}\n\t}\n\n\t_, updateErr := db.Exec(\n\t\t`UPDATE doc_schema SET name = ?, description = ?, is_active = ? WHERE id = ?`,\n\t\tdocInfo.Name, docInfo.Description, docInfo.IsActive, docInfo.ID)\n\n\tif updateErr != nil {\n\t\treturn fmt.Errorf(\"failed to update schema info's description: %s\", updateErr.Error())\n\t}\n\n\treturn nil\n}", "func MountSchemaController(service goa.Service, ctrl SchemaController) {\n\trouter := service.HTTPHandler().(*httprouter.Router)\n\tvar h goa.Handler\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewCreateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Create(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"Create\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Create\", \"route\", \"POST /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewDeleteSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Delete(ctx)\n\t}\n\trouter.Handle(\"DELETE\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Delete\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Delete\", \"route\", \"DELETE /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewGetSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Get(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Get\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Get\", \"route\", \"GET /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewListSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.List(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"List\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"List\", \"route\", \"GET /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewSetDefaultsSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.SetDefaults(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas/:name/setDefaults\", ctrl.NewHTTPRouterHandle(\"SetDefaults\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"SetDefaults\", \"route\", \"POST /v1/schemas/:name/setDefaults\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewUpdateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Update(ctx)\n\t}\n\trouter.Handle(\"PUT\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"PUT /v1/schemas/:name\")\n\trouter.Handle(\"POST\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"POST /v1/schemas/:name\")\n}", "func DeleteSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\n\tindexer.RemoveIndexer(index)\n\tif err := conf.DeleteSchema(index); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": \"schema deleted\",\n\t\t\"index\": index,\n\t})\n}", "func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {\n\n\tif schema.AdditionalItems != nil {\n\t\ts := schema.AdditionalItems.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalItems\")\n\t\t}\n\t}\n\n\tif schema.Items != nil {\n\t\tif schema.Items.SchemaArray != nil {\n\t\t\tfor _, s := range *(schema.Items.SchemaArray) {\n\t\t\t\ts.applyToSchemas(operation, \"Items.SchemaArray\")\n\t\t\t}\n\t\t} else if schema.Items.Schema != nil {\n\t\t\tschema.Items.Schema.applyToSchemas(operation, \"Items.Schema\")\n\t\t}\n\t}\n\n\tif schema.AdditionalProperties != nil {\n\t\ts := schema.AdditionalProperties.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalProperties\")\n\t\t}\n\t}\n\n\tif schema.Properties != nil {\n\t\tfor _, pair := range *(schema.Properties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Properties\")\n\t\t}\n\t}\n\tif schema.PatternProperties != nil {\n\t\tfor _, pair := range *(schema.PatternProperties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"PatternProperties\")\n\t\t}\n\t}\n\n\tif schema.Dependencies != nil {\n\t\tfor _, pair := range *(schema.Dependencies) {\n\t\t\tschemaOrStringArray := pair.Value\n\t\t\ts := schemaOrStringArray.Schema\n\t\t\tif s != nil {\n\t\t\t\ts.applyToSchemas(operation, \"Dependencies\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif schema.AllOf != nil {\n\t\tfor _, s := range *(schema.AllOf) {\n\t\t\ts.applyToSchemas(operation, \"AllOf\")\n\t\t}\n\t}\n\tif schema.AnyOf != nil {\n\t\tfor _, s := range *(schema.AnyOf) {\n\t\t\ts.applyToSchemas(operation, \"AnyOf\")\n\t\t}\n\t}\n\tif schema.OneOf != nil {\n\t\tfor _, s := range *(schema.OneOf) {\n\t\t\ts.applyToSchemas(operation, \"OneOf\")\n\t\t}\n\t}\n\tif schema.Not != nil {\n\t\tschema.Not.applyToSchemas(operation, \"Not\")\n\t}\n\n\tif schema.Definitions != nil {\n\t\tfor _, pair := range *(schema.Definitions) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Definitions\")\n\t\t}\n\t}\n\n\toperation(schema, context)\n}", "func (p *hostingdeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {\n\tresp.Schema = schema.Schema{\n\t\tAttributes: map[string]schema.Attribute{\n\t\t\t\"account_id\": schema.StringAttribute{\n\t\t\t\tDescription: \"Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"auth_token\": schema.StringAttribute{\n\t\t\t\tDescription: \"Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func (r *IndexingDatasourcesService) UpdateSchema(name string, updateschemarequest *UpdateSchemaRequest) *IndexingDatasourcesUpdateSchemaCall {\n\tc := &IndexingDatasourcesUpdateSchemaCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.updateschemarequest = updateschemarequest\n\treturn c\n}", "func (b *fixupBody) effectiveSchema(given *hcl.BodySchema) *hcl.BodySchema {\n\treturn effectiveSchema(given, b.original, b.names, true)\n}", "func (r ResourceUpdatedHandler) Handle() error {\n\tif r.Resource == nil || r.OldResource == nil {\n\t\tlogrus.Errorf(\"Resource update handler received nil resource\")\n\t} else {\n\t\tconfig, envVarPostfix, oldSHAData := getConfig(r)\n\t\tif config.SHAValue != oldSHAData {\n\t\t\tlogrus.Infof(\"Changes detected in %s of type '%s' in namespace: %s\", config.ResourceName, envVarPostfix, config.Namespace)\n\t\t\t// process resource based on its type\n\t\t\trollingUpgrade(r, config, envVarPostfix, callbacks.RollingUpgradeFuncs{\n\t\t\t\tItemsFunc: callbacks.GetDeploymentItems,\n\t\t\t\tContainersFunc: callbacks.GetDeploymentContainers,\n\t\t\t\tUpdateFunc: callbacks.UpdateDeployment,\n\t\t\t\tResourceType: \"Deployment\",\n\t\t\t})\n\t\t\trollingUpgrade(r, config, envVarPostfix, callbacks.RollingUpgradeFuncs{\n\t\t\t\tItemsFunc: callbacks.GetDaemonSetItems,\n\t\t\t\tContainersFunc: callbacks.GetDaemonSetContainers,\n\t\t\t\tUpdateFunc: callbacks.UpdateDaemonSet,\n\t\t\t\tResourceType: \"DaemonSet\",\n\t\t\t})\n\t\t\trollingUpgrade(r, config, envVarPostfix, callbacks.RollingUpgradeFuncs{\n\t\t\t\tItemsFunc: callbacks.GetStatefulSetItems,\n\t\t\t\tContainersFunc: callbacks.GetStatefulsetContainers,\n\t\t\t\tUpdateFunc: callbacks.UpdateStatefulset,\n\t\t\t\tResourceType: \"StatefulSet\",\n\t\t\t})\n\t\t}\n\t}\n\treturn nil\n}", "func PutHandler(config interface{}, putConfig methodconfigs.PutRequestConfig, loc []string) http.HandlerFunc {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t//authenticate request\n\t\tif !authenticator.IsAuthenticated(r, putConfig.Auth) {\n\t\t\terrorresponse.ThrowError(w, \"Request not authorized!\")\n\t\t\treturn\n\t\t}\n\n\t\tvar schema string = putConfig.Data\n\n\t\ts := strings.Replace(schema, \"$\", \"\", 1)\n\t\tsch := strings.Split(s, \".\")\n\n\t\t_, schemaData := getresource.GetResource(config, sch[0], sch[1])\n\n\t\t//verify incoming data according to schema and patch\n\t\tdata := make(map[string]interface{})\n\t\t//\n\t\tif strings.Compare(r.Header.Get(\"Content-Type\"), strings.Trim(r.Header.Get(\"Content-Type\"), \"\\n\")) != 0 {\n\t\t\terrorresponse.ThrowError(w, \"Content-Type Header is not application/json\")\n\t\t\treturn\n\t\t}\n\n\t\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\t\terrorresponse.ThrowError(w, fmt.Sprint(\"%s\", err))\n\t\t\treturn\n\t\t}\n\n\t\t//validate data\n\t\t//necessary data and error result\n\t\tnecessaryData, validityResult := customvalidator.Validate(config, putConfig.Validator, schema, data)\n\n\t\tdataRequired := make(map[string]string)\n\n\t\tfor k, v := range validityResult {\n\t\t\tif v == \"required\" {\n\t\t\t\tdataRequired[k] = v\n\t\t\t}\n\t\t}\n\n\t\tif len(dataRequired) > 0 {\n\t\t\tresponsehandler.SendJSONResponse(w, dataRequired, 404)\n\t\t\treturn\n\t\t} else if len(validityResult) > 0 {\n\t\t\tresponsehandler.SendJSONResponse(w, validityResult, 404)\n\t\t\treturn\n\t\t}\n\n\t\t//read data from file\n\t\tqueryResults := fileio.ReadFromFile()\n\t\t//create a map for response\n\t\tresponse := make(map[string]interface{})\n\t\t//get ```result``` value from config file\n\t\tresultWithoutDollar := strings.Replace(putConfig.Result, \"$\", \"\", 1)\n\t\tresultArr := strings.Split(resultWithoutDollar, \".\")\n\t\t//send response as per schema defined in ```result```\n\t\t_, responseResult := getresource.GetResource(config, resultArr[0], resultArr[1])\n\t\t//check which keys are required in response\n\t\tresultFields := make(map[string]bool)\n\t\t//create a map of required keys in resultFields\n\t\tfor key, _ := range responseResult.(map[string]interface{}) {\n\t\t\tresultFields[key] = true\n\t\t}\n\n\t\t//put new data\n\t\tdataToWrite := make(map[string]interface{})\n\n\t\tfor key, _ := range schemaData.(map[string]interface{}) {\n\t\t\tif _, ok := necessaryData[key]; ok {\n\t\t\t\tdataToWrite[key] = necessaryData[key]\n\t\t\t} else if resultFields[key] {\n\t\t\t\tdataToWrite[key] = necessaryData[key]\n\t\t\t}\n\t\t}\n\n\t\t//write new data\n\t\tfileio.WriteToFile(dataToWrite)\n\n\t\t//send response according to schema specified in ```result```\n\t\t//read again\n\t\tqueryResults = fileio.ReadFromFile()\n\t\tfor key, val := range queryResults.(map[string]interface{}) {\n\t\t\tif _, ok := resultFields[key]; ok {\n\t\t\t\tresponse[key] = val\n\t\t\t}\n\t\t}\n\n\t\tresponsehandler.SendJSONResponse(w, response, 201)\n\t\treturn\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func (c FunctionSchema) Change(obj interface{}) {\n\tc2, ok := obj.(*FunctionSchema)\n\tif !ok {\n\t\tfmt.Println(\"Error!!!, Change needs a FunctionSchema instance\", c2)\n\t}\n\tif c.get(\"definition\") != c2.get(\"definition\") {\n\t\tfmt.Println(\"-- This function is different so we'll recreate it:\")\n\n\t\t// If we are comparing two different schemas against each other, we need to do some\n\t\t// modification of the first function definition so we create it in the right schema\n\t\tfunctionDef := c.get(\"definition\")\n\t\tif dbInfo1.DbSchema != dbInfo2.DbSchema {\n\t\t\tfunctionDef = strings.Replace(\n\t\t\t\tfunctionDef,\n\t\t\t\tfmt.Sprintf(\"FUNCTION %s.%s(\", c.get(\"schema_name\"), c.get(\"function_name\")),\n\t\t\t\tfmt.Sprintf(\"FUNCTION %s.%s(\", dbInfo2.DbSchema, c.get(\"function_name\")),\n\t\t\t\t-1)\n\t\t}\n\n\t\t// The definition column has everything needed to rebuild the function\n\t\tfmt.Println(\"-- STATEMENT-BEGIN\")\n\t\tfmt.Printf(\"%s;\\n\", functionDef)\n\t\tfmt.Println(\"-- STATEMENT-END\")\n\t}\n}", "func UpdateCommentProfileHandle(db interface{}) func(server.Request) (handler.Response, error) {\n\n\treturn func(req server.Request) (handler.Response, error) {\n\n\t\t// Create service\n\t\tpostService, serviceErr := service.NewCommentService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\n\t\tpostService.UpdateCommentProfile(req.UserID, req.DisplayName, req.Avatar)\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}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (app *Application) HandleWrite(srvUUID string, uuid string, value []byte) *CallbackError {\n\tif app.config.WriteFunc == nil {\n\t\treturn NewCallbackError(-1, \"No callback registered.\")\n\t}\n\n\terr := app.config.WriteFunc(app, srvUUID, uuid, value)\n\tif err != nil {\n\t\treturn NewCallbackError(-2, err.Error())\n\t}\n\n\treturn nil\n}", "func (db *JSONLite) SetSchema(id string, schema *jsonschema.RootSchema) error {\n\tif val, ok := db.schemas.load(id); ok && val == schema {\n\t\treturn nil\n\t}\n\n\tstmt, err := db.cursor.Prepare(\"INSERT OR REPLACE INTO \\\"_schemas\\\" (\\\"id\\\", \\\"schema\\\") VALUES (?, ?)\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tschemaData, err := json.Marshal(schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb.sqlMutex.Lock()\n\t_, err = stmt.Exec(id, schemaData)\n\tdb.sqlMutex.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// db.schemas[id] = schema\n\tdb.schemas.store(id, schema)\n\treturn nil\n}", "func handlePatchRequest(w http.ResponseWriter, e *models.Endpoint, r *http.Request, entity entities.Entity, h *func() (interface{}, error)) {\n\tw.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\tif !checkContentType(w, r) {\n\t\treturn\n\t}\n\n\tbyteData, _ := ioutil.ReadAll(r.Body)\n\terr := entity.ParseEntity(byteData)\n\tif err != nil {\n\t\tsendError(w, []error{err})\n\t\treturn\n\t}\n\n\thandle := *h\n\tdata, err2 := handle()\n\tif err2 != nil {\n\t\tsendError(w, []error{err2})\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Location\", entity.GetSelfLink())\n\n\tsendJSONResponse(w, http.StatusOK, data, nil)\n}", "func (scanner *SchemaScanner) RunHandlerForSchema(ctx context.Context, schema *gojsonschema.SubSchema) (astmodel.Type, error) {\n\tschemaType, err := getSubSchemaType(schema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn scanner.RunHandler(ctx, schemaType, schema)\n}", "func (fn ReplaceApiextensionsV1beta1CustomResourceDefinitionHandlerFunc) Handle(params ReplaceApiextensionsV1beta1CustomResourceDefinitionParams) middleware.Responder {\n\treturn fn(params)\n}", "func emitSchema(pkgSpec *pschema.PackageSpec, version, outDir string, goPackageName string) error {\n\tschemaJSON, err := json.MarshalIndent(pkgSpec, \"\", \" \")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"marshaling Pulumi schema\")\n\t}\n\n\t// Ensure the spec is stamped with a version.\n\tpkgSpec.Version = version\n\n\tcompressedSchema := bytes.Buffer{}\n\tcompressedWriter := gzip.NewWriter(&compressedSchema)\n\terr = json.NewEncoder(compressedWriter).Encode(pkgSpec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"marshaling metadata\")\n\t}\n\tif err = compressedWriter.Close(); err != nil {\n\t\treturn err\n\t}\n\n\terr = emitFile(outDir, \"schema.go\", []byte(fmt.Sprintf(`package %s\nvar pulumiSchema = %#v\n`, goPackageName, compressedSchema.Bytes())))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"saving metadata\")\n\t}\n\n\treturn emitFile(outDir, \"schema.json\", schemaJSON)\n}", "func (c *Client) Schema() error {\n\t_, err := c.db.DB().Exec(Schema)\n\treturn err\n}", "func (s *LDBStore) PutSchema(schema string) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\treturn s.db.Put(keySchema, []byte(schema))\n}", "func hookConfigurationSchema() *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeList,\n\t\tOptional: true,\n\t\tMaxItems: 1,\n\t\tElem: &schema.Resource{\n\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\"invocation_condition\": func() *schema.Schema {\n\t\t\t\t\tschema := documentAttributeConditionSchema()\n\t\t\t\t\treturn schema\n\t\t\t\t}(),\n\t\t\t\t\"lambda_arn\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: verify.ValidARN,\n\t\t\t\t},\n\t\t\t\t\"s3_bucket\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: validation.All(\n\t\t\t\t\t\tvalidation.StringLenBetween(3, 63),\n\t\t\t\t\t\tvalidation.StringMatch(\n\t\t\t\t\t\t\tregexp.MustCompile(`[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]`),\n\t\t\t\t\t\t\t\"Must be a valid bucket name\",\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}", "func (r *Recorder) Handle(ctx context.Context, req admission.Request) admission.Response {\n\tklog.Infof(\"Webhook is invoked by resource %s/%s, created by %s\", req.AdmissionRequest.Namespace, req.AdmissionRequest.Name, req.UserInfo.Username)\n\n\trequesterNs := strings.Split(req.UserInfo.Username, \":\")[2]\n\trequesterName := strings.Split(req.UserInfo.Username, \":\")[3]\n\n\tif len(r.Namespaces) != 0 {\n\t\tvar find bool\n\t\t// r.Namespaces = append(r.Namespaces, \"openshift-operator-lifecycle-manager\")\n\t\tfor _, ns := range r.Namespaces {\n\t\t\tif requesterNs == ns {\n\t\t\t\tfind = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !find {\n\t\t\tklog.Infof(\"Requester %s/%s is filtered\", requesterNs, requesterName)\n\t\t\treturn admission.Allowed(\"\")\n\t\t}\n\t}\n\n\tvar obj DeprecatedObject\n\tif req.Namespace == \"\" {\n\t\tobj = DeprecatedObject{\n\t\t\tName: req.Name,\n\t\t\tRequesterList: []string{\n\t\t\t\trequesterNs + \"/\" + requesterName,\n\t\t\t},\n\t\t}\n\t} else {\n\t\tobj = DeprecatedObject{\n\t\t\tName: req.Name,\n\t\t\tNamespace: req.Namespace,\n\t\t\tRequesterList: []string{\n\t\t\t\trequesterNs + \"/\" + requesterName,\n\t\t\t},\n\t\t}\n\t}\n\n\tapiFromRequest := DeprecatedObjectList{\n\t\tGroup: req.Kind.Group,\n\t\tVersion: req.Kind.Version,\n\t\tKind: req.Kind.Kind,\n\t\tObjects: []DeprecatedObject{\n\t\t\tobj,\n\t\t},\n\t}\n\n\terr := UpdateConfigmap(ctx, r.Client, apiFromRequest)\n\tif err != nil {\n\t\treturn admission.Errored(http.StatusBadRequest, err)\n\t}\n\treturn admission.Allowed(\"\")\n}", "func (fmd *FakeMysqlDaemon) PreflightSchemaChange(ctx context.Context, dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tif fmd.PreflightSchemaChangeResult == nil {\n\t\treturn nil, fmt.Errorf(\"no preflight result defined\")\n\t}\n\treturn fmd.PreflightSchemaChangeResult, nil\n}", "func (fn WeaveRoomsModifyHandlerFunc) Handle(params WeaveRoomsModifyParams) middleware.Responder {\n\treturn fn(params)\n}", "func (o CrawlerOutput) SchemaChangePolicy() CrawlerSchemaChangePolicyPtrOutput {\n\treturn o.ApplyT(func(v *Crawler) CrawlerSchemaChangePolicyPtrOutput { return v.SchemaChangePolicy }).(CrawlerSchemaChangePolicyPtrOutput)\n}", "func (s *Manager) SetDeleteEventingSchema(ctx context.Context, project string, evType string, params model.RequestParams) (int, error) {\n\t// Check if the request has been hijacked\n\thookResponse := s.integrationMan.InvokeHook(ctx, params)\n\tif hookResponse.CheckResponse() {\n\t\t// Check if an error occurred\n\t\tif err := hookResponse.Error(); err != nil {\n\t\t\treturn hookResponse.Status(), err\n\t\t}\n\n\t\t// Gracefully return\n\t\treturn hookResponse.Status(), nil\n\t}\n\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\tresourceID := config.GenerateResourceID(s.clusterID, project, config.ResourceEventingSchema, evType)\n\tdelete(projectConfig.EventingSchemas, resourceID)\n\n\tif err := s.modules.SetEventingSchemaConfig(ctx, project, projectConfig.EventingSchemas); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif err := s.store.DeleteResource(ctx, resourceID); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func (m *ParameterMutator) Schema(v Schema) *ParameterMutator {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.proxy.schema = v\n\treturn m\n}", "func handler(writer http.ResponseWriter, request *http.Request) {\n\tswitch request.Method {\n\tcase \"GET\":\n\t\twriter.Write(getConfiguration())\n\tcase \"PUT\":\n\t\tcontents, err := ioutil.ReadAll(request.Body)\n\t\tif err != nil {\n\t\t\treportError(writer, err, http.StatusInternalServerError)\n\t\t} else {\n\t\t\thandlePutRequest(writer, contents)\n\t\t}\n\t}\n}", "func RetrieveSchema(service service.MetaDataMgmtService, schemaMap map[string]*entity.Schema) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Logger.Debug(\"Entering handler.RetrieveSchema() handler...\")\n\n\t\t// #1 - Parse path parameters & request headers\n\t\tvar resource string\n\t\tvar catalogType string\n\t\tvar resourceType string\n\t\tvars := mux.Vars(r)\n\t\tif vars != nil {\n\n\t\t\tcatalogType = vars[\"catalog\"]\n\t\t\tresource = vars[\"resourceType\"]\n\t\t\tresourceType = \"urn:resource:\" + catalogType + \":\" + resource\n\t\t}\n\t\tvar validURNs []string\n\t\tfor _, subres := range schemaMap {\n\n\t\t\tvalidURNs = append(validURNs, subres.URN)\n\t\t}\n\t\tfmt.Print(validURNs[0])\n\n\t\t// #2 - Validate input\n\t\terrors := validateSchemaResourceType(resourceType, validURNs)\n\t\tif errors != nil {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write(buildSchemaMetaDataMgmtFailureRespBody(entity.ErrInvalidInputResourceType))\n\t\t\treturn\n\t\t}\n\n\t\t// #3 - Fetch the Schema\n\t\tvar smap = schemaMap[resourceType].Data\n\n\t\t// #4 - Build and return success response\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(buildSchemaMetaDataMgmtSuccessRespBody(smap))\n\t\treturn\n\t})\n}", "func (p PreferencesUpdatedHandler) Handle(ctx context.Context, in json.RawMessage) (interface{}, error) {\n\tlogger := log.From(ctx)\n\tlogger.Infof(\"updating preferences\")\n\n\tvar values map[string]string\n\n\tif err := json.Unmarshal(in, &values); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal message: %w\", err)\n\t}\n\n\tpreferences, err := v1alpha1.CreateOrOpenPreferences(ctx, p.config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create or open preferences: %w\", err)\n\t}\n\n\tpreferences.Update(values)\n\n\tif err := v1alpha1.WritePreferences(ctx, p.config, preferences); err != nil {\n\t\treturn nil, fmt.Errorf(\"write preferences: %w\", err)\n\t}\n\n\treturn true, nil\n}", "func (c *DQLConfig) AddSchema(schemaName, path string) error {\n\tif len(c.Schemas) == 0 {\n\t\tc.Schemas = map[string]*Schema{}\n\t}\n\n\tc.Schemas[schemaName] = &Schema{\n\t\tName: schemaName,\n\t\tPath: path,\n\t}\n\n\t// add schema to ServerelessConfig\n\ts, err := c.ReadServerlessConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.AddSchema(schemaName, path).Write()\n}", "func ModifyVersionHandler(ctx context.Context, dataConnector data.Connector, patchID string, modifications VersionModifications) error {\n\tversion, err := dataConnector.FindVersionById(patchID)\n\tif err != nil {\n\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding version %s: %s\", patchID, err.Error()))\n\t}\n\tuser := MustHaveUser(ctx)\n\thttpStatus, err := ModifyVersion(*version, *user, nil, modifications)\n\tif err != nil {\n\t\treturn mapHTTPStatusToGqlError(ctx, httpStatus, err)\n\t}\n\n\tif evergreen.IsPatchRequester(version.Requester) {\n\t\t// restart is handled through graphql because we need the user to specify\n\t\t// which downstream tasks they want to restart\n\t\tif modifications.Action != Restart {\n\t\t\t//do the same for child patches\n\t\t\tp, err := patch.FindOneId(patchID)\n\t\t\tif err != nil {\n\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding patch %s: %s\", patchID, err.Error()))\n\t\t\t}\n\t\t\tif p == nil {\n\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"patch '%s' not found \", patchID))\n\t\t\t}\n\t\t\tif p.IsParent() {\n\t\t\t\tfor _, childPatchId := range p.Triggers.ChildPatches {\n\t\t\t\t\tp, err := patch.FindOneId(childPatchId)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding child patch %s: %s\", childPatchId, err.Error()))\n\t\t\t\t\t}\n\t\t\t\t\tif p == nil {\n\t\t\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"child patch '%s' not found \", childPatchId))\n\t\t\t\t\t}\n\t\t\t\t\t// only modify the child patch if it is finalized\n\t\t\t\t\tif p.Version != \"\" {\n\t\t\t\t\t\terr = ModifyVersionHandler(ctx, dataConnector, childPatchId, modifications)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.Wrap(mapHTTPStatusToGqlError(ctx, httpStatus, err), fmt.Sprintf(\"error modifying child patch '%s'\", patchID))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}", "func UpgradeSchema(database *models.Database) error {\n\tdb, err := getDatabase(database)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn db.UpgradeSchema()\n}", "func SchemaRegister(svc string, cluster string, sdb string, table string, inputType string, output string, version int, formatType string, dst string, createTopic bool) error {\n\tavroSchema, err := schema.ConvertToAvro(&db.Loc{Cluster: cluster, Service: svc, Name: sdb}, table, inputType, formatType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputSchemaName, err := encoder.GetOutputSchemaName(svc, sdb, table, inputType, output, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dst == \"state\" || dst == \"all\" {\n\t\terr = state.InsertSchema(outputSchemaName, formatType, string(avroSchema))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif createTopic {\n\t\ttm := time.Now()\n\t\tc, err := config.Get().GetChangelogTopicName(svc, sdb, table, inputType, \"kafka\", version, tm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = createKafkaTopic(c, inputType, svc, sdb, table)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\to, err := config.Get().GetOutputTopicName(svc, sdb, table, inputType, \"kafka\", version, tm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = createKafkaTopic(o, inputType, svc, sdb, table)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"AvroSchema registered for(%v,%v, %v,%v,%v,%v,%v) = %s\", svc, cluster, sdb, table, inputType, output, version, avroSchema)\n\treturn nil\n}", "func (t *Table) UpdateSchema(ctx context.Context, sch schema.Schema) (*Table, error) {\n\ttable, err := t.table.SetSchema(ctx, sch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Table{table: table}, nil\n}", "func (s *Manager) SetDeleteEventingSchema(ctx context.Context, project string, evType string, params model.RequestParams) (int, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\tdelete(projectConfig.Modules.Eventing.Schemas, evType)\n\n\tif err := s.modules.SetEventingConfig(project, &projectConfig.Modules.Eventing); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif err := s.setProject(ctx, projectConfig); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func (w *GovernanceWorker) handleUpdatePolicy(cmd *UpdatePolicyCommand) {\n\n\t// for the non pattern case, no policy files are needed. TODO-New: what should we do here?\n\tif w.devicePattern == \"\" {\n\t\treturn\n\t}\n\n\t// Find the microservice definitions in our database so that we can update the policy for each one.\n\tmsDefs, err := persistence.FindMicroserviceDefs(w.db, []persistence.MSFilter{persistence.UnarchivedMSFilter()})\n\tif err != nil {\n\t\tglog.Errorf(logString(fmt.Sprintf(\"Unable to update policies, find service definitions from the database, error %v\", err)))\n\t\treturn\n\t}\n\n\t// For each microservice def, generate a new policy. The GenMicroservicePolicy function will write the new policy to disk and\n\t// it will issue events that trigger the node to update its service advertisement in the exchange.\n\tfor _, msdef := range msDefs {\n\n\t\tglog.V(5).Infof(logString(fmt.Sprintf(\"Working on msdef: %v\", msdef)))\n\n\t\tif err := microservice.GenMicroservicePolicy(&msdef, w.BaseWorker.Manager.Config.Edge.PolicyPath, w.db, w.BaseWorker.Manager.Messages, exchange.GetOrg(w.GetExchangeId()), w.devicePattern); err != nil {\n\t\t\tglog.Errorf(logString(fmt.Sprintf(\"Unable to update policy for %v, error %v\", msdef, err)))\n\t\t}\n\t}\n\n\tglog.V(5).Infof(logString(fmt.Sprintf(\"Policies updated\")))\n\n}", "func (s *Server) HandleDescriptor(w http.ResponseWriter, req *http.Request) {\n\tw.WriteHeader(200)\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.Write([]byte(s.Descriptor))\n}", "func (fn UpdateBookWithFormHandlerFunc) Handle(params UpdateBookWithFormParams, principal interface{}) middleware.Responder {\n\treturn fn(params, principal)\n}", "func Handle(rp *RuntimePipeline) error{\n\tdb.UpdateIterationAction(rp.ID, rp.Status.ToString())\n\tfor i := 0; i < len(rp.Buckets); i++ {\n\t\tif rp.Buckets[i].State.CanUpdate() && rp.Buckets[i].NeedUpdate {\n\t\t\tdb.UpdateStageExecState(rp.Buckets[i].Id, rp.Buckets[i].State.ToString())\n\t\t\trp.Buckets[i].NeedUpdate = false\n\t\t}\n\t\tfor j:=0; j < len(rp.Buckets[i].Steps); j++ {\n\t\t\tif rp.Buckets[i].Steps[j].NeedUpdate{\n\t\t\t\tdb.UpdateStepExecState(rp.Buckets[i].Steps[j].Id, rp.Buckets[i].Steps[j].State.ToString())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func ConfigUpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tupdateConfig(w, r, updateConfigURL)\n}", "func generateSchemaFile(o, wdPath string) error {\n\tsData, err := GenerateSchema()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check if the provided output path is relative\n\tif !path.IsAbs(o) {\n\t\to = path.Join(wdPath, o)\n\t}\n\n\terr = os.WriteFile(path.Join(o, schemaFileName), sData, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tLog.Info(\"generated JSON schema for BlueprintMetadata\", \"path\", path.Join(o, schemaFileName))\n\treturn nil\n}" ]
[ "0.72983176", "0.69974923", "0.6839018", "0.6790851", "0.63716346", "0.6250636", "0.60318166", "0.5930686", "0.58531696", "0.5836623", "0.58035827", "0.57919437", "0.572319", "0.56905335", "0.568128", "0.5633838", "0.56321174", "0.56176364", "0.5573111", "0.5523975", "0.5510525", "0.548509", "0.548509", "0.54396003", "0.53790694", "0.5333416", "0.533242", "0.531184", "0.53102845", "0.52915585", "0.52808726", "0.5252879", "0.52310485", "0.5225864", "0.5213925", "0.52016985", "0.5192805", "0.5190815", "0.5176111", "0.51591885", "0.5157981", "0.51403946", "0.51402885", "0.5125804", "0.51188314", "0.5112458", "0.51118344", "0.5095584", "0.5092753", "0.50872403", "0.5081201", "0.507755", "0.50674635", "0.5035164", "0.50291675", "0.50165635", "0.5009241", "0.5003305", "0.49973223", "0.4981703", "0.4956817", "0.49526948", "0.49441102", "0.49169204", "0.48861885", "0.48843065", "0.48725265", "0.48541674", "0.48429868", "0.4842743", "0.4839322", "0.48233894", "0.4820898", "0.479848", "0.47831136", "0.4782265", "0.47697124", "0.47652546", "0.47559506", "0.47473592", "0.47442642", "0.4742246", "0.47403604", "0.473348", "0.47249687", "0.47163662", "0.47138858", "0.47097033", "0.4707245", "0.47061718", "0.4693073", "0.46842068", "0.46815214", "0.46706268", "0.46702927", "0.46608952", "0.4643259", "0.4642814", "0.46242827", "0.46197534" ]
0.8124072
0
HandleGetSchemas returns handler to get schema
func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() // get project id and dbType from url vars := mux.Vars(r) projectID := vars["project"] dbAlias := "" dbAliasQuery, exists := r.URL.Query()["dbAlias"] if exists { dbAlias = dbAliasQuery[0] } colQuery, exists := r.URL.Query()["col"] col := "" if exists { col = colQuery[0] } schemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetSchemas(w http.ResponseWriter, r *http.Request) {\n\trequestWhere, values, err := config.PrestConf.Adapter.WhereByRequest(r, 1)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas, hasCount := config.PrestConf.Adapter.SchemaClause(r)\n\n\tif requestWhere != \"\" {\n\t\tsqlSchemas = fmt.Sprint(sqlSchemas, \" WHERE \", requestWhere)\n\t}\n\n\tdistinct, err := config.PrestConf.Adapter.DistinctClause(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif distinct != \"\" {\n\t\tsqlSchemas = strings.Replace(sqlSchemas, \"SELECT\", distinct, 1)\n\t}\n\n\torder, err := config.PrestConf.Adapter.OrderByRequest(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\torder = config.PrestConf.Adapter.SchemaOrderBy(order, hasCount)\n\n\tpage, err := config.PrestConf.Adapter.PaginateIfPossible(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas = fmt.Sprint(sqlSchemas, order, \" \", page)\n\tsc := config.PrestConf.Adapter.Query(sqlSchemas, values...)\n\tif sc.Err() != nil {\n\t\thttp.Error(w, sc.Err().Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\t//nolint\n\tw.Write(sc.Bytes())\n}", "func (a *Client) GetSchemas(params *GetSchemasParams) (*GetSchemasOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemasParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemas\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemasReader{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.(*GetSchemasOK), nil\n\n}", "func (k *xyzProvider) GetSchema(ctx context.Context, req *pulumirpc.GetSchemaRequest) (*pulumirpc.GetSchemaResponse, error) {\n\treturn &pulumirpc.GetSchemaResponse{}, nil\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}", "func (a *Client) GetSchemas(params *GetSchemasParams) (*GetSchemasOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemasParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemas\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemasReader{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.(*GetSchemasOK)\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 getSchemas: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (a *Client) GetSchema(params *GetSchemaParams) (*GetSchemaOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchema\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Schemas/{identifier}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaReader{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.(*GetSchemaOK), nil\n\n}", "func RetrieveSchema(service service.MetaDataMgmtService, schemaMap map[string]*entity.Schema) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Logger.Debug(\"Entering handler.RetrieveSchema() handler...\")\n\n\t\t// #1 - Parse path parameters & request headers\n\t\tvar resource string\n\t\tvar catalogType string\n\t\tvar resourceType string\n\t\tvars := mux.Vars(r)\n\t\tif vars != nil {\n\n\t\t\tcatalogType = vars[\"catalog\"]\n\t\t\tresource = vars[\"resourceType\"]\n\t\t\tresourceType = \"urn:resource:\" + catalogType + \":\" + resource\n\t\t}\n\t\tvar validURNs []string\n\t\tfor _, subres := range schemaMap {\n\n\t\t\tvalidURNs = append(validURNs, subres.URN)\n\t\t}\n\t\tfmt.Print(validURNs[0])\n\n\t\t// #2 - Validate input\n\t\terrors := validateSchemaResourceType(resourceType, validURNs)\n\t\tif errors != nil {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write(buildSchemaMetaDataMgmtFailureRespBody(entity.ErrInvalidInputResourceType))\n\t\t\treturn\n\t\t}\n\n\t\t// #3 - Fetch the Schema\n\t\tvar smap = schemaMap[resourceType].Data\n\n\t\t// #4 - Build and return success response\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(buildSchemaMetaDataMgmtSuccessRespBody(smap))\n\t\treturn\n\t})\n}", "func (a *Client) GetSchema(params *GetSchemaParams) (*GetSchemaOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchema\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas/ids/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaReader{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.(*GetSchemaOK), nil\n\n}", "func (a *Client) GetSchema(params *GetSchemaParams) (*GetSchemaOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchema\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas/ids/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaReader{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.(*GetSchemaOK)\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 getSchema: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (a *Client) GetSchema(params *GetSchemaParams) (*GetSchemaOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchema\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaReader{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.(*GetSchemaOK)\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 getSchema: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (client GroupClient) GetSchemaResponder(resp *http.Response) (result USQLSchema, 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}", "func (s *Manager) GetSchemas(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ttype response struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {Schema: collectionInfo.Schema}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{Schema: value.Schema}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{Schema: value.Schema}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func (fmd *FakeMysqlDaemon) GetSchema(ctx context.Context, dbName string, request *tabletmanagerdatapb.GetSchemaRequest) (*tabletmanagerdatapb.SchemaDefinition, error) {\n\tif fmd.SchemaFunc != nil {\n\t\treturn fmd.SchemaFunc()\n\t}\n\tif fmd.Schema == nil {\n\t\treturn nil, fmt.Errorf(\"no schema defined\")\n\t}\n\treturn tmutils.FilterTables(fmd.Schema, request.Tables, request.ExcludeTables, request.IncludeViews)\n}", "func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*proto.SchemaDefinition, error) {\n\tif fmd.Schema == nil {\n\t\treturn nil, fmt.Errorf(\"no schema defined\")\n\t}\n\treturn fmd.Schema.FilterTables(tables, excludeTables, includeViews)\n}", "func GetSchema(eventID string) (schema *Schema, err error) {\n\tschema = &Schema{}\n\n\terr = stmtSchemaByEventID.QueryRow(eventID).Scan(&schema.EventID, &schema.Alias, &schema.Desc)\n\tif err != nil {\n\t\tlog.Println(\"coudn't get schema\")\n\t\treturn\n\t}\n\trows, err := stmtParamsByEventID.Query(eventID)\n\tif err != nil {\n\t\tlog.Println(\"coudn't get schema\")\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tparams := &Parameters{}\n\t\terr = rows.Scan(&params.Name, &params.DataType, &params.Mandatory, &params.Description, &params.Format)\n\t\tif err != nil {\n\t\t\tlog.Println(\"coudn't get schema\")\n\t\t\treturn\n\t\t}\n\t\tschema.Params = append(schema.Params, params)\n\t}\n\n\treturn\n}", "func (ovs OvsdbClient) GetSchema(dbName string) (*DatabaseSchema, error) {\n\targs := NewGetSchemaArgs(dbName)\n\tvar reply DatabaseSchema\n\terr := ovs.rpcClient.Call(\"get_schema\", args, &reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tovs.Schema[dbName] = reply\n\treturn &reply, err\n}", "func (c *Client) GetSchema(id int) (string, error) {\n\t//\tschemaUrlResponse, err := s.httpClient.Get(schemaUrl)\n\treq, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%s/schemas/ids/%d\", c.URL, id), http.NoBody)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"building request for getting schema from registry\")\n\t}\n\tif c.Auth != nil {\n\t\treq.SetBasicAuth(c.Auth.KafkaSchemaApiKey, c.Auth.KafkaSchemaApiSecret)\n\t}\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"getting schema from registry\")\n\t}\n\tdefer resp.Body.Close()\n\tsr := SchemaResponse{}\n\terr = unmarshalRespErr(resp, err, &sr)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"making http request\")\n\t}\n\treturn sr.Schema, nil\n}", "func (client GroupClient) ListSchemasResponder(resp *http.Response) (result USQLSchemaList, 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}", "func Get(schemaID string) (*gojsonschema.Schema, error) {\n\tschema, ok := jsonSchemaList[schemaID]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"schema '%s' not found\", schemaID)\n\t}\n\n\treturn schema, nil\n}", "func (client GroupClient) GetSchema(accountName string, databaseName string, schemaName string) (result USQLSchema, err error) {\n\treq, err := client.GetSchemaPreparer(accountName, databaseName, schemaName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"GetSchema\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSchemaSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"GetSchema\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetSchemaResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"GetSchema\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func GetSchema(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SchemaState, opts ...pulumi.ResourceOption) (*Schema, error) {\n\tvar resource Schema\n\terr := ctx.ReadResource(\"aws:schemas/schema:Schema\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (a *Client) GetSchemaOnly(params *GetSchemaOnlyParams) (*GetSchemaOnlyOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaOnlyParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemaOnly\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/subjects/{subject}/versions/{version}/schema\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaOnlyReader{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.(*GetSchemaOnlyOK), nil\n\n}", "func (c *DefaultConstr) GetSchema(conn *sql.DB) (string, error) {\n\treturn \"\", ErrorNotSupport\n}", "func Handler() func(ctx *routing.Context) error {\n\treturn func(ctx *routing.Context) error {\n\t\t// r.URL.Query().Get(\"query\")\n\t\tprint(ctx.Request.URI().QueryString())\n\t\tresult := executeQuery(string(ctx.Request.URI().QueryString()), schema)\n\t\tjson.NewEncoder(ctx.Response.BodyWriter()).Encode(result)\n\t\treturn nil\n\t}\n}", "func (a *Client) GetSchemaOnly(params *GetSchemaOnlyParams) (*GetSchemaOnlyOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaOnlyParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemaOnly\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/subjects/{subject}/versions/{version}/schema\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaOnlyReader{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.(*GetSchemaOnlyOK)\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 getSchemaOnly: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (d *Default) ExtractSchemas(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error {\n\t// Root schemas in sp.Schemas\n\t// are already extracted, extracting\n\t// them would result in an infinite recursion.\n\textractRoot := false\n\n\twalkFunc := func(path spec.SchemaPath) error {\n\t\tif !extractRoot && len(path) < 2 {\n\t\t\treturn nil\n\t\t}\n\n\t\tlast := path.Last()\n\n\t\tif last == nil {\n\t\t\treturn nil\n\t\t}\n\t\tif last.Create && last.Name != \"\" {\n\n\t\t\texists := false\n\t\t\tfor _, sch := range sp.Schemas {\n\t\t\t\tif sch.Name == last.Name {\n\t\t\t\t\texists = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !exists {\n\t\t\t\tsp.Schemas = append(sp.Schemas, deepcopy.Copy(last).(*spec.Schema))\n\t\t\t}\n\n\t\t\tlast.Create = false\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Walk all the root schemas\n\tfor _, s := range sp.Schemas {\n\t\terr := s.Walk(walkFunc, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// For parameters/responses, we can\n\t// extract anything.\n\textractRoot = true\n\n\tfor _, p := range sp.Paths {\n\t\tfor _, o := range p.Operations {\n\t\t\tfor _, param := range o.Parameters {\n\t\t\t\terr := param.Schema.Walk(walkFunc, true)\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\tfor _, res := range o.Responses {\n\t\t\t\terr := res.Schema.Walk(walkFunc, true)\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\tfor _, cb := range o.Callbacks {\n\t\t\t\tfor _, cbPath := range cb {\n\t\t\t\t\tfor _, cbOp := range cbPath.Operations {\n\t\t\t\t\t\tfor _, param := range cbOp.Parameters {\n\t\t\t\t\t\t\terr := param.Schema.Walk(walkFunc, true)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor _, res := range cbOp.Responses {\n\t\t\t\t\t\t\terr := res.Schema.Walk(walkFunc, true)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn err\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 nil\n}", "func (c *PlatformGraphQLClient) FetchSchemas(ctx context.Context, dataRegistryID string) (*Schemas, error) {\n\treq := graphql.NewRequest(`\n\t\tquery (\n\t\t\t$dataRegistryId: ID!\n\t\t) {\n\t\t\tdataRegistry(id: $dataRegistryId) {\n\t\t\t\tid\n\t\t\t\tschemas {\n\t\t\t\t\trecords {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tstatus\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`)\n\n\treq.Var(\"dataRegistryId\", dataRegistryID)\n\n\tvar resp struct {\n\t\tResult *Schemas `json:\"dataRegistry\"`\n\t}\n\n\treturn resp.Result, c.Run(ctx, req, &resp)\n}", "func (db *sqlite3) GetSchema(pBt *Btree) (p *Schema) {\n\tif pBt != nil {\n\t\tp = pBt.Schema(true, ClearSchema)\n\t} else {\n\t\tp = &Schema{}\n\t}\n\tif p == nil {\n\t\tdb.mallocFailed = true\n\t} else if p.file_format == 0 {\n\t\tp.Tables = make(map[string]*Table)\n\t\tp.Indices = make(map[string]*Index)\n\t\tp.Triggers = make(map[string]*Trigger)\n\t\tp.ForeignKeys = make(map[string]*ForeignKey)\n\t\tp.enc = SQLITE_UTF8\n\t}\n\treturn\n}", "func GetSchema() *schema.Instance {\n\tb := schema.NewBuilder()\n\tfor _, p := range types {\n\t\tb.Add(*p.GetSpec())\n\t}\n\treturn b.Build()\n}", "func (a *PublicApiService) GetSchema(ctx context.Context, id string) PublicApiApiGetSchemaRequest {\n\treturn PublicApiApiGetSchemaRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func SchemaUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tupdatedSchema := schemas.Schema{}\n\n\terr = json.NewDecoder(r.Body).Decode(&updatedSchema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif updatedSchema.FullName != \"\" {\n\t\t_, schemaName, err := schemas.ExtractSchema(updatedSchema.FullName)\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tupdatedSchema.Name = schemaName\n\t}\n\n\tschema, err := schemas.Update(schemasList.Schemas[0], updatedSchema.Name, updatedSchema.Type, updatedSchema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func GetSchema() string {\n\treturn fmt.Sprintf(`\n\tschema {\n\t\tquery: Query\n\t\tmutation: Mutation\n\t}\n\t%s\n\t%s\n\t%s\n\t%s\n`, typeDefs, inputs, queries, mutations)\n}", "func (client *CachedSchemaRegistryClient) GetSchema(id int) (*goavro.Codec, error) {\n\tclient.schemaCacheLock.RLock()\n\tcachedResult := client.schemaCache[id]\n\tclient.schemaCacheLock.RUnlock()\n\tif nil != cachedResult {\n\t\treturn cachedResult, nil\n\t}\n\tcodec, err := client.SchemaRegistryClient.GetSchema(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.schemaCacheLock.Lock()\n\tclient.schemaCache[id] = codec\n\tclient.schemaCacheLock.Unlock()\n\treturn codec, nil\n}", "func SchemaListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList.Schemas[0], \"\", \" \")\n\trespondOK(w, output)\n}", "func GetSchema(scope string, session *r.Session) (Schema, error) {\n\tres, err := r.Table(\"schema\").Get(scope).Run(session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Close()\n\n\tvar result Schema\n\tif err := res.One(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "func (m *ExternalConnection) GetSchema()(Schemaable) {\n return m.schema\n}", "func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\tif err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func GetHTTPHandler(r ResolverRoot, db *DB, migrations []*gormigrate.Migration, res http.ResponseWriter, req *http.Request) {\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tlog.Debug().Msgf(\"Path base: %s\", path.Base(req.URL.Path))\n\t}\n\texecutableSchema := NewExecutableSchema(Config{Resolvers: r})\n\tgqlHandler := handler.New(executableSchema)\n\tgqlHandler.AddTransport(transport.Websocket{\n\t\tKeepAlivePingInterval: 10 * time.Second,\n\t})\n\tgqlHandler.AddTransport(transport.Options{})\n\tgqlHandler.AddTransport(transport.GET{})\n\tgqlHandler.AddTransport(transport.POST{})\n\tgqlHandler.AddTransport(transport.MultipartForm{})\n\tgqlHandler.Use(extension.FixedComplexityLimit(300))\n\tif os.Getenv(\"DEBUG\") == \"true\" {\n\t\tgqlHandler.Use(extension.Introspection{})\n\t}\n\tgqlHandler.Use(apollotracing.Tracer{})\n\tgqlHandler.Use(extension.AutomaticPersistedQuery{\n\t\tCache: lru.New(100),\n\t})\n\tloaders := GetLoaders(db)\n\tif os.Getenv(\"EXPOSE_MIGRATION_ENDPOINT\") == \"true\" {\n\t\tif path.Base(req.URL.Path) == \"migrate\" {\n\t\t\terr := db.Migrate(migrations)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t\tif path.Base(req.URL.Path) == \"automigrate\" {\n\t\t\terr := db.AutoMigrate()\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(res, err.Error(), 400)\n\t\t\t}\n\t\t\tfmt.Fprintf(res, \"OK\")\n\t\t}\n\t}\n\tgqlBasePath := os.Getenv(\"API_GRAPHQL_BASE_RESOURCE\")\n\tif gqlBasePath == \"\" {\n\t\tgqlBasePath = \"graphql\"\n\t}\n\tif path.Base(req.URL.Path) == gqlBasePath {\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tgqlHandler.ServeHTTP(res, req)\n\t}\n\n\tif os.Getenv(\"EXPOSE_PLAYGROUND_ENDPOINT\") == \"true\" && path.Base(req.URL.Path) == \"playground\" {\n\t\tplaygroundHandler := playground.Handler(\"GraphQL playground\", gqlBasePath)\n\t\tctx := initContextWithJWTClaims(req)\n\t\tctx = context.WithValue(ctx, KeyLoaders, loaders)\n\t\tctx = context.WithValue(ctx, KeyExecutableSchema, executableSchema)\n\t\treq = req.WithContext(ctx)\n\t\tif req.Method == \"GET\" {\n\t\t\tplaygroundHandler(res, req)\n\t\t}\n\t}\n}", "func (t *TikvHandlerTool) Schema() (infoschema.InfoSchema, error) {\n\tdom, err := session.GetDomain(t.Store)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dom.InfoSchema(), nil\n}", "func (a *Client) ListSchemas(params *ListSchemasParams) (*ListSchemasOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListSchemasParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listSchemas\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Schemas\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ListSchemasReader{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.(*ListSchemasOK), nil\n\n}", "func (c serverResources) OpenAPISchema() (*openapiv2.Document, error) {\n\treturn c.cachedClient.OpenAPISchema()\n}", "func (csvw *CSVWriter) GetSchema() schema.Schema {\n\treturn csvw.sch\n}", "func HandleReloadSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tschema := modules.Schema()\n\t\tcolResult, err := syncman.SetReloadSchema(ctx, dbAlias, projectID, schema)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: colResult})\n\t\t// return\n\t}\n}", "func (r *IndexingDatasourcesService) GetSchema(name string) *IndexingDatasourcesGetSchemaCall {\n\tc := &IndexingDatasourcesGetSchemaCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (a *EntitiesApiService) ApiEntitiesSchemaGet(ctx context.Context) (*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\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/entities/Schema\"\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{}\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 nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\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\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (client *SyncGroupsClient) listHubSchemasHandleResponse(resp *http.Response) (SyncGroupsClientListHubSchemasResponse, error) {\n\tresult := SyncGroupsClientListHubSchemasResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SyncFullSchemaPropertiesListResult); err != nil {\n\t\treturn SyncGroupsClientListHubSchemasResponse{}, err\n\t}\n\treturn result, nil\n}", "func (s *LDBStore) GetSchema() (string, error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tdata, err := s.db.Get(keySchema)\n\tif err != nil {\n\t\tif err == leveldb.ErrNotFound {\n\t\t\treturn DbSchemaNone, nil\n\t\t}\n\t\treturn \"\", err\n\t}\n\n\treturn string(data), nil\n}", "func MapRouteBySchemas(server *Server, dataStore db.DB) {\n\troute := server.martini\n\tlog.Debug(\"[Initializing Routes]\")\n\tschemaManager := schema.GetManager()\n\troute.Get(\"/_all\", func(w http.ResponseWriter, r *http.Request, p martini.Params, auth schema.Authorization, ctx middleware.Context) {\n\t\tresponses := make(map[string]interface{})\n\t\tcontext := map[string]interface{}{\n\t\t\t\"path\": r.URL.Path,\n\t\t\t\"http_request\": r,\n\t\t\t\"http_response\": w,\n\t\t\t\"context\": ctx[\"context\"],\n\t\t\t\"trace_id\": ctx[\"trace_id\"],\n\t\t}\n\t\tfor _, s := range schemaManager.Schemas() {\n\t\t\tpolicy, role := authorization(w, r, schema.ActionRead, s.GetPluralURL(), s, auth)\n\t\t\tif policy == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontext[\"policy\"] = policy\n\t\t\tcontext[\"role\"] = role\n\t\t\tcontext[\"auth\"] = auth\n\t\t\tcontext[\"sync\"] = server.sync\n\n\t\t\tif err := resources.GetResources(\n\t\t\t\tcontext, dataStore,\n\t\t\t\ts,\n\t\t\t\tresources.FilterFromQueryParameter(s, r.URL.Query()),\n\t\t\t\tnil,\n\t\t\t); err != nil {\n\t\t\t\thandleError(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresources.ApplyPolicyForResources(context, s)\n\t\t\tresponse := context[\"response\"].(map[string]interface{})\n\t\t\tresponses[s.GetDbTableName()] = response[s.Plural]\n\t\t}\n\t\troutes.ServeJson(w, responses)\n\t})\n\tfor _, s := range schemaManager.Schemas() {\n\t\tMapRouteBySchema(server, dataStore, s)\n\t}\n}", "func HandleGetDatabaseConfig(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tdbConfig, err := syncMan.GetDatabaseConfig(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func (s *Manager) GetEventingSchema(ctx context.Context, project, id string, params model.RequestParams) (int, []interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, nil, err\n\t}\n\n\tif id != \"*\" {\n\t\tservice, ok := projectConfig.Modules.Eventing.Schemas[id]\n\t\tif !ok {\n\t\t\treturn http.StatusBadRequest, nil, helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf(\"Schema (%s) does not exists in eventing config\", id), nil, nil)\n\t\t}\n\t\treturn http.StatusOK, []interface{}{service}, nil\n\t}\n\n\tservices := []interface{}{}\n\tfor _, value := range projectConfig.Modules.Eventing.Schemas {\n\t\tservices = append(services, value)\n\t}\n\treturn http.StatusOK, services, nil\n}", "func BackendSchemas() []*config.ConfigurationSchema {\n\tconfigurationSchemas := []*config.ConfigurationSchema{}\n\tfor _, registry := range backendRegistry {\n\t\tconfigurationSchemas = append(configurationSchemas, registry.configurationSchema)\n\t}\n\treturn configurationSchemas\n}", "func (c *Insert) Schema() (res []Column, err error) {\n\tresp, err := http.Get(c.schemaURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get table schema: %s\", err)\n\t}\n\tdefer func() {\n\t\tif cErr := resp.Body.Close(); cErr != nil {\n\t\t\tif err == nil {\n\t\t\t\terr = cErr\n\t\t\t}\n\t\t}\n\t}()\n\tif resp.StatusCode != http.StatusOK {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out error schema response (status %d): %s\", resp.StatusCode, err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get a schema: %s (%s)\", string(data), err)\n\t}\n\n\tscanner := bufio.NewScanner(resp.Body)\n\tfor scanner.Scan() {\n\t\tvar col Column\n\t\tif err := json.Unmarshal(scanner.Bytes(), &col); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out schema response: %s\", err)\n\t\t}\n\t\tres = append(res, col)\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to reao out schema response: %s\", err)\n\t}\n\n\treturn res, nil\n}", "func MountSchemaController(service goa.Service, ctrl SchemaController) {\n\trouter := service.HTTPHandler().(*httprouter.Router)\n\tvar h goa.Handler\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewCreateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Create(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"Create\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Create\", \"route\", \"POST /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewDeleteSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Delete(ctx)\n\t}\n\trouter.Handle(\"DELETE\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Delete\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Delete\", \"route\", \"DELETE /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewGetSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Get(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Get\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Get\", \"route\", \"GET /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewListSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.List(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"List\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"List\", \"route\", \"GET /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewSetDefaultsSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.SetDefaults(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas/:name/setDefaults\", ctrl.NewHTTPRouterHandle(\"SetDefaults\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"SetDefaults\", \"route\", \"POST /v1/schemas/:name/setDefaults\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewUpdateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Update(ctx)\n\t}\n\trouter.Handle(\"PUT\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"PUT /v1/schemas/:name\")\n\trouter.Handle(\"POST\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"POST /v1/schemas/:name\")\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func GetSchema() string {\n\tbox := packr.New(\"schema\", \"../schema\")\n\tvar schema strings.Builder\n\n\tbox.Walk(func(p string, f packr.File) error {\n\t\tif p == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tvar err error\n\t\tif finfo, err := f.FileInfo(); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tif finfo.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tif !strings.Contains(p, \".graphql\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tn := p\n\t\tif strings.HasPrefix(p, \"\\\\\") || strings.HasPrefix(p, \"/\") {\n\t\t\tn = n[1:]\n\t\t}\n\n\t\tn = strings.Replace(n, \"\\\\\", \"/\", -1)\n\n\t\ts, err := box.FindString(p)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tschema.WriteString(s)\n\n\t\treturn nil\n\t})\n\n\treturn schema.String()\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (a *Client) GetSchemaContent(params *GetSchemaContentParams) (*GetSchemaContentOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaContentParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemaContent\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/SchemaStore/en/{identifier}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaContentReader{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.(*GetSchemaContentOK), nil\n\n}", "func (scanner *SchemaScanner) RunHandlerForSchema(ctx context.Context, schema *gojsonschema.SubSchema) (astmodel.Type, error) {\n\tschemaType, err := getSubSchemaType(schema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn scanner.RunHandler(ctx, schemaType, schema)\n}", "func HandleInspectCollectionSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tcol := vars[\"col\"]\n\t\tprojectID := vars[\"project\"]\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\ts, err := schema.SchemaInspection(ctx, dbAlias, logicalDBName, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetSchemaInspection(ctx, projectID, dbAlias, col, s); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: s})\n\t\t// return\n\t}\n}", "func (a *Client) GetSchemaTypes(params *GetSchemaTypesParams) (*GetSchemaTypesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSchemaTypesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSchemaTypes\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schemas/types\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSchemaTypesReader{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.(*GetSchemaTypesOK)\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 getSchemaTypes: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (client GroupClient) ListSchemas(accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLSchemaList, err error) {\n\treq, err := client.ListSchemasPreparer(accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListSchemas\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSchemasSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListSchemas\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListSchemasResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"ListSchemas\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (c *DefaultApiService) FetchSchema(Id string) (*EventsV1Schema, error) {\n\tpath := \"/v1/Schemas/{Id}\"\n\tpath = strings.Replace(path, \"{\"+\"Id\"+\"}\", Id, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tresp, err := c.requestHandler.Get(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &EventsV1Schema{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "func GetSchema(field reflect.Type, components *ComponentMetadata) (*spec.Schema, error) {\n\treturn getSchema(field, components, false)\n}", "func (s *Manager) GetEventingSchema(ctx context.Context, project, id string, params model.RequestParams) (int, []interface{}, error) {\n\t// Check if the request has been hijacked\n\thookResponse := s.integrationMan.InvokeHook(ctx, params)\n\tif hookResponse.CheckResponse() {\n\t\t// Check if an error occurred\n\t\tif err := hookResponse.Error(); err != nil {\n\t\t\treturn hookResponse.Status(), nil, err\n\t\t}\n\n\t\t// Gracefully return\n\t\treturn hookResponse.Status(), hookResponse.Result().([]interface{}), nil\n\t}\n\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, nil, err\n\t}\n\n\tif id != \"*\" {\n\t\tresourceID := config.GenerateResourceID(s.clusterID, project, config.ResourceEventingSchema, id)\n\t\tservice, ok := projectConfig.EventingSchemas[resourceID]\n\t\tif !ok {\n\t\t\treturn http.StatusBadRequest, nil, helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf(\"Schema (%s) does not exists in eventing config\", id), nil, nil)\n\t\t}\n\t\treturn http.StatusOK, []interface{}{service}, nil\n\t}\n\n\tservices := []interface{}{}\n\tfor _, value := range projectConfig.EventingSchemas {\n\t\tservices = append(services, value)\n\t}\n\treturn http.StatusOK, services, nil\n}", "func SchemaListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", \"\", refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList, \"\", \" \")\n\trespondOK(w, output)\n}", "func getAppsHandler(w http.ResponseWriter, r *http.Request) {\n\tvar apps []App\n\terr := getApps(&apps)\n\tcheck(err)\n\trespondWithResult(w, apps)\n}", "func GetAllSchemaInfo(db rdbmstool.DbHandlerProxy) ([]SchemaInfo, error) {\n\tsqlStr := `\n\tSELECT a.id, a.name, a.description, a.is_active, \n\t\tMAX(b.revision), SUM(CASE WHEN b.revision = -1 THEN 1 ELSE 0 END)\n\tFROM doc_schema a\n\tLEFT JOIN doc_schema_revision b ON a.id = b.schema_id\n\tGROUP BY a.id`\n\n\trows, rowsErr := db.Query(sqlStr)\n\tif rowsErr != nil {\n\t\treturn nil, fmt.Errorf(\"error encounter access database: %s\", rowsErr.Error())\n\t}\n\n\tdefer rows.Close()\n\n\tvar tmpID, tmpName, tmpDesc string\n\tvar tmpLatestRev, tmpIsActive, tmpHasDraft int\n\tresults := []SchemaInfo{}\n\tfor rows.Next() {\n\t\tscanErr := rows.Scan(&tmpID, &tmpName, &tmpDesc, &tmpIsActive, &tmpLatestRev, &tmpHasDraft)\n\t\tif scanErr != nil {\n\t\t\tif scanErr == sql.ErrNoRows {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to fetch record from database: %s\", scanErr.Error())\n\t\t\t}\n\t\t}\n\n\t\tresults = append(results, SchemaInfo{\n\t\t\tID: tmpID,\n\t\t\tName: tmpName,\n\t\t\tLatestRevision: tmpLatestRev,\n\t\t\tDescription: tmpDesc,\n\t\t\tIsActive: tmpIsActive == 1,\n\t\t\tHasDraft: tmpHasDraft == 1,\n\t\t})\n\t}\n\n\treturn results, nil\n}", "func (db *JSONLite) Schema(id string) (*jsonschema.RootSchema, error) {\n\tif schema, ok := db.schemas.load(id); ok {\n\t\treturn schema, nil\n\t}\n\n\tstmt, err := db.cursor.Prepare(\"SELECT schema FROM \\\"_schemas\\\" WHERE \\\"id\\\" = ?\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar schemaData string\n\tschema := &jsonschema.RootSchema{}\n\trow := stmt.QueryRow(id)\n\tif err := row.Scan(&schemaData); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn schema, nil\n\t\t}\n\n\t\treturn nil, errors.Wrap(err, \"scanning error\")\n\t}\n\n\tif err := json.Unmarshal([]byte(schemaData), schema); err != nil {\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"unmarshal error %s\", schemaData))\n\t}\n\n\tdb.schemas.store(id, schema)\n\treturn schema, nil\n}", "func (e *BaseExecutor) GetSchema() *expression.Schema {\n\treturn e.schema\n}", "func (d *SchemaData) GetSchemaDefinition() (*schema.SchemaDefinition, error) {\n\tret := &schema.SchemaDefinition{\n\t\tDirectives: map[string]*schema.DirectiveDefinition{},\n\t}\n\n\ttypes := map[string]schema.NamedType{}\n\n\tfor _, t := range d.Types {\n\t\tif builtin, ok := schema.BuiltInTypes[t.Name]; ok {\n\t\t\ttypes[t.Name] = builtin\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch t.Kind {\n\t\tcase \"SCALAR\":\n\t\t\ttypes[t.Name] = &schema.ScalarType{}\n\t\tcase \"OBJECT\":\n\t\t\ttypes[t.Name] = &schema.ObjectType{}\n\t\tcase \"INTERFACE\":\n\t\t\ttypes[t.Name] = &schema.InterfaceType{}\n\t\tcase \"UNION\":\n\t\t\ttypes[t.Name] = &schema.UnionType{}\n\t\tcase \"ENUM\":\n\t\t\ttypes[t.Name] = &schema.EnumType{}\n\t\tcase \"INPUT_OBJECT\":\n\t\t\ttypes[t.Name] = &schema.InputObjectType{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported type kind in types list: %v\", t.Kind)\n\t\t}\n\t}\n\n\tif t, err := d.QueryType.getType(types); err != nil {\n\t\treturn nil, err\n\t} else if obj, ok := t.(*schema.ObjectType); !ok {\n\t\treturn nil, fmt.Errorf(\"query type is not an object\")\n\t} else {\n\t\tret.Query = obj\n\t}\n\n\tif d.MutationType != nil {\n\t\tif t, err := d.MutationType.getType(types); err != nil {\n\t\t\treturn nil, err\n\t\t} else if obj, ok := t.(*schema.ObjectType); !ok {\n\t\t\treturn nil, fmt.Errorf(\"mutation type is not an object\")\n\t\t} else {\n\t\t\tret.Mutation = obj\n\t\t}\n\t}\n\n\tif d.SubscriptionType != nil {\n\t\tif t, err := d.SubscriptionType.getType(types); err != nil {\n\t\t\treturn nil, err\n\t\t} else if obj, ok := t.(*schema.ObjectType); !ok {\n\t\t\treturn nil, fmt.Errorf(\"subcription type is not an object\")\n\t\t} else {\n\t\t\tret.Subscription = obj\n\t\t}\n\t}\n\n\tfor _, t := range d.Types {\n\t\tif _, ok := schema.BuiltInTypes[t.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch t.Kind {\n\t\tcase \"SCALAR\":\n\t\t\tdef := types[t.Name].(*schema.ScalarType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\tcase \"OBJECT\":\n\t\t\tdef := types[t.Name].(*schema.ObjectType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\t\tdef.Fields = map[string]*schema.FieldDefinition{}\n\t\t\tfor _, field := range t.Fields {\n\t\t\t\tif fieldDef, err := field.getFieldDefinition(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tdef.Fields[field.Name] = fieldDef\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, t := range t.Interfaces {\n\t\t\t\tif iface, err := t.getType(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else if iface, ok := iface.(*schema.InterfaceType); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"type is not an interface: %s\", t.Name)\n\t\t\t\t} else {\n\t\t\t\t\tdef.ImplementedInterfaces = append(def.ImplementedInterfaces, iface)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(t.Interfaces) > 0 {\n\t\t\t\tret.AdditionalTypes = append(ret.AdditionalTypes, def)\n\t\t\t}\n\t\t\tdef.IsTypeOf = func(v interface{}) bool {\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase \"INTERFACE\":\n\t\t\tdef := types[t.Name].(*schema.InterfaceType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\t\tdef.Fields = map[string]*schema.FieldDefinition{}\n\t\t\tfor _, field := range t.Fields {\n\t\t\t\tif fieldDef, err := field.getFieldDefinition(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tdef.Fields[field.Name] = fieldDef\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"UNION\":\n\t\t\tdef := types[t.Name].(*schema.UnionType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\t\tfor _, t := range t.PossibleTypes {\n\t\t\t\tif obj, err := t.getType(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else if obj, ok := obj.(*schema.ObjectType); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"type is not an object: %s\", t.Name)\n\t\t\t\t} else {\n\t\t\t\t\tdef.MemberTypes = append(def.MemberTypes, obj)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"ENUM\":\n\t\t\tdef := types[t.Name].(*schema.EnumType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\t\tdef.Values = map[string]*schema.EnumValueDefinition{}\n\t\t\tfor _, value := range t.EnumValues {\n\t\t\t\tif valueDef, err := value.getEnumValueDefinition(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tdef.Values[value.Name] = valueDef\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"INPUT_OBJECT\":\n\t\t\tdef := types[t.Name].(*schema.InputObjectType)\n\t\t\tdef.Name = t.Name\n\t\t\tdef.Description = t.Description\n\t\t\tdef.Fields = map[string]*schema.InputValueDefinition{}\n\t\t\tfor _, field := range t.InputFields {\n\t\t\t\tif fieldDef, err := field.getInputValueDefinition(types); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tdef.Fields[field.Name] = fieldDef\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, dir := range d.Directives {\n\t\tif def, err := dir.getDirectiveDefinition(types); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tret.Directives[dir.Name] = def\n\t\t}\n\t}\n\n\treturn ret, nil\n}", "func (fn GetDefinitionHandlerFunc) Handle(params GetDefinitionParams) middleware.Responder {\n\treturn fn(params)\n}", "func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func servicesSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\ts := schema{\n\t\tTitle: \"service collection\",\n\t\tType: \"array\",\n\t\tItems: &schema{\n\t\t\tRef: \"http://myhost.com/schema/service\",\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func NewSchemaHandler(p SchemaHandlerParams) SchemaHandler {\n\treturn SchemaHandler{\n\t\ttableSchemaMutator: p.TableSchemaMutator,\n\t\tenumMutator: p.EnumMutator,\n\t\tlogger: p.Logger,\n\t}\n}", "func (m* Manager) GetHandler(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\tfuncName := r.FormValue(\"funcName\")\n\n\tres, err := m.platformManager.GetFunction(funcName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonRet, err := json.Marshal(res)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\tw.Write(jsonRet)\n\treturn\n}", "func GetQueryHandlers(s *Server) *datasource.QueryTypeMux {\n\tmux := datasource.NewQueryTypeMux()\n\n\t// This could be a map[models.QueryType]datasource.QueryHandlerFunc and then a loop to handle all of them.\n\tmux.HandleFunc(models.QueryDatabaseMeasurements, s.HandleDatabaseMeasurements)\n\tmux.HandleFunc(models.QueryProcessMeasurements, s.HandleProcessMeasurements)\n\tmux.HandleFunc(models.QueryDiskMeasurements, s.HandleDiskMeasurements)\n\n\treturn mux\n}", "func (m *Mixin) GetSchema() (string, error) {\n\tb, err := m.schema.Find(\"kustomize.json\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(b), nil\n}", "func (c *Cluster) GetSchema(ctx context.Context, keyspace string, opts GetSchemaOptions) (*vtadminpb.Schema, error) {\n\tspan, ctx := trace.NewSpan(ctx, \"Cluster.GetSchema\")\n\tdefer span.Finish()\n\n\tif opts.TableSizeOptions == nil {\n\t\topts.TableSizeOptions = &vtadminpb.GetSchemaTableSizeOptions{\n\t\t\tAggregateSizes: false,\n\t\t\tIncludeNonServingShards: false,\n\t\t}\n\t}\n\n\tif opts.BaseRequest == nil {\n\t\topts.BaseRequest = &vtctldatapb.GetSchemaRequest{}\n\t}\n\n\tif opts.TableSizeOptions.AggregateSizes && opts.BaseRequest.TableNamesOnly {\n\t\tlog.Warningf(\"GetSchema(cluster = %s) size aggregation is incompatible with TableNamesOnly, ignoring the latter in favor of aggregating sizes\", c.ID)\n\t\topts.BaseRequest.TableNamesOnly = false\n\t}\n\n\tAnnotateSpan(c, span)\n\tspan.Annotate(\"keyspace\", keyspace)\n\tannotateGetSchemaRequest(opts.BaseRequest, span)\n\tvtadminproto.AnnotateSpanWithGetSchemaTableSizeOptions(opts.TableSizeOptions, span)\n\n\tif len(opts.Tablets) == 0 {\n\t\t// Fetch all tablets for the keyspace.\n\t\tvar err error\n\n\t\topts.Tablets, err = c.FindTablets(ctx, func(tablet *vtadminpb.Tablet) bool {\n\t\t\treturn tablet.Tablet.Keyspace == keyspace\n\t\t}, -1)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w for keyspace %s\", errors.ErrNoTablet, keyspace)\n\t\t}\n\t}\n\n\tif err := c.Vtctld.Dial(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to Dial vtctld for cluster = %s for GetSchema: %w\", c.ID, err)\n\t}\n\n\ttabletsToQuery, err := c.getTabletsToQueryForSchemas(ctx, keyspace, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.getSchemaFromTablets(ctx, keyspace, tabletsToQuery, opts)\n}", "func GetDocumentHandler(index, typeName, endpoint string, r *http.Request, s server.PGElasticServer) (response interface{}, err error) {\n\tdocumentID := endpoint\n\tdocumentObject, err := s.GetDBClient().GetDocument(index, typeName, documentID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif documentObject != nil {\n\t\tresponse = documentGetResponse{\n\t\t\tIndex: index,\n\t\t\tType: typeName,\n\t\t\tID: documentObject.ID,\n\t\t\tVersion: documentObject.Version,\n\t\t\tFound: true,\n\t\t\tDocument: documentObject.Document,\n\t\t}\n\t} else {\n\t\tresponse = documentGetResponse{\n\t\t\tIndex: index,\n\t\t\tType: typeName,\n\t\t\tFound: false,\n\t\t}\n\n\t}\n\treturn response, nil\n}", "func (s *peerRESTServer) GetLocksHandler(w http.ResponseWriter, r *http.Request) {\n\tif !s.IsValid(w, r) {\n\t\ts.writeErrorResponse(w, errors.New(\"Invalid request\"))\n\t\treturn\n\t}\n\n\tctx := newContext(r, w, \"GetLocks\")\n\tlocks := globalLockServer.ll.DupLockMap()\n\tlogger.LogIf(ctx, gob.NewEncoder(w).Encode(locks))\n\n\tw.(http.Flusher).Flush()\n\n}", "func (s *server) handleStoryboardsGet() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuserID := r.Context().Value(contextKeyUserID).(string)\n\n\t\tstoryboards, err := s.database.GetStoryboardsByUser(userID)\n\n\t\tif err != nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\n\t\ts.respondWithJSON(w, http.StatusOK, storyboards)\n\t}\n}", "func GetMetricsHandler(db *models.DB) func(echo.Context) error {\n\treturn func(c echo.Context) (err error) {\n\t\topts := new(models.GetMetricsOpts)\n\t\tif err = c.Bind(opts); err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error())\n\t\t}\n\t\tmetrics, err := db.GetMetrics(*opts)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\treturn c.JSON(http.StatusOK, metrics)\n\t}\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (fn WeaveModelManifestsGetHandlerFunc) Handle(params WeaveModelManifestsGetParams, principal interface{}) middleware.Responder {\n\treturn fn(params, principal)\n}", "func NewSchema(m ...interface{}) *Schema {\n\tif len(m) > 0 {\n\t\tsche := &Schema{}\n\t\tstack := toMiddleware(m)\n\t\tfor _, s := range stack {\n\t\t\t*sche = append(*sche, s)\n\t\t}\n\t\treturn sche\n\t}\n\treturn nil\n}", "func HandleGetTableRules(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbAlias\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcol := \"\"\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\n\t\tdbConfig, err := syncMan.GetCollectionRules(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func appSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\thost, err := config.GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := []link{\n\t\t{\"href\": host + \"/apps/{name}/log\", \"method\": \"GET\", \"rel\": \"log\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"GET\", \"rel\": \"get_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"POST\", \"rel\": \"set_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"DELETE\", \"rel\": \"unset_env\"},\n\t\t{\"href\": host + \"/apps/{name}/restart\", \"method\": \"GET\", \"rel\": \"restart\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"POST\", \"rel\": \"update\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"DELETE\", \"rel\": \"delete\"},\n\t\t{\"href\": host + \"/apps/{name}/run\", \"method\": \"POST\", \"rel\": \"run\"},\n\t}\n\ts := schema{\n\t\tTitle: \"app schema\",\n\t\tType: \"object\",\n\t\tLinks: l,\n\t\tRequired: []string{\"platform\", \"name\"},\n\t\tProperties: map[string]property{\n\t\t\t\"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"platform\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"ip\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"cname\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func generateHandler(w http.ResponseWriter, r *http.Request) {\n\tpath := r.URL.Path[1:]\n\trequest := urlParser.ParseURL(path)\n\n\ttableName := request.TableName\n\tfields := request.Fields\n\n\t//only valid names are existing tables in db\n\tif !structs.ValidStruct[tableName] {\n\t\tfmt.Printf(\"\\\"%s\\\" table not found.\\n\", tableName)\n\n\t\thttp.NotFound(w, r)\n\t} else {\n\t\tfmt.Printf(\"\\\"%s\\\" table found.\\n\", tableName)\n\n\t\trows := sqlParser.GetRows(tableName, fields)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tif fields == \"\" {\n\t\t\tfmt.Printf(\"No fields\\n\")\n\t\t\tstructs.MapTableToJson(tableName, rows, w)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\n\", fields)\n\t\t\tfieldArray := strings.Split(fields, \",\")\n\t\t\tstructFilter.MapCustomTableToJson(tableName, rows, w, fieldArray)\n\t\t}\n\t}\n}", "func (a *App) GetDialogsHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid Product ID\")\n\t\treturn\n\t}\n\n\tdialogs, err := getDialogs(a.DB, id)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, dialogs)\n}", "func (o SchemaPackageResponseOutput) Schemas() Hl7SchemaConfigResponseArrayOutput {\n\treturn o.ApplyT(func(v SchemaPackageResponse) []Hl7SchemaConfigResponse { return v.Schemas }).(Hl7SchemaConfigResponseArrayOutput)\n}", "func (c *clusterCache) GetOpenAPISchema() openapi.Resources {\n\treturn c.openAPISchema\n}", "func (p *hostingdeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {\n\tresp.Schema = schema.Schema{\n\t\tAttributes: map[string]schema.Attribute{\n\t\t\t\"account_id\": schema.StringAttribute{\n\t\t\t\tDescription: \"Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"auth_token\": schema.StringAttribute{\n\t\t\t\tDescription: \"Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func Get() *Schema {\n\treturn current\n}", "func (c *Converter) GenerateJSONSchemas() ([]types.GeneratedJSONSchema, error) {\n\n\tc.logger.Debug(\"Converting API\")\n\n\t// Store the output in here:\n\tgeneratedJSONSchemas, err := c.mapOpenAPIDefinitionsToJSONSchema()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not map openapi definitions to jsonschema\")\n\t}\n\n\treturn generatedJSONSchemas, nil\n}", "func (manager *Manager) Schema(id string) (*Schema, bool) {\n\tmanager.mu.RLock()\n\tdefer manager.mu.RUnlock()\n\n\treturn manager.schema(id)\n}", "func GetSchema(schemaName string, conn Conn) (Schema, error) {\n\tvar tbls []string\n\tvar err error\n\tvar tbl Table\n\tvar s = Schema{\n\t\tName: schemaName,\n\t}\n\ttbls, err = conn.GetTableNames(schemaName)\n\tif err != nil {\n\t\treturn Schema{}, err\n\t}\n\tfor _, t := range tbls {\n\t\ttbl, err = GetTable(schemaName, t, conn)\n\t\tif err != nil {\n\t\t\treturn Schema{}, err\n\t\t}\n\t\ts.Tables = append(s.Tables, tbl)\n\t}\n\treturn s, nil\n}", "func (d *Document) Schemas() []*Schema {\n\treturn d.schemas\n}", "func (o LookupEntryResultOutput) Schema() GoogleCloudDatacatalogV1SchemaResponseOutput {\n\treturn o.ApplyT(func(v LookupEntryResult) GoogleCloudDatacatalogV1SchemaResponse { return v.Schema }).(GoogleCloudDatacatalogV1SchemaResponseOutput)\n}" ]
[ "0.7004768", "0.6699936", "0.66698825", "0.6629372", "0.65966946", "0.65060455", "0.6421018", "0.6378638", "0.62172014", "0.61479443", "0.61028916", "0.6035422", "0.590596", "0.59007186", "0.5847819", "0.5807947", "0.5741891", "0.5739257", "0.57041323", "0.5689232", "0.5688833", "0.55966663", "0.55183405", "0.5496039", "0.5434089", "0.5412442", "0.54045993", "0.5385425", "0.53815335", "0.53771317", "0.53599054", "0.5357353", "0.53501165", "0.5348661", "0.5335425", "0.5322248", "0.52932453", "0.5270598", "0.52638733", "0.5259676", "0.5256299", "0.52538717", "0.52347237", "0.52322024", "0.52205986", "0.5213348", "0.5211908", "0.52110904", "0.5206145", "0.51928216", "0.518371", "0.51752406", "0.516923", "0.516388", "0.5159819", "0.51540637", "0.5135899", "0.51346904", "0.5118403", "0.5100401", "0.50920796", "0.50699484", "0.50648624", "0.5050291", "0.50489587", "0.50406444", "0.50285816", "0.50242954", "0.50162643", "0.501155", "0.49873668", "0.49734393", "0.49727774", "0.49655432", "0.49646434", "0.49513885", "0.4946751", "0.49408874", "0.49304035", "0.4929056", "0.49258155", "0.49037847", "0.49009836", "0.49009836", "0.49009836", "0.48992488", "0.48976836", "0.4878356", "0.48661748", "0.48553866", "0.48522133", "0.48452652", "0.48394966", "0.48380542", "0.48322433", "0.4831521", "0.4831206", "0.4830908", "0.4803322", "0.48032993" ]
0.8195078
0
HandleSetTableRules is an endpoint handler which update database collection rules in config & creates collection if it doesn't exist
func HandleSetTableRules(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) v := config.TableRule{} _ = json.NewDecoder(r.Body).Decode(&v) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] col := vars["col"] if err := syncman.SetCollectionRules(ctx, projectID, dbAlias, col, &v); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) // return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleGetTableRules(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbAlias\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcol := \"\"\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\n\t\tdbConfig, err := syncMan.GetCollectionRules(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig})\n\t}\n}", "func (s *Manager) SetCollectionRules(ctx context.Context, project, dbAlias, col string, v *config.TableRule) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// update collection rules & is realtime in config\n\tdatabaseConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn errors.New(\"specified database not present in config\")\n\t}\n\tcollection, ok := databaseConfig.Collections[col]\n\tif !ok {\n\t\tif databaseConfig.Collections == nil {\n\t\t\tdatabaseConfig.Collections = map[string]*config.TableRule{col: v}\n\t\t} else {\n\t\t\tdatabaseConfig.Collections[col] = &config.TableRule{IsRealTimeEnabled: v.IsRealTimeEnabled, Rules: v.Rules}\n\t\t}\n\t} else {\n\t\tcollection.IsRealTimeEnabled = v.IsRealTimeEnabled\n\t\tcollection.Rules = v.Rules\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func (c Control) ServeSetRules(w http.ResponseWriter, r *http.Request) {\n\t// Get rules from the request.\n\trulesData := r.PostFormValue(\"rules\")\n\tvar decoded map[string][]string\n\tif err := json.Unmarshal([]byte(rulesData), &decoded); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Set rules in the configuration and server.\n\tc.Config.Lock()\n\tc.Config.Rules = decoded\n\tc.Server.Proxy.SetRuleTable(decoded)\n\tc.Config.Save()\n\tc.Config.Unlock()\n\n\thttp.Redirect(w, r, \"/rules\", http.StatusTemporaryRedirect)\n}", "func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\tif err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (m *SynchronizationSchema) SetSynchronizationRules(value []SynchronizationRuleable)() {\n err := m.GetBackingStore().Set(\"synchronizationRules\", value)\n if err != nil {\n panic(err)\n }\n}", "func (db *RethinkDBAdapter) SetupTable(tableName string) *CASServerError {\n\tswitch tableName {\n\tcase db.ticketsTableName:\n\t\treturn db.SetupTicketsTable()\n\tcase db.servicesTableName:\n\t\treturn db.SetupServicesTable()\n\tcase db.usersTableName:\n\t\treturn db.SetupUsersTable()\n\tcase db.apiKeysTableName:\n\t\treturn db.SetupApiKeysTable()\n\tdefault:\n\t\tcasError := &FailedToSetupDatabaseError\n\t\treturn casError\n\t}\n}", "func SetRulesetAction(ruleAction map[string]string) (err error) {\n cmd, err := utils.GetKeyValueString(\"execute\", \"command\")\n if err != nil {\n logs.Error(\"SetRulesetAction Error getting data from main.conf\")\n return err\n }\n param, err := utils.GetKeyValueString(\"execute\", \"param\")\n if err != nil {\n logs.Error(\"SetRulesetAction Error getting data from main.conf\")\n return err\n }\n\n sid := ruleAction[\"sid\"]\n uuid := ruleAction[\"uuid\"]\n action := ruleAction[\"action\"]\n path, err := ndb.GetRulesetPath(uuid)\n\n if action == \"Enable\" {\n val := \"sed -i '/sid:\\\\s*\" + sid + \"/s/^#//' \" + path + \"\"\n _, err := exec.Command(cmd, param, val).Output()\n if err != nil {\n logs.Error(\"Set ruleset actiopn ERROR: \"+err.Error())\n return nil\n }\n } else {\n val := \"sed -i '/sid:\\\\s*\" + sid + \"/s/^/#/' \" + path + \"\"\n _, err := exec.Command(cmd, param, val).Output() \n if err != nil {\n logs.Error(\"Set ruleset actiopn ERROR: \"+err.Error())\n return nil\n }\n }\n return err\n}", "func AddNewRuleset(data map[string]map[string]string) (duplicated []byte, err error) { \n //check for duplicated rule SIDs\n if duplicated, err = FindDuplicatedSIDs(data); duplicated != nil {\n return duplicated, nil\n }\n if err != nil {\n logs.Error(\"ruleset/AddNewRuleset -- duplicated error: %s\", err.Error())\n return nil, err\n }\n\n if ndb.Rdb == nil {\n logs.Error(\"ruleset/AddNewRuleset -- Can't access to database\")\n return nil, errors.New(\"ruleset/AddNewRuleset -- Can't access to database\")\n }\n\n localFiles, err := utils.GetKeyValueString(\"ruleset\", \"localRulesets\")\n if err != nil {\n logs.Error(\"DeleteRuleset Error getting data from main.conf for load data: \" + err.Error())\n return duplicated, err\n }\n \n rulesetCreated := false\n rulesetUUID := utils.Generate()\n\n //get all rulesets\n rsets,err := ndb.GetAllRulesets()\n\n //check for previous default ruleset. If not, set as default\n setAsDefault := true\n for x := range rsets {\n if rsets[x][\"default\"] == \"true\" && rsets[x][\"type\"] == \"local\"{\n setAsDefault = false\n break\n }\n }\n\n //add new ruleset\n for x := range data {\n for rsetID := range rsets {\n if rsetID == data[x][\"uuid\"] && !rulesetCreated { rulesetCreated = true }\n }\n\n rulesetFolderName := strings.Replace(data[x][\"rulesetName\"], \" \", \"_\", -1)\n path := localFiles + rulesetFolderName + \"/\" + data[x][\"fileName\"]\n\n if !rulesetCreated {\n err = insertRulesetValues(rulesetUUID, \"type\", \"local\")\n err = insertRulesetValues(rulesetUUID, \"name\", data[x][\"rulesetName\"])\n err = insertRulesetValues(rulesetUUID, \"desc\", data[x][\"rulesetDesc\"])\n if setAsDefault{\n err = insertRulesetValues(rulesetUUID, \"default\", \"true\")\n }else{\n err = insertRulesetValues(rulesetUUID, \"default\", \"false\")\n }\n if err != nil {\n logs.Error(\"ruleset/AddNewRuleset -- Insert error: %s\", err.Error())\n return nil, err\n }\n rulesetCreated = true\n }\n\n //copy source file into new folder\n if _, err := os.Stat(localFiles + rulesetFolderName); os.IsNotExist(err) {\n os.MkdirAll(localFiles+rulesetFolderName, os.ModePerm)\n }\n\n //copyfile\n copy, err := utils.GetKeyValueString(\"execute\", \"copy\")\n if err != nil {\n logs.Error(\"SetRulesetAction Error getting data from main.conf\")\n return nil, err\n }\n\n cpCmd := exec.Command(copy, data[x][\"filePath\"], path)\n err = cpCmd.Run()\n if err != nil {\n logs.Error(\"ruleset/AddNewRuleset -- Error copying new file: %s\", err.Error())\n return nil, err\n }\n\n //add md5 for every file\n md5, err := utils.CalculateMD5(path)\n if err != nil {\n logs.Error(\"ruleset/AddNewRuleset -- Error calculating md5: %s\", err.Error())\n return nil, err\n }\n\n ruleFilesUUID := utils.Generate()\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"name\", data[x][\"rulesetName\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"path\", path)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"file\", data[x][\"fileName\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"type\", \"local\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceUUID\", rulesetUUID)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceFileUUID\", x)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"exists\", \"true\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"isUpdated\", \"false\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"md5\", md5)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceType\", data[x][\"sourceType\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"linesAdded\", \"true\")\n if err != nil {\n logs.Error(\"ruleset/AddNewRuleset -- Error Inserting Ruleset: %s\", err.Error())\n return nil, err\n }\n }\n\n return nil, nil\n}", "func ModifyRuleset(data map[string]map[string]string) (duplicated []byte, err error) {\n \n logs.Info(data)\n\n if ndb.Rdb == nil {\n logs.Error(\"ruleset/ModifyRuleset -- Can't access to database\")\n return nil, errors.New(\"ruleset/ModifyRuleset -- Can't access to database\")\n }\n\n //check for duplicated rule SIDs\n if duplicated, err = FindDuplicatedSIDs(data); duplicated != nil {\n return duplicated, nil\n }\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- duplicated error: %s\", err.Error())\n return nil, err\n }\n\n //delete all rule files by source UUID\n for x := range data {\n rsets, err := ndb.GetAllRuleFiles()\n for id := range rsets {\n if rsets[id][\"sourceUUID\"] == data[x][\"uuid\"] {\n //delete local file\n err = os.RemoveAll(rsets[id][\"path\"]) \n if err != nil {logs.Error(\"ruleset/ModifyRuleset -- delete files locally for update error: %s\", err.Error()); return nil, err}\n //delete rule_file by uuid\n err = ndb.DeleteRuleFilesByUuid(id)\n if err != nil {logs.Error(\"ruleset/ModifyRuleset -- delete files at database for update error: %s\", err.Error()); return nil, err}\n }\n }\n }\n\n //get local ruleset path\n localFiles, err := utils.GetKeyValueString(\"ruleset\", \"localRulesets\")\n if err != nil {\n logs.Error(\"DeleteRuleset Error getting data from main.conf for load data: \" + err.Error())\n return duplicated, err\n }\n\n rulesetModified := false\n for x := range data {\n rulesetFolderName := strings.Replace(data[x][\"rulesetName\"], \" \", \"_\", -1)\n path := localFiles + rulesetFolderName + \"/\" + data[x][\"fileName\"]\n\n //change ruleset name and desc\n if !rulesetModified {\n err = ndb.UpdateRuleset(data[x][\"uuid\"], \"name\", data[x][\"rulesetName\"])\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- modify name error: %s\", err.Error())\n return nil, err\n }\n err = ndb.UpdateRuleset(data[x][\"uuid\"], \"desc\", data[x][\"rulesetDesc\"])\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- modify desc error: %s\", err.Error())\n return nil, err\n }\n rulesetModified = true\n }\n\n //check source file folder\n if _, err := os.Stat(localFiles + rulesetFolderName); os.IsNotExist(err) {\n os.MkdirAll(localFiles+rulesetFolderName, os.ModePerm)\n }\n\n //copyfile\n copy, err := utils.GetKeyValueString(\"execute\", \"copy\")\n if err != nil {\n logs.Error(\"SetRulesetAction Error getting data from main.conf\")\n return nil, err\n }\n\n cpCmd := exec.Command(copy, data[x][\"filePath\"], path)\n err = cpCmd.Run()\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- Error copying new file: %s\", err.Error())\n return nil, err\n }\n\n //add md5 for every file\n md5, err := utils.CalculateMD5(path)\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- Error calculating md5: %s\", err.Error())\n return nil, err\n }\n\n ruleFilesUUID := utils.Generate()\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"name\", data[x][\"rulesetName\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"path\", path)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"file\", data[x][\"fileName\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"type\", \"local\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceUUID\", data[x][\"uuid\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceFileUUID\", x)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"exists\", \"true\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"isUpdated\", \"false\")\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"md5\", md5)\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"sourceType\", data[x][\"sourceType\"])\n err = ndb.InsertRulesetSourceRules(ruleFilesUUID, \"linesAdded\", \"true\")\n if err != nil {\n logs.Error(\"ruleset/ModifyRuleset -- Error Inserting Ruleset: %s\", err.Error())\n return nil, err\n }\n }\n\n return nil, nil\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func GetRulesetRules(uuid string) (r map[string]map[string]string, err error) {\n rules := make(map[string]map[string]string)\n path, err := ndb.GetRulesetPath(uuid)\n rules, err = ReadRuleset(path)\n for rule := range rules {\n retrieveNote := make(map[string]string)\n retrieveNote[\"uuid\"] = uuid\n retrieveNote[\"sid\"] = rule\n rules[rule][\"note\"], _ = GetRuleNote(retrieveNote)\n sourceType, err := ndb.GetRuleFilesValue(uuid, \"sourceType\")\n if err != nil {\n logs.Error(\"GetRulesetRules--> GetRuleFilesValue query error %s\", err.Error())\n return nil, err\n }\n rules[rule][\"sourceType\"] = sourceType\n }\n return rules, err\n}", "func (m *endpointManager) applyRules(workloadId proto.WorkloadEndpointID, endpointId string, inboundPolicyIds []string, outboundPolicyIds []string) error {\n\tlogCxt := log.WithFields(log.Fields{\"id\": workloadId, \"endpointId\": endpointId})\n\tlogCxt.WithFields(log.Fields{\n\t\t\"inboundPolicyIds\": inboundPolicyIds,\n\t\t\"outboundPolicyIds\": outboundPolicyIds,\n\t}).Info(\"Applying endpoint rules\")\n\n\tvar rules []*hns.ACLPolicy\n\n\tif nodeToEp := m.nodeToEndpointRule(); nodeToEp != nil {\n\t\tlog.WithField(\"hostAddrs\", m.hostAddrs).Debug(\"Adding node->endpoint allow rule\")\n\t\trules = append(rules, nodeToEp)\n\t}\n\trules = append(rules, m.policysetsDataplane.GetPolicySetRules(inboundPolicyIds, true)...)\n\trules = append(rules, m.policysetsDataplane.GetPolicySetRules(outboundPolicyIds, false)...)\n\n\tif len(rules) > 0 {\n\t\tif log.GetLevel() >= log.DebugLevel {\n\t\t\tfor _, rule := range rules {\n\t\t\t\tlogCxt.WithField(\"rule\", rule).Debug(\"Complete set of rules to be applied\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlogCxt.Info(\"No policies/profiles were specified, all rules will be removed from this endpoint\")\n\t}\n\n\tlogCxt.Debug(\"Sending request to hns to apply the rules\")\n\n\tendpoint := &hns.HNSEndpoint{}\n\tendpoint.Id = endpointId\n\n\tif err := endpoint.ApplyACLPolicy(rules...); err != nil {\n\t\tlogCxt.WithError(err).Warning(\"Failed to apply rules. This operation will be retried.\")\n\t\treturn ErrorUpdateFailed\n\t}\n\n\treturn nil\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (db *RethinkDBAdapter) setTableSetupOptions(tableName string, opts *r.TableCreateOpts) error {\n\tswitch tableName {\n\tcase db.ticketsTableName:\n\t\tdb.ticketsTableOptions = opts\n\tcase db.servicesTableName:\n\t\tdb.servicesTableOptions = opts\n\tcase db.usersTableName:\n\t\tdb.usersTableOptions = opts\n\tcase db.apiKeysTableName:\n\t\tdb.apiKeysTableOptions = opts\n\tdefault:\n\t\treturn errors.New(fmt.Sprintf(\"Failed to set table setup options for table [%s]\", tableName))\n\t}\n\treturn nil\n}", "func tablesHandler(w http.ResponseWriter, r *http.Request) {\n\tsourcesManageHandler(w, r, ast.TypeTable)\n}", "func DeleteRuleset(rulesetMap map[string]string) (err error) {\n uuid := rulesetMap[\"uuid\"]\n name := rulesetMap[\"name\"]\n rulesetFolderName := strings.Replace(name, \" \", \"_\", -1)\n\n localRulesetFiles, err := utils.GetKeyValueString(\"ruleset\", \"localRulesets\")\n if err != nil {\n logs.Error(\"DeleteRuleset Error getting data from main.conf for load data: \" + err.Error())\n return err\n }\n\n //delete LOG for scheduler\n err = ndb.DeleteSchedulerLog(uuid)\n if err != nil {\n logs.Error(\"Error deleting LOG DeleteSchedulerLog: \" + err.Error())\n return err\n }\n\n //delete scheduler\n schedulerUUID, err := ndb.GetSchedulerByValue(uuid)\n if err != nil {\n logs.Error(\"Error getting scheduler uuid GetSchedulerByValue: \" + err.Error())\n return err\n }\n\n err = ndb.DeleteScheduler(schedulerUUID)\n if err != nil {\n logs.Error(\"Error deleting scheduler uuid DeleteSchedulerLog: \" + err.Error())\n return err\n }\n\n //delete ruleset\n err = ndb.DeleteRulesetByUniqueid(uuid)\n if err != nil {\n logs.Error(\"DeleteRulesetByUniqueid -> ERROR deleting ruleset: \" + err.Error())\n return err\n }\n\n //delete a node ruleset\n err = ndb.DeleteRulesetNodeByUniqueid(uuid)\n if err != nil {\n logs.Error(\"DeleteRulesetNodeByUniqueid -> ERROR deleting ruleset: \" + err.Error())\n return err\n }\n\n //select all groups\n groups, err := ndb.GetAllGroups()\n if err != nil {\n logs.Error(\"DeleteRulesetNodeByUniqueid -> ERROR getting all groups: \" + err.Error())\n return err\n }\n groupsRulesets, err := ndb.GetAllGroupRulesets()\n if err != nil {\n logs.Error(\"DeleteRulesetNodeByUniqueid -> ERROR getting all grouprulesets: \" + err.Error())\n return err\n }\n for id := range groups {\n for grid := range groupsRulesets {\n if groupsRulesets[grid][\"groupid\"] == id && groupsRulesets[grid][\"rulesetid\"] == uuid {\n //delete a node ruleset\n err = ndb.DeleteGroupRulesetByValue(\"groupid\", id)\n if err != nil {\n logs.Error(\"DeleteRulesetNodeByUniqueid -> ERROR deleting grouprulesets: \" + err.Error())\n return err\n }\n err = ndb.DeleteGroupRulesetByValue(\"rulesetid\", uuid)\n if err != nil {\n logs.Error(\"DeleteRulesetNodeByUniqueid -> ERROR deleting grouprulesets: \" + err.Error())\n return err\n }\n }\n }\n\n }\n\n //delete ruleset from path\n err = os.RemoveAll(localRulesetFiles + rulesetFolderName)\n if err != nil {\n logs.Error(\"DB DeleteRuleset/rm -> ERROR deleting ruleset from their path...\")\n return errors.New(\"DB DeleteRuleset/rm -> ERROR deleting ruleset from their path...\")\n }\n\n //delete all ruleset source rules for specific uuid\n rules, err := ndb.GetRulesFromRuleset(uuid)\n if err != nil {\n logs.Error(\"GetRulesFromRuleset -> ERROR getting all rule_files for delete local ruleset: \" + err.Error())\n return err\n }\n for sourceUUID := range rules {\n err = ndb.DeleteRuleFilesByUuid(sourceUUID)\n if err != nil {\n logs.Error(\"DeleteRuleFilesByUuid -> ERROR deleting all local ruleset rule files associated: \" + err.Error())\n return err\n }\n }\n\n //update to nil group ruleset\n rulesetsForGroups, err := ndb.GetAllGroupsBValue(uuid)\n if err != nil {\n logs.Error(\"GetAllGroupsBValue -> ERROR getting all groups by ruleset uuid: \" + err.Error())\n return err\n }\n for y := range rulesetsForGroups {\n err = ndb.UpdateGroupValue(y, \"ruleset\", \"\")\n if err != nil {\n logs.Error(\"Error updating to null rulesets into group table: \" + err.Error())\n return err\n }\n err = ndb.UpdateGroupValue(y, \"rulesetID\", \"\")\n if err != nil {\n logs.Error(\"Error updating to null rulesetsID into group table: \" + err.Error())\n return err\n }\n }\n\n return nil\n}", "func HandleAddEventingSecurityRule(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tc := new(config.Rule)\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-rule\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing rules\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSecurityRules(ctx, projectID, evType, c, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to add eventing rules\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func SetDefaultRuleset(uuid string) (err error) {\n //get all rulesets\n rsets,err := ndb.GetAllRulesets()\n for x := range rsets {\n \n if rsets[x][\"default\"] == \"\" && rsets[x][\"type\"] == \"local\"{ \n err = ndb.RulesetSourceKeyInsert(x, \"default\", \"false\")\n if err != nil {logs.Error(\"ruleset/SetDefaultRuleset: %s\", err.Error()); return err}\n }\n \n if rsets[x][\"default\"] == \"true\" && rsets[x][\"type\"] == \"local\"{\n err = ndb.UpdateRuleset(x, \"default\", \"false\")\n if err != nil {logs.Error(\"ruleset/SetDefaultRuleset: %s\", err.Error()); return err}\n }\n }\n \n err = ndb.UpdateRuleset(uuid, \"default\", \"true\")\n if err != nil {logs.Error(\"ruleset/SetDefaultRuleset: %s\", err.Error()); return err}\n\n return err\n}", "func SetRuleSelected(n map[string]string) (err error) {\n node_uniqueid_ruleset := n[\"nid\"]\n ruleset_uniqueid := n[\"rule_uid\"]\n\n if ndb.Rdb == nil {\n logs.Error(\"SetRuleSelected -- Can't access to database\")\n return errors.New(\"SetRuleSelected -- Can't access to database\")\n }\n sqlQuery := \"SELECT * FROM ruleset_node WHERE node_uniqueid = \\\"\" + node_uniqueid_ruleset + \"\\\";\"\n rows, err := ndb.Rdb.Query(sqlQuery)\n if err != nil {\n logs.Error(\"Put SetRuleSelecteda query error %s\", err.Error())\n return err\n }\n defer rows.Close()\n if rows.Next() {\n rows.Close()\n updateRulesetNode, err := ndb.Rdb.Prepare(\"update ruleset_node set ruleset_uniqueid = ? where node_uniqueid = ?;\")\n if err != nil {\n logs.Error(\"SetRuleSelected UPDATE prepare error -- \" + err.Error())\n return err\n }\n _, err = updateRulesetNode.Exec(&ruleset_uniqueid, &node_uniqueid_ruleset)\n defer updateRulesetNode.Close()\n\n if err != nil {\n logs.Error(\"SetRuleSelected UPDATE Error -- \" + err.Error())\n return err\n }\n return nil\n } else {\n insertRulesetNode, err := ndb.Rdb.Prepare(\"insert into ruleset_node (ruleset_uniqueid, node_uniqueid) values (?,?);\")\n _, err = insertRulesetNode.Exec(&ruleset_uniqueid, &node_uniqueid_ruleset)\n defer insertRulesetNode.Close()\n\n if err != nil {\n logs.Error(\"error insertRulesetNode en ruleset/rulesets--> \" + err.Error())\n return err\n }\n return nil\n }\n return err\n}", "func (t *Trinity) initViewSetCfg() {\n\tv := &ViewSetCfg{\n\t\tDb: t.db,\n\t\tHasAuthCtl: false,\n\t\tAtomicRequestMap: map[string]bool{\n\t\t\t\"RETRIEVE\": t.setting.GetAtomicRequest(),\n\t\t\t\"GET\": t.setting.GetAtomicRequest(),\n\t\t\t\"POST\": t.setting.GetAtomicRequest(),\n\t\t\t\"PATCH\": t.setting.GetAtomicRequest(),\n\t\t\t\"PUT\": t.setting.GetAtomicRequest(),\n\t\t\t\"DELETE\": t.setting.GetAtomicRequest(),\n\t\t},\n\t\tAuthenticationBackendMap: map[string]func(c *gin.Context) error{\n\t\t\t\"RETRIEVE\": JwtUnverifiedAuthBackend,\n\t\t\t\"GET\": JwtUnverifiedAuthBackend,\n\t\t\t\"POST\": JwtUnverifiedAuthBackend,\n\t\t\t\"PATCH\": JwtUnverifiedAuthBackend,\n\t\t\t\"PUT\": JwtUnverifiedAuthBackend,\n\t\t\t\"DELETE\": JwtUnverifiedAuthBackend,\n\t\t},\n\t\tGetCurrentUserAuth: func(c *gin.Context, db *gorm.DB) error {\n\t\t\tc.Set(\"UserID\", \"\") // with c.GetInt64(\"UserID\")\n\t\t\tc.Set(\"UserPermission\", []string{}) // with c.GetStringSlice(\"UserID\")\n\t\t\treturn nil\n\t\t},\n\t\tAccessBackendRequireMap: map[string][]string{},\n\t\tAccessBackendCheckMap: map[string]func(v *ViewSetRunTime) error{\n\t\t\t\"RETRIEVE\": DefaultAccessBackend,\n\t\t\t\"GET\": DefaultAccessBackend,\n\t\t\t\"POST\": DefaultAccessBackend,\n\t\t\t\"PATCH\": DefaultAccessBackend,\n\t\t\t\"PUT\": DefaultAccessBackend,\n\t\t\t\"DELETE\": DefaultAccessBackend,\n\t\t},\n\t\tPreloadListMap: map[string]map[string]func(db *gorm.DB) *gorm.DB{\n\t\t\t\"RETRIEVE\": nil, // Foreign key :Foreign table if you want to filter the foreign table\n\t\t\t\"GET\": nil,\n\t\t},\n\t\tFilterBackendMap: map[string]func(c *gin.Context, db *gorm.DB) *gorm.DB{\n\t\t\t\"RETRIEVE\": DefaultFilterBackend,\n\t\t\t\"GET\": DefaultFilterBackend,\n\t\t\t\"POST\": DefaultFilterBackend,\n\t\t\t\"PATCH\": DefaultFilterBackend,\n\t\t\t\"PUT\": DefaultFilterBackend,\n\t\t\t\"DELETE\": DefaultFilterBackend,\n\t\t},\n\t\tFilterByList: []string{},\n\t\tFilterCustomizeFunc: map[string]func(db *gorm.DB, queryValue string) *gorm.DB{},\n\t\tSearchingByList: []string{},\n\t\tOrderingByList: map[string]bool{},\n\t\tPageSize: t.setting.GetPageSize(),\n\t\tEnableOrderBy: true,\n\t\tEnableChangeLog: false,\n\t\tEnableDataVersion: true,\n\t\tEnableVersionControl: false,\n\t\tRetrieve: DefaultRetrieveCallback,\n\t\tGet: DefaultGetCallback,\n\t\tPost: DefaultPostCallback,\n\t\tPut: DefaultPutCallback,\n\t\tPatch: DefaultPatchCallback,\n\t\tDelete: DefaultDeleteCallback,\n\t}\n\tt.vCfg = v\n\n}", "func setRoutesOnCustomRoutingTable(container, ip, table string) {\n\ttype route struct {\n\t\tDst string `json:\"dst\"`\n\t\tDev string `json:\"dev\"`\n\t}\n\tout, err := runCommand(containerRuntime, \"exec\", container, \"ip\", \"--json\", \"route\", \"get\", ip)\n\tframework.ExpectNoError(err, fmt.Sprintf(\"failed to get default route to %s on node %s, out: %s\", ip, container, out))\n\n\troutes := []route{}\n\terr = json.Unmarshal([]byte(out), &routes)\n\tframework.ExpectNoError(err, fmt.Sprintf(\"failed to parse route to %s on node %s\", ip, container))\n\tgomega.Expect(routes).ToNot(gomega.HaveLen(0))\n\n\trouteTo := routes[0]\n\tout, err = runCommand(containerRuntime, \"exec\", container, \"ip\", \"route\", \"add\", ip, \"dev\", routeTo.Dev, \"table\", table, \"prio\", \"100\")\n\tframework.ExpectNoError(err, fmt.Sprintf(\"failed to set route to %s on node %s table %s, out: %s\", ip, container, table, out))\n\n\tout, err = runCommand(containerRuntime, \"exec\", container, \"ip\", \"route\", \"add\", \"blackhole\", ip, \"table\", table, \"prio\", \"50\")\n\tframework.ExpectNoError(err, fmt.Sprintf(\"failed to set blackhole route to %s on node %s table %s, out: %s\", ip, container, table, out))\n}", "func (s *Store) InitTable(ctx context.Context, m map[string]string) error {\n\tif _, err := s.db.ExecContext(ctx, create); err != nil {\n\t\treturn err\n\t}\n\tfor path, url := range m {\n\t\tif err := s.setURL(ctx, path, url); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func GetAllRulesets() (rulesets map[string]map[string]string, err error) {\n var allrulesets = map[string]map[string]string{}\n var uniqid string\n var param string\n var value string\n var uuidLocal string\n if ndb.Rdb == nil {\n logs.Error(\"ruleset/GetAllRulesets -- Can't access to database\")\n return nil, errors.New(\"ruleset/GetAllRulesets -- Can't access to database\")\n }\n sql := \"select ruleset_uniqueid from ruleset where ruleset_param='type' and ruleset_value = 'local';\"\n rows, err := ndb.Rdb.Query(sql)\n if err != nil {\n logs.Error(\"ruleset/GetAllRulesets -- Query error: %s\", err.Error())\n return nil, err\n }\n defer rows.Close()\n for rows.Next() {\n if err = rows.Scan(&uuidLocal); err != nil {\n logs.Error(\"ruleset/GetAllRulesets -- Query return error: %s\", err.Error())\n return nil, err\n }\n sql := \"select ruleset_uniqueid, ruleset_param, ruleset_value from ruleset where ruleset_uniqueid='\" + uuidLocal + \"';\"\n rowsLocal, err := ndb.Rdb.Query(sql)\n if err != nil {\n logs.Error(\"GetAllRulesets ndb.Rdb.Query Error : %s\", err.Error())\n return nil, err\n }\n defer rowsLocal.Close()\n for rowsLocal.Next() {\n if err = rowsLocal.Scan(&uniqid, &param, &value); err != nil {\n logs.Error(\"GetAllRulesets rowsLocal.Scan: %s\", err.Error())\n return nil, err\n }\n if allrulesets[uniqid] == nil {\n allrulesets[uniqid] = map[string]string{}\n }\n allrulesets[uniqid][param] = value\n\n //add scheduler status\n schedulerUUID, err := ndb.GetSchedulerByValue(uniqid)\n if err != nil {\n logs.Error(\"GetAllRulesets GetSchedulerByValue: %s\", err.Error())\n return nil, err\n }\n schedulerData, err := ndb.GetSchedulerByUniqueid(schedulerUUID)\n if err != nil {\n logs.Error(\"GetAllRulesets GetSchedulerByUniqueid: %s\", err.Error())\n return nil, err\n }\n allrulesets[uniqid][\"status\"] = schedulerData[schedulerUUID][\"status\"]\n\n }\n }\n\n return allrulesets, nil\n}", "func rulesHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\tbody, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Invalid body\", logger)\n\t\t\treturn\n\t\t}\n\t\tid, err := createRule(\"\", string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tfmt.Fprintf(w, \"Rule %s was created successfully.\", id)\n\tcase http.MethodGet:\n\t\tcontent, err := getAllRulesWithStatus()\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Show rules error\", logger)\n\t\t\treturn\n\t\t}\n\t\tjsonResponse(content, w, logger)\n\t}\n}", "func (h *eventHandler) OnTableChanged(schema string, table string) error {\n\t// err := h.r.updateRule(schema, table)\n\t// if err != nil && err != ErrRuleNotExist {\n\t// \treturn errors.Trace(err)\n\t// }\n\treturn nil\n}", "func (m *RuleBasedSubjectSet) SetRule(value *string)() {\n err := m.GetBackingStore().Set(\"rule\", value)\n if err != nil {\n panic(err)\n }\n}", "func insertRulesetValues(uuid string, param string, value string) (err error) {\n if ndb.RulesetParamExists(uuid, param) {\n updateRulesetValue, _ := ndb.Rdb.Prepare(\"update ruleset set ruleset_value = ? where ruleset_uniqueid = ? and ruleset_param =?;\")\n _, err = updateRulesetValue.Exec(&uuid, &param, &value)\n defer updateRulesetValue.Close()\n } else {\n insertRulesetValues, _ := ndb.Rdb.Prepare(\"insert into ruleset (ruleset_uniqueid, ruleset_param, ruleset_value) values (?,?,?);\")\n _, err = insertRulesetValues.Exec(&uuid, &param, &value)\n defer insertRulesetValues.Close()\n }\n\n if err != nil {\n return err\n }\n return nil\n}", "func SetRulesForTesting(ctx context.Context, rs []*FailureAssociationRule) error {\n\ttestutil.MustApply(ctx,\n\t\tspanner.Delete(\"FailureAssociationRules\", spanner.AllKeys()))\n\t// Insert some FailureAssociationRules.\n\t_, err := span.ReadWriteTransaction(ctx, func(ctx context.Context) error {\n\t\tfor _, r := range rs {\n\t\t\tms := spanutil.InsertMap(\"FailureAssociationRules\", map[string]any{\n\t\t\t\t\"Project\": r.Project,\n\t\t\t\t\"RuleId\": r.RuleID,\n\t\t\t\t\"RuleDefinition\": r.RuleDefinition,\n\t\t\t\t\"CreationTime\": r.CreationTime,\n\t\t\t\t\"CreationUser\": r.CreationUser,\n\t\t\t\t\"LastUpdated\": r.LastUpdated,\n\t\t\t\t\"LastUpdatedUser\": r.LastUpdatedUser,\n\t\t\t\t\"BugSystem\": r.BugID.System,\n\t\t\t\t\"BugID\": r.BugID.ID,\n\t\t\t\t\"PredicateLastUpdated\": r.PredicateLastUpdated,\n\t\t\t\t// Uses the value 'NULL' to indicate false, and true to indicate true.\n\t\t\t\t\"IsActive\": spanner.NullBool{Bool: r.IsActive, Valid: r.IsActive},\n\t\t\t\t\"IsManagingBug\": spanner.NullBool{Bool: r.IsManagingBug, Valid: r.IsManagingBug},\n\t\t\t\t\"IsManagingBugPriority\": r.IsManagingBugPriority,\n\t\t\t\t\"IsManagingBugPriorityLastUpdated\": r.IsManagingBugPriorityLastUpdated,\n\t\t\t\t\"SourceClusterAlgorithm\": r.SourceCluster.Algorithm,\n\t\t\t\t\"SourceClusterId\": r.SourceCluster.ID,\n\t\t\t})\n\t\t\tspan.BufferWrite(ctx, ms)\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}", "func (tc *tableCollector) tableSetFor(t *sqlparser.AliasedTableExpr) TableSet {\n\tfor i, t2 := range tc.Tables {\n\t\tif t == t2.GetExpr() {\n\t\t\treturn TableSet(1 << i)\n\t\t}\n\t}\n\tpanic(\"unknown table\")\n}", "func (s *Manager) GetCollectionRules(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ttype response struct {\n\t\tIsRealTimeEnabled bool `json:\"isRealtimeEnabled\"`\n\t\tRules map[string]*config.Rule `json:\"rules\"`\n\t}\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"specified collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {IsRealTimeEnabled: collectionInfo.IsRealTimeEnabled, Rules: collectionInfo.Rules}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func (s *Service) setsInit() error {\n\tlog.Println(\"Initing sets table\")\n\n\t_, err := s.connection.Exec(`\n\t\tCREATE TABLE IF NOT EXISTS sets (\n\t\t\tid text not null primary key,\n\t\t\tname text\n\t\t)\n\t`)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't create sets table\")\n\t}\n\n\t_, err = s.connection.Exec(\"CREATE UNIQUE INDEX IF NOT EXISTS name ON sets (name)\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't create index ON sets (name)\")\n\t}\n\n\treturn nil\n}", "func (p *k8sUpdate) CreateRules() ([]string, error) {\n\t// Build URL list\n\tvar urls []string\n\tfor _, svc := range p.services {\n\t\tann, ok := svc.Annotations[metricsAnnotation]\n\t\tif !ok || ann == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar metricsRecords []api.MetricsServiceRecord\n\t\tif err := json.Unmarshal([]byte(ann), &metricsRecords); err != nil {\n\t\t\tp.log.Errorf(\"Failed to unmarshal metrics annotation in service '%s.%s': %#v\", svc.Namespace, svc.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get service IP\n\t\tif svc.Spec.Type != k8s.ServiceTypeClusterIP {\n\t\t\tp.log.Errorf(\"Cannot put metrics rules in services of type other than ClusterIP ('%s.%s')\", svc.Namespace, svc.Name)\n\t\t\tcontinue\n\t\t}\n\t\tclusterIP := svc.Spec.ClusterIP\n\n\t\t// Collect URLs\n\t\tfor _, m := range metricsRecords {\n\t\t\tif m.RulesPath == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tu := url.URL{\n\t\t\t\tScheme: \"http\",\n\t\t\t\tHost: net.JoinHostPort(clusterIP, strconv.Itoa(m.ServicePort)),\n\t\t\t\tPath: m.RulesPath,\n\t\t\t}\n\t\t\turls = append(urls, u.String())\n\t\t}\n\t}\n\n\tif len(urls) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Fetch rules from URLs\n\trulesChan := make(chan string, len(urls))\n\twg := sync.WaitGroup{}\n\tfor _, url := range urls {\n\t\twg.Add(1)\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\tp.log.Debugf(\"fetching rules from %s\", url)\n\t\t\tresp, err := http.Get(url)\n\t\t\tif err != nil {\n\t\t\t\tp.log.Errorf(\"Failed to fetch rule from '%s': %#v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\t\t\tp.log.Errorf(\"Failed to fetch rule from '%s': Status %d\", url, resp.StatusCode)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\traw, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tp.log.Errorf(\"Failed to read rule from '%s': %#v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trulesChan <- string(raw)\n\t\t\tp.log.Debugf(\"done fetching rules from %s\", url)\n\t\t}(url)\n\t}\n\n\twg.Wait()\n\tclose(rulesChan)\n\tvar result []string\n\tfor rule := range rulesChan {\n\t\tresult = append(result, rule)\n\t}\n\tp.log.Debugf(\"Found %d rules\", len(result))\n\n\treturn result, nil\n}", "func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func (db *RethinkDBAdapter) SetupServicesTable() *CASServerError {\n\treturn db.setupTable(db.servicesTableName, db.servicesTableOptions)\n}", "func ConfigureStatefulSetForRollout(statefulSet *appsv1.StatefulSet) {\n\tstatefulSet.Spec.UpdateStrategy.Type = appsv1.RollingUpdateStatefulSetStrategyType\n\t//the canary rollout is for now directly started, the might move to a webhook instead\n\tstatefulSet.Spec.UpdateStrategy.RollingUpdate = &appsv1.RollingUpdateStatefulSetStrategy{\n\t\tPartition: pointers.Int32(util.MinInt32(*statefulSet.Spec.Replicas, statefulSet.Status.Replicas)),\n\t}\n\tstatefulSet.Annotations[AnnotationCanaryRollout] = rolloutStatePending\n\tstatefulSet.Annotations[AnnotationUpdateStartTime] = strconv.FormatInt(time.Now().Unix(), 10)\n}", "func RuleListHandler(w http.ResponseWriter, req *http.Request) {\n\trules := api.RuleList{}\n\n\tif err := clients[0].List(context.Background(), \"/rules\", &rules); err != nil {\n\t\tif kvstore.IsKeyNotFoundError(err) {\n\t\t\terrors.SendNotFound(w, \"NodeList\", \"\")\n\t\t\treturn\n\t\t}\n\t\terrors.SendInternalError(w, err)\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tbefore := time.Now()\n\tencoder.Encode(&rules)\n\tlog.Infof(\"Encode time %v\", time.Since(before))\n}", "func HandleGetAllTableNames(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tcollections, err := crud.GetCollections(ctx, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcols := make([]string, len(collections))\n\t\tfor i, value := range collections {\n\t\t\tcols[i] = value.TableName\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: cols})\n\t}\n}", "func (m *WorkbookWorksheet) SetTables(value []WorkbookTableable)() {\n m.tables = value\n}", "func (sys *IAMSys) policyDBSet(objectAPI ObjectLayer, name, policy string, isSTS bool) error {\n\tif name == \"\" || policy == \"\" {\n\t\treturn errInvalidArgument\n\t}\n\n\tif _, ok := sys.iamUsersMap[name]; !ok {\n\t\treturn errNoSuchUser\n\t}\n\n\t_, ok := sys.iamPolicyDocsMap[policy]\n\tif !ok {\n\t\treturn errNoSuchPolicy\n\t}\n\n\tmp := newMappedPolicy(policy)\n\t_, ok = sys.iamUsersMap[name]\n\tif !ok {\n\t\treturn errNoSuchUser\n\t}\n\tvar err error\n\tmappingPath := getMappedPolicyPath(name, isSTS)\n\tif globalEtcdClient != nil {\n\t\terr = saveIAMConfigItemEtcd(context.Background(), mp, mappingPath)\n\t} else {\n\t\terr = saveIAMConfigItem(objectAPI, mp, mappingPath)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tsys.iamUserPolicyMap[name] = mp\n\treturn nil\n}", "func MakeHandler(svc Service, opts ...kithttp.ServerOption) http.Handler {\n\tr := mux.NewRouter()\n\tr.StrictSlash(true)\n\n\tr.Methods(\"GET\").Path(`/`).Name(\"ruleList\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tlistEndpoint(svc),\n\t\t\tdecodeListRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\topts...,\n\t\t),\n\t)\n\n\tr.Methods(\"GET\").Path(`/{id:[a-zA-Z0-9]+}`).Name(\"ruleGet\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tgetEndpoint(svc),\n\t\t\tdecodeGetRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/activate`).Name(\"ruleActivate\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tactivateEndpoint(svc),\n\t\t\tdecodeActivateRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/deactivate`).Name(\"ruleDeactivate\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tdeactivateEndpoint(svc),\n\t\t\tdecodeDeactivateRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/rollout`).Name(\"ruleUpdateRollout\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tupdateRolloutEndpoint(svc),\n\t\t\tdecodeUpdateRolloutRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\treturn r\n}", "func (m *Workbook) SetTables(value []WorkbookTableable)() {\n m.tables = value\n}", "func TestPolicyRules(t *testing.T) {\n\t// create policy\n\tcheckCreatePolicy(t, false, \"default\", \"policy1\")\n\n\t// verify policy on unknown tenant fails\n\tcheckCreatePolicy(t, true, \"tenant1\", \"policy1\")\n\n\t// add rules\n\tcheckCreateRule(t, false, \"default\", \"policy1\", \"1\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, false, \"default\", \"policy1\", \"2\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"\", \"deny\", 1, 0)\n\tcheckCreateRule(t, false, \"default\", \"policy1\", \"3\", \"out\", \"\", \"\", \"\", \"contiv\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, false, \"default\", \"policy1\", \"4\", \"in\", \"\", \"\", \"10.1.1.1/24\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, false, \"default\", \"policy1\", \"5\", \"out\", \"\", \"\", \"\", \"\", \"\", \"10.1.1.1/24\", \"tcp\", \"allow\", 1, 80)\n\n\t// verify duplicate rule id fails\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"1\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\n\t// verify unknown directions fail\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"both\", \"\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 0)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"xyz\", \"\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 0)\n\n\t// verify unknown protocol fails\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"xyz\", \"allow\", 1, 80)\n\n\t// verify unknown action fails\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"xyz\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"contiv\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"accept\", 1, 80)\n\n\t// verify rule on unknown tenant/policy fails\n\tcheckCreateRule(t, true, \"default\", \"policy2\", \"100\", \"in\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"allow\", 1, 0)\n\tcheckCreateRule(t, true, \"tenant\", \"policy1\", \"100\", \"in\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"allow\", 1, 0)\n\n\t// verify invalid to/from and direction combos fail\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"\", \"\", \"\", \"invalid\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"\", \"\", \"\", \"\", \"invalid\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"\", \"\", \"\", \"\", \"\", \"invalid\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"out\", \"invalid\", \"\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"out\", \"\", \"invalid\", \"\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"out\", \"\", \"\", \"invalid\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\n\t// verify cant specify both from/to network and from/to ip addresses\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"in\", \"contiv\", \"\", \"10.1.1.1/24\", \"\", \"\", \"\", \"tcp\", \"allow\", 1, 80)\n\tcheckCreateRule(t, true, \"default\", \"policy1\", \"100\", \"out\", \"\", \"\", \"\", \"contiv\", \"\", \"10.1.1.1/24\", \"tcp\", \"allow\", 1, 80)\n\n\t// checkCreateRule(t, true, tenant, policy, ruleID, dir, fnet, fepg, fip, tnet, tepg, tip, proto, prio, port)\n\n\t// delete rules\n\tcheckDeleteRule(t, false, \"default\", \"policy1\", \"1\")\n\tcheckDeleteRule(t, false, \"default\", \"policy1\", \"2\")\n\tcheckDeleteRule(t, false, \"default\", \"policy1\", \"3\")\n\tcheckDeleteRule(t, false, \"default\", \"policy1\", \"4\")\n\tcheckDeleteRule(t, false, \"default\", \"policy1\", \"5\")\n\n\t// verify cant delete a rule and policy that doesnt exist\n\tcheckDeleteRule(t, true, \"default\", \"policy1\", \"100\")\n\tcheckDeletePolicy(t, true, \"default\", \"policy2\")\n\n\t// delete policy\n\tcheckDeletePolicy(t, false, \"default\", \"policy1\")\n}", "func resourceKeboolaAWSRedShiftWriterTablesUpdate(d *schema.ResourceData, meta interface{}) error {\n\tlog.Println(\"[INFO] Updating AWS RedShift table in Keboola.\")\n\n\ttables := d.Get(\"table\").(*schema.Set).List()\n\n\tmappedTables := make([]AWSRedShiftWriterTable, 0, len(tables))\n\tstorageTables := make([]AWSRedShiftWriterStorageTable, 0, len(tables))\n\n\tfor _, table := range tables {\n\t\tconfig := table.(map[string]interface{})\n\n\t\tmappedTable := AWSRedShiftWriterTable{\n\t\t\tDatabaseName: config[\"db_name\"].(string),\n\t\t\tExport: config[\"export\"].(bool),\n\t\t\tTableID: config[\"table_id\"].(string),\n\t\t\tIncremental: config[\"incremental\"].(bool),\n\t\t}\n\t\tif q := config[\"primary_key\"]; q != nil {\n\t\t\tmappedTable.PrimaryKey = AsStringArray(q.([]interface{}))\n\t\t}\n\n\t\tstorageTable := AWSRedShiftWriterStorageTable{\n\t\t\tSource: mappedTable.TableID,\n\t\t\tDestination: fmt.Sprintf(\"%s.csv\", mappedTable.TableID),\n\t\t}\n\t\tif val, ok := config[\"changed_since\"]; ok {\n\t\t\tstorageTable.ChangedSince = val.(string)\n\t\t}\n\t\tif val, ok := config[\"where_column\"]; ok {\n\t\t\tstorageTable.WhereColumn = val.(string)\n\t\t}\n\n\t\tif val, ok := config[\"where_operator\"]; ok {\n\t\t\tstorageTable.WhereOperator = val.(string)\n\t\t}\n\n\t\tif q := config[\"where_values\"]; q != nil {\n\t\t\tstorageTable.WhereValues = AsStringArray(q.([]interface{}))\n\t\t}\n\n\t\titemConfigs := config[\"column\"].([]interface{})\n\t\tmappedColumns := make([]AWSRedShiftWriterTableItem, 0, len(itemConfigs))\n\t\tcolumnNames := make([]string, 0, len(itemConfigs))\n\t\tfor _, item := range itemConfigs {\n\t\t\tcolumnConfig := item.(map[string]interface{})\n\n\t\t\tmappedColumn := AWSRedShiftWriterTableItem{\n\t\t\t\tName: columnConfig[\"name\"].(string),\n\t\t\t\tDatabaseName: columnConfig[\"db_name\"].(string),\n\t\t\t\tType: columnConfig[\"type\"].(string),\n\t\t\t\tSize: columnConfig[\"size\"].(string),\n\t\t\t\tIsNullable: columnConfig[\"nullable\"].(bool),\n\t\t\t\tDefaultValue: columnConfig[\"default\"].(string),\n\t\t\t}\n\n\t\t\tmappedColumns = append(mappedColumns, mappedColumn)\n\t\t\tcolumnNames = append(columnNames, mappedColumn.Name)\n\n\t\t}\n\n\t\tmappedTable.Items = mappedColumns\n\t\tstorageTable.Columns = columnNames\n\n\t\tmappedTables = append(mappedTables, mappedTable)\n\t\tstorageTables = append(storageTables, storageTable)\n\t}\n\n\tclient := meta.(*KBCClient)\n\n\tgetWriterResponse, err := client.GetFromStorage(fmt.Sprintf(\"storage/components/keboola.wr-redshift-v2/configs/%s\", d.Id()))\n\n\tif hasErrors(err, getWriterResponse) {\n\t\treturn extractError(err, getWriterResponse)\n\t}\n\n\tvar awsredshiftWriter AWSRedShiftWriter\n\n\tdecoder := json.NewDecoder(getWriterResponse.Body)\n\terr = decoder.Decode(&awsredshiftWriter)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tawsredshiftWriter.Configuration.Parameters.Tables = mappedTables\n\tawsredshiftWriter.Configuration.Storage.Input.Tables = storageTables\n\n\tawsredshiftConfigJSON, err := json.Marshal(awsredshiftWriter.Configuration)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdateAWSRedShiftForm := url.Values{}\n\tupdateAWSRedShiftForm.Add(\"configuration\", string(awsredshiftConfigJSON))\n\tupdateAWSRedShiftForm.Add(\"changeDescription\", \"Update RedShift tables\")\n\n\tupdateAWSRedShiftBuffer := buffer.FromForm(updateAWSRedShiftForm)\n\n\tupdateResponse, err := client.PutToStorage(fmt.Sprintf(\"storage/components/keboola.wr-redshift-v2/configs/%s\", d.Id()), updateAWSRedShiftBuffer)\n\n\tif hasErrors(err, updateResponse) {\n\t\treturn extractError(err, updateResponse)\n\t}\n\n\treturn resourceKeboolaAWSRedShiftTablesRead(d, meta)\n}", "func (api *APIServer) httpTablesHandler(w http.ResponseWriter, r *http.Request) {\n\ttables, err := getTables(api.config)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"tables\", err)\n\t\treturn\n\t}\n\tsendResponse(w, http.StatusOK, tables)\n}", "func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tcrud := modules.DB()\n\t\tif err := crud.DeleteTable(ctx, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (m *MysqlProxy) InitMysqlTable() {\n if len(m.TableIds) == 0 { return }\n\n // 分析数据,并恢复至MysqlProxy结构体中.\n tables := []*schema.MysqlTable{}\n\n for _, tid := range m.TableIds {\n tbs, err := redis.ReadDB(\"MysqlTable\", tid)\n CheckError(err)\n if len(tbs) != 1 { panic(\"no found relation table for id: \" + tid) }\n tb := tbs[0][tid].(map[string]interface {})\n// panic(fmt.Sprintf(\"%#v\", tbs))\n shardTbIds := []string{}\n if std, isOk := tb[\"ShardIds\"].([]interface{}); isOk && len(std) > 0 {\n shardTbIds = redis.RestorePrimaryId(std)\n }\n\n shardTb := []*schema.MysqlShardTable{}\n\n table := &schema.MysqlTable{\n Id: tb[\"Id\"].(string),\n Name: tb[\"Name\"].(string),\n CurGId: uint64(tb[\"CurGId\"].(float64)),\n RowTotal: uint64(tb[\"RowTotal\"].(float64)),\n ShardIds: shardTbIds,\n Created: int64(tb[\"Created\"].(float64)),\n Shards: shardTb,\n }\n\n if len(shardTbIds) > 0 {\n // create new shard table\n shardTb, err = m.GetShardTableByIds(shardTbIds)\n CheckError(err)\n table.Shards = shardTb\n\n err = table.RestoreColumnsByDB()\n CheckError(err)\n }\n\n // fmt.Printf(\"Init table `%s` done\\n\", table.Name)\n tables = append(tables, table)\n }\n\n m.Tables = tables\n schema.Tables = m.Tables\n}", "func (i *iptables) GenerateRules(config *types.ClusterConfig) (map[string]*RuleSet, error) {\n\tout := map[string]*RuleSet{\n\t\t\"PREROUTING\": &RuleSet{\n\t\t\tChainRule: \":PREROUTING ACCEPT\",\n\t\t\tRules: []string{\n\t\t\t\t\"-A PREROUTING -j \" + i.chain.String(),\n\t\t\t},\n\t\t},\n\t\ti.masqChain.String(): &RuleSet{\n\t\t\tChainRule: fmt.Sprintf(\":%s - [0:0]\", i.masqChain.String()),\n\t\t\tRules: []string{\n\t\t\t\ti.generateMasqRule(),\n\t\t\t},\n\t\t},\n\t\ti.chain.String(): &RuleSet{\n\t\t\tChainRule: \":\" + i.chain.String() + \" - [0:0]\",\n\t\t},\n\t}\n\n\t// format strings for masq and jump rules\n\tmasqFmt := fmt.Sprintf(`-A %s -d %%s/32 -p %%s -m %%s --dport %%s -m comment --comment \"%%s\" -j %s`, i.chain, i.masqChain)\n\tjumpFmt := fmt.Sprintf(`-A %s -d %%s/32 -p %%s -m %%s --dport %%s -m comment --comment \"%%s\" -j %%s`, i.chain)\n\n\t// walk the service configuration and apply all rules\n\trules := []string{}\n\tfor serviceIP, services := range config.Config {\n\t\tdest := string(serviceIP)\n\t\tfor dport, service := range services {\n\t\t\tprotocols := getServiceProtocols(service.TCPEnabled, service.UDPEnabled)\n\t\t\tident := types.MakeIdent(service.Namespace, service.Service, service.PortName)\n\t\t\tfor _, prot := range protocols {\n\t\t\t\tchain := servicePortChainName(ident, prot)\n\n\t\t\t\trules = append(rules, fmt.Sprintf(masqFmt, dest, prot, prot, dport, ident))\n\t\t\t\trules = append(rules, fmt.Sprintf(jumpFmt, dest, prot, prot, dport, ident, chain))\n\t\t\t}\n\t\t}\n\t}\n\n\t// sort and add to output\n\t// sort.Sort(sort.StringSlice(rules))\n\tout[i.chain.String()].Rules = rules\n\n\treturn out, nil\n}", "func Generate(conf config.Config, tableName string) (err error) {\n\n\terr = yaml.ReadTables(conf)\n\tif util.ErrorCheck(err) {\n\t\treturn fmt.Errorf(\"Generate failed. Unable to read YAML Tables\")\n\t}\n\n\t// Filter by tableName in the YAML Schema\n\tif tableName != \"*\" {\n\t\ttgtTbl := []table.Table{}\n\n\t\tfor _, tbl := range yaml.Schema {\n\t\t\tif tbl.Name == tableName {\n\t\t\t\ttgtTbl = append(tgtTbl, tbl)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Reduce the YAML schema to the single target table\n\t\tyaml.Schema = tgtTbl\n\t}\n\n\tif len(yaml.Schema) == 0 {\n\t\treturn fmt.Errorf(\"Generate: YAML Table not found: %s\", tableName)\n\t}\n\n\treturn writeTables(conf, yaml.Schema)\n}", "func (self *PolicyAgent) InitTables(nextTblId uint8) error {\n\tsw := self.ofSwitch\n\n\tnextTbl := sw.GetTable(nextTblId)\n\tif nextTbl == nil {\n\t\tlog.Fatalf(\"Error getting table id: %d\", nextTblId)\n\t}\n\n\tself.nextTable = nextTbl\n\n\t// Create all tables\n\tself.dstGrpTable, _ = sw.NewTable(DST_GRP_TBL_ID)\n\tself.policyTable, _ = sw.NewTable(POLICY_TBL_ID)\n\n\t// Packets that miss dest group lookup still go to policy table\n\tvalidPktFlow, _ := self.dstGrpTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: FLOW_MISS_PRIORITY,\n\t})\n\tvalidPktFlow.Next(self.policyTable)\n\n\t// Packets that didnt match any rule go to next table\n\tvlanMissFlow, _ := self.policyTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: FLOW_MISS_PRIORITY,\n\t})\n\tvlanMissFlow.Next(nextTbl)\n\n\treturn nil\n}", "func (fw *IPtables) makeRules(netif FirewallEndpoint) error {\n\tlog.Infof(\"In makeRules() with %s\", netif.GetName())\n\n\tvar err error\n\tfw.u32filter, fw.chainPrefix, err = fw.prepareU32Rules(netif.GetIP())\n\tif err != nil {\n\t\t// TODO need personalized error here, or even panic\n\t\treturn err\n\t}\n\tfw.interfaceName = netif.GetName()\n\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"INPUT\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-INPUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"OUTPUT\",\n\t\tDirections: []string{\"o\"},\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-FORWARD-OUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"o\"},\n\t\t// Using ROMANA-FORWARD-IN second time to capture both\n\t\t// traffic from host to endpoint and\n\t\t// traffic from endpoint to another endpoint.\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\n\tlog.Infof(\"In makeRules() created chains %v\", fw.chains)\n\treturn nil\n}", "func (r *Refresher) ensureAllTables(\n\tctx context.Context, settings *settings.Values, initialTableCollectionDelay time.Duration,\n) {\n\tif !AutomaticStatisticsClusterMode.Get(settings) {\n\t\t// Automatic stats are disabled.\n\t\treturn\n\t}\n\n\t// Use a historical read so as to disable txn contention resolution.\n\tgetAllTablesQuery := fmt.Sprintf(\n\t\t`\nSELECT table_id FROM crdb_internal.tables AS OF SYSTEM TIME '-%s'\nWHERE database_name IS NOT NULL\nAND drop_time IS NULL\n`,\n\t\tinitialTableCollectionDelay)\n\n\tit, err := r.ex.QueryIterator(\n\t\tctx,\n\t\t\"get-tables\",\n\t\tnil, /* txn */\n\t\tgetAllTablesQuery,\n\t)\n\tif err == nil {\n\t\tvar ok bool\n\t\tfor ok, err = it.Next(ctx); ok; ok, err = it.Next(ctx) {\n\t\t\trow := it.Cur()\n\t\t\ttableID := descpb.ID(*row[0].(*tree.DInt))\n\t\t\t// Don't create statistics for system tables or virtual tables.\n\t\t\t// TODO(rytaft): Don't add views here either. Unfortunately views are not\n\t\t\t// identified differently from tables in crdb_internal.tables.\n\t\t\tif !descpb.IsReservedID(tableID) && !descpb.IsVirtualTable(tableID) {\n\t\t\t\tr.mutationCounts[tableID] += 0\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\t// Note that it is ok if the iterator returned partial results before\n\t\t// encountering an error - in that case we added entries to\n\t\t// r.mutationCounts for some of the tables and operation of adding an\n\t\t// entry is idempotent (i.e. we didn't mess up anything for the next\n\t\t// call to this method).\n\t\tlog.Errorf(ctx, \"failed to get tables for automatic stats: %v\", err)\n\t\treturn\n\t}\n}", "func (m *DeviceAndAppManagementAssignmentFilter) SetRule(value *string)() {\n err := m.GetBackingStore().Set(\"rule\", value)\n if err != nil {\n panic(err)\n }\n}", "func (qri *QueryRuleInfo) SetRules(ruleSource string, newRules *QueryRules) error {\n\tif newRules == nil {\n\t\tnewRules = NewQueryRules()\n\t}\n\tqri.mu.Lock()\n\tdefer qri.mu.Unlock()\n\tif _, ok := qri.queryRulesMap[ruleSource]; ok {\n\t\tqri.queryRulesMap[ruleSource] = newRules.Copy()\n\t\treturn nil\n\t}\n\treturn errors.New(\"Rule source identifier \" + ruleSource + \" is not valid\")\n}", "func (b *Binary) SetTableName(tableName string) {\n\tecosystem, _ := converter.ParseName(tableName)\n\tb.ecosystem = ecosystem\n}", "func NewHandler(ctx context.Context, rsService store.RulesetService, cfg Config) http.Handler {\n\ts := service{\n\t\trulesets: rsService,\n\t}\n\n\tvar logger zerolog.Logger\n\n\tif cfg.Logger != nil {\n\t\tlogger = *cfg.Logger\n\t} else {\n\t\tlogger = zerolog.New(os.Stderr).With().Timestamp().Logger()\n\t}\n\n\tif cfg.Timeout == 0 {\n\t\tcfg.Timeout = 5 * time.Second\n\t}\n\n\tif cfg.WatchTimeout == 0 {\n\t\tcfg.WatchTimeout = 30 * time.Second\n\t}\n\n\trs := rulesetService{\n\t\tservice: &s,\n\t\ttimeout: cfg.Timeout,\n\t\twatchTimeout: cfg.WatchTimeout,\n\t}\n\n\t// router\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/rulesets/\", &rs)\n\n\t// middlewares\n\tchain := []func(http.Handler) http.Handler{\n\t\thlog.NewHandler(logger),\n\t\thlog.AccessHandler(func(r *http.Request, status, size int, duration time.Duration) {\n\t\t\thlog.FromRequest(r).Info().\n\t\t\t\tStr(\"method\", r.Method).\n\t\t\t\tStr(\"url\", r.URL.String()).\n\t\t\t\tInt(\"status\", status).\n\t\t\t\tInt(\"size\", size).\n\t\t\t\tDur(\"duration\", duration).\n\t\t\t\tMsg(\"request received\")\n\t\t}),\n\t\thlog.RemoteAddrHandler(\"ip\"),\n\t\thlog.UserAgentHandler(\"user_agent\"),\n\t\thlog.RefererHandler(\"referer\"),\n\t\tfunc(http.Handler) http.Handler {\n\t\t\treturn mux\n\t\t},\n\t}\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// playing the middleware chain\n\t\tvar cur http.Handler\n\t\tfor i := len(chain) - 1; i >= 0; i-- {\n\t\t\tcur = chain[i](cur)\n\t\t}\n\n\t\t// serving the request\n\t\tcur.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func InitTableMap() {\n\t/*\n\t db.BaseDBMap.AddTableWithName(Activity{}, \"activity\").SetKeys(false,\"Id\")\n\t db.BaseDBMap.AddTableWithName(BackendGoods{}, \"backend_goods\").SetKeys(false,\"GoodsId\")\n\t db.BaseDBMap.AddTableWithName(ConGoods{}, \"con_goods\").SetKeys(false,\"GoodsId\")\n\t db.BaseDBMap.AddTableWithName(FreeLimit{}, \"free_limit\").SetKeys(false,\"FreeName\")\n\t db.BaseDBMap.AddTableWithName(GameServiceOption{}, \"game_service_option\").SetKeys(false,\"KindID\",\"ServerID\")\n\t db.BaseDBMap.AddTableWithName(GameTestpai{}, \"game_testpai\").SetKeys(true, \"Id\")\n\t db.BaseDBMap.AddTableWithName(GlobalVar{}, \"global_var\").SetKeys(false,\"K\")\n\t db.BaseDBMap.AddTableWithName(Goods{}, \"goods\").SetKeys(false,\"GoodsId\")\n\t db.BaseDBMap.AddTableWithName(IncAgentNum{}, \"inc_agent_num\").SetKeys(false,\"NodeId\")\n\t db.BaseDBMap.AddTableWithName(PersonalTableFee{}, \"personal_table_fee\").SetKeys(false,\"KindID\",\"ServerID\",\"DrawCountLimit\")\n\t db.BaseDBMap.AddTableWithName(PersonalTableFeeBak728{}, \"personal_table_fee_bak_7_28\").SetKeys(false,\"KindID\",\"ServerID\",\"DrawCountLimit\")\n\t db.BaseDBMap.AddTableWithName(RefreshInTime{}, \"refresh_in_time\").SetKeys(false,\"Id\")\n\t db.BaseDBMap.AddTableWithName(Upgrade{}, \"upgrade\").SetKeys(false,\"UpId\")\n\t db.BaseDBMap.AddTableWithName(UpgradeAdvisor{}, \"upgrade_advisor\").SetKeys(false,\"AdvisorId\")\n\t*/\n}", "func configureRoutes(service Service, db *gorm.DB, enableAuth bool, tokenURL string) *Routes {\n\tengine := gin.New()\n\tengine.Use(gin.Recovery())\n\tengine.Use(middleware.LogrusLogger())\n\tif db != nil {\n\t\tengine.Use(middleware.DatabaseContext(db))\n\t}\n\troutes := &Routes{Engine: engine}\n\n\troutes.AddDataSourceUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddDataSourceUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\tif enableAuth {\n\t\trouteTokenURL := tokenURL\n\t\tif routeTokenURL == \"\" {\n\t\t\trouteTokenURL = \"http://info.services.auth.localhost/oauth2/tokeninfo\"\n\t\t}\n\t\troutes.AddDataSourceUsingPOST.Auth = ginoauth2.Auth(\n\t\t\tmiddleware.ScopesAuth(\"uid\"),\n\t\t\toauth2.Endpoint{\n\t\t\t\tTokenURL: routeTokenURL,\n\t\t\t},\n\t\t)\n\t\troutes.AddDataSourceUsingPOST.RouterGroup.Use(routes.AddDataSourceUsingPOST.Auth)\n\t}\n\troutes.AddDataSourceUsingPOST.Post = routes.AddDataSourceUsingPOST.Group(\"\")\n\troutes.AddDataSourceUsingPOST.Post.POST(ginizePath(\"/datasource/_datasource\"), data_source_controller.BusinessLogicAddDataSourceUsingPOST(service.AddDataSourceUsingPOST))\n\n\troutes.AddEntityUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddEntityUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\n\troutes.AddEntityUsingPOST.Post = routes.AddEntityUsingPOST.Group(\"\")\n\troutes.AddEntityUsingPOST.Post.POST(ginizePath(\"/schemas/_entitys\"), schema_controller.BusinessLogicAddEntityUsingPOST(service.AddEntityUsingPOST))\n\n\troutes.AddFieldUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddFieldUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.AddFieldUsingPOST.Post = routes.AddFieldUsingPOST.Group(\"\")\n\troutes.AddFieldUsingPOST.Post.POST(ginizePath(\"/schemas/_fields\"), schema_controller.BusinessLogicAddFieldUsingPOST(service.AddFieldUsingPOST))\n\n\troutes.AddPermissionUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddPermissionUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.AddPermissionUsingPOST.Post = routes.AddPermissionUsingPOST.Group(\"\")\n\troutes.AddPermissionUsingPOST.Post.POST(ginizePath(\"/permission/_permission\"), permission_controller.BusinessLogicAddPermissionUsingPOST(service.AddPermissionUsingPOST))\n\n\troutes.AddRoleUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddRoleUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.AddRoleUsingPOST.Post = routes.AddRoleUsingPOST.Group(\"\")\n\troutes.AddRoleUsingPOST.Post.POST(ginizePath(\"/role/_roles\"), role_controller.BusinessLogicAddRoleUsingPOST(service.AddRoleUsingPOST))\n\n\troutes.AddUserUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.AddUserUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.AddUserUsingPOST.Post = routes.AddUserUsingPOST.Group(\"\")\n\troutes.AddUserUsingPOST.Post.POST(ginizePath(\"/user/_users\"), user_controller.BusinessLogicAddUserUsingPOST(service.AddUserUsingPOST))\n\n\troutes.ApplyUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.ApplyUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.ApplyUsingPOST.Post = routes.ApplyUsingPOST.Group(\"\")\n\troutes.ApplyUsingPOST.Post.POST(ginizePath(\"/apply\"), apply_controller.BusinessLogicApplyUsingPOST(service.ApplyUsingPOST))\n\n\troutes.CreateAuthenticationTokenUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.CreateAuthenticationTokenUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.CreateAuthenticationTokenUsingPOST.Post = routes.CreateAuthenticationTokenUsingPOST.Group(\"\")\n\troutes.CreateAuthenticationTokenUsingPOST.Post.POST(ginizePath(\"/auth\"), authentication_rest_controller.BusinessLogicCreateAuthenticationTokenUsingPOST(service.CreateAuthenticationTokenUsingPOST))\n\n\troutes.DataMutationUsingDELETE.RouterGroup = routes.Group(\"\")\n\troutes.DataMutationUsingDELETE.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.DataMutationUsingDELETE.Post = routes.DataMutationUsingDELETE.Group(\"\")\n\troutes.DataMutationUsingDELETE.Post.DELETE(ginizePath(\"/api/{entity}/{id}\"), data_controller.BusinessLogicDataMutationUsingDELETE(service.DataMutationUsingDELETE))\n\n\troutes.DataMutationUsingPOST.RouterGroup = routes.Group(\"\")\n\troutes.DataMutationUsingPOST.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.DataMutationUsingPOST.Post = routes.DataMutationUsingPOST.Group(\"\")\n\troutes.DataMutationUsingPOST.Post.POST(ginizePath(\"/api/{entity}\"), data_controller.BusinessLogicDataMutationUsingPOST(service.DataMutationUsingPOST))\n\n\troutes.DataMutationUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.DataMutationUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.DataMutationUsingPUT.Post = routes.DataMutationUsingPUT.Group(\"\")\n\troutes.DataMutationUsingPUT.Post.PUT(ginizePath(\"/api/{entity}/{id}\"), data_controller.BusinessLogicDataMutationUsingPUT(service.DataMutationUsingPUT))\n\n\troutes.DataQueryUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.DataQueryUsingGET.Post = routes.DataQueryUsingGET.Group(\"\")\n\troutes.DataQueryUsingGET.Post.GET(ginizePath(\"/api/{entity}\"), data_controller.BusinessLogicDataQueryUsingGET(service.DataQueryUsingGET))\n\n\troutes.EditDataSourceUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.EditDataSourceUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditDataSourceUsingPUT.Post = routes.EditDataSourceUsingPUT.Group(\"\")\n\troutes.EditDataSourceUsingPUT.Post.PUT(ginizePath(\"/datasource/_datasource/put/{id}\"), data_source_controller.BusinessLogicEditDataSourceUsingPUT(service.EditDataSourceUsingPUT))\n\n\troutes.EditEntityUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.EditEntityUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditEntityUsingPUT.Post = routes.EditEntityUsingPUT.Group(\"\")\n\troutes.EditEntityUsingPUT.Post.PUT(ginizePath(\"/schemas/_entitys/put/{id}\"), schema_controller.BusinessLogicEditEntityUsingPUT(service.EditEntityUsingPUT))\n\n\troutes.EditFieldUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.EditFieldUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditFieldUsingPUT.Post = routes.EditFieldUsingPUT.Group(\"\")\n\troutes.EditFieldUsingPUT.Post.PUT(ginizePath(\"/schemas/_fields/put/{id}\"), schema_controller.BusinessLogicEditFieldUsingPUT(service.EditFieldUsingPUT))\n\n\troutes.EditFieldUsingPUT1.RouterGroup = routes.Group(\"\")\n\troutes.EditFieldUsingPUT1.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditFieldUsingPUT1.Post = routes.EditFieldUsingPUT1.Group(\"\")\n\troutes.EditFieldUsingPUT1.Post.PUT(ginizePath(\"/user/_users/put/{id}\"), user_controller.BusinessLogicEditFieldUsingPUT1(service.EditFieldUsingPUT1))\n\n\troutes.EditPermissionUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.EditPermissionUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditPermissionUsingPUT.Post = routes.EditPermissionUsingPUT.Group(\"\")\n\troutes.EditPermissionUsingPUT.Post.PUT(ginizePath(\"/permission/_permission/{id}\"), permission_controller.BusinessLogicEditPermissionUsingPUT(service.EditPermissionUsingPUT))\n\n\troutes.EditRoleUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.EditRoleUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.EditRoleUsingPUT.Post = routes.EditRoleUsingPUT.Group(\"\")\n\troutes.EditRoleUsingPUT.Post.PUT(ginizePath(\"/role/_roles/put/{id}\"), role_controller.BusinessLogicEditRoleUsingPUT(service.EditRoleUsingPUT))\n\n\troutes.FindAllFieldsUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindAllFieldsUsingGET.Post = routes.FindAllFieldsUsingGET.Group(\"\")\n\troutes.FindAllFieldsUsingGET.Post.GET(ginizePath(\"/schemas/_fields\"), schema_controller.BusinessLogicFindAllFieldsUsingGET(service.FindAllFieldsUsingGET))\n\n\troutes.FindEntityFieldsUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindEntityFieldsUsingGET.Post = routes.FindEntityFieldsUsingGET.Group(\"\")\n\troutes.FindEntityFieldsUsingGET.Post.GET(ginizePath(\"/schemas/fields\"), schema_controller.BusinessLogicFindEntityFieldsUsingGET(service.FindEntityFieldsUsingGET))\n\n\troutes.FindOneFieldUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindOneFieldUsingGET.Post = routes.FindOneFieldUsingGET.Group(\"\")\n\troutes.FindOneFieldUsingGET.Post.GET(ginizePath(\"/schemas/_fields/{fid}\"), schema_controller.BusinessLogicFindOneFieldUsingGET(service.FindOneFieldUsingGET))\n\n\troutes.FindOneUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindOneUsingGET.Post = routes.FindOneUsingGET.Group(\"\")\n\troutes.FindOneUsingGET.Post.GET(ginizePath(\"/api/{entity}/{id}\"), data_controller.BusinessLogicFindOneUsingGET(service.FindOneUsingGET))\n\n\troutes.FindOneUsingGET1.RouterGroup = routes.Group(\"\")\n\troutes.FindOneUsingGET1.Post = routes.FindOneUsingGET1.Group(\"\")\n\troutes.FindOneUsingGET1.Post.GET(ginizePath(\"/schemas/_entitys/{eid}\"), schema_controller.BusinessLogicFindOneUsingGET1(service.FindOneUsingGET1))\n\n\troutes.FindRoleUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindRoleUsingGET.Post = routes.FindRoleUsingGET.Group(\"\")\n\troutes.FindRoleUsingGET.Post.GET(ginizePath(\"/datasource/_datasource/{datasourceId}\"), data_source_controller.BusinessLogicFindRoleUsingGET(service.FindRoleUsingGET))\n\n\troutes.FindRoleUsingGET1.RouterGroup = routes.Group(\"\")\n\troutes.FindRoleUsingGET1.Post = routes.FindRoleUsingGET1.Group(\"\")\n\troutes.FindRoleUsingGET1.Post.GET(ginizePath(\"/role/_roles/{roleId}\"), role_controller.BusinessLogicFindRoleUsingGET1(service.FindRoleUsingGET1))\n\n\troutes.FindUserUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.FindUserUsingGET.Post = routes.FindUserUsingGET.Group(\"\")\n\troutes.FindUserUsingGET.Post.GET(ginizePath(\"/permission/_permission/{id}\"), permission_controller.BusinessLogicFindUserUsingGET(service.FindUserUsingGET))\n\n\troutes.FindUserUsingGET1.RouterGroup = routes.Group(\"\")\n\troutes.FindUserUsingGET1.Post = routes.FindUserUsingGET1.Group(\"\")\n\troutes.FindUserUsingGET1.Post.GET(ginizePath(\"/user/_users/{userId}\"), user_controller.BusinessLogicFindUserUsingGET1(service.FindUserUsingGET1))\n\n\troutes.GetAuthenticatedUserUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.GetAuthenticatedUserUsingGET.Post = routes.GetAuthenticatedUserUsingGET.Group(\"\")\n\troutes.GetAuthenticatedUserUsingGET.Post.GET(ginizePath(\"/user/me\"), user_controller.BusinessLogicGetAuthenticatedUserUsingGET(service.GetAuthenticatedUserUsingGET))\n\n\troutes.GetSchemasUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.GetSchemasUsingGET.Post = routes.GetSchemasUsingGET.Group(\"\")\n\troutes.GetSchemasUsingGET.Post.GET(ginizePath(\"/schemas/_entitys\"), schema_controller.BusinessLogicGetSchemasUsingGET(service.GetSchemasUsingGET))\n\n\troutes.ListUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.ListUsingGET.Post = routes.ListUsingGET.Group(\"\")\n\troutes.ListUsingGET.Post.GET(ginizePath(\"/datasource/_datasource\"), data_source_controller.BusinessLogicListUsingGET(service.ListUsingGET))\n\n\troutes.ListUsingGET1.RouterGroup = routes.Group(\"\")\n\troutes.ListUsingGET1.Post = routes.ListUsingGET1.Group(\"\")\n\troutes.ListUsingGET1.Post.GET(ginizePath(\"/permission/_permission\"), permission_controller.BusinessLogicListUsingGET1(service.ListUsingGET1))\n\n\troutes.ListUsingGET2.RouterGroup = routes.Group(\"\")\n\troutes.ListUsingGET2.Post = routes.ListUsingGET2.Group(\"\")\n\troutes.ListUsingGET2.Post.GET(ginizePath(\"/role/_roles\"), role_controller.BusinessLogicListUsingGET2(service.ListUsingGET2))\n\n\troutes.ListUsingGET3.RouterGroup = routes.Group(\"\")\n\troutes.ListUsingGET3.Post = routes.ListUsingGET3.Group(\"\")\n\troutes.ListUsingGET3.Post.GET(ginizePath(\"/user/_users\"), user_controller.BusinessLogicListUsingGET3(service.ListUsingGET3))\n\n\troutes.RefreshAndGetAuthenticationTokenUsingGET.RouterGroup = routes.Group(\"\")\n\troutes.RefreshAndGetAuthenticationTokenUsingGET.Post = routes.RefreshAndGetAuthenticationTokenUsingGET.Group(\"\")\n\troutes.RefreshAndGetAuthenticationTokenUsingGET.Post.GET(ginizePath(\"/refresh\"), authentication_rest_controller.BusinessLogicRefreshAndGetAuthenticationTokenUsingGET(service.RefreshAndGetAuthenticationTokenUsingGET))\n\n\troutes.ResetCurrentDsUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.ResetCurrentDsUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.ResetCurrentDsUsingPUT.Post = routes.ResetCurrentDsUsingPUT.Group(\"\")\n\troutes.ResetCurrentDsUsingPUT.Post.PUT(ginizePath(\"/schemas/resetCurrentDs/{dataSourceId}\"), schema_controller.BusinessLogicResetCurrentDsUsingPUT(service.ResetCurrentDsUsingPUT))\n\n\troutes.SyncSchemasUsingPUT.RouterGroup = routes.Group(\"\")\n\troutes.SyncSchemasUsingPUT.RouterGroup.Use(middleware.ContentTypes(\"application/json\"))\n\troutes.SyncSchemasUsingPUT.Post = routes.SyncSchemasUsingPUT.Group(\"\")\n\troutes.SyncSchemasUsingPUT.Post.PUT(ginizePath(\"/schemas/sync/{dataSourceId}\"), schema_controller.BusinessLogicSyncSchemasUsingPUT(service.SyncSchemasUsingPUT))\n\n\treturn routes\n}", "func (c Control) ServeRules(w http.ResponseWriter, r *http.Request) {\n\ttemplate := map[string]interface{}{}\n\n\t// Encode the rules as JSON and put them in the template.\n\tc.Config.RLock()\n\tencoded, _ := json.Marshal(c.Config.Rules)\n\tc.Config.RUnlock()\n\ttemplate[\"rules\"] = string(encoded)\n\n\tserveTemplate(w, r, \"rules\", template)\n}", "func (s *GroupSQLDao) SetGroupRules(delegatee SqlLike, groups ...Group) error {\n\tif delegatee == nil {\n\t\tdelegatee = s.conn\n\t}\n\trawsql := fmt.Sprintf(\n\t\t\"INSERT INTO `%s` (`%s`, `%s`) VALUES(?, ?)\",\n\t\ttblRelGrpRule,\n\t\tRRRGroupID,\n\t\tRRRRuleID,\n\t)\n\truleStmt, err := delegatee.Prepare(rawsql)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sql prepare failed, %v\", err)\n\t}\n\tdefer ruleStmt.Close()\n\tsilenceStmt, err := delegatee.Prepare(fmt.Sprintf(\n\t\t\"INSERT INTO `%s` (`%s`, `%s`) VALUES(?, ?)\",\n\t\ttblRelRGSilence,\n\t\tfldRGUUID,\n\t\tfldSilenceUUID,\n\t))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sql prepare failed, %v\", err)\n\t}\n\tdefer silenceStmt.Close()\n\tspeedStmt, err := delegatee.Prepare(fmt.Sprintf(\n\t\t\"INSERT INTO `%s` (`%s`, `%s`) VALUES(?, ?)\",\n\t\ttblRelRGSpeed,\n\t\tfldRGUUID,\n\t\tfldSpeedUUID,\n\t))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sql prepare failed, %v\", err)\n\t}\n\tdefer speedStmt.Close()\n\tinterposalStmt, err := delegatee.Prepare(fmt.Sprintf(\n\t\t\"INSERT INTO `%s` (`%s`, `%s`) VALUES(?, ?)\",\n\t\ttblRelRGInterposal,\n\t\tfldRGUUID,\n\t\tfldInterposalUUID,\n\t))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sql prepare failed, %v\", err)\n\t}\n\tdefer interposalStmt.Close()\n\n\tfor _, g := range groups {\n\t\tfor _, r := range g.Rules {\n\t\t\t_, err := ruleStmt.Exec(g.ID, r.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"insert rule relation failed, %v\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, sr := range g.SilenceRules {\n\t\t\t_, err := silenceStmt.Exec(g.UUID, sr.UUID)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"insert silence relation failed, %v\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, sr := range g.SpeedRules {\n\t\t\t_, err := speedStmt.Exec(g.UUID, sr.UUID)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"insert speed relation failed, %v\", err)\n\t\t\t}\n\t\t}\n\t\tfor _, ir := range g.InterposalRules {\n\t\t\t_, err := interposalStmt.Exec(g.UUID, ir.UUID)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"insert interposal relation failed, %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (kl *Kubelet) syncIPTablesRules(iptClient utiliptables.Interface) bool {\n\t// Create hint chain so other components can see whether we are using iptables-legacy\n\t// or iptables-nft.\n\tif _, err := iptClient.EnsureChain(utiliptables.TableMangle, KubeIPTablesHintChain); err != nil {\n\t\tklog.ErrorS(err, \"Failed to ensure that iptables hint chain exists\")\n\t\treturn false\n\t}\n\n\tif !iptClient.IsIPv6() { // ipv6 doesn't have this issue\n\t\t// Set up the KUBE-FIREWALL chain and martian packet protection rule.\n\t\t// (See below.)\n\n\t\t// NOTE: kube-proxy (in iptables mode) creates an identical copy of this\n\t\t// rule. If you want to change this rule in the future, you MUST do so in\n\t\t// a way that will interoperate correctly with skewed versions of the rule\n\t\t// created by kube-proxy.\n\n\t\tif _, err := iptClient.EnsureChain(utiliptables.TableFilter, KubeFirewallChain); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that filter table KUBE-FIREWALL chain exists\")\n\t\t\treturn false\n\t\t}\n\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainOutput, \"-j\", string(KubeFirewallChain)); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that OUTPUT chain jumps to KUBE-FIREWALL\")\n\t\t\treturn false\n\t\t}\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainInput, \"-j\", string(KubeFirewallChain)); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that INPUT chain jumps to KUBE-FIREWALL\")\n\t\t\treturn false\n\t\t}\n\n\t\t// Kube-proxy's use of `route_localnet` to enable NodePorts on localhost\n\t\t// creates a security hole (https://issue.k8s.io/90259) which this\n\t\t// iptables rule mitigates. This rule should have been added to\n\t\t// kube-proxy, but it mistakenly ended up in kubelet instead, and we are\n\t\t// keeping it in kubelet for now in case other third-party components\n\t\t// depend on it.\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Append, utiliptables.TableFilter, KubeFirewallChain,\n\t\t\t\"-m\", \"comment\", \"--comment\", \"block incoming localnet connections\",\n\t\t\t\"--dst\", \"127.0.0.0/8\",\n\t\t\t\"!\", \"--src\", \"127.0.0.0/8\",\n\t\t\t\"-m\", \"conntrack\",\n\t\t\t\"!\", \"--ctstate\", \"RELATED,ESTABLISHED,DNAT\",\n\t\t\t\"-j\", \"DROP\"); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure rule to drop invalid localhost packets in filter table KUBE-FIREWALL chain\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (fw *IPtables) CreateRules(chain int) error {\n\tlog.Info(\"In CreateRules() for chain\", chain)\n\tfor _, rule := range fw.chains[chain].Rules {\n\t\t// First create rule record in database.\n\t\terr0 := fw.addIPtablesRule(rule)\n\t\tif err0 != nil {\n\t\t\tlog.Error(\"In CreateRules() create db record for iptables rule \", rule.GetBody())\n\t\t\treturn err0\n\t\t}\n\n\t\terr1 := fw.EnsureRule(rule, EnsureFirst)\n\t\tif err1 != nil {\n\t\t\tlog.Error(\"In CreateRules() failed to create install firewall rule \", rule.GetBody())\n\t\t\treturn err1\n\t\t}\n\n\t\t// Finally, set 'active' flag in database record.\n\t\tif err2 := fw.Store.switchIPtablesRule(rule, setRuleActive); err2 != nil {\n\t\t\tlog.Error(\"In CreateRules() iptables rule created, but activation failed \", rule.GetBody())\n\t\t\treturn err2\n\t\t}\n\t}\n\tlog.Info(\"Creating firewall rules success\")\n\treturn nil\n}", "func (db *RethinkDBAdapter) SetupTicketsTable() *CASServerError {\n\treturn db.setupTable(db.ticketsTableName, db.ticketsTableOptions)\n}", "func ModelSetHandler(w http.ResponseWriter, r *http.Request) {\n body, err := ioutil.ReadAll(r.Body)\n\n // check validity of input\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n return\n }\n\n // load yaml model\n err = model.GetModel().Load2(string(body))\n\n // check success of import\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n return\n }\n}", "func (f5 *f5LTM) addRoute(policyname, routename, poolname, hostname,\n\tpathname string) error {\n\tsuccess := false\n\n\tpolicyResourceId := f5.iControlUriResourceId(policyname)\n\trulesUrl := fmt.Sprintf(\"https://%s/mgmt/tm/ltm/policy/%s/rules\",\n\t\tf5.host, policyResourceId)\n\n\trulesPayload := f5Rule{\n\t\tName: routename,\n\t}\n\n\terr := f5.post(rulesUrl, rulesPayload, nil)\n\tif err != nil {\n\t\tif err.(F5Error).httpStatusCode == HTTP_CONFLICT_CODE {\n\t\t\tglog.V(4).Infof(\"Warning: Rule %s already exists; continuing with\"+\n\t\t\t\t\" initialization in case the existing rule is only partially\"+\n\t\t\t\t\" initialized...\", routename)\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// If adding the condition or action to the rule fails later on,\n\t// delete the rule.\n\tdefer func() {\n\t\tif success != true {\n\t\t\terr := f5.deleteRoute(policyname, routename)\n\t\t\tif err != nil && err.(F5Error).httpStatusCode != 404 {\n\t\t\t\tglog.V(4).Infof(\"Warning: Creating rule %s failed,\"+\n\t\t\t\t\t\" and then cleanup got an error: %v\", routename, err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tconditionUrl := fmt.Sprintf(\"https://%s/mgmt/tm/ltm/policy/%s/rules/%s/conditions\",\n\t\tf5.host, policyResourceId, routename)\n\n\tconditionPayload := f5RuleCondition{\n\t\tName: \"0\",\n\t\tCaseInsensitive: true,\n\t\tHttpHost: true,\n\t\tHost: true,\n\t\tIndex: 0,\n\t\tEquals: true,\n\t\tRequest: true,\n\t\tValues: []string{hostname},\n\t}\n\n\terr = f5.post(conditionUrl, conditionPayload, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif pathname != \"\" {\n\t\t// Each segment of the pathname must be added to the rule as a separate\n\t\t// condition.\n\t\tsegments := strings.Split(pathname, \"/\")\n\t\tconditionPayload.HttpHost = false\n\t\tconditionPayload.Host = false\n\t\tconditionPayload.HttpUri = true\n\t\tconditionPayload.PathSegment = true\n\t\tfor i, segment := range segments[1:] {\n\t\t\tif segment == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tidx := fmt.Sprintf(\"%d\", i+1)\n\t\t\tconditionPayload.Name = idx\n\t\t\tconditionPayload.Index = i + 1\n\t\t\tconditionPayload.Values = []string{segment}\n\t\t\terr = f5.post(conditionUrl, conditionPayload, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tactionUrl := fmt.Sprintf(\"https://%s/mgmt/tm/ltm/policy/%s/rules/%s/actions\",\n\t\tf5.host, policyResourceId, routename)\n\n\tactionPayload := f5RuleAction{\n\t\tName: \"0\",\n\t\tForward: true,\n\t\tPool: fmt.Sprintf(\"%s/%s\", f5.partitionPath, poolname),\n\t\tRequest: true,\n\t\tSelect: true,\n\t\tVlan: 0,\n\t}\n\n\terr = f5.post(actionUrl, actionPayload, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsuccess = true\n\n\troutes, err := f5.getRoutes(policyname)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\troutes[routename] = true\n\n\treturn nil\n}", "func (c *awsSesReceiptRuleSets) Create(awsSesReceiptRuleSet *v1.AwsSesReceiptRuleSet) (result *v1.AwsSesReceiptRuleSet, err error) {\n\tresult = &v1.AwsSesReceiptRuleSet{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"awssesreceiptrulesets\").\n\t\tBody(awsSesReceiptRuleSet).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (g *MyGame) SetTable(tableRoundKey, tableVal string) {\n g.Tables = append(g.Tables, tableVal)\n}", "func ReadRuleset(path string) (rules map[string]map[string]string, err error) {\n data, err := os.Open(path)\n if err != nil {\n logs.Error(\"File reading error %s\", err.Error())\n }\n\n var validID = regexp.MustCompile(`sid:\\s?(\\d+);`)\n var msgfield = regexp.MustCompile(`msg:\\s?\\\"([^\"]+)\\\"`)\n var ipfield = regexp.MustCompile(`^([^\\(]+)\\(`)\n var enablefield = regexp.MustCompile(`^#`)\n\n scanner := bufio.NewScanner(data)\n rules = make(map[string]map[string]string)\n for scanner.Scan() {\n replaceFirst := strings.Replace(scanner.Text(), \"“\", \"\\\"\", -1)\n replaceSecond := strings.Replace(replaceFirst, \"”\", \"\\\"\", -1)\n if validID.MatchString(replaceSecond) {\n sid := validID.FindStringSubmatch(replaceSecond)\n if len(sid) == 0 {\n logs.Error(\"ReadRuleset error: SID not found \" + replaceSecond)\n continue\n }\n msg := msgfield.FindStringSubmatch(replaceSecond)\n if len(msg) == 0 {\n logs.Error(\"ReadRuleset error: MSG not found \" + replaceSecond)\n continue\n }\n ip := ipfield.FindStringSubmatch(replaceSecond)\n if len(ip) == 0 {\n logs.Error(\"ReadRuleset error: RULE header not found \" + replaceSecond)\n continue\n }\n\n rule := make(map[string]string)\n if enablefield.MatchString(replaceSecond) {\n rule[\"enabled\"] = \"Disabled\"\n } else {\n rule[\"enabled\"] = \"Enabled\"\n }\n rule[\"sid\"] = sid[1]\n rule[\"msg\"] = msg[1]\n rule[\"ip\"] = ip[1]\n rule[\"raw\"] = replaceSecond\n rules[sid[1]] = rule\n }\n\n }\n return rules, err\n}", "func listTables_GET_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_table_route.ListTablesHandler:cannot parse path.\" +\n\t\t\t\"try /list?ExclusiveStartTableName=$T&Limit=$L\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\tqueryMap := make(map[string]string)\n\tfor k, v := range req.URL.Query() {\n\t\tqueryMap[strings.ToLower(k)] = v[0]\n\t}\n\n\tq_estn, estn_exists := queryMap[strings.ToLower(list.EXCLUSIVE_START_TABLE_NAME)]\n\testn := \"\"\n\tif estn_exists {\n\t\testn = q_estn\n\t}\n\tq_limit, limit_exists := queryMap[strings.ToLower(list.LIMIT)]\n\tlimit := uint64(0)\n\tif limit_exists {\n\t\tlimit_conv, conv_err := strconv.ParseUint(q_limit, 10, 64)\n\t\tif conv_err != nil {\n\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler bad limit %s\", q_limit)\n\t\t\tlog.Printf(e)\n\t\t} else {\n\t\t\tlimit = limit_conv\n\t\t\tif limit > DEFAULT_LIMIT {\n\t\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler: high limit %d\", limit_conv)\n\t\t\t\tlog.Printf(e)\n\t\t\t\tlimit = DEFAULT_LIMIT\n\t\t\t}\n\t\t}\n\t}\n\n\tl := list.List{\n\t\tLimit: limit,\n\t\tExclusiveStartTableName: estn}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_GET_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_GET_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.listTable_GET_Handler %s\", mr_err.Error())\n\t\tlog.Printf(e)\n\t}\n}", "func UpdateRules(newRules []C.Rule) {\n\tconfigMux.Lock()\n\trules = newRules\n\tconfigMux.Unlock()\n}", "func (se *StorageEndpoint) LoadRules(f func(k, v string)) error {\n\treturn se.loadRangeByPrefix(rulesPath+\"/\", f)\n}", "func resourceKeboolaAWSRedShiftWriterTablesCreate(d *schema.ResourceData, meta interface{}) error {\n\tlog.Println(\"[INFO] Creating AWS RedShift Tables in Keboola\")\n\n\tclient := meta.(*KBCClient)\n\n\twriterID := d.Get(\"writer_id\").(string)\n\ttables := d.Get(\"table\").(*schema.Set).List()\n\n\tmappedTables := make([]AWSRedShiftWriterTable, 0, len(tables))\n\tstorageTables := make([]AWSRedShiftWriterStorageTable, 0, len(tables))\n\n\tfor _, table := range tables {\n\t\tconfig := table.(map[string]interface{})\n\t\tmappedTable := AWSRedShiftWriterTable{\n\t\t\tDatabaseName: config[\"db_name\"].(string),\n\t\t\tExport: config[\"export\"].(bool),\n\t\t\tTableID: config[\"table_id\"].(string),\n\t\t\tIncremental: config[\"incremental\"].(bool),\n\t\t}\n\n\t\tif q := config[\"primary_key\"]; q != nil {\n\t\t\tmappedTable.PrimaryKey = AsStringArray(q.([]interface{}))\n\t\t}\n\n\t\tstorageTable := AWSRedShiftWriterStorageTable{\n\t\t\tSource: mappedTable.TableID,\n\t\t\tDestination: fmt.Sprintf(\"%s.csv\", mappedTable.TableID),\n\t\t}\n\t\tif val, ok := config[\"changed_since\"]; ok {\n\t\t\tstorageTable.ChangedSince = val.(string)\n\t\t}\n\t\tif val, ok := config[\"where_column\"]; ok {\n\t\t\tstorageTable.WhereColumn = val.(string)\n\t\t}\n\t\tif val, ok := config[\"where_operator\"]; ok {\n\t\t\tstorageTable.WhereOperator = val.(string)\n\t\t}\n\n\t\tif q := config[\"where_values\"]; q != nil {\n\t\t\tstorageTable.WhereValues = AsStringArray(q.([]interface{}))\n\t\t}\n\t\titemConfigs := config[\"column\"].([]interface{})\n\t\tmappedItems := make([]AWSRedShiftWriterTableItem, 0, len(itemConfigs))\n\t\tcolumnsNames := make([]string, 0, len(itemConfigs))\n\n\t\tfor _, item := range itemConfigs {\n\t\t\titemConfig := item.(map[string]interface{})\n\n\t\t\tmappedItem := AWSRedShiftWriterTableItem{\n\t\t\t\tName: itemConfig[\"name\"].(string),\n\t\t\t\tDatabaseName: itemConfig[\"db_name\"].(string),\n\t\t\t\tType: itemConfig[\"type\"].(string),\n\t\t\t\tSize: itemConfig[\"size\"].(string),\n\t\t\t\tIsNullable: itemConfig[\"nullable\"].(bool),\n\t\t\t\tDefaultValue: itemConfig[\"default\"].(string),\n\t\t\t}\n\t\t\tmappedItems = append(mappedItems, mappedItem)\n\t\t\tcolumnsNames = append(columnsNames, mappedItem.Name)\n\t\t}\n\t\tmappedTable.Items = mappedItems\n\t\tstorageTable.Columns = columnsNames\n\n\t\tmappedTables = append(mappedTables, mappedTable)\n\t\tstorageTables = append(storageTables, storageTable)\n\t}\n\n\tgetWriterResponse, err := client.GetFromStorage(fmt.Sprintf(\"storage/components/keboola.wr-redshift-v2/configs/%s\", writerID))\n\n\tif hasErrors(err, getWriterResponse) {\n\t\treturn extractError(err, getWriterResponse)\n\t}\n\n\tvar awsredshiftwriter AWSRedShiftWriter\n\n\tdecoder := json.NewDecoder(getWriterResponse.Body)\n\terr = decoder.Decode(&awsredshiftwriter)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tawsredshiftwriter.Configuration.Parameters.Tables = mappedTables\n\tawsredshiftwriter.Configuration.Storage.Input.Tables = storageTables\n\n\tawsredshiftConfigJSON, err := json.Marshal(awsredshiftwriter.Configuration)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tupdateAWSRedShiftForm := url.Values{}\n\tupdateAWSRedShiftForm.Add(\"configuration\", string(awsredshiftConfigJSON))\n\tupdateAWSRedShiftForm.Add(\"changeDescription\", \"Update AWSRedshift tables\")\n\n\tupdateAWSRedShiftBuffer := buffer.FromForm(updateAWSRedShiftForm)\n\n\tupdateResponse, err := client.PutToStorage(fmt.Sprintf(\"storage/components/keboola.wr-redshift-v2/configs/%s\", writerID), updateAWSRedShiftBuffer)\n\n\tif hasErrors(err, updateResponse) {\n\t\treturn extractError(err, updateResponse)\n\t}\n\n\td.SetId(writerID)\n\n\treturn resourceKeboolaAWSRedShiftTablesRead(d, meta)\n}", "func (p *fleetUpdate) CreateRules() ([]string, error) {\n\t// No rules here\n\treturn nil, nil\n}", "func (c *chain) setup(ipt *iptables.IPTables) error {\n\terr := utils.EnsureChain(ipt, c.table, c.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add the rules to the chain\n\tfor _, rule := range c.rules {\n\t\tif err := utils.InsertUnique(ipt, c.table, c.name, false, rule); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Add the entry rules to the entry chains\n\tfor _, entryChain := range c.entryChains {\n\t\tfor _, rule := range c.entryRules {\n\t\t\tr := []string{}\n\t\t\tr = append(r, rule...)\n\t\t\tr = append(r, \"-j\", c.name)\n\t\t\tif err := utils.InsertUnique(ipt, c.table, entryChain, c.prependEntry, r); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *Ruleset) Validate() error {\n\tif len(r.Rules) == 0 {\n\t\treturn nil\n\t}\n\tfor _, rule := range r.Rules {\n\t\tif err := rule.Init(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func checkTableNameDef(r *ParseResult, tableName string) {\n\tif strings.Contains(tableName, DBNameSeparator) { // Rule 1\n\t\tr.AddError(TableWithDBNameErr.Accept(strings.Split(tableName, DBNameSeparator)[0]))\n\t}\n\n\tif strings.ToLower(tableName) != tableName { // Rule 2\n\t\tr.AddError(TableNotLowerCaseErr.Accept(tableName))\n\t}\n\n\tif _, ok := reservedWords[strings.ToUpper(tableName)]; ok { // Rule 3\n\t\tr.AddError(TableReservedWordErr.Accept(tableName))\n\t}\n\n\tif strings.Contains(tableName, Hyphen) {\n\t\tr.AddError(TableNameWithHyphenErr.Accept(tableName))\n\t}\n}", "func ValidateTableData() {\n\tconfig := GetConfig()\n\n\t// get table configuration from the config file\n\ttablesConfig := config.Get(\"app.tables\").([]interface{})\n\n\tfor _, table := range tablesConfig {\n\t\ttableName, err := dyno.GetString(table, \"name\")\n\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"error\": err, \"path\": \"validateTableData.table_name\"}).Error(\"Was not able to find the key!\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\ttableFields, err := dyno.Get(table, \"fields\")\n\t\tfields := tableFields.([]interface{})\n\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"error\": err, \"table\": tableName, \"path\": \"validateTableData.fields\"}).Error(\"Was not able to find the key!\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tfor _, field := range fields {\n\t\t\tfieldName, err := dyno.GetString(field, \"field\")\n\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(log.Fields{\"error\": err, \"table\": tableName, \"fieldName\": fieldName}).Error(\"Was not able to find the key!\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tfieldExtension, err := dyno.GetString(field, \"extension\")\n\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(log.Fields{\"error\": err, \"table\": tableName, \"fieldName\": fieldName, \"extension\": fieldExtension}).Error(\"Was not able to find the key! Every field does need to have an extension!\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tif len(fieldName) == 0 {\n\t\t\t\tlog.WithFields(log.Fields{\"error\": \"field\", \"table\": tableName, \"fieldName\": fieldName, \"extension\": fieldExtension}).Error(\"Missing correct field name!\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tif len(fieldExtension) == 0 {\n\t\t\t\tlog.WithFields(log.Fields{\"error\": \"extension\", \"table\": tableName, \"fieldName\": fieldName, \"extension\": fieldExtension}).Error(\"Every field does need to have an extension!\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\n\t}\n}", "func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error {\n\ttqsc.mu.Lock()\n\tdefer tqsc.mu.Unlock()\n\ttqsc.queryRulesMap[ruleSource] = qrs\n\treturn nil\n}", "func (d DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig userconfig.RulesConfig) (bool, error) {\n\tupdated := false\n\terr := d.Transaction(func(tx DB) error {\n\t\tcurrent, err := d.GetConfig(ctx, userID)\n\t\tif err != nil && err != sql.ErrNoRows {\n\t\t\treturn err\n\t\t}\n\t\t// The supplied oldConfig must match the current config. If no config\n\t\t// exists, then oldConfig must be nil. Otherwise, it must exactly\n\t\t// equal the existing config.\n\t\tif !((err == sql.ErrNoRows && oldConfig.Files == nil) || oldConfig.Equal(current.Config.RulesConfig)) {\n\t\t\treturn nil\n\t\t}\n\t\tnew := userconfig.Config{\n\t\t\tAlertmanagerConfig: current.Config.AlertmanagerConfig,\n\t\t\tRulesConfig: newConfig,\n\t\t}\n\t\tupdated = true\n\t\treturn d.SetConfig(ctx, userID, new)\n\t})\n\treturn updated, err\n}", "func (fw *IPtables) addIPtablesRule(rule *IPtablesRule) error {\n\tif err := fw.Store.addIPtablesRule(rule); err != nil {\n\t\tlog.Error(\"In addIPtablesRule failed to add \", rule.GetBody())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *AssignmentFilterEvaluateRequest) SetRule(value *string)() {\n err := m.GetBackingStore().Set(\"rule\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *cockroachdb) Setup() error {\n\tlog.Tracef(\"Setup tables\")\n\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tif c.shutdown {\n\t\treturn cache.ErrShutdown\n\t}\n\n\ttx := c.recordsdb.Begin()\n\terr := c.createTables(tx)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\treturn tx.Commit().Error\n}", "func (rs *ruleSet) Proto() (*rulepb.RuleSet, error) {\n\tres := &rulepb.RuleSet{\n\t\tUuid: rs.uuid,\n\t\tNamespace: string(rs.namespace),\n\t\tCreatedAtNanos: rs.createdAtNanos,\n\t\tLastUpdatedAtNanos: rs.lastUpdatedAtNanos,\n\t\tLastUpdatedBy: rs.lastUpdatedBy,\n\t\tTombstoned: rs.tombstoned,\n\t\tCutoverNanos: rs.cutoverNanos,\n\t}\n\n\tmappingRules := make([]*rulepb.MappingRule, len(rs.mappingRules))\n\tfor i, m := range rs.mappingRules {\n\t\tmr, err := m.proto()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmappingRules[i] = mr\n\t}\n\tres.MappingRules = mappingRules\n\n\trollupRules := make([]*rulepb.RollupRule, len(rs.rollupRules))\n\tfor i, r := range rs.rollupRules {\n\t\trr, err := r.proto()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trollupRules[i] = rr\n\t}\n\tres.RollupRules = rollupRules\n\n\treturn res, nil\n}", "func ruleHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\trule, err := ruleProcessor.GetRuleJson(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Describe rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Add(ContentType, ContentTypeJSON)\n\t\tw.Write([]byte(rule))\n\tcase http.MethodDelete:\n\t\tdeleteRule(name)\n\t\tcontent, err := ruleProcessor.ExecDrop(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Delete rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(content))\n\tcase http.MethodPut:\n\t\t_, err := ruleProcessor.GetRuleById(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Rule not found\", logger)\n\t\t\treturn\n\t\t}\n\n\t\tbody, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Invalid body\", logger)\n\t\t\treturn\n\t\t}\n\t\terr = updateRule(name, string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Update rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\t// Update to db after validation\n\t\t_, err = ruleProcessor.ExecUpdate(name, string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Update rule error, suggest to delete it and recreate\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, \"Rule %s was updated successfully.\", name)\n\t}\n}", "func TestMoveTablesNoRoutingRules(t *testing.T) {\n\tms := &vtctldatapb.MaterializeSettings{\n\t\tWorkflow: \"workflow\",\n\t\tSourceKeyspace: \"sourceks\",\n\t\tTargetKeyspace: \"targetks\",\n\t\tTableSettings: []*vtctldatapb.TableMaterializeSettings{{\n\t\t\tTargetTable: \"t1\",\n\t\t\tSourceExpression: \"select * from t1\",\n\t\t}},\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tenv := newTestMaterializerEnv(t, ctx, ms, []string{\"0\"}, []string{\"0\"})\n\tdefer env.close()\n\n\tenv.tmc.expectVRQuery(100, mzCheckJournal, &sqltypes.Result{})\n\tenv.tmc.expectVRQuery(200, mzSelectFrozenQuery, &sqltypes.Result{})\n\tenv.tmc.expectVRQuery(200, insertPrefix, &sqltypes.Result{})\n\tenv.tmc.expectVRQuery(200, mzSelectIDQuery, &sqltypes.Result{})\n\tenv.tmc.expectVRQuery(200, mzUpdateQuery, &sqltypes.Result{})\n\n\terr := env.wr.MoveTables(ctx, \"workflow\", \"sourceks\", \"targetks\", \"t1\", \"\", \"\", false, \"\", true, false, \"\", false, false, \"\", defaultOnDDL, nil, true)\n\trequire.NoError(t, err)\n\trr, err := env.wr.ts.GetRoutingRules(ctx)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 0, len(rr.Rules))\n}", "func (fw *IPtables) SetDefaultRules(rules []FirewallRule) error {\n\tfor _, rule := range rules {\n\t\tlog.Infof(\"In SetDefaultRules() processing rule %s\", rule.GetBody())\n\t\tif rule.GetType() == \"iptables\" {\n\t\t\tiptablesRule := &IPtablesRule{\n\t\t\t\tBody: rule.GetBody(),\n\t\t\t\tState: setRuleInactive.String(),\n\t\t\t}\n\n\t\t\terr := fw.injectRule(iptablesRule)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"In SetDefaultRules() failed to set the rule %s, %s\", rule.GetBody(), err)\n\t\t\t}\n\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"In SetDefaultRules() unsupported rule type %s\", rule.GetType())\n\t\t}\n\t}\n\n\treturn nil\n}", "func SetEntries(task *kernel.Task, stk *stack.Stack, optVal []byte, ipv6 bool) *syserr.Error {\n\tvar replace linux.IPTReplace\n\toptVal = replace.UnmarshalBytes(optVal)\n\n\tvar table stack.Table\n\tswitch replace.Name.String() {\n\tcase filterTable:\n\t\ttable = stack.EmptyFilterTable()\n\tcase natTable:\n\t\ttable = stack.EmptyNATTable()\n\tdefault:\n\t\tnflog(\"unknown iptables table %q\", replace.Name.String())\n\t\treturn syserr.ErrInvalidArgument\n\t}\n\n\tvar err *syserr.Error\n\tvar offsets map[uint32]int\n\tif ipv6 {\n\t\toffsets, err = modifyEntries6(task, stk, optVal, &replace, &table)\n\t} else {\n\t\toffsets, err = modifyEntries4(task, stk, optVal, &replace, &table)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Go through the list of supported hooks for this table and, for each\n\t// one, set the rule it corresponds to.\n\tfor hook := range replace.HookEntry {\n\t\tif table.ValidHooks()&(1<<hook) != 0 {\n\t\t\thk := hookFromLinux(hook)\n\t\t\ttable.BuiltinChains[hk] = stack.HookUnset\n\t\t\ttable.Underflows[hk] = stack.HookUnset\n\t\t\tfor offset, ruleIdx := range offsets {\n\t\t\t\tif offset == replace.HookEntry[hook] {\n\t\t\t\t\ttable.BuiltinChains[hk] = ruleIdx\n\t\t\t\t}\n\t\t\t\tif offset == replace.Underflow[hook] {\n\t\t\t\t\tif !validUnderflow(table.Rules[ruleIdx], ipv6) {\n\t\t\t\t\t\tnflog(\"underflow for hook %d isn't an unconditional ACCEPT or DROP: %+v\", ruleIdx)\n\t\t\t\t\t\treturn syserr.ErrInvalidArgument\n\t\t\t\t\t}\n\t\t\t\t\ttable.Underflows[hk] = ruleIdx\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ruleIdx := table.BuiltinChains[hk]; ruleIdx == stack.HookUnset {\n\t\t\t\tnflog(\"hook %v is unset.\", hk)\n\t\t\t\treturn syserr.ErrInvalidArgument\n\t\t\t}\n\t\t\tif ruleIdx := table.Underflows[hk]; ruleIdx == stack.HookUnset {\n\t\t\t\tnflog(\"underflow %v is unset.\", hk)\n\t\t\t\treturn syserr.ErrInvalidArgument\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check the user chains.\n\tfor ruleIdx, rule := range table.Rules {\n\t\tif _, ok := rule.Target.(*stack.UserChainTarget); !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// We found a user chain. Before inserting it into the table,\n\t\t// check that:\n\t\t//\t- There's some other rule after it.\n\t\t//\t- There are no matchers.\n\t\tif ruleIdx == len(table.Rules)-1 {\n\t\t\tnflog(\"user chain must have a rule or default policy\")\n\t\t\treturn syserr.ErrInvalidArgument\n\t\t}\n\t\tif len(table.Rules[ruleIdx].Matchers) != 0 {\n\t\t\tnflog(\"user chain's first node must have no matchers\")\n\t\t\treturn syserr.ErrInvalidArgument\n\t\t}\n\t}\n\n\t// Set each jump to point to the appropriate rule. Right now they hold byte\n\t// offsets.\n\tfor ruleIdx, rule := range table.Rules {\n\t\tjump, ok := rule.Target.(*JumpTarget)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Find the rule corresponding to the jump rule offset.\n\t\tjumpTo, ok := offsets[jump.Offset]\n\t\tif !ok {\n\t\t\tnflog(\"failed to find a rule to jump to\")\n\t\t\treturn syserr.ErrInvalidArgument\n\t\t}\n\t\tjump.RuleNum = jumpTo\n\t\trule.Target = jump\n\t\ttable.Rules[ruleIdx] = rule\n\t}\n\n\t// Since we don't support FORWARD, yet, make sure all other chains point to\n\t// ACCEPT rules.\n\tfor hook, ruleIdx := range table.BuiltinChains {\n\t\tif hook := stack.Hook(hook); hook == stack.Forward {\n\t\t\tif ruleIdx == stack.HookUnset {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !isUnconditionalAccept(table.Rules[ruleIdx], ipv6) {\n\t\t\t\tnflog(\"hook %d is unsupported.\", hook)\n\t\t\t\treturn syserr.ErrInvalidArgument\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO(gvisor.dev/issue/6167): Check the following conditions:\n\t//\t- There are no loops.\n\t//\t- There are no chains without an unconditional final rule.\n\t//\t- There are no chains without an unconditional underflow rule.\n\n\tstk.IPTables().ReplaceTable(nameToID[replace.Name.String()], table, ipv6)\n\treturn nil\n}", "func listTables_POST_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_tables_route.listTables_POST_Handler:cannot parse path. try /batch-get-item\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbodybytes, read_err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif read_err != nil && read_err != io.EOF {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler err reading req body: %s\", read_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar l list.List\n\n\tum_err := json.Unmarshal(bodybytes, &l)\n\tif um_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler unmarshal err on %s to Get %s\", string(bodybytes), um_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_POST_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_POST_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler %s\",\n\t\t\tmr_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func TabsSet(w http.ResponseWriter, r *http.Request) {\n\tvar e error\n\tbody, e := ioutil.ReadAll(r.Body)\n\tif e != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Error().Msgf(\"[HTTP] failed to read TabsSet request body\")\n\t\terrResp := ErrResponse{\n\t\t\tErrors: []string{http.StatusText(http.StatusInternalServerError)},\n\t\t}\n\t\tresp, _ := json.Marshal(errResp)\n\t\tw.Write([]byte(resp))\n\t\treturn\n\t}\n\n\tvar tabs = []*models.Tab{}\n\te = json.Unmarshal(body, &tabs)\n\tif e != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Error().Msgf(\"[HTTP] failed to unmarshal TabsSet request body: %s\", string(body))\n\t\terrResp := ErrResponse{\n\t\t\tErrors: []string{http.StatusText(http.StatusInternalServerError)},\n\t\t}\n\t\tresp, _ := json.Marshal(errResp)\n\t\tw.Write([]byte(resp))\n\t\treturn\n\t}\n\te = engine.DB.TabsSet(tabs)\n\tif e != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Error().Msgf(\"[DB] TabsSet error: %s\", e)\n\t\terrResp := ErrResponse{\n\t\t\tErrors: []string{http.StatusText(http.StatusInternalServerError)},\n\t\t}\n\t\tresp, _ := json.Marshal(errResp)\n\t\tw.Write([]byte(resp))\n\t\treturn\n\t}\n\tnewTabs, e := engine.DB.TabsGet(false)\n\tif e != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Error().Msgf(\"[DB] TabsGet error %v\", e)\n\t\terrResp := ErrResponse{\n\t\t\tErrors: []string{http.StatusText(http.StatusInternalServerError)},\n\t\t}\n\t\tresp, _ := json.Marshal(errResp)\n\t\tw.Write([]byte(resp))\n\t\treturn\n\t}\n\tmsg := &ws.Message{\n\t\tMsg: \"refresh tabs\",\n\t\tPayload: newTabs,\n\t}\n\tws.OutChann <- msg\n\tw.WriteHeader(http.StatusOK)\n}", "func (t *TwitterController) PostRules(rules []string) (response.PostRules, error) {\n\tauthorizationBearer := \"Bearer \" + os.Getenv(\"TWITTER_AUTH_BEARER\")\n\tclient := &http.Client{}\n\n\tvar postRequestBody request.PostRules\n\n\tfor _, rule := range rules {\n\t\tpostRequestBody.Add = append(postRequestBody.Add, request.PostRulesValue{\n\t\t\tValue: rule,\n\t\t})\n\t}\n\n\trequestBody, _ := json.Marshal(postRequestBody)\n\n\treq, _ := http.NewRequest(\"POST\", rulesURL, strings.NewReader(string(requestBody)))\n\treq.Header.Add(\"Authorization\", authorizationBearer)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn response.PostRules{}, err\n\t}\n\n\tdefer resp.Body.Close()\n\tjsonResp, _ := ioutil.ReadAll(resp.Body)\n\n\tvar postRulesResp response.PostRules\n\tjson.Unmarshal([]byte(jsonResp), &postRulesResp)\n\n\treturn postRulesResp, nil\n}", "func addRulesToConfigPolicyNode(rules map[string]interface{}, cpn *ConfigPolicyNode) error {\n\tfor k, rule := range rules {\n\t\tif rule, ok := rule.(map[string]interface{}); ok {\n\t\t\treq, _ := rule[\"required\"].(bool)\n\t\t\tswitch rule[\"type\"] {\n\t\t\tcase \"integer\":\n\t\t\t\tr, _ := NewIntegerRule(k, req)\n\t\t\t\tif d, ok := rule[\"default\"]; ok {\n\t\t\t\t\t// json encoding an int results in a float when decoding\n\t\t\t\t\tdef_, _ := d.(float64)\n\t\t\t\t\tdef := int(def_)\n\t\t\t\t\tr.default_ = &def\n\t\t\t\t}\n\t\t\t\tif m, ok := rule[\"minimum\"]; ok {\n\t\t\t\t\tmin_, _ := m.(float64)\n\t\t\t\t\tmin := int(min_)\n\t\t\t\t\tr.minimum = &min\n\t\t\t\t}\n\t\t\t\tif m, ok := rule[\"maximum\"]; ok {\n\t\t\t\t\tmax_, _ := m.(float64)\n\t\t\t\t\tmax := int(max_)\n\t\t\t\t\tr.maximum = &max\n\t\t\t\t}\n\t\t\t\tcpn.Add(r)\n\t\t\tcase \"string\":\n\t\t\t\tr, _ := NewStringRule(k, req)\n\t\t\t\tif d, ok := rule[\"default\"]; ok {\n\t\t\t\t\tdef, _ := d.(string)\n\t\t\t\t\tif def != \"\" {\n\t\t\t\t\t\tr.default_ = &def\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcpn.Add(r)\n\t\t\tcase \"bool\":\n\t\t\t\tr, _ := NewBoolRule(k, req)\n\t\t\t\tif d, ok := rule[\"default\"]; ok {\n\t\t\t\t\tdef, _ := d.(bool)\n\t\t\t\t\tr.default_ = &def\n\t\t\t\t}\n\n\t\t\t\tcpn.Add(r)\n\t\t\tcase \"float\":\n\t\t\t\tr, _ := NewFloatRule(k, req)\n\t\t\t\tif d, ok := rule[\"default\"]; ok {\n\t\t\t\t\tdef, _ := d.(float64)\n\t\t\t\t\tr.default_ = &def\n\t\t\t\t}\n\t\t\t\tif m, ok := rule[\"minimum\"]; ok {\n\t\t\t\t\tmin, _ := m.(float64)\n\t\t\t\t\tr.minimum = &min\n\t\t\t\t}\n\t\t\t\tif m, ok := rule[\"maximum\"]; ok {\n\t\t\t\t\tmax, _ := m.(float64)\n\t\t\t\t\tr.maximum = &max\n\t\t\t\t}\n\t\t\t\tcpn.Add(r)\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"unknown type\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func RuleCreateHandler(w http.ResponseWriter, req *http.Request) {\n\tdecoder := json.NewDecoder(req.Body)\n\tdefer req.Body.Close()\n\n\trule := api.Rule{}\n\tif err := decoder.Decode(&rule); err != nil {\n\t\terrors.SendBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tmutex.Lock()\n\tclient := clients[clientID%numClients]\n\tclientID++\n\tmutex.Unlock()\n\tif err := client.Create(context.Background(), path.Join(\"/rules\", rule.Name), &rule); err != nil {\n\t\tencoder.Encode(err)\n\t} else {\n\t\tencoder.Encode(&rule)\n\t}\n}", "func HandleAddEventingTriggerRule(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\truleName := vars[\"id\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tvalue := config.EventingTrigger{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&value)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-trigger\", \"modify\", map[string]string{\"project\": projectID, \"id\": ruleName})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, value)\n\t\tstatus, err := syncMan.SetEventingRule(ctx, projectID, ruleName, &value, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (c *AwsClient) ensureRouteTable() error {\n\n\tlogrus.Debug(\"Reading the main route table\")\n\tmainRT, err := c.getRouteTable(\n\t\t[]*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"vpc-id\"),\n\t\t\t\tValues: aws.StringSlice([]string{c.vpcID}),\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: aws.String(\"association.main\"),\n\t\t\t\tValues: aws.StringSlice([]string{\"true\"}),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not find the main route table: %s\", err)\n\t}\n\n\tlogrus.Debug(\"Checking if our route table exists\")\n\tmyRouteTable, err := c.getRouteTable(\n\t\t[]*ec2.Filter{\n\t\t\t{\n\t\t\t\tName: aws.String(\"tag:name\"),\n\t\t\t\tValues: aws.StringSlice([]string{uniquePrefix}),\n\t\t\t},\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tswitch err {\n\t\tcase errRouteTableNotFound:\n\t\t\tlogrus.Info(\"Route table doesn't exist, creating a new one\")\n\n\t\t\tinput := &ec2.CreateRouteTableInput{\n\t\t\t\tVpcId: aws.String(c.vpcID),\n\t\t\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t\t\t{\n\t\t\t\t\t\tResourceType: aws.String(ec2.ResourceTypeRouteTable),\n\t\t\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tKey: aws.String(\"name\"),\n\t\t\t\t\t\t\t\tValue: aws.String(uniquePrefix),\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\n\t\t\tresp, err := c.aws.CreateRouteTable(input)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to CreateRouteTable: %w\", err)\n\t\t\t}\n\n\t\t\tfor _, route := range onlyDefaultRoute(mainRT.Routes) {\n\t\t\t\tlogrus.Debugf(\"Checking a route from the main RT: %s\", *route.DestinationCidrBlock)\n\n\t\t\t\tif route.GatewayId != nil {\n\t\t\t\t\tlogrus.Info(\"Adding a default route from the main route table\")\n\n\t\t\t\t\tinput := &ec2.CreateRouteInput{\n\t\t\t\t\t\tDestinationCidrBlock: route.DestinationCidrBlock,\n\t\t\t\t\t\tGatewayId: route.GatewayId,\n\t\t\t\t\t\tRouteTableId: resp.RouteTable.RouteTableId,\n\t\t\t\t\t}\n\n\t\t\t\t\t_, err := c.aws.CreateRoute(input)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"Failed to add base routes from main RT: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.awsRouteTable = resp.RouteTable\n\t\t\treturn c.associateRouteTable()\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\tc.awsRouteTable = myRouteTable\n\tlogrus.Debugf(\"Route table already exists\")\n\n\treturn c.associateRouteTable()\n}", "func resetTable(w http.ResponseWriter, r *http.Request, _ httprouter.Params){\n\tmytable = mytable.reset()\n\temptydb()\n}", "func (d DB) SetConfig(ctx context.Context, userID string, cfg userconfig.Config) error {\n\tif !cfg.RulesConfig.FormatVersion.IsValid() {\n\t\treturn fmt.Errorf(\"invalid rule format version %v\", cfg.RulesConfig.FormatVersion)\n\t}\n\tcfgBytes, err := json.Marshal(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = d.Insert(\"configs\").\n\t\tColumns(\"owner_id\", \"owner_type\", \"subsystem\", \"config\").\n\t\tValues(userID, entityType, subsystem, cfgBytes).\n\t\tExec()\n\treturn err\n}", "func (task *SetupSchemaTask) run() error {\n\n\tconfig := task.config\n\n\tdefer func() {\n\t\ttask.client.Close()\n\t}()\n\n\tlog.Printf(\"Starting schema setup, config=%+v\\n\", config)\n\n\tif config.Overwrite {\n\t\tdropAllTablesTypes(task.client)\n\t}\n\n\tif !config.DisableVersioning {\n\t\tlog.Printf(\"Setting up version tables\\n\")\n\t\tif err := task.client.CreateSchemaVersionTables(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(config.SchemaFilePath) > 0 {\n\t\tstmts, err := ParseCQLFile(config.SchemaFilePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Println(\"----- Creating types and tables -----\")\n\t\tfor _, stmt := range stmts {\n\t\t\tlog.Println(rmspaceRegex.ReplaceAllString(stmt, \" \"))\n\t\t\tif err := task.client.Exec(stmt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tlog.Println(\"----- Done -----\")\n\t}\n\n\tif !config.DisableVersioning {\n\t\tlog.Printf(\"Setting initial schema version to %v\\n\", config.InitialVersion)\n\t\terr := task.client.UpdateSchemaVersion(config.InitialVersion, config.InitialVersion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"Updating schema update log\\n\")\n\t\terr = task.client.WriteSchemaUpdateLog(\"0\", config.InitialVersion, \"\", \"initial version\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Println(\"Schema setup complete\")\n\n\treturn nil\n}", "func (m *MysqlProxy) AddTable(tab *schema.MysqlTable) error {\n tables := m.Tables\n tableIds := m.TableIds\n\n if tables == nil {\n tables = []*schema.MysqlTable{ tab }\n tableIds = []string{ tab.Id }\n } else {\n tables = append(tables, tab)\n tableIds = append(tableIds, tab.Id)\n }\n m.Tables = tables\n schema.Tables = tables\n m.TableIds = tableIds\n\n return m.UpdateToRedisDB()\n}", "func SetRoutes(cfg *conf.Config, db *gorm.DB, r *gin.Engine) {\n\tr.GET(\"/\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, \"HELLO\")\n\t})\n\tr.GET(\"/state/:stateID/cities\", getStateCitiesHandler(cfg, db))\n\tr.POST(\"/user/:userID/visits\", getNewVisitHandler(cfg, db))\n\tr.DELETE(\"/user/:userID/visits/:visitID\", getDeleteVisitHandler(cfg, db))\n\tr.GET(\"/user/:userID/visits/states\", getVisitedStatesHandler(cfg, db))\n\tr.GET(\"/user/:userID/visits\", getVisitedCitiesHandler(cfg, db))\n}" ]
[ "0.68676865", "0.6056035", "0.5995382", "0.5469408", "0.5430646", "0.5360334", "0.53322506", "0.5099649", "0.50065756", "0.50055325", "0.49860755", "0.49699572", "0.4905327", "0.48625025", "0.48625025", "0.4852737", "0.47984773", "0.47907025", "0.47798216", "0.4773209", "0.4764428", "0.47383434", "0.47236675", "0.4719535", "0.4714542", "0.469686", "0.46870783", "0.46657005", "0.46525022", "0.46366864", "0.46002847", "0.45919257", "0.45832112", "0.45757896", "0.45748788", "0.45682922", "0.4543882", "0.4523544", "0.45232624", "0.45192504", "0.45192277", "0.4519052", "0.44782338", "0.44772238", "0.44609958", "0.44564492", "0.44562396", "0.4455656", "0.4454293", "0.44410288", "0.44404653", "0.44362107", "0.4432994", "0.44310993", "0.44285244", "0.4413391", "0.44103447", "0.44087392", "0.43918115", "0.4391128", "0.43867633", "0.43848032", "0.4375232", "0.43691218", "0.4357553", "0.43397713", "0.43363547", "0.43273747", "0.43238187", "0.4317128", "0.43163413", "0.43044528", "0.4296476", "0.42907423", "0.42879736", "0.42840144", "0.4280439", "0.42723167", "0.4269239", "0.42654732", "0.4262492", "0.42607674", "0.42574978", "0.42542598", "0.42540738", "0.4252786", "0.42520925", "0.42450267", "0.42311788", "0.42289147", "0.42288458", "0.42259142", "0.4224342", "0.4214554", "0.42008835", "0.42000723", "0.41976216", "0.4191541", "0.41898844", "0.418626" ]
0.8472057
0
HandleGetTableRules returns handler to get collection rule
func HandleGetTableRules(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() // get project id and dbAlias vars := mux.Vars(r) projectID := vars["project"] dbAlias := "" dbAliasQuery, exists := r.URL.Query()["dbAlias"] if exists { dbAlias = dbAliasQuery[0] } col := "" colQuery, exists := r.URL.Query()["col"] if exists { col = colQuery[0] } dbConfig, err := syncMan.GetCollectionRules(ctx, projectID, dbAlias, col) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: dbConfig}) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleSetTableRules(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tif err := syncman.SetCollectionRules(ctx, projectID, dbAlias, col, &v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func GetRules(filtersMap map[string]interface{}, page int) ([]Rule, error) {\n\tvar rules []Rule\n\terr := database.Client.GetAll(ruleTable, &rules, filtersMap, nil, page)\n\treturn rules, err\n}", "func (c *AuditClient) GetRules() ([][]byte, error) {\n\tmsg := syscall.NetlinkMessage{\n\t\tHeader: syscall.NlMsghdr{\n\t\t\tType: uint16(auparse.AUDIT_LIST_RULES),\n\t\t\tFlags: syscall.NLM_F_REQUEST | syscall.NLM_F_ACK,\n\t\t},\n\t\tData: nil,\n\t}\n\n\t// Send AUDIT_LIST_RULES message to the kernel.\n\tseq, err := c.Netlink.Send(msg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed sending request: %w\", err)\n\t}\n\n\t// Get the ack message which is a NLMSG_ERROR type whose error code is SUCCESS.\n\tack, err := c.getReply(seq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get audit ACK: %w\", err)\n\t}\n\n\tif ack.Header.Type != syscall.NLMSG_ERROR {\n\t\treturn nil, fmt.Errorf(\"unexpected ACK to LIST_RULES, got type=%d\", ack.Header.Type)\n\t}\n\n\tif err = ParseNetlinkError(ack.Data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rules [][]byte\n\tfor {\n\t\treply, err := c.getReply(seq)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed receiving rule data: %w\", err)\n\t\t}\n\n\t\tif reply.Header.Type == syscall.NLMSG_DONE {\n\t\t\tbreak\n\t\t}\n\n\t\tif reply.Header.Type != uint16(auparse.AUDIT_LIST_RULES) {\n\t\t\treturn nil, fmt.Errorf(\"unexpected message type %d while receiving rules\", reply.Header.Type)\n\t\t}\n\n\t\trule := make([]byte, len(reply.Data))\n\t\tcopy(rule, reply.Data)\n\t\trules = append(rules, rule)\n\t}\n\n\treturn rules, nil\n}", "func HandleGetEventingSecurityRules(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-rule\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, securityRules, err := syncMan.GetEventingSecurityRules(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: securityRules})\n\t}\n}", "func GetRulesetRules(uuid string) (r map[string]map[string]string, err error) {\n rules := make(map[string]map[string]string)\n path, err := ndb.GetRulesetPath(uuid)\n rules, err = ReadRuleset(path)\n for rule := range rules {\n retrieveNote := make(map[string]string)\n retrieveNote[\"uuid\"] = uuid\n retrieveNote[\"sid\"] = rule\n rules[rule][\"note\"], _ = GetRuleNote(retrieveNote)\n sourceType, err := ndb.GetRuleFilesValue(uuid, \"sourceType\")\n if err != nil {\n logs.Error(\"GetRulesetRules--> GetRuleFilesValue query error %s\", err.Error())\n return nil, err\n }\n rules[rule][\"sourceType\"] = sourceType\n }\n return rules, err\n}", "func (t *TwitterController) GetRules() (response.GetRules, error) {\n\tauthorizationBearer := \"Bearer \" + os.Getenv(\"TWITTER_AUTH_BEARER\")\n\tclient := &http.Client{}\n\n\treq, _ := http.NewRequest(\"GET\", rulesURL, nil)\n\treq.Header.Add(\"Authorization\", authorizationBearer)\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn response.GetRules{}, err\n\t}\n\n\tdefer resp.Body.Close()\n\tjsonResp, _ := ioutil.ReadAll(resp.Body)\n\n\tvar getRulesResp response.GetRules\n\tjson.Unmarshal([]byte(jsonResp), &getRulesResp)\n\n\treturn getRulesResp, nil\n}", "func rulesHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\tbody, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Invalid body\", logger)\n\t\t\treturn\n\t\t}\n\t\tid, err := createRule(\"\", string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tfmt.Fprintf(w, \"Rule %s was created successfully.\", id)\n\tcase http.MethodGet:\n\t\tcontent, err := getAllRulesWithStatus()\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Show rules error\", logger)\n\t\t\treturn\n\t\t}\n\t\tjsonResponse(content, w, logger)\n\t}\n}", "func (m *Mock) GetRule(*nftables.Table, *nftables.Chain) ([]*nftables.Rule, error) {\n\treturn nil, nil\n}", "func RuleListHandler(w http.ResponseWriter, req *http.Request) {\n\trules := api.RuleList{}\n\n\tif err := clients[0].List(context.Background(), \"/rules\", &rules); err != nil {\n\t\tif kvstore.IsKeyNotFoundError(err) {\n\t\t\terrors.SendNotFound(w, \"NodeList\", \"\")\n\t\t\treturn\n\t\t}\n\t\terrors.SendInternalError(w, err)\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tbefore := time.Now()\n\tencoder.Encode(&rules)\n\tlog.Infof(\"Encode time %v\", time.Since(before))\n}", "func (a *Client) GetRules(params *GetRulesParams, opts ...ClientOption) (*GetRulesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRulesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"get-rules\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fwmgr/entities/rules/v1\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetRulesReader{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.(*GetRulesOK)\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 get-rules: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (m *ManagerClient) GetRules() (string, error) {\n\tif auth, _ := m.IsServerAuthenticated(); auth {\n\t\treq, err := m.Prepare(\"GET\", GetRulesURL, nil)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"GetRules failed to prepare request: %s\", err)\n\t\t}\n\n\t\tresp, err := m.httpClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"GetRules failed to issue HTTP request: %s\", err)\n\t\t}\n\n\t\tif resp != nil {\n\t\t\tdefer resp.Body.Close()\n\t\t\tif resp.StatusCode != 200 {\n\t\t\t\treturn \"\", fmt.Errorf(\"GetRules failed to retrieve rules, unexpected HTTP status code %d\", resp.StatusCode)\n\t\t\t}\n\t\t\trules, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"GetRules failed to read HTTP response body: %s\", err)\n\t\t\t}\n\t\t\treturn string(rules), nil\n\t\t}\n\t}\n\treturn \"\", nil\n}", "func GetRules(release database.Release) []database.Rule {\n\tvar rules []database.Rule\n\tdb.DB.Model(&release).Related(&rules)\n\tfor i, rule := range rules {\n\t\tdb.DB.Model(&rule).Related(&rules[i].TimeRule)\n\t\tdb.DB.Model(&rule).Related(&rules[i].RollRule)\n\t\tdb.DB.Model(&rule).Related(&rules[i].VersionRule)\n\t\tdb.DB.Model(&rule).Related(&rules[i].OsRule)\n\t\tdb.DB.Model(&rule).Related(&rules[i].IPRule)\n\t}\n\treturn rules\n}", "func HandleGetAllTableNames(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\n\t\tcrud := modules.DB()\n\t\tcollections, err := crud.GetCollections(ctx, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcols := make([]string, len(collections))\n\t\tfor i, value := range collections {\n\t\t\tcols[i] = value.TableName\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: cols})\n\t}\n}", "func listTables_GET_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_table_route.ListTablesHandler:cannot parse path.\" +\n\t\t\t\"try /list?ExclusiveStartTableName=$T&Limit=$L\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\tqueryMap := make(map[string]string)\n\tfor k, v := range req.URL.Query() {\n\t\tqueryMap[strings.ToLower(k)] = v[0]\n\t}\n\n\tq_estn, estn_exists := queryMap[strings.ToLower(list.EXCLUSIVE_START_TABLE_NAME)]\n\testn := \"\"\n\tif estn_exists {\n\t\testn = q_estn\n\t}\n\tq_limit, limit_exists := queryMap[strings.ToLower(list.LIMIT)]\n\tlimit := uint64(0)\n\tif limit_exists {\n\t\tlimit_conv, conv_err := strconv.ParseUint(q_limit, 10, 64)\n\t\tif conv_err != nil {\n\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler bad limit %s\", q_limit)\n\t\t\tlog.Printf(e)\n\t\t} else {\n\t\t\tlimit = limit_conv\n\t\t\tif limit > DEFAULT_LIMIT {\n\t\t\t\te := fmt.Sprintf(\"list_table_route.listTables_GET_Handler: high limit %d\", limit_conv)\n\t\t\t\tlog.Printf(e)\n\t\t\t\tlimit = DEFAULT_LIMIT\n\t\t\t}\n\t\t}\n\t}\n\n\tl := list.List{\n\t\tLimit: limit,\n\t\tExclusiveStartTableName: estn}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_GET_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_GET_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.listTable_GET_Handler %s\", mr_err.Error())\n\t\tlog.Printf(e)\n\t}\n}", "func (s *Manager) GetCollectionRules(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ttype response struct {\n\t\tIsRealTimeEnabled bool `json:\"isRealtimeEnabled\"`\n\t\tRules map[string]*config.Rule `json:\"rules\"`\n\t}\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"specified collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {IsRealTimeEnabled: collectionInfo.IsRealTimeEnabled, Rules: collectionInfo.Rules}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{IsRealTimeEnabled: value.IsRealTimeEnabled, Rules: value.Rules}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func FalcoRulesHandler(c buffalo.Context) error {\n\tc.Set(\"page-title\", \"Falco rules\")\n\tc.Set(\"page-description\", \"Falco Rules\")\n\treturn c.Render(http.StatusOK, r.HTML(\"falco_rules.html\"))\n}", "func (a *UnsupportedApiService) ApplicationsTrafficRulesGET(ctx context.Context, appInstanceId string) ([]TrafficRule, *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 []TrafficRule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/applications/{appInstanceId}/traffic_rules\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"appInstanceId\"+\"}\", fmt.Sprintf(\"%v\", appInstanceId), -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\", \"text/plain\"}\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 []TrafficRule\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 == 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\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (api *APIServer) httpTablesHandler(w http.ResponseWriter, r *http.Request) {\n\ttables, err := getTables(api.config)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"tables\", err)\n\t\treturn\n\t}\n\tsendResponse(w, http.StatusOK, tables)\n}", "func (a *EventSettingsApiService) GetSystemRules(ctx _context.Context) ([]SystemRuleLabel, *_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 []SystemRuleLabel\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/events/settings/event-specifications/custom/systemRules\"\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\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\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\tvar v []SystemRuleLabel\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}", "func tablesHandler(w http.ResponseWriter, r *http.Request) {\n\tsourcesManageHandler(w, r, ast.TypeTable)\n}", "func GetRules() ([]AuditRule, error) {\n\tclient, err := libaudit.NewAuditClient(nil)\n\tdefer client.Close()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to initialize client\")\n\t}\n\trawRules, err := client.GetRules()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to get audit rules\")\n\t}\n\tvar auditRules []AuditRule\n\tfor _, r := range rawRules {\n\t\tvar ard auditRuleData\n\t\tnbuf := bytes.NewBuffer(r)\n\t\tif err := struc.Unpack(nbuf, &ard); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to process audit rule\")\n\t\t}\n\t\tar, err := ard.toAuditRule()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to process audit rule\")\n\t\t}\n\t\tauditRules = append(auditRules, ar)\n\t}\n\treturn auditRules, nil\n}", "func HandleGetEventingTriggers(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get projectId and ruleName from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\truleNameQuery, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = ruleNameQuery[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-trigger\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, rules, err := syncMan.GetEventingTriggerRules(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: rules})\n\t}\n}", "func (m *ManagedTenantsManagedTenantAlertRuleDefinitionsItemAlertRulesRequestBuilder) Get(ctx context.Context, requestConfiguration *ManagedTenantsManagedTenantAlertRuleDefinitionsItemAlertRulesRequestBuilderGetRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantAlertRuleCollectionResponseable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagedTenantAlertRuleCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantAlertRuleCollectionResponseable), nil\n}", "func GetRules() []Rule {\n\tupdateMux.RLock()\n\trules := rulesFrom(breakerRules)\n\tupdateMux.RUnlock()\n\tret := make([]Rule, 0, len(rules))\n\tfor _, rule := range rules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func (o BucketWebsiteOutput) RoutingRules() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BucketWebsite) interface{} { return v.RoutingRules }).(pulumi.AnyOutput)\n}", "func getTopoRuleHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\n\tcontent, err := getRuleTopo(name)\n\tif err != nil {\n\t\thandleError(w, err, \"get rule topo error\", logger)\n\t\treturn\n\t}\n\tw.Header().Set(ContentType, ContentTypeJSON)\n\tw.Write([]byte(content))\n}", "func (m *ManagedTenantsManagedTenantAlertRulesRequestBuilder) Get(ctx context.Context, requestConfiguration *ManagedTenantsManagedTenantAlertRulesRequestBuilderGetRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantAlertRuleCollectionResponseable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagedTenantAlertRuleCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantAlertRuleCollectionResponseable), nil\n}", "func (s *NamespaceWebhook) Rules() []admissionregv1.RuleWithOperations { return rules }", "func (th *TableHandler) GetTable(c echo.Context) (err error) {\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\tid := c.Param(\"id\")\n\ttableId, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\t// Invalid request parameter\n\t\tzap.L().Error(errInvalidRequest.Error(), zap.Error(err))\n\t\treturn c.JSON(http.StatusBadRequest, presenter.ErrResp(reqID, errInvalidRequest))\n\t}\n\t// Query database\n\tres, err := th.dbSvc.GetTable(c.Request().Context(), tableId)\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Return ok\n\treturn c.JSON(http.StatusOK, &presenter.Table{\n\t\t// TableID: res.TableID,\n\t\tCapacity: res.Capacity,\n\t})\n}", "func ExampleAlertRulesClient_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\tclient, err := armsecurityinsights.NewAlertRulesClient(\"d0cfe6b2-9ac0-4464-9919-dccaee2e48c0\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.Get(ctx,\n\t\t\"myRg\",\n\t\t\"myWorkspace\",\n\t\t\"myFirstFusionRule\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "func getStatusRuleHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\n\tcontent, err := getRuleStatus(name)\n\tif err != nil {\n\t\thandleError(w, err, \"get rule status error\", logger)\n\t\treturn\n\t}\n\tw.Header().Set(ContentType, ContentTypeJSON)\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(content))\n}", "func (th *TableHandler) GetTables(c echo.Context) (err error) {\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\tlimit, offset, err := getLimitAndOffest(c)\n\tif err != nil {\n\t\tzap.L().Error(errInvalidRequest.Error(), zap.Error(err))\n\t\treturn c.JSON(http.StatusBadRequest, presenter.ErrResp(reqID, err))\n\t}\n\t// Query database\n\tdata, err := th.dbSvc.ListTables(c.Request().Context(), limit, offset)\n\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Map response fields\n\tvar tables []*presenter.Table\n\tfor _, d := range data {\n\t\ttables = append(tables, &presenter.Table{\n\t\t\tTableID: d.TableID,\n\t\t\tCapacity: d.Capacity,\n\t\t})\n\t}\n\n\t// Return ok\n\treturn c.JSON(http.StatusOK, tables)\n}", "func ExampleRulesClient_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\tclient, err := armcdn.NewRulesClient(\"subid\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.Get(ctx,\n\t\t\"RG\",\n\t\t\"profile1\",\n\t\t\"ruleSet1\",\n\t\t\"rule1\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "func ListTablesHandler(w http.ResponseWriter, req *http.Request) {\n\tif bbpd_runinfo.BBPDAbortIfClosed(w) {\n\t\treturn\n\t}\n\tif req.Method == \"GET\" {\n\t\tlistTables_GET_Handler(w, req)\n\t} else if req.Method == \"POST\" {\n\t\tlistTables_POST_Handler(w, req)\n\t} else {\n\t\te := fmt.Sprintf(\"list_tables_route.ListTablesHandler:bad method %s\", req.Method)\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t}\n}", "func httpHandleRouteRuleFunc(c *gin.Context) {\r\n\tc.JSON(http.StatusOK, listRouteRule())\r\n}", "func GetRulesOfResource(resource string) []Rule {\n\tupdateMux.RLock()\n\tresRules, ok := breakerRules[resource]\n\tupdateMux.RUnlock()\n\tif !ok {\n\t\treturn nil\n\t}\n\tret := make([]Rule, 0, len(resRules))\n\tfor _, rule := range resRules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func (t *AreaTopology) Rules(target NodeID, mapping map[NodeID]string) []Rule {\n\tfor _, area := range t.areas {\n\t\tfor node, links := range area.nodes {\n\t\t\tif node.Name == target {\n\t\t\t\trules := make([]Rule, 0, len(links))\n\t\t\t\tfor _, link := range links {\n\t\t\t\t\trules = append(rules, Rule{\n\t\t\t\t\t\tIP: mapping[link.Distant.Name],\n\t\t\t\t\t\tDelay: link.Delay,\n\t\t\t\t\t\tLoss: link.Loss,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\treturn rules\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (in *IstioClient) GetRouteRules(namespace string, serviceName string) ([]IstioObject, error) {\n\tresult, err := in.istioConfigApi.Get().Namespace(namespace).Resource(routeRules).Do().Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trulesList, ok := result.(*RouteRuleList)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%s/%s doesn't return a RouteRule list\", namespace, serviceName)\n\t}\n\n\trouterRules := make([]IstioObject, 0)\n\tfor _, rule := range rulesList.GetItems() {\n\t\tappendRule := serviceName == \"\"\n\t\tif !appendRule && FilterByDestination(rule.GetSpec(), namespace, serviceName, \"\") {\n\t\t\tappendRule = true\n\t\t}\n\t\tif appendRule {\n\t\t\trouterRules = append(routerRules, rule.DeepCopyIstioObject())\n\t\t}\n\t}\n\treturn routerRules, nil\n}", "func (api *API) DiscoveryRulesGet(params Params) (res LLDRules, err error) {\n\tif _, present := params[\"output\"]; !present {\n\t\tparams[\"output\"] = \"extend\"\n\t}\n\terr = api.CallWithErrorParse(\"discoveryrule.get\", params, &res)\n\treturn\n}", "func (s *Server) handler(req *http.Request) http.Handler {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tfor _, r := range s.rules {\n\t\tif r.Match(req) {\n\t\t\treturn r.Handler()\n\t\t}\n\t}\n\treturn nil\n}", "func (se *StorageEndpoint) LoadRules(f func(k, v string)) error {\n\treturn se.loadRangeByPrefix(rulesPath+\"/\", f)\n}", "func (nfr *nfRules) GetRuleHandle(id uint32) (uint64, error) {\n\trules, err := nfr.conn.GetRule(nfr.table, nfr.chain)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor _, rule := range rules {\n\t\tif rule.UserData != nil {\n\t\t\t// Rule ID TLV is stored in last 4 bytes of User data\n\t\t\tn := make([]byte, 4)\n\t\t\t// Rule ID TLV 4 bytes:\n\t\t\t// [0] - TLV type , must be 0x2\n\t\t\t// [1] - Value length, must be 2\n\t\t\t// [2:] - 2 bytes carrying Rule ID\n\t\t\tif rule.UserData[len(rule.UserData)-4] != 0x2 || rule.UserData[len(rule.UserData)-3] != 0x2 {\n\t\t\t\treturn 0, fmt.Errorf(\"did not find Rule ID TLV in user data\")\n\t\t\t}\n\t\t\t// Copy last 2 bytes of user data which carry rule id\n\t\t\tcopy(n[2:], rule.UserData[len(rule.UserData)-2:])\n\t\t\truleID := binaryutil.BigEndian.Uint32(n)\n\t\t\tif ruleID == id {\n\t\t\t\treturn rule.Handle, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0, fmt.Errorf(\"rule with id %d is not found\", id)\n}", "func (vr *VirtualResource) Rules(id string) ([]Rule, error) {\n\tresp, err := vr.doRequest(\"GET\", id+\"/rule\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif err := vr.readError(resp); err != nil {\n\t\treturn nil, err\n\t}\n\tvar rules []Rule\n\tdec := json.NewDecoder(resp.Body)\n\tif err := dec.Decode(&rules); err != nil {\n\t\treturn nil, err\n\t}\n\treturn rules, nil\n}", "func GetRule(id string) (*Rule, error) {\n\tvar rule Rule\n\tfilters := map[string]interface{}{\"_id\": id}\n\terr := database.Client.GetOne(ruleTable, &rule, filters)\n\treturn &rule, err\n}", "func (client GroupClient) GetTableResponder(resp *http.Response) (result USQLTable, 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}", "func (c Control) ServeRules(w http.ResponseWriter, r *http.Request) {\n\ttemplate := map[string]interface{}{}\n\n\t// Encode the rules as JSON and put them in the template.\n\tc.Config.RLock()\n\tencoded, _ := json.Marshal(c.Config.Rules)\n\tc.Config.RUnlock()\n\ttemplate[\"rules\"] = string(encoded)\n\n\tserveTemplate(w, r, \"rules\", template)\n}", "func UnmarshalRulesGet(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(RulesGet)\n\terr = core.UnmarshalPrimitive(m, \"enabled\", &obj.Enabled)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"event_type_filter\", &obj.EventTypeFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"notification_filter\", &obj.NotificationFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (s *RestServer) getL2FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request L2FlowBehavioralMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "func (a *UnsupportedApiService) ApplicationsDnsRulesGET(ctx context.Context, appInstanceId string) ([]DnsRule, *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 []DnsRule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/applications/{appInstanceId}/dns_rules\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"appInstanceId\"+\"}\", fmt.Sprintf(\"%v\", appInstanceId), -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\", \"text/plain\"}\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 []DnsRule\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 == 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\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func doGetAccessRules(targetURL string) (r map[string]string, err *probe.Error) {\n\tclnt, err := newClient(targetURL)\n\tif err != nil {\n\t\treturn map[string]string{}, err.Trace(targetURL)\n\t}\n\treturn clnt.GetAccessRules()\n}", "func (client GroupClient) GetTableValuedFunctionResponder(resp *http.Response) (result USQLTableValuedFunction, 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}", "func (o HttpOutput) Rules() HttpRuleArrayOutput {\n\treturn o.ApplyT(func(v Http) []HttpRule { return v.Rules }).(HttpRuleArrayOutput)\n}", "func (client *FirewallRulesClient) getHandleResponse(resp *azcore.Response) (FirewallRulesGetResponse, error) {\n\tresult := FirewallRulesGetResponse{RawResponse: resp.Response}\n\tif err := resp.UnmarshalAsJSON(&result.FirewallRule); err != nil {\n\t\treturn FirewallRulesGetResponse{}, err\n\t}\n\treturn result, nil\n}", "func ruleHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\trule, err := ruleProcessor.GetRuleJson(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Describe rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Add(ContentType, ContentTypeJSON)\n\t\tw.Write([]byte(rule))\n\tcase http.MethodDelete:\n\t\tdeleteRule(name)\n\t\tcontent, err := ruleProcessor.ExecDrop(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Delete rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(content))\n\tcase http.MethodPut:\n\t\t_, err := ruleProcessor.GetRuleById(name)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Rule not found\", logger)\n\t\t\treturn\n\t\t}\n\n\t\tbody, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Invalid body\", logger)\n\t\t\treturn\n\t\t}\n\t\terr = updateRule(name, string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Update rule error\", logger)\n\t\t\treturn\n\t\t}\n\t\t// Update to db after validation\n\t\t_, err = ruleProcessor.ExecUpdate(name, string(body))\n\t\tif err != nil {\n\t\t\thandleError(w, err, \"Update rule error, suggest to delete it and recreate\", logger)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, \"Rule %s was updated successfully.\", name)\n\t}\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules {\n\ttqsc.mu.Lock()\n\tdefer tqsc.mu.Unlock()\n\treturn tqsc.queryRulesMap[ruleSource]\n}", "func (r *Router) ListRules(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tvar readableRules []config.RuleConfig\n\tfor _, s := range r.services {\n\t\tfor _, rule := range s.Proxy.GetRules() {\n\t\t\t// Convert to human-readable\n\t\t\tc := rule.ToConfig()\n\t\t\treadableRules = append(readableRules, c)\n\t\t}\n\t}\n\tlog.WithField(\"rules\", readableRules).Debug(\"List rules:\")\n\t// Write it out\n\te := json.NewEncoder(w)\n\tif e.Encode(readableRules) != nil {\n\t\tlog.Error(\"Error encoding router rules to JSON\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Encoding rules problem\"))\n\t}\n}", "func (s *RestServer) getIPv4FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request IPv4FlowBehavioralMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "func (a *BackendOptionsApiService) GetHTTPRequestRules(ctx _context.Context, parentName string, parentType string, localVarOptionals *GetHTTPRequestRulesOpts) (InlineResponse20012, *_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 InlineResponse20012\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/http_request_rules\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"parent_name\", parameterToString(parentName, \"\"))\n\tlocalVarQueryParams.Add(\"parent_type\", parameterToString(parentType, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\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\"}\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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20012\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 ModelError\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}", "func (r *rulesRPCHandler) ListRules(ctx context.Context, req *api.ListReq) (*api.RuleList, error) {\n\trules := api.RuleList{}\n\tif err := clients[0].List(ctx, \"/rules\", &rules); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rules, nil\n}", "func (qri *QueryRuleInfo) GetRules(ruleSource string) (*QueryRules, error) {\n\tqri.mu.Lock()\n\tdefer qri.mu.Unlock()\n\tif ruleset, ok := qri.queryRulesMap[ruleSource]; ok {\n\t\treturn ruleset.Copy(), nil\n\t}\n\treturn NewQueryRules(), errors.New(\"Rule source identifier \" + ruleSource + \" is not valid\")\n}", "func (fn GetStickTableHandlerFunc) Handle(params GetStickTableParams, principal interface{}) middleware.Responder {\n\treturn fn(params, principal)\n}", "func (c *Client) GetRules(o Organization, p Project) ([]Rule, error) {\n\tvar rules []Rule\n\n\terr := c.do(\"GET\", fmt.Sprintf(\"projects/%s/%s/rules\", *o.Slug, *p.Slug), &rules, nil)\n\treturn rules, err\n}", "func (r *Resource) getAllHandler(c *gin.Context) {\n // get restaurant_id query param (empty string if not provided)\n restaurantID := c.Query(\"restaurant_id\")\n\n // return all tables if no restaurant_id query param, else get all tables\n // for specific restaurant\n if restaurantID == \"\" {\n // fetch all from database\n tables, err := r.db.GetAllTables()\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, tables)\n } else {\n // parse restaurant ID query param\n id, err := strconv.ParseInt(\n restaurantID,\n 10,\n 64,\n )\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": \"Bad ID\"})\n return\n }\n\n // fetch all from database\n tables, err := r.db.GetAllTablesForRestaurantID(id)\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, tables)\n }\n}", "func generateHandler(w http.ResponseWriter, r *http.Request) {\n\tpath := r.URL.Path[1:]\n\trequest := urlParser.ParseURL(path)\n\n\ttableName := request.TableName\n\tfields := request.Fields\n\n\t//only valid names are existing tables in db\n\tif !structs.ValidStruct[tableName] {\n\t\tfmt.Printf(\"\\\"%s\\\" table not found.\\n\", tableName)\n\n\t\thttp.NotFound(w, r)\n\t} else {\n\t\tfmt.Printf(\"\\\"%s\\\" table found.\\n\", tableName)\n\n\t\trows := sqlParser.GetRows(tableName, fields)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tif fields == \"\" {\n\t\t\tfmt.Printf(\"No fields\\n\")\n\t\t\tstructs.MapTableToJson(tableName, rows, w)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\n\", fields)\n\t\t\tfieldArray := strings.Split(fields, \",\")\n\t\t\tstructFilter.MapCustomTableToJson(tableName, rows, w, fieldArray)\n\t\t}\n\t}\n}", "func (s *Service) GetRule(ruleName string, params map[string]string, response handle.ResponseHandle) error {\n\treturn getRule(s.client, ruleName, params, response)\n}", "func (a *UnsupportedApiService) ApplicationsTrafficRuleGET(ctx context.Context, appInstanceId string, trafficRuleId string) (TrafficRule, *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 TrafficRule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/applications/{appInstanceId}/traffic_rules/{trafficRuleId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"appInstanceId\"+\"}\", fmt.Sprintf(\"%v\", appInstanceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"trafficRuleId\"+\"}\", fmt.Sprintf(\"%v\", trafficRuleId), -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\", \"text/plain\"}\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 TrafficRule\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 == 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\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (o BackendResponseOutput) Rules() BackendRuleResponseArrayOutput {\n\treturn o.ApplyT(func(v BackendResponse) []BackendRuleResponse { return v.Rules }).(BackendRuleResponseArrayOutput)\n}", "func (a *BackendOptionsApiService) GetServerSwitchingRules(ctx _context.Context, backend string, localVarOptionals *GetServerSwitchingRulesOpts) (InlineResponse20022, *_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 InlineResponse20022\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/server_switching_rules\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"backend\", parameterToString(backend, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\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\"}\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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20022\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 ModelError\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}", "func (h *GetStickTablesHandlerImpl) Handle(params stick_table.GetStickTablesParams, principal interface{}) middleware.Responder {\n\tprocess := 0\n\tif params.Process != nil {\n\t\tprocess = int(*params.Process)\n\t}\n\n\truntime, err := h.Client.Runtime()\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn stick_table.NewGetStickTablesDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tstkTS, err := runtime.ShowTables(process)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn stick_table.NewGetStickTablesDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tfor _, table := range stkTS {\n\t\ttable.Fields = findTableFields(table.Name, h.Client)\n\t}\n\n\treturn stick_table.NewGetStickTablesOK().WithPayload(stkTS)\n}", "func MakeHandler(svc Service, opts ...kithttp.ServerOption) http.Handler {\n\tr := mux.NewRouter()\n\tr.StrictSlash(true)\n\n\tr.Methods(\"GET\").Path(`/`).Name(\"ruleList\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tlistEndpoint(svc),\n\t\t\tdecodeListRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\topts...,\n\t\t),\n\t)\n\n\tr.Methods(\"GET\").Path(`/{id:[a-zA-Z0-9]+}`).Name(\"ruleGet\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tgetEndpoint(svc),\n\t\t\tdecodeGetRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/activate`).Name(\"ruleActivate\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tactivateEndpoint(svc),\n\t\t\tdecodeActivateRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/deactivate`).Name(\"ruleDeactivate\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tdeactivateEndpoint(svc),\n\t\t\tdecodeDeactivateRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\tr.Methods(\"PUT\").Path(`/{id:[a-zA-Z0-9]+}/rollout`).Name(\"ruleUpdateRollout\").Handler(\n\t\tkithttp.NewServer(\n\t\t\tupdateRolloutEndpoint(svc),\n\t\t\tdecodeUpdateRolloutRequest,\n\t\t\tkithttp.EncodeJSONResponse,\n\t\t\tappend(\n\t\t\t\topts,\n\t\t\t\tkithttp.ServerBefore(extractMuxVars(varID)),\n\t\t\t)...,\n\t\t),\n\t)\n\n\treturn r\n}", "func (ks *kuiperService) ListRules(ctx context.Context, token string, offset, limit uint64, name string, metadata Metadata) (RulesPage, error) {\n\tres, err := ks.auth.Identify(ctx, &mainflux.Token{Value: token})\n\tif err != nil {\n\t\treturn RulesPage{}, ErrUnauthorizedAccess\n\t}\n\n\treturn ks.rules.RetrieveAll(ctx, res.GetValue(), offset, limit, name, metadata)\n}", "func (o HttpResponseOutput) Rules() HttpRuleResponseArrayOutput {\n\treturn o.ApplyT(func(v HttpResponse) []HttpRuleResponse { return v.Rules }).(HttpRuleResponseArrayOutput)\n}", "func (m *moduleService) Rules() *Rules {\n\treturn m.rules\n}", "func (p *k8sUpdate) CreateRules() ([]string, error) {\n\t// Build URL list\n\tvar urls []string\n\tfor _, svc := range p.services {\n\t\tann, ok := svc.Annotations[metricsAnnotation]\n\t\tif !ok || ann == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar metricsRecords []api.MetricsServiceRecord\n\t\tif err := json.Unmarshal([]byte(ann), &metricsRecords); err != nil {\n\t\t\tp.log.Errorf(\"Failed to unmarshal metrics annotation in service '%s.%s': %#v\", svc.Namespace, svc.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get service IP\n\t\tif svc.Spec.Type != k8s.ServiceTypeClusterIP {\n\t\t\tp.log.Errorf(\"Cannot put metrics rules in services of type other than ClusterIP ('%s.%s')\", svc.Namespace, svc.Name)\n\t\t\tcontinue\n\t\t}\n\t\tclusterIP := svc.Spec.ClusterIP\n\n\t\t// Collect URLs\n\t\tfor _, m := range metricsRecords {\n\t\t\tif m.RulesPath == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tu := url.URL{\n\t\t\t\tScheme: \"http\",\n\t\t\t\tHost: net.JoinHostPort(clusterIP, strconv.Itoa(m.ServicePort)),\n\t\t\t\tPath: m.RulesPath,\n\t\t\t}\n\t\t\turls = append(urls, u.String())\n\t\t}\n\t}\n\n\tif len(urls) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Fetch rules from URLs\n\trulesChan := make(chan string, len(urls))\n\twg := sync.WaitGroup{}\n\tfor _, url := range urls {\n\t\twg.Add(1)\n\t\tgo func(url string) {\n\t\t\tdefer wg.Done()\n\t\t\tp.log.Debugf(\"fetching rules from %s\", url)\n\t\t\tresp, err := http.Get(url)\n\t\t\tif err != nil {\n\t\t\t\tp.log.Errorf(\"Failed to fetch rule from '%s': %#v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\t\t\tp.log.Errorf(\"Failed to fetch rule from '%s': Status %d\", url, resp.StatusCode)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\traw, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tp.log.Errorf(\"Failed to read rule from '%s': %#v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trulesChan <- string(raw)\n\t\t\tp.log.Debugf(\"done fetching rules from %s\", url)\n\t\t}(url)\n\t}\n\n\twg.Wait()\n\tclose(rulesChan)\n\tvar result []string\n\tfor rule := range rulesChan {\n\t\tresult = append(result, rule)\n\t}\n\tp.log.Debugf(\"Found %d rules\", len(result))\n\n\treturn result, nil\n}", "func listTables_POST_Handler(w http.ResponseWriter, req *http.Request) {\n\tstart := time.Now()\n\tpathElts := strings.Split(req.URL.Path, \"/\")\n\tif len(pathElts) != 2 {\n\t\te := \"list_tables_route.listTables_POST_Handler:cannot parse path. try /batch-get-item\"\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbodybytes, read_err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif read_err != nil && read_err != io.EOF {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler err reading req body: %s\", read_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar l list.List\n\n\tum_err := json.Unmarshal(bodybytes, &l)\n\tif um_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler unmarshal err on %s to Get %s\", string(bodybytes), um_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresp_body, code, resp_err := l.EndpointReq()\n\n\tif resp_err != nil {\n\t\te := fmt.Sprintf(\"list_table_route.ListTable_POST_Handler:err %s\",\n\t\t\tresp_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif ep.HttpErr(code) {\n\t\troute_response.WriteError(w, code, \"list_table_route.ListTable_POST_Handler\", resp_body)\n\t\treturn\n\t}\n\n\tmr_err := route_response.MakeRouteResponse(\n\t\tw,\n\t\treq,\n\t\tresp_body,\n\t\tcode,\n\t\tstart,\n\t\tlist.ENDPOINT_NAME)\n\tif mr_err != nil {\n\t\te := fmt.Sprintf(\"list_tables_route.listTables_POST_Handler %s\",\n\t\t\tmr_err.Error())\n\t\tlog.Printf(e)\n\t\thttp.Error(w, e, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (o BucketWebsitePtrOutput) RoutingRules() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *BucketWebsite) interface{} {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RoutingRules\n\t}).(pulumi.AnyOutput)\n}", "func (o ApplicationOutput) DispatchRules() UrlDispatchRuleResponseArrayOutput {\n\treturn o.ApplyT(func(v *Application) UrlDispatchRuleResponseArrayOutput { return v.DispatchRules }).(UrlDispatchRuleResponseArrayOutput)\n}", "func (s *RestServer) getIPv6FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request IPv6FlowBehavioralMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "func (rs *RuleSet) ListRules() (rules []Rule, err error) {\n\treturn rs.Rules, nil\n}", "func (client *Client) GetMiddlewareRules() ([]*mwRule.Rule, error) {\n\tresp, err := client.v3.Get(client.ctx, \"/eve/mwrules\", clientv3.WithPrefix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trules := make([]*mwRule.Rule, 0, resp.Count)\n\tfor _, kv := range resp.Kvs {\n\t\trule, err := client.parseMwRule(kv)\n\t\tif err != nil {\n\t\t\tlog.Print(\"Error: \", err)\n\t\t\tcontinue\n\t\t}\n\t\trules = append(rules, rule)\n\t}\n\treturn rules, nil\n}", "func HandleDeleteTable(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\tcrud := modules.DB()\n\t\tif err := crud.DeleteTable(ctx, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetDeleteCollection(ctx, projectID, dbAlias, col); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func TestHandler_Tables(t *testing.T) {\n\tdb := pie.NewDatabase()\n\th := pie.NewHandler(db)\n\tw := httptest.NewRecorder()\n\n\t// Create tables.\n\tdb.CreateTable(\"bob\", nil)\n\tdb.CreateTable(\"susy\", nil)\n\n\t// Retrieve list of tables.\n\tr, _ := http.NewRequest(\"GET\", \"/tables\", nil)\n\th.ServeHTTP(w, r)\n\n\t// Verify the request was successful.\n\tif w.Code != http.StatusOK {\n\t\tt.Fatalf(\"unexpected status: %d\", w)\n\t} else if !strings.Contains(w.Body.String(), `<li><a href=\"/tables/bob\">bob</a></li>`) {\n\t\tt.Fatalf(\"table 'bob' not found\")\n\t} else if !strings.Contains(w.Body.String(), `<li><a href=\"/tables/susy\">susy</a></li>`) {\n\t\tt.Fatalf(\"table 'susy' not found\")\n\t}\n}", "func (s *Manager) GetEventingTriggerRules(ctx context.Context, project, id string, params model.RequestParams) (int, []interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, nil, err\n\t}\n\n\tif id != \"*\" {\n\t\tservice, ok := projectConfig.Modules.Eventing.Rules[id]\n\t\tif !ok {\n\t\t\treturn http.StatusBadRequest, nil, helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf(\"Trigger rule (%s) does not exists for eventing config\", id), nil, nil)\n\t\t}\n\t\treturn http.StatusOK, []interface{}{service}, nil\n\t}\n\n\tservices := []interface{}{}\n\tfor _, value := range projectConfig.Modules.Eventing.Rules {\n\t\tservices = append(services, value)\n\t}\n\treturn http.StatusOK, services, nil\n}", "func (r *rulesRPCHandler) WatchRules(req *api.WatchReq, server api.Rules_WatchRulesServer) error {\n\tch := make(chan *kvstore.WatchEvent, 0)\n\tr.addWatcher(ch)\n\tfor in := range ch {\n\t\tout := &api.Event{\n\t\t\tRule: in.Object.(*api.Rule),\n\t\t}\n\t\tswitch in.Type {\n\t\tcase kvstore.Created:\n\t\t\tout.Type = api.Event_Created\n\t\tcase kvstore.Updated:\n\t\t\tout.Type = api.Event_Updated\n\t\tcase kvstore.Deleted:\n\t\t\tout.Type = api.Event_Deleted\n\t\t}\n\t\tif err := server.Send(out); err != nil {\n\t\t\tlog.Errorf(\"Error sending event %v, %v\", in, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetTableContentController(c *fiber.Ctx) error {\n\n\t// init and parse the request object\n\tobj := getTableContentRequest{\n\t\tTableName: c.Query(\"table_name\", \"\"),\n\t}\n\n\t// check request\n\tif !checkGetTableContentRequest(obj) {\n\t\tres, _ := models.GetJSONResponse(\"Wrong JSON syntax\", \"#d41717\", \"ok\", \"None\", 200)\n\t\treturn c.Send(res)\n\t}\n\n\t// check login\n\tif ok, ident := middleware.ValidateAccessToken(c); ok {\n\n\t\ttbl := actions.GetTableByName(obj.TableName).MinPermLvl\n\n\t\tconn := actions.GetConn()\n\t\tdefer conn.Close()\n\n\t\t// check if permission of user is high enough\n\t\tif !actions.CheckUserHasHigherPermission(conn, ident, tbl, \"\") {\n\t\t\tres, _ := models.GetJSONResponse(\"Your permission is not high enough\", \"#d41717\", \"ok\", \"None\", 200)\n\t\t\treturn c.Send(res)\n\t\t}\n\n\t\t// query table as json\n\t\tstmt := \"SELECT * FROM `table_\" + obj.TableName + \"`;\"\n\t\tjson, err := utils.QueryToJson(conn, stmt)\n\n\t\tif err != nil {\n\t\t\tres, _ := models.GetJSONResponse(\"Invalid table name\", \"#d41717\", \"ok\", \"None\", 200)\n\t\t\treturn c.Send(res)\n\t\t}\n\n\t\treturn c.JSON(getTableContentResponse{\n\t\t\tMessage: \"successful\",\n\t\t\tAlert: \"#1db004\",\n\t\t\tStatus: \"ok\",\n\t\t\tHttpStatus: 200,\n\t\t\tElements: strings.ReplaceAll(strings.ReplaceAll(string(json), \"\\n\", \"\"), \"\\t\", \"\"),\n\t\t})\n\t}\n\n\tres, _ := models.GetJSONResponse(\"You do not have the permission to perform this\", \"alert alert-warning\", \"Failed\", \"None\", 200)\n\treturn c.Send(res)\n}", "func makeGetByMultiCriteriaHandler(m *mux.Router, endpoints endpoint.Endpoints, options []http.ServerOption) {\n\tm.Methods(\"GET\", \"OPTIONS\").Path(\"/employees/criteria/\").Handler(\n\t\thandlers.CORS(handlers.AllowedMethods([]string{\"GET\"}),\n\t\t\thandlers.AllowedHeaders([]string{\"Content-Type\", \"Content-Length\"}),\n\t\t\thandlers.AllowedOrigins([]string{\"*\"}),\n\t\t)(http.NewServer(endpoints.GetByMultiCriteriaEndpoint, decodeGetByMultiCriteriaRequest, encodeGetByMultiCriteriaResponse, options...)))\n}", "func (o HttpPtrOutput) Rules() HttpRuleArrayOutput {\n\treturn o.ApplyT(func(v *Http) []HttpRule {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Rules\n\t}).(HttpRuleArrayOutput)\n}", "func (a *BackendOptionsApiService) GetTCPResponseRules(ctx _context.Context, backend string, localVarOptionals *GetTCPResponseRulesOpts) (InlineResponse20018, *_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 InlineResponse20018\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/tcp_response_rules\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"backend\", parameterToString(backend, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\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\"}\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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20018\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 ModelError\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}", "func NewHandler(ctx context.Context, rsService store.RulesetService, cfg Config) http.Handler {\n\ts := service{\n\t\trulesets: rsService,\n\t}\n\n\tvar logger zerolog.Logger\n\n\tif cfg.Logger != nil {\n\t\tlogger = *cfg.Logger\n\t} else {\n\t\tlogger = zerolog.New(os.Stderr).With().Timestamp().Logger()\n\t}\n\n\tif cfg.Timeout == 0 {\n\t\tcfg.Timeout = 5 * time.Second\n\t}\n\n\tif cfg.WatchTimeout == 0 {\n\t\tcfg.WatchTimeout = 30 * time.Second\n\t}\n\n\trs := rulesetService{\n\t\tservice: &s,\n\t\ttimeout: cfg.Timeout,\n\t\twatchTimeout: cfg.WatchTimeout,\n\t}\n\n\t// router\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/rulesets/\", &rs)\n\n\t// middlewares\n\tchain := []func(http.Handler) http.Handler{\n\t\thlog.NewHandler(logger),\n\t\thlog.AccessHandler(func(r *http.Request, status, size int, duration time.Duration) {\n\t\t\thlog.FromRequest(r).Info().\n\t\t\t\tStr(\"method\", r.Method).\n\t\t\t\tStr(\"url\", r.URL.String()).\n\t\t\t\tInt(\"status\", status).\n\t\t\t\tInt(\"size\", size).\n\t\t\t\tDur(\"duration\", duration).\n\t\t\t\tMsg(\"request received\")\n\t\t}),\n\t\thlog.RemoteAddrHandler(\"ip\"),\n\t\thlog.UserAgentHandler(\"user_agent\"),\n\t\thlog.RefererHandler(\"referer\"),\n\t\tfunc(http.Handler) http.Handler {\n\t\t\treturn mux\n\t\t},\n\t}\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// playing the middleware chain\n\t\tvar cur http.Handler\n\t\tfor i := len(chain) - 1; i >= 0; i-- {\n\t\t\tcur = chain[i](cur)\n\t\t}\n\n\t\t// serving the request\n\t\tcur.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func Get(c *golangsdk.ServiceClient, policyID, ruleID string) (r GetResult) {\n\treqOpt := &golangsdk.RequestOpts{\n\t\tMoreHeaders: RequestOpts.MoreHeaders,\n\t}\n\n\t_, r.Err = c.Get(resourceURL(c, policyID, ruleID), &r.Body, reqOpt)\n\treturn\n}", "func (s *RestServer) listIPv4FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\titer, err := goproto.NewIPv4FlowBehavioralMetricsIterator()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get metrics, error: %s\", err)\n\t}\n\n\t// for OSX tests\n\tif iter == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar mtr []goproto.IPv4FlowBehavioralMetrics\n\n\tfor iter.HasNext() {\n\t\ttemp := iter.Next()\n\t\tif temp == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tobjMeta := s.GetObjectMeta(\"IPv4FlowBehavioralMetricsKey\", temp.GetKey())\n\t\tif objMeta == nil {\n\t\t\tlog.Errorf(\"failed to get objMeta for IPv4FlowBehavioralMetrics key %+v\", temp.GetKey())\n\t\t\tcontinue\n\t\t}\n\n\t\ttemp.ObjectMeta = *objMeta\n\t\tmtr = append(mtr, *temp)\n\t}\n\titer.Free()\n\treturn mtr, nil\n}", "func (s *prometheusruleWebhook) Rules() []admissionregv1.RuleWithOperations {\n\treturn rules\n}", "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, RequestMethodGet)\n}", "func (a *BackendOptionsApiService) GetStickRules(ctx _context.Context, backend string, localVarOptionals *GetStickRulesOpts) (InlineResponse20026, *_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 InlineResponse20026\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/stick_rules\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"backend\", parameterToString(backend, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\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\"}\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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20026\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 ModelError\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}", "func (client *FirewallRulesClient) listByServerHandleResponse(resp *azcore.Response) (FirewallRulesListByServerResponse, error) {\n\tresult := FirewallRulesListByServerResponse{RawResponse: resp.Response}\n\tif err := resp.UnmarshalAsJSON(&result.FirewallRuleListResult); err != nil {\n\t\treturn FirewallRulesListByServerResponse{}, err\n\t}\n\treturn result, nil\n}", "func GetRouteHandler(rw http.ResponseWriter, req *http.Request) {\n\tkey := mux.Vars(req)[\"key\"]\n\t// Retreive key from Redis.\n\tresp := client.Get(key)\n\turl, err := resp.Result()\n\tif err != nil {\n\t\tutil.WriteErrorResp(rw, http.StatusNotFound, \"Not Found!\")\n\t\treturn\n\t}\n\tredirect := util.Redirect{Key: key, Target: url}\n\tutil.WriterJSONResponse(rw, redirect)\n}", "func RoutingRulesPath() string {\n\treturn \"Routing/Rules\"\n}", "func (rules *Rules) ListOfRules() []Rule {\n\treturn rules.list\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}" ]
[ "0.69260275", "0.62734264", "0.5644939", "0.557043", "0.55194503", "0.54998934", "0.54833883", "0.54473406", "0.54217273", "0.5348677", "0.53371495", "0.5312679", "0.5264292", "0.52637553", "0.5258468", "0.5245055", "0.5222252", "0.5206832", "0.51762116", "0.5171938", "0.5120182", "0.5096055", "0.50805146", "0.5075808", "0.50751203", "0.504181", "0.5034034", "0.50254107", "0.5007228", "0.5006279", "0.5000473", "0.49715686", "0.49503475", "0.49480712", "0.4930827", "0.49092564", "0.48991367", "0.489265", "0.48916736", "0.48861554", "0.4882898", "0.48741323", "0.48725885", "0.48695028", "0.4850316", "0.48443016", "0.48434433", "0.48362914", "0.48353004", "0.48317334", "0.48162496", "0.47810185", "0.47569686", "0.47531375", "0.47320473", "0.47304705", "0.47166663", "0.47138658", "0.47106537", "0.47047696", "0.47013217", "0.47009388", "0.4699204", "0.46761778", "0.4672903", "0.4671209", "0.46623832", "0.46598345", "0.46577322", "0.46539715", "0.46464068", "0.46371675", "0.46306166", "0.46291646", "0.46260884", "0.46253064", "0.46144494", "0.4610032", "0.46005762", "0.4597248", "0.45668164", "0.45526502", "0.45495406", "0.45486206", "0.45456737", "0.45369464", "0.4531737", "0.4529074", "0.4524584", "0.45231724", "0.45181936", "0.45136103", "0.45025393", "0.4501888", "0.45016223", "0.4491279", "0.447881", "0.44749022", "0.447434", "0.44743335" ]
0.82049686
0
HandleReloadSchema is an endpoint handler which return & sets the schemas of all collection in config
func HandleReloadSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() schema := modules.Schema() colResult, err := syncman.SetReloadSchema(ctx, dbAlias, projectID, schema) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: colResult}) // return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Manager) SetReloadSchema(ctx context.Context, dbAlias, project string, schemaArg *schema.Schema) (map[string]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollectionConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn nil, errors.New(\"specified database not present in config\")\n\t}\n\tcolResult := map[string]interface{}{}\n\tfor colName, colValue := range collectionConfig.Collections {\n\t\tif colName == \"default\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult, err := schemaArg.SchemaInspection(ctx, dbAlias, project, colName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set new schema in config & return in response body\n\t\tcolValue.Schema = result\n\t\tcolResult[colName] = result\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn colResult, s.setProject(ctx, projectConfig)\n}", "func (tqsc *Controller) ReloadSchema(ctx context.Context) error {\n\treturn nil\n}", "func (s *Service) reloadSchema(pkg factset.Package, schemaVersion *factset.PackageVersion) error {\n\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Debugf(\"Reloading schema for package: %s\", pkg.Product)\n\tif err := s.db.DropTablesWithProductAndBundle(pkg.Product, pkg.Bundle); err != nil {\n\t\treturn err\n\t}\n\tschemaFileDetails := s.getSchemaDetails(pkg, schemaVersion)\n\tschemaFileArchive, err := s.factset.Download(*schemaFileDetails, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tschemaFiles, err := s.unzipFile(schemaFileArchive, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, file := range schemaFiles {\n\t\tif strings.HasSuffix(file, \".sql\") {\n\t\t\tfileContents, err := ioutil.ReadFile(file)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithFields(log.Fields{\"fs_product\": pkg.Product}).Errorf(\"Could not read file: %s\", file)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = s.db.CreateTablesFromSchema(fileContents, pkg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Infof(\"Updated schema for product %s to version v%d_%d\", pkg.Product, schemaVersion.FeedVersion, schemaVersion.Sequence)\n\t\t}\n\t}\n\treturn nil\n}", "func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func ReloadSchema() {\n\tdefer logError()\n\tSqlQueryRpcService.qe.schemaInfo.triggerReload()\n}", "func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\tif err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func SchemaUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tupdatedSchema := schemas.Schema{}\n\n\terr = json.NewDecoder(r.Body).Decode(&updatedSchema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif updatedSchema.FullName != \"\" {\n\t\t_, schemaName, err := schemas.ExtractSchema(updatedSchema.FullName)\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tupdatedSchema.Name = schemaName\n\t}\n\n\tschema, err := schemas.Update(schemasList.Schemas[0], updatedSchema.Name, updatedSchema.Type, updatedSchema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func (db *Database) RefreshSchema() error {\n\t// Get schema from query\n\trows, err := db.runQuery(\"SELECT teleport.get_schema();\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\n\t// Read schema content from sql.Row\n\tvar schemaContent []byte\n\trows.Next()\n\terr = rows.Scan(&schemaContent)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse schema\n\tvar schemas Schemas\n\tschemas, err = ParseSchema(string(schemaContent))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, schema := range schemas {\n\t\tdb.Schemas[schema.Name] = schema\n\t\tschema.Db = db\n\t}\n\n\treturn nil\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func HandleInspectCollectionSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tcol := vars[\"col\"]\n\t\tprojectID := vars[\"project\"]\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\ts, err := schema.SchemaInspection(ctx, dbAlias, logicalDBName, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetSchemaInspection(ctx, projectID, dbAlias, col, s); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: s})\n\t\t// return\n\t}\n}", "func (s *Store) reregisterSchemas() error {\n\tresults, err := s.datastore.Query(query.Query{\n\t\tPrefix: dsStoreSchemas.String(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer results.Close()\n\n\tfor res := range results.Next() {\n\t\tname := ds.RawKey(res.Key).Name()\n\t\tvar indexes []*IndexConfig\n\t\tindex, err := s.datastore.Get(dsStoreIndexes.ChildString(name))\n\t\tif err == nil && index != nil {\n\t\t\t_ = json.Unmarshal(index, &indexes)\n\t\t}\n\t\tif _, err := s.RegisterSchema(name, string(res.Value), indexes...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func updateSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tif params.database == schema.DryrunDBName {\n\t\tp := *params\n\t\tif err := doCreateDatabase(p, p.database); err != nil {\n\t\t\treturn handleErr(fmt.Errorf(\"error creating dryrun database: %v\", err))\n\t\t}\n\t\tdefer doDropDatabase(p, p.database)\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Update(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func SchemaListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", \"\", refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList, \"\", \" \")\n\trespondOK(w, output)\n}", "func (s *Manager) GetSchemas(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ttype response struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {Schema: collectionInfo.Schema}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{Schema: value.Schema}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{Schema: value.Schema}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}", "func LoadSchema(q graphql.Querier) error {\n\tif schema != nil {\n\t\treturn nil\n\t}\n\n\trespBody, err := q.Query(schemaQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar introspection introspection\n\tif err := json.Unmarshal(respBody, &introspection); err != nil {\n\t\treturn err\n\t}\n\n\tschema = &introspection.Data.Schema\n\n\treturn nil\n}", "func (s *Manager) SetModifyAllSchema(ctx context.Context, dbAlias, project string, v config.CrudStub) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.applySchemas(ctx, project, dbAlias, projectConfig, v); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func hookConfigurationSchema() *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeList,\n\t\tOptional: true,\n\t\tMaxItems: 1,\n\t\tElem: &schema.Resource{\n\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\"invocation_condition\": func() *schema.Schema {\n\t\t\t\t\tschema := documentAttributeConditionSchema()\n\t\t\t\t\treturn schema\n\t\t\t\t}(),\n\t\t\t\t\"lambda_arn\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: verify.ValidARN,\n\t\t\t\t},\n\t\t\t\t\"s3_bucket\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: validation.All(\n\t\t\t\t\t\tvalidation.StringLenBetween(3, 63),\n\t\t\t\t\t\tvalidation.StringMatch(\n\t\t\t\t\t\t\tregexp.MustCompile(`[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]`),\n\t\t\t\t\t\t\t\"Must be a valid bucket name\",\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}", "func (manager *Manager) loadSchemaFromFile(filePath string) error {\n\tif filePath == \"\" {\n\t\treturn nil\n\t}\n\tlog.Info(\"Loading schema %s ...\", filePath)\n\tschemas, err := util.LoadMap(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnamespaces, _ := schemas[\"namespaces\"].([]interface{})\n\tfor _, namespaceData := range namespaces {\n\t\tnamespace, err := NewNamespace(namespaceData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = manager.registerNamespace(namespace); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tschemaObjList := []*Schema{}\n\tschemaMap := map[string]*Schema{}\n\tlist, _ := schemas[\"schemas\"].([]interface{})\n\tfor _, schemaData := range list {\n\t\tif fileName, ok := schemaData.(string); ok {\n\t\t\terr := manager.loadSchemaFromFile(fileName) // recursive call for included files\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tmetaschema, _ := manager.schema(\"schema\")\n\t\t\tschemaObj, err := newSchemaFromObj(schemaData, metaschema)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tschemaMap[schemaObj.ID] = schemaObj\n\t\t\tschemaObjList = append(schemaObjList, schemaObj)\n\t\t}\n\t}\n\t_, err = reorderSchemas(schemaObjList)\n\tif err != nil {\n\t\tlog.Warning(\"Error in reordering schema %s\", err)\n\t}\n\tfor _, schemaObj := range schemaObjList {\n\t\tif schemaObj.IsAbstract() {\n\t\t\t// Register abstract schema\n\t\t\tmanager.registerSchema(schemaObj)\n\t\t} else {\n\t\t\tfor _, baseSchemaID := range schemaObj.Extends {\n\t\t\t\tbaseSchema, ok := manager.schema(baseSchemaID)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fmt.Errorf(\"Base Schema %s not found\", baseSchemaID)\n\t\t\t\t}\n\t\t\t\tif !baseSchema.IsAbstract() {\n\t\t\t\t\treturn fmt.Errorf(\"Base Schema %s isn't abstract type\", baseSchemaID)\n\t\t\t\t}\n\t\t\t\tschemaObj.Extend(baseSchema)\n\t\t\t}\n\t\t}\n\t}\n\t// Reorder schema by relation topology\n\tschemaOrder, err := reorderSchemas(schemaObjList)\n\tif err != nil {\n\t\tlog.Warning(\"Error in reordering schema %s\", err)\n\t}\n\n\tfor _, id := range schemaOrder {\n\t\tschemaObj := schemaMap[id]\n\t\tif !schemaObj.IsAbstract() {\n\t\t\terr = manager.registerSchema(schemaObj)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tpolicies, _ := schemas[\"policies\"].([]interface{})\n\tif policies != nil {\n\t\tfor _, policyData := range policies {\n\t\t\tpolicy, err := NewPolicy(policyData)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmanager.policies = append(manager.policies, policy)\n\t\t}\n\t}\n\textensions, _ := schemas[\"extensions\"].([]interface{})\n\tif extensions == nil {\n\t\treturn nil\n\t}\n\n\tfor _, extensionData := range extensions {\n\t\td := extensionData.(map[string](interface{}))\n\t\trawurl, ok := d[\"url\"].(string)\n\t\tif ok {\n\t\t\td[\"url\"], err = fixRelativeURL(rawurl, filepath.Dir(filePath))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\textension, err := NewExtension(extensionData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\textension.File = filePath\n\t\tmanager.Extensions = append(manager.Extensions, extension)\n\t}\n\n\treturn nil\n}", "func Reload(w http.ResponseWriter, r *http.Request) {\n\tlog.Debugf(\"Reload called\")\n\t_, err := server.Reload(false)\n\tif err != nil {\n\t\t//failed to reload the config from DB\n\t\tlog.Debugf(\"Reload failed with error %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusInternalServerError, \"Failed to reload the auth config\")\n\t\treturn\n\t}\n}", "func Update(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tfor i, elem := range schema {\n\t\tif elem.Config.Name == params[\"name\"] {\n\t\t\tschema = append(schema[:i], schema[i+1:]...)\n\t\t\tvar updateSchema Schema\n\t\t\tjson.NewDecoder(r.Body).Decode(&updateSchema)\n\t\t\tupdateSchema.Config.Name = params[\"name\"]\n\t\t\tschema = append(schema, updateSchema)\n\t\t\tjson.NewEncoder(w).Encode(updateSchema)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (service *Service) populateFromSchema() {\n\tschema := service.schema\n\tservice.name = schema.Name\n\tservice.version = schema.Version\n\tservice.fullname = joinVersionToName(service.name, service.version)\n\tservice.dependencies = schema.Dependencies\n\tservice.settings = schema.Settings\n\tif service.settings == nil {\n\t\tservice.settings = make(map[string]interface{})\n\t}\n\tservice.metadata = schema.Metadata\n\tif service.metadata == nil {\n\t\tservice.metadata = make(map[string]interface{})\n\t}\n\n\tservice.actions = make([]Action, len(schema.Actions))\n\tfor index, actionSchema := range schema.Actions {\n\t\tservice.actions[index] = CreateServiceAction(\n\t\t\tservice.fullname,\n\t\t\tactionSchema.Name,\n\t\t\tactionSchema.Handler,\n\t\t\tactionSchema.Schema,\n\t\t)\n\t}\n\n\tservice.events = make([]Event, len(schema.Events))\n\tfor index, eventSchema := range schema.Events {\n\t\tgroup := eventSchema.Group\n\t\tif group == \"\" {\n\t\t\tgroup = service.Name()\n\t\t}\n\t\tservice.events[index] = Event{\n\t\t\tname: eventSchema.Name,\n\t\t\tserviceName: service.Name(),\n\t\t\tgroup: group,\n\t\t\thandler: eventSchema.Handler,\n\t\t}\n\t}\n\n\tservice.created = schema.Created\n\tservice.started = schema.Started\n\tservice.stopped = schema.Stopped\n}", "func registerSchema(fn schemaFn) {\n\tschemas = append(schemas, fn)\n}", "func SchemaListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList.Schemas[0], \"\", \" \")\n\trespondOK(w, output)\n}", "func (c serverResources) OpenAPISchema() (*openapiv2.Document, error) {\n\treturn c.cachedClient.OpenAPISchema()\n}", "func (manager *Manager) registerSchema(schema *Schema) error {\n\tif _, ok := manager.schemas[schema.ID]; ok {\n\t\tlog.Warning(\"Overwriting schema %s\", schema.ID)\n\t\treturn nil\n\t}\n\tmanager.schemas[schema.ID] = schema\n\tmanager.schemaOrder = append(manager.schemaOrder, schema.ID)\n\tbaseURL := \"/\"\n\tif schema.Parent != \"\" {\n\t\tparentSchema, ok := manager.schema(schema.Parent)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Parent schema %s of %s not found\", schema.Parent, schema.ID)\n\t\t}\n\t\tschema.SetParentSchema(parentSchema)\n\t}\n\tif schema.NamespaceID != \"\" {\n\t\tnamespace, ok := manager.namespace(schema.NamespaceID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Namespace schema %s of %s not found\", schema.NamespaceID, schema.ID)\n\t\t}\n\t\tschema.SetNamespace(namespace)\n\t\tbaseURL = schema.Namespace.GetFullPrefix() + \"/\"\n\t}\n\tif schema.Prefix != \"\" {\n\t\tbaseURL = baseURL + strings.TrimPrefix(schema.Prefix, \"/\") + \"/\"\n\t}\n\tschema.URL = baseURL + schema.Plural\n\tif schema.Parent != \"\" {\n\t\tschema.URLWithParents = baseURL + strings.TrimPrefix(schema.GetParentURL(), \"/\") + \"/\" + schema.Plural\n\t} else {\n\t\tschema.URLWithParents = schema.URL\n\t}\n\treturn nil\n}", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func (s *SrvConfig) Reload(bind cfgo.BindFunc) error {\n\treturn bind()\n}", "func (m *ExternalConnection) SetSchema(value Schemaable)() {\n m.schema = value\n}", "func (client GroupClient) ListSchemasResponder(resp *http.Response) (result USQLSchemaList, 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}", "func Reload(w http.ResponseWriter, r *http.Request) {\n\terr := server.Reload()\n\tif err != nil {\n\t\t//failed to reload the config from DB\n\t\tlog.Debugf(\"Reload failed with error %v\", err)\n\t\tReturnHTTPError(w, r, http.StatusInternalServerError, \"Failed to reload the auth config\")\n\t}\n}", "func (handler *SimpleHandler) Refresh() error {\n\tif _, ok := handler.Config[\"path\"]; !ok {\n\t\treturn fmt.Errorf(\"missing `path' authentication handler setting\")\n\t}\n\n\tif handler.debugLevel > 0 {\n\t\tlog.Printf(\"DEBUG: loading authentication data from `%s' file...\\n\", handler.Config[\"path\"])\n\t}\n\n\thandler.Users = make(map[string]string)\n\n\t_, err := utils.JSONLoad(handler.Config[\"path\"], &handler.Users)\n\treturn err\n}", "func MountSchemaController(service goa.Service, ctrl SchemaController) {\n\trouter := service.HTTPHandler().(*httprouter.Router)\n\tvar h goa.Handler\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewCreateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Create(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"Create\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Create\", \"route\", \"POST /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewDeleteSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Delete(ctx)\n\t}\n\trouter.Handle(\"DELETE\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Delete\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Delete\", \"route\", \"DELETE /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewGetSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Get(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Get\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Get\", \"route\", \"GET /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewListSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.List(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"List\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"List\", \"route\", \"GET /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewSetDefaultsSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.SetDefaults(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas/:name/setDefaults\", ctrl.NewHTTPRouterHandle(\"SetDefaults\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"SetDefaults\", \"route\", \"POST /v1/schemas/:name/setDefaults\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewUpdateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Update(ctx)\n\t}\n\trouter.Handle(\"PUT\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"PUT /v1/schemas/:name\")\n\trouter.Handle(\"POST\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"POST /v1/schemas/:name\")\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func GetSchemas(w http.ResponseWriter, r *http.Request) {\n\trequestWhere, values, err := config.PrestConf.Adapter.WhereByRequest(r, 1)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas, hasCount := config.PrestConf.Adapter.SchemaClause(r)\n\n\tif requestWhere != \"\" {\n\t\tsqlSchemas = fmt.Sprint(sqlSchemas, \" WHERE \", requestWhere)\n\t}\n\n\tdistinct, err := config.PrestConf.Adapter.DistinctClause(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif distinct != \"\" {\n\t\tsqlSchemas = strings.Replace(sqlSchemas, \"SELECT\", distinct, 1)\n\t}\n\n\torder, err := config.PrestConf.Adapter.OrderByRequest(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\torder = config.PrestConf.Adapter.SchemaOrderBy(order, hasCount)\n\n\tpage, err := config.PrestConf.Adapter.PaginateIfPossible(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas = fmt.Sprint(sqlSchemas, order, \" \", page)\n\tsc := config.PrestConf.Adapter.Query(sqlSchemas, values...)\n\tif sc.Err() != nil {\n\t\thttp.Error(w, sc.Err().Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\t//nolint\n\tw.Write(sc.Bytes())\n}", "func servicesSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\ts := schema{\n\t\tTitle: \"service collection\",\n\t\tType: \"array\",\n\t\tItems: &schema{\n\t\t\tRef: \"http://myhost.com/schema/service\",\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func (s *configService) Reload() error", "func appSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\thost, err := config.GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := []link{\n\t\t{\"href\": host + \"/apps/{name}/log\", \"method\": \"GET\", \"rel\": \"log\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"GET\", \"rel\": \"get_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"POST\", \"rel\": \"set_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"DELETE\", \"rel\": \"unset_env\"},\n\t\t{\"href\": host + \"/apps/{name}/restart\", \"method\": \"GET\", \"rel\": \"restart\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"POST\", \"rel\": \"update\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"DELETE\", \"rel\": \"delete\"},\n\t\t{\"href\": host + \"/apps/{name}/run\", \"method\": \"POST\", \"rel\": \"run\"},\n\t}\n\ts := schema{\n\t\tTitle: \"app schema\",\n\t\tType: \"object\",\n\t\tLinks: l,\n\t\tRequired: []string{\"platform\", \"name\"},\n\t\tProperties: map[string]property{\n\t\t\t\"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"platform\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"ip\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"cname\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func (m *SynchronizationJob) SetSchema(value SynchronizationSchemaable)() {\n err := m.GetBackingStore().Set(\"schema\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func setupSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Setup(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (p *hostingdeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {\n\tresp.Schema = schema.Schema{\n\t\tAttributes: map[string]schema.Attribute{\n\t\t\t\"account_id\": schema.StringAttribute{\n\t\t\t\tDescription: \"Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"auth_token\": schema.StringAttribute{\n\t\t\t\tDescription: \"Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func (ar *AppendResult) UpdatedSchema(ctx context.Context) (*storagepb.TableSchema, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase <-ar.Ready():\n\t\tif ar.response != nil {\n\t\t\tif schema := ar.response.GetUpdatedSchema(); schema != nil {\n\t\t\t\treturn proto.Clone(schema).(*storagepb.TableSchema), nil\n\t\t\t}\n\t\t}\n\t\treturn nil, nil\n\t}\n}", "func (s *PollOptionStore) Reload(record *PollOption) error {\n\treturn s.Store.Reload(Schema.PollOption.BaseSchema, record)\n}", "func ClearSchema(p interface{}) {\n\tschema := p.(*Schema)\n\tschema.Indices = make(map[string]*Index)\n\n\ttemp2 := schema.Triggers\n\tschema.Triggers = make(map[string]*Trigger)\n\tfor _, t := range temp2 {\n\t\t(*sqlite3)(nil).DeleteTrigger(t)\n\t}\n\n\ttemp1 := schema.Tables\n\tschema.Tables = make(map[string]*Table)\n\tfor _, t := range temp1 {\n\t\t(*sqlite3)(nil).DeleteTable(0, t)\n\t}\n\n\tschema.ForeignKeys = make(map[string]*ForeignKey)\n\tschema.pSeqTab = nil\n\tif schema.flags & DB_SchemaLoaded {\n\t\tschema.iGeneration++\n\t\tschema.flags &= ~DB_SchemaLoaded\n\t}\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error {\n\tgvk := schema.GroupVersionKind{\n\t\tGroup: crd.Spec.Group,\n\t\tVersion: GetVersionFromCRD(crd),\n\t\tKind: crd.Spec.Names.Kind,\n\t}\n\tif schemaRef.GVK.String() != gvk.String() {\n\t\treturn fmt.Errorf(\"unexpected mismatch of GVK when updating schema reference for controller, old GVK = %s, new GVK = %s\", schemaRef.GVK.String(), gvk.String())\n\t}\n\tschemaRef.CRD = crd\n\tschemaRef.JsonSchema = GetOpenAPIV3SchemaFromCRD(crd)\n\treturn nil\n}", "func RetrieveSchema(service service.MetaDataMgmtService, schemaMap map[string]*entity.Schema) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Logger.Debug(\"Entering handler.RetrieveSchema() handler...\")\n\n\t\t// #1 - Parse path parameters & request headers\n\t\tvar resource string\n\t\tvar catalogType string\n\t\tvar resourceType string\n\t\tvars := mux.Vars(r)\n\t\tif vars != nil {\n\n\t\t\tcatalogType = vars[\"catalog\"]\n\t\t\tresource = vars[\"resourceType\"]\n\t\t\tresourceType = \"urn:resource:\" + catalogType + \":\" + resource\n\t\t}\n\t\tvar validURNs []string\n\t\tfor _, subres := range schemaMap {\n\n\t\t\tvalidURNs = append(validURNs, subres.URN)\n\t\t}\n\t\tfmt.Print(validURNs[0])\n\n\t\t// #2 - Validate input\n\t\terrors := validateSchemaResourceType(resourceType, validURNs)\n\t\tif errors != nil {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write(buildSchemaMetaDataMgmtFailureRespBody(entity.ErrInvalidInputResourceType))\n\t\t\treturn\n\t\t}\n\n\t\t// #3 - Fetch the Schema\n\t\tvar smap = schemaMap[resourceType].Data\n\n\t\t// #4 - Build and return success response\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(buildSchemaMetaDataMgmtSuccessRespBody(smap))\n\t\treturn\n\t})\n}", "func (m *ParameterMutator) Schema(v Schema) *ParameterMutator {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.proxy.schema = v\n\treturn m\n}", "func BasicSchema() *v1.Schemas {\n\treturn basicSchema.DeepCopy()\n}", "func (c *DefaultApiService) FetchSchema(Id string) (*EventsV1Schema, error) {\n\tpath := \"/v1/Schemas/{Id}\"\n\tpath = strings.Replace(path, \"{\"+\"Id\"+\"}\", Id, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tresp, err := c.requestHandler.Get(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &EventsV1Schema{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "func CatalogSchema() *gojsonschema.Schema {\n\treturn loadSchema(\"catalog.schema.json\")\n}", "func (p *planner) notifySchemaChange(\n\ttableDesc *sqlbase.TableDescriptor, mutationID sqlbase.MutationID,\n) {\n\tsc := SchemaChanger{\n\t\ttableID: tableDesc.GetID(),\n\t\tmutationID: mutationID,\n\t\tnodeID: p.extendedEvalCtx.NodeID,\n\t\tleaseMgr: p.LeaseMgr(),\n\t\tjobRegistry: p.ExecCfg().JobRegistry,\n\t\tleaseHolderCache: p.ExecCfg().LeaseHolderCache,\n\t\trangeDescriptorCache: p.ExecCfg().RangeDescriptorCache,\n\t\tclock: p.ExecCfg().Clock,\n\t\tsettings: p.ExecCfg().Settings,\n\t\texecCfg: p.ExecCfg(),\n\t}\n\tp.extendedEvalCtx.SchemaChangers.queueSchemaChanger(sc)\n}", "func (un *Decoder) SetSchema(e *yang.Entry) { un.schema = e }", "func (c *Insert) Schema() (res []Column, err error) {\n\tresp, err := http.Get(c.schemaURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get table schema: %s\", err)\n\t}\n\tdefer func() {\n\t\tif cErr := resp.Body.Close(); cErr != nil {\n\t\t\tif err == nil {\n\t\t\t\terr = cErr\n\t\t\t}\n\t\t}\n\t}()\n\tif resp.StatusCode != http.StatusOK {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out error schema response (status %d): %s\", resp.StatusCode, err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get a schema: %s (%s)\", string(data), err)\n\t}\n\n\tscanner := bufio.NewScanner(resp.Body)\n\tfor scanner.Scan() {\n\t\tvar col Column\n\t\tif err := json.Unmarshal(scanner.Bytes(), &col); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out schema response: %s\", err)\n\t\t}\n\t\tres = append(res, col)\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to reao out schema response: %s\", err)\n\t}\n\n\treturn res, nil\n}", "func sampleSchema() *schemapb.CollectionSchema {\n\tschema := &schemapb.CollectionSchema{\n\t\tName: \"schema\",\n\t\tDescription: \"schema\",\n\t\tAutoID: true,\n\t\tFields: []*schemapb.FieldSchema{\n\t\t\t{\n\t\t\t\tFieldID: 102,\n\t\t\t\tName: \"FieldBool\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"bool\",\n\t\t\t\tDataType: schemapb.DataType_Bool,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 103,\n\t\t\t\tName: \"FieldInt8\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int8\",\n\t\t\t\tDataType: schemapb.DataType_Int8,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 104,\n\t\t\t\tName: \"FieldInt16\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int16\",\n\t\t\t\tDataType: schemapb.DataType_Int16,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 105,\n\t\t\t\tName: \"FieldInt32\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int32\",\n\t\t\t\tDataType: schemapb.DataType_Int32,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 106,\n\t\t\t\tName: \"FieldInt64\",\n\t\t\t\tIsPrimaryKey: true,\n\t\t\t\tAutoID: false,\n\t\t\t\tDescription: \"int64\",\n\t\t\t\tDataType: schemapb.DataType_Int64,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 107,\n\t\t\t\tName: \"FieldFloat\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"float\",\n\t\t\t\tDataType: schemapb.DataType_Float,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 108,\n\t\t\t\tName: \"FieldDouble\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"double\",\n\t\t\t\tDataType: schemapb.DataType_Double,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 109,\n\t\t\t\tName: \"FieldString\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"string\",\n\t\t\t\tDataType: schemapb.DataType_VarChar,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.MaxLengthKey, Value: \"128\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 110,\n\t\t\t\tName: \"FieldBinaryVector\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"binary_vector\",\n\t\t\t\tDataType: schemapb.DataType_BinaryVector,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.DimKey, Value: \"16\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 111,\n\t\t\t\tName: \"FieldFloatVector\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"float_vector\",\n\t\t\t\tDataType: schemapb.DataType_FloatVector,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.DimKey, Value: \"4\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 112,\n\t\t\t\tName: \"FieldJSON\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"json\",\n\t\t\t\tDataType: schemapb.DataType_JSON,\n\t\t\t},\n\t\t},\n\t}\n\treturn schema\n}", "func (h SchemaHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper) {\n\trouter.HandleFunc(\"/{namespace}/tables\", utils.ApplyHTTPWrappers(h.AddTable, wrappers...)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.GetTable, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables\", utils.ApplyHTTPWrappers(h.GetTables, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.DeleteTable, wrappers...)).Methods(http.MethodDelete)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.UpdateTable, wrappers...)).Methods(http.MethodPut)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}/columns/{column}/enum-cases\", utils.ApplyHTTPWrappers(h.GetEnumCases, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}/columns/{column}/enum-cases\", utils.ApplyHTTPWrappers(h.ExtendEnumCases, wrappers...)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/{namespace}/hash\", utils.ApplyHTTPWrappers(h.GetHash, wrappers...)).Methods(http.MethodGet)\n}", "func (db *DatabaseModel) SetSchema(schema *ovsdb.DatabaseSchema) []error {\n\tdb.mutex.Lock()\n\tdefer db.mutex.Unlock()\n\terrors := db.client.validate(schema)\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\tdb.schema = schema\n\tdb.mapper = mapper.NewMapper(schema)\n\terrs := db.generateModelInfo()\n\tif len(errs) > 0 {\n\t\tdb.schema = nil\n\t\tdb.mapper = nil\n\t\treturn errs\n\t}\n\treturn []error{}\n}", "func AlterSchema(dg *dgo.Dgraph, ctx *context.Context, schema *string) error {\n\top := &api.Operation{}\n\top.Schema = *schema\n\terr := dg.Alter(*ctx, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *MediaTypeMutator) Schema(v Schema) *MediaTypeMutator {\n\tb.proxy.schema = v\n\treturn b\n}", "func Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tfor i, elem := range schema {\n\t\tif elem.Config.Name == params[\"name\"] {\n\t\t\tschema = append(schema[:i], schema[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(schema)\n}", "func (s *StatsPeriodStore) Reload(record *StatsPeriod) error {\n\treturn s.Store.Reload(Schema.StatsPeriod.BaseSchema, record)\n}", "func loadSchema() (*schema.PackageSpec, error) {\n\tvar pkgSpec schema.PackageSpec\n\tuncompressed, err := gzip.NewReader(bytes.NewReader(pulumiSchema))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading schema: %w\", err)\n\t}\n\n\tif err = json.NewDecoder(uncompressed).Decode(&pkgSpec); err != nil {\n\t\treturn nil, fmt.Errorf(\"deserializing schema: %w\", err)\n\t}\n\tif err = uncompressed.Close(); err != nil {\n\t\treturn nil, fmt.Errorf(\"closing uncompress stream for schema: %w\", err)\n\t}\n\t// embed version because go codegen is particularly sensitive to this.\n\tif pkgSpec.Version == \"\" {\n\t\tpkgSpec.Version = version.Version\n\t}\n\treturn &pkgSpec, nil\n}", "func (pm *pathManager) confReload(pathConfs map[string]*conf.PathConf) {\n\tselect {\n\tcase pm.chConfReload <- pathConfs:\n\tcase <-pm.ctx.Done():\n\t}\n}", "func generateGoSchemaFile(schema map[string]interface{}, config Config) {\r\n var obj map[string]interface{}\r\n var schemas = make(map[string]interface{})\r\n var outString = \"package main\\n\\nvar schemas = `\\n\"\r\n\r\n var filename = config.Schemas.GoSchemaFilename\r\n var apiFunctions = config.Schemas.API\r\n var elementNames = config.Schemas.GoSchemaElements\r\n \r\n var functionKey = \"API\"\r\n var objectModelKey = \"objectModelSchemas\"\r\n \r\n schemas[functionKey] = interface{}(make(map[string]interface{}))\r\n schemas[objectModelKey] = interface{}(make(map[string]interface{}))\r\n\r\n fmt.Printf(\"Generate Go SCHEMA file %s for: \\n %s and: \\n %s\\n\", filename, apiFunctions, elementNames)\r\n\r\n // grab the event API functions for input\r\n for i := range apiFunctions {\r\n functionSchemaName := \"#/definitions/API/\" + apiFunctions[i]\r\n functionName := apiFunctions[i]\r\n obj = getObject(schema, functionSchemaName)\r\n if obj == nil {\r\n fmt.Printf(\"** WARN ** %s returned nil from getObject\\n\", functionSchemaName)\r\n return\r\n }\r\n schemas[functionKey].(map[string]interface{})[functionName] = obj \r\n } \r\n\r\n // grab the elements requested (these are useful separately even though\r\n // they obviously appear already as part of the event API functions)\r\n for i := range elementNames {\r\n elementName := elementNames[i]\r\n obj = getObject(schema, elementName)\r\n if obj == nil {\r\n fmt.Printf(\"** ERR ** %s returned nil from getObject\\n\", elementName)\r\n return\r\n }\r\n schemas[objectModelKey].(map[string]interface{})[elementName] = obj \r\n }\r\n \r\n // marshal for output to file \r\n schemaOut, err := json.MarshalIndent(&schemas, \"\", \" \")\r\n if err != nil {\r\n fmt.Printf(\"** ERR ** cannot marshal schema file output for writing\\n\")\r\n return\r\n }\r\n outString += string(schemaOut) + \"`\"\r\n ioutil.WriteFile(filename, []byte(outString), 0644)\r\n}", "func ReloadFlexGetHandler(w http.ResponseWriter, req *http.Request) {\n\tglog.Info(\"Reload FlexGet\")\n\tif result, err := execFlexGetAction(reloadFlexGetCmd); err != nil {\n\t\tglog.Error(\"Error reloading FlexGet: \", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t} else {\n\t\tfmt.Fprint(w, string(result))\n\t}\n}", "func (s *PollStore) Reload(record *Poll) error {\n\treturn s.Store.Reload(Schema.Poll.BaseSchema, record)\n}", "func CQRReloadFunc(cqrConfigs []CQRConfig, c *gin.Context) func(*gin.Context) {\n\tvar tableNames []string\n\tfor _, v := range cqrConfigs {\n\t\ttableNames = append(tableNames, v.Tables...)\n\t}\n\tfn := func(c *gin.Context) {\n\t\tvar err error\n\t\tr := response{Err: err, Status: http.StatusOK}\n\n\t\ttable, exists := c.GetQuery(\"table\")\n\t\tif !exists || table == \"\" {\n\t\t\ttable, exists = c.GetQuery(\"t\")\n\t\t\tif !exists || table == \"\" {\n\t\t\t\terr := errors.New(\"Table name required\")\n\t\t\t\tlog.WithFields(log.Fields{}).Error(err.Error())\n\t\t\t\tr.Status = http.StatusBadRequest\n\t\t\t\tr.Err = err\n\t\t\t\trender(r, c)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfound := false\n\t\tfor _, cqrConfig := range cqrConfigs {\n\t\t\tfor _, configTableName := range cqrConfig.Tables {\n\n\t\t\t\tif strings.Contains(configTableName, table) {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbegin := time.Now()\n\t\t\t\t\terr := cqrConfig.Data.Reload()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tr.Success = false\n\t\t\t\t\t\tr.Err = err\n\t\t\t\t\t\tr.Status = http.StatusInternalServerError\n\t\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\t\"table\": table,\n\t\t\t\t\t\t\t\"error\": err.Error(),\n\t\t\t\t\t\t\t\"took\": time.Since(begin),\n\t\t\t\t\t\t}).Error(\"reload failed\")\n\t\t\t\t\t\trender(r, c)\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tr.Success = true\n\t\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\t\"table\": table,\n\t\t\t\t\t\t\t\"took\": time.Since(begin),\n\t\t\t\t\t\t\t\"ua\": c.Request.UserAgent(),\n\t\t\t\t\t\t\t\"referer\": c.Request.Referer(),\n\t\t\t\t\t\t}).Info(\"reload done\")\n\t\t\t\t\t}\n\t\t\t\t\tif cqrConfig.WebHook != \"\" {\n\t\t\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\t\t\"table\": cqrConfig.Tables,\n\t\t\t\t\t\t\t\"hook\": cqrConfig.WebHook,\n\t\t\t\t\t\t}).Debug(\"webhook\")\n\n\t\t\t\t\t\tresp, err := http.Get(cqrConfig.WebHook)\n\t\t\t\t\t\tif err != nil || resp.StatusCode != 200 {\n\t\t\t\t\t\t\tfields := log.Fields{\n\t\t\t\t\t\t\t\t\"table\": cqrConfig.Tables,\n\t\t\t\t\t\t\t\t\"hook\": cqrConfig.WebHook,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif resp != nil {\n\t\t\t\t\t\t\t\tfields[\"code\"] = resp.Status\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tfields[\"error\"] = err.Error()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlog.WithFields(fields).Error(\"hook failed\")\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 !found {\n\t\t\tr.Success = false\n\t\t\tr.Status = http.StatusInternalServerError\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"table\": table,\n\t\t\t\t\"avialable\": strings.Join(tableNames, \", \"),\n\t\t\t}).Error(\"table not found\")\n\t\t\tr.Err = fmt.Errorf(\"Table %s not found\", table)\n\t\t}\n\t\trender(r, c)\n\t\treturn\n\t}\n\treturn fn\n}", "func MapRouteBySchemas(server *Server, dataStore db.DB) {\n\troute := server.martini\n\tlog.Debug(\"[Initializing Routes]\")\n\tschemaManager := schema.GetManager()\n\troute.Get(\"/_all\", func(w http.ResponseWriter, r *http.Request, p martini.Params, auth schema.Authorization, ctx middleware.Context) {\n\t\tresponses := make(map[string]interface{})\n\t\tcontext := map[string]interface{}{\n\t\t\t\"path\": r.URL.Path,\n\t\t\t\"http_request\": r,\n\t\t\t\"http_response\": w,\n\t\t\t\"context\": ctx[\"context\"],\n\t\t\t\"trace_id\": ctx[\"trace_id\"],\n\t\t}\n\t\tfor _, s := range schemaManager.Schemas() {\n\t\t\tpolicy, role := authorization(w, r, schema.ActionRead, s.GetPluralURL(), s, auth)\n\t\t\tif policy == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontext[\"policy\"] = policy\n\t\t\tcontext[\"role\"] = role\n\t\t\tcontext[\"auth\"] = auth\n\t\t\tcontext[\"sync\"] = server.sync\n\n\t\t\tif err := resources.GetResources(\n\t\t\t\tcontext, dataStore,\n\t\t\t\ts,\n\t\t\t\tresources.FilterFromQueryParameter(s, r.URL.Query()),\n\t\t\t\tnil,\n\t\t\t); err != nil {\n\t\t\t\thandleError(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresources.ApplyPolicyForResources(context, s)\n\t\t\tresponse := context[\"response\"].(map[string]interface{})\n\t\t\tresponses[s.GetDbTableName()] = response[s.Plural]\n\t\t}\n\t\troutes.ServeJson(w, responses)\n\t})\n\tfor _, s := range schemaManager.Schemas() {\n\t\tMapRouteBySchema(server, dataStore, s)\n\t}\n}", "func (s *TsvStoreOptions) SetSchema(v []map[string]*string) *TsvStoreOptions {\n\ts.Schema = v\n\treturn s\n}", "func RenameSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\tnewIndex := c.Param(\"newIndex\")\n\tif _, err := conf.LoadSchema(index); err != nil {\n\t\tc.Error(http.StatusNotFound, fmt.Sprintf(\"index %s not found\", index))\n\t\treturn\n\t}\n\tif _, err := conf.LoadSchema(newIndex); err == nil {\n\t\tc.Error(http.StatusInternalServerError, fmt.Sprintf(\"index %s alreday exists\", newIndex))\n\t\treturn\n\t}\n\n\tindexer.LruRemove(index)\n\tindexer.RemoveIndexer(index)\n\n\tif err := conf.RenameSchema(index, newIndex); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": fmt.Sprintf(\"index %s renamed to %s OK\", index, newIndex),\n\t})\n}", "func (sm *Manager) RegisterNewSchema(schema StateManager) {\n\tsm.handlers[schema.Name()] = schema\n}", "func (s *Service) SetSchemas(schemas http.FileSystem) {\n\ts.schemas = schemas\n}", "func datasourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema {\n\treturn tpgresource.DatasourceSchemaFromResourceSchema(rs)\n}", "func (gc *GraphClient) UpdateSchema(sg schema.SchemaGraph) error {\n\trequestBody := PutGraphSchemaRequestBody{}\n\trequestBody.Schema = sg\n\n\tb, err := json.Marshal(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to marshall request body\")\n\t}\n\n\treq, err := gc.newRequest(context.Background(), \"PUT\", \"/api/graph/schema\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := gc.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode == http.StatusUnauthorized {\n\t\treturn fmt.Errorf(\"Unauthorized access. Check your auth token\")\n\t} else if res.StatusCode == http.StatusTooManyRequests {\n\t\treturn ErrTooManyRequests\n\t} else if res.StatusCode != http.StatusOK {\n\t\treturn handleUnexpectedResponse(res)\n\t}\n\treturn nil\n}", "func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {\n\n\tif schema.AdditionalItems != nil {\n\t\ts := schema.AdditionalItems.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalItems\")\n\t\t}\n\t}\n\n\tif schema.Items != nil {\n\t\tif schema.Items.SchemaArray != nil {\n\t\t\tfor _, s := range *(schema.Items.SchemaArray) {\n\t\t\t\ts.applyToSchemas(operation, \"Items.SchemaArray\")\n\t\t\t}\n\t\t} else if schema.Items.Schema != nil {\n\t\t\tschema.Items.Schema.applyToSchemas(operation, \"Items.Schema\")\n\t\t}\n\t}\n\n\tif schema.AdditionalProperties != nil {\n\t\ts := schema.AdditionalProperties.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalProperties\")\n\t\t}\n\t}\n\n\tif schema.Properties != nil {\n\t\tfor _, pair := range *(schema.Properties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Properties\")\n\t\t}\n\t}\n\tif schema.PatternProperties != nil {\n\t\tfor _, pair := range *(schema.PatternProperties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"PatternProperties\")\n\t\t}\n\t}\n\n\tif schema.Dependencies != nil {\n\t\tfor _, pair := range *(schema.Dependencies) {\n\t\t\tschemaOrStringArray := pair.Value\n\t\t\ts := schemaOrStringArray.Schema\n\t\t\tif s != nil {\n\t\t\t\ts.applyToSchemas(operation, \"Dependencies\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif schema.AllOf != nil {\n\t\tfor _, s := range *(schema.AllOf) {\n\t\t\ts.applyToSchemas(operation, \"AllOf\")\n\t\t}\n\t}\n\tif schema.AnyOf != nil {\n\t\tfor _, s := range *(schema.AnyOf) {\n\t\t\ts.applyToSchemas(operation, \"AnyOf\")\n\t\t}\n\t}\n\tif schema.OneOf != nil {\n\t\tfor _, s := range *(schema.OneOf) {\n\t\t\ts.applyToSchemas(operation, \"OneOf\")\n\t\t}\n\t}\n\tif schema.Not != nil {\n\t\tschema.Not.applyToSchemas(operation, \"Not\")\n\t}\n\n\tif schema.Definitions != nil {\n\t\tfor _, pair := range *(schema.Definitions) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Definitions\")\n\t\t}\n\t}\n\n\toperation(schema, context)\n}", "func (o *CMFFamiliesPolicy) Reload(ctx context.Context, exec boil.ContextExecutor) error {\n\tret, err := FindCMFFamiliesPolicy(ctx, exec, o.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*o = *ret\n\treturn nil\n}", "func (o *CMFFamiliesPolicySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := CMFFamiliesPolicySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfFamiliesPolicyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `cmf_families_policies`.* FROM `cmf_families_policies` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfFamiliesPolicyPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in CMFFamiliesPolicySlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func manualRefreshHandler(logger log.Logger, searcher *searcher, downloadRepo downloadRepository) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Log(\"main\", \"admin: refreshing data\")\n\t\tif stats, err := searcher.refreshData(\"\"); err != nil {\n\t\t\tlogger.Log(\"main\", fmt.Sprintf(\"ERROR: admin: problem refreshing data: %v\", err))\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t} else {\n\t\t\tif err := downloadRepo.recordStats(stats); err != nil {\n\t\t\t\tmoovhttp.Problem(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlogger.Log(\n\t\t\t\t\"main\", fmt.Sprintf(\"admin: finished data refreshed %v ago\", time.Since(stats.RefreshedAt)),\n\t\t\t\t\"SDNs\", stats.SDNs, \"AltNames\", stats.Alts, \"Addresses\", stats.Addresses, \"SSI\", stats.SectoralSanctions,\n\t\t\t\t\"DPL\", stats.DeniedPersons, \"BISEntities\", stats.BISEntities,\n\t\t\t)\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tjson.NewEncoder(w).Encode(stats)\n\t\t}\n\t}\n}", "func (c *Client) Schema() error {\n\t_, err := c.db.DB().Exec(Schema)\n\treturn err\n}", "func (it *iterator) resetSchema(schemaDesc namespace.SchemaDescr) {\n\tif schemaDesc == nil {\n\t\tit.schemaDesc = nil\n\t\tit.schema = nil\n\n\t\t// Clear but don't set to nil so they don't need to be reallocated\n\t\t// next time.\n\t\tcustomFields := it.customFields\n\t\tfor i := range customFields {\n\t\t\tcustomFields[i] = customFieldState{}\n\t\t}\n\t\tit.customFields = customFields[:0]\n\n\t\tnonCustomFields := it.nonCustomFields\n\t\tfor i := range nonCustomFields {\n\t\t\tnonCustomFields[i] = marshalledField{}\n\t\t}\n\t\tit.nonCustomFields = nonCustomFields[:0]\n\t\treturn\n\t}\n\n\tit.schemaDesc = schemaDesc\n\tit.schema = schemaDesc.Get().MessageDescriptor\n\tit.customFields, it.nonCustomFields = customAndNonCustomFields(it.customFields, nil, it.schema)\n}", "func (s *PersonStore) Reload(record *Person) error {\n\treturn s.Store.Reload(Schema.Person.BaseSchema, record)\n}", "func SchemaRegister(svc string, cluster string, sdb string, table string, inputType string, output string, version int, formatType string, dst string, createTopic bool) error {\n\tavroSchema, err := schema.ConvertToAvro(&db.Loc{Cluster: cluster, Service: svc, Name: sdb}, table, inputType, formatType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutputSchemaName, err := encoder.GetOutputSchemaName(svc, sdb, table, inputType, output, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dst == \"state\" || dst == \"all\" {\n\t\terr = state.InsertSchema(outputSchemaName, formatType, string(avroSchema))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif createTopic {\n\t\ttm := time.Now()\n\t\tc, err := config.Get().GetChangelogTopicName(svc, sdb, table, inputType, \"kafka\", version, tm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = createKafkaTopic(c, inputType, svc, sdb, table)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\to, err := config.Get().GetOutputTopicName(svc, sdb, table, inputType, \"kafka\", version, tm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = createKafkaTopic(o, inputType, svc, sdb, table)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"AvroSchema registered for(%v,%v, %v,%v,%v,%v,%v) = %s\", svc, cluster, sdb, table, inputType, output, version, avroSchema)\n\treturn nil\n}", "func (r *Routes) configureWellKnown(healthFunc func() bool) {\n\twellKnown := r.Group(\"/.well-known\")\n\t{\n\t\twellKnown.GET(\"/schema-discovery\", func(ctx *gin.Context) {\n\t\t\tdiscovery := struct {\n\t\t\t\tSchemaURL string `json:\"schema_url\"`\n\t\t\t\tSchemaType string `json:\"schema_type\"`\n\t\t\t\tUIURL string `json:\"ui_url\"`\n\t\t\t}{\n\t\t\t\tSchemaURL: \"/swagger.json\",\n\t\t\t\tSchemaType: \"swagger-2.0\",\n\t\t\t}\n\t\t\tctx.JSON(http.StatusOK, &discovery)\n\t\t})\n\t\twellKnown.GET(\"/health\", healthHandler(healthFunc))\n\t}\n\n\tr.GET(\"/swagger.json\", func(ctx *gin.Context) {\n\t\tctx.String(http.StatusOK, string(SwaggerJSON))\n\t})\n}", "func (r *Routes) configureWellKnown(healthFunc func() bool) {\n\twellKnown := r.Group(\"/.well-known\")\n\t{\n\t\twellKnown.GET(\"/schema-discovery\", func(ctx *gin.Context) {\n\t\t\tdiscovery := struct {\n\t\t\t\tSchemaURL string `json:\"schema_url\"`\n\t\t\t\tSchemaType string `json:\"schema_type\"`\n\t\t\t\tUIURL string `json:\"ui_url\"`\n\t\t\t}{\n\t\t\t\tSchemaURL: \"/swagger.json\",\n\t\t\t\tSchemaType: \"swagger-2.0\",\n\t\t\t}\n\t\t\tctx.JSON(http.StatusOK, &discovery)\n\t\t})\n\t\twellKnown.GET(\"/health\", healthHandler(healthFunc))\n\t}\n\n\tr.GET(\"/swagger.json\", func(ctx *gin.Context) {\n\t\tctx.String(http.StatusOK, string(SwaggerJSON))\n\t})\n}", "func DeleteSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\n\tindexer.RemoveIndexer(index)\n\tif err := conf.DeleteSchema(index); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": \"schema deleted\",\n\t\t\"index\": index,\n\t})\n}", "func UpdateSchema(gqlConfig GraphQLConfig, schemaConfig schema.Config) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\terr := ready.Validate(ctx, gqlConfig.URL, 5*time.Second)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"waiting for database to be ready, database timed out or does not exist\")\n\t}\n\n\tgql := NewGraphQL(gqlConfig)\n\n\tschema, err := schema.New(gql, schemaConfig)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"preparing schema\")\n\t}\n\n\tif err := schema.Create(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"creating schema\")\n\t}\n\n\treturn nil\n}", "func BackendSchemas() []*config.ConfigurationSchema {\n\tconfigurationSchemas := []*config.ConfigurationSchema{}\n\tfor _, registry := range backendRegistry {\n\t\tconfigurationSchemas = append(configurationSchemas, registry.configurationSchema)\n\t}\n\treturn configurationSchemas\n}", "func (c *Converter) GenerateJSONSchemas() ([]types.GeneratedJSONSchema, error) {\n\n\tc.logger.Debug(\"Converting API\")\n\n\t// Store the output in here:\n\tgeneratedJSONSchemas, err := c.mapOpenAPIDefinitionsToJSONSchema()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not map openapi definitions to jsonschema\")\n\t}\n\n\treturn generatedJSONSchemas, nil\n}", "func hostResourceSchema(m map[string]*schema.Schema) (o map[string]*schema.Schema) {\n\to = map[string]*schema.Schema{}\n\tfor k, v := range m {\n\t\tschema := *v\n\n\t\t// required\n\t\tswitch k {\n\t\tcase \"host\", \"interface\", \"groups\":\n\t\t\tschema.Required = true\n\t\tcase \"templates\", \"proxyid\", \"inventory\":\n\t\t\tschema.Optional = true\n\t\t}\n\n\t\to[k] = &schema\n\t}\n\n\to[\"proxyid\"].ValidateFunc = validation.StringIsNotWhiteSpace\n\to[\"proxyid\"].Default = \"0\"\n\treturn o\n}", "func resourceSourceSchema() map[string]*schema.Schema {\n\treturn map[string]*schema.Schema{\n\t\t\"collector_id\": {\n\t\t\tType: schema.TypeInt,\n\t\t\tRequired: true,\n\t\t\tForceNew: true,\n\t\t},\n\t\t\"name\": {\n\t\t\tType: schema.TypeString,\n\t\t\tRequired: true,\n\t\t},\n\t\t\"description\": {\n\t\t\tType: schema.TypeString,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"host\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"category\": {\n\t\t\tType: schema.TypeString,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"time_zone\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"force_time_zone\": {\n\t\t\tType: schema.TypeBool,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"automatic_date_parsing\": {\n\t\t\tType: schema.TypeBool,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"multiline_processing_enabled\": {\n\t\t\tType: schema.TypeBool,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"use_autoline_matching\": {\n\t\t\tType: schema.TypeBool,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"manual_prefix_regexp\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"default_date_format\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t},\n\t\t\"default_date_formats\": {\n\t\t\tType: schema.TypeSet,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t\tElem: &schema.Resource{\n\t\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\t\"format\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t},\n\t\t\t\t\t\"locator\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"filters\": {\n\t\t\tType: schema.TypeSet,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t\tElem: &schema.Resource{\n\t\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\t\"type\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t},\n\t\t\t\t\t\"name\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t},\n\t\t\t\t\t\"regexp\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t},\n\t\t\t\t\t\"mask\": {\n\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"cutoff_timestamp\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t\tDescription: \"Only collect data more recent than this timestamp (RFC3339 Formatted)\",\n\t\t},\n\t\t\"cutoff_relative_time\": {\n\t\t\tType: schema.TypeString,\n\t\t\tComputed: true,\n\t\t\tOptional: true,\n\t\t\tDescription: `Can be specified instead of cutoffTimestamp to provide a relative offset with respect to the current time.\nExample: use -1h, -1d, or -1w to collect data that's less than one hour, one day, or one week old, respectively.\nYou can only use hours, days, and weeks to specify cutoffRelativeTime. No other time units are supported.`,\n\t\t},\n\t}\n}", "func (client GroupClient) GetSchemaResponder(resp *http.Response) (result USQLSchema, 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}", "func (b *SynchronizationTemplateRequestBuilder) Schema() *SynchronizationSchemaRequestBuilder {\n\tbb := &SynchronizationSchemaRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/schema\"\n\treturn bb\n}", "func main() {\n\tscma, restRoutes := LoadSchemaFile(\"schema.graphql\", schema.ObjectFieldResolvers{\n\t\t\"Query\": schema.FieldResolvers{\n\t\t\t\"person\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif person, ok := testdata.People[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn person, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no person found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"account\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif account, ok := testdata.Accounts[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn account, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no account found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"user\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tif user, ok := testdata.Users[p.Args[\"id\"].(string)]; ok {\n\t\t\t\t\treturn user, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, api.NewErrorWithRestStatus(\n\t\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\t\tfmt.Errorf(\"no user found with ID '%s'\", p.Args[\"id\"]),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t\"Person\": schema.FieldResolvers{\n\t\t\t// TODO: Need some way to easily return plain old JSON fields\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Person).ID, nil\n\t\t\t},\n\t\t\t\"users\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tvar users []testdata.User\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.PersonID == p.Source.(testdata.Person).ID {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t},\n\t\t\"Account\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Account).ID, nil\n\t\t\t},\n\t\t\t\"plan\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.Account).PlanID\n\t\t\t\tif plan, ok := testdata.Plans[id]; ok {\n\t\t\t\t\treturn plan, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no plan found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"users\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tvar users []testdata.User\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.AccountID == p.Source.(testdata.Account).ID {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t\t\"usersByType\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tusers := []testdata.User{}\n\t\t\t\tfor _, user := range testdata.Users {\n\t\t\t\t\tif user.AccountID == p.Source.(testdata.Account).ID && user.Type == p.Args[\"type\"] {\n\t\t\t\t\t\tusers = append(users, user)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn users, nil\n\t\t\t},\n\t\t},\n\t\t\"Plan\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Plan).ID, nil\n\t\t\t},\n\t\t\t\"name\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.Plan).Name, nil\n\t\t\t},\n\t\t},\n\t\t\"User\": schema.FieldResolvers{\n\t\t\t\"id\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.User).ID, nil\n\t\t\t},\n\t\t\t\"person\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.User).PersonID\n\t\t\t\tif person, ok := testdata.People[id]; ok {\n\t\t\t\t\treturn person, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no person found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"account\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\tid := p.Source.(testdata.User).AccountID\n\t\t\t\tif account, ok := testdata.Accounts[id]; ok {\n\t\t\t\t\treturn account, nil\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no account found with ID '%s'\", id)\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"type\": func(p graphql.ResolveParams) (interface{}, error) {\n\t\t\t\treturn p.Source.(testdata.User).Type, nil\n\t\t\t},\n\t\t},\n\t})\n\n\tserver := gin.Default()\n\tserver.Use(\n\t\tcors.New(cors.Config{\n\t\t\tAllowAllOrigins: true,\n\t\t\tAllowMethods: []string{\"POST\", \"OPTIONS\"},\n\t\t\tAllowHeaders: []string{\n\t\t\t\t\"Origin\",\n\t\t\t\t\"Authorization\",\n\t\t\t\t\"X-Requested-With\",\n\t\t\t\t\"Content-Type\",\n\t\t\t\t\"Accept\",\n\t\t\t\t\"W-Token\",\n\t\t\t\t\"W-UserId\",\n\t\t\t},\n\t\t}),\n\t\tapi.ErrorMiddleware(),\n\t)\n\tserver.OPTIONS(\"/\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, \"Hello!\")\n\t})\n\tserver.GET(\"/graphql\", GinHandlerForGraphQLSchema(scma))\n\tfor _, route := range restRoutes {\n\t\tserver.GET(route.Route, route.Handler)\n\t}\n\n\tlog.Fatal(server.Run())\n}", "func ReLoadConfigAPIHandler(w http.ResponseWriter, r *http.Request) {\n\tLog := Logger.NewSessionLogger()\n\n\tif AliceNodeStart && BobNodeStart {\n\t\t//TODO: be capable to modify\n\t\tLog.Warnf(\"the node has started and can not modify config.\")\n\t\tfmt.Fprintf(w, RESPONSE_HAS_STARTED)\n\t\treturn\n\t}\n\tvar plog PodLog\n\tplog.Result = LOG_RESULT_FAILED\n\tplog.Operation = LOG_OPERATION_TYPE_CONFIG_SETTING\n\n\tdefer func() {\n\t\terr := insertLogToDB(plog)\n\t\tif err != nil {\n\t\t\tLog.Warnf(\"insert log error! %v\", err)\n\t\t\treturn\n\t\t}\n\t\tnodeRecovery(w, Log)\n\t}()\n\n\tif !AliceNodeStart {\n\t\tip := r.FormValue(\"ip\")\n\t\tif ip != \"\" {\n\t\t\tLog.Debugf(\"ip=%v\", ip)\n\t\t\tBConf.NetIP = ip\n\t\t}\n\t\tplog.Detail = \"modify ip =\" + ip + \";\"\n\t}\n\n\tif !AliceNodeStart && !BobNodeStart {\n\t\tpassword := r.FormValue(\"password\")\n\t\tkeystoreFile := r.FormValue(\"keystore\")\n\t\tprivkey := r.FormValue(\"privkey\")\n\t\tif privkey != \"\" {\n\t\t\tLog.Debugf(\"import private key. privkey=%v\", privkey)\n\t\t\tPrivateKeyECDSA, err := crypto.HexToECDSA(privkey)\n\t\t\tif err != nil {\n\t\t\t\tLog.Warnf(\"failed to parse private key. err=%v\", err)\n\t\t\t\tfmt.Fprintf(w, RESPONSE_UPLOAD_KEY_FAILED)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpublicKey := PrivateKeyECDSA.Public()\n\t\t\tLog.Debugf(\"publicKey=%v\", publicKey)\n\t\t\tplog.Detail = plog.Detail + \"modify eth key, address=%v\" + \"TODO\" + \";\"\n\t\t\tpublicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)\n\t\t\tif !ok {\n\t\t\t\tLog.Warnf(\"invalid private key.\")\n\t\t\t\tfmt.Fprintf(w, RESPONSE_UPLOAD_KEY_FAILED)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tLog.Debugf(\"privateKeyECDSA=%v\", PrivateKeyECDSA)\n\t\t\t\tkey := &keystore.Key{\n\t\t\t\t\tAddress: crypto.PubkeyToAddress(*publicKeyECDSA),\n\t\t\t\t\tPrivateKey: PrivateKeyECDSA,\n\t\t\t\t}\n\t\t\t\terr = ConnectToProvider(key, BConf.ContractAddr, Log)\n\t\t\t\tif err != nil {\n\t\t\t\t\tLog.Warnf(\"failed to connect to provider for contract. err=%v\", err)\n\t\t\t\t\tfmt.Fprintf(w, RESPONSE_INITIALIZE_FAILED)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tETHKey = key\n\t\t\t\tLog.Infof(\"success to connect to provider for contract\")\n\t\t\t}\n\t\t\t//TODO: save keystore\n\t\t} else if password != \"\" && keystoreFile != \"\" {\n\t\t\tplog.Detail = plog.Detail + \"modify eth key, keystoreFile=\" + keystoreFile\n\t\t\tkey, err := initKeyStore(keystoreFile, password, Log)\n\t\t\tif err != nil {\n\t\t\t\tLog.Errorf(\"Failed to initialize key store file. err=%v\", err)\n\t\t\t\tfmt.Fprintf(w, RESPONSE_INITIALIZE_FAILED)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tLog.Infof(\"initialize key store finish. ethaddr=%v.\", key.Address.Hex())\n\t\t\tplog.Detail = plog.Detail + \", address=\" + key.Address.Hex()\n\t\t\terr = ConnectToProvider(key, BConf.ContractAddr, Log)\n\t\t\tif err != nil {\n\t\t\t\tLog.Warnf(\"Failed to connect to provider for contract. err=%v\", err)\n\t\t\t\tfmt.Fprintf(w, RESPONSE_INITIALIZE_FAILED)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tETHKey = key\n\t\t\tLog.Infof(\"success to connect to provider for contract\")\n\t\t\tBConf.KeyStoreFile = keystoreFile\n\t\t}\n\t}\n\n\terr := saveBasicConfig(BConf, DEFAULT_BASIC_CONFGI_FILE)\n\tif err != nil {\n\t\tLog.Warnf(\"failed to save basic config. file = %v, err=%v\", DEFAULT_BASIC_CONFGI_FILE, err)\n\t\tfmt.Fprintf(w, RESPONSE_SAVE_CONFIG_FILE_FAILED)\n\t\treturn\n\t}\n\tplog.Result = LOG_RESULT_SUCCESS\n\tLog.Infof(\"success to set basic config. config=%v\", BConf)\n\tfmt.Fprintf(w, `{\"code\":\"0\",\"message\":\"set config successfully\"}`)\n\treturn\n}" ]
[ "0.7177776", "0.7145628", "0.673341", "0.6624522", "0.6543675", "0.6149476", "0.6075368", "0.60667056", "0.5946006", "0.5571808", "0.5567838", "0.54518217", "0.5399067", "0.5378405", "0.52802455", "0.5230651", "0.517944", "0.5177448", "0.51750547", "0.5151869", "0.50868386", "0.5085115", "0.50793475", "0.50751054", "0.50718033", "0.50609714", "0.50477266", "0.50141335", "0.5013318", "0.50125885", "0.49937868", "0.49901196", "0.4989455", "0.49867818", "0.49818873", "0.49818873", "0.49616933", "0.49162647", "0.49140644", "0.4886408", "0.48806828", "0.48777583", "0.48777583", "0.4862291", "0.48486847", "0.48246253", "0.4789596", "0.4784693", "0.476984", "0.47492996", "0.4748486", "0.474839", "0.47422594", "0.47125062", "0.47083357", "0.4701971", "0.47002164", "0.46978885", "0.4695983", "0.46716928", "0.46612486", "0.46610904", "0.46487734", "0.4645407", "0.4644958", "0.46377072", "0.46249807", "0.46143657", "0.46100533", "0.46009806", "0.45982042", "0.4595405", "0.4586871", "0.45864666", "0.45828664", "0.45814812", "0.4572155", "0.45675147", "0.45455754", "0.45297575", "0.45244575", "0.4511412", "0.4509385", "0.45091885", "0.45034593", "0.44885987", "0.44885138", "0.4487952", "0.44833842", "0.44833842", "0.4483331", "0.44786662", "0.44731614", "0.44610178", "0.44608986", "0.44509062", "0.44452184", "0.44405434", "0.44368586", "0.44311267" ]
0.7888811
0
HandleInspectCollectionSchema gets the schema for particular collection & update the database collection schema in config
func HandleInspectCollectionSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() vars := mux.Vars(r) dbAlias := vars["dbAlias"] col := vars["col"] projectID := vars["project"] logicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } schema := modules.Schema() s, err := schema.SchemaInspection(ctx, dbAlias, logicalDBName, col) if err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } if err := syncman.SetSchemaInspection(ctx, projectID, dbAlias, col, s); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendResponse(w, http.StatusOK, model.Response{Result: s}) // return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func sampleSchema() *schemapb.CollectionSchema {\n\tschema := &schemapb.CollectionSchema{\n\t\tName: \"schema\",\n\t\tDescription: \"schema\",\n\t\tAutoID: true,\n\t\tFields: []*schemapb.FieldSchema{\n\t\t\t{\n\t\t\t\tFieldID: 102,\n\t\t\t\tName: \"FieldBool\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"bool\",\n\t\t\t\tDataType: schemapb.DataType_Bool,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 103,\n\t\t\t\tName: \"FieldInt8\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int8\",\n\t\t\t\tDataType: schemapb.DataType_Int8,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 104,\n\t\t\t\tName: \"FieldInt16\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int16\",\n\t\t\t\tDataType: schemapb.DataType_Int16,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 105,\n\t\t\t\tName: \"FieldInt32\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int32\",\n\t\t\t\tDataType: schemapb.DataType_Int32,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 106,\n\t\t\t\tName: \"FieldInt64\",\n\t\t\t\tIsPrimaryKey: true,\n\t\t\t\tAutoID: false,\n\t\t\t\tDescription: \"int64\",\n\t\t\t\tDataType: schemapb.DataType_Int64,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 107,\n\t\t\t\tName: \"FieldFloat\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"float\",\n\t\t\t\tDataType: schemapb.DataType_Float,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 108,\n\t\t\t\tName: \"FieldDouble\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"double\",\n\t\t\t\tDataType: schemapb.DataType_Double,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 109,\n\t\t\t\tName: \"FieldString\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"string\",\n\t\t\t\tDataType: schemapb.DataType_VarChar,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.MaxLengthKey, Value: \"128\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 110,\n\t\t\t\tName: \"FieldBinaryVector\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"binary_vector\",\n\t\t\t\tDataType: schemapb.DataType_BinaryVector,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.DimKey, Value: \"16\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 111,\n\t\t\t\tName: \"FieldFloatVector\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"float_vector\",\n\t\t\t\tDataType: schemapb.DataType_FloatVector,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.DimKey, Value: \"4\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 112,\n\t\t\t\tName: \"FieldJSON\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"json\",\n\t\t\t\tDataType: schemapb.DataType_JSON,\n\t\t\t},\n\t\t},\n\t}\n\treturn schema\n}", "func setupSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Setup(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\tif err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func strKeySchema() *schemapb.CollectionSchema {\n\tschema := &schemapb.CollectionSchema{\n\t\tName: \"schema\",\n\t\tDescription: \"schema\",\n\t\tAutoID: true,\n\t\tFields: []*schemapb.FieldSchema{\n\t\t\t{\n\t\t\t\tFieldID: 101,\n\t\t\t\tName: \"UID\",\n\t\t\t\tIsPrimaryKey: true,\n\t\t\t\tAutoID: false,\n\t\t\t\tDescription: \"uid\",\n\t\t\t\tDataType: schemapb.DataType_VarChar,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.MaxLengthKey, Value: \"1024\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 102,\n\t\t\t\tName: \"FieldInt32\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"int_scalar\",\n\t\t\t\tDataType: schemapb.DataType_Int32,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 103,\n\t\t\t\tName: \"FieldFloat\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"float_scalar\",\n\t\t\t\tDataType: schemapb.DataType_Float,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 104,\n\t\t\t\tName: \"FieldString\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"string_scalar\",\n\t\t\t\tDataType: schemapb.DataType_VarChar,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.MaxLengthKey, Value: \"128\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 105,\n\t\t\t\tName: \"FieldBool\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"bool_scalar\",\n\t\t\t\tDataType: schemapb.DataType_Bool,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFieldID: 106,\n\t\t\t\tName: \"FieldFloatVector\",\n\t\t\t\tIsPrimaryKey: false,\n\t\t\t\tDescription: \"vectors\",\n\t\t\t\tDataType: schemapb.DataType_FloatVector,\n\t\t\t\tTypeParams: []*commonpb.KeyValuePair{\n\t\t\t\t\t{Key: common.DimKey, Value: \"4\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn schema\n}", "func (s *Manager) GetSchemas(ctx context.Context, project, dbAlias, col string) ([]interface{}, error) {\n\t// Acquire a lock\n\ttype response struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dbAlias != \"\" && col != \"\" {\n\t\tcollectionInfo, ok := projectConfig.Modules.Crud[dbAlias].Collections[col]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"collection (%s) not present in config for dbAlias (%s) )\", dbAlias, col)\n\t\t}\n\t\treturn []interface{}{map[string]*response{fmt.Sprintf(\"%s-%s\", dbAlias, col): {Schema: collectionInfo.Schema}}}, nil\n\t} else if dbAlias != \"\" {\n\t\tcollections := projectConfig.Modules.Crud[dbAlias].Collections\n\t\tcoll := map[string]*response{}\n\t\tfor key, value := range collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbAlias, key)] = &response{Schema: value.Schema}\n\t\t}\n\t\treturn []interface{}{coll}, nil\n\t}\n\tdatabases := projectConfig.Modules.Crud\n\tcoll := map[string]*response{}\n\tfor dbName, dbInfo := range databases {\n\t\tfor key, value := range dbInfo.Collections {\n\t\t\tcoll[fmt.Sprintf(\"%s-%s\", dbName, key)] = &response{Schema: value.Schema}\n\t\t}\n\t}\n\treturn []interface{}{coll}, nil\n}", "func (s *Manager) SetSchemaInspection(ctx context.Context, project, dbAlias, col, schema string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update schema in config\n\tcollection, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn errors.New(\"specified database not present in config\")\n\t}\n\n\tif collection.Collections == nil {\n\t\tcollection.Collections = map[string]*config.TableRule{}\n\t}\n\ttemp, ok := collection.Collections[col]\n\tif !ok {\n\t\tcollection.Collections[col] = &config.TableRule{Schema: schema, Rules: map[string]*config.Rule{}}\n\t} else {\n\t\ttemp.Schema = schema\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func VisualizeSchema(next gen.Generator) gen.Generator {\n\treturn gen.GenerateFunc(func(g *gen.Graph) error {\n\t\tbuf, err := generateHTML(g)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpath := filepath.Join(g.Config.Target, \"schema-viz.html\")\n\t\tif err := os.WriteFile(path, buf, 0644); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn next.Generate(g)\n\t})\n}", "func (s *Manager) SetReloadSchema(ctx context.Context, dbAlias, project string, schemaArg *schema.Schema) (map[string]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollectionConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn nil, errors.New(\"specified database not present in config\")\n\t}\n\tcolResult := map[string]interface{}{}\n\tfor colName, colValue := range collectionConfig.Collections {\n\t\tif colName == \"default\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult, err := schemaArg.SchemaInspection(ctx, dbAlias, project, colName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set new schema in config & return in response body\n\t\tcolValue.Schema = result\n\t\tcolResult[colName] = result\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn colResult, s.setProject(ctx, projectConfig)\n}", "func (ld *LocalDocker) IntrospectSchema() (*tengo.Schema, error) {\n\treturn ld.d.Schema(ld.schemaName)\n}", "func servicesSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\ts := schema{\n\t\tTitle: \"service collection\",\n\t\tType: \"array\",\n\t\tItems: &schema{\n\t\t\tRef: \"http://myhost.com/schema/service\",\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func getAllSchemaColumns(t *testing.T) *schema.ColCollection {\n\tcolColl, err := schema.NewColCollection(\n\t\tschema.NewColumn(\"id\", 0, types.IntKind, true),\n\t\tschema.NewColumn(\"first\", 1, types.StringKind, false),\n\t\tschema.NewColumn(\"last\", 2, types.StringKind, false),\n\t\tschema.NewColumn(\"is_married\", 3, types.BoolKind, false),\n\t\tschema.NewColumn(\"age\", 4, types.IntKind, false),\n\t\tschema.NewColumn(\"rating\", 5, types.FloatKind, false),\n\t\tschema.NewColumn(\"uuid\", 6, types.UUIDKind, false),\n\t\tschema.NewColumn(\"num_episodes\", 7, types.UintKind, false),\n\t\tschema.NewColumn(\"id\", 8, types.IntKind, true),\n\t\tschema.NewColumn(\"name\", 9, types.StringKind, false),\n\t\tschema.NewColumn(\"air_date\", 10, types.IntKind, false),\n\t\tschema.NewColumn(\"rating\", 11, types.FloatKind, false),\n\t\tschema.NewColumn(\"character_id\", 12, types.IntKind, true),\n\t\tschema.NewColumn(\"episode_id\", 13, types.IntKind, true),\n\t\tschema.NewColumn(\"comments\", 14, types.StringKind, false),\n\t)\n\n\trequire.NoError(t, err)\n\treturn colColl\n}", "func (d *Driver) ConfigSchema() (*hclspec.Spec, error) {\n\treturn configSpec, nil\n}", "func CatalogSchema() *gojsonschema.Schema {\n\treturn loadSchema(\"catalog.schema.json\")\n}", "func (s *Manager) SetModifySchema(ctx context.Context, project, dbAlias, col, schema string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update schema in config\n\tcollection, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn errors.New(\"specified database not present in config\")\n\t}\n\tif collection.Collections == nil {\n\t\tcollection.Collections = map[string]*config.TableRule{}\n\t}\n\ttemp, ok := collection.Collections[col]\n\tif !ok {\n\t\tcollection.Collections[col] = &config.TableRule{Schema: schema, Rules: map[string]*config.Rule{}}\n\t} else {\n\t\ttemp.Schema = schema\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func SchemaUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tupdatedSchema := schemas.Schema{}\n\n\terr = json.NewDecoder(r.Body).Decode(&updatedSchema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif updatedSchema.FullName != \"\" {\n\t\t_, schemaName, err := schemas.ExtractSchema(updatedSchema.FullName)\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tupdatedSchema.Name = schemaName\n\t}\n\n\tschema, err := schemas.Update(schemasList.Schemas[0], updatedSchema.Name, updatedSchema.Type, updatedSchema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel []query.Selection, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.Doc, sel, __SchemaImplementors, ec.Variables)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t\t// return\n\t}\n}", "func (ec *executionContext) ___Schema(sel []query.Selection, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.doc, sel, __SchemaImplementors, ec.variables)\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(field, obj)\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(field, obj)\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}", "func updateSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tif params.database == schema.DryrunDBName {\n\t\tp := *params\n\t\tif err := doCreateDatabase(p, p.database); err != nil {\n\t\t\treturn handleErr(fmt.Errorf(\"error creating dryrun database: %v\", err))\n\t\t}\n\t\tdefer doDropDatabase(p, p.database)\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Update(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func (mc *MongoClient) GetCollectionHandler(name string) *mongo.Collection {\n\tif name == \"\" {\n\t\tmc.logger.Fatalw(\"you have not set mongodb collection name\")\n\t}\n\treturn mc.getDbHandler().Collection(name)\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\t\tif out.Values[i] == graphql.Null {\n\t\t\t\tinvalid = true\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func RetrieveSchema(service service.MetaDataMgmtService, schemaMap map[string]*entity.Schema) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlogger.Logger.Debug(\"Entering handler.RetrieveSchema() handler...\")\n\n\t\t// #1 - Parse path parameters & request headers\n\t\tvar resource string\n\t\tvar catalogType string\n\t\tvar resourceType string\n\t\tvars := mux.Vars(r)\n\t\tif vars != nil {\n\n\t\t\tcatalogType = vars[\"catalog\"]\n\t\t\tresource = vars[\"resourceType\"]\n\t\t\tresourceType = \"urn:resource:\" + catalogType + \":\" + resource\n\t\t}\n\t\tvar validURNs []string\n\t\tfor _, subres := range schemaMap {\n\n\t\t\tvalidURNs = append(validURNs, subres.URN)\n\t\t}\n\t\tfmt.Print(validURNs[0])\n\n\t\t// #2 - Validate input\n\t\terrors := validateSchemaResourceType(resourceType, validURNs)\n\t\tif errors != nil {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write(buildSchemaMetaDataMgmtFailureRespBody(entity.ErrInvalidInputResourceType))\n\t\t\treturn\n\t\t}\n\n\t\t// #3 - Fetch the Schema\n\t\tvar smap = schemaMap[resourceType].Data\n\n\t\t// #4 - Build and return success response\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(buildSchemaMetaDataMgmtSuccessRespBody(smap))\n\t\treturn\n\t})\n}", "func (h *HTTPApi) ensureCollection(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n\tdefer r.Body.Close()\n\tbytes, _ := ioutil.ReadAll(r.Body)\n\n\tvar collection metadata.Collection\n\tif err := json.Unmarshal(bytes, &collection); err == nil {\n\t\tmeta := h.storageNode.Datasources[ps.ByName(\"datasource\")].GetMeta()\n\t\tif db, ok := meta.Databases[ps.ByName(\"dbname\")]; ok {\n\t\t\tif shardInstance, ok := db.ShardInstances[ps.ByName(\"shardinstance\")]; ok {\n\t\t\t\tif err := h.storageNode.Datasources[ps.ByName(\"datasource\")].EnsureExistsCollection(r.Context(), db, shardInstance, &collection); err != nil {\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t\tw.Write([]byte(err.Error()))\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n}", "func hookConfigurationSchema() *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeList,\n\t\tOptional: true,\n\t\tMaxItems: 1,\n\t\tElem: &schema.Resource{\n\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\"invocation_condition\": func() *schema.Schema {\n\t\t\t\t\tschema := documentAttributeConditionSchema()\n\t\t\t\t\treturn schema\n\t\t\t\t}(),\n\t\t\t\t\"lambda_arn\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: verify.ValidARN,\n\t\t\t\t},\n\t\t\t\t\"s3_bucket\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: validation.All(\n\t\t\t\t\t\tvalidation.StringLenBetween(3, 63),\n\t\t\t\t\t\tvalidation.StringMatch(\n\t\t\t\t\t\t\tregexp.MustCompile(`[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]`),\n\t\t\t\t\t\t\t\"Must be a valid bucket name\",\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}", "func (h *HTTPApi) viewCollection(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tmeta := h.storageNode.Datasources[ps.ByName(\"datasource\")].GetMeta()\n\tif db, ok := meta.Databases[ps.ByName(\"dbname\")]; ok {\n\t\tif shardInstance, ok := db.ShardInstances[ps.ByName(\"shardinstance\")]; ok {\n\t\t\tif collection, ok := shardInstance.Collections[ps.ByName(\"collectionname\")]; ok {\n\t\t\t\t// Now we need to return the results\n\t\t\t\tif bytes, err := json.Marshal(collection); err == nil {\n\t\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\t\tw.Write(bytes)\n\t\t\t\t} else {\n\t\t\t\t\t// TODO: log this better?\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n}", "func ShowSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\tif schema, err := conf.LoadSchema(index); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t} else {\n\t\tc.JSON(http.StatusOK, schema.SchemaConf)\n\t}\n}", "func (client GroupClient) GetSchemaResponder(resp *http.Response) (result USQLSchema, 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}", "func appSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\thost, err := config.GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := []link{\n\t\t{\"href\": host + \"/apps/{name}/log\", \"method\": \"GET\", \"rel\": \"log\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"GET\", \"rel\": \"get_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"POST\", \"rel\": \"set_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"DELETE\", \"rel\": \"unset_env\"},\n\t\t{\"href\": host + \"/apps/{name}/restart\", \"method\": \"GET\", \"rel\": \"restart\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"POST\", \"rel\": \"update\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"DELETE\", \"rel\": \"delete\"},\n\t\t{\"href\": host + \"/apps/{name}/run\", \"method\": \"POST\", \"rel\": \"run\"},\n\t}\n\ts := schema{\n\t\tTitle: \"app schema\",\n\t\tType: \"object\",\n\t\tLinks: l,\n\t\tRequired: []string{\"platform\", \"name\"},\n\t\tProperties: map[string]property{\n\t\t\t\"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"platform\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"ip\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"cname\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func HandleReloadSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tschema := modules.Schema()\n\t\tcolResult, err := syncman.SetReloadSchema(ctx, dbAlias, projectID, schema)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: colResult})\n\t\t// return\n\t}\n}", "func GetCollectionStatList(client *mongo.Client) *CollectionStatList {\n\tcollectionStatList := &CollectionStatList{}\n\tdbNames, err := client.ListDatabaseNames(context.TODO(), bson.M{})\n\tif err != nil {\n\t\tif !logSuppressCS.Contains(keyCS) {\n\t\t\tlog.Warnf(\"%s. Collection stats will not be collected. This log message will be suppressed from now.\", err)\n\t\t\tlogSuppressCS.Add(keyCS)\n\t\t}\n\t\treturn nil\n\t}\n\n\tlogSuppressCS.Delete(keyCS)\n\tfor _, dbName := range dbNames {\n\t\tif common.IsSystemDB(dbName) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcollNames, err := client.Database(dbName).ListCollectionNames(context.TODO(), bson.M{})\n\t\tif err != nil {\n\t\t\tif !logSuppressCS.Contains(dbName) {\n\t\t\t\tlog.Warnf(\"%s. Collection stats will not be collected for this db. This log message will be suppressed from now.\", err)\n\t\t\t\tlogSuppressCS.Add(dbName)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tlogSuppressCS.Delete(dbName)\n\t\tfor _, collName := range collNames {\n\t\t\tif common.IsSystemCollection(collName) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfullCollName := common.CollFullName(dbName, collName)\n\t\t\tcollStatus := CollectionStatus{}\n\t\t\tres := client.Database(dbName).RunCommand(context.TODO(), bson.D{{\"collStats\", collName}, {\"scale\", 1}})\n\t\t\tif err = res.Decode(&collStatus); err != nil {\n\t\t\t\tif !logSuppressCS.Contains(fullCollName) {\n\t\t\t\t\tlog.Warnf(\"%s. Collection stats will not be collected for this collection. This log message will be suppressed from now.\", err)\n\t\t\t\t\tlogSuppressCS.Add(fullCollName)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogSuppressCS.Delete(fullCollName)\n\t\t\tcollStatus.Database = dbName\n\t\t\tcollStatus.Name = collName\n\t\t\tcollectionStatList.Members = append(collectionStatList.Members, collStatus)\n\t\t}\n\t}\n\n\treturn collectionStatList\n}", "func (e AggregateEvent) Schema() string { return \"aggregate\" }", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func SchemaListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList.Schemas[0], \"\", \" \")\n\trespondOK(w, output)\n}", "func (c *Client) Schema() error {\n\t_, err := c.db.DB().Exec(Schema)\n\treturn err\n}", "func (r *Reflector) SchemaEns() *spec.AsyncAPI {\n\tif r.Schema == nil {\n\t\tr.Schema = &spec.AsyncAPI{}\n\t}\n\n\treturn r.Schema\n}", "func (tqsc *Controller) ReloadSchema(ctx context.Context) error {\n\treturn nil\n}", "func GetAllSchemaInfo(db rdbmstool.DbHandlerProxy) ([]SchemaInfo, error) {\n\tsqlStr := `\n\tSELECT a.id, a.name, a.description, a.is_active, \n\t\tMAX(b.revision), SUM(CASE WHEN b.revision = -1 THEN 1 ELSE 0 END)\n\tFROM doc_schema a\n\tLEFT JOIN doc_schema_revision b ON a.id = b.schema_id\n\tGROUP BY a.id`\n\n\trows, rowsErr := db.Query(sqlStr)\n\tif rowsErr != nil {\n\t\treturn nil, fmt.Errorf(\"error encounter access database: %s\", rowsErr.Error())\n\t}\n\n\tdefer rows.Close()\n\n\tvar tmpID, tmpName, tmpDesc string\n\tvar tmpLatestRev, tmpIsActive, tmpHasDraft int\n\tresults := []SchemaInfo{}\n\tfor rows.Next() {\n\t\tscanErr := rows.Scan(&tmpID, &tmpName, &tmpDesc, &tmpIsActive, &tmpLatestRev, &tmpHasDraft)\n\t\tif scanErr != nil {\n\t\t\tif scanErr == sql.ErrNoRows {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to fetch record from database: %s\", scanErr.Error())\n\t\t\t}\n\t\t}\n\n\t\tresults = append(results, SchemaInfo{\n\t\t\tID: tmpID,\n\t\t\tName: tmpName,\n\t\t\tLatestRevision: tmpLatestRev,\n\t\t\tDescription: tmpDesc,\n\t\t\tIsActive: tmpIsActive == 1,\n\t\t\tHasDraft: tmpHasDraft == 1,\n\t\t})\n\t}\n\n\treturn results, nil\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func getCountCollection(dbConfig databaseConfig) (countCollection, error) {\n\t// countCollection to store the tableCounts\n\tvar countCollection countCollection\n\t// Initialize both Increment and Row maps\n\tcountCollection.Increment = make(map[string]int)\n\tcountCollection.Row = make(map[string]int)\n\n\t// Database Source Name\n\tvar dsn string\n\n\tvar dbType string\n\tif dbConfig.Type == \"\" {\n\t\t// If no type is specified, set it to MySQL, since that is the default anyway\n\t\tdbType = \"mysql\"\n\t} else {\n\t\t// Otherwise, set it to the type specified in the config YAML\n\t\tdbType = dbConfig.Type\n\t}\n\n\tvar dbSchema string\n\tif dbConfig.Schema == \"\" {\n\t\t// If no schema was explicitly defined, use a default value\n\t\tif dbType == \"mysql\" {\n\t\t\t// If it's a MySQL db, use the db name as the default schema\n\t\t\tdbSchema = dbConfig.Database\n\t\t} else if dbType == \"postgres\" {\n\t\t\t// If it's a PostgreSQL db, use the public schema as the default\n\t\t\tdbSchema = \"public\"\n\t\t} else {\n\t\t\t// Otherwise, use the db name as the default schema\n\t\t\tdbSchema = dbConfig.Name\n\t\t}\n\t} else {\n\t\t// Otherwise, use the defined schema\n\t\tdbSchema = dbConfig.Schema\n\t}\n\n\tif dbType == \"mysql\" {\n\t\t// If it's a MySQL db, generate a MySQL DSN\n\t\tdsn = fmt.Sprintf(\"%s:%s@tcp(%s)/%s\", dbConfig.User, dbConfig.Password, dbConfig.Host, dbConfig.Database)\n\t} else if dbType == \"postgres\" {\n\t\t// If it's a PostgreSQL db, generate a PostgreSQL DSN\n\t\tdsn = fmt.Sprintf(\"postgres://%s:%s@%s/%s\", dbConfig.User, dbConfig.Password, dbConfig.Host, dbConfig.Database)\n\t} else {\n\t\t// Otherwise, generate a MySQL DSN by default as it is the most consistent\n\t\tdsn = fmt.Sprintf(\"%s:%s@tcp(%s)/%s\", dbConfig.User, dbConfig.Password, dbConfig.Host, dbConfig.Database)\n\t}\n\n\t// Create the database connection using the type and DSN\n\tdb, err := sql.Open(dbType, dsn)\n\tif err != nil {\n\t\treturn countCollection, err\n\t}\n\tdefer db.Close()\n\n\tvar (\n\t\tincrementQuery string\n\t\tincrementArgs []interface{}\n\t\trowQuery string\n\t\trowArgs []interface{}\n\t)\n\n\tif dbConfig.Type == \"mysql\" {\n\t\t// If it's a MySQL database, generate MySQL query interfaces\n\t\tif len(dbConfig.Tables.Increment) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull auto increment values for the specified tables\n\t\t\tincrementQuery, incrementArgs, err = sqlx.In(\"SELECT `TABLE_NAME`, `AUTO_INCREMENT` FROM information_schema.TABLES WHERE TABLE_NAME IN (?) AND TABLE_SCHEMA = ?\", dbConfig.Tables.Increment, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble increment query interface: %s\", err)\n\t\t\t}\n\t\t}\n\n\t\tif len(dbConfig.Tables.Row) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull the number of rows for the specified tables\n\t\t\trowQuery, rowArgs, err = sqlx.In(\"SELECT `TABLE_NAME`, `TABLE_ROWS` FROM information_schema.TABLES WHERE TABLE_NAME IN (?) AND TABLE_SCHEMA = ?\", dbConfig.Tables.Row, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble row query interface: %s\", err)\n\t\t\t}\n\t\t}\n\t} else if dbConfig.Type == \"postgres\" {\n\t\t// If it's a PostgreSQL datbase, generate PostgreSQL query interfaces\n\t\t// Currently, both Increment and Row use the same query, as it is non-trivial to obtain the auto-increment value\n\t\t// TODO: Figure out how to obtain auto-increment values efficiently\n\t\tif len(dbConfig.Tables.Increment) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull the number of rows for the specified tables\n\t\t\tincrementQuery, incrementArgs, err = sqlx.In(\"SELECT relname,n_live_tup FROM pg_stat_user_tables WHERE relname IN (?) AND schemaname = ?\", dbConfig.Tables.Increment, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble increment query interface: %s\", err)\n\t\t\t}\n\t\t\t// Rebind the interface to use $1, $2, etc instead of ?, ?, etc as this is required by the PostgreSQL driver\n\t\t\tincrementQuery = sqlx.Rebind(sqlx.DOLLAR, incrementQuery)\n\t\t}\n\n\t\tif len(dbConfig.Tables.Row) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull the number of rows for the specified tables\n\t\t\trowQuery, rowArgs, err = sqlx.In(\"SELECT relname,n_live_tup FROM pg_stat_user_tables WHERE relname IN (?) AND schemaname = ?\", dbConfig.Tables.Row, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble row query interface: %s\", err)\n\t\t\t}\n\t\t\t// Rebind the interface to use $1, $2, etc instead of ?, ?, etc as this is required by the PostgreSQL driver\n\t\t\trowQuery = sqlx.Rebind(sqlx.DOLLAR, rowQuery)\n\t\t}\n\t} else {\n\t\t// Otherwise, generate MySQL query interfaces by default, as MySQL is the default type anyway\n\t\tif len(dbConfig.Tables.Increment) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull auto increment values for the specified tables\n\t\t\tincrementQuery, incrementArgs, err = sqlx.In(\"SELECT TABLE_NAME,AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_NAME IN (?) AND TABLE_SCHEMA = ?\", dbConfig.Tables.Increment, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble increment query interface: %s\", err)\n\t\t\t}\n\t\t}\n\n\t\tif len(dbConfig.Tables.Row) > 0 {\n\t\t\t// Generate the query and slice of arguments to pull the number of rows for the specified tables\n\t\t\trowQuery, rowArgs, err = sqlx.In(\"SELECT TABLE_NAME,TABLE_ROWS FROM information_schema.TABLES WHERE TABLE_NAME IN (?) AND TABLE_SCHEMA = ?\", dbConfig.Tables.Row, dbSchema)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Failed to assemble row query interface: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif incrementQuery != \"\" && len(incrementArgs) > 0 {\n\t\t// Query for all of the auto increment tables\n\t\trows, err := db.Query(incrementQuery, incrementArgs...)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: Failed to query database %s: %s\", dbConfig.Name, err)\n\t\t} else {\n\t\t\tdefer rows.Close()\n\n\t\t\tfor rows.Next() {\n\t\t\t\t// Go through each row retrieved\n\t\t\t\tvar (\n\t\t\t\t\ttableName string\n\t\t\t\t\ttableCount int\n\t\t\t\t)\n\n\t\t\t\t// Assign the values to vars\n\t\t\t\terr := rows.Scan(&tableName, &tableCount)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"ERROR: Failed to obtain values in database %s for table %s: %s\", dbConfig.Name, tableName, err)\n\t\t\t\t} else {\n\t\t\t\t\t// Set the count for the table key in the Increment map\n\t\t\t\t\tcountCollection.Increment[tableName] = tableCount\n\n\t\t\t\t\tlog.Printf(\"INFO: Obtained value in database %s for table %s with count %d\", dbConfig.Name, tableName, tableCount)\n\t\t\t\t}\n\n\t\t\t\t// If there were any errors, output\n\t\t\t\terr = rows.Err()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"ERROR: Row failures for database %s: %s\", dbConfig.Name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif rowQuery != \"\" && len(rowArgs) > 0 {\n\t\t// If the number of row tables isn't empty, query\n\t\t// Query for all of the row count tables\n\t\trows, err := db.Query(rowQuery, rowArgs...)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: Failed to query database %s: %s\", dbConfig.Name, err)\n\t\t} else {\n\t\t\tdefer rows.Close()\n\n\t\t\tfor rows.Next() {\n\t\t\t\t// Go through each row retrieved\n\t\t\t\tvar (\n\t\t\t\t\ttableName string\n\t\t\t\t\ttableCount int\n\t\t\t\t)\n\n\t\t\t\t// Assign the values to vars\n\t\t\t\terr := rows.Scan(&tableName, &tableCount)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"ERROR: Failed to obtain values in database %s for table %s: %s\", dbConfig.Name, tableName, err)\n\t\t\t\t} else {\n\t\t\t\t\t// Set the count for the table key in the Row map\n\t\t\t\t\tcountCollection.Row[tableName] = tableCount\n\n\t\t\t\t\tlog.Printf(\"INFO: Obtained value in database %s for table %s with count %d\", dbConfig.Name, tableName, tableCount)\n\t\t\t\t}\n\n\t\t\t\t// If there were any errors, output\n\t\t\t\terr = rows.Err()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"ERROR: Row failures for database %s: %s\", dbConfig.Name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Assuming no fatal errors, return nil\n\treturn countCollection, nil\n}", "func AlterSchema(dg *dgo.Dgraph, ctx *context.Context, schema *string) error {\n\top := &api.Operation{}\n\top.Schema = *schema\n\terr := dg.Alter(*ctx, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (p *hostingdeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {\n\tresp.Schema = schema.Schema{\n\t\tAttributes: map[string]schema.Attribute{\n\t\t\t\"account_id\": schema.StringAttribute{\n\t\t\t\tDescription: \"Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"auth_token\": schema.StringAttribute{\n\t\t\t\tDescription: \"Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func AddSchemaInfo(db rdbmstool.DbHandlerProxy, name string, description string) error {\n\tsqlStr := `SELECT COUNT(name) FROM doc_schema WHERE name = ?`\n\n\trow := db.QueryRow(sqlStr, name)\n\tvar tmpInt int\n\tscanErr := row.Scan(&tmpInt)\n\tif scanErr != nil {\n\t\tif scanErr == sql.ErrNoRows {\n\t\t\ttmpInt = 0\n\t\t} else {\n\t\t\treturn scanErr\n\t\t}\n\t}\n\n\tif tmpInt > 0 {\n\t\treturn ErrSchemaInfoAlreadyExists{msg: name + \" already exists\"}\n\t}\n\n\t//get next ID\n\t// currentID, currErr := util.GetDBColumnMaxInt(db, \"doc_schema\", \"id\")\n\t// if currErr != nil {\n\t// \treturn fmt.Errorf(\"failed to acquire latest record ID: %s\", currErr.Error())\n\t// }\n\t// currentID++\n\tnewID, idErr := stringtool.GenerateRandomUUID()\n\tif idErr != nil {\n\t\treturn fmt.Errorf(\"failed to generate ID for new schema %s\", name)\n\t}\n\n\tsqlInsert := `INSERT INTO doc_schema (id, name, description, is_active) VALUES (?,?,?,1)`\n\t_, dbErr := db.Exec(sqlInsert, newID, name, description)\n\tif dbErr != nil {\n\t\treturn fmt.Errorf(\"failed to create %s schemaInfo into database: %s\", name, dbErr.Error())\n\t}\n\n\treturn nil\n}", "func (drv ClickHouseDriver) DumpSchema(u *url.URL, db *sql.DB) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tvar err error\n\n\terr = clickhouseSchemaDump(db, &buf, drv.databaseName(u))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = clickhouseSchemaMigrationsDump(db, &buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "func getChartVersionSchema(w http.ResponseWriter, req *http.Request, params Params) {\n\tdb, closer := dbSession.DB()\n\tdefer closer()\n\tvar files models.ChartFiles\n\tfileID := fmt.Sprintf(\"%s/%s-%s\", params[\"repo\"], params[\"chartName\"], params[\"version\"])\n\tif err := db.C(filesCollection).FindId(fileID).One(&files); err != nil {\n\t\tlog.WithError(err).Errorf(\"could not find values.schema.json with id %s\", fileID)\n\t\thttp.NotFound(w, req)\n\t\treturn\n\t}\n\n\tw.Write([]byte(files.Schema))\n}", "func (c serverResources) OpenAPISchema() (*openapiv2.Document, error) {\n\treturn c.cachedClient.OpenAPISchema()\n}", "func (m *ExternalConnection) SetSchema(value Schemaable)() {\n m.schema = value\n}", "func (app *Apollo) GetCollection(c *gin.Context) {\n\tpid := c.Param(\"pid\")\n\ttgtFormat := c.Query(\"format\")\n\tif tgtFormat == \"\" {\n\t\ttgtFormat = \"json\"\n\t}\n\tif tgtFormat != \"json\" && tgtFormat != \"xml\" && tgtFormat != \"uvamap\" {\n\t\tlog.Printf(\"ERROR: Unsupported format for %s requested %s\", tgtFormat, pid)\n\t\tc.String(http.StatusBadRequest, fmt.Sprintf(\"unsupported format %s\", tgtFormat))\n\t\treturn\n\t}\n\tlog.Printf(\"INFO: get collection for PID %s as %s\", pid, tgtFormat)\n\tstartTime := time.Now()\n\trootID, dbErr := lookupIdentifier(&app.DB, pid)\n\tif dbErr != nil {\n\t\tlog.Printf(\"ERROR: %s\", dbErr.Error())\n\t\tc.String(http.StatusNotFound, dbErr.Error())\n\t\treturn\n\t}\n\n\troot, dbErr := getTree(&app.DB, rootID.ID)\n\tif dbErr != nil {\n\t\tlog.Printf(\"ERROR: %s\", dbErr.Error())\n\t\tc.String(http.StatusInternalServerError, dbErr.Error())\n\t\treturn\n\t}\n\telapsedNanoSec := time.Since(startTime)\n\telapsedMS := int64(elapsedNanoSec / time.Millisecond)\n\n\tlog.Printf(\"INFO: collection tree retrieved from DB; sending to client. Elapsed Time: %d (ms)\", elapsedMS)\n\tif tgtFormat == \"json\" {\n\t\t//c.Header(\"Content-Disposition\", fmt.Sprintf(\"attachment; filename=%s.json\", pid))\n\t\tc.JSON(http.StatusOK, root)\n\t} else {\n\t\txml, err := generateXML(root, tgtFormat)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: unable to generate XML for %s: %s\", pid, err.Error())\n\t\t\tc.String(http.StatusInternalServerError, \"unable to generate XML content\")\n\t\t\treturn\n\t\t}\n\t\tc.Header(\"Content-Disposition\", fmt.Sprintf(\"attachment; filename=%s.xml\", pid))\n\t\tc.Header(\"Content-Type\", \"application/xml\")\n\t\tc.String(http.StatusOK, xml)\n\t}\n}", "func UpgradeSchema(database *models.Database) error {\n\tdb, err := getDatabase(database)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn db.UpgradeSchema()\n}", "func (b *Backend) watchCollection() error {\n\t// Filter any documents that don't have a key. If the collection is shared between\n\t// the cluster state and audit events, this filters out the event documents since they\n\t// have a different schema, and it's a requirement for all resources to have a key.\n\tquery := b.svc.Collection(b.CollectionName).Where(keyDocProperty, \"!=\", \"\")\n\tif b.LimitWatchQuery {\n\t\tquery = query.Where(timestampDocProperty, \">=\", b.clock.Now().UTC().Add(-driftTolerance).Unix())\n\t}\n\n\tsnaps := query.Snapshots(b.clientContext)\n\tb.buf.SetInit()\n\tdefer b.buf.Reset()\n\tdefer snaps.Stop()\n\n\tfor {\n\t\tquerySnap, err := snaps.Next()\n\t\tif err == context.Canceled {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn ConvertGRPCError(err)\n\t\t}\n\t\tfor _, change := range querySnap.Changes {\n\t\t\tr, err := newRecordFromDoc(change.Doc)\n\t\t\tif err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\tvar e backend.Event\n\t\t\tswitch change.Kind {\n\t\t\tcase firestore.DocumentAdded, firestore.DocumentModified:\n\t\t\t\te = backend.Event{\n\t\t\t\t\tType: types.OpPut,\n\t\t\t\t\tItem: r.backendItem(),\n\t\t\t\t}\n\t\t\tcase firestore.DocumentRemoved:\n\t\t\t\te = backend.Event{\n\t\t\t\t\tType: types.OpDelete,\n\t\t\t\t\tItem: backend.Item{\n\t\t\t\t\t\tKey: r.Key,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t\tb.buf.Emit(e)\n\t\t}\n\t}\n}", "func (d *Describe) Schema() sql.Schema {\n\treturn sql.Schema{{\n\t\tName: \"name\",\n\t\tType: VarChar25000,\n\t}, {\n\t\tName: \"type\",\n\t\tType: VarChar25000,\n\t}}\n}", "func UpdateSchemaInfo(db rdbmstool.DbHandlerProxy, docInfo *SchemaInfo) error {\n\trow := db.QueryRow(`SELECT COUNT(id) FROM doc_schema WHERE id = ?`, docInfo.ID)\n\tvar tmpInt int\n\terr := row.Scan(&tmpInt)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn ErrSchemaInfoNotFound{msg: fmt.Sprintf(\"%s not found in database\", docInfo.Name)}\n\t\t}\n\n\t\treturn err\n\t}\n\n\tif tmpInt == 0 {\n\t\treturn ErrSchemaInfoNotFound{msg: fmt.Sprintf(\"%s not found in database\", docInfo.Name)}\n\t}\n\n\t_, updateErr := db.Exec(\n\t\t`UPDATE doc_schema SET name = ?, description = ?, is_active = ? WHERE id = ?`,\n\t\tdocInfo.Name, docInfo.Description, docInfo.IsActive, docInfo.ID)\n\n\tif updateErr != nil {\n\t\treturn fmt.Errorf(\"failed to update schema info's description: %s\", updateErr.Error())\n\t}\n\n\treturn nil\n}", "func BackendSchema(factoryName string) (*config.ConfigurationSchema, error) {\n\tif backendRegistry[factoryName] == nil {\n\t\treturn nil, fmt.Errorf(\"The adapter %s is not registered Processor cannot be created\", factoryName)\n\t}\n\treturn backendRegistry[factoryName].configurationSchema, nil\n}", "func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {\n\n\tif schema.AdditionalItems != nil {\n\t\ts := schema.AdditionalItems.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalItems\")\n\t\t}\n\t}\n\n\tif schema.Items != nil {\n\t\tif schema.Items.SchemaArray != nil {\n\t\t\tfor _, s := range *(schema.Items.SchemaArray) {\n\t\t\t\ts.applyToSchemas(operation, \"Items.SchemaArray\")\n\t\t\t}\n\t\t} else if schema.Items.Schema != nil {\n\t\t\tschema.Items.Schema.applyToSchemas(operation, \"Items.Schema\")\n\t\t}\n\t}\n\n\tif schema.AdditionalProperties != nil {\n\t\ts := schema.AdditionalProperties.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalProperties\")\n\t\t}\n\t}\n\n\tif schema.Properties != nil {\n\t\tfor _, pair := range *(schema.Properties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Properties\")\n\t\t}\n\t}\n\tif schema.PatternProperties != nil {\n\t\tfor _, pair := range *(schema.PatternProperties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"PatternProperties\")\n\t\t}\n\t}\n\n\tif schema.Dependencies != nil {\n\t\tfor _, pair := range *(schema.Dependencies) {\n\t\t\tschemaOrStringArray := pair.Value\n\t\t\ts := schemaOrStringArray.Schema\n\t\t\tif s != nil {\n\t\t\t\ts.applyToSchemas(operation, \"Dependencies\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif schema.AllOf != nil {\n\t\tfor _, s := range *(schema.AllOf) {\n\t\t\ts.applyToSchemas(operation, \"AllOf\")\n\t\t}\n\t}\n\tif schema.AnyOf != nil {\n\t\tfor _, s := range *(schema.AnyOf) {\n\t\t\ts.applyToSchemas(operation, \"AnyOf\")\n\t\t}\n\t}\n\tif schema.OneOf != nil {\n\t\tfor _, s := range *(schema.OneOf) {\n\t\t\ts.applyToSchemas(operation, \"OneOf\")\n\t\t}\n\t}\n\tif schema.Not != nil {\n\t\tschema.Not.applyToSchemas(operation, \"Not\")\n\t}\n\n\tif schema.Definitions != nil {\n\t\tfor _, pair := range *(schema.Definitions) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Definitions\")\n\t\t}\n\t}\n\n\toperation(schema, context)\n}", "func (*MongodConfig4_0_Storage_WiredTiger_CollectionConfig) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mongodb_v1_config_mongodb4_0_proto_rawDescGZIP(), []int{0, 0, 0, 1}\n}", "func fixOpenAPISchema(name string, schema *openapi3.Schema) {\n\tt := schema.Type\n\tswitch t {\n\tcase \"object\":\n\t\tfor k, v := range schema.Properties {\n\t\t\ts := v.Value\n\t\t\tfixOpenAPISchema(k, s)\n\t\t}\n\tcase \"array\":\n\t\tfixOpenAPISchema(\"\", schema.Items.Value)\n\t}\n\tif name != \"\" {\n\t\tschema.Title = name\n\t}\n\n\tdescription := schema.Description\n\tif strings.Contains(description, UsageTag) {\n\t\tdescription = strings.Split(description, UsageTag)[1]\n\t}\n\tif strings.Contains(description, ShortTag) {\n\t\tdescription = strings.Split(description, ShortTag)[0]\n\t\tdescription = strings.TrimSpace(description)\n\t}\n\tschema.Description = description\n}", "func ValidateSchemaInBody(weaviateSchema *models.SemanticSchema, bodySchema *models.Schema, className string, dbConnector dbconnector.DatabaseConnector, serverConfig *config.WeaviateConfig) error {\n\t// Validate whether the class exists in the given schema\n\t// Get the class by its name\n\tclass, err := schema.GetClassByName(weaviateSchema, className)\n\n\t// Return the error, in this case that the class is not found\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate whether the properties exist in the given schema\n\t// Get the input properties from the bodySchema in readable format\n\tisp := *bodySchema\n\n\tif isp == nil {\n\t\treturn nil\n\t}\n\n\tinputSchema := isp.(map[string]interface{})\n\n\t// For each property in the input schema\n\tfor pk, pv := range inputSchema {\n\t\t// Get the property data type from the schema\n\t\tdt, err := schema.GetPropertyDataType(class, pk)\n\n\t\t// Return the error, in this case that the property is not found\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Check whether the datatypes are correct\n\t\tif *dt == schema.DataTypeCRef {\n\t\t\t// Cast it to a usable variable\n\t\t\tpvcr := pv.(map[string]interface{})\n\n\t\t\t// Return different types of errors for cref input\n\t\t\tif len(pvcr) != 3 {\n\t\t\t\t// Give an error if the cref is not filled with correct number of properties\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires exactly 3 arguments: '$cref', 'locationUrl' and 'type'. Check your input schema\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t)\n\t\t\t} else if _, ok := pvcr[\"$cref\"]; !ok {\n\t\t\t\t// Give an error if the cref is not filled with correct properties ($cref)\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires exactly 3 arguments: '$cref', 'locationUrl' and 'type'. '$cref' is missing, check your input schema\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t)\n\t\t\t} else if _, ok := pvcr[\"locationUrl\"]; !ok {\n\t\t\t\t// Give an error if the cref is not filled with correct properties (locationUrl)\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires exactly 3 arguments: '$cref', 'locationUrl' and 'type'. 'locationUrl' is missing, check your input schema\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t)\n\t\t\t} else if _, ok := pvcr[\"type\"]; !ok {\n\t\t\t\t// Give an error if the cref is not filled with correct properties (type)\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires exactly 3 arguments: '$cref', 'locationUrl' and 'type'. 'type' is missing, check your input schema\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Return error if type is not right, when it is not one of the 3 possible types\n\t\t\trefType := pvcr[\"type\"].(string)\n\t\t\tif !validateRefType(refType) {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires one of the following values in 'type': '%s', '%s' or '%s'\",\n\t\t\t\t\tclass.Class, pk,\n\t\t\t\t\tconnutils.RefTypeAction,\n\t\t\t\t\tconnutils.RefTypeThing,\n\t\t\t\t\tconnutils.RefTypeKey,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// TODO: https://github.com/creativesoftwarefdn/weaviate/issues/237 Validate using / existing locationURL?\n\t\t\t// Validate whether reference exists based on given Type\n\t\t\tcrefu := strfmt.UUID(pvcr[\"$cref\"].(string))\n\t\t\tif refType == connutils.RefTypeAction {\n\t\t\t\tar := &models.ActionGetResponse{}\n\t\t\t\tare := dbConnector.GetAction(crefu, ar)\n\t\t\t\tif are != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error finding the 'cref' to an Action in the database: %s\", are)\n\t\t\t\t}\n\t\t\t} else if refType == connutils.RefTypeKey {\n\t\t\t\tkr := &models.KeyGetResponse{}\n\t\t\t\tkre := dbConnector.GetKey(crefu, kr)\n\t\t\t\tif kre != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error finding the 'cref' to a Key in the database: %s\", kre)\n\t\t\t\t}\n\t\t\t} else if refType == connutils.RefTypeThing {\n\t\t\t\ttr := &models.ThingGetResponse{}\n\t\t\t\ttre := dbConnector.GetThing(crefu, tr)\n\t\t\t\tif tre != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error finding the 'cref' to a Thing in the database: %s\", tre)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if *dt == schema.DataTypeString {\n\t\t\t// Return error when the input can not be casted to a string\n\t\t\tif _, ok := pv.(string); !ok {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires a string. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if *dt == schema.DataTypeInt {\n\t\t\t// Return error when the input can not be casted to json.Number\n\t\t\tif _, ok := pv.(json.Number); !ok {\n\t\t\t\t// If value is not a json.Number, it could be an int, which is fine\n\t\t\t\tif _, ok := pv.(int64); !ok {\n\t\t\t\t\t// If value is not a json.Number, it could be an int, which is fine when the float does not contain a decimal\n\t\t\t\t\tif vFloat, ok := pv.(float64); ok {\n\t\t\t\t\t\t// Check whether the float is containing a decimal\n\t\t\t\t\t\tif vFloat != float64(int64(vFloat)) {\n\t\t\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\t\t\"class '%s' with property '%s' requires an integer. The given value is '%v'\",\n\t\t\t\t\t\t\t\tclass.Class,\n\t\t\t\t\t\t\t\tpk,\n\t\t\t\t\t\t\t\tpv,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it is not a float, it is cerntainly not a integer, return the error\n\t\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\t\"class '%s' with property '%s' requires an integer. The given value is '%v'\",\n\t\t\t\t\t\t\tclass.Class,\n\t\t\t\t\t\t\tpk,\n\t\t\t\t\t\t\tpv,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if _, err := pv.(json.Number).Int64(); err != nil {\n\t\t\t\t// Return error when the input can not be converted to an int\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires an integer, the JSON number could not be converted to an int. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\n\t\t} else if *dt == schema.DataTypeNumber {\n\t\t\t// Return error when the input can not be casted to json.Number\n\t\t\tif _, ok := pv.(json.Number); !ok {\n\t\t\t\tif _, ok := pv.(float64); !ok {\n\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\"class '%s' with property '%s' requires a float. The given value is '%v'\",\n\t\t\t\t\t\tclass.Class,\n\t\t\t\t\t\tpk,\n\t\t\t\t\t\tpv,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else if _, err := pv.(json.Number).Float64(); err != nil {\n\t\t\t\t// Return error when the input can not be converted to a float\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires a float, the JSON number could not be converted to a float. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if *dt == schema.DataTypeBoolean {\n\t\t\t// Return error when the input can not be casted to a boolean\n\t\t\tif _, ok := pv.(bool); !ok {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires a bool. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if *dt == schema.DataTypeDate {\n\t\t\t// Return error when the input can not be casted to a string\n\t\t\tif _, ok := pv.(string); !ok {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires a string with a RFC3339 formatted date. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Parse the time as this has to be correct\n\t\t\t_, err := time.Parse(time.RFC3339, pv.(string))\n\n\t\t\t// Return if there is an error while parsing\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"class '%s' with property '%s' requires a string with a RFC3339 formatted date. The given value is '%v'\",\n\t\t\t\t\tclass.Class,\n\t\t\t\t\tpk,\n\t\t\t\t\tpv,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (*MongodConfig4_4_Storage_WiredTiger_CollectionConfig) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mongodb_v1_config_mongodb4_4_proto_rawDescGZIP(), []int{0, 0, 0, 1}\n}", "func (c *DefaultConstr) GetSchema(conn *sql.DB) (string, error) {\n\treturn \"\", ErrorNotSupport\n}", "func (i *blockIter) Schema() sql.Schema {\n\treturn i.sch\n}", "func InitSchema() {\n\tup()\n}", "func (_ NetConfig) OpenAPISchemaType() []string { return []string{\"object\"} }", "func (m *ExternalConnection) GetSchema()(Schemaable) {\n return m.schema\n}", "func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error {\n\tgvk := schema.GroupVersionKind{\n\t\tGroup: crd.Spec.Group,\n\t\tVersion: GetVersionFromCRD(crd),\n\t\tKind: crd.Spec.Names.Kind,\n\t}\n\tif schemaRef.GVK.String() != gvk.String() {\n\t\treturn fmt.Errorf(\"unexpected mismatch of GVK when updating schema reference for controller, old GVK = %s, new GVK = %s\", schemaRef.GVK.String(), gvk.String())\n\t}\n\tschemaRef.CRD = crd\n\tschemaRef.JsonSchema = GetOpenAPIV3SchemaFromCRD(crd)\n\treturn nil\n}", "func ensureCollection(ctx context.Context, name string) {\n\t_, err := db.Collection(ctx, name)\n\tif driver.IsNotFound(err) {\n\t\t_, err = db.CreateCollection(ctx, name, nil)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"[ArangoDB][ensureCollection] failed to create collection '%v': %v\", name, err)\n\t\t}\n\t} else if err != nil {\n\t\tlogger.Errorf(\"[ArangoDB][ensureCollection] failed to open collection '%v': %v\", name, err)\n\t}\n\n\tlogger.Debugf(\"[ArangoDB][ensureCollection] %v ok.\", name)\n}", "func (db *DatabaseModel) SetSchema(schema *ovsdb.DatabaseSchema) []error {\n\tdb.mutex.Lock()\n\tdefer db.mutex.Unlock()\n\terrors := db.client.validate(schema)\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\tdb.schema = schema\n\tdb.mapper = mapper.NewMapper(schema)\n\terrs := db.generateModelInfo()\n\tif len(errs) > 0 {\n\t\tdb.schema = nil\n\t\tdb.mapper = nil\n\t\treturn errs\n\t}\n\treturn []error{}\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (t *TikvHandlerTool) Schema() (infoschema.InfoSchema, error) {\n\tdom, err := session.GetDomain(t.Store)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dom.InfoSchema(), nil\n}", "func LoadCollectionConfig(dialect *SQLDialect) *DatabaseModel {\n\tconf := ModelConfig{\n\t\tCreate: `CREATE TABLE IF NOT EXISTS collection (\n\t\tid $TEXT PRIMARY KEY,\n\t\ttitle $TEXT NOT NULL,\n\t\tvolume $INT NOT NULL,\n\t\tpublication_year $INT NOT NULL,\n\t\tedition $INT NOT NULL,\n\t\tcollector_id $TEXT NOT NULL,\n\t\toclc $TEXT NOT NULL,\n\t\tlccn $TEXT NOT NULL,\n\t\tisbn $TEXT NOT NULL,\n\t\tCONSTRAINT collector_fk\n\t\t FOREIGN KEY (collector_id)\n\t\t REFERENCES person(id)\n\t\t);`,\n\t\tConstraints: \"\",\n\t}\n\treturn NewDatabaseModel(dialect, conf)\n}", "func SchemaChange(svc string, cluster string, sdb string, table string, inputType string, output string, version int, formatType string, alter string, dst string) error {\n\tvar ts types.TableSchema\n\tvar rs string\n\tvar err error\n\n\tif rs, err = schema.GetRaw(&db.Loc{Cluster: cluster, Service: svc, Name: sdb}, table, inputType); log.E(err) {\n\t\treturn err\n\t}\n\n\tif !schema.MutateTable(state.GetDB(), svc, sdb, table, alter, &ts, &rs) {\n\t\treturn fmt.Errorf(\"error applying alter table\")\n\t}\n\n\tavroSchema, err := schema.ConvertToAvroFromSchema(&ts, formatType)\n\tif log.E(err) {\n\t\treturn err\n\t}\n\n\toutputSchemaName, err := encoder.GetOutputSchemaName(svc, sdb, table, inputType, output, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dst == \"state\" || dst == \"all\" {\n\t\terr = state.UpdateSchema(outputSchemaName, formatType, string(avroSchema))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"Change schema for(%v,%v,%v,%v,%v,%v) = %s, from %v\", svc, sdb, table, inputType, output, version, avroSchema, alter)\n\treturn nil\n}", "func (c *Insert) Schema() (res []Column, err error) {\n\tresp, err := http.Get(c.schemaURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get table schema: %s\", err)\n\t}\n\tdefer func() {\n\t\tif cErr := resp.Body.Close(); cErr != nil {\n\t\t\tif err == nil {\n\t\t\t\terr = cErr\n\t\t\t}\n\t\t}\n\t}()\n\tif resp.StatusCode != http.StatusOK {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out error schema response (status %d): %s\", resp.StatusCode, err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get a schema: %s (%s)\", string(data), err)\n\t}\n\n\tscanner := bufio.NewScanner(resp.Body)\n\tfor scanner.Scan() {\n\t\tvar col Column\n\t\tif err := json.Unmarshal(scanner.Bytes(), &col); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read out schema response: %s\", err)\n\t\t}\n\t\tres = append(res, col)\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to reao out schema response: %s\", err)\n\t}\n\n\treturn res, nil\n}", "func PrecreateCollectionsMiddleware(mongoDBuri string) gin.HandlerFunc {\n\n\tclient, err := mongowrapper.Connect(context.Background(), options.Client().ApplyURI(mongoDBuri))\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"PrecreateCollectionsMiddleware can't connect to MongoDB\"))\n\t}\n\n\tcollectionsToCreate := models2.AllFhirResourceCollectionNames()\n\n\t// cached databases that we've already checked/created\n\tvar dbsAlreadyDone sync.Map\n\n\treturn func(c *gin.Context) {\n\n\t\tdbName := c.GetHeader(\"Db\")\n\t\tif dbName == \"\" {\n\t\t\tdbName = \"fhir\"\n\t\t}\n\n\t\t_, done := dbsAlreadyDone.Load(dbName)\n\n\t\tif !done {\n\t\t\tctx, span := trace.StartSpan(c.Request.Context(), \"create_collections\")\n\t\t\tspan.AddAttributes(trace.StringAttribute(\"db\", dbName))\n\t\t\tdefer span.End()\n\n\t\t\terr := CreateCollections(ctx, collectionsToCreate, dbName, client)\n\t\t\tif err != nil {\n\t\t\t\tpanic(errors.Wrap(err, \"PrecreateCollectionsMiddleware failed\"))\n\t\t\t}\n\t\t\tdbsAlreadyDone.Store(dbName, true)\n\t\t}\n\n\t\tc.Next()\n\t}\n}", "func (h HTTPHandler) CollectionMappingGet(w http.ResponseWriter, r *http.Request) {\n\terr := processJWT(r, false, h.secret)\n\tif err != nil {\n\t\thttp.Error(w, \"{\\\"message\\\": \\\"\"+err.Error()+\"\\\"}\", 401)\n\t\treturn\n\t}\n\n\t// find the index to operate on\n\tvars := mux.Vars(r)\n\tindexName := vars[\"name\"]\n\n\tif nil == h.bf.Local.Search.BlockchainIndices[indexName] {\n\t\thttp.Error(w, \"{\\\"message\\\": \\\"the collection \"+indexName+\" doesn't exist\\\"}\", 404)\n\t\treturn\n\t}\n\n\tvar indexMapping *blockchain.DocumentMapping\n\terr = h.bf.Local.Db.View(func(dbtx *bolt.Tx) error {\n\t\tb := dbtx.Bucket([]byte(blockchain.CollectionsBucket))\n\n\t\tif b == nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"route\": \"HandleCollectionMappingGet\",\n\t\t\t\t\"address\": r.Header.Get(\"address\"),\n\t\t\t}).Warn(\"bucket doesn't exist\")\n\t\t\treturn errors.New(\"bucket doesn't exist\")\n\t\t}\n\n\t\tencodedIndexMapping := b.Get([]byte(indexName))\n\n\t\tif encodedIndexMapping == nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"route\": \"HandleCollectionMappingGet\",\n\t\t\t\t\"address\": r.Header.Get(\"address\"),\n\t\t\t}).Error(\"collection doesn't exist\")\n\t\t\treturn errors.New(\"collection doesn't exist\")\n\t\t}\n\t\tindexMapping = blockchain.DeserializeDocumentMapping(encodedIndexMapping)\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\thttp.Error(w, \"{\\\"message\\\": \\\"could not find the collection\\\"}\", 404)\n\t\treturn\n\t}\n\n\trv := struct {\n\t\tMessage string `json:\"message\"`\n\t\tMapping blockchain.DocumentMapping `json:\"mapping\"`\n\t}{\n\t\tMessage: \"ok\",\n\t\tMapping: *indexMapping,\n\t}\n\n\tmustEncode(w, rv)\n}", "func GetUserConfigSchema(t string) map[string]interface{} {\n\tif _, ok := getUserConfigurationOptionsSchemaFilenames()[t]; !ok {\n\t\tlog.Panicf(\"user configuration options schema type `%s` is not available\", t)\n\t}\n\n\treturn userConfigSchemas[t]\n}", "func (v *IADs) Schema() (path string, err error) {\n\tvar bstr *int16\n\thr, _, _ := syscall.Syscall(\n\t\tuintptr(v.VTable().Schema),\n\t\t2,\n\t\tuintptr(unsafe.Pointer(v)),\n\t\tuintptr(unsafe.Pointer(&bstr)),\n\t\t0)\n\tif bstr != nil {\n\t\tdefer ole.SysFreeString(bstr)\n\t}\n\tif hr == 0 {\n\t\tpath = ole.BstrToString((*uint16)(unsafe.Pointer(bstr)))\n\t} else {\n\t\treturn \"\", convertHresultToError(hr)\n\t}\n\treturn\n}", "func (v *actorInfoViewType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (k *xyzProvider) GetSchema(ctx context.Context, req *pulumirpc.GetSchemaRequest) (*pulumirpc.GetSchemaResponse, error) {\n\treturn &pulumirpc.GetSchemaResponse{}, nil\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func (m *MongoClient) initAllCollection() {\n\tm.UserCollection = m.Database.Collection(Collections[UserCollection])\n\tm.ProjectCollection = m.Database.Collection(Collections[ProjectCollection])\n\n\t// Initialize chaos infra collection\n\terr := m.Database.CreateCollection(context.TODO(), Collections[ChaosInfraCollection], nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create chaosInfrastructures collection\")\n\t}\n\n\tm.ChaosInfraCollection = m.Database.Collection(Collections[ChaosInfraCollection])\n\t_, err = m.ChaosInfraCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"infra_id\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create indexes for chaosInfrastructures collection\")\n\t}\n\n\t// Initialize chaos experiment collection\n\terr = m.Database.CreateCollection(context.TODO(), Collections[ChaosExperimentCollection], nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create chaosExperiments collection\")\n\t}\n\n\tm.ChaosExperimentCollection = m.Database.Collection(Collections[ChaosExperimentCollection])\n\t_, err = m.ChaosExperimentCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"experiment_id\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create indexes for chaosExperiments collection\")\n\t}\n\n\t// Initialize chaos experiment runs collection\n\terr = m.Database.CreateCollection(context.TODO(), Collections[ChaosExperimentRunsCollection], nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create chaosExperimentRuns collection\")\n\t}\n\n\tm.ChaosExperimentRunsCollection = m.Database.Collection(Collections[ChaosExperimentRunsCollection])\n\t_, err = m.ChaosExperimentRunsCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"experiment_run_id\": 1,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"failed to create indexes for chaosExperimentRuns collection\")\n\t}\n\n\t// Initialize chaos hubs collection\n\terr = m.Database.CreateCollection(context.TODO(), Collections[ChaosHubCollection], nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create chaosHubs collection\")\n\t}\n\n\tm.ChaosHubCollection = m.Database.Collection(Collections[ChaosHubCollection])\n\t_, err = m.ChaosHubCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"hub_id\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"failed to create indexes for chaosHubs collection\")\n\t}\n\n\tm.GitOpsCollection = m.Database.Collection(Collections[GitOpsCollection])\n\t_, err = m.GitOpsCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"project_id\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"Error Creating Index for GitOps Collection : \", err)\n\t}\n\tm.ImageRegistryCollection = m.Database.Collection(Collections[ImageRegistryCollection])\n\tm.ServerConfigCollection = m.Database.Collection(Collections[ServerConfigCollection])\n\t_, err = m.ServerConfigCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"key\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"Error Creating Index for Server Config Collection : \", err)\n\t}\n\tm.EnvironmentCollection = m.Database.Collection(Collections[EnvironmentCollection])\n\t_, err = m.EnvironmentCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"environment_id\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"failed to create indexes for environments collection\")\n\t}\n\t// Initialize chaos probes collection\n\terr = m.Database.CreateCollection(context.TODO(), Collections[ChaosProbeCollection], nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create chaosProbes collection\")\n\t}\n\n\tm.ChaosProbeCollection = m.Database.Collection(Collections[ChaosProbeCollection])\n\t_, err = m.ChaosProbeCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.M{\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t\tOptions: options.Index().SetUnique(true),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{\n\t\t\t\t{\"project_id\", 1},\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"failed to create indexes for chaosProbes collection\")\n\t}\n}", "func (m *Mixin) GetSchema() (string, error) {\n\tb, err := m.schema.Find(\"kustomize.json\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(b), nil\n}", "func NewSwaggerSchemaFor(delegate discovery.SwaggerSchemaInterface, gv schema.GroupVersion) (*SwaggerSchema, error) {\n\tlog.Debugf(\"Fetching schema for %v\", gv)\n\tswagger, err := delegate.SwaggerSchema(gv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SwaggerSchema{api: swagger, delegate: delegate}, nil\n}", "func AdminCollection(c *mongo.Database) {\n\tadminCollection = c.Collection(\"admins\")\n}", "func (v *nicerButSlowerFilmListViewType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (s *BaseMySqlParserListener) EnterCollectionOptions(ctx *CollectionOptionsContext) {}", "func (a *ArangoDb) collection(ctx context.Context, colName string) (arango.Collection, error) {\n\tvar col arango.Collection\n\n\tcol, err := (*a.Db).Collection(ctx, colName)\n\n\tif arango.IsNotFound(err) {\n\t\tcol, err = (*a.Db).CreateCollection(ctx, colName, nil)\n\t} else if err != nil {\n\t\treturn nil, &e.Error{Code: e.EINTERNAL, Op: \"db.collection\", Err: err}\n\t}\n\n\treturn col, nil\n}", "func structToSchema(prog *Program, name, tagName string, ref Reference) (*Schema, error) {\n\tschema := &Schema{\n\t\tTitle: name,\n\t\tDescription: ref.Info,\n\t\tType: \"object\",\n\t\tProperties: map[string]*Schema{},\n\t}\n\n\tfor _, p := range ref.Fields {\n\t\tif p.KindField == nil {\n\t\t\treturn nil, fmt.Errorf(\"p.KindField is nil for %v\", name)\n\t\t}\n\n\t\tname = goutil.TagName(p.KindField, tagName)\n\n\t\tif name == \"-\" {\n\t\t\tcontinue\n\t\t}\n\t\tif name == \"\" {\n\t\t\tname = p.Name\n\t\t}\n\n\t\tprop, err := fieldToSchema(prog, name, tagName, ref, p.KindField)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse %v: %v\", ref.Lookup, err)\n\t\t}\n\n\t\tif !sliceutil.Contains([]string{\"path\", \"query\", \"form\"}, ref.Context) {\n\t\t\tfixRequired(schema, prop)\n\t\t}\n\n\t\tif prop == nil {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"structToSchema: prop is nil for field %#v in %#v\",\n\t\t\t\tname, ref.Lookup)\n\t\t}\n\n\t\tschema.Properties[name] = prop\n\t}\n\n\treturn schema, nil\n}", "func initSchema(ctx context.Context, db *sqlx.DB, log *log.Logger, isUnittest bool) func(*sqlx.DB) error {\n\tf := func(db *sqlx.DB) error {\n\t\treturn nil\n\t}\n\n\treturn f\n}", "func ImageConfigSchema() *gojsonschema.Schema {\n\treturn loadSchema(\"image-config.schema.json\")\n}", "func (v *Vuln) Schema() *schema.NVDCVEFeedJSON10DefCVEItem {\n\treturn v.cveItem\n}", "func (c *DefaultApiService) FetchSchema(Id string) (*EventsV1Schema, error) {\n\tpath := \"/v1/Schemas/{Id}\"\n\tpath = strings.Replace(path, \"{\"+\"Id\"+\"}\", Id, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tresp, err := c.requestHandler.Get(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &EventsV1Schema{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "func (s *ShowTableStatus) Schema() sql.Schema { return showTableStatusSchema }" ]
[ "0.6002191", "0.5668754", "0.55984676", "0.54508936", "0.5389286", "0.53730094", "0.5371129", "0.53263897", "0.5297817", "0.52953386", "0.52618605", "0.5245622", "0.52429086", "0.5224411", "0.5188879", "0.5187949", "0.5158642", "0.5144006", "0.5132363", "0.5129445", "0.50949985", "0.50784385", "0.5066133", "0.50408953", "0.50334734", "0.50334734", "0.50334734", "0.5010154", "0.49538612", "0.49452743", "0.4893954", "0.48459738", "0.48378518", "0.48366874", "0.48295236", "0.4810661", "0.4804584", "0.47943684", "0.4781353", "0.47692823", "0.476583", "0.47650144", "0.47480077", "0.47435132", "0.47435132", "0.4730015", "0.47205886", "0.46952653", "0.46952653", "0.4688658", "0.46845108", "0.46749392", "0.46704152", "0.46686143", "0.46673915", "0.46670938", "0.4622293", "0.46087742", "0.46086514", "0.46061254", "0.4596131", "0.45941493", "0.45873052", "0.45803323", "0.45800233", "0.45761016", "0.4570853", "0.45641145", "0.455343", "0.45464742", "0.4545392", "0.454235", "0.45412356", "0.4540901", "0.4540851", "0.45335385", "0.45256004", "0.45212972", "0.45155862", "0.4506083", "0.4504117", "0.4503333", "0.44991118", "0.4496886", "0.44917604", "0.44898745", "0.44751787", "0.44749025", "0.44723874", "0.4463621", "0.44568598", "0.4454221", "0.44443828", "0.44431165", "0.44426507", "0.4434252", "0.44317475", "0.4428559", "0.44263753", "0.44253978" ]
0.8027757
0
HandleModifyAllSchema is an endpoint handler which updates the existing schema & updates the config
func HandleModifyAllSchema(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get the JWT token from header token := utils.GetTokenFromHeader(r) v := config.CrudStub{} _ = json.NewDecoder(r.Body).Decode(&v) defer utils.CloseTheCloser(r.Body) // Check if the request is authorised if err := adminMan.IsTokenValid(token); err != nil { _ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error()) return } vars := mux.Vars(r) dbAlias := vars["dbAlias"] projectID := vars["project"] // Create a context of execution ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) defer cancel() if err := syncman.SetModifyAllSchema(ctx, dbAlias, projectID, v); err != nil { _ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error()) return } _ = utils.SendOkayResponse(w) // return } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func HandleModifySchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.TableRule{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\t\tcol := vars[\"col\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\tif err := schema.SchemaModifyAll(ctx, dbAlias, logicalDBName, map[string]*config.TableRule{col: &v}); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetModifySchema(ctx, projectID, dbAlias, col, v.Schema); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func (s *Manager) SetModifyAllSchema(ctx context.Context, dbAlias, project string, v config.CrudStub) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.applySchemas(ctx, project, dbAlias, projectConfig, v); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func HandleReloadSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\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\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tschema := modules.Schema()\n\t\tcolResult, err := syncman.SetReloadSchema(ctx, dbAlias, projectID, schema)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: colResult})\n\t\t// return\n\t}\n}", "func SchemaUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tupdatedSchema := schemas.Schema{}\n\n\terr = json.NewDecoder(r.Body).Decode(&updatedSchema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif updatedSchema.FullName != \"\" {\n\t\t_, schemaName, err := schemas.ExtractSchema(updatedSchema.FullName)\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tupdatedSchema.Name = schemaName\n\t}\n\n\tschema, err := schemas.Update(schemasList.Schemas[0], updatedSchema.Name, updatedSchema.Type, updatedSchema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func HandleSetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\ttype schemaRequest struct {\n\t\tSchema string `json:\"schema\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for set eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\tc := schemaRequest{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&c)\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, c)\n\t\tstatus, err := syncMan.SetEventingSchema(ctx, projectID, evType, c.Schema, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func (m *memStoreImpl) handleTableSchemaChange(tableSchemaChangeEvents <-chan *metaCom.Table, done chan<- struct{}) {\n\tfor table := range tableSchemaChangeEvents {\n\t\tm.applyTableSchema(table)\n\t\tdone <- struct{}{}\n\t}\n\tclose(done)\n}", "func Update(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tfor i, elem := range schema {\n\t\tif elem.Config.Name == params[\"name\"] {\n\t\t\tschema = append(schema[:i], schema[i+1:]...)\n\t\t\tvar updateSchema Schema\n\t\t\tjson.NewDecoder(r.Body).Decode(&updateSchema)\n\t\t\tupdateSchema.Config.Name = params[\"name\"]\n\t\t\tschema = append(schema, updateSchema)\n\t\t\tjson.NewEncoder(w).Encode(updateSchema)\n\t\t\treturn\n\t\t}\n\t}\n}", "func updateSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tif params.database == schema.DryrunDBName {\n\t\tp := *params\n\t\tif err := doCreateDatabase(p, p.database); err != nil {\n\t\t\treturn handleErr(fmt.Errorf(\"error creating dryrun database: %v\", err))\n\t\t}\n\t\tdefer doDropDatabase(p, p.database)\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Update(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func (tqsc *Controller) ReloadSchema(ctx context.Context) error {\n\treturn nil\n}", "func SchemaListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", \"\", refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList, \"\", \" \")\n\trespondOK(w, output)\n}", "func (s *Service) reloadSchema(pkg factset.Package, schemaVersion *factset.PackageVersion) error {\n\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Debugf(\"Reloading schema for package: %s\", pkg.Product)\n\tif err := s.db.DropTablesWithProductAndBundle(pkg.Product, pkg.Bundle); err != nil {\n\t\treturn err\n\t}\n\tschemaFileDetails := s.getSchemaDetails(pkg, schemaVersion)\n\tschemaFileArchive, err := s.factset.Download(*schemaFileDetails, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tschemaFiles, err := s.unzipFile(schemaFileArchive, pkg.Product)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, file := range schemaFiles {\n\t\tif strings.HasSuffix(file, \".sql\") {\n\t\t\tfileContents, err := ioutil.ReadFile(file)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithFields(log.Fields{\"fs_product\": pkg.Product}).Errorf(\"Could not read file: %s\", file)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = s.db.CreateTablesFromSchema(fileContents, pkg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Infof(\"Updated schema for product %s to version v%d_%d\", pkg.Product, schemaVersion.FeedVersion, schemaVersion.Sequence)\n\t\t}\n\t}\n\treturn nil\n}", "func HandleGetSchemas(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\t// get project id and dbType from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tdbAlias := \"\"\n\t\tdbAliasQuery, exists := r.URL.Query()[\"dbAlias\"]\n\t\tif exists {\n\t\t\tdbAlias = dbAliasQuery[0]\n\t\t}\n\t\tcolQuery, exists := r.URL.Query()[\"col\"]\n\t\tcol := \"\"\n\t\tif exists {\n\t\t\tcol = colQuery[0]\n\t\t}\n\t\tschemas, err := syncMan.GetSchemas(ctx, projectID, dbAlias, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: schemas})\n\t}\n}", "func SchemaChange(svc string, cluster string, sdb string, table string, inputType string, output string, version int, formatType string, alter string, dst string) error {\n\tvar ts types.TableSchema\n\tvar rs string\n\tvar err error\n\n\tif rs, err = schema.GetRaw(&db.Loc{Cluster: cluster, Service: svc, Name: sdb}, table, inputType); log.E(err) {\n\t\treturn err\n\t}\n\n\tif !schema.MutateTable(state.GetDB(), svc, sdb, table, alter, &ts, &rs) {\n\t\treturn fmt.Errorf(\"error applying alter table\")\n\t}\n\n\tavroSchema, err := schema.ConvertToAvroFromSchema(&ts, formatType)\n\tif log.E(err) {\n\t\treturn err\n\t}\n\n\toutputSchemaName, err := encoder.GetOutputSchemaName(svc, sdb, table, inputType, output, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dst == \"state\" || dst == \"all\" {\n\t\terr = state.UpdateSchema(outputSchemaName, formatType, string(avroSchema))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"Change schema for(%v,%v,%v,%v,%v,%v) = %s, from %v\", svc, sdb, table, inputType, output, version, avroSchema, alter)\n\treturn nil\n}", "func (gc *GraphClient) UpdateSchema(sg schema.SchemaGraph) error {\n\trequestBody := PutGraphSchemaRequestBody{}\n\trequestBody.Schema = sg\n\n\tb, err := json.Marshal(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to marshall request body\")\n\t}\n\n\treq, err := gc.newRequest(context.Background(), \"PUT\", \"/api/graph/schema\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := gc.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode == http.StatusUnauthorized {\n\t\treturn fmt.Errorf(\"Unauthorized access. Check your auth token\")\n\t} else if res.StatusCode == http.StatusTooManyRequests {\n\t\treturn ErrTooManyRequests\n\t} else if res.StatusCode != http.StatusOK {\n\t\treturn handleUnexpectedResponse(res)\n\t}\n\treturn nil\n}", "func HandleInspectCollectionSchema(adminMan *admin.Manager, modules *modules.Modules, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Create a context of execution\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tcol := vars[\"col\"]\n\t\tprojectID := vars[\"project\"]\n\t\tlogicalDBName, err := syncman.GetLogicalDatabaseName(ctx, projectID, dbAlias)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\t\tschema := modules.Schema()\n\t\ts, err := schema.SchemaInspection(ctx, dbAlias, logicalDBName, col)\n\t\tif err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif err := syncman.SetSchemaInspection(ctx, projectID, dbAlias, col, s); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendResponse(w, http.StatusOK, model.Response{Result: s})\n\t\t// return\n\t}\n}", "func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {\n\n\tif schema.AdditionalItems != nil {\n\t\ts := schema.AdditionalItems.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalItems\")\n\t\t}\n\t}\n\n\tif schema.Items != nil {\n\t\tif schema.Items.SchemaArray != nil {\n\t\t\tfor _, s := range *(schema.Items.SchemaArray) {\n\t\t\t\ts.applyToSchemas(operation, \"Items.SchemaArray\")\n\t\t\t}\n\t\t} else if schema.Items.Schema != nil {\n\t\t\tschema.Items.Schema.applyToSchemas(operation, \"Items.Schema\")\n\t\t}\n\t}\n\n\tif schema.AdditionalProperties != nil {\n\t\ts := schema.AdditionalProperties.Schema\n\t\tif s != nil {\n\t\t\ts.applyToSchemas(operation, \"AdditionalProperties\")\n\t\t}\n\t}\n\n\tif schema.Properties != nil {\n\t\tfor _, pair := range *(schema.Properties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Properties\")\n\t\t}\n\t}\n\tif schema.PatternProperties != nil {\n\t\tfor _, pair := range *(schema.PatternProperties) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"PatternProperties\")\n\t\t}\n\t}\n\n\tif schema.Dependencies != nil {\n\t\tfor _, pair := range *(schema.Dependencies) {\n\t\t\tschemaOrStringArray := pair.Value\n\t\t\ts := schemaOrStringArray.Schema\n\t\t\tif s != nil {\n\t\t\t\ts.applyToSchemas(operation, \"Dependencies\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif schema.AllOf != nil {\n\t\tfor _, s := range *(schema.AllOf) {\n\t\t\ts.applyToSchemas(operation, \"AllOf\")\n\t\t}\n\t}\n\tif schema.AnyOf != nil {\n\t\tfor _, s := range *(schema.AnyOf) {\n\t\t\ts.applyToSchemas(operation, \"AnyOf\")\n\t\t}\n\t}\n\tif schema.OneOf != nil {\n\t\tfor _, s := range *(schema.OneOf) {\n\t\t\ts.applyToSchemas(operation, \"OneOf\")\n\t\t}\n\t}\n\tif schema.Not != nil {\n\t\tschema.Not.applyToSchemas(operation, \"Not\")\n\t}\n\n\tif schema.Definitions != nil {\n\t\tfor _, pair := range *(schema.Definitions) {\n\t\t\ts := pair.Value\n\t\t\ts.applyToSchemas(operation, \"Definitions\")\n\t\t}\n\t}\n\n\toperation(schema, context)\n}", "func ReloadSchema() {\n\tdefer logError()\n\tSqlQueryRpcService.qe.schemaInfo.triggerReload()\n}", "func HandleDeleteEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tevType := vars[\"id\"]\n\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"modify\", map[string]string{\"project\": projectID, \"id\": evType})\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to validate token for delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\t\tstatus, err := syncMan.SetDeleteEventingSchema(ctx, projectID, evType, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Logger.LogError(helpers.GetRequestID(ctx), \"Failed to delete eventing schema\", err, nil)\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\n\t\t_ = helpers.Response.SendOkayResponse(ctx, status, w)\n\t}\n}", "func AlterSchema(dg *dgo.Dgraph, ctx *context.Context, schema *string) error {\n\top := &api.Operation{}\n\top.Schema = *schema\n\terr := dg.Alter(*ctx, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ConfigUpdateAllHandler(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tlogging.Logger.Error(\"failed to parse update config form\", zap.Any(\"error\", err))\n\t\treturn\n\t}\n\tmb := chain.GetServerChain().GetCurrentMagicBlock()\n\tminers := mb.Miners.Nodes\n\tfor _, miner := range miners {\n\t\tif node.Self.Underlying().PublicKey != miner.PublicKey {\n\t\t\tgo func(miner *node.Node) {\n\t\t\t\tresp, err := http.PostForm(miner.GetN2NURLBase()+updateConfigURL, r.Form)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.Logger.Error(\"failed to update other miner's config\", zap.Any(\"miner\", miner.GetKey()), zap.Any(\"response\", resp), zap.Any(\"error\", err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdefer resp.Body.Close()\n\t\t\t}(miner)\n\t\t}\n\t}\n\tupdateConfig(w, r, updateConfigAllURL)\n}", "func (s *Manager) SetReloadSchema(ctx context.Context, dbAlias, project string, schemaArg *schema.Schema) (map[string]interface{}, error) {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollectionConfig, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn nil, errors.New(\"specified database not present in config\")\n\t}\n\tcolResult := map[string]interface{}{}\n\tfor colName, colValue := range collectionConfig.Collections {\n\t\tif colName == \"default\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult, err := schemaArg.SchemaInspection(ctx, dbAlias, project, colName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set new schema in config & return in response body\n\t\tcolValue.Schema = result\n\t\tcolResult[colName] = result\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn colResult, s.setProject(ctx, projectConfig)\n}", "func HandleGetEventingSchema(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\t// get project id and type from url\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\t\tid := \"*\"\n\t\ttyp, exists := r.URL.Query()[\"id\"]\n\t\tif exists {\n\t\t\tid = typ[0]\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)\n\t\tdefer cancel()\n\n\t\t// Check if the request is authorised\n\t\treqParams, err := adminMan.IsTokenValid(ctx, token, \"eventing-schema\", \"read\", map[string]string{\"project\": projectID, \"id\": id})\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)\n\t\t\treturn\n\t\t}\n\n\t\treqParams = utils.ExtractRequestParams(r, reqParams, nil)\n\n\t\tstatus, schemas, err := syncMan.GetEventingSchema(ctx, projectID, id, reqParams)\n\t\tif err != nil {\n\t\t\t_ = helpers.Response.SendErrorResponse(ctx, w, status, err)\n\t\t\treturn\n\t\t}\n\t\t_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: schemas})\n\t}\n}", "func appSchema(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\thost, err := config.GetString(\"host\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := []link{\n\t\t{\"href\": host + \"/apps/{name}/log\", \"method\": \"GET\", \"rel\": \"log\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"GET\", \"rel\": \"get_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"POST\", \"rel\": \"set_env\"},\n\t\t{\"href\": host + \"/apps/{name}/env\", \"method\": \"DELETE\", \"rel\": \"unset_env\"},\n\t\t{\"href\": host + \"/apps/{name}/restart\", \"method\": \"GET\", \"rel\": \"restart\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"POST\", \"rel\": \"update\"},\n\t\t{\"href\": host + \"/apps/{name}\", \"method\": \"DELETE\", \"rel\": \"delete\"},\n\t\t{\"href\": host + \"/apps/{name}/run\", \"method\": \"POST\", \"rel\": \"run\"},\n\t}\n\ts := schema{\n\t\tTitle: \"app schema\",\n\t\tType: \"object\",\n\t\tLinks: l,\n\t\tRequired: []string{\"platform\", \"name\"},\n\t\tProperties: map[string]property{\n\t\t\t\"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"platform\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"ip\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t\t\"cname\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t},\n\t\t},\n\t}\n\treturn json.NewEncoder(w).Encode(s)\n}", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func generateGoSchemaFile(schema map[string]interface{}, config Config) {\r\n var obj map[string]interface{}\r\n var schemas = make(map[string]interface{})\r\n var outString = \"package main\\n\\nvar schemas = `\\n\"\r\n\r\n var filename = config.Schemas.GoSchemaFilename\r\n var apiFunctions = config.Schemas.API\r\n var elementNames = config.Schemas.GoSchemaElements\r\n \r\n var functionKey = \"API\"\r\n var objectModelKey = \"objectModelSchemas\"\r\n \r\n schemas[functionKey] = interface{}(make(map[string]interface{}))\r\n schemas[objectModelKey] = interface{}(make(map[string]interface{}))\r\n\r\n fmt.Printf(\"Generate Go SCHEMA file %s for: \\n %s and: \\n %s\\n\", filename, apiFunctions, elementNames)\r\n\r\n // grab the event API functions for input\r\n for i := range apiFunctions {\r\n functionSchemaName := \"#/definitions/API/\" + apiFunctions[i]\r\n functionName := apiFunctions[i]\r\n obj = getObject(schema, functionSchemaName)\r\n if obj == nil {\r\n fmt.Printf(\"** WARN ** %s returned nil from getObject\\n\", functionSchemaName)\r\n return\r\n }\r\n schemas[functionKey].(map[string]interface{})[functionName] = obj \r\n } \r\n\r\n // grab the elements requested (these are useful separately even though\r\n // they obviously appear already as part of the event API functions)\r\n for i := range elementNames {\r\n elementName := elementNames[i]\r\n obj = getObject(schema, elementName)\r\n if obj == nil {\r\n fmt.Printf(\"** ERR ** %s returned nil from getObject\\n\", elementName)\r\n return\r\n }\r\n schemas[objectModelKey].(map[string]interface{})[elementName] = obj \r\n }\r\n \r\n // marshal for output to file \r\n schemaOut, err := json.MarshalIndent(&schemas, \"\", \" \")\r\n if err != nil {\r\n fmt.Printf(\"** ERR ** cannot marshal schema file output for writing\\n\")\r\n return\r\n }\r\n outString += string(schemaOut) + \"`\"\r\n ioutil.WriteFile(filename, []byte(outString), 0644)\r\n}", "func (fmd *FakeMysqlDaemon) ApplySchemaChange(ctx context.Context, dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tbeforeSchema, err := fmd.SchemaFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdbaCon, err := fmd.GetDbaConnection(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = fmd.db.HandleQuery(dbaCon.Conn, change.SQL, func(*sqltypes.Result) error { return nil }); err != nil {\n\t\treturn nil, err\n\t}\n\n\tafterSchema, err := fmd.SchemaFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &tabletmanagerdatapb.SchemaChangeResult{\n\t\tBeforeSchema: beforeSchema,\n\t\tAfterSchema: afterSchema}, nil\n}", "func RenameSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\tnewIndex := c.Param(\"newIndex\")\n\tif _, err := conf.LoadSchema(index); err != nil {\n\t\tc.Error(http.StatusNotFound, fmt.Sprintf(\"index %s not found\", index))\n\t\treturn\n\t}\n\tif _, err := conf.LoadSchema(newIndex); err == nil {\n\t\tc.Error(http.StatusInternalServerError, fmt.Sprintf(\"index %s alreday exists\", newIndex))\n\t\treturn\n\t}\n\n\tindexer.LruRemove(index)\n\tindexer.RemoveIndexer(index)\n\n\tif err := conf.RenameSchema(index, newIndex); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": fmt.Sprintf(\"index %s renamed to %s OK\", index, newIndex),\n\t})\n}", "func (api *APIServer) httpConfigUpdateHandler(w http.ResponseWriter, r *http.Request) {\n\tif locked := api.lock.TryAcquire(1); !locked {\n\t\tlog.Println(ErrAPILocked)\n\t\twriteError(w, http.StatusServiceUnavailable, \"update\", ErrAPILocked)\n\t\treturn\n\t}\n\tdefer api.lock.Release(1)\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"reading body error: %v\", err))\n\t\treturn\n\t}\n\n\tnewConfig := DefaultConfig()\n\tif err := yaml.Unmarshal(body, &newConfig); err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"error parsing new config: %v\", err))\n\t\treturn\n\t}\n\n\tif err := validateConfig(newConfig); err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"update\", fmt.Errorf(\"error validating new config: %v\", err))\n\t\treturn\n\t}\n\tlog.Printf(\"Applying new valid config\")\n\tapi.config = *newConfig\n\tapi.restart <- struct{}{}\n}", "func modifyAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to modify config %s\", ctx.Param(\"appId\")))\n var request struct{Operation []map[string]interface{} `json:\"operation\" binding:\"required\"`}\n // parse config from request body\n if err := ctx.ShouldBind(&request); err != nil {\n log.Error(fmt.Errorf(\"unable to extract JSON Patch from body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n current, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // perform JSON patch on config\n updated, err := PatchConfig(current, request.Operation)\n if err != nil {\n switch err {\n case ErrInvalidJSONConfig, ErrInvalidPatch:\n log.Warn(fmt.Sprintf(\"cannot process JSON Patch %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"http_code\": http.StatusBadRequest, \"message\": \"Invalid JSON Patch Operation\"})\n default:\n log.Error(fmt.Errorf(\"unable to apply JSON Patch: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // update config in postgres database\n if err := db.UpdateConfigByAppId(appId, updated); err != nil {\n log.Error(fmt.Errorf(\"unable to updated config in database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully updated config\"})\n}", "func (s *Manager) SetModifySchema(ctx context.Context, project, dbAlias, col, schema string) error {\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update schema in config\n\tcollection, ok := projectConfig.Modules.Crud[dbAlias]\n\tif !ok {\n\t\treturn errors.New(\"specified database not present in config\")\n\t}\n\tif collection.Collections == nil {\n\t\tcollection.Collections = map[string]*config.TableRule{}\n\t}\n\ttemp, ok := collection.Collections[col]\n\tif !ok {\n\t\tcollection.Collections[col] = &config.TableRule{Schema: schema, Rules: map[string]*config.Rule{}}\n\t} else {\n\t\ttemp.Schema = schema\n\t}\n\n\tif err := s.modules.SetCrudConfig(project, projectConfig.Modules.Crud); err != nil {\n\t\tlogrus.Errorf(\"error setting crud config - %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn s.setProject(ctx, projectConfig)\n}", "func UpdateSchema(gqlConfig GraphQLConfig, schemaConfig schema.Config) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\terr := ready.Validate(ctx, gqlConfig.URL, 5*time.Second)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"waiting for database to be ready, database timed out or does not exist\")\n\t}\n\n\tgql := NewGraphQL(gqlConfig)\n\n\tschema, err := schema.New(gql, schemaConfig)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"preparing schema\")\n\t}\n\n\tif err := schema.Create(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"creating schema\")\n\t}\n\n\treturn nil\n}", "func (p *planner) notifySchemaChange(\n\ttableDesc *sqlbase.TableDescriptor, mutationID sqlbase.MutationID,\n) {\n\tsc := SchemaChanger{\n\t\ttableID: tableDesc.GetID(),\n\t\tmutationID: mutationID,\n\t\tnodeID: p.extendedEvalCtx.NodeID,\n\t\tleaseMgr: p.LeaseMgr(),\n\t\tjobRegistry: p.ExecCfg().JobRegistry,\n\t\tleaseHolderCache: p.ExecCfg().LeaseHolderCache,\n\t\trangeDescriptorCache: p.ExecCfg().RangeDescriptorCache,\n\t\tclock: p.ExecCfg().Clock,\n\t\tsettings: p.ExecCfg().Settings,\n\t\texecCfg: p.ExecCfg(),\n\t}\n\tp.extendedEvalCtx.SchemaChangers.queueSchemaChanger(sc)\n}", "func (db *DatabaseModel) SetSchema(schema *ovsdb.DatabaseSchema) []error {\n\tdb.mutex.Lock()\n\tdefer db.mutex.Unlock()\n\terrors := db.client.validate(schema)\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\tdb.schema = schema\n\tdb.mapper = mapper.NewMapper(schema)\n\terrs := db.generateModelInfo()\n\tif len(errs) > 0 {\n\t\tdb.schema = nil\n\t\tdb.mapper = nil\n\t\treturn errs\n\t}\n\treturn []error{}\n}", "func UpdateSchema() error {\r\n\tif !conf.Config.IsOBSMaster() {\r\n\t\tb := &Block{}\r\n\t\tif found, err := b.GetMaxBlock(); !found {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\treturn migration.UpdateMigrate(&MigrationHistory{})\r\n}", "func PutSchema(registry sources.Registry, graphUpdater *knowledge.GraphUpdater, sem *semaphore.Weighted) http.HandlerFunc {\n\treturn handleUpdate(registry, func(ctx context.Context, source string, body io.Reader) error {\n\t\trequestBody := client.PutGraphSchemaRequestBody{}\n\t\tif err := json.NewDecoder(body).Decode(&requestBody); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// TODO(c.michaud): verify compatibility of the schema with graph updates\n\t\terr := graphUpdater.UpdateSchema(ctx, source, requestBody.Schema)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to update the schema: %v\", err)\n\t\t}\n\n\t\tlabels := prometheus.Labels{\"source\": source}\n\t\tmetrics.GraphUpdateSchemaUpdatedCounter.\n\t\t\tWith(labels).\n\t\t\tInc()\n\t\treturn nil\n\t}, sem, \"update_schema\")\n}", "func UpdateSchemaDescriptor(schema *descriptorpb.DescriptorProto) AppendOption {\n\treturn func(pw *pendingWrite) {\n\t\tpw.newSchema = schema\n\t}\n}", "func (q cmfFamiliesPolicyQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for cmf_families_policies\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for cmf_families_policies\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (mh *MetadataHandler) HandleGetAllMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tres, err := mh.Repository.GetAll()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\treturn\n\t}\n\tif res == nil {\n\t\t// no resources found\n\t\tw.WriteHeader(http.StatusNotFound) // 404\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK) // 200\n\tyaml.NewEncoder(w).Encode(res)\n}", "func ClearSchema(p interface{}) {\n\tschema := p.(*Schema)\n\tschema.Indices = make(map[string]*Index)\n\n\ttemp2 := schema.Triggers\n\tschema.Triggers = make(map[string]*Trigger)\n\tfor _, t := range temp2 {\n\t\t(*sqlite3)(nil).DeleteTrigger(t)\n\t}\n\n\ttemp1 := schema.Tables\n\tschema.Tables = make(map[string]*Table)\n\tfor _, t := range temp1 {\n\t\t(*sqlite3)(nil).DeleteTable(0, t)\n\t}\n\n\tschema.ForeignKeys = make(map[string]*ForeignKey)\n\tschema.pSeqTab = nil\n\tif schema.flags & DB_SchemaLoaded {\n\t\tschema.iGeneration++\n\t\tschema.flags &= ~DB_SchemaLoaded\n\t}\n}", "func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error {\n\tgvk := schema.GroupVersionKind{\n\t\tGroup: crd.Spec.Group,\n\t\tVersion: GetVersionFromCRD(crd),\n\t\tKind: crd.Spec.Names.Kind,\n\t}\n\tif schemaRef.GVK.String() != gvk.String() {\n\t\treturn fmt.Errorf(\"unexpected mismatch of GVK when updating schema reference for controller, old GVK = %s, new GVK = %s\", schemaRef.GVK.String(), gvk.String())\n\t}\n\tschemaRef.CRD = crd\n\tschemaRef.JsonSchema = GetOpenAPIV3SchemaFromCRD(crd)\n\treturn nil\n}", "func (manager *Manager) registerSchema(schema *Schema) error {\n\tif _, ok := manager.schemas[schema.ID]; ok {\n\t\tlog.Warning(\"Overwriting schema %s\", schema.ID)\n\t\treturn nil\n\t}\n\tmanager.schemas[schema.ID] = schema\n\tmanager.schemaOrder = append(manager.schemaOrder, schema.ID)\n\tbaseURL := \"/\"\n\tif schema.Parent != \"\" {\n\t\tparentSchema, ok := manager.schema(schema.Parent)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Parent schema %s of %s not found\", schema.Parent, schema.ID)\n\t\t}\n\t\tschema.SetParentSchema(parentSchema)\n\t}\n\tif schema.NamespaceID != \"\" {\n\t\tnamespace, ok := manager.namespace(schema.NamespaceID)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Namespace schema %s of %s not found\", schema.NamespaceID, schema.ID)\n\t\t}\n\t\tschema.SetNamespace(namespace)\n\t\tbaseURL = schema.Namespace.GetFullPrefix() + \"/\"\n\t}\n\tif schema.Prefix != \"\" {\n\t\tbaseURL = baseURL + strings.TrimPrefix(schema.Prefix, \"/\") + \"/\"\n\t}\n\tschema.URL = baseURL + schema.Plural\n\tif schema.Parent != \"\" {\n\t\tschema.URLWithParents = baseURL + strings.TrimPrefix(schema.GetParentURL(), \"/\") + \"/\" + schema.Plural\n\t} else {\n\t\tschema.URLWithParents = schema.URL\n\t}\n\treturn nil\n}", "func MountSchemaController(service goa.Service, ctrl SchemaController) {\n\trouter := service.HTTPHandler().(*httprouter.Router)\n\tvar h goa.Handler\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewCreateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Create(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"Create\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Create\", \"route\", \"POST /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewDeleteSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Delete(ctx)\n\t}\n\trouter.Handle(\"DELETE\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Delete\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Delete\", \"route\", \"DELETE /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewGetSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Get(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Get\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Get\", \"route\", \"GET /v1/schemas/:name\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewListSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.List(ctx)\n\t}\n\trouter.Handle(\"GET\", \"/v1/schemas\", ctrl.NewHTTPRouterHandle(\"List\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"List\", \"route\", \"GET /v1/schemas\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewSetDefaultsSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.SetDefaults(ctx)\n\t}\n\trouter.Handle(\"POST\", \"/v1/schemas/:name/setDefaults\", ctrl.NewHTTPRouterHandle(\"SetDefaults\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"SetDefaults\", \"route\", \"POST /v1/schemas/:name/setDefaults\")\n\th = func(c *goa.Context) error {\n\t\tctx, err := NewUpdateSchemaContext(c)\n\t\tif err != nil {\n\t\t\treturn goa.NewBadRequestError(err)\n\t\t}\n\t\treturn ctrl.Update(ctx)\n\t}\n\trouter.Handle(\"PUT\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"PUT /v1/schemas/:name\")\n\trouter.Handle(\"POST\", \"/v1/schemas/:name\", ctrl.NewHTTPRouterHandle(\"Update\", h))\n\tservice.Info(\"mount\", \"ctrl\", \"Schema\", \"action\", \"Update\", \"route\", \"POST /v1/schemas/:name\")\n}", "func (db *Database) RefreshSchema() error {\n\t// Get schema from query\n\trows, err := db.runQuery(\"SELECT teleport.get_schema();\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\n\t// Read schema content from sql.Row\n\tvar schemaContent []byte\n\trows.Next()\n\terr = rows.Scan(&schemaContent)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse schema\n\tvar schemas Schemas\n\tschemas, err = ParseSchema(string(schemaContent))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, schema := range schemas {\n\t\tdb.Schemas[schema.Name] = schema\n\t\tschema.Db = db\n\t}\n\n\treturn nil\n}", "func setupSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Setup(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func HandleAll(api *api.API) {\n\n\twrapperLogOn := alice.New(api.ParseHandler)\n\thttp.Handle(\"/logon\", wrapperLogOn.ThenFunc(api.LogOn))\n\n\twrapper := alice.New(api.ParseHandler, api.LogonHandler)\n\n\thttp.Handle(\"/getBooks\", wrapper.ThenFunc(api.GetBooks))\n\thttp.Handle(\"/getRoles\", wrapper.ThenFunc(api.GetRoles))\n\thttp.Handle(\"/getUsers\", wrapper.ThenFunc(api.GetUsers))\n\n\thttp.Handle(\"/updateUsers\", wrapper.ThenFunc(api.UpdateUsers))\n\thttp.Handle(\"/updateRoles\", wrapper.ThenFunc(api.UpdateRoles))\n\thttp.Handle(\"/updateBooks\", wrapper.ThenFunc(api.UpdateBooks))\n\n\thttp.Handle(\"/insertBooks\", wrapper.ThenFunc(api.InsertBooks))\n\thttp.Handle(\"/insertUsers\", wrapper.ThenFunc(api.InsertUsers))\n\thttp.Handle(\"/insertRoles\", wrapper.ThenFunc(api.InsertRoles))\n\n\thttp.Handle(\"/deleteRoles\", wrapper.ThenFunc(api.DeleteRoles))\n\thttp.Handle(\"/deleteBooks\", wrapper.ThenFunc(api.DeleteBooks))\n\thttp.Handle(\"/deleteUsers\", wrapper.ThenFunc(api.DeleteUsers))\n}", "func (q shelfQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for shelf\")\n\t}\n\n\treturn nil\n}", "func PutHandler(config interface{}, putConfig methodconfigs.PutRequestConfig, loc []string) http.HandlerFunc {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t//authenticate request\n\t\tif !authenticator.IsAuthenticated(r, putConfig.Auth) {\n\t\t\terrorresponse.ThrowError(w, \"Request not authorized!\")\n\t\t\treturn\n\t\t}\n\n\t\tvar schema string = putConfig.Data\n\n\t\ts := strings.Replace(schema, \"$\", \"\", 1)\n\t\tsch := strings.Split(s, \".\")\n\n\t\t_, schemaData := getresource.GetResource(config, sch[0], sch[1])\n\n\t\t//verify incoming data according to schema and patch\n\t\tdata := make(map[string]interface{})\n\t\t//\n\t\tif strings.Compare(r.Header.Get(\"Content-Type\"), strings.Trim(r.Header.Get(\"Content-Type\"), \"\\n\")) != 0 {\n\t\t\terrorresponse.ThrowError(w, \"Content-Type Header is not application/json\")\n\t\t\treturn\n\t\t}\n\n\t\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\t\terrorresponse.ThrowError(w, fmt.Sprint(\"%s\", err))\n\t\t\treturn\n\t\t}\n\n\t\t//validate data\n\t\t//necessary data and error result\n\t\tnecessaryData, validityResult := customvalidator.Validate(config, putConfig.Validator, schema, data)\n\n\t\tdataRequired := make(map[string]string)\n\n\t\tfor k, v := range validityResult {\n\t\t\tif v == \"required\" {\n\t\t\t\tdataRequired[k] = v\n\t\t\t}\n\t\t}\n\n\t\tif len(dataRequired) > 0 {\n\t\t\tresponsehandler.SendJSONResponse(w, dataRequired, 404)\n\t\t\treturn\n\t\t} else if len(validityResult) > 0 {\n\t\t\tresponsehandler.SendJSONResponse(w, validityResult, 404)\n\t\t\treturn\n\t\t}\n\n\t\t//read data from file\n\t\tqueryResults := fileio.ReadFromFile()\n\t\t//create a map for response\n\t\tresponse := make(map[string]interface{})\n\t\t//get ```result``` value from config file\n\t\tresultWithoutDollar := strings.Replace(putConfig.Result, \"$\", \"\", 1)\n\t\tresultArr := strings.Split(resultWithoutDollar, \".\")\n\t\t//send response as per schema defined in ```result```\n\t\t_, responseResult := getresource.GetResource(config, resultArr[0], resultArr[1])\n\t\t//check which keys are required in response\n\t\tresultFields := make(map[string]bool)\n\t\t//create a map of required keys in resultFields\n\t\tfor key, _ := range responseResult.(map[string]interface{}) {\n\t\t\tresultFields[key] = true\n\t\t}\n\n\t\t//put new data\n\t\tdataToWrite := make(map[string]interface{})\n\n\t\tfor key, _ := range schemaData.(map[string]interface{}) {\n\t\t\tif _, ok := necessaryData[key]; ok {\n\t\t\t\tdataToWrite[key] = necessaryData[key]\n\t\t\t} else if resultFields[key] {\n\t\t\t\tdataToWrite[key] = necessaryData[key]\n\t\t\t}\n\t\t}\n\n\t\t//write new data\n\t\tfileio.WriteToFile(dataToWrite)\n\n\t\t//send response according to schema specified in ```result```\n\t\t//read again\n\t\tqueryResults = fileio.ReadFromFile()\n\t\tfor key, val := range queryResults.(map[string]interface{}) {\n\t\t\tif _, ok := resultFields[key]; ok {\n\t\t\t\tresponse[key] = val\n\t\t\t}\n\t\t}\n\n\t\tresponsehandler.SendJSONResponse(w, response, 201)\n\t\treturn\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func MapRouteBySchemas(server *Server, dataStore db.DB) {\n\troute := server.martini\n\tlog.Debug(\"[Initializing Routes]\")\n\tschemaManager := schema.GetManager()\n\troute.Get(\"/_all\", func(w http.ResponseWriter, r *http.Request, p martini.Params, auth schema.Authorization, ctx middleware.Context) {\n\t\tresponses := make(map[string]interface{})\n\t\tcontext := map[string]interface{}{\n\t\t\t\"path\": r.URL.Path,\n\t\t\t\"http_request\": r,\n\t\t\t\"http_response\": w,\n\t\t\t\"context\": ctx[\"context\"],\n\t\t\t\"trace_id\": ctx[\"trace_id\"],\n\t\t}\n\t\tfor _, s := range schemaManager.Schemas() {\n\t\t\tpolicy, role := authorization(w, r, schema.ActionRead, s.GetPluralURL(), s, auth)\n\t\t\tif policy == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontext[\"policy\"] = policy\n\t\t\tcontext[\"role\"] = role\n\t\t\tcontext[\"auth\"] = auth\n\t\t\tcontext[\"sync\"] = server.sync\n\n\t\t\tif err := resources.GetResources(\n\t\t\t\tcontext, dataStore,\n\t\t\t\ts,\n\t\t\t\tresources.FilterFromQueryParameter(s, r.URL.Query()),\n\t\t\t\tnil,\n\t\t\t); err != nil {\n\t\t\t\thandleError(w, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tresources.ApplyPolicyForResources(context, s)\n\t\t\tresponse := context[\"response\"].(map[string]interface{})\n\t\t\tresponses[s.GetDbTableName()] = response[s.Plural]\n\t\t}\n\t\troutes.ServeJson(w, responses)\n\t})\n\tfor _, s := range schemaManager.Schemas() {\n\t\tMapRouteBySchema(server, dataStore, s)\n\t}\n}", "func hookConfigurationSchema() *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeList,\n\t\tOptional: true,\n\t\tMaxItems: 1,\n\t\tElem: &schema.Resource{\n\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\"invocation_condition\": func() *schema.Schema {\n\t\t\t\t\tschema := documentAttributeConditionSchema()\n\t\t\t\t\treturn schema\n\t\t\t\t}(),\n\t\t\t\t\"lambda_arn\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: verify.ValidARN,\n\t\t\t\t},\n\t\t\t\t\"s3_bucket\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: validation.All(\n\t\t\t\t\t\tvalidation.StringLenBetween(3, 63),\n\t\t\t\t\t\tvalidation.StringMatch(\n\t\t\t\t\t\t\tregexp.MustCompile(`[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]`),\n\t\t\t\t\t\t\t\"Must be a valid bucket name\",\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}", "func (it *iterator) resetSchema(schemaDesc namespace.SchemaDescr) {\n\tif schemaDesc == nil {\n\t\tit.schemaDesc = nil\n\t\tit.schema = nil\n\n\t\t// Clear but don't set to nil so they don't need to be reallocated\n\t\t// next time.\n\t\tcustomFields := it.customFields\n\t\tfor i := range customFields {\n\t\t\tcustomFields[i] = customFieldState{}\n\t\t}\n\t\tit.customFields = customFields[:0]\n\n\t\tnonCustomFields := it.nonCustomFields\n\t\tfor i := range nonCustomFields {\n\t\t\tnonCustomFields[i] = marshalledField{}\n\t\t}\n\t\tit.nonCustomFields = nonCustomFields[:0]\n\t\treturn\n\t}\n\n\tit.schemaDesc = schemaDesc\n\tit.schema = schemaDesc.Get().MessageDescriptor\n\tit.customFields, it.nonCustomFields = customAndNonCustomFields(it.customFields, nil, it.schema)\n}", "func updateTableSchema(client *bigquery.Client, datasetID, tableID string, timestampFields []string, sch avro.Schema) error {\n\tvar newSchema = bigquery.Schema{}\n\tctx := context.Background()\n\tdefer ctx.Done()\n\ttableRef := client.Dataset(datasetID).Table(tableID)\n\ttableMetadata, err := tableRef.Metadata(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewSchema = append(tableMetadata.Schema)\n\tfor _, avroField := range sch.Fields {\n\t\texists := false\n\t\tavroFieldType := \"\"\n\t\tfor _, tableField := range newSchema {\n\t\t\tif avroField.Name == tableField.Name {\n\t\t\t\texists = true\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif !exists {\n\t\t\tfor _, v := range avroField.FieldType {\n\t\t\t\tif v == \"null\" {\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tavroFieldType = v\n\t\t\t\t}\n\t\t\t}\n\t\t\tnewSchema = append(newSchema,\n\t\t\t\t&bigquery.FieldSchema{Name: avroField.Name, Type: bqSchemaMap[avroFieldType]},\n\t\t\t)\n\t\t}\n\t}\n\tfor i, fieldSchema := range newSchema {\n\t\tfor _, timestampKey := range timestampFields {\n\t\t\tif timestampKey != fieldSchema.Name {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tnewSchema[i] = &bigquery.FieldSchema{Name: fieldSchema.Name, Type: bigquery.TimestampFieldType}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate := bigquery.TableMetadataToUpdate{\n\t\tSchema: newSchema,\n\t}\n\tif _, err := tableRef.Update(ctx, update, tableMetadata.ETag); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (srv *Server) handlePatch(res http.ResponseWriter, req *http.Request) {\n\tfor _, rute := range srv.routePatches {\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\tres.WriteHeader(http.StatusNotFound)\n}", "func (o CMFFamiliesPolicySlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfFamiliesPolicyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_families_policies` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfFamiliesPolicyPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfFamiliesPolicy slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfFamiliesPolicy\")\n\t}\n\treturn rowsAff, nil\n}", "func fixupSchema(schema interface{}, namedTypes map[string]map[string]interface{}) interface{} {\n\tswitch x0 := schema.(type) {\n\tcase string:\n\t\t// This is a type name. If it matches a named type, then recurse\n\t\t// on that type's schema. Otherwise, it is a primitive type and\n\t\t// return as-is.\n\t\tif typ, ok := namedTypes[x0]; ok {\n\t\t\treturn fixupSchema(typ, namedTypes)\n\t\t}\n\t\treturn x0\n\n\tcase map[string]interface{}:\n\t\tswitch x1 := x0[\"type\"].(type) {\n\t\tcase string:\n\t\t\tswitch x1 {\n\t\t\tcase \"error\":\n\t\t\t\tx0[\"type\"] = \"record\"\n\t\t\t\tfallthrough\n\n\t\t\tcase \"record\":\n\t\t\t\t// This is a record, so recurse on each field\n\t\t\t\tfields, _ := x0[\"fields\"].([]interface{})\n\t\t\t\tfor i, field := range fields {\n\t\t\t\t\tfields[i] = fixupSchema(field, namedTypes)\n\t\t\t\t}\n\n\t\t\tcase \"array\":\n\t\t\t\t// This is a array, so recurse on item schema\n\t\t\t\tx0[\"items\"] = fixupSchema(x0[\"items\"], namedTypes)\n\n\t\t\tcase \"map\":\n\t\t\t\t// This is a map, so recurse on value schema\n\t\t\t\tx0[\"values\"] = fixupSchema(x0[\"values\"], namedTypes)\n\n\t\t\tdefault:\n\t\t\t\t// This is another named type\n\t\t\t\tx0 = mergeSchema(x0, fixupSchema(x0[\"type\"], namedTypes))\n\t\t\t}\n\n\t\tcase []interface{}:\n\t\t\t// This is a union, so recurse on each element\n\t\t\tfor i := range x1 {\n\t\t\t\tx1[i] = fixupSchema(x1[i], namedTypes)\n\t\t\t}\n\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unhandled type: %T\", x1))\n\t\t}\n\t\treturn x0\n\n\tcase []interface{}:\n\t\t// This is a union, so recurse on each element\n\t\tfor i := range x0 {\n\t\t\tx0[i] = fixupSchema(x0[i], namedTypes)\n\t\t}\n\t\treturn x0\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unhandled type: %T\", x0))\n\t}\n}", "func (ar *AppendResult) UpdatedSchema(ctx context.Context) (*storagepb.TableSchema, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase <-ar.Ready():\n\t\tif ar.response != nil {\n\t\t\tif schema := ar.response.GetUpdatedSchema(); schema != nil {\n\t\t\t\treturn proto.Clone(schema).(*storagepb.TableSchema), nil\n\t\t\t}\n\t\t}\n\t\treturn nil, nil\n\t}\n}", "func (q smallblogQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for smallblog\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for smallblog\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q skinQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for skin\")\n\t}\n\n\treturn nil\n}", "func (q apiKeyQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for api_keys\")\n\t}\n\n\treturn nil\n}", "func (s *Manager) SetEventingSchema(ctx context.Context, project string, evType string, schema string, params model.RequestParams) (int, error) {\n\t// Check if the request has been hijacked\n\thookResponse := s.integrationMan.InvokeHook(ctx, params)\n\tif hookResponse.CheckResponse() {\n\t\t// Check if an error occurred\n\t\tif err := hookResponse.Error(); err != nil {\n\t\t\treturn hookResponse.Status(), err\n\t\t}\n\n\t\t// Gracefully return\n\t\treturn hookResponse.Status(), nil\n\t}\n\n\t// Acquire a lock\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tprojectConfig, err := s.getConfigWithoutLock(ctx, project)\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\n\tresourceID := config.GenerateResourceID(s.clusterID, project, config.ResourceEventingSchema, evType)\n\tv := &config.EventingSchema{Schema: schema, ID: evType}\n\tif projectConfig.EventingSchemas == nil {\n\t\tprojectConfig.EventingSchemas = config.EventingSchemas{resourceID: v}\n\t} else {\n\t\tprojectConfig.EventingSchemas[resourceID] = v\n\t}\n\n\tif err := s.modules.SetEventingSchemaConfig(ctx, project, projectConfig.EventingSchemas); err != nil {\n\t\treturn http.StatusInternalServerError, helpers.Logger.LogError(helpers.GetRequestID(ctx), \"error setting eventing config\", err, nil)\n\t}\n\n\tif err := s.store.SetResource(ctx, resourceID, v); err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treturn http.StatusOK, nil\n}", "func Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tfor i, elem := range schema {\n\t\tif elem.Config.Name == params[\"name\"] {\n\t\t\tschema = append(schema[:i], schema[i+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(schema)\n}", "func DeleteSchema(c *mgin.Context) {\n\tindex := c.Param(\"index\")\n\n\tindexer.RemoveIndexer(index)\n\tif err := conf.DeleteSchema(index); err != nil {\n\t\tc.Error(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"code\": http.StatusOK,\n\t\t\"msg\": \"schema deleted\",\n\t\t\"index\": index,\n\t})\n}", "func SchemaListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\tschemasList, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\tif err != nil {\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif schemasList.Empty() {\n\t\terr := APIErrorNotFound(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schemasList.Schemas[0], \"\", \" \")\n\trespondOK(w, output)\n}", "func (h SchemaHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper) {\n\trouter.HandleFunc(\"/{namespace}/tables\", utils.ApplyHTTPWrappers(h.AddTable, wrappers...)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.GetTable, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables\", utils.ApplyHTTPWrappers(h.GetTables, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.DeleteTable, wrappers...)).Methods(http.MethodDelete)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}\", utils.ApplyHTTPWrappers(h.UpdateTable, wrappers...)).Methods(http.MethodPut)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}/columns/{column}/enum-cases\", utils.ApplyHTTPWrappers(h.GetEnumCases, wrappers...)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/{namespace}/tables/{table}/columns/{column}/enum-cases\", utils.ApplyHTTPWrappers(h.ExtendEnumCases, wrappers...)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/{namespace}/hash\", utils.ApplyHTTPWrappers(h.GetHash, wrappers...)).Methods(http.MethodGet)\n}", "func (q dMessageEmbedQuery) UpdateAll(cols M) error {\n\tqueries.SetUpdate(q.Query, cols)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all for d_message_embeds\")\n\t}\n\n\treturn nil\n}", "func (q descriptionQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for descriptions\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for descriptions\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (service *Service) populateFromSchema() {\n\tschema := service.schema\n\tservice.name = schema.Name\n\tservice.version = schema.Version\n\tservice.fullname = joinVersionToName(service.name, service.version)\n\tservice.dependencies = schema.Dependencies\n\tservice.settings = schema.Settings\n\tif service.settings == nil {\n\t\tservice.settings = make(map[string]interface{})\n\t}\n\tservice.metadata = schema.Metadata\n\tif service.metadata == nil {\n\t\tservice.metadata = make(map[string]interface{})\n\t}\n\n\tservice.actions = make([]Action, len(schema.Actions))\n\tfor index, actionSchema := range schema.Actions {\n\t\tservice.actions[index] = CreateServiceAction(\n\t\t\tservice.fullname,\n\t\t\tactionSchema.Name,\n\t\t\tactionSchema.Handler,\n\t\t\tactionSchema.Schema,\n\t\t)\n\t}\n\n\tservice.events = make([]Event, len(schema.Events))\n\tfor index, eventSchema := range schema.Events {\n\t\tgroup := eventSchema.Group\n\t\tif group == \"\" {\n\t\t\tgroup = service.Name()\n\t\t}\n\t\tservice.events[index] = Event{\n\t\t\tname: eventSchema.Name,\n\t\t\tserviceName: service.Name(),\n\t\t\tgroup: group,\n\t\t\thandler: eventSchema.Handler,\n\t\t}\n\t}\n\n\tservice.created = schema.Created\n\tservice.started = schema.Started\n\tservice.stopped = schema.Stopped\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func (m *memStoreImpl) FetchSchema() error {\n\ttables, err := m.metaStore.ListTables()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to list tables from meta\")\n\t}\n\n\tfor _, tableName := range tables {\n\t\terr := m.fetchTable(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// watch table addition/modification\n\ttableSchemaChangeEvents, done, err := m.metaStore.WatchTableSchemaEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableSchemaChange(tableSchemaChangeEvents, done)\n\n\t// watch table deletion\n\ttableListChangeEvents, done, err := m.metaStore.WatchTableListEvents()\n\tif err != nil {\n\t\treturn utils.StackError(err, \"Failed to watch table list events\")\n\t}\n\tgo m.handleTableListChange(tableListChangeEvents, done)\n\n\t// watch enum cases appending\n\tm.RLock()\n\tfor _, tableSchema := range m.TableSchemas {\n\t\tfor columnName, enumCases := range tableSchema.EnumDicts {\n\t\t\terr := m.watchEnumCases(tableSchema.Schema.Name, columnName, len(enumCases.ReverseDict))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tm.RUnlock()\n\n\treturn nil\n}", "func HandleSetDatabaseConfig(adminMan *admin.Manager, syncman *syncman.Manager) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Get the JWT token from header\n\t\ttoken := utils.GetTokenFromHeader(r)\n\n\t\tv := config.CrudStub{}\n\t\t_ = json.NewDecoder(r.Body).Decode(&v)\n\t\tdefer utils.CloseTheCloser(r.Body)\n\n\t\t// Check if the request is authorised\n\t\tif err := adminMan.IsTokenValid(token); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)\n\t\tdefer cancel()\n\t\tvars := mux.Vars(r)\n\t\tdbAlias := vars[\"dbAlias\"]\n\t\tprojectID := vars[\"project\"]\n\n\t\tif err := syncman.SetDatabaseConnection(ctx, projectID, dbAlias, v); err != nil {\n\t\t\t_ = utils.SendErrorResponse(w, http.StatusInternalServerError, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t_ = utils.SendOkayResponse(w)\n\t}\n}", "func UpgradeSchema(database *models.Database) error {\n\tdb, err := getDatabase(database)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn db.UpgradeSchema()\n}", "func (mh *MetadataHandler) HandlePutMetadata(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvar payload metadata.ApplicationMetadata\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\terr = yaml.Unmarshal(b, &payload)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\t// validate the payload first\n\tvalid, desc := payload.IsValid()\n\tif !valid {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\tyaml.NewEncoder(w).Encode(desc)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tvar (\n\t\tappID string\n\t\tok bool\n\t)\n\tif appID, ok = vars[\"appID\"]; !ok {\n\t\tw.WriteHeader(http.StatusBadRequest) // 400\n\t\treturn\n\t}\n\n\tpayload.ApplicationID = appID\n\n\terr = mh.Repository.Update(appID, &payload)\n\tif err != nil {\n\t\tif err == repository.ErrIDNotFound {\n\t\t\tw.WriteHeader(http.StatusConflict) // 409\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusInternalServerError) // 500\n\t\t}\n\t\tyaml.NewEncoder(w).Encode(err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK) // 200\n\tyaml.NewEncoder(w).Encode(payload)\n}", "func SchemaValidate(ctx context.Context, s fwschema.Schema, req ValidateSchemaRequest, resp *ValidateSchemaResponse) {\n\tfor name, attribute := range s.GetAttributes() {\n\n\t\tattributeReq := ValidateAttributeRequest{\n\t\t\tAttributePath: path.Root(name),\n\t\t\tAttributePathExpression: path.MatchRoot(name),\n\t\t\tConfig: req.Config,\n\t\t}\n\t\t// Instantiate a new response for each request to prevent validators\n\t\t// from modifying or removing diagnostics.\n\t\tattributeResp := &ValidateAttributeResponse{}\n\n\t\tAttributeValidate(ctx, attribute, attributeReq, attributeResp)\n\n\t\tresp.Diagnostics.Append(attributeResp.Diagnostics...)\n\t}\n\n\tfor name, block := range s.GetBlocks() {\n\t\tattributeReq := ValidateAttributeRequest{\n\t\t\tAttributePath: path.Root(name),\n\t\t\tAttributePathExpression: path.MatchRoot(name),\n\t\t\tConfig: req.Config,\n\t\t}\n\t\t// Instantiate a new response for each request to prevent validators\n\t\t// from modifying or removing diagnostics.\n\t\tattributeResp := &ValidateAttributeResponse{}\n\n\t\tBlockValidate(ctx, block, attributeReq, attributeResp)\n\n\t\tresp.Diagnostics.Append(attributeResp.Diagnostics...)\n\t}\n\n\tif s.GetDeprecationMessage() != \"\" {\n\t\tresp.Diagnostics.AddWarning(\n\t\t\t\"Deprecated\",\n\t\t\ts.GetDeprecationMessage(),\n\t\t)\n\t}\n}", "func (sm *Manager) RegisterNewSchema(schema StateManager) {\n\tsm.handlers[schema.Name()] = schema\n}", "func (bh *handlerImpl) Handle(srv ab.AtomicBroadcast_BroadcastServer) error {\n\tfor {\n\t\tmsg, err := srv.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpayload := &cb.Payload{}\n\t\terr = proto.Unmarshal(msg.Payload, payload)\n\t\tif err != nil {\n\t\t\tif logger.IsEnabledFor(logging.WARNING) {\n\t\t\t\tlogger.Warningf(\"Received malformed message, dropping connection: %s\", err)\n\t\t\t}\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_BAD_REQUEST})\n\t\t}\n\n\t\tif payload.Header == nil {\n\t\t\tlogger.Warningf(\"Received malformed message, with missing header, dropping connection\")\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_BAD_REQUEST})\n\t\t}\n\n\t\tchdr, err := utils.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\t\tif err != nil {\n\t\t\tif logger.IsEnabledFor(logging.WARNING) {\n\t\t\t\tlogger.Warningf(\"Received malformed message (bad channel header), dropping connection: %s\", err)\n\t\t\t}\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_BAD_REQUEST})\n\t\t}\n\n\t\tif chdr.Type == int32(cb.HeaderType_CONFIG_UPDATE) {\n\t\t\tlogger.Debugf(\"Preprocessing CONFIG_UPDATE\")\n\t\t\tmsg, err = bh.sm.Process(msg)\n\t\t\tif err != nil {\n\t\t\t\tif logger.IsEnabledFor(logging.WARNING) {\n\t\t\t\t\tlogger.Warningf(\"Rejecting CONFIG_UPDATE because: %s\", err)\n\t\t\t\t}\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_BAD_REQUEST})\n\t\t\t}\n\n\t\t\terr = proto.Unmarshal(msg.Payload, payload)\n\t\t\tif err != nil || payload.Header == nil {\n\t\t\t\tlogger.Criticalf(\"Generated bad transaction after CONFIG_UPDATE processing\")\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_INTERNAL_SERVER_ERROR})\n\t\t\t}\n\n\t\t\tchdr, err = utils.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Criticalf(\"Generated bad transaction after CONFIG_UPDATE processing (bad channel header): %s\", err)\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_INTERNAL_SERVER_ERROR})\n\t\t\t}\n\n\t\t\tif chdr.ChannelId == \"\" {\n\t\t\t\tlogger.Criticalf(\"Generated bad transaction after CONFIG_UPDATE processing (empty channel ID)\")\n\t\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_INTERNAL_SERVER_ERROR})\n\t\t\t}\n\t\t}\n\n\t\tsupport, ok := bh.sm.GetChain(chdr.ChannelId)\n\t\tif !ok {\n\t\t\tif logger.IsEnabledFor(logging.WARNING) {\n\t\t\t\tlogger.Warningf(\"Rejecting broadcast because channel %s was not found\", chdr.ChannelId)\n\t\t\t}\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_NOT_FOUND})\n\t\t}\n\n\t\tif logger.IsEnabledFor(logging.DEBUG) {\n\t\t\tlogger.Debugf(\"Broadcast is filtering message of type %d for channel %s\", chdr.Type, chdr.ChannelId)\n\t\t}\n\n\t\t// Normal transaction for existing chain\n\t\t_, filterErr := support.Filters().Apply(msg)\n\n\t\tif filterErr != nil {\n\t\t\tif logger.IsEnabledFor(logging.WARNING) {\n\t\t\t\tlogger.Warningf(\"Rejecting broadcast message because of filter error: %s\", filterErr)\n\t\t\t}\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_BAD_REQUEST})\n\t\t}\n\n\t\tif !support.Enqueue(msg) {\n\t\t\tlogger.Infof(\"Consenter instructed us to shut down\")\n\t\t\treturn srv.Send(&ab.BroadcastResponse{Status: cb.Status_SERVICE_UNAVAILABLE})\n\t\t}\n\n\t\tif logger.IsEnabledFor(logging.DEBUG) {\n\t\t\tlogger.Debugf(\"Broadcast has successfully enqueued message of type %d for chain %s\", chdr.Type, chdr.ChannelId)\n\t\t}\n\n\t\terr = srv.Send(&ab.BroadcastResponse{Status: cb.Status_SUCCESS})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "func registerSchema(fn schemaFn) {\n\tschemas = append(schemas, fn)\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func (s *Server) handleRoutesPostPutPatch(c *gin.Context) {\n\tctx := c.Request.Context()\n\tmethod := strings.ToUpper(c.Request.Method)\n\n\tvar wroute models.RouteWrapper\n\terr := bindRoute(c, method, &wroute)\n\tif err != nil {\n\t\thandleErrorResponse(c, err)\n\t\treturn\n\t}\n\tif method != http.MethodPatch {\n\t\terr = s.ensureApp(ctx, &wroute, method)\n\t\tif err != nil {\n\t\t\thandleErrorResponse(c, err)\n\t\t\treturn\n\t\t}\n\t}\n\tresp, err := s.ensureRoute(ctx, method, &wroute)\n\tif err != nil {\n\t\thandleErrorResponse(c, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, resp)\n}", "func (m *ExternalConnection) SetSchema(value Schemaable)() {\n m.schema = value\n}", "func (un *Decoder) SetSchema(e *yang.Entry) { un.schema = e }", "func (p *planner) writeSchemaChange(\n\tctx context.Context, tableDesc *tabledesc.Mutable, mutationID descpb.MutationID, jobDesc string,\n) error {\n\tif !p.EvalContext().TxnImplicit {\n\t\ttelemetry.Inc(sqltelemetry.SchemaChangeInExplicitTxnCounter)\n\t}\n\tif tableDesc.Dropped() {\n\t\t// We don't allow schema changes on a dropped table.\n\t\treturn errors.Errorf(\"no schema changes allowed on table %q as it is being dropped\",\n\t\t\ttableDesc.Name)\n\t}\n\tif !tableDesc.IsNew() {\n\t\tif err := p.createOrUpdateSchemaChangeJob(ctx, tableDesc, jobDesc, mutationID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn p.writeTableDesc(ctx, tableDesc)\n}", "func (fmd *FakeMysqlDaemon) PreflightSchemaChange(ctx context.Context, dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) {\n\tif fmd.PreflightSchemaChangeResult == nil {\n\t\treturn nil, fmt.Errorf(\"no preflight result defined\")\n\t}\n\treturn fmd.PreflightSchemaChangeResult, nil\n}", "func (q docQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for doc\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for doc\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q automodRuleDatumQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for automod_rule_data\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for automod_rule_data\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (b *fixupBody) effectiveSchema(given *hcl.BodySchema) *hcl.BodySchema {\n\treturn effectiveSchema(given, b.original, b.names, true)\n}", "func (w *GovernanceWorker) handleUpdatePolicy(cmd *UpdatePolicyCommand) {\n\n\t// for the non pattern case, no policy files are needed. TODO-New: what should we do here?\n\tif w.devicePattern == \"\" {\n\t\treturn\n\t}\n\n\t// Find the microservice definitions in our database so that we can update the policy for each one.\n\tmsDefs, err := persistence.FindMicroserviceDefs(w.db, []persistence.MSFilter{persistence.UnarchivedMSFilter()})\n\tif err != nil {\n\t\tglog.Errorf(logString(fmt.Sprintf(\"Unable to update policies, find service definitions from the database, error %v\", err)))\n\t\treturn\n\t}\n\n\t// For each microservice def, generate a new policy. The GenMicroservicePolicy function will write the new policy to disk and\n\t// it will issue events that trigger the node to update its service advertisement in the exchange.\n\tfor _, msdef := range msDefs {\n\n\t\tglog.V(5).Infof(logString(fmt.Sprintf(\"Working on msdef: %v\", msdef)))\n\n\t\tif err := microservice.GenMicroservicePolicy(&msdef, w.BaseWorker.Manager.Config.Edge.PolicyPath, w.db, w.BaseWorker.Manager.Messages, exchange.GetOrg(w.GetExchangeId()), w.devicePattern); err != nil {\n\t\t\tglog.Errorf(logString(fmt.Sprintf(\"Unable to update policy for %v, error %v\", msdef, err)))\n\t\t}\n\t}\n\n\tglog.V(5).Infof(logString(fmt.Sprintf(\"Policies updated\")))\n\n}", "func GetAllSchemaInfo(db rdbmstool.DbHandlerProxy) ([]SchemaInfo, error) {\n\tsqlStr := `\n\tSELECT a.id, a.name, a.description, a.is_active, \n\t\tMAX(b.revision), SUM(CASE WHEN b.revision = -1 THEN 1 ELSE 0 END)\n\tFROM doc_schema a\n\tLEFT JOIN doc_schema_revision b ON a.id = b.schema_id\n\tGROUP BY a.id`\n\n\trows, rowsErr := db.Query(sqlStr)\n\tif rowsErr != nil {\n\t\treturn nil, fmt.Errorf(\"error encounter access database: %s\", rowsErr.Error())\n\t}\n\n\tdefer rows.Close()\n\n\tvar tmpID, tmpName, tmpDesc string\n\tvar tmpLatestRev, tmpIsActive, tmpHasDraft int\n\tresults := []SchemaInfo{}\n\tfor rows.Next() {\n\t\tscanErr := rows.Scan(&tmpID, &tmpName, &tmpDesc, &tmpIsActive, &tmpLatestRev, &tmpHasDraft)\n\t\tif scanErr != nil {\n\t\t\tif scanErr == sql.ErrNoRows {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to fetch record from database: %s\", scanErr.Error())\n\t\t\t}\n\t\t}\n\n\t\tresults = append(results, SchemaInfo{\n\t\t\tID: tmpID,\n\t\t\tName: tmpName,\n\t\t\tLatestRevision: tmpLatestRev,\n\t\t\tDescription: tmpDesc,\n\t\t\tIsActive: tmpIsActive == 1,\n\t\t\tHasDraft: tmpHasDraft == 1,\n\t\t})\n\t}\n\n\treturn results, nil\n}", "func handleUpdate(w http.ResponseWriter, r *http.Request) {\n\tfmt.Printf(\"Received request: %v %v %v\\n\", r.Method, r.URL, r.Proto)\n\tbf.RepopulateBloomFilter()\n}", "func (c *Client) Schema() error {\n\t_, err := c.db.DB().Exec(Schema)\n\treturn err\n}", "func (p *hostingdeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {\n\tresp.Schema = schema.Schema{\n\t\tAttributes: map[string]schema.Attribute{\n\t\t\t\"account_id\": schema.StringAttribute{\n\t\t\t\tDescription: \"Account ID for hosting.de API. May also be provided via HOSTINGDE_ACCOUNT_ID environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"auth_token\": schema.StringAttribute{\n\t\t\t\tDescription: \"Auth token for hosting.de API. May also be provided via HOSTINGDE_AUTH_TOKEN environment variable.\",\n\t\t\t\tOptional: true,\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func (manager *Manager) loadSchemaFromFile(filePath string) error {\n\tif filePath == \"\" {\n\t\treturn nil\n\t}\n\tlog.Info(\"Loading schema %s ...\", filePath)\n\tschemas, err := util.LoadMap(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnamespaces, _ := schemas[\"namespaces\"].([]interface{})\n\tfor _, namespaceData := range namespaces {\n\t\tnamespace, err := NewNamespace(namespaceData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = manager.registerNamespace(namespace); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tschemaObjList := []*Schema{}\n\tschemaMap := map[string]*Schema{}\n\tlist, _ := schemas[\"schemas\"].([]interface{})\n\tfor _, schemaData := range list {\n\t\tif fileName, ok := schemaData.(string); ok {\n\t\t\terr := manager.loadSchemaFromFile(fileName) // recursive call for included files\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tmetaschema, _ := manager.schema(\"schema\")\n\t\t\tschemaObj, err := newSchemaFromObj(schemaData, metaschema)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tschemaMap[schemaObj.ID] = schemaObj\n\t\t\tschemaObjList = append(schemaObjList, schemaObj)\n\t\t}\n\t}\n\t_, err = reorderSchemas(schemaObjList)\n\tif err != nil {\n\t\tlog.Warning(\"Error in reordering schema %s\", err)\n\t}\n\tfor _, schemaObj := range schemaObjList {\n\t\tif schemaObj.IsAbstract() {\n\t\t\t// Register abstract schema\n\t\t\tmanager.registerSchema(schemaObj)\n\t\t} else {\n\t\t\tfor _, baseSchemaID := range schemaObj.Extends {\n\t\t\t\tbaseSchema, ok := manager.schema(baseSchemaID)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fmt.Errorf(\"Base Schema %s not found\", baseSchemaID)\n\t\t\t\t}\n\t\t\t\tif !baseSchema.IsAbstract() {\n\t\t\t\t\treturn fmt.Errorf(\"Base Schema %s isn't abstract type\", baseSchemaID)\n\t\t\t\t}\n\t\t\t\tschemaObj.Extend(baseSchema)\n\t\t\t}\n\t\t}\n\t}\n\t// Reorder schema by relation topology\n\tschemaOrder, err := reorderSchemas(schemaObjList)\n\tif err != nil {\n\t\tlog.Warning(\"Error in reordering schema %s\", err)\n\t}\n\n\tfor _, id := range schemaOrder {\n\t\tschemaObj := schemaMap[id]\n\t\tif !schemaObj.IsAbstract() {\n\t\t\terr = manager.registerSchema(schemaObj)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tpolicies, _ := schemas[\"policies\"].([]interface{})\n\tif policies != nil {\n\t\tfor _, policyData := range policies {\n\t\t\tpolicy, err := NewPolicy(policyData)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmanager.policies = append(manager.policies, policy)\n\t\t}\n\t}\n\textensions, _ := schemas[\"extensions\"].([]interface{})\n\tif extensions == nil {\n\t\treturn nil\n\t}\n\n\tfor _, extensionData := range extensions {\n\t\td := extensionData.(map[string](interface{}))\n\t\trawurl, ok := d[\"url\"].(string)\n\t\tif ok {\n\t\t\td[\"url\"], err = fixRelativeURL(rawurl, filepath.Dir(filePath))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\textension, err := NewExtension(extensionData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\textension.File = filePath\n\t\tmanager.Extensions = append(manager.Extensions, extension)\n\t}\n\n\treturn nil\n}", "func fixOpenAPISchema(name string, schema *openapi3.Schema) {\n\tt := schema.Type\n\tswitch t {\n\tcase \"object\":\n\t\tfor k, v := range schema.Properties {\n\t\t\ts := v.Value\n\t\t\tfixOpenAPISchema(k, s)\n\t\t}\n\tcase \"array\":\n\t\tfixOpenAPISchema(\"\", schema.Items.Value)\n\t}\n\tif name != \"\" {\n\t\tschema.Title = name\n\t}\n\n\tdescription := schema.Description\n\tif strings.Contains(description, UsageTag) {\n\t\tdescription = strings.Split(description, UsageTag)[1]\n\t}\n\tif strings.Contains(description, ShortTag) {\n\t\tdescription = strings.Split(description, ShortTag)[0]\n\t\tdescription = strings.TrimSpace(description)\n\t}\n\tschema.Description = description\n}", "func (q oauthClientQuery) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.Exec(exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for oauth_clients\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for oauth_clients\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (s *Store) reregisterSchemas() error {\n\tresults, err := s.datastore.Query(query.Query{\n\t\tPrefix: dsStoreSchemas.String(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer results.Close()\n\n\tfor res := range results.Next() {\n\t\tname := ds.RawKey(res.Key).Name()\n\t\tvar indexes []*IndexConfig\n\t\tindex, err := s.datastore.Get(dsStoreIndexes.ChildString(name))\n\t\tif err == nil && index != nil {\n\t\t\t_ = json.Unmarshal(index, &indexes)\n\t\t}\n\t\tif _, err := s.RegisterSchema(name, string(res.Value), indexes...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Client) UpdateSchemaDevice(ctx context.Context, path string, payload *UpdateDeviceSourceSchemaPayload) (*http.Response, error) {\n\treq, err := c.NewUpdateSchemaDeviceRequest(ctx, path, payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "func HandleModify(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tfmt.Println(\"In handleModify\")\r\n\tvar ab AddressBook\r\n\tif r.Method != http.MethodPost {\r\n\t\terr := fmt.Sprintf(\"Method %s not supported on this action %s\\n\", r.Method, r.URL.Path)\r\n\t\tfmt.Printf(\"%s\", err)\r\n\t\thttp.Error(w, err, http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n\r\n\tif err := json.NewDecoder(r.Body).Decode(&ab); err != nil {\r\n\t\tmsg := fmt.Sprintf(\"Error %s while decoding json\\n\", err.Error())\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tif ab.FirstName == \"\" {\r\n\t\tmsg := \"Name not provided as part of the query\\n\"\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tMutex.RLock()\r\n\tdefer Mutex.RUnlock()\r\n\tif len(AddrBook) == 0 {\r\n\t\tmsg := fmt.Sprintf(\"Address book is empty nothing to modify\\n\")\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tif abTmp, ok := AddrBook[ab.FirstName]; !ok {\r\n\t\tmsg := fmt.Sprintf(\"%s not found in the Address book, nothing to modify\\n\", abTmp.FirstName)\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\tabTmp, _ := AddrBook[ab.FirstName]\r\n\tif ab.LastName != \"\" && abTmp.LastName != ab.LastName {\r\n\t\tabTmp.LastName = ab.LastName\r\n\t}\r\n\tif ab.Email != \"\" && abTmp.Email != ab.Email {\r\n\t\tabTmp.Email = ab.Email\r\n\t}\r\n\tif ab.PhoneNumber != 0 && abTmp.PhoneNumber != ab.PhoneNumber {\r\n\t\tabTmp.PhoneNumber = ab.PhoneNumber\r\n\t}\r\n\tAddrBook[ab.FirstName] = abTmp\r\n\tmsg := fmt.Sprintf(\"Modified name %s present in the address book\\n\", ab.FirstName)\r\n\tfmt.Printf(\"%s\", msg)\r\n\thttp.Error(w, msg, http.StatusOK)\r\n}", "func migrateSchemas(ctx context.Context, db *core_database.DatabaseConn, log *zap.Logger, models ...interface{}) error {\n\tvar engine *gorm.DB\n\tif db == nil {\n\t\treturn service_errors.ErrInvalidInputArguments\n\t}\n\n\tif engine = db.Engine; engine == nil {\n\t\treturn errors.New(\"invalid gorm database engine object\")\n\t}\n\n\tif len(models) > 0 {\n\t\tif err := engine.AutoMigrate(models...); err != nil {\n\t\t\t// TODO: emit metric\n\t\t\tlog.Error(err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Info(\"successfully migrated database schemas\")\n\t}\n\n\treturn nil\n}", "func (r *IndexingDatasourcesService) UpdateSchema(name string, updateschemarequest *UpdateSchemaRequest) *IndexingDatasourcesUpdateSchemaCall {\n\tc := &IndexingDatasourcesUpdateSchemaCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.updateschemarequest = updateschemarequest\n\treturn c\n}", "func (rh RequestHandler) RegisterAll(s *schemabuilder.Schema) {\n\trh.RegisterService(s)\n\trh.RegisterRepo(s)\n\trh.RegisterCI(s)\n}", "func UpdateSchemaDevicePath(id int) string {\n\tparam0 := strconv.Itoa(id)\n\n\treturn fmt.Sprintf(\"/sources/devices/%s/schemas\", param0)\n}" ]
[ "0.7679847", "0.69742095", "0.6728757", "0.66691935", "0.6480663", "0.6210196", "0.6210196", "0.61880237", "0.61793935", "0.57679015", "0.572682", "0.5706312", "0.56923145", "0.56712043", "0.5664309", "0.55865926", "0.55235964", "0.54683274", "0.5465102", "0.5459875", "0.5393502", "0.53818387", "0.53033406", "0.527041", "0.522895", "0.5162084", "0.5154151", "0.5149806", "0.51365596", "0.5131924", "0.51095766", "0.508905", "0.50879806", "0.50878304", "0.5073474", "0.50504947", "0.5037368", "0.50146735", "0.49783564", "0.49675238", "0.49632105", "0.49547338", "0.49352205", "0.49305654", "0.49269697", "0.49198505", "0.491181", "0.48907366", "0.488733", "0.4884231", "0.4867451", "0.48554194", "0.48445576", "0.482416", "0.48118082", "0.47956735", "0.4795081", "0.4790397", "0.47878632", "0.47869894", "0.47832632", "0.47828314", "0.47814167", "0.47786272", "0.47660008", "0.47642365", "0.47588313", "0.4744389", "0.4744389", "0.4743377", "0.4739334", "0.47264794", "0.4720232", "0.47036412", "0.46983358", "0.4695408", "0.46847668", "0.4681038", "0.46769238", "0.46677953", "0.46661106", "0.46619084", "0.46587953", "0.4655064", "0.4651779", "0.46511915", "0.4646474", "0.46445203", "0.46401072", "0.4639807", "0.4639561", "0.4637688", "0.46368262", "0.4629439", "0.46271092", "0.46227452", "0.4611619", "0.46052969", "0.46031642", "0.45992586" ]
0.8581223
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *DaemonsetRef) DeepCopyInto(out *DaemonsetRef) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8216088", "0.8128937", "0.81051093", "0.8086112", "0.80840266", "0.806814", "0.80643326", "0.80272067", "0.8013088", "0.79972315", "0.799318", "0.7988673", "0.79883105", "0.79879236", "0.79879236", "0.7986761", "0.79770774", "0.7973031", "0.7970074", "0.7970074", "0.7970074", "0.7968491", "0.7963908", "0.7962594", "0.79461676", "0.79461676", "0.79453707", "0.794318", "0.794318", "0.79430556", "0.7941854", "0.7939476", "0.7937904", "0.79294026", "0.7925471", "0.7917021", "0.79131836", "0.79123056", "0.7910745", "0.79105514", "0.79092926", "0.7906994", "0.79068947", "0.7905208", "0.7905208", "0.7904789", "0.7904576", "0.7902542", "0.789971", "0.7898187", "0.789275", "0.78916943", "0.78905755", "0.7889031", "0.7887323", "0.7887001", "0.78859967", "0.78859967", "0.788571", "0.7881972", "0.7875957", "0.7875957", "0.78754383", "0.78744066", "0.78725743", "0.7872079", "0.78715914", "0.7865343", "0.7863912", "0.7863912", "0.7863912", "0.78638506", "0.7863712", "0.7862366", "0.7859421", "0.7858547", "0.7857873", "0.78512096", "0.7847138", "0.78456485", "0.7841974", "0.78375477", "0.7837439", "0.78371376", "0.7835643", "0.7833311", "0.78312105", "0.7830207", "0.7828144", "0.7826242", "0.7825785", "0.782401", "0.7820985", "0.7819203", "0.78140086", "0.7812223", "0.7811996", "0.7811559", "0.78109616", "0.7809847", "0.7809696" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonsetRef.
func (in *DaemonsetRef) DeepCopy() *DaemonsetRef { if in == nil { return nil } out := new(DaemonsetRef) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *BcsDaemonset) DeepCopy() *BcsDaemonset {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsDaemonset)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressDaemonSet) DeepCopy() *IngressDaemonSet {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressDaemonSet)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsDaemonsetList) DeepCopy() *BcsDaemonsetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsDaemonsetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressDaemonSetList) DeepCopy() *IngressDaemonSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressDaemonSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DaemonsetsSpec) DeepCopy() *DaemonsetsSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DaemonsetsSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func SetDaemonsetOwnerRef(pod *v1.Pod) {\n\tpod.ObjectMeta.OwnerReferences = GetDaemonSetOwnerRefList()\n}", "func (in *BcsDaemonsetSpec) DeepCopy() *BcsDaemonsetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsDaemonsetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ManagedSeedSet) DeepCopy() *ManagedSeedSet {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ManagedSeedSet)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressDaemonSetSpec) DeepCopy() *IngressDaemonSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressDaemonSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ReconcileDaemonSet(c client.Client, hdfs hdfsv1.HDFS, expected v1.DaemonSet) (v1.DaemonSet, error) {\n\n\t//create kind instance\n\tvar reconciled v1.DaemonSet\n\terr := ReconcileResource(Params{\n\t\tClient: c,\n\t\tOwner: &hdfs,\n\t\tExpected: &expected,\n\t\tReconciled: &reconciled,\n\t})\n\n\treturn reconciled, err\n}", "func (in *DaemonsetRef) DeepCopyInto(out *DaemonsetRef) {\n\t*out = *in\n}", "func (c *component) daemonset() *appsv1.DaemonSet {\n\tmaxUnavailable := intstr.FromInt(1)\n\n\tannots := map[string]string{}\n\n\tif c.config.envoyConfigMap != nil {\n\t\tannots[EnvoyConfigMapName] = rmeta.AnnotationHash(c.config.envoyConfigMap)\n\t}\n\n\tif c.config.ModSecurityConfigMap != nil {\n\t\tannots[ModSecurityRulesetHashAnnotation] = rmeta.AnnotationHash(c.config.ModSecurityConfigMap.Data)\n\t}\n\n\tpodTemplate := corev1.PodTemplateSpec{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: annots,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tHostIPC: true,\n\t\t\tHostNetwork: true,\n\t\t\tServiceAccountName: APLName,\n\t\t\tDNSPolicy: corev1.DNSClusterFirstWithHostNet,\n\t\t\t// Absence of l7 daemonset pod on a node will break the annotated services connectivity, so we tolerate all.\n\t\t\tTolerations: rmeta.TolerateAll,\n\t\t\tImagePullSecrets: secret.GetReferenceList(c.config.PullSecrets),\n\t\t\tContainers: c.containers(),\n\t\t\tVolumes: c.volumes(),\n\t\t},\n\t}\n\n\treturn &appsv1.DaemonSet{\n\t\tTypeMeta: metav1.TypeMeta{Kind: \"DaemonSet\", APIVersion: \"apps/v1\"},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: ApplicationLayerDaemonsetName,\n\t\t\tNamespace: common.CalicoNamespace,\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tTemplate: podTemplate,\n\t\t\tUpdateStrategy: appsv1.DaemonSetUpdateStrategy{\n\t\t\t\tRollingUpdate: &appsv1.RollingUpdateDaemonSet{\n\t\t\t\t\tMaxUnavailable: &maxUnavailable,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func ValidateDaemonSet(ds *apps.DaemonSet, opts apivalidation.PodValidationOptions) field.ErrorList {\n\tallErrs := apivalidation.ValidateObjectMeta(&ds.ObjectMeta, true, ValidateDaemonSetName, field.NewPath(\"metadata\"))\n\tallErrs = append(allErrs, ValidateDaemonSetSpec(&ds.Spec, nil, field.NewPath(\"spec\"), opts)...)\n\treturn allErrs\n}", "func DeleteDaemonSet(daemonSetName, namespace string) error {\n\tconst (\n\t\tTimeout = 5 * time.Minute\n\t)\n\n\tlogrus.Infof(\"Deleting daemonset %s\", daemonSetName)\n\tdeletePolicy := metav1.DeletePropagationForeground\n\n\tif err := daemonsetClient.K8sClient.AppsV1().DaemonSets(namespace).Delete(context.TODO(), daemonSetName, metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}); err != nil {\n\t\tlogrus.Infof(\"The daemonset (%s) deletion is unsuccessful due to %+v\", daemonSetName, err.Error())\n\t}\n\n\tfor start := time.Now(); time.Since(start) < Timeout; {\n\n\t\tpods, err := daemonsetClient.K8sClient.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{LabelSelector: \"name=\" + daemonSetName})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get pods, err: %s\", err)\n\t\t}\n\n\t\tif len(pods.Items) == 0 {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(waitingTime)\n\t}\n\n\tlogrus.Infof(\"Successfully cleaned up daemonset %s\", daemonSetName)\n\treturn nil\n}", "func (c *Client) DaemonSetsCleaner(namespace string, dryRun bool, directories []string) error {\n\tvar left []string\n\n\tclusterDaemonsets, err := c.ListDaemonSets(namespace)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\tfor _, value := range clusterDaemonsets.Items {\n\t\tleft = append(left, value.Name)\n\t}\n\n\tobjectsToDelete := Except(left, \"DaemonSet\", directories)\n\n\tfor _, item := range objectsToDelete {\n\t\tfor _, daemonset := range clusterDaemonsets.Items {\n\t\t\tif item == daemonset.Name {\n\t\t\t\tif dryRun {\n\t\t\t\t\tcolor.Yellow(\"******************************************************************************\")\n\t\t\t\t\tcolor.Yellow(\" Deleting DaemonSet %s [dry-run]\\n\", daemonset.Name)\n\t\t\t\t\tcolor.Yellow(\"******************************************************************************\")\n\t\t\t\t} else {\n\t\t\t\t\tcolor.Red(\"******************************************************************************\")\n\t\t\t\t\tcolor.Red(\" Deleting DaemonSet %s\\n\", daemonset.Name)\n\t\t\t\t\tcolor.Red(\"******************************************************************************\")\n\t\t\t\t\tif err := c.DeleteDaemonSet(daemonset); err != nil {\n\t\t\t\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\t\t\t\tos.Exit(1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetDaemonSetOwnerRefList() []metav1.OwnerReference {\n\treturn []metav1.OwnerReference{\n\t\t{Kind: \"DaemonSet\", APIVersion: \"v1\"},\n\t}\n}", "func MockDaemonSet() appsv1.DaemonSet {\n\tp := MockPod()\n\treturn appsv1.DaemonSet{\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tTemplate: corev1.PodTemplateSpec{Spec: p.Spec},\n\t\t},\n\t}\n}", "func CreateOrUpdateDaemonSet(client clientset.Interface, ds *extensions.DaemonSet) error {\n if _, err := client.ExtensionsV1beta1().DaemonSets(ds.ObjectMeta.Namespace).Create(ds); err != nil {\n if !apierrors.IsAlreadyExists(err) {\n return fmt.Errorf(\"unable to create daemonset: %v\", err)\n }\n\n if _, err := client.ExtensionsV1beta1().DaemonSets(ds.ObjectMeta.Namespace).Update(ds); err != nil {\n return fmt.Errorf(\"unable to update daemonset: %v\", err)\n }\n }\n return nil\n}", "func (in *ReplicaSet) DeepCopy() *ReplicaSet {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReplicaSet)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func GetDaemonSet(namespace string, daemonsetName string) *v1beta1.DaemonSet {\n\treturn &v1beta1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: daemonsetName,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{\"firstLabel\": \"temp\"},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tconstants.ConfigmapUpdateOnChangeAnnotation: daemonsetName,\n\t\t\t\tconstants.SecretUpdateOnChangeAnnotation: daemonsetName},\n\t\t},\n\t\tSpec: v1beta1.DaemonSetSpec{\n\t\t\tUpdateStrategy: v1beta1.DaemonSetUpdateStrategy{\n\t\t\t\tType: v1beta1.RollingUpdateDaemonSetStrategyType,\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{\"secondLabel\": \"temp\"},\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\tImage: \"tutum/hello-world\",\n\t\t\t\t\t\t\tName: daemonsetName,\n\t\t\t\t\t\t\tEnv: []v1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"BUCKET_NAME\",\n\t\t\t\t\t\t\t\t\tValue: \"test\",\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}", "func annotateDaemonSet(ctx context.Context, c *kubernetes.Clientset, ds *appsv1.DaemonSet) error {\n\tds.Annotations[\"lunarway.com/observed-artifact-id\"] = ds.Annotations[\"lunarway.com/artifact-id\"]\n\t_, err := c.AppsV1().DaemonSets(ds.Namespace).Update(ctx, ds, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (in *ManagedSeedSetList) DeepCopy() *ManagedSeedSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ManagedSeedSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ClusterDockerDaemon) DeepCopy() *ClusterDockerDaemon {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterDockerDaemon)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Vrouter) PrepareDaemonSet(ds *appsv1.DaemonSet,\n\tcommonConfiguration *PodConfiguration,\n\trequest reconcile.Request,\n\tscheme *runtime.Scheme,\n\tclient client.Client) error {\n\tinstanceType := \"vrouter\"\n\tSetDSCommonConfiguration(ds, commonConfiguration)\n\tds.SetName(request.Name + \"-\" + instanceType + \"-daemonset\")\n\tds.SetNamespace(request.Namespace)\n\tds.SetLabels(map[string]string{\"contrail_manager\": instanceType,\n\t\tinstanceType: request.Name})\n\tds.Spec.Selector.MatchLabels = map[string]string{\"contrail_manager\": instanceType,\n\t\tinstanceType: request.Name}\n\tds.Spec.Template.SetLabels(map[string]string{\"contrail_manager\": instanceType,\n\t\tinstanceType: request.Name})\n\tds.Spec.Template.Spec.Affinity = &corev1.Affinity{\n\t\tPodAntiAffinity: &corev1.PodAntiAffinity{\n\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{{\n\t\t\t\tLabelSelector: &metav1.LabelSelector{\n\t\t\t\t\tMatchExpressions: []metav1.LabelSelectorRequirement{{\n\t\t\t\t\t\tKey: instanceType,\n\t\t\t\t\t\tOperator: \"Exists\",\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\tTopologyKey: \"kubernetes.io/hostname\",\n\t\t\t}},\n\t\t},\n\t}\n\terr := controllerutil.SetControllerReference(c, ds, scheme)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DeleteDaemonSet(client kubernetes.Interface, namespace string, daemonsetName string) error {\n\tlogrus.Infof(\"Deleting DaemonSet %s\", daemonsetName)\n\tdaemonsetError := client.ExtensionsV1beta1().DaemonSets(namespace).Delete(daemonsetName, &metav1.DeleteOptions{})\n\ttime.Sleep(10 * time.Second)\n\treturn daemonsetError\n}", "func GetDaemonSetDetail(client k8sClient.Interface, metricClient metricapi.MetricClient,\n\tnamespace, name string) (*DaemonSetDetail, error) {\n\n\tlog.Printf(\"Getting details of %s daemon set in %s namespace\", name, namespace)\n\tdaemonSet, err := client.AppsV1beta2().DaemonSets(namespace).Get(name, metaV1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodList, err := GetDaemonSetPods(client, metricClient, ds.DefaultDataSelectWithMetrics, name, namespace)\n\tnonCriticalErrors, criticalError := errors.HandleError(err)\n\tif criticalError != nil {\n\t\treturn nil, criticalError\n\t}\n\n\tpodInfo, err := getDaemonSetPodInfo(client, daemonSet)\n\tnonCriticalErrors, criticalError = errors.AppendError(err, nonCriticalErrors)\n\tif criticalError != nil {\n\t\treturn nil, criticalError\n\t}\n\n\tserviceList, err := GetDaemonSetServices(client, ds.DefaultDataSelect, namespace, name)\n\tnonCriticalErrors, criticalError = errors.AppendError(err, nonCriticalErrors)\n\tif criticalError != nil {\n\t\treturn nil, criticalError\n\t}\n\n\teventList, err := event.GetResourceEvents(client, ds.DefaultDataSelect, daemonSet.Namespace, daemonSet.Name)\n\tnonCriticalErrors, criticalError = errors.AppendError(err, nonCriticalErrors)\n\tif criticalError != nil {\n\t\treturn nil, criticalError\n\t}\n\n\tdaemonSetDetail := &DaemonSetDetail{\n\t\tObjectMeta: api.NewObjectMeta(daemonSet.ObjectMeta),\n\t\tTypeMeta: api.NewTypeMeta(api.ResourceKindDaemonSet),\n\t\tLabelSelector: daemonSet.Spec.Selector,\n\t\tPodInfo: *podInfo,\n\t\tPodList: *podList,\n\t\tServiceList: *serviceList,\n\t\tEventList: *eventList,\n\t\tErrors: nonCriticalErrors,\n\t}\n\n\tfor _, container := range daemonSet.Spec.Template.Spec.Containers {\n\t\tdaemonSetDetail.ContainerImages = append(daemonSetDetail.ContainerImages, container.Image)\n\t}\n\n\tfor _, initContainer := range daemonSet.Spec.Template.Spec.InitContainers {\n\t\tdaemonSetDetail.InitContainerImages = append(daemonSetDetail.InitContainerImages, initContainer.Image)\n\t}\n\n\treturn daemonSetDetail, nil\n}", "func (c *ClientSetClient) PatchDaemonSet(namespace, name, jsonPatch string) (*appsv1.DaemonSet, error) {\n\tctx := context.TODO()\n\treturn c.clientset.AppsV1().DaemonSets(namespace).Patch(ctx, name, types.StrategicMergePatchType, []byte(jsonPatch), metav1.PatchOptions{})\n}", "func (r *ReconcileHostPathProvisioner) reconcileDaemonSet(reqLogger logr.Logger, instance *hostpathprovisionerv1alpha1.HostPathProvisioner, namespace string) (reconcile.Result, error) {\n\t// Define a new DaemonSet object\n\tprovisionerImage := os.Getenv(provisionerImageEnvVarName)\n\tif provisionerImage == \"\" {\n\t\treqLogger.Info(\"PROVISIONER_IMAGE not set, defaulting to hostpath-provisioner\")\n\t\tprovisionerImage = ProvisionerImageDefault\n\t}\n\n\tdesired := createDaemonSetObject(instance, provisionerImage, namespace)\n\tdesiredMetaObj := &desired.ObjectMeta\n\tsetLastAppliedConfiguration(desiredMetaObj)\n\n\t// Set HostPathProvisioner instance as the owner and controller\n\tif err := controllerutil.SetControllerReference(instance, desired, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Check if this DaemonSet already exists\n\tfound := &appsv1.DaemonSet{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: desired.Name, Namespace: desired.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\treqLogger.Info(\"Creating a new DaemonSet\", \"DaemonSet.Namespace\", desired.Namespace, \"Daemonset.Name\", desired.Name)\n\t\terr = r.client.Create(context.TODO(), desired)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\t// DaemonSet created successfully - don't requeue\n\t\treturn reconcile.Result{}, nil\n\t} else if err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Keep a copy of the original for comparison later.\n\tcurrentRuntimeObjCopy := found.DeepCopyObject()\n\t// Copy found status fields, so the compare won't fail on desired/scheduled/ready pods being different. Updating will ignore them anyway.\n\tdesired = copyStatusFields(desired, found)\n\n\t// allow users to add new annotations (but not change ours)\n\tmergeLabelsAndAnnotations(desiredMetaObj, &found.ObjectMeta)\n\n\t// create merged DaemonSet from found and desired.\n\tmerged, err := mergeObject(desired, found)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif !reflect.DeepEqual(currentRuntimeObjCopy, merged) {\n\t\tlogJSONDiff(reqLogger, currentRuntimeObjCopy, merged)\n\t\t// Current is different from desired, update.\n\t\treqLogger.Info(\"Updating DaemonSet\", \"DaemonSet.Name\", desired.Name)\n\t\terr = r.client.Update(context.TODO(), merged)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\t// DaemonSet already exists and matches the desired state - don't requeue\n\treqLogger.Info(\"Skip reconcile: DaemonSet already exists\", \"DaemonSet.Namespace\", found.Namespace, \"Daemonset.Name\", found.Name)\n\treturn reconcile.Result{}, nil\n}", "func CreateDaemonSet(client *rancher.Client, clusterName, daemonSetName, namespace string, template corev1.PodTemplateSpec) (*appv1.DaemonSet, error) {\n\tdynamicClient, err := client.GetDownStreamClusterClient(clusterName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlabels := map[string]string{}\n\tlabels[\"workload.user.cattle.io/workloadselector\"] = fmt.Sprintf(\"apps.daemonset-%v-%v\", namespace, daemonSetName)\n\n\ttemplate.ObjectMeta = metav1.ObjectMeta{\n\t\tLabels: labels,\n\t}\n\ttemplate.Spec.RestartPolicy = corev1.RestartPolicyAlways\n\tdaemonSet := &appv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: daemonSetName,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: template,\n\t\t},\n\t}\n\n\tdaemonSetResource := dynamicClient.Resource(DaemonSetGroupVersionResource).Namespace(namespace)\n\n\tunstructuredResp, err := daemonSetResource.Create(context.TODO(), unstructured.MustToUnstructured(daemonSet), metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewDaemonSet := &appv1.DaemonSet{}\n\terr = scheme.Scheme.Convert(unstructuredResp, newDaemonSet, unstructuredResp.GroupVersionKind())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn daemonSet, nil\n}", "func (k *API) DaemonSets(namespace string) (*v1.DaemonSetList, error) {\n\tdaemonSets, err := k.Client.AppsV1().DaemonSets(namespace).List(context.Background(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn daemonSets, nil\n}", "func (s S) DaemonSets() []appsv1.DaemonSet {\n\treturn s.daemonSets\n}", "func DaemonSetName(name string) string {\n\treturn DNSLengthName(DaemonSetPrefix, \"%s-%s\", DaemonSetPrefix, name)\n}", "func (in *BcsDaemonset) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func daemonSetMatch(ds *appsv1.DaemonSet, history *appsv1.ControllerRevision) (bool, error) {\n\tpatch, err := getDaemonSetPatch(ds)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn bytes.Equal(patch, history.Data.Raw), nil\n}", "func NewMockDaemonSetReconciler(ctrl *gomock.Controller) *MockDaemonSetReconciler {\n\tmock := &MockDaemonSetReconciler{ctrl: ctrl}\n\tmock.recorder = &MockDaemonSetReconcilerMockRecorder{mock}\n\treturn mock\n}", "func (in *Statefulset) DeepCopy() *Statefulset {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Statefulset)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressDaemonSet) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (mr *MockRemoteSnapshotMockRecorder) DaemonSets() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DaemonSets\", reflect.TypeOf((*MockRemoteSnapshot)(nil).DaemonSets))\n}", "func (in *StatefulSet) DeepCopy() *StatefulSet {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSet)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func CalicoDaemonSet(repo string) string {\n\treturn calicoCommon(repo, \"node\")\n\n}", "func RunDSInformer(factory informers.SharedInformerFactory) {\n\tdsInformer := factory.Apps().V1().DaemonSets().Informer()\n\n\tstopper := make(chan struct{})\n\tdefer close(stopper)\n\n\tdefer runtime.HandleCrash()\n\n\tdsInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\t// When a resource gets updated\n\t\tUpdateFunc: func(oldObj interface{}, newObj interface{}) {\n\t\t\tdsNewObj := newObj.(*v1.DaemonSet)\n\t\t\tdsOldObj := newObj.(*v1.DaemonSet)\n\n\t\t\toldManifest := dsOldObj.GetAnnotations()[\"kubectl.kubernetes.io/last-applied-configuration\"]\n\t\t\tnewManifest := dsNewObj.GetAnnotations()[\"kubectl.kubernetes.io/last-applied-configuration\"]\n\n\t\t\tif oldManifest != \"\" && newManifest != \"\" {\n\t\t\t\tvar oldDm v1.StatefulSet\n\t\t\t\terr := json.Unmarshal([]byte(oldManifest), &oldDm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tvar newDm v1.StatefulSet\n\t\t\t\terr = json.Unmarshal([]byte(newManifest), &newDm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif dsNewObj.GetResourceVersion() != dsOldObj.GetResourceVersion() && !reflect.DeepEqual(newDm, oldDm) {\n\t\t\t\t\tvar worflowid = dsNewObj.GetAnnotations()[\"litmuschaos.io/workflow\"]\n\t\t\t\t\tif dsNewObj.GetAnnotations()[\"litmuschaos.io/gitops\"] == \"true\" && worflowid != \"\" {\n\t\t\t\t\t\tlog.Print(\"EventType: Update \\n GitOps Notification for workflowID: %s, ResourceType: %s, ResourceName: %s, ResourceNamespace: %s\", worflowid, \"DaemonSet\", dsNewObj.Name, dsNewObj.Namespace)\n\t\t\t\t\t\terr := PolicyAuditor(\"DaemonSet\", dsNewObj, worflowid)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Print(err)\n\t\t\t\t\t\t\treturn\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\tdsInformer.Run(stopper)\n\tif !cache.WaitForCacheSync(stopper, dsInformer.HasSynced) {\n\t\truntime.HandleError(fmt.Errorf(\"Timed out waiting for caches to sync\"))\n\t\treturn\n\t}\n}", "func DS(namespace, name string, containerImages ...string) kapisext.DaemonSet {\n\treturn kapisext.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t\tSelfLink: \"/ds/\" + name,\n\t\t},\n\t\tSpec: kapisext.DaemonSetSpec{\n\t\t\tTemplate: kapi.PodTemplateSpec{\n\t\t\t\tSpec: PodSpec(containerImages...),\n\t\t\t},\n\t\t},\n\t}\n}", "func (in *DnsForwardingRuleset) DeepCopy() *DnsForwardingRuleset {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRuleset)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (d *Dentry) DecRef() {\n\td.impl.DecRef()\n}", "func NewDaemonSetPrepuller(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.ClusterConfiguration) *DaemonSetPrepuller {\n\treturn &DaemonSetPrepuller{\n\t\tclient: client,\n\t\tcfg: cfg,\n\t\twaiter: waiter,\n\t}\n}", "func (s S) WithDaemonSets(d []appsv1.DaemonSet) S {\n\ts.daemonSets = d\n\treturn s\n}", "func GetOwnerRefDaemonSet(sts *appsv1.DaemonSet) metav1.OwnerReference {\n\tf := false\n\tt := true\n\treturn metav1.OwnerReference{\n\t\tAPIVersion: \"apps/v1\",\n\t\tKind: \"DaemonSet\",\n\t\tName: sts.Name,\n\t\tUID: sts.UID,\n\t\tController: &f,\n\t\tBlockOwnerDeletion: &t,\n\t}\n}", "func inheritDaemonsetLabels(service *apistructs.Service, daemonset *appsv1.DaemonSet) error {\n\tif daemonset == nil {\n\t\treturn nil\n\t}\n\n\tif daemonset.Labels == nil {\n\t\tdaemonset.Labels = make(map[string]string)\n\t}\n\n\tif daemonset.Spec.Template.Labels == nil {\n\t\tdaemonset.Spec.Template.Labels = make(map[string]string)\n\t}\n\n\thasHostPath := serviceHasHostpath(service)\n\n\terr := setPodLabelsFromService(hasHostPath, service.Labels, daemonset.Labels)\n\tif err != nil {\n\t\treturn errors.Errorf(\"error in service.Labels: for daemonset %v in namesapce %v with error: %v\\n\", daemonset.Name, daemonset.Namespace, err)\n\t}\n\n\tfor lk, lv := range daemonset.Labels {\n\t\tif lk == apistructs.AlibabaECILabel && lv == \"true\" {\n\t\t\treturn errors.Errorf(\"error in service.Labels: for daemonset %v in namesapce %v with error: ECI not support daemonset, do not set lables %s='true' for daemonset\", daemonset.Name, daemonset.Namespace, lk)\n\t\t}\n\t}\n\n\terr = setPodLabelsFromService(hasHostPath, service.Labels, daemonset.Spec.Template.Labels)\n\tif err != nil {\n\t\treturn errors.Errorf(\"error in service.Labels: for daemonset %v in namesapce %v with error: %v\\n\", daemonset.Name, daemonset.Namespace, err)\n\t}\n\n\terr = setPodLabelsFromService(hasHostPath, service.DeploymentLabels, daemonset.Spec.Template.Labels)\n\tif err != nil {\n\t\treturn errors.Errorf(\"error in service.DeploymentLabels: for daemonset %v in namesapce %v with error: %v\\n\", daemonset.Name, daemonset.Namespace, err)\n\t}\n\n\tfor lk, lv := range daemonset.Spec.Template.Labels {\n\t\tif lk == apistructs.AlibabaECILabel && lv == \"true\" {\n\t\t\treturn errors.Errorf(\"error in service.DeploymentLabels: for daemonset %v in namesapce %v with error: ECI not support daemonset, do not set lables %s='true' for daemonset.\\n\", daemonset.Name, daemonset.Namespace, lk)\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreateDaemonSet(daemonSetName, namespace, containerName, imageWithVersion string, timeout time.Duration) (*v1core.PodList, error) {\n\n\trebootDaemonSet := createDaemonSetsTemplate(daemonSetName, namespace, containerName, imageWithVersion)\n\n\tif doesDaemonSetExist(daemonSetName, namespace) {\n\t\terr := DeleteDaemonSet(daemonSetName, namespace)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Failed to delete %s daemonset because: %s\", daemonSetName, err)\n\t\t}\n\t}\n\n\tlogrus.Infof(\"Creating daemonset %s\", daemonSetName)\n\t_, err := daemonsetClient.K8sClient.AppsV1().DaemonSets(namespace).Create(context.TODO(), rebootDaemonSet, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = WaitDaemonsetReady(namespace, daemonSetName, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogrus.Infof(\"Deamonset is ready\")\n\n\tvar ptpPods *v1core.PodList\n\tptpPods, err = daemonsetClient.K8sClient.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{LabelSelector: \"name=\" + daemonSetName})\n\tif err != nil {\n\t\treturn ptpPods, err\n\t}\n\tlogrus.Infof(\"Successfully created daemonset %s\", daemonSetName)\n\treturn ptpPods, nil\n}", "func (s *Scheduler) CheckPodBelongDaemonset(taskgroupID string) bool {\n\tnamespace, name := types.GetRunAsAndAppIDbyTaskGroupID(taskgroupID)\n\tversion, err := s.store.GetVersion(namespace, name)\n\tif err != nil {\n\t\tblog.Errorf(\"Fetch taskgroup(%s) version(%s.%s) error %s\", taskgroupID, namespace, name, err.Error())\n\t\treturn false\n\t}\n\tif version == nil {\n\t\tblog.Errorf(\"Fetch taskgroup(%s) version(%s.%s) is empty\", taskgroupID, namespace, name)\n\t\treturn false\n\t}\n\n\tif version.Kind == commtype.BcsDataType_Daemonset {\n\t\treturn true\n\t}\n\treturn false\n}", "func makeDaemonsets(dsc *Checker, orphan bool) error {\n\n\tif orphan {\n\t\tdsc.hostname = \"ORPHANED-TEST\"\n\t}\n\n\tcheckRunTime := strconv.Itoa(int(CheckRunTime))\n\thostname := getHostname()\n\n\tterminationGracePeriod := int64(1)\n\ttestDS := Checker{\n\t\tNamespace: Namespace,\n\t\tDaemonSetName: daemonSetBaseName + \"-\" + hostname + \"-\" + checkRunTime,\n\t\thostname: hostname,\n\t}\n\n\ttestDS.DaemonSet = &appsv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: testDS.DaemonSetName,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": testDS.DaemonSetName,\n\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\"checkRunTime\": checkRunTime,\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": testDS.DaemonSetName,\n\t\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\t\"checkRunTime\": checkRunTime,\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\": testDS.DaemonSetName,\n\t\t\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\t\t\"checkRunTime\": checkRunTime,\n\t\t\t\t\t},\n\t\t\t\t\tName: testDS.DaemonSetName,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tTerminationGracePeriodSeconds: &terminationGracePeriod,\n\t\t\t\t\tTolerations: []apiv1.Toleration{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: \"node-role.kubernetes.io/master\",\n\t\t\t\t\t\t\tEffect: \"NoSchedule\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"sleep\",\n\t\t\t\t\t\t\tImage: \"gcr.io/google_containers/pause:0.8.0\",\n\t\t\t\t\t\t\tResources: apiv1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: apiv1.ResourceList{\n\t\t\t\t\t\t\t\t\tapiv1.ResourceCPU: resource.MustParse(\"0\"),\n\t\t\t\t\t\t\t\t\tapiv1.ResourceMemory: resource.MustParse(\"0\"),\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\tdaemonSetClient := dsc.getDaemonSetClient()\n\t_, err := daemonSetClient.Create(testDS.DaemonSet)\n\treturn err\n}", "func (in *Datacenter) DeepCopy() *Datacenter {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Datacenter)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ReplicaSetList) DeepCopy() *ReplicaSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReplicaSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func getDSClient() v1.DaemonSetInterface {\n\tlog.Debug(\"Creating Daemonset client.\")\n\treturn client.AppsV1().DaemonSets(checkNamespace)\n}", "func createDaemonSetObject(cr *hostpathprovisionerv1alpha1.HostPathProvisioner, provisionerImage, namespace string) *appsv1.DaemonSet {\n\tvolumeType := corev1.HostPathDirectoryOrCreate\n\tlabels := map[string]string{\n\t\t\"k8s-app\": cr.Name,\n\t}\n\treturn &appsv1.DaemonSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t\tKind: \"DaemonSet\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"k8s-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: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tServiceAccountName: cr.Name + \"-admin\",\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,\n\t\t\t\t\t\t\tImage: provisionerImage,\n\t\t\t\t\t\t\tImagePullPolicy: cr.Spec.ImagePullPolicy,\n\t\t\t\t\t\t\tEnv: []corev1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"USE_NAMING_PREFIX\",\n\t\t\t\t\t\t\t\t\tValue: cr.Spec.PathConfig.UseNamingPrefix,\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: \"NODE_NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &corev1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &corev1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"spec.nodeName\",\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\t{\n\t\t\t\t\t\t\t\t\tName: \"PV_DIR\",\n\t\t\t\t\t\t\t\t\tValue: cr.Spec.PathConfig.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\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"pv-volume\",\n\t\t\t\t\t\t\t\t\tMountPath: cr.Spec.PathConfig.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\tTerminationMessagePath: \"/dev/termination-log\",\n\t\t\t\t\t\t\tTerminationMessagePolicy: corev1.TerminationMessageReadFile,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"pv-volume\", // Has to match VolumeMounts in containers\n\t\t\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: cr.Spec.PathConfig.Path,\n\t\t\t\t\t\t\t\t\tType: &volumeType,\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}", "func ValidateDaemonSetUpdate(ds, oldDS *apps.DaemonSet, opts apivalidation.PodValidationOptions) field.ErrorList {\n\tallErrs := apivalidation.ValidateObjectMetaUpdate(&ds.ObjectMeta, &oldDS.ObjectMeta, field.NewPath(\"metadata\"))\n\tallErrs = append(allErrs, ValidateDaemonSetSpecUpdate(&ds.Spec, &oldDS.Spec, field.NewPath(\"spec\"))...)\n\tallErrs = append(allErrs, ValidateDaemonSetSpec(&ds.Spec, &oldDS.Spec, field.NewPath(\"spec\"), opts)...)\n\treturn allErrs\n}", "func (r *reconciler) createLogsDaemonSet(\n\tctx context.Context,\n\tl log.Logger,\n\td config.Deployment,\n\ts assets.SecretStore,\n) error {\n\tname := fmt.Sprintf(\"%s-logs\", d.Agent.Name)\n\tds, err := generateLogsDaemonSet(r.config, name, d)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to generate DaemonSet: %w\", err)\n\t}\n\tkey := types.NamespacedName{Namespace: ds.Namespace, Name: ds.Name}\n\n\tif len(d.Logs) == 0 {\n\n\t\tvar ds apps_v1.DaemonSet\n\t\terr := r.Client.Get(ctx, key, &ds)\n\t\tif k8s_errors.IsNotFound(err) || !isManagedResource(&ds) {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn fmt.Errorf(\"failed to find stale DaemonSet %s: %w\", key, err)\n\t\t}\n\n\t\terr = r.Client.Delete(ctx, &ds)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to delete stale DaemonSet %s: %w\", key, err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tlevel.Info(l).Log(\"msg\", \"reconciling logs daemonset\", \"ds\", key)\n\terr = clientutil.CreateOrUpdateDaemonSet(ctx, r.Client, ds)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to reconcile statefulset governing service: %w\", err)\n\t}\n\treturn nil\n}", "func NewDaemonSetControl(config DSConfig) (*DSControl, error) {\n\terr := config.checkAndSetDefaults()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn &DSControl{\n\t\tDSConfig: config,\n\t\tFieldLogger: log.WithFields(log.Fields{\n\t\t\t\"daemonset\": formatMeta(config.ObjectMeta),\n\t\t}),\n\t}, nil\n}", "func Convert_apps_DaemonSetList_To_v1_DaemonSetList(in *apps.DaemonSetList, out *v1.DaemonSetList, s conversion.Scope) error {\n\treturn autoConvert_apps_DaemonSetList_To_v1_DaemonSetList(in, out, s)\n}", "func (in *BcsDaemonsetStatus) DeepCopy() *BcsDaemonsetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsDaemonsetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ChartRef) DeepCopy() *ChartRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChartRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ApplyDaemonSetv1(ctx context.Context, client appsclientv1.DaemonSetsGetter, required *appsv1.DaemonSet, reconciling bool) (*appsv1.DaemonSet, bool, error) {\n\texisting, err := client.DaemonSets(required.Namespace).Get(ctx, required.Name, metav1.GetOptions{})\n\tif apierrors.IsNotFound(err) {\n\t\tklog.V(2).Infof(\"DaemonSet %s/%s not found, creating\", required.Namespace, required.Name)\n\t\tactual, err := client.DaemonSets(required.Namespace).Create(ctx, required, metav1.CreateOptions{})\n\t\treturn actual, true, err\n\t}\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\t// if we only create this resource, we have no need to continue further\n\tif IsCreateOnly(required) {\n\t\treturn nil, false, nil\n\t}\n\n\tmodified := pointer.Bool(false)\n\tresourcemerge.EnsureDaemonSet(modified, existing, *required)\n\tif !*modified {\n\t\treturn existing, false, nil\n\t}\n\n\tif reconciling {\n\t\tklog.V(2).Infof(\"Updating DaemonSet %s/%s due to diff: %v\", required.Namespace, required.Name, cmp.Diff(existing, required))\n\t}\n\n\tactual, err := client.DaemonSets(required.Namespace).Update(ctx, existing, metav1.UpdateOptions{})\n\treturn actual, true, err\n}", "func BuildDaemonForFluentd(instance *operatorv1alpha1.AuditLogging) *appsv1.DaemonSet {\n\treqLogger := log.WithValues(\"dameonForFluentd\", \"Entry\", \"instance.Name\", instance.Name)\n\tmetaLabels := LabelsForMetadata(FluentdName)\n\tselectorLabels := LabelsForSelector(FluentdName, instance.Name)\n\tpodLabels := LabelsForPodMetadata(FluentdName, instance.Name)\n\tannotations := annotationsForMetering(FluentdName)\n\tcommonVolumes = BuildCommonVolumes(instance)\n\tfluentdMainContainer.VolumeMounts = BuildCommonVolumeMounts(instance)\n\n\tvar tag, imageRegistry string\n\tif instance.Spec.Fluentd.ImageRegistry != \"\" || instance.Spec.Fluentd.ImageTag != \"\" {\n\t\tif instance.Spec.Fluentd.ImageRegistry != \"\" {\n\t\t\timageRegistry = instance.Spec.Fluentd.ImageRegistry\n\t\t} else {\n\t\t\timageRegistry = defaultImageRegistry\n\t\t}\n\t\tif instance.Spec.Fluentd.ImageTag != \"\" {\n\t\t\ttag = instance.Spec.Fluentd.ImageTag\n\t\t} else {\n\t\t\ttag = defaultFluentdImageTag\n\t\t}\n\t\tfluentdMainContainer.Image = imageRegistry + defaultFluentdImageName + \":\" + tag\n\t}\n\n\tif instance.Spec.Fluentd.PullPolicy != \"\" {\n\t\tswitch instance.Spec.Fluentd.PullPolicy {\n\t\tcase \"Always\":\n\t\t\tfluentdMainContainer.ImagePullPolicy = corev1.PullAlways\n\t\tcase \"PullNever\":\n\t\t\tfluentdMainContainer.ImagePullPolicy = corev1.PullNever\n\t\tcase \"IfNotPresent\":\n\t\t\tfluentdMainContainer.ImagePullPolicy = corev1.PullIfNotPresent\n\t\tdefault:\n\t\t\treqLogger.Info(\"Trying to update PullPolicy\", \"NOT SUPPORTED\", instance.Spec.Fluentd.PullPolicy)\n\t\t}\n\t}\n\n\tdaemon := &appsv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: FluentdDaemonSetName,\n\t\t\tNamespace: InstanceNamespace,\n\t\t\tLabels: metaLabels,\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: selectorLabels,\n\t\t\t},\n\t\t\tUpdateStrategy: appsv1.DaemonSetUpdateStrategy{\n\t\t\t\tType: appsv1.RollingUpdateDaemonSetStrategyType,\n\t\t\t\tRollingUpdate: &appsv1.RollingUpdateDaemonSet{\n\t\t\t\t\tMaxUnavailable: &intstr.IntOrString{\n\t\t\t\t\t\tType: intstr.Int,\n\t\t\t\t\t\tIntVal: 1,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tMinReadySeconds: 5,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t\tAnnotations: annotations,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tServiceAccountName: FluentdDaemonSetName + ServiceAcct,\n\t\t\t\t\tTerminationGracePeriodSeconds: &seconds30,\n\t\t\t\t\t// NodeSelector: {},\n\t\t\t\t\tTolerations: commonTolerations,\n\t\t\t\t\tVolumes: commonVolumes,\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\tfluentdMainContainer,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn daemon\n}", "func (in *IngressDaemonSetList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *MongoDBReplicaSetInfo) DeepCopy() *MongoDBReplicaSetInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBReplicaSetInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ManagedSeedSetSpec) DeepCopy() *ManagedSeedSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ManagedSeedSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func getDaemonSetPatch(ds *appsv1.DaemonSet) ([]byte, error) {\n\tdsBytes, err := json.Marshal(ds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\terr = json.Unmarshal(dsBytes, &raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\n\t// Create a patch of the DaemonSet that replaces spec.template\n\tspec := raw[\"spec\"].(map[string]interface{})\n\ttemplate := spec[\"template\"].(map[string]interface{})\n\tspecCopy[\"template\"] = template\n\ttemplate[\"$patch\"] = \"replace\"\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "func (m *MockRemoteSnapshot) DaemonSets() v1sets.DaemonSetSet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DaemonSets\")\n\tret0, _ := ret[0].(v1sets.DaemonSetSet)\n\treturn ret0\n}", "func (mr *MockLifecycleMockRecorder) GetPodFromDaemonSet(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPodFromDaemonSet\", reflect.TypeOf((*MockLifecycle)(nil).GetPodFromDaemonSet), arg0, arg1)\n}", "func (c *client) WalkDaemonSets(f func(DaemonSet) error) error {\n\tif c.daemonSetStore == nil {\n\t\treturn nil\n\t}\n\tfor _, m := range c.daemonSetStore.List() {\n\t\tds := m.(*apiappsv1.DaemonSet)\n\t\tif err := f(NewDaemonSet(ds)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (m *MockDaemonSetReconciler) ReconcileDaemonSet(obj *v1.DaemonSet) (reconcile.Result, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReconcileDaemonSet\", obj)\n\tret0, _ := ret[0].(reconcile.Result)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (in *ManagedSeed) DeepCopy() *ManagedSeed {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ManagedSeed)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (m *MockDaemonSetFinalizer) ReconcileDaemonSet(obj *v1.DaemonSet) (reconcile.Result, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReconcileDaemonSet\", obj)\n\tret0, _ := ret[0].(reconcile.Result)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (mr *MockDaemonSetReconcilerMockRecorder) ReconcileDaemonSet(obj interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ReconcileDaemonSet\", reflect.TypeOf((*MockDaemonSetReconciler)(nil).ReconcileDaemonSet), obj)\n}", "func ReconcileDaemonSets(ctx context.Context, namedGetters []NamedDaemonSetCreatorGetter, namespace string, client ctrlruntimeclient.Client, objectModifiers ...ObjectModifier) error {\n\tfor _, get := range namedGetters {\n\t\tname, create := get()\n\t\tcreate = DefaultDaemonSet(create)\n\t\tcreateObject := DaemonSetObjectWrapper(create)\n\t\tcreateObject = createWithNamespace(createObject, namespace)\n\t\tcreateObject = createWithName(createObject, name)\n\n\t\tfor _, objectModifier := range objectModifiers {\n\t\t\tcreateObject = objectModifier(createObject)\n\t\t}\n\n\t\tif err := EnsureNamedObject(ctx, types.NamespacedName{Namespace: namespace, Name: name}, createObject, client, &appsv1.DaemonSet{}, false); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to ensure DaemonSet %s/%s: %v\", namespace, name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (k *k8sService) deleteDaemonSet(name string) error {\n\terr := k.client.ExtensionsV1beta1().DaemonSets(defaultNS).Delete(name, nil)\n\tif err == nil {\n\t\tlog.Infof(\"Deleted DaemonSet %v\", name)\n\t} else if errors.IsNotFound(err) {\n\t\tlog.Infof(\"DaemonSet %v not found\", name)\n\t\terr = nil\n\t} else {\n\t\tlog.Errorf(\"Failed to delete DaemonSet %v with error: %v\", name, err)\n\t}\n\treturn err\n}", "func createDaemonSet(client k8sclient.Interface, module *protos.Module) error {\n\tdsConfig := createDaemonSetObject(module)\n\td, err := client.ExtensionsV1beta1().DaemonSets(defaultNS).Create(dsConfig)\n\tif err == nil {\n\t\tlog.Infof(\"Created DaemonSet %+v\", d)\n\t} else if errors.IsAlreadyExists(err) {\n\t\tlog.Infof(\"DaemonSet %+v already exists\", dsConfig)\n\t} else {\n\t\tlog.Errorf(\"Failed to create DaemonSet %+v with error: %v\", dsConfig, err)\n\t}\n\n\treturn err\n}", "func (c *ClientSetClient) ListDaemonSets(namespace string, opts metav1.ListOptions) (*appsv1.DaemonSetList, error) {\n\tctx := context.TODO()\n\treturn c.clientset.AppsV1().DaemonSets(namespace).List(ctx, opts)\n}", "func (in *BcsDaemonsetList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DruidService) DeepCopy() *DruidService {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DruidService)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func UpdateDaemonSet(client *kubernetes.Clientset, namespace string, resource interface{}) error {\n\tdaemonSet := resource.(appsv1.DaemonSet)\n\t_, err := client.AppsV1().DaemonSets(namespace).Update(context.TODO(), &daemonSet, metav1.UpdateOptions{})\n\treturn err\n}", "func CloneRefOfSet(n *Set) *Set {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tout := *n\n\tout.Comments = CloneComments(n.Comments)\n\tout.Exprs = CloneSetExprs(n.Exprs)\n\treturn &out\n}", "func (in *IngressDaemonSetStatus) DeepCopy() *IngressDaemonSetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressDaemonSetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func GetDaemonSetAnnotations(item interface{}) map[string]string {\n\treturn item.(appsv1.DaemonSet).ObjectMeta.Annotations\n}", "func NewMockDaemonSetDeletionReconciler(ctrl *gomock.Controller) *MockDaemonSetDeletionReconciler {\n\tmock := &MockDaemonSetDeletionReconciler{ctrl: ctrl}\n\tmock.recorder = &MockDaemonSetDeletionReconcilerMockRecorder{mock}\n\treturn mock\n}", "func (mr *MockDaemonSetFinalizerMockRecorder) ReconcileDaemonSet(obj interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ReconcileDaemonSet\", reflect.TypeOf((*MockDaemonSetFinalizer)(nil).ReconcileDaemonSet), obj)\n}", "func (in *DiscoveryService) DeepCopy() *DiscoveryService {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DiscoveryService)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func DaemonSetObjectWrapper(create DaemonSetCreator) ObjectCreator {\n\treturn func(existing runtime.Object) (runtime.Object, error) {\n\t\tif existing != nil {\n\t\t\treturn create(existing.(*appsv1.DaemonSet))\n\t\t}\n\t\treturn create(&appsv1.DaemonSet{})\n\t}\n}", "func GetDaemonSetContainers(item interface{}) []corev1.Container {\n\treturn item.(appsv1.DaemonSet).Spec.Template.Spec.Containers\n}", "func (in *PagerdutyRuleset) DeepCopy() *PagerdutyRuleset {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PagerdutyRuleset)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AddAnnotationsToDaemonSet(ctx context.Context, f *framework.Framework, ns *corev1.Namespace, ds *appsv1.DaemonSet, annotations map[string]string) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\tds, err := f.ClientSet.AppsV1().DaemonSets(ns.Name).Get(ctx, ds.Name, metav1.GetOptions{})\n\tcancel()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ds.Spec.Template.ObjectMeta.Annotations == nil {\n\t\tds.Spec.Template.ObjectMeta.Annotations = make(map[string]string)\n\t}\n\n\tfor k, v := range annotations {\n\t\tif val, ok := ds.Spec.Template.ObjectMeta.Annotations[k]; !ok {\n\t\t\tlog.Debugf(\"Adding annotation (%s: '%s') to daemonset (%s)\", k, v, ds.Name)\n\t\t} else if v != val {\n\t\t\tlog.Debugf(\"Replacing annotation (%s: '%s' -> '%s') on daemonset (%s)\", k, v, val, ds.Name)\n\t\t}\n\t\tds.Spec.Template.ObjectMeta.Annotations[k] = v\n\t}\n\n\tresource := &resources.Resources{\n\t\tDaemonset: ds,\n\t}\n\n\tresource.ExpectDaemonsetUpdateSuccessful(ctx, f, ns)\n\treturn nil\n}", "func (in *ServiceAccountRef) DeepCopy() *ServiceAccountRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceAccountRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (dc *daemonsetCollector) Collect(ch chan<- prometheus.Metric) {\n\tdss, err := dc.store.List()\n\tif err != nil {\n\t\tScrapeErrorTotalMetric.With(prometheus.Labels{\"resource\": \"daemonset\"}).Inc()\n\t\tglog.Errorf(\"listing daemonsets failed: %s\", err)\n\t\treturn\n\t}\n\tScrapeErrorTotalMetric.With(prometheus.Labels{\"resource\": \"daemonset\"}).Add(0)\n\n\tResourcesPerScrapeMetric.With(prometheus.Labels{\"resource\": \"daemonset\"}).Observe(float64(len(dss)))\n\tfor _, d := range dss {\n\t\tdc.collectDaemonSet(ch, d)\n\t}\n\n\tglog.V(4).Infof(\"collected %d daemonsets\", len(dss))\n}", "func (c *ClientSetClient) DeleteDaemonSet(daemonset *appsv1.DaemonSet) error {\n\tctx := context.TODO()\n\treturn c.clientset.AppsV1().DaemonSets(daemonset.Namespace).Delete(ctx, daemonset.Name, metav1.DeleteOptions{})\n}", "func (r *DaemonSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\treqNamespace := req.NamespacedName.Namespace\n\tif reqNamespace != KubeNs && reqNamespace != ControllerNs {\n\t\tr.Log.WithValues(\"daemonset\", req.NamespacedName)\n\t\tdaemonsets := &appsv1.DaemonSet{}\n\t\terr := r.Get(context.TODO(), req.NamespacedName, daemonsets)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tif isDaemonSetReady(daemonsets) {\n\t\t\tcontainers := daemonsets.Spec.Template.Spec.Containers\n\t\t\tfor i, c := range containers {\n\t\t\t\tif isImagePresent(c.Image) {\n\t\t\t\t\tvar msg string\n\t\t\t\t\tmsg = fmt.Sprintf(\"Retagging image %s of daemonset: %s\", c.Image, daemonsets.Name)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t\timg, err := images.Process(c.Image)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tmsg = fmt.Sprintf(\"Failed to process image: %s\", img)\n\t\t\t\t\t\tsetupLog.Error(err, msg)\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t\t// update image\n\t\t\t\t\tmsg = fmt.Sprintf(\"Updating image %s of daemonset: %s\", c.Image, daemonsets.Name)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t\tdaemonsets.Spec.Template.Spec.Containers[i].Image = img\n\t\t\t\t\terr = r.Update(context.TODO(), daemonsets)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\t\t\t\t\t}\n\t\t\t\t\tmsg = fmt.Sprintf(\"Updated image: %s -> %s\", c.Image, img)\n\t\t\t\t\tsetupLog.Info(msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn reconcile.Result{}, nil\n}", "func FileDescriptorSet() *descriptor.FileDescriptorSet {\n\t// We just need ONE of the service names to look up the FileDescriptorSet.\n\tret, err := discovery.GetDescriptorSet(\"dm.Deps\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ret\n}", "func FileDescriptorSet() *descriptor.FileDescriptorSet {\n\t// We just need ONE of the service names to look up the FileDescriptorSet.\n\tret, err := discovery.GetDescriptorSet(\"dm.Deps\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ret\n}", "func (dsl *DaemonSetLock) GetDaemonSet(sleep, timeout time.Duration) (*v1.DaemonSet, error) {\n\tvar ds *v1.DaemonSet\n\tvar lastError error\n\terr := wait.PollImmediate(sleep, timeout, func() (bool, error) {\n\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\tdefer cancel()\n\t\tif ds, lastError = dsl.client.AppsV1().DaemonSets(dsl.namespace).Get(ctx, dsl.name, metav1.GetOptions{}); lastError != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Timed out trying to get daemonset %s in namespace %s: %v\", dsl.name, dsl.namespace, lastError)\n\t}\n\treturn ds, nil\n}", "func (m *IoK8sAPIAppsV1RollingUpdateDaemonSet) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateMaxUnavailable(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}", "func CreateDaemonSet(name string) *appsv1.DaemonSet {\n\tmaxUnavailable := intstr.FromInt(1)\n\n\treturn &appsv1.DaemonSet{\n\t\tTypeMeta: genTypeMeta(gvk.DaemonSet),\n\t\tObjectMeta: genObjectMeta(name, true),\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tRevisionHistoryLimit: conversion.PtrInt32(10),\n\t\t\tUpdateStrategy: appsv1.DaemonSetUpdateStrategy{\n\t\t\t\tRollingUpdate: &appsv1.RollingUpdateDaemonSet{\n\t\t\t\t\tMaxUnavailable: &maxUnavailable,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tStatus: appsv1.DaemonSetStatus{\n\t\t\tCurrentNumberScheduled: 1,\n\t\t\tDesiredNumberScheduled: 1,\n\t\t\tNumberAvailable: 1,\n\t\t\tNumberReady: 1,\n\t\t\tUpdatedNumberScheduled: 1,\n\t\t},\n\t}\n}" ]
[ "0.6627356", "0.6272149", "0.5870161", "0.5827506", "0.5707826", "0.5585251", "0.55466366", "0.5517457", "0.5514708", "0.53805035", "0.5360138", "0.53076094", "0.52681077", "0.52662474", "0.52429956", "0.5228576", "0.5196257", "0.5114117", "0.51059514", "0.5100633", "0.5097572", "0.50668573", "0.5036134", "0.50280064", "0.500815", "0.50074816", "0.5006171", "0.49793312", "0.49517384", "0.49291247", "0.48987398", "0.4863596", "0.4843602", "0.48396406", "0.48247042", "0.4811942", "0.47884238", "0.4783528", "0.4746501", "0.4717917", "0.4716214", "0.46790534", "0.46689954", "0.46536586", "0.46497133", "0.46334192", "0.46307993", "0.4608847", "0.45974874", "0.45770502", "0.4574913", "0.45733148", "0.4566157", "0.45660892", "0.45641175", "0.45525426", "0.45523348", "0.45489997", "0.4542885", "0.4529778", "0.45121798", "0.4508171", "0.4505087", "0.44974107", "0.44972962", "0.44946963", "0.44856465", "0.44794098", "0.44789797", "0.44776088", "0.44755578", "0.4471067", "0.44686463", "0.4465012", "0.4458143", "0.44480377", "0.44379845", "0.4432164", "0.44308084", "0.44301456", "0.44108972", "0.4409206", "0.44031465", "0.43983096", "0.43970752", "0.43917096", "0.43841732", "0.43692684", "0.43505362", "0.4319938", "0.4314098", "0.43090177", "0.43089283", "0.4298516", "0.42976078", "0.4287063", "0.4287063", "0.4285671", "0.42848828", "0.4272139" ]
0.8755028
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *EKSPodIdentityWebhook) DeepCopyInto(out *EKSPodIdentityWebhook) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec in.Status.DeepCopyInto(&out.Status) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8215289", "0.81280124", "0.81039286", "0.80862963", "0.8083811", "0.80673146", "0.8064545", "0.8026454", "0.8012046", "0.7996313", "0.799204", "0.79887754", "0.7987097", "0.7986994", "0.7986994", "0.79854053", "0.7975989", "0.7972486", "0.79695636", "0.79695636", "0.79695636", "0.7967528", "0.79624444", "0.7961954", "0.7945754", "0.7945754", "0.7944541", "0.79428566", "0.7942668", "0.7942668", "0.7940451", "0.793851", "0.7936731", "0.79294837", "0.79252166", "0.7915377", "0.7911627", "0.7911138", "0.7909384", "0.790913", "0.7908773", "0.7905649", "0.79050326", "0.7904594", "0.7904594", "0.7904235", "0.79036915", "0.79020816", "0.78988886", "0.78977424", "0.7891376", "0.7891024", "0.7889831", "0.78890276", "0.7887135", "0.788637", "0.7885264", "0.7885264", "0.7884786", "0.7880785", "0.78745943", "0.78745943", "0.78745407", "0.78734446", "0.78724426", "0.78713626", "0.78713554", "0.78652424", "0.7863321", "0.7863321", "0.7863321", "0.7863293", "0.7862628", "0.7860664", "0.7858556", "0.785785", "0.78571486", "0.7851332", "0.78453225", "0.78448987", "0.78415996", "0.7837483", "0.7837037", "0.7836443", "0.78351796", "0.78329664", "0.7831094", "0.7829445", "0.7826582", "0.7824499", "0.78242797", "0.78227437", "0.78192484", "0.7818843", "0.78128535", "0.7812535", "0.78111476", "0.78111106", "0.781107", "0.78093034", "0.7808775" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EKSPodIdentityWebhook.
func (in *EKSPodIdentityWebhook) DeepCopy() *EKSPodIdentityWebhook { if in == nil { return nil } out := new(EKSPodIdentityWebhook) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EKSPodIdentityWebhookList) DeepCopy() *EKSPodIdentityWebhookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookSpec) DeepCopy() *EKSPodIdentityWebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookStatus) DeepCopy() *EKSPodIdentityWebhookStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationWebhook) DeepCopy() *AuthenticationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhook) DeepCopy() *RolloutWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhook) DeepCopy() *GitHubWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhookPayload) DeepCopy() *RolloutWebhookPayload {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhookPayload)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *WebhookAuth) DeepCopy() *WebhookAuth {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookAuth)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthorizationWebhook) DeepCopy() *AuthorizationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthorizationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Identity) WebHook() Hook {\n\treturn Hook{\n\t\tavatarURL: c.AvatarURL,\n\t\tusername: c.Username,\n\t\twebHookURL: c.WebHookURL,\n\t}\n}", "func NewWebhook(db *sqlx.DB) *Webhook {\n\treturn &Webhook{db: db}\n}", "func (in *WebhookClient) DeepCopy() *WebhookClient {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookClient)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (d *azure) HandleWebhook(c *gin.Context) {\n\tlog.Debug(\"Got azure webhook event\")\n\n\tpayload := webhookPayload{}\n\n\tif err := c.BindJSON(&payload); err != nil {\n\t\tlog.WithError(err).Error(\"Failed to bind payload JSON to expected structure\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tvar s []string = strings.Split(payload.Target.Repository, \"/\")\n\tpayload.Target.Name = strings.Join(s[1:len(s)], \"\")\n\n\tif payload.Action != \"push\" {\n\t\tlog.Debug(fmt.Sprintf(\"Skip event %s\", payload.Action))\n\t\treturn\n\t}\n\n\tevent := hermes.NewNormalizedEvent()\n\teventURI := constructEventURI(&payload, c.Query(\"account\"))\n\tpayloadJSON, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to covert webhook payload structure to JSON\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\t// keep original JSON\n\tevent.Original = string(payloadJSON)\n\n\t// get image push details\n\tevent.Variables[\"event\"] = payload.Action\n\tns := strings.Split(payload.Request.Host, \".\")\n\tevent.Variables[\"namespace\"] = ns[0]\n\tevent.Variables[\"name\"] = payload.Target.Repository\n\tevent.Variables[\"tag\"] = payload.Target.Tag\n\tevent.Variables[\"type\"] = \"registry\"\n\tevent.Variables[\"provider\"] = \"azure\"\n\tevent.Variables[\"pushed_at\"] = payload.Timestamp\n\n\t// get secret from URL query\n\tevent.Secret = c.Query(\"secret\")\n\n\tlog.Debug(\"Event url \" + eventURI)\n\n\t// invoke trigger\n\terr = d.hermesSvc.TriggerEvent(eventURI, event)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to trigger event pipelines\")\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.Status(http.StatusOK)\n}", "func WebhookHandler(w http.ResponseWriter, r *http.Request, reconciler gitopsconfig.Reconciler) {\n\tlog.Info(\"received webhook call\")\n\tif r.Method != \"POST\" {\n\t\tlog.Info(\"webhook handler only accepts the POST method\", \"sent_method\", r.Method)\n\t\tw.WriteHeader(405)\n\t\treturn\n\t}\n\n\tpayload, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Error(err, \"error reading webhook request body\")\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\twebHookEvent, err := github.ParseWebHook(github.WebHookType(r), payload)\n\tif err != nil {\n\t\tlog.Error(err, \"error parsing webhook event payload\")\n\t\treturn\n\t}\n\n\tswitch e := webHookEvent.(type) {\n\tcase *github.PushEvent:\n\t\t// A commit push was received, determine if there is are GitOpsConfigs that match the event\n\t\t// The repository url and Git ref must match for the templateSource or parameterSource\n\t\t{\n\t\t\tlist, err := reconciler.GetAll()\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"error getting the list of GitOpsConfigs\")\n\t\t\t\tw.WriteHeader(500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttargetList := gitopsv1alpha1.GitOpsConfigList{\n\t\t\t\tTypeMeta: list.TypeMeta,\n\t\t\t\tListMeta: list.ListMeta,\n\t\t\t\tItems: make([]gitopsv1alpha1.GitOpsConfig, 0, len(list.Items)),\n\t\t\t}\n\n\t\t\tfor _, instance := range list.Items {\n\t\t\t\tif !gitopsconfig.ContainsTrigger(&instance, \"Webhook\") {\n\t\t\t\t\tlog.Info(\"skip instance without webhook trigger\", \"instance_name\", instance.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tlog.Info(\"comparing instance and event metadata\", \"event_name\", e.Repo.GetFullName(), \"event_ref\", e.GetRef(),\n\t\t\t\t\t\"template_uri\", instance.Spec.TemplateSource.URI, \"template_ref\", instance.Spec.TemplateSource.Ref,\n\t\t\t\t\t\"parameter_uri\", instance.Spec.ParameterSource.URI, \"parameter_ref\", instance.Spec.ParameterSource.Ref)\n\n\t\t\t\tif !repoURLAndRefMatch(&instance, e) {\n\t\t\t\t\tlog.Info(\"skip instance without matching repo url or git ref of the event\", \"instance_name\", instance.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tlog.Info(\"found matching instance\", \"instance_name\", instance.Name)\n\t\t\t\ttargetList.Items = append(targetList.Items, instance)\n\t\t\t}\n\n\t\t\tif len(targetList.Items) == 0 {\n\t\t\t\tlog.Info(\"no gitopsconfigs match the webhook event\", \"event_repo\", e.Repo.GetFullName(), \"event_ref\", strings.TrimPrefix(e.GetRef(), \"refs/heads/\"))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor _, instance := range targetList.Items {\n\t\t\t\t//if secured discard those that do not validate\n\t\t\t\tsecret := getWebhookSecret(&instance)\n\t\t\t\tif secret != \"\" {\n\t\t\t\t\t_, err := github.ValidatePayload(r, []byte(secret))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err, \"webhook payload could not be validated with instance secret --> ignoring\", \"instance\", instance.GetName(), \"namespace\", instance.GetNamespace())\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Webhook triggering job\", \"instance\", instance.GetName(), \"namespace\", instance.GetNamespace())\n\t\t\t\t_, err := reconciler.CreateJob(\"create\", &instance)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err, \"Webhook unable to create job for instance\", \"instance\", instance.GetName(), \"namespace\", instance.GetNamespace())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t{\n\t\t\tlog.Info(\"unknown event type\", \"type\", github.WebHookType(r))\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Info(\"webhook handling concluded correctly\")\n}", "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *ApiService) CreateWebhook(ServiceSid string, params *CreateWebhookParams) (*VerifyV2Webhook, error) {\n\tpath := \"/v2/Services/{ServiceSid}/Webhooks\"\n\tpath = strings.Replace(path, \"{\"+\"ServiceSid\"+\"}\", ServiceSid, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.FriendlyName != nil {\n\t\tdata.Set(\"FriendlyName\", *params.FriendlyName)\n\t}\n\tif params != nil && params.EventTypes != nil {\n\t\tfor _, item := range *params.EventTypes {\n\t\t\tdata.Add(\"EventTypes\", item)\n\t\t}\n\t}\n\tif params != nil && params.WebhookUrl != nil {\n\t\tdata.Set(\"WebhookUrl\", *params.WebhookUrl)\n\t}\n\tif params != nil && params.Status != nil {\n\t\tdata.Set(\"Status\", *params.Status)\n\t}\n\tif params != nil && params.Version != nil {\n\t\tdata.Set(\"Version\", *params.Version)\n\t}\n\n\tresp, err := c.requestHandler.Post(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tps := &VerifyV2Webhook{}\n\tif err := json.NewDecoder(resp.Body).Decode(ps); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, err\n}", "func (in *GitHubWebhookList) DeepCopy() *GitHubWebhookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhook(ops ...ConfigOption) (*Webhook, error) {\n\tconf := toConfig(ops...)\n\ttemplater, err := templates.NewTemplater(conf.templateName, conf.sidecarConfig, conf.sidecarTemplate)\n\tif err != nil {\n\t\topenlogging.Error(fmt.Sprintf(\"new templater failed: error = %v, template = %s\", err.Error(), conf.templateName))\n\t\treturn nil, err\n\t}\n\n\treturn &Webhook{\n\t\tserver: &http.Server{\n\t\t\tAddr: fmt.Sprintf(\":%d\", conf.port),\n\t\t\tTLSConfig: &tls.Config{GetCertificate: conf.getCertificate},\n\t\t},\n\t\tconfig: conf,\n\t\ttemplater: templater,\n\t}, nil\n}", "func (e *UserJoinedConversation) Copy() eventlog.Payload {\n\tcp := *e\n\treturn &cp\n}", "func NewWebhook() *NamespaceWebhook {\n\tscheme := runtime.NewScheme()\n\terr := admissionv1.AddToScheme(scheme)\n\tif err != nil {\n\t\tlog.Error(err, \"Fail adding admissionsv1 scheme to NamespaceWebhook\")\n\t\tos.Exit(1)\n\t}\n\n\terr = corev1.AddToScheme(scheme)\n\tif err != nil {\n\t\tlog.Error(err, \"Fail adding corev1 scheme to NamespaceWebhook\")\n\t\tos.Exit(1)\n\t}\n\n\treturn &NamespaceWebhook{\n\t\ts: *scheme,\n\t}\n}", "func (o *GetFleetsFleetIDMembersInternalServerError) SetPayload(payload *models.GetFleetsFleetIDMembersInternalServerErrorBody) {\n\to.Payload = payload\n}", "func (t *TauAPI) CreateWebhook(webhook Webhook) (ID int64, error error) {\n\tjsonPostMsg, _ := json.Marshal(webhook)\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 2,\n\t\tMethod: \"POST\",\n\t\tPath: \"webhooks/webhooks\",\n\t\tNeedsAuth: true,\n\t\tPostMsg: jsonPostMsg,\n\t})\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\tif string(jsonData) == \"[\\\"Limit reached\\\"]\" {\n\t\treturn 0, fmt.Errorf(\"Limit of webhooks reached (5)\")\n\t}\n\tvar d struct {\n\t\tID int64 `json:\"id\"`\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn 0, fmt.Errorf(\"CreateWebhook -> unmarshal jsonData %v\", err)\n\t}\n\treturn d.ID, nil\n}", "func New(clientSecret string) Webhook {\n\treturn &webhook{\n\t\tsecret: clientSecret,\n\t\tevents: make(map[Event]Handler),\n\t}\n}", "func New() (*WebhookHandler, error) {\n\tconf, err := NewConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewWithConfig(conf)\n}", "func (c *EcomClient) CreateWebhook(ctx context.Context, p *CreateWebhookRequest) (*WebhookResponse, error) {\n\trequest, err := json.Marshal(&p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: client: json marshal\", err)\n\t}\n\n\turl := c.endpoint + \"/webhooks\"\n\tbody := strings.NewReader(string(request))\n\tres, err := c.request(http.MethodPost, url, body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: request\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode >= 400 {\n\t\tvar e badRequestResponse\n\t\tdec := json.NewDecoder(res.Body)\n\t\tdec.DisallowUnknownFields()\n\t\tif err := dec.Decode(&e); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: client decode\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"status: %d, code: %s, message: %s\", e.Status, e.Code, e.Message)\n\t}\n\n\tvar webhook WebhookResponse\n\tif err = json.NewDecoder(res.Body).Decode(&webhook); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: decode\", err)\n\t}\n\treturn &webhook, nil\n}", "func New(\n\tctx context.Context,\n\tcontrollers []interface{},\n) (webhook *Webhook, err error) {\n\n\t// ServeMux.Handle panics on duplicate paths\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"error creating webhook %v\", r)\n\t\t}\n\t}()\n\n\topts := GetOptions(ctx)\n\tif opts == nil {\n\t\treturn nil, errors.New(\"context must have Options specified\")\n\t}\n\tlogger := logging.FromContext(ctx)\n\n\tif opts.StatsReporter == nil {\n\t\treporter, err := NewStatsReporter()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topts.StatsReporter = reporter\n\t}\n\n\tdefaultTLSMinVersion := uint16(tls.VersionTLS13)\n\tif opts.TLSMinVersion == 0 {\n\t\topts.TLSMinVersion = TLSMinVersionFromEnv(defaultTLSMinVersion)\n\t} else if opts.TLSMinVersion != tls.VersionTLS12 && opts.TLSMinVersion != tls.VersionTLS13 {\n\t\treturn nil, fmt.Errorf(\"unsupported TLS version: %d\", opts.TLSMinVersion)\n\t}\n\n\tsyncCtx, cancel := context.WithCancel(context.Background())\n\n\twebhook = &Webhook{\n\t\tOptions: *opts,\n\t\tLogger: logger,\n\t\tsynced: cancel,\n\t}\n\n\tif opts.SecretName != \"\" {\n\t\t// Injection is too aggressive for this case because by simply linking this\n\t\t// library we force consumers to have secret access. If we require that one\n\t\t// of the admission controllers' informers *also* require the secret\n\t\t// informer, then we can fetch the shared informer factory here and produce\n\t\t// a new secret informer from it.\n\t\tsecretInformer := kubeinformerfactory.Get(ctx).Core().V1().Secrets()\n\n\t\twebhook.tlsConfig = &tls.Config{\n\t\t\tMinVersion: opts.TLSMinVersion,\n\n\t\t\t// If we return (nil, error) the client sees - 'tls: internal error\"\n\t\t\t// If we return (nil, nil) the client sees - 'tls: no certificates configured'\n\t\t\t//\n\t\t\t// We'll return (nil, nil) when we don't find a certificate\n\t\t\tGetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) {\n\t\t\t\tsecret, err := secretInformer.Lister().Secrets(system.Namespace()).Get(opts.SecretName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorw(\"failed to fetch secret\", zap.Error(err))\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\twebOpts := GetOptions(ctx)\n\t\t\t\tsKey, sCert := getSecretDataKeyNamesOrDefault(webOpts.ServerPrivateKeyName, webOpts.ServerCertificateName)\n\t\t\t\tserverKey, ok := secret.Data[sKey]\n\t\t\t\tif !ok {\n\t\t\t\t\tlogger.Warn(\"server key missing\")\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\tserverCert, ok := secret.Data[sCert]\n\t\t\t\tif !ok {\n\t\t\t\t\tlogger.Warn(\"server cert missing\")\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\tcert, err := tls.X509KeyPair(serverCert, serverKey)\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 &cert, nil\n\t\t\t},\n\t\t}\n\t}\n\n\twebhook.mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Error(w, fmt.Sprint(\"no controller registered for: \", html.EscapeString(r.URL.Path)), http.StatusBadRequest)\n\t})\n\n\tfor _, controller := range controllers {\n\t\tswitch c := controller.(type) {\n\t\tcase AdmissionController:\n\t\t\thandler := admissionHandler(logger, opts.StatsReporter, c, syncCtx.Done())\n\t\t\twebhook.mux.Handle(c.Path(), handler)\n\n\t\tcase ConversionController:\n\t\t\thandler := conversionHandler(logger, opts.StatsReporter, c)\n\t\t\twebhook.mux.Handle(c.Path(), handler)\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown webhook controller type: %T\", controller)\n\t\t}\n\t}\n\n\treturn\n}", "func (o *ItemImportRequestOptions) SetWebhook(v string) {\n\to.Webhook = &v\n}", "func (target *WebhookTarget) ID() event.TargetID {\n\treturn target.id\n}", "func (s *WebhooksServiceOp) Create(webhook Webhook, options ...interface{}) (Webhook, error) {\n\tvar webhookResponse GetWebhookResponse\n\tjsonBody, err := json.Marshal(webhook)\n\tif err != nil {\n\t\treturn webhookResponse.Data, err\n\t}\n\treqBody := bytes.NewReader(jsonBody)\n\tbody, reqErr := s.client.DoRequest(http.MethodPost, \"/v3/hooks\", reqBody)\n\tif reqErr != nil {\n\t\treturn webhookResponse.Data, reqErr\n\t}\n\n\tjsonErr := json.Unmarshal(body, &webhookResponse)\n\tif jsonErr != nil {\n\t\treturn webhookResponse.Data, jsonErr\n\t}\n\n\treturn webhookResponse.Data, nil\n}", "func (in *ExecHook) DeepCopy() *ExecHook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExecHook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (wh *Webhook) Create(accountId string, data map[string]interface{}, extraHeaders map[string]string) (map[string]interface{}, error) {\n\tif accountId != \"\" {\n\t\turl := fmt.Sprintf(\"/%s%s/%s%s\", constants.VERSION_V2, constants.ACCOUNT_URL, url.PathEscape(accountId), constants.WEBHOOK)\n\t\treturn wh.Request.Post(url, data, extraHeaders)\n\t}\n\turl := fmt.Sprintf(\"/%s%s\", constants.VERSION_V1, constants.WEBHOOK)\n\treturn wh.Request.Post(url, data, extraHeaders)\n}", "func (o *GetFleetsFleetIDMembersOK) SetPayload(payload models.GetFleetsFleetIDMembersOKBody) {\n\to.Payload = payload\n}", "func (o *ProjectWebhook) Clone() datamodel.Model {\n\tc := new(ProjectWebhook)\n\tc.FromMap(o.ToMap())\n\treturn c\n}", "func NewWebhook(token string) *Webhook {\n\treturn &Webhook{\n\t\tToken: token,\n\t}\n}", "func NewWebhook(client kubernetes.Interface, resources *WebhookResources, controllerNamespace string, noInitContainer bool) (*Webhook, error) {\n\tvar (\n\t\tscheme = runtime.NewScheme()\n\t\tcodecs = serializer.NewCodecFactory(scheme)\n\t)\n\n\treturn &Webhook{\n\t\tdeserializer: codecs.UniversalDeserializer(),\n\t\tcontrollerNamespace: controllerNamespace,\n\t\tresources: resources,\n\t\tnoInitContainer: noInitContainer,\n\t}, nil\n}", "func (in *ExecRestoreHook) DeepCopy() *ExecRestoreHook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExecRestoreHook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Client) Webhook(id int) (*Webhook, error) {\n\tvar res Webhook\n\terr := c.get(c.baseURL+fmt.Sprintf(\"/webhooks/%d\", id), &res)\n\n\treturn &res, err\n}", "func (o *PostRolesRoleIDUsersUserIDInternalServerError) SetPayload(payload *PostRolesRoleIDUsersUserIDInternalServerErrorBody) {\n\to.Payload = payload\n}", "func (in *InitRestoreHook) DeepCopy() *InitRestoreHook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InitRestoreHook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *GetEventsEventIDInternalServerError) SetPayload(payload *GetEventsEventIDInternalServerErrorBody) {\n\to.Payload = payload\n}", "func CreateWebhook(user string, repo string, accesstoken string, webhookUrl string, secret string) (int, error) {\n\tdata := user + \":\" + accesstoken\n\tsEnc := base64.StdEncoding.EncodeToString([]byte(data))\n\tname := \"web\"\n\tactive := true\n\thook := github.Hook{\n\t\tName: &name,\n\t\tActive: &active,\n\t\tConfig: make(map[string]interface{}),\n\t\tEvents: []string{\"push\"},\n\t}\n\n\thook.Config[\"url\"] = webhookUrl\n\thook.Config[\"content_type\"] = \"json\"\n\thook.Config[\"secret\"] = secret\n\thook.Config[\"insecure_ssl\"] = \"1\"\n\n\tlogrus.Infof(\"hook to create:%v\", hook)\n\tb := new(bytes.Buffer)\n\tjson.NewEncoder(b).Encode(hook)\n\thc := http.Client{}\n\tAPIURL := fmt.Sprintf(\"https://api.github.com/repos/%v/%v/hooks\", user, repo)\n\treq, err := http.NewRequest(\"POST\", APIURL, b)\n\n\treq.Header.Add(\"Authorization\", \"Basic \"+sEnc)\n\n\tresp, err := hc.Do(req)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\trespData, err := ioutil.ReadAll(resp.Body)\n\tlogrus.Infof(\"respData:%v\", string(respData))\n\tif resp.StatusCode > 399 {\n\t\treturn -1, errors.New(string(respData))\n\t}\n\terr = json.Unmarshal(respData, &hook)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn hook.GetID(), err\n}", "func (in *WebhookConfig) DeepCopy() *WebhookConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhook(timeout time.Duration) filters.Spec {\n\treturn WebhookWithOptions(WebhookOptions{Timeout: timeout, Tracer: opentracing.NoopTracer{}})\n}", "func New(config *Config) *Webhook {\n\treturn &Webhook{\n\t\tprovider: webhooks.Gogs,\n\t\tsecret: config.Secret,\n\t\teventFuncs: map[Event]webhooks.ProcessPayloadFunc{},\n\t}\n}", "func NewPostWebhook(branchesToIgnore string, committersToIgnore string, enabled bool, id int32, title string, url string) *PostWebhook {\n\tthis := PostWebhook{}\n\tthis.BranchesToIgnore = branchesToIgnore\n\tthis.CommittersToIgnore = committersToIgnore\n\tthis.Enabled = enabled\n\tthis.Id = id\n\tthis.Title = title\n\tthis.Url = url\n\treturn &this\n}", "func (h *Handler) WebhookHandler(w http.ResponseWriter, r *http.Request) {\n\tevents, err := h.client.ParseRequest(r)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\tfor _, event := range events {\n\t\tif event.Type != linebot.EventTypeMessage {\n\t\t\treturn\n\t\t}\n\n\t\tswitch message := event.Message.(type) {\n\t\tcase *linebot.TextMessage:\n\t\t\th.replyMessageExec(event, message)\n\n\t\tcase *linebot.StickerMessage:\n\t\t\treplyMessage := fmt.Sprintf(\n\t\t\t\t\"sticker id is %s, stickerResourceType is ...\", message.StickerID)\n\t\t\tif _, err := h.client.ReplyMessage(event.ReplyToken, linebot.NewTextMessage(replyMessage)).Do(); err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func webhookKey(context context.Context, handler string) *datastore.Key {\n\treturn datastore.NewKey(context, \"Webhook\", handler, 0, nil)\n}", "func (c *Context) HandleWebhook(w http.ResponseWriter, r *http.Request) {\n\trequestID := l.GenerateContextID()\n\tlogger := &l.Logger{Context: map[string]interface{}{\n\t\t\"request_id\": requestID,\n\t}}\n\tlog := logger.StartLog()\n\tdefer log.Write()\n\n\tlog[\"request_url\"] = r.URL.String()\n\tlog[\"request_path\"] = r.URL.Path\n\tlog[\"request_header\"] = r.Header\n\n\twebhookID := GetRequestWebhookID(r)\n\tif len(webhookID) == 0 {\n\t\tlog[\"error\"] = \"couldn't identify webhook ID from URL\"\n\t\thttp.Error(w, requestID, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlog[\"webhook_id\"] = webhookID\n\twebhookSecret, err := c.WebhookSecret.SecretForWebhookID(webhookID)\n\tif err != nil {\n\t\tlog[\"error\"] = serr.ContextualizeErrorf(err, \"fetching webhook secret\")\n\t\thttp.Error(w, requestID, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tpayload, err := github.ValidatePayload(r, []byte(webhookSecret.Secret))\n\tif err != nil {\n\t\tlog[\"error\"] = serr.ContextualizeErrorf(err, \"validating webhook request\")\n\t\thttp.Error(w, requestID, http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tevent, err := github.ParseWebHook(github.WebHookType(r), payload)\n\tif err != nil {\n\t\tlog[\"request_body\"] = string(payload)\n\t\tlog[\"error\"] = serr.ContextualizeErrorf(err, \"parsing webhook request\")\n\t\thttp.Error(w, requestID, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tswitch event := event.(type) {\n\tcase *github.PushEvent:\n\t\tlog[\"push_event\"] = event\n\tcase *github.PullRequestEvent:\n\t\tlog[\"pull_event\"] = event\n\n\t\t// Handle the event asynchronously.\n\t\tgo c.HandlePullEvent(webhookSecret, event, requestID, logger)\n\tdefault:\n\t\tlog[\"body\"] = string(payload)\n\t\tlog[\"other_event\"] = true\n\t}\n}", "func (in *EKSPodIdentityWebhookStatus) DeepCopyInto(out *EKSPodIdentityWebhookStatus) {\n\t*out = *in\n\tif in.PodIdentityWebhookSecret != nil {\n\t\tin, out := &in.PodIdentityWebhookSecret, &out.PodIdentityWebhookSecret\n\t\t*out = new(SecretRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookService != nil {\n\t\tin, out := &in.PodIdentityWebhookService, &out.PodIdentityWebhookService\n\t\t*out = new(ServiceRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookDaemonset != nil {\n\t\tin, out := &in.PodIdentityWebhookDaemonset, &out.PodIdentityWebhookDaemonset\n\t\t*out = new(DaemonsetRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookConfiguration != nil {\n\t\tin, out := &in.PodIdentityWebhookConfiguration, &out.PodIdentityWebhookConfiguration\n\t\t*out = new(MutatingWebhookConfigurationRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookServiceAccount != nil {\n\t\tin, out := &in.PodIdentityWebhookServiceAccount, &out.PodIdentityWebhookServiceAccount\n\t\t*out = new(ServiceAccountRef)\n\t\t**out = **in\n\t}\n}", "func NewWebhookHandler(e *echo.Echo, u webhook.WebhooksUsecase) {\n\thandler := &WebhookHandler{\n\t\tWebhoolUsecase: u,\n\t}\n\te.POST(\"/webhoooks\", handler.CreateWebhooks)\n\te.DELETE(\"/webhoooks/:id\", handler.DeleteWebhooks)\n}", "func (in *EKSPodIdentityWebhook) DeepCopyInto(out *EKSPodIdentityWebhook) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tout.Spec = in.Spec\n\tin.Status.DeepCopyInto(&out.Status)\n}", "func (o *PostReposOwnerRepoKeysCreated) SetPayload(payload *models.UserKeysKeyID) {\n\to.Payload = payload\n}", "func Webhook(u *url.URL, h http.Header, req *stripe.Event) (int, http.Header, interface{}, error) {\n\t// if we dont support the handler, just return success so they dont try again.\n\thandler, err := payment.GetHandler(req.Type)\n\tif err != nil {\n\t\treturn response.NewDefaultOK()\n\t}\n\n\t// get the event from stripe api again since they dont provide a way to\n\t// authenticate incoming requests\n\tevent, err := event.Get(req.ID, nil)\n\tif err != nil {\n\t\treturn response.NewBadRequest(err)\n\t}\n\n\tif err := handler(event.Data.Raw); err != nil {\n\t\treturn response.NewBadRequest(err)\n\t}\n\n\treturn response.NewDefaultOK()\n}", "func NewWebhook(ctx *pulumi.Context,\n\tname string, args *WebhookArgs, opts ...pulumi.ResourceOption) (*Webhook, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Name == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Name'\")\n\t}\n\tif args.Url == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Url'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Webhook\n\terr := ctx.RegisterResource(\"datadog:index/webhook:Webhook\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func New(mgr manager.Manager, args Args) (*Webhook, error) {\n\tlogger := log.Log.WithName(args.Name).WithValues(\"provider\", args.Provider)\n\n\t// Create handler\n\tbuilder := NewBuilder(mgr, logger)\n\n\tfor val, objs := range args.Validators {\n\t\tbuilder.WithValidator(val, objs...)\n\t}\n\n\tfor mut, objs := range args.Mutators {\n\t\tbuilder.WithMutator(mut, objs...)\n\t}\n\n\tbuilder.WithPredicates(args.Predicates...)\n\n\thandler, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create webhook\n\tlogger.Info(\"Creating webhook\")\n\n\treturn &Webhook{\n\t\tPath: args.Path,\n\t\tWebhook: &admission.Webhook{Handler: handler},\n\t}, nil\n}", "func (in *AdmissionWebhookConfigurationList) DeepCopy() *AdmissionWebhookConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebHook(\n\tsessionWorks repository.Session,\n\tconnectionsSupervisor Connections,\n\tauthorizer Authorizer,\n\twebhookURL string,\n\tmsgRepo repository.Message,\n\tclient httpInfra.Client,\n\tinterruptChan chan os.Signal,\n) *WebHook {\n\treturn &WebHook{\n\t\tsessionRepo: sessionWorks,\n\t\tconnectionsSupervisor: connectionsSupervisor,\n\t\tauth: authorizer,\n\t\twebhookURL: webhookURL,\n\t\tmsgRepo: msgRepo,\n\t\tclient: client,\n\t\tinterruptChan: interruptChan,\n\t}\n}", "func SetWebhook(token string, url string, port int) error {\n\tdata, _ := json.Marshal(webhook{WebHookURL: url})\n\tr, _ := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/personal/webhook\", monobankAPIURL), bytes.NewReader(data))\n\tr.Header.Set(\"X-Token\", token)\n\tr.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := http.Client{}\n\tresp, err := client.Do(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\treturn fmt.Errorf(\"Status code: %d, Resp: %s\", resp.StatusCode, string(body))\n\t}\n\treturn nil\n}", "func (r *DmsService) Webhooks(parent string, message *Message) *DmsWebhooksCall {\n\tc := &DmsWebhooksCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.message = message\n\treturn c\n}", "func (o *PostUserIDF2aOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (a *ManagementApiService) GetWebhook(ctx _context.Context, webhookId int32) apiGetWebhookRequest {\n\treturn apiGetWebhookRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\twebhookId: webhookId,\n\t}\n}", "func (w *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s\", webhooksBasePath)\n\tresource := new(Webhook)\n\terr := w.client.Post(path, webhook, &resource)\n\treturn resource, err\n}", "func (o *GetFleetsFleetIDMembersForbidden) SetPayload(payload *models.GetFleetsFleetIDMembersForbiddenBody) {\n\to.Payload = payload\n}", "func (o *PutTeamsTeamIDMembersUsernameUnprocessableEntity) SetPayload(payload *models.OrganizationAsTeamMember) {\n\to.Payload = payload\n}", "func New(secret string, config WebhookConfig) *Webhook {\n\tif config.L == nil {\n\t\tconfig.L = log.New(ioutil.Discard, \"\", 0)\n\t}\n\tif config.PushCallback == nil {\n\t\tconfig.PushCallback = emptyCallback\n\t}\n\tif config.ReleaseCallback == nil {\n\t\tconfig.ReleaseCallback = emptyCallback\n\t}\n\treturn &Webhook{\n\t\tl: config.L,\n\t\tsecret: secret,\n\t\tpushCallback: config.PushCallback,\n\t\treleaseCallback: config.ReleaseCallback,\n\t}\n}", "func (in *RulerWebhookSink) DeepCopy() *RulerWebhookSink {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RulerWebhookSink)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *ApiService) DeleteWebhook(ServiceSid string, Sid string) error {\n\tpath := \"/v2/Services/{ServiceSid}/Webhooks/{Sid}\"\n\tpath = strings.Replace(path, \"{\"+\"ServiceSid\"+\"}\", ServiceSid, -1)\n\tpath = strings.Replace(path, \"{\"+\"Sid\"+\"}\", Sid, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tresp, err := c.requestHandler.Delete(c.baseURL+path, data, headers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\treturn nil\n}", "func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {\n\twebhooks.DefaultLog.Info(\"Parsing Payload...\")\n\n\tevent := r.Header.Get(\"X-Gogs-Event\")\n\tif len(event) == 0 {\n\t\twebhooks.DefaultLog.Error(\"Missing X-Gogs-Event Header\")\n\t\thttp.Error(w, \"400 Bad Request - Missing X-Gogs-Event Header\", http.StatusBadRequest)\n\t\treturn\n\t}\n\twebhooks.DefaultLog.Debug(fmt.Sprintf(\"X-Gogs-Event:%s\", event))\n\n\tgogsEvent := Event(event)\n\n\tfn, ok := hook.eventFuncs[gogsEvent]\n\t// if no event registered\n\tif !ok {\n\t\twebhooks.DefaultLog.Info(fmt.Sprintf(\"Webhook Event %s not registered, it is recommended to setup only events in gogs that will be registered in the webhook to avoid unnecessary traffic and reduce potential attack vectors.\", event))\n\t\treturn\n\t}\n\n\tpayload, err := ioutil.ReadAll(r.Body)\n\tif err != nil || len(payload) == 0 {\n\t\twebhooks.DefaultLog.Error(\"Issue reading Payload\")\n\t\thttp.Error(w, \"Issue reading Payload\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\twebhooks.DefaultLog.Debug(fmt.Sprintf(\"Payload:%s\", string(payload)))\n\n\t// If we have a Secret set, we should check the MAC\n\tif len(hook.secret) > 0 {\n\t\twebhooks.DefaultLog.Info(\"Checking secret\")\n\t\tsignature := r.Header.Get(\"X-Gogs-Signature\")\n\t\tif len(signature) == 0 {\n\t\t\twebhooks.DefaultLog.Error(\"Missing X-Gogs-Signature required for HMAC verification\")\n\t\t\thttp.Error(w, \"403 Forbidden - Missing X-Gogs-Signature required for HMAC verification\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\twebhooks.DefaultLog.Debug(fmt.Sprintf(\"X-Gogs-Signature:%s\", signature))\n\n\t\tmac := hmac.New(sha256.New, []byte(hook.secret))\n\t\tmac.Write(payload)\n\n\t\texpectedMAC := hex.EncodeToString(mac.Sum(nil))\n\n\t\tif !hmac.Equal([]byte(signature), []byte(expectedMAC)) {\n\t\t\twebhooks.DefaultLog.Debug(string(payload))\n\t\t\thttp.Error(w, \"403 Forbidden - HMAC verification failed\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Make headers available to ProcessPayloadFunc as a webhooks type\n\thd := webhooks.Header(r.Header)\n\n\tswitch gogsEvent {\n\tcase CreateEvent:\n\t\tvar pe client.CreatePayload\n\t\tjson.Unmarshal([]byte(payload), &pe)\n\t\thook.runProcessPayloadFunc(fn, pe, hd)\n\n\tcase ReleaseEvent:\n\t\tvar re client.ReleasePayload\n\t\tjson.Unmarshal([]byte(payload), &re)\n\t\thook.runProcessPayloadFunc(fn, re, hd)\n\n\tcase PushEvent:\n\t\tvar pe client.PushPayload\n\t\tjson.Unmarshal([]byte(payload), &pe)\n\t\thook.runProcessPayloadFunc(fn, pe, hd)\n\n\tcase DeleteEvent:\n\t\tvar de client.DeletePayload\n\t\tjson.Unmarshal([]byte(payload), &de)\n\t\thook.runProcessPayloadFunc(fn, de, hd)\n\n\tcase ForkEvent:\n\t\tvar fe client.ForkPayload\n\t\tjson.Unmarshal([]byte(payload), &fe)\n\t\thook.runProcessPayloadFunc(fn, fe, hd)\n\n\tcase IssuesEvent:\n\t\tvar ie client.IssuesPayload\n\t\tjson.Unmarshal([]byte(payload), &ie)\n\t\thook.runProcessPayloadFunc(fn, ie, hd)\n\n\tcase IssueCommentEvent:\n\t\tvar ice client.IssueCommentPayload\n\t\tjson.Unmarshal([]byte(payload), &ice)\n\t\thook.runProcessPayloadFunc(fn, ice, hd)\n\n\tcase PullRequestEvent:\n\t\tvar pre client.PullRequestPayload\n\t\tjson.Unmarshal([]byte(payload), &pre)\n\t\thook.runProcessPayloadFunc(fn, pre, hd)\n\t}\n}", "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetCharactersCharacterIDLoyaltyPointsInternalServerError) SetPayload(payload *models.GetCharactersCharacterIDLoyaltyPointsInternalServerErrorBody) {\n\to.Payload = payload\n}", "func (in *ExporterWebhookSink) DeepCopy() *ExporterWebhookSink {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExporterWebhookSink)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (target *WebhookTarget) Send(eventData event.Event) (resp *http.Response, err error) {\n\tatomic.AddInt64(&target.activeRequests, 1)\n\tdefer atomic.AddInt64(&target.activeRequests, -1)\n\n\tatomic.AddInt64(&target.totalRequests, 1)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tatomic.AddInt64(&target.failedRequests, 1)\n\t\t}\n\t}()\n\n\tif err = target.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := json.Marshal(eventData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, target.args.Endpoint.String(), bytes.NewReader(data))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Verify if the authToken already contains\n\t// <Key> <Token> like format, if this is\n\t// already present we can blindly use the\n\t// authToken as is instead of adding 'Bearer'\n\ttokens := strings.Fields(target.args.AuthToken)\n\tswitch len(tokens) {\n\tcase 2:\n\t\treq.Header.Set(\"Authorization\", target.args.AuthToken)\n\tcase 1:\n\t\treq.Header.Set(\"Authorization\", \"Bearer \"+target.args.AuthToken)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn target.httpClient.Do(req)\n}", "func (c GitHubWebhookController) PostWebhook(ctx *gin.Context) (err error) {\n\n\t// Switch by Request Header\n\tswitch ctx.Request.Header.Get(\"X-GitHub-Event\") {\n\tcase \"pull_request\":\n\t\tpullRequest := PullRequestEvent{}\n\t\terr = ctx.Bind(&pullRequest)\n\t\tif err != nil {\n\t\t\tc.Logger.Error(err.Error())\n\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\treturn err\n\t\t}\n\t\trequest := domain.GitHubPullRequest{\n\t\t\tOrganization: pullRequest.Repository.Owner.Login,\n\t\t\tRepository: pullRequest.Repository.Name,\n\t\t\tNumber: uint(pullRequest.PullRequest.Number),\n\t\t\tTitle: pullRequest.PullRequest.Title,\n\t\t\tURL: pullRequest.PullRequest.IssueURL,\n\t\t\tSenderUsername: pullRequest.Sender.Login,\n\t\t\tOpenedUsername: pullRequest.PullRequest.User.Login,\n\t\t}\n\n\t\t// Switch by Request Body\n\t\tswitch pullRequest.Action {\n\t\tcase \"opened\", \"reopened\": // user Open/ReOpen PullRequest\n\t\t\tres, err := c.Interactor.OpenPullRequest(request)\n\t\t\tif err != nil {\n\t\t\t\tc.Logger.Error(err.Error())\n\t\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tctx.JSON(http.StatusOK, res)\n\t\tcase \"closed\":\n\t\t\tswitch pullRequest.PullRequest.Merged {\n\t\t\tcase true:\n\t\t\t\tres, err := c.Interactor.MergePullRequest(domain.GitHubPullRequest{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.Logger.Error(err.Error())\n\t\t\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctx.JSON(http.StatusOK, res)\n\t\t\tcase false:\n\t\t\t\tres, err := c.Interactor.ClosePullRequest(request)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.Logger.Error(err.Error())\n\t\t\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctx.JSON(http.StatusOK, res)\n\t\t\t}\n\t\t}\n\n\tcase \"issue_comment\":\n\t\tissue := IssueCommentEvent{}\n\t\terr := ctx.Bind(&issue)\n\t\tif err != nil {\n\t\t\tc.Logger.Error(err.Error())\n\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\treturn err\n\t\t}\n\t\trequest := domain.GitHubPullRequest{\n\t\t\tOrganization: issue.Repository.Owner.Login,\n\t\t\tRepository: issue.Repository.Name,\n\t\t\tNumber: uint(issue.Issue.Number),\n\t\t\tTitle: issue.Issue.Title,\n\t\t\tURL: issue.Issue.URL,\n\t\t\tSenderUsername: issue.Sender.Login,\n\t\t\tOpenedUsername: issue.Issue.User.Login,\n\t\t}\n\n\t\t// Switch by Request Body\n\t\tswitch issue.Action {\n\t\tcase \"created\": // User created Comment in PullRequest\n\t\t\tcommand := trimNewlineChar(issue.Comment.Body)\n\t\t\tif !strings.HasPrefix(command, \"/\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tcommands := strings.Split(strings.TrimLeft(command, \"/\"), \" \")\n\n\t\t\t// Switch by command\n\t\t\tswitch commands[0] {\n\t\t\tcase \"request\":\n\t\t\t\tres, err := c.Interactor.CommentRequest(request)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.Logger.Error(err.Error())\n\t\t\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctx.JSON(http.StatusOK, res)\n\t\t\tcase \"reviewed\":\n\t\t\t\tres, err := c.Interactor.CommentReviewed(request)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.Logger.Error(err.Error())\n\t\t\t\t\tctx.JSON(http.StatusInternalServerError, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tctx.JSON(http.StatusOK, res)\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tc.Logger.Info(fmt.Sprintf(\"X-GitHub-Event: %s: Skiped.\", ctx.Request.Header.Get(\"X-GitHub-Event\")))\n\t\tctx.JSON(http.StatusForbidden, nil)\n\t}\n\treturn nil\n}", "func TestCreateAndUpdateWebhook(t *testing.T) {\n\tc, _ := NewClient(testClientID, testSecret, APIBaseSandBox)\n\tc.GetAccessToken()\n\n\tcreationPayload := &CreateWebhookRequest{\n\t\tURL: \"https://example.com/paypal_webhooks\",\n\t\tEventTypes: []WebhookEventType{\n\t\t\tWebhookEventType{\n\t\t\t\tName: \"PAYMENT.AUTHORIZATION.CREATED\",\n\t\t\t},\n\t\t},\n\t}\n\n\tcreatedWebhook, err := c.CreateWebhook(creationPayload)\n\tif err != nil {\n\t\tt.Errorf(\"Webhook couldn't be created, error %v\", err)\n\t}\n\n\tupdatePayload := []WebhookField{\n\t\tWebhookField{\n\t\t\tOperation: \"replace\",\n\t\t\tPath: \"/event_types\",\n\t\t\tValue: []interface{}{\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"name\": \"PAYMENT.SALE.REFUNDED\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err = c.UpdateWebhook(createdWebhook.ID, updatePayload)\n\tif err != nil {\n\t\tt.Errorf(\"Couldn't update webhook, error %v\", err)\n\t}\n\n\terr = c.DeleteWebhook(createdWebhook.ID)\n\tif err != nil {\n\t\tt.Errorf(\"An error occurred while webhooks deletion, error %v\", err)\n\t}\n}", "func (s *WebhooksServiceOp) Get(id int64, options ...interface{}) (Webhook, error) {\n\tvar webhookResponse GetWebhookResponse\n\tbody, reqErr := s.client.DoRequest(http.MethodGet, fmt.Sprintf(\"/v3/hooks/%d\", id), nil)\n\tif reqErr != nil {\n\t\treturn webhookResponse.Data, reqErr\n\t}\n\tjsonErr := json.Unmarshal(body, &webhookResponse)\n\tif jsonErr != nil {\n\t\treturn webhookResponse.Data, jsonErr\n\t}\n\treturn webhookResponse.Data, nil\n}", "func NewWebHook(accessToken string) *WebHook {\n\tbaseAPI := \"https://oapi.dingtalk.com/robot/send\"\n\treturn &WebHook{accessToken: accessToken, apiUrl: baseAPI}\n}", "func (t *TauAPI) DeleteWebhook(ID int64) error {\n\t_, err := t.doTauRequest(&TauReq{\n\t\tVersion: 2,\n\t\tMethod: \"DELETE\",\n\t\tPath: \"webhooks/webhooks/\" + strconv.FormatInt(ID, 10),\n\t\tNeedsAuth: true,\n\t})\n\treturn err\n}", "func ListenWebhook(a Application) {\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n\t\tw.WriteHeader(200)\n\n\t\tif req.Method == http.MethodGet {\n\t\t\treturn\n\t\t}\n\n\t\tbody, err := ioutil.ReadAll(req.Body)\n\n\t\tlogrus.Infof(\"webhook data: %s\", string(body))\n\n\t\tif err != nil {\n\t\t\tlogrus.Error(err)\n\t\t\treturn\n\t\t}\n\n\t\tevent := webhookEvent{}\n\n\t\terr = json.Unmarshal(body, &event)\n\t\tif err != nil {\n\t\t\tlogrus.Error(err)\n\t\t\treturn\n\t\t}\n\n\t\tif event.Data.StatementItem.Amount > 0 {\n\t\t\treturn\n\t\t}\n\n\t\titem := Item{\n\t\t\tName: event.Data.StatementItem.Description,\n\t\t\tAmount: event.Data.StatementItem.getNormalizedAmount(),\n\t\t\tCategory: event.Data.StatementItem.getCategory(),\n\t\t}\n\n\t\tif item.Name == \"\" {\n\t\t\tif item.Category != \"\" {\n\t\t\t\titem.Name = item.Category\n\t\t\t} else {\n\t\t\t\titem.Name = \"transaction\"\n\t\t\t}\n\t\t}\n\t\tvar account User\n\n\t\tif event.Data.Account == a.Config.MonobankAccount1 {\n\t\t\taccount = User{\n\t\t\t\tID: a.Config.SenderID1,\n\t\t\t\tUsername: a.Config.UserName1,\n\t\t\t}\n\t\t} else if event.Data.Account == a.Config.MonobankAccount2 {\n\t\t\taccount = User{\n\t\t\t\tID: a.Config.SenderID2,\n\t\t\t\tUsername: a.Config.UserName2,\n\t\t\t}\n\t\t} else {\n\t\t\treturn\n\t\t}\n\n\t\ta.IntegrationEvents <- BankData{Item: item, Account: account}\n\t})\n\n\tlogrus.Info(fmt.Sprintf(\"listen webhook on: %d\", a.Config.MonobankPort))\n\terr := http.ListenAndServe(fmt.Sprintf(\":%d\", a.Config.MonobankPort), nil)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t}\n}", "func (o *PostUserIDF2aDefault) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetWebhookID(webhookID string) {\n\to.WebhookID = webhookID\n}", "func (r apiCreateNotificationWebhookRequest) Execute() (NotificationWebhook, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue NotificationWebhook\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"ManagementApiService.CreateNotificationWebhook\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/applications/{applicationId}/notification_webhooks\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"applicationId\"+\"}\", _neturl.QueryEscape(parameterToString(r.applicationId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\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 := 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 = r.body\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 auth, ok := auth[\"Authorization\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\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 auth, ok := auth[\"Authorization\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.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 := r.apiService.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 := r.apiService.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\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 == 201 {\n\t\t\tvar v NotificationWebhook\n\t\t\terr = r.apiService.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 = r.apiService.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}", "func NewWebhook() *prometheusruleWebhook {\n\tscheme := runtime.NewScheme()\n\treturn &prometheusruleWebhook{\n\t\ts: *scheme,\n\t}\n}", "func (bot *Bot) DeleteWebhook() (err error) {\n\t_, resBody, err := bot.client.PostForm(methodDeleteWebhook, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"DeleteWebhook: %w\", err)\n\t}\n\n\tres := &response{}\n\terr = json.Unmarshal(resBody, res)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"DeleteWebhook: %w\", err)\n\t}\n\n\treturn nil\n}", "func New(options ...Option) (*Webhook, error) {\n\thook := new(Webhook)\n\tfor _, opt := range options {\n\t\tif err := opt(hook); err != nil {\n\t\t\treturn nil, errors.New(\"Error applying Option\")\n\t\t}\n\t}\n\treturn hook, nil\n}", "func New(req *http.Request) (hook *Hook, err error) {\n\thook = new(Hook)\n\tif !strings.EqualFold(req.Method, \"POST\") {\n\t\treturn nil, errors.New(\"unknown method\")\n\t}\n\n\tif hook.Signature = req.Header.Get(\"X-ChatWorkWebhookSignature\"); len(hook.Signature) == 0 {\n\t\treturn nil, errors.New(\"no signature\")\n\t}\n\n\thook.RawPayload, err = ioutil.ReadAll(req.Body)\n\treturn\n}", "func (z *Client) CreateWebhook(ctx context.Context, hook *Webhook) (*Webhook, error) {\n\tvar data, result struct {\n\t\tWebhook *Webhook `json:\"webhook\"`\n\t}\n\tdata.Webhook = hook\n\n\tbody, err := z.post(ctx, \"/webhooks\", data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(body, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.Webhook, nil\n}", "func SendWebhook(wh data.WebhookServices, event string, data interface{}) {\n\theaders := make(map[string]string)\n\theaders[\"X-Webhook-Event\"] = event\n\n\tsubscribers, err := wh.AllSubscriptions(event)\n\tif err != nil {\n\t\tlog.Println(\"unable to get webhook subscribers for \", event)\n\t\treturn\n\t}\n\n\tfor _, sub := range subscribers {\n\t\tgo func(sub model.Webhook, headers map[string]string) {\n\t\t\tif err := post(sub.TargetURL, data, nil, headers); err != nil {\n\t\t\t\tlog.Println(\"error calling URL\", sub.TargetURL, err)\n\t\t\t}\n\t\t}(sub, headers)\n\t}\n}", "func (o *GetIdentityIDOK) SetPayload(payload *models.Identity) {\n\to.Payload = payload\n}", "func (s *WebhookServiceOp) Create(ctx context.Context, webhook Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s.json\", webhooksBasePath)\n\twrappedData := WebhookResource{Webhook: &webhook}\n\tresource := new(WebhookResource)\n\terr := s.client.Post(ctx, path, wrappedData, resource)\n\treturn resource.Webhook, err\n}", "func Webhooks(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tlog.Infof(ctx, \"GET /webhooks\")\n\tvar webhooksObj model.WebhooksObj\n\tmakeWebhooksObj(&webhooksObj, r.URL.Query())\n\tlog.Infof(ctx, \"webhooksObj is: %+v\", webhooksObj)\n\n\tgaeMail := makeGaeMailForWebhooks(ctx, &webhooksObj)\n\tgaeMail.Send()\n}", "func (o *UpdateOfficeUserOK) SetPayload(payload *adminmessages.OfficeUser) {\n\to.Payload = payload\n}", "func (s *NamespaceWebhook) Name() string { return WebhookName }", "func (s *ApiService) IPNWebhook(w http.ResponseWriter, r *http.Request) {\n\t// return 200 on success, otherwise nothing (NowPayments will retry)\n\n\t/*\n\tctx := context.Background()\n\n\t// cryptographically validate webhook payload\n\tpayment, err := s.nowPaymentsService.IPNWebhookValidate(r)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to validate IPNWebhook: %+v\", err)\n\t\tprometheus_monitoring.TickNowPaymentsIPNFailed()\n\t\treturn\n\t}\n\n\t// update order in database\n\terr = s.ordersService.IPNUpdateOrder(ctx, *payment)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to update order in IPNWebhook: %+v\", err)\n\t\tprometheus_monitoring.TickNowPaymentsIPNFailed()\n\t\treturn\n\t}\n\t*/\n\n\tfmt.Printf(\"Hit IPN\\n\")\n\tw.WriteHeader(http.StatusOK)\n}", "func (o *GetUserKeysKeyIDOK) SetPayload(payload *models.UserKeysKeyID) {\n\to.Payload = payload\n}", "func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {\n\tconfig := map[string]string{\n\t\t\"url\": w.URL,\n\t\t\"content_type\": w.ContentType.Name(),\n\t}\n\tif w.Type == webhook_module.SLACK {\n\t\ts := GetSlackHook(w)\n\t\tconfig[\"channel\"] = s.Channel\n\t\tconfig[\"username\"] = s.Username\n\t\tconfig[\"icon_url\"] = s.IconURL\n\t\tconfig[\"color\"] = s.Color\n\t}\n\n\tauthorizationHeader, err := w.HeaderAuthorization()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &api.Hook{\n\t\tID: w.ID,\n\t\tType: w.Type,\n\t\tURL: fmt.Sprintf(\"%s/settings/hooks/%d\", repoLink, w.ID),\n\t\tActive: w.IsActive,\n\t\tConfig: config,\n\t\tEvents: w.EventsArray(),\n\t\tAuthorizationHeader: authorizationHeader,\n\t\tUpdated: w.UpdatedUnix.AsTime(),\n\t\tCreated: w.CreatedUnix.AsTime(),\n\t\tBranchFilter: w.BranchFilter,\n\t}, nil\n}", "func (a *ManagementApiService) CreateNotificationWebhook(ctx _context.Context, applicationId int32) apiCreateNotificationWebhookRequest {\n\treturn apiCreateNotificationWebhookRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tapplicationId: applicationId,\n\t}\n}", "func (c *MockWebhookClient) DeleteWebhook(ctx context.Context, repo bitbucket.Repo, id int) (err error) {\n\treturn c.MockDeleteWebhook(ctx, repo, id)\n}" ]
[ "0.7455655", "0.659675", "0.64380205", "0.6092637", "0.5820071", "0.57413214", "0.5714943", "0.5300089", "0.5221228", "0.51092845", "0.5073489", "0.49398625", "0.47650415", "0.4762692", "0.47494987", "0.4719676", "0.4692562", "0.46774372", "0.4602285", "0.45991862", "0.4523041", "0.45201176", "0.45154583", "0.45046526", "0.4504389", "0.45009732", "0.44802937", "0.44532615", "0.44477454", "0.44305605", "0.44221133", "0.44155952", "0.4399466", "0.43860978", "0.43795356", "0.43782413", "0.43716168", "0.43675873", "0.43642506", "0.43563953", "0.43487886", "0.4320623", "0.43203053", "0.43201852", "0.42947358", "0.42928272", "0.42888546", "0.4287272", "0.4286045", "0.42847323", "0.4284063", "0.425768", "0.42433023", "0.42403454", "0.42280838", "0.42243916", "0.42243832", "0.42242506", "0.42190012", "0.41954058", "0.41917786", "0.4191247", "0.4190361", "0.4186248", "0.41856092", "0.41855648", "0.41838747", "0.418224", "0.41809702", "0.416763", "0.41613102", "0.41567555", "0.41560137", "0.414645", "0.41421798", "0.4137136", "0.41299757", "0.41297433", "0.41250443", "0.41140524", "0.411377", "0.4113742", "0.41107538", "0.41063038", "0.40985128", "0.40930483", "0.40926316", "0.4091745", "0.4087421", "0.40865985", "0.40678126", "0.40620825", "0.4061355", "0.40603405", "0.4058296", "0.4056468", "0.40529108", "0.4050866", "0.40494674", "0.40479904" ]
0.8896081
0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *EKSPodIdentityWebhook) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *ConsoleQuickStart) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ServingRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Keevakind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Run) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Pentesting) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Version) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DroidVirt) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleSample) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleQuickStartList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Kernel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AppBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Execution) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PipelineRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Runner) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Terminal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Terminal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleCLIDownload) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CliApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DirectorBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *DiscoveryService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Baremetal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Egeria) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Qliksense) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Idler) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DroidVirtList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RpaasBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Host) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ServingRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RedisEnterprise) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SSLProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleLink) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GitHubBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *MobileSecurityServiceBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DOMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *KeevakindList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DockerBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *RPMCompose) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SecretEngine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VultrMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SpaceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Redpanda) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Ray) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *KeptnCore) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Crd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Sidekick) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Test) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ManagedSeed) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Method) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DirectorBindList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *IdGenerate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FundPool) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FalconContainer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ExecutionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RestQL) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ChaosApi) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RedisGCache) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualDatabase) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AppBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Notary) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *QliksenseList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FusionAppInstance) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *IdGenerateList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataDownload) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Guestbook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleCLIDownloadList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GlobalUser) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PipelineRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Hawtio) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RTCPeerConnection) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CliAppList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualNodeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *EventingBackend) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GitHubBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AtRest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *OpenStackPlaybookGenerator) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *UsersDB2) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Ghost) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DiscoveryServiceCertificate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *WorkflowRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SD) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CrunchyBridgeConnection) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ManagedSeedList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FusionApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Framework) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PyTorchJob) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}" ]
[ "0.7313452", "0.71596146", "0.710827", "0.71008897", "0.7058157", "0.70423585", "0.7039146", "0.7030632", "0.69994885", "0.6974074", "0.6971826", "0.6956056", "0.69528073", "0.69508666", "0.6937996", "0.6936287", "0.6936287", "0.6927997", "0.6925237", "0.6922473", "0.691321", "0.69018435", "0.68970793", "0.68953156", "0.6889778", "0.68884665", "0.68874615", "0.6879511", "0.6877547", "0.68764734", "0.68655354", "0.6861854", "0.6860834", "0.68524367", "0.68518084", "0.6848959", "0.6848959", "0.6848018", "0.6840722", "0.68407166", "0.68383163", "0.68383163", "0.68383163", "0.68383163", "0.68355286", "0.6835036", "0.6831838", "0.6830678", "0.68301433", "0.6829844", "0.6827224", "0.6819231", "0.6816276", "0.6814227", "0.6814133", "0.6807819", "0.68024844", "0.67947155", "0.67907375", "0.6784383", "0.6784256", "0.6784113", "0.6783712", "0.6783374", "0.67830354", "0.6770653", "0.6770257", "0.6768379", "0.6765797", "0.6763702", "0.67573893", "0.67573893", "0.6751337", "0.67481023", "0.67477804", "0.67435074", "0.67410785", "0.67406976", "0.6737413", "0.6736253", "0.6735813", "0.6735117", "0.673461", "0.6734598", "0.6733997", "0.67296046", "0.6729361", "0.67269105", "0.6726003", "0.6722453", "0.67205614", "0.67184865", "0.6716663", "0.6715474", "0.671334", "0.6712881", "0.6711985", "0.67110837", "0.67105305", "0.67102426", "0.670898" ]
0.0
-1
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *EKSPodIdentityWebhookList) DeepCopyInto(out *EKSPodIdentityWebhookList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]EKSPodIdentityWebhook, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8215831", "0.812879", "0.8104949", "0.8086246", "0.8083644", "0.8068615", "0.8064988", "0.8027893", "0.80128986", "0.7996562", "0.79928833", "0.79897606", "0.79880935", "0.7987752", "0.7987752", "0.7986811", "0.7977551", "0.79732406", "0.79701513", "0.79701513", "0.79701513", "0.7968306", "0.79637116", "0.7963065", "0.79463845", "0.79463845", "0.79456735", "0.7943684", "0.7943684", "0.794304", "0.79416597", "0.7938698", "0.7937716", "0.7929953", "0.79263693", "0.7916528", "0.79126227", "0.79123724", "0.7910327", "0.791019", "0.7909672", "0.7906689", "0.7906599", "0.7905296", "0.7905296", "0.79051584", "0.790466", "0.79019094", "0.7899738", "0.78984", "0.7892225", "0.78914297", "0.7891315", "0.7889668", "0.78875935", "0.78875524", "0.7886123", "0.7886123", "0.78860646", "0.78814936", "0.7875633", "0.7875633", "0.78749907", "0.7874529", "0.7873067", "0.7872254", "0.7871928", "0.78660685", "0.7864945", "0.7864945", "0.7864945", "0.7863978", "0.78637886", "0.78619343", "0.7859457", "0.7859223", "0.78576493", "0.78515524", "0.78465164", "0.7845511", "0.78416", "0.7837877", "0.7837727", "0.7837356", "0.7835647", "0.7833818", "0.7831703", "0.7831128", "0.78275645", "0.78263915", "0.78257185", "0.78239715", "0.7820681", "0.78199947", "0.78135055", "0.78123045", "0.7812034", "0.78116155", "0.78115803", "0.7810069", "0.7809976" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EKSPodIdentityWebhookList.
func (in *EKSPodIdentityWebhookList) DeepCopy() *EKSPodIdentityWebhookList { if in == nil { return nil } out := new(EKSPodIdentityWebhookList) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EKSPodIdentityWebhook) DeepCopy() *EKSPodIdentityWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhookList) DeepCopy() *GitHubWebhookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationList) DeepCopy() *AdmissionWebhookConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookStatus) DeepCopy() *EKSPodIdentityWebhookStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *WebhooksServiceOp) List(options ...interface{}) ([]Webhook, error) {\n\twebhookListResponse := ListWebhookResponse{}\n\tbody, reqErr := s.client.DoRequest(http.MethodGet, \"/v3/hooks\", nil)\n\tif reqErr != nil {\n\t\treturn webhookListResponse.Data, reqErr\n\t}\n\tjsonErr := json.Unmarshal(body, &webhookListResponse)\n\tif jsonErr != nil {\n\t\treturn webhookListResponse.Data, jsonErr\n\t}\n\treturn webhookListResponse.Data, nil\n}", "func (c *ApiService) ListWebhook(ServiceSid string, params *ListWebhookParams) ([]VerifyV2Webhook, error) {\n\tresponse, errors := c.StreamWebhook(ServiceSid, params)\n\n\trecords := make([]VerifyV2Webhook, 0)\n\tfor record := range response {\n\t\trecords = append(records, record)\n\t}\n\n\tif err := <-errors; err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn records, nil\n}", "func (in *HookList) DeepCopy() *HookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AuthenticationWebhook) DeepCopy() *AuthenticationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (w Webhook) List(ctx context.Context, listOptions postmand.RepositoryListOptions) ([]*postmand.Webhook, error) {\n\twebhooks := []*postmand.Webhook{}\n\tquery, args := listQuery(\"webhooks\", listOptions)\n\terr := w.db.SelectContext(ctx, &webhooks, query, args...)\n\treturn webhooks, err\n}", "func (in *SensuEventFilterList) DeepCopy() *SensuEventFilterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuEventFilterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Client) ListWebhooks() ([]*Webhook, error) {\n\treturn c.ListWebhooksContext(context.TODO())\n}", "func (s *WebhooksService) ListWebhooks(queryParams *ListWebhooksQueryParams) (*Webhooks, *resty.Response, error) {\n\n\tpath := \"/webhooks/\"\n\n\tqueryParamsString, _ := query.Values(queryParams)\n\n\tresponse, err := s.client.R().\n\t\tSetQueryString(queryParamsString.Encode()).\n\t\tSetResult(&Webhooks{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Webhooks)\n\tif queryParams.Paginate {\n\t\titems := s.webhooksPagination(response.Header().Get(\"Link\"), 0, 0)\n\t\tfor _, webhook := range items.Items {\n\t\t\tresult.AddWebhook(webhook)\n\t\t}\n\t} else {\n\t\tif len(result.Items) < queryParams.Max {\n\t\t\titems := s.webhooksPagination(response.Header().Get(\"Link\"), len(result.Items), queryParams.Max)\n\t\t\tfor _, webhook := range items.Items {\n\t\t\t\tresult.AddWebhook(webhook)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result, response, err\n\n}", "func (w *WebhookServiceOp) List(options interface{}) ([]Webhook, error) {\n\tpath := fmt.Sprintf(\"%s\", webhooksBasePath)\n\tresource := make([]Webhook, 0)\n\terr := w.client.Get(path, &resource, options)\n\treturn resource, err\n}", "func (in *RolloutWebhook) DeepCopy() *RolloutWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewListPayload(id string) *step.ListPayload {\n\tv := &step.ListPayload{}\n\tv.ID = id\n\n\treturn v\n}", "func (c *Client) ListWebhooksContext(ctx context.Context) ([]*Webhook, error) {\n\treq := &api.WebhooksListRequest{}\n\tresp := &api.WebhooksListResponse{}\n\tif err := c.postContext(ctx, \"webhooks/list\", req, resp); err != nil {\n\t\treturn nil, err\n\t}\n\tres := []*Webhook{}\n\tfor _, h := range *resp {\n\t\thook := &Webhook{\n\t\t\tID: h.ID,\n\t\t\tURL: h.URL,\n\t\t\tDescription: h.Description,\n\t\t\tEvents: h.Events,\n\t\t\tAuthKey: h.AuthKey,\n\t\t\tCreatedAt: h.CreatedAt.Time,\n\t\t\tLastSentAt: h.LastSentAt.Time,\n\t\t\tBatchesSent: h.BatchesSent,\n\t\t\tEventsSent: h.EventsSent,\n\t\t\tLastError: h.LastError,\n\t\t}\n\t\tres = append(res, hook)\n\t}\n\treturn res, nil\n}", "func (in *ConsoleNotificationList) DeepCopy() *ConsoleNotificationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleNotificationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhook) DeepCopy() *GitHubWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FusionAppInstanceList) DeepCopy() *FusionAppInstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppInstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *HangoutsChatWebhooksService) List(ctx context.Context) (webhooks []Webhook, err error) {\n\tvar r webhooksResponse\n\terr = s.client.request(ctx, http.MethodGet, \"v1/hangouts-chat-webhooks\", nil, &r)\n\treturn r.Webhooks, err\n}", "func (in *EKSPodIdentityWebhookSpec) DeepCopy() *EKSPodIdentityWebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FirebaseWebAppList) DeepCopy() *FirebaseWebAppList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FirebaseWebAppList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApiKeyList) DeepCopy() *ApiKeyList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApiKeyList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleCLIDownloadList) DeepCopy() *ConsoleCLIDownloadList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleCLIDownloadList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (list ListResponse) GetWebHooks() (*ListOfWebHooks, error) {\n\tif err := list.CanMakeRequest(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoint := fmt.Sprintf(webhooks_path, list.ID)\n\tresponse := new(ListOfWebHooks)\n\n\treturn response, list.api.Request(\"GET\", endpoint, nil, nil, response)\n}", "func (in *IdGenerateList) DeepCopy() *IdGenerateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdGenerateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdlerList) DeepCopy() *IdlerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdlerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhookPayload) DeepCopy() *RolloutWebhookPayload {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhookPayload)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AttachmentList) DeepCopy() *AttachmentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttachmentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MailboxList) DeepCopy() *MailboxList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MailboxList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookClient) DeepCopy() *WebhookClient {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookClient)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MobileSecurityServiceUnbindList) DeepCopy() *MobileSecurityServiceUnbindList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MobileSecurityServiceUnbindList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (webhooks *Webhooks) AddWebhook(item Webhook) []Webhook {\n\twebhooks.Items = append(webhooks.Items, item)\n\treturn webhooks.Items\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WorkflowRunList) DeepCopy() *WorkflowRunList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkflowRunList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationList) DeepCopy() *NotificationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationList) DeepCopy() *NotificationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebServerList) DeepCopy() *WebServerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebServerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WavefrontAlertList) DeepCopy() *WavefrontAlertList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WavefrontAlertList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ClaimsList) Copy() elemental.Identifiables {\n\n\tcopy := append(ClaimsList{}, o...)\n\treturn &copy\n}", "func (in *TriggerList) DeepCopy() *TriggerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TriggerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthorizationWebhook) DeepCopy() *AuthorizationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthorizationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ArgusWatcherList) DeepCopy() *ArgusWatcherList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ArgusWatcherList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FLAppList) DeepCopy() *FLAppList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FLAppList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShadowEndpointSliceList) DeepCopy() *ShadowEndpointSliceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShadowEndpointSliceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookList) DeepCopyInto(out *EKSPodIdentityWebhookList) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ListMeta.DeepCopyInto(&out.ListMeta)\n\tif in.Items != nil {\n\t\tin, out := &in.Items, &out.Items\n\t\t*out = make([]EKSPodIdentityWebhook, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n}", "func GetWebhooks() ([]models.Webhook, error) { //nolint\n\twebhooks := make([]models.Webhook, 0)\n\n\tquery := \"SELECT * FROM webhooks\"\n\n\trows, err := _db.Query(query)\n\tif err != nil {\n\t\treturn webhooks, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar id int\n\t\tvar url string\n\t\tvar events string\n\t\tvar timestampString string\n\t\tvar lastUsedString *string\n\n\t\tif err := rows.Scan(&id, &url, &events, &timestampString, &lastUsedString); err != nil {\n\t\t\tlog.Error(\"There is a problem reading the database.\", err)\n\t\t\treturn webhooks, err\n\t\t}\n\n\t\ttimestamp, err := time.Parse(time.RFC3339, timestampString)\n\t\tif err != nil {\n\t\t\treturn webhooks, err\n\t\t}\n\n\t\tvar lastUsed *time.Time\n\t\tif lastUsedString != nil {\n\t\t\tlastUsedTime, _ := time.Parse(time.RFC3339, *lastUsedString)\n\t\t\tlastUsed = &lastUsedTime\n\t\t}\n\n\t\tsingleWebhook := models.Webhook{\n\t\t\tID: id,\n\t\t\tURL: url,\n\t\t\tEvents: strings.Split(events, \",\"),\n\t\t\tTimestamp: timestamp,\n\t\t\tLastUsed: lastUsed,\n\t\t}\n\n\t\twebhooks = append(webhooks, singleWebhook)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\treturn webhooks, err\n\t}\n\n\treturn webhooks, nil\n}", "func (in *IdentityProviderList) DeepCopy() *IdentityProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FusionAppList) DeepCopy() *FusionAppList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *ItemImportRequestOptions) SetWebhook(v string) {\n\to.Webhook = &v\n}", "func (in *KubeEventsRuleList) DeepCopy() *KubeEventsRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeEventsRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRevocationList) DeepCopy() *CertificateRevocationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRevocationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LabelIdentityList) DeepCopy() *LabelIdentityList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelIdentityList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhook(db *sqlx.DB) *Webhook {\n\treturn &Webhook{db: db}\n}", "func (in *AWSFargateProfileList) DeepCopy() *AWSFargateProfileList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSFargateProfileList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhookList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataUploadList) DeepCopy() *DataUploadList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DataUploadList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MobileSecurityServiceBindList) DeepCopy() *MobileSecurityServiceBindList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MobileSecurityServiceBindList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ImageSignerList) DeepCopy() *ImageSignerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSignerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CiliumEndpointList) DeepCopy() *CiliumEndpointList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CiliumEndpointList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ListedWorkflow) DeepCopy() *ListedWorkflow {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ListedWorkflow)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProxySQLInsightList) DeepCopy() *ProxySQLInsightList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxySQLInsightList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WordpressInstanceList) DeepCopy() *WordpressInstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WordpressInstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EventSourceList) DeepCopy() *EventSourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventSourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SensuHandlerList) DeepCopy() *SensuHandlerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuHandlerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func MutatingWebhookConfigurationListHandler(ctx context.Context, list *admissionregistrationv1.MutatingWebhookConfigurationList, options Options) (component.Component, error) {\n\tif list == nil {\n\t\treturn nil, errors.New(\"mutating webhook configuration list is nil\")\n\t}\n\n\tcols := component.NewTableCols(\"Name\", \"Age\")\n\tot := NewObjectTable(\"Mutating Webhook Configurations\", \"We couldn't find any mutating webhook configurations!\", cols, options.DashConfig.ObjectStore())\n\n\tfor _, mutatingWebhookConfiguration := range list.Items {\n\t\trow := component.TableRow{}\n\t\tnameLink, err := options.Link.ForObject(&mutatingWebhookConfiguration, mutatingWebhookConfiguration.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trow[\"Name\"] = nameLink\n\t\tts := mutatingWebhookConfiguration.CreationTimestamp.Time\n\t\trow[\"Age\"] = component.NewTimestamp(ts)\n\n\t\tif err := ot.AddRowForObject(ctx, &mutatingWebhookConfiguration, row); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"add row for object: %w\", err)\n\t\t}\n\t}\n\n\treturn ot.ToComponent()\n}", "func (o OAUTHKeysList) Copy() elemental.Identifiables {\n\n\tcopy := append(OAUTHKeysList{}, o...)\n\treturn &copy\n}", "func (in *AcrPullBindingList) DeepCopy() *AcrPullBindingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AcrPullBindingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AppManifestList) DeepCopy() *AppManifestList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppManifestList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ListHooks(ctx *context.APIContext) {\n\t// swagger:operation GET /user/hooks user userListHooks\n\t// ---\n\t// summary: List the authenticated user's webhooks\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: page\n\t// in: query\n\t// description: page number of results to return (1-based)\n\t// type: integer\n\t// - name: limit\n\t// in: query\n\t// description: page size of results\n\t// type: integer\n\t// responses:\n\t// \"200\":\n\t// \"$ref\": \"#/responses/HookList\"\n\n\tutils.ListOwnerHooks(\n\t\tctx,\n\t\tctx.Doer,\n\t)\n}", "func (in *RestApiList) DeepCopy() *RestApiList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestApiList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObservatoriumList) DeepCopy() *ObservatoriumList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObservatoriumList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FederationDomainList) DeepCopy() *FederationDomainList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HTTPRuleList) DeepCopy() *HTTPRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HTTPRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ServiceInstanceBindingList) DeepCopy() *ServiceInstanceBindingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceInstanceBindingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AppBindingList) DeepCopy() *AppBindingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppBindingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PullRequestList) DeepCopy() *PullRequestList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PullRequestList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HistoryEntryList) DeepCopy() *HistoryEntryList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HistoryEntryList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (o ImageVulnerabilitiesList) Copy() elemental.Identifiables {\n\n\tcopy := append(ImageVulnerabilitiesList{}, o...)\n\treturn &copy\n}", "func (mr *MockRepoClientMockRecorder) ListWebhooks() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListWebhooks\", reflect.TypeOf((*MockRepoClient)(nil).ListWebhooks))\n}", "func (in *SecretRoleBindingList) DeepCopy() *SecretRoleBindingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRoleBindingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TweetList) DeepCopy() *TweetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TweetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *VirtualMachineFlavorList) DeepCopy() *VirtualMachineFlavorList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineFlavorList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSManagedMachinePoolList) DeepCopy() *AWSManagedMachinePoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSManagedMachinePoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ExternalSecretList) DeepCopy() *ExternalSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ValidationList) DeepCopy() *ValidationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ValidationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubBindingList) DeepCopy() *GitHubBindingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubBindingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Identity) WebHook() Hook {\n\treturn Hook{\n\t\tavatarURL: c.AvatarURL,\n\t\tusername: c.Username,\n\t\twebHookURL: c.WebHookURL,\n\t}\n}", "func (in *AWSMachinePoolList) DeepCopy() *AWSMachinePoolList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSMachinePoolList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationServiceList) DeepCopy() *AuthenticationServiceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationServiceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FlexibleServersFirewallRuleList) DeepCopy() *FlexibleServersFirewallRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServersFirewallRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AlertingRuleList) DeepCopy() *AlertingRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlertingRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (t *TauAPI) CreateWebhook(webhook Webhook) (ID int64, error error) {\n\tjsonPostMsg, _ := json.Marshal(webhook)\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 2,\n\t\tMethod: \"POST\",\n\t\tPath: \"webhooks/webhooks\",\n\t\tNeedsAuth: true,\n\t\tPostMsg: jsonPostMsg,\n\t})\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\tif string(jsonData) == \"[\\\"Limit reached\\\"]\" {\n\t\treturn 0, fmt.Errorf(\"Limit of webhooks reached (5)\")\n\t}\n\tvar d struct {\n\t\tID int64 `json:\"id\"`\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn 0, fmt.Errorf(\"CreateWebhook -> unmarshal jsonData %v\", err)\n\t}\n\treturn d.ID, nil\n}", "func (in *PrivateEndpointList) DeepCopy() *PrivateEndpointList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsResolversInboundEndpointList) DeepCopy() *DnsResolversInboundEndpointList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsResolversInboundEndpointList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShadowPodList) DeepCopy() *ShadowPodList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShadowPodList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WorkloadEntryList) DeepCopy() *WorkloadEntryList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkloadEntryList)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.75138044", "0.71253616", "0.6389425", "0.6092289", "0.580533", "0.5775616", "0.5734961", "0.56703657", "0.56364554", "0.5611077", "0.555949", "0.5512877", "0.5491004", "0.5488365", "0.548807", "0.54841", "0.5409213", "0.53670716", "0.53264004", "0.53166413", "0.5310518", "0.5261399", "0.5253952", "0.5233882", "0.52280474", "0.514524", "0.5117122", "0.5091608", "0.5086966", "0.5039026", "0.5034743", "0.5022058", "0.5019776", "0.50080204", "0.49849436", "0.49713466", "0.49610105", "0.49610105", "0.4956556", "0.49379542", "0.493731", "0.49304217", "0.49051827", "0.48729944", "0.48683256", "0.4868037", "0.4854454", "0.4851832", "0.48491216", "0.48186758", "0.4817877", "0.48135233", "0.48067412", "0.47945467", "0.47876835", "0.47864202", "0.47683454", "0.47631663", "0.47517297", "0.4737338", "0.4734064", "0.47322682", "0.4727577", "0.47239968", "0.47224024", "0.47221997", "0.47198585", "0.4718903", "0.47172785", "0.4704974", "0.4703861", "0.4681626", "0.46563843", "0.46554536", "0.46511748", "0.4649393", "0.46430033", "0.46410972", "0.46345633", "0.46322", "0.46308225", "0.4628325", "0.46253142", "0.4624695", "0.46241167", "0.46140188", "0.46082407", "0.46055725", "0.45969528", "0.45931724", "0.4592534", "0.45779786", "0.4571273", "0.45657393", "0.45539945", "0.45400795", "0.4533627", "0.4532394", "0.45296037", "0.45259488" ]
0.9170767
0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *EKSPodIdentityWebhookList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *ConsoleQuickStart) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ServingRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Keevakind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Run) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Pentesting) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Version) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DroidVirt) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleSample) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleQuickStartList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Kernel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AppBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Execution) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PipelineRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Runner) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Terminal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Terminal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleCLIDownload) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CliApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DirectorBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *DiscoveryService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Baremetal) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Egeria) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Qliksense) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Idler) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DroidVirtList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RpaasBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Host) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ServingRuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RedisEnterprise) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SSLProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleLink) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GitHubBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *MobileSecurityServiceBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DOMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *KeevakindList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DockerBind) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *RPMCompose) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SecretEngine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VultrMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SpaceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Ray) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Redpanda) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *KeptnCore) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Crd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Sidekick) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Test) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ManagedSeed) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Method) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DirectorBindList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t} else {\n\t\treturn nil\n\t}\n}", "func (in *IdGenerate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ExecutionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FalconContainer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FundPool) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RedisGCache) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RestQL) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ChaosApi) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualDatabase) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AppBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Notary) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *QliksenseList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FusionAppInstance) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *IdGenerateList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DataDownload) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Guestbook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ConsoleCLIDownloadList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PipelineRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GlobalUser) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CliAppList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Hawtio) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *VirtualNodeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *RTCPeerConnection) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *EventingBackend) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *GitHubBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *AtRest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *OpenStackPlaybookGenerator) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *UsersDB2) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Ghost) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *DiscoveryServiceCertificate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *WorkflowRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SD) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *CrunchyBridgeConnection) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *ManagedSeedList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *PyTorchJob) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *Framework) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *FusionApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}" ]
[ "0.7310628", "0.7156044", "0.71033555", "0.70980227", "0.7054339", "0.703866", "0.7034588", "0.7028135", "0.6996418", "0.6971367", "0.696867", "0.69530594", "0.695035", "0.6948232", "0.6935207", "0.69329184", "0.69329184", "0.6926076", "0.6922031", "0.69193244", "0.690913", "0.6897809", "0.6892772", "0.6891362", "0.6886663", "0.68842524", "0.6884086", "0.687541", "0.6874373", "0.6873528", "0.68614846", "0.6858221", "0.68577105", "0.68495107", "0.6848675", "0.68446654", "0.68446654", "0.6843637", "0.6837802", "0.68371683", "0.6835379", "0.6835379", "0.6835379", "0.6835379", "0.68323886", "0.6831164", "0.6828055", "0.6826891", "0.68264025", "0.68257093", "0.68232316", "0.6815097", "0.6811769", "0.6811195", "0.6810813", "0.6803599", "0.6800846", "0.67916983", "0.67877984", "0.6781314", "0.6780394", "0.6780265", "0.67795205", "0.6779461", "0.6779073", "0.6766471", "0.6766131", "0.67652184", "0.6762", "0.6759887", "0.6753985", "0.6753985", "0.67473525", "0.674506", "0.6742857", "0.6739492", "0.67366815", "0.6736482", "0.67349905", "0.67330945", "0.673199", "0.67318904", "0.6731279", "0.6729689", "0.6729562", "0.6726481", "0.67263705", "0.6723147", "0.6722425", "0.6719022", "0.67168653", "0.671509", "0.671276", "0.6711862", "0.6709131", "0.67090064", "0.6707975", "0.6707181", "0.67070854", "0.67068195", "0.6706742" ]
0.0
-1
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *EKSPodIdentityWebhookSpec) DeepCopyInto(out *EKSPodIdentityWebhookSpec) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8216088", "0.8128937", "0.81051093", "0.8086112", "0.80840266", "0.806814", "0.80643326", "0.80272067", "0.8013088", "0.79972315", "0.799318", "0.7988673", "0.79883105", "0.79879236", "0.79879236", "0.7986761", "0.79770774", "0.7973031", "0.7970074", "0.7970074", "0.7970074", "0.7968491", "0.7963908", "0.7962594", "0.79461676", "0.79461676", "0.79453707", "0.794318", "0.794318", "0.79430556", "0.7941854", "0.7939476", "0.7937904", "0.79294026", "0.7925471", "0.7917021", "0.79131836", "0.79123056", "0.7910745", "0.79105514", "0.79092926", "0.7906994", "0.79068947", "0.7905208", "0.7905208", "0.7904789", "0.7904576", "0.7902542", "0.789971", "0.7898187", "0.789275", "0.78916943", "0.78905755", "0.7889031", "0.7887323", "0.7887001", "0.78859967", "0.78859967", "0.788571", "0.7881972", "0.7875957", "0.7875957", "0.78754383", "0.78744066", "0.78725743", "0.7872079", "0.78715914", "0.7865343", "0.7863912", "0.7863912", "0.7863912", "0.78638506", "0.7863712", "0.7862366", "0.7859421", "0.7858547", "0.7857873", "0.78512096", "0.7847138", "0.78456485", "0.7841974", "0.78375477", "0.7837439", "0.78371376", "0.7835643", "0.7833311", "0.78312105", "0.7830207", "0.7828144", "0.7826242", "0.7825785", "0.782401", "0.7820985", "0.7819203", "0.78140086", "0.7812223", "0.7811996", "0.7811559", "0.78109616", "0.7809847", "0.7809696" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EKSPodIdentityWebhookSpec.
func (in *EKSPodIdentityWebhookSpec) DeepCopy() *EKSPodIdentityWebhookSpec { if in == nil { return nil } out := new(EKSPodIdentityWebhookSpec) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EKSPodIdentityWebhook) DeepCopy() *EKSPodIdentityWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhookSpec) DeepCopy() *GitHubWebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookList) DeepCopy() *EKSPodIdentityWebhookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationSpec) DeepCopy() *AdmissionWebhookConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SensuEventFilterSpec) DeepCopy() *SensuEventFilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuEventFilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookStatus) DeepCopy() *EKSPodIdentityWebhookStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RollingUpdateSpec) DeepCopy() *RollingUpdateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RollingUpdateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RollingUpdateSpec) DeepCopy() *RollingUpdateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RollingUpdateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhookSpec(spec *job.WebhookSpec) *WebhookSpec {\n\treturn &WebhookSpec{\n\t\tCreatedAt: spec.CreatedAt,\n\t\tUpdatedAt: spec.UpdatedAt,\n\t}\n}", "func (in *EKSPodIdentityWebhookSpec) DeepCopyInto(out *EKSPodIdentityWebhookSpec) {\n\t*out = *in\n}", "func (in *WebServerHealthCheckSpec) DeepCopy() *WebServerHealthCheckSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebServerHealthCheckSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleNotificationSpec) DeepCopy() *ConsoleNotificationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleNotificationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeEventsRuleSpec) DeepCopy() *KubeEventsRuleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeEventsRuleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdGenerateSpec) DeepCopy() *IdGenerateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdGenerateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestoreResourceHookSpec) DeepCopy() *RestoreResourceHookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestoreResourceHookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KeevakindSpec) DeepCopy() *KeevakindSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeevakindSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EventSourceSpec) DeepCopy() *EventSourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventSourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SocialEventSpec) DeepCopy() *SocialEventSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SocialEventSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationSpec) DeepCopy() *NotificationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationSpec) DeepCopy() *NotificationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SpeakerSpec) DeepCopy() *SpeakerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SpeakerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FlexibleServers_FirewallRule_Spec) DeepCopy() *FlexibleServers_FirewallRule_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServers_FirewallRule_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EmbeddedRunSpec) DeepCopy() *EmbeddedRunSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EmbeddedRunSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SensuHandlerSpec) DeepCopy() *SensuHandlerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuHandlerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutSpec) DeepCopy() *RolloutSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebServerSpec) DeepCopy() *WebServerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebServerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdlerSpec) DeepCopy() *IdlerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdlerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelmRequestSpec) DeepCopy() *HelmRequestSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmRequestSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhook) DeepCopy() *GitHubWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsResolvers_InboundEndpoint_Spec) DeepCopy() *DnsResolvers_InboundEndpoint_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsResolvers_InboundEndpoint_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PullRequestSpec) DeepCopy() *PullRequestSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PullRequestSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SplunkEnterpriseSpec) DeepCopy() *SplunkEnterpriseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SplunkEnterpriseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShadowEndpointSliceSpec) DeepCopy() *ShadowEndpointSliceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShadowEndpointSliceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EarlyStoppingSpec) DeepCopy() *EarlyStoppingSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EarlyStoppingSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RedisEnterprise_Spec) DeepCopy() *RedisEnterprise_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisEnterprise_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ReceiversSpec) DeepCopy() *ReceiversSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReceiversSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhook(timeout time.Duration) filters.Spec {\n\treturn WebhookWithOptions(WebhookOptions{Timeout: timeout, Tracer: opentracing.NoopTracer{}})\n}", "func (in *FalconContainerSpec) DeepCopy() *FalconContainerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FalconContainerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SSLProxySpec) DeepCopy() *SSLProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SSLProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationWebhook) DeepCopy() *AuthenticationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ChaosApiSpec) DeepCopy() *ChaosApiSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChaosApiSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhook) DeepCopy() *RolloutWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MailboxSpec) DeepCopy() *MailboxSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MailboxSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FilterSpec) DeepCopy() *FilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FilterSpec) DeepCopy() *FilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ArgusWatcherSpec) DeepCopy() *ArgusWatcherSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ArgusWatcherSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BookkeeperSpec) DeepCopy() *BookkeeperSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BookkeeperSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderSpec) DeepCopy() *IdentityProviderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhookPayload) DeepCopy() *RolloutWebhookPayload {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhookPayload)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BackupResourceHookSpec) DeepCopy() *BackupResourceHookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackupResourceHookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ThanosReceiveControllerSpec) DeepCopy() *ThanosReceiveControllerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ThanosReceiveControllerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFSpec) DeepCopy() *EKSCFSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HealthCheckerSpec) DeepCopy() *HealthCheckerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HealthCheckerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AppEventSpec) DeepCopy() *AppEventSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppEventSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateEndpoint_Spec) DeepCopy() *PrivateEndpoint_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpoint_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelmSpec) DeepCopy() *HelmSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApiKeySpec) DeepCopy() *ApiKeySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApiKeySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AttachmentSpec) DeepCopy() *AttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in PeerSpecs) DeepCopy() PeerSpecs {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeerSpecs)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (in *ListenerSpec) DeepCopy() *ListenerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ListenerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TriggerSpec) DeepCopy() *TriggerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TriggerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SinkSpec) DeepCopy() *SinkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SinkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleServiceOauthProxySpec) DeepCopy() *ConsoleServiceOauthProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleServiceOauthProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelloHttpServiceSpec) DeepCopy() *HelloHttpServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelloHttpServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AlertingRuleSpec) DeepCopy() *AlertingRuleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlertingRuleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObservatoriumSpec) DeepCopy() *ObservatoriumSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObservatoriumSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EscalationPolicySecretSpec) DeepCopy() *EscalationPolicySecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EscalationPolicySecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FrameworkSpec) DeepCopy() *FrameworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FrameworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WeatherServiceSpec) DeepCopy() *WeatherServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WeatherServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SidekickSpec) DeepCopy() *SidekickSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SidekickSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelloocpSpec) DeepCopy() *HelloocpSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelloocpSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WavefrontAlertSpec) DeepCopy() *WavefrontAlertSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WavefrontAlertSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DopplerSecretSpec) DeepCopy() *DopplerSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DopplerSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateSpec) DeepCopy() *CertificateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRevocationSpec) DeepCopy() *CertificateRevocationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRevocationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationServiceSpec) DeepCopy() *AuthenticationServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShadowPodSpec) DeepCopy() *ShadowPodSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShadowPodSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ValidationSpec) DeepCopy() *ValidationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ValidationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EnvoyFilter_Patch) DeepCopy() *EnvoyFilter_Patch {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EnvoyFilter_Patch)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DataUploadSpec) DeepCopy() *DataUploadSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DataUploadSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleCLIDownloadSpec) DeepCopy() *ConsoleCLIDownloadSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleCLIDownloadSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DiscoveryServiceCertificateSpec) DeepCopy() *DiscoveryServiceCertificateSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DiscoveryServiceCertificateSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebImageSpec) DeepCopy() *WebImageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebImageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleYAMLSampleSpec) DeepCopy() *ConsoleYAMLSampleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleYAMLSampleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSManagedSpec) DeepCopy() *EKSManagedSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PentestingSpec) DeepCopy() *PentestingSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PentestingSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestApiSpec) DeepCopy() *RestApiSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestApiSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WorkflowRunSpec) DeepCopy() *WorkflowRunSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkflowRunSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSManagedMachinePoolSpec) DeepCopy() *AWSManagedMachinePoolSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSManagedMachinePoolSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LokiSpec) DeepCopy() *LokiSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LokiSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LokiSpec) DeepCopy() *LokiSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LokiSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebAppSpec) DeepCopy() *WebAppSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebAppSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ChannelSpec) DeepCopy() *ChannelSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChannelSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContainerProbeSpec) DeepCopy() *ContainerProbeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerProbeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebImageStreamSpec) DeepCopy() *WebImageStreamSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebImageStreamSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FusionAppInstanceSpec) DeepCopy() *FusionAppInstanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppInstanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsResolvers_OutboundEndpoint_Spec) DeepCopy() *DnsResolvers_OutboundEndpoint_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsResolvers_OutboundEndpoint_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7447531", "0.68233037", "0.625811", "0.58538747", "0.55260247", "0.53913707", "0.5371805", "0.5371805", "0.5307042", "0.5010729", "0.49849185", "0.49666238", "0.4917856", "0.49089196", "0.4845179", "0.48018003", "0.47993705", "0.47924098", "0.4772695", "0.4772695", "0.47625852", "0.474302", "0.471766", "0.4714845", "0.4711198", "0.4700057", "0.46986482", "0.46909815", "0.46908757", "0.46904096", "0.4688183", "0.467167", "0.46597692", "0.46557248", "0.46555746", "0.46486986", "0.46255127", "0.46242726", "0.46168187", "0.46098244", "0.4606894", "0.46003175", "0.45997882", "0.45901495", "0.45901495", "0.4588504", "0.45680213", "0.45628688", "0.4559069", "0.45548272", "0.45507798", "0.45466566", "0.45398736", "0.4536409", "0.45363414", "0.4530803", "0.45283943", "0.4526893", "0.4523448", "0.4518954", "0.45071375", "0.4491557", "0.4489147", "0.44873366", "0.4484242", "0.447676", "0.44752684", "0.4466767", "0.44655788", "0.4464409", "0.4458156", "0.445171", "0.4448307", "0.44453195", "0.44448662", "0.44391394", "0.44374895", "0.44356042", "0.44334617", "0.44276926", "0.44268042", "0.44229916", "0.44228396", "0.44228396", "0.44154724", "0.44122556", "0.4409399", "0.43922323", "0.43893328", "0.4387492", "0.4384394", "0.43840128", "0.4383255", "0.4383255", "0.43703428", "0.4369099", "0.43661657", "0.43647346", "0.43620017", "0.43612424" ]
0.88325137
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *EKSPodIdentityWebhookStatus) DeepCopyInto(out *EKSPodIdentityWebhookStatus) { *out = *in if in.PodIdentityWebhookSecret != nil { in, out := &in.PodIdentityWebhookSecret, &out.PodIdentityWebhookSecret *out = new(SecretRef) **out = **in } if in.PodIdentityWebhookService != nil { in, out := &in.PodIdentityWebhookService, &out.PodIdentityWebhookService *out = new(ServiceRef) **out = **in } if in.PodIdentityWebhookDaemonset != nil { in, out := &in.PodIdentityWebhookDaemonset, &out.PodIdentityWebhookDaemonset *out = new(DaemonsetRef) **out = **in } if in.PodIdentityWebhookConfiguration != nil { in, out := &in.PodIdentityWebhookConfiguration, &out.PodIdentityWebhookConfiguration *out = new(MutatingWebhookConfigurationRef) **out = **in } if in.PodIdentityWebhookServiceAccount != nil { in, out := &in.PodIdentityWebhookServiceAccount, &out.PodIdentityWebhookServiceAccount *out = new(ServiceAccountRef) **out = **in } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8215289", "0.81280124", "0.81039286", "0.80862963", "0.8083811", "0.80673146", "0.8064545", "0.8026454", "0.8012046", "0.7996313", "0.799204", "0.79887754", "0.7987097", "0.7986994", "0.7986994", "0.79854053", "0.7975989", "0.7972486", "0.79695636", "0.79695636", "0.79695636", "0.7967528", "0.79624444", "0.7961954", "0.7945754", "0.7945754", "0.7944541", "0.79428566", "0.7942668", "0.7942668", "0.7940451", "0.793851", "0.7936731", "0.79294837", "0.79252166", "0.7915377", "0.7911627", "0.7911138", "0.7909384", "0.790913", "0.7908773", "0.7905649", "0.79050326", "0.7904594", "0.7904594", "0.7904235", "0.79036915", "0.79020816", "0.78988886", "0.78977424", "0.7891376", "0.7891024", "0.7889831", "0.78890276", "0.7887135", "0.788637", "0.7885264", "0.7885264", "0.7884786", "0.7880785", "0.78745943", "0.78745943", "0.78745407", "0.78734446", "0.78724426", "0.78713626", "0.78713554", "0.78652424", "0.7863321", "0.7863321", "0.7863321", "0.7863293", "0.7862628", "0.7860664", "0.7858556", "0.785785", "0.78571486", "0.7851332", "0.78453225", "0.78448987", "0.78415996", "0.7837483", "0.7837037", "0.7836443", "0.78351796", "0.78329664", "0.7831094", "0.7829445", "0.7826582", "0.7824499", "0.78242797", "0.78227437", "0.78192484", "0.7818843", "0.78128535", "0.7812535", "0.78111476", "0.78111106", "0.781107", "0.78093034", "0.7808775" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EKSPodIdentityWebhookStatus.
func (in *EKSPodIdentityWebhookStatus) DeepCopy() *EKSPodIdentityWebhookStatus { if in == nil { return nil } out := new(EKSPodIdentityWebhookStatus) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EKSPodIdentityWebhook) DeepCopy() *EKSPodIdentityWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhookStatus) DeepCopy() *GitHubWebhookStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhookStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookList) DeepCopy() *EKSPodIdentityWebhookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SensuEventFilterStatus) DeepCopy() *SensuEventFilterStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuEventFilterStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationStatus) DeepCopy() *AdmissionWebhookConfigurationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdlerStatus) DeepCopy() *IdlerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdlerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FusionAppInstanceStatus) DeepCopy() *FusionAppInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhook) DeepCopy() *RolloutWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApiKeyStatus) DeepCopy() *ApiKeyStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApiKeyStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Identity_STATUS) DeepCopy() *Identity_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Identity_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FLAppStatus) DeepCopy() *FLAppStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FLAppStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdGenerateStatus) DeepCopy() *IdGenerateStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdGenerateStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BatchAccountIdentity_UserAssignedIdentities_STATUS) DeepCopy() *BatchAccountIdentity_UserAssignedIdentities_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BatchAccountIdentity_UserAssignedIdentities_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AttachmentStatus) DeepCopy() *AttachmentStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttachmentStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KeyVaultReference_STATUS) DeepCopy() *KeyVaultReference_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeyVaultReference_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CloudFunctions2FunctionStatus) DeepCopy() *CloudFunctions2FunctionStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudFunctions2FunctionStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FirebaseWebAppStatus) DeepCopy() *FirebaseWebAppStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FirebaseWebAppStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EventSourceStatus) DeepCopy() *EventSourceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventSourceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WordpressInstanceStatus) DeepCopy() *WordpressInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WordpressInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsResolvers_InboundEndpoint_STATUS) DeepCopy() *DnsResolvers_InboundEndpoint_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsResolvers_InboundEndpoint_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TriggerStatus) DeepCopy() *TriggerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TriggerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSMachinePoolInstanceStatus) DeepCopy() *AWSMachinePoolInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSMachinePoolInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutWebhookPayload) DeepCopy() *RolloutWebhookPayload {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutWebhookPayload)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitHubWebhook) DeepCopy() *GitHubWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ImageSignerStatus) DeepCopy() *ImageSignerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageSignerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookStatus) DeepCopyInto(out *EKSPodIdentityWebhookStatus) {\n\t*out = *in\n\tif in.PodIdentityWebhookSecret != nil {\n\t\tin, out := &in.PodIdentityWebhookSecret, &out.PodIdentityWebhookSecret\n\t\t*out = new(SecretRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookService != nil {\n\t\tin, out := &in.PodIdentityWebhookService, &out.PodIdentityWebhookService\n\t\t*out = new(ServiceRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookDaemonset != nil {\n\t\tin, out := &in.PodIdentityWebhookDaemonset, &out.PodIdentityWebhookDaemonset\n\t\t*out = new(DaemonsetRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookConfiguration != nil {\n\t\tin, out := &in.PodIdentityWebhookConfiguration, &out.PodIdentityWebhookConfiguration\n\t\t*out = new(MutatingWebhookConfigurationRef)\n\t\t**out = **in\n\t}\n\tif in.PodIdentityWebhookServiceAccount != nil {\n\t\tin, out := &in.PodIdentityWebhookServiceAccount, &out.PodIdentityWebhookServiceAccount\n\t\t*out = new(ServiceAccountRef)\n\t\t**out = **in\n\t}\n}", "func (in *KeyVaultProperties_STATUS) DeepCopy() *KeyVaultProperties_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeyVaultProperties_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UserAccountStatusEmbedded) DeepCopy() *UserAccountStatusEmbedded {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserAccountStatusEmbedded)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FlexibleServers_FirewallRule_STATUS) DeepCopy() *FlexibleServers_FirewallRule_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServers_FirewallRule_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FusionAppStatus) DeepCopy() *FusionAppStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderStatus) DeepCopy() *IdentityProviderStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ArgusWatcherStatus) DeepCopy() *ArgusWatcherStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ArgusWatcherStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SimpleRolloutTraitStatus) DeepCopy() *SimpleRolloutTraitStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SimpleRolloutTraitStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SSLProxyStatus) DeepCopy() *SSLProxyStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SSLProxyStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AppEventStatus) DeepCopy() *AppEventStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppEventStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ListenerStatus) DeepCopy() *ListenerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ListenerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSPCAIssuerStatus) DeepCopy() *AWSPCAIssuerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSPCAIssuerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TweetStatus) DeepCopy() *TweetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TweetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MailboxStatus) DeepCopy() *MailboxStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MailboxStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRevocationStatus) DeepCopy() *CertificateRevocationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRevocationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeEventsRuleStatus) DeepCopy() *KubeEventsRuleStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeEventsRuleStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AlertingRuleStatus) DeepCopy() *AlertingRuleStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlertingRuleStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HTTPRuleStatus) DeepCopy() *HTTPRuleStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HTTPRuleStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FalconContainerStatus) DeepCopy() *FalconContainerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FalconContainerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SocialEventStatus) DeepCopy() *SocialEventStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SocialEventStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LokiStatus) DeepCopy() *LokiStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LokiStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ServiceInstanceStatus) DeepCopy() *ServiceInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationServiceStatus) DeepCopy() *AuthenticationServiceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationServiceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BatchAccountIdentity_STATUS) DeepCopy() *BatchAccountIdentity_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BatchAccountIdentity_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SignerKeyStatus) DeepCopy() *SignerKeyStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SignerKeyStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MobileSecurityServiceStatus) DeepCopy() *MobileSecurityServiceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MobileSecurityServiceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SidekickStatus) DeepCopy() *SidekickStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SidekickStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WeatherServiceStatus) DeepCopy() *WeatherServiceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WeatherServiceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WorkflowRunStatus) DeepCopy() *WorkflowRunStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkflowRunStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TaskLoopRunStatus) DeepCopy() *TaskLoopRunStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TaskLoopRunStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationWebhook) DeepCopy() *AuthenticationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TaskLoopTaskRunStatus) DeepCopy() *TaskLoopTaskRunStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TaskLoopTaskRunStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TemplateInstanceStatus) DeepCopy() *TemplateInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TemplateInstanceStatus) DeepCopy() *TemplateInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebServerStatus) DeepCopy() *WebServerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebServerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FunctionStatus) DeepCopy() *FunctionStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FunctionStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsResolvers_OutboundEndpoint_STATUS) DeepCopy() *DnsResolvers_OutboundEndpoint_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsResolvers_OutboundEndpoint_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationStatus) DeepCopy() *NotificationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationStatus) DeepCopy() *NotificationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FargateProfileStatus) DeepCopy() *FargateProfileStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FargateProfileStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutStatus) DeepCopy() *RolloutStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RolloutStatus) DeepCopy() *RolloutStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolloutStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PentestingStatus) DeepCopy() *PentestingStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PentestingStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UserPoolStatus) DeepCopy() *UserPoolStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserPoolStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FrameworkStatus) DeepCopy() *FrameworkStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FrameworkStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RedisEnterprise_STATUS) DeepCopy() *RedisEnterprise_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisEnterprise_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ChaosApiStatus) DeepCopy() *ChaosApiStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChaosApiStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WavefrontAlertStatus) DeepCopy() *WavefrontAlertStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WavefrontAlertStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *StatefulSetStatus) DeepCopy() *StatefulSetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EndpointGroupStatus) DeepCopy() *EndpointGroupStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointGroupStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatastreamStreamStatus) DeepCopy() *DatastreamStreamStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatastreamStreamStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UserPoolDomainStatus) DeepCopy() *UserPoolDomainStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserPoolDomainStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProxyServiceStatus) DeepCopy() *ProxyServiceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxyServiceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSMachinePoolStatus) DeepCopy() *AWSMachinePoolStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSMachinePoolStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OpenStackPlaybookGeneratorStatus) DeepCopy() *OpenStackPlaybookGeneratorStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OpenStackPlaybookGeneratorStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateEndpointIPConfiguration_STATUS) DeepCopy() *PrivateEndpointIPConfiguration_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointIPConfiguration_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestApiStatus) DeepCopy() *RestApiStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestApiStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FortvilleStatus) DeepCopy() *FortvilleStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FortvilleStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSManagedMachinePoolStatus) DeepCopy() *AWSManagedMachinePoolStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSManagedMachinePoolStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KeevakindStatus) DeepCopy() *KeevakindStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeevakindStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RocketmqStatus) DeepCopy() *RocketmqStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RocketmqStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSPodIdentityWebhookSpec) DeepCopy() *EKSPodIdentityWebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSPodIdentityWebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CodisProxyStatus) DeepCopy() *CodisProxyStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CodisProxyStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BurrowStatus) DeepCopy() *BurrowStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BurrowStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OpenStackIPSetStatus) DeepCopy() *OpenStackIPSetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OpenStackIPSetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationStatus) DeepCopy() *ApplicationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationStatus) DeepCopy() *ApplicationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationStatus) DeepCopy() *ApplicationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TektonStatus) DeepCopy() *TektonStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TektonStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ExternalSecretStatus) DeepCopy() *ExternalSecretStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalSecretStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WatermarkHorizontalPodAutoscalerStatus) DeepCopy() *WatermarkHorizontalPodAutoscalerStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WatermarkHorizontalPodAutoscalerStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShadowPodStatus) DeepCopy() *ShadowPodStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShadowPodStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelloocpStatus) DeepCopy() *HelloocpStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelloocpStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OVirtStatus) DeepCopy() *OVirtStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OVirtStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *HelmRequestStatus) DeepCopy() *HelmRequestStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmRequestStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7412", "0.6860369", "0.6748026", "0.6282171", "0.6095725", "0.6011908", "0.5978788", "0.5935275", "0.59312373", "0.5927533", "0.5919393", "0.5819512", "0.5815602", "0.58154786", "0.5715951", "0.5706863", "0.5685052", "0.5678343", "0.5663991", "0.56619436", "0.56577057", "0.56425416", "0.56407213", "0.5635752", "0.5622636", "0.5617416", "0.5604086", "0.55889696", "0.5584918", "0.5559212", "0.5537977", "0.55373764", "0.5536625", "0.55291146", "0.55204815", "0.5502729", "0.5499675", "0.54840934", "0.54800844", "0.5478204", "0.54735863", "0.5470683", "0.5463189", "0.5460772", "0.5460624", "0.54583323", "0.5444515", "0.54367316", "0.5434829", "0.54286635", "0.5414497", "0.53883404", "0.53869885", "0.5383719", "0.5382567", "0.53815126", "0.53805155", "0.53786814", "0.53786814", "0.5365388", "0.53639543", "0.5363855", "0.5353561", "0.5353561", "0.5350661", "0.5342371", "0.5342371", "0.5326486", "0.53227323", "0.53216237", "0.5311643", "0.53105265", "0.5305846", "0.52955735", "0.5291801", "0.5291674", "0.5290991", "0.5285882", "0.5285073", "0.5271633", "0.5270533", "0.5263023", "0.52580875", "0.52580106", "0.5255124", "0.525371", "0.52522314", "0.5250428", "0.5240732", "0.5234005", "0.5233914", "0.5233914", "0.5233914", "0.52332616", "0.523098", "0.5230482", "0.52290016", "0.5226819", "0.5226633", "0.5220361" ]
0.90216064
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *MutatingWebhookConfigurationRef) DeepCopyInto(out *MutatingWebhookConfigurationRef) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8216088", "0.8128937", "0.81051093", "0.8086112", "0.80840266", "0.806814", "0.80643326", "0.80272067", "0.8013088", "0.79972315", "0.799318", "0.7988673", "0.79883105", "0.79879236", "0.79879236", "0.7986761", "0.79770774", "0.7973031", "0.7970074", "0.7970074", "0.7970074", "0.7968491", "0.7963908", "0.7962594", "0.79461676", "0.79461676", "0.79453707", "0.794318", "0.794318", "0.79430556", "0.7941854", "0.7939476", "0.7937904", "0.79294026", "0.7925471", "0.7917021", "0.79131836", "0.79123056", "0.7910745", "0.79105514", "0.79092926", "0.7906994", "0.79068947", "0.7905208", "0.7905208", "0.7904789", "0.7904576", "0.7902542", "0.789971", "0.7898187", "0.789275", "0.78916943", "0.78905755", "0.7889031", "0.7887323", "0.7887001", "0.78859967", "0.78859967", "0.788571", "0.7881972", "0.7875957", "0.7875957", "0.78754383", "0.78744066", "0.78725743", "0.7872079", "0.78715914", "0.7865343", "0.7863912", "0.7863912", "0.7863912", "0.78638506", "0.7863712", "0.7862366", "0.7859421", "0.7858547", "0.7857873", "0.78512096", "0.7847138", "0.78456485", "0.7841974", "0.78375477", "0.7837439", "0.78371376", "0.7835643", "0.7833311", "0.78312105", "0.7830207", "0.7828144", "0.7826242", "0.7825785", "0.782401", "0.7820985", "0.7819203", "0.78140086", "0.7812223", "0.7811996", "0.7811559", "0.78109616", "0.7809847", "0.7809696" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingWebhookConfigurationRef.
func (in *MutatingWebhookConfigurationRef) DeepCopy() *MutatingWebhookConfigurationRef { if in == nil { return nil } out := new(MutatingWebhookConfigurationRef) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookConfig) DeepCopy() *WebhookConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationSpec) DeepCopy() *AdmissionWebhookConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationList) DeepCopy() *AdmissionWebhookConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfigurationStatus) DeepCopy() *AdmissionWebhookConfigurationStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfigurationStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ApplyMutatingWebhookConfiguration(client admissionregistrationclientv1.MutatingWebhookConfigurationsGetter, recorder events.Recorder,\n\trequiredOriginal *admissionregistrationv1.MutatingWebhookConfiguration, expectedGeneration int64) (*admissionregistrationv1.MutatingWebhookConfiguration, bool, error) {\n\n\tif requiredOriginal == nil {\n\t\treturn nil, false, fmt.Errorf(\"Unexpected nil instead of an object\")\n\t}\n\trequired := requiredOriginal.DeepCopy()\n\n\texisting, err := client.MutatingWebhookConfigurations().Get(context.TODO(), required.GetName(), metav1.GetOptions{})\n\tif apierrors.IsNotFound(err) {\n\t\tactual, err := client.MutatingWebhookConfigurations().Create(context.TODO(), required, metav1.CreateOptions{})\n\t\treportCreateEvent(recorder, required, err)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn actual, true, nil\n\t} else if err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tmodified := resourcemerge.BoolPtr(false)\n\texistingCopy := existing.DeepCopy()\n\n\tresourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta)\n\tif !*modified && existingCopy.GetGeneration() == expectedGeneration {\n\t\treturn existingCopy, false, nil\n\t}\n\t// at this point we know that we're going to perform a write. We're just trying to get the object correct\n\ttoWrite := existingCopy // shallow copy so the code reads easier\n\n\t// Providing upgrade compatibility with service-ca-bundle operator\n\t// and ignore clientConfig.caBundle changes on \"inject-cabundle\" label\n\tif required.GetAnnotations() != nil && required.GetAnnotations()[genericCABundleInjectorAnnotation] != \"\" {\n\t\tcopyMutatingWebhookCABundle(existing, required)\n\t}\n\ttoWrite.Webhooks = required.Webhooks\n\n\tklog.V(4).Infof(\"MutatingWebhookConfiguration %q changes: %v\", required.GetNamespace()+\"/\"+required.GetName(), JSONPatchNoError(existing, toWrite))\n\n\tactual, err := client.MutatingWebhookConfigurations().Update(context.TODO(), toWrite, metav1.UpdateOptions{})\n\treportUpdateEvent(recorder, required, err)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn actual, *modified || actual.GetGeneration() > existingCopy.GetGeneration(), nil\n}", "func MutatingWebhookConfigurationHandler(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1.MutatingWebhookConfiguration, options Options) (component.Component, error) {\n\to := NewObject(mutatingWebhookConfiguration)\n\n\tch, err := newMutatingWebhookConfigurationHandler(mutatingWebhookConfiguration, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := ch.Webhooks(options); err != nil {\n\t\treturn nil, errors.Wrap(err, \"print mutatingwebhookconfiguration webhooks\")\n\t}\n\n\treturn o.ToComponent(ctx, options)\n}", "func (in *TerminalValidatingWebhookConfiguration) DeepCopy() *TerminalValidatingWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TerminalValidatingWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TerminalValidatingWebhookConfiguration) DeepCopy() *TerminalValidatingWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TerminalValidatingWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func appendWebhookConfiguration(mutatingWebhooks []*admissionv1.MutatingWebhookConfiguration, validatingWebhooks []*admissionv1.ValidatingWebhookConfiguration, configyamlFile []byte, tag string) ([]*admissionv1.MutatingWebhookConfiguration, []*admissionv1.ValidatingWebhookConfiguration, error) {\n\tobjs, err := utilyaml.ToUnstructured(configyamlFile)\n\tif err != nil {\n\t\tklog.Fatalf(\"failed to parse yaml\")\n\t}\n\t// look for resources of kind MutatingWebhookConfiguration\n\tfor i := range objs {\n\t\to := objs[i]\n\t\tif o.GetKind() == mutatingWebhookKind {\n\t\t\t// update the name in metadata\n\t\t\tif o.GetName() == mutatingwebhook {\n\t\t\t\to.SetName(fmt.Sprintf(\"%s-%s\", mutatingwebhook, tag))\n\n\t\t\t\twebhook := &admissionv1.MutatingWebhookConfiguration{}\n\t\t\t\tif err := scheme.Scheme.Convert(&o, webhook, nil); err != nil {\n\t\t\t\t\tklog.Fatalf(\"failed to convert MutatingWebhookConfiguration %s\", o.GetName())\n\t\t\t\t}\n\n\t\t\t\tmutatingWebhooks = append(mutatingWebhooks, webhook)\n\t\t\t}\n\t\t}\n\t\tif o.GetKind() == validatingWebhookKind {\n\t\t\t// update the name in metadata\n\t\t\tif o.GetName() == validatingwebhook {\n\t\t\t\to.SetName(fmt.Sprintf(\"%s-%s\", validatingwebhook, tag))\n\n\t\t\t\twebhook := &admissionv1.ValidatingWebhookConfiguration{}\n\t\t\t\tif err := scheme.Scheme.Convert(&o, webhook, nil); err != nil {\n\t\t\t\t\tklog.Fatalf(\"failed to convert ValidatingWebhookConfiguration %s\", o.GetName())\n\t\t\t\t}\n\n\t\t\t\tvalidatingWebhooks = append(validatingWebhooks, webhook)\n\t\t\t}\n\t\t}\n\t}\n\treturn mutatingWebhooks, validatingWebhooks, err\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func CreateConfiguration(clientset kubeclientset.Interface, selector *metav1.LabelSelector) error {\n\tfail := admregv1beta1.Fail\n\n\tconfig := &admregv1beta1.MutatingWebhookConfiguration{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: Name,\n\t\t},\n\t\tWebhooks: []admregv1beta1.MutatingWebhook{\n\t\t\t{\n\t\t\t\tName: fullName,\n\t\t\t\tClientConfig: admregv1beta1.WebhookClientConfig{\n\t\t\t\t\tService: &admregv1beta1.ServiceReference{\n\t\t\t\t\t\tName: Name,\n\t\t\t\t\t\tNamespace: serviceNamespace,\n\t\t\t\t\t},\n\t\t\t\t\tCABundle: caCert,\n\t\t\t\t},\n\t\t\t\tRules: []admregv1beta1.RuleWithOperations{\n\t\t\t\t\t{\n\t\t\t\t\t\tOperations: []admregv1beta1.OperationType{\n\t\t\t\t\t\t\tadmregv1beta1.Create,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRule: admregv1beta1.Rule{\n\t\t\t\t\t\t\tAPIGroups: []string{\"*\"},\n\t\t\t\t\t\t\tAPIVersions: []string{\"*\"},\n\t\t\t\t\t\t\tResources: []string{\"pods\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tFailurePolicy: &fail,\n\t\t\t\tNamespaceSelector: selector,\n\t\t\t},\n\t\t},\n\t}\n\tlog.Infof(\"Creating MutatingWebhookConfiguration %q\", config.Name)\n\tif _, err := clientset.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Create(context.TODO(), config, metav1.CreateOptions{}); err != nil {\n\t\tif !apierrors.IsAlreadyExists(err) {\n\t\t\treturn fmt.Errorf(\"failed to create MutatingWebhookConfiguration %q: %s\", config.Name, err)\n\t\t}\n\t\tlog.Infof(\"MutatingWebhookConfiguration %q already exists; use the existing one\", config.Name)\n\t}\n\treturn nil\n}", "func (in *DomainName_EndpointConfiguration) DeepCopy() *DomainName_EndpointConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DomainName_EndpointConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestApi_EndpointConfiguration) DeepCopy() *RestApi_EndpointConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestApi_EndpointConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ReconcileWebhookConfiguration(webhookServerReady, stopCh <-chan struct{},\n\tvc *WebhookParameters, kubeConfig string) {\n\n\tclientset, err := kube.CreateClientset(kubeConfig, \"\")\n\tif err != nil {\n\t\tlog.Fatalf(\"could not create k8s clientset: %v\", err)\n\t}\n\tvc.Clientset = clientset\n\n\twhc, err := NewWebhookConfigController(*vc)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot create validation webhook config: %v\", err)\n\t}\n\n\tif vc.EnableValidation {\n\t\t//wait for galley endpoint to be available before register ValidatingWebhookConfiguration\n\t\t<-webhookServerReady\n\t}\n\twhc.reconcile(stopCh)\n\n}", "func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricsConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TargetTrackingScalingPolicyConfiguration) DeepCopy() *TargetTrackingScalingPolicyConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TargetTrackingScalingPolicyConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigWatcher) DeepCopy() *ConfigWatcher {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigWatcher)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggerConfig) DeepCopy() *LoggerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ApplyValidatingWebhookConfiguration(client admissionregistrationclientv1.ValidatingWebhookConfigurationsGetter, recorder events.Recorder,\n\trequiredOriginal *admissionregistrationv1.ValidatingWebhookConfiguration, expectedGeneration int64) (*admissionregistrationv1.ValidatingWebhookConfiguration, bool, error) {\n\tif requiredOriginal == nil {\n\t\treturn nil, false, fmt.Errorf(\"Unexpected nil instead of an object\")\n\t}\n\trequired := requiredOriginal.DeepCopy()\n\n\texisting, err := client.ValidatingWebhookConfigurations().Get(context.TODO(), required.GetName(), metav1.GetOptions{})\n\tif apierrors.IsNotFound(err) {\n\t\tactual, err := client.ValidatingWebhookConfigurations().Create(context.TODO(), required, metav1.CreateOptions{})\n\t\treportCreateEvent(recorder, required, err)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn actual, true, nil\n\t} else if err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tmodified := resourcemerge.BoolPtr(false)\n\texistingCopy := existing.DeepCopy()\n\n\tresourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta)\n\tif !*modified && existingCopy.GetGeneration() == expectedGeneration {\n\t\treturn existingCopy, false, nil\n\t}\n\t// at this point we know that we're going to perform a write. We're just trying to get the object correct\n\ttoWrite := existingCopy // shallow copy so the code reads easier\n\t// Providing upgrade compatibility with service-ca-bundle operator\n\t// and ignore clientConfig.caBundle changes on \"inject-cabundle\" label\n\tif required.GetAnnotations() != nil && required.GetAnnotations()[genericCABundleInjectorAnnotation] != \"\" {\n\t\t// Populate unpopulated webhooks[].clientConfig.caBundle fields from existing resource\n\t\tcopyValidatingWebhookCABundle(existing, required)\n\t}\n\ttoWrite.Webhooks = required.Webhooks\n\n\tklog.V(4).Infof(\"ValidatingWebhookConfiguration %q changes: %v\", required.GetNamespace()+\"/\"+required.GetName(), JSONPatchNoError(existing, toWrite))\n\n\tactual, err := client.ValidatingWebhookConfigurations().Update(context.TODO(), toWrite, metav1.UpdateOptions{})\n\treportUpdateEvent(recorder, required, err)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn actual, *modified || actual.GetGeneration() > existingCopy.GetGeneration(), nil\n}", "func (in *NotificationConfig) DeepCopy() *NotificationConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (h *WLSHandler) UpdateConfiguration(config *config.Configuration) {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\th.targetConfig = config\n}", "func (in *LoggingConfig) DeepCopy() *LoggingConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MySQLConfiguration) DeepCopy() *MySQLConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FileSinkConfig) DeepCopy() *FileSinkConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FileSinkConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GCPConfiguration) DeepCopy() *GCPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GCPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerLoggerConfiguration) DeepCopy() *ControllerManagerLoggerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerLoggerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func MutatingWebhookConfigurationObjectWrapper(create MutatingWebhookConfigurationCreator) ObjectCreator {\n\treturn func(existing runtime.Object) (runtime.Object, error) {\n\t\tif existing != nil {\n\t\t\treturn create(existing.(*admissionregistrationv1beta1.MutatingWebhookConfiguration))\n\t\t}\n\t\treturn create(&admissionregistrationv1beta1.MutatingWebhookConfiguration{})\n\t}\n}", "func (in *CertificateRenewalConfig) DeepCopy() *CertificateRenewalConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRenewalConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *StepScalingPolicyConfiguration) DeepCopy() *StepScalingPolicyConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StepScalingPolicyConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Client) GetMutatingWebhookConfigurationV1beta1(name string) (*hook.MutatingWebhookConfiguration, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.admissionv1beta1.MutatingWebhookConfigurations().Get(context.TODO(), name, metav1.GetOptions{})\n}", "func (in *AuthenticationWebhook) DeepCopy() *AuthenticationWebhook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationWebhook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ComponentConfiguration) DeepCopy() *ComponentConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EndpointConfigurationParameters) DeepCopy() *EndpointConfigurationParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointConfigurationParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SinkConfig) DeepCopy() *SinkConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SinkConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CollectionConfiguration) DeepCopy() *CollectionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CollectionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func rebuildWebhookConfigHelper(\n\tcaFile, webhookConfigFile, webhookName string,\n\townerRefs []metav1.OwnerReference,\n) (*v1beta1.ValidatingWebhookConfiguration, error) {\n\t// load and validate configuration\n\twebhookConfigData, err := ioutil.ReadFile(webhookConfigFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar webhookConfig v1beta1.ValidatingWebhookConfiguration\n\tif err := yaml.Unmarshal(webhookConfigData, &webhookConfig); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not decode validatingwebhookconfiguration from %v: %v\",\n\t\t\twebhookConfigFile, err)\n\t}\n\n\t// fill in missing defaults to minimize desired vs. actual diffs later.\n\tfor i := 0; i < len(webhookConfig.Webhooks); i++ {\n\t\tif webhookConfig.Webhooks[i].FailurePolicy == nil {\n\t\t\tfailurePolicy := v1beta1.Fail\n\t\t\twebhookConfig.Webhooks[i].FailurePolicy = &failurePolicy\n\t\t}\n\t\tif webhookConfig.Webhooks[i].NamespaceSelector == nil {\n\t\t\twebhookConfig.Webhooks[i].NamespaceSelector = &metav1.LabelSelector{}\n\t\t}\n\t}\n\n\t// the webhook name is fixed at startup time\n\twebhookConfig.Name = webhookName\n\n\t// update ownerRefs so configuration is cleaned up when the galley's namespace is deleted.\n\twebhookConfig.OwnerReferences = ownerRefs\n\n\tin, err := os.Open(caFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read ca bundle from %v: %v\", caFile, err)\n\t}\n\tdefer in.Close() // nolint: errcheck\n\n\tcaPem, err := loadCaCertPem(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// patch the ca-cert into the user provided configuration\n\tfor i := range webhookConfig.Webhooks {\n\t\twebhookConfig.Webhooks[i].ClientConfig.CABundle = caPem\n\t}\n\n\treturn &webhookConfig, nil\n}", "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func MutatingWebhookConfigurationListHandler(ctx context.Context, list *admissionregistrationv1.MutatingWebhookConfigurationList, options Options) (component.Component, error) {\n\tif list == nil {\n\t\treturn nil, errors.New(\"mutating webhook configuration list is nil\")\n\t}\n\n\tcols := component.NewTableCols(\"Name\", \"Age\")\n\tot := NewObjectTable(\"Mutating Webhook Configurations\", \"We couldn't find any mutating webhook configurations!\", cols, options.DashConfig.ObjectStore())\n\n\tfor _, mutatingWebhookConfiguration := range list.Items {\n\t\trow := component.TableRow{}\n\t\tnameLink, err := options.Link.ForObject(&mutatingWebhookConfiguration, mutatingWebhookConfiguration.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trow[\"Name\"] = nameLink\n\t\tts := mutatingWebhookConfiguration.CreationTimestamp.Time\n\t\trow[\"Age\"] = component.NewTimestamp(ts)\n\n\t\tif err := ot.AddRowForObject(ctx, &mutatingWebhookConfiguration, row); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"add row for object: %w\", err)\n\t\t}\n\t}\n\n\treturn ot.ToComponent()\n}", "func (in *MutatingWebhookConfigurationRef) DeepCopyInto(out *MutatingWebhookConfigurationRef) {\n\t*out = *in\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func (in *DebugHookConfig) DeepCopy() *DebugHookConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DebugHookConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ConfigFromWebhookURL(webhookURL url.URL) (*Config, format.PropKeyResolver, error) {\n\tconfig, pkr := DefaultConfig()\n\n\tconfig.webhookURL = &webhookURL\n\t// TODO: Decide what to do with custom URL queries. Right now they are passed\n\t// to the inner url.URL and not processed by PKR.\n\t// customQuery, err := format.SetConfigPropsFromQuery(&pkr, webhookURL.Query())\n\t// goland:noinspection GoNilness: SetConfigPropsFromQuery always return non-nil\n\t// config.webhookURL.RawQuery = customQuery.Encode()\n\tconfig.DisableTLS = webhookURL.Scheme == \"http\"\n\treturn config, pkr, nil\n}", "func (in *WebuiConfig) DeepCopy() *WebuiConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebuiConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewWebhookConfigController(p WebhookParameters) (*WebhookConfigController, error) {\n\n\t// Configuration must be updated whenever the caBundle changes. watch the parent directory of\n\t// the target files so we can catch symlink updates of k8s secrets.\n\tfileWatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, file := range []string{p.CACertFile, p.WebhookConfigFile} {\n\t\twatchDir, _ := filepath.Split(file)\n\t\tif err := fileWatcher.Watch(watchDir); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not watch %v: %v\", file, err)\n\t\t}\n\t}\n\n\twhc := &WebhookConfigController{\n\t\tconfigWatcher: fileWatcher,\n\t\twebhookParameters: &p,\n\t\tcreateInformerWebhookSource: defaultCreateInformerWebhookSource,\n\t}\n\n\tgalleyNamespace, err := whc.webhookParameters.Clientset.CoreV1().Namespaces().Get(\n\t\twhc.webhookParameters.DeploymentAndServiceNamespace, metav1.GetOptions{})\n\tif err != nil {\n\t\tscope.Warnf(\"Could not find %s namespace to set ownerRef. \"+\n\t\t\t\"The validatingwebhookconfiguration must be deleted manually\",\n\t\t\twhc.webhookParameters.DeploymentAndServiceNamespace)\n\t} else {\n\t\twhc.ownerRefs = []metav1.OwnerReference{\n\t\t\t*metav1.NewControllerRef(\n\t\t\t\tgalleyNamespace,\n\t\t\t\tcorev1.SchemeGroupVersion.WithKind(\"Namespace\"),\n\t\t\t),\n\t\t}\n\t}\n\n\treturn whc, nil\n}", "func (in *LoggingConfigurationSpec) DeepCopy() *LoggingConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configurator) DeepCopy() *Configurator {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configurator)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewListAdmissionregistrationV1MutatingWebhookConfiguration(ctx *middleware.Context, handler ListAdmissionregistrationV1MutatingWebhookConfigurationHandler) *ListAdmissionregistrationV1MutatingWebhookConfiguration {\n\treturn &ListAdmissionregistrationV1MutatingWebhookConfiguration{Context: ctx, Handler: handler}\n}", "func (c *Client) CreateMutatingWebhookConfigurationV1beta1(cfg *hook.MutatingWebhookConfiguration) (*hook.MutatingWebhookConfiguration, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.admissionv1beta1.MutatingWebhookConfigurations().Create(context.TODO(), cfg, metav1.CreateOptions{})\n}", "func ReconcileSeedWebhookConfig(ctx context.Context, c client.Client, webhookConfig client.Object, ownerNamespace string, caBundle []byte) error {\n\tvar ownerReference *metav1.OwnerReference\n\tif len(ownerNamespace) > 0 {\n\t\tns := &corev1.Namespace{}\n\t\tif err := c.Get(ctx, client.ObjectKey{Name: ownerNamespace}, ns); err != nil {\n\t\t\treturn err\n\t\t}\n\t\townerReference = metav1.NewControllerRef(ns, corev1.SchemeGroupVersion.WithKind(\"Namespace\"))\n\t\townerReference.BlockOwnerDeletion = pointer.Bool(false)\n\t}\n\n\tdesiredWebhookConfig := webhookConfig.DeepCopyObject().(client.Object)\n\n\tif _, err := controllerutils.GetAndCreateOrStrategicMergePatch(ctx, c, webhookConfig, func() error {\n\t\tif ownerReference != nil {\n\t\t\twebhookConfig.SetOwnerReferences(kubernetes.MergeOwnerReferences(webhookConfig.GetOwnerReferences(), *ownerReference))\n\t\t}\n\n\t\tif len(caBundle) == 0 {\n\t\t\tvar err error\n\t\t\t// we can safely assume, that the CA bundles in all webhooks are the same, as we manage it ourselves\n\t\t\tcaBundle, err = GetCABundleFromWebhookConfig(webhookConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := InjectCABundleIntoWebhookConfig(desiredWebhookConfig, caBundle); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn OverwriteWebhooks(webhookConfig, desiredWebhookConfig)\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error reconciling seed webhook config: %w\", err)\n\t}\n\n\treturn nil\n}", "func (in *KubemanagerConfig) DeepCopy() *KubemanagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubemanagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func BuildWebhookConfigs(\n\twebhooks []*Webhook,\n\tc client.Client,\n\tnamespace, providerName string,\n\tservicePort int,\n\tmode, url string,\n\tcaBundle []byte,\n) (\n\tseedWebhookConfig client.Object,\n\tshootWebhookConfig *admissionregistrationv1.MutatingWebhookConfiguration,\n\terr error,\n) {\n\tvar (\n\t\texact = admissionregistrationv1.Exact\n\t\tsideEffects = admissionregistrationv1.SideEffectClassNone\n\n\t\tseedWebhooks []admissionregistrationv1.MutatingWebhook\n\t\tshootWebhooks []admissionregistrationv1.MutatingWebhook\n\t)\n\n\tfor _, webhook := range webhooks {\n\t\tvar rules []admissionregistrationv1.RuleWithOperations\n\n\t\tfor _, t := range webhook.Types {\n\t\t\trule, err := buildRule(c, t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\trules = append(rules, *rule)\n\t\t}\n\n\t\twebhookToRegister := admissionregistrationv1.MutatingWebhook{\n\t\t\tAdmissionReviewVersions: []string{\"v1\", \"v1beta1\"},\n\t\t\tName: fmt.Sprintf(\"%s.%s.extensions.gardener.cloud\", webhook.Name, strings.TrimPrefix(providerName, \"provider-\")),\n\t\t\tNamespaceSelector: webhook.Selector,\n\t\t\tObjectSelector: webhook.ObjectSelector,\n\t\t\tRules: rules,\n\t\t\tSideEffects: &sideEffects,\n\t\t\tTimeoutSeconds: pointer.Int32(10),\n\t\t}\n\n\t\tif webhook.TimeoutSeconds != nil {\n\t\t\twebhookToRegister.TimeoutSeconds = webhook.TimeoutSeconds\n\t\t}\n\n\t\tshootMode := ModeURLWithServiceName\n\t\tif mode == ModeURL {\n\t\t\tshootMode = ModeURL\n\t\t}\n\n\t\tswitch webhook.Target {\n\t\tcase TargetSeed:\n\t\t\twebhookToRegister.FailurePolicy = getFailurePolicy(admissionregistrationv1.Fail, webhook.FailurePolicy)\n\t\t\twebhookToRegister.MatchPolicy = &exact\n\t\t\twebhookToRegister.ClientConfig = BuildClientConfigFor(webhook.Path, namespace, providerName, servicePort, mode, url, caBundle)\n\t\t\tseedWebhooks = append(seedWebhooks, webhookToRegister)\n\t\tcase TargetShoot:\n\t\t\twebhookToRegister.FailurePolicy = getFailurePolicy(admissionregistrationv1.Ignore, webhook.FailurePolicy)\n\t\t\twebhookToRegister.MatchPolicy = &exact\n\t\t\twebhookToRegister.ClientConfig = BuildClientConfigFor(webhook.Path, namespace, providerName, servicePort, shootMode, url, caBundle)\n\t\t\tshootWebhooks = append(shootWebhooks, webhookToRegister)\n\t\tdefault:\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid webhook target: %s\", webhook.Target)\n\t\t}\n\t}\n\n\t// if all webhooks for one target are removed in a new version, extensions need to explicitly delete the respective\n\t// webhook config\n\tif len(seedWebhooks) > 0 {\n\t\tseedWebhookConfig = &admissionregistrationv1.MutatingWebhookConfiguration{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: NamePrefix + providerName,\n\t\t\t\tLabels: map[string]string{v1beta1constants.LabelExcludeWebhookFromRemediation: \"true\"},\n\t\t\t},\n\t\t\tWebhooks: seedWebhooks,\n\t\t}\n\t}\n\n\tif len(shootWebhooks) > 0 {\n\t\tshootWebhookConfig = &admissionregistrationv1.MutatingWebhookConfiguration{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: NamePrefix + providerName + NameSuffixShoot,\n\t\t\t\tLabels: map[string]string{v1beta1constants.LabelExcludeWebhookFromRemediation: \"true\"},\n\t\t\t},\n\t\t\tWebhooks: shootWebhooks,\n\t\t}\n\t}\n\n\treturn seedWebhookConfig, shootWebhookConfig, nil\n}", "func (in *NotificationsConfig) DeepCopy() *NotificationsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotifyConfigurationType) DeepCopy() *NotifyConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotifyConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UpdateConfig) DeepCopy() *UpdateConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UpdateConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *NormalizedProjectRevisionHook) SetWebHookConfigBody(v string) {\n\to.WebHookConfigBody = &v\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerConfiguration) DeepCopy() *ControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OCIConfiguration) DeepCopy() *OCIConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OCIConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Convert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(in *WebhookConfiguration, out *config.WebhookConfiguration, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_WebhookConfiguration_To_config_WebhookConfiguration(in, out, s)\n}", "func (in *KalmConfig) DeepCopy() *KalmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KalmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (secretsManager *SecretsManagerV2) UpdateConfigurationWithContext(ctx context.Context, updateConfigurationOptions *UpdateConfigurationOptions) (result ConfigurationIntf, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(updateConfigurationOptions, \"updateConfigurationOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(updateConfigurationOptions, \"updateConfigurationOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"name\": *updateConfigurationOptions.Name,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.PATCH)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/configurations/{name}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range updateConfigurationOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"UpdateConfiguration\")\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\tif updateConfigurationOptions.XSmAcceptConfigurationType != nil {\n\t\tbuilder.AddHeader(\"X-Sm-Accept-Configuration-Type\", fmt.Sprint(*updateConfigurationOptions.XSmAcceptConfigurationType))\n\t}\n\n\t_, err = builder.SetBodyContentJSON(updateConfigurationOptions.ConfigurationPatch)\n\tif err != nil {\n\t\treturn\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 = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalConfiguration)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (in *JobConfig) DeepCopy() *JobConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(JobConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (proxyConfig *ProxyConfig) DeepCopy() *ProxyConfig {\n\tif proxyConfig == nil {\n\t\treturn nil\n\t}\n\tcloned := ProxyConfig{}\n\tcloned = *proxyConfig\n\tcloned.LinkProxyConfig = proxyConfig.LinkProxyConfig.DeepCopy()\n\tcloned.StandAloneProxyConfig = proxyConfig.StandAloneProxyConfig.DeepCopy()\n\treturn &cloned\n}", "func (in *ApplicationConfigurationList) DeepCopy() *ApplicationConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MongoDBConfiguration) DeepCopy() *MongoDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func OverwriteWebhooks(current, desired client.Object) error {\n\tswitch config := current.(type) {\n\tcase *admissionregistrationv1.MutatingWebhookConfiguration:\n\t\td := desired.(*admissionregistrationv1.MutatingWebhookConfiguration)\n\t\tconfig.Webhooks = d.DeepCopy().Webhooks\n\tcase *admissionregistrationv1.ValidatingWebhookConfiguration:\n\t\td := desired.(*admissionregistrationv1.ValidatingWebhookConfiguration)\n\t\tconfig.Webhooks = d.DeepCopy().Webhooks\n\tcase *admissionregistrationv1beta1.MutatingWebhookConfiguration:\n\t\td := desired.(*admissionregistrationv1beta1.MutatingWebhookConfiguration)\n\t\tconfig.Webhooks = d.DeepCopy().Webhooks\n\tcase *admissionregistrationv1beta1.ValidatingWebhookConfiguration:\n\t\td := desired.(*admissionregistrationv1beta1.ValidatingWebhookConfiguration)\n\t\tconfig.Webhooks = d.DeepCopy().Webhooks\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected webhook config type: %T\", current)\n\t}\n\n\treturn nil\n}", "func (cm *CertificateManager) updateWebhookConfigs(ctx context.Context, caCertData []byte) error {\n\tcm.opts.Logger.Info(\"Updating webhook configs with CA bundle\")\n\n\t// Update validating webhooks with new CA data.\n\tlabelSelector, err := metav1.ParseToLabelSelector(cm.opts.WebhookConfigLabel)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse webhook label: %w\", err)\n\t}\n\tmatchLabels := client.MatchingLabels(labelSelector.MatchLabels)\n\tvalidatingWebhookList := &adminregv1.ValidatingWebhookConfigurationList{}\n\tif err := cm.opts.Client.List(ctx, validatingWebhookList, matchLabels); err != nil && !apierrors.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to list validating webhooks: %w\", err)\n\t}\n\n\tfor i := range validatingWebhookList.Items {\n\t\twebhookConfig := validatingWebhookList.Items[i]\n\t\tfor i := range webhookConfig.Webhooks {\n\t\t\twebhookConfig.Webhooks[i].ClientConfig.CABundle = caCertData\n\t\t}\n\n\t\tif err := cm.opts.Client.Update(ctx, &webhookConfig); err != nil {\n\t\t\tif !apierrors.IsConflict(err) {\n\t\t\t\treturn fmt.Errorf(\"failed to update validating webhook configuration %s/%s: %w\", webhookConfig.Namespace, webhookConfig.Name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Update mutating webhooks with new CA data.\n\tmutatingWebhookList := &adminregv1.MutatingWebhookConfigurationList{}\n\tif err := cm.opts.Client.List(ctx, mutatingWebhookList, matchLabels); err != nil && !apierrors.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to list mutating webhooks: %w\", err)\n\t}\n\n\tfor i := range mutatingWebhookList.Items {\n\t\twebhookConfig := mutatingWebhookList.Items[i]\n\t\tfor i := range webhookConfig.Webhooks {\n\t\t\twebhookConfig.Webhooks[i].ClientConfig.CABundle = caCertData\n\t\t}\n\n\t\tif err := cm.opts.Client.Update(ctx, &webhookConfig); err != nil {\n\t\t\tif !apierrors.IsConflict(err) {\n\t\t\t\treturn fmt.Errorf(\"failed to update mutating webhook configuration %s/%s: %w\", webhookConfig.Namespace, webhookConfig.Name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (in *AWSConfiguration) DeepCopy() *AWSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVConfiguration) DeepCopy() *KVConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CheConfig) DeepCopy() *CheConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CheConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfigurationList) DeepCopy() *LoggingConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (td *OsmTestData) GetMutatingWebhook(mwhcName string) (*admissionregv1.MutatingWebhookConfiguration, error) {\n\tmwhc, err := td.Client.AdmissionregistrationV1().MutatingWebhookConfigurations().Get(context.Background(), mwhcName, metav1.GetOptions{})\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Could not get MutatingWebhook: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn mwhc, nil\n}", "func Convert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in *config.WebhookConfiguration, out *WebhookConfiguration, s conversion.Scope) error {\n\treturn autoConvert_config_WebhookConfiguration_To_v1alpha1_WebhookConfiguration(in, out, s)\n}", "func (in *SecretAccessRequestConfiguration) DeepCopy() *SecretAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretboxConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c Configuration) Clone() Configuration {\n\treturn Configuration{\n\t\tEDATool: c.EDATool,\n\t\tInputFile: c.InputFile,\n\t\tOutputFile: c.OutputFile,\n\t\tLastUpdated: c.LastUpdated,\n\t}\n}", "func (c *Client) UpdateMutatingWebhookConfigurationV1beta1(cfg *hook.MutatingWebhookConfiguration) (*hook.MutatingWebhookConfiguration, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.admissionv1beta1.MutatingWebhookConfigurations().Update(context.TODO(), cfg, metav1.UpdateOptions{})\n}", "func (o *ListAdmissionregistrationV1ValidatingWebhookConfigurationOK) WithPayload(payload *models.IoK8sAPIAdmissionregistrationV1ValidatingWebhookConfigurationList) *ListAdmissionregistrationV1ValidatingWebhookConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "func (in *AzureConfiguration) DeepCopy() *AzureConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LandscaperConfiguration) DeepCopy() *LandscaperConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LandscaperConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (whc *WebhookConfigController) rebuildWebhookConfig() error {\n\twebhookConfig, err := rebuildWebhookConfigHelper(\n\t\twhc.webhookParameters.CACertFile,\n\t\twhc.webhookParameters.WebhookConfigFile,\n\t\twhc.webhookParameters.WebhookName,\n\t\twhc.ownerRefs)\n\tif err != nil {\n\t\treportValidationConfigLoadError(err)\n\t\tscope.Errorf(\"validatingwebhookconfiguration (re)load failed: %v\", err)\n\t\treturn err\n\t}\n\twhc.webhookConfiguration = webhookConfig\n\n\t// pretty-print the validatingwebhookconfiguration as YAML\n\tvar webhookYAML string\n\tif b, err := yaml.Marshal(whc.webhookConfiguration); err == nil {\n\t\twebhookYAML = string(b)\n\t}\n\tscope.Infof(\"%v validatingwebhookconfiguration (re)loaded: \\n%v\",\n\t\twhc.webhookConfiguration.Name, webhookYAML)\n\n\treportValidationConfigLoad()\n\n\treturn nil\n}", "func (in *AdmissionWebhookConfiguration) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SensuCheckConfig) DeepCopy() *SensuCheckConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuCheckConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BootConfiguration) DeepCopy() *BootConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BootConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceConfiguration) DeepCopy() *ResourceConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Consumer) UpdateConfiguration(opts ...ConsumerOption) error {\n\tif !c.IsDurable() {\n\t\treturn fmt.Errorf(\"only durable consumers can be updated\")\n\t}\n\n\tncfg, err := NewConsumerConfiguration(*c.cfg, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.mgr.NewConsumerFromDefault(c.stream, *ncfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Reset()\n}", "func (o *NormalizedProjectRevisionHook) GetWebHookConfigUrl() string {\n\tif o == nil || o.WebHookConfigUrl == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.WebHookConfigUrl\n}", "func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7793853", "0.7489177", "0.7276248", "0.7276248", "0.6999186", "0.68108094", "0.63378036", "0.6257152", "0.6257152", "0.6191447", "0.60581696", "0.5876469", "0.5876469", "0.58589596", "0.58589596", "0.58589596", "0.5825608", "0.56981975", "0.56957376", "0.56651753", "0.56275606", "0.5602579", "0.5599224", "0.55150276", "0.5468939", "0.5461338", "0.54520863", "0.5433519", "0.54270846", "0.54177475", "0.5408949", "0.54018945", "0.53971183", "0.53716147", "0.53419334", "0.5331104", "0.52519655", "0.52064943", "0.51972693", "0.5195037", "0.51855516", "0.5179715", "0.5161367", "0.5149339", "0.51491606", "0.5123171", "0.50851524", "0.5083609", "0.5082624", "0.50818765", "0.5080742", "0.50806075", "0.5078702", "0.5077836", "0.5066548", "0.5064814", "0.5048797", "0.5047464", "0.5044181", "0.5042737", "0.5020464", "0.5020453", "0.5014586", "0.50137657", "0.5002434", "0.5002434", "0.49959245", "0.4987898", "0.49842924", "0.49830043", "0.49713695", "0.49678016", "0.49652907", "0.49643382", "0.4960973", "0.49572808", "0.49475408", "0.49301887", "0.49244294", "0.49180633", "0.49142474", "0.48872265", "0.4884487", "0.487846", "0.48770297", "0.48672196", "0.48655766", "0.4855814", "0.48406166", "0.48272306", "0.48212582", "0.48064464", "0.48026294", "0.47919038", "0.47867924", "0.4781759", "0.477464", "0.47695917", "0.47615638", "0.47531635" ]
0.8851851
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *Ref) DeepCopyInto(out *Ref) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8215289", "0.81280124", "0.81039286", "0.80862963", "0.8083811", "0.80673146", "0.8064545", "0.8026454", "0.8012046", "0.7996313", "0.799204", "0.79887754", "0.7987097", "0.7986994", "0.7986994", "0.79854053", "0.7975989", "0.7972486", "0.79695636", "0.79695636", "0.79695636", "0.7967528", "0.79624444", "0.7961954", "0.7945754", "0.7945754", "0.7944541", "0.79428566", "0.7942668", "0.7942668", "0.7940451", "0.793851", "0.7936731", "0.79294837", "0.79252166", "0.7915377", "0.7911627", "0.7911138", "0.7909384", "0.790913", "0.7908773", "0.7905649", "0.79050326", "0.7904594", "0.7904594", "0.7904235", "0.79036915", "0.79020816", "0.78988886", "0.78977424", "0.7891376", "0.7891024", "0.7889831", "0.78890276", "0.7887135", "0.788637", "0.7885264", "0.7885264", "0.7884786", "0.7880785", "0.78745943", "0.78745943", "0.78745407", "0.78734446", "0.78724426", "0.78713626", "0.78713554", "0.78652424", "0.7863321", "0.7863321", "0.7863321", "0.7863293", "0.7862628", "0.7860664", "0.7858556", "0.785785", "0.78571486", "0.7851332", "0.78448987", "0.78415996", "0.7837483", "0.7837037", "0.7836443", "0.78351796", "0.78329664", "0.7831094", "0.7829445", "0.7826582", "0.7824499", "0.78242797", "0.78227437", "0.78192484", "0.7818843", "0.78128535", "0.7812535", "0.78111476", "0.78111106", "0.781107", "0.78093034", "0.7808775" ]
0.78453225
78
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Ref.
func (in *Ref) DeepCopy() *Ref { if in == nil { return nil } out := new(Ref) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *GitRef) DeepCopy() *GitRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RefSpec) DeepCopy() *RefSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RefSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RefSpec) DeepCopy() *RefSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RefSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ChartRef) DeepCopy() *ChartRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChartRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FieldRef) DeepCopy() *FieldRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FieldRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Reference) DeepCopy() *Reference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Reference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RuntimeRef) DeepCopy() *RuntimeRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RuntimeRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectRef) DeepCopy() *ObjectRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectRef) DeepCopy() *ObjectRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RouteRef) DeepCopy() *RouteRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RouteRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRef) DeepCopy() *CertificateRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (e *HTMLApplet) Ref(dest *DOMElement) *HTMLApplet {\n\te.ref = dest\n\treturn e\n}", "func (in *ServiceRef) DeepCopy() *ServiceRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (ref Ref) Copy() Ref {\n\treturn termSliceCopy(ref)\n}", "func (in *AppRef) DeepCopy() *AppRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShootRef) DeepCopy() *ShootRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShootRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderRef) DeepCopy() *ProviderRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (snapshot *DataSnapshot) Ref() *Reference {\n\treturn snapshot.ref\n}", "func (ref Collections) Ref(c collection.SeqNum) collection.Reference {\n\treturn Collection{\n\t\trepo: ref.repo,\n\t\tdrive: ref.drive,\n\t\tcollection: c,\n\t}\n}", "func (in *RemoteReference) DeepCopy() *RemoteReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RemoteReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrometheusRuleRef) DeepCopy() *PrometheusRuleRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrometheusRuleRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TaskRef) DeepCopy() *TaskRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TaskRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BuildReference) DeepCopy() *BuildReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BuildReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Ref(ref string) interface{} {\n\treturn struct {\n\t\tRef string `json:\"$ref\"`\n\t}{\n\t\tRef: ref,\n\t}\n}", "func (in *ServiceAccountRef) DeepCopy() *ServiceAccountRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceAccountRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (r *QualifiedRef) Clone() *QualifiedRef {\n\tif r == nil {\n\t\treturn nil\n\t}\n\tother := *r\n\tother.Table = r.Table.Clone()\n\tother.Column = r.Column.Clone()\n\treturn &other\n}", "func (x *FzSha256) Ref() *C.fz_sha256 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_sha256)(unsafe.Pointer(x))\n}", "func (in *BuildTaskRef) DeepCopy() *BuildTaskRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BuildTaskRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzColorConverter) Ref() *C.fz_color_converter {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_color_converter)(unsafe.Pointer(x))\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzLink) Ref() *C.fz_link {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_link)(unsafe.Pointer(x))\n}", "func (x *JSClassDefinition) Ref() *C.JSClassDefinition {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref192c18d5\n}", "func (c FieldsCollection) Ref() *models.Field {\n\treturn c.MustGet(\"Ref\")\n}", "func (in *ObjectReference) DeepCopy() *ObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectReference) DeepCopy() *ObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectReference) DeepCopy() *ObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectReference) DeepCopy() *ObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectReference) DeepCopy() *ObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (n *NetworkService) Reference() *ReferenceObject {\n\tvar kind string\n\n\tswitch n.Kind {\n\tcase tcpUDPServiceObjectKind:\n\t\tkind = tcpUDPServiceObjectRefKind\n\tcase icmpServiceObjectKind:\n\t\tkind = icmpServiceObjectRefKind\n\tcase networkProtocolObjectKind:\n\t\tkind = networkProtocolObjectRefKind\n\t}\n\tr := ReferenceObject{\n\t\tKind: kind,\n\t\tObjectID: n.ObjectID,\n\t\tName: n.Name,\n\t}\n\n\treturn &r\n}", "func (x *Value) Ref() *C.YGValue {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref23e8c9e3\n}", "func (in *ResourceRefNamespaced) DeepCopy() *ResourceRefNamespaced {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRefNamespaced)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (e *HTMLTableRow) Ref(dest *DOMElement) *HTMLTableRow {\n\te.ref = dest\n\treturn e\n}", "func (x *ImVec2) Ref() *C.struct_ImVec2 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref74e98a33\n}", "func (in *ResourceRef) DeepCopy() *ResourceRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AppReference) DeepCopy() *AppReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AppReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (options *GetWorkspaceReadmeOptions) SetRef(ref string) *GetWorkspaceReadmeOptions {\n\toptions.Ref = core.StringPtr(ref)\n\treturn options\n}", "func (x *FzDocument) Ref() *C.fz_document {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_document)(unsafe.Pointer(x))\n}", "func (v *Component) Ref() string {\n\treturn v.id\n}", "func (x *FzSha384) Ref() *C.fz_sha384 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_sha384)(unsafe.Pointer(x))\n}", "func (recv *Object) Ref() Object {\n\tretC := C.g_object_ref((C.gpointer)(recv.native))\n\tretGo := *ObjectNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func (in *HistoryReference) DeepCopy() *HistoryReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HistoryReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DaemonsetRef) DeepCopy() *DaemonsetRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DaemonsetRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *PDFObj) Ref() *C.pdf_obj {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.pdf_obj)(unsafe.Pointer(x))\n}", "func (x *FzPath) Ref() *C.fz_path {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_path)(unsafe.Pointer(x))\n}", "func (x *PDFPattern) Ref() *C.pdf_pattern {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.pdf_pattern)(unsafe.Pointer(x))\n}", "func (in *PoolReference) DeepCopy() *PoolReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PoolReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzMd5) Ref() *C.fz_md5 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_md5)(unsafe.Pointer(x))\n}", "func (d UserData) SetRef(value string) m.UserData {\n\td.ModelData.Set(models.NewFieldName(\"Ref\", \"ref\"), value)\n\treturn d\n}", "func (x *FzIcclink) Ref() *C.fz_icclink {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_icclink)(unsafe.Pointer(x))\n}", "func (x *FzColorParams) Ref() *C.fz_color_params {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_color_params)(unsafe.Pointer(x))\n}", "func (o *GstObj) Ref(obj *GstObj) *GstObj {\n\tr := new(GstObj)\n\tr.SetPtr(glib.Pointer(C.gst_object_ref(C.gpointer(o.GetPtr()))))\n\treturn r\n}", "func (O *Object) ObjectRef() *Object {\n\treturn O\n}", "func (x *FzRect) Ref() *C.fz_rect {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_rect)(unsafe.Pointer(x))\n}", "func (v *Object) Ref() {\n\tC.g_object_ref(C.gpointer(v.ptr))\n}", "func (x *FzTree) Ref() *C.fz_tree {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_tree)(unsafe.Pointer(x))\n}", "func (x *FzSha256) PassRef() *C.fz_sha256 {\n\tif x == nil {\n\t\tx = (*FzSha256)(allocFzSha256Memory(1))\n\t}\n\treturn (*C.fz_sha256)(unsafe.Pointer(x))\n}", "func (in ObjectReferences) DeepCopy() ObjectReferences {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectReferences)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (x *FzShaperData) Ref() *C.fz_shaper_data_t {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_shaper_data_t)(unsafe.Pointer(x))\n}", "func (in *CertificateSecretRef) DeepCopy() *CertificateSecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzSha512) Ref() *C.fz_sha512 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_sha512)(unsafe.Pointer(x))\n}", "func (r *Repo) Ref() string {\n\tif len(r.Tag) > 0 {\n\t\treturn r.TagRef()\n\t} else if len(r.Branch) > 0 {\n\t\treturn r.BranchRef()\n\t} else if r.PR > 0 {\n\t\treturn r.PRRef()\n\t}\n\n\treturn \"\"\n}", "func (in *KeyVaultReference) DeepCopy() *KeyVaultReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeyVaultReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzIrect) Ref() *C.fz_irect {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_irect)(unsafe.Pointer(x))\n}", "func (x *FzAnnot) Ref() *C.fz_annot {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_annot)(unsafe.Pointer(x))\n}", "func (x *PDFXrefSubsec) Ref() *C.pdf_xref_subsec {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.pdf_xref_subsec)(unsafe.Pointer(x))\n}", "func (x *FzArc4) Ref() *C.fz_arc4 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_arc4)(unsafe.Pointer(x))\n}", "func (x *FzXml) Ref() *C.fz_xml {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_xml)(unsafe.Pointer(x))\n}", "func (in *MutatingWebhookConfigurationRef) DeepCopy() *MutatingWebhookConfigurationRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MutatingWebhookConfigurationRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DropletReference) DeepCopy() *DropletReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DropletReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzStoreHash) Ref() *C.fz_store_hash {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_store_hash)(unsafe.Pointer(x))\n}", "func (x *PDFXref) Ref() *C.pdf_xref {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.pdf_xref)(unsafe.Pointer(x))\n}", "func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrossVersionObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrossVersionObjectReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzBuffer) Ref() *C.fz_buffer {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_buffer)(unsafe.Pointer(x))\n}", "func (in *ServiceReference) DeepCopy() *ServiceReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ServiceReference) DeepCopy() *ServiceReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (ref CommitStates) Ref(stateNum commit.StateNum) commit.StateReference {\n\treturn CommitState{\n\t\trepo: ref.repo,\n\t\tdrive: ref.drive,\n\t\tcommit: ref.commit,\n\t\tstate: stateNum,\n\t}\n}", "func (in *TemplateReference) DeepCopy() *TemplateReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplateReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (x *FzLink) PassRef() *C.fz_link {\n\tif x == nil {\n\t\tx = (*FzLink)(allocFzLinkMemory(1))\n\t}\n\treturn (*C.fz_link)(unsafe.Pointer(x))\n}", "func (x *PDFRange) Ref() *C.pdf_range {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.pdf_range)(unsafe.Pointer(x))\n}", "func (in *ProviderRef) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "func (s UserSet) Ref() string {\n\tres, _ := s.RecordCollection.Get(models.NewFieldName(\"Ref\", \"ref\")).(string)\n\treturn res\n}", "func (x *FzPathWalker) Ref() *C.fz_path_walker {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_path_walker)(unsafe.Pointer(x))\n}", "func (x *FzBitmap) Ref() *C.fz_bitmap {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_bitmap)(unsafe.Pointer(x))\n}", "func (x *FzImage) Ref() *C.fz_image {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_image)(unsafe.Pointer(x))\n}", "func (in *SensuClusterRef) DeepCopy() *SensuClusterRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuClusterRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (d UserData) Ref() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"Ref\", \"ref\"))\n\tif !d.Has(models.NewFieldName(\"Ref\", \"ref\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (in *QualifiedIssuerRef) DeepCopy() *QualifiedIssuerRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(QualifiedIssuerRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.70822686", "0.6410743", "0.6410743", "0.6265839", "0.62535995", "0.62149656", "0.61250263", "0.6099854", "0.6099854", "0.6018698", "0.5982944", "0.5973794", "0.5952699", "0.5942301", "0.5941175", "0.58627886", "0.58217555", "0.5793365", "0.57277805", "0.5645848", "0.5640387", "0.55842716", "0.55662686", "0.5557602", "0.55490613", "0.55478334", "0.5531569", "0.547391", "0.54115254", "0.5408967", "0.5408967", "0.5408967", "0.5403576", "0.5363915", "0.5343396", "0.53429556", "0.53429556", "0.53429556", "0.53429556", "0.53429556", "0.53398657", "0.5339755", "0.53391266", "0.5317107", "0.53103364", "0.52870226", "0.5270046", "0.52585053", "0.5258311", "0.52504253", "0.5233816", "0.5206391", "0.5157331", "0.51564276", "0.51407284", "0.5120194", "0.511778", "0.5104243", "0.510412", "0.5102642", "0.5083519", "0.50747126", "0.50741166", "0.5065801", "0.50629026", "0.50570047", "0.50563407", "0.5056149", "0.50527185", "0.50407815", "0.503392", "0.5030841", "0.5027747", "0.5024578", "0.5023897", "0.5004724", "0.5004628", "0.5000388", "0.4981767", "0.49682713", "0.4967544", "0.49610862", "0.4951294", "0.4950247", "0.4950247", "0.49478707", "0.49461174", "0.49461174", "0.49420527", "0.4939106", "0.49256647", "0.49146307", "0.48938385", "0.48878533", "0.48863178", "0.48820925", "0.48763323", "0.4875249", "0.48717755", "0.48701155" ]
0.7920549
0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *SecretRef) DeepCopyInto(out *SecretRef) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8216088", "0.8128937", "0.81051093", "0.8086112", "0.80840266", "0.806814", "0.80643326", "0.80272067", "0.8013088", "0.79972315", "0.799318", "0.7988673", "0.79883105", "0.79879236", "0.79879236", "0.7986761", "0.79770774", "0.7973031", "0.7970074", "0.7970074", "0.7970074", "0.7968491", "0.7963908", "0.7962594", "0.79461676", "0.79461676", "0.79453707", "0.794318", "0.794318", "0.79430556", "0.7941854", "0.7939476", "0.7937904", "0.79294026", "0.7925471", "0.7917021", "0.79131836", "0.79123056", "0.7910745", "0.79105514", "0.79092926", "0.7906994", "0.79068947", "0.7905208", "0.7905208", "0.7904789", "0.7904576", "0.7902542", "0.789971", "0.7898187", "0.789275", "0.78916943", "0.78905755", "0.7889031", "0.7887323", "0.7887001", "0.78859967", "0.78859967", "0.788571", "0.7881972", "0.7875957", "0.7875957", "0.78754383", "0.78744066", "0.78725743", "0.7872079", "0.78715914", "0.7865343", "0.7863912", "0.7863912", "0.7863912", "0.78638506", "0.7863712", "0.7862366", "0.7859421", "0.7858547", "0.7857873", "0.78512096", "0.7847138", "0.78456485", "0.7841974", "0.78375477", "0.7837439", "0.78371376", "0.7835643", "0.7833311", "0.78312105", "0.7830207", "0.7828144", "0.7826242", "0.7825785", "0.782401", "0.7820985", "0.7819203", "0.78140086", "0.7812223", "0.7811996", "0.7811559", "0.78109616", "0.7809847", "0.7809696" ]
0.0
-1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretRef.
func (in *SecretRef) DeepCopy() *SecretRef { if in == nil { return nil } out := new(SecretRef) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *Secret) DeepCopy() *Secret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Secret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretKeyRef) DeepCopy() *SecretKeyRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretKeyRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigMapSecret) DeepCopy() *ConfigMapSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ToolchainSecret) DeepCopy() *ToolchainSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ToolchainSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateSecretRef) DeepCopy() *CertificateSecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateSecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RandomSecret) DeepCopy() *RandomSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RandomSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretInfo) DeepCopy() *SecretInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IopingSpecVolumeVolumeSourceRbdOutput) SecretRef() IopingSpecVolumeVolumeSourceRbdSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceRbd) *IopingSpecVolumeVolumeSourceRbdSecretRef { return v.SecretRef }).(IopingSpecVolumeVolumeSourceRbdSecretRefPtrOutput)\n}", "func (in *VaultSecret) DeepCopy() *VaultSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LicenseSecretRef) DeepCopy() *LicenseSecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LicenseSecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DopplerSecret) DeepCopy() *DopplerSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DopplerSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PasswordSecret) DeepCopy() *PasswordSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PasswordSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o BuildStrategySpecBuildStepsEnvFromOutput) SecretRef() BuildStrategySpecBuildStepsEnvFromSecretRefPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsEnvFrom) *BuildStrategySpecBuildStepsEnvFromSecretRef {\n\t\treturn v.SecretRef\n\t}).(BuildStrategySpecBuildStepsEnvFromSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceRbdOutput) SecretRef() FioSpecVolumeVolumeSourceRbdSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceRbd) *FioSpecVolumeVolumeSourceRbdSecretRef { return v.SecretRef }).(FioSpecVolumeVolumeSourceRbdSecretRefPtrOutput)\n}", "func (in *GitHubSecret) DeepCopy() *GitHubSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitHubSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *VaultSecretReference) DeepCopy() *VaultSecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CredentialSecret) DeepCopy() *CredentialSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CredentialSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRefSpec) DeepCopy() *SecretRefSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRefSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ImagePullSecret) DeepCopy() *ImagePullSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImagePullSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsSecret) DeepCopy() *BcsSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvFromOutput) SecretRef() ClusterBuildStrategySpecBuildStepsEnvFromSecretRefPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvFrom) *ClusterBuildStrategySpecBuildStepsEnvFromSecretRef {\n\t\treturn v.SecretRef\n\t}).(ClusterBuildStrategySpecBuildStepsEnvFromSecretRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceRbdPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceRbdSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceRbd) *IopingSpecVolumeVolumeSourceRbdSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceRbdSecretRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceCinderOutput) SecretRef() IopingSpecVolumeVolumeSourceCinderSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceCinder) *IopingSpecVolumeVolumeSourceCinderSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceCinderSecretRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceIscsiOutput) SecretRef() IopingSpecVolumeVolumeSourceIscsiSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceIscsi) *IopingSpecVolumeVolumeSourceIscsiSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceIscsiSecretRefPtrOutput)\n}", "func (in *StringSecret) DeepCopy() *StringSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StringSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IopingSpecVolumeVolumeSourceStorageosOutput) SecretRef() IopingSpecVolumeVolumeSourceStorageosSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceStorageos) *IopingSpecVolumeVolumeSourceStorageosSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceStorageosSecretRefPtrOutput)\n}", "func (o BuildStrategySpecBuildStepsEnvValueFromOutput) SecretKeyRef() BuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsEnvValueFrom) *BuildStrategySpecBuildStepsEnvValueFromSecretKeyRef {\n\t\treturn v.SecretKeyRef\n\t}).(BuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceCinderOutput) SecretRef() FioSpecVolumeVolumeSourceCinderSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCinder) *FioSpecVolumeVolumeSourceCinderSecretRef { return v.SecretRef }).(FioSpecVolumeVolumeSourceCinderSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceIscsiOutput) SecretRef() FioSpecVolumeVolumeSourceIscsiSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceIscsi) *FioSpecVolumeVolumeSourceIscsiSecretRef { return v.SecretRef }).(FioSpecVolumeVolumeSourceIscsiSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceRbdPtrOutput) SecretRef() FioSpecVolumeVolumeSourceRbdSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceRbd) *FioSpecVolumeVolumeSourceRbdSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceRbdSecretRefPtrOutput)\n}", "func (o VirtualDatabaseSpecBuildEnvValueFromOutput) SecretKeyRef() VirtualDatabaseSpecBuildEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecBuildEnvValueFrom) *VirtualDatabaseSpecBuildEnvValueFromSecretKeyRef {\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecBuildEnvValueFromSecretKeyRefPtrOutput)\n}", "func (in *MemberSecret) DeepCopy() *MemberSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MemberSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o FioSpecVolumeVolumeSourceStorageosOutput) SecretRef() FioSpecVolumeVolumeSourceStorageosSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceStorageos) *FioSpecVolumeVolumeSourceStorageosSecretRef {\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceStorageosSecretRefPtrOutput)\n}", "func (o VirtualDatabaseSpecEnvValueFromOutput) SecretKeyRef() VirtualDatabaseSpecEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecEnvValueFrom) *VirtualDatabaseSpecEnvValueFromSecretKeyRef {\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecEnvValueFromSecretKeyRefPtrOutput)\n}", "func (in *AWSCredentialsSecretReference) DeepCopy() *AWSCredentialsSecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSCredentialsSecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IopingSpecVolumeVolumeSourceIscsiPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceIscsiSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceIscsi) *IopingSpecVolumeVolumeSourceIscsiSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceIscsiSecretRefPtrOutput)\n}", "func (in *TemplatedSecret) DeepCopy() *TemplatedSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TemplatedSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o VirtualDatabaseSpecDatasourcesPropertiesValueFromOutput) SecretKeyRef() VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecDatasourcesPropertiesValueFrom) *VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRef {\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRefPtrOutput)\n}", "func (o BuildStrategySpecBuildStepsEnvValueFromPtrOutput) SecretKeyRef() BuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v *BuildStrategySpecBuildStepsEnvValueFrom) *BuildStrategySpecBuildStepsEnvValueFromSecretKeyRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretKeyRef\n\t}).(BuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput)\n}", "func (in *SecretSpec) DeepCopy() *SecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretSpec) DeepCopy() *SecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvValueFromOutput) SecretKeyRef() ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvValueFrom) *ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRef {\n\t\treturn v.SecretKeyRef\n\t}).(ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput)\n}", "func (in *NotificationSecret) DeepCopy() *NotificationSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *SharingKey) Secret(out *[32]byte) {\n\tcopy(out[:], s.secret)\n}", "func (o IopingSpecVolumeVolumeSourceCephfsOutput) SecretRef() IopingSpecVolumeVolumeSourceCephfsSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceCephfs) *IopingSpecVolumeVolumeSourceCephfsSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceCephfsSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceIscsiPtrOutput) SecretRef() FioSpecVolumeVolumeSourceIscsiSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceIscsi) *FioSpecVolumeVolumeSourceIscsiSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceIscsiSecretRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceCinderPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceCinderSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceCinder) *IopingSpecVolumeVolumeSourceCinderSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceCinderSecretRefPtrOutput)\n}", "func (o VirtualDatabaseSpecBuildEnvValueFromPtrOutput) SecretKeyRef() VirtualDatabaseSpecBuildEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecBuildEnvValueFrom) *VirtualDatabaseSpecBuildEnvValueFromSecretKeyRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecBuildEnvValueFromSecretKeyRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceCephfsOutput) SecretRef() FioSpecVolumeVolumeSourceCephfsSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCephfs) *FioSpecVolumeVolumeSourceCephfsSecretRef { return v.SecretRef }).(FioSpecVolumeVolumeSourceCephfsSecretRefPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvValueFromPtrOutput) SecretKeyRef() ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsEnvValueFrom) *ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretKeyRef\n\t}).(ClusterBuildStrategySpecBuildStepsEnvValueFromSecretKeyRefPtrOutput)\n}", "func Secret(s *dag.Secret) *envoy_api_v2_auth.Secret {\n\treturn &envoy_api_v2_auth.Secret{\n\t\tName: Secretname(s),\n\t\tType: &envoy_api_v2_auth.Secret_TlsCertificate{\n\t\t\tTlsCertificate: &envoy_api_v2_auth.TlsCertificate{\n\t\t\t\tPrivateKey: &envoy_api_v2_core.DataSource{\n\t\t\t\t\tSpecifier: &envoy_api_v2_core.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.PrivateKey(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tCertificateChain: &envoy_api_v2_core.DataSource{\n\t\t\t\t\tSpecifier: &envoy_api_v2_core.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.Cert(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (o FioSpecVolumeVolumeSourceCinderPtrOutput) SecretRef() FioSpecVolumeVolumeSourceCinderSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceCinder) *FioSpecVolumeVolumeSourceCinderSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceCinderSecretRefPtrOutput)\n}", "func (o VirtualDatabaseSpecEnvValueFromPtrOutput) SecretKeyRef() VirtualDatabaseSpecEnvValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecEnvValueFrom) *VirtualDatabaseSpecEnvValueFromSecretKeyRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecEnvValueFromSecretKeyRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceScaleIOOutput) SecretRef() IopingSpecVolumeVolumeSourceScaleIOSecretRefOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceScaleIO) IopingSpecVolumeVolumeSourceScaleIOSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceScaleIOSecretRefOutput)\n}", "func (s Keygen) Secret() *party.Secret {\n\treturn &party.Secret{\n\t\tID: s.selfID,\n\t}\n}", "func (g *Guard) Secret(v []byte) (*Secret, error) {\n\tg.lock.Lock()\n\tdefer g.lock.Unlock()\n\n\tb, err := memguard.NewMutableFromBytes(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := Secret{\n\t\tbuffer: b,\n\t\tguard: g,\n\t}\n\n\tg.secrets = append(g.secrets, &s)\n\treturn &s, nil\n}", "func (o VirtualDatabaseSpecDatasourcesPropertiesValueFromPtrOutput) SecretKeyRef() VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRefPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecDatasourcesPropertiesValueFrom) *VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretKeyRef\n\t}).(VirtualDatabaseSpecDatasourcesPropertiesValueFromSecretKeyRefPtrOutput)\n}", "func (in *RegistrySecret) DeepCopy() *RegistrySecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistrySecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IopingSpecVolumeVolumeSourceStorageosPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceStorageosSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceStorageos) *IopingSpecVolumeVolumeSourceStorageosSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceStorageosSecretRefPtrOutput)\n}", "func Secret(s *dag.Secret) *envoy_tls_v3.Secret {\n\treturn &envoy_tls_v3.Secret{\n\t\tName: envoy.Secretname(s),\n\t\tType: &envoy_tls_v3.Secret_TlsCertificate{\n\t\t\tTlsCertificate: &envoy_tls_v3.TlsCertificate{\n\t\t\t\tPrivateKey: &envoy_core_v3.DataSource{\n\t\t\t\t\tSpecifier: &envoy_core_v3.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.PrivateKey(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tCertificateChain: &envoy_core_v3.DataSource{\n\t\t\t\t\tSpecifier: &envoy_core_v3.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.Cert(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (in *ConfigMapSecretList) DeepCopy() *ConfigMapSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *configuration) Secret(clientSet ClientSet) *Secret {\n\tif clientSet != nil {\n\t\treturn NewSecret(clientSet)\n\t}\n\treturn nil\n\n}", "func (o IopingSpecVolumeVolumeSourceFlexVolumeOutput) SecretRef() IopingSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceFlexVolume) *IopingSpecVolumeVolumeSourceFlexVolumeSecretRef {\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput)\n}", "func (in *BcsSecretList) DeepCopy() *BcsSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IopingSpecVolumeVolumeSourceScaleIOPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceScaleIOSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceScaleIO) *IopingSpecVolumeVolumeSourceScaleIOSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceScaleIOSecretRefPtrOutput)\n}", "func (s Sign) Secret() *party.Secret {\n\treturn s.secret\n}", "func (o FioSpecVolumeVolumeSourceFlexVolumeOutput) SecretRef() FioSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceFlexVolume) *FioSpecVolumeVolumeSourceFlexVolumeSecretRef {\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceScaleIOOutput) SecretRef() FioSpecVolumeVolumeSourceScaleIOSecretRefOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceScaleIO) FioSpecVolumeVolumeSourceScaleIOSecretRef { return v.SecretRef }).(FioSpecVolumeVolumeSourceScaleIOSecretRefOutput)\n}", "func (o FioSpecVolumeVolumeSourceStorageosPtrOutput) SecretRef() FioSpecVolumeVolumeSourceStorageosSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceStorageos) *FioSpecVolumeVolumeSourceStorageosSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceStorageosSecretRefPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceCephfsPtrOutput) SecretRef() IopingSpecVolumeVolumeSourceCephfsSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceCephfs) *IopingSpecVolumeVolumeSourceCephfsSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceCephfsSecretRefPtrOutput)\n}", "func (in *CheSecret) DeepCopy() *CheSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CheSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RandomSecretList) DeepCopy() *RandomSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RandomSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o FioSpecVolumeVolumeSourceScaleIOPtrOutput) SecretRef() FioSpecVolumeVolumeSourceScaleIOSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceScaleIO) *FioSpecVolumeVolumeSourceScaleIOSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceScaleIOSecretRefPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceCephfsPtrOutput) SecretRef() FioSpecVolumeVolumeSourceCephfsSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceCephfs) *FioSpecVolumeVolumeSourceCephfsSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceCephfsSecretRefPtrOutput)\n}", "func (o FunctionServiceConfigSecretEnvironmentVariableOutput) Secret() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FunctionServiceConfigSecretEnvironmentVariable) string { return v.Secret }).(pulumi.StringOutput)\n}", "func (in *DopplerSecretList) DeepCopy() *DopplerSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DopplerSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Secret) DeepEqual(other *Secret) bool {\n\tif other == nil {\n\t\treturn false\n\t}\n\n\tif in.Namespace != other.Namespace {\n\t\treturn false\n\t}\n\tif in.Name != other.Name {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (in *VaultSecretList) DeepCopy() *VaultSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o IdentityAwareProxyClientOutput) Secret() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *IdentityAwareProxyClient) pulumi.StringOutput { return v.Secret }).(pulumi.StringOutput)\n}", "func (in *StringSecretList) DeepCopy() *StringSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StringSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o FioSpecVolumeVolumeSourceFlexVolumePtrOutput) SecretRef() FioSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceFlexVolume) *FioSpecVolumeVolumeSourceFlexVolumeSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(FioSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput)\n}", "func (k Key) Secret() []byte {\n\treturn k.secret\n}", "func GetSecret(client client.Client, parentNamespace string, secretRef *corev1.ObjectReference) (secret *corev1.Secret, err error) {\n\tsrLogger := log.WithValues(\"package\", \"utils\", \"method\", \"getSecret\")\n\tif secretRef != nil {\n\t\tsrLogger.Info(\"Retreive secret\", \"parentNamespace\", parentNamespace, \"secretRef\", secretRef)\n\t\tns := secretRef.Namespace\n\t\tif ns == \"\" {\n\t\t\tns = parentNamespace\n\t\t}\n\t\tsecret = &corev1.Secret{}\n\t\terr = client.Get(context.TODO(), types.NamespacedName{Namespace: ns, Name: secretRef.Name}, secret)\n\t\tif err != nil {\n\t\t\tsrLogger.Error(err, \"Failed to get secret \", \"Name:\", secretRef.Name, \" on namespace: \", secretRef.Namespace)\n\t\t\treturn nil, err\n\t\t}\n\t\tsrLogger.Info(\"Secret found \", \"Name:\", secretRef.Name, \" on namespace: \", secretRef.Namespace)\n\t} else {\n\t\tsrLogger.Info(\"No secret defined\", \"parentNamespace\", parentNamespace)\n\t}\n\treturn secret, err\n}", "func (o IopingSpecVolumeVolumeSourceFlexVolumePtrOutput) SecretRef() IopingSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceFlexVolume) *IopingSpecVolumeVolumeSourceFlexVolumeSecretRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretRef\n\t}).(IopingSpecVolumeVolumeSourceFlexVolumeSecretRefPtrOutput)\n}", "func (o ContainerV1Output) SecretRefs() ContainerV1SecretRefArrayOutput {\n\treturn o.ApplyT(func(v *ContainerV1) ContainerV1SecretRefArrayOutput { return v.SecretRefs }).(ContainerV1SecretRefArrayOutput)\n}", "func (in *ExternalSecret) DeepCopy() *ExternalSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PlatformSecrets) DeepCopy() *PlatformSecrets {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PlatformSecrets)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (sp *SecretProposal) Secret() []uint32 { return sp.secret }", "func Secret(objectMeta metav1.ObjectMeta, data map[string][]byte) *corev1.Secret {\n\treturn &corev1.Secret{\n\t\tObjectMeta: objectMeta,\n\t\tData: data,\n\t\tType: secretTypeForData(data),\n\t\tImmutable: pointer.Bool(true),\n\t}\n}", "func (ci *auditInfo) SecretHash() dex.Bytes {\n\treturn ci.secretHash\n}", "func (ci *auditInfo) SecretHash() dex.Bytes {\n\treturn ci.secretHash\n}", "func (ci *auditInfo) SecretHash() dex.Bytes {\n\treturn ci.secretHash\n}", "func (in *SecretRoleBinding) DeepCopy() *SecretRoleBinding {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRoleBinding)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretEngine) DeepCopy() *SecretEngine {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngine)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7781256", "0.745195", "0.745195", "0.745195", "0.7148328", "0.6931388", "0.6782078", "0.67413205", "0.67248464", "0.6716652", "0.669141", "0.6669019", "0.66052324", "0.6580276", "0.65783435", "0.65390766", "0.6525357", "0.64835936", "0.6468834", "0.64573145", "0.6455496", "0.6427081", "0.6372516", "0.6352918", "0.6343332", "0.6337251", "0.63150764", "0.631333", "0.63108265", "0.62608075", "0.62395024", "0.62374604", "0.62264246", "0.61724764", "0.6141935", "0.60924757", "0.6090149", "0.6088947", "0.60816646", "0.60741615", "0.60665816", "0.6049357", "0.6048341", "0.6046672", "0.6046672", "0.60463214", "0.6045206", "0.60069263", "0.5997849", "0.5974469", "0.5972902", "0.5948604", "0.5929834", "0.592324", "0.59133977", "0.58874553", "0.58843905", "0.5883743", "0.58566016", "0.5846353", "0.58392787", "0.58390546", "0.5831489", "0.5819308", "0.58019054", "0.5791263", "0.5777187", "0.5772136", "0.5771021", "0.5770413", "0.5752068", "0.5726965", "0.572244", "0.57088035", "0.5700777", "0.5684658", "0.56530213", "0.56526303", "0.56338185", "0.56207114", "0.561709", "0.56148195", "0.55847675", "0.5576376", "0.55667645", "0.5559489", "0.554611", "0.5541179", "0.55268365", "0.5518575", "0.5515749", "0.5505141", "0.54831076", "0.54807186", "0.54807186", "0.54807186", "0.54700065", "0.5432934" ]
0.82409436
2
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *ServiceAccountRef) DeepCopyInto(out *ServiceAccountRef) { *out = *in }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\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.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, 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}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "func (in *Empty) DeepCopyInto(out *Empty) {\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}", "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}" ]
[ "0.8215289", "0.81280124", "0.81039286", "0.80862963", "0.8083811", "0.80673146", "0.8064545", "0.8026454", "0.8012046", "0.7996313", "0.799204", "0.79887754", "0.7987097", "0.7986994", "0.7986994", "0.79854053", "0.7975989", "0.7972486", "0.79695636", "0.79695636", "0.79695636", "0.7967528", "0.79624444", "0.7961954", "0.7945754", "0.7945754", "0.7944541", "0.79428566", "0.7942668", "0.7942668", "0.7940451", "0.793851", "0.7936731", "0.79294837", "0.79252166", "0.7915377", "0.7911627", "0.7911138", "0.7909384", "0.790913", "0.7908773", "0.7905649", "0.79050326", "0.7904594", "0.7904594", "0.7904235", "0.79036915", "0.79020816", "0.78988886", "0.78977424", "0.7891376", "0.7891024", "0.7889831", "0.78890276", "0.7887135", "0.788637", "0.7885264", "0.7885264", "0.7884786", "0.7880785", "0.78745943", "0.78745943", "0.78745407", "0.78734446", "0.78724426", "0.78713626", "0.78713554", "0.78652424", "0.7863321", "0.7863321", "0.7863321", "0.7863293", "0.7862628", "0.7860664", "0.7858556", "0.785785", "0.78571486", "0.7851332", "0.78453225", "0.78448987", "0.78415996", "0.7837483", "0.7837037", "0.7836443", "0.78351796", "0.78329664", "0.7831094", "0.7829445", "0.7826582", "0.7824499", "0.78242797", "0.78227437", "0.78192484", "0.7818843", "0.78128535", "0.7812535", "0.78111476", "0.78111106", "0.781107", "0.78093034", "0.7808775" ]
0.0
-1