query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
41a14481f58d7d35c9ebdbe8b88212e8
ElementType returns the element type of this Output (map[string][]int16).
[ { "docid": "07713f796df3266bd7cce997298cd203", "score": "0.7991146", "text": "func (Int16ArrayMapOutput) ElementType() reflect.Type {\n\treturn int16ArrayMapType\n}", "title": "" } ]
[ { "docid": "240640ce0a6bbabe1f9a035d39c137d1", "score": "0.8093357", "text": "func (Int16MapOutput) ElementType() reflect.Type {\n\treturn int16MapType\n}", "title": "" }, { "docid": "25bc95469c8efa7fe39e6e30d5e75fca", "score": "0.80704355", "text": "func (Uint16MapOutput) ElementType() reflect.Type {\n\treturn uint16MapType\n}", "title": "" }, { "docid": "e0b236841399c128e99b5621fd0f5a68", "score": "0.79660255", "text": "func (Uint16ArrayMapOutput) ElementType() reflect.Type {\n\treturn uint16ArrayMapType\n}", "title": "" }, { "docid": "7b24f735e759c48772d74b9b001cfcc9", "score": "0.79195046", "text": "func (Uint16MapArrayOutput) ElementType() reflect.Type {\n\treturn uint16MapArrayType\n}", "title": "" }, { "docid": "1ebfb8be4e04072b4b65f9834ee0bdb6", "score": "0.7884298", "text": "func (Uint16Output) ElementType() reflect.Type {\n\treturn uint16Type\n}", "title": "" }, { "docid": "80e70d82e5f42f1500eeebd47b771d64", "score": "0.78705454", "text": "func (Int16MapArrayOutput) ElementType() reflect.Type {\n\treturn int16MapArrayType\n}", "title": "" }, { "docid": "aa196a31ef3f842ec783734f8c9be592", "score": "0.779907", "text": "func (Int16Output) ElementType() reflect.Type {\n\treturn int16Type\n}", "title": "" }, { "docid": "a9aaccaf9ba92376f446cf807dd35f93", "score": "0.76068676", "text": "func (Int16Map) ElementType() reflect.Type {\n\treturn int16MapType\n}", "title": "" }, { "docid": "61a7f068729c4e518868446a886a473f", "score": "0.7602622", "text": "func (Uint16Map) ElementType() reflect.Type {\n\treturn uint16MapType\n}", "title": "" }, { "docid": "5cda2d34029f791fbbe18b2745a3614d", "score": "0.7596913", "text": "func (Uint16PtrOutput) ElementType() reflect.Type {\n\treturn uint16PtrType\n}", "title": "" }, { "docid": "1bd769c938a21c9b78983698cfb26ac7", "score": "0.75933504", "text": "func (Uint16ArrayOutput) ElementType() reflect.Type {\n\treturn uint16ArrayType\n}", "title": "" }, { "docid": "92937c07b52b8b70573b23e1ee3d8027", "score": "0.7571238", "text": "func (Uint16ArrayMap) ElementType() reflect.Type {\n\treturn uint16ArrayMapType\n}", "title": "" }, { "docid": "a13e1d313245eef8854327abf2725332", "score": "0.7569247", "text": "func (Int16ArrayMap) ElementType() reflect.Type {\n\treturn int16ArrayMapType\n}", "title": "" }, { "docid": "af895a669b06b8ec3be7f092910edec1", "score": "0.7555587", "text": "func (Int16PtrOutput) ElementType() reflect.Type {\n\treturn int16PtrType\n}", "title": "" }, { "docid": "11b7c3bfcb00a765997de1235842bffe", "score": "0.7539523", "text": "func (UintMapOutput) ElementType() reflect.Type {\n\treturn uintMapType\n}", "title": "" }, { "docid": "72950262e6e9091fb3e5a59958b627c0", "score": "0.7521079", "text": "func (Int16ArrayOutput) ElementType() reflect.Type {\n\treturn int16ArrayType\n}", "title": "" }, { "docid": "4f53e3a77d0b789f85b75f71f1349a25", "score": "0.7492045", "text": "func (Uint16MapArray) ElementType() reflect.Type {\n\treturn uint16MapArrayType\n}", "title": "" }, { "docid": "7f37300da001932717aa7168c11bb827", "score": "0.74849766", "text": "func (Uint16) ElementType() reflect.Type {\n\treturn uint16Type\n}", "title": "" }, { "docid": "62db2e59ea5595b1ea0f1edbd96d1491", "score": "0.7424902", "text": "func (Int16MapArray) ElementType() reflect.Type {\n\treturn int16MapArrayType\n}", "title": "" }, { "docid": "c8082c68409af5b517b32cc60768df8a", "score": "0.7416932", "text": "func (UintOutput) ElementType() reflect.Type {\n\treturn uintType\n}", "title": "" }, { "docid": "3a09dc6d5c3cbe0d4458635279395ade", "score": "0.73933804", "text": "func (UintArrayMapOutput) ElementType() reflect.Type {\n\treturn uintArrayMapType\n}", "title": "" }, { "docid": "deb61f0f5320d87d2daaba64d3da14de", "score": "0.7368804", "text": "func (UintMapArrayOutput) ElementType() reflect.Type {\n\treturn uintMapArrayType\n}", "title": "" }, { "docid": "13300788cd1c5bee80587b0b9e7ba3de", "score": "0.73406774", "text": "func (Int16) ElementType() reflect.Type {\n\treturn int16Type\n}", "title": "" }, { "docid": "fd6edaa984d23fbc45c0c39f6c55d0e8", "score": "0.72990954", "text": "func (Uint32MapOutput) ElementType() reflect.Type {\n\treturn uint32MapType\n}", "title": "" }, { "docid": "dffa2d4a7d4fd99a39b332070229a8de", "score": "0.7296903", "text": "func (Uint32MapArrayOutput) ElementType() reflect.Type {\n\treturn uint32MapArrayType\n}", "title": "" }, { "docid": "46eb55ee47adebd8571896f77ddfcfd4", "score": "0.7295478", "text": "func (IDMapOutput) ElementType() reflect.Type {\n\treturn iDMapType\n}", "title": "" }, { "docid": "4b3cd65c4002deedf792cb4781711a47", "score": "0.72660404", "text": "func (IntMapOutput) ElementType() reflect.Type {\n\treturn intMapType\n}", "title": "" }, { "docid": "25001566d64a6ea55016817fb8f75760", "score": "0.7250222", "text": "func (IntArrayMapOutput) ElementType() reflect.Type {\n\treturn intArrayMapType\n}", "title": "" }, { "docid": "ab6b0d8eb353953f3c08fe9dc988db2e", "score": "0.7212199", "text": "func (IDArrayMapOutput) ElementType() reflect.Type {\n\treturn iDArrayMapType\n}", "title": "" }, { "docid": "1ac21060e33adb25d319979999c361a9", "score": "0.7211765", "text": "func (Uint32ArrayMapOutput) ElementType() reflect.Type {\n\treturn uint32ArrayMapType\n}", "title": "" }, { "docid": "2784fcbbaaefee2256863de086ef848c", "score": "0.720296", "text": "func (Uint8MapOutput) ElementType() reflect.Type {\n\treturn uint8MapType\n}", "title": "" }, { "docid": "ea441c0409195a563f7c2353d2f83acf", "score": "0.7192427", "text": "func (Int8MapOutput) ElementType() reflect.Type {\n\treturn int8MapType\n}", "title": "" }, { "docid": "463b1b993b371fa2c486042579b70ef3", "score": "0.717106", "text": "func (*uint16Ptr) ElementType() reflect.Type {\n\treturn uint16PtrType\n}", "title": "" }, { "docid": "ec42b4752fe782622dc479adabfc47fa", "score": "0.7167227", "text": "func (Uint16Array) ElementType() reflect.Type {\n\treturn uint16ArrayType\n}", "title": "" }, { "docid": "cd5d8906f4b10cd47a84cc0a043214e1", "score": "0.7145089", "text": "func (Uint64MapOutput) ElementType() reflect.Type {\n\treturn uint64MapType\n}", "title": "" }, { "docid": "10c5b032fedfc8f3d719faf5eb138d49", "score": "0.7131042", "text": "func (Uint64MapArrayOutput) ElementType() reflect.Type {\n\treturn uint64MapArrayType\n}", "title": "" }, { "docid": "4581ced58356f0654dc8a30d2cca667b", "score": "0.7110757", "text": "func (*int16Ptr) ElementType() reflect.Type {\n\treturn int16PtrType\n}", "title": "" }, { "docid": "78a10b6ba416ffa83ab761bd1148a953", "score": "0.71070933", "text": "func (Uint8MapArrayOutput) ElementType() reflect.Type {\n\treturn uint8MapArrayType\n}", "title": "" }, { "docid": "edcb0cfe921e7bc3b51bd14d7f30b273", "score": "0.7084791", "text": "func (Int8ArrayMapOutput) ElementType() reflect.Type {\n\treturn int8ArrayMapType\n}", "title": "" }, { "docid": "c064b4d31d680b9d52e5d9653b78f482", "score": "0.708153", "text": "func (UintArrayOutput) ElementType() reflect.Type {\n\treturn uintArrayType\n}", "title": "" }, { "docid": "c5332730cf250bc38fb480b9e778dc3f", "score": "0.70699126", "text": "func (Int16Array) ElementType() reflect.Type {\n\treturn int16ArrayType\n}", "title": "" }, { "docid": "b8c1e4dd78ea633ec55467384f7ec4bb", "score": "0.705523", "text": "func (Uint8ArrayMapOutput) ElementType() reflect.Type {\n\treturn uint8ArrayMapType\n}", "title": "" }, { "docid": "25d8501e48b0edb18545eceb87f4e0df", "score": "0.705012", "text": "func (IntMapArrayOutput) ElementType() reflect.Type {\n\treturn intMapArrayType\n}", "title": "" }, { "docid": "d8920cf4afbd892df029a6dd3f652eed", "score": "0.70440316", "text": "func (IDMapArrayOutput) ElementType() reflect.Type {\n\treturn iDMapArrayType\n}", "title": "" }, { "docid": "99cc048487fd0fb398b0435625354365", "score": "0.7041204", "text": "func (Uint64ArrayMapOutput) ElementType() reflect.Type {\n\treturn uint64ArrayMapType\n}", "title": "" }, { "docid": "096102d1542727bab64693fb5bbb23b7", "score": "0.703028", "text": "func (Int32MapOutput) ElementType() reflect.Type {\n\treturn int32MapType\n}", "title": "" }, { "docid": "a694b7dce1335e927c79f707f0e89da4", "score": "0.7022891", "text": "func (Int8MapArrayOutput) ElementType() reflect.Type {\n\treturn int8MapArrayType\n}", "title": "" }, { "docid": "98d54229f05476b156add549d16a289b", "score": "0.7004884", "text": "func (Int32MapArrayOutput) ElementType() reflect.Type {\n\treturn int32MapArrayType\n}", "title": "" }, { "docid": "06731533e0bce9cb338e7aacc95b93e2", "score": "0.70045", "text": "func (Uint32Output) ElementType() reflect.Type {\n\treturn uint32Type\n}", "title": "" }, { "docid": "8d4d9fde54e9c2f044072c3bc8ca17bb", "score": "0.69832426", "text": "func (Uint8Output) ElementType() reflect.Type {\n\treturn uint8Type\n}", "title": "" }, { "docid": "23d8525eca2eda6f363e2c5312bde1bc", "score": "0.69816667", "text": "func (Int32ArrayMapOutput) ElementType() reflect.Type {\n\treturn int32ArrayMapType\n}", "title": "" }, { "docid": "d45d8c6a16cad76fa94169c84723e175", "score": "0.6967199", "text": "func (IntOutput) ElementType() reflect.Type {\n\treturn intType\n}", "title": "" }, { "docid": "d765d08f12d96d74b5d6b0173343f04d", "score": "0.6966612", "text": "func (UintMap) ElementType() reflect.Type {\n\treturn uintMapType\n}", "title": "" }, { "docid": "1f0cff737865b71c842a9609b06d3676", "score": "0.6960903", "text": "func (Int64MapOutput) ElementType() reflect.Type {\n\treturn int64MapType\n}", "title": "" }, { "docid": "8d544e6def61246c98a3367427cb086e", "score": "0.69574", "text": "func (Uint64Output) ElementType() reflect.Type {\n\treturn uint64Type\n}", "title": "" }, { "docid": "59c54b7882b07b362eb4389429aeb8df", "score": "0.6933233", "text": "func (URNMapOutput) ElementType() reflect.Type {\n\treturn uRNMapType\n}", "title": "" }, { "docid": "328c362ff6e6bf4988435ae8e6b96255", "score": "0.69118124", "text": "func (UintArrayMap) ElementType() reflect.Type {\n\treturn uintArrayMapType\n}", "title": "" }, { "docid": "15430d7129d444d6b4c567bfb5eee702", "score": "0.6910348", "text": "func (URNArrayMapOutput) ElementType() reflect.Type {\n\treturn uRNArrayMapType\n}", "title": "" }, { "docid": "876bd87e632b1117d79175a7ab942217", "score": "0.690861", "text": "func (Int8Output) ElementType() reflect.Type {\n\treturn int8Type\n}", "title": "" }, { "docid": "b2f667ace773d85fdcf0790efb1d5b6a", "score": "0.6903681", "text": "func (Int64MapArrayOutput) ElementType() reflect.Type {\n\treturn int64MapArrayType\n}", "title": "" }, { "docid": "eb6aea4400a674b4bc0c6e8bae3d87fa", "score": "0.68698275", "text": "func (Uint) ElementType() reflect.Type {\n\treturn uintType\n}", "title": "" }, { "docid": "71ebdc15800fa3ec8a0cd2076442d07b", "score": "0.6867166", "text": "func (Int64ArrayMapOutput) ElementType() reflect.Type {\n\treturn int64ArrayMapType\n}", "title": "" }, { "docid": "ceea807304485c220df9081733daa1f4", "score": "0.68517125", "text": "func (Float32MapOutput) ElementType() reflect.Type {\n\treturn float32MapType\n}", "title": "" }, { "docid": "9bbcf3c972eea5920936df81d562248d", "score": "0.68158174", "text": "func (AssetArrayMapOutput) ElementType() reflect.Type {\n\treturn assetArrayMapType\n}", "title": "" }, { "docid": "4db555bb51bcfafc139f527368cde276", "score": "0.6810806", "text": "func (UintMapArray) ElementType() reflect.Type {\n\treturn uintMapArrayType\n}", "title": "" }, { "docid": "4ecbc6356ab3510546f53760fb2e632d", "score": "0.68007475", "text": "func (UintPtrOutput) ElementType() reflect.Type {\n\treturn uintPtrType\n}", "title": "" }, { "docid": "7a45172e83a9f1f2f97456317441685b", "score": "0.67974687", "text": "func (Float32MapArrayOutput) ElementType() reflect.Type {\n\treturn float32MapArrayType\n}", "title": "" }, { "docid": "bf573a30cbd5a59ba86622cd1663a59a", "score": "0.67895883", "text": "func (m *ArrayElem) Type() Type {\n\treturn m.wtype\n}", "title": "" }, { "docid": "b0750d256b1635b5c3c984bd9c16265b", "score": "0.677704", "text": "func (IntArrayOutput) ElementType() reflect.Type {\n\treturn intArrayType\n}", "title": "" }, { "docid": "255b78e94e5de40b96ebd153c9a4a3e5", "score": "0.6763814", "text": "func (Float32ArrayMapOutput) ElementType() reflect.Type {\n\treturn float32ArrayMapType\n}", "title": "" }, { "docid": "75be4e3d168eb4b715de0d36f343c6c3", "score": "0.67624986", "text": "func (IDArrayOutput) ElementType() reflect.Type {\n\treturn iDArrayType\n}", "title": "" }, { "docid": "fd5a709002fe503f55c84c5a26c89765", "score": "0.6755667", "text": "func (URNMapArrayOutput) ElementType() reflect.Type {\n\treturn uRNMapArrayType\n}", "title": "" }, { "docid": "97e5eff11cf5dc967200ff0e4a610fee", "score": "0.67426676", "text": "func (Uint32Map) ElementType() reflect.Type {\n\treturn uint32MapType\n}", "title": "" }, { "docid": "2dbcd83d44a5445f67b0efe5ba37a4b9", "score": "0.6740964", "text": "func (AssetMapOutput) ElementType() reflect.Type {\n\treturn assetMapType\n}", "title": "" }, { "docid": "a517fa607adf478ac852e8166fd0f974", "score": "0.6740139", "text": "func (Uint32MapArray) ElementType() reflect.Type {\n\treturn uint32MapArrayType\n}", "title": "" }, { "docid": "56f04da3d7f998000e2b437fb7d8764f", "score": "0.67390746", "text": "func (Uint32ArrayMap) ElementType() reflect.Type {\n\treturn uint32ArrayMapType\n}", "title": "" }, { "docid": "9dd93f836eb6145253f3da7fe194ab14", "score": "0.6728968", "text": "func (Float64MapOutput) ElementType() reflect.Type {\n\treturn float64MapType\n}", "title": "" }, { "docid": "2350e98d83b5a0f470b02db5484f12db", "score": "0.6722637", "text": "func (IDOutput) ElementType() reflect.Type {\n\treturn idType\n}", "title": "" }, { "docid": "53f8f3f84a53170433a09958db7c648e", "score": "0.67217475", "text": "func (AssetMapArrayOutput) ElementType() reflect.Type {\n\treturn assetMapArrayType\n}", "title": "" }, { "docid": "98a38908f6b1ee77f4780a1dd7a830d1", "score": "0.67087424", "text": "func (Uint32ArrayOutput) ElementType() reflect.Type {\n\treturn uint32ArrayType\n}", "title": "" }, { "docid": "0b75d606f571dc269bea3a6068f31e52", "score": "0.6707736", "text": "func (IDArrayMap) ElementType() reflect.Type {\n\treturn iDArrayMapType\n}", "title": "" }, { "docid": "ba4311d4bc42abaf55fd49f4d6971ad8", "score": "0.66963977", "text": "func (IntPtrOutput) ElementType() reflect.Type {\n\treturn intPtrType\n}", "title": "" }, { "docid": "e00c2a2bc7dceb878265852fccc7e10f", "score": "0.6691985", "text": "func (Float64MapArrayOutput) ElementType() reflect.Type {\n\treturn float64MapArrayType\n}", "title": "" }, { "docid": "b4b597aa9cd8906ee005ce88ae4f2b3c", "score": "0.668815", "text": "func (IntArrayMap) ElementType() reflect.Type {\n\treturn intArrayMapType\n}", "title": "" }, { "docid": "3a83bece37b70a968ff559cb3d2a9494", "score": "0.6650546", "text": "func (Float64ArrayMapOutput) ElementType() reflect.Type {\n\treturn float64ArrayMapType\n}", "title": "" }, { "docid": "49bc1aa02bcb15ef6b6976d98ff88ba8", "score": "0.665", "text": "func (ArchiveArrayMapOutput) ElementType() reflect.Type {\n\treturn archiveArrayMapType\n}", "title": "" }, { "docid": "53bcb58632a33e49e5e61d60e2c37249", "score": "0.664208", "text": "func (Uint8Map) ElementType() reflect.Type {\n\treturn uint8MapType\n}", "title": "" }, { "docid": "73b07eccc0316df8c526bdf4005b147c", "score": "0.66420346", "text": "func (BoolArrayMapOutput) ElementType() reflect.Type {\n\treturn boolArrayMapType\n}", "title": "" }, { "docid": "7ab878538fa6c2f7a11ec151883fbc47", "score": "0.66330856", "text": "func (BoolMapOutput) ElementType() reflect.Type {\n\treturn boolMapType\n}", "title": "" }, { "docid": "0573a7971386e1ade36c7edd8cb5e85c", "score": "0.66329587", "text": "func (AssetOrArchiveArrayMapOutput) ElementType() reflect.Type {\n\treturn assetOrArchiveArrayMapType\n}", "title": "" }, { "docid": "4a542d0ba41270c32a866b750a8061b0", "score": "0.66241306", "text": "func (ArchiveMapArrayOutput) ElementType() reflect.Type {\n\treturn archiveMapArrayType\n}", "title": "" }, { "docid": "a5cc62db68c5e76826a26b52da549b25", "score": "0.6623086", "text": "func (BoolMapArrayOutput) ElementType() reflect.Type {\n\treturn boolMapArrayType\n}", "title": "" }, { "docid": "6c137940255a0c4813164010e05e2d4f", "score": "0.66195714", "text": "func (Int8Map) ElementType() reflect.Type {\n\treturn int8MapType\n}", "title": "" }, { "docid": "69baad6d5b6965639dd3b3e157141e51", "score": "0.6611731", "text": "func (IDMap) ElementType() reflect.Type {\n\treturn iDMapType\n}", "title": "" }, { "docid": "d1d6da079a0d922f46d940c3bcf87e12", "score": "0.66051334", "text": "func (StringMapOutput) ElementType() reflect.Type {\n\treturn stringMapType\n}", "title": "" }, { "docid": "ad789125d87701a29c603285f3f27259", "score": "0.659505", "text": "func (Uint64ArrayOutput) ElementType() reflect.Type {\n\treturn uint64ArrayType\n}", "title": "" }, { "docid": "1602360b192aa7e3faf299f195412706", "score": "0.65934294", "text": "func (IntMap) ElementType() reflect.Type {\n\treturn intMapType\n}", "title": "" }, { "docid": "107b8948583c3ebf72701478169a6d03", "score": "0.65845203", "text": "func (Int8ArrayMap) ElementType() reflect.Type {\n\treturn int8ArrayMapType\n}", "title": "" }, { "docid": "411aabd5aef5ea75e9703ad7d3fe6a24", "score": "0.65796006", "text": "func (AssetOrArchiveMapOutput) ElementType() reflect.Type {\n\treturn assetOrArchiveMapType\n}", "title": "" }, { "docid": "4ca62c966ec75ac1171b6a085414cfb8", "score": "0.6569371", "text": "func (Uint8ArrayMap) ElementType() reflect.Type {\n\treturn uint8ArrayMapType\n}", "title": "" } ]
efb84d4365d1720f8bd43eabd23c76bc
DeletedBy pointed to by the foreign key.
[ { "docid": "5e59f2611be0d45f8d21b5fca8cb440f", "score": "0.6055668", "text": "func (o *Post) DeletedBy(mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.DeletedByID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(queryMods...)\n\tqueries.SetFrom(query.Query, \"`users`\")\n\n\treturn query\n}", "title": "" } ]
[ { "docid": "19283c9f50cd67c28e6fd2d9f0ae67a7", "score": "0.70177406", "text": "func (o *ViewTimelog) SetDeletedBy(v int32) {\n\to.DeletedBy = &v\n}", "title": "" }, { "docid": "c14f37e6f3f748462bf4c0e8c7268391", "score": "0.66949916", "text": "func (o *ViewTimelog) SetDeletedByUserId(v int32) {\n\to.DeletedByUserId = &v\n}", "title": "" }, { "docid": "1fd10f394243378abe69facb0b6656c5", "score": "0.6622853", "text": "func (o *Post) SetDeletedBy(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE `posts` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, []string{\"deleted_by_id\"}),\n\t\tstrmangle.WhereClause(\"`\", \"`\", 0, postPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\tqueries.Assign(&o.DeletedByID, related.ID)\n\tif o.R == nil {\n\t\to.R = &postR{\n\t\t\tDeletedBy: related,\n\t\t}\n\t} else {\n\t\to.R.DeletedBy = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &userR{\n\t\t\tDeletedByPosts: PostSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.DeletedByPosts = append(related.R.DeletedByPosts, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "649dbeb4233bd8278e3fd8f66bddd93b", "score": "0.6574899", "text": "func (o *ViewTimelog) GetDeletedBy() int32 {\n\tif o == nil || o.DeletedBy == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DeletedBy\n}", "title": "" }, { "docid": "1545afe5a151764bb063caed56ce132e", "score": "0.6256428", "text": "func (o *ViewTimelog) GetDeletedByUserId() int32 {\n\tif o == nil || o.DeletedByUserId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DeletedByUserId\n}", "title": "" }, { "docid": "eb632875e226516d4f6a693e11653a4f", "score": "0.5983385", "text": "func (o *Post) RemoveDeletedBy(ctx context.Context, exec boil.ContextExecutor, related *User) error {\n\tvar err error\n\n\tqueries.SetScanner(&o.DeletedByID, nil)\n\tif _, err = o.Update(ctx, exec, boil.Whitelist(\"deleted_by_id\")); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.R.DeletedBy = nil\n\tif related == nil || related.R == nil {\n\t\treturn nil\n\t}\n\n\tfor i, ri := range related.R.DeletedByPosts {\n\t\tif queries.Equal(o.DeletedByID, ri.DeletedByID) {\n\t\t\tcontinue\n\t\t}\n\n\t\tln := len(related.R.DeletedByPosts)\n\t\tif ln > 1 && i < ln-1 {\n\t\t\trelated.R.DeletedByPosts[i] = related.R.DeletedByPosts[ln-1]\n\t\t}\n\t\trelated.R.DeletedByPosts = related.R.DeletedByPosts[:ln-1]\n\t\tbreak\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62fea5323ab7618c7cffffbdda3b59c3", "score": "0.5868442", "text": "func (comment *Comment) CanBeDeletedBy(user *User) bool {\n\treturn (user.Username == comment.User.Username)\n}", "title": "" }, { "docid": "0087867be754cac4ee14da1f6160852b", "score": "0.568941", "text": "func (o *ViewTimelog) HasDeletedBy() bool {\n\tif o != nil && o.DeletedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a42fa8657bb27a3c2d132a415ca9dafc", "score": "0.5648209", "text": "func (fd *ForeignDatum) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !fd._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif fd._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM foreign_data WHERE id = $1`\n\n\t// run query\n\tXOLog(sqlstr, fd.ID)\n\t_, err = db.Exec(sqlstr, fd.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tfd._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "18761c831f707fbe9fe4dc84dcca1d3a", "score": "0.5641975", "text": "func (fd *ForeignDatum) Deleted() bool {\n\treturn fd._deleted\n}", "title": "" }, { "docid": "4f1ac583ae4e76c97f79efabee69892b", "score": "0.548567", "text": "func (o *ViewTimelog) HasDeletedByUserId() bool {\n\tif o != nil && o.DeletedByUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1273849827c9a55f820d5b50170972f9", "score": "0.5420867", "text": "func (o *ViewTimelog) GetDeletedByOk() (*int32, bool) {\n\tif o == nil || o.DeletedBy == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DeletedBy, true\n}", "title": "" }, { "docid": "d09238ea7cc814f6e8d332136dc602d4", "score": "0.53820586", "text": "func (d *Decision) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !d._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif d._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM public.decisions WHERE to_user_id = $1`\n\n\t// run query\n\tXOLog(sqlstr, d.ToUserID)\n\t_, err = db.Exec(sqlstr, d.ToUserID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\td._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "c126303971e447031c20b36845541907", "score": "0.53681564", "text": "func (bu *BunionUser) Deleted() bool {\n\treturn bu._deleted\n}", "title": "" }, { "docid": "ab5cdf4cbf20191477f2a5e7f3353767", "score": "0.5337236", "text": "func (s *Self) Deleted() bool {\n\treturn s._deleted\n}", "title": "" }, { "docid": "29ac0a6f3b1fed325940f3d7aff5cf52", "score": "0.53184867", "text": "func (dau *DevelopAdminUser) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif dau._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetDevelopAdminUserTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE uid = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, dau.UID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, dau.UID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, dau.UID)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tdau._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "91afc56fb355f56f0f3cfa0c4ab6f732", "score": "0.5301217", "text": "func (u *User) Deleted() bool {\n\treturn u._deleted\n}", "title": "" }, { "docid": "91afc56fb355f56f0f3cfa0c4ab6f732", "score": "0.5301217", "text": "func (u *User) Deleted() bool {\n\treturn u._deleted\n}", "title": "" }, { "docid": "5beb89d31865f47ed8ed2ae45955565e", "score": "0.5301036", "text": "func (o *ViewTimelog) GetDeletedAt() string {\n\tif o == nil || o.DeletedAt == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DeletedAt\n}", "title": "" }, { "docid": "8d7e4a5dcf85778caeb31126f5b209f4", "score": "0.5283216", "text": "func (s *User) Delete(cl orm.DB, user *twisk.User) error {\n\tuser.Delete()\n\t_, err := cl.Model(user).Column(\"deleted_at\").WherePK().Update()\n\treturn err\n}", "title": "" }, { "docid": "c9a530b16fbd69bf5bc6f4dae2d66681", "score": "0.5272121", "text": "func (ListenerImpl) DataplaneDeleted(ctx context.Context, dataplane *Dataplane) {}", "title": "" }, { "docid": "3a9cad28f338ad22f2d8bb4f6354ca16", "score": "0.52711076", "text": "func (b *HandoffBuilder) DeletedAt(value time.Time) *HandoffBuilder {\n\tb.deletedAt = value\n\tb.bitmap_ |= 16\n\treturn b\n}", "title": "" }, { "docid": "dc21db0cf173a5205f3b07d127bcd25e", "score": "0.52637804", "text": "func (pdb *BrokerCassa) Delete(fromWhere sql.Expression) error {\n\tstatement, bindings, err := ExpToString(fromWhere)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn pdb.session.Exec(\"DELETE\"+statement, bindings...)\n}", "title": "" }, { "docid": "0b32edb62a45fdb6bbdb8bef89b68f36", "score": "0.5260822", "text": "func (bu *BunionUser) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif bu._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetBunionUserTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE bunionid = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, bu.Bunionid)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, bu.Bunionid)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, bu.Bunionid)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tbu._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "4d5f160eb472ffebbeb4cdcfe84b29cd", "score": "0.5249901", "text": "func deleteCallback(scope *gorm.Scope) {\n\tif !scope.HasError() {\n\t\tvar extraOption string\n\t\tif str, ok := scope.Get(\"orm:delete_option\"); ok {\n\t\t\textraOption = fmt.Sprint(str)\n\t\t}\n\n\t\tdeletedOnField, hasDeletedOnField := scope.FieldByName(\"DeletedOn\")\n\n\t\tif !scope.Search.Unscoped && hasDeletedOnField {\n\t\t\tscope.Raw(fmt.Sprintf(\n\t\t\t\t\"UPDATE %v SET %v=%v%v%v\",\n\t\t\t\tscope.QuotedTableName(),\n\t\t\t\tscope.Quote(deletedOnField.DBName),\n\t\t\t\tscope.AddToVars(time.Now().Unix()),\n\t\t\t\taddExtraSpaceIfExist(scope.CombinedConditionSql()),\n\t\t\t\taddExtraSpaceIfExist(extraOption),\n\t\t\t)).Exec()\n\t\t} else {\n\t\t\tscope.Raw(fmt.Sprintf(\n\t\t\t\t\"DELETE FROM %v%v%v\",\n\t\t\t\tscope.QuotedTableName(),\n\t\t\t\taddExtraSpaceIfExist(scope.CombinedConditionSql()),\n\t\t\t\taddExtraSpaceIfExist(extraOption),\n\t\t\t)).Exec()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "62a6c0e38f835b36b4d2102610572d85", "score": "0.522573", "text": "func (s *ChiStatus) HostDeleted() {\n\tdoWithWriteLock(s, func(s *ChiStatus) {\n\t\ts.HostsDeletedCount++\n\t})\n}", "title": "" }, { "docid": "beab06233a2567ad92aec278a6fbc05d", "score": "0.5219892", "text": "func fkTriggerDelete(tls *libc.TLS, dbMem uintptr, p uintptr) { /* sqlite3.c:121404:13: */\n\tif p != 0 {\n\t\tvar pStep uintptr = (*Trigger)(unsafe.Pointer(p)).Fstep_list\n\t\tXsqlite3ExprDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere)\n\t\tXsqlite3ExprListDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList)\n\t\tXsqlite3SelectDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect)\n\t\tXsqlite3ExprDelete(tls, dbMem, (*Trigger)(unsafe.Pointer(p)).FpWhen)\n\t\tXsqlite3DbFree(tls, dbMem, p)\n\t}\n}", "title": "" }, { "docid": "eefbe873843a8637c1aacd39b2b43ceb", "score": "0.521695", "text": "func (dau *DevelopAdminUser) Deleted() bool {\n\treturn dau._deleted\n}", "title": "" }, { "docid": "54dc32bec6bddcb895a7207f25deae27", "score": "0.5203953", "text": "func (o *AnalyticsPageviewReferer) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no AnalyticsPageviewReferer provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), analyticsPageviewRefererPrimaryKeyMapping)\n\tsql := \"DELETE FROM `analytics_pageview_referers` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from analytics_pageview_referers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for analytics_pageview_referers\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "d8b3522d3943d3af3d9ab1af2d5ed15d", "score": "0.5176841", "text": "func (ufbi *UserFeedBackIssue) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif ufbi._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetUserFeedBackIssueTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, ufbi.ID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, ufbi.ID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, ufbi.ID)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tufbi._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "7458e0421d5156665036094151c8e385", "score": "0.5173126", "text": "func (o *ViewTimelog) GetDateDeleted() string {\n\tif o == nil || o.DateDeleted == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DateDeleted\n}", "title": "" }, { "docid": "0a2c3dae42b949ec74217a84af9dedbf", "score": "0.5165416", "text": "func (au *AuthUser) Deleted() bool {\n\treturn au._deleted\n}", "title": "" }, { "docid": "529efb0a2343ed83d417ffd568f9443d", "score": "0.51603484", "text": "func (fd *FoodDiary) Deleted() bool {\n\treturn fd._deleted\n}", "title": "" }, { "docid": "8de3436975037f81493c67766d8e5185", "score": "0.5158371", "text": "func (t *HandlerImpl) ObjectDeleted(client kubernetes.Interface, obj interface{}) {\n\tlogrus.Debug(\"HandlerImpl.ObjectDeleted\")\n}", "title": "" }, { "docid": "a679230f96de6c6fedd37901648302b2", "score": "0.5138546", "text": "func (store MySQL) DeleteUser(id, deletedBy int) error {\n\tlog.Debug().Int(\"id\", id).Int(\"deleted_by\", deletedBy).Msg(\"DeleteUser\")\n\n\tif id == 0 {\n\t\treturn ErrDeleteUserMissingID\n\t}\n\n\tif deletedBy == 0 {\n\t\treturn ErrDeleteUserMissingDeletedByID\n\t}\n\n\tconn := db.Connx(mysqlDbID)\n\n\t// Issue an update with the deleted by in order to have an audit log in the history table\n\t_, err := conn.Exec(`\n UPDATE `+usersTableName+` SET\n active = 0,\n updated_by = ?\n WHERE\n id = ?\n `,\n\t\tid,\n\t\tdeletedBy,\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Actually remove the user from the database\n\t_, err = conn.Exec(`\n DELETE FROM\n `+usersTableName+`\n WHERE\n id = ?\n `,\n\t\tid,\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "6b795a776e7413f0c7f0f913e5da2659", "score": "0.5137433", "text": "func (f *Foo) Deleted() bool {\n\treturn f._deleted\n}", "title": "" }, { "docid": "6eab2711a55ce77fa83aaa4c8894f71e", "score": "0.51311076", "text": "func (m *GrantMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "eab2a75c9fc135e62c56ba6b906b76f4", "score": "0.5120564", "text": "func (nr *NotifyRemoved) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !nr._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif nr._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM sun.notify_removed WHERE Id = ?`\n\n\t// run query\n\tif LogTableSqlReq.NotifyRemoved {\n\t\tXOLog(sqlstr, nr.Id)\n\t}\n\t_, err = db.Exec(sqlstr, nr.Id)\n\tif err != nil {\n\t\tif LogTableSqlReq.NotifyRemoved {\n\t\t\tXOLogErr(err)\n\t\t}\n\t\treturn err\n\t}\n\n\t// set deleted\n\tnr._deleted = true\n\n\tOnNotifyRemoved_AfterDelete(nr)\n\n\treturn nil\n}", "title": "" }, { "docid": "67dbb9a7b27ed461f81477bc8c67c586", "score": "0.51127887", "text": "func DeleteBy(by string, vals ...interface{}) int64 {\n\treturn adapter.DeleteIn(TABLE_NAME, nil, by, vals...)\n}", "title": "" }, { "docid": "e4b6774e0258b1413d5297d292728009", "score": "0.51063395", "text": "func (ep *EntPlan) Deleted() bool {\n\treturn ep._deleted\n}", "title": "" }, { "docid": "37adba6ac1beadf7bed6b2828bb26862", "score": "0.5100614", "text": "func (c *MovieController) DeleteBy(id int) context.Map {\n\tdeleted := movies[id].Name\n\tmovies = append(movies[:id], movies[id+1:]...)\n\treturn context.Map{\"deleted\": deleted}\n}", "title": "" }, { "docid": "783192822e467a6921c1311fb6a8c00b", "score": "0.5091895", "text": "func (o *PrivateHostOp) Delete(ctx context.Context, zone string, id types.ID) error {\n\t_, err := o.Read(ctx, zone, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tds().Delete(o.key, zone, id)\n\treturn nil\n}", "title": "" }, { "docid": "e0bbc8cef3833b877d81ce179ddd5e9a", "score": "0.5090622", "text": "func (c *Customer) Deleted() bool {\n\treturn c._deleted\n}", "title": "" }, { "docid": "f97060912bbcd59f9966f644a86088d7", "score": "0.5089", "text": "func (a *Author) Delete(id int) error {\n\tconn, ctx, err := domain.GetConn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tstmt, err := conn.PrepareContext(ctx, deleteQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := stmt.ExecContext(ctx, id); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "747ae1a04735017d4c719352bc1f9a3c", "score": "0.5080293", "text": "func (b *Author) DeleteAuthor(db *sqlx.DB) error {\n\t_, err := db.Exec(\"DELETE FROM authors WHERE id=$1\", b.ID)\n\n\treturn err\n}", "title": "" }, { "docid": "43599586c16e55ef3d3e4f386ae795bf", "score": "0.5079475", "text": "func (o *Order) Deleted() bool {\n\treturn o._deleted\n}", "title": "" }, { "docid": "c72614a4823606f57ac01dff36c1f935", "score": "0.50691485", "text": "func (pv *PostView) Deleted() bool {\n\treturn pv._deleted\n}", "title": "" }, { "docid": "5c3af413ac2e678b99989dd3abf31411", "score": "0.5068307", "text": "func (o *Phendesc) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phendesc provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), phendescPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"phendesc\\\" WHERE \\\"phendesc_id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete from phendesc\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e8a111deb27d3320ebcdf1511ed8f331", "score": "0.50572133", "text": "func (v *Visitor) Deleted() bool {\n\treturn v._deleted\n}", "title": "" }, { "docid": "cd6404dfa8e1a3020270af98f30ae904", "score": "0.5049125", "text": "func (bf *BaseFlavor) DropForeignKey(i interface{}, ft, fkn string) error {\n\n\tschema := \"ALTER TABLE \" + ft + \" DROP CONSTRAINT \" + fkn + \";\"\n\tbf.QsLog(schema)\n\n\t_, err := bf.Exec(schema)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a16131d59cbbbf2ba7d724352b642d01", "score": "0.50438684", "text": "func Delete(db *xorm.Engine, id int64) (err error) {\n\t_, err = db.Where(fmt.Sprintf(\"id=%d\", id)).Update(\n\t\tentity.Todo{\n\t\t\tId_user: -1,\n\t\t\tDeleted_at: time.Now(),\n\t\t},\n\t)\n\treturn\n}", "title": "" }, { "docid": "ed0e76a0fe69a0aeb87ed4b433060863", "score": "0.5037025", "text": "func (o *ViewTimelog) GetDeletedByUserIdOk() (*int32, bool) {\n\tif o == nil || o.DeletedByUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DeletedByUserId, true\n}", "title": "" }, { "docid": "d850fa1e35073048ab34303594cef268", "score": "0.5035543", "text": "func (m *GroupMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "0dbb09f013cc70be6209610922932a3d", "score": "0.5033568", "text": "func (h *Handler) Delete(objKey string) error {\n\th.logger.Infof(\"Dele obj %s\", objKey)\n\treturn nil\n}", "title": "" }, { "docid": "062c13f1a2988aa1d722d5bc33e2c213", "score": "0.503296", "text": "func (p *Peer) Deleted() bool {\n\treturn p._deleted\n}", "title": "" }, { "docid": "dd155f0f740e567690f1a6e6cbf977e6", "score": "0.500934", "text": "func (d *DocumentBase) GetDeletedAt() time.Time {\n\treturn d.DeletedAt\n}", "title": "" }, { "docid": "9c2e1afb649af5ebaeb88e62541558da", "score": "0.50064266", "text": "func (o *ViewTimelog) SetDeletedAt(v string) {\n\to.DeletedAt = &v\n}", "title": "" }, { "docid": "deca4e40d2d6b6f03b83aea710dd3922", "score": "0.49976042", "text": "func (m *UserMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "55a19a185ae8807101f0adb432bd6a06", "score": "0.49780548", "text": "func (badgerkv *BadgerKV) Delete(id []byte) error {\n\terr := badgerkv.db.Update(func(tx *badger.Txn) error {\n\t\treturn tx.Delete(id)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "c5a7bd248201e899855396915371f26b", "score": "0.49684775", "text": "func (o *ViewTimelog) SetDateDeleted(v string) {\n\to.DateDeleted = &v\n}", "title": "" }, { "docid": "262ea9ea89de440d974a43934869c604", "score": "0.49682736", "text": "func (t *Triage) Deleted() bool {\n\treturn t._deleted\n}", "title": "" }, { "docid": "2d0326d7bf0ee904103d33a4041a7103", "score": "0.49667895", "text": "func (t *Handler) ObjectDeleted(obj interface{}) {\n\tlog.Info(\"EVHandler.ObjectDeleted\")\n\t// Mail notification, TBD\n}", "title": "" }, { "docid": "928ac33bae7a859b7eeb25feca601846", "score": "0.49603468", "text": "func (h *myHandler) ObjectDeleted(obj interface{}) {\n\tdeleteEvent, ok := obj.(kw_event.Event)\n\tif ok {\n\t\th.setter.SetContainerPIDs(deleteEvent.Name, nil)\n\t\tproContainer.logger.Info(\"delete\", zap.String(\"pod\", deleteEvent.Name))\n\t}\n}", "title": "" }, { "docid": "eae4c9e40fe176ab80e54ddc7514a9d4", "score": "0.49581957", "text": "func DeletePerson(ctx context.Context, pk string) {\n\tdeletePerson(ctx, pk)\n}", "title": "" }, { "docid": "b43eef83e6dd5ea92a20cabf846936a1", "score": "0.49547037", "text": "func (m *FactMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "4b9bbfa075582bc47b6501c5583275be", "score": "0.4949258", "text": "func (p *Comment) Delete() {\n\tp.IsDeleted = true\n}", "title": "" }, { "docid": "5c8d23d473344088bfa049c15a5eacac", "score": "0.49490133", "text": "func (g *Good) Deleted() bool {\n\treturn g._deleted\n}", "title": "" }, { "docid": "594d7190d59742a48cf8c58a681fc6dd", "score": "0.4948578", "text": "func (t *Throttler) revisionDeleted(obj interface{}) {\n\tacc, err := kmeta.DeletionHandlingAccessor(obj)\n\tif err != nil {\n\t\tt.logger.Warnw(\"Revision delete failure to process\", zap.Error(err))\n\t\treturn\n\t}\n\n\trevID := types.NamespacedName{Namespace: acc.GetNamespace(), Name: acc.GetName()}\n\n\tt.logger.Debugw(\"Revision delete\", zap.String(logkey.Key, revID.String()))\n\n\tt.revisionThrottlersMutex.Lock()\n\tdefer t.revisionThrottlersMutex.Unlock()\n\tdelete(t.revisionThrottlers, revID)\n}", "title": "" }, { "docid": "4484b4b4ec155df5dfad58c4ba31733d", "score": "0.49461704", "text": "func (c *Company) Deleted() bool {\n\treturn c._deleted\n}", "title": "" }, { "docid": "ed57dfde66bcf6c70db09692abc4807e", "score": "0.4940967", "text": "func LogDeleted(ctx context.Context, conn *store.Connection, userID uuid.UUID) error {\n\t_, err := CreateLogEntry(ctx, conn, auditlog.Deleted, userID, nil)\n\treturn err\n}", "title": "" }, { "docid": "459d948b5b0d48409fca1db715b9e73a", "score": "0.49403676", "text": "func (s *SMTP) ObjectDeleted(obj interface{}) {\n\tnotify(s, obj, \"deleted\")\n}", "title": "" }, { "docid": "eb7ae28015799f17638c6313b856d642", "score": "0.4933117", "text": "func (d *Decision) Deleted() bool {\n\treturn d._deleted\n}", "title": "" }, { "docid": "c54a3dfdccac27b111491523763823ee", "score": "0.49259984", "text": "func (m *GrantMutation) ClearDeletedAt() {\n\tm.deleted_at = nil\n\tm.clearedFields[grant.FieldDeletedAt] = struct{}{}\n}", "title": "" }, { "docid": "96a584614540950c158f7d39c70e9149", "score": "0.49245465", "text": "func (ds *DjangoSession) Deleted() bool {\n\treturn ds._deleted\n}", "title": "" }, { "docid": "138d542daf631de97a46dacebc0259d1", "score": "0.4924314", "text": "func (s *OrderService) DeleteByUserID(ctx context.Context, userID string) error {\n\treturn s.orderRepo.DeleteByUserID(ctx, userID)\n}", "title": "" }, { "docid": "9c80a384cf0f122177bf5933099a5641", "score": "0.4922554", "text": "func (o *StatusChange) DeletedAt() time.Time {\n\tif o != nil && o.bitmap_&16 != 0 {\n\t\treturn o.deletedAt\n\t}\n\treturn time.Time{}\n}", "title": "" }, { "docid": "daa549a37a3d22cbcb2c01557716bdb6", "score": "0.49215546", "text": "func (m *CommentMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "fad36332a5d44ac7fee9929730458f25", "score": "0.49209043", "text": "func (ufbi *UserFeedBackIssue) Deleted() bool {\n\treturn ufbi._deleted\n}", "title": "" }, { "docid": "8daad1567bf5fc0a7136ac28b79f18ba", "score": "0.4920197", "text": "func (pv *PostView) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !pv._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif pv._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM test.post_views WHERE id = $1`\n\n\t// run query\n\tXOLog(sqlstr, pv.ID)\n\t_, err = db.Exec(sqlstr, pv.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tpv._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "b3fccff6ec8718ce8facb4d8337697d8", "score": "0.49137112", "text": "func (table *TableElem) ReferencedBy() []FKElem {\n\treturn table.referencedBy\n}", "title": "" }, { "docid": "c2c843063c868f2219eb572d74988348", "score": "0.49133852", "text": "func (o *IndexerNode) MarkDeleted() {\n\n\to.isDelete = true\n}", "title": "" }, { "docid": "c2c843063c868f2219eb572d74988348", "score": "0.49133852", "text": "func (o *IndexerNode) MarkDeleted() {\n\n\to.isDelete = true\n}", "title": "" }, { "docid": "e266773b204e84cd6b5d58a3070f803a", "score": "0.49087873", "text": "func (e *Entity) Del(key string) error {\n\treturn ae.Delete(e.Context, e.Key(key))\n}", "title": "" }, { "docid": "2c1b98e3d0a16c7c0b0526c496cd1116", "score": "0.49053177", "text": "func (dm *DjangoMigration) Deleted() bool {\n\treturn dm._deleted\n}", "title": "" }, { "docid": "da7b4d1935e454e55d98bef25daead45", "score": "0.49012494", "text": "func (i *Identity) Deleted() bool {\n\treturn i._deleted\n}", "title": "" }, { "docid": "0180968dee390af50d25a1a70a1bcd95", "score": "0.48999807", "text": "func (fd *FoodDiary) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !fd._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif fd._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM public.food_diary WHERE id = $1`\n\n\t// run query\n\tXOLog(sqlstr, fd.ID)\n\t_, err = db.Exec(sqlstr, fd.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tfd._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "b872b4c3c69c3270db8e4289f1938061", "score": "0.48987612", "text": "func (m *ArticleMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "077a64497e9c57202e2008f8f271176f", "score": "0.48983833", "text": "func (procurementModel ProcurementModel) DeleteFarmer(id uint64) (int64, error) {\n\n\tresult, err := procurementModel.Db.Exec(`UPDATE farmer_registration SET farmer_status = false WHERE farmer_id = ?`, id)\n\n\tif err != nil {\n\t\treturn 0, err\n\t} else { \n\n\t\treturn result.RowsAffected()\n\t}\n}", "title": "" }, { "docid": "6c30fb7078287769b350285202610c7c", "score": "0.489733", "text": "func (o *PrivateHostOp) Delete(ctx context.Context, zone string, id types.ID) error {\n\t// build request URL\n\tpathBuildParameter := map[string]interface{}{\n\t\t\"rootURL\": SakuraCloudAPIRoot,\n\t\t\"pathSuffix\": o.PathSuffix,\n\t\t\"pathName\": o.PathName,\n\t\t\"zone\": zone,\n\t\t\"id\": id,\n\t}\n\n\turl, err := buildURL(\"{{.rootURL}}/{{.zone}}/{{.pathSuffix}}/{{.pathName}}/{{.id}}\", pathBuildParameter)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// build request body\n\tvar body interface{}\n\n\t// do request\n\t_, err = o.Client.Do(ctx, \"DELETE\", url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build results\n\n\treturn nil\n}", "title": "" }, { "docid": "de5bd111f52bf1331eace8908b21957b", "score": "0.48943126", "text": "func (db *db) DeleteUser(p peer.ID) error {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tif _, ok := db.storage[p]; ok {\n\t\tdelete(db.storage, p)\n\t\treturn nil\n\t}\n\treturn errUnknownUser\n}", "title": "" }, { "docid": "162b0f81d928693ec95dca72cbeabe25", "score": "0.48942715", "text": "func (m *ScopeMutation) DeletedAt() (r time.Time, exists bool) {\n\tv := m.deleted_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "4cb18f86747b5442f123e5764bdb609a", "score": "0.48912483", "text": "func (l *Ledger) Deleted() bool {\n\treturn l._deleted\n}", "title": "" }, { "docid": "aa963a69891dee8b0cf625f669ea990e", "score": "0.48889717", "text": "func (so *ServiceOffering) AfterDelete(tx *gorm.DB) error {\n\treturn tx.Model(&serviceplan.ServicePlan{}).Where(\"source_ref = ? AND tenant_id = ? AND source_id = ?\", so.SourceRef, so.TenantID, so.SourceID).Delete(&serviceplan.ServicePlan{}).Error\n}", "title": "" }, { "docid": "2366bd05e48117b461ca7aee2fc660dc", "score": "0.4888591", "text": "func (o *DriveItem) GetDeleted() Deleted {\n\tif o == nil || o.Deleted == nil {\n\t\tvar ret Deleted\n\t\treturn ret\n\t}\n\treturn *o.Deleted\n}", "title": "" }, { "docid": "7d520e30c29a99543f9ce4084f460888", "score": "0.4887371", "text": "func deleteCallback(scope *gorm.Scope) {\n\tif !scope.HasError() {\n\t\tvar extraOption string\n\t\tif str, ok := scope.Get(\"gorm:delete_option\"); ok {\n\t\t\textraOption = fmt.Sprint(str)\n\t\t}\n\n\t\tif !scope.Search.Unscoped {\n\t\t\tif isDeletedField, ok := scope.FieldByName(\"IsDeleted\"); ok {\n\t\t\t\tif deletedAtField, hasDeletedAtField := scope.FieldByName(\"DeletedAt\"); hasDeletedAtField {\n\t\t\t\t\tscope.Raw(fmt.Sprintf(\n\t\t\t\t\t\t\"UPDATE %v SET %v=%v,%v=%v%v%v\",\n\t\t\t\t\t\tscope.QuotedTableName(),\n\t\t\t\t\t\tscope.Quote(isDeletedField.DBName),\n\t\t\t\t\t\tscope.AddToVars(1),\n\t\t\t\t\t\tscope.Quote(deletedAtField.DBName),\n\t\t\t\t\t\tscope.AddToVars(gorm.NowFunc()),\n\t\t\t\t\t\taddExtraSpaceIfExist(scope.CombinedConditionSql()),\n\t\t\t\t\t\taddExtraSpaceIfExist(extraOption),\n\t\t\t\t\t)).Exec()\n\t\t\t\t} else {\n\t\t\t\t\tscope.Raw(fmt.Sprintf(\n\t\t\t\t\t\t\"UPDATE %v SET %v=%v%v%v\",\n\t\t\t\t\t\tscope.QuotedTableName(),\n\t\t\t\t\t\tscope.Quote(isDeletedField.DBName),\n\t\t\t\t\t\tscope.AddToVars(1),\n\t\t\t\t\t\taddExtraSpaceIfExist(scope.CombinedConditionSql()),\n\t\t\t\t\t\taddExtraSpaceIfExist(extraOption),\n\t\t\t\t\t)).Exec()\n\t\t\t\t}\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tscope.Raw(fmt.Sprintf(\n\t\t\t\"DELETE FROM %v%v%v\",\n\t\t\tscope.QuotedTableName(),\n\t\t\taddExtraSpaceIfExist(scope.CombinedConditionSql()),\n\t\t\taddExtraSpaceIfExist(extraOption),\n\t\t)).Exec()\n\t}\n}", "title": "" }, { "docid": "4b53b3884772b4f1be98f8c3eeac219e", "score": "0.4886424", "text": "func DeleteNodeRevision_commentViaDeleted(iDeleted int) (err error) {\n\tvar has bool\n\tvar _NodeRevision_comment = &NodeRevision_comment{Deleted: iDeleted}\n\tif has, err = Engine.Get(_NodeRevision_comment); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"deleted = ?\", iDeleted).Delete(new(NodeRevision_comment)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "19ee0da569824c05f21f9d4c1c656cad", "score": "0.48822403", "text": "func (s *SpaceUser) DeleteByUserId(userId string) (err error) {\n\tdb := G.DB()\n\t_, err = db.Exec(db.AR().Delete(Table_SpaceUser_Name, map[string]interface{}{\n\t\t\"user_id\": userId,\n\t}))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "7975cabfe2f9825d2d30a24d4f1eebd2", "score": "0.4880713", "text": "func (o *Doctor) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Doctor provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), doctorPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"doctor\\\" WHERE \\\"doctor_id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from doctor\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for doctor\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "cb8c3e2084345b1db164db3d95367bf6", "score": "0.48729464", "text": "func (db *CommentStore) Delete(username, postID string) error {\n\tq := `DELETE FROM comments WHERE post_id = $1 AND\n\t\tcommenter_id = (SELECT id FROM users WHERE username = $2)`\n\t_, err := db.Exec(q, postID, username)\n\treturn err\n}", "title": "" }, { "docid": "0164e29230d4f720becc291ae53c2d74", "score": "0.48709902", "text": "func (h *HostHandler) DeleteHost(w http.ResponseWriter, r *http.Request) {\n\n\t// Assume if we've reach this far, we can access the article\n\t// context because this handler is a child of the ArticleCtx\n\t// middleware. The worst case, the recoverer middleware will save us.\n\thost := r.Context().Value(\"host\").(*models.Host)\n\n\tif err := h.HostUsecase.Delete(r.Context(), host.ID); err != nil {\n\t\trender.Render(w, r, _restUtil.NewErrorResponse(err))\n\t\treturn\n\t}\n\n\tw.Write([]byte(fmt.Sprintf(\"host deleted with id %v\", host.ID)))\n\n}", "title": "" } ]
14d42ef4041f863e9ff81057ae10a4f9
MysqlAddr returns hostname:mysql port.
[ { "docid": "71241f3a06a82f911ed8db642d8f95b5", "score": "0.76679146", "text": "func (ti *TabletInfo) MysqlAddr() string {\n\treturn netutil.JoinHostPort(ti.Tablet.MysqlHostname, ti.Tablet.MysqlPort)\n}", "title": "" } ]
[ { "docid": "a8f0d28e578f0d1d697e79deb338e792", "score": "0.73524356", "text": "func (mysqld *Mysqld) Addr() string {\n\thostname := netutil.FullyQualifiedHostnameOrPanic()\n\treturn fmt.Sprintf(\"%v:%v\", hostname, mysqld.config.MysqlPort)\n}", "title": "" }, { "docid": "68ca4d600a35bf59e286bbe5517f723e", "score": "0.6841137", "text": "func (m MySQL) GetPort() int {\n\treturn 3306\n}", "title": "" }, { "docid": "451f04eeae77be9f6b44404217edc4b4", "score": "0.6538818", "text": "func (mysqld *Mysqld) IpAddr() string {\n\taddr, err := netutil.ResolveIpAddr(mysqld.Addr())\n\tif err != nil {\n\t\tpanic(err) // should never happen\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "94a6a3780a1126c0c2dd83c813e67099", "score": "0.64638156", "text": "func getDBAddress() string {\n\tuser := config.App.MysqlUser\n\tpass := config.App.MysqlPassword\n\thost := config.App.MysqlHost\n\tport := config.App.MysqlPort\n\tdb := config.App.MysqlDatabase\n\n\treturn fmt.Sprintf(\"%s:%s@(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local\", user, pass, host, port, db)\n}", "title": "" }, { "docid": "29159ad517a4aa7f49bfc8167ff26ce3", "score": "0.63513917", "text": "func getMySqlEndpoint() string {\n\tlog.Print(\"looking up database endpoint...\")\n\tif (DB_HOST != \"\") {\n\t\treturn DB_HOST\n\t}\n\tsess := session.Must(session.NewSession())\n\tssmSvc := ssm.New(sess)\n\tinput := &ssm.GetParameterInput{ Name: &DB_ENDPOINT_PARAMETER_NAME }\n\tresult, err := ssmSvc.GetParameter(input)\n\tif err != nil {\n\t if err, ok := err.(awserr.Error); ok {\n\t switch err.Code() {\n\t default:\n\t fmt.Println(err.Error())\n\t }\n\t } else {\n\t fmt.Println(err.Error())\n\t }\n\t\treturn \"\"\n\t}\n\tretval := *(result.Parameter.Value)\n\treturn retval\n}", "title": "" }, { "docid": "5ace9a7c02520f885843098a2efb7502", "score": "0.62680846", "text": "func (srv *tcpServer) addr() string {\n\treturn net.JoinHostPort(srv.host, srv.port)\n}", "title": "" }, { "docid": "ad756f98732ac6a8d5e7f3c529c63245", "score": "0.6201216", "text": "func getMySQLConnectionString() (string, error) {\n\tcnfPath := path.Join(configDir, \"client.cnf\")\n\tcfg, err := ini.Load(cnfPath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Could not open %s: %s\", cnfPath, err)\n\t}\n\n\tclient := cfg.Section(\"client\")\n\thost := client.Key(\"host\").String()\n\tuser := client.Key(\"user\").String()\n\tpassword := client.Key(\"password\").String()\n\tport, err := client.Key(\"port\").Int()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Invalid port in %s: %s\", cnfPath, err)\n\t}\n\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%d)/?timeout=5s&multiStatements=true&interpolateParams=true\",\n\t\tuser, password, host, port,\n\t)\n\treturn dsn, nil\n}", "title": "" }, { "docid": "76de578466582dc8f3b80b65e707109a", "score": "0.6163118", "text": "func (c *Config) GetAddr() string {\n\tif c.Port != 0 {\n\t\treturn fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n\t}\n\t//default\n\treturn \":8080\"\n}", "title": "" }, { "docid": "a44d4d02874a993990d270e29d1ec1dd", "score": "0.61388797", "text": "func (rCfg *RedisConfig) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", rCfg.Host, rCfg.Port)\n}", "title": "" }, { "docid": "0ae7bf75303c911f2b32f74af1c7eeba", "score": "0.6078702", "text": "func (c *Cfg) Addr() string {\n\treturn net.JoinHostPort(c.Host, fmt.Sprint(c.Port))\n}", "title": "" }, { "docid": "4d8f872095aa18edb7ec5cbbfb6fc3dd", "score": "0.6070573", "text": "func (db *Database) Address() string {\n\treturn db.Host + \":\" + strconv.Itoa(db.Port)\n}", "title": "" }, { "docid": "4d8f872095aa18edb7ec5cbbfb6fc3dd", "score": "0.6070573", "text": "func (db *Database) Address() string {\n\treturn db.Host + \":\" + strconv.Itoa(db.Port)\n}", "title": "" }, { "docid": "6f3caf565103148802e5f911b143390d", "score": "0.5911501", "text": "func (c *Config) getAddress() string {\n\thost := \"localhost\"\n\tif c.BindAddress != \"\" {\n\t\thost = c.BindAddress\n\t}\n\n\tport := \"80\"\n\tif c.BindPort != \"\" {\n\t\tport = c.BindPort\n\t}\n\n\treturn fmt.Sprintf(\"%s:%s\", host, port)\n}", "title": "" }, { "docid": "21af5fc551f02a3d4770673b794571d0", "score": "0.5903134", "text": "func (c *Connection) Addr() string {\n\treturn c.Conn.RemoteAddr().String()\n}", "title": "" }, { "docid": "30015e41a551fe224bdd55bfd39e43d6", "score": "0.58963776", "text": "func (c *Config) Addr() string {\n\treturn net.JoinHostPort(c.Host, fmt.Sprint(c.Port))\n}", "title": "" }, { "docid": "931e57bb57a59edd5676417738956ae7", "score": "0.5855147", "text": "func (conn *Connection) Addr() string {\n\treturn conn.Conn.RemoteAddr().String()\n}", "title": "" }, { "docid": "dfad4b39f239c554724ac364a5e2c09f", "score": "0.5845268", "text": "func (this *ServerInfo) Addr() string {\n\treturn this.IP + \":\" + strconv.Itoa(this.Port)\n}", "title": "" }, { "docid": "f7fee6c5e817839d8e15691bf35aeca0", "score": "0.5841803", "text": "func (c *Config) GetMysqlDSN() string {\n\treturn fmt.Sprintf(\"%s:%s@tcp(%s:%d)/?timeout=5s&multiStatements=true&interpolateParams=true\",\n\t\tc.User, c.Password, c.Host, c.Port,\n\t)\n}", "title": "" }, { "docid": "489504425a98f091662d68602397e03b", "score": "0.58409864", "text": "func (c *Config) GetAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n}", "title": "" }, { "docid": "c7f62351ba2b9df3460950f3f23cf5bc", "score": "0.5808633", "text": "func MySQL(dsn string) (m map[string]string, err error) {\n\tvar cfg *mysql.Config\n\tif cfg, err = mysql.ParseDSN(dsn); err == nil {\n\t\taddr := strings.Split(cfg.Addr, \":\")\n\t\tm = map[string]string{\n\t\t\t\"user\": cfg.User,\n\t\t\t\"host\": addr[0],\n\t\t\t\"port\": addr[1],\n\t\t\t\"dbname\": cfg.DBName,\n\t\t}\n\t\treturn m, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "347ba93966ff920565365608301bc303", "score": "0.5789449", "text": "func (s *Server) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", s.IP, s.Port)\n}", "title": "" }, { "docid": "edb19b6bf694b29c50eb86b0a07a167c", "score": "0.57856226", "text": "func (m *Multiplexer) Addr() net.Addr {\n\treturn m.conn.LocalAddr()\n}", "title": "" }, { "docid": "3fedaf187bb7c8d3e4484ce7eb1ebc97", "score": "0.5782971", "text": "func (l *UnixListener) Addr() Addr {}", "title": "" }, { "docid": "5723372fb515eefbb0350c8a223553b5", "score": "0.5770555", "text": "func (s *Server) Addr() string {\n\treturn fmt.Sprintf(\"%v:%v\", s.host, s.port)\n}", "title": "" }, { "docid": "c5d7f5c0ae1032b9e379992d6a846924", "score": "0.5764211", "text": "func (c *DBConfig) GetMySQLConnStr() string {\n\treturn fmt.Sprintf(\"%s:%s@/%s\", c.User, c.Password, c.DBName)\n}", "title": "" }, { "docid": "565474837d88805e4f0e6407de3b8512", "score": "0.5760827", "text": "func (s Server) Addr() string {\n\treturn net.JoinHostPort(s.Host, s.Port)\n}", "title": "" }, { "docid": "d3dc3264390b4ef1adf8f28046257c8c", "score": "0.5756856", "text": "func (m *MySQL) DSN() string {\n\treturn fmt.Sprintf(\"root@tcp(%s.%s.svc:3306)/test\", m.Svc.Name, m.Svc.Namespace)\n}", "title": "" }, { "docid": "3ed72cbeae4eb75f6ec6a474b129ad08", "score": "0.5741476", "text": "func (c *MdbClient) ServerAddress() string {\n\tserverConfig := c.config.Server\n\treturn fmt.Sprintf(\"%s:%d\", serverConfig.Host, serverConfig.Port)\n}", "title": "" }, { "docid": "13774ca4332688f4a11a8e7574133da9", "score": "0.572581", "text": "func (s *Server) GetAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", s.Config.Addr, s.Config.Port)\n}", "title": "" }, { "docid": "9948b8f42763a2a8363853001b84ba88", "score": "0.5724778", "text": "func (l *TCPListener) Addr() Addr {}", "title": "" }, { "docid": "0d2e72679fa312c90e9b393598d39791", "score": "0.5722541", "text": "func (c *conn) RemoteAddr() Addr {}", "title": "" }, { "docid": "68a1d3de056a32fbf48820ff30340940", "score": "0.5680765", "text": "func (cc *ConnectorClient) ServerAddress(name string) (hostname string,err error) {\n children,_,err := cc.zoo.Children(\"/connector/\"+name) //Get the list of children of given name node\n if (err != nil) { //Make sure the name node exists\n return \"\",err\n }\n if (len(children)<1) { //Make sure that there is at least one server connected\n return \"\",errors.New(\"No server found\")\n }\n //For now, the implementation only cares about one server: the first one\n i:=strings.LastIndex(children[0],\":\") //We want to strip the pid from the server address\n if (i<0) {\n return \"\",errors.New(\"Malformed server data\")\n }\n return children[0][0:i],nil\n}", "title": "" }, { "docid": "acaa824f04844b0e47acfb83b32aa7be", "score": "0.56724703", "text": "func (c *Context) ListenAddr() string {\n\treturn fmt.Sprintf(\":%d\", c.Port)\n}", "title": "" }, { "docid": "136213ce658b7bbc73d59cbfa5b27d28", "score": "0.56660736", "text": "func (c *FGConfig) GetAddr() string {\n\taddr := fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n\treturn addr\n}", "title": "" }, { "docid": "37e95c3d8cb235a9c882c2ef16bb9c48", "score": "0.56586736", "text": "func (m *MySQL) DefaultPort() uint {\n\treturn 3306\n}", "title": "" }, { "docid": "a2fb34919cfc839c49886289e1c3c5a4", "score": "0.56527966", "text": "func (o ConnectionProfileMysqlPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ConnectionProfileMysql) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "6d2f16c04582099af4838194d7f8d543", "score": "0.56486017", "text": "func (md *MdServer) BindAddr() string {\n\treturn fmt.Sprintf(\"%v:%v\", md.bindHost, md.bindPort)\n}", "title": "" }, { "docid": "00a04774fb0809c3ff2d6015a218404c", "score": "0.5648551", "text": "func (r *Remote) DaemonAddr() (string, error) {\n\tif r.Daemon == nil {\n\t\treturn \"\", errors.New(\"Daemon configuration not set for remote\")\n\t}\n\treturn \"https://\" + r.IP + \":\" + r.Daemon.Port, nil\n}", "title": "" }, { "docid": "21fe8d24f6c262c7949f332a2940e9fb", "score": "0.564769", "text": "func (c *Context) ListenAddr() string {\n\tswitch c.Port {\n\tcase 80:\n\t\treturn \":http\"\n\tcase 443:\n\t\treturn \":https\"\n\t}\n\treturn fmt.Sprintf(\":%d\", c.Port)\n}", "title": "" }, { "docid": "45b491969898df3f09d3802358b1ac78", "score": "0.56473553", "text": "func (a *Adaptor) Port() string { return a.Host }", "title": "" }, { "docid": "41eace192bf24c3da2d30bf79b10d346", "score": "0.5642772", "text": "func getServerAddr() string {\n\taddr := getCommandLineOptValue(\"-address\")\n\tif addr != \"\" {\n\t\treturn addr\n\t}\n\treturn defaultServerAddr\n}", "title": "" }, { "docid": "a415a247b300749569b6e89a7202693e", "score": "0.5640932", "text": "func ConnectMysql(addr string, c model.Credential, timeout time.Duration) (bool, error) {\n\tdataSourceName := fmt.Sprintf(\"%s@tcp(%s)/?timeout=%s\", url.UserPassword(c.User, c.Password).String(), addr, timeout)\n\treturn Connect(\"mysql\", dataSourceName, timeout)\n}", "title": "" }, { "docid": "7e9a7c2ed68e727bc32b17ff8a065f18", "score": "0.56220675", "text": "func (c *Consumer) HostPortAddr() string {\n\thostPortAddr := (*string)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&c.hostPortAddr))))\n\tif hostPortAddr != nil {\n\t\treturn *hostPortAddr\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "639a19ae7fd5f5e3a59a5bf93bac0a57", "score": "0.56043845", "text": "func (c *Container) Addr(port int) string {\n\texposed := c.Port(port)\n\treturn net.JoinHostPort(c.host, strconv.Itoa(exposed))\n}", "title": "" }, { "docid": "cdd2c18704fa440170b44c1e2c651741", "score": "0.5599459", "text": "func (p *Provider) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", p.IP, p.Port)\n}", "title": "" }, { "docid": "1796dce6cfca6a0a47aa6b4343aea2f7", "score": "0.5596689", "text": "func (l *Listener) Addr() net.Addr {\n\treturn l.conn.LocalAddr()\n}", "title": "" }, { "docid": "b51ba22f92853849327fdac3b3cdf2d8", "score": "0.5596507", "text": "func (s *metadataCredentialService) Addr() net.Addr {\n\treturn s.listener.Addr()\n}", "title": "" }, { "docid": "3858565b77b46d2a3bb3e95f21aa953b", "score": "0.55926245", "text": "func (cfg *Config) MysqlDSN() string {\n\tvar dsn string\n\tvar err error\n\tif dsn, err = getMySQLConnectionString(); err != nil {\n\t\tlog.Info(\"failed to get mysql DSN string\", \"error\", err)\n\t}\n\treturn dsn\n}", "title": "" }, { "docid": "a8a8e0a1affb54646da3adab7c141d05", "score": "0.5588775", "text": "func (m *MySQL) Conn() string {\n\tif m.ConnectionString != \"\" {\n\t\tconnStr := strings.TrimPrefix(m.ConnectionString, \"mysql://\")\n\t\tconnStr = strings.Split(connStr, \"?\")[0]\n\t\tconnStr = strings.Replace(connStr, \"@\", \"@tcp(\", 1)\n\t\tif strings.Contains(connStr, \":3306\") {\n\t\t\tconnStr = strings.Replace(connStr, \"/\", \")/\", 1)\n\t\t} else {\n\t\t\tconnStr = strings.Replace(connStr, \"/\", \":3306)/\", 1)\n\t\t}\n\t\tconnStr += \"?parseTime=true&charset=utf8mb4\"\n\n\t\treturn connStr\n\t}\n\n\treturn fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?parseTime=true&charset=utf8mb4\",\n\t\tm.User, m.Password, m.Host, m.Port, m.DB)\n}", "title": "" }, { "docid": "4b286bf9538771fb1f281766f561bff9", "score": "0.5582411", "text": "func (server *Server) GetAddress() string {\n\treturn fmt.Sprintf(\"http://localhost:%d\", server.Port)\n}", "title": "" }, { "docid": "1897b8b4db8f86c9e2444b35e3e625ec", "score": "0.55783767", "text": "func (h *Srv) Addr() (string, error) {\n\th.Lock()\n\tdefer h.Unlock()\n\tif h.server != nil {\n\t\treturn h.server.Addr, nil\n\t}\n\treturn \"\", errors.New(\"server not running\")\n}", "title": "" }, { "docid": "0cfe70ec52fab4dc9932c2576ca5fb6f", "score": "0.5573137", "text": "func (inst *TiFlashInstance) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", inst.Host, inst.ServicePort)\n}", "title": "" }, { "docid": "cf0ea21b9aecb0e65155795b3ef1649e", "score": "0.5571995", "text": "func portAddress(port int) string { return \":\" + strconv.Itoa(port) }", "title": "" }, { "docid": "65a25b8e6eb4a9be1e5fcaf8e9dfdab4", "score": "0.5571602", "text": "func (ac *appConfig) MysqlDataSource() string {\n\tif ac.mysqlDataSource != nil {\n\t\treturn *ac.mysqlDataSource\n\t}\n\n\tformat := \"%s:%s@tcp(%s)/%s\"\n\tvar args []interface{}\n\n\tif viper.IsSet(\"MYSQL_USERNAME\") {\n\t\targs = append(args, viper.GetString(\"MYSQL_USERNAME\"))\n\t} else {\n\t\tlog.Fatal(\"please set MYSQL_USERNAME in environment variable\")\n\t}\n\n\tif viper.IsSet(\"MYSQL_PASSWORD\") {\n\t\targs = append(args, viper.GetString(\"MYSQL_PASSWORD\"))\n\t} else {\n\t\tlog.Fatal(\"please set MYSQL_PASSWORD in environment variable\")\n\t}\n\n\tif viper.IsSet(\"MYSQL_ADDRESS\") {\n\t\targs = append(args, viper.GetString(\"MYSQL_ADDRESS\"))\n\t} else {\n\t\tlog.Fatal(\"please set MYSQL_ADDRESS in environment variable\")\n\t}\n\n\tif viper.IsSet(\"MYSQL_DATABASE\") {\n\t\targs = append(args, viper.GetString(\"MYSQL_DATABASE\"))\n\t} else {\n\t\tlog.Fatal(\"please set MYSQL_DATABASE in environment variable\")\n\t}\n\n\tac.mysqlDataSource = _string(fmt.Sprintf(format, args...))\n\treturn *ac.mysqlDataSource\n}", "title": "" }, { "docid": "0e948a9d000662f0e6b7ba75de97ff91", "score": "0.5569397", "text": "func (f *FakeServer) GetAddr() (string, error) { return \"\", nil }", "title": "" }, { "docid": "5e91578d53cba2b2b0609f46755a6433", "score": "0.554978", "text": "func (core *Host) Addr() net.Addr {\n\treturn core.conn.LocalAddr()\n}", "title": "" }, { "docid": "183aff4b8ac952aae54e5b319a4ae991", "score": "0.55345166", "text": "func (i *CDCInstance) GetAddr() string {\n\treturn utils.JoinHostPort(i.GetHost(), i.GetPort())\n}", "title": "" }, { "docid": "bfcf4c628ef1cf7e44ed67b814a60f49", "score": "0.5531499", "text": "func (c Config) HTTPAddr() string {\n\treturn (\"http://\" + c.HTTPHost + \":\" + c.HTTPPort)\n}", "title": "" }, { "docid": "a6a541482c07a343e886a37b9348c5f8", "score": "0.55268896", "text": "func getListenAdress() string {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t\tfmt.Printf(\"Defaulting to port %s\", port)\n\t}\n\t_, err := strconv.Atoi(port)\n\tif err != nil {\n\t\tlog.Fatalln(\"Invalid port\", port)\n\t}\n\treturn fmt.Sprintf(\"0.0.0.0:%s\", port)\n}", "title": "" }, { "docid": "765c50b865a119bd554df53597b9d6e9", "score": "0.55259943", "text": "func (o ConnectionProfileMysqlOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ConnectionProfileMysql) int { return v.Port }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "4ebce5dfc9be4ec5dace934b146e3d22", "score": "0.551597", "text": "func (c *Config) HttpAddr() string {\n\treturn net.JoinHostPort(c.Host, fmt.Sprintf(\"%d\", c.HTTPPort))\n}", "title": "" }, { "docid": "4ebce5dfc9be4ec5dace934b146e3d22", "score": "0.551597", "text": "func (c *Config) HttpAddr() string {\n\treturn net.JoinHostPort(c.Host, fmt.Sprintf(\"%d\", c.HTTPPort))\n}", "title": "" }, { "docid": "06c2d2079ed23c6036eb7f064e85bffc", "score": "0.5515637", "text": "func remoteAddrPort(r *http.Request) string {\n\tsplitAddr := strings.Split(r.RemoteAddr, \":\")\n\treturn splitAddr[len(splitAddr)-1]\n}", "title": "" }, { "docid": "4f0d37a357da7c4791c2326126e05553", "score": "0.55081457", "text": "func getServerAddr() string {\n\tport, ok := os.LookupEnv(\"SERVER_PORT\")\n\tif !ok {\n\t\tlogrus.WithFields(\n\t\t\tlogrus.Fields{\n\t\t\t\t\"Function\": \"getServerAddr()\",\n\t\t\t}).Debug(\"App : SERVER PORT environment variable required but not set\")\n\t\tos.Exit(1)\n\t}\n\taddr := \":\" + port\n\treturn addr\n}", "title": "" }, { "docid": "bf0d7beb4774a7ddb06851b6ee773b65", "score": "0.54878306", "text": "func getMysqlConnParam(tablet *cluster.Vttablet) mysql.ConnParams {\n\tconnParams := mysql.ConnParams{\n\t\tUname: username,\n\t\tDbName: dbName,\n\t\tUnixSocket: path.Join(os.Getenv(\"VTDATAROOT\"), fmt.Sprintf(\"/vt_%010d/mysql.sock\", tablet.TabletUID)),\n\t}\n\treturn connParams\n}", "title": "" }, { "docid": "f98ec8c4731fa15969d706c1b2cde322", "score": "0.5477892", "text": "func (o MysqlProfilePtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *MysqlProfile) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "fbf2a7d11485bee1352ce48656b2f30d", "score": "0.5474295", "text": "func (o ConnectionProfileMysqlPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConnectionProfileMysql) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "93930953778902e8658e7c030b49f66c", "score": "0.5470674", "text": "func (t *SocketServer) Addr() net.Addr {\n\tif t.listener != nil {\n\t\treturn t.listener.Addr()\n\t}\n\treturn t.conn.LocalAddr()\n}", "title": "" }, { "docid": "7655b48d12c2d710acdf0b14b8a3ae58", "score": "0.5464778", "text": "func GetServerAddress() string {\n\tif len(sock) > 0 {\n\t\treturn fmt.Sprintf(\"unix:%s\", sock)\n\t}\n\treturn fmt.Sprintf(\"%s:%d\", rootConfig.Host, rootConfig.Port)\n}", "title": "" }, { "docid": "70f782a5769c2af59a5c3274feb880fa", "score": "0.5458375", "text": "func TestGetMysqlConnectionString(t *testing.T) {\n\tconfig := new(Config)\n\tconfig.DBConfig.Address = \"localhost\"\n\tconfig.DBConfig.Port = 3306\n\tconfig.DBConfig.Username = \"developer\"\n\tconfig.DBConfig.Password = \"abcd1234\"\n\tconfig.DBConfig.Schema = \"kcapp\"\n\n\tconn := config.GetMysqlConnectionString()\n\tassert.Equal(t, conn, \"developer:abcd1234@(localhost:3306)/kcapp?parseTime=true\")\n}", "title": "" }, { "docid": "1d38e96e6757f4518cec14879211016d", "score": "0.5458047", "text": "func (n Node) getAddress() string{\n\treturn \"http://\" + n.Host + \":\" + strconv.Itoa(n.Port) + \"/graphql\" //CHANGE HTTP:// to Schema\n}", "title": "" }, { "docid": "730aff1138e9f489f4834343b7dae611", "score": "0.5457427", "text": "func getListenAddress() string {\n\tport := getEnv(\"PORT\", \"1338\")\n\treturn \":\" + port\n}", "title": "" }, { "docid": "97794300239a7439e01414fe0f02f7d3", "score": "0.5454444", "text": "func (s *Server) Addr() string {\n\treturn s.listener.Addr().String()\n}", "title": "" }, { "docid": "19e9b9bdc2366b6fd0cc40241a8b0397", "score": "0.54462385", "text": "func (config ServerConfig) GetDbPort() int {\n\tif config.DbURL != \"\" {\n\t\tu, err := url.Parse(config.DbURL)\n\t\tif err != nil {\n\t\t\treturn 5432\n\t\t}\n\t\tparts := strings.Split(u.Host, \":\")\n\n\t\tif len(parts) == 2 {\n\t\t\tport, _ := strconv.Atoi(parts[1])\n\t\t\treturn port\n\t\t}\n\n\t\treturn 5432\n\t}\n\n\treturn config.DbPort\n}", "title": "" }, { "docid": "458c7f080aa1c157156c81b36f87ed16", "score": "0.5441891", "text": "func (cln *client) Addr() string {\n\treturn cln.conn.RemoteAddr().String()\n}", "title": "" }, { "docid": "fdec57beb65c36e666a7e15c5797288e", "score": "0.54351795", "text": "func (ti *TabletInfo) Addr() string {\n\treturn netutil.JoinHostPort(ti.Hostname, int32(ti.PortMap[\"vt\"]))\n}", "title": "" }, { "docid": "58407f977a7da5b11702e54d8b3e32e6", "score": "0.5434593", "text": "func (l *connListener) Addr() net.Addr {\n\treturn l.addr\n}", "title": "" }, { "docid": "c60f5c8c42079b332fd4cd8bf4bd8aff", "score": "0.54334885", "text": "func (f *FTPServer) Address() string {\n\tport := f.Listener.Addr().(*net.TCPAddr).Port\n\treturn \"127.0.0.1:\" + strconv.Itoa(port)\n}", "title": "" }, { "docid": "e708f1dab837978dc3a8c088cc1ed369", "score": "0.5433102", "text": "func getListenAddress() string {\n\tport := \"1338\"\n\treturn \":\" + port\n}", "title": "" }, { "docid": "0f9a7ec8ccae663aab89fcda3277baf2", "score": "0.5432333", "text": "func (b *Broker) GetBrokerAddr() string {\n\tif b.addr == \"\" {\n\t\tb.addr = fmt.Sprintf(\"%v:%v\", b.Network.HostName, b.Network.Port)\n\t}\n\treturn b.addr\n}", "title": "" }, { "docid": "8c6af2671d609fd98db784fef0c8e589", "score": "0.5428012", "text": "func (d *Daemon) Addr() net.Addr {\n\treturn d.rpcListener.Addr()\n}", "title": "" }, { "docid": "9d618d370b7b4e900852a751ba6e98c2", "score": "0.5426752", "text": "func (c *Client) Addr() string {\n\tif c.unixSocket != \"\" {\n\t\treturn c.unixSocket\n\t}\n\treturn c.url.String()\n}", "title": "" }, { "docid": "a9079b15891ec6df147bd80cb87b7433", "score": "0.54261565", "text": "func (listener *CarbonlinkListener) Addr() net.Addr {\n\tif listener.tcpListener == nil {\n\t\treturn nil\n\t}\n\treturn listener.tcpListener.Addr()\n}", "title": "" }, { "docid": "fe64210647e5ec8dde40e309692dbecc", "score": "0.54220396", "text": "func getListenAddress() string {\n\tport := getPort(\"PORT\", \"1338\")\n\treturn \":\" + port\n}", "title": "" }, { "docid": "11bac208b2676394458280eb98c6640a", "score": "0.5419976", "text": "func MysqlConnect(configName string) *gorm.DB {\n\tmysql := LoadDBConfig(configName)\n\tconnection, err := gorm.Open(\"mysql\", mysql.User+\":\"+mysql.Password+\"@tcp(\"+mysql.Host+\":\"+strconv.Itoa(mysql.Port)+\")/\"+mysql.DBName+\"?charset=utf8&parseTime=True&loc=Local\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif mysql.DebugMode {\n\t\treturn connection.Debug()\n\t}\n\n\treturn connection\n}", "title": "" }, { "docid": "3ca000549bd942818a8c6a4801094c8b", "score": "0.54179597", "text": "func getDBAddr() (string, error) {\n\tif *dbAddrFlag != \"\" {\n\t\tglog.V(2).Infof(\"-db_addr is specified, so using it: %s\\n\", *dbAddrFlag)\n\t\treturn *dbAddrFlag, nil\n\t}\n\taddr, err := etcdwrapper.Read(fmt.Sprintf(\"/services/db/%s\", stage))\n\tif err != nil {\n\t\tglog.Errorf(\"failed to get DB address from etcd: %v\", err)\n\t\treturn \"\", err\n\t}\n\tglog.Infof(\"etcd says DB can be found at: %s\\n\", addr)\n\treturn addr, nil\n}", "title": "" }, { "docid": "195f010269991262bf524586d0fa3c5c", "score": "0.5414679", "text": "func getListenAddress() string {\n\tport := getEnv(\"PORT\", \"8888\")\n\treturn \"0.0.0.0:\" + port\n}", "title": "" }, { "docid": "6bc71d3001f43b4ca255a60ca4129e62", "score": "0.5413855", "text": "func (ln *listener) Addr() net.Addr { return nil }", "title": "" }, { "docid": "3dfe3c872a1ceb0c3c4c2eff9b110cdc", "score": "0.54106444", "text": "func (c *Config) ListenAddress() string {\n\treturn fmt.Sprintf(\":%d\", c.Port)\n}", "title": "" }, { "docid": "3dfe3c872a1ceb0c3c4c2eff9b110cdc", "score": "0.54106444", "text": "func (c *Config) ListenAddress() string {\n\treturn fmt.Sprintf(\":%d\", c.Port)\n}", "title": "" }, { "docid": "3dfe3c872a1ceb0c3c4c2eff9b110cdc", "score": "0.54106444", "text": "func (c *Config) ListenAddress() string {\n\treturn fmt.Sprintf(\":%d\", c.Port)\n}", "title": "" }, { "docid": "e01cdfd8fe55a3bbd58637dcbdedb712", "score": "0.5410046", "text": "func serverAddr() (string, error) {\n\treturn redis.DefaultServerAddr()\n}", "title": "" }, { "docid": "d33e4119cebc593b9b035ba99d324421", "score": "0.540637", "text": "func ListenAddr() string {\n\tlistenAddr := net.JoinHostPort(Config.Ipaddress, strconv.Itoa(Config.Port))\n\treturn listenAddr\n}", "title": "" }, { "docid": "0f774af2587bc42961422e298166375a", "score": "0.53975683", "text": "func (adapter *Adapter) Addr() string {\n\treturn adapter.listener.Addr().String()\n}", "title": "" }, { "docid": "3621a6830f8024952b089961bd5d8ced", "score": "0.5395135", "text": "func getGrpcAddr(port uint64) (string, uint64) {\n\tgrpcPort, _ := config.GetUint(\"grpc_port\")\n\tif grpcPort > 0 {\n\t\treturn \":\" + strconv.FormatUint(uint64(grpcPort), 10), uint64(grpcPort)\n\t}\n\treturn \":\" + strconv.FormatUint(uint64(port+6), 10), uint64(port) + 6\n}", "title": "" }, { "docid": "c32badfe5771b29968f5fc0483856a76", "score": "0.5395101", "text": "func (di *DockerizedInstance) Port() int {\n\treturn di.portMap[3306]\n}", "title": "" }, { "docid": "677e1e8514aaac091db5a601c786889e", "score": "0.53926826", "text": "func (ts *Server) Addr() string {\n\treturn ts.addr.String()\n}", "title": "" }, { "docid": "37664a31307b4d62262ddd00a62044ef", "score": "0.539251", "text": "func (spec *TCPSpec) Addr() string {\n\treturn net.JoinHostPort(spec.Host, spec.Port)\n}", "title": "" }, { "docid": "92dc7214ec459e3a765deb86598e6420", "score": "0.53872555", "text": "func (c *Stream) RemoteAddr() net.Addr { return c.master.conn.RemoteAddr() }", "title": "" }, { "docid": "7dc310f00e6dcd9161b3e9c9ea9b914f", "score": "0.5386301", "text": "func (s *Servers) Addr(name string) (a *net.TCPAddr) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tfor _, srv := range s.servers {\n\t\tif srv.name == name {\n\t\t\treturn srv.tcpAddr\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
469543f2818a4ddace44388ef13d2f10
Deprecated: Use GetUsersRequest.ProtoReflect.Descriptor instead.
[ { "docid": "7ef84dbbcfbfc7ac5b0320b722981eee", "score": "0.74672145", "text": "func (*GetUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_userservice_proto_rawDescGZIP(), []int{1}\n}", "title": "" } ]
[ { "docid": "df5f0f83c97989216fadcff7df8ed665", "score": "0.75760996", "text": "func (*GetUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "4e4f2410e2287c9edd4befa0c38b27c0", "score": "0.75088114", "text": "func (*ListUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2860582fba39b2f2a84a1420670b926c", "score": "0.7429899", "text": "func (*GetUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_hello_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "95221eaade2e70369f19a489b42c8545", "score": "0.7401381", "text": "func (*GetAllUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_userpb_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1b3e8879d5fcf90020dcda66d9a87680", "score": "0.7302455", "text": "func (*RequestUsers) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_v1_user_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "40a504255cf1c00efdbeacba465bd3e1", "score": "0.72631955", "text": "func (*GetAllUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "4bf346425a8dd7fa88576752660c7be3", "score": "0.7235839", "text": "func (*ListUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_admin_user_management_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "02a8d95366d473f512209807bab10256", "score": "0.7194834", "text": "func (*ListUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_identitypb_identity_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "127c9e6ab8ca8a8d6a89947fd4c0e2ab", "score": "0.7107874", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d458762d4efcd005a872d35e4cc54d8e", "score": "0.70672506", "text": "func (*UserGetRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4194ec40bd79c7bbb03af7effe63a2a1", "score": "0.70654154", "text": "func (*ListUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "94b245b1f4ae61ebef782f9fbe3efa38", "score": "0.70416987", "text": "func (*ListUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_user_user_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "f325ca7a1f9b8703dbd1bcff420bb76f", "score": "0.70295906", "text": "func (*GetUsersReq) Descriptor() ([]byte, []int) {\n\treturn file_business_int_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b52349b7a614b61b4b275d6d16fc07b8", "score": "0.7024405", "text": "func (*UsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_powergate_admin_v1_admin_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "42df2ac31d96db7fba02ebdb55e403de", "score": "0.70176953", "text": "func (*GetUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "37b4672590c3360ae9daf76466c6548c", "score": "0.7017032", "text": "func (*UserGetRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "613469b37e88ead3fd05d1cab400b1a7", "score": "0.6952297", "text": "func (*ListUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_yelp_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "20d3634fd1dd0603e65c4891747b410e", "score": "0.6933008", "text": "func (*GetUserDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3e5b1ccaeb9030efd359fc3b7f3f46e1", "score": "0.6927504", "text": "func (*ListUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1bdd5efe613856e167de03f452c1633f", "score": "0.6913403", "text": "func (*GetUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "71e25b5bd570d221dee085f1aea7f16d", "score": "0.6861343", "text": "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "3b6e71325105adf2229f061aa6d4aa6e", "score": "0.6861145", "text": "func (*DevicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "ba3b37bbe0570a5478a07c99cc759545", "score": "0.6857432", "text": "func (*GetAllUsersParam) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7702a4863d4143a2495855047cb00390", "score": "0.6856214", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ebeb0ae6a492c5628ab9452d9cd5617a", "score": "0.68484545", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2b258717c77b39bdfdb9fab1273737ff", "score": "0.6848419", "text": "func (*ListUsersRes) Descriptor() ([]byte, []int) {\n\treturn file_pb_userDescribe_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "200ac314422f6ea6a19b8b454250d560", "score": "0.68478703", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_user_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f8564374272fca8b01b40197d0395fbc", "score": "0.6842523", "text": "func (*GetUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_userservice_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "005ff84435a6b5a133900000c67199a4", "score": "0.6837139", "text": "func (*UserListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "330370e8495c7db81564ad6a139beee0", "score": "0.683039", "text": "func (*ImportUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_byteplus_retail_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "82bff9cc95165197d6c7308c934bf8b6", "score": "0.6807239", "text": "func (*GetAllUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "2196e2bc7e4c0f3cea2668ce9289a140", "score": "0.680233", "text": "func (*UserGetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "06ef75b2754ec154edc1ead124fb8f8d", "score": "0.67794997", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_admin_user_management_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7210e5703f181f8302481a526a542597", "score": "0.6777163", "text": "func (*GetAllUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_userpb_user_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c10b8d5115387118de1c4c32b53848ed", "score": "0.6776302", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "829d76ca577609e4ea64fb554815673d", "score": "0.67756456", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_user_user_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "2c8e15ee81ad31bacd1dbb1910ddbd51", "score": "0.6774956", "text": "func (*ListUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "111c0c5c81f2b89ffbfcab5c5a6372f3", "score": "0.67721474", "text": "func (*GetUserDataByUsernameRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "062ed4b75e08eff10e04585a80207c46", "score": "0.6757605", "text": "func (*ListUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "161743b1c6b92119ef4439607af6bf90", "score": "0.6754907", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "858c62056d26c0efe012e7d24cfa6356", "score": "0.6753838", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mkit_service_account_user_v1_user_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "dc00b2484219cd58838165c25331d62d", "score": "0.6742206", "text": "func (*UserRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_users_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ca2b95ee74f7ff74f73932cbaefdc85e", "score": "0.67330503", "text": "func (*GetUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_hello_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "2b1931eb349a215d9b99c29ce1f15917", "score": "0.67195624", "text": "func (*UserUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b2378fa572b197f9d82a2c7ade9146e2", "score": "0.6718349", "text": "func (*Users) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_v1_user_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "032ed382dde1738dcc83b3040bdb1cf3", "score": "0.6709802", "text": "func (*ListUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_identitypb_identity_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "b21a9bcd27dd0413abbce1437fcd8514", "score": "0.67009217", "text": "func (*GetByIdsRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_user_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "59de62375760881e13871a8e382a356e", "score": "0.6694062", "text": "func (*ListUserReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_user_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "b171bc0bafea2fa81b500bd107e8daea", "score": "0.6666726", "text": "func (*ListUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_admin_user_management_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "241877ee5a6e439bcd8f86e1daceba9d", "score": "0.66543704", "text": "func (*CreateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "fc870aa6c61759c0c387a95514d4ae3d", "score": "0.66467947", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_identitypb_identity_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "c647719d21095441030b9b17711e91ba", "score": "0.6630946", "text": "func (*GetUsersResp) Descriptor() ([]byte, []int) {\n\treturn file_business_int_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c68311ad2acfeaa7914ed0b0d56c2ecc", "score": "0.66257626", "text": "func (*SearchUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "56011cb7dca4334abc4588c1ca12702b", "score": "0.662033", "text": "func (*UserGetResponse) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "33656afafc415fbf239521b9d54bd550", "score": "0.6618805", "text": "func (*UserRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_user_v1_user_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1e3b20b096524903ad95667a5ced0c65", "score": "0.6617827", "text": "func (*FetchUserActivesRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_grapery_grapery_common_protoc_user_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "029b5d051be816ebc9d971863eecd328", "score": "0.6616183", "text": "func (*GetUserByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_hello_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cc907d5a421691bead32212793027331", "score": "0.66079473", "text": "func (*ValidateUserPasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "96435e1a31503b538fb6e866be701c18", "score": "0.6601501", "text": "func (*UserUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_grapery_grapery_common_protoc_user_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "78072d4914b8dc33fcee1f5d10f2d6b0", "score": "0.66001517", "text": "func (*LoginRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "128db90cc4236a4b52ea102e0db44b09", "score": "0.6593554", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_user_user_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "ba7d6e46720f6f886ea04115ff6c9cf3", "score": "0.6591948", "text": "func (*FindUserByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_account_account_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "48f1c371e74f3ec486933e21a64994a3", "score": "0.6588726", "text": "func (*RequestFullUsersByUIDs) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "bcd03fccbfb51d6fedc123c644567d67", "score": "0.6584141", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_user_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6f99a3011c1ddf8b494cb90931274a28", "score": "0.6584078", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_authpb_auth_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "53313f947d4181daa51e8e3a8dc2ce76", "score": "0.65800554", "text": "func (*GetUserByIDRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_userpb_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "fe713925bc2580c07af79c7a3a218637", "score": "0.6577948", "text": "func (*Users) Descriptor() ([]byte, []int) {\n\treturn file_api_user_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b0677bb1992e1ad134904ef3084b98a7", "score": "0.656605", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b0677bb1992e1ad134904ef3084b98a7", "score": "0.656605", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "bf16a6eed49378d6eedf0370bd4ee977", "score": "0.65541226", "text": "func (*UserInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_userinfo_user_info_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0b5a76764fe0d0bd294819663bd2276d", "score": "0.6552443", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_user_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "054bae40911ea0b7003e01f31e6c7344", "score": "0.6552276", "text": "func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_rest_proto_rawDescGZIP(), []int{97}\n}", "title": "" }, { "docid": "816b9dfedc3b3eb3137827b9c65fbd4f", "score": "0.65487057", "text": "func (*SearchUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_grapery_grapery_common_protoc_user_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "f0bf70998d0bac34d94f22c8bfc30ff6", "score": "0.6548093", "text": "func (*GetAllUsersResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "decb155ec00a5bf3f5ddce90bd782a95", "score": "0.6547786", "text": "func (*GetUserByUsernameReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_user_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "7a39d49100aea5149b32e82e5c996cdd", "score": "0.65427727", "text": "func (*VerifyTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_users_users_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "c9a3f72f7103a0bda21e4cc4c04e0055", "score": "0.65424126", "text": "func (*CreateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_users_users_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "e19f97340f365afaecaebbd540f53565", "score": "0.6539442", "text": "func (*GetUserInfoReq) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_user_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "4c24a50de69f8cde19d546f031bf3715", "score": "0.65331686", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "833dd81f4476e62f6258524144737bbf", "score": "0.65323645", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_user_user_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "b750f62bd83a683d6779eef8515855d0", "score": "0.65315104", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_users_users_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "406996a9dd13991fad565cfdc70bdf3c", "score": "0.6528418", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_mkit_service_account_user_v1_user_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "35275d7540ef226db011a0c31cc3bbff", "score": "0.65256566", "text": "func (*UserInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_grapery_grapery_common_protoc_user_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "3f222c25c581b52d66fa6099436b680b", "score": "0.6516432", "text": "func (*DeleteUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_account_account_proto_rawDescGZIP(), []int{56}\n}", "title": "" }, { "docid": "46e0f338e0808f22859866ec3831fbd7", "score": "0.6506086", "text": "func (*RequestUser) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_v1_user_user_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c758bcc5d41ad7eace75866122f22187", "score": "0.6503742", "text": "func (*DeleteUserReq) Descriptor() ([]byte, []int) {\n\treturn file_pb_userDescribe_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "ce9697fa1b794f1c372cd3284df9f03a", "score": "0.64999807", "text": "func (*UserRemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "04060e089e0217341ac382e5cb8aa19c", "score": "0.64995784", "text": "func (*Users) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "8effd84d6b9b54845c9e37c57dc59b53", "score": "0.64975435", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "6c5b476789569f3b8d193fd958c6b4e0", "score": "0.6497518", "text": "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_mkit_service_account_user_v1_user_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "198c6eb470daa66ddbbd0024c98bbcd9", "score": "0.6496717", "text": "func (*FindAllUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_account_account_proto_rawDescGZIP(), []int{52}\n}", "title": "" }, { "docid": "ec0457a2b3c55949340b47a8ef9a84fc", "score": "0.64964086", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ccd297dc4389799a68224799a93b3d63", "score": "0.649219", "text": "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_mkit_service_account_user_v1_user_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "fd5e404e390ad96e5dd9ba224dce72e3", "score": "0.6490462", "text": "func (*WriteUsersRequest) Descriptor() ([]byte, []int) {\n\treturn file_byteplus_retail_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "98c55b093da7f654e73af2b5ff6d6898", "score": "0.6490318", "text": "func (*UserIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ac10a61953eb9e53b49304f69d520e5a", "score": "0.64807", "text": "func (*GetUsersCountRequest) Descriptor() ([]byte, []int) {\n\treturn file_identitypb_identity_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "39ff17c0fe9acf2dc460293268a85b47", "score": "0.64763993", "text": "func (*GetByIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_user_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "537cd7bb5bbd4100840e58a3e852b3a8", "score": "0.6474173", "text": "func (*UpdateUserReq) Descriptor() ([]byte, []int) {\n\treturn file_pb_userDescribe_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "d33c9a5686d3dece43f6f671861d83ae", "score": "0.64684224", "text": "func (*UpdateUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_account_account_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "ac30729530fc8da3e92767f5d5a1cf49", "score": "0.6462297", "text": "func (*UserWatchingRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_grapery_grapery_common_protoc_user_proto_rawDescGZIP(), []int{15}\n}", "title": "" } ]
afb0a5a98644fffb1068f2d0efe359e4
ContextuallyValidateMessage checks if the message is contextually valid. Returns nil if the message is contextually valid or a suitable error otherwise.
[ { "docid": "e2a33db176640e8d6c1fe03e21aed423", "score": "0.6864815", "text": "func (v *syntaxContextValidator) ContextuallyValidateMessage(ctx context.Context, m *Message, currentK uint32) error {\n\tif m == nil {\n\t\treturn errNilMsg\n\t}\n\tif m.InnerMessage == nil {\n\t\treturn errNilInner\n\t}\n\n\tcurrentRound := currentK % RoundsPerIteration\n\t// the message must match the current iteration unless it is a notify or pre-round message\n\tcurrentIteration := currentK / RoundsPerIteration\n\tmsgIteration := m.Round / RoundsPerIteration\n\tsameIter := currentIteration == msgIteration\n\n\t// first validate pre-round and notify\n\tswitch m.Type {\n\tcase pre:\n\t\treturn nil\n\tcase notify:\n\t\tif currentK == preRound && msgIteration != 0 {\n\t\t\treturn errInvalidIter\n\t\t} else if currentK == preRound {\n\t\t\treturn errInvalidRound\n\t\t}\n\t\t// notify before notify could be created for this iteration\n\t\tif currentRound < commitRound && sameIter {\n\t\t\treturn errInvalidRound\n\t\t}\n\n\t\t// old notify is accepted\n\t\tif m.Round <= currentK {\n\t\t\treturn nil\n\t\t}\n\n\t\t// early notify detected\n\t\tif m.Round == currentK+1 && currentRound == commitRound {\n\t\t\treturn errEarlyMsg\n\t\t}\n\n\t\t// future notify is rejected\n\t\treturn errInvalidIter\n\t}\n\n\t// check status, proposal & commit types\n\tswitch m.Type {\n\tcase status:\n\t\tif currentK == preRound && msgIteration != 0 {\n\t\t\treturn errInvalidIter\n\t\t} else if currentK == preRound {\n\t\t\treturn errEarlyMsg\n\t\t}\n\t\tif currentRound == notifyRound && currentIteration+1 == msgIteration {\n\t\t\treturn errEarlyMsg\n\t\t}\n\t\tif currentRound == statusRound && sameIter {\n\t\t\treturn nil\n\t\t}\n\t\tif !sameIter {\n\t\t\treturn errInvalidIter\n\t\t}\n\t\treturn errInvalidRound\n\tcase proposal:\n\t\tif currentK == preRound && msgIteration != 0 {\n\t\t\treturn errInvalidIter\n\t\t} else if currentK == preRound {\n\t\t\treturn errInvalidRound\n\t\t}\n\t\tif currentRound == statusRound && sameIter {\n\t\t\treturn errEarlyMsg\n\t\t}\n\t\t// a late proposal is also contextually valid\n\t\tif (currentRound == proposalRound || currentRound == commitRound) && sameIter {\n\t\t\treturn nil\n\t\t}\n\t\tif !sameIter {\n\t\t\treturn errInvalidIter\n\t\t}\n\t\treturn errInvalidRound\n\tcase commit:\n\t\tif currentK == preRound && msgIteration != 0 {\n\t\t\treturn errInvalidIter\n\t\t} else if currentK == preRound {\n\t\t\treturn errInvalidRound\n\t\t}\n\t\tif currentRound == proposalRound && sameIter {\n\t\t\treturn errEarlyMsg\n\t\t}\n\t\tif currentRound == commitRound && sameIter {\n\t\t\treturn nil\n\t\t}\n\t\tif !sameIter {\n\t\t\treturn errInvalidIter\n\t\t}\n\t\treturn errInvalidRound\n\t}\n\n\treturn errUnexpectedType\n}", "title": "" } ]
[ { "docid": "79a0a3ee0ce5046f1f4efa64e44c5624", "score": "0.6784572", "text": "func (m *MessagesAuthor) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4f29fa54a022e81bc84b3b165b7ebb94", "score": "0.66619164", "text": "func (m *FcInterfaceRecommendMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateFcInterfaceRecommendMessageInlineArguments(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateMessage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSeverity(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "192fa23acd7bf9fbb27e24112ebac953", "score": "0.644359", "text": "func (o *ReadSMSBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9305398ce0011322ebfc87e6e7767aee", "score": "0.6346374", "text": "func (o *PostCheckBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "766792c4e674857ccf1acf023a585176", "score": "0.6231328", "text": "func (m *GivebackStatusInlineError) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateMessage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c1b876522d68c5235414d4e178632e1", "score": "0.62181705", "text": "func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4c1b876522d68c5235414d4e178632e1", "score": "0.62181705", "text": "func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3c1fc7797a5e521d5c38c8d7cc30d15a", "score": "0.6186363", "text": "func (m *StatusDescriptionError) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0c2098b178e4a1cdf1a3da9a70171348", "score": "0.6168057", "text": "func (m *Context) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif utf8.RuneCountInString(m.GetName()) < 1 {\n\t\treturn ContextValidationError{\n\t\t\tfield: \"Name\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif utf8.RuneCountInString(m.GetControlPlane()) < 1 {\n\t\treturn ContextValidationError{\n\t\t\tfield: \"ControlPlane\",\n\t\t\treason: \"value length must be at least 1 runes\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetDefaults()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn ContextValidationError{\n\t\t\t\tfield: \"Defaults\",\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.GetCredentials()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn ContextValidationError{\n\t\t\t\tfield: \"Credentials\",\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\treturn nil\n}", "title": "" }, { "docid": "264fa4e5f8ea48b7730acca629be9625", "score": "0.6122116", "text": "func (o *PostLighthouseStateBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "47b46ea7910d3f428dacbc2e06fe551a", "score": "0.60868", "text": "func (o *PostScanBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "658b1ba9b3e8892b61607aec8f5e6bce", "score": "0.6068644", "text": "func (m *Share) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "05332d1bd1ebba452236cb836f401370", "score": "0.6067183", "text": "func (m *ResumeRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3612f64dba33025a90673217f8e4f91f", "score": "0.6056139", "text": "func (m *ServiceMemberPayload) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAffiliation(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateBackupContacts(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateBackupMailingAddress(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCurrentLocation(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateOrders(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateRank(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateResidentialAddress(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateWeightAllotment(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c212c3ef102fd9e542a9c543d4d6379a", "score": "0.6051238", "text": "func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "c96f8910e9681cf77605251fb88550a2", "score": "0.6037011", "text": "func (m VipVerification) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4794013841e2c9ab8ef9093ba9a9c26d", "score": "0.6029998", "text": "func (m *EmsEventActionInlineConfirmationMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateArguments(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateMessage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6db37b9dcc474079ea29acf3c4c5cc8", "score": "0.6029544", "text": "func (m *PerformanceFcpMetricInlineSvm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "94dc355c90a4c97418c1bcae6735b604", "score": "0.60240585", "text": "func (m *PerformanceFcpMetric) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDuration(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIops(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLatency(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStatus(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSvm(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateThroughput(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTimestamp(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86fbd1591bd388711e8a4b3f874823cf", "score": "0.60135007", "text": "func (m *Member) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAffiliation(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateRank(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c31e855c98e14d96d2cce53a46ea6462", "score": "0.60054654", "text": "func (m *Operation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAuthorizationContext(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateErrorResponseBody(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePeerCertificateChain(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePeerPrincipal(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateReferer(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSocketContext(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateURI(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ffa603e1510595a5245ead16b784514", "score": "0.60005265", "text": "func (m VMVideoType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "81045858b4e6c1d3bf3b33efaa0003f0", "score": "0.59997976", "text": "func (m *SnmpTransport) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAuthProtocol(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCluster(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateEntityAsyncStatus(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePrivacyProtocol(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateProtocol(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVersion(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba447ea3fd9ea9fc4a6c139b37835a18", "score": "0.5998562", "text": "func (m *Meta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "62e0c10f20f4c5058ff5e7d785f31d29", "score": "0.5981931", "text": "func (m *event) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ee08c62df42366ecf99c7f271355df8f", "score": "0.59791255", "text": "func (m *WireGuardPeer) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4e535add762f13681b44291c2ec31812", "score": "0.5973903", "text": "func (o *PostLoginBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "94ff66ac3709161d453baf18836fd650", "score": "0.5970165", "text": "func (m *GivebackStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAggregate(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateError(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df209e9ece094b06f5ad121c23d505f7", "score": "0.59658855", "text": "func (m *ConnectionCurrent) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5c322cc148bff58029b6d15ff9b5842e", "score": "0.5962852", "text": "func (m *Connection) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5e076ca5cce49dfd537ef4ad262e0288", "score": "0.59602857", "text": "func (m *FcPortInlineMetric) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDuration(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIops(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLatency(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStatus(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateThroughput(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTimestamp(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5e256865dcef02ebc93591864691cca", "score": "0.59551215", "text": "func (m *BaseStream) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1af59d3df71db27a04dee716c1bbc6bf", "score": "0.59506387", "text": "func (m *PtzChannel) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "66e12e8aca49b5db7dca205276900ffe", "score": "0.59429216", "text": "func (m *EmailAlert) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6223b406f79646298e9a14887155cd5d", "score": "0.5926799", "text": "func (m *Post) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateData(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c041ae0a98f7bf974e2640d812e29965", "score": "0.5924452", "text": "func (m *FcPortInlineTransceiver) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCapabilities(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateFormFactor(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateManufacturer(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePartNumber(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e249b13543d4d6cdf114e86540b29b30", "score": "0.5924359", "text": "func (o *InviteUserBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.contextValidateAccessMode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58ccb22f3647fb3b52eaf3952eb11f80", "score": "0.5919587", "text": "func (m *SystemLog) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0175e8f7b4553cb7160b9893e6ecb371", "score": "0.59151953", "text": "func (m *Role) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9690f7acceca782e3467f917c19507f3", "score": "0.59129995", "text": "func (m *Position) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9448bd644274aaf1f73bd285361dcd19", "score": "0.59055185", "text": "func (m *Paging) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ffb0b45b1ef00813f2eb1a982580f82d", "score": "0.58975637", "text": "func (m *WireguardPeer) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidatePeerID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7baca421a1cee86eea840409ed275d44", "score": "0.5896662", "text": "func (s *String) ContextValidate(context context.Context, formats strfmt.Registry) error {\n\t// always validate ok\n\treturn nil\n}", "title": "" }, { "docid": "9f88ee57145f3a279d12269f3dbc2057", "score": "0.5894638", "text": "func (m *Record) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "89c6bd5dc7a9a774892ddbb6799f4505", "score": "0.58853126", "text": "func (m Message) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "8509ef3c3e1f98983b0b16a95c2fce61", "score": "0.5884499", "text": "func (m *GetCheckResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "591f77acd931abb18c04e6a7b8a846c1", "score": "0.588425", "text": "func (m *VerifyVip) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateVip(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVipType(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d969bff558b1ca11e57a42742a8149ce", "score": "0.588423", "text": "func (m *BgpPeer) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateFamilies(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efbeadcdabbc69237e26bd2d6d01a63f", "score": "0.5883968", "text": "func (m NdmpReason) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "7a963a2ec04a29081db57389665357de", "score": "0.5874907", "text": "func (m *WebhookNotification) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCreatedAt(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateFirstAttemptedAt(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStatus(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUpdatedAt(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f0fbe3f73056b5d4515969b7fb0c8d3", "score": "0.58727646", "text": "func (m *Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAuthor(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTime(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdad3fe5ba06de7c90b1de6329379ba8", "score": "0.5866063", "text": "func (m *NvmeSubsystemHostInlineSubsystem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateName(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUUID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "12cd30ac245efa47ff182dd20af235b5", "score": "0.58655065", "text": "func (m *FalconxHandle) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1a56f51908ae7a7f12bb0b5443d281fd", "score": "0.5864778", "text": "func (m *VersionedFlowSnapshotEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateProcessGroupRevision(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateVersionedFlowSnapshot(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26306ba2adef96c2a4d0ed31f0ff87bd", "score": "0.5864704", "text": "func (m HostStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "644e861cdefc439b1ee76c4f01bcbba4", "score": "0.58642554", "text": "func (m *NvmeSubsystem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIoQueue(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmeSubsystemInlineHosts(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmeSubsystemInlineSubsystemMaps(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSerialNumber(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSvm(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTargetNqn(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUUID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54a89d9c6329eddf204639af1c3f4706", "score": "0.5863385", "text": "func (m *NvmeSubsystemHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDhHmacChap(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateIoQueue(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNvmeSubsystemHostInlineRecords(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSubsystem(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81558ba91b14dab16752467af391fb03", "score": "0.5862178", "text": "func (o *GetCurrentKeyBlockHeightOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "7b0cb4fbdd576a9709c4594949510afc", "score": "0.5861457", "text": "func (m BPSUnit) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "977f070aab8bbd3fe9b870bf8281ec94", "score": "0.5857473", "text": "func (m *NotifyViaMethods) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3f98a01ce0df23b14e69e1bf7e2a1b21", "score": "0.58537686", "text": "func (m ActionCancelReason) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b4ff32302881aa976c7b1ecb51c62b08", "score": "0.58535355", "text": "func (m *TopMetricsDirectoryResponseInlineNotice) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateMessage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9232b0fdbc8150c78dc29f936959c284", "score": "0.58506125", "text": "func (o *SendJobCommandBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "84eb4974bd0bf5b668c759ab162f2af1", "score": "0.58499485", "text": "func (m *CloudInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLimits(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePvmInstances(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUsage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "532fe3735f512a650c10d7dbe738295a", "score": "0.58457875", "text": "func (m *PageMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "41cfdd79680e53da9e5358bff147a84c", "score": "0.58449036", "text": "func (m *Metric) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateSampleStreams(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSamples(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateUnit(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fdee5d27634fabed332fe6b03f48e595", "score": "0.58369666", "text": "func (ggmv *messageValidator) Validate(ctx context.Context, msg *types.SignedMessage, fromActor *actor.Actor) error {\n\treturn nil\n}", "title": "" }, { "docid": "87914f2af40637ce8796f559d7e26efd", "score": "0.5835999", "text": "func (m *PromAlertStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b52c16404da4dc96ff7ff56643b38f65", "score": "0.58313364", "text": "func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateError(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9794491bbc773e178deb423f8f4e6b24", "score": "0.5830879", "text": "func (m *VMSnapshotVM) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0b164386a916c66b43bc1df836bec246", "score": "0.5829727", "text": "func (m *SpeedLimit) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0fe0dab848f29c0759aa78a147281258", "score": "0.5828082", "text": "func (m WebhookNotificationStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6c18c9b563377509cb15e63921d7bb10", "score": "0.5827024", "text": "func (m *LatestOver) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "265f651be92f8d1c81e2aff8bc27f29a", "score": "0.5826116", "text": "func (m *Post) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateOptions(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0195167afda3648d8be199572d73d4cf", "score": "0.5826099", "text": "func (m *SoftwareErrorsReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCode(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateMessage(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSeverity(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aef80be61de36f11baffcc4a2ad5ba6", "score": "0.58247346", "text": "func (m *UsbDeviceVM) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0aa413c20ebd16d210f010e709371cbe", "score": "0.58244246", "text": "func (m Rule) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "91327a5b2fe44aa59586317aebb54d97", "score": "0.5821246", "text": "func (o *CreatePeerFolderBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "223fa9bf5f8def7c0f8b12326680e022", "score": "0.5815953", "text": "func (m *SystemSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "f4665b53a3d0fb9716e1a9fd6845549c", "score": "0.5812259", "text": "func (o *DecisionsUnauthorizedBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "86f898d993c88c15de8995428f9216d6", "score": "0.5811736", "text": "func (m *Merchant) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6158867321428206bfe1668f3725152d", "score": "0.5811354", "text": "func (m *WebhookReceiver) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateHTTPConfig(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe2e7c02b7a8fe4d7314a2e8b3266803", "score": "0.58103836", "text": "func (m *SysInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "881c599ea83ca62b1f76cca31b1bfafc", "score": "0.5807867", "text": "func (m *PerformanceFcpMetricResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePerformanceFcpMetricResponseInlineRecords(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4a57a8e5422fc038de57e4ce4c1b7fd", "score": "0.580598", "text": "func (m *WritableCustomField) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateDisplay(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateURL(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ddb11e2509ab0378042929956499634a", "score": "0.5803008", "text": "func (m *MatchEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "d00cc0d2deb8721c7bd44c77a3834cbd", "score": "0.5802983", "text": "func (o *DeleteRelationTupleBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3cf55c550c4e210d9af96e0c34999a1a", "score": "0.57989913", "text": "func (m *PasswordStrengthMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCrackTimesDisplay(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCrackTimesSeconds(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateFeedback(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateSequence(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4dc2936a52e40a01505f7cd2111c963d", "score": "0.57967365", "text": "func (m *Connection) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCurrent(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateOptions(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab7dae6a46b281d94b73230308a4d045", "score": "0.5792908", "text": "func (m *CloudAccountVcf) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateEnabledRegions(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTags(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc2290970a1b42c562bb0f3af7586d1e", "score": "0.579154", "text": "func (m *DataCollector) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ce7a52780fb3d04f2954ba613f66375e", "score": "0.5787376", "text": "func (m *VolumeGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateStatusDescription(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26d10ad6c3114f53cd746f07de4e4529", "score": "0.578653", "text": "func (m *PortStatisticsInlineDeviceInlineReceiveRaw) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "72c84a83824ef8618de7508c3cc30679", "score": "0.57800424", "text": "func (m *SystemStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateDiskPartitions(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "237a3c71d2458324f892c2835c42da05", "score": "0.5779908", "text": "func (m *FcPortInlineStatistics) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateIopsRaw(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateLatencyRaw(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStatus(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateThroughputRaw(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateTimestamp(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b8109dc16612e2233cad13b761b682c", "score": "0.57778573", "text": "func (o *PostCheckInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "00fa40c677188724e384a6dea303a7de", "score": "0.57740235", "text": "func (m *pipeline) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateInputMeta(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateWarnings(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateNotifications(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateRollbacks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStages(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStarred(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateWorkspace(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "164e670586b1d41cffd4a8555372532b", "score": "0.57727873", "text": "func (m *NestedFHRPGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateDisplay(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateID(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateURL(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "203379ac4565b712902fa0dfa49ca896", "score": "0.57707477", "text": "func (m *DomainMaliciousFile) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "7af247954291cc1f805b41413f4906c1", "score": "0.5769528", "text": "func (o *DecisionsInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" } ]
ac7ec02efda9e59a2c320a65d9f496ac
Generated from example definition:
[ { "docid": "8c85d41d2557d2036589b72a0873fda0", "score": "0.0", "text": "func ExampleServicesClient_BeginCreateOrUpdate_servicesCreateOrUpdateConsumption() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armappplatform.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, \"myResourceGroup\", \"myservice\", armappplatform.ServiceResource{\n\t\tLocation: to.Ptr(\"eastus\"),\n\t\tTags: map[string]*string{\n\t\t\t\"key1\": to.Ptr(\"value1\"),\n\t\t},\n\t\tProperties: &armappplatform.ClusterResourceProperties{\n\t\t\tManagedEnvironmentID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.App/managedEnvironments/myenvironment\"),\n\t\t},\n\t\tSKU: &armappplatform.SKU{\n\t\t\tName: to.Ptr(\"S0\"),\n\t\t\tTier: to.Ptr(\"StandardGen2\"),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.ServiceResource = armappplatform.ServiceResource{\n\t// \tName: to.Ptr(\"myservice\"),\n\t// \tType: to.Ptr(\"Microsoft.AppPlatform/Spring\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice\"),\n\t// \tSystemData: &armappplatform.SystemData{\n\t// \t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:16:03.944Z\"); return t}()),\n\t// \t\tCreatedBy: to.Ptr(\"sample-user\"),\n\t// \t\tCreatedByType: to.Ptr(armappplatform.CreatedByTypeUser),\n\t// \t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:17:03.944Z\"); return t}()),\n\t// \t\tLastModifiedBy: to.Ptr(\"sample-user\"),\n\t// \t\tLastModifiedByType: to.Ptr(armappplatform.LastModifiedByTypeUser),\n\t// \t},\n\t// \tLocation: to.Ptr(\"eastus\"),\n\t// \tTags: map[string]*string{\n\t// \t\t\"key1\": to.Ptr(\"value1\"),\n\t// \t},\n\t// \tProperties: &armappplatform.ClusterResourceProperties{\n\t// \t\tInfraResourceGroup: to.Ptr(\"myenvironment_SpringApps_12345678abcd1234abcd12345678abcd\"),\n\t// \t\tManagedEnvironmentID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.App/managedEnvironments/myenvironment\"),\n\t// \t\tProvisioningState: to.Ptr(armappplatform.ProvisioningStateSucceeded),\n\t// \t\tServiceID: to.Ptr(\"12345678abcd1234abcd12345678abcd\"),\n\t// \t},\n\t// \tSKU: &armappplatform.SKU{\n\t// \t\tName: to.Ptr(\"S0\"),\n\t// \t\tTier: to.Ptr(\"StandardGen2\"),\n\t// \t},\n\t// }\n}", "title": "" } ]
[ { "docid": "0db2eca236a0d22c4f5677336c696aa8", "score": "0.6234063", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\n}", "title": "" }, { "docid": "ea6b9b329e658a684e43f8780abff750", "score": "0.61007905", "text": "func ExampleNewTrits() {}", "title": "" }, { "docid": "0351c435cdb59a58645628a8526fadea", "score": "0.6047212", "text": "func Example_implementing() {}", "title": "" }, { "docid": "9a01b23cc156f963ea392589c9f28d36", "score": "0.5965796", "text": "func Example() {}", "title": "" }, { "docid": "9a01b23cc156f963ea392589c9f28d36", "score": "0.5965796", "text": "func Example() {}", "title": "" }, { "docid": "a60a73c7986e127d72308c3861fe5ee1", "score": "0.5773993", "text": "func ExampleAddTrits() {}", "title": "" }, { "docid": "121a30a601f87631463169da8750f24a", "score": "0.576097", "text": "func ExampleTritsToTrytes() {}", "title": "" }, { "docid": "d917e5a4a5767c81cfa0413b4cc2bb54", "score": "0.5743602", "text": "func (d *definition) Example(text string) *definition {\n\td.model.Example = text\n\treturn d\n}", "title": "" }, { "docid": "dfb2b110117726bf869adfac4664f6f6", "score": "0.563343", "text": "func ExampleValidTrit() {}", "title": "" }, { "docid": "a8f85e4eea5d3b4adab333d89fefcf45", "score": "0.56329167", "text": "func ExampleValidTrits() {}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "7304b15fc4170edee3740fb423a3e792", "score": "0.55501866", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "40af017345a1721ff4642df4282cc078", "score": "0.5520277", "text": "func ExamplePadTrits() {}", "title": "" }, { "docid": "61f9a4d394ea120f2713140dd29a7483", "score": "0.5499674", "text": "func (b *SchemaBuilder) Example(v interface{}) *SchemaBuilder {\n\tb.lock.Lock()\n\tdefer b.lock.Unlock()\n\tif b.target == nil {\n\t\treturn b\n\t}\n\tb.target.example = v\n\treturn b\n}", "title": "" }, { "docid": "c44280e206a9b5edd1ad5095f9420207", "score": "0.54666597", "text": "func (a *APIDefinition) Example(dt DataType) interface{} {\n\tif a.rand == nil {\n\t\ta.rand = NewRandomGenerator(a.Name)\n\t}\n\treturn dt.Example(a.rand)\n}", "title": "" }, { "docid": "bdc05a54053d5c714e9108121445498c", "score": "0.5465244", "text": "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_tensorflow_core_example_example_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.54465216", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.54465216", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.54465216", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.54465216", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "9490e5ea443adb09f7cd9dfc1724196e", "score": "0.54345787", "text": "func Example(x, y string) string {\n\treturn x + \",\" + y\n}", "title": "" }, { "docid": "31f8f5d0c9c9fac14ff68594db0cf10d", "score": "0.5429858", "text": "func (e *entry) Examples() []int {\n\treturn api_examples[strings.ToLower(e.name)]\n}", "title": "" }, { "docid": "520f8de39c6edee1a69fe3aa8611ebf6", "score": "0.5420372", "text": "func Examples() map[string]string {\n\treturn examples\n}", "title": "" }, { "docid": "98758c61c4e5ffdfd4844a818dcf93ce", "score": "0.5403136", "text": "func (a *APIDefinition) GenerateExample(dt DataType) interface{} {\n\treturn dt.GenerateExample(a.RandomGenerator())\n}", "title": "" }, { "docid": "7089d51db72e8de846af5a022b0ca8bd", "score": "0.5402007", "text": "func TestExample(t *testing.T) {\n\n\tExample()\n\n\n}", "title": "" }, { "docid": "484c3b8adfbec4c2d78232ad1b53d951", "score": "0.53812855", "text": "func (s *BaseFeatureListener) EnterExample(ctx *ExampleContext) {}", "title": "" }, { "docid": "71969aeacb856c8534d0edc824cbbaab", "score": "0.53812844", "text": "func ExampleValidTryte() {}", "title": "" }, { "docid": "f0eaa97050d8f64dbddf076a48ef1f8f", "score": "0.5355816", "text": "func (*SequenceExample) Descriptor() ([]byte, []int) {\n\treturn file_tensorflow_core_example_example_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b340eb71dc52d32591498bd859e72c8f", "score": "0.52896863", "text": "func Pod003(t *Test) {\n}", "title": "" }, { "docid": "415a0ccb7dab77409bd2953f6e70e529", "score": "0.5286145", "text": "func Example() {\n\t_ = b\n\t_ = d\n}", "title": "" }, { "docid": "5fb8645c3b75f79550d638a8ae29cf62", "score": "0.52767694", "text": "func TestGeneratorExample(t *testing.T) {\n\tgeneratorExample()\n}", "title": "" }, { "docid": "12618c67bce88f30b7686c31776a3385", "score": "0.5218021", "text": "func Example() {\n\tfmt.Println(\"Hello\")\n}", "title": "" }, { "docid": "c26cd4237f54fbccf298377cbecb35b5", "score": "0.5176731", "text": "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_api_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "53b9045089ccf4c780fdee8a1b0a5f04", "score": "0.51689166", "text": "func (a *AttributeDefinition) Example(r *RandomGenerator) interface{} {\n\trandomValidationLengthExample := func(count int) interface{} {\n\t\tif a.Type.IsArray() {\n\t\t\tres := make([]interface{}, count)\n\t\t\tfor i := 0; i < count; i++ {\n\t\t\t\tres[i] = a.Type.ToArray().ElemType.Example(r)\n\t\t\t}\n\t\t\treturn res\n\t\t}\n\t\treturn r.faker.Characters(count)\n\t}\n\n\trandomLengthExample := func(validExample func(res float64) bool) interface{} {\n\t\tif a.Type.Kind() == IntegerKind {\n\t\t\tres := r.Int()\n\t\t\tfor !validExample(float64(res)) {\n\t\t\t\tres = r.Int()\n\t\t\t}\n\t\t\treturn res\n\t\t}\n\t\tres := r.Float64()\n\t\tfor !validExample(res) {\n\t\t\tres = r.Float64()\n\t\t}\n\t\treturn res\n\t}\n\n\tfor _, v := range a.Validations {\n\t\tswitch actual := v.(type) {\n\t\tcase *EnumValidationDefinition:\n\t\t\tcount := len(actual.Values)\n\t\t\ti := r.Int() % count\n\t\t\treturn actual.Values[i]\n\t\tcase *FormatValidationDefinition:\n\t\t\tif res, ok := map[string]interface{}{\n\t\t\t\t\"email\": r.faker.Email(),\n\t\t\t\t\"hostname\": r.faker.DomainName() + \".\" + r.faker.DomainSuffix(),\n\t\t\t\t\"date-time\": time.Now().Format(time.RFC3339),\n\t\t\t\t\"ipv4\": r.faker.IPv4Address().String(),\n\t\t\t\t\"ipv6\": r.faker.IPv6Address().String(),\n\t\t\t\t\"uri\": r.faker.URL(),\n\t\t\t\t\"mac\": func() string {\n\t\t\t\t\tres, err := regen.Generate(`([0-9A-F]{2}-){5}[0-9A-F]{2}`)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"12-34-56-78-9A-BC\"\n\t\t\t\t\t}\n\t\t\t\t\treturn res\n\t\t\t\t}(),\n\t\t\t\t\"cidr\": \"192.168.100.14/24\",\n\t\t\t\t\"regexp\": r.faker.Characters(3) + \".*\",\n\t\t\t}[actual.Format]; ok {\n\t\t\t\treturn res\n\t\t\t}\n\t\t\tpanic(\"unknown format\") // bug\n\t\tcase *PatternValidationDefinition:\n\t\t\tres, err := regen.Generate(actual.Pattern)\n\t\t\tif err != nil {\n\t\t\t\treturn r.faker.Name()\n\t\t\t}\n\t\t\treturn res\n\t\tcase *MinimumValidationDefinition:\n\t\t\treturn randomLengthExample(func(res float64) bool {\n\t\t\t\treturn res >= actual.Min\n\t\t\t})\n\t\tcase *MaximumValidationDefinition:\n\t\t\treturn randomLengthExample(func(res float64) bool {\n\t\t\t\treturn res <= actual.Max\n\t\t\t})\n\t\tcase *MinLengthValidationDefinition:\n\t\t\tcount := actual.MinLength + (r.Int() % 3)\n\t\t\treturn randomValidationLengthExample(count)\n\t\tcase *MaxLengthValidationDefinition:\n\t\t\tcount := actual.MaxLength - (r.Int() % 3)\n\t\t\treturn randomValidationLengthExample(count)\n\t\t}\n\t}\n\treturn a.Type.Example(r)\n}", "title": "" }, { "docid": "477c8d499196ba29a1a91922da297c73", "score": "0.51591873", "text": "func (m *Master) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\tfmt.Println(\"received rpc request from worker!\")\n\treturn nil\n}", "title": "" }, { "docid": "b5e8d41b1aa55fd73da6dd9be6943807", "score": "0.51429147", "text": "func ExampleCanTritsToTrytes() {}", "title": "" }, { "docid": "dd88e236a858c2e4925e329352d3b276", "score": "0.5135757", "text": "func ExampleTrytesToTrits() {}", "title": "" }, { "docid": "0479b9142a6d84a772a0303160afb834", "score": "0.5129353", "text": "func (v Vocabulary) UsageExample(w string) ([]string, error) {\n contents, err := makeReq(fmt.Sprintf(usageExampleApiUrl, w))\n if err != nil {\n return []string{}, err\n }\n\n var resp UrbanDictResp\n err = json.Unmarshal(contents, &resp)\n if err != nil {\n return []string{}, err\n }\n\n if len(resp.Things) == 0 {\n return []string{}, nil\n }\n\n var result []string\n for _, thing := range resp.Things {\n if thing.ThumbsUp > 2*thing.ThumbsDown {\n text := strings.Replace(thing.Example, \"\\r\", \" \", -1)\n text = strings.Replace(thing.Example, \"\\n\", \" \", -1)\n result = append(result, text)\n }\n }\n return result, nil\n}", "title": "" }, { "docid": "53b9d4ade6ac9570ddd0dc6dffcd80e2", "score": "0.50811565", "text": "func (plugin *ExamplePlugin) exampleMappingUsage() {\n\t// Random name used to registration. Every registered name should be unique\n\tname := \"example-entity\"\n\n\t// Register name, unique ID and metadata to example index map. Metadata are optional, can be nil. Name and ID have\n\t// to be unique, otherwise the mapping will be overridden\n\tplugin.exampleIdx.RegisterName(name, plugin.exampleIDSeq, &Meta{})\n\tplugin.Log.Infof(\"Name %v registered\", name)\n\n\t// Find the registered mapping using lookup index (name has to be known). Function returns an index related to\n\t// provided name, a metadata (nil if there are no metadata or mapping was not found) and a bool flag whether\n\t// the mapping with provided name was found or not\n\t_, meta, found := plugin.exampleIdx.LookupIdx(name)\n\tif found && meta != nil {\n\t\tplugin.Log.Infof(\"Name %v stored in mapping\", name)\n\t} else {\n\t\tplugin.Log.Errorf(\"Name %v not found\", name)\n\t}\n\n\t// Find the registered mapping using lookup name (index has to be known). Function returns a name related to\n\t// provided index, a metadata (nil if there are no metadata or mapping was not found) and a bool flag whether\n\t// the mapping with provided index was found or not\n\t_, meta, found = plugin.exampleIdx.LookupName(plugin.exampleIDSeq)\n\tif found && meta != nil {\n\t\tplugin.Log.Infof(\"Index %v stored in mapping\", plugin.exampleIDSeq)\n\t} else {\n\t\tplugin.Log.Errorf(\"Index %v not found\", plugin.exampleIDSeq)\n\t}\n\n\t// This is how to remove mapping from registry. Other plugins can be notified about this change\n\tplugin.exampleIdx.UnregisterName(name)\n\tplugin.Log.Infof(\"Name %v unregistered\", name)\n}", "title": "" }, { "docid": "219129c26477704ee869fdef4890499e", "score": "0.50809747", "text": "func NewExample(in *yaml.Node, context *compiler.Context) (*Example, error) {\n\terrors := make([]error, 0)\n\tx := &Example{}\n\tm, ok := compiler.UnpackMap(in)\n\tif !ok {\n\t\tmessage := fmt.Sprintf(\"has unexpected value: %+v (%T)\", in, in)\n\t\terrors = append(errors, compiler.NewError(context, message))\n\t} else {\n\t\tallowedKeys := []string{\"description\", \"externalValue\", \"summary\", \"value\"}\n\t\tallowedPatterns := []*regexp.Regexp{pattern1}\n\t\tinvalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)\n\t\tif len(invalidKeys) > 0 {\n\t\t\tmessage := fmt.Sprintf(\"has invalid %s: %+v\", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, \", \"))\n\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t}\n\t\t// string summary = 1;\n\t\tv1 := compiler.MapValueForKey(m, \"summary\")\n\t\tif v1 != nil {\n\t\t\tx.Summary, ok = compiler.StringForScalarNode(v1)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for summary: %s\", compiler.Display(v1))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// string description = 2;\n\t\tv2 := compiler.MapValueForKey(m, \"description\")\n\t\tif v2 != nil {\n\t\t\tx.Description, ok = compiler.StringForScalarNode(v2)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for description: %s\", compiler.Display(v2))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// Any value = 3;\n\t\tv3 := compiler.MapValueForKey(m, \"value\")\n\t\tif v3 != nil {\n\t\t\tvar err error\n\t\t\tx.Value, err = NewAny(v3, compiler.NewContext(\"value\", v3, context))\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, err)\n\t\t\t}\n\t\t}\n\t\t// string external_value = 4;\n\t\tv4 := compiler.MapValueForKey(m, \"externalValue\")\n\t\tif v4 != nil {\n\t\t\tx.ExternalValue, ok = compiler.StringForScalarNode(v4)\n\t\t\tif !ok {\n\t\t\t\tmessage := fmt.Sprintf(\"has unexpected value for externalValue: %s\", compiler.Display(v4))\n\t\t\t\terrors = append(errors, compiler.NewError(context, message))\n\t\t\t}\n\t\t}\n\t\t// repeated NamedAny specification_extension = 5;\n\t\t// MAP: Any ^x-\n\t\tx.SpecificationExtension = make([]*NamedAny, 0)\n\t\tfor i := 0; i < len(m.Content); i += 2 {\n\t\t\tk, ok := compiler.StringForScalarNode(m.Content[i])\n\t\t\tif ok {\n\t\t\t\tv := m.Content[i+1]\n\t\t\t\tif strings.HasPrefix(k, \"x-\") {\n\t\t\t\t\tpair := &NamedAny{}\n\t\t\t\t\tpair.Name = k\n\t\t\t\t\tresult := &Any{}\n\t\t\t\t\thandled, resultFromExt, err := compiler.CallExtension(context, v, k)\n\t\t\t\t\tif handled {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbytes := compiler.Marshal(v)\n\t\t\t\t\t\t\tresult.Yaml = string(bytes)\n\t\t\t\t\t\t\tresult.Value = resultFromExt\n\t\t\t\t\t\t\tpair.Value = result\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpair.Value, err = NewAny(v, compiler.NewContext(k, v, context))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrors = append(errors, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tx.SpecificationExtension = append(x.SpecificationExtension, pair)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn x, compiler.NewErrorGroupOrNil(errors)\n}", "title": "" }, { "docid": "d0e9355f3d95b91413a86520b3d15f4f", "score": "0.5057676", "text": "func Examples() *ExamplesElem {\n\treturn buildExamplesElem()\n}", "title": "" }, { "docid": "f2ebcbd5e5f6d3d87af71c8a5eb56862", "score": "0.50562423", "text": "func Pod002(t *Test) {\n}", "title": "" }, { "docid": "2af7e6edb89d0c1f5dce156bd531b3e2", "score": "0.5055015", "text": "func init() {\n\t// Set the general plugin information one by one, also including\n\t// its type (source or extractor).\n\tinfo.SetId(999)\n\tinfo.SetName(\"custom-example\")\n\tinfo.SetDescription(\"A Source Plugin Example\")\n\tinfo.SetContact(\"github.com/falcosecurity/plugin-sdk-go\")\n\tinfo.SetVersion(\"0.1.0\")\n\tinfo.SetRequiredAPIVersion(\"0.2.0\")\n\tinfo.SetType(sdk.TypeSourcePlugin)\n\tinfo.SetEventSource(\"example\")\n\n\t// Define an initialization callback\n\tinitialize.SetOnInit(OnInit)\n\n\t// Define a callback for opening the event source.\n\topen.SetOnOpen(OnOpen)\n\n\t// Setting the fields supported for extraction.\n\tfields.SetFields([]sdk.FieldEntry{\n\t\t{Type: \"string\", Name: \"example.hello\", Display: \"Hello World\", Desc: \"An hello world string\"},\n\t})\n}", "title": "" }, { "docid": "add54740465e55d9510a4347e0a0da74", "score": "0.5050876", "text": "func (*GetListOfExamplesResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_api_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "63558d60843c7c5d346832a53d875955", "score": "0.50378674", "text": "func exampleHook(params *cynic.HookParameters) (alert bool, data interface{}) {\n\tfmt.Println(\"executing exampleHook!\")\n\n\tmessage := \"\"\n\turl := \"http://localhost:9001/one\"\n\tresp, err := simpleGet(url)\n\n\tif err != nil {\n\t\tmessage = err.Error()\n\t\tparams.Status.Update(\"exampleHook\", message)\n\t\treturn false, result{\n\t\t\tAlert: true,\n\t\t\tMessage: message,\n\t\t}\n\t}\n\n\tmessage = resp\n\n\tvar target interface{}\n\tjson.Unmarshal([]byte(message), &target)\n\tparams.Status.Update(\"exampleHook\", target)\n\n\treturn false, result{\n\t\tAlert: true,\n\t\tMessage: message,\n\t}\n}", "title": "" }, { "docid": "b71af339cd3573b4571bd58493d010d7", "score": "0.50340956", "text": "func ExampleValidTrytes() {}", "title": "" }, { "docid": "53aa8672b396d58ebd017adf33927b9e", "score": "0.50328094", "text": "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_search_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b87fb1c53ceabf3c26c60bcdb8e678a4", "score": "0.50281954", "text": "func createExample() string {\n\treturn `$ pouch create --name foo busybox:latest\ncontainer ID: e1d541722d68dc5d133cca9e7bd8fd9338603e1763096c8e853522b60d11f7b9, name: foo`\n}", "title": "" }, { "docid": "32f41e131c49f6ce053ac08d6a7d359d", "score": "0.50273615", "text": "func logsExample() string {\n\treturn ``\n}", "title": "" }, { "docid": "0ba0a267a12c74dae7825cc8a9b08b76", "score": "0.5021785", "text": "func Examples(files ...*ast.File) []*Example", "title": "" }, { "docid": "c80345f8908547c571dcab1664e74b46", "score": "0.50140566", "text": "func TestGeneratorExample2(t *testing.T) {\n\tgeneratorExample2()\n}", "title": "" }, { "docid": "a3992c013addae69ca253da05eb0318a", "score": "0.5011593", "text": "func (*ExampleList) Descriptor() ([]byte, []int) {\n\treturn file_tensorflow_serving_apis_input_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "35d40869cd16ea6e8c880c7bb498a257", "score": "0.50021917", "text": "func TestCodeExample(t *testing.T) {\n\tcodeExample()\n}", "title": "" }, { "docid": "f7a1c4c858575fac10387ba55975668c", "score": "0.49961838", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` artworks register --body '{\n \"artist_name\": \"Leonardo da Vinci\",\n \"artist_pastelid\": \"jXYJud3rmrR1Sk2scvR47N4E4J5Vv48uCC6se2nzHrBRdjaKj3ybPoi1Y2VVoRqi1GnQrYKjSxQAC7NBtvtEdS\",\n \"artist_pastelid_passphrase\": \"qwerasdf1234\",\n \"artist_website_url\": \"https://www.leonardodavinci.net\",\n \"description\": \"The Mona Lisa is an oil painting by Italian artist, inventor, and writer Leonardo da Vinci. Likely completed in 1506, the piece features a portrait of a seated woman set against an imaginary landscape.\",\n \"image_id\": 1,\n \"issued_copies\": 1,\n \"keywords\": \"Renaissance, sfumato, portrait\",\n \"maximum_fee\": 100,\n \"name\": \"Mona Lisa\",\n \"series_name\": \"Famous artist\",\n \"spendable_address\": \"PtiqRXn2VQwBjp1K8QXR2uW2w2oZ3Ns7N6j\",\n \"youtube_url\": \"https://www.youtube.com/watch?v=0xl6Ufo4ZX0\"\n }'` + \"\\n\" +\n\t\t\"\"\n}", "title": "" }, { "docid": "a3ebf0d7ff91cea322c39a17c84c8a69", "score": "0.49928623", "text": "func GeneratedRegister(r *server.Hertz) {\n\t//INSERT_POINT: DO NOT DELETE THIS LINE!\n}", "title": "" }, { "docid": "84751aed5b1429b91f6d8bdb974abb2c", "score": "0.49923337", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` some--function add --message '{\n \"a\": 4322588876820724806,\n \"b\": 4640347192739498460\n }'` + \"\\n\" +\n\t\t\"\"\n}", "title": "" }, { "docid": "dc3f3932c24a2693f9a471ed28d80b43", "score": "0.49848104", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` actual-time get-actual-time-data` + \"\\n\" +\n\t\tos.Args[0] + ` entity-hall wait-line-overview --body '{\n \"endDate\": \"2020-07-27\",\n \"regionCode\": \"520100\",\n \"startDate\": \"2019-07-27\"\n }'` + \"\\n\" +\n\t\tos.Args[0] + ` third-part get-actual-time-data` + \"\\n\" +\n\t\tos.Args[0] + ` import-file import-excel-file --body '{\n \"file\": \"bHpw\",\n \"filename\": \"3nb\"\n }' --area \"abc\" --year 2020 --type 1` + \"\\n\" +\n\t\tos.Args[0] + ` simulation set-data --body '{\n \"isShowMock\": true,\n \"key\": \"对应模块\",\n \"orderBy\": 1,\n \"orderTimeScope\": 1,\n \"val\": \"对应值\"\n }' --jwt-token \"eyJhbGciOiJIUz...\"` + \"\\n\" +\n\t\t\"\"\n}", "title": "" }, { "docid": "83f8f84c9c05af873360ed2559c68438", "score": "0.49785358", "text": "func (d *ConcatNode) Example(s []byte, n int) []byte {\n\ts = d.L.Example(s, n)\n\ts = d.R.Example(s, n)\n\treturn s\n}", "title": "" }, { "docid": "305e4c7f47db083d0000a9da606e62a7", "score": "0.49568364", "text": "func (o *Adam) IncExample() {\n\to.TimeStep++\n\to.updateAlpha()\n}", "title": "" }, { "docid": "5f79c1dd88f7988dbf768203bd84b2d8", "score": "0.49502376", "text": "func (b *ComponentsBuilder) Examples(v map[string]Example) *ComponentsBuilder {\n\tb.target.examples = v\n\treturn b\n}", "title": "" }, { "docid": "e146ebdc48987fda60d58ea63ef8e8cf", "score": "0.4939695", "text": "func TestSourceParameters(val Source, ptr *Source) { // want \"source identified\" \"source identified\" \"source identified\"\n\n}", "title": "" }, { "docid": "feedce78d9762aa67ad1725cd1f412b0", "score": "0.49313685", "text": "func init() {\n\tnoteMixin := schema.Note{}.Mixin()\n\tnoteMixinFields0 := noteMixin[0].Fields()\n\t_ = noteMixinFields0\n\tnoteFields := schema.Note{}.Fields()\n\t_ = noteFields\n\t// noteDescCreateTime is the schema descriptor for create_time field.\n\tnoteDescCreateTime := noteMixinFields0[0].Descriptor()\n\t// note.DefaultCreateTime holds the default value on creation for the create_time field.\n\tnote.DefaultCreateTime = noteDescCreateTime.Default.(func() time.Time)\n\t// noteDescUpdateTime is the schema descriptor for update_time field.\n\tnoteDescUpdateTime := noteMixinFields0[1].Descriptor()\n\t// note.DefaultUpdateTime holds the default value on creation for the update_time field.\n\tnote.DefaultUpdateTime = noteDescUpdateTime.Default.(func() time.Time)\n\t// note.UpdateDefaultUpdateTime holds the default value on update for the update_time field.\n\tnote.UpdateDefaultUpdateTime = noteDescUpdateTime.UpdateDefault.(func() time.Time)\n}", "title": "" }, { "docid": "470c5bbb23330aded30fef687171b26f", "score": "0.4930194", "text": "func main() {\n\t// Init close channel to stop the example\n\texampleFinished := make(chan struct{}, 1)\n\n\t// Start Agent with ExampleFlavor (combinatioplugin.GoVppmux, n of ExamplePlugin & reused cn-infra plugins)\n\tflavor := ExampleFlavor{IdxLookupExample: ExamplePlugin{closeChannel: &exampleFinished}}\n\tagent := core.NewAgent(log.DefaultLogger(), 15*time.Second, append(flavor.Plugins())...)\n\tcore.EventLoopWithInterrupt(agent, exampleFinished)\n}", "title": "" }, { "docid": "9eadf3b9d3891cc9598061347b5816ee", "score": "0.49161822", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` user-method register --body '{\n \"email\": \"123@email.com\",\n \"password\": \"password\"\n }'` + \"\\n\" +\n\t\t\"\"\n}", "title": "" }, { "docid": "05e59f96f66a864f54dc82ae8a24b52d", "score": "0.4903033", "text": "func (*ExampleListWithContext) Descriptor() ([]byte, []int) {\n\treturn file_tensorflow_serving_apis_input_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c4a21cf7af5be456dffe3e15a3f195a5", "score": "0.49000973", "text": "func runExample(t *testing.T, prog string, arg ...string) (string, error) {\n\tcmd := exampleCommand(t, prog, arg...)\n\tout, err := cmd.Output()\n\treturn string(out), err\n}", "title": "" }, { "docid": "18a9d74dcc2cf3a8759cebfba9bdc904", "score": "0.4899464", "text": "func (c *OldSerieRuleConfig) Sample() string {\n\treturn `\n time=\"2020-01-01T00:08:00Z\"\n out=\"stdout\"\n #out=\"out_file.log\"\n format=\"text\"\n #format=\"json\"\n timestamp=true\n\t`\n}", "title": "" }, { "docid": "87b1724acaa56eaf5f16afce07ecf02a", "score": "0.4882747", "text": "func CallExample(e Example) {\n\tfmt.Println(e.someMethod(\"test\"))\n}", "title": "" }, { "docid": "f84411174135d95dd71dc0d2d0f5163f", "score": "0.48796105", "text": "func (self *EightBall) Description() string {\n return DESCRIPTION\n}", "title": "" }, { "docid": "046d419b44223e19d92ff541c38a934b", "score": "0.4877517", "text": "func (d *AltNode) Example(s []byte, n int) []byte {\n\tif IsEpsilon(d) {\n\t\treturn s // was an Epsilon\n\t} else {\n\t\treturn d.Alts[rand.Intn(len(d.Alts))].Example(s, n)\n\t}\n}", "title": "" }, { "docid": "cd27dc1feee84eaa46d7bfad260bd1f8", "score": "0.48639923", "text": "func generateSimple() *simplepb.SimpleMessage {\n\tmsg := simplepb.SimpleMessage{\n\t\tMessageCode:123,\n\t\tMessage:\"hello\",\n\t\tList : [] int32{1,2,3},\n\t}\n\tfmt.Println(msg.GetMessageCode())\n\tfmt.Println(msg.GetMessage())\n\tfmt.Println(msg.GetList())\n\n\treturn &msg\n\n}", "title": "" }, { "docid": "fb0c3f84fa58caabcade8bad337a31c0", "score": "0.48232052", "text": "func init() {\n\tdescriptions = map[string]string{\n\t\t\"app_id\": \"The application ID required for API requests\",\n\t\t\"endpoint\": \"The full URL (plus path) to the API endpoint\",\n\t\t// \"timeout\": \"Max. wait time should wait for a successful connection to the API\",\n\t}\n}", "title": "" }, { "docid": "021d86d9bd9360eb11df25ab14edc792", "score": "0.4809821", "text": "func (inst *instance) Impl() string { return inst.name }", "title": "" }, { "docid": "83701c93b8119977bd009e5c0ad9eaca", "score": "0.480948", "text": "func ExampleModuleFactory() {}", "title": "" }, { "docid": "6a2acbc9fd2c92aedf509e9d3e83e759", "score": "0.48075515", "text": "func main() {\r\n\t// examples.ExampleOne()\r\n\t// examples.ExampleTwo()\r\n\texamples.ExampleConv()\r\n\t// examples.CheckAND()\r\n\t// examples.CheckOR()\r\n\t// examples.CheckXOR()\r\n\t// examples.CheckXTO()\r\n\t// examples.CheckOCR()\r\n\t// examples.CheckOCRNetFromFile()\r\n\t// examples.CheckOCRTwoConv()\r\n\t// examples.ImportExportNet()\r\n}", "title": "" }, { "docid": "0514fe33671809fc678edcf78c3808b6", "score": "0.4806407", "text": "func GenerateExample(l int) string {\n\tcomplete := GenerateCompleteExample(l)\n\tgapped := &strings.Builder{}\n\tfor i := 0; i < l; i++ {\n\t\tif rand.Intn(3) == 0 {\n\t\t\tgapped.WriteString(\"?\")\n\t\t\tcontinue\n\t\t}\n\t\tswitch complete[i] {\n\t\tcase 1:\n\t\t\tgapped.WriteString(\"a\")\n\t\tcase -1:\n\t\t\tgapped.WriteString(\"b\")\n\t\t}\n\t}\n\n\treturn gapped.String()\n}", "title": "" }, { "docid": "ce847334abaa2c2f9add747a870b86c0", "score": "0.48028147", "text": "func TestGripPubControlInitialize(t *testing.T) {\n NewGripPubControl(nil)\n NewGripPubControl([]map[string]interface{} {\n map[string]interface{} {\n \"control_uri\": \"uri\",\n \"control_iss\": \"hello\", \n \"key\": []byte(\"key\")}})\n}", "title": "" }, { "docid": "bf786478ed4dffd56c32e48a27a17b19", "score": "0.48025674", "text": "func UsageExamples() string {\n\treturn os.Args[0] + ` table-info get-info --message '{\n \"tableName\": \"myGreatTable\"\n }'` + \"\\n\" +\n\t\t\"\"\n}", "title": "" } ]
c444f4922f383fadda453bc9a7b770e3
NewFakeProtocol returns a FakeProtocol with configured response and expected error.
[ { "docid": "cae84098ceda44b104cd079ce8d42047", "score": "0.83490926", "text": "func NewFakeProtocol(response *pb.CsrResponse, err string) *FakeProtocol {\n\treturn &FakeProtocol{\n\t\tresp: response,\n\t\terrMsg: err,\n\t}\n}", "title": "" } ]
[ { "docid": "67c9bb91052574c4ce944e187bac61fa", "score": "0.6619622", "text": "func NewMockProtocol(version uint64) Protocol {\n\treturn &MockProtocol{\n\t\tnil,\n\t\tversion,\n\t\tnil,\n\t}\n}", "title": "" }, { "docid": "e1fb9d628364085bc78e0bfff0ce9850", "score": "0.6205603", "text": "func NewProtocol() mangos.Protocol {\n\treturn &resp{}\n}", "title": "" }, { "docid": "08535679782a46cb25ab57341455a179", "score": "0.5986057", "text": "func NewProtocolDriver(t mockConstructorTestingTNewProtocolDriver) *ProtocolDriver {\n\tmock := &ProtocolDriver{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "219a27f157974eb9b5bb9e8aa53f8d8d", "score": "0.5962424", "text": "func NewMockProtocolClient() *MockProtocolClient {\n\n\treturn &MockProtocolClient{\n\t\tProtocol: protocol.Protocol{\n\t\t\tStartingBlockChainTime: 0,\n\t\t\tHashAlgorithmInMultiHashCode: 18,\n\t\t\tMaxOperationsPerBatch: 1, // one operation per batch - batch gets cut right away\n\t\t\tMaxOperationByteSize: 2000,\n\t\t},\n\t}\n\n}", "title": "" }, { "docid": "166ee42dae29418cfe2795e87c9a52bb", "score": "0.5922888", "text": "func newTestProtocol(name string, conn *net.UDPConn, logger *logger.Logger, masters ...*peer.Peer) (*Protocol, func()) {\n\tdb, _ := peer.NewDB(mapdb.NewMapDB())\n\taddr := conn.LocalAddr().(*net.UDPAddr)\n\tlocal := peertest.NewLocal(addr.Network(), addr.IP, addr.Port, db)\n\tlog := logger.Named(name)\n\n\tprot := New(local, 0, 0, Logger(log), MasterPeers(masters))\n\n\tsrv := server.Serve(local, conn, log, prot)\n\tprot.Start(srv)\n\n\tteardown := func() {\n\t\tsrv.Close()\n\t\tprot.Close()\n\t}\n\n\treturn prot, teardown\n}", "title": "" }, { "docid": "be892fe30172cf709ab48ef874455e64", "score": "0.5832444", "text": "func NewProtocol(chain blockchain.Blockchain, sf state.Factory) *Protocol {\n\treturn &Protocol{\n\t\tchain: chain,\n\t\tsf: sf,\n\t\tsubChains: make(map[uint32]*subChain),\n\t}\n}", "title": "" }, { "docid": "05981d3fe43c1104ac8db8c548521fc8", "score": "0.57579017", "text": "func NewMockProtocolClient() *MockProtocolClient {\n\treturn &MockProtocolClient{\n\t\t//nolint:gomnd // mock values are defined below.\n\t\tProtocol: protocol.Protocol{\n\t\t\tStartingBlockChainTime: 0,\n\t\t\tHashAlgorithmInMultiHashCode: sha2_256,\n\t\t\tMaxOperationsPerBatch: 2,\n\t\t\tMaxDeltaByteSize: 2000,\n\t\t\tCompressionAlgorithm: \"GZIP\",\n\t\t\tMaxChunkFileSize: maxBatchFileSize,\n\t\t\tMaxMapFileSize: maxBatchFileSize,\n\t\t\tMaxAnchorFileSize: maxBatchFileSize,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c986002f97de679afcb96aecf66aaf09", "score": "0.56428725", "text": "func NewProtocol(config *config.ProtocolConfig) *Protocol {\n\treturn &Protocol{\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "14b05dcfff77a91f7406a955400fe094", "score": "0.56061554", "text": "func NewMockProtocol(ctrl *gomock.Controller) *MockProtocol {\n\tmock := &MockProtocol{ctrl: ctrl}\n\tmock.recorder = &MockProtocolMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "14b05dcfff77a91f7406a955400fe094", "score": "0.56061554", "text": "func NewMockProtocol(ctrl *gomock.Controller) *MockProtocol {\n\tmock := &MockProtocol{ctrl: ctrl}\n\tmock.recorder = &MockProtocolMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "baa15d36364ff268c34d6c8a5fd11add", "score": "0.55350304", "text": "func NewProtocol(cfg genesis.Rewarding) *Protocol {\n\th := hash.Hash160b([]byte(_protocolID))\n\taddr, err := address.FromBytes(h[:])\n\tif err != nil {\n\t\tlog.L().Panic(\"Error when constructing the address of rewarding protocol\", zap.Error(err))\n\t}\n\tif err = validateFoundationBonusExtension(cfg); err != nil {\n\t\tlog.L().Panic(\"failed to validate foundation bonus extension\", zap.Error(err))\n\t}\n\treturn &Protocol{\n\t\tkeyPrefix: h[:],\n\t\taddr: addr,\n\t\tcfg: cfg,\n\t}\n}", "title": "" }, { "docid": "2229d946de5799d487d8623abbfab399", "score": "0.55283374", "text": "func newFakeConnection() *FakeConn {\n\treturn &FakeConn{\n\t\tgetResultMap: map[string]result{},\n\t\twatches: map[string][]chan *topo.WatchData{},\n\t\tgetErrors: []bool{},\n\t\tupdateErrors: []updateError{},\n\t}\n}", "title": "" }, { "docid": "4ddc58c259f0cbd4cdbf484a95294f47", "score": "0.5380859", "text": "func FakeNewServer(callback func()) IFakeServer {\n\treturn &fakeServer{\n\t\tcallback: callback,\n\t}\n}", "title": "" }, { "docid": "525d8a51fc11eb4412c02c1fa4f5c383", "score": "0.5340649", "text": "func ProtocolFactory(in, out thrift.TProtocolFactory) ServerOpt {\n\treturn func(cf *serverConfig) {\n\t\tcf.protosIn = in\n\t\tcf.protosOut = out\n\t}\n}", "title": "" }, { "docid": "d73ae8ac2ef471426c35549d9e81f33a", "score": "0.53291065", "text": "func NewFake() *Fake {\n\treturn new(Fake)\n}", "title": "" }, { "docid": "004b18d597f80b50a5553545aeda226c", "score": "0.5315033", "text": "func NewProtocol(t *kernel.Task) (netlink.Protocol, *syserr.Error) {\n\treturn &Protocol{}, nil\n}", "title": "" }, { "docid": "7f073a8a908bb21eac99bc69dcdd78f4", "score": "0.5314038", "text": "func NewFake() Fake {\n\tfakeRegistryMu.Lock()\n\tdefer fakeRegistryMu.Unlock()\n\n\tid := fakeRegistryID + 1\n\tfakeRegistryID++\n\n\tret := Fake{\n\t\tid,\n\t\t&fakeDialer{streams: map[types.StreamName]*fakeStream{}},\n\t}\n\tfakeRegistry[id] = ret\n\treturn ret\n}", "title": "" }, { "docid": "b072903e318ee69359b37da6466d4710", "score": "0.5287817", "text": "func NewFakeDlp(port uint16, delay time.Duration) (*FakeDlpServiceServer, *grpc.Server) {\n log.Printf(\"Dlp server listening on port %v\\n\", port)\n grpcServer := grpc.NewServer()\n fakeDlp := &FakeDlpServiceServer{\n delay: delay,\n InspectContentReq: make(chan *dlppb.InspectContentRequest, 100),\n HybridInspectReq: make(chan *dlppb.HybridInspectJobTriggerRequest, 100),\n }\n dlppb.RegisterDlpServiceServer(grpcServer, fakeDlp)\n\n go func() {\n lis, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", port))\n if err != nil {\n log.Fatalf(\"failed to listen: %v\", err)\n }\n err = grpcServer.Serve(lis)\n if err != nil {\n log.Fatalf(\"fake DLP server terminated abnormally: %v\", err)\n }\n }()\n return fakeDlp, grpcServer\n}", "title": "" }, { "docid": "15a5d050def6283cd887391f2bf548cf", "score": "0.52681607", "text": "func NewFakeTransport(opts ...FakeTransportOption) *FakeTransport {\n\tt := &FakeTransport{\n\t\tonce: lifecycle.NewOnce(),\n\t\tinitialConnectionStatus: peer.Available,\n\t\tinitialPeerConnectionStatuses: make(map[string]peer.ConnectionStatus),\n\n\t\tpeers: make(map[string]*FakePeer),\n\t\tretainErrors: make(map[string]error),\n\t\treleaseErrors: make(map[string]error),\n\t\tpendingStatusChanges: make(chan struct{}, 1),\n\t\tdone: make(chan struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(t)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "6a8a06b10800f2dcaf8821c5a3593ddc", "score": "0.5249543", "text": "func newFakePodManager() (*basicPodManager, *fakeMirrorClient) {\n\tpodManager := newBasicPodManager(nil)\n\tfakeMirrorClient := newFakeMirrorClient()\n\tpodManager.mirrorClient = fakeMirrorClient\n\treturn podManager, fakeMirrorClient\n}", "title": "" }, { "docid": "4a0b13cf8827b2edc6809d0f53e589a0", "score": "0.5228146", "text": "func newFakeClient(behaviour *FakeClientBehaviour, expectedEventCount int) CEClient {\n\treturn FakeClient{\n\t\tbehaviour: behaviour,\n\t\t// set buffersize to length of want events to make sure no extra events are sent\n\t\tevents: make(chan string, expectedEventCount),\n\t\twaitGroup: &sync.WaitGroup{},\n\t}\n}", "title": "" }, { "docid": "92a6242bc0d6e7313eb0b3d68fdaf5ac", "score": "0.52165973", "text": "func NewResponse(protocolCode byte, respStatus int16) SofaRpcCmd {\n\tif builder, ok := responseFactory[protocolCode]; ok {\n\t\treturn builder.BuildResponse(respStatus)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bfc09f6ce9ffb6f18f6fc955e355f4ab", "score": "0.520994", "text": "func NewProtocolErr(err error) ProtocolErr {\n\treturn ProtocolErr{\n\t\tCause: err,\n\t}\n}", "title": "" }, { "docid": "9409564b842fb1ea226bf387847f6281", "score": "0.5202799", "text": "func TestDecodeProtocolChangeResponseErrorType(t *testing.T) {\n\tvalidMsg := &FCRMessage{\n\t\tmessageType: -1,\n\t\tprotocolVersion: 1,\n\t\tprotocolSupported: []int32{1, 1},\n\t\tmessageBody: []byte(`{}`),\n\t\tsignature: \"\",\n\t}\n\tmsg, err := DecodeProtocolChangeResponse(validMsg)\n\tassert.Empty(t, msg)\n\tassert.Equal(t, err, errors.New(\"message type mismatch\"))\n}", "title": "" }, { "docid": "b9fbc0bd5e568d1fb9582fe7a0a1d971", "score": "0.5199364", "text": "func newProtocolUNKN(conn tcp.Connection, bodyLength uint32) (tcp.ProtocolMessage, error) {\n\tif bodyLength != 0 {\n\t\treturn nil, fmt.Errorf(\"protocol error: Corrupt message UNKN size %d != 0\", bodyLength)\n\t}\n\n\treturn &protocolUNKN{}, nil\n}", "title": "" }, { "docid": "34cb424b442deb9efc9b08cd1eb69bb8", "score": "0.5179688", "text": "func NewFakeClient(result []Release, err error) Client {\n\treturn fakeClient{\n\t\tresult: result,\n\t\terr: err,\n\t}\n}", "title": "" }, { "docid": "dfcfdbb1e782e9ff32c39462844c657f", "score": "0.5169027", "text": "func fakeClient(t *testing.T, resp certResp) *http.Client {\n\treturn &http.Client{Transport: &fakeTransport{t: t, respData: resp}}\n}", "title": "" }, { "docid": "3cd4502cc7ff58b1eb16d3e279f02973", "score": "0.51332253", "text": "func (_m *MockCall) NewResponse() proto.Message {\r\n\tret := _m.ctrl.Call(_m, \"NewResponse\")\r\n\tret0, _ := ret[0].(proto.Message)\r\n\treturn ret0\r\n}", "title": "" }, { "docid": "874b2a4e58cc7948d20c983ea997b513", "score": "0.5126029", "text": "func NewProtocol(config config.SwarmConfig, base baseNetwork, peersManager peersManager, localNodePubkey p2pcrypto.PublicKey, logger log.Log) *Protocol {\n\t// intentionally not subscribing to peers events so that the channels won't block in case executing Start delays\n\treturn &Protocol{\n\t\tLog: logger,\n\t\tconfig: config,\n\t\tnet: base,\n\t\tlocalNodePubkey: localNodePubkey,\n\t\tpeers: peersManager,\n\t\tshutdown: make(chan struct{}),\n\t\toldMessageQ: types.NewDoubleCache(oldMessageCacheSize), // todo : remember to drain this\n\t\tpropagateQ: make(chan service.MessageValidation, propagateHandleBufferSize),\n\t\tpq: priorityq.New(propagateHandleBufferSize),\n\t\tpriorities: make(map[string]priorityq.Priority),\n\t}\n}", "title": "" }, { "docid": "199cab52baaa09ec240df99a929cc197", "score": "0.51231664", "text": "func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService2ProtocolTest {\n\tsvc := &OutputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService2ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService2ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "9d348498241bf8f37a6b0a467631686c", "score": "0.5119218", "text": "func NewFake() (*FakeCRDClient, error) {\n\tscheme := runtime.NewScheme()\n\tif err := crv1.AddToScheme(scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FakeCRDClient{\n\t\terrors: make(map[string]error),\n\t\tTenants: make(map[string]*crv1.Tenant),\n\t\tNetworks: make(map[string]*crv1.Network),\n\t\tscheme: scheme,\n\t}, nil\n}", "title": "" }, { "docid": "b848cb6a7dca8444e577e5f9393ea891", "score": "0.5103235", "text": "func newResponse(conn *conn, data []byte, flags byte, err error) *response {\n\treturn &response{\n\t\tconn: conn,\n\t\tleft: data,\n\t\tflags: flags,\n\t\terr: err,\n\t}\n}", "title": "" }, { "docid": "13431cbdee75ba38e790536e9fdbeb5f", "score": "0.5097975", "text": "func NewProtocol(address string, port int) (protocol.IProtocol, error) {\n\tvar p httpProtocol\n\n\tp.address = fmt.Sprintf(\"%s:%d\", address, port)\n\n\treturn &p, nil\n}", "title": "" }, { "docid": "de884d1bc1c6310a5d3f1cf6471d7058", "score": "0.5083395", "text": "func newFakeExtensions() *Extensions {\n\treturn NewExtensions(generic.New(), webhooks.NewWebHook(http.NewServeMux()))\n}", "title": "" }, { "docid": "c4706683574f6ece764ae5c262a6acb9", "score": "0.5081418", "text": "func New(label string, facade Facade, test bool) (pairingCode string, pem string, err error) {\n\tcl := &Client{\n\t\tPem: ku.GeneratePem(),\n\t}\n\tif test {\n\t\tcl.ApiUri = \"https://test.bitpay.com\"\n\t}\n\tcl.ClientId, err = ku.GenerateSinFromPem(cl.Pem)\n\tif err != nil {\n\t\treturn\n\t}\n\tcode, err := cl.NewToken(label, facade)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn code, cl.Pem, nil\n}", "title": "" }, { "docid": "39d2c8faeb0a04b77254fe3f1c7fecfd", "score": "0.50710577", "text": "func NewProtocol() mangos.Protocol {\n\treturn &push{}\n}", "title": "" }, { "docid": "28bed02d831e2861bf6b2451bd2ea765", "score": "0.50657296", "text": "func newFakeController() (*Controller, agtesting.Mocks) {\n\tm := agtesting.NewMocks()\n\twh := webhooks.NewWebHook(http.NewServeMux())\n\tc := NewController(wh, healthcheck.NewHandler(), m.KubeClient, m.ExtClient, m.AgonesClient, m.AgonesInformerFactory)\n\tc.recorder = m.FakeRecorder\n\treturn c, m\n}", "title": "" }, { "docid": "bb86b0d0dc6ea73723911822b61f7ca4", "score": "0.50470465", "text": "func NewMockServerProtocol(ctrl *gomock.Controller) *MockServerProtocol {\n\tmock := &MockServerProtocol{ctrl: ctrl}\n\tmock.recorder = &MockServerProtocolMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "db9c776cd456e86aa68e04f8bf0e4638", "score": "0.50365454", "text": "func NewFakeTopoServer(ctx context.Context, factory *FakeFactory) *topo.Server {\n\tts, err := topo.NewWithFactory(factory, \"\" /*serverAddress*/, \"\" /*root*/)\n\tif err != nil {\n\t\tlog.Exitf(\"topo.NewWithFactory() failed: %v\", err)\n\t}\n\tfor cell := range factory.cells {\n\t\tif err := ts.CreateCellInfo(ctx, cell, &topodatapb.CellInfo{}); err != nil {\n\t\t\tlog.Exitf(\"ts.CreateCellInfo(%v) failed: %v\", cell, err)\n\t\t}\n\t}\n\treturn ts\n}", "title": "" }, { "docid": "4482feb13a9d6df051874830d6713ac6", "score": "0.5033344", "text": "func NewMockProtocolConstructor(ctrl *gomock.Controller) *MockProtocolConstructor {\n\tmock := &MockProtocolConstructor{ctrl: ctrl}\n\tmock.recorder = &MockProtocolConstructorMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "2b7605de86dd9cd84d4e0edb5c489116", "score": "0.5031029", "text": "func NewProtocol(store s.Store, epochctx *epochctx.EpochCtx) *Protocol {\n\treturn &Protocol{\n\t\tStore: store,\n\t\tepochCtx: epochctx,\n\t}\n}", "title": "" }, { "docid": "564a35c2bcd645ba32952916e1135a58", "score": "0.5002014", "text": "func NewFake() tun.Device {\n\treturn &fakeTUN{\n\t\tevchan: make(chan tun.Event),\n\t\tclosechan: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "feaef12f53977c5c9e6dc875a961afbf", "score": "0.49988368", "text": "func Test_ProtoIO_WriteCodedProtoResponse_BadMessage_ReturnsError(t *testing.T) {\n\tpio := ProtoIoImpl{}\n\twriter := &MockResponseWriter{}\n\terr := pio.WriteCodedProtoResponse(writer, nil, 5)\n\tif err == nil {\n\t\tt.Error(\"Should have received error.\")\n\t}\n\n\tif len(writer.WriteHeaderInputs) != 1 {\n\t\tt.Fatal(\"Expected one write to headers got:\", len(writer.WriteHeaderInputs))\n\t}\n\n\tif !reflect.DeepEqual(writer.WriteHeaderInputs[0], 5) {\n\t\tt.Error(\"Did not write the correct data. Expected:\", 5,\n\t\t\t\"Received:\", writer.WriteHeaderInputs[0])\n\t}\n}", "title": "" }, { "docid": "06c5c749e347409e814d8a831b6bcb3f", "score": "0.49971947", "text": "func NewBackend(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *Backend {\n\tmock := &Backend{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "3d9ba78ec6b2dbacbe550465a085631d", "score": "0.49957967", "text": "func TestNewBaseRespone(t *testing.T) {\n\tConvey(\"Create a new Base Response\", t, func() {\n\t\tr := NewBaseResponse(\"success\", \"message\", 200)\n\t\tSo(r.Code, ShouldEqual, 200)\n\t\tSo(r.Status, ShouldEqual, \"success\")\n\t\tSo(r.Message, ShouldEqual, \"message\")\n\t})\n}", "title": "" }, { "docid": "d4e2659f12d3b908375c03cca5ff9247", "score": "0.49742594", "text": "func newMockTLSServer(t *testing.T) *mockTLSServer {\n\tserver := &mockTLSServer{}\n\n\thandler := http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {\n\t\tt.Logf(\"request: %+v\", *req)\n\t\tswitch req.URL.Path {\n\t\tdefault:\n\t\t\tt.Logf(\"The request contains path: %v\", req.URL)\n\t\t\tresp.WriteHeader(http.StatusOK)\n\t\t}\n\t})\n\n\tserver.httpServer = httptest.NewTLSServer(handler)\n\n\tt.Logf(\"Serving TLS at: %v\", server.httpServer.URL)\n\n\treturn server\n}", "title": "" }, { "docid": "ee8dccf319ef52ec1cbbfae7cf6a0b58", "score": "0.49693084", "text": "func New(opts *Opts, wrappers ...Wrapper) Protocol {\n\tvar p Protocol = &protocol{opts.Storage, opts.Stasher, opts.GoBinPath, opts.Fs}\n\tfor _, w := range wrappers {\n\t\tp = w(p)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "b77decfb049731f518bf44719f1fc9d3", "score": "0.49677783", "text": "func NewFakeConfigurator(opts ...yarpcconfig.Option) *yarpcconfig.Configurator {\n\tconfigurator := yarpcconfig.New(opts...)\n\tconfigurator.MustRegisterTransport(FakeTransportSpec())\n\tconfigurator.MustRegisterPeerChooser(FakePeerChooserSpec())\n\tconfigurator.MustRegisterPeerList(FakePeerListSpec())\n\tconfigurator.MustRegisterPeerListUpdater(FakePeerListUpdaterSpec())\n\treturn configurator\n}", "title": "" }, { "docid": "ea9edfa8e9951759b7178e7c5933ccd3", "score": "0.4962177", "text": "func New(response []byte, sleep time.Duration) (m *Mock, err error) {\n\tm = new(Mock)\n\tm.response = response\n\tm.sleep = sleep\n\tm.dir, err = ioutil.TempDir(os.TempDir(), \"mock-opensips-\")\n\tif err != nil {\n\t\treturn\n\t}\n\tm.addr, err = net.ResolveUnixAddr(\"unixgram\", path.Join(m.dir, \"mock.sock\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tm.l, err = net.ListenUnixgram(\"unixgram\", m.addr)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ffbaa43a72ff933bc9d50afdbb630d0", "score": "0.496146", "text": "func NewProtocol(clusterID, clientID, sendSubject, receiveSubject string, stanOpts []stan.Option, opts ...ProtocolOption) (*Protocol, error) {\n\tconn, err := stan.Connect(clusterID, clientID, stanOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp, err := NewProtocolFromConn(conn, sendSubject, receiveSubject, opts...)\n\tif err != nil {\n\t\tif err2 := conn.Close(); err2 != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to close conn: %s, when recovering from err: %w\", err2, err)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tp.connOwned = true\n\n\treturn p, nil\n}", "title": "" }, { "docid": "f1ca54cf0b9d8de84fe14cd2f506bca3", "score": "0.49603525", "text": "func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService1ProtocolTest {\n\tsvc := &OutputService1ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService1ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService1ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "ca9738bd72b1316c61f8c91f9b991eb1", "score": "0.49593148", "text": "func NewMockProtocolClientProvider() *MockProtocolClientProvider {\n\tm := make(map[string]protocol.Client)\n\n\tm[DefaultNS] = NewMockProtocolClient()\n\treturn &MockProtocolClientProvider{\n\t\tProtocolClients: m,\n\t}\n}", "title": "" }, { "docid": "39459fef326eee8ec41bce70deeb7b77", "score": "0.49573794", "text": "func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService8ProtocolTest {\n\tsvc := &OutputService8ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService8ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService8ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "2daf574e9470c6708de3f5fda3c5ef0a", "score": "0.49565193", "text": "func NewFakeTopoFactory() *FakeFactory {\n\tfactory := &FakeFactory{\n\t\tmu: sync.Mutex{},\n\t\tcells: map[string][]*FakeConn{},\n\t}\n\tfactory.cells[topo.GlobalCell] = []*FakeConn{newFakeConnection()}\n\treturn factory\n}", "title": "" }, { "docid": "188c0c3092c81e8434af71c9f321ad73", "score": "0.49554604", "text": "func NewProtocol(conn net.Conn) *Protocol {\n\tp := new(Protocol)\n\tp.conn = conn\n\tp.setupBuffers()\n\n\t// TODO: make this deadline configurable\n\tp.deadline = 500\n\n\t// Set a default server name, this will be replaced with a call to SetServerName\n\tp.serverName = \"reeve-director\"\n\n\treturn p\n}", "title": "" }, { "docid": "a312a56cb382e04da02efbca8d09bc84", "score": "0.49537876", "text": "func Test_ProtoIO_WriteProtoResponse_BadMessage_ReturnsError(t *testing.T) {\n\tpio := ProtoIoImpl{}\n\twriter := &MockResponseWriter{}\n\terr := pio.WriteProtoResponse(writer, nil)\n\tif err == nil {\n\t\tt.Error(\"Should have received error.\")\n\t}\n}", "title": "" }, { "docid": "08f2214a812bb5b7510edd4d3e2921c1", "score": "0.49502853", "text": "func New(p Protocol, in io.Writer, out io.Reader) ContainerIO {\n\tswitch p {\n\tcase HTTP:\n\t\treturn &HTTPProtocol{in, out}\n\tcase JSON:\n\t\treturn &JSONProtocol{in, out}\n\tcase Default, Empty:\n\t\treturn &DefaultProtocol{}\n\t}\n\treturn &errorProto{errInvalidProtocol}\n}", "title": "" }, { "docid": "f9aab2b186668228112185d60adf4371", "score": "0.49495497", "text": "func newMockServer(t *testing.T, status int, res interface{}) *httptest.Server {\n\treturn httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(status)\n\t\tif res != nil {\n\t\t\tbody, err := json.Marshal(res)\n\t\t\tassert.NoError(t, err)\n\t\t\tw.Write(body)\n\t\t}\n\t}))\n\n}", "title": "" }, { "docid": "94b7aaa14207692573b657b699d18f49", "score": "0.4935553", "text": "func CreateServerMock() (ServerCreateResponse, error) {\n\n\tinput := new(ServerCreateInput)\n\tdefaultval := reflect.Indirect(reflect.ValueOf(input))\n\n\tdefaults := make(map[string]interface{})\n\tfor i := 0; i < defaultval.NumField(); i++ {\n\t\tdefaults[defaultval.Type().Field(i).Name] = defaultval.Type().Field(i).Type\n\t}\n\n\treturn ServerCreateResponse{DefaultResponse: defaults}, nil\n}", "title": "" }, { "docid": "6414ff396e94e82493fc512633b0a6e2", "score": "0.49297518", "text": "func (m *MockFramework) RequestProtocol() protocol.ProtocolVersion {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RequestProtocol\")\n\tret0, _ := ret[0].(protocol.ProtocolVersion)\n\treturn ret0\n}", "title": "" }, { "docid": "123c09d2b1f8dec15f0c2382e8531a72", "score": "0.49256498", "text": "func NewProtocol() mangos.Protocol {\n\treturn &pub{}\n}", "title": "" }, { "docid": "3c5a210450d10d214c0bbaa4a55e0c1b", "score": "0.49059612", "text": "func (m *mockContext) Protocol() protocol.Client {\n\treturn m.ProtocolClient\n}", "title": "" }, { "docid": "b98ef1a7ced9cdbf994e3386fe2afc3d", "score": "0.49037316", "text": "func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService9ProtocolTest {\n\tsvc := &OutputService9ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService9ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService9ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "8762f96c33e3b8fc73c38f44511be323", "score": "0.48983634", "text": "func NewProtocol() protocol.Protocol {\n\ts := &socket{\n\t\tpipes: make(map[uint32]*pipe),\n\t\tctxs: make(map[*context]struct{}),\n\t}\n\ts.master = &context{\n\t\ts: s,\n\t\trecvq: make(chan *protocol.Message, defaultQLen),\n\t\tcloseq: make(chan struct{}),\n\t\trecvQLen: defaultQLen,\n\t}\n\ts.ctxs[s.master] = struct{}{}\n\treturn s\n}", "title": "" }, { "docid": "5a814a3225dd13d4b10249da82baba4e", "score": "0.4891688", "text": "func main() {\n\t//fmt.Println(\"hello\")\n\tserver1 := rpckit2.NewProtocol(\"pingpong\", 1)\n\tserver1.AddStruct(rpckit2.Struct{\n\t\tName: \"ssss\",\n\t\tDescription: \"A struct\",\n\t\tFields: []rpckit2.Property{\n\t\t\trpckit2.Property{ID: 1, T: rpckit2.String(), Name: \"wee\", Description: \"WAAAAH\"},\n\t\t},\n\t})\n\n\t//server.AddError(101, \"not allowed\")\n\tserver1.AddMethod(rpckit2.Method{\n\t\tID: 1, Name: \"SimpleTest\",\n\t\tDescription: \"The simplest of tests\",\n\t\tInput: []rpckit2.Property{\n\t\t\trpckit2.Property{ID: 1, T: rpckit2.Int(), Name: \"vinteger\"},\n\t\t\trpckit2.Property{ID: 2, T: rpckit2.Int64(), Name: \"vint64\"},\n\t\t\trpckit2.Property{ID: 3, T: rpckit2.Float(), Name: \"vfloat\"},\n\t\t\trpckit2.Property{ID: 4, T: rpckit2.Double(), Name: \"vdouble\"},\n\t\t\trpckit2.Property{ID: 5, T: rpckit2.Bool(), Name: \"vbool\"},\n\t\t\trpckit2.Property{ID: 6, T: rpckit2.String(), Name: \"vstring\"},\n\t\t\trpckit2.Property{ID: 7, T: rpckit2.Bytes(), Name: \"vbytes\"},\n\t\t\trpckit2.Property{ID: 8, T: rpckit2.StructName(\"ssss\"), Name: \"vstruct\"},\n\t\t},\n\t\tOutput: []rpckit2.Property{\n\t\t\trpckit2.Property{ID: 1, T: rpckit2.Int(), Name: \"vinteger\"},\n\t\t\trpckit2.Property{ID: 2, T: rpckit2.Int64(), Name: \"vint64\"},\n\t\t\trpckit2.Property{ID: 3, T: rpckit2.Float(), Name: \"vfloat\"},\n\t\t\trpckit2.Property{ID: 4, T: rpckit2.Double(), Name: \"vdouble\"},\n\t\t\trpckit2.Property{ID: 5, T: rpckit2.Bool(), Name: \"vbool\"},\n\t\t\trpckit2.Property{ID: 6, T: rpckit2.String(), Name: \"vstring\"},\n\t\t\trpckit2.Property{ID: 7, T: rpckit2.Bytes(), Name: \"vbytes\"},\n\t\t\trpckit2.Property{ID: 8, T: rpckit2.StructName(\"ssss\"), Name: \"vstruct\"},\n\t\t},\n\t})\n\n\tserver1.AddMethod(rpckit2.Method{\n\t\tID: 2, Name: \"ArrayTest\",\n\t\tDescription: \"The simplest of tests, but with arrays\",\n\t\tInput: []rpckit2.Property{\n\t\t\trpckit2.Property{ID: 1, T: rpckit2.Array(rpckit2.Int()), Name: \"vinteger\"},\n\t\t\trpckit2.Property{ID: 2, T: rpckit2.Array(rpckit2.Int64()), Name: \"vint64\"},\n\t\t\trpckit2.Property{ID: 3, T: rpckit2.Array(rpckit2.Float()), Name: \"vfloat\"},\n\t\t\trpckit2.Property{ID: 4, T: rpckit2.Array(rpckit2.Double()), Name: \"vdouble\"},\n\t\t\trpckit2.Property{ID: 5, T: rpckit2.Array(rpckit2.Bool()), Name: \"vbool\"},\n\t\t\trpckit2.Property{ID: 6, T: rpckit2.Array(rpckit2.String()), Name: \"vstring\"},\n\t\t\trpckit2.Property{ID: 7, T: rpckit2.Array(rpckit2.Bytes()), Name: \"vbytes\"},\n\t\t\trpckit2.Property{ID: 8, T: rpckit2.Array(rpckit2.StructName(\"ssss\")), Name: \"vstruct\"},\n\t\t},\n\t\tOutput: []rpckit2.Property{\n\t\t\trpckit2.Property{ID: 1, T: rpckit2.Array(rpckit2.Int()), Name: \"vinteger\"},\n\t\t\trpckit2.Property{ID: 2, T: rpckit2.Array(rpckit2.Int64()), Name: \"vint64\"},\n\t\t\trpckit2.Property{ID: 3, T: rpckit2.Array(rpckit2.Float()), Name: \"vfloat\"},\n\t\t\trpckit2.Property{ID: 4, T: rpckit2.Array(rpckit2.Double()), Name: \"vdouble\"},\n\t\t\trpckit2.Property{ID: 5, T: rpckit2.Array(rpckit2.Bool()), Name: \"vbool\"},\n\t\t\trpckit2.Property{ID: 6, T: rpckit2.Array(rpckit2.String()), Name: \"vstring\"},\n\t\t\trpckit2.Property{ID: 7, T: rpckit2.Array(rpckit2.Bytes()), Name: \"vbytes\"},\n\t\t\trpckit2.Property{ID: 8, T: rpckit2.Array(rpckit2.StructName(\"ssss\")), Name: \"vstruct\"},\n\t\t},\n\t})\n\n\tif err := (rpckit2.SwiftGenerator{\n\t\tProtocols: []*rpckit2.Protocol{\n\t\t\tserver1,\n\t\t},\n\t\tPackageName: \"main\",\n\t}.Generate(\"../schema.generated\")); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"err: %+v\\n\", err)\n\t}\n\n\tif err := (rpckit2.GoGenerator{\n\t\tProtocols: []*rpckit2.Protocol{\n\t\t\tserver1,\n\t\t},\n\t\tPackageName: \"main\",\n\t}.Generate(\"../schema.generated\")); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"err: %+v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "8a7353ad60769496af14b1f813a99c21", "score": "0.4881847", "text": "func newMockJwtProvider(addr, respKeys string) (*MockJwtProvider, error) {\n\tl, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to create MockJwtProvider %v\", err)\n\t}\n\tmockJwtProvider := &MockJwtProvider{\n\t\tcnt: new(int32),\n\t}\n\tmockJwtProvider.s = httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tatomic.AddInt32(mockJwtProvider.cnt, 1)\n\t\tglog.Infof(\"Provider at addr %v responding with: %v\", addr, respKeys)\n\t\tw.Write([]byte(respKeys))\n\t}))\n\tmockJwtProvider.s.Listener.Close()\n\tmockJwtProvider.s.Listener = l\n\tmockJwtProvider.s.Start()\n\treturn mockJwtProvider, nil\n}", "title": "" }, { "docid": "aa78dae6eb3843770ec38c8a073f6ed2", "score": "0.4876908", "text": "func newTestServer() (*Server, string) {\n\tport := os.Getenv(\"TEST_HTTP_PORT\")\n\tif len(port) == 0 {\n\t\tport = \"8080\"\n\t}\n\tconfig := ServerConfig{ListenAddress: \":\" + port}\n\tserver, err := NewServer(&config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server, \"http://localhost:\" + port\n}", "title": "" }, { "docid": "f0ec4f72412846a65ccdb0bec0cc6696", "score": "0.48750567", "text": "func newFakeReconciler(initObjects ...runtime.Object) *ReconcileMachineHealthCheck {\n\tfakeClient := fake.NewFakeClient(initObjects...)\n\treturn &ReconcileMachineHealthCheck{\n\t\tclient: fakeClient,\n\t\tscheme: scheme.Scheme,\n\t\tnamespace: namespace,\n\t}\n}", "title": "" }, { "docid": "d45d18e9c6dcfb0d2e8c941e7d7a10a8", "score": "0.48662093", "text": "func New(name string, mspID string, blockHeight uint64) *MockChannelPeer {\n\tpeer, err := peer.New(config, peer.WithURL(\"grpc://\"+name+\":7051\"), peer.WithServerName(name), peer.WithMSPID(mspID))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to create peer: %s)\", err))\n\t}\n\n\treturn &MockChannelPeer{\n\t\tPeer: peer,\n\t\tblockHeight: blockHeight,\n\t}\n}", "title": "" }, { "docid": "12e077b595f501b0e29ce39c60eaca61", "score": "0.4856845", "text": "func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {\n\tservice := &service.Service{\n\t\tServiceInfo: serviceinfo.ServiceInfo{\n\t\t\tConfig: defaults.DefaultConfig.Merge(config),\n\t\t\tServiceName: \"inputservice2protocoltest\",\n\t\t\tAPIVersion: \"2014-01-01\",\n\t\t},\n\t}\n\tservice.Initialize()\n\n\t// Handlers\n\tservice.Handlers.Sign.PushBack(v4.Sign)\n\tservice.Handlers.Build.PushBack(query.Build)\n\tservice.Handlers.Unmarshal.PushBack(query.Unmarshal)\n\tservice.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)\n\tservice.Handlers.UnmarshalError.PushBack(query.UnmarshalError)\n\n\treturn &InputService2ProtocolTest{service}\n}", "title": "" }, { "docid": "37bb53fd247913f02237dec670a31f07", "score": "0.48554623", "text": "func NewStubModified(t *testing.T, in interface{}, changes interface{}) *StubMessage {\n\tpayload := struct {\n\t\tBody interface{}\n\t\tChanges interface{}\n\t}{\n\t\tBody: in,\n\t\tChanges: changes,\n\t}\n\tdata, err := json.Marshal(payload)\n\tif err != nil {\n\t\tt.Fatalf(\"error while marshalling data %v\", err)\n\t}\n\tsm := &StubMessage{\n\t\tbody: data,\n\t}\n\n\treturn sm\n}", "title": "" }, { "docid": "83ae2bce4c45dd1d1940308447d1d67f", "score": "0.4854349", "text": "func NewProtocol(raw string) (Protocol, error) {\n\tswitch {\n\tcase strings.EqualFold(protocolUDPStr, raw):\n\t\treturn ProtocolUDP, nil\n\tcase strings.EqualFold(protocolTCPStr, raw):\n\t\treturn ProtocolTCP, nil\n\tdefault:\n\t\treturn Protocol(Unknown), fmt.Errorf(\"unknown protocol: %s\", raw)\n\t}\n}", "title": "" }, { "docid": "6bfc3fdbce45662ca76d3ff3589ec3a9", "score": "0.4843595", "text": "func (m *MockProtocolConstructor) RequestProtocol() protocol.ProtocolVersion {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RequestProtocol\")\n\tret0, _ := ret[0].(protocol.ProtocolVersion)\n\treturn ret0\n}", "title": "" }, { "docid": "4bff9dfbcedf8b6a0265262c095af935", "score": "0.48402184", "text": "func NewUnregisteredFake(namespace types.StreamName) (Fake, *Client) {\n\tf := Fake{\n\t\t0,\n\t\t&fakeDialer{streams: map[types.StreamName]*fakeStream{}},\n\t}\n\treturn f, &Client{f.dial, namespace}\n}", "title": "" }, { "docid": "19173663cf3feccd3682c6127df6f296", "score": "0.4834026", "text": "func New(kubeClientSet kubernetes.Interface, lt *loadTestV1.LoadTest, logger *zap.Logger) *Fake {\n\tbackend := &Backend{\n\t\tkubeClient: kubeClientSet,\n\t\tlogger: logger,\n\t}\n\n\tbackend.SetDefaults()\n\n\treturn &Fake{\n\t\tbackend: backend,\n\t\tloadTest: lt,\n\t}\n}", "title": "" }, { "docid": "252c4ab1c56dadcfcac6476bc1ac5f11", "score": "0.4832879", "text": "func New() *Fake {\n\treturn &Fake{\n\t\tgates: &gates{\n\t\t\tbyTag: map[string][]*vtadminpb.VTGate{},\n\t\t\tbyName: map[string]*vtadminpb.VTGate{},\n\t\t},\n\t\tvtctlds: &vtctlds{\n\t\t\tbyTag: map[string][]*vtadminpb.Vtctld{},\n\t\t\tbyName: map[string]*vtadminpb.Vtctld{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3f9b8944fa68f66ddb9f13be7952ba4a", "score": "0.4832261", "text": "func TestClientWrongMessageTypeLegacy(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\ttransport := thrift.NewTMemoryBuffer()\n\tprotocol := NewMockTProtocol(mockCtrl)\n\tgomock.InOrder(\n\t\tprotocol.EXPECT().WriteMessageBegin(context.Background(), \"testString\", thrift.CALL, int32(1)),\n\t\tprotocol.EXPECT().WriteStructBegin(context.Background(), \"testString_args\"),\n\t\tprotocol.EXPECT().WriteFieldBegin(context.Background(), \"s\", thrift.TType(thrift.STRING), int16(1)),\n\t\tprotocol.EXPECT().WriteString(context.Background(), \"test\"),\n\t\tprotocol.EXPECT().WriteFieldEnd(context.Background()),\n\t\tprotocol.EXPECT().WriteFieldStop(context.Background()),\n\t\tprotocol.EXPECT().WriteStructEnd(context.Background()),\n\t\tprotocol.EXPECT().WriteMessageEnd(context.Background()),\n\t\tprotocol.EXPECT().Flush(context.Background()),\n\t\tprotocol.EXPECT().ReadMessageBegin(context.Background()).Return(\"testString\", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),\n\t)\n\n\tclient := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)\n\t_, err := client.TestString(defaultCtx, \"test\")\n\tmockCtrl.Finish()\n\tappErr, ok := err.(thrift.TApplicationException)\n\tif !ok {\n\t\tt.Fatal(\"Expected TApplicationException\")\n\t}\n\tif appErr.TypeId() != thrift.INVALID_MESSAGE_TYPE_EXCEPTION {\n\t\tt.Fatal(\"Expected INVALID_MESSAGE_TYPE_EXCEPTION error\")\n\t}\n}", "title": "" }, { "docid": "5cf8d5e4fd403ace036a301b9d50b623", "score": "0.4830505", "text": "func (f *FServiceProvider) GetProtocolFactory() *FProtocolFactory {\n\treturn f.protocolFactory\n}", "title": "" }, { "docid": "86acbb845acf574342ded60f4d6eb517", "score": "0.48290023", "text": "func NewMock() *MockClient {\n\treturn &MockClient{\n\t\tnextPatientConfigCall: make(map[string]*patientConfigCall),\n\t}\n}", "title": "" }, { "docid": "19e796359e226482794f201ab0483404", "score": "0.48188907", "text": "func NewMock(idlerAPI string, state PodState, throwError bool) (idler *Mock) {\n\treturn &Mock{\n\t\tidlerAPI: idlerAPI,\n\t\tIdlerState: state,\n\t\tthrowError: throwError,\n\t}\n}", "title": "" }, { "docid": "152c41afc78fc9c0a0afb0bdc6362030", "score": "0.48141187", "text": "func newFakeController() (*Controller, agtesting.Mocks) {\n\tm := agtesting.NewMocks()\n\tc := NewController(healthcheck.NewHandler(), m.KubeClient, m.ExtClient, m.AgonesClient, m.AgonesInformerFactory)\n\tc.recorder = m.FakeRecorder\n\treturn c, m\n}", "title": "" }, { "docid": "08f4d361084e200de2564a374301b1f2", "score": "0.48140725", "text": "func NewMock() *ServerMock {\n\treturn &ServerMock{\n\t\tconnected: true,\n\t\tmsgC: make(chan Message, 100),\n\t\terrC: make(chan error, 1),\n\t}\n}", "title": "" }, { "docid": "feb2438fd9348420064503005f763723", "score": "0.48044613", "text": "func newFakeChain(params *chaincfg.Params) *BlockChain {\n\t// Create a genesis block node and block index populated with it for use\n\t// when creating the fake chain below.\n\tnode := newBlockNode(&params.GenesisBlock.Header, nil)\n\tnode.status = statusDataStored | statusValidated\n\tnode.isFullyLinked = true\n\tindex := newBlockIndex(nil)\n\tindex.bestHeader = node\n\tindex.AddNode(node)\n\n\t// Generate a deployment ID map from the provided params.\n\tdeploymentData, err := extractDeployments(params)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &BlockChain{\n\t\tdeploymentData: deploymentData,\n\t\tchainParams: params,\n\t\tindex: index,\n\t\tbestChain: newChainView(node),\n\t\trecentBlocks: lru.NewKVCache(recentBlockCacheSize),\n\t\tisVoterMajorityVersionCache: make(map[[stakeMajorityCacheKeySize]byte]bool),\n\t\tisStakeMajorityVersionCache: make(map[[stakeMajorityCacheKeySize]byte]bool),\n\t\tcalcPriorStakeVersionCache: make(map[[chainhash.HashSize]byte]uint32),\n\t\tcalcVoterVersionIntervalCache: make(map[[chainhash.HashSize]byte]uint32),\n\t\tcalcStakeVersionCache: make(map[[chainhash.HashSize]byte]uint32),\n\t}\n}", "title": "" }, { "docid": "61022b32845ce4f4088920491a118861", "score": "0.47983786", "text": "func newJobcoinMock(addressInfo clientlib.JobcoinAddressInfo, addressErr, sendErr error) clientlib.JobcoinClient {\n\treturn &mockJobcoinClient{\n\t\tAddressInfo: addressInfo,\n\t\tGetAddressError: addressErr,\n\t\tSendError: sendErr,\n\t}\n}", "title": "" }, { "docid": "b405cea47c9694e1a132550ea26f7497", "score": "0.47905657", "text": "func New(err error) backend.B {\n\tif err == nil {\n\t\tpanic(\"the error must not be nil\")\n\t}\n\treturn erroringImpl{err}\n}", "title": "" }, { "docid": "e99f8e3d6c9fa9ea391057097abfb846", "score": "0.47808725", "text": "func newFakeNodeServer(stopper *stop.Stopper) (*fakeStoresServer, *rpc.Context, string, error) {\n\tctx := rpc.NewContext(testutils.NewNodeTestBaseContext(), nil, stopper)\n\ts := rpc.NewServer(ctx)\n\tln, err := netutil.ListenAndServeGRPC(ctx.Stopper, s, util.TestAddr)\n\tif err != nil {\n\t\treturn nil, nil, \"\", err\n\t}\n\tstopper.AddCloser(stop.CloserFn(func() { _ = ln.Close() }))\n\tf := &fakeStoresServer{}\n\troachpb.RegisterInternalStoresServer(s, f)\n\treturn f, ctx, ln.Addr().String(), nil\n}", "title": "" }, { "docid": "1074be690c85c851606793a46131c9a2", "score": "0.4780081", "text": "func NewMockClientProtocol(ctrl *gomock.Controller) *MockClientProtocol {\n\tmock := &MockClientProtocol{ctrl: ctrl}\n\tmock.recorder = &MockClientProtocolMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "c741e4322b1b17f893f0ad110a049877", "score": "0.4777614", "text": "func New(t *storageprovider.Topology) *Fake {\n\treturn &Fake{\n\t\tTopology: t,\n\t\tCurrentUtilization: 50,\n\t}\n}", "title": "" }, { "docid": "13be7c04adb0a1175ce5fad04a897ca6", "score": "0.4774939", "text": "func createDummyServer(t *testing.T, requiredStatusCode int, isPassed bool, requiredStatusResponse string) (*httptest.Server, string, string) {\n\tif requiredStatusCode == http.StatusOK {\n\t\tserver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar got models.ExternalOSRequest\n\t\t\treq := r.Body\n\t\t\treader, _ := io.ReadAll(req)\n\t\t\tjson.Unmarshal(reader, &got)\n\n\t\t\twantReq := getRequest()\n\n\t\t\tassert.NotNil(t, got)\n\t\t\tassert.Equal(t, got, wantReq)\n\t\t\tif r.URL.Path == constants.EXTERNAL_OPENSEARCH_API_PATH {\n\t\t\t\tif isPassed {\n\t\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\t\tw.Write([]byte(externalOpensearchResponseSuccess))\n\t\t\t\t} else {\n\t\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\t\tw.Write([]byte(externalOpensearchResponseFailure))\n\t\t\t\t}\n\t\t\t}\n\t\t}))\n\n\t\t// Extract IP and port from the server's URL\n\t\taddress := server.URL[strings.Index(server.URL, \"//\")+2:]\n\t\tcolonIndex := strings.Index(address, \":\")\n\t\tip := address[:colonIndex]\n\t\tport := address[colonIndex+1:]\n\n\t\treturn server, ip, port\n\t}\n\n\tserver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(requiredStatusCode)\n\t\tw.Write([]byte(requiredStatusResponse))\n\t}))\n\n\t// Extract IP and port from the server's URL\n\taddress := server.URL[strings.Index(server.URL, \"//\")+2:]\n\tcolonIndex := strings.Index(address, \":\")\n\tip := address[:colonIndex]\n\tport := address[colonIndex+1:]\n\n\treturn server, ip, port\n}", "title": "" }, { "docid": "89b6af0e3b5e10dd63e6bc3ff6c76156", "score": "0.4769769", "text": "func NewFakeClient(t *testing.T, initObjs ...runtime.Object) *FakeClient {\n\tclient := fake.NewFakeClientWithScheme(scheme.Scheme, initObjs...)\n\treturn &FakeClient{client, t, nil, nil, nil, nil}\n}", "title": "" }, { "docid": "75b00b4f9e62621cdaa1c3fc1e518faa", "score": "0.47516617", "text": "func NewHttpServerMock(fields ...HttpServerMockField) *HttpServerMock {\n\tif len(fields) == 0 {\n\t\tfields = []HttpServerMockField{MockFieldResponse}\n\t}\n\tfoundResponse := false\n\tfor _, field := range fields {\n\t\tif field == MockFieldResponse {\n\t\t\tfoundResponse = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !foundResponse {\n\t\tpanic(\"Must use MockFieldResponse.\")\n\t}\n\thttpServerMock := &HttpServerMock{fields: fields}\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\",\n\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\tresult := httpServerMock.handle(req, w, httpServerMock)\n\t\t\t_, _ = w.Write([]byte(result))\n\t\t})\n\n\tserver := httptest.NewServer(mux)\n\thttpServerMock.Server = server\n\treturn httpServerMock\n}", "title": "" }, { "docid": "2e20a53266c0383832f35e67f2b12b42", "score": "0.4750198", "text": "func newTestServer(\n\trspChan <-chan *http.Response,\n\treqChan chan<- *http.Request,\n) *httptest.Server {\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar rsp *http.Response\n\t\tselect {\n\t\tcase rsp = <-rspChan:\n\t\tdefault:\n\t\t\tpanic(\"[PROG ERR] I don't know what to respond!\")\n\t\t}\n\t\tif reqChan != nil {\n\t\t\tbodyClone := bytes.NewBuffer(nil)\n\t\t\t_, _ = io.Copy(bodyClone, r.Body)\n\t\t\treq := r.Clone(context.TODO())\n\t\t\treq.Body = ioutil.NopCloser(bodyClone)\n\t\t\tselect {\n\t\t\tcase reqChan <- req:\n\t\t\t\t// Only push request if test function is\n\t\t\t\t// popping from the channel.\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\thdrs := w.Header()\n\t\tfor k, v := range rsp.Header {\n\t\t\tfor _, vv := range v {\n\t\t\t\thdrs.Add(k, vv)\n\t\t\t}\n\t\t}\n\t\tw.WriteHeader(rsp.StatusCode)\n\t\tif rsp.Body != nil {\n\t\t\t_, _ = io.Copy(w, rsp.Body)\n\t\t}\n\t}\n\treturn httptest.NewServer(http.HandlerFunc(handler))\n}", "title": "" }, { "docid": "2e20a53266c0383832f35e67f2b12b42", "score": "0.4750198", "text": "func newTestServer(\n\trspChan <-chan *http.Response,\n\treqChan chan<- *http.Request,\n) *httptest.Server {\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar rsp *http.Response\n\t\tselect {\n\t\tcase rsp = <-rspChan:\n\t\tdefault:\n\t\t\tpanic(\"[PROG ERR] I don't know what to respond!\")\n\t\t}\n\t\tif reqChan != nil {\n\t\t\tbodyClone := bytes.NewBuffer(nil)\n\t\t\t_, _ = io.Copy(bodyClone, r.Body)\n\t\t\treq := r.Clone(context.TODO())\n\t\t\treq.Body = ioutil.NopCloser(bodyClone)\n\t\t\tselect {\n\t\t\tcase reqChan <- req:\n\t\t\t\t// Only push request if test function is\n\t\t\t\t// popping from the channel.\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\thdrs := w.Header()\n\t\tfor k, v := range rsp.Header {\n\t\t\tfor _, vv := range v {\n\t\t\t\thdrs.Add(k, vv)\n\t\t\t}\n\t\t}\n\t\tw.WriteHeader(rsp.StatusCode)\n\t\tif rsp.Body != nil {\n\t\t\t_, _ = io.Copy(w, rsp.Body)\n\t\t}\n\t}\n\treturn httptest.NewServer(http.HandlerFunc(handler))\n}", "title": "" }, { "docid": "d3fb727dffbbe53e02fbca6ba34e1415", "score": "0.47421747", "text": "func NewProtocol(peerID peer.ID, stream network.Stream, sendQueueSize int, readTimeout, writeTimeout time.Duration, serverMetrics *metrics.ServerMetrics) *Protocol {\n\tdefs := gossipMessageRegistry.Definitions()\n\tsentEvents := make([]*events.Event, len(defs))\n\tfor i, def := range defs {\n\t\tif def == nil {\n\t\t\tcontinue\n\t\t}\n\t\tsentEvents[i] = events.NewEvent(events.VoidCaller)\n\t}\n\n\treturn &Protocol{\n\t\tParser: protocol.New(gossipMessageRegistry),\n\t\tPeerID: peerID,\n\t\tEvents: ProtocolEvents{\n\t\t\tHeartbeatUpdated: events.NewEvent(HeartbeatCaller),\n\t\t\t// we need this because protocol.Protocol doesn't emit\n\t\t\t// events for sent messages anymore.\n\t\t\tSent: sentEvents,\n\t\t\tClosed: events.NewEvent(events.VoidCaller),\n\t\t\tErrors: events.NewEvent(events.ErrorCaller),\n\t\t},\n\t\tStream: stream,\n\t\tSendQueue: make(chan []byte, sendQueueSize),\n\t\treadTimeout: readTimeout,\n\t\twriteTimeout: writeTimeout,\n\t\tServerMetrics: serverMetrics,\n\t}\n}", "title": "" }, { "docid": "4ac46b789d0ae28748453c288053c10a", "score": "0.47355807", "text": "func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService10ProtocolTest {\n\tsvc := &OutputService10ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService10ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService10ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "48d553999ecd02c0faa352ce9db5d4fb", "score": "0.47328568", "text": "func newFacebookTestServer(jsonData string) (*http.Client, *httptest.Server) {\n\tclient, mux, server := testutils.TestServer()\n\tmux.HandleFunc(\"/v2.9/me\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprintf(w, jsonData)\n\t})\n\treturn client, server\n}", "title": "" }, { "docid": "8861b20dc3e5cbaa10bb673cb54ec963", "score": "0.47303006", "text": "func NewInputService2ProtocolTest(config aws.Config) *InputService2ProtocolTest {\n\tvar signingName string\n\tsigningRegion := config.Region\n\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: aws.NewClient(\n\t\t\tconfig,\n\t\t\taws.Metadata{\n\t\t\t\tServiceName: \"inputservice2protocoltest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" }, { "docid": "4b61732e49cee98d5dc37c2b5ec47e7a", "score": "0.47228616", "text": "func (x *fastReflection_MsgCreateResponse) New() protoreflect.Message {\n\treturn new(fastReflection_MsgCreateResponse)\n}", "title": "" }, { "docid": "d1e060dbea2e9ee9a16db20fed26de87", "score": "0.47224373", "text": "func TestNewResponse(t *testing.T) {\n\tassert := tassert.New(t)\n\n\t// Setup a fake Kube client. We use this to create a full simulation of creating a pod with\n\t// the required xDS Certificate, properly formatted CommonName etc.\n\tfakeKubeClient := testclient.NewSimpleClientset()\n\tfakeConfigClient := configFake.NewSimpleClientset()\n\n\t// We deliberately set the namespace and service accounts to random values\n\t// to ensure no hard-coded values sneak in.\n\tnamespace := uuid.New().String()\n\tserviceAccount := uuid.New().String()\n\n\t// This is the thing we are going to be requesting (pretending that the Envoy is requesting it)\n\trequest := &xds_discovery.DiscoveryRequest{\n\t\tTypeUrl: string(envoy.TypeSDS),\n\t\tResourceNames: []string{\n\t\t\tsecrets.SDSCert{Name: serviceAccount, CertType: secrets.ServiceCertType}.String(),\n\t\t\tsecrets.SDSCert{Name: serviceAccount, CertType: secrets.RootCertTypeForMTLSInbound}.String(),\n\t\t\tsecrets.SDSCert{Name: serviceAccount, CertType: secrets.RootCertTypeForHTTPS}.String(),\n\t\t},\n\t}\n\n\tstop := make(chan struct{})\n\tdefer close(stop)\n\n\t// The Common Name of the xDS Certificate (issued to the Envoy on the Pod by the Injector) will\n\t// have be prefixed with the ID of the pod. It is the first chunk of a dot-separated string.\n\tpodID := uuid.New().String()\n\n\tcertCommonName := certificate.CommonName(fmt.Sprintf(\"%s.%s.%s.%s\", podID, envoy.KindSidecar, serviceAccount, namespace))\n\tcertSerialNumber := certificate.SerialNumber(\"123456\")\n\tgoodProxy, err := envoy.NewProxy(certCommonName, certSerialNumber, nil)\n\tassert.Nil(err)\n\n\t_, err = envoy.NewProxy(\"-certificate-common-name-is-invalid-\", \"-cert-serial-number-is-invalid-\", nil)\n\tassert.Equal(err, envoy.ErrInvalidCertificateCN)\n\n\tcfg := configurator.NewConfigurator(fakeConfigClient, stop, namespace, \"-the-mesh-config-name-\")\n\tcertManager := tresor.NewFakeCertManager(cfg)\n\tmeshCatalog := catalog.NewFakeMeshCatalog(fakeKubeClient, fakeConfigClient)\n\n\t// ----- Test with an properly configured proxy\n\tresources, err := NewResponse(meshCatalog, goodProxy, request, cfg, certManager, nil)\n\tassert.Equal(err, nil, fmt.Sprintf(\"Error evaluating sds.NewResponse(): %s\", err))\n\tassert.NotNil(resources)\n\tassert.Equal(len(resources), 2)\n\t_, ok := resources[0].(*xds_auth.Secret)\n\tassert.True(ok)\n}", "title": "" }, { "docid": "feaafe22687ac8fe4c6b25e6322228d3", "score": "0.47104296", "text": "func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *OutputService12ProtocolTest {\n\tsvc := &OutputService12ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"OutputService12ProtocolTest\",\n\t\t\t\tServiceID: \"OutputService12ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(query.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)\n\n\treturn svc\n}", "title": "" } ]
1581f3a48ee859dc64052d5ce8e25dba
Tests default root key generation
[ { "docid": "86a6b16a68eefc93ccc4773ee3c70225", "score": "0.8303446", "text": "func TestDefaultRootKeyGeneration(t *testing.T) {\n\t// -- setup --\n\tsetUp(t)\n\n\ttempDir := tempDirWithConfig(t, \"{}\")\n\tdefer os.RemoveAll(tempDir)\n\n\t// -- tests --\n\n\t// starts out with no keys\n\tassertNumKeys(t, tempDir, 0, 0, true)\n\n\t// generate root key with no algorithm produces a single ECDSA root key and no other keys\n\t_, err := runCommand(t, tempDir, \"key\", \"generate\")\n\trequire.NoError(t, err)\n\tassertNumKeys(t, tempDir, 1, 0, true)\n}", "title": "" } ]
[ { "docid": "3dd7911966025bb717ea03dc9b382d6e", "score": "0.70170105", "text": "func TestGeneratingKeyOfCustomLength(t *testing.T) {\n\tgenerator, _ := setupKG(t)\n\n\tderivedKey := generator.GenerateKey([]byte(\"some_salt\"), 32)\n\tassert.Equal(t, 32, len(derivedKey), \"Should have generated a key of the right size\")\n}", "title": "" }, { "docid": "392b5b5ea559f87a88c4f18dfa5aeeae", "score": "0.7001194", "text": "func TestInitWithRootKey(t *testing.T) {\n\t// -- setup --\n\tsetUp(t)\n\n\ttempDir := tempDirWithConfig(t, \"{}\")\n\tdefer os.RemoveAll(tempDir)\n\n\tserver := setupServer()\n\tdefer server.Close()\n\n\ttempFile, err := ioutil.TempFile(\"\", \"targetfile\")\n\trequire.NoError(t, err)\n\ttempFile.Close()\n\tdefer os.Remove(tempFile.Name())\n\n\t// -- tests --\n\n\t// create encrypted root key\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\t// if the key has a root role, AddKey sets the gun to \"\" so we have done the same here\n\tencryptedPEMPrivKey, err := utils.EncryptPrivateKey(privKey, data.CanonicalRootRole, \"\", testPassphrase)\n\trequire.NoError(t, err)\n\tencryptedPEMKeyFilename := filepath.Join(tempDir, \"encrypted_key.key\")\n\terr = ioutil.WriteFile(encryptedPEMKeyFilename, encryptedPEMPrivKey, 0644)\n\trequire.NoError(t, err)\n\n\t// init repo\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun\", \"--rootkey\", encryptedPEMKeyFilename)\n\trequire.NoError(t, err)\n\n\t// publish repo\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"publish\", \"gun\")\n\trequire.NoError(t, err)\n\n\t// check that the root key used for init is the one listed as root key\n\toutput, err := runCommand(t, tempDir, \"key\", \"list\")\n\trequire.NoError(t, err)\n\trequire.Contains(t, output, data.PublicKeyFromPrivate(privKey).ID())\n\n\t// check error if file doesn't exist\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun2\", \"--rootkey\", \"bad_file\")\n\trequire.Error(t, err, \"Init with nonexistent key file should error\")\n\n\t// check error if file is invalid format\n\tbadKeyFilename := filepath.Join(tempDir, \"bad_key.key\")\n\tnonPEMKey := []byte(\"thisisnotapemkey\")\n\terr = ioutil.WriteFile(badKeyFilename, nonPEMKey, 0644)\n\trequire.NoError(t, err)\n\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun2\", \"--rootkey\", badKeyFilename)\n\trequire.Error(t, err, \"Init with non-PEM key should error\")\n\n\t// check error if unencrypted PEM used\n\tunencryptedPrivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\tunencryptedPEMPrivKey, err := utils.KeyToPEM(unencryptedPrivKey, data.CanonicalRootRole, \"\")\n\trequire.NoError(t, err)\n\tunencryptedPEMKeyFilename := filepath.Join(tempDir, \"unencrypted_key.key\")\n\terr = ioutil.WriteFile(unencryptedPEMKeyFilename, unencryptedPEMPrivKey, 0644)\n\trequire.NoError(t, err)\n\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun2\", \"--rootkey\", unencryptedPEMKeyFilename)\n\trequire.Error(t, err, \"Init with unencrypted PEM key should error\")\n\n\t// check error if invalid password used\n\t// instead of using a new retriever, we create a new key with a different pass\n\tbadPassPrivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\t// Blank gun name since it is a root key\n\tbadPassPEMPrivKey, err := utils.EncryptPrivateKey(badPassPrivKey, data.CanonicalRootRole, \"\", \"bad_pass\")\n\trequire.NoError(t, err)\n\tbadPassPEMKeyFilename := filepath.Join(tempDir, \"badpass_key.key\")\n\terr = ioutil.WriteFile(badPassPEMKeyFilename, badPassPEMPrivKey, 0644)\n\trequire.NoError(t, err)\n\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun2\", \"--rootkey\", badPassPEMKeyFilename)\n\trequire.Error(t, err, \"Init with wrong password should error\")\n\n\t// check error if wrong role specified\n\tsnapshotPrivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\tsnapshotPEMPrivKey, err := utils.KeyToPEM(snapshotPrivKey, data.CanonicalSnapshotRole, \"gun2\")\n\trequire.NoError(t, err)\n\tsnapshotPEMKeyFilename := filepath.Join(tempDir, \"snapshot_key.key\")\n\terr = ioutil.WriteFile(snapshotPEMKeyFilename, snapshotPEMPrivKey, 0644)\n\trequire.NoError(t, err)\n\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun2\", \"--rootkey\", snapshotPEMKeyFilename)\n\trequire.Error(t, err, \"Init with wrong role should error\")\n}", "title": "" }, { "docid": "de803297bd2e7913a80563ec126550cc", "score": "0.69841754", "text": "func TestKeyRotationNonRoot(t *testing.T) {\n\t// -- setup --\n\tsetUp(t)\n\n\ttempDir := tempDirWithConfig(t, \"{}\")\n\tdefer os.RemoveAll(tempDir)\n\n\ttempfiles := make([]string, 2)\n\tfor i := 0; i < 2; i++ {\n\t\ttempFile, err := ioutil.TempFile(\"\", \"targetfile\")\n\t\trequire.NoError(t, err)\n\t\ttempFile.Close()\n\t\ttempfiles[i] = tempFile.Name()\n\t\tdefer os.Remove(tempFile.Name())\n\t}\n\n\tserver := setupServer()\n\tdefer server.Close()\n\n\tvar target = \"sdgkadgad\"\n\n\t// -- tests --\n\n\t// starts out with no keys\n\tassertNumKeys(t, tempDir, 0, 0, true)\n\n\t// generate root key produces a single root key and no other keys\n\t_, err := runCommand(t, tempDir, \"key\", \"generate\", data.ECDSAKey)\n\trequire.NoError(t, err)\n\tassertNumKeys(t, tempDir, 1, 0, true)\n\n\t// initialize a repo, should have signing keys and no new root key\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun\")\n\trequire.NoError(t, err)\n\tassertNumKeys(t, tempDir, 1, 2, true)\n\n\t// publish using the original keys\n\tassertSuccessfullyPublish(t, tempDir, server.URL, \"gun\", target, tempfiles[0])\n\n\t// create new target keys\n\ttempFile, err := ioutil.TempFile(\"\", \"pemfile\")\n\trequire.NoError(t, err)\n\tdefer os.Remove(tempFile.Name())\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\tpemBytes, err := utils.EncryptPrivateKey(privKey, data.CanonicalTargetsRole, \"\", testPassphrase)\n\trequire.NoError(t, err)\n\n\tnBytes, err := tempFile.Write(pemBytes)\n\trequire.NoError(t, err)\n\ttempFile.Close()\n\trequire.Equal(t, len(pemBytes), nBytes)\n\n\ttempFile2, err := ioutil.TempFile(\"\", \"pemfile2\")\n\trequire.NoError(t, err)\n\tdefer os.Remove(tempFile2.Name())\n\n\tprivKey2, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\tpemBytes2, err := utils.KeyToPEM(privKey2, data.CanonicalTargetsRole, \"\")\n\trequire.NoError(t, err)\n\n\tnBytes2, err := tempFile2.Write(pemBytes2)\n\trequire.NoError(t, err)\n\ttempFile2.Close()\n\trequire.Equal(t, len(pemBytes2), nBytes2)\n\n\t// rotate the targets key\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalTargetsRole.String(), \"--key\", tempFile.Name(), \"--key\", tempFile2.Name())\n\trequire.NoError(t, err)\n\n\t// publish using the new keys\n\toutput := assertSuccessfullyPublish(\n\t\tt, tempDir, server.URL, \"gun\", target+\"2\", tempfiles[1])\n\t// assert that the previous target is still there\n\trequire.True(t, strings.Contains(string(output), target))\n\n\t// rotate to nonexistant key\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalTargetsRole.String(), \"--key\", \"nope.pem\")\n\trequire.Error(t, err)\n}", "title": "" }, { "docid": "602f4bb9e68230be005f3c3ed680b31b", "score": "0.6768945", "text": "func Test_genkey(t *testing.T) {\n\tword := \"1q2w3e4r5t\"\n\tapiKey := ApiKeyGenerator(word)\n\tif apiKey != \"28f0116ef42bf718324946f13d787a1d41274a08335d52ee833d5b577f02a32a\" {\n\t\tt.Error(\"Expected that ApiKeyGenerator return this hash [28f0116ef42bf718324946f13d787a1d41274a08335d52ee833d5b577f02a32a]\")\n\t}\n}", "title": "" }, { "docid": "dd69a13f40607908445b67b312bdefc6", "score": "0.6764038", "text": "func testKeyGeneration(t *testing.T, tag string) {\n\tpriv, err := GeneratePrivateKey()\n\tif err != nil {\n\t\tt.Errorf(\"%s: error: %s\", tag, err)\n\t\treturn\n\t}\n\tpub := priv.PubKey()\n\tif !isOnCurve(&pub.x, &pub.y) {\n\t\tt.Errorf(\"%s: public key invalid: %s\", tag, err)\n\t}\n}", "title": "" }, { "docid": "8d72e73623dd4acfb35221772485dd8c", "score": "0.6683396", "text": "func testRootMetadataLatestKeyGenerationPrivate(t *testing.T, ver MetadataVer) {\n\tcodec := kbfscodec.NewMsgpack()\n\tcrypto := MakeCryptoCommon(codec)\n\ttlfID := tlf.FakeID(0, false)\n\th := makeFakeTlfHandle(t, 14, false, nil, nil)\n\trmd, err := makeInitialRootMetadata(ver, tlfID, h)\n\trequire.NoError(t, err)\n\n\tif rmd.LatestKeyGeneration() != 0 {\n\t\tt.Errorf(\"Expected key generation to be invalid (0)\")\n\t}\n\trmd.fakeInitialRekey(codec, crypto)\n\tif rmd.LatestKeyGeneration() != FirstValidKeyGen {\n\t\tt.Errorf(\"Expected key generation to be valid(%d)\", FirstValidKeyGen)\n\t}\n}", "title": "" }, { "docid": "992be36635a911b2ba0670fb1b4506ca", "score": "0.6663567", "text": "func TestBase36KeyGeneration(t *testing.T) {\n\tt.Log(\"Testing base 36 key generation\")\n\tkey, err := getBase36TimeKey(time.Now())\n\n\tif err != nil {\n\t\tt.Errorf(\"Error generating ID time key\")\n\t}\n\n\tif len(key) != specTimeKeyLength {\n\t\tt.Errorf(\"Time key generated was not of specification length\")\n\t}\n}", "title": "" }, { "docid": "318436340c92ad3460074f85bd4795fb", "score": "0.6562571", "text": "func testRootMetadataLatestKeyGenerationPublic(t *testing.T, ver MetadataVer) {\n\ttlfID := tlf.FakeID(0, true)\n\th := makeFakeTlfHandle(t, 14, true, nil, nil)\n\trmd, err := makeInitialRootMetadata(ver, tlfID, h)\n\trequire.NoError(t, err)\n\n\tif rmd.LatestKeyGeneration() != PublicKeyGen {\n\t\tt.Errorf(\"Expected key generation to be public (%d)\", PublicKeyGen)\n\t}\n}", "title": "" }, { "docid": "935b1f6d453db0e5bccc67c5bd6b362c", "score": "0.6511716", "text": "func TestGenerateKey(t *testing.T) {\n\tkey, err := GenerateAESKey()\n\tif err != nil || len(key) != SymKeyLen {\n\t\tFailWithError(t, err)\n\t}\n\ttestSymKey = key\n\n\tkey, err = GenerateHMACKey()\n\tif err != nil || len(key) != MacKeyLen {\n\t\tFailWithError(t, err)\n\t}\n\ttestMacKey = key\n}", "title": "" }, { "docid": "96ffd94eba27f634131778440d657802", "score": "0.6496153", "text": "func TestTaprootKey(t *testing.T) {\n\tt.Parallel()\n\n\ttestCases := []struct {\n\t\tname string\n\t\tgiven *Tapscript\n\t\texpected []byte\n\t}{{\n\t\tname: \"full tree\",\n\t\tgiven: &Tapscript{\n\t\t\tType: TapscriptTypeFullTree,\n\t\t\tLeaves: []txscript.TapLeaf{\n\t\t\t\ttxscript.NewBaseTapLeaf(testScript1),\n\t\t\t\ttxscript.NewBaseTapLeaf(testScript2),\n\t\t\t},\n\t\t\tControlBlock: &txscript.ControlBlock{\n\t\t\t\tInternalKey: testInternalKey,\n\t\t\t\tLeafVersion: txscript.BaseLeafVersion,\n\t\t\t},\n\t\t},\n\t\texpected: testTaprootKey,\n\t}, {\n\t\tname: \"partial tree with proof\",\n\t\tgiven: &Tapscript{\n\t\t\tType: TapscriptTypePartialReveal,\n\t\t\tRevealedScript: testScript2,\n\t\t\tControlBlock: &txscript.ControlBlock{\n\t\t\t\tInternalKey: testInternalKey,\n\t\t\t\tLeafVersion: txscript.BaseLeafVersion,\n\t\t\t\tInclusionProof: testScript1Proof,\n\t\t\t},\n\t\t},\n\t\texpected: testTaprootKey,\n\t}, {\n\t\tname: \"root hash only\",\n\t\tgiven: &Tapscript{\n\t\t\tType: TaprootKeySpendRootHash,\n\t\t\tControlBlock: &txscript.ControlBlock{\n\t\t\t\tInternalKey: testInternalKey,\n\t\t\t},\n\t\t\tRootHash: []byte(\"I could be a root hash\"),\n\t\t},\n\t\texpected: testTaprootKey2,\n\t}, {\n\t\tname: \"full key only\",\n\t\tgiven: &Tapscript{\n\t\t\tType: TaprootFullKeyOnly,\n\t\t\tFullOutputKey: testInternalKey,\n\t\t},\n\t\texpected: schnorr.SerializePubKey(testInternalKey),\n\t}}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\n\t\tt.Run(tc.name, func(tt *testing.T) {\n\t\t\ttaprootKey, err := tc.given.TaprootKey()\n\t\t\trequire.NoError(tt, err)\n\n\t\t\trequire.Equal(\n\t\t\t\ttt, tc.expected, schnorr.SerializePubKey(\n\t\t\t\t\ttaprootKey,\n\t\t\t\t),\n\t\t\t)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4a325286b406454653471b97b41908bf", "score": "0.64957106", "text": "func initRootKey() ([32]byte, error) {\n\taddress, addressHash := storage.GetInitRootPubKey()\n\n\tvar seed [32]byte\n\tcopy(seed[:], storage.INIT_ROOT_SEED[:])\n\n\t//Create the hash of the seed which will be included in the transaction\n\thashedSeed := protocol.SerializeHashContent(seed)\n\n\n\terr := storage.AppendNewSeed(seedFile, storage.SeedJson{fmt.Sprintf(\"%x\", string(hashedSeed[:])), string(seed[:])})\n\tif err != nil {\n\t\treturn hashedSeed, errors.New(fmt.Sprintf(\"Error creating the seed file.\"))\n\t}\n\n\t//Balance must be greater staking minimum\n\trootAcc := protocol.NewAccount(address, INITIALINITROOTBALANCE, true, hashedSeed)\n\tstorage.State[addressHash] = &rootAcc\n\tstorage.RootKeys[addressHash] = &rootAcc\n\n\treturn hashedSeed, nil\n}", "title": "" }, { "docid": "04b3a4aa136e7f6518f3cc9262024bec", "score": "0.64696366", "text": "func Test_proGenKeys(t *testing.T) {\n\n\t// Need a public key\n\t// openssl rsa -in mykey.pem -pubout > mykey.pub\n\n\tpk, err := EncryptionPrivateKey(1028, \"HARDTOGUESS\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tf, ok, err := proconfs.CreateFile(pr0config.KeyCertPath, \"mykey.pem\")\n\tif !ok {\n\t\tfmt.Println(err)\n\t}\n\tproconfs.WriteFile(f, pk)\n}", "title": "" }, { "docid": "e4093141c75edf37e67332269094ea03", "score": "0.64197665", "text": "func (c *GenerateRootCommand) initGenerateRoot(client *api.Client, otp string, pgpKey string) int {\n\t// Start the rekey\n\tstatus, err := client.Sys().GenerateRootInit(otp, pgpKey)\n\tif err != nil {\n\t\tc.Ui.Error(fmt.Sprintf(\"Error initializing root generation: %s\", err))\n\t\treturn 1\n\t}\n\n\tc.dumpStatus(status)\n\n\treturn 0\n}", "title": "" }, { "docid": "fb257e6f679b6417a5bfac2655d2e605", "score": "0.6362831", "text": "func GenerateRootKey() (priv, pub []byte, err error) {\n\tpub, priv, err = ed25519.GenerateKey(rand.Reader)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn pem.EncodeToMemory(&pem.Block{\n\t\t\tType: pemTypeRootPrivate,\n\t\t\tBytes: []byte(priv),\n\t\t}), pem.EncodeToMemory(&pem.Block{\n\t\t\tType: pemTypeRootPublic,\n\t\t\tBytes: []byte(pub),\n\t\t}), nil\n}", "title": "" }, { "docid": "da8af31bce713671a8a73daf9b981d81", "score": "0.6312462", "text": "func GenerateRoot(t testing.T, cluster *vault.TestCluster, drToken bool) string {\n\ttoken, err := GenerateRootWithError(t, cluster, drToken)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn token\n}", "title": "" }, { "docid": "841e090dfe957ace60eb15666607acc4", "score": "0.6301481", "text": "func rootKey(k string) RootKey {\n\troot.AddKnownKey(k)\n\treturn RootKey(k)\n}", "title": "" }, { "docid": "4a667ac9ff7d2c3ade9d0cebfb29fd6a", "score": "0.6288394", "text": "func TestCryptoCommonRandomTLFKeys(t *testing.T) {\n\tc := MakeCryptoCommon(kbfscodec.NewMsgpack())\n\n\ta1, a2, a3, a4, a5, err := c.MakeRandomTLFKeys()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tb1, b2, b3, b4, b5, err := c.MakeRandomTLFKeys()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif a1 == (kbfscrypto.TLFPublicKey{}) {\n\t\tt.Errorf(\"zero TLFPublicKey (a1)\")\n\t}\n\n\tif a2 == (kbfscrypto.TLFPrivateKey{}) {\n\t\tt.Errorf(\"zero TLFPrivateKey (a2)\")\n\t}\n\n\tif a3 == (kbfscrypto.TLFEphemeralPublicKey{}) {\n\t\tt.Errorf(\"zero TLFEphemeralPublicKey (a3)\")\n\t}\n\n\tif a4 == (kbfscrypto.TLFEphemeralPrivateKey{}) {\n\t\tt.Errorf(\"zero TLFEphemeralPrivateKey (a4)\")\n\t}\n\n\tif a5 == (kbfscrypto.TLFCryptKey{}) {\n\t\tt.Errorf(\"zero TLFCryptKey (a5)\")\n\t}\n\n\tif b1 == (kbfscrypto.TLFPublicKey{}) {\n\t\tt.Errorf(\"zero TLFPublicKey (1)\")\n\t}\n\n\tif b2 == (kbfscrypto.TLFPrivateKey{}) {\n\t\tt.Errorf(\"zero TLFPrivateKey (b2)\")\n\t}\n\n\tif b3 == (kbfscrypto.TLFEphemeralPublicKey{}) {\n\t\tt.Errorf(\"zero TLFEphemeralPublicKey (b3)\")\n\t}\n\n\tif b4 == (kbfscrypto.TLFEphemeralPrivateKey{}) {\n\t\tt.Errorf(\"zero TLFEphemeralPrivateKey (b4)\")\n\t}\n\n\tif b5 == (kbfscrypto.TLFCryptKey{}) {\n\t\tt.Errorf(\"zero TLFCryptKey (b5)\")\n\t}\n\n\tif a1 == b1 {\n\t\tt.Errorf(\"a1 == b1\")\n\t}\n\n\tif a2 == b2 {\n\t\tt.Errorf(\"a2 == b2\")\n\t}\n\n\tif a3 == b3 {\n\t\tt.Errorf(\"a3 == b3\")\n\t}\n\n\tif a4 == b4 {\n\t\tt.Errorf(\"a4 == b4\")\n\t}\n\n\tif a5 == b5 {\n\t\tt.Errorf(\"a5 == b5\")\n\t}\n}", "title": "" }, { "docid": "f1dda7091a8374ceb2a4d4756429885c", "score": "0.6282654", "text": "func initRandomKey(cData *commands.CommandData) error {\n\t// Generate a random key\n\tcData.EncryptionKey = randKey(cData.RandKey)\n\tpath := \"./\"\n\n\t// use keystorepath if keystore is enabled\n\tif keystore, _ := cData.GetKeystore(); keystore != nil {\n\t\tpath = keystore.Path\n\t}\n\n\t// Generate file and save key\n\tcData.Keyfile = genFile(path, \"key\")\n\treturn ioutil.WriteFile(cData.Keyfile, cData.EncryptionKey, 0600)\n}", "title": "" }, { "docid": "630bfdc585834e28f99d537693cd9433", "score": "0.6275868", "text": "func testkey(t *testing.T) *ecdsa.PrivateKey {\n\tk, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to generate test key: %v\", err)\n\t}\n\treturn k\n}", "title": "" }, { "docid": "8e5408b50f48fb495d3678bf582335e8", "score": "0.6269373", "text": "func genMockKey() (string, error) {\n\tvar key [128 / 8]byte\n\t_, err := rand.Read(key[:])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"%x\", key), nil\n}", "title": "" }, { "docid": "1acd9bfa9e513dcb8624845049c5233e", "score": "0.62334585", "text": "func TestGenerateKey(t *testing.T) {\n\tvar testClient = GetJSON(\"./testFile.json\")\n\tif testClient.ClientId != clientId {\n\t\tt.Errorf(\"Expected: %v, Got: %v\", clientId, testClient.ClientId)\n\t}\n\tif testClient.ClientSecret != clientSecret {\n\t\tt.Errorf(\"Expected: %v, Got: %v\", clientSecret, testClient.ClientSecret)\n\t}\n\tif testClient.generateKey() != apiKey {\n\t\tt.Errorf(\"API Key was not calculated correctly, got %v\", testClient.generateKey())\n\t}\n}", "title": "" }, { "docid": "05ed866df5f8694d554bb3df4fddcef9", "score": "0.6232265", "text": "func TestGenPublicKey(t *testing.T) {\n\tvar opts Opts\n\topts.Mode = W16 // explicit, in case the default ever changes\n\n\tpubKey := GenPublicKey(testdata.Seed, testdata.PubSeed, opts)\n\n\tif !bytes.Equal(pubKey, testdata.PubKey) {\n\t\tt.Error(\"Wrong key\")\n\t}\n}", "title": "" }, { "docid": "2b5cf5e1742bac89fccd4cd661f5007a", "score": "0.6228308", "text": "func runKeyGen(kpath string) {\n\tsuite := ed25519.NewAES128SHA256Ed25519(true) \n\tKeyGen(suite, kpath)\n}", "title": "" }, { "docid": "e15e44492c3fcb2c49da6c98de702287", "score": "0.6224088", "text": "func TestGenerateKeys(t *testing.T) {\n\tfor i, k := range generateKeys(modules.Seed{}, 1000, 4000) {\n\t\tif len(k.UnlockConditions.PublicKeys) == 0 {\n\t\t\tt.Errorf(\"index %v was skipped\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "551c884ad7a2b347bced29e8dccc0f80", "score": "0.61913145", "text": "func TestGenerateKeys(t *testing.T) {\n\tt.Skip() // don't recreate keys by mistake\n\tcount := commandGenerateTestKeys(TEST_KEYS_FILENAME)\n\tkeys := getTestKeysFromFile(TEST_KEYS_FILENAME)\n\n\trequire.Equal(t, count, len(keys), \"should have written and read same number of keys\")\n}", "title": "" }, { "docid": "14659f11565a5a650ec0ddfecfea077a", "score": "0.6169008", "text": "func TestAPIKey(t *testing.T) {\n\tlog.Println(\"TestAPIKey()\")\n\n\t// Load config\n\tconfig, err := common.LoadConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not load configuration: %s\", err.Error())\n\t}\n\tcommon.Static.Config = config\n\n\t// Generate mock APIKey\n\tkey := new(APIKey)\n\tif err := key.Create(1); err != nil {\n\t\tt.Fatalf(\"Failed to create mock APIKey: %s\", err.Error())\n\t}\n\n\t// Verify key can be saved\n\tif err := key.Save(); err != nil {\n\t\tt.Fatalf(\"Failed to save APIKey: %s\", err.Error())\n\t}\n\n\t// Verify key can be loaded using matching pubkey\n\tkey2, err := key.Load(key.Pubkey, \"pubkey\")\n\tif err != nil || key2 == (APIKey{}) {\n\t\tt.Fatal(\"Failed to load APIKey: %s\", err.Error())\n\t}\n\n\t// Verify key is the same as previous one\n\tif key.Pubkey != key2.Pubkey {\n\t\tt.Fatalf(\"key.Pubkey, expected %s, got %s\", key.Pubkey, key2.Pubkey)\n\t}\n\n\t// Verify key can be deleted\n\tif err := key2.Delete(); err != nil {\n\t\tt.Fatalf(\"Failed to delete APIKey: %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "8680fe03a11e823c3aab5dd73718f4a5", "score": "0.6167494", "text": "func (s *memRootKeyStore) RootKey(context.Context) (rootKey, id []byte, err error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.key == nil {\n\t\tnewKey, err := randomBytes(24)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ts.key = newKey\n\t}\n\treturn s.key, []byte(\"0\"), nil\n}", "title": "" }, { "docid": "6b5ab4f8d878258589d5823be0ce3ae1", "score": "0.61476725", "text": "func generateKeysForNodeRegistration(t *testing.T) (crypto.PrivateKey, string, crypto.PrivateKey, string) {\n\tstakingPrivateKey, publicKey := generateKeys(t, flow_crypto.BLSBLS12381)\n\tstakingPublicKey := publicKey.String()\n\tstakingPublicKey = stakingPublicKey[2:]\n\tnetworkingPrivateKey, publicKey := generateKeys(t, flow_crypto.ECDSAP256)\n\tnetworkingPublicKey := publicKey.String()\n\tnetworkingPublicKey = networkingPublicKey[2:]\n\n\treturn stakingPrivateKey, stakingPublicKey, networkingPrivateKey, networkingPublicKey\n\n}", "title": "" }, { "docid": "2585a138f1078783efc9083bcd4d2b4d", "score": "0.61468714", "text": "func testNewPCWSByRoots(t *testing.T) {\n\tr := new(Renter)\n\tr.staticWorkerPool = new(workerPool)\n\n\t// create random roots\n\tvar root1 crypto.Hash\n\tvar root2 crypto.Hash\n\tfastrand.Read(root1[:])\n\tfastrand.Read(root2[:])\n\troots := []crypto.Hash{root1, root2}\n\n\t// create a passthrough EC and a passhtrough cipher key\n\tptec := modules.NewPassthroughErasureCoder()\n\tptck, err := crypto.NewSiaKey(crypto.TypePlain, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// verify basic case\n\t_, err = r.newPCWSByRoots(context.Background(), roots[:1], ptec, ptck, 0)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// verify the case where we the amount of roots does not equal num pieces\n\t// defined in the erasure coder\n\t_, err = r.newPCWSByRoots(context.Background(), roots, ptec, ptck, 0)\n\tif err == nil || !strings.Contains(err.Error(), \"but erasure coder specifies 1 pieces\") {\n\t\tt.Fatal(err)\n\t}\n\n\t// verify the legacy case where 1-of-N only needs 1 root\n\tec, err := modules.NewRSCode(1, 10)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// verify the amount of roots provided **does not** equal num pieces,\n\t// usually causing an error\n\tif len(roots[:1]) == ec.NumPieces() {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\t_, err = r.newPCWSByRoots(context.Background(), roots[:1], ec, ptck, 0)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected\")\n\t}\n\n\t// verify passing nil for the master key returns an error\n\t_, err = r.newPCWSByRoots(context.Background(), roots[:1], ptec, nil, 0)\n\tif err == nil {\n\t\tt.Fatal(\"unexpected\")\n\t}\n}", "title": "" }, { "docid": "36b6839e5433574e37dd63af9584e915", "score": "0.6140543", "text": "func TestClientKeyGenerationRotation(t *testing.T) {\n\t// -- setup --\n\tsetUp(t)\n\n\ttempDir := tempDirWithConfig(t, \"{}\")\n\tdefer os.RemoveAll(tempDir)\n\n\ttempfiles := make([]string, 2)\n\tfor i := 0; i < 2; i++ {\n\t\ttempFile, err := ioutil.TempFile(\"\", \"targetfile\")\n\t\trequire.NoError(t, err)\n\t\ttempFile.Close()\n\t\ttempfiles[i] = tempFile.Name()\n\t\tdefer os.Remove(tempFile.Name())\n\t}\n\n\tserver := setupServer()\n\tdefer server.Close()\n\n\tvar target = \"sdgkadga\"\n\n\t// -- tests --\n\n\t// starts out with no keys\n\tassertNumKeys(t, tempDir, 0, 0, true)\n\n\t// generate root key produces a single root key and no other keys\n\t_, err := runCommand(t, tempDir, \"key\", \"generate\", data.ECDSAKey)\n\trequire.NoError(t, err)\n\tassertNumKeys(t, tempDir, 1, 0, true)\n\n\t// initialize a repo, should have signing keys and no new root key\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"init\", \"gun\")\n\trequire.NoError(t, err)\n\torigRoot, origSign := assertNumKeys(t, tempDir, 1, 2, true)\n\n\t// publish using the original keys\n\tassertSuccessfullyPublish(t, tempDir, server.URL, \"gun\", target, tempfiles[0])\n\n\t// rotate the signing keys\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalSnapshotRole.String())\n\trequire.NoError(t, err)\n\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalTargetsRole.String())\n\trequire.NoError(t, err)\n\troot, sign := assertNumKeys(t, tempDir, 1, 2, true)\n\trequire.Equal(t, origRoot[0], root[0])\n\n\t// just do a cursory rotation check that the keys aren't equal anymore\n\tfor _, origKey := range origSign {\n\t\tfor _, key := range sign {\n\t\t\trequire.NotEqual(\n\t\t\t\tt, key, origKey, \"One of the signing keys was not removed\")\n\t\t}\n\t}\n\n\t// publish using the new keys\n\toutput := assertSuccessfullyPublish(\n\t\tt, tempDir, server.URL, \"gun\", target+\"2\", tempfiles[1])\n\t// assert that the previous target is still there\n\trequire.True(t, strings.Contains(string(output), target))\n\n\t// rotate the snapshot and timestamp keys on the server, multiple times\n\tfor i := 0; i < 10; i++ {\n\t\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalSnapshotRole.String(), \"-r\")\n\t\trequire.NoError(t, err)\n\t\t_, err = runCommand(t, tempDir, \"-s\", server.URL, \"key\", \"rotate\", \"gun\", data.CanonicalTimestampRole.String(), \"-r\")\n\t\trequire.NoError(t, err)\n\t}\n}", "title": "" }, { "docid": "fef55cb7e1c73d792104ce8cacf171ae", "score": "0.61393356", "text": "func Generate(node *v1alpha1.Node) error {\n\tswitch node.KeyConfig.Type {\n\tcase v1alpha1.TypeLiteral:\n\t\tnode.Value = []byte(node.KeyConfig.Value)\n\tcase v1alpha1.TypePassword:\n\t\tif node.KeyConfig.Length == 0 {\n\t\t\tnode.KeyConfig.Length = defaultPasswordLength\n\t\t}\n\t\tpassword, err := GeneratePassword(node.KeyConfig.Length)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnode.Value = password\n\tcase v1alpha1.TypePrivateKey:\n\t\tprivateKeyPEM, err := generateRSAPrivateKey()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnode.Value = privateKeyPEM\n\tcase v1alpha1.TypePublicKeySSH:\n\t\tprivateKeyPEM, err := getValueFromParent(node.KeyConfig.PrivateKeyPath, node)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpublicKeyPEM, err := getRSAPublicKeySSHFromPrivateKey(privateKeyPEM)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnode.Value = publicKeyPEM\n\tcase v1alpha1.TypeCA:\n\t\trootCA, err := GenerateRootCA(\"ForgeRock\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnode.Value = rootCA.CertPEM\n\n\t\t// find private key node(s)\n\t\tfor _, childNode := range node.Children {\n\t\t\tif childNode.KeyConfig.Type == v1alpha1.TypeCAPrivateKey {\n\t\t\t\tif memorystore.Equal(childNode.KeyConfig.CAPath, node.Path) {\n\t\t\t\t\tchildNode.Value = rootCA.PrivateKeyPEM\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase v1alpha1.TypeCAPrivateKey:\n\t\t// taken care of by TypeCA\n\tcase v1alpha1.TypeCACopy:\n\t\tcaPEM, err := getValueFromParent(node.KeyConfig.CAPath, node)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnode.Value = caPEM\n\tcase v1alpha1.TypeJCEKS:\n\t\t// TODO\n\tcase v1alpha1.TypePKCS12:\n\t\tswitch length := len(node.Path); length {\n\t\tcase 2: // compiled keystore\n\t\t\tvalue, err := GetKeystore(node.Path)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithStack(err)\n\t\t\t}\n\n\t\t\tnode.Value = value\n\t\tcase 3: // individual aliases\n\t\t\tswitch node.AliasConfig.Type {\n\t\t\tcase v1alpha1.TypeCACopyAlias:\n\t\t\t\tcaCertPEM, err := getValueFromParent(node.AliasConfig.CAPath, node)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tstorePassword, err := getValueFromParent(node.KeyConfig.StorePassPath, node)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = ImportCertFromPEM(caCertPEM, storePassword, node.AliasConfig)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tnode.Value = caCertPEM\n\t\t\tcase v1alpha1.TypeKeyPair:\n\t\t\t\t// get private key's PEM value\n\t\t\t\trootCAPrivateKeyPEM, err := getValueFromParent(node.AliasConfig.SignedWithPath, node)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// get private key's CA PEM value\n\t\t\t\trootCAPEM := []byte{}\n\t\t\t\tfor _, parentNode := range node.Parents {\n\t\t\t\t\tif memorystore.Equal(node.AliasConfig.SignedWithPath, parentNode.Path) {\n\t\t\t\t\t\trootCAPEM, err = getValueFromParent(parentNode.KeyConfig.CAPath, parentNode)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(rootCAPEM) == 0 {\n\t\t\t\t\treturn errors.New(\"Failed to find root CA PEM value\")\n\t\t\t\t}\n\n\t\t\t\t// generate\n\t\t\t\tcertAndKeyPEM, certPEM, keyPEM, err := GenerateSignedCertPEM(\n\t\t\t\t\trootCAPEM,\n\t\t\t\t\trootCAPrivateKeyPEM,\n\t\t\t\t\tnode.AliasConfig.Algorithm,\n\t\t\t\t\tnode.AliasConfig.CommonName,\n\t\t\t\t\tnode.AliasConfig.Sans,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// add to keystore\n\t\t\t\tstorePassword, err := getValueFromParent(node.KeyConfig.StorePassPath, node)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = ImportKeyPairFromPEMs(certPEM, keyPEM, storePassword, node.AliasConfig)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tnode.Value = certAndKeyPEM\n\t\t\tcase v1alpha1.TypeHMACKey:\n\t\t\t\t// TODO placeholder\n\t\t\t\tnode.Value = []byte(\"temp-placeholder\")\n\t\t\tcase v1alpha1.TypeAESKey:\n\t\t\t\t// TODO placeholder\n\t\t\t\tnode.Value = []byte(\"temp-placeholder\")\n\t\t\tdefault:\n\t\t\t\treturn errors.WithStack(fmt.Errorf(\"Unexpected aliasConfig.Type: '%v', in %v\", node.AliasConfig.Type, node.Path))\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn errors.WithStack(fmt.Errorf(\"Unexpected node.KeyConfig.Type: '%v', in %v\", node.KeyConfig.Type, node.Path))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "10af6ad5bcae51de7834e69fc79332ff", "score": "0.61354554", "text": "func TestNymRandomizedGenerate(t *testing.T) {\n\tsk, h, prg := generateCredKeys()\n\n\tskNym1, pkNym1 := GenerateNymKeys(prg, sk, h)\n\tskNym2, pkNym2 := GenerateNymKeys(prg, sk, h)\n\n\tassert.Check(t, !bigEqual(skNym1, skNym2))\n\tassert.Check(t, !pkEqual(pkNym1, pkNym2))\n}", "title": "" }, { "docid": "98698566c9ac3371bcb6d0fe7ba31805", "score": "0.6118437", "text": "func testPKEKeyGeneration(t *testing.T, v sikeVec) {\n\tvar err error\n\tparams := common.Params(v.id)\n\tvar pt [common.MaxMsgBsz]byte\n\tmsg := make([]byte, params.MsgLen)\n\tct := make([]byte, v.kem.CiphertextSize())\n\t// static buffer to ensure no overrides\n\tpk := NewPublicKey(v.id, KeyVariantSike)\n\tsk := NewPrivateKey(v.id, KeyVariantSike)\n\n\tfor i := range msg {\n\t\tmsg[i] = byte(i)\n\t}\n\n\terr = sk.Generate(rand.Reader)\n\tCheckNoErr(t, err, \"PKE key generation\")\n\tsk.GeneratePublicKey(pk)\n\n\terr = v.kem.encrypt(ct, rand.Reader, pk, msg[:])\n\tCheckNoErr(t, err, \"PKE encryption\")\n\tptLen, err := v.kem.decrypt(pt[:], sk, ct)\n\tCheckNoErr(t, err, \"PKE key decryption\")\n\n\tif !bytes.Equal(pt[:ptLen], msg[:]) {\n\t\tt.Fatalf(\"Decryption failed \\n got : %X\\n exp : %X\", pt, msg)\n\t}\n}", "title": "" }, { "docid": "5784a4d2723d9590fc2e0d373ae92740", "score": "0.61182123", "text": "func TestRootMetadataUpconversionPrivate(t *testing.T) {\n\tconfig := MakeTestConfigOrBust(t, \"alice\", \"bob\", \"charlie\")\n\tconfig.SetKeyCache(&dummyNoKeyCache{})\n\tctx := context.Background()\n\tdefer config.Shutdown(ctx)\n\n\ttlfID := tlf.FakeID(1, false)\n\th := parseTlfHandleOrBust(t, config, \"alice,alice@twitter#bob,charlie@twitter,eve@reddit\", false)\n\trmd, err := makeInitialRootMetadata(InitialExtraMetadataVer, tlfID, h)\n\trequire.NoError(t, err)\n\trequire.Equal(t, KeyGen(0), rmd.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(1), rmd.Revision())\n\trequire.Equal(t, InitialExtraMetadataVer, rmd.Version())\n\n\t// set some dummy numbers\n\tdiskUsage, refBytes, unrefBytes := uint64(12345), uint64(4321), uint64(1234)\n\trmd.SetDiskUsage(diskUsage)\n\trmd.SetRefBytes(refBytes)\n\trmd.SetUnrefBytes(unrefBytes)\n\t// Make sure the MD looks readable.\n\trmd.data.Dir.BlockPointer = BlockPointer{ID: kbfsblock.FakeID(1)}\n\n\t// key it once\n\tdone, _, err := config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, KeyGen(1), rmd.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(1), rmd.Revision())\n\trequire.Equal(t, InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 0, len(rmd.bareMd.(*BareRootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 1, len(rmd.bareMd.(*BareRootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\n\t// revoke bob's device\n\t_, bobUID, err := config.KBPKI().Resolve(context.Background(), \"bob\")\n\trequire.NoError(t, err)\n\tRevokeDeviceForLocalUserOrBust(t, config, bobUID, 0)\n\n\t// rekey it\n\tdone, _, err = config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(1), rmd.Revision())\n\trequire.Equal(t, InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 0, len(rmd.bareMd.(*BareRootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 1, len(rmd.bareMd.(*BareRootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\n\t// prove charlie\n\tconfig.KeybaseService().(*KeybaseDaemonLocal).addNewAssertionForTestOrBust(\n\t\t\"charlie\", \"charlie@twitter\")\n\n\t// rekey it\n\tdone, _, err = config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(1), rmd.Revision())\n\trequire.Equal(t, InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 0, len(rmd.bareMd.(*BareRootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 2, len(rmd.bareMd.(*BareRootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\n\t// add a device for charlie and rekey as charlie\n\t_, charlieUID, err := config.KBPKI().Resolve(context.Background(), \"charlie\")\n\tconfig2 := ConfigAsUser(config, \"charlie\")\n\tconfig2.SetKeyCache(&dummyNoKeyCache{})\n\tdefer config2.Shutdown(ctx)\n\tAddDeviceForLocalUserOrBust(t, config, charlieUID)\n\tAddDeviceForLocalUserOrBust(t, config2, charlieUID)\n\n\t// rekey it\n\tdone, _, err = config2.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(1), rmd.Revision())\n\trequire.Equal(t, InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 1, len(rmd.bareMd.(*BareRootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 2, len(rmd.bareMd.(*BareRootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\n\t// override the metadata version\n\tconfig.metadataVersion = SegregatedKeyBundlesVer\n\n\t// create an MDv3 successor\n\trmd2, err := rmd.MakeSuccessor(context.Background(),\n\t\tconfig.MetadataVersion(), config.Codec(), config.Crypto(),\n\t\tconfig.KeyManager(), fakeMdID(1), true)\n\trequire.NoError(t, err)\n\trequire.Equal(t, KeyGen(2), rmd2.LatestKeyGeneration())\n\trequire.Equal(t, MetadataRevision(2), rmd2.Revision())\n\trequire.Equal(t, SegregatedKeyBundlesVer, rmd2.Version())\n\textra, ok := rmd2.extra.(*ExtraMetadataV3)\n\trequire.True(t, ok)\n\trequire.True(t, extra.wkbNew)\n\trequire.True(t, extra.rkbNew)\n\n\t// compare numbers\n\trequire.Equal(t, diskUsage, rmd2.DiskUsage())\n\trequire.Equal(t, rmd.data.Dir, rmd2.data.Dir)\n\n\t// These should be 0 since they are reset for successors.\n\trequire.Equal(t, uint64(0), rmd2.RefBytes())\n\trequire.Equal(t, uint64(0), rmd2.UnrefBytes())\n\n\t// create and compare bare tlf handles (this verifies unresolved+resolved writer/reader sets are identical)\n\trmd.tlfHandle, rmd2.tlfHandle = nil, nil // avoid a panic due to the handle already existing\n\thandle, err := rmd.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\thandle2, err := rmd2.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\trequire.Equal(t, handle, handle2)\n\n\t// compare tlf crypt keys\n\tkeys, err := config.KeyManager().GetTLFCryptKeyOfAllGenerations(context.Background(), rmd)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 2, len(keys))\n\n\tkeys2, err := config.KeyManager().GetTLFCryptKeyOfAllGenerations(context.Background(), rmd2)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 2, len(keys2))\n\trequire.Equal(t, keys, keys2)\n\n\t// get each key generation for alice from each version of metadata\n\taliceKeys := getAllUsersKeysForTest(t, config, rmd, \"alice\")\n\taliceKeys2 := getAllUsersKeysForTest(t, config, rmd2, \"alice\")\n\n\t// compare alice's keys\n\trequire.Equal(t, 2, len(aliceKeys))\n\trequire.Equal(t, aliceKeys, aliceKeys2)\n\n\t// get each key generation for charlie from each version of metadata\n\tcharlieKeys := getAllUsersKeysForTest(t, config2, rmd, \"charlie\")\n\tcharlieKeys2 := getAllUsersKeysForTest(t, config2, rmd2, \"charlie\")\n\n\t// compare charlie's keys\n\trequire.Equal(t, 2, len(charlieKeys))\n\trequire.Equal(t, charlieKeys, charlieKeys2)\n\n\t// compare alice and charlie's keys\n\trequire.Equal(t, aliceKeys, charlieKeys)\n\n\t// Rekeying again shouldn't change wkbNew/rkbNew.\n\terr = rmd2.finalizeRekey(config.Crypto())\n\trequire.NoError(t, err)\n\textra, ok = rmd2.extra.(*ExtraMetadataV3)\n\trequire.True(t, ok)\n\trequire.True(t, extra.wkbNew)\n\trequire.True(t, extra.rkbNew)\n}", "title": "" }, { "docid": "78032453fbe3af10674b57893a1aceda", "score": "0.60893816", "text": "func KeyGen(suite abstract.Suite,\n\t\t\tkpath string) {\n\n\tvar kpubpath string = kpath\n\tvar kpripath string = kpath\n\tkpubpath = kpubpath + \".pub\"\n\tkpripath = kpripath + \".pri\"\n\n\tkeypair, err := crypto.SchnorrGenerateKeypair(suite)\n\tif err != nil {\n\t\tfmt.Println(\"Key generation failed\")\n\t\treturn\n\t}\n\tpubkey := crypto.SchnorrExtractPubkey(keypair)\n\n\tr := crypto.SchnorrSaveKeypair(kpripath, suite, keypair)\n\tif r != nil {\n\t\tfmt.Printf(\"Unable to write to %s\\n\", kpripath)\n\t\tfmt.Println(\"Error is\")\n\t\tfmt.Println(r.Error())\n\t\treturn\n\t}\n\tr = crypto.SchnorrSavePubkey(kpubpath, suite, pubkey)\n\tif r != nil {\n\t\tfmt.Printf(\"Unable to write to %s\\n\", kpubpath)\n\t\treturn\n\t}\n\tfmt.Println(\"Written private keypair to : \" + kpripath)\n\tfmt.Println(\"Written public key to : \" + kpubpath)\n}", "title": "" }, { "docid": "f23b587dc20f3d246eed02b590fe13ab", "score": "0.6077948", "text": "func amain() {\n\tseed, err := hex.DecodeString(\"42762c87e931ba2f0638ea39d0683526b8c368112cd491e380a6a514c4eb4740a48bfffc36cbc836d358dae23444ea4881ac00622b5785097df32642cecf71c0b5df7f2719ebc5d0decb9f49a0b0fb1166a495f5b2ae3786146ed0c5a5f3bd535d141438cde203c3cf8524122ff7f122ab09aac04c95ad8b641d5a2c2725cc2930e9e19445d29e05f30efbf5d7470e5e43da32a5b9730cf8dc76b98e9b3a64b88849e7287a52e59c8979596ba3567d52db0e9f50af9598a345ea2168b99b8ff1622714d63ab17b24f401d8ff21156778a2118911768ba2b1ffc3aca1858561ae69427812477e9aa9271dd82a890dfc16ceedbcae738e34786ba108ee87fc2cc8\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"根种子(%d): %s\\n\", len(seed), hex.EncodeToString(seed))\n\n\t// Create master private key from seed\n\tcomputerVoiceMasterKey, _ := bip32.NewMasterKey(seed)\n\tfmt.Println(\"根私钥: \", computerVoiceMasterKey.B58Serialize())\n\n\t// Map departments to keys\n\t// There is a very small chance a given child index is invalid\n\t// If so your real program should handle this by skipping the index\n\tdepartmentKeys := map[string]*bip32.Key{}\n\tdepartmentKeys[\"Sales\"], _ = computerVoiceMasterKey.NewChildKey(0)\n\tdepartmentKeys[\"Marketing\"], _ = computerVoiceMasterKey.NewChildKey(1)\n\tdepartmentKeys[\"Engineering\"], _ = computerVoiceMasterKey.NewChildKey(2)\n\tdepartmentKeys[\"Customer Support\"], _ = computerVoiceMasterKey.NewChildKey(3)\n\n\t// Create public keys for record keeping, auditors, payroll, etc\n\tdepartmentAuditKeys := map[string]*bip32.Key{}\n\tdepartmentAuditKeys[\"Sales\"] = departmentKeys[\"Sales\"].PublicKey()\n\tdepartmentAuditKeys[\"Marketing\"] = departmentKeys[\"Marketing\"].PublicKey()\n\tdepartmentAuditKeys[\"Engineering\"] = departmentKeys[\"Engineering\"].PublicKey()\n\tdepartmentAuditKeys[\"Customer Support\"] = departmentKeys[\"Customer Support\"].PublicKey()\n\n\t// Print public keys\n\tfor department, pubKey := range departmentAuditKeys {\n\t\tfmt.Println(department, pubKey)\n\t}\n}", "title": "" }, { "docid": "1e7579e82d6ded1bd9f31dd3661954cf", "score": "0.607369", "text": "func TestAll() {\n log.Println(\"Begin Crypto test\")\n \n bufflen := 128\n\n b := RandBytes(bufflen)\n if len(b) != bufflen {\n log.Fatal(\"nacl.RandBytes() failed length test\")\n }\n \n for n := 1 ; n < 16 ; n++ {\n key := GenSignKeypair()\n defer key.Free()\n testSign(n * 1024, key)\n }\n \n for n := 1 ; n < 16 ; n++ {\n key := GenSignKeypair()\n defer key.Free()\n testFucky(n * 1024, key)\n }\n \n for n := 1 ; n < 16 ; n++ {\n tokey := GenBoxKeypair()\n fromkey := GenBoxKeypair()\n defer tokey.Free()\n defer fromkey.Free()\n testBox(n * 1024, tokey, fromkey)\n }\n \n \n log.Println(\"Crypto Test Done\")\n}", "title": "" }, { "docid": "937ea53f10fbc6a7b53d6a5ee297248e", "score": "0.60691065", "text": "func verifyRootKeyOnHardware(t *testing.T, rootKeyID string) {\n\t// do not bother verifying if there is no yubikey available\n\tif yubikey.IsAccessible() {\n\t\t// //we're just getting keys here, so nil is fine\n\t\ts, err := yubikey.NewYubiStore(nil, _retriever)\n\t\trequire.NoError(t, err)\n\t\tprivKey, role, err := s.GetKey(rootKeyID)\n\t\trequire.NoError(t, err)\n\t\trequire.NotNil(t, privKey)\n\t\trequire.Equal(t, data.CanonicalRootRole, role)\n\t}\n}", "title": "" }, { "docid": "a201a2d3180d1a5da3a1b8d95e716995", "score": "0.60667366", "text": "func getSeed(algo cryptokeys.SigningAlgo) string {\n\tkb := keys.MockKeyBase()\n\tpass := \"throwing-this-key-away\"\n\tname := \"inmemorykey\"\n\t_, seed, _ := kb.CreateMnemonic(name, cryptokeys.English, pass, algo)\n\treturn seed\n}", "title": "" }, { "docid": "a62ab6c578068a7eedf0093d1bc23cef", "score": "0.60551953", "text": "func MustNewXXXTestingOnly(sk *big.Int) Key {\n\tkey, err := keyFromScalar(scalarFromBig(sk))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "3039e9484a2106aa97a7199e8ac49ecb", "score": "0.6008802", "text": "func TestHDWalletNewMasterKey(t *testing.T) {\n\tdata := []struct {\n\t\tseed []byte\n\t}{\n\t\t{[]byte{1, 2, 3}},\n\t\t{[]byte{}}, // empty array\n\t\t{[]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, // 32 bytes\n\t\t{[]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, // 64 bytes\n\t}\n\n\tfor _, item := range data {\n\t\tmasterKey, err := NewMasterKey(item.seed)\n\n\t\tassert.Equal(t, nil, err)\n\t\tassert.Equal(t, childNumberLen, len(masterKey.ChildNumber))\n\t\tassert.Equal(t, chainCodeLen, len(masterKey.ChainCode))\n\t\tassert.Equal(t, common.PublicKeySize, len(masterKey.KeySet.PaymentAddress.Pk))\n\t\tassert.Equal(t, common.TransmissionKeySize, len(masterKey.KeySet.PaymentAddress.Tk))\n\t\tassert.Equal(t, common.PrivateKeySize, len(masterKey.KeySet.PrivateKey))\n\t\tassert.Equal(t, common.ReceivingKeySize, len(masterKey.KeySet.ReadonlyKey.Rk))\n\t}\n}", "title": "" }, { "docid": "5f151d53a98eaeeb4efac20811a21842", "score": "0.6003516", "text": "func generateKeys() (rootPubKey string, retrievalPubKey string, retrievalPrivateKey *fcrcrypto.KeyPair, err error) {\n\trootKey, err := fcrcrypto.GenerateBlockchainKeyPair()\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error generating blockchain key: %s\", err.Error())\n\t}\n\tif rootKey == nil {\n\t\treturn \"\", \"\", nil, errors.New(\"error generating blockchain key\")\n\t}\n\n\trootPubKey, err = rootKey.EncodePublicKey()\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error encoding public key: %s\", err.Error())\n\t}\n\n\tretrievalPrivateKey, err = fcrcrypto.GenerateRetrievalV1KeyPair()\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error generating retrieval key: %s\", err.Error())\n\t}\n\tif retrievalPrivateKey == nil {\n\t\treturn \"\", \"\", nil, errors.New(\"error generating retrieval key\")\n\t}\n\n\tretrievalPubKey, err = retrievalPrivateKey.EncodePublicKey()\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error encoding retrieval pub key: %s\", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "5716f4ff81bba0e5e540964c7228a19f", "score": "0.5979596", "text": "func TestAddBaseKeysToRoot(t *testing.T) {\n\tfor _, role := range data.BaseRoles {\n\t\ted25519 := signed.NewEd25519()\n\t\trepo := initRepo(t, ed25519)\n\n\t\tkey, err := ed25519.Create(role, testGUN, data.ED25519Key)\n\t\trequire.NoError(t, err)\n\n\t\trequire.Len(t, repo.Root.Signed.Roles[role].KeyIDs, 1)\n\n\t\trequire.NoError(t, repo.AddBaseKeys(role, key))\n\n\t\t_, ok := repo.Root.Signed.Keys[key.ID()]\n\t\trequire.True(t, ok)\n\t\trequire.Len(t, repo.Root.Signed.Roles[role].KeyIDs, 2)\n\t\trequire.True(t, repo.Root.Dirty)\n\n\t\tswitch role {\n\t\tcase data.CanonicalSnapshotRole:\n\t\t\trequire.True(t, repo.Snapshot.Dirty)\n\t\tcase data.CanonicalTargetsRole:\n\t\t\trequire.True(t, repo.Targets[data.CanonicalTargetsRole].Dirty)\n\t\tcase data.CanonicalTimestampRole:\n\t\t\trequire.True(t, repo.Timestamp.Dirty)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "caf2de02a571ffb150606bf6bae37ee2", "score": "0.5974632", "text": "func TestInitInvalidKeys(t *testing.T) {\n\tunittest.SmallTest(t)\n\tt.Skip(\"See crbug.com/1010021\")\n\n\twd, cleanup := testutils.TempDir(t)\n\tdefer cleanup()\n\n\tauth, _, _ := makeMocks()\n\n\tgoldClient, err := makeGoldClient(auth, true /*=passFail*/, false /*=uploadOnly*/, wd)\n\tassert.NoError(t, err)\n\tconf := makeTestSharedConfig()\n\tconf.Key[\"blank\"] = \"\"\n\terr = goldClient.SetSharedConfig(conf, false)\n\tassert.Error(t, err)\n\tassert.Contains(t, err.Error(), `invalid configuration`)\n}", "title": "" }, { "docid": "6de8ebea743a8187738a79e144d90b2c", "score": "0.59728944", "text": "func generateRootCA(path string) {\n\tpriv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"can not generate Private Key: %v\", err)\n\t}\n\n\tnotBefore := time.Now()\n\t// Certificate validity set to one year.\n\tnotAfter := notBefore.AddDate(1, 0, 0)\n\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tSubject: pkix.Name{\n\t\t\tOrganization: []string{\"Tracy the Tracer\"},\n\t\t},\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tIsCA: true,\n\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t\tIPAddresses: []net.IP{net.ParseIP(\"127.0.0.1\")},\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, priv.Public(), priv)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to create certificate: %v\", err)\n\t}\n\n\tcertOut, err := os.Create(filepath.Join(path, \"cert.pem\"))\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to open cert.pem for writing: %v\", err)\n\t}\n\n\tpem.Encode(certOut, &pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes})\n\tcertOut.Close()\n\n\tkeyOut, err := os.OpenFile(filepath.Join(path, \"key.pem\"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to open key.pem for writing: %v\", err)\n\t\treturn\n\t}\n\n\tb, err := x509.MarshalECPrivateKey(priv)\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"failed to get private key bytes: %v\", err)\n\t\treturn\n\t}\n\n\tpem.Encode(keyOut, &pem.Block{Type: \"EC PRIVATE KEY\", Bytes: b})\n\tkeyOut.Close()\n}", "title": "" }, { "docid": "1638ef2e601c7726ff1580fd64e5bfd3", "score": "0.59694254", "text": "func setupFakeKey() (*rsa.PrivateKey, []byte, error) {\n\t// Generate a key we can use in the test data.\n\tpk, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// Encode the key and substitute into our example JSON.\n\tenc := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(pk),\n\t})\n\tenc, err = json.Marshal(string(enc))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn pk, bytes.Replace(jwtJSONKey, []byte(`\"super secret key\"`), enc, 1), nil\n}", "title": "" }, { "docid": "3a06a1aa2561f3e8e35060b08bd67af2", "score": "0.59673125", "text": "func TestKAT(t *testing.T) {\n\tvar tests TestVectors\n\t// Helper checks if e==true and reports an error if not.\n\tcheckExpr := func(e bool, vec *TestVector, t *testing.T, msg string) {\n\t\tt.Helper()\n\t\tif !e {\n\t\t\tt.Errorf(\"[Test ID=%d] \"+msg, vec.ID)\n\t\t}\n\t}\n\t// checkSharedSecret implements nominal case - imports asymmetric keys for\n\t// both parties, derives secret key and compares it to value in test vector.\n\t// Comparison must succeed in case status is \"Valid\" in any other case\n\t// it must fail.\n\tcheckSharedSecret := func(vec *TestVector, t *testing.T, status int) {\n\t\tvar prv1 PrivateKey\n\t\tvar pub1, pub2 PublicKey\n\t\tvar ss [SharedSecretSize]byte\n\n\t\tprBuf, err := hex.DecodeString(vec.Pr1)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcheckExpr(prv1.Import(prBuf[:]), vec, t, \"PrivateKey wrong\")\n\t\tpkBuf, err := hex.DecodeString(vec.Pk1)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcheckExpr(pub1.Import(pkBuf[:]), vec, t, \"PublicKey 1 wrong\")\n\t\tpkBuf, err = hex.DecodeString(vec.Pk2)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcheckExpr(pub2.Import(pkBuf[:]), vec, t, \"PublicKey 2 wrong\")\n\t\tcheckExpr(DeriveSecret(&ss, &pub2, &prv1, rng), vec, t, \"Error when deriving key\")\n\t\tssExp, err := hex.DecodeString(vec.Ss)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcheckExpr(bytes.Equal(ss[:], ssExp) == (status == Valid), vec, t, \"Unexpected value of shared secret\")\n\t}\n\t// checkPublicKey1 imports public and private key for one party A\n\t// and tries to generate public key for a private key. After that\n\t// it compares generated key to a key from test vector. Comparison\n\t// must fail.\n\tcheckPublicKey1 := func(vec *TestVector, t *testing.T) {\n\t\tvar prv PrivateKey\n\t\tvar pub PublicKey\n\t\tvar pubBytesGot [PublicKeySize]byte\n\n\t\tprBuf, err := hex.DecodeString(vec.Pr1)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tpubBytesExp, err := hex.DecodeString(vec.Pk1)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tcheckExpr(\n\t\t\tprv.Import(prBuf[:]),\n\t\t\tvec, t, \"PrivateKey wrong\")\n\n\t\t// Generate public key\n\t\tCheckNoErr(t, GeneratePrivateKey(&prv, rng), \"PrivateKey generation failed\")\n\t\tpub.Export(pubBytesGot[:])\n\n\t\t// pubBytesGot must be different than pubBytesExp\n\t\tcheckExpr(\n\t\t\t!bytes.Equal(pubBytesGot[:], pubBytesExp),\n\t\t\tvec, t, \"Public key generated is the same as public key from the test vector\")\n\t}\n\t// checkPublicKey2 the goal is to test key validation. Test tries to\n\t// import public key for B and ensure that import succeeds in case\n\t// status is \"Valid\" and fails otherwise.\n\tcheckPublicKey2 := func(vec *TestVector, t *testing.T, status int) {\n\t\tvar pub PublicKey\n\t\tpubBytesExp, err := hex.DecodeString(vec.Pk2)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t// Import validates an input, so it must fail\n\t\tpub.Import(pubBytesExp[:])\n\t\tcheckExpr(\n\t\t\tValidate(&pub, rng) == (status == Valid || status == ValidPublicKey2),\n\t\t\tvec, t, \"PublicKey has been validated correctly\")\n\t}\n\t// Load test data\n\tfile, err := os.Open(katFile)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\terr = json.NewDecoder(file).Decode(&tests)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\t// Loop over numIter test cases\n\t// The algorithm is relatively slow, so it tests a smaller number.\n\tN := len(tests.Vectors)\n\tvar buf [2]byte\n\tfor i := 0; i < numIter; i++ {\n\t\t_, _ = rand.Read(buf[:])\n\t\tidx := binary.LittleEndian.Uint16(buf[:]) % uint16(N)\n\t\ttest := tests.Vectors[idx]\n\t\tswitch test.Status {\n\t\tcase StatusValues[Valid]:\n\t\t\tcheckSharedSecret(&test, t, Valid)\n\t\t\tcheckPublicKey2(&test, t, Valid)\n\t\tcase StatusValues[InvalidSharedSecret]:\n\t\t\tcheckSharedSecret(&test, t, InvalidSharedSecret)\n\t\tcase StatusValues[InvalidPublicKey1]:\n\t\t\tcheckPublicKey1(&test, t)\n\t\tcase StatusValues[InvalidPublicKey2]:\n\t\t\tcheckPublicKey2(&test, t, InvalidPublicKey2)\n\t\tcase StatusValues[InvalidPublicKey2]:\n\t\t\tcheckPublicKey2(&test, t, InvalidPublicKey2)\n\t\tcase StatusValues[ValidPublicKey2]:\n\t\t\tcheckPublicKey2(&test, t, ValidPublicKey2)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77d0e249ecf1f466f18ea6e0d65538eb", "score": "0.5955487", "text": "func genKey() error {\n\n\t// Generate a new private key.\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a file for the private key information in PEM form.\n\tprivateFile, err := os.Create(\"private.pem\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating private file\")\n\t}\n\tdefer privateFile.Close()\n\n\t// Construct a PEM block for the private key.\n\tprivateBlock := pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(privateKey),\n\t}\n\n\t// Write the private key to the private key file.\n\tif err := pem.Encode(privateFile, &privateBlock); err != nil {\n\t\treturn errors.Wrap(err, \"encoding to private file\")\n\t}\n\n\t// Marshal the public key from the private key to PKIX.\n\tasn1Bytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"marshaling public key\")\n\t}\n\n\t// Create a file for the public key information in PEM form.\n\tpublicFile, err := os.Create(\"public.pem\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating public file\")\n\t}\n\tdefer publicFile.Close()\n\n\t// Construct a PEM block for the public key.\n\tpublicBlock := pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: asn1Bytes,\n\t}\n\n\t// Write the public key to the private key file.\n\tif err := pem.Encode(publicFile, &publicBlock); err != nil {\n\t\treturn errors.Wrap(err, \"encoding to public file\")\n\t}\n\n\tfmt.Println(\"private and public key files generated\")\n\treturn nil\n}", "title": "" }, { "docid": "ba7962e77aca5f115c5f41f0c2a88d06", "score": "0.5938291", "text": "func GenerateRootDeterministicKey(seed []byte) (*RootDeterministicKey, error) {\n\tif seed == nil {\n\t\tseed = make([]byte, 16)\n\t\tif _, err := rand.Read(seed); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\ts, err := NewRippleFamilySeed(seed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinc := big.NewInt(0).SetBytes(seed)\n\tinc.Lsh(inc, 32)\n\tf := func(priv *big.Int) bool { return priv.Cmp(order) >= 0 }\n\tkey := newKey(order, inc, f)\n\tkey.priv.X, key.priv.Y = key.priv.ScalarBaseMult(key.PrivateBytes())\n\treturn &RootDeterministicKey{\n\t\tbaseKey: *key,\n\t\tSeed: s,\n\t}, nil\n}", "title": "" }, { "docid": "5808236dbe5cbd5b7edc5222b47af4c7", "score": "0.59350926", "text": "func TestKeys(t *testing.T) {\n\ta, b, err := keys(password, salt, int(scryptIterations))\n\tif err != nil {\n\t\tt.Errorf(\"keys(%v, %v) => %q; want nil\", password, salt, err)\n\t}\n\tif !bytes.Equal(a, aesKey) {\n\t\tt.Errorf(\"keys(%v, %v) => aesKey = %v; want %v\", password, salt, a, aesKey)\n\t}\n\tif !bytes.Equal(b, hmacKey) {\n\t\tt.Errorf(\"keys(%v, %v) => hmacKey = %v; want %v\", password, salt, b, hmacKey)\n\t}\n}", "title": "" }, { "docid": "625c4d5ffc9c51ed0c38c526acbee259", "score": "0.5931489", "text": "func generateKey_none(securityPolicy []UA_SecurityPolicy, secret []UA_ByteString, seed []UA_ByteString, out []UA_ByteString) UA_StatusCode {\n\treturn 0\n}", "title": "" }, { "docid": "d50ffdadb51db81562d92ac6caf881d5", "score": "0.59264714", "text": "func assertNumKeys(t *testing.T, tempDir string, numRoot, numSigning int,\n\trootOnDisk bool) ([]string, []string) {\n\n\troot, signing := getUniqueKeys(t, tempDir)\n\trequire.Len(t, root, numRoot)\n\trequire.Len(t, signing, numSigning)\n\tfor _, rootKeyID := range root {\n\t\t_, err := os.Stat(filepath.Join(\n\t\t\ttempDir, notary.PrivDir, rootKeyID+\".key\"))\n\t\t// os.IsExist checks to see if the error is because a file already\n\t\t// exists, and hence it isn't actually the right function to use here\n\t\trequire.Equal(t, rootOnDisk, !os.IsNotExist(err))\n\n\t\t// this function is declared is in the build-tagged setup files\n\t\tverifyRootKeyOnHardware(t, rootKeyID)\n\t}\n\treturn root, signing\n}", "title": "" }, { "docid": "43f412d7171f47a0d9e821b4a09acbf1", "score": "0.5913479", "text": "func genTestRootCert() (cert_b, priv_b []byte) {\n\t//Generate a short lived cert\n\t//valid for 1 day to be used with server hosted\n\tca := &x509.Certificate{\n\t\tSerialNumber: big.NewInt(1653),\n\t\tSubject: pkix.Name{\n\t\t\tCountry: []string{\"Test\"},\n\t\t\tOrganization: []string{\"Test\"},\n\t\t\tOrganizationalUnit: []string{\"Test\"},\n\t\t},\n\t\tNotBefore: time.Now(),\n\t\tNotAfter: time.Now().AddDate(0, 0, 1),\n\t\tSubjectKeyId: []byte{1, 2, 3, 4, 5},\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tDNSNames: []string{\"localhost\"},\n\t\tIPAddresses: []net.IP{net.ParseIP(\"127.0.0.1\")},\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tKeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t}\n\n\tpriv, _ := rsa.GenerateKey(rand.Reader, 1024)\n\tpub := &priv.PublicKey\n\tca_b, err := x509.CreateCertificate(rand.Reader, ca, ca, pub, priv)\n\tif err != nil {\n\t\tlog.Println(\"create ca failed\", err)\n\t\treturn\n\t}\n\tpriv_b = x509.MarshalPKCS1PrivateKey(priv)\n\treturn ca_b, priv_b\n}", "title": "" }, { "docid": "b726a501dbf56e90835874c9f79c3f2b", "score": "0.5911711", "text": "func TestNymDeterministicGenerate(t *testing.T) {\n\tprg := amcl.NewRAND()\n\n\tprg.Clean()\n\tprg.Seed(1, []byte{SEED})\n\n\th := FP256BN.ECP_generator().Mul(FP256BN.Randomnum(FP256BN.NewBIGints(FP256BN.CURVE_Order), prg))\n\tsk, _ := GenerateKeys(prg, 0)\n\n\tprg.Clean()\n\tprg.Seed(1, []byte{SEED})\n\n\tskNym1, pkNym1 := GenerateNymKeys(prg, sk, h)\n\n\tprg.Clean()\n\tprg.Seed(1, []byte{SEED})\n\n\tskNym2, pkNym2 := GenerateNymKeys(prg, sk, h)\n\n\tassert.Check(t, bigEqual(skNym1, skNym2))\n\tassert.Check(t, pkEqual(pkNym1, pkNym2))\n}", "title": "" }, { "docid": "6676d76dc539510506b541c108705405", "score": "0.59111357", "text": "func genKey() error {\n\n\t// Generate a new private key.\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a file for the private key information in PEM form.\n\tprivateFile, err := os.Create(\"private.pem\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating private file: %w\", err)\n\t}\n\tdefer privateFile.Close()\n\n\t// Construct a PEM block for the private key.\n\tprivateBlock := pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(privateKey),\n\t}\n\n\t// Write the private key to the private key file.\n\tif err := pem.Encode(privateFile, &privateBlock); err != nil {\n\t\treturn fmt.Errorf(\"encoding to private file: %w\", err)\n\t}\n\n\t// =========================================================================\n\n\t// Marshal the public key from the private key to PKIX.\n\tasn1Bytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling public key: %w\", err)\n\t}\n\n\t// Create a file for the public key information in PEM form.\n\tpublicFile, err := os.Create(\"public.pem\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating public file: %w\", err)\n\t}\n\tdefer publicFile.Close()\n\n\t// Construct a PEM block for the public key.\n\tpublicBlock := pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: asn1Bytes,\n\t}\n\n\t// Write the public key to the private key file.\n\tif err := pem.Encode(publicFile, &publicBlock); err != nil {\n\t\treturn fmt.Errorf(\"encoding to public file: %w\", err)\n\t}\n\n\tfmt.Println(\"private and public key files generated\")\n\treturn nil\n}", "title": "" }, { "docid": "ab9998c5730433123718a9c0e5d40655", "score": "0.59094113", "text": "func TestOIDC_Path_OIDCKeyKey(t *testing.T) {\n\tc, _, _ := TestCoreUnsealed(t)\n\tctx := namespace.RootContext(nil)\n\tstorage := &logical.InmemStorage{}\n\n\t// Create a test key \"test-key\" -- should succeed\n\tresp, err := c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.CreateOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\n\t// Read \"test-key\" and validate\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.ReadOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\texpected := map[string]interface{}{\n\t\t\"rotation_period\": int64(86400),\n\t\t\"verification_ttl\": int64(86400),\n\t\t\"algorithm\": \"RS256\",\n\t\t\"allowed_client_ids\": []string{},\n\t}\n\tif diff := deep.Equal(expected, resp.Data); diff != nil {\n\t\tt.Fatal(diff)\n\t}\n\n\t// Update \"test-key\" -- should succeed\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.UpdateOperation,\n\t\tData: map[string]interface{}{\n\t\t\t\"rotation_period\": \"10m\",\n\t\t\t\"verification_ttl\": \"1h\",\n\t\t\t\"allowed_client_ids\": \"allowed-test-role\",\n\t\t},\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\n\t// Read \"test-key\" again and validate\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.ReadOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\texpected = map[string]interface{}{\n\t\t\"rotation_period\": int64(600),\n\t\t\"verification_ttl\": int64(3600),\n\t\t\"algorithm\": \"RS256\",\n\t\t\"allowed_client_ids\": []string{\"allowed-test-role\"},\n\t}\n\tif diff := deep.Equal(expected, resp.Data); diff != nil {\n\t\tt.Fatal(diff)\n\t}\n\n\t// Create a role that depends on test key\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/role/allowed-test-role\",\n\t\tOperation: logical.UpdateOperation,\n\t\tData: map[string]interface{}{\n\t\t\t\"key\": \"test-key\",\n\t\t},\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\tfmt.Printf(\"resp is:\\n%#v\", resp)\n\n\t// Delete test-key -- should fail because test-role depends on test-key\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.DeleteOperation,\n\t\tStorage: storage,\n\t})\n\texpectError(t, resp, err)\n\t// validate error message\n\texpectedStrings := map[string]interface{}{\n\t\t\"unable to delete key \\\"test-key\\\" because it is currently referenced by these roles: allowed-test-role\": true,\n\t}\n\texpectStrings(t, []string{resp.Data[\"error\"].(string)}, expectedStrings)\n\n\t// Delete allowed-test-role\n\tc.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/role/allowed-test-role\",\n\t\tOperation: logical.DeleteOperation,\n\t\tStorage: storage,\n\t})\n\n\t// Delete test-key -- should succeed this time because no roles depend on test-key\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.DeleteOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n}", "title": "" }, { "docid": "985f9733650e0cd8f2ad5d5777a2349c", "score": "0.59033334", "text": "func genKey(walletHandle string) error {\n\tgenResponse, err := kmdClient.GenerateKey(walletHandle)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error generating key - %v\", err)\n\t}\n\tfmt.Printf(\"Generated address: %s\\n\", genResponse.Address)\n\n\treturn nil\n}", "title": "" }, { "docid": "ad9b7b9ece25391f67ec6f0363230bb5", "score": "0.5901874", "text": "func generateKeys(keystore string, nodeList []node) error {\n\t// Create folders for this node\n\tfiles.CreateDirsIfNotExists([]string{\n\t\tconfiguration.GivernyConfigDir,\n\t\tfilepath.Join(configuration.GivernyConfigDir, givernyNetworksDir),\n\t\tkeystore,\n\t})\n\n\t// prompt password and write it to a file, if necessary\n\tif !_noSavePassKey && _passFile == \"\" && !_generatePassKey {\n\t\tpassphrase, _ := crypto.GetPassphrase(\"\", true)\n\t\t_passFile = filepath.Join(keystore, \"pwd.txt\")\n\t\tfiles.WriteToFile(_passFile, passphrase, files.OverwriteSilently)\n\t}\n\n\t// Generate Keys\n\tfor j, n := range nodeList {\n\n\t\tvar thisNodePassPhraseFile = filepath.Join(keystore, n.Moniker+\".txt\")\n\n\t\tif _generatePassKey {\n\t\t\tpassphrase := crypto.RandomPassphrase(8)\n\t\t\tfiles.WriteToFile(thisNodePassPhraseFile, passphrase, files.BackupExisting)\n\t\t\tcommon.DebugMessage(\"Written \" + thisNodePassPhraseFile)\n\t\t} else {\n\t\t\tif !_noSavePassKey {\n\t\t\t\tif _passFile != \"\" {\n\t\t\t\t\tfiles.CopyFileContents(_passFile, thisNodePassPhraseFile)\n\t\t\t\t\tcommon.DebugMessage(\"copied \" + _passFile + \" to \" + thisNodePassPhraseFile)\n\t\t\t\t} else {\n\t\t\t\t\tpassphrase, _ := crypto.GetPassphrase(\"\", true)\n\t\t\t\t\tfiles.WriteToFilePrivate(thisNodePassPhraseFile, passphrase)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthisNodePassPhraseFile = _passFile\n\t\t\t}\n\t\t}\n\n\t\tcommon.InfoMessage(fmt.Sprintf(\"Generating key for %s (validator? %v) %s\",\n\t\t\tn.Moniker,\n\t\t\tn.Validator,\n\t\t\tn.NetAddr))\n\n\t\t//TODO add a save passphrase option.\n\t\tkey, err := crypto.NewKeyfile(keystore, n.Moniker, thisNodePassPhraseFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnodeList[j].Address = key.Address.Hex()\n\t\tnodeList[j].PubKeyHex = hex.EncodeToString(ecrypto.FromECDSAPub(&key.PrivateKey.PublicKey))\n\n\t\tcommon.DebugMessage(\" \" + n.Address)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9468c468e3906e200b5b9c5a939b80e8", "score": "0.588848", "text": "func TestTAP12(t *testing.T) {\n\tdb := NewDB()\n\t// Need to use a signer type that supports random signatures.\n\tkey1, _ := keys.GenerateRsaKey()\n\tkey2, _ := keys.GenerateRsaKey()\n\tmsg := []byte(\"{}\")\n\tsig1, _ := key1.SignMessage(msg)\n\tsig1Duplicate, _ := key1.SignMessage(msg)\n\tassert.NotEqual(t, sig1, sig1Duplicate, \"Signatures should be random\")\n\tsig2, _ := key2.SignMessage(msg)\n\n\t// Idempotent: adding the same key with the same ID is okay.\n\tassert.Nil(t, db.AddKey(\"key1\", key1.PublicData()), \"initial add\")\n\tassert.Nil(t, db.AddKey(\"key1\", key1.PublicData()), \"re-add\")\n\t// Adding a different key is allowed, unless the key ID is the same.\n\tassert.Nil(t, db.AddKey(\"key2\", key2.PublicData()), \"different key with different ID\")\n\tassert.ErrorIs(t, db.AddKey(\"key1\", key2.PublicData()), ErrRepeatID{\"key1\"}, \"different key with same key ID\")\n\tassert.Nil(t, db.AddKey(\"key1-duplicate\", key1.PublicData()), \"same key with different ID should succeed\")\n\tassert.Nil(t, db.AddRole(\"diffkeys\", &data.Role{\n\t\tKeyIDs: []string{\"key1\", \"key2\"},\n\t\tThreshold: 2,\n\t}), \"adding role\")\n\tassert.Nil(t, db.AddRole(\"samekeys\", &data.Role{\n\t\tKeyIDs: []string{\"key1\", \"key1-alt\"},\n\t\tThreshold: 2,\n\t}), \"adding role\")\n\tassert.Nil(t, db.VerifySignatures(&data.Signed{\n\t\tSigned: msg,\n\t\tSignatures: []data.Signature{{KeyID: \"key1\", Signature: sig1}, {KeyID: \"key2\", Signature: sig2}},\n\t}, \"diffkeys\"), \"Signature with different keys: \")\n\tassert.ErrorIs(t, db.VerifySignatures(&data.Signed{\n\t\tSigned: msg,\n\t\tSignatures: []data.Signature{{KeyID: \"key1\", Signature: sig1}, {KeyID: \"key1-alt\", Signature: sig1Duplicate}},\n\t}, \"samekeys\"), ErrRoleThreshold{2, 1}, \"Threshold signing with repeat key\")\n}", "title": "" }, { "docid": "9cd200598044663553769ea0d01cd36a", "score": "0.5881902", "text": "func TestKeyRing(t *testing.T, newKeyStore NewKeyStore) {\n\tt.Run(\"TestKeyRingInitialState\", func(t *testing.T) {\n\t\ttestKeyRingInitialState(t, newKeyStore)\n\t})\n\tt.Run(\"TestKeyRingAddingKeys\", func(t *testing.T) {\n\t\ttestKeyRingAddingKeys(t, newKeyStore)\n\t})\n\tt.Run(\"TestKeyRingCurrent\", func(t *testing.T) {\n\t\ttestKeyRingCurrent(t, newKeyStore)\n\t})\n\tt.Run(\"TestKeyRingDestroyingKeys\", func(t *testing.T) {\n\t\ttestKeyRingDestroyingKeys(t, newKeyStore)\n\t})\n}", "title": "" }, { "docid": "bfe4d57434b4d8a8be9a0b8da8897b8a", "score": "0.58605194", "text": "func TestGenerateKeyContinuously(t *testing.T) {\n\tcontrollerBase := new(ControllerBase)\n\tcontrollerBase.sortedControllerInstancesLocal = []controllerInstanceLocal{}\n\n\t// Totally add 1000 controller manager instance one by one\n\tconst TotalInstanceCount = 1000\n\tfor i := 0; i < TotalInstanceCount; i++ {\n\t\tcontrollerKey, _ := controllerBase.generateKey()\n\t\tcontrollerInstanceLocal := new(controllerInstanceLocal)\n\t\tcontrollerInstanceLocal.controllerKey = controllerKey\n\t\tgenerateTestSortedControllerInstances(controllerBase, controllerInstanceLocal)\n\t\tverifyControllerKeyEvenlyDistributed(t, controllerBase)\n\t}\n}", "title": "" }, { "docid": "546f3d0358bb41e5b0e7783942741fe3", "score": "0.58590484", "text": "func GenerateKey(data int64, length int) string {\r\n\ttmp := strconv.FormatInt(data, 10)\r\n\tprefixCount := length - len(tmp)\r\n\ttarget := make([]byte, length)\r\n\tfor i := 0; i < length; i++ {\r\n\t\tif i < prefixCount {\r\n\t\t\ttarget[i] = '0'\r\n\t\t} else {\r\n\t\t\ttarget[i] = tmp[i-prefixCount]\r\n\t\t}\r\n\t}\r\n\treturn string(target)\r\n}", "title": "" }, { "docid": "d544893f6e49402ee3a47a185948c8d2", "score": "0.58560103", "text": "func GenerateKey(length int) string {\n\t// Change seed explicitly\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\thex := \"0123456789ABCDEF\"\n\tret := \"\"\n\n\t// Build random key\n\tfor i := 0; i < length; i++ {\n\t\tindex := rand.Intn(len(hex))\n\t\tret = ret + string(hex[index])\n\t}\n\tlog.Println(\"Create key: \", ret)\n\treturn ret\n}", "title": "" }, { "docid": "b8e6ae083622359e5d3fc794e4a268d6", "score": "0.5843134", "text": "func (c *PPSI) createKeys() {\n\n\t//b:=c.suite.Scalar().Zero()\n\tenckey := c.suite.Scalar().Pick(random.Stream)\n\n\t//for !c.suite.Scalar().Gcd(enckey,b).Equal(c.suite.Scalar().One()) {\n\t\tenckey = c.suite.Scalar().Pick(random.Stream)\n\t//}\n\n\tc.encKey = enckey\n\tc.decKey = c.suite.Scalar().Inv(enckey)\n\n}", "title": "" }, { "docid": "7643be961b8de66819717b3596f38793", "score": "0.58345044", "text": "func TestNewRandKeys(t *testing.T) {\n\tkeys, err := NewRandKeys()\n\tif err == io.EOF {\n\t\tt.Fatal(\"got EOF: NewRandKeys should never give an EOF error\")\n\t}\n\n\tassert.NoError(t, err)\n\tassert.NotNil(t, keys)\n}", "title": "" }, { "docid": "92481eb765b6bf905dce1af203129bd3", "score": "0.5823407", "text": "func ensureRsaKey(configStore types.GetterSetter) error {\n\t// If it exists, we're good\n\t_, err := configStore.Get([]byte(privateKeyKey))\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\t// Create a random key\n\tkey, err := rsaRandomKey()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"generating private key: %w\", err)\n\t}\n\n\tkeyDer, err := x509.MarshalPKCS8PrivateKey(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshalling private key: %w\", err)\n\t}\n\n\tif err := configStore.Set([]byte(privateKeyKey), keyDer); err != nil {\n\t\treturn fmt.Errorf(\"storing private key: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6b573d7748f5055178a52d78367e0f86", "score": "0.58185685", "text": "func (s *FourDemoSuite) doTestKeygenGeneralTss(newJoinParty bool) {\n\twg := sync.WaitGroup{}\n\tlock := &sync.Mutex{}\n\tkeygenResult := make(map[int]keygen.Response)\n\tfor i := 0; i < partyNum; i++ {\n\t\twg.Add(1)\n\t\tgo func(idx int) {\n\t\t\tdefer wg.Done()\n\t\t\tvar req keygen.Request\n\t\t\tlocalPubKeys := append([]string{}, testPubKeys...)\n\t\t\tif newJoinParty {\n\t\t\t\treq = keygen.NewRequest(localPubKeys, 10, \"0.14.0\")\n\t\t\t} else {\n\t\t\t\treq = keygen.NewRequest(localPubKeys, 10, \"0.13.0\")\n\t\t\t}\n\t\t\tres, err := s.servers[idx].Keygen(req)\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Error().Err(err).Msgf(\"fail to generate the key\")\n\t\t\t}\n\t\t\tlock.Lock()\n\t\t\tdefer lock.Unlock()\n\t\t\tkeygenResult[idx] = res\n\t\t}(i)\n\t}\n\twg.Wait()\n\n\tfmt.Printf(\"-------->pool address %v\\n\", keygenResult[0].PoolAddress)\n\treturn\n}", "title": "" }, { "docid": "59726837154451f9c6e6c5d143558126", "score": "0.5807014", "text": "func TestTransferKeys(t *testing.T) {\n\tif DIGITS != 4 {\n\t\tt.Errorf(\"Test wont work unless DIGITS is set to 4.\")\n\t\treturn\n\t}\n\tif TIMEOUT > 3*time.Second && REPUBLISH > 2*time.Second {\n\t\tt.Errorf(\"Test will take too long unless TIMEOUT is set to 3 and REPUBLISH is set to 2.\")\n\t\treturn\n\t}\n\tport = 58000\n\tid := ID{5, 8, 3, 15}\n\tnode0 := makeTapestry(id, \"\", t)\n\tid = ID{7, 0, 0xd, 1}\n\tnode1 := makeTapestry(id, node0.local.node.Address, t)\n\tid = ID{9, 0, 0xf, 5}\n\tnode2 := makeTapestry(id, node0.local.node.Address, t)\n\tid = ID{0xb, 0, 0xf, 0xa}\n\tnode3 := makeTapestry(id, node0.local.node.Address, t)\n\n\tnode0.Store(\"spoon\", []byte(\"cuchara\"))\n\tnode1.Store(\"table\", []byte(\"mesa\"))\n\tnode2.Store(\"chair\", []byte(\"silla\"))\n\tnode3.Store(\"fork\", []byte(\"tenedor\"))\n\n\t//The root for the node is\n\troot, _ := node3.local.findRoot(node3.local.node, Hash(\"fork\"))\n\tif !equal_ids(root.Id, node0.local.node.Id) {\n\t\tt.Errorf(\"The root for the fork is not node0, its %v\\n\", root.Id)\n\t}\n\t//Now we insert a new node\n\tid = ID{0x5, 2, 0xa, 0xa}\n\tnode4 := makeTapestry(id, node2.local.node.Address, t)\n\tnode4.Store(\"napkin\", []byte(\"servilleta\"))\n\n\t// //The root for spoon should have changed to node4\n\tfmt.Printf(\"hash for fork: %v\\n\", Hash(\"fork\"))\n\tfmt.Printf(\"hash for spoon: %v\\n\", Hash(\"spoon\"))\n\tfmt.Printf(\"hash for table: %v\\n\", Hash(\"table\"))\n\tfmt.Printf(\"hash for chair: %v\\n\", Hash(\"chair\"))\n\troot2, _ := node2.local.findRoot(node2.local.node, Hash(\"fork\"))\n\tif !equal_ids(root2.Id, node4.local.node.Id) {\n\t\tt.Errorf(\"The root for the fork is not node4, its %v\\n\", root2.Id)\n\t}\n\t//We now make sure that the replica is no longer in the previous node\n\treplica := node0.local.store.Get(\"fork\")\n\tif len(replica) != 0 {\n\t\tt.Errorf(\"This node still has a replica for another node %v\", replica)\n\t}\n\n\tnode1.Leave()\n\tnode2.Leave()\n\tnode3.Leave()\n\tnode4.Leave()\n\tnode0.Leave()\n}", "title": "" }, { "docid": "0385e6b9c455e6f1278be557629e4085", "score": "0.5798019", "text": "func (s *FourDemoSuite) doTestKeygenMoneroTss(newJoinParty bool) {\n\twg := sync.WaitGroup{}\n\tlock := &sync.Mutex{}\n\tkeygenResult := make(map[int]moneroKeygen.Response)\n\tfor i := 0; i < partyNum; i++ {\n\t\twg.Add(1)\n\t\tgo func(idx int) {\n\t\t\tdefer wg.Done()\n\t\t\tvar req moneroKeygen.Request\n\t\t\tlocalPubKeys := append([]string{}, testPubKeys...)\n\t\t\tif newJoinParty {\n\t\t\t\treq = moneroKeygen.NewRequest(localPubKeys, 10, \"0.14.0\", s.rpcAddress[idx])\n\t\t\t} else {\n\t\t\t\treq = moneroKeygen.NewRequest(localPubKeys, 10, \"0.13.0\", s.rpcAddress[idx])\n\t\t\t}\n\t\t\tres, err := s.moneroServers[idx].Keygen(req)\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Error().Err(err).Msgf(\"fail to generate the key\")\n\t\t\t}\n\t\t\tlock.Lock()\n\t\t\tdefer lock.Unlock()\n\t\t\tkeygenResult[idx] = res\n\t\t}(i)\n\t}\n\twg.Wait()\n\n\tfmt.Printf(\"-------->pool address %v\\n\", keygenResult[0].PoolAddress)\n\treturn\n}", "title": "" }, { "docid": "aca22b8bc1a6f61410989ee5a1a27daf", "score": "0.5795707", "text": "func TestNewPubkey(t *testing.T) {\n\tw, tearDownFunc := setupWallet(t)\n\tdefer tearDownFunc()\n\n\trpcc := &rpcmock.Client{}\n\trpcc = mockImportAddress(rpcc, nil)\n\tw.SetRPCClient(rpcc)\n\n\tpub, err := w.NewPubkey()\n\n\tassert.Nil(t, err)\n\tassert.NotNil(t, pub)\n}", "title": "" }, { "docid": "3763501c04de66f7589fe4d2f52c8f65", "score": "0.5791329", "text": "func handleKeyRegistryTest(t *testing.T, reg KeyRegistry) {\n\ta := assertions.New(t)\n\n\tctx := test.Context()\n\n\tjoinEUI := types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\tdevEUI := types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\tpb := &ttnpb.SessionKeys{\n\t\tSessionKeyId: []byte{0x11, 0x22, 0x33, 0x44},\n\t\tFNwkSIntKey: test.DefaultFNwkSIntKeyEnvelope,\n\t\tSNwkSIntKey: test.DefaultSNwkSIntKeyEnvelope,\n\t\tNwkSEncKey: test.DefaultNwkSEncKeyEnvelope,\n\t\tAppSKey: test.DefaultAppSKeyEnvelope,\n\t}\n\n\tret, err := reg.GetByID(ctx, joinEUI, devEUI, pb.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\tt.Fatalf(\"Error received: %v\", err)\n\t}\n\ta.So(ret, should.BeNil)\n\n\tret, err = reg.SetByID(ctx, joinEUI, devEUI, pb.SessionKeyId,\n\t\t[]string{\n\t\t\t\"app_s_key\",\n\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\"nwk_s_enc_key\",\n\t\t\t\"s_nwk_s_int_key\",\n\t\t},\n\t\tfunc(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) {\n\t\t\tif !a.So(stored, should.BeNil) {\n\t\t\t\tt.Fatal(\"Registry is not empty\")\n\t\t\t}\n\t\t\treturn ttnpb.Clone(pb), []string{\n\t\t\t\t\"app_s_key\",\n\t\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\t\"nwk_s_enc_key\",\n\t\t\t\t\"s_nwk_s_int_key\",\n\t\t\t\t\"session_key_id\",\n\t\t\t}, nil\n\t\t},\n\t)\n\tif !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) {\n\t\tt.Fatalf(\"Failed to create keys: %s\", err)\n\t}\n\ta.So(ret, should.Resemble, pb)\n\n\tret, err = reg.GetByID(ctx, joinEUI, devEUI, pb.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\ta.So(err, should.BeNil)\n\ta.So(ret, should.HaveEmptyDiff, pb)\n\n\tpbOther := ttnpb.Clone(pb)\n\tjoinEUIOther := types.EUI64{0x43, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\tdevEUIOther := types.EUI64{0x43, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\n\tret, err = reg.GetByID(ctx, joinEUIOther, devEUIOther, pbOther.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\tt.Fatalf(\"Error received: %v\", err)\n\t}\n\ta.So(ret, should.BeNil)\n\n\tret, err = reg.SetByID(ctx, joinEUIOther, devEUIOther, pbOther.SessionKeyId,\n\t\t[]string{\n\t\t\t\"app_s_key\",\n\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\"nwk_s_enc_key\",\n\t\t\t\"s_nwk_s_int_key\",\n\t\t},\n\t\tfunc(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) {\n\t\t\tif !a.So(stored, should.BeNil) {\n\t\t\t\tt.Fatal(\"Registry is not empty\")\n\t\t\t}\n\t\t\treturn ttnpb.Clone(pbOther), []string{\n\t\t\t\t\"app_s_key\",\n\t\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\t\"nwk_s_enc_key\",\n\t\t\t\t\"s_nwk_s_int_key\",\n\t\t\t\t\"session_key_id\",\n\t\t\t}, nil\n\t\t},\n\t)\n\tif !a.So(err, should.BeNil) || !a.So(ret, should.NotBeNil) {\n\t\tt.Fatalf(\"Failed to create keys: %s\", err)\n\t}\n\ta.So(ret, should.Resemble, pbOther)\n\n\tret, err = reg.GetByID(ctx, joinEUIOther, devEUIOther, pbOther.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\ta.So(err, should.BeNil)\n\ta.So(ret, should.HaveEmptyDiff, pbOther)\n\n\terr = DeleteKeys(ctx, reg, joinEUI, devEUI, pb.SessionKeyId)\n\tif !a.So(err, should.BeNil) {\n\t\tt.FailNow()\n\t}\n\n\tret, err = reg.GetByID(ctx, joinEUI, devEUI, pb.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\tt.Fatalf(\"Error received: %v\", err)\n\t}\n\ta.So(ret, should.BeNil)\n\n\terr = DeleteKeys(ctx, reg, joinEUIOther, devEUIOther, pbOther.SessionKeyId)\n\tif !a.So(err, should.BeNil) {\n\t\tt.FailNow()\n\t}\n\n\tret, err = reg.GetByID(ctx, joinEUIOther, devEUIOther, pbOther.SessionKeyId, ttnpb.SessionKeysFieldPathsTopLevel)\n\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\tt.Fatalf(\"Error received: %v\", err)\n\t}\n\ta.So(ret, should.BeNil)\n\n\t// Check number of retained session keys. Only the last 10 should be kept.\n\tfor i := byte(0); i < 20; i++ {\n\t\tsid := bytes.Repeat([]byte{i}, 4)\n\t\t_, err := reg.SetByID(ctx, joinEUI, devEUI, sid, []string{\n\t\t\t\"app_s_key\",\n\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\"nwk_s_enc_key\",\n\t\t\t\"s_nwk_s_int_key\",\n\t\t},\n\t\t\tfunc(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) {\n\t\t\t\tif !a.So(stored, should.BeNil) {\n\t\t\t\t\tt.Fatal(\"Registry is not empty\")\n\t\t\t\t}\n\t\t\t\treturn &ttnpb.SessionKeys{\n\t\t\t\t\t\tSessionKeyId: sid,\n\t\t\t\t\t\tFNwkSIntKey: test.DefaultFNwkSIntKeyEnvelope,\n\t\t\t\t\t\tSNwkSIntKey: test.DefaultSNwkSIntKeyEnvelope,\n\t\t\t\t\t\tNwkSEncKey: test.DefaultNwkSEncKeyEnvelope,\n\t\t\t\t\t\tAppSKey: test.DefaultAppSKeyEnvelope,\n\t\t\t\t\t}, []string{\n\t\t\t\t\t\t\"app_s_key\",\n\t\t\t\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\t\t\t\"nwk_s_enc_key\",\n\t\t\t\t\t\t\"s_nwk_s_int_key\",\n\t\t\t\t\t\t\"session_key_id\",\n\t\t\t\t\t}, nil\n\t\t\t})\n\t\tif !a.So(err, should.BeNil) {\n\t\t\tt.Fatalf(\"Error received: %v\", err)\n\t\t}\n\t}\n\tfor i := byte(0); i < 20; i++ {\n\t\t_, err := reg.GetByID(ctx, joinEUI, devEUI, bytes.Repeat([]byte{i}, 4), ttnpb.SessionKeysFieldPathsTopLevel)\n\t\tif i < 10 {\n\t\t\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\t\t\tt.Fatalf(\"Error received: %v\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tif !a.So(err, should.BeNil) {\n\t\t\t\tt.FailNow()\n\t\t\t}\n\t\t}\n\t}\n\n\t// Delete all the session keys of the given device.\n\terr = reg.Delete(ctx, joinEUI, devEUI)\n\tif !a.So(err, should.BeNil) {\n\t\tt.Fatalf(\"Error received: %v\", err)\n\t}\n\tfor i := byte(0); i < 20; i++ {\n\t\t_, err := reg.GetByID(ctx, joinEUI, devEUI, bytes.Repeat([]byte{i}, 4), ttnpb.SessionKeysFieldPathsTopLevel)\n\t\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\t\tt.Fatalf(\"Error received: %v\", err)\n\t\t}\n\t}\n\n\t// Batch Operations\n\tnoOfKeysPerDevice := uint8(10)\n\tdevEUI1 := types.EUI64{0x44, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\tdevEUI2 := types.EUI64{0x45, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\tdevEUI3 := types.EUI64{0x46, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}\n\n\t// Create keys for each device\n\tfor _, devEUI := range []types.EUI64{devEUI1, devEUI2, devEUI3} {\n\t\tfor i := byte(0); i < noOfKeysPerDevice; i++ {\n\t\t\tsid := bytes.Repeat([]byte{i}, 4)\n\t\t\t_, err := reg.SetByID(ctx, joinEUI, devEUI, sid, []string{\n\t\t\t\t\"app_s_key\",\n\t\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\t\"nwk_s_enc_key\",\n\t\t\t\t\"s_nwk_s_int_key\",\n\t\t\t},\n\t\t\t\tfunc(stored *ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error) {\n\t\t\t\t\tif !a.So(stored, should.BeNil) {\n\t\t\t\t\t\tt.Fatal(\"Registry is not empty\")\n\t\t\t\t\t}\n\t\t\t\t\treturn &ttnpb.SessionKeys{\n\t\t\t\t\t\t\tSessionKeyId: sid,\n\t\t\t\t\t\t\tFNwkSIntKey: test.DefaultFNwkSIntKeyEnvelope,\n\t\t\t\t\t\t\tSNwkSIntKey: test.DefaultSNwkSIntKeyEnvelope,\n\t\t\t\t\t\t\tNwkSEncKey: test.DefaultNwkSEncKeyEnvelope,\n\t\t\t\t\t\t\tAppSKey: test.DefaultAppSKeyEnvelope,\n\t\t\t\t\t\t}, []string{\n\t\t\t\t\t\t\t\"app_s_key\",\n\t\t\t\t\t\t\t\"f_nwk_s_int_key\",\n\t\t\t\t\t\t\t\"nwk_s_enc_key\",\n\t\t\t\t\t\t\t\"s_nwk_s_int_key\",\n\t\t\t\t\t\t\t\"session_key_id\",\n\t\t\t\t\t\t}, nil\n\t\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Error creating session key with ID %v for devEUI %v: %v\", sid, devEUI, err)\n\t\t\t}\n\t\t\t// Read the keys back\n\t\t\t_, err = reg.GetByID(ctx, joinEUI, devEUI, sid, ttnpb.SessionKeysFieldPathsTopLevel)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Error reading session key with ID %v for devEUI %v: %v\", sid, devEUI, err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Batch Delete\n\terr = reg.BatchDelete(ctx, []*ttnpb.EndDeviceIdentifiers{\n\t\t{\n\t\t\tJoinEui: joinEUI.Bytes(),\n\t\t\tDevEui: devEUI1.Bytes(),\n\t\t},\n\t\t{\n\t\t\tJoinEui: joinEUI.Bytes(),\n\t\t\tDevEui: devEUI2.Bytes(),\n\t\t},\n\t\t{\n\t\t\tJoinEui: joinEUI.Bytes(),\n\t\t\tDevEui: devEUI3.Bytes(),\n\t\t},\n\t})\n\tif !a.So(err, should.BeNil) {\n\t\tt.Fatalf(\"Could not BatchDelete keys: %v\", err)\n\t}\n\n\t// Check if all keys are deleted\n\tfor _, devEUI := range []types.EUI64{devEUI1, devEUI2, devEUI3} {\n\t\tfor i := byte(0); i < noOfKeysPerDevice; i++ {\n\t\t\tsid := bytes.Repeat([]byte{i}, 4)\n\t\t\t_, err := reg.GetByID(ctx, joinEUI, devEUI, sid, ttnpb.SessionKeysFieldPathsTopLevel)\n\t\t\tif !a.So(err, should.NotBeNil) || !a.So(errors.IsNotFound(err), should.BeTrue) {\n\t\t\t\tt.Fatalf(\"Error received: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cffe6211130e7760786583fced5eb0a2", "score": "0.57816035", "text": "func requireGetKeySuccess(t *testing.T, dbStore trustmanager.KeyStore, expectedRole string, expectedKey data.PrivateKey) {\n\tretrKey, role, err := dbStore.GetKey(expectedKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, expectedRole, role)\n\trequire.Equal(t, retrKey.Private(), expectedKey.Private())\n\trequire.Equal(t, retrKey.Algorithm(), expectedKey.Algorithm())\n\trequire.Equal(t, retrKey.Public(), expectedKey.Public())\n\trequire.Equal(t, retrKey.SignatureAlgorithm(), expectedKey.SignatureAlgorithm())\n}", "title": "" }, { "docid": "709314b73a0465cc8ec80f5acfe3f539", "score": "0.57697964", "text": "func TestKEK(t *testing.T) {\n\tprv1, err := GenerateKey(rand.Reader)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tprv2, err := GenerateKey(rand.Reader)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tt.FailNow()\n\t}\n\n\tpub1 := &prv1.PublicKey\n\tpub2 := &prv2.PublicKey\n\n\tkek1 := prv1.InitializeKEK(rand.Reader, pub2, KEKAES256CBCHMACSHA512, nil, sha512.New())\n\tif kek1 == nil {\n\t\tfmt.Println(\"dhkam: failed to initialise KEK\")\n\t\tt.FailNow()\n\t}\n\tkek2 := prv2.InitializeKEK(rand.Reader, pub1, KEKAES256CBCHMACSHA512, nil, sha512.New())\n\tif kek2 == nil {\n\t\tfmt.Println(\"dhkam: failed to initialise KEK\")\n\t\tt.FailNow()\n\t}\n\n\tkeyList1 := make([][]byte, numTestCEK)\n\tkeyList2 := make([][]byte, numTestCEK)\n\tfor i := 0; i < numTestCEK; i++ {\n\t\tkeyList1[i], err = prv1.CEK(kek1)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\tt.FailNow()\n\t\t}\n\t\tkeyList2[i], err = prv2.CEK(kek2)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\tt.FailNow()\n\t\t}\n\t}\n\n\tfor i := 0; i < numTestCEK; i++ {\n\t\tfor j := 0; j < numTestCEK; j++ {\n\t\t\tif i == j {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif bytes.Equal(keyList1[i], keyList1[j]) {\n\t\t\t\tfmt.Println(\"dhkam: CEK isn't unique\")\n\t\t\t\tt.FailNow()\n\t\t\t}\n\t\t\tif bytes.Equal(keyList2[i], keyList2[j]) {\n\t\t\t\tfmt.Println(\"dhkam: CEK isn't unique\")\n\t\t\t\tt.FailNow()\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i := 0; i < numTestCEK; i++ {\n\t\tif !bytes.Equal(keyList1[i], keyList2[i]) {\n\t\t\tfmt.Println(\"dhkam: CEK's don't match\")\n\t\t\tt.FailNow()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c60b9c9c7720b3c8c2282ba1541c72a8", "score": "0.57688147", "text": "func generateKid(key *rsa.PublicKey) string {\n\th := sha1.New()\n\th.Write(key.N.Bytes())\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "bf8f0d3beeef9e9ea54f4e9f44209582", "score": "0.57661474", "text": "func newKeyID(tb testing.TB) string {\n\tchoices := make([]byte, 32)\n\t_, err := rand.Read(choices)\n\trequire.NoError(tb, err)\n\treturn keyIDFromBytes(choices)\n}", "title": "" }, { "docid": "7840042c60ea8020a6dd57762e1c1b18", "score": "0.5744303", "text": "func TestNewRandomKeyfile(t *testing.T) {\n\n\t// datei löschen\n\terr := os.Remove(writeTestFile)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// datei schreiben\n\tNewRandomKeyfile(writeTestFile)\n}", "title": "" }, { "docid": "825933d18354a823297986115bbb6594", "score": "0.5743196", "text": "func generateRootCertificate(privateKey *ecdsa.PrivateKey, serialNumber *big.Int) ([]byte, error) {\n\t// prepare the certificate. set the validity time to the predefined range\n\tnow := time.Now()\n\ttemplate := &x509.Certificate{\n\t\tBasicConstraintsValid: true,\n\t\tIsCA: true,\n\t\tKeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign,\n\t\tMaxPathLenZero: true, // there are no intermediate certificates\n\t\tNotBefore: now.Add(beforeInterval),\n\t\tNotAfter: now.Add(defaultRootCAExpiration),\n\t\tSerialNumber: serialNumber,\n\t\tSignatureAlgorithm: certificateSignatureAlgorithm,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: rootCAName,\n\t\t},\n\t}\n\n\t// a root certificate has no parent, so pass in the template twice\n\treturn x509.CreateCertificate(rand.Reader, template, template,\n\t\tprivateKey.Public(), privateKey)\n}", "title": "" }, { "docid": "51731eec44a19b86aff07c69a0bd3df2", "score": "0.5737906", "text": "func (tester *SignerFactoryTester) TestGenerate(t *testing.T) {\n\tfor _, test := range []struct {\n\t\tName string\n\t\tKeySpec *keyspb.Specification\n\t\tWantErr bool\n\t}{\n\t\t{\n\t\t\tName: \"RSA\",\n\t\t\tKeySpec: &keyspb.Specification{\n\t\t\t\tParams: &keyspb.Specification_RsaParams{\n\t\t\t\t\tRsaParams: &keyspb.Specification_RSA{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"ECDSA\",\n\t\t\tKeySpec: &keyspb.Specification{\n\t\t\t\tParams: &keyspb.Specification_EcdsaParams{\n\t\t\t\t\tEcdsaParams: &keyspb.Specification_ECDSA{},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"RSA with insufficient key size\",\n\t\t\tKeySpec: &keyspb.Specification{\n\t\t\t\tParams: &keyspb.Specification_RsaParams{\n\t\t\t\t\tRsaParams: &keyspb.Specification_RSA{\n\t\t\t\t\t\tBits: 1024,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tWantErr: true,\n\t\t},\n\t\t{\n\t\t\tName: \"Nil KeySpec\",\n\t\t\tWantErr: true,\n\t\t},\n\t} {\n\t\tctx := context.Background()\n\t\tsf := tester.NewSignerFactory()\n\n\t\tkey, err := sf.Generate(ctx, test.KeySpec)\n\t\tif gotErr := err != nil; gotErr != test.WantErr {\n\t\t\tt.Errorf(\"%v: Generate() = (_, %v), want err? %v\", test.Name, err, test.WantErr)\n\t\t\tcontinue\n\t\t} else if gotErr {\n\t\t\tcontinue\n\t\t}\n\n\t\tsigner, err := sf.NewSigner(ctx, key)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%v: NewSigner() = (_, %v), want (_, nil)\", test.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tpublicKey := signer.Public()\n\t\tswitch test.KeySpec.Params.(type) {\n\t\tcase *keyspb.Specification_RsaParams:\n\t\t\tif _, ok := publicKey.(*rsa.PublicKey); !ok {\n\t\t\t\tt.Errorf(\"%v: signer.Public() = %T, want *rsa.PublicKey\", test.Name, publicKey)\n\t\t\t}\n\t\tcase *keyspb.Specification_EcdsaParams:\n\t\t\tif _, ok := publicKey.(*ecdsa.PublicKey); !ok {\n\t\t\t\tt.Errorf(\"%v: signer.Public() = %T, want *ecdsa.PublicKey\", test.Name, publicKey)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "836be3410e969ebb3e54fb8514e14374", "score": "0.57370114", "text": "func genPrivKey(t *testing.T) string {\n\tpriv, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Trying to throw off simple-minded scanners looking for key files\n\tx := \"PRIVATE\"\n\tblock := &pem.Block{\n\t\tType: \"RSA \" + x + \" KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(priv),\n\t}\n\n\tdir := t.TempDir()\n\tkf := filepath.Join(dir, \"kf\")\n\tf, err := os.OpenFile(kf, os.O_RDWR|os.O_CREATE, 0600)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := pem.Encode(f, block); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn kf\n}", "title": "" }, { "docid": "d70e9304ad34f75dd4b424f58117d3ce", "score": "0.57302177", "text": "func (tok *Token) Generate(keyName string, keyType token.KeyType, bits uint) (token.Key, error) {\n\ttok.mutex.Lock()\n\tdefer tok.mutex.Unlock()\n\tkeyConf, err := tok.config.GetKey(keyName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif keyConf.Label == \"\" {\n\t\treturn nil, errors.New(\"Key attribute 'label' must be defined in order to create an object\")\n\t}\n\tkeyID := makeKeyID()\n\tif keyID == nil {\n\t\treturn nil, errors.New(\"failed to make key ID\")\n\t}\n\tvar pubTypeAttrs []*pkcs11.Attribute\n\tvar mech *pkcs11.Mechanism\n\tswitch keyType {\n\tcase token.KeyTypeRsa:\n\t\tpubTypeAttrs, mech, err = rsaGenerateAttrs(bits)\n\tcase token.KeyTypeEcdsa:\n\t\tpubTypeAttrs, mech, err = ecdsaGenerateAttrs(bits)\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported key type\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcommonAttrs := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, keyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, keyConf.Label),\n\t}\n\tpubAttrs := attrConcat(commonAttrs, newPublicKeyAttrs, pubTypeAttrs)\n\tprivAttrs := attrConcat(commonAttrs, newPrivateKeyAttrs)\n\tif _, _, err := tok.ctx.GenerateKeyPair(tok.sh, []*pkcs11.Mechanism{mech}, pubAttrs, privAttrs); err != nil {\n\t\tif err2, ok := err.(pkcs11.Error); ok && err2 == pkcs11.CKR_MECHANISM_INVALID && mech.Mechanism == pkcs11.CKM_RSA_X9_31_KEY_PAIR_GEN {\n\t\t\tmech.Mechanism = pkcs11.CKM_RSA_PKCS_KEY_PAIR_GEN\n\t\t\tif _, _, err := tok.ctx.GenerateKeyPair(tok.sh, []*pkcs11.Mechanism{mech}, pubAttrs, privAttrs); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tkeyConf.ID = hex.EncodeToString(keyID)\n\treturn tok.getKey(keyConf, keyName)\n}", "title": "" }, { "docid": "b58a45831a6468373d3b12738dc647df", "score": "0.5721238", "text": "func TestGenerateRSAkeyPair(t *testing.T) {\n\tconn, err := net.DialTimeout(\"tcp\", TEST_THALES_HSM_HOST, time.Duration(HSM_CONNECTION_TIMEOUT)*time.Second)\n\tif err != nil {\n\t\tt.Fatalf(\"[THALES]: Failed to HSM connect: %s\\n\", err)\n\t}\n\tdefer conn.Close()\n\n\t//verifySignatureRsaBitsTest(t, conn,512)\n\tverifySignatureRsaBitsTest(t, conn,1024)\n\tverifySignatureRsaBitsTest(t, conn,2048)\n\t//verifySignatureRsaBitsTest(t, conn,4096)\n}", "title": "" }, { "docid": "05dc385bb813a6ff68d10078db191341", "score": "0.56952655", "text": "func (k DeposedKey) generation() {}", "title": "" }, { "docid": "1bbd20dfa1cf8adf7436c233ac0f013c", "score": "0.56940573", "text": "func testPre(t *testing.T) {\n\tt.Log(\"init\")\n\t{\n\t\tvar id ID\n\t\terr := id.SetLittleEndian([]byte{6, 5, 4, 3, 2, 1})\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tt.Log(\"id :\", id.GetHexString())\n\t\tvar id2 ID\n\t\terr = id2.SetHexString(id.GetHexString())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif !id.IsEqual(&id2) {\n\t\t\tt.Errorf(\"not same id\\n%s\\n%s\", id.GetHexString(), id2.GetHexString())\n\t\t}\n\t\terr = id2.SetDecString(id.GetDecString())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif !id.IsEqual(&id2) {\n\t\t\tt.Errorf(\"not same id\\n%s\\n%s\", id.GetDecString(), id2.GetDecString())\n\t\t}\n\t}\n\t{\n\t\tvar sec SecretKey\n\t\terr := sec.SetLittleEndian([]byte{1, 2, 3, 4, 5, 6})\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tt.Log(\"sec=\", sec.GetHexString())\n\t}\n\n\tt.Log(\"create secret key\")\n\tm := \"this is a bls sample for go\"\n\tvar sec SecretKey\n\tsec.SetByCSPRNG()\n\tt.Log(\"sec:\", sec.GetHexString())\n\tt.Log(\"create public key\")\n\tpub := sec.GetPublicKey()\n\tt.Log(\"pub:\", pub.GetHexString())\n\tsign := sec.Sign(m)\n\tt.Log(\"sign:\", sign.GetHexString())\n\tif !sign.Verify(pub, m) {\n\t\tt.Error(\"Signature does not verify\")\n\t}\n\n\t// How to make array of SecretKey\n\t{\n\t\tsec := make([]SecretKey, 3)\n\t\tfor i := 0; i < len(sec); i++ {\n\t\t\tsec[i].SetByCSPRNG()\n\t\t\tt.Log(\"sec=\", sec[i].GetHexString())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "41ff240e49abc926abdd4904213be962", "score": "0.56904745", "text": "func generateKey() []byte {\n\tkey := make([]byte, 32)\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not generate key. Aborting: %v\", err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "78fa5615edb27ef5cee842e76143bbec", "score": "0.56831557", "text": "func TestGeneratePrivateKey(t *testing.T) {\n\tpriv, err := GeneratePrivateKey()\n\tif err != nil {\n\t\tt.Errorf(\"failed to generate private key: %s\", err)\n\t\treturn\n\t}\n\tpub := priv.PubKey()\n\tif !isOnCurve(&pub.x, &pub.y) {\n\t\tt.Error(\"public key is not on the curve\")\n\t}\n}", "title": "" }, { "docid": "b4440685f5b2e5c3b0a787c12447cf95", "score": "0.5680967", "text": "func TestOIDC_PublicKeys(t *testing.T) {\n\tc, _, _ := TestCoreUnsealed(t)\n\tctx := namespace.RootContext(nil)\n\tstorage := &logical.InmemStorage{}\n\n\t// Create a test key \"test-key\"\n\tc.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.CreateOperation,\n\t\tStorage: storage,\n\t})\n\n\t// .well-known/keys should contain 1 public key\n\tresp, err := c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/.well-known/keys\",\n\t\tOperation: logical.ReadOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\t// parse response\n\tresponseJWKS := &jose.JSONWebKeySet{}\n\tjson.Unmarshal(resp.Data[\"http_raw_body\"].([]byte), responseJWKS)\n\tif len(responseJWKS.Keys) != 1 {\n\t\tt.Fatalf(\"expected 1 public key but instead got %d\", len(responseJWKS.Keys))\n\t}\n\n\t// rotate test-key a few times, each rotate should increase the length of public keys returned\n\t// by the .well-known endpoint\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key/rotate\",\n\t\tOperation: logical.UpdateOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\tc.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key/rotate\",\n\t\tOperation: logical.UpdateOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\n\t// .well-known/keys should contain 3 public keys\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/.well-known/keys\",\n\t\tOperation: logical.ReadOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\t// parse response\n\tjson.Unmarshal(resp.Data[\"http_raw_body\"].([]byte), responseJWKS)\n\tif len(responseJWKS.Keys) != 3 {\n\t\tt.Fatalf(\"expected 3 public keys but instead got %d\", len(responseJWKS.Keys))\n\t}\n\n\t// create another named key\n\tc.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key2\",\n\t\tOperation: logical.CreateOperation,\n\t\tStorage: storage,\n\t})\n\n\t// delete test key\n\tc.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/key/test-key\",\n\t\tOperation: logical.DeleteOperation,\n\t\tStorage: storage,\n\t})\n\n\t// .well-known/keys should contain 1 public key, all of the public keys\n\t// from named key \"test-key\" should have been deleted\n\tresp, err = c.identityStore.HandleRequest(ctx, &logical.Request{\n\t\tPath: \"oidc/.well-known/keys\",\n\t\tOperation: logical.ReadOperation,\n\t\tStorage: storage,\n\t})\n\texpectSuccess(t, resp, err)\n\t// parse response\n\tjson.Unmarshal(resp.Data[\"http_raw_body\"].([]byte), responseJWKS)\n\tif len(responseJWKS.Keys) != 1 {\n\t\tt.Fatalf(\"expected 1 public keys but instead got %d\", len(responseJWKS.Keys))\n\t}\n}", "title": "" }, { "docid": "972dde4ec05a5b02333d963d7ebe42eb", "score": "0.56716347", "text": "func TestServerConfiguration_Key(t *testing.T) {\n\tt.Parallel()\n\n\tkey := \"server.key\"\n\tcfg := ServerConfiguration{\n\t\tkey: key,\n\t}\n\n\tif cfg.Key() != key {\n\t\tt.Fatal(\"TLS key is wrong\")\n\t}\n}", "title": "" }, { "docid": "4dacb80788dba0f479f5c498d5c401c9", "score": "0.5670044", "text": "func NewRootKey(algorithm EncryptionAlgorithm) (*RootKey, error) {\n\tmeta := NewRootKeyMeta()\n\tmeta.Algorithm = algorithm\n\n\trootKey := &RootKey{\n\t\tMeta: meta,\n\t}\n\n\tswitch algorithm {\n\tcase EncryptionAlgorithmAES256GCM:\n\t\tkey, err := crypto.Bytes(32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to generate key: %v\", err)\n\t\t}\n\t\trootKey.Key = key\n\t}\n\n\treturn rootKey, nil\n}", "title": "" }, { "docid": "31bbf13006c9588112856d77b7cac236", "score": "0.5665998", "text": "func TestGetByKey(t *testing.T) {\n\ttf.UnitTest(t)\n\n\tctx := context.Background()\n\tbuilder := chain.NewBuilder(t, address.Undef)\n\tgenTS := builder.NewGenesis()\n\tr := repo.NewInMemoryRepo()\n\tcs := newChainStore(r, genTS.At(0).Cid())\n\n\t// Construct test chain data\n\tlink1 := builder.AppendOn(genTS, 2)\n\tlink2 := builder.AppendOn(link1, 3)\n\tlink3 := builder.AppendOn(link2, 1)\n\tlink4 := builder.BuildOn(link3, 2, func(bb *chain.BlockBuilder, i int) { bb.IncHeight(2) })\n\n\t// Put the test chain to the store\n\trequirePutTestChain(ctx, t, cs, link4.Key(), builder, 5)\n\n\t// Check that we can get all tipsets by key\n\tgotGTS := requireGetTipSet(ctx, t, cs, genTS.Key())\n\tgotGTSSR := requireGetTipSetStateRoot(ctx, t, cs, genTS.Key())\n\n\tgot1TS := requireGetTipSet(ctx, t, cs, link1.Key())\n\tgot1TSSR := requireGetTipSetStateRoot(ctx, t, cs, link1.Key())\n\n\tgot2TS := requireGetTipSet(ctx, t, cs, link2.Key())\n\tgot2TSSR := requireGetTipSetStateRoot(ctx, t, cs, link2.Key())\n\n\tgot3TS := requireGetTipSet(ctx, t, cs, link3.Key())\n\tgot3TSSR := requireGetTipSetStateRoot(ctx, t, cs, link3.Key())\n\n\tgot4TS := requireGetTipSet(ctx, t, cs, link4.Key())\n\tgot4TSSR := requireGetTipSetStateRoot(ctx, t, cs, link4.Key())\n\tassert.Equal(t, genTS, gotGTS)\n\tassert.Equal(t, link1, got1TS)\n\tassert.Equal(t, link2, got2TS)\n\tassert.Equal(t, link3, got3TS)\n\tassert.Equal(t, link4, got4TS)\n\n\tassert.Equal(t, genTS.At(0).StateRoot, gotGTSSR)\n\tassert.Equal(t, link1.At(0).StateRoot, got1TSSR)\n\tassert.Equal(t, link2.At(0).StateRoot, got2TSSR)\n\tassert.Equal(t, link3.At(0).StateRoot, got3TSSR)\n\tassert.Equal(t, link4.At(0).StateRoot, got4TSSR)\n}", "title": "" }, { "docid": "6022286fc26d7171efbfafc68551980c", "score": "0.5662139", "text": "func genPrivKey(rander io.Reader) PrivKeyBLS {\n\tv, _ := syscall.Getenv(\"TASKID\")\n\tShard, _ := strconv.Atoi(v)\n\tvar id int64\n\tid = int64(Shard * 500)\n\ttmp := rand.New(rand.NewSource(uint64(id)))\n\tcipher1 := random.New(tmp)\n\n\tpriv, _ := bls.NewKeyPair(bn256_suite, cipher1)\n\tdata, _ := priv.MarshalBinary()\n\treturn PrivKeyBLS(data)\n}", "title": "" }, { "docid": "86d6956458d70cd15e67f8e92c3a2141", "score": "0.5656048", "text": "func TestSubkey(t *testing.T) {\n\tkey, _ := hex.DecodeString(\"2b7e151628aed2a6abf7158809cf4f3c\")\n\tconst k1 = \"fbeed618357133667c85e08f7236a8de\"\n\tconst k2 = \"f7ddac306ae266ccf90bc11ee46d513b\"\n\n\tciph, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tt.Errorf(\"Error from NewCipher: %s\", err)\n\t}\n\tkey1, key2 := generateSubkeys(ciph)\n\n\tresult1 := hex.EncodeToString(key1)\n\tresult2 := hex.EncodeToString(key2)\n\n\tif k1 != result1 {\n\t\tt.Errorf(\"K1 does not match: %s != %s\", k1, result1)\n\t}\n\tif k2 != result2 {\n\t\tt.Errorf(\"K2 does not match: %s != %s\", k2, result2)\n\t}\n}", "title": "" }, { "docid": "9f8aad95aa02e7f1c6dc6abf34ca7dfa", "score": "0.5649778", "text": "func GenerateKey(containerID string) string {\n\treturn \"\"\n}", "title": "" }, { "docid": "7a511fd67bcedfe37bae30674c39156a", "score": "0.5649024", "text": "func initHashKeys() {\n\tfor index := 0; index < 13; index++ {\n\t\tfor index2 := 0; index2 < 120; index2++ {\n\t\t\tPieceKeys[index][index2] = Rand64()\n\t\t}\n\t}\n\tSideKey = Rand64()\n\tfor index := 0; index < 16; index++ {\n\t\tCastleKeys[index] = Rand64()\n\t}\n}", "title": "" }, { "docid": "4a3268bde52566a563d959421bd24931", "score": "0.5642651", "text": "func TestHStar2OffsetRootKAT(t *testing.T) {\n\ts := NewHStar2(testonly.Hasher)\n\n\tm := make(map[string]string)\n\n\tfor i, x := range simpleTestVector {\n\t\t// start at 24 so we can assume that key prefixes are probably unique by then\n\t\t// TODO(al): improve rootsForTrimmedKeys to use a map and remove this\n\t\t// requirement.\n\t\tfor size := 24; size < 256; size += 8 {\n\t\t\tm[x.k] = x.v\n\t\t\tintermediates := rootsForTrimmedKeys(t, size, createHStar2Leaves(testonly.Hasher, m))\n\n\t\t\troot, err := s.HStar2Nodes(size, s.hasher.Size()*8-size, intermediates,\n\t\t\t\tfunc(int, *big.Int) ([]byte, error) { return nil, nil },\n\t\t\t\tfunc(int, *big.Int, []byte) error { return nil })\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Failed to calculate root at iteration %d: %v\", i, err)\n\t\t\t}\n\t\t\tif expected, got := x.root, root; !bytes.Equal(expected, got) {\n\t\t\t\tt.Fatalf(\"Expected root:\\n%v\\nGot:\\n%v\", base64.StdEncoding.EncodeToString(expected), base64.StdEncoding.EncodeToString(got))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ce069e0c4f0c1b80898544f09d266276", "score": "0.5641349", "text": "func TestHDWalletNewChildKey(t *testing.T) {\n\tseed := []byte{1, 2, 3}\n\tmasterKey, _ := NewMasterKey(seed)\n\n\tdata := []struct {\n\t\tchildIdx uint32\n\t}{\n\t\t{uint32(0)},\n\t\t{uint32(1)},\n\t\t{uint32(2)},\n\t\t{uint32(3)},\n\t\t{uint32(4)},\n\t}\n\n\tfor _, item := range data {\n\t\tchildKey, err := masterKey.NewChildKey(item.childIdx)\n\n\t\tassert.Equal(t, nil, err)\n\t\tassert.Equal(t, common.Uint32ToBytes(item.childIdx), childKey.ChildNumber)\n\t\tassert.Equal(t, chainCodeLen, len(childKey.ChainCode))\n\t\tassert.Equal(t, masterKey.Depth+1, childKey.Depth)\n\t\tassert.Equal(t, common.PublicKeySize, len(childKey.KeySet.PaymentAddress.Pk))\n\t\tassert.Equal(t, common.TransmissionKeySize, len(childKey.KeySet.PaymentAddress.Tk))\n\t\tassert.Equal(t, common.PrivateKeySize, len(childKey.KeySet.PrivateKey))\n\t\tassert.Equal(t, common.ReceivingKeySize, len(childKey.KeySet.ReadonlyKey.Rk))\n\t}\n}", "title": "" }, { "docid": "bb8e3e8765b83ef689b93ce5681b5e45", "score": "0.56345505", "text": "func TestKey(c echo.Context) error {\n\ttoken, err := servicesAuth.TestKey()\n\tif err != nil {\n\t\treturn c.JSON(409, err)\n\t}\n\treturn c.JSON(200, token)\n}", "title": "" }, { "docid": "b5a8053774aefe1070d819b41f9c3b37", "score": "0.5621071", "text": "func skGen() Key {\n\tskey := RandomScalar()\n\tScReduce32(skey)\n\treturn *skey\n}", "title": "" }, { "docid": "1aa3fdc88111239e7979b36a682ebba8", "score": "0.5619465", "text": "func newTestKeyPair(serial int64, org, dnsName string) (string, string) {\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcertTemplate := x509.Certificate{\n\t\tSerialNumber: big.NewInt(serial),\n\t\tSubject: pkix.Name{Organization: []string{org}},\n\t\tDNSNames: []string{dnsName},\n\t}\n\n\tcertDERBytes, err := x509.CreateCertificate(rand.Reader, &certTemplate, &certTemplate, &privateKey.PublicKey, privateKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar certBuf bytes.Buffer\n\terr = pem.Encode(&certBuf, &pem.Block{Type: \"CERTIFICATE\", Bytes: certDERBytes})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar keyBuf bytes.Buffer\n\terr = pem.Encode(&keyBuf, &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn certBuf.String(), keyBuf.String()\n}", "title": "" }, { "docid": "0870b4770bc2da710ffd04f410e26655", "score": "0.561829", "text": "func (a *Admin) generateKey(size int) {\n\ta.Key = make([]byte, size)\n\tfor p := 0; p < len(a.Key); {\n\t\tn, err := rand.Read(a.Key[p:])\n\t\tif err != nil {\n\t\t\tpanic(\"Error while generating key: \" + err.Error())\n\t\t}\n\t\tp += n\n\t}\n}", "title": "" }, { "docid": "ff2694ca94a0b6bb75e3df7fe22bf369", "score": "0.5616418", "text": "func xTestThalesGenerateSymmetricKey(t *testing.T) {\n\tconn, err := net.DialTimeout(\"tcp\", TEST_THALES_HSM_HOST, time.Duration(HSM_CONNECTION_TIMEOUT)*time.Second)\n\tif err != nil {\n\t\tt.Fatalf(\"[THALES]: Failed to HSM connect: %s\\n\", err)\n\t}\n\tdefer conn.Close()\n\n\t_,err = thalesGenerateSymmetricKey(conn)\n\n\tif err != nil {\n\t\tt.Fatalf(\"[THALES]: Couldn't generate symmetric key: %s\\n\", err)\n\t}\n}", "title": "" } ]
53c5994418023c1a83682e98585ae965
NewPlugin returns a new auth plugin
[ { "docid": "64bd0165d6f7acd4b182e78949421801", "score": "0.76726604", "text": "func NewPlugin() plugin.Plugin {\n\tauth := new(Auth)\n\tauth.Provider = new(allow)\n\n\treturn plugin.NewPlugin(\n\t\tplugin.WithName(\"auth\"),\n\t\tplugin.WithFlag(\n\t\t\t&cli.StringFlag{\n\t\t\t\tName: \"auth\",\n\t\t\t\tUsage: \"Specify the type of auth e.g basic:///path/to/file, digest:///path/to/file, ldap[s]://url\",\n\t\t\t},\n\t\t\t&cli.StringFlag{\n\t\t\t\tName: \"realm\",\n\t\t\t\tUsage: \"Specify the realm for auth\",\n\t\t\t},\n\t\t),\n\t\tplugin.WithHandler(auth.Handler),\n\t\tplugin.WithInit(func(ctx *cli.Context) error {\n\t\t\tauthType := ctx.String(\"auth\")\n\t\t\tauthRealm := ctx.String(\"realm\")\n\t\t\tparts := strings.Split(authType, \"://\")\n\n\t\t\t// no auth\n\t\t\tif len(parts) < 2 {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\ttyp := parts[0]\n\t\t\tfile := parts[1]\n\n\t\t\tswitch typ {\n\t\t\tcase \"basic\":\n\t\t\t\tauth.Provider = basic.New(file, authRealm)\n\t\t\t\tlog.Infof(\"Loaded basic auth file: %s\", file)\n\t\t\tcase \"digest\":\n\t\t\t\tlog.Infof(\"Loaded digest auth file: %s\", file)\n\t\t\t\tauth.Provider = digest.New(file, authRealm)\n\t\t\tcase \"ldap\", \"ldaps\":\n\t\t\t\tlog.Infof(\"Loaded ldap auth url: %s\", file)\n\t\t\t\tauth.Provider = ldap.New(file, authRealm)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}),\n\t)\n}", "title": "" } ]
[ { "docid": "befaa9c62d9c9166004729b13c9f5780", "score": "0.7058396", "text": "func newPlugin(casbinModel string, casbinPolicy string) (*CasbinAuthZPlugin, error) {\n\tplugin := &CasbinAuthZPlugin{}\n\n\tplugin.enforcer = casbin.NewEnforcer(casbinModel, casbinPolicy)\n\n\treturn plugin, nil\n}", "title": "" }, { "docid": "578590eec48180fe0d91bf4c7314b230", "score": "0.7028086", "text": "func newPlugin(dockerHost string, registries map[string]bool) (*ImgAuthZPlugin, error) {\n\tclient, err := dockerclient.NewClient(dockerHost, dockerapi.DefaultVersion, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ImgAuthZPlugin{\n\t\tclient: client,\n\t\tauthorizedRegistries: registries,\n\t\tnumAuthorizedRegistries: len(registries),\n\t\tauthRegistriesAsString: authRegistries(registries)}, nil\n}", "title": "" }, { "docid": "bb5c521ac84363e2fc9e1ee3c9c41537", "score": "0.6826971", "text": "func New(args Args) *AuthNPlugin {\n\tif args.URL == nil || args.URL.Scheme == \"\" && args.AuthToken == \"\" {\n\t\treturn nil\n\t}\n\treturn &AuthNPlugin{\n\t\targs: args,\n\t\tclient: &http.Client{Transport: args.Transport},\n\t}\n}", "title": "" }, { "docid": "36b2f365c9699de271bfb021e611227b", "score": "0.6760436", "text": "func NewPlugin() (Plugin, error) {\n\tdbtype := config.Get(\"userdb.type\")\n\tdburl := config.Get(\"userdb.url\")\n\n\tif dbtype == \"\" && dburl != \"\" {\n\t\tu, err := url.Parse(dburl)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdbtype = u.Scheme\n\t}\n\n\tif dbtype == \"\" {\n\t\treturn nil, errors.New(\"The user database plugin does not configured\")\n\t} else if f, ok := pluginRegistration[dbtype]; ok {\n\t\treturn f(dburl)\n\t} else {\n\t\treturn nil, fmt.Errorf(\"Unsupported user database scheme: %s\", dbtype)\n\t}\n}", "title": "" }, { "docid": "82729a5295ba48d66d1bc268d1ad10a2", "score": "0.6717128", "text": "func NewPlugin(c *portercontext.Context, impl plugins.StorageProtocol) Plugin {\n\treturn Plugin{\n\t\tcontext: c,\n\t\timpl: impl,\n\t}\n}", "title": "" }, { "docid": "c43d9fd3b23f58aaaefe0e01513b816c", "score": "0.6514604", "text": "func GetPluginCtor() signature.SignerFactoryCtor {\n\treturn newPluginFactory\n}", "title": "" }, { "docid": "d2117ffb60de74ab5ced019a7b03246d", "score": "0.6507477", "text": "func NewPlugin(context context.T, updatePluginConfig UpdatePluginConfig) (*Plugin, error) {\n\treturn &Plugin{\n\t\tcontext,\n\t\tupdatePluginConfig.ManifestLocation,\n\t}, nil\n}", "title": "" }, { "docid": "216168afc533355ebe616ed3395817ae", "score": "0.6494808", "text": "func newPluginHandlerAPI(ctx *web.Context) (interface{}, int){\n isLoggedIn, u, _ := getSessionByCookie(ctx)\n\n if (!isLoggedIn) || (!u.IsAdmin()){\n logging.Warning(\"web-plugin\", \"newPlugin() called unauthorized, aborting\")\n return unauthorized()\n }\n\n decoder := json.NewDecoder(ctx.Request.Body)\n var pl pluginData.Plugin\n err := decoder.Decode(&pl)\n if err != nil {\n logging.Error(\"web-plugin\", \"newPluginHandlerAPI() failed to decode JSON:\", err)\n return err, 400\n }\n\n err = pluginData.Create(&pl, data.DB)\n if err == nil {\n return pl, 201\n } else {\n logging.Error(\"web-plugin\", err)\n return err, 500\n }\n}", "title": "" }, { "docid": "b0ff394f70c9a302354e00b086dbc59d", "score": "0.64695144", "text": "func NewPlugin(mouse *mouse.Mouse, config *Config) func(*mouse.Event) {\n\tplugin := &Plugin{\n\t\tConfig: config,\n\t\tMouse: mouse,\n\t\tmutex: &sync.Mutex{},\n\t\tvm: otto.New(),\n\t}\n\n\t// Register javascript functions\n\tplugin.register()\n\tgo plugin.watchFiles()\n\n\t// Load initial scripts\n\tif err := plugin.load(); err != nil {\n\t\tstderr.Printf(\"Could not load javascript plugins:\", err)\n\t}\n\n\treturn plugin.handler\n}", "title": "" }, { "docid": "6b2773dfe59753d2aef0e24f4ed4bd6d", "score": "0.64605445", "text": "func New(deps Deps) core.NamedPlugin {\n\treturn core.NamedPlugin{\n\t\tPluginName: pluginID,\n\t\tPlugin: &pluginImpl{\n\t\t\tDeps: deps,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "20440cb023e24edd357256c51696331f", "score": "0.6451352", "text": "func NewPlugin(context context.T) (*Plugin, error) {\n\tvar err error\n\tvar p = Plugin{}\n\n\tc := context.With(\"[\" + Name() + \"]\")\n\tlog := c.Log()\n\n\t//get machineID - return if not able to detect machineID\n\tif p.machineID, err = context.Identity().InstanceID(); err != nil {\n\t\terr = fmt.Errorf(\"Unable to detect machineID because of %v - this will hamper execution of inventory plugin\",\n\t\t\terr.Error())\n\t\treturn &p, err\n\t}\n\n\tp.context = c\n\tp.stopPolicy = sdkutil.NewStopPolicy(Name(), model.ErrorThreshold)\n\n\t//loads all registered gatherers (for now only a dummy application gatherer is loaded in memory)\n\tp.supportedGatherers, p.installedGatherers = gatherers.InitializeGatherers(p.context)\n\t//initializes SSM Inventory uploader\n\tif p.uploader, err = datauploader.NewInventoryUploader(c); err != nil {\n\t\terr = log.Errorf(\"Unable to configure SSM Inventory uploader - %v\", err.Error())\n\t}\n\n\treturn &p, err\n}", "title": "" }, { "docid": "76a0b80a2fbb41fd8dd7a62544f162fa", "score": "0.6440335", "text": "func NewPlugin(name, version, endpointType string) (*Plugin, error) {\n\t// Setup base plugin.\n\tplugin, err := common.NewPlugin(name, version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Plugin{\n\t\tPlugin: plugin,\n\t\tEndpointType: endpointType,\n\t}, nil\n}", "title": "" }, { "docid": "b048bbc75b188095c269d0d62f644f81", "score": "0.6436863", "text": "func New() generator.Plugin {\n\treturn &plugin{}\n}", "title": "" }, { "docid": "d692d66f2621665371d62dfbdac269d8", "score": "0.63947415", "text": "func New() *Plugin {\n\tp := &Plugin{}\n\treturn p\n}", "title": "" }, { "docid": "874cce40c4ef414d864fbe3b8600e9f6", "score": "0.6392472", "text": "func NewPlugin(cfgPath string) (chatbot.Plugin, error) {\n\tchatbot.Info(\"NewPlugin - filetemplatePlugin\")\n\n\treturn &filetemplatePlugin{}, nil\n}", "title": "" }, { "docid": "e279fe8525c4a68f139d6908bf27678d", "score": "0.6380442", "text": "func NewPlugin(pluginAddr string) *plugin {\n\treturn &plugin{\n\t\tclient: &http.Client{},\n\t\tpluginAddr: pluginAddr,\n\t}\n}", "title": "" }, { "docid": "2bba8777040581a2db6f3d786550de68", "score": "0.63680947", "text": "func NewPlugin() plugin.Plugin {\n\treturn Plugin{}\n}", "title": "" }, { "docid": "a8d17c97c4825be5347aa51bf229fd94", "score": "0.6361913", "text": "func NewPlugin(ctx *pulumi.Context,\n\tname string, args *PluginArgs, opts ...pulumi.ResourceOption) (*Plugin, error) {\n\tif args == nil {\n\t\targs = &PluginArgs{}\n\t}\n\n\tvar resource Plugin\n\terr := ctx.RegisterResource(\"docker:index/plugin:Plugin\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d09d8627b47161824f760c40bf206590", "score": "0.6343737", "text": "func NewPlugin(pluginType string, osClient *osclient.Client, kClient *kclient.Client, hostname string, selfIP string) (api.OsdnPlugin, api.FilteringEndpointsConfigHandler, error) {\n\tswitch strings.ToLower(pluginType) {\n\tcase ovs.SingleTenantPluginName():\n\t\treturn ovs.CreatePlugin(osdn.NewRegistry(osClient, kClient), false, hostname, selfIP)\n\tcase ovs.MultiTenantPluginName():\n\t\treturn ovs.CreatePlugin(osdn.NewRegistry(osClient, kClient), true, hostname, selfIP)\n\t}\n\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "c280a3f3d5d261180015b8b2a010568a", "score": "0.632947", "text": "func NewPlugin(name string, fn LogFunc) *Plugin {\n\treturn &Plugin{name: name, logFn: fn}\n}", "title": "" }, { "docid": "e62b5a0f7c4c6cee8f7d2421d923e0af", "score": "0.6294453", "text": "func NewPlugin() *Plugin {\n\treturn &Plugin{\n\t\tfilesWritten: map[string]interface{}{},\n\t}\n}", "title": "" }, { "docid": "794bb789551cecc4b6896ef264875cef", "score": "0.629137", "text": "func (PluginFactoryBase) NewPlugin(*runtime.SandboxContextBuilder) Plugin {\n\treturn PluginBase{}\n}", "title": "" }, { "docid": "f845cb0fb0416e6d4dc07de2316b690c", "score": "0.6252067", "text": "func New(name string) *Plugin {\n\treturn &Plugin{\n\t\tname: name,\n\t}\n}", "title": "" }, { "docid": "18524282e50d95339308c1abb0b40a8e", "score": "0.6236138", "text": "func New(b bot.Bot) *AdminPlugin {\n\tp := &AdminPlugin{\n\t\tbot: b,\n\t\tdb: b.DB(),\n\t\tcfg: b.Config(),\n\t}\n\tb.Register(p, bot.Message, p.message)\n\tb.Register(p, bot.Help, p.help)\n\tp.registerWeb()\n\treturn p\n}", "title": "" }, { "docid": "9b7d99729a5c9dda7212604155933a60", "score": "0.6232879", "text": "func New(log logrus.FieldLogger) *Plugin {\n\treturn &Plugin{log: log}\n}", "title": "" }, { "docid": "312ea10af8c26a9e24e002f8e989dad7", "score": "0.61968803", "text": "func NewPlugin(pluginID string, contents []byte) (*Plugin, error) {\n\tp := &Plugin{}\n\tif err := p.UnmarshalText(contents); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not unmarshal plugin file: %s\", err)\n\t}\n\tp.ID = pluginID\n\n\t// Validate the parameter definitions\n\tfor _, param := range p.Parameters {\n\t\tif err := param.validateDefinition(); err != nil {\n\t\t\treturn nil, errors.NewError(\n\t\t\t\t\"invalid parameter found in plugin\",\n\t\t\t\t\"ensure that all parameters are valid for the plugin\",\n\t\t\t\t\"plugin_type\", p.ID,\n\t\t\t\t\"plugin_parameter\", param.Name,\n\t\t\t\t\"error_message\", err.Error(),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "6326a714c6924c7ae04d23c6f5cded83", "score": "0.61743325", "text": "func NewPlugin(name string, getQueries GetQueriesFunc, writeResults WriteResultsFunc) *Plugin {\n\treturn &Plugin{name: name, getQueries: getQueries, writeResults: writeResults}\n}", "title": "" }, { "docid": "d65fe71b233fbccc69f5d4d2eeb34db2", "score": "0.6169511", "text": "func New(config []byte, manager *plugins.Manager) (*Plugin, error) {\n\n\tvar parsedConfig Config\n\n\tif err := util.Unmarshal(config, &parsedConfig); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := parsedConfig.validateAndInjectDefaults(manager.Services()); err != nil {\n\t\treturn nil, err\n\t}\n\n\tplugin := &Plugin{\n\t\tmanager: manager,\n\t\tconfig: parsedConfig,\n\t\tstop: make(chan chan struct{}),\n\t\tstatus: &Status{\n\t\t\tName: parsedConfig.Name,\n\t\t},\n\t\tlisteners: map[interface{}]func(Status){},\n\t}\n\n\treturn plugin, nil\n}", "title": "" }, { "docid": "d3a7633c001529e16a20d54239958111", "score": "0.6157779", "text": "func PluginFactory(\n\tBuildApi *APIVersionStruct,\n\tBuildNumber string,\n\tDefaultLocale string,\n\tDiscoveryDefinition *PluginDiscoveryDefinitionStruct,\n\tEntryPoint string,\n\tExtendedStartStopHooks *bool,\n\tExternalVersion string,\n\tHostTypes []string,\n\tLanguage string,\n\tLinkedSourceDefinition PluginLinkedSourceDefinition,\n\tLuaName string,\n\tManifest *PluginManifestStruct,\n\tMessages []*ToolkitLocaleStruct,\n\tMinimumLuaVersion string,\n\tName string,\n\tNamespace string,\n\tPluginId string,\n\tReference string,\n\tRootSquashEnabled *bool,\n\tSnapshotParametersDefinition *PluginSnapshotParametersDefinitionStruct,\n\tSnapshotSchema *SchemaDraftV4Struct,\n\tSourceCode string,\n\tUpgradeDefinition *PluginUpgradeDefinitionStruct,\n\tVirtualSourceDefinition *PluginVirtualSourceDefinitionStruct,\n) PluginStruct {\n\treturn PluginStruct{\n\t\tType: \"Plugin\",\n\t\tBuildApi: BuildApi,\n\t\tBuildNumber: BuildNumber,\n\t\tDefaultLocale: DefaultLocale,\n\t\tDiscoveryDefinition: DiscoveryDefinition,\n\t\tEntryPoint: EntryPoint,\n\t\tExtendedStartStopHooks: ExtendedStartStopHooks,\n\t\tExternalVersion: ExternalVersion,\n\t\tHostTypes: HostTypes,\n\t\tLanguage: Language,\n\t\tLinkedSourceDefinition: LinkedSourceDefinition,\n\t\tLuaName: LuaName,\n\t\tManifest: Manifest,\n\t\tMessages: Messages,\n\t\tMinimumLuaVersion: MinimumLuaVersion,\n\t\tName: Name,\n\t\tNamespace: Namespace,\n\t\tPluginId: PluginId,\n\t\tReference: Reference,\n\t\tRootSquashEnabled: RootSquashEnabled,\n\t\tSnapshotParametersDefinition: SnapshotParametersDefinition,\n\t\tSnapshotSchema: SnapshotSchema,\n\t\tSourceCode: SourceCode,\n\t\tUpgradeDefinition: UpgradeDefinition,\n\t\tVirtualSourceDefinition: VirtualSourceDefinition,\n\t}\n}", "title": "" }, { "docid": "85501cc66898476d8c7e0782b89be351", "score": "0.61342674", "text": "func New(opts ...Option) Plugin {\n\tp := &pluginImpl{}\n\n\tfor _, opt := range opts {\n\t\topt(p)\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "322015b3c5d7e2b79223ed804007cba6", "score": "0.61179894", "text": "func NewPluginRegistrar(ctx context.Context, pluginConfig registrar.PluginConfig) (*PluginRegistrar, error) {\n\n\tvar err error\n\n\tpluginMutex.Lock()\n\tdefer pluginMutex.Unlock()\n\n\tlog := ctx.Value(\"appLog\").(*log.Entry)\n\tlog.Debugf(\"Entering NewPluginRegistrar\")\n\tpluginRegistrar := PluginRegistrar{pluginConfig: &pluginConfig}\n\t// Parse validation should ensure path is not empty\n\tregPlugin, err := plugin.Open(pluginConfig.PluginLibPath)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to open provided plugin library. Error: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\t// Get plugin in name\n\tpluginConfig.PluginName = filepath.Base(pluginConfig.PluginLibPath)\n\n\tif err = lookupSymbols(regPlugin, &pluginRegistrar); err != nil {\n\t\tlog.Errorf(\"Plugin library failed validation. Error: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\t// initialize the plugin\n\tnewPluginLibRegistrar, err := regPlugin.Lookup(\"NewPluginLibRegistrar\")\n\tif err != nil {\n\t\tlog.Errorf(\"Plugin library does not support RegistrarProvider interface. Error: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tpluginRegistrar.pluginArgs.PluginArg = pluginConfig\n\tif !pluginRegistrar.pluginTest {\n\t\t// clear ResultObj\n\t\tpluginRegistrar.pluginResult.PluginError = nil\n\t\tpluginRegistrar.pluginResult.PluginResult = nil\n\t}\n\tnewPluginLibRegistrar.(func())()\n\tif pluginRegistrar.pluginResult.PluginError != nil {\n\t\tlog.Errorf(\"Plugin library failed to initialize. Error: %s\", pluginRegistrar.pluginResult.PluginError.Error())\n\t\treturn nil, pluginRegistrar.pluginResult.PluginError\n\t}\n\tpluginConfig.Registrar = regPlugin\n\n\treturn &pluginRegistrar, nil\n}", "title": "" }, { "docid": "afe52c45dea3add3fa0ef94d2817f579", "score": "0.6112475", "text": "func NewPlugin(config PluginConfig, enabled bool, name string, settings PluginSettings) *Plugin {\n\tthis := Plugin{}\n\tthis.Config = config\n\tthis.Enabled = enabled\n\tthis.Name = name\n\tthis.Settings = settings\n\treturn &this\n}", "title": "" }, { "docid": "f96bb428c5bb94eca6c4b75c6712e7f7", "score": "0.6064197", "text": "func New(_ runtime.Object, h framework.Handle) (framework.Plugin, error) {\n\tcfg := config.GetConfigOrDie()\n\tclient, err := versioned.NewForConfig(cfg)\n\tutilruntime.Must(err)\n\treturn &Plugin{handle: h, client: client}, nil\n}", "title": "" }, { "docid": "115d5375af5badc78061e84a20e9dad2", "score": "0.6055578", "text": "func New() *PCAPlugin {\n\treturn newPlugin(newPCAClient)\n}", "title": "" }, { "docid": "c5f4ece059791f75fe412ddbb5ff611a", "score": "0.60460645", "text": "func New(b bot.Bot) *YourPlugin {\n\typ := &YourPlugin{\n\t\tbot: b,\n\t\tconfig: b.Config(),\n\t}\n\tb.RegisterRegex(yp, bot.Message, regexp.MustCompile(`.*`), yp.message)\n\tb.Register(yp, bot.Help, yp.help)\n\treturn yp\n}", "title": "" }, { "docid": "5b4e8ca3efa221d0bc31ecab373d6d8e", "score": "0.60345703", "text": "func NewPlugin() (*Plugin, error) {\n\tplugin := &Plugin{\n\t\tpvs: getPVs(),\n\t}\n\treturn plugin, nil\n}", "title": "" }, { "docid": "7a43a3b973080873070d51b0c699fcee", "score": "0.6027523", "text": "func NewPlugin() plugin.Plugin {\n\treturn &static{}\n}", "title": "" }, { "docid": "af9840a6cbcf39d3c746b5f4f9357a73", "score": "0.5996274", "text": "func NewPlugin(context context.T) (sessionplugin.ISessionPlugin, error) {\n\tvar plugin = PortPlugin{\n\t\tcontext: context,\n\t\tcancelled: make(chan struct{}),\n\t}\n\treturn &plugin, nil\n}", "title": "" }, { "docid": "3ccd8697b4d8b29eb23ac5a09d0e78a5", "score": "0.5994035", "text": "func New(parsedConfig *Config, manager *plugins.Manager) *Plugin {\n\tp := &Plugin{\n\t\tmanager: manager,\n\t\tconfig: *parsedConfig,\n\t\tstatus: &Status{\n\t\t\tName: parsedConfig.Name,\n\t\t},\n\t}\n\tp.initDownloader()\n\treturn p\n}", "title": "" }, { "docid": "a18cb73fd62cfe0a5c44a76a71117b28", "score": "0.5991349", "text": "func New(name string, initClient func(string) (fsroot.Client, error)) (*Plugin, error) {\n\tconfig := mustInitConfig()\n\n\tfsClient, err := initClient(config.ClientRoot)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"client init failed\")\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tconn, err := grpc.Dial(config.AgentAddress, grpc.WithDialer(unixDialer), grpc.WithInsecure())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"dial gprc server failed\")\n\t}\n\treturn &Plugin{\n\t\tname: name,\n\t\trpcConn: conn,\n\t\tctx: ctx,\n\t\tcancelContext: cancel,\n\t\tcli: pb.NewDataMoverClient(conn),\n\t\tfsClient: fsClient,\n\t\tconfig: config,\n\t}, nil\n}", "title": "" }, { "docid": "d37bd519b20ce5db55b42e8b7eaec69e", "score": "0.5986257", "text": "func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {\n\n\tlog := NewLogger()\n\tlog.Printf(\"booting trauth version: %s\", version)\n\n\t// parse && validate the configuration we got\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// register our user type\n\tgob.Register(User{})\n\n\t// return the plugin instance\n\treturn &Trauth{\n\t\tnext: next,\n\t\tname: name,\n\t\tconfig: config,\n\t\tlogger: NewLogger(),\n\t}, nil\n}", "title": "" }, { "docid": "005eea9529538df221060a661ef2dd56", "score": "0.5983951", "text": "func New(arguments framework.Arguments) framework.Plugin {\n\treturn &gangPlugin{pluginArguments: arguments}\n}", "title": "" }, { "docid": "12b3d5644e53693de703164a9430b8ed", "score": "0.5958306", "text": "func newAvailablePlugin(resp plugin.Response, emitter gomit.Emitter, ep executablePlugin, security client.GRPCSecurity) (*availablePlugin, error) {\n\tif security.TLSEnabled && !resp.Meta.TLSEnabled {\n\t\treturn nil, errors.New(ErrMsgInsecurePlugin + \"; plugin_name: \" + resp.Meta.Name)\n\t}\n\tif !security.TLSEnabled && resp.Meta.TLSEnabled {\n\t\treturn nil, errors.New(ErrMsgInsecureClient + \"; plugin_name: \" + resp.Meta.Name)\n\t}\n\tif resp.Type != plugin.CollectorPluginType && resp.Type != plugin.ProcessorPluginType && resp.Type != plugin.PublisherPluginType && resp.Type != plugin.StreamCollectorPluginType {\n\t\treturn nil, strategy.ErrBadType\n\t}\n\tap := &availablePlugin{\n\t\tmeta: resp.Meta,\n\t\tname: resp.Meta.Name,\n\t\tversion: resp.Meta.Version,\n\t\tpluginType: resp.Type,\n\t\temitter: emitter,\n\t\thealthChan: make(chan error, 1),\n\t\tlastHitTime: time.Now(),\n\t\tePlugin: ep,\n\t\tpprofPort: resp.PprofAddress,\n\t\tisRemote: false,\n\t}\n\tap.key = fmt.Sprintf(\"%s\"+core.Separator+\"%s\"+core.Separator+\"%d\", ap.pluginType.String(), ap.name, ap.version)\n\n\t// Create RPC Client\n\tswitch resp.Type {\n\tcase plugin.CollectorPluginType:\n\t\tswitch resp.Meta.RPCType {\n\t\tcase plugin.NativeRPC:\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"_module\": \"control-aplugin\",\n\t\t\t\t\"_block\": \"newAvailablePlugin\",\n\t\t\t\t\"plugin_name\": ap.name,\n\t\t\t}).Warning(\"This plugin is using a deprecated RPC protocol. Find more information here: https://github.com/intelsdi-x/snap/issues/1289 \")\n\t\t\tc, e := client.NewCollectorNativeClient(resp.ListenAddress, DefaultClientTimeout, resp.PublicKey, !resp.Meta.Unsecure)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tcase plugin.GRPC:\n\t\t\tc, e := client.NewCollectorGrpcClient(resp.ListenAddress, DefaultClientTimeout, security)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tcase plugin.STREAMGRPC:\n\t\t\tc, e := client.NewStreamCollectorGrpcClient(\n\t\t\t\tresp.ListenAddress,\n\t\t\t\tDefaultClientTimeout,\n\t\t\t\tsecurity)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid RPCTYPE\")\n\t\t}\n\tcase plugin.PublisherPluginType:\n\t\tswitch resp.Meta.RPCType {\n\t\tcase plugin.NativeRPC:\n\t\t\tc, e := client.NewPublisherNativeClient(resp.ListenAddress, DefaultClientTimeout, resp.PublicKey, !resp.Meta.Unsecure)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tcase plugin.GRPC:\n\t\t\tc, e := client.NewPublisherGrpcClient(resp.ListenAddress, DefaultClientTimeout, security)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid RPCTYPE\")\n\t\t}\n\tcase plugin.ProcessorPluginType:\n\t\tswitch resp.Meta.RPCType {\n\t\tcase plugin.NativeRPC:\n\t\t\tc, e := client.NewProcessorNativeClient(resp.ListenAddress, DefaultClientTimeout, resp.PublicKey, !resp.Meta.Unsecure)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tcase plugin.GRPC:\n\t\t\tc, e := client.NewProcessorGrpcClient(resp.ListenAddress, DefaultClientTimeout, security)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid RPCTYPE\")\n\t\t}\n\tcase plugin.StreamCollectorPluginType:\n\t\tswitch resp.Meta.RPCType {\n\t\tcase plugin.STREAMGRPC:\n\t\t\tc, e := client.NewStreamCollectorGrpcClient(\n\t\t\t\tresp.ListenAddress,\n\t\t\t\tDefaultClientTimeout,\n\t\t\t\tsecurity)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, errors.New(\"error while creating client connection: \" + e.Error())\n\t\t\t}\n\t\t\tap.client = c\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid RPCTYPE\")\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"Cannot create a client for a plugin of the type: \" + resp.Type.String())\n\t}\n\n\treturn ap, nil\n}", "title": "" }, { "docid": "362df2a89e8a3089a482a8d425a17001", "score": "0.59508413", "text": "func NewCredentials(p *plugin.Plugin) (*credentials.Credentials, error) {\n\tretrieve, isExpired, err := GetPluginProviderFns(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn credentials.NewCredentials(Provider{\n\t\tRetrieveFn: retrieve,\n\t\tIsExpiredFn: isExpired,\n\t}), nil\n}", "title": "" }, { "docid": "da8c4699a3841b1d48ac806d2a65a643", "score": "0.59233576", "text": "func NewAuth(auth AuthType) AuthenticationProcesser {\n\tswitch auth {\n\tcase Basic:\n\t\treturn &BasicAuthentication{}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "47abc16b6762b66b5544e4592ddf9efd", "score": "0.5913136", "text": "func New(parent string, o *options.Options, p *node.Node, pp *node.Node) *AbstractPlugin {\n\tpl := AbstractPlugin{Parent: parent, Options: o, Params: p, ParentParams: pp}\n\treturn &pl\n}", "title": "" }, { "docid": "9ff4c2d5562aa3bb228d038cb314d0a6", "score": "0.59034586", "text": "func NewPlugin(command string) *Plugin {\n\tfilename := filepath.Base(command)\n\tp := &Plugin{\n\t\tTimeout: 1 * time.Minute,\n\t\tCycleInterval: 5 * time.Second,\n\t\tCommand: command,\n\t\tDebugf: DebugfNoop,\n\t\trefreshSignal: make(chan struct{}, 1),\n\t\tcycleSignal: make(chan struct{}, 1),\n\t}\n\tvar err error\n\tp.RefreshInterval, err = ParseFilenameInterval(filename)\n\tif err != nil {\n\t\tp.Debugf(\"failed to process interval: %s: %s (using default %v)\", filename, err, defaultRefreshInterval)\n\t\tp.RefreshInterval = defaultRefreshInterval\n\t}\n\treturn p\n}", "title": "" }, { "docid": "d912d98f8dfe815d5faaf8968bc0a0dd", "score": "0.5894961", "text": "func New(p interface{}, opts ...Option) (Stub, error) {\n\tstub := &stub{\n\t\tplugin: p,\n\t\tname: os.Getenv(api.PluginNameEnvVar),\n\t\tidx: os.Getenv(api.PluginIdxEnvVar),\n\t\tsocketPath: api.DefaultSocketPath,\n\t\tdialer: func(p string) (stdnet.Conn, error) { return stdnet.Dial(\"unix\", p) },\n\t\tdoneC: make(chan struct{}),\n\t}\n\n\tfor _, o := range opts {\n\t\tif err := o(stub); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := stub.setupHandlers(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := stub.getIdentity(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Infof(noCtx, \"Created plugin %s (%s, handles %s)\", stub.Name(),\n\t\tfilepath.Base(os.Args[0]), stub.events.PrettyString())\n\n\treturn stub, nil\n}", "title": "" }, { "docid": "df0cbcb6928ae44e7392ea15c22d4bc1", "score": "0.5894733", "text": "func CreatePlugin(client _interface.PluginClients, name string, parameters []string, baseDir string) (_interface.PluginInterface, error) {\n\tpluginMutex.Lock()\n\tdefer pluginMutex.Unlock()\n\tpb, found := pluginsHolder[name]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"can't find init plugin %s in controllers\", name)\n\t}\n\tinitPlugins := pb.BuildFunc(client, parameters, baseDir)\n\treturn initPlugins, nil\n}", "title": "" }, { "docid": "c4256440774ee8a30c6719beeb6dc114", "score": "0.5879581", "text": "func NewGotifyPluginInstance(ctx plugin.UserContext) plugin.Plugin {\n\treturn &Plugin{}\n}", "title": "" }, { "docid": "647ba5c99ce0924e98f097c5f7c7bec9", "score": "0.5844504", "text": "func NewPlugin() plugin.Plugin {\n\treturn &allowedCors{\n\t\tallowedHeaders: []string{},\n\t\tallowedOrigins: []string{},\n\t\tallowedMethods: []string{},\n\t}\n}", "title": "" }, { "docid": "5a48909975a97fa78f3d823ecf742d01", "score": "0.5837238", "text": "func NewPlugin(opts ...Option) *NSMPlugin {\n\tp := &NSMPlugin{}\n\tp.PluginName = PluginName\n\tp.KVScheduler = &kvscheduler.DefaultPlugin\n\n\tfor _, o := range opts {\n\t\to(p)\n\t}\n\n\tif p.Log == nil {\n\t\tp.Log = logging.ForPlugin(p.String())\n\t}\n\n\tif p.Cfg == nil {\n\t\tp.Cfg = config.ForPlugin(p.String())\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "c31586c1eb0e924943a7e99be3a00a2a", "score": "0.58237696", "text": "func (router *RouterDefinition) Plugin(pluginType interface{}, names ...string) *Plugin {\n\tnewPlugin := &Plugin{\n\t\tImportName: reflect.TypeOf(pluginType).PkgPath(),\n\t\tRootCommand: Command{\n\t\t\tNames: NewStringSet(names...),\n\t\t},\n\t\tPrefix: DefaultPrefix,\n\t\tListeners: map[string][]interface{}{},\n\t}\n\n\trouter.Plugins = append(router.Plugins, newPlugin)\n\treturn newPlugin\n}", "title": "" }, { "docid": "4eead65aff45e7d4abf8b7861c710837", "score": "0.58212334", "text": "func NewPlugin() derive.Plugin {\n\treturn derive.NewPlugin(\"tuple\", \"deriveTuple\", New)\n}", "title": "" }, { "docid": "5d7f4471462164eeee030a702b5d319a", "score": "0.58174247", "text": "func New(parsedConfig *Config, manager *plugins.Manager) *Plugin {\n\tp := &Plugin{\n\t\tmanager: manager,\n\t\tconfig: *parsedConfig,\n\t\tbundleCh: make(chan bundle.Status),\n\t\tbulkBundleCh: make(chan map[string]*bundle.Status),\n\t\tdiscoCh: make(chan bundle.Status),\n\t\tdecisionLogsCh: make(chan lstat.Status),\n\t\tstop: make(chan chan struct{}),\n\t\treconfig: make(chan reconfigure),\n\t\tpluginStatusCh: make(chan map[string]*plugins.Status),\n\t\tqueryCh: make(chan chan *UpdateRequestV1),\n\t\tlogger: manager.Logger().WithFields(map[string]interface{}{\"plugin\": Name}),\n\t\ttrigger: make(chan trigger),\n\t}\n\n\tp.manager.UpdatePluginStatus(Name, &plugins.Status{State: plugins.StateNotReady})\n\n\treturn p\n}", "title": "" }, { "docid": "55f7c5d4ff0e0b89c8983bd583d54fb6", "score": "0.5811276", "text": "func newJsonInjector() *JsonInjectorImpl {\n\treturn &JsonInjectorImpl{\n\t\tPluginsEnvVarName: \"SSO_PLUGINS\",\n\t\tPluginsVolumeInfo: VolumeInfo{VolumeName: \"sso-plugins\", VolumeMount: \"/opt/eap/providers\", InitVolumeMount: \"/opt/plugins\"},\n\t\tThemesVolumeInfo: VolumeInfo{VolumeName: \"sso-themes\", VolumeMount: \"/opt/themes\", InitVolumeMount: \"/opt/themes\"},\n\t\tInitContainerName: \"sso-plugins-init\",\n\t\tInitContainerImage: \"quay.io/integreatly/sso_plugins_init:1.0.0\",\n\t}\n}", "title": "" }, { "docid": "ade2b8826e400e8049255ac9893a1154", "score": "0.5791351", "text": "func CreateMockPlugin(token string) *MockPlugin {\n\tp := &MockPlugin{\n\t\ttoken: token,\n\t}\n\treturn p\n}", "title": "" }, { "docid": "f6c294872769832056f1830d939416fc", "score": "0.578084", "text": "func NewPlugin(opts ...Option) *Aggregator {\n\tp := &Aggregator{}\n\n\tp.PluginName = \"aggregator\"\n\tp.Local = local.DefaultRegistry\n\tp.Resync = &resync.DefaultPlugin\n\n\tfor _, o := range opts {\n\t\to(p)\n\t}\n\tif p.Cfg == nil {\n\t\tp.Cfg = config.ForPlugin(p.String(),\n\t\t\tconfig.WithCustomizedFlag(config.FlagName(p.String()), \"aggregator.conf\"),\n\t\t)\n\t}\n\tp.PluginDeps.SetupLog()\n\n\treturn p\n}", "title": "" }, { "docid": "9545438edb25a012eea1553f36052b9a", "score": "0.5758732", "text": "func NewPlugins(ctx context.Context) (*Plugins, error) {\n\tvar plugins Plugins\n\n\tplugins.URI = pluginAPI\n\tplugins.Info.Page = 1\n\n\treturn &plugins, nil\n}", "title": "" }, { "docid": "dad87c9df8923c95586541e5916c55af", "score": "0.5752894", "text": "func InitPlugin(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdebugRequestBody(r)\n\n\t\tpluginID := chi.URLParam(r, \"plugin_id\")\n\t\ttenantID := r.Context().Value(ContextKey(\"tenant_id\")).(string)\n\t\tif pluginID == \"\" {\n\t\t\thttputil.ReturnError(r, w, 404, \"need plugin id\")\n\t\t\treturn\n\t\t}\n\t\t_, err := db.GetManager().TenantPluginDao().GetPluginByID(pluginID, tenantID)\n\t\tif err != nil {\n\t\t\tif err.Error() == gorm.ErrRecordNotFound.Error() {\n\t\t\t\thttputil.ReturnError(r, w, 404, \"cant find plugin\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlogrus.Errorf(\"get plugin error, %v\", err)\n\t\t\thttputil.ReturnError(r, w, 500, \"get plugin error\")\n\t\t\treturn\n\t\t}\n\t\tctx := context.WithValue(r.Context(), ContextKey(\"plugin_id\"), pluginID)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "7daccc34e56ca0fd61d5c11cc287e512", "score": "0.57494015", "text": "func NewGotifyPluginInstance(ctx plugin.UserContext) plugin.Plugin {\n\treturn &EchoPlugin{}\n}", "title": "" }, { "docid": "8c7cd7751d70e12f149e02507c2e818b", "score": "0.57294875", "text": "func NewPlugin(conf *Config) *Plugin {\n\treturn &Plugin{\n\t\tname: \"cni-nftables-firewall\",\n\t\tcniVersion: \"0.4.0\",\n\t\tsupportedVersions: supportedVersions,\n\t\tfilterTableName: conf.FilterTableName,\n\t\tforwardFilterChainName: conf.ForwardFilterChainName,\n\t\tnatTableName: conf.NatTableName,\n\t\tpostRoutingNatChainName: conf.PostRoutingNatChainName,\n\t\ttargetIPVersions: make(map[string]bool),\n\t\tinterfaceChain: []string{},\n\t}\n}", "title": "" }, { "docid": "b1a3ed64eb98ec32c23d3ab06cecd0ca", "score": "0.57200354", "text": "func (a *Client) LoadPlugin(params *LoadPluginParams, authInfo runtime.ClientAuthInfoWriter) (*LoadPluginCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewLoadPluginParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"loadPlugin\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/plugins\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"multipart/form-data\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &LoadPluginReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*LoadPluginCreated), nil\n\n}", "title": "" }, { "docid": "0b74193c515eaf296c5800cc1b3aa7d5", "score": "0.57153815", "text": "func NewPluginCommand(settings *environment.Settings) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"plugin\",\n\t\tShort: \"Manage plugins\",\n\t\tLong: \"Plugin used to install|list|uninstall Go Plugins or custom cmds into fabric command\",\n\t}\n\n\tcmd.AddCommand(\n\t\tNewPluginListCommand(settings),\n\t\tNewPluginInstallCommand(settings),\n\t\tNewPluginUninstallCommand(settings),\n\t)\n\n\tcmd.SetOutput(settings.Streams.Out)\n\n\treturn cmd\n}", "title": "" }, { "docid": "41463b3499783f5789c110de6af7a122", "score": "0.5686043", "text": "func New(min, max int) validator.Plugin {\n\treturn &plugin{\n\t\tmin: min,\n\t\tmax: max,\n\t}\n}", "title": "" }, { "docid": "cbb28636c874913016964aebaab58053", "score": "0.56815845", "text": "func NewPlugin(context context.T) (sessionplugin.ISessionPlugin, error) {\n\tshellPlugin, err := shell.NewPlugin(context, appconfig.PluginNameStandardStream)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar plugin = StandardStreamPlugin{\n\t\tcontext: context,\n\t\tshell: shellPlugin,\n\t}\n\n\treturn &plugin, nil\n}", "title": "" }, { "docid": "2e9270ea09a6ffcd142bc666d3610996", "score": "0.5676931", "text": "func NewPlugin(qilbot *bot.Qilbot) (plugin *Plugin) {\n\tconst (\n\t\tName = \"EDSM Plugin\"\n\t\tDescription = \"Client plugin for Elite Dangerous Star Map web site.\"\n\t)\n\n\tdebugMode := qilbot.InDebugMode()\n\n\tplugin = &Plugin{\n\t\tPlugin: bot.Plugin{\n\t\t\tQilbot: qilbot,\n\t\t\tName: Name,\n\t\t\tDescription: Description,\n\t\t\tCommands: []bot.CommandInformation{\n\t\t\t\t{\n\t\t\t\t\tCommand: \"distance\",\n\t\t\t\t\tTemplate: \"distance **sys1** / **sys2**\",\n\t\t\t\t\tDescription: \"Uses the coords in EDSM to calculate the distance between the two star systems.\",\n\t\t\t\t\tExecute: func(s *discordgo.Session, m *discordgo.MessageCreate, commandText string) {\n\t\t\t\t\t\tplugin.distanceCommand(s, m, commandText)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommand: \"sphere\",\n\t\t\t\t\tTemplate: \"sphere **sys1** 14.33ly\",\n\t\t\t\t\tDescription: \"Returns a list of systems within a specified distance to specified system.\",\n\t\t\t\t\tExecute: func(s *discordgo.Session, m *discordgo.MessageCreate, commandText string) {\n\t\t\t\t\t\tplugin.sphereCommand(s, m, commandText)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tapi: NewAPIClient(debugMode),\n\t}\n\n\tqilbot.AddPlugin(plugin)\n\n\tqilbot.AddCommand(&plugin.Commands[0])\n\tqilbot.AddCommand(&plugin.Commands[1])\n\n\treturn\n}", "title": "" }, { "docid": "9acfd02fc69fbf9dcb43e18d4be85e0e", "score": "0.56732064", "text": "func NewPlugin() derive.Plugin {\n\treturn derive.NewPlugin(\"fmap\", \"deriveFmap\", New)\n}", "title": "" }, { "docid": "f9320722699dfc8e1913a31b20143634", "score": "0.5652492", "text": "func NewPlugin(pluginConfig pluginutil.PluginConfig) (*Plugin, error) {\n\tvar plugin Plugin\n\tplugin.MaxStdoutLength = pluginConfig.MaxStdoutLength\n\tplugin.MaxStderrLength = pluginConfig.MaxStderrLength\n\tplugin.StdoutFileName = pluginConfig.StdoutFileName\n\tplugin.StderrFileName = pluginConfig.StderrFileName\n\tplugin.OutputTruncatedSuffix = pluginConfig.OutputTruncatedSuffix\n\tplugin.ExecuteUploadOutputToS3Bucket = pluginutil.UploadOutputToS3BucketExecuter(plugin.UploadOutputToS3Bucket)\n\n\treturn &plugin, nil\n}", "title": "" }, { "docid": "17b1acebd0a57ecb89a762f08f2b7680", "score": "0.5614309", "text": "func New(client pluginsinterface.PluginClientset, arguments []string) pluginsinterface.PluginInterface {\n\tp := sshPlugin{\n\t\tpluginArguments: arguments,\n\t\tclient: client,\n\t\tsshKeyFilePath: SSHAbsolutePath,\n\t}\n\n\tp.addFlags()\n\n\treturn &p\n}", "title": "" }, { "docid": "e0f176dce8853eb8ccf908816e6c81ba", "score": "0.56092507", "text": "func InitializePlugin() {\n}", "title": "" }, { "docid": "c7c07629df20488467ce3c59031d283c", "score": "0.5596886", "text": "func NewPlugin(idGenerator ext.IDGenerator, config Config) vulnerabilityreport.Plugin {\n\treturn &scanner{\n\t\tidGenerator: idGenerator,\n\t\tconfig: config,\n\t\tconverter: NewConverter(config),\n\t}\n}", "title": "" }, { "docid": "ff4ca36cb7c556907b9f35fb17c9be90", "score": "0.55894196", "text": "func New(path string) (plugin.Plugin, error) {\n\treturn plugin.NewWithConfig(Plugin, config.Config{\"path\": path})\n}", "title": "" }, { "docid": "ab9929e7006cd3cb8d7c94fd0003b486", "score": "0.5583846", "text": "func getPluginWithNameAndURL(name, url string) string {\n\treturn fmt.Sprintf(`\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/open-policy-agent/opa/plugins\"\n\t\"github.com/open-policy-agent/opa/util\"\n\t\"github.com/open-policy-agent/opa/runtime\"\n)\n\nvar Name = \"%v\"\n\ntype Tester struct {}\n\nfunc (t *Tester) Start(ctx context.Context) error {\n\t_, err := http.Get(\"%v\")\n\treturn err\n}\n\nfunc (t *Tester) Stop(ctx context.Context) {\n\treturn\n}\n\nfunc (t *Tester) Reconfigure(ctx context.Context, config interface{}) {\n\treturn\n}\n\ntype Config struct { Key string }\n\ntype Factory struct {}\n\nfunc (f Factory) Validate(_ *plugins.Manager, config []byte) (interface{}, error) {\n\ttest := Config{}\n\n\tif err := util.Unmarshal(config, &test); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif test.Key != \"secret\" {\n\t\treturn nil, fmt.Errorf(\"got \" + test.Key + \", expected secret\")\n\t}\n\n return test, nil\n}\n\nfunc (f Factory) New(_ *plugins.Manager, config interface{}) plugins.Plugin {\n\treturn &Tester{}\n}\n\nfunc Init() error {\n\truntime.RegisterPlugin(Name, Factory{})\n\treturn nil\n}\n`, name, url)\n}", "title": "" }, { "docid": "130393d3a2134b5dbb1c52cf799e83fa", "score": "0.5583529", "text": "func InitPlugin(mbc *context.MultiBotContext) error {\n\tctx = mbc\n\toptions = ctx.GetOptions(GetName())\n\tif st, ok := options[\"files_dir\"]; ok && st != nil {\n\t\tfilesDir = st.(string)\n\t}\n\tif st, ok := options[\"secret_length\"]; ok && st != nil {\n\t\tsecretPhraseLength = st.(int64)\n\t}\n\tif err := ctx.DBCreateTable(&File{}); err != nil {\n\t\tctx.Log().Errorf(\"Unable to create table for files: %s\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d787752722afbef22a9f4bc6feb4dc52", "score": "0.5579785", "text": "func New(obj runtime.Object, handle framework.Handle) (framework.Plugin, error) {\n\twaitDuration, err := time.ParseDuration(waitMsec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AtomicDeploymentPlugin{\n\t\twaitDuration: waitDuration,\n\t\tframeworkHandle: handle,\n\t}, nil\n}", "title": "" }, { "docid": "3f4fdab81e9b13a8b4b0e03717a5442a", "score": "0.5570574", "text": "func NewLocalPlugin(name, addr string) *Plugin {\n\treturn &Plugin{\n\t\tname: name,\n\t\tAddr: addr,\n\t\t// TODO: change to nil\n\t\tTLSConfig: &tlsconfig.Options{InsecureSkipVerify: true},\n\t\tactivateWait: sync.NewCond(&sync.Mutex{}),\n\t}\n}", "title": "" }, { "docid": "0065e5db8f0da0189a69a6acae6e9f42", "score": "0.55685586", "text": "func New() *Auth {\n\treturn &Auth{}\n}", "title": "" }, { "docid": "fb3054774d19b5e095aaa3022161fc00", "score": "0.5565672", "text": "func New(ctx *context.T, host string) (idiscovery.Plugin, error) {\n\treturn newWithTTL(ctx, host, defaultTTL)\n}", "title": "" }, { "docid": "f1adbdba0e55c203329b2affe34c98f2", "score": "0.5561183", "text": "func NewPlugin(informer cache.SharedIndexInformer, cfg *config.Config, logger log.Logger) (Vali, error) {\n\tvar err error\n\tvali := &vali{cfg: cfg, logger: logger}\n\n\tvali.defaultClient, err = client.NewClient(*cfg, logger, client.Options{\n\t\tRemoveTenantID: cfg.PluginConfig.DynamicTenant.RemoveTenantIdWhenSendingToDefaultURL,\n\t\tMultiTenantClient: false,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(cfg.PluginConfig.DynamicHostPath) > 0 {\n\t\tvali.dynamicHostRegexp = regexp.MustCompile(cfg.PluginConfig.DynamicHostRegex)\n\n\t\tcfgShallowCopy := *cfg\n\t\tcfgShallowCopy.ClientConfig.BufferConfig.DqueConfig.QueueName = cfg.ClientConfig.BufferConfig.DqueConfig.QueueName + \"-controller\"\n\t\tcontrollerDefaultClient, err := client.NewClient(cfgShallowCopy, logger, client.Options{\n\t\t\tRemoveTenantID: cfg.PluginConfig.DynamicTenant.RemoveTenantIdWhenSendingToDefaultURL,\n\t\t\tMultiTenantClient: false,\n\t\t\tPreservedLabels: cfg.PluginConfig.PreservedLabels,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvali.controller, err = controller.NewController(informer, cfg, controllerDefaultClient, logger)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif cfg.PluginConfig.KubernetesMetadata.FallbackToTagWhenMetadataIsMissing {\n\t\tvali.extractKubernetesMetadataRegexp = regexp.MustCompile(cfg.PluginConfig.KubernetesMetadata.TagPrefix + cfg.PluginConfig.KubernetesMetadata.TagExpression)\n\t}\n\n\tif cfg.PluginConfig.DynamicTenant.Tenant != \"\" && cfg.PluginConfig.DynamicTenant.Field != \"\" && cfg.PluginConfig.DynamicTenant.Regex != \"\" {\n\t\tvali.dynamicTenantRegexp = regexp.MustCompile(cfg.PluginConfig.DynamicTenant.Regex)\n\t\tvali.dynamicTenant = cfg.PluginConfig.DynamicTenant.Tenant\n\t\tvali.dynamicTenantField = cfg.PluginConfig.DynamicTenant.Field\n\t}\n\n\treturn vali, nil\n}", "title": "" }, { "docid": "f7eeb10c7492cbd7d5db126dfd5ef123", "score": "0.55518997", "text": "func (pc *Controller) newPluginClient(pluginEntry *models.Plugin) (*Client, error) {\n\n\t// pluginEntry.ServiceLabels\n\tss := strings.Split(pluginEntry.ServiceEndpoint, \":\")\n\tif len(ss) < 2 {\n\t\treturn nil, errors.Errorf(\"unable get service name, %+v\", pluginEntry.ServiceEndpoint)\n\t}\n\t// TODO: empty namespace means that serviceaccount of analyze pod\n\t// need to have access to all namespaces to list services?\n\tservice, err := pc.kubeClient.GetService(ss[0], \"\", pluginEntry.ServiceLabels)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"unable to find service for registered plugin, %+v\", pluginEntry)\n\t}\n\n\tvar servicePort string\n\tfor _, port := range service.Spec.Ports {\n\t\tif port.Name == \"grpc\" {\n\t\t\tservicePort = strconv.Itoa(int(port.Port))\n\t\t}\n\t}\n\n\tif servicePort == \"\" {\n\t\treturn nil, errors.Errorf(\n\t\t\t\"unable to find service port for plugin, %+v, list of ports: %+v\",\n\t\t\tpluginEntry,\n\t\t\tservice.Spec.Ports,\n\t\t)\n\t}\n\n\tpluginClient, err := NewClient(service.Spec.ClusterIP + \":\" + servicePort)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"unable to instantiate pluginClient client for entity, %+v\", pluginEntry)\n\t}\n\n\treturn pluginClient, nil\n}", "title": "" }, { "docid": "f5c7c564da1bb9acbde50feae5d8cec2", "score": "0.55409586", "text": "func NewPluginClient(secret string) *PluginClient {\n\treturn &PluginClient{\n\t\tsecret: secret,\n\t}\n}", "title": "" }, { "docid": "c9820fa48c2da02f4c233d37eb8fc954", "score": "0.553281", "text": "func New(auth structs.Auth) Config {\n\ta := Config{\n\t\tAuth: auth,\n\t}\n\treturn a\n}", "title": "" }, { "docid": "8d15fb306051dfb931844e698356e9c0", "score": "0.55209106", "text": "func New(qChan qtypes_qchannel.QChan, cfg *config.Config, name string) (Plugin, error) {\n\tp := qtypes_plugin.NewNamedPlugin(qChan, cfg, pluginTyp, pluginPkg, name, version)\n\tesp := Plugin{\n\t\tPlugin: p,\n\t\tbuffer: make(chan interface{}, 1000),\n\t}\n\tnameSplit := strings.Split(p.Name, \"_\")\n\tidxDef := esp.Name\n\tif len(nameSplit) != 0 {\n\t\tidxDef = nameSplit[len(nameSplit)-1]\n\t}\n\tidx := p.CfgStringOr(\"index-prefix\", idxDef)\n\tesp.ParseKVtoFields()\n\tesp.ParseSkipKV()\n\tesp.indexPrefix = idx\n\tesp.last = time.Now().Add(-24 * time.Hour)\n\treturn esp, nil\n}", "title": "" }, { "docid": "d50ae6a90d61c7e44e32763439832316", "score": "0.5496675", "text": "func (t *Tstore) PluginRegister(b backend.Backend, p backend.Plugin) error {\n\tlog.Tracef(\"PluginRegister: %v\", p.ID)\n\n\tvar (\n\t\tpluginClient plugins.PluginClient\n\t\terr error\n\n\t\tdataDir = filepath.Join(t.dataDir, pluginDataDirname)\n\t)\n\tswitch p.ID {\n\tcase cmplugin.PluginID:\n\t\ttstoreClient := NewTstoreClient(t, cmplugin.PluginID)\n\t\tpluginClient, err = comments.New(tstoreClient,\n\t\t\tp.Settings, dataDir, p.Identity)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase ddplugin.PluginID:\n\t\tpluginClient, err = dcrdata.New(p.Settings, t.activeNetParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase piplugin.PluginID:\n\t\ttstoreClient := NewTstoreClient(t, piplugin.PluginID)\n\t\tpluginClient, err = pi.New(b, tstoreClient,\n\t\t\tp.Settings, dataDir, p.Identity)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase tkplugin.PluginID:\n\t\ttstoreClient := NewTstoreClient(t, tkplugin.PluginID)\n\t\tpluginClient, err = ticketvote.New(b, tstoreClient,\n\t\t\tp.Settings, dataDir, p.Identity, t.activeNetParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase umplugin.PluginID:\n\t\ttstoreClient := NewTstoreClient(t, umplugin.PluginID)\n\t\tpluginClient, err = usermd.New(tstoreClient, p.Settings, dataDir)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn backend.ErrPluginIDInvalid\n\t}\n\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tt.plugins[p.ID] = plugin{\n\t\tid: p.ID,\n\t\tclient: pluginClient,\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "33e7d0a1d47f1c85be91b2d209ad7592", "score": "0.54839677", "text": "func NewPluginFactory(engine engine.Engine, ctx *rt.EngineContext) PluginFactory {\n\treturn &pluginManager{\n\t\t// List your plugins here\n\t\tfactories: []PluginFactory{\n\t\t\t// Success plugin ensures task is declared \"failed\" if execution isn't\n\t\t\t// success (exit code non-zero in most cases)\n\t\t\tsuccess.NewPluginFactory(engine, ctx),\n\t\t\t// Dummy plugin that does absolutely nothing always added to make sure\n\t\t\t// that it doesn't have any side-effects\n\t\t\tPluginBase{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c9ec18a97ed445a89f134b18eebffcfa", "score": "0.5477317", "text": "func New(cfg *Config, logger logger.Logger, registerer prometheus.Registerer) (pluginregistry.StoragePlugin, error) {\n\ts := &Plugin{\n\t\tcfg: cfg,\n\t\tregisterer: registerer,\n\t\tLogger: logger.NewLogger(\"redisPlugin\"),\n\t\tannouncement: make(chan struct{}, 10),\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "db1069342da1bb5d9d1db437ff39fd8b", "score": "0.5475406", "text": "func NewAddCommandPlugin(\n\tircClient client.TwitchClientT, repo repository.SingleBotRepositoryT) chatplugins.ChatCommandPluginT {\n\treturn &AddCommandPlugin{ircClient: ircClient, repo: repo}\n}", "title": "" }, { "docid": "708ec5ae909eeddb78f627aea45ebb9b", "score": "0.54553676", "text": "func New(handle interfaces.FrameworkHandle) (interfaces.Plugin, error) {\n\treturn &RegionAndAz{handle: handle}, nil\n}", "title": "" }, { "docid": "0f2f546abf5c96872748bc1c1157b87f", "score": "0.5455226", "text": "func NewAuth() *Auth {\n\treturn &Auth{}\n}", "title": "" }, { "docid": "0f2f546abf5c96872748bc1c1157b87f", "score": "0.5455226", "text": "func NewAuth() *Auth {\n\treturn &Auth{}\n}", "title": "" }, { "docid": "75d799c7fa0c6638ee93c1d08ff4abfe", "score": "0.545445", "text": "func New(engine *gin.Engine, providers map[string]Provider, jwtSettings *JWTSettings) resource.Routable {\n\tauthentication := &authentication{group: engine.Group(\"/\"), providers: providers, jwtSettings: jwtSettings}\n\t{\n\t\tauthentication.group.GET(\"/public/authenticate/:provider/:tokenString\", authentication.publicAuthenticate)\n\t\tauthentication.group.GET(\"/private/authenticate/:tokenString\", authentication.privateAuthenticate)\n\t}\n\treturn authentication\n}", "title": "" }, { "docid": "fa1ffd13d489b80e3f80b26d7ea90976", "score": "0.5448341", "text": "func (eh sendToPluginEventHandler) New() interface{} {\n\treturn &SendToPluginEvent{}\n}", "title": "" }, { "docid": "b3dfc281ac22d5e23f5cda3a5276b73c", "score": "0.54367584", "text": "func newExamplePlugin(plugin *gobgp.Plugin) *pluginExample {\n\tcloseCh := make(chan struct{})\n\treturn &pluginExample{\n\t\tPluginInfraDeps: *flavor.InfraDeps(examplePluginName),\n\t\tgoBgpPlugin: plugin,\n\t\tcloseCh: closeCh}\n}", "title": "" }, { "docid": "888cd958bfb3ef81e8e1128e99d2fdd7", "score": "0.541322", "text": "func New(discord *bruxism.Discord) bruxism.Plugin {\n\treturn &MeetupsPlugin{\n\t\tdiscord: discord,\n\t}\n}", "title": "" }, { "docid": "e4d9768dab4a72e516ac18b037f2a74c", "score": "0.53900796", "text": "func newCmdPluginAdd(ctx api.Context) *cobra.Command {\n\tinstallOpts := &plugin.InstallOpts{}\n\tcmd := &cobra.Command{\n\t\tUse: \"add <resource>\",\n\t\tShort: \"Add a CLI plugin\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcluster, err := ctx.Cluster()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tp, err := ctx.PluginManager(cluster).Install(args[0], installOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Fprintf(ctx.ErrOut(), \"New commands available: %s\\n\", strings.Join(p.CommandNames(), \", \"))\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.Flags().BoolVarP(&installOpts.Update, \"update\", \"u\", false, \"\")\n\treturn cmd\n}", "title": "" }, { "docid": "817d98090d8eb7d1163b60a3a271643e", "score": "0.53860056", "text": "func purple_init_plugin(plugin *C.PurplePlugin) C.gboolean {\n\tlog.Println(plugin, MyTid2())\n\truntime.LockOSThread()\n\n\t// _plugin_instance = NewPlugin()\n\tif _plugin_instance == nil {\n\t\tlog.Panicln(\"failed\")\n\t}\n\tplugin.info = _plugin_instance.cppi\n\n\t_plugin_instance.init(plugin)\n\t// var init_func = init_plugin\n\t// init_func(plugin)\n\treturn C.purple_plugin_register(plugin)\n}", "title": "" }, { "docid": "bcc445823dfe3753b7a9c73459559aaf", "score": "0.53831726", "text": "func newRhpPluginImpl() rhpPluginImpl {\n\treturn rhpPluginImpl{\n\t\tfunc() string { return \"\" },\n\t\tfunc(_ interface{}) (interface{}, error) { return nil, nil },\n\t\tfunc(_ string, _ string, _ url.Values, _ RhpHandleListReqLookupFunc) (string, error) { return \"\", nil },\n\t}\n}", "title": "" }, { "docid": "891796d2b038f5deec98e3994d395406", "score": "0.5369944", "text": "func (ph *PluginHandler) Add(plugin *data.Plugin) (*data.Plugin, error) {\n\trespPlugin := &data.Plugin{}\n\n\t// By default we'll be creating a global plugin\n\tpath := pluginsRootPath\n\n\t// If we're only applying it to an api, use the apis\n\t// plugin endpoint\n\tif plugin.ApiID != \"\" && plugin.ConsumerID == \"\" {\n\t\tpath = fmt.Sprintf(\"%s/%s%s\", apisRootPath, plugin.ApiID, path)\n\n\t\t// We need to reset the ApiID so that we don't\n\t\t// send it in the json request body\n\t\tplugin.ApiID = \"\"\n\t}\n\n\tpluginError := &PluginApiError{}\n\n\t_, err := ph.Kong.Client.Post(path).BodyJSON(plugin).Receive(respPlugin, pluginError)\n\n\tif err != nil {\n\t\treturn &data.Plugin{}, err\n\t}\n\n\tif (PluginApiError{}) != *pluginError {\n\t\treturn &data.Plugin{}, errors.New(\"Encountered an error when making the request\")\n\t}\n\n\treturn respPlugin, nil\n}", "title": "" }, { "docid": "b7fbfad9658595f03f436d64ac5a3740", "score": "0.53453785", "text": "func (_m *ISessionPluginFactory) Create(_a0 context.T) (SessionPlugin, error) {\n\targs := _m.Called(_a0)\n\treturn args.Get(0).(SessionPlugin), args.Error(1)\n}", "title": "" } ]
535b3fea7cdda0016adb98990eb43a53
LsaGeneration returns from NetworkInstance_Protocol_Ospfv2_Global_TimersAny the path struct for its child "lsageneration".
[ { "docid": "f8baf4c60b2824ad70feca857fd019ca", "score": "0.7904156", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_TimersAny) LsaGeneration() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGenerationAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGenerationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
[ { "docid": "7314ea15a3b99724503f7a4019137cac", "score": "0.79211146", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers) LsaGeneration() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7314ea15a3b99724503f7a4019137cac", "score": "0.79209864", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers) LsaGeneration() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bbc5649b847bbadf7117e3a34d817482", "score": "0.70992035", "text": "func (n *NetworkInstance_Protocol_Isis_Global_TimersAny) LspGeneration() *NetworkInstance_Protocol_Isis_Global_Timers_LspGenerationAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGenerationAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsp-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "34fada9c9acce63a04d5567729da5e09", "score": "0.6923102", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspGeneration() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsp-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "34fada9c9acce63a04d5567729da5e09", "score": "0.6922341", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspGeneration() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsp-generation\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cff50fcea94e7c541a78ec01e56d6f1e", "score": "0.67039245", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e61aa9d2cf357dd4642a864cebd73363", "score": "0.6312775", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b60c0ef3692694f6ce46f7bbed001dd7", "score": "0.6102861", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny) Lsa(LinkStateId string) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsas\", \"lsa\"},\n\t\t\tmap[string]interface{}{\"link-state-id\": LinkStateId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0f60364a1e1bf2cd450e3e808c65925e", "score": "0.6092153", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "0f60364a1e1bf2cd450e3e808c65925e", "score": "0.6092153", "text": "func (*NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "2dcc357dd9315a89806970cf4373d2db", "score": "0.59347224", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Lsa(LinkStateId string) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsas\", \"lsa\"},\n\t\t\tmap[string]interface{}{\"link-state-id\": LinkStateId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2dcc357dd9315a89806970cf4373d2db", "score": "0.59347224", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Lsa(LinkStateId string) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsas\", \"lsa\"},\n\t\t\tmap[string]interface{}{\"link-state-id\": LinkStateId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3e8650ea4ceb01b512858615bc04e144", "score": "0.5875239", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) LsaAny() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsas\", \"lsa\"},\n\t\t\tmap[string]interface{}{\"link-state-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "41b7ded051670d5652e72f0f30504b55", "score": "0.57508606", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) RouterLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"router-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "41b7ded051670d5652e72f0f30504b55", "score": "0.5750141", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) RouterLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"router-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "94dcfaa6e286ba576d1ac6b24ffaf054", "score": "0.56566787", "text": "func (s *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c67d2f4b9efb0c3d92fae657f37bc2a9", "score": "0.56371623", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny) RouterLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"router-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "435d89e3eacbbfcc5c4cb95a831005c4", "score": "0.5624076", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) NetworkLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"network-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "435d89e3eacbbfcc5c4cb95a831005c4", "score": "0.56222796", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) NetworkLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"network-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ab57a0e3b752d8139cb22d9fc10f81c6", "score": "0.5588717", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) TimerType() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerType {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"timer-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ab57a0e3b752d8139cb22d9fc10f81c6", "score": "0.5588717", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration) TimerType() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerType {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"timer-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2cc428a8df51c9cbbc7baa2b51b24ba5", "score": "0.55839574", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_LsdbAny) LsaType(Type oc.E_OpenconfigOspfTypes_OSPF_LSA_TYPE) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-types\", \"lsa-type\"},\n\t\t\tmap[string]interface{}{\"type\": Type},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3cd9f8b2ed0e14348b2c10697716df00", "score": "0.5557276", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb) LsaTypeAny() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-types\", \"lsa-type\"},\n\t\t\tmap[string]interface{}{\"type\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "45c4c2240f76f46ad161426a78a41f0c", "score": "0.5549457", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny) NetworkLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"network-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6112d63af258778b5b76d192a5f168c6", "score": "0.5541412", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny) LsaAny() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsas\", \"lsa\"},\n\t\t\tmap[string]interface{}{\"link-state-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3aac4706b99f0425103c1e8f61bc5900", "score": "0.55286807", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb) LsaType(Type oc.E_OpenconfigOspfTypes_OSPF_LSA_TYPE) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-types\", \"lsa-type\"},\n\t\t\tmap[string]interface{}{\"type\": Type},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3aac4706b99f0425103c1e8f61bc5900", "score": "0.5527178", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb) LsaType(Type oc.E_OpenconfigOspfTypes_OSPF_LSA_TYPE) *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-types\", \"lsa-type\"},\n\t\t\tmap[string]interface{}{\"type\": Type},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "248318196170529b6f71c15dfe8d7e22", "score": "0.5519017", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "248318196170529b6f71c15dfe8d7e22", "score": "0.55180043", "text": "func (*NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) IsYANGGoStruct() {}", "title": "" }, { "docid": "ce97b0d808327271cc4bc8684a3820c9", "score": "0.55017304", "text": "func (n *NetworkInstance_Protocol_Ospfv2_AreaAny) Lsdb() *NetworkInstance_Protocol_Ospfv2_Area_LsdbAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_LsdbAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsdb\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "43ff7da415cd21692f39645ad88af6ff", "score": "0.54467404", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGenerationAny) LspMaxWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-max-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a269be29397f1fa83fdb6d68a544555e", "score": "0.5420108", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGenerationAny) TimerType() *NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerTypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_LsaGeneration_TimerTypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"timer-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e6a871980aadbc59eb817b2d2566c9ec", "score": "0.5418717", "text": "func (s *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4eae8c1fc1eca82ac040a4df35efe0d", "score": "0.54157156", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area) Lsdb() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsdb\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c4eae8c1fc1eca82ac040a4df35efe0d", "score": "0.54157156", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area) Lsdb() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsdb\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ccd50a7f196f14fc94d8d55ad0be5a45", "score": "0.5399306", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsaAny) GraceLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"grace-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "31f358a8f819defc556501ee7fe8a96c", "score": "0.53764963", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "31f358a8f819defc556501ee7fe8a96c", "score": "0.53764963", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5ebcc4dfff2416477e0b07f4b8b4c029", "score": "0.5374029", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspMaxWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-max-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5ebcc4dfff2416477e0b07f4b8b4c029", "score": "0.537375", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspMaxWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspMaxWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-max-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a4496a2cc9f2cd755240282e1b1a5aea", "score": "0.53280956", "text": "func (gc *GenerateConfiguration) SRTPath() string {\n\treturn gc.srtPath\n}", "title": "" }, { "docid": "4c8ef92707fbfa6bbbf48b4a62e7f052", "score": "0.53198016", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_LsdbAny) LsaTypeAny() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaTypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"lsa-types\", \"lsa-type\"},\n\t\t\tmap[string]interface{}{\"type\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b0fe7b87f14d00dfb2377b3dbcbb2632", "score": "0.52189475", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) GraceLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"grace-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b0fe7b87f14d00dfb2377b3dbcbb2632", "score": "0.5218573", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) GraceLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"grace-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6dbedc742587eb87471fe35fdf1478fc", "score": "0.5197063", "text": "func (n *NetworkInstance_Protocol_Isis_Global_TimersAny) LspLifetimeInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-lifetime-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7f1163143c4f5da7d003edef663a11b2", "score": "0.51815367", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny) SequenceNumber() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumberAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumberAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"sequence-number\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "66a4a52e38284b04fcc906c16f18ff65", "score": "0.51590174", "text": "func (n *NetworkInstance_Protocol_Isis_Global_TimersAny) LspRefreshInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-refresh-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "16c194ad159d36eef98867cfe14a8143", "score": "0.51117575", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGenerationAny) LspSecondWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-second-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a68503eaeb545d62f663a1c0ffda2f95", "score": "0.50788087", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspLifetimeInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-lifetime-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a68503eaeb545d62f663a1c0ffda2f95", "score": "0.50774634", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspLifetimeInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-lifetime-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "fa26b090d7a46924be5e6d5177b31119", "score": "0.5075653", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) SummaryLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"summary-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "fa26b090d7a46924be5e6d5177b31119", "score": "0.5075653", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) SummaryLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"summary-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2b222ce2de4eed10b4313422c10d4506", "score": "0.50735253", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsaAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "13464136dbf3fb716093090d35b15d1b", "score": "0.50717604", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_GlobalAny) LsrId() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrIdAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrIdAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsr-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d6031bd3f251ed9a0b7c6d04ac1d4f0", "score": "0.5071216", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspRefreshInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-refresh-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d6031bd3f251ed9a0b7c6d04ac1d4f0", "score": "0.5069929", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers) LspRefreshInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-refresh-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7570db8ba09aa3a83c111dc66caee74a", "score": "0.5066254", "text": "func (n *NetworkInstance_Protocol_Isis_Level) LspAny() *NetworkInstance_Protocol_Isis_Level_LspAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_LspAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-state-database\", \"lsp\"},\n\t\t\tmap[string]interface{}{\"lsp-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a43407b6c65b6c531bd059a93ddc2f4f", "score": "0.5064314", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisementAny) Lifetime() *Interface_Subinterface_Ipv6_RouterAdvertisement_LifetimeAny {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_LifetimeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "845d2443baef3c13d74ea2f38ca53526", "score": "0.5058423", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Global) LsrId() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrId {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsr-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "845d2443baef3c13d74ea2f38ca53526", "score": "0.5057873", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Global) LsrId() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrId {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Global_LsrId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsr-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ef55656f62cdb42591184b59d191035b", "score": "0.50319487", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspFirstWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-first-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4bffcf75f7a2e752005ebe4c2971d22f", "score": "0.5031468", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) SequenceNumber() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumber {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumber{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"sequence-number\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4bffcf75f7a2e752005ebe4c2971d22f", "score": "0.5030381", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) SequenceNumber() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumber {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SequenceNumber{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"sequence-number\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ef55656f62cdb42591184b59d191035b", "score": "0.5027271", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspFirstWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-first-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "856f63d10736cf34b48f44ba1d1dcc7a", "score": "0.5007682", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspSecondWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-second-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "856f63d10736cf34b48f44ba1d1dcc7a", "score": "0.50074226", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration) LspSecondWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitInterval {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspSecondWaitInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-second-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "14c4485a0f8ea407a088034f457394f2", "score": "0.49891943", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a51e10f58e09bc1ff07e8210242f784", "score": "0.49804813", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "8a51e10f58e09bc1ff07e8210242f784", "score": "0.49795967", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) IsYANGGoStruct() {}", "title": "" }, { "docid": "2ca7116e90d66b16d35edbd42508879c", "score": "0.4974199", "text": "func (n *NetworkInstance_Protocol_Isis_LevelAny) Lsp(LspId string) *NetworkInstance_Protocol_Isis_Level_LspAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_LspAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-state-database\", \"lsp\"},\n\t\t\tmap[string]interface{}{\"lsp-id\": LspId},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b58dbccb1b71249dfb5c0121073ae8b7", "score": "0.49664384", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisementAny) Lifetime() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_LifetimeAny {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_LifetimeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b0e37d341c7746e8755808096febf178", "score": "0.4947651", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) OpaqueLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"opaque-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b0e37d341c7746e8755808096febf178", "score": "0.4947651", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) OpaqueLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"opaque-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9ab439c7bd10b9c91e92645287eab86d", "score": "0.49129796", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9ab439c7bd10b9c91e92645287eab86d", "score": "0.49117887", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2544e26e9576c228314b080a6e67e78e", "score": "0.4904642", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Timers_LspGenerationAny) LspFirstWaitInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspGeneration_LspFirstWaitIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-first-wait-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "586ea8010024dcf70a622bd950c2bd15", "score": "0.4903034", "text": "func (n *NetworkInstance_Protocol_Isis_LevelAny) LspAny() *NetworkInstance_Protocol_Isis_Level_LspAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_LspAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"link-state-database\", \"lsp\"},\n\t\t\tmap[string]interface{}{\"lsp-id\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d7b25dd019fd627e8aa24d83a0fc0590", "score": "0.48946235", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) Ipv4SrlgAny() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4SrlgAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4SrlgAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"ipv4-srlgs\", \"ipv4-srlg\"},\n\t\t\tmap[string]interface{}{\"instance-number\": \"*\"},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bc2e0d5dbe54410feaf606177cbaa39c", "score": "0.4889804", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisement) Lifetime() *Interface_Subinterface_Ipv6_RouterAdvertisement_Lifetime {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_Lifetime{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bc2e0d5dbe54410feaf606177cbaa39c", "score": "0.48888192", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisement) Lifetime() *Interface_Subinterface_Ipv6_RouterAdvertisement_Lifetime {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_Lifetime{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "fc0418f0d401d418858ff0fed65d44ad", "score": "0.48803404", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_LsaAny) SummaryLsa() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsaAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsaAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"summary-lsa\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e28ef74ecf2f30ba0f82400eb4bf66e4", "score": "0.48754126", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e28ef74ecf2f30ba0f82400eb4bf66e4", "score": "0.48742667", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d000cdb9495bcb1abe49205c3740b750", "score": "0.48741144", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) NewLsa(LinkStateId string) (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Lsa == nil {\n\t\tt.Lsa = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa)\n\t}\n\n\tkey := LinkStateId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Lsa[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Lsa\", key)\n\t}\n\n\tt.Lsa[key] = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa{\n\t\tLinkStateId: &LinkStateId,\n\t}\n\n\treturn t.Lsa[key], nil\n}", "title": "" }, { "docid": "d000cdb9495bcb1abe49205c3740b750", "score": "0.48740333", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) NewLsa(LinkStateId string) (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Lsa == nil {\n\t\tt.Lsa = make(map[string]*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa)\n\t}\n\n\tkey := LinkStateId\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Lsa[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Lsa\", key)\n\t}\n\n\tt.Lsa[key] = &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa{\n\t\tLinkStateId: &LinkStateId,\n\t}\n\n\treturn t.Lsa[key], nil\n}", "title": "" }, { "docid": "3d10bff565ab981c28bc70a7ff080a63", "score": "0.48494074", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_Link_SubTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "acba9b53a56d67753eb7382fa015580e", "score": "0.48391345", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NetworkLsa\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a2b2b3d0527993574765db4fcdc9396", "score": "0.4820616", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6a2b2b3d0527993574765db4fcdc9396", "score": "0.4820616", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7596e0cdb74625750a4f8fe496b496f7", "score": "0.48174575", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7596e0cdb74625750a4f8fe496b496f7", "score": "0.48174575", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) LinkId() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_LinkId{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"link-id\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "223bdff854515e6a790d1e2975f97c1e", "score": "0.48171425", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "223bdff854515e6a790d1e2975f97c1e", "score": "0.48171425", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7b42162315c95f2d53834c0832e62e0", "score": "0.4811195", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) Metric() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Metric {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Metric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c4a3f0bfd93d97eda5b8eef1a956bd39", "score": "0.4809482", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c7b42162315c95f2d53834c0832e62e0", "score": "0.4809282", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) Metric() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Metric {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa_Metric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f7f2758902202e0f6b8112d0a486bbf5", "score": "0.48059377", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisement) Lifetime() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_Lifetime {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_Lifetime{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f7f2758902202e0f6b8112d0a486bbf5", "score": "0.48041365", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisement) Lifetime() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_Lifetime {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_Lifetime{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lifetime\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "33a58ad5b2fed432d033a0353c651d78", "score": "0.48017418", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "33a58ad5b2fed432d033a0353c651d78", "score": "0.4799882", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
8c4f42e24b857114fd7153a6f2519906
DeleteLaunchTemplateRequest indicates an expected call of DeleteLaunchTemplateRequest
[ { "docid": "1b1b9456f7c0ee02c29d8172f76ef76f", "score": "0.7270879", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplateRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplateRequest\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplateRequest), arg0)\n}", "title": "" } ]
[ { "docid": "f33e761e6ab7d913661b076b89213231", "score": "0.72730213", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplate(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplate\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplate), arg0)\n}", "title": "" }, { "docid": "6ab28d7ae65b235c1da28111ce5c17a9", "score": "0.7163988", "text": "func (m *MockEC2) DeleteLaunchTemplate(request *ec2.DeleteLaunchTemplateInput) (*ec2.DeleteLaunchTemplateOutput, error) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tklog.V(2).Infof(\"Mock DeleteLaunchTemplate: %v\", request)\n\n\to := &ec2.DeleteLaunchTemplateOutput{}\n\n\tif m.LaunchTemplates == nil {\n\t\treturn o, nil\n\t}\n\tfor id := range m.LaunchTemplates {\n\t\tif id == aws.StringValue(request.LaunchTemplateId) {\n\t\t\tdelete(m.LaunchTemplates, id)\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "431ba866e2a8e44db567ae1fbd2aaac7", "score": "0.70828146", "text": "func (m *MockEC2Client) DeleteLaunchTemplateRequest(arg0 *ec2.DeleteLaunchTemplateInput) (*request.Request, *ec2.DeleteLaunchTemplateOutput) {\n\tret := m.ctrl.Call(m, \"DeleteLaunchTemplateRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DeleteLaunchTemplateOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "da697f543e6c6bebdd21d7e1b09157f6", "score": "0.6746364", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplateVersionsRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplateVersionsRequest\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplateVersionsRequest), arg0)\n}", "title": "" }, { "docid": "55784a13d1a17f075f8d028c03778192", "score": "0.6548042", "text": "func (m *MockEC2Client) DeleteLaunchTemplateVersionsRequest(arg0 *ec2.DeleteLaunchTemplateVersionsInput) (*request.Request, *ec2.DeleteLaunchTemplateVersionsOutput) {\n\tret := m.ctrl.Call(m, \"DeleteLaunchTemplateVersionsRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ec2.DeleteLaunchTemplateVersionsOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "52c43b1c09439d42b2d3515ed4fd1048", "score": "0.63810116", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplateVersions(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplateVersions\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplateVersions), arg0)\n}", "title": "" }, { "docid": "e78841fae54c2eadda2783f023c68863", "score": "0.63540727", "text": "func TestDeleteTemplate() {\n\tlog.Info(\"Start TestDeleteTemplate\")\n\tlog.Info(\"Delete analyze template\")\n\tvar res = invokeHTTPRequest(\"/api/v1/templates/test/analyze/test\", \"DELETE\", []byte(\"\"))\n\tlog.Info(res)\n\tlog.Info(\"Delete anonymize template\")\n\tres = invokeHTTPRequest(\"/api/v1/templates/test/anonymize/test\", \"DELETE\", []byte(\"\"))\n\tlog.Info(res)\n\tlog.Info(\"End TestDeleteTemplate\")\n}", "title": "" }, { "docid": "6ea0d2e8df8607840c0293761466f364", "score": "0.61539185", "text": "func (m *ManagedTenantsManagementTemplateStepsManagementTemplateStepItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ManagedTenantsManagementTemplateStepsManagementTemplateStepItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "eb775146fb5a931444dbe71c1326cd26", "score": "0.6153357", "text": "func (m *MockEC2Client) DeleteLaunchTemplate(arg0 *ec2.DeleteLaunchTemplateInput) (*ec2.DeleteLaunchTemplateOutput, error) {\n\tret := m.ctrl.Call(m, \"DeleteLaunchTemplate\", arg0)\n\tret0, _ := ret[0].(*ec2.DeleteLaunchTemplateOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "75ddbcb9e703a227f28efdd7305a4e9d", "score": "0.61312836", "text": "func (mr *MockBuildClientMockRecorder) DeleteTemplate(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteTemplate\", reflect.TypeOf((*MockBuildClient)(nil).DeleteTemplate), arg0, arg1)\n}", "title": "" }, { "docid": "016b3493b655e5fed46f7e3e84e495ac", "score": "0.597218", "text": "func (client *VirtualMachineTemplatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif virtualMachineTemplateName == \"\" {\n\t\treturn nil, errors.New(\"parameter virtualMachineTemplateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{virtualMachineTemplateName}\", url.PathEscape(virtualMachineTemplateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-06-05-preview\")\n\tif options != nil && options.Force != nil {\n\t\treqQP.Set(\"force\", strconv.FormatBool(*options.Force))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "67ba05461787ff78021f7bb13d961318", "score": "0.58979267", "text": "func (m *TeamTemplatesItemDefinitionsTeamTemplateDefinitionItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *TeamTemplatesItemDefinitionsTeamTemplateDefinitionItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "30bedf4e699771bac9d4ed499287ea9f", "score": "0.5766048", "text": "func (client *WordpressInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, phpWorkloadName string, options *WordpressInstancesClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif phpWorkloadName == \"\" {\n\t\treturn nil, errors.New(\"parameter phpWorkloadName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{phpWorkloadName}\", url.PathEscape(phpWorkloadName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-12-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "056433945fbcdbc6d3e421b86d694b89", "score": "0.5746396", "text": "func (r *SecurityBaselineTemplateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "042db9e019bfeffee6c7642ac4626e00", "score": "0.5743137", "text": "func (m *LabelsFilePlanReferencesFilePlanReferenceTemplateItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *LabelsFilePlanReferencesFilePlanReferenceTemplateItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "12e44559a3f5fe9de85fdfbcbeb1d2d1", "score": "0.5712784", "text": "func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, labName string, name string, options *VirtualMachinesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "7f7a93001e8855f94f3f14789d4ca7ab", "score": "0.5678357", "text": "func ExampleInspector_DeleteAssessmentTemplate_shared00() {\r\n\tsvc := inspector.New(session.New())\r\n\tinput := &inspector.DeleteAssessmentTemplateInput{\r\n\t\tAssessmentTemplateArn: aws.String(\"arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T\"),\r\n\t}\r\n\r\n\tresult, err := svc.DeleteAssessmentTemplate(input)\r\n\tif err != nil {\r\n\t\tif aerr, ok := err.(awserr.Error); ok {\r\n\t\t\tswitch aerr.Code() {\r\n\t\t\tcase inspector.ErrCodeInternalException:\r\n\t\t\t\tfmt.Println(inspector.ErrCodeInternalException, aerr.Error())\r\n\t\t\tcase inspector.ErrCodeInvalidInputException:\r\n\t\t\t\tfmt.Println(inspector.ErrCodeInvalidInputException, aerr.Error())\r\n\t\t\tcase inspector.ErrCodeAssessmentRunInProgressException:\r\n\t\t\t\tfmt.Println(inspector.ErrCodeAssessmentRunInProgressException, aerr.Error())\r\n\t\t\tcase inspector.ErrCodeAccessDeniedException:\r\n\t\t\t\tfmt.Println(inspector.ErrCodeAccessDeniedException, aerr.Error())\r\n\t\t\tcase inspector.ErrCodeNoSuchEntityException:\r\n\t\t\t\tfmt.Println(inspector.ErrCodeNoSuchEntityException, aerr.Error())\r\n\t\t\tdefault:\r\n\t\t\t\tfmt.Println(aerr.Error())\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\r\n\t\t\t// Message from an error.\r\n\t\t\tfmt.Println(err.Error())\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\r\n\tfmt.Println(result)\r\n}", "title": "" }, { "docid": "7cd5c89476eb86238e9d00c5fb4c36e7", "score": "0.5605766", "text": "func DeleteTemplate(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar templateId string\n\terr = flags.ParseFlag(cmd.Flags(), \"template-id\", &templateId)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"template-id\": ` + err.Error())\n\t}\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\terr = client.StreamsService.DeleteTemplate(templateId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1b765cca04ede63acb7b828b54942e74", "score": "0.55883193", "text": "func (mr *MockEC2ClientMockRecorder) ModifyLaunchTemplate(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ModifyLaunchTemplate\", reflect.TypeOf((*MockEC2Client)(nil).ModifyLaunchTemplate), arg0)\n}", "title": "" }, { "docid": "240a68024cf8db1d7386ef94134e8765", "score": "0.55858195", "text": "func (client *OnlineDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, options *OnlineDeploymentsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\tif deploymentName == \"\" {\n\t\treturn nil, errors.New(\"parameter deploymentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{deploymentName}\", url.PathEscape(deploymentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "2a2e0ec0c629b3d07bcc0e79d085c337", "score": "0.55707055", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplateVersionsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplateVersionsWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplateVersionsWithContext), varargs...)\n}", "title": "" }, { "docid": "4f1fe5b0b5bc4cc527891e1a6f142c4c", "score": "0.55681854", "text": "func (mr *MockEC2ClientMockRecorder) ModifyLaunchTemplateRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ModifyLaunchTemplateRequest\", reflect.TypeOf((*MockEC2Client)(nil).ModifyLaunchTemplateRequest), arg0)\n}", "title": "" }, { "docid": "6f94d21aa725f942834337a15611e298", "score": "0.5536527", "text": "func (client *VirtualNetworkTapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif tapName == \"\" {\n\t\treturn nil, errors.New(\"parameter tapName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tapName}\", url.PathEscape(tapName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "532f1324c9106d15a2509d71d3792846", "score": "0.55356616", "text": "func TestDeleteUserHandlerBeforeHookAbortsRequest(t *testing.T) {\n\tmockEnv := makeMockEnv()\n\n\tmockEnv.hook.BeforeDelete(func(env *env, input *dao.DeleteUserInput) *HookError {\n\t\treturn &HookError{http.StatusTeapot, errors.New(\"Example\")}\n\t})\n\n\t// Create a single user\n\t_, err := makeRequest(mockEnv, http.MethodPost, \"/user\", `{\"Name\": \"Jay\"}`, JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make request: %s\", err.Error())\n\t}\n\n\t// Delete that same user\n\tres, err := makeRequest(mockEnv, http.MethodDelete, fmt.Sprintf(\"/user/%s\", UUID0), \"\", JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make request: %s\", err.Error())\n\t}\n\n\tif res.Code != http.StatusTeapot {\n\t\tt.Errorf(\"Wrong status code: %v\", res.Code)\n\t}\n}", "title": "" }, { "docid": "62342e97711f8107b72517eb605429a0", "score": "0.55353814", "text": "func (client *NetworkTapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkTapName string, options *NetworkTapsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTaps/{networkTapName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif networkTapName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkTapName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkTapName}\", url.PathEscape(networkTapName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "097f736f59e98683eea7a556d80ae3e9", "score": "0.55110055", "text": "func (m *MockEC2Client) DeleteLaunchTemplateVersions(arg0 *ec2.DeleteLaunchTemplateVersionsInput) (*ec2.DeleteLaunchTemplateVersionsOutput, error) {\n\tret := m.ctrl.Call(m, \"DeleteLaunchTemplateVersions\", arg0)\n\tret0, _ := ret[0].(*ec2.DeleteLaunchTemplateVersionsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b905753dc1f7fed13441422420bf0bb6", "score": "0.5494269", "text": "func DeleteTemplate(Ob map[string]interface{}) *utils.Response {\n\tvar tem *model.Template\n\tvar ID string\n\tif _, ok := Ob[\"ID\"].(string); ok {\n\t\tID = Ob[\"ID\"].(string)\n\t\ttem = model.NewTemplate(ID)\n\t} else {\n\t\treturn utils.WITHOUT_PARAMETERS\n\t}\n\tif !tem.IsExist() {\n\t\treturn utils.TEMPLATE_NOT_EXIST\n\t}\n\tif err := tem.Delete(); err != nil {\n\t\treturn utils.NewResponse(utils.SYSTEM_CODE, err.Error(), nil)\n\t}\n\tt := struct {\n\t\tID string\n\t}{ID}\n\treturn utils.NewResponse(0, \"\", t)\n}", "title": "" }, { "docid": "782a1c2dd31152cac4511c836db77e89", "score": "0.54928416", "text": "func (mr *MockEC2ClientMockRecorder) GetLaunchTemplateDataRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLaunchTemplateDataRequest\", reflect.TypeOf((*MockEC2Client)(nil).GetLaunchTemplateDataRequest), arg0)\n}", "title": "" }, { "docid": "7a121715481d64ce38712af67165c26f", "score": "0.54913366", "text": "func ExampleInspector_DeleteAssessmentTemplate_shared00() {\n\tsvc := inspector.New(session.New())\n\tinput := &inspector.DeleteAssessmentTemplateInput{\n\t\tAssessmentTemplateArn: aws.String(\"arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T\"),\n\t}\n\n\tresult, err := svc.DeleteAssessmentTemplate(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase inspector.ErrCodeInternalException:\n\t\t\t\tfmt.Println(inspector.ErrCodeInternalException, aerr.Error())\n\t\t\tcase inspector.ErrCodeInvalidInputException:\n\t\t\t\tfmt.Println(inspector.ErrCodeInvalidInputException, aerr.Error())\n\t\t\tcase inspector.ErrCodeAssessmentRunInProgressException:\n\t\t\t\tfmt.Println(inspector.ErrCodeAssessmentRunInProgressException, aerr.Error())\n\t\t\tcase inspector.ErrCodeAccessDeniedException:\n\t\t\t\tfmt.Println(inspector.ErrCodeAccessDeniedException, aerr.Error())\n\t\t\tcase inspector.ErrCodeNoSuchEntityException:\n\t\t\t\tfmt.Println(inspector.ErrCodeNoSuchEntityException, aerr.Error())\n\t\t\tcase inspector.ErrCodeServiceTemporarilyUnavailableException:\n\t\t\t\tfmt.Println(inspector.ErrCodeServiceTemporarilyUnavailableException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "title": "" }, { "docid": "85d165010bba3bf675c77423f5ac1b60", "score": "0.54666716", "text": "func (mr *MockEC2ClientMockRecorder) CreateLaunchTemplateRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateLaunchTemplateRequest\", reflect.TypeOf((*MockEC2Client)(nil).CreateLaunchTemplateRequest), arg0)\n}", "title": "" }, { "docid": "2c57e1a2d3c61232c36824f58dc8ddcc", "score": "0.54656833", "text": "func (client *PoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, options *PoliciesClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\tif policySetName == \"\" {\n\t\treturn nil, errors.New(\"parameter policySetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{policySetName}\", url.PathEscape(policySetName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-09-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "0de9eec56df05f86de566e6ea73ebc02", "score": "0.5390217", "text": "func (client *AttestationsClient) deleteAtResourceCreateRequest(ctx context.Context, resourceID string, attestationName string, options *AttestationsClientDeleteAtResourceOptions) (*policy.Request, error) {\n\turlPath := \"/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceId}\", resourceID)\n\tif attestationName == \"\" {\n\t\treturn nil, errors.New(\"parameter attestationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{attestationName}\", url.PathEscape(attestationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "68091773b067b2660fbc296701a9bea6", "score": "0.53897923", "text": "func (client *ProvisionedClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "ae5ecd4eb21660dc100e2477a3bd5d7b", "score": "0.538734", "text": "func PermissionsDeleteTemplateFunc() {\n\topt := &PermissionsDeleteTemplateOption{\n\t\tTemplateId: \"\",\n\t\tTemplateName: \"\",\n\t}\n\tresp, err := client.Permissions.DeleteTemplate(opt)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(resp.StatusCode)\n}", "title": "" }, { "docid": "146d4059819263ca1a7df38e0209dce2", "score": "0.5374521", "text": "func (mr *MockEC2ClientMockRecorder) DeleteLaunchTemplateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLaunchTemplateWithContext\", reflect.TypeOf((*MockEC2Client)(nil).DeleteLaunchTemplateWithContext), varargs...)\n}", "title": "" }, { "docid": "2a084e80baf3fda5af5a4ecb4e827d5c", "score": "0.537436", "text": "func (client *SQLServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerInstancesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sqlServerInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter sqlServerInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sqlServerInstanceName}\", url.PathEscape(sqlServerInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-03-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "2563575fde09602c2e20d1f3173360ff", "score": "0.5373703", "text": "func (t *DummyRectificationClient) DeleteRequest(\n\tcluster, reqid, message string) error {\n\tt.logf(\"Deleting application %s %s %s\", cluster, reqid, message)\n\tt.deleted = append(t.deleted, dummyDelete{cluster, reqid, message})\n\treturn nil\n}", "title": "" }, { "docid": "570ad8e420a4ffe09b9ec07466cca2a6", "score": "0.5367539", "text": "func (client *AttestationsClient) deleteAtResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, attestationName string, options *AttestationsClientDeleteAtResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif attestationName == \"\" {\n\t\treturn nil, errors.New(\"parameter attestationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{attestationName}\", url.PathEscape(attestationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "f5f070690d2a786456eb195ed733187b", "score": "0.5367251", "text": "func (client *ServerEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, options *ServerEndpointsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif storageSyncServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter storageSyncServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{storageSyncServiceName}\", url.PathEscape(storageSyncServiceName))\n\tif syncGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter syncGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{syncGroupName}\", url.PathEscape(syncGroupName))\n\tif serverEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverEndpointName}\", url.PathEscape(serverEndpointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "c722c7e9a1875883a2d7b2d6b2ae3bc5", "score": "0.5360907", "text": "func (m *DefaultManagedAppProtectionItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *DefaultManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "84f9a7aa024e97c4fada20a52307c62d", "score": "0.53576314", "text": "func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vmName == \"\" {\n\t\treturn nil, errors.New(\"parameter vmName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vmName}\", url.PathEscape(vmName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\tif options != nil && options.ForceDeletion != nil {\n\t\treqQP.Set(\"forceDeletion\", strconv.FormatBool(*options.ForceDeletion))\n\t}\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "5554c2675636c0c0dba0b98a2d908381", "score": "0.5352097", "text": "func (s *Service) DeleteLaunchTemplate(id string) error {\n\ts.scope.V(2).Info(\"Deleting launch template\", \"id\", id)\n\n\tinput := &ec2.DeleteLaunchTemplateInput{\n\t\tLaunchTemplateId: aws.String(id),\n\t}\n\n\tif _, err := s.EC2Client.DeleteLaunchTemplate(input); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete launch template %q\", id)\n\t}\n\n\ts.scope.V(2).Info(\"Deleted launch template\", \"id\", id)\n\treturn nil\n}", "title": "" }, { "docid": "399b7d75923edbe397c74c24902d53aa", "score": "0.5348646", "text": "func (mr *MockEC2ClientMockRecorder) CreateLaunchTemplateVersionRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateLaunchTemplateVersionRequest\", reflect.TypeOf((*MockEC2Client)(nil).CreateLaunchTemplateVersionRequest), arg0)\n}", "title": "" }, { "docid": "43e6224e96df49f44876d2f48918229c", "score": "0.5334594", "text": "func (mr *MockEC2ClientMockRecorder) GetLaunchTemplateData(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLaunchTemplateData\", reflect.TypeOf((*MockEC2Client)(nil).GetLaunchTemplateData), arg0)\n}", "title": "" }, { "docid": "d597aff36ca62af7a326f917a17067ab", "score": "0.5333334", "text": "func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif farmBeatsResourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter farmBeatsResourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{farmBeatsResourceName}\", url.PathEscape(farmBeatsResourceName))\n\tif extensionID == \"\" {\n\t\treturn nil, errors.New(\"parameter extensionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{extensionId}\", url.PathEscape(extensionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-09-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "40df4a8177801d46a8b368bc868ac5e2", "score": "0.5329969", "text": "func (client *ApplicationDefinitionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationDefinitionName string, options *ApplicationDefinitionsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif applicationDefinitionName == \"\" {\n\t\treturn nil, errors.New(\"parameter applicationDefinitionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{applicationDefinitionName}\", url.PathEscape(applicationDefinitionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "1cc02eb48d5069827f847af1ee561ded", "score": "0.53128225", "text": "func (client *CloudServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "47074754d26540a65665251beb1dfd5f", "score": "0.53051716", "text": "func TestDeletePictureHandlerBeforeHookAbortsRequest(t *testing.T) {\n\tmockEnv := makeMockEnv()\n\n\tmockEnv.hook.BeforeDeletePicture(func(env *env, input *dao.DeletePictureInput) *HookError {\n\t\treturn &HookError{http.StatusTeapot, errors.New(\"Example\")}\n\t})\n\n\t// Create a single user\n\t_, err := makeRequest(mockEnv, http.MethodPost, \"/user\", `{\"Name\": \"Jay\"}`, JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make request: %s\", err.Error())\n\t}\n\n\t// Create a single picture for that user\n\tbody := `{\"Img\": \"c3F1YXRhbmRkYWI=\"}`\n\t_, err = makeRequest(mockEnv, http.MethodPost, fmt.Sprintf(\"/user/%s/picture\", UUID0), body, JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make POST request: %s\", err.Error())\n\t}\n\n\t// Delete that same picture\n\tres, err := makeRequest(mockEnv, http.MethodDelete, fmt.Sprintf(\"/user/%s/picture/%s\", UUID0, pictureUUID0), \"\", JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make PUT request: %s\", err.Error())\n\t}\n\n\tif res.Code != http.StatusTeapot {\n\t\tt.Errorf(\"Wrong status code: %v\", res.Code)\n\t}\n}", "title": "" }, { "docid": "8e8963d89441735a0c2f129cfe4cdc92", "score": "0.5302537", "text": "func (mr *MockSNSClientMockRecorder) DeletePlatformApplicationRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeletePlatformApplicationRequest\", reflect.TypeOf((*MockSNSClient)(nil).DeletePlatformApplicationRequest), arg0)\n}", "title": "" }, { "docid": "9ace8d2892363d2babd0991780de3f34", "score": "0.52911025", "text": "func DeleteActionTemplateExample() {\n\tvar (\n\t\tapiKey string = \"API-YOUR_API_KEY\"\n\t\toctopusURL string = \"https://your_octopus_url\"\n\t\tspaceID string = \"space-id\"\n\n\t\t// action template values\n\t\tactionTemplateID string = \"action-template-id\"\n\t)\n\n\tapiURL, err := url.Parse(octopusURL)\n\tif err != nil {\n\t\t_ = fmt.Errorf(\"error parsing URL for Octopus API: %v\", err)\n\t\treturn\n\t}\n\n\tclient, err := client.NewClient(nil, apiURL, apiKey, spaceID)\n\tif err != nil {\n\t\t_ = fmt.Errorf(\"error creating API client: %v\", err)\n\t\treturn\n\t}\n\n\t// delete action template\n\terr = client.ActionTemplates.DeleteByID(actionTemplateID)\n\tif err != nil {\n\t\t_ = fmt.Errorf(\"error deleting action template: %v\", err)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"action template deleted: (%s)\\n\", actionTemplateID)\n}", "title": "" }, { "docid": "22e29f1f5744cef2c6df2126e874c82e", "score": "0.52893174", "text": "func (client *BareMetalMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, bareMetalMachineName string, options *BareMetalMachinesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif bareMetalMachineName == \"\" {\n\t\treturn nil, errors.New(\"parameter bareMetalMachineName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{bareMetalMachineName}\", url.PathEscape(bareMetalMachineName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "630fc27d925fd6182430ca1e5d492fc1", "score": "0.52845246", "text": "func (mr *MockEC2ClientMockRecorder) CreateLaunchTemplate(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateLaunchTemplate\", reflect.TypeOf((*MockEC2Client)(nil).CreateLaunchTemplate), arg0)\n}", "title": "" }, { "docid": "a0e312cf9384a711d5e87e1f441d651f", "score": "0.5283033", "text": "func (client *SolutionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *SolutionsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationsManagement/solutions/{solutionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif solutionName == \"\" {\n\t\treturn nil, errors.New(\"parameter solutionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{solutionName}\", url.PathEscape(solutionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2015-11-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "978d06bbb9e02ad062d08bf83616300c", "score": "0.52826583", "text": "func (client *IntegrationAccountMapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string, options *IntegrationAccountMapsDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif integrationAccountName == \"\" {\n\t\treturn nil, errors.New(\"parameter integrationAccountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{integrationAccountName}\", url.PathEscape(integrationAccountName))\n\tif mapName == \"\" {\n\t\treturn nil, errors.New(\"parameter mapName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{mapName}\", url.PathEscape(mapName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "d8c27fc733b45e99e4128e381cb2cfc8", "score": "0.5280719", "text": "func (mr *MockEC2ClientMockRecorder) DescribeLaunchTemplatesRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeLaunchTemplatesRequest\", reflect.TypeOf((*MockEC2Client)(nil).DescribeLaunchTemplatesRequest), arg0)\n}", "title": "" }, { "docid": "beb997b5b02c94dc3428fa54b64063e4", "score": "0.52780384", "text": "func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif connectedEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedEnvironmentName}\", url.PathEscape(connectedEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "def2acda5eee7800c8a463f724207337", "score": "0.52730817", "text": "func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif restorePointCollectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter restorePointCollectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{restorePointCollectionName}\", url.PathEscape(restorePointCollectionName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "88294873c05d027a4c9d149fe9437df3", "score": "0.5267715", "text": "func (mr *MockStorageRequestClientMockRecorder) StorageRequestDelete(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StorageRequestDelete\", reflect.TypeOf((*MockStorageRequestClient)(nil).StorageRequestDelete), arg0)\n}", "title": "" }, { "docid": "efa4b9d4d656b32fa1c56349320cbb34", "score": "0.5260987", "text": "func (m *WindowsHelloForBusinessAuthenticationMethodItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *WindowsHelloForBusinessAuthenticationMethodItemRequestBuilderDeleteRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "8790c5f5673f6c75ed84232731de4253", "score": "0.52435577", "text": "func (client *LabsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif labName == \"\" {\n\t\treturn nil, errors.New(\"parameter labName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{labName}\", url.PathEscape(labName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "234c3da44d3e5668f904b97a04ae6091", "score": "0.5241655", "text": "func DeleteTemplate(request *api.Request, templateID int64) *DeleteTemplateRequest {\n\trequest.Add(\"template_id\", strconv.FormatInt(templateID, 10))\n\n\treturn &DeleteTemplateRequest{\n\t\trequest: request,\n\t}\n}", "title": "" }, { "docid": "d7ee1f049e32543452438a951989fad8", "score": "0.5239662", "text": "func TestDeleteUserHandlerAfterHookAbortsRequest(t *testing.T) {\n\tmockEnv := makeMockEnv()\n\n\tmockEnv.hook.AfterDelete(func(env *env) *HookError {\n\t\treturn &HookError{http.StatusTeapot, errors.New(\"Example\")}\n\t})\n\n\t// Create a single user\n\t_, err := makeRequest(mockEnv, http.MethodPost, \"/user\", `{\"Name\": \"Jay\"}`, JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make request: %s\", err.Error())\n\t}\n\n\t// Delete that same user\n\tres, err := makeRequest(mockEnv, http.MethodDelete, fmt.Sprintf(\"/user/%s\", UUID0), \"\", JWT0)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not make request: %s\", err.Error())\n\t}\n\n\tif res.Code != http.StatusTeapot {\n\t\tt.Errorf(\"Wrong status code: %v\", res.Code)\n\t}\n}", "title": "" }, { "docid": "0bedba03cbad7952a9de62d0bf5417eb", "score": "0.5233601", "text": "func (mr *MockEC2ClientMockRecorder) DescribeLaunchTemplateVersionsRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeLaunchTemplateVersionsRequest\", reflect.TypeOf((*MockEC2Client)(nil).DescribeLaunchTemplateVersionsRequest), arg0)\n}", "title": "" }, { "docid": "b8e612f51790ac6ebbb6fd71e5eec87e", "score": "0.5230218", "text": "func (client *AFDEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, profileName string, endpointName string, options *AFDEndpointsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6165082165043e7ff3305e21bb2ee78e", "score": "0.52252376", "text": "func (client *WebTestsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, webTestName string, options *WebTestsClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif webTestName == \"\" {\n\t\treturn nil, errors.New(\"parameter webTestName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{webTestName}\", url.PathEscape(webTestName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2015-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "1d30fdbf9a4fef7e9220ffc6aba05b4f", "score": "0.5222744", "text": "func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vmScaleSetName == \"\" {\n\t\treturn nil, errors.New(\"parameter vmScaleSetName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vmScaleSetName}\", url.PathEscape(vmScaleSetName))\n\tif vmssExtensionName == \"\" {\n\t\treturn nil, errors.New(\"parameter vmssExtensionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vmssExtensionName}\", url.PathEscape(vmssExtensionName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "d8c40fee2a76e9f128333c0c2f58cd55", "score": "0.5219582", "text": "func (m *ThreatSubmissionRequestBuilder) Delete(ctx context.Context, requestConfiguration *ThreatSubmissionRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "a61f39a2862ec6f1c165b76d4b798be5", "score": "0.5216197", "text": "func (client *ContactProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, contactProfileName string, options *ContactProfilesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif contactProfileName == \"\" {\n\t\treturn nil, errors.New(\"parameter contactProfileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{contactProfileName}\", url.PathEscape(contactProfileName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-04-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "8ca7ee4651515f6edda41a809200db7c", "score": "0.52042586", "text": "func (a *Client) DeleteWidgetTemplate(params *DeleteWidgetTemplateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteWidgetTemplateNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteWidgetTemplateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteWidgetTemplate\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/content/widget-templates/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteWidgetTemplateReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteWidgetTemplateNoContent)\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 deleteWidgetTemplate: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "e6dfb45e9b638e5888e156e479d873b0", "score": "0.52031773", "text": "func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif restorePointCollectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter restorePointCollectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{restorePointCollectionName}\", url.PathEscape(restorePointCollectionName))\n\tif restorePointName == \"\" {\n\t\treturn nil, errors.New(\"parameter restorePointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{restorePointName}\", url.PathEscape(restorePointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "f74d844356f2c2f8cb14070ba8d4c3d8", "score": "0.5203112", "text": "func (client *VPNSitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vpnSiteName == \"\" {\n\t\treturn nil, errors.New(\"parameter vpnSiteName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vpnSiteName}\", url.PathEscape(vpnSiteName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "cc6098208b509c8084f80163d1803eb0", "score": "0.52019346", "text": "func (client *CloudServicesClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.Parameters != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.Parameters)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "a0664bc7802e7a2014f45dc2ab66cf9b", "score": "0.5201534", "text": "func (mr *MockCloudMapMockRecorder) DeleteServiceRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteServiceRequest\", reflect.TypeOf((*MockCloudMap)(nil).DeleteServiceRequest), arg0)\n}", "title": "" }, { "docid": "3d1814d6c4bf161fb6507f293ce47370", "score": "0.5193377", "text": "func (client *ReplicationRecoveryPlansClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}\"\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif recoveryPlanName == \"\" {\n\t\treturn nil, errors.New(\"parameter recoveryPlanName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{recoveryPlanName}\", url.PathEscape(recoveryPlanName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "c0d959d92334afb2edc6134219fc4d24", "score": "0.5192458", "text": "func TestDeleteSync(t *testing.T) {\n\ttests := []controllerTest{\n\t\t{\n\t\t\tname: \"1-1 - content with empty snapshot class is deleted if it is bound to a non-exist snapshot and also has a snapshot uid specified\",\n\t\t\tinitialContents: newContentArray(\"content1-1\", classEmpty, \"sid1-1\", \"vuid1-1\", \"volume1-1\", \"snapuid1-1\", \"snap1-1\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-1\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"2-1 - content with empty snapshot class will not be deleted if it is bound to a non-exist snapshot but it does not have a snapshot uid specified\",\n\t\t\tinitialContents: newContentArray(\"content2-1\", classEmpty, \"sid2-1\", \"vuid2-1\", \"volume2-1\", \"\", \"snap2-1\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content2-1\", classEmpty, \"sid2-1\", \"vuid2-1\", \"volume2-1\", \"\", \"snap2-1\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid2-1\", nil, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-2 - successful delete with snapshot class that has empty secret parameter\",\n\t\t\tinitialContents: newContentArray(\"content1-2\", emptySecretClass, \"sid1-2\", \"vuid1-2\", \"volume1-2\", \"snapuid1-2\", \"snap1-2\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\tinitialSecrets: []*v1.Secret{emptySecret()},\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-2\", map[string]string{}, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-3 - successful delete with snapshot class that has valid secret parameter\",\n\t\t\tinitialContents: newContentArray(\"content1-3\", validSecretClass, \"sid1-3\", \"vuid1-3\", \"volume1-3\", \"snapuid1-3\", \"snap1-3\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-3\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-4 - fail delete with snapshot class that has invalid secret parameter\",\n\t\t\tinitialContents: newContentArray(\"content1-4\", invalidSecretClass, \"sid1-4\", \"vuid1-4\", \"volume1-4\", \"snapuid1-4\", \"snap1-4\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-4\", invalidSecretClass, \"sid1-4\", \"vuid1-4\", \"volume1-4\", \"snapuid1-4\", \"snap1-4\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-5 - csi driver delete snapshot returns error\",\n\t\t\tinitialContents: newContentArray(\"content1-5\", validSecretClass, \"sid1-5\", \"vuid1-5\", \"volume1-5\", \"snapuid1-5\", \"snap1-5\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-5\", validSecretClass, \"sid1-5\", \"vuid1-5\", \"volume1-5\", \"snapuid1-5\", \"snap1-5\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-5\", map[string]string{\"foo\": \"bar\"}, errors.New(\"mock csi driver delete error\")}},\n\t\t\texpectedEvents: []string{\"Warning SnapshotDeleteError\"},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-6 - api server delete content returns error\",\n\t\t\tinitialContents: newContentArray(\"content1-6\", validSecretClass, \"sid1-6\", \"vuid1-6\", \"volume1-6\", \"snapuid1-6\", \"snap1-6\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-6\", validSecretClass, \"sid1-6\", \"vuid1-6\", \"volume1-6\", \"snapuid1-6\", \"snap1-6\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-6\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\texpectedEvents: []string{\"Warning SnapshotContentObjectDeleteError\"},\n\t\t\terrors: []reactorError{\n\t\t\t\t// Inject error to the first client.VolumesnapshotV1alpha1().VolumeSnapshotContents().Delete call.\n\t\t\t\t// All other calls will succeed.\n\t\t\t\t{\"delete\", \"volumesnapshotcontents\", errors.New(\"mock delete error\")},\n\t\t\t},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\t// delete success - snapshot that the content was pointing to was deleted, and another\n\t\t\t// with the same name created.\n\t\t\tname: \"1-7 - prebound content is deleted while the snapshot exists\",\n\t\t\tinitialContents: newContentArray(\"content1-7\", validSecretClass, \"sid1-7\", \"vuid1-7\", \"volume1-7\", \"snapuid1-7\", \"snap1-7\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-7\", validSecretClass, \"content1-7\", \"snapuid1-7-x\", \"claim1-7\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-7\", validSecretClass, \"content1-7\", \"snapuid1-7-x\", \"claim1-7\", false, nil, nil, nil),\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-7\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\t// delete success(?) - content is deleted before doDelete() starts\n\t\t\tname: \"1-8 - content is deleted before deleting\",\n\t\t\tinitialContents: newContentArray(\"content1-8\", validSecretClass, \"sid1-8\", \"vuid1-8\", \"volume1-8\", \"snapuid1-8\", \"snap1-8\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-8\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: wrapTestWithInjectedOperation(testSyncContent, func(ctrl *csiSnapshotController, reactor *snapshotReactor) {\n\t\t\t\t// Delete the volume before delete operation starts\n\t\t\t\treactor.lock.Lock()\n\t\t\t\tdelete(reactor.contents, \"content1-8\")\n\t\t\t\treactor.lock.Unlock()\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"1-9 - content will not be deleted if it is bound to a snapshot correctly, snapshot uid is specified\",\n\t\t\tinitialContents: newContentArray(\"content1-9\", validSecretClass, \"sid1-9\", \"vuid1-9\", \"volume1-9\", \"snapuid1-9\", \"snap1-9\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-9\", validSecretClass, \"sid1-9\", \"vuid1-9\", \"volume1-9\", \"snapuid1-9\", \"snap1-9\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-9\", validSecretClass, \"content1-9\", \"snapuid1-9\", \"claim1-9\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-9\", validSecretClass, \"content1-9\", \"snapuid1-9\", \"claim1-9\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-10 - should delete content which is bound to a snapshot incorrectly\",\n\t\t\tinitialContents: newContentArray(\"content1-10\", validSecretClass, \"sid1-10\", \"vuid1-10\", \"volume1-10\", \"snapuid1-10-x\", \"snap1-10\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: nocontents,\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-10\", \"snapuid1-10\", \"claim1-10\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-10\", \"snapuid1-10\", \"claim1-10\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\texpectedDeleteCalls: []deleteCall{{\"sid1-10\", map[string]string{\"foo\": \"bar\"}, nil}},\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-10 - will not delete content with retain policy set which is bound to a snapshot incorrectly\",\n\t\t\tinitialContents: newContentArray(\"content1-10\", validSecretClass, \"sid1-10\", \"vuid1-10\", \"volume1-10\", \"snapuid1-10-x\", \"snap1-10\", &retainPolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-10\", validSecretClass, \"sid1-10\", \"vuid1-10\", \"volume1-10\", \"snapuid1-10-x\", \"snap1-10\", &retainPolicy, nil, nil, true),\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-10\", \"snapuid1-10\", \"claim1-10\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-10\", \"snapuid1-10\", \"claim1-10\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-11 - content will not be deleted if it is bound to a snapshot correctly, snapsht uid is not specified\",\n\t\t\tinitialContents: newContentArray(\"content1-11\", validSecretClass, \"sid1-11\", \"vuid1-11\", \"volume1-11\", \"\", \"snap1-11\", &deletePolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-11\", validSecretClass, \"sid1-11\", \"vuid1-11\", \"volume1-11\", \"\", \"snap1-11\", &deletePolicy, nil, nil, true),\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-11\", validSecretClass, \"content1-11\", \"snapuid1-11\", \"claim1-11\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-11\", validSecretClass, \"content1-11\", \"snapuid1-11\", \"claim1-11\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-12 - content with retain policy will not be deleted if it is bound to a non-exist snapshot and also has a snapshot uid specified\",\n\t\t\tinitialContents: newContentArray(\"content1-12\", classEmpty, \"sid1-12\", \"vuid1-12\", \"volume1-12\", \"snapuid1-12\", \"snap1-12\", &retainPolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-12\", classEmpty, \"sid1-12\", \"vuid1-12\", \"volume1-12\", \"snapuid1-12\", \"snap1-12\", &retainPolicy, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-13 - content with empty snapshot class is not deleted when Deletion policy is not set even if it is bound to a non-exist snapshot and also has a snapshot uid specified\",\n\t\t\tinitialContents: newContentArray(\"content1-1\", classEmpty, \"sid1-1\", \"vuid1-1\", \"volume1-1\", \"snapuid1-1\", \"snap1-1\", nil, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-1\", classEmpty, \"sid1-1\", \"vuid1-1\", \"volume1-1\", \"snapuid1-1\", \"snap1-1\", nil, nil, nil, true),\n\t\t\tinitialSnapshots: nosnapshots,\n\t\t\texpectedSnapshots: nosnapshots,\n\t\t\texpectedEvents: noevents,\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-14 - content will not be deleted if it is bound to a snapshot correctly, snapshot uid is specified\",\n\t\t\tinitialContents: newContentArray(\"content1-14\", validSecretClass, \"sid1-14\", \"vuid1-14\", \"volume1-14\", \"snapuid1-14\", \"snap1-14\", &retainPolicy, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-14\", validSecretClass, \"sid1-14\", \"vuid1-14\", \"volume1-14\", \"snapuid1-14\", \"snap1-14\", &retainPolicy, nil, nil, true),\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-14\", validSecretClass, \"content1-14\", \"snapuid1-14\", \"claim1-14\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-14\", validSecretClass, \"content1-14\", \"snapuid1-14\", \"claim1-14\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t\t{\n\t\t\tname: \"1-15 - content will not be deleted which is bound to a snapshot incorrectly if Deletion policy is not set\",\n\t\t\tinitialContents: newContentArray(\"content1-10\", validSecretClass, \"sid1-15\", \"vuid1-15\", \"volume1-15\", \"snapuid1-15-x\", \"snap1-15\", nil, nil, nil, true),\n\t\t\texpectedContents: newContentArray(\"content1-10\", validSecretClass, \"sid1-15\", \"vuid1-15\", \"volume1-15\", \"snapuid1-15-x\", \"snap1-15\", nil, nil, nil, true),\n\t\t\tinitialSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-15\", \"snapuid1-15\", \"claim1-15\", false, nil, nil, nil),\n\t\t\texpectedSnapshots: newSnapshotArray(\"snap1-10\", validSecretClass, \"content1-15\", \"snapuid1-15\", \"claim1-15\", false, nil, nil, nil),\n\t\t\texpectedEvents: noevents,\n\t\t\tinitialSecrets: []*v1.Secret{secret()},\n\t\t\terrors: noerrors,\n\t\t\ttest: testSyncContent,\n\t\t},\n\t}\n\trunSyncTests(t, tests, snapshotClasses)\n}", "title": "" }, { "docid": "8ec920805f644ed0d42d51d145dd8eab", "score": "0.5190619", "text": "func (mr *MockIAMAPIMockRecorder) DeleteSigningCertificateRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteSigningCertificateRequest\", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSigningCertificateRequest), arg0)\n}", "title": "" }, { "docid": "4d26005c9e19ec979726fc07ba10c037", "score": "0.51857954", "text": "func (m *IosManagedAppProtectionItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *IosManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "799128308b3f3d8e627f0c04b415d557", "score": "0.51851773", "text": "func (client *CommunicationsGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, communicationsGatewayName string, options *CommunicationsGatewaysClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif communicationsGatewayName == \"\" {\n\t\treturn nil, errors.New(\"parameter communicationsGatewayName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{communicationsGatewayName}\", url.PathEscape(communicationsGatewayName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "6015eeeeec47ea2221c4cb19cce5d6bf", "score": "0.51841086", "text": "func (client *EmailServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, options *EmailServicesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif emailServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter emailServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{emailServiceName}\", url.PathEscape(emailServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "4f53caac3428a2ba271008c30b900114", "score": "0.5179893", "text": "func (m *AndroidManagedAppProtectionItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *AndroidManagedAppProtectionItemRequestBuilderDeleteRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "3cbe2f44cc02748ab350aa42de6bcb01", "score": "0.51788676", "text": "func (mr *MockEC2ClientMockRecorder) DeleteKeyPairRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteKeyPairRequest\", reflect.TypeOf((*MockEC2Client)(nil).DeleteKeyPairRequest), arg0)\n}", "title": "" }, { "docid": "2918d7d30fa8bca87a20df41bf52f31c", "score": "0.5170371", "text": "func (client *AFDEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, profileName string, endpointName string, options *AFDEndpointsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif profileName == \"\" {\n\t\treturn nil, errors.New(\"parameter profileName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{profileName}\", url.PathEscape(profileName))\n\tif endpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter endpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{endpointName}\", url.PathEscape(endpointName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "70a24de3e1b7cd10e99874acf138f157", "score": "0.516971", "text": "func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif restorePointCollectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter restorePointCollectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{restorePointCollectionName}\", url.PathEscape(restorePointCollectionName))\n\tif restorePointName == \"\" {\n\t\treturn nil, errors.New(\"parameter restorePointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{restorePointName}\", url.PathEscape(restorePointName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "888c3921616873da7ceb549053e9de40", "score": "0.5165038", "text": "func (m *InformationProtectionRequestBuilder) Delete(ctx context.Context, requestConfiguration *InformationProtectionRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "141a0320f0efd4648fd72766c509f042", "score": "0.51542574", "text": "func (client *TagClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string, options *TagClientDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif tagID == \"\" {\n\t\treturn nil, errors.New(\"parameter tagID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{tagId}\", url.PathEscape(tagID))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"If-Match\"] = []string{ifMatch}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "245b770813c8b9394824df6138a410b9", "score": "0.51538026", "text": "func (mr *MockIAMAPIMockRecorder) DeletePolicyVersionRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeletePolicyVersionRequest\", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyVersionRequest), arg0)\n}", "title": "" }, { "docid": "22f4370421c278f0f611e4a8e2d952e6", "score": "0.5149783", "text": "func (client *ProviderInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapMonitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}/providerInstances/{providerInstanceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif sapMonitorName == \"\" {\n\t\treturn nil, errors.New(\"parameter sapMonitorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sapMonitorName}\", url.PathEscape(sapMonitorName))\n\tif providerInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter providerInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{providerInstanceName}\", url.PathEscape(providerInstanceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-02-07-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "406c18a688962ca1436d6a3c3e19240c", "score": "0.51497275", "text": "func (m *EntitlementManagementAccessPackageCatalogsItemCustomAccessPackageWorkflowExtensionsCustomAccessPackageWorkflowExtensionItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *EntitlementManagementAccessPackageCatalogsItemCustomAccessPackageWorkflowExtensionsCustomAccessPackageWorkflowExtensionItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "0a2fbf1bc5c023b8f990dcb302515285", "score": "0.5149294", "text": "func (client *ContainerServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerServiceName string, options *ContainerServicesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif containerServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter containerServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{containerServiceName}\", url.PathEscape(containerServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2017-07-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "db3f8cb4722492d5ca5eaaae8e0d721a", "score": "0.51457554", "text": "func (mr *MockIAMAPIMockRecorder) DeleteSSHPublicKeyRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteSSHPublicKeyRequest\", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSSHPublicKeyRequest), arg0)\n}", "title": "" }, { "docid": "811dcabe4806bd148f676fd083be4a2a", "score": "0.5144454", "text": "func (client *ContainerServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerServiceName string, options *ContainerServicesBeginDeleteOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\turlPath = strings.ReplaceAll(urlPath, \"{containerServiceName}\", url.PathEscape(containerServiceName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\tquery := req.URL.Query()\n\tquery.Set(\"api-version\", \"2017-01-31\")\n\treq.URL.RawQuery = query.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "a287b38af2aca82dcde63d9808db4434", "score": "0.5133718", "text": "func (client *NetworkVirtualAppliancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *NetworkVirtualAppliancesBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif networkVirtualApplianceName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkVirtualApplianceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkVirtualApplianceName}\", url.PathEscape(networkVirtualApplianceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "dcdd9e30cf8d96f31603fa5488829e45", "score": "0.51328284", "text": "func (c *UDIClient) NewDeleteFunctionTemplateRequest() *DeleteFunctionTemplateRequest {\n\treq := &DeleteFunctionTemplateRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "title": "" }, { "docid": "7041c1fbe2d2d968c8a271ab6aaad87d", "score": "0.5130416", "text": "func (m *WdacSupplementalPoliciesItemDeploySummaryRequestBuilder) Delete(ctx context.Context, requestConfiguration *WdacSupplementalPoliciesItemDeploySummaryRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "9eb3bcb87df8fec233411470f5c85c74", "score": "0.5128562", "text": "func (mr *MockIAMAPIMockRecorder) DeleteInstanceProfileRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteInstanceProfileRequest\", reflect.TypeOf((*MockIAMAPI)(nil).DeleteInstanceProfileRequest), arg0)\n}", "title": "" }, { "docid": "d0e53fb3043279092cd5c81c9e074f87", "score": "0.5127475", "text": "func (m *ManagedDevicesItemWindowsProtectionStateRequestBuilder) Delete(ctx context.Context, requestConfiguration *ManagedDevicesItemWindowsProtectionStateRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "c0dd211475430830ad25edc7e9b726ea", "score": "0.5117517", "text": "func TestSyncDelete(t *testing.T) {\n\tklusterlet := newKlusterlet(\"klusterlet\", \"testns\", \"\")\n\tnow := metav1.Now()\n\tklusterlet.ObjectMeta.SetDeletionTimestamp(&now)\n\tbootstrapKubeConfigSecret := newSecret(helpers.BootstrapHubKubeConfig, \"testns\")\n\tbootstrapKubeConfigSecret.Data[\"kubeconfig\"] = newKubeConfig(\"testhost\")\n\tnamespace := newNamespace(\"testns\")\n\tappliedManifestWorks := []runtime.Object{\n\t\tnewAppliedManifestWorks(\"testhost\", nil, false),\n\t\tnewAppliedManifestWorks(\"testhost\", []string{appliedManifestWorkFinalizer}, true),\n\t\tnewAppliedManifestWorks(\"testhost-2\", []string{appliedManifestWorkFinalizer}, false),\n\t}\n\tcontroller := newTestController(klusterlet, appliedManifestWorks, namespace, bootstrapKubeConfigSecret)\n\tsyncContext := testinghelper.NewFakeSyncContext(t, \"klusterlet\")\n\n\terr := controller.controller.sync(nil, syncContext)\n\tif err != nil {\n\t\tt.Errorf(\"Expected non error when sync, %v\", err)\n\t}\n\n\tdeleteActions := []clienttesting.DeleteActionImpl{}\n\tkubeActions := controller.kubeClient.Actions()\n\tfor _, action := range kubeActions {\n\t\tif action.GetVerb() == \"delete\" {\n\t\t\tdeleteAction := action.(clienttesting.DeleteActionImpl)\n\t\t\tdeleteActions = append(deleteActions, deleteAction)\n\t\t}\n\t}\n\n\tif len(deleteActions) != 14 {\n\t\tt.Errorf(\"Expected 14 delete actions, but got %d\", len(deleteActions))\n\t}\n\n\tdeleteCRDActions := []clienttesting.DeleteActionImpl{}\n\tcrdActions := controller.apiExtensionClient.Actions()\n\tfor _, action := range crdActions {\n\t\tif action.GetVerb() == \"delete\" {\n\t\t\tdeleteAction := action.(clienttesting.DeleteActionImpl)\n\t\t\tdeleteCRDActions = append(deleteCRDActions, deleteAction)\n\t\t}\n\t}\n\n\tif len(deleteCRDActions) != 2 {\n\t\tt.Errorf(\"Expected 2 delete actions, but got %d\", len(deleteCRDActions))\n\t}\n\n\tupdateWorkActions := []clienttesting.UpdateActionImpl{}\n\tworkActions := controller.workClient.Actions()\n\tfor _, action := range workActions {\n\t\tif action.GetVerb() == \"update\" {\n\t\t\tupdateAction := action.(clienttesting.UpdateActionImpl)\n\t\t\tupdateWorkActions = append(updateWorkActions, updateAction)\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tif len(updateWorkActions) != 1 {\n\t\tt.Errorf(\"Expected 1 update action, but got %d\", len(updateWorkActions))\n\t}\n}", "title": "" }, { "docid": "b95769a19e5021050f2481ed7c7dcf47", "score": "0.5116171", "text": "func (c *FakeExecutionHookTemplates) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(executionhooktemplatesResource, c.ns, name), &v1alpha1.ExecutionHookTemplate{})\n\n\treturn err\n}", "title": "" }, { "docid": "18b9b0bba25225b0dfdf92bc44eba859", "score": "0.51080555", "text": "func (mr *MockIAMAPIMockRecorder) DeleteServiceSpecificCredentialRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteServiceSpecificCredentialRequest\", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceSpecificCredentialRequest), arg0)\n}", "title": "" }, { "docid": "b6296d8f451a22857c2b92d5bc06ff5d", "score": "0.5104742", "text": "func (m *DeviceCompliancePolicyItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *DeviceCompliancePolicyItemRequestBuilderDeleteRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" } ]
f66cb221faf83c110e0d86bf5a45f014
NewPubKeyRespFromDNS retrieves the TXT record from DNS based on the specified domain and selector and parses it.
[ { "docid": "8ba16452b1c83f7414eb3c9c1ede81ed", "score": "0.80735964", "text": "func NewPubKeyRespFromDNS(selector, domain string, opts ...DNSOpt) (*PubKeyRep, verifyOutput, error) {\n\tdnsOpts := DNSOptions{}\n\n\tfor _, opt := range opts {\n\t\topt.apply(&dnsOpts)\n\t}\n\n\tif dnsOpts.netLookupTXT == nil {\n\t\tdnsOpts.netLookupTXT = net.LookupTXT\n\t}\n\n\ttxt, err := dnsOpts.netLookupTXT(selector + \"._domainkey.\" + domain)\n\tif err != nil {\n\t\tif strings.HasSuffix(err.Error(), \"no such host\") {\n\t\t\treturn nil, PERMFAIL, ErrVerifyNoKeyForSignature\n\t\t}\n\n\t\treturn nil, TEMPFAIL, ErrVerifyKeyUnavailable\n\t}\n\n\t// empty record\n\tif len(txt) == 0 {\n\t\treturn nil, PERMFAIL, ErrVerifyNoKeyForSignature\n\t}\n\n\t// parsing, we keep the first record\n\t// TODO: if there is multiple record\n\n\treturn NewPubKeyResp(txt[0])\n}", "title": "" } ]
[ { "docid": "18a982e6a3273d323d127dde1ec86b91", "score": "0.57281184", "text": "func NewPubKeyResp(dkimRecord string) (*PubKeyRep, verifyOutput, error) {\n\tpkr := new(PubKeyRep)\n\tpkr.Version = \"DKIM1\"\n\tpkr.HashAlgo = []string{\"sha1\", \"sha256\"}\n\tpkr.KeyType = \"rsa\"\n\tpkr.FlagTesting = false\n\tpkr.FlagIMustBeD = false\n\n\tp := strings.Split(dkimRecord, \";\")\n\tfor i, data := range p {\n\t\tkeyVal := strings.SplitN(data, \"=\", 2)\n\t\tval := \"\"\n\t\tif len(keyVal) > 1 {\n\t\t\tval = strings.TrimSpace(keyVal[1])\n\t\t}\n\t\tswitch strings.ToLower(strings.TrimSpace(keyVal[0])) {\n\t\tcase \"v\":\n\t\t\t// RFC: is this tag is specified it MUST be the first in the record\n\t\t\tif i != 0 {\n\t\t\t\treturn nil, PERMFAIL, ErrVerifyTagVMustBeTheFirst\n\t\t\t}\n\t\t\tpkr.Version = val\n\t\t\tif pkr.Version != \"DKIM1\" {\n\t\t\t\treturn nil, PERMFAIL, ErrVerifyVersionMusBeDkim1\n\t\t\t}\n\t\tcase \"h\":\n\t\t\tp := strings.Split(strings.ToLower(val), \":\")\n\t\t\tpkr.HashAlgo = []string{}\n\t\t\tfor _, h := range p {\n\t\t\t\th = strings.TrimSpace(h)\n\t\t\t\tif h == \"sha1\" || h == \"sha256\" {\n\t\t\t\t\tpkr.HashAlgo = append(pkr.HashAlgo, h)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// if empty switch back to default\n\t\t\tif len(pkr.HashAlgo) == 0 {\n\t\t\t\tpkr.HashAlgo = []string{\"sha1\", \"sha256\"}\n\t\t\t}\n\t\tcase \"k\":\n\t\t\tif strings.ToLower(val) != \"rsa\" {\n\t\t\t\treturn nil, PERMFAIL, ErrVerifyBadKeyType\n\t\t\t}\n\t\tcase \"n\":\n\t\t\tqp, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(val)))\n\t\t\tif err == nil {\n\t\t\t\tval = string(qp)\n\t\t\t}\n\t\t\tpkr.Note = val\n\t\tcase \"p\":\n\t\t\trawkey := val\n\t\t\tif rawkey == \"\" {\n\t\t\t\treturn nil, PERMFAIL, ErrVerifyRevokedKey\n\t\t\t}\n\t\t\tun64, err := base64.StdEncoding.DecodeString(rawkey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, PERMFAIL, ErrVerifyBadKey\n\t\t\t}\n\t\t\tpk, err := x509.ParsePKIXPublicKey(un64)\n\t\t\tif pk, ok := pk.(*rsa.PublicKey); ok {\n\t\t\t\tpkr.PubKey = *pk\n\t\t\t}\n\t\tcase \"s\":\n\t\t\tt := strings.Split(strings.ToLower(val), \":\")\n\t\t\tfor _, tt := range t {\n\t\t\t\ttt = strings.TrimSpace(tt)\n\t\t\t\tswitch tt {\n\t\t\t\tcase \"*\":\n\t\t\t\t\tpkr.ServiceType = append(pkr.ServiceType, \"all\")\n\t\t\t\tcase \"email\":\n\t\t\t\t\tpkr.ServiceType = append(pkr.ServiceType, tt)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"t\":\n\t\t\tflags := strings.Split(strings.ToLower(val), \":\")\n\t\t\tfor _, flag := range flags {\n\t\t\t\tflag = strings.TrimSpace(flag)\n\t\t\t\tswitch flag {\n\t\t\t\tcase \"y\":\n\t\t\t\t\tpkr.FlagTesting = true\n\t\t\t\tcase \"s\":\n\t\t\t\t\tpkr.FlagIMustBeD = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// if no pubkey\n\tif pkr.PubKey == (rsa.PublicKey{}) {\n\t\treturn nil, PERMFAIL, ErrVerifyNoKey\n\t}\n\n\t// No service type\n\tif len(pkr.ServiceType) == 0 {\n\t\tpkr.ServiceType = []string{\"all\"}\n\t}\n\n\treturn pkr, SUCCESS, nil\n}", "title": "" }, { "docid": "ba230632c2994dead5c81ce924652ee5", "score": "0.5564526", "text": "func (nm Netmaker) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\ta := new(dns.Msg)\n\ta.SetReply(r)\n\ta.Compress = true\n\ta.Authoritative = true\n\n\tvar f responseQuerier\n\n\tswitch state.QType() {\n\tcase dns.TypeA:\n\t\tf = getResponsesAQueries\n\tdefault:\n\t\treturn plugin.NextOrFailure(nm.Name(), nm.Next, ctx, w, r)\n\t}\n\n\t// extract the zone from the query.\n\tqn := strings.TrimSuffix(state.QName(), \".\"+nm.Zone)\n\n\t// retrieve list of answers to send to client\n\tanswers, err := f(state, qn, nm.Entries)\n\tif err != nil {\n\t\tlog.Debugf(\"Catched an error from the responder: %v\", err)\n\t\treturn plugin.NextOrFailure(nm.Name(), nm.Next, ctx, w, r)\n\t}\n\n\ta.Answer = answers\n\tstate.SizeAndDo(a)\n\tw.WriteMsg(a)\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "d2a72ab908e14e3ba6276c785dca467a", "score": "0.5483401", "text": "func (hc HealthCheckPlugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\tif state.QType() != dns.TypeTXT && state.QType() != dns.TypeSPF && state.QType() != dns.TypeMX {\n\t\treturn plugin.NextOrFailure(hc.Name(), hc.Next, ctx, w, r)\n\t}\n\n\ta := new(dns.Msg)\n\ta.SetReply(r)\n\ta.Authoritative = true\n\ta.Compress = true\n\n\tvar err error\n\n\tswitch state.QType() {\n\tcase dns.TypeTXT:\n\t\ta.Answer, err = hc.processTXTRecord(state)\n\t\tif err != nil {\n\t\t\treturn plugin.NextOrFailure(hc.Name(), hc.Next, ctx, w, r)\n\t\t}\n\tcase dns.TypeMX:\n\t\ta.Answer, err = hc.processMXRecord(state)\n\t\tif err != nil {\n\t\t\treturn plugin.NextOrFailure(hc.Name(), hc.Next, ctx, w, r)\n\t\t}\n\t// This is really only supported for odd legacy issues. Per RFC 7208, SPF\n\t// records must be TXT records\n\tcase dns.TypeSPF:\n\t\ta.Answer, err = hc.processSPFRecord(state)\n\t\tif err != nil {\n\t\t\treturn plugin.NextOrFailure(hc.Name(), hc.Next, ctx, w, r)\n\t\t}\n\t}\n\n\tstate.SizeAndDo(a)\n\tw.WriteMsg(a)\n\n\treturn dns.RcodeSuccess, nil\n}", "title": "" }, { "docid": "b79067087fb0a285b152d4da373ea5ac", "score": "0.535425", "text": "func (h *Hostsfile) ServeDNS(ctx context.Context, ch *middleware.Chain) {\n\tw, req := ch.Writer, ch.Request\n\n\tq := req.Question[0]\n\n\tanswers := []dns.RR{}\n\n\tswitch q.Qtype {\n\tcase dns.TypePTR:\n\t\tnames := h.LookupStaticAddr(dnsutil.ExtractAddressFromReverse(q.Name))\n\t\tif len(names) == 0 {\n\t\t\tch.Next(ctx)\n\t\t\treturn\n\t\t}\n\t\tanswers = ptr(q.Name, names)\n\tcase dns.TypeA:\n\t\tips := h.LookupStaticHostV4(q.Name)\n\t\tanswers = a(q.Name, ips)\n\tcase dns.TypeAAAA:\n\t\tips := h.LookupStaticHostV6(q.Name)\n\t\tanswers = aaaa(q.Name, ips)\n\t}\n\n\tif len(answers) == 0 {\n\t\tif !h.otherRecordsExist(q.Qtype, q.Name) {\n\t\t\tch.Next(ctx)\n\t\t\treturn\n\t\t}\n\t}\n\n\tm := new(dns.Msg)\n\tm.SetReply(req)\n\tm.Authoritative, m.RecursionAvailable = true, true\n\tm.Answer = answers\n\n\t_ = w.WriteMsg(m)\n\n\tch.Cancel()\n}", "title": "" }, { "docid": "f67e7f3c7cc4c173fcfe5bcad8e43a80", "score": "0.53315425", "text": "func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tvar err error\n\tmsg := dns.Msg{}\n\tmsg.SetReply(r)\n\n\t// We only support single questions for now\n\tif len(r.Question) != 1 {\n\t\tmsg.SetRcode(r, dns.RcodeNameError)\n\t} else if r.Question[0].Qtype == dns.TypePTR {\n\t\tmsg, err = h.handlePTR(r)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"PTR record lookup failed for %s: %v\", r.Question[0].Name, err)\n\t\t\tmsg.SetRcode(r, dns.RcodeNameError)\n\t\t}\n\t} else if r.Question[0].Qtype == dns.TypeA || r.Question[0].Qtype == dns.TypeAAAA {\n\t\tmsg, err = h.handleA(r)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"A record lookup failed for %s: %v\", r.Question[0].Name, err)\n\t\t\tmsg.SetRcode(r, dns.RcodeNameError)\n\t\t}\n\n\t\t// Currently forkdns doesn't support IPv6, but to ensure compatbility and expected behavior with\n\t\t// DNS clients, we return an empty AAAA response if the A record was found (meaning the domain\n\t\t// exists, but no AAAA records).\n\t\tif r.Question[0].Qtype == dns.TypeAAAA && msg.Rcode == dns.RcodeSuccess {\n\t\t\tmsg.Answer = []dns.RR{} // Empty response for AAAA if equivalent A record exists.\n\t\t}\n\t} else {\n\t\t// Fallback to NXDOMAIN\n\t\tmsg.SetRcode(r, dns.RcodeNameError)\n\t}\n\n\terr = w.WriteMsg(&msg)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed sending response for %s: %v\", r.Question[0].Name, err)\n\t}\n}", "title": "" }, { "docid": "b3940710e23b37e9b2c1851331afd94b", "score": "0.532246", "text": "func (n *Network) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tpath, _ := msg.PathWithWildcard(state.Name(), n.PathPrefix)\n\tres, err := n.get(path)\n\n\tif err != nil {\n\t\treturn 0, errKeyNotFound\n\t}\n\tresp, err := n.parseReslove(res.Kvs)\n\tif err != nil {\n\t\treturn 0, errParse\n\t}\n\n\ta := new(dns.Msg)\n\ta.SetReply(r)\n\ta.Authoritative = true\n\n\tvar rr dns.RR\n\n\trr = new(dns.A)\n\trr.(*dns.A).Hdr = dns.RR_Header{Name: state.QName(), Rrtype: dns.TypeA, Class: state.QClass()}\n\trr.(*dns.A).A = net.ParseIP(resp.Ip[rand.Intn(len(resp.Ip))]).To4()\n\n\ta.Answer = []dns.RR{rr}\n\tw.WriteMsg(a)\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "f279fe785ecaafa4c1cfe17c4e5cb9a5", "score": "0.529459", "text": "func (e *Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\topt := plugin.Options{}\n\tstate := request.Request{W: w, Req: r}\n\n\tzone := plugin.Zones(e.Zones).Matches(state.Name())\n\tif zone == \"\" {\n\t\treturn plugin.NextOrFailure(e.Name(), e.Next, ctx, w, r)\n\t}\n\n\tvar (\n\t\trecords, extra []dns.RR\n\t\ttruncated bool\n\t\terr error\n\t)\n\n\tswitch state.QType() {\n\tcase dns.TypeA:\n\t\trecords, truncated, err = plugin.A(ctx, e, zone, state, nil, opt)\n\tcase dns.TypeAAAA:\n\t\trecords, truncated, err = plugin.AAAA(ctx, e, zone, state, nil, opt)\n\tcase dns.TypeTXT:\n\t\trecords, truncated, err = plugin.TXT(ctx, e, zone, state, nil, opt)\n\tcase dns.TypeCNAME:\n\t\trecords, err = plugin.CNAME(ctx, e, zone, state, opt)\n\tcase dns.TypePTR:\n\t\trecords, err = plugin.PTR(ctx, e, zone, state, opt)\n\tcase dns.TypeMX:\n\t\trecords, extra, err = plugin.MX(ctx, e, zone, state, opt)\n\tcase dns.TypeSRV:\n\t\trecords, extra, err = plugin.SRV(ctx, e, zone, state, opt)\n\tcase dns.TypeSOA:\n\t\trecords, err = plugin.SOA(ctx, e, zone, state, opt)\n\tcase dns.TypeNS:\n\t\tif state.Name() == zone {\n\t\t\trecords, extra, err = plugin.NS(ctx, e, zone, state, opt)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\tdefault:\n\t\t// Do a fake A lookup, so we can distinguish between NODATA and NXDOMAIN\n\t\t_, _, err = plugin.A(ctx, e, zone, state, nil, opt)\n\t}\n\tif err != nil && e.IsNameError(err) {\n\t\tif e.Fall.Through(state.Name()) {\n\t\t\treturn plugin.NextOrFailure(e.Name(), e.Next, ctx, w, r)\n\t\t}\n\t\t// Make err nil when returning here, so we don't log spam for NXDOMAIN.\n\t\treturn plugin.BackendError(ctx, e, zone, dns.RcodeNameError, state, nil /* err */, opt)\n\t}\n\tif err != nil {\n\t\treturn plugin.BackendError(ctx, e, zone, dns.RcodeServerFailure, state, err, opt)\n\t}\n\n\tif len(records) == 0 {\n\t\treturn plugin.BackendError(ctx, e, zone, dns.RcodeSuccess, state, err, opt)\n\t}\n\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\tm.Truncated = truncated\n\tm.Authoritative = true\n\tm.Answer = append(m.Answer, records...)\n\tm.Extra = append(m.Extra, extra...)\n\n\tw.WriteMsg(m)\n\treturn dns.RcodeSuccess, nil\n}", "title": "" }, { "docid": "b6d57f327172c862f82d64d01915d322", "score": "0.5185909", "text": "func (d *Driver) GetDNS(domain string) (string, error) {\n\tif d.debug {\n\t\tfmt.Printf(\"GetDNS(%q)\\r\\n\", domain)\n\t}\n\n\tipaddr := make([]byte, 4)\n\t_, err := d.Rpc_netconn_gethostbyname(domain, &ipaddr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tret, err := fmt.Sprintf(\"%d.%d.%d.%d\", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]), nil\n\tif d.debug {\n\t\tfmt.Printf(\"-> %s\\r\\n\", ret)\n\t\tfmt.Printf(\"-> %02X.%02X.%02X.%02X\\r\\n\", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3])\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "f61751788ddffe351963dfe48eeecb2d", "score": "0.5179518", "text": "func (h Header) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tapplyRules(r, h.QueryRules)\n\n\twr := ResponseHeaderWriter{ResponseWriter: w, Rules: h.ResponseRules}\n\treturn plugin.NextOrFailure(h.Name(), h.Next, ctx, &wr, r)\n}", "title": "" }, { "docid": "78219ee5ba89875e464d9d27d134235b", "score": "0.5116811", "text": "func (mn Meshname) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tvar remoteLookups = make(map[string][]dns.Question)\n\n\ta := new(dns.Msg)\n\ta.SetReply(r)\n\ta.Authoritative = true\n\n\tfor _, q := range r.Question {\n\t\tlabels := dns.SplitDomainName(q.Name)\n\t\tif len(labels) < 2 {\n\t\t\t// s.log.Debugln(\"Error: invalid domain requested\")\n\t\t\tcontinue\n\t\t}\n\t\tsubDomain := labels[len(labels)-2]\n\n\n\t\tresolvedAddr, err := _meshname.IPFromDomain(&subDomain)\n\t\tif err != nil {\n\t\t\t// s.log.Debugln(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tremoteLookups[resolvedAddr.String()] = append(remoteLookups[resolvedAddr.String()], q)\n\t}\n\n\tfor remoteServer, questions := range remoteLookups {\n\t\trm := new(dns.Msg)\n\t\trm.RecursionDesired = true\n\t\trm.Question = questions\n\t\tresp, _, err := mn.dnsClient.Exchange(rm, \"[\"+remoteServer+\"]:53\") // no retries\n\t\tif err != nil {\n\t\t\t// s.log.Debugln(err)\n\t\t\tcontinue\n\t\t}\n\t\t// s.log.Debugln(resp.String())\n\t\ta.Answer = append(a.Answer, resp.Answer...)\n\t\ta.Ns = append(a.Ns, resp.Ns...)\n\t\ta.Extra = append(a.Extra, resp.Extra...)\n\t}\n\n\tw.WriteMsg(a)\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "e84dec456f8cdef78f2d33bccf1662c1", "score": "0.50919086", "text": "func (z *Zone) ServeDNS(ctx context.Context, w MessageWriter, r *Query) {\n\tw.Authoritative(true)\n\n\tvar found bool\n\tfor _, q := range r.Questions {\n\t\tif !strings.HasSuffix(q.Name, z.Origin) {\n\t\t\tcontinue\n\t\t}\n\t\tif q.Type == TypeSOA && q.Name == z.Origin {\n\t\t\tw.Answer(q.Name, z.TTL, z.SOA)\n\t\t\tfound = true\n\n\t\t\tcontinue\n\t\t}\n\n\t\tdn := q.Name[:len(q.Name)-len(z.Origin)-1]\n\n\t\trrs, ok := z.RRs.GetKey(dn)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, rr := range rrs[q.Type] {\n\t\t\tw.Answer(q.Name, z.TTL, rr)\n\t\t\tfound = true\n\n\t\t\tif r.RecursionDesired && rr.Type() == TypeCNAME {\n\t\t\t\tname := rr.(*CNAME).CNAME\n\t\t\t\tdn := name[:len(name)-len(z.Origin)-1]\n\n\t\t\t\tif rrs, ok := z.RRs.GetKey(dn); ok {\n\t\t\t\t\tfor _, rr := range rrs[q.Type] {\n\t\t\t\t\t\tw.Answer(name, z.TTL, rr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif !found {\n\t\tw.Status(NXDomain)\n\n\t\tif z.SOA != nil {\n\t\t\tw.Authority(z.Origin, z.TTL, z.SOA)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d99caca6b363bd27bf6078ce39c6e7f4", "score": "0.50759614", "text": "func (a *Agent) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tmsg := dns.Msg{}\n\tmsg.SetReply(r)\n\tmsg.Authoritative = true\n\n\tdomain := msg.Question[0].Name\n\tanswers, err := a.LookupDNS(r.Question[0].Qtype, domain)\n\tif err != nil {\n\t\tw.WriteMsg(&msg)\n\t}\n\n\tswitch r.Question[0].Qtype {\n\tcase dns.TypeA:\n\t\tfor _, answer := range answers {\n\t\t\tmsg.Answer = append(msg.Answer, &dns.A{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: domain,\n\t\t\t\t\tRrtype: dns.TypeA,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: uint32(a.CacheTTL),\n\t\t\t\t},\n\t\t\t\tA: net.ParseIP(answer.Result),\n\t\t\t})\n\t\t}\n\tcase dns.TypeCNAME:\n\t\tfor _, answer := range answers {\n\t\t\tmsg.Answer = append(msg.Answer, &dns.CNAME{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: domain,\n\t\t\t\t\tRrtype: dns.TypeCNAME,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: uint32(a.CacheTTL),\n\t\t\t\t},\n\t\t\t\tTarget: answer.Result,\n\t\t\t})\n\t\t}\n\tcase dns.TypeAAAA:\n\t\tfor _, answer := range answers {\n\t\t\tmsg.Answer = append(msg.Answer, &dns.AAAA{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: domain,\n\t\t\t\t\tRrtype: dns.TypeAAAA,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: uint32(a.CacheTTL),\n\t\t\t\t},\n\t\t\t\tAAAA: net.ParseIP(answer.Result),\n\t\t\t})\n\t\t}\n\tcase dns.TypeMX:\n\t\tfor _, answer := range answers {\n\t\t\tmsg.Answer = append(msg.Answer, &dns.MX{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: domain,\n\t\t\t\t\tRrtype: dns.TypeMX,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: uint32(a.CacheTTL),\n\t\t\t\t},\n\t\t\t\tMx: answer.Result,\n\t\t\t\tPreference: answer.Preference,\n\t\t\t})\n\t\t}\n\t}\n\tw.WriteMsg(&msg)\n}", "title": "" }, { "docid": "ce79f5ed4547655272e3d25bff2e0347", "score": "0.5065064", "text": "func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tdefer func() {\n\t\t// In case the user doesn't enable error middleware, we still\n\t\t// need to make sure that we stay alive up here\n\t\tif rec := recover(); rec != nil {\n\t\t\tDefaultErrorFunc(w, r, dns.RcodeServerFailure)\n\t\t}\n\t}()\n\n\tif m, err := middleware.Edns0Version(r); err != nil { // Wrong EDNS version, return at once.\n\t\trc := middleware.RcodeToString(dns.RcodeBadVers)\n\t\t// TODO(miek): hardcoded \"udp\" here.\n\t\tmetrics.Report(metrics.Dropped, \"udp\", rc, m.Len(), time.Now())\n\t\tw.WriteMsg(m)\n\t\treturn\n\t}\n\n\t// Execute the optional request callback if it exists\n\tif s.ReqCallback != nil && s.ReqCallback(w, r) {\n\t\treturn\n\t}\n\n\tq := r.Question[0].Name\n\tb := make([]byte, len(q))\n\toff, end := 0, false\n\tctx := context.Background()\n\n\tfor {\n\t\tl := len(q[off:])\n\t\tfor i := 0; i < l; i++ {\n\t\t\tb[i] = q[off+i]\n\t\t\t// normalize the name for the lookup\n\t\t\tif b[i] >= 'A' && b[i] <= 'Z' {\n\t\t\t\tb[i] |= ('a' - 'A')\n\t\t\t}\n\t\t}\n\n\t\tif h, ok := s.zones[string(b[:l])]; ok {\n\t\t\tif r.Question[0].Qtype != dns.TypeDS {\n\t\t\t\trcode, _ := h.stack.ServeDNS(ctx, w, r)\n\t\t\t\tif RcodeNoClientWrite(rcode) {\n\t\t\t\t\tDefaultErrorFunc(w, r, rcode)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\toff, end = dns.NextLabel(q, off)\n\t\tif end {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Wildcard match, if we have found nothing try the root zone as a last resort.\n\tif h, ok := s.zones[\".\"]; ok {\n\t\trcode, _ := h.stack.ServeDNS(ctx, w, r)\n\t\tif RcodeNoClientWrite(rcode) {\n\t\t\tDefaultErrorFunc(w, r, rcode)\n\t\t}\n\t\treturn\n\t}\n\n\t// Still here? Error out with REFUSED and some logging\n\tremoteHost := w.RemoteAddr().String()\n\tDefaultErrorFunc(w, r, dns.RcodeRefused)\n\tlog.Printf(\"[INFO] \\\"%s %s %s\\\" - No such zone at %s (Remote: %s)\", dns.Type(r.Question[0].Qtype), dns.Class(r.Question[0].Qclass), q, s.Addr, remoteHost)\n}", "title": "" }, { "docid": "0fb0829c61406cb012769acc2c294c22", "score": "0.50568736", "text": "func parseDNSResponse(respData []byte) (uint32, error) {\n\t// initialize a DNS message\n\tvar msg dnsmessage.Message\n\t// smallestTTL holds the smallest TTL found in any response.\n\t// As per RFC8484, Section 5.1, the smallest <of-many> TTLs must\n\t// be used, i.e. to apply for cache-control:max-age\n\t// Likewise, the same value is used to steer the Radis cache behaviour\n\tvar smallestTTL uint32 = 0\n\n\t// unpack the DNS packet\n\terr := msg.Unpack(respData)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tlogrus.Debugf(\"DNS Response carries %d answer(s)\\n\", len(msg.Answers))\n\n\t// parse the response\n\tfor _, dnsRR := range msg.Answers {\n\t\tlogrus.Debugf(\"Response RR: \", dnsRR)\n\t\tlogrus.Debugf(\"-> TTL is %d seconds\\n\", dnsRR.Header.TTL)\n\n\t\t// store minimum TTL if we have no value yet for the TTL\n\t\t// of if the previous value of the TTL is bigger than the current value\n\t\tif smallestTTL == 0 || smallestTTL >= dnsRR.Header.TTL {\n\t\t\tsmallestTTL = dnsRR.Header.TTL\n\t\t}\n\t}\n\n\tlogrus.Debugf(\"Smallest TTL in response considered: %d\", smallestTTL)\n\n\t// return a\n\treturn smallestTTL, nil\n}", "title": "" }, { "docid": "ecb2bd265233e8a6d08179c9b9ede781", "score": "0.5055615", "text": "func (e *Extractor) ExtractDNS(msg string) map[string]struct{} {\n\t// Match the parts as required for regex check\n\treturn e.extractRegex(msg)\n}", "title": "" }, { "docid": "07cbac4e1d4915bbd1a0285f32866d41", "score": "0.50416607", "text": "func (cass *Cassandra) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tqname := state.Name()\n\tqtype := state.QType()\n\tclog.Infof(\"ServeDNS: qname=%s, qtype=%s\",qname, state.Type())\n\n\tif time.Since(cass.LastZoneUpdate) > zoneUpdateTime {\n\t\tcass.LoadZones()\n\t}\n\n\tzone := plugin.Zones(cass.Zones).Matches(qname)\n\tclog.Debugf(\"attempting to serve zone: %s\",zone)\n\tif zone == \"\" {\n\t\treturn plugin.NextOrFailure(qname, cass.Next, ctx, w, r)\n\t}\n\n\tanswers := make([]dns.RR, 0, 10)\n\textras := make([]dns.RR, 0, 10)\n\tvar err error\n\n\tswitch qtype {\n\tcase dns.TypeAXFR, dns.TypeIXFR:\n\t\treturn errorResponse(state, zone, dns.RcodeNotImplemented, err)\n\n\tcase dns.TypeA:\n\t\tanswers, extras, err = cass.A(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeAAAA:\n\t\tanswers, extras, err = cass.AAAA(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeCNAME:\n\t\tanswers, extras, err = cass.CNAME(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeTXT:\n\t\tanswers, extras, err = cass.TXT(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeNS:\n\t\tanswers, extras, err = cass.NS(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeMX:\n\t\tanswers, extras, err = cass.MX(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeSRV:\n\t\tanswers, extras, err = cass.SRV(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tcase dns.TypeSOA:\n\t\tanswers, extras, err = cass.SOA(zone,qname)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\tdefault:\n\t\treturn errorResponse(state, zone, dns.RcodeNotImplemented, err)\n\t}\n\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\tm.Authoritative, m.RecursionAvailable, m.Compress = true, false, true\n\n\tm.Answer = append(m.Answer, answers...)\n\tm.Extra = append(m.Extra, extras...)\n\n\tstate.SizeAndDo(m)\n\tm = state.Scrub(m)\n\t_ = w.WriteMsg(m)\n\treturn dns.RcodeSuccess, nil\n}", "title": "" }, { "docid": "b5914038deafefe166ad1b7639705071", "score": "0.5022191", "text": "func (d *dnsProviderPrivate) Present(domain, token, keyAuth string) error {\n\tctx := context.Background()\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\tzone, err := d.getHostedZoneID(ctx, info.EffectiveFQDN)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"azure: %w\", err)\n\t}\n\n\trsc := privatedns.NewRecordSetsClientWithBaseURI(d.config.ResourceManagerEndpoint, d.config.SubscriptionID)\n\trsc.Authorizer = d.authorizer\n\n\tsubDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, zone)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"azure: %w\", err)\n\t}\n\n\t// Get existing record set\n\trset, err := rsc.Get(ctx, d.config.ResourceGroup, zone, privatedns.TXT, subDomain)\n\tif err != nil {\n\t\tvar detailed autorest.DetailedError\n\t\tif !errors.As(err, &detailed) || detailed.StatusCode != http.StatusNotFound {\n\t\t\treturn fmt.Errorf(\"azure: %w\", err)\n\t\t}\n\t}\n\n\t// Construct unique TXT records using map\n\tuniqRecords := map[string]struct{}{info.Value: {}}\n\tif rset.RecordSetProperties != nil && rset.TxtRecords != nil {\n\t\tfor _, txtRecord := range *rset.TxtRecords {\n\t\t\t// Assume Value doesn't contain multiple strings\n\t\t\tvalues := to.StringSlice(txtRecord.Value)\n\t\t\tif len(values) > 0 {\n\t\t\t\tuniqRecords[values[0]] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar txtRecords []privatedns.TxtRecord\n\tfor txt := range uniqRecords {\n\t\ttxtRecords = append(txtRecords, privatedns.TxtRecord{Value: &[]string{txt}})\n\t}\n\n\trec := privatedns.RecordSet{\n\t\tName: &subDomain,\n\t\tRecordSetProperties: &privatedns.RecordSetProperties{\n\t\t\tTTL: to.Int64Ptr(int64(d.config.TTL)),\n\t\t\tTxtRecords: &txtRecords,\n\t\t},\n\t}\n\n\t_, err = rsc.CreateOrUpdate(ctx, d.config.ResourceGroup, zone, privatedns.TXT, subDomain, rec, \"\", \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"azure: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98d00b134161259a0485e0d8aad10877", "score": "0.50188386", "text": "func verifyDNS(addr string, sshConn *SSHConnection) (bool, string, error) {\n\tif !viper.GetBool(\"verify-dns\") || sshConn.SSHConn.Permissions == nil {\n\t\treturn false, \"\", nil\n\t}\n\n\tif _, ok := sshConn.SSHConn.Permissions.Extensions[\"pubKeyFingerprint\"]; !ok {\n\t\treturn false, \"\", nil\n\t}\n\n\trecords, err := net.LookupTXT(addr)\n\n\tfor _, v := range records {\n\t\tif strings.HasPrefix(v, sishDNSPrefix) {\n\t\t\tdnsPubKeyFingerprint := strings.TrimSpace(strings.TrimPrefix(v, sishDNSPrefix))\n\n\t\t\tmatch := sshConn.SSHConn.Permissions.Extensions[\"pubKeyFingerprint\"] == dnsPubKeyFingerprint\n\t\t\tif match {\n\t\t\t\treturn match, dnsPubKeyFingerprint, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false, \"\", nil\n}", "title": "" }, { "docid": "29d4494dbe2fb4522831421e448117e9", "score": "0.4969659", "text": "func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\n\t// Add send option into context so other plugin can decide on which DNSTap\n\t// message to be sent out\n\tsendOption := taprw.SendOption{Cq: true, Cr: true}\n\tnewCtx := context.WithValue(ctx, DnstapSendOption, &sendOption)\n\n\trw := &taprw.ResponseWriter{\n\t\tResponseWriter: w,\n\t\tTapper: &h,\n\t\tQuery: r,\n\t\tSend: &sendOption,\n\t\tQueryEpoch: time.Now(),\n\t}\n\n\tcode, err := plugin.NextOrFailure(h.Name(), h.Next, tapContext{newCtx, h}, rw, r)\n\tif err != nil {\n\t\t// ignore dnstap errors\n\t\treturn code, err\n\t}\n\n\tif err = rw.DnstapError(); err != nil {\n\t\treturn code, plugin.Error(\"dnstap\", err)\n\t}\n\n\treturn code, nil\n}", "title": "" }, { "docid": "7d353f1bdc2bdb70a2aa6f28ecdf1c58", "score": "0.49616525", "text": "func (h *bridgeServices) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\n\tfor _, q := range r.Question {\n\t\tswitch q.Name {\n\t\tcase h.name + \".\":\n\t\t\tm.Answer = append(m.Answer, &dns.A{\n\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 60},\n\t\t\t\tA: h.baseIP,\n\t\t\t})\n\t\tcase \"googleDNS.\":\n\t\t\tm.Answer = append(m.Answer, &dns.A{\n\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 0},\n\t\t\t\tA: net.ParseIP(\"8.8.8.8\"),\n\t\t\t})\n\t\tdefault:\n\t\t\tresp, err := http.Get(\"https://dns.google.com/resolve?name=\" + q.Name + \"&type=\" + fmt.Sprintf(\"%d\", q.Qtype))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to lookup DNS for %v: %v\\n\", q.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar response dnsResponse\n\t\t\tif err := json.NewDecoder(resp.Body).Decode(&response); err != nil {\n\t\t\t\tfmt.Printf(\"Failed to decode DNS response for %v: %v\\n\", q.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, a := range response.Answer {\n\t\t\t\tswitch a.Type {\n\t\t\t\tcase dns.TypeA:\n\t\t\t\t\tm.Answer = append(m.Answer, &dns.A{\n\t\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: a.TTL},\n\t\t\t\t\t\tA: net.ParseIP(a.Data),\n\t\t\t\t\t})\n\t\t\t\tcase dns.TypeAAAA:\n\t\t\t\t\tm.Answer = append(m.Answer, &dns.AAAA{\n\t\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeAAAA, Class: dns.ClassINET, Ttl: a.TTL},\n\t\t\t\t\t\tAAAA: net.ParseIP(a.Data),\n\t\t\t\t\t})\n\t\t\t\tcase dns.TypeNS:\n\t\t\t\t\tm.Answer = append(m.Answer, &dns.NS{\n\t\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeNS, Class: dns.ClassINET, Ttl: a.TTL},\n\t\t\t\t\t\tNs: a.Data,\n\t\t\t\t\t})\n\t\t\t\tcase dns.TypeCNAME:\n\t\t\t\t\tm.Answer = append(m.Answer, &dns.CNAME{\n\t\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeCNAME, Class: dns.ClassINET, Ttl: a.TTL},\n\t\t\t\t\t\tTarget: a.Data,\n\t\t\t\t\t})\n\t\t\t\tcase dns.TypeTXT:\n\t\t\t\t\tm.Answer = append(m.Answer, &dns.TXT{\n\t\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: a.TTL},\n\t\t\t\t\t\tTxt: []string{a.Data},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tm.RecursionDesired = false\n\tm.RecursionAvailable = true\n\tw.WriteMsg(m)\n}", "title": "" }, { "docid": "77e0625e5068bc3448e24c3e81769564", "score": "0.49450576", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tfqdn, value, _ := acme.DNS01Record(domain, keyAuth)\n\tzone, err := d.getHostedZone(fqdn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pdns: %v\", err)\n\t}\n\n\tname := fqdn\n\n\t// pre-v1 API wants non-fqdn\n\tif d.apiVersion == 0 {\n\t\tname = acme.UnFqdn(fqdn)\n\t}\n\n\trec := pdnsRecord{\n\t\tContent: \"\\\"\" + value + \"\\\"\",\n\t\tDisabled: false,\n\n\t\t// pre-v1 API\n\t\tType: \"TXT\",\n\t\tName: name,\n\t\tTTL: d.config.TTL,\n\t}\n\n\trrsets := rrSets{\n\t\tRRSets: []rrSet{\n\t\t\t{\n\t\t\t\tName: name,\n\t\t\t\tChangeType: \"REPLACE\",\n\t\t\t\tType: \"TXT\",\n\t\t\t\tKind: \"Master\",\n\t\t\t\tTTL: d.config.TTL,\n\t\t\t\tRecords: []pdnsRecord{rec},\n\t\t\t},\n\t\t},\n\t}\n\n\tbody, err := json.Marshal(rrsets)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pdns: %v\", err)\n\t}\n\n\t_, err = d.makeRequest(http.MethodPatch, zone.URL, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pdns: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a209284eefac64aba4ecd56f4992cf82", "score": "0.49236193", "text": "func handleDNS(w dns.ResponseWriter, r *dns.Msg, EXT_IP string) {\n\t// many thanks to the original author of this function\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\tm.Compress = false\n\tm.Authoritative = true\n\tparseDNS(m, w.RemoteAddr().String(), EXT_IP)\n\tw.WriteMsg(m)\n}", "title": "" }, { "docid": "91e8a7ba1b894ee85f94d11f6e975810", "score": "0.49178505", "text": "func checkNSRecordMatches(domain, hostname string) {\n\n\ttime.Sleep(1 * time.Second)\n\n\tresults, err := net.LookupNS(domain)\n\n\tif err != nil {\n\t\tlog.Printf(\"WARN: No working NS records found for %s\", domain)\n\t\tlog.Printf(\"WARN: You can still test things using `dig example.%s @%s`, but you won't be able to resolve hosts directly.\", domain, hostname)\n\t\tlog.Printf(\"WARN: See https://github.com/danieljimenez/aws-name-server for instructions on setting up NS records.\")\n\t\treturn\n\t}\n\n\tmatched := false\n\n\tfor _, record := range results {\n\t\tif record.Host == hostname {\n\t\t\tmatched = true\n\t\t}\n\t}\n\n\tif !matched {\n\t\tlog.Printf(\"WARN: The NS record for %s points to: %s\", domain, results[0].Host)\n\t\tlog.Printf(\"WARN: But --hostname is: %s\", hostname)\n\t\tlog.Printf(\"WARN: These hostnames must match if you want DNS to work properly.\")\n\t\tlog.Printf(\"WARN: See https://github.com/danieljimenez/aws-name-server for instructions on NS records.\")\n\t}\n}", "title": "" }, { "docid": "b927a979f48e746fd9113b1c8a7f3010", "score": "0.49161065", "text": "func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tvar err error\n\tresp := new(dns.Msg)\n\tresp.SetReply(r)\n\t// Return an empty response in worst case scenario\n\tdefer func() {\n\t\tif resp.Answer == nil {\n\t\t\tresp.SetRcode(r, dns.RcodeServerFailure)\n\t\t}\n\n\t\terr = w.WriteMsg(resp)\n\t\tif err != nil {\n\t\t\ts.logger.Errorf(\"Failed to write dns response: %s\", err)\n\t\t}\n\t}()\n\n\tif len(r.Question) == 0 {\n\t\treturn\n\t}\n\n\trequestName := r.Question[0].Name\n\ts.logger.Infof(\"Received resolution request for: %s\", requestName)\n\n\taddr := s.registry.ResolveDomain(requestName)\n\ts.logger.Infof(\"Resolved domain to address: %s\", net.ParseIP(addr))\n\tif addr == \"\" {\n\t\treturn\n\t}\n\n\tresp.Authoritative = true\n\tresp.Answer = []dns.RR{\n\t\t&dns.A{\n\t\t\tHdr: dns.RR_Header{\n\t\t\t\tName: r.Question[0].Name,\n\t\t\t\tRrtype: dns.TypeA,\n\t\t\t\tClass: dns.ClassINET,\n\t\t\t\tTtl: 0,\n\t\t\t},\n\t\t\tA: net.ParseIP(addr),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8213a5743a366b85073ca2c9550ff113", "score": "0.49151713", "text": "func (s *server) ServeDNS(w miekgdns.ResponseWriter, r *miekgdns.Msg) {\n\tq := r.Question\n\tr.Question = make([]miekgdns.Question, 0, len(q))\n\tquestion := q[0]\n\tname := question.Name\n\tswitch strings.Count(question.Name, \".\") {\n\tcase 1:\n\t\tquestion.Name = question.Name + s.forwardDNS.Search[0] + \".\"\n\tcase 2:\n\t\tquestion.Name = question.Name + s.forwardDNS.Search[1] + \".\"\n\tcase 3:\n\t\tquestion.Name = question.Name + s.forwardDNS.Search[2] + \".\"\n\tcase 4:\n\t\tquestion.Name = question.Name + strings.Split(s.forwardDNS.Search[2], \".\")[1] + \".\"\n\tcase 5:\n\tdefault:\n\t\tw.Close()\n\t\treturn\n\t}\n\tr.Question = []miekgdns.Question{question}\n\tanswer, _, err := s.client.Exchange(r, s.forwardDNS.Servers[0]+\":53\")\n\tif err != nil {\n\t\tif !strings.Contains(err.Error(), \"timeout\") {\n\t\t\tlog.Warnln(err)\n\t\t}\n\t\tif err = w.WriteMsg(r); err != nil {\n\t\t\tlog.Warnln(err)\n\t\t}\n\t} else {\n\t\tif len(answer.Answer) != 0 {\n\t\t\tanswer.Answer[0].Header().Name = name\n\t\t}\n\t\tif len(answer.Question) != 0 {\n\t\t\tanswer.Question[0].Name = name\n\t\t}\n\t\tif err = w.WriteMsg(answer); err != nil {\n\t\t\tlog.Warnln(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b53fe42152b50abe6fc7a2d09d9c352", "score": "0.49148256", "text": "func (h *DNSServer) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tmsg := dns.Msg{}\n\tmsg.SetReply(r)\n\tmsg.Authoritative = false\n\tmsg.RecursionAvailable = h.SpoofRecursive\n\n\tq := &r.Question[0]\n\tlcName := strings.ToLower(q.Name)\n\n\tsendNs := 0\n\n\tsoaValue := h.doLookup(\"SOA\", lcName)\n\tif soaValue != nil && len(soaValue.Value) > 0 {\n\t\tmsg.Authoritative = true\n\n\t\tsendNs = 1\n\t}\n\n\ttString := \"Unknown\"\n\n\tswitch q.Qtype {\n\tcase dns.TypeANY:\n\t\th.handleA(lcName, &msg, q)\n\t\th.handleAAAA(lcName, &msg, q)\n\t\th.handleMX(lcName, &msg, q)\n\t\th.handleTXT(lcName, &msg, q)\n\t\ttString = \"ANY\"\n\tcase dns.TypeA:\n\t\th.handleA(lcName, &msg, q)\n\t\ttString = \"A\"\n\tcase dns.TypeAAAA:\n\t\th.handleAAAA(lcName, &msg, q)\n\t\ttString = \"AAAA\"\n\tcase dns.TypeMX:\n\t\th.handleMX(lcName, &msg, q)\n\t\ttString = \"MX\"\n\tcase dns.TypeTXT:\n\t\th.handleTXT(lcName, &msg, q)\n\t\ttString = \"TXT\"\n\tcase dns.TypeNS:\n\t\tif msg.Authoritative {\n\t\t\tif soaValue.Value[0] == lcName {\n\t\t\t\tsendNs = 2\n\t\t\t}\n\t\t}\n\t\ttString = \"NS\"\n\tcase dns.TypeSOA:\n\t\tif msg.Authoritative {\n\t\t\tif soaValue.Value[0] == lcName {\n\t\t\t\tmsg.Answer = append(msg.Answer, &dns.SOA{\n\t\t\t\t\tHdr: dns.RR_Header{Name: q.Name, Rrtype: q.Qtype, Class: q.Qclass, Ttl: soaValue.TTL},\n\t\t\t\t\tNs: h.NSNames[0],\n\t\t\t\t\tMbox: h.SoaMBox,\n\t\t\t\t\tSerial: uint32(time.Now().UnixNano() * int64(time.Nanosecond) / int64(time.Second)),\n\t\t\t\t\tRefresh: 3600,\n\t\t\t\t\tRetry: 60,\n\t\t\t\t\tExpire: 3600,\n\t\t\t\t\tMinttl: 10,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\ttString = \"SOA\"\n\t}\n\n\t//Add authority section, unless we want to send it as answer\n\tif sendNs > 0 {\n\t\tfor _, l := range h.NSNames {\n\t\t\tns := &dns.NS{\n\t\t\t\tHdr: dns.RR_Header{Name: soaValue.Value[0], Rrtype: dns.TypeNS, Class: dns.ClassINET, Ttl: soaValue.TTL},\n\t\t\t\tNs: l,\n\t\t\t}\n\t\t\tif sendNs == 1 {\n\t\t\t\tmsg.Ns = append(msg.Ns, ns)\n\t\t\t} else if sendNs == 2 {\n\t\t\t\tmsg.Answer = append(msg.Answer, ns)\n\t\t\t}\n\t\t}\n\t}\n\n\th.Logger(\"SimpleDNS: Serving %s->%s: %s %s->%+v\", w.RemoteAddr(), w.LocalAddr(), tString, lcName, msg.Answer)\n\n\tw.WriteMsg(&msg)\n}", "title": "" }, { "docid": "d44256a6d39d27eb97d941d506733fd4", "score": "0.4901714", "text": "func (o KeySigningKeyOutput) DnskeyRecord() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *KeySigningKey) pulumi.StringOutput { return v.DnskeyRecord }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d3de8887e2fe64a134508f04e18ebd9b", "score": "0.48619425", "text": "func (d Dump) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\trep := replacer.New()\n\ttrw := dnstest.NewRecorder(w)\n\tfmt.Fprintln(output, rep.Replace(ctx, state, trw, format))\n\treturn plugin.NextOrFailure(d.Name(), d.Next, ctx, w, r)\n}", "title": "" }, { "docid": "e73758239e1d7dbfefeba1de74073a54", "score": "0.48540205", "text": "func lookupDNS(domain string, outputFile string, plain bool) {\n\tif outputFile != \"\" {\n\t\tif outputFile[len(outputFile)-4:] == \"html\" {\n\t\t\theaderHTML(\"DNS SCANNING\", outputFile)\n\t\t}\n\t}\n\t// -- A RECORDS --\n\tips, err := net.LookupIP(domain)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Could not get IPs: %v\\n\", err)\n\t}\n\tfor _, ip := range ips {\n\t\tif !plain {\n\t\t\tfmt.Printf(\"[+]FOUND %s IN A: \", domain)\n\t\t\tcolor.Green(\"%s\\n\", ip.String())\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\n\", ip.String())\n\t\t}\n\t\tif outputFile != \"\" {\n\t\t\tappendWhere(ip.String(), \"\", outputFile)\n\t\t}\n\t}\n\t// -- CNAME RECORD --\n\tcname, err := net.LookupCNAME(domain)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Could not get CNAME: %v\\n\", err)\n\t}\n\tif !plain {\n\t\tfmt.Printf(\"[+]FOUND %s IN CNAME: \", domain)\n\t\tcolor.Green(\"%s\\n\", cname)\n\t} else {\n\t\tfmt.Printf(\"%s\\n\", cname)\n\t}\n\tif outputFile != \"\" {\n\t\tappendWhere(cname, \"\", outputFile)\n\t}\n\t// -- NS RECORDS --\n\tnameserver, err := net.LookupNS(domain)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Could not get NSs: %v\\n\", err)\n\t}\n\tfor _, ns := range nameserver {\n\t\tif !plain {\n\t\t\tfmt.Printf(\"[+]FOUND %s IN NS: \", domain)\n\t\t\tcolor.Green(\"%s\\n\", ns.Host)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\n\", ns.Host)\n\t\t}\n\t\tif outputFile != \"\" {\n\t\t\tappendWhere(ns.Host, \"\", outputFile)\n\t\t}\n\t}\n\t// -- MX RECORDS --\n\tmxrecords, err := net.LookupMX(domain)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Could not get MXs: %v\\n\", err)\n\t}\n\tfor _, mx := range mxrecords {\n\t\tif !plain {\n\t\t\tfmt.Printf(\"[+]FOUND %s IN MX: \", domain)\n\t\t\tcolor.Green(\"%s %v\\n\", mx.Host, mx.Pref)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s %v\\n\", mx.Host, mx.Pref)\n\t\t}\n\t\tif outputFile != \"\" {\n\t\t\tappendWhere(mx.Host, \"\", outputFile)\n\t\t}\n\t}\n\t_, srvs, err := net.LookupSRV(\"xmpp-server\", \"tcp\", domain)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Could not get SRVs: %v\\n\", err)\n\t}\n\tfor _, srv := range srvs {\n\t\tif !plain {\n\t\t\tfmt.Printf(\"[+]FOUND %s IN SRV: \", domain)\n\t\t\tcolor.Green(\"%v:%v:%d:%d\\n\", srv.Target, srv.Port, srv.Priority, srv.Weight)\n\t\t} else {\n\t\t\tfmt.Printf(\"%v:%v:%d:%d\\n\", srv.Target, srv.Port, srv.Priority, srv.Weight)\n\t\t}\n\t\tif outputFile != \"\" {\n\t\t\tappendWhere(srv.Target, \"\", outputFile)\n\t\t}\n\t}\n\ttxtrecords, _ := net.LookupTXT(domain)\n\tfor _, txt := range txtrecords {\n\t\tif !plain {\n\t\t\tfmt.Printf(\"[+]FOUND %s IN TXT: \", domain)\n\t\t\tcolor.Green(\"%s\\n\", txt)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\n\", txt)\n\t\t}\n\t\tif outputFile != \"\" {\n\t\t\tappendWhere(txt, \"\", outputFile)\n\t\t}\n\t}\n\tif outputFile != \"\" {\n\t\tif outputFile[len(outputFile)-4:] == \"html\" {\n\t\t\tfooterHTML(outputFile)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63cc85e61397a52b67aebb3c2a6f47b7", "score": "0.48161158", "text": "func dnsLookup(domain, msgType string) {\n\tt := dns.StringToType[msgType]\n\tswitch t {\n\tcase dns.TypeA, dns.TypeAAAA, dns.TypeCNAME, dns.TypeMX:\n\t\tbreak\n\tdefault:\n\t\tlog.Printf(\"Unexpected query type (%v); defaulting to 'A'\", msgType)\n\t\tt = dns.TypeA\n\t}\n\n\tq := new(dns.Msg)\n\tq.SetQuestion(dns.Fqdn(domain), t)\n\n\t// try each dns server if a connection error is encountered\n\t// server response codes (e.g. NXDOMAIN) are *not* considered errors\n\tfor _, d := range dnsServers {\n\t\t_, err := dnsQuery(q, d)\n\t\tif err != nil {\n\t\t\tlog.Print(err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "572c21fdb8559520349354b1a993371a", "score": "0.4805545", "text": "func (cc *CoreControl) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\t// Need to bring up the server\n\n\t// Record response to get status code and size of the reply.\n\tstatus, err := plugin.NextOrFailure(cc.Name(), cc.Next, ctx, w, r)\n\n\treturn status, err\n}", "title": "" }, { "docid": "0b006ae994855e0a52126790bd04c574", "score": "0.4803976", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tctx := context.Background()\n\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\t// TODO(ldez) replace domain by FQDN to follow CNAME.\n\tzoneDomain, err := d.getHostedZone(ctx, domain)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"vultr: %w\", err)\n\t}\n\n\tsubDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, zoneDomain)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"vultr: %w\", err)\n\t}\n\n\treq := govultr.DomainRecordReq{\n\t\tName: subDomain,\n\t\tType: \"TXT\",\n\t\tData: `\"` + info.Value + `\"`,\n\t\tTTL: d.config.TTL,\n\t\tPriority: func(v int) *int { return &v }(0),\n\t}\n\t_, err = d.client.DomainRecord.Create(ctx, zoneDomain, &req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"vultr: API call failed: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3637664edab6ff6f66f718f9a3eed281", "score": "0.480313", "text": "func (c *config) getCertFromLetsEncrypt(hostnames []string, hostrec *domainConf, route53client *route53.Route53) ([]byte, error) {\n\t// First, register our key if not already done\n\tif !c.ACME.registered {\n\t\tlog.Println(\"always try to register our key and email address with Let's Encrypt...\")\n\t\t_, err := c.ACME.client.CreateAccount(context.Background(), &acme.Account{\n\t\t\tContact: []string{\"mailto:\" + c.ACME.Email},\n\t\t\tTermsAgreed: true,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Println(\"error registering with Let's Encrypt (this is expected) - ignoring: \", err)\n\t\t}\n\n\t\t// no point re-doing each time\n\t\tc.ACME.registered = true\n\t}\n\n\t// Now, initiate DNS challenge\n\tlog.Println(\"checking authorization...\")\n\torder, err := c.ACME.client.CreateOrder(context.Background(), acme.NewOrder(hostnames...))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We can skip this if we already have an authorization\n\tif order.Status != acme.StatusValid {\n\t\tfor authzIdx, domainAuth := range order.Authorizations {\n\t\t\tlog.Println(fmt.Sprintf(\"we need to re-authorize for this domain: %s\", string(order.Identifiers[authzIdx].Value)))\n\t\t\tac, err := c.ACME.client.GetAuthorization(context.Background(), domainAuth)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif ac.Status != acme.StatusValid {\n\t\t\t\tvar chal *acme.Challenge\n\t\t\t\tfor _, c := range ac.Challenges {\n\t\t\t\t\tif c.Type == \"dns-01\" {\n\t\t\t\t\t\tchal = c\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif chal == nil {\n\t\t\t\t\treturn nil, errors.New(\"no supported challenge type found\")\n\t\t\t\t}\n\n\t\t\t\tval, err := c.ACME.client.DNS01ChallengeRecord(chal.Token)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\t// Return TXT record\n\t\t\t\ttxtDomain := fmt.Sprintf(\"_acme-challenge.%s.\", strings.Replace(hostrec.AuthorizationDomain, \"*.\", \"\", 1))\n\t\t\t\tlog.Println(fmt.Sprintf(\"setting TXT record at %s in route53 to authorize for %s\", txtDomain, order.Identifiers[authzIdx].Value))\n\t\t\t\tchangeResult, err := route53client.ChangeResourceRecordSets(&route53.ChangeResourceRecordSetsInput{\n\t\t\t\t\tHostedZoneId: aws.String(hostrec.ZoneID),\n\t\t\t\t\tChangeBatch: &route53.ChangeBatch{\n\t\t\t\t\t\tChanges: []*route53.Change{\n\t\t\t\t\t\t\t&route53.Change{\n\t\t\t\t\t\t\t\tAction: aws.String(\"UPSERT\"),\n\t\t\t\t\t\t\t\tResourceRecordSet: &route53.ResourceRecordSet{\n\t\t\t\t\t\t\t\t\tName: aws.String(txtDomain),\n\t\t\t\t\t\t\t\t\tTTL: aws.Int64(15),\n\t\t\t\t\t\t\t\t\tType: aws.String(\"TXT\"),\n\t\t\t\t\t\t\t\t\tResourceRecords: []*route53.ResourceRecord{\n\t\t\t\t\t\t\t\t\t\t&route53.ResourceRecord{\n\t\t\t\t\t\t\t\t\t\t\tValue: aws.String(fmt.Sprintf(`\"%s\"`, val)),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tlog.Println(\"waiting on route53 change to be complete...\")\n\t\t\t\terr = route53client.WaitUntilResourceRecordSetsChanged(&route53.GetChangeInput{\n\t\t\t\t\tId: changeResult.ChangeInfo.Id,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tlog.Println(\"accepting Let's Encrypt challenge\")\n\t\t\t\t_, err = c.ACME.client.AcceptChallenge(context.Background(), chal)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tlog.Println(\"waiting authorization...\")\n\t\t\t\t_, err = c.ACME.client.WaitAuthorization(context.Background(), domainAuth)\n\t\t\t\tif err != nil {\n\t\t\t\t\tauthError := err.(acme.AuthorizationError).Authorization.Challenges[0].Error\n\t\t\t\t\tlog.Println(authError)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.Println(\"generating key for certificate...\")\n\tpkey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"generating certificate signing request...\")\n\tcsr, err := x509.CreateCertificateRequest(rand.Reader, &x509.CertificateRequest{\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: hostnames[0],\n\t\t},\n\t\tDNSNames: hostnames,\n\t}, pkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"requesting certificate...\")\n\tders, err := c.ACME.client.FinalizeOrder(context.Background(), order.FinalizeURL, csr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"received. marshaling result...\")\n\tbuf := &bytes.Buffer{}\n\terr = pem.Encode(buf, &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(pkey),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, der := range ders {\n\t\terr = pem.Encode(buf, &pem.Block{\n\t\t\tType: \"CERTIFICATE\",\n\t\t\tBytes: der,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "6a0094ddf3b06bd8cb479d2c4f3febf9", "score": "0.47928074", "text": "func (f *FakeDNSServer) fakeDNS(s string, dmsg dnsmessage.Message) (r dnsmessage.Message, err error) {\n\n\tr = dnsmessage.Message{\n\t\tHeader: dnsmessage.Header{\n\t\t\tID: dmsg.ID,\n\t\t\tResponse: true,\n\t\t},\n\t\tQuestions: dmsg.Questions,\n\t}\n\tipv6 := f.IP.To16()\n\tipv4 := f.IP.To4()\n\tswitch t := dmsg.Questions[0].Type; {\n\tcase t == dnsmessage.TypeA && ipv4 != nil:\n\t\tvar ip [4]byte\n\t\tcopy(ip[:], []byte(ipv4))\n\t\tr.Answers = []dnsmessage.Resource{\n\t\t\t{\n\t\t\t\tHeader: dnsmessage.ResourceHeader{\n\t\t\t\t\tName: dmsg.Questions[0].Name,\n\t\t\t\t\tType: dnsmessage.TypeA,\n\t\t\t\t\tClass: dnsmessage.ClassINET,\n\t\t\t\t\tLength: 4,\n\t\t\t\t},\n\t\t\t\tBody: &dnsmessage.AResource{\n\t\t\t\t\tA: ip,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\tcase t == dnsmessage.TypeAAAA && ipv4 == nil:\n\t\tvar ip [16]byte\n\t\tcopy(ip[:], []byte(ipv6))\n\t\tr.Answers = []dnsmessage.Resource{\n\t\t\t{\n\t\t\t\tHeader: dnsmessage.ResourceHeader{\n\t\t\t\t\tName: dmsg.Questions[0].Name,\n\t\t\t\t\tType: dnsmessage.TypeAAAA,\n\t\t\t\t\tClass: dnsmessage.ClassINET,\n\t\t\t\t\tLength: 16,\n\t\t\t\t},\n\t\t\t\tBody: &dnsmessage.AAAAResource{\n\t\t\t\t\tAAAA: ip,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\tdefault:\n\t\tr.Header.RCode = dnsmessage.RCodeNameError\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "68df04a348ef7da879100037744aa127", "score": "0.4743595", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tctx := context.Background()\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\tauthZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"derak: could not find zone for domain %q (%s): %w\", domain, info.EffectiveFQDN, err)\n\t}\n\n\trecordName, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"derak: %w\", err)\n\t}\n\n\tzoneID, err := d.getZoneID(ctx, info)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"derak: get zone ID: %w\", err)\n\t}\n\n\tr := internal.Record{\n\t\tType: \"TXT\",\n\t\tHost: recordName,\n\t\tContent: info.Value,\n\t\tTTL: d.config.TTL,\n\t}\n\n\trecord, err := d.client.CreateRecord(ctx, zoneID, r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"derak: create record: %w\", err)\n\t}\n\n\td.recordIDsMu.Lock()\n\td.recordIDs[token] = record.ID\n\td.recordIDsMu.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "249ed267241a4288e8c16c1294e6b74a", "score": "0.4727139", "text": "func TestDNSProvider(t *testing.T) {\n\t// serverResponses is the JSON Request->Response map used by the\n\t// fake JSON server.\n\tserverResponses := map[string]map[string]string{\n\t\thttp.MethodGet: {\n\t\t\t``: `{\"rrset_ttl\":300,\"rrset_values\":[],\"rrset_name\":\"_acme-challenge.abc.def\",\"rrset_type\":\"TXT\"}`,\n\t\t},\n\t\thttp.MethodPut: {\n\t\t\t`{\"rrset_ttl\":300,\"rrset_values\":[\"TOKEN\"]}`: `{\"message\": \"Zone Record Created\"}`,\n\t\t},\n\t\thttp.MethodDelete: {\n\t\t\t``: ``,\n\t\t},\n\t}\n\n\tfakeKeyAuth := \"XXXX\"\n\n\tregexpToken := regexp.MustCompile(`\"rrset_values\":\\[\".+\"\\]`)\n\n\t// start fake RPC server\n\tmux := http.NewServeMux()\n\tserver := httptest.NewServer(mux)\n\tt.Cleanup(server.Close)\n\n\tmux.HandleFunc(\"/domains/example.com/records/_acme-challenge.abc.def/TXT\", func(rw http.ResponseWriter, req *http.Request) {\n\t\tlog.Infof(\"request: %s %s\", req.Method, req.URL)\n\n\t\tif req.Header.Get(internal.APIKeyHeader) == \"\" {\n\t\t\thttp.Error(rw, `{\"message\": \"missing API key\"}`, http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\tif req.Method == http.MethodPost && req.Header.Get(\"Content-Type\") != \"application/json\" {\n\t\t\thttp.Error(rw, `{\"message\": \"invalid content type\"}`, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tbody, errS := io.ReadAll(req.Body)\n\t\tif errS != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"message\": \"read body error: %v\"}`, errS), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tbody = regexpToken.ReplaceAllLiteral(body, []byte(`\"rrset_values\":[\"TOKEN\"]`))\n\n\t\tresponses, ok := serverResponses[req.Method]\n\t\tif !ok {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"message\": \"Server response for request not found: %#q\"}`, string(body)), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tresp := responses[string(body)]\n\n\t\t_, errS = rw.Write([]byte(resp))\n\t\tif errS != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"message\": \"failed to write response: %v\"}`, errS), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t})\n\tmux.HandleFunc(\"/\", func(rw http.ResponseWriter, req *http.Request) {\n\t\tlog.Infof(\"request: %s %s\", req.Method, req.URL)\n\t\thttp.Error(rw, fmt.Sprintf(`{\"message\": \"URL doesn't match: %s\"}`, req.URL), http.StatusNotFound)\n\t})\n\n\t// define function to override findZoneByFqdn with\n\tfakeFindZoneByFqdn := func(fqdn string) (string, error) {\n\t\treturn \"example.com.\", nil\n\t}\n\n\tconfig := NewDefaultConfig()\n\tconfig.APIKey = \"123412341234123412341234\"\n\tconfig.BaseURL = server.URL\n\n\tprovider, err := NewDNSProviderConfig(config)\n\trequire.NoError(t, err)\n\n\t// override findZoneByFqdn function\n\tsavedFindZoneByFqdn := provider.findZoneByFqdn\n\tdefer func() {\n\t\tprovider.findZoneByFqdn = savedFindZoneByFqdn\n\t}()\n\tprovider.findZoneByFqdn = fakeFindZoneByFqdn\n\n\t// run Present\n\terr = provider.Present(\"abc.def.example.com\", \"\", fakeKeyAuth)\n\trequire.NoError(t, err)\n\n\t// run CleanUp\n\terr = provider.CleanUp(\"abc.def.example.com\", \"\", fakeKeyAuth)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "fc808bf0df48f0a26e161eee39190c4c", "score": "0.4724343", "text": "func (h *dnsHandler) handlePTR(r *dns.Msg) (dns.Msg, error) {\n\tmsg := dns.Msg{}\n\tmsg.SetReply(r)\n\n\t// If request is marked as non-recursive it means it is from another forkdns and we should\n\t// attempt to answer it using the local dnsmasq lease file and not relay it.\n\tif !r.RecursionDesired {\n\t\t// Check if the local DHCP leases file contains a lease for the requested reverse DNS name.\n\t\t// If this fails with an error or no record found, then check other cluster hosts.\n\t\thostname, err := h.getLeaseHostByReverseIPName(r.Question[0].Name)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"PTR record lease lookup failed for %s: %v\", r.Question[0].Name, err)\n\t\t}\n\n\t\t// Record found in local DHCP leases file, generate answer response and send.\n\t\tif hostname != \"\" {\n\t\t\tmsg.Authoritative = true\n\t\t\tmsg.Answer = append(msg.Answer, &dns.PTR{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: r.Question[0].Name,\n\t\t\t\t\tRrtype: dns.TypePTR,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 0,\n\t\t\t\t},\n\t\t\t\t// Suffix the hostname in the lease with the cluster DNS zone name (e.g. \".lxd.\")\n\t\t\t\t// The final full stop is important as the response needs to be a FQDN.\n\t\t\t\tPtr: fmt.Sprintf(\"%s.%s.\", hostname, h.domain),\n\t\t\t})\n\n\t\t\treturn msg, nil\n\t\t}\n\n\t\t// Record not found locally, return NXDOMAIN.\n\t\tmsg.SetRcode(r, dns.RcodeNameError)\n\t\treturn msg, nil\n\t}\n\n\t// If we get here, then the recursion desired flag was set, meaning we cannot answer the\n\t// query locally and need to relay it to the other forkdns instances.\n\n\t// Get current list of servers safely.\n\tdnsServersFileLock.Lock()\n\tservers := dnsServersList\n\tdnsServersFileLock.Unlock()\n\n\t// Query all the servers.\n\tfor _, server := range servers {\n\t\treq := dns.Msg{}\n\t\treq.Question = r.Question\n\t\t// Tell the remote node we only want to query their local data (to stop loops).\n\t\treq.RecursionDesired = false\n\t\treq.Id = r.Id\n\n\t\tresp, err := dns.Exchange(&req, fmt.Sprintf(\"%s:1053\", server))\n\t\tif err != nil || len(resp.Answer) == 0 {\n\t\t\t// Error or empty response, try the next one\n\t\t\tcontinue\n\t\t}\n\n\t\treturn *resp, nil\n\t}\n\n\t// Record not found in any of the remove servers.\n\tmsg.SetRcode(r, dns.RcodeNameError)\n\treturn msg, nil\n}", "title": "" }, { "docid": "f3c3e3dabc77db6f2378a0b6537bfc8e", "score": "0.47226995", "text": "func serveDNS(connection *net.UDPConn, clientAddress net.Addr, request *layers.DNS) {\n\t// Strictly, this copies a pointer - so we're appending data to the client's\n\t// question, and throwing it back. The alias is just for clarity.\n\treplyMsg := request\n\t// dnsAnswer is a data structure that we will add on to the DNS data.\n\t// Hint: this part may be helpful in your MITM when you have to spoof\n\t// a DNS answer!\n\tvar dnsAnswer layers.DNSResourceRecord\n\t// Use the map declared earlier to find the IP corresponding to the URL.\n\tipString, ok := records[string(request.Questions[0].Name)]\n\tif !ok {\n\t\tpanic(\"Error: Answer to DNS question not found.\")\n\t}\n\t// This line is just to convert the stringified IP address into an\n\t// IP object, which gopacket understands.\n\tipAddress, _, _ := net.ParseCIDR(ipString + \"/24\")\n\t// Now we can populate the data structure. Type A indicates that\n\t// the question is a domain name, and the answer is an IPv4 address.\n\tdnsAnswer.Type = layers.DNSTypeA\n\tdnsAnswer.IP = ipAddress\n\t// This just copies the domain name, but as a byte array.\n\tdnsAnswer.Name = request.Questions[0].Name\n\t// IN stands for internet - it is the namespace of this DNS request/reply.\n\t// DNS can be used for protocols other than internet, but that's\n\t// obviously beyond the scope of this project.\n\tdnsAnswer.Class = layers.DNSClassIN\n\t// QR = false indicates the DNS packet is a question; true indicates answer.\n\treplyMsg.QR = true\n\t// The number of answers: just one.\n\treplyMsg.ANCount = 1\n\t// This corresponds to a \"200 OK\" in HTTP; everything is good.\n\treplyMsg.ResponseCode = layers.DNSResponseCodeNoErr\n\t// Finally, augment dnsAnswer to the DNS data.\n\treplyMsg.Answers = append(replyMsg.Answers, dnsAnswer)\n\t// This last part deals with converting the DNS data structure to raw bytes.\n\tbuf := gopacket.NewSerializeBuffer()\n\topts := gopacket.SerializeOptions{}\n\terr := replyMsg.SerializeTo(buf, opts)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Uncomment the line below to make the server respond.\n\t// You will need to do this if you want to verify your starter code\n\t// and setup are working, but disable this when your MITM is up.\n\t//connection.WriteTo(buf.Bytes(), clientAddress)\n}", "title": "" }, { "docid": "96e55d55a97ef23967fbc2a7180e0533", "score": "0.47220916", "text": "func (m *Metrics) ServeDNS(dc *ctx.Context) {\n\tdc.NextDNS()\n\n\tif !dc.DNSWriter.Written() {\n\t\treturn\n\t}\n\n\tm.queries.With(\n\t\tprometheus.Labels{\n\t\t\t\"qtype\": dns.TypeToString[dc.DNSRequest.Question[0].Qtype],\n\t\t\t\"rcode\": dns.RcodeToString[dc.DNSWriter.Rcode()],\n\t\t}).Inc()\n}", "title": "" }, { "docid": "d80d8a59deade5cc117565c30f8275a3", "score": "0.46769977", "text": "func loadDns() (*ebpf.CollectionSpec, error) {\n\treader := bytes.NewReader(_DnsBytes)\n\tspec, err := ebpf.LoadCollectionSpecFromReader(reader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't load dns: %w\", err)\n\t}\n\n\treturn spec, err\n}", "title": "" }, { "docid": "60bb874c1eadbe03234a154fab1473b2", "score": "0.46627825", "text": "func (f *Forwarder) ServeDNS(ctx context.Context, ch *middleware.Chain) {\n\tw, req := ch.Writer, ch.Request\n\n\tif len(req.Question) == 0 || len(f.servers) == 0 {\n\t\tch.CancelWithRcode(dns.RcodeServerFailure, true)\n\t\treturn\n\t}\n\n\tfReq := new(dns.Msg)\n\tfReq.SetQuestion(req.Question[0].Name, req.Question[0].Qtype)\n\tfReq.Question[0].Qclass = req.Question[0].Qclass\n\tfReq.SetEdns0(dnsutil.DefaultMsgSize, true)\n\tfReq.CheckingDisabled = req.CheckingDisabled\n\n\tfor _, server := range f.servers {\n\t\tresp, err := dnsutil.Exchange(ctx, req, server.Addr, server.Proto)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"forwarder query failed\", \"query\", formatQuestion(req.Question[0]), \"error\", err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tresp.Id = req.Id\n\n\t\t_ = w.WriteMsg(resp)\n\t\treturn\n\t}\n\n\tch.CancelWithRcode(dns.RcodeServerFailure, true)\n}", "title": "" }, { "docid": "4e91cb08c4fabd5d7fea0b5af8a49e45", "score": "0.46542862", "text": "func (u *Unbound) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tif !u.match(state) {\n\t\treturn plugin.NextOrFailure(u.Name(), u.Next, ctx, w, r)\n\t}\n\n\tvar (\n\t\tres *unbound.Result\n\t\terr error\n\t)\n\tswitch state.Proto() {\n\tcase \"tcp\":\n\t\tres, err = u.t.Resolve(state.QName(), state.QType(), state.QClass())\n\tcase \"udp\":\n\t\tres, err = u.u.Resolve(state.QName(), state.QType(), state.QClass())\n\t}\n\n\trcode := dns.RcodeServerFailure\n\tif err == nil {\n\t\trcode = res.AnswerPacket.Rcode\n\t}\n\trc, ok := dns.RcodeToString[rcode]\n\tif !ok {\n\t\trc = strconv.Itoa(rcode)\n\t}\n\n\tserver := metrics.WithServer(ctx)\n\tRcodeCount.WithLabelValues(server, rc).Add(1)\n\tRequestDuration.WithLabelValues(server).Observe(res.Rtt.Seconds())\n\n\tif err != nil {\n\t\treturn dns.RcodeServerFailure, err\n\t}\n\n\t// If the client *didn't* set the opt record, and specifically not the DO bit,\n\t// strip this from the reply (unbound default to setting DO).\n\tif !state.Do() {\n\t\t// technically we can still set bufsize and fluff, for now remove the entire OPT record.\n\t\tfor i := 0; i < len(res.AnswerPacket.Extra); i++ {\n\t\t\trr := res.AnswerPacket.Extra[i]\n\t\t\tif _, ok := rr.(*dns.OPT); ok {\n\t\t\t\tres.AnswerPacket.Extra = append(res.AnswerPacket.Extra[:i], res.AnswerPacket.Extra[i+1:]...)\n\t\t\t\tbreak // TODO(miek): more than one? Think TSIG?\n\t\t\t}\n\t\t}\n\t\tfilter(res.AnswerPacket, dnssec)\n\t}\n\n\tres.AnswerPacket.Id = r.Id\n\tw.WriteMsg(res.AnswerPacket)\n\treturn 0, nil\n}", "title": "" }, { "docid": "d05a3bb993dbf8941a02879e9c720045", "score": "0.46258977", "text": "func (c *Consul) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\trcode, answer, extra, err := c.serveDNS(ctx, state)\n\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] %s: %s\", state.Name(), err)\n\t}\n\n\ta := &dns.Msg{}\n\ta.SetReply(r)\n\ta.Rcode = rcode\n\ta.Compress = true\n\ta.Authoritative = true\n\n\tif answer != nil {\n\t\ta.Answer = append(a.Answer, answer)\n\t}\n\n\tif extra != nil {\n\t\ta.Extra = append(a.Extra, extra)\n\t}\n\n\tstate.SizeAndDo(a)\n\ta = state.Scrub(a)\n\tw.WriteMsg(a)\n\treturn rcode, err\n}", "title": "" }, { "docid": "744d850b7e9bce38c29c53e3e77cf37b", "score": "0.4621061", "text": "func (a Alias) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tmw := NewResponseModifier(w)\n\treturn plugin.NextOrFailure(a.Name(), a.Next, ctx, mw, r)\n}", "title": "" }, { "docid": "8ce95fb5dfdbe760d21294224908664c", "score": "0.4613633", "text": "func (p *RaintankProbeDns) Run() (CheckResult, error) {\n\tdeadline := time.Now().Add(p.Timeout)\n\tresult := &DnsResult{}\n\t// fix failed to respond with upper case\n\tc := dns.Client{Net: p.Protocol}\n\tm := dns.Msg{}\n\tif !strings.HasSuffix(p.RecordName, \".\") {\n\t\tp.RecordName = p.RecordName + \".\"\n\t}\n\tm.SetQuestion(p.RecordName, recordTypeToWireType[p.RecordType])\n\n\tfor _, s := range p.Servers {\n\t\tif time.Now().After(deadline) {\n\t\t\tmsg := \"timeout looking up dns record.\"\n\t\t\tresult.Error = &msg\n\t\t\treturn result, nil\n\t\t}\n\t\t//trim any leading/training whitespace.\n\t\tserver := strings.Trim(s, \" \")\n\n\t\tsrvPort := net.JoinHostPort(server, strconv.FormatInt(p.Port, 10))\n\t\tstart := time.Now()\n\t\tr, t, err := c.Exchange(&m, srvPort)\n\t\tif err != nil || r == nil {\n\t\t\t//try the next server.\n\t\t\tcontinue\n\t\t}\n\t\t//tcp queries dont return time.\n\t\tif t == 0 {\n\t\t\tt = time.Since(start)\n\t\t}\n\t\tduration := t.Seconds() * 1000\n\t\tresult.Time = &duration\n\t\tanswers := len(r.Answer)\n\t\tresult.Answers = &answers\n\t\tif answers > 0 {\n\t\t\tttl := r.Answer[0].Header().Ttl\n\t\t\tresult.Ttl = &ttl\n\t\t}\n\t\tif p.ExpectRegex != \"\" {\n\t\t\t// push the answers into a text blob\n\t\t\tvar b bytes.Buffer\n\t\t\tfor _, a := range r.Answer {\n\t\t\t\tb.WriteString(a.String())\n\t\t\t\tb.WriteString(\"\\n\")\n\t\t\t}\n\t\t\tinverse := false\n\t\t\texpr := p.ExpectRegex\n\t\t\tif strings.HasPrefix(expr, \"!\") && strings.HasSuffix(expr, \"!\") {\n\t\t\t\texpr = strings.TrimPrefix(expr, \"!\")\n\t\t\t\texpr = strings.TrimSuffix(expr, \"!\")\n\t\t\t\tinverse = true\n\t\t\t}\n\t\t\trgx, err := regexp.Compile(expr)\n\t\t\tif err != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"expectRegex error. %s\", err.Error())\n\n\t\t\t\tresult.Error = &msg\n\t\t\t\treturn result, nil\n\t\t\t}\n\n\t\t\tswitch inverse {\n\t\t\tcase true:\n\t\t\t\tif rgx.MatchString(b.String()) {\n\t\t\t\t\tlog.Debugf(\"expectRegex %s unexpectedly matched Answers %s\", p.ExpectRegex, b.String())\n\n\t\t\t\t\tmsg := \"expectRegex unexpectedly matched\"\n\t\t\t\t\tresult.Error = &msg\n\t\t\t\t\treturn result, nil\n\t\t\t\t}\n\t\t\tcase false:\n\t\t\t\tif !rgx.MatchString(b.String()) {\n\t\t\t\t\tlog.Debugf(\"expectRegex %s did not match Answers %s\", p.ExpectRegex, b.String())\n\n\t\t\t\t\tmsg := \"expectRegex did not match\"\n\t\t\t\t\tresult.Error = &msg\n\t\t\t\t\treturn result, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn result, nil\n\t}\n\tmsg := \"All target servers failed to respond\"\n\tresult.Error = &msg\n\treturn result, nil\n}", "title": "" }, { "docid": "4c93cea22f7da92a37c06ff6728e875f", "score": "0.46110237", "text": "func (r *Result) parseTXT(dom string) error {\n\tif r.rec >= 10 {\n\t\treturn fmt.Errorf(\"recursion limit\")\n\t}\n\n\td, _ := NewDomain(dom)\n\td.Fetch()\n\n\t// Sanity control\n\tif r.rn == nil {\n\t\tr.rn = cidranger.NewPCTrieRanger()\n\t}\n\n\ttxt := strings.Fields(d.Raw)\n\n\t// First checks\n\tif len(txt) == 0 || txt[0] != \"v=spf1\" {\n\t\treturn fmt.Errorf(\"wrong format %s\", txt)\n\t}\n\n\t// We are not parsing completely, just what interest us\n\tfor _, f := range txt[1:] {\n\t\tif m := reIPS.FindStringSubmatch(f); m != nil {\n\t\t\t//\n\t\t\tdebug(\"ip46: %s\", m[3])\n\n\t\t\tpresent, _ := r.rn.Contains(net.ParseIP(m[3]))\n\t\t\tif !present {\n\t\t\t\tipb := readIP(m)\n\t\t\t\tr.IPs = append(r.IPs, *ipb)\n\t\t\t} else {\n\t\t\t\tdebug(\"included\")\n\t\t\t}\n\t\t} else if m := reINC.FindStringSubmatch(f); m != nil {\n\t\t\t//\n\t\t\tdebug(\"include: %s\", m)\n\n\t\t\tr.rec++\n\t\t\tr.dns++\n\t\t\t// Recurse with include\n\t\t\terr := r.parseTXT(m[2])\n\t\t\tdebug(\"error was %v\", err)\n\t\t} else if reMXS.MatchString(f) {\n\t\t\t//\n\t\t\tdebug(\"mx\")\n\n\t\t\tr.AppendMX(d.Name)\n\t\t} else if reRDR.FindStringSubmatch(f); m != nil {\n\t\t\t//\n\t\t\tdebug(\"redirect: %s\", m)\n\n\t\t\t// If redirect= and *all, ignore\n\t\t\tif strings.HasSuffix(txt[len(txt)], \"all\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr.rec++\n\t\t\tr.dns++\n\n\t\t\t// Recurse with redirect\n\t\t\terr := r.parseTXT(m[1])\n\t\t\tdebug(\"error was %v\", err)\n\t\t} else {\n\t\t\tdebug(\"nothing\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6766be40b1302022f155f79727e22e71", "score": "0.46083224", "text": "func (d *DNSProvider) Present(domainName, token, keyAuth string) error {\n\tfqdn, value, ttl := acme.DNS01Record(domainName, keyAuth)\n\n\tauthZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// fetch the domain details\n\tdomain, err := d.getDomain(authZone)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create the TXT record\n\tname := strings.Replace(fqdn, \".\"+authZone, \"\", 1)\n\trecord := &Record{\n\t\tName: name,\n\t\tTTL: fmt.Sprintf(\"%d\", ttl),\n\t\tRoundRobin: []RoundRobin{\n\t\t\tRoundRobin{\n\t\t\t\tValue: value,\n\t\t\t},\n\t\t},\n\t}\n\n\terr = d.createRecord(domain, record)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0b839240127827b552216770a969d44c", "score": "0.46062762", "text": "func NewFromDNS(domain, user, pass string) (*etcd.Client, error) {\n\tvar config etcd.Config = etcd.Config{\n\t\tUsername: user,\n\t\tPassword: pass,\n\t}\n\tvar err error\n\n\terr = FillConfigFromDNS(&config, \"etcd-client\", domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn etcd.New(config)\n}", "title": "" }, { "docid": "dbc86207a6f6845064ba110ac6c8b4d8", "score": "0.46060607", "text": "func TXT(ctx context.Context, b ServiceBackend, zone string, state request.Request, previousRecords []dns.RR, opt Options) (records []dns.RR, truncated bool, err error) {\n\tservices, err := b.Services(ctx, state, false, opt)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tdup := make(map[string]struct{})\n\n\tfor _, serv := range services {\n\t\twhat, _ := serv.HostType()\n\n\t\tswitch what {\n\t\tcase dns.TypeCNAME:\n\t\t\tif Name(state.Name()).Matches(dns.Fqdn(serv.Host)) {\n\t\t\t\t// x CNAME x is a direct loop, don't add those\n\t\t\t\t// in etcd/skydns w.x CNAME x is also direct loop due to the \"recursive\" nature of search results\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewRecord := serv.NewCNAME(state.QName(), serv.Host)\n\t\t\tif len(previousRecords) > 7 {\n\t\t\t\t// don't add it, and just continue\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif dnsutil.DuplicateCNAME(newRecord, previousRecords) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif dns.IsSubDomain(zone, dns.Fqdn(serv.Host)) {\n\t\t\t\tstate1 := state.NewWithQuestion(serv.Host, state.QType())\n\t\t\t\tstate1.Zone = zone\n\t\t\t\tnextRecords, tc, err := TXT(ctx, b, zone, state1, append(previousRecords, newRecord), opt)\n\t\t\t\tif tc {\n\t\t\t\t\ttruncated = true\n\t\t\t\t}\n\t\t\t\tif err == nil {\n\t\t\t\t\t// Not only have we found something we should add the CNAME and the IP addresses.\n\t\t\t\t\tif len(nextRecords) > 0 {\n\t\t\t\t\t\trecords = append(records, newRecord)\n\t\t\t\t\t\trecords = append(records, nextRecords...)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// This means we can not complete the CNAME, try to look else where.\n\t\t\ttarget := newRecord.Target\n\t\t\t// Lookup\n\t\t\tm1, e1 := b.Lookup(ctx, state, target, state.QType())\n\t\t\tif e1 != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Len(m1.Answer) > 0 here is well?\n\t\t\trecords = append(records, newRecord)\n\t\t\trecords = append(records, m1.Answer...)\n\t\t\tcontinue\n\n\t\tcase dns.TypeTXT:\n\t\t\tif _, ok := dup[serv.Text]; !ok {\n\t\t\t\tdup[serv.Text] = struct{}{}\n\t\t\t\trecords = append(records, serv.NewTXT(state.QName()))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn records, truncated, nil\n}", "title": "" }, { "docid": "87c36bf79b498d6e815078df193da676", "score": "0.45947838", "text": "func (m *CollectorConnections) GetDNS(addr *Addr) (string, []string) {\n\treturn getDNS(m.EncodedDNS, addr.Ip)\n}", "title": "" }, { "docid": "15dc3112797a7cf4f3d6e9aea0e318b3", "score": "0.45887113", "text": "func (buf Bufsize) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tif option := r.IsEdns0(); option != nil && int(option.UDPSize()) > buf.Size {\n\t\toption.SetUDPSize(uint16(buf.Size))\n\t}\n\treturn plugin.NextOrFailure(buf.Name(), buf.Next, ctx, w, r)\n}", "title": "" }, { "docid": "15fdc9c1f33b164ecf4fa36a71b11d5e", "score": "0.45798567", "text": "func runDNS(g ProofContextExt, scripts []*jsonw.Wrapper, startstate ScriptState) []libkb.ProofError {\n\tuserdomain := startstate.Vars.Hostname\n\tdomains := []string{userdomain, \"_keybase.\" + userdomain}\n\tvar errs []libkb.ProofError\n\tfor _, d := range domains {\n\t\tdebugWithState(g, startstate, \"Trying DNS: %v\", d)\n\n\t\terr := runDNSOne(g, scripts, startstate, d)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "87669981a26ee956d9fac4760954d5cf", "score": "0.45743126", "text": "func (h *DDNSHandler) ServeDNSReverse(w dns.ResponseWriter, req *dns.Msg) *dns.Msg {\n\tm := new(dns.Msg)\n\tm.SetReply(req)\n\tm.Compress = true\n\tm.Authoritative = false // Set to false, because I don't know what to do wrt DNSSEC.\n\tm.RecursionAvailable = true\n\tvar err error\n\tif m.Answer, err = h.PTRRecords(req.Question[0]); err == nil {\n\t\t// TODO Reverse DNSSEC. We should sign this, but requires a key....and more\n\t\t// Probably not worth the hassle?\n\t\tif err := w.WriteMsg(m); err != nil {\n\t\t\tlog.Error(\"failure to return reply %q\", err)\n\t\t}\n\t\treturn m\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e1059d28f65a1db61c2d2cb44d90b2fe", "score": "0.45729846", "text": "func (p PodNames) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\tif state.QType() != dns.TypeA && state.QType() != dns.TypeAAAA && state.QType() != dns.TypePTR {\n\t\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n\t}\n\tqname := state.QName()\n\tzone := plugin.Zones(p.Zones).Matches(qname)\n\tif zone == \"\" {\n\t\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n\t}\n\n\tif dnsutil.IsReverse(qname) > 0 {\n\t\t// handle reverse\n\t\tip := dnsutil.ExtractAddressFromReverse(state.Name())\n\t\tobjs, err := p.podIndexer.ByIndex(\"PodIP\", ip) // expose constant from kubernetes package?\n\t\tif err != nil {\n\t\t\treturn dns.RcodeServerFailure, err\n\t\t}\n\t\tm := &dns.Msg{}\n\t\tm.SetReply(r)\n\t\tfor _, o := range objs {\n\t\t\tpod, ok := o.(*object.Pod)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tm.Answer = append(m.Answer, &dns.PTR{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: qname,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tRrtype: dns.TypePTR,\n\t\t\t\t\tTtl: p.ttl,\n\t\t\t\t},\n\t\t\t\tPtr: pod.Name + \".\" + pod.Namespace + \".\" + p.Zones[0]})\n\t\t}\n\t\terr = w.WriteMsg(m)\n\t\tif err != nil {\n\t\t\treturn dns.RcodeServerFailure, err\n\t\t}\n\n\t\treturn dns.RcodeSuccess, nil\n\t}\n\n\t// strip zone off to get name/namespace\n\tsub := qname[0 : strings.Index(qname, zone)-1]\n\tsegs := strings.Split(sub, \".\")\n\tif len(segs) < 2 {\n\t\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n\t}\n\titem, exists, err := p.podIndexer.GetByKey(segs[1] + \"/\" + segs[0])\n\tif err != nil {\n\t\treturn dns.RcodeServerFailure, err\n\t}\n\tif !exists {\n\t\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n\t}\n\tpod, ok := item.(*object.Pod)\n\tif !ok {\n\t\treturn dns.RcodeServerFailure, errors.New(\"unexpected indexer item type\")\n\t}\n\tip := net.ParseIP(pod.PodIP)\n\n\t// construct the reply\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\tm.Authoritative = true\n\tif ip.To4() != nil && state.QType() == dns.TypeA {\n\t\tm.Answer = append(m.Answer, &dns.A{\n\t\t\tHdr: dns.RR_Header{\n\t\t\t\tName: qname,\n\t\t\t\tClass: dns.ClassINET,\n\t\t\t\tRrtype: dns.TypeA,\n\t\t\t\tTtl: p.ttl,\n\t\t\t},\n\t\t\tA: ip})\n\t}\n\tif ip.To16() != nil && state.QType() == dns.TypeAAAA {\n\t\tm.Answer = append(m.Answer, &dns.AAAA{\n\t\t\tHdr: dns.RR_Header{\n\t\t\t\tName: qname,\n\t\t\t\tClass: dns.ClassINET,\n\t\t\t\tRrtype: dns.TypeAAAA,\n\t\t\t\tTtl: p.ttl,\n\t\t\t},\n\t\t\tAAAA: ip})\n\t}\n\n\t// write reply\n\terr = w.WriteMsg(m)\n\tif err != nil {\n\t\treturn dns.RcodeServerFailure, err\n\t}\n\n\treturn dns.RcodeSuccess, nil\n}", "title": "" }, { "docid": "cab9c491b1b2133da7e3d350c558f03e", "score": "0.45553455", "text": "func (wrapper RFC2136) NewDNSProvider() (challenge.Provider, error) {\n\tcfg := rfc2136.NewDefaultConfig()\n\tif wrapper.Nameserver != \"\" {\n\t\tcfg.Nameserver = wrapper.Nameserver\n\t}\n\tif wrapper.TSIGAlgorithm != \"\" {\n\t\tcfg.TSIGAlgorithm = wrapper.TSIGAlgorithm\n\t}\n\tif wrapper.TSIGKey != \"\" {\n\t\tcfg.TSIGKey = wrapper.TSIGKey\n\t}\n\tif wrapper.TSIGSecret != \"\" {\n\t\tcfg.TSIGSecret = wrapper.TSIGSecret\n\t}\n\tif wrapper.DNSClient.SequenceInterval != 0 {\n\t\tcfg.SequenceInterval = time.Duration(wrapper.DNSClient.SequenceInterval)\n\t}\n\tif wrapper.DNSClient.DNSTimeout != 0 {\n\t\tcfg.DNSTimeout = time.Duration(wrapper.DNSClient.DNSTimeout)\n\t}\n\tif wrapper.CommonConfig.TTL != 0 {\n\t\tcfg.TTL = wrapper.CommonConfig.TTL\n\t}\n\tif wrapper.CommonConfig.PropagationTimeout != 0 {\n\t\tcfg.PropagationTimeout = time.Duration(wrapper.CommonConfig.PropagationTimeout)\n\t}\n\tif wrapper.CommonConfig.PollingInterval != 0 {\n\t\tcfg.PollingInterval = time.Duration(wrapper.CommonConfig.PollingInterval)\n\t}\n\n\treturn rfc2136.NewDNSProviderConfig(cfg)\n}", "title": "" }, { "docid": "1e23d93263cbd67f817ce7d804bbeff4", "score": "0.45439395", "text": "func RRtoRecord(r dnssrv.RR) cache.Record {\n\tnew := cache.Record{}\n\tswitch r.(type) {\n\tcase *dnssrv.SOA, *dnssrv.NS, *dnssrv.TXT, *dnssrv.MX:\n\t\t// nu.nl.\t\t\t10675\tIN\tTXT\t\"MS=ms73419602\"\n\t\tfields := strings.Fields(r.String())\n\t\tif len(fields) >= 4 {\n\t\t\tttl, _ := strconv.Atoi(fields[1])\n\t\t\treturn cache.Record{Name: \"\", Domain: fields[0], Type: fields[3], TTL: ttl, Target: strings.Join(fields[4:], \"\\t\")}\n\t\t}\n\tdefault:\n\t\tfields := strings.Fields(r.String())\n\t\tif len(fields) >= 4 {\n\t\t\thost, domain := cache.SplitDomain(fields[0])\n\t\t\tttl, _ := strconv.Atoi(fields[1])\n\t\t\treturn cache.Record{Name: host, Domain: domain, Type: fields[3], TTL: ttl, Target: strings.Join(fields[4:], \"\\t\")}\n\t\t}\n\t}\n\treturn new\n}", "title": "" }, { "docid": "4e4b67409a9b0464c683a233911b2575", "score": "0.45427483", "text": "func updateResultDNSConfig(result *current.Result, cniConfig *CNIConfig) {\n\tresult.DNS = cniConfig.DNS\n}", "title": "" }, { "docid": "1faf36d41be53ce57b38fad4a7c8bfe5", "score": "0.44943815", "text": "func (do DO_c) getDomainRecord (domain, subDomain string) (dr *do_domain_record_t, err error) {\n pages := 1\n //first step is to get a list of current subdomains from this parent domain\n if do.Verbose { fmt.Println(\"Getting list of current subdomains\") }\n for pages > 0 {\n nextUrl := fmt.Sprintf(\"domains/%s/records?page=%d\", domain, pages) //this is the next url to request\n resp, err := do.request(nextUrl, nil)\n if err == nil {\n var records struct {\n Records []do_domain_record_t `json:\"domain_records\"`\n Links struct {\n Pages struct {\n Next string `json:\"next\"`\n } `json:\"pages\"`\n } `json:\"links\"`\n }\n err = json.Unmarshal(resp, &records)\n if err == nil {\n //loop through these records looking for a matched subdomain\n for _, sd := range (records.Records) {\n if strings.Compare(strings.ToLower(sd.Name), subDomain) == 0 { //the record exists\n return &sd, nil //we found it\n }\n }\n \n //keep searching as long as we have a \"next\" url\n if len(records.Links.Pages.Next) > 0 {\n pages++\n } else {\n pages = 0 //we're done\n }\n } else {\n return nil, err\n }\n } else {\n return nil, err\n }\n }\n \n //if we're here it's cause it didn't exist yet\n return nil, nil\n}", "title": "" }, { "docid": "1d3587e9a41e616a1f560ae0ae983ce8", "score": "0.44939423", "text": "func (a *Agent) LookupDNS(qType uint16, name string) ([]cache.Answer, error) {\n\tswitch qType {\n\tcase dns.TypeA:\n\t\tc, exists := a.ACache.Get(name)\n\t\t// Cache hit, return cache\n\t\tif exists {\n\t\t\treturn c.Records, nil\n\t\t}\n\tcase dns.TypeAAAA:\n\t\tc, exists := a.AAAACache.Get(name)\n\t\tif exists {\n\t\t\treturn c.Records, nil\n\t\t}\n\t}\n\n\t// Cache missed, check in Spec List\n\tdnsServer := a.GetDNSServer(name)\n\n\tm := new(dns.Msg)\n\tm.SetQuestion(name, qType)\n\tm.RecursionDesired = true\n\tr, _, err := a.DNSClient.Exchange(m, dnsServer)\n\tif err != nil {\n\t\treturn []cache.Answer{}, err\n\t}\n\tif r.Rcode != dns.RcodeSuccess {\n\t\treturn []cache.Answer{}, fmt.Errorf(\"Rcode=%d not successful\", r.Rcode)\n\t}\n\n\tvar answers []cache.Answer\n\tfor _, answer := range r.Answer {\n\t\tfieldA, ok := answer.(*dns.A)\n\t\tif ok {\n\t\t\tanswers = append(answers, cache.Answer{\n\t\t\t\tResult: fieldA.A.String(),\n\t\t\t\tPreference: 0,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tfieldAAAA, ok := answer.(*dns.AAAA)\n\t\tif ok {\n\t\t\tanswers = append(answers, cache.Answer{\n\t\t\t\tResult: fieldAAAA.AAAA.String(),\n\t\t\t\tPreference: 0,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tfieldCNAME, ok := answer.(*dns.CNAME)\n\t\tif ok {\n\t\t\tanswers = append(answers, cache.Answer{\n\t\t\t\tResult: fieldCNAME.Target,\n\t\t\t\tPreference: 0,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tfieldMX, ok := answer.(*dns.MX)\n\t\tif ok {\n\t\t\tanswers = append(answers, cache.Answer{\n\t\t\t\tResult: fieldMX.Mx,\n\t\t\t\tPreference: fieldMX.Preference,\n\t\t\t})\n\t\t\tglog.Info(fieldMX.Preference, fieldMX.Mx)\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tswitch qType {\n\tcase dns.TypeA:\n\t\ta.ACache.Put(cache.Cache{\n\t\t\tName: name,\n\t\t\tRecords: answers,\n\t\t\tExpiredAt: time.Now().Add(time.Duration(a.CacheTTL) * time.Second),\n\t\t})\n\tcase dns.TypeAAAA:\n\t\ta.AAAACache.Put(cache.Cache{\n\t\t\tName: name,\n\t\t\tRecords: answers,\n\t\t\tExpiredAt: time.Now().Add(time.Duration(a.CacheTTL) * time.Second),\n\t\t})\n\t}\n\n\tglog.Infof(\"Query [%d]%s from DNS server %s, Results: %s\", qType, name, dnsServer, answers)\n\treturn answers, nil\n}", "title": "" }, { "docid": "15b255c6d82c53ab1e7b913b902260a0", "score": "0.4477799", "text": "func (*CloudProvider) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string) {\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "43c240fa1079f376fdf91982c80a8b57", "score": "0.44763294", "text": "func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\treturn f(ctx, w, r)\n}", "title": "" }, { "docid": "0472d5966d6fedf68a5d46c458c3ca0c", "score": "0.44751403", "text": "func NewDNS(domain string, port int, lookupInterval time.Duration, log logger.Logger) (Discoverer, error) {\n\tlogger := logger.Std()\n\tif log != nil {\n\t\tlogger = log\n\t}\n\n\tif port <= 0 || port > 65535 {\n\t\treturn nil, ErrInvalidPort\n\t}\n\n\tif lookupInterval == 0 {\n\t\tlookupInterval = 30 * time.Second\n\t}\n\n\tdis := &dnsDiscoverer{\n\t\tdomain: domain,\n\t\tport: port,\n\t\tlookupInterval: lookupInterval,\n\t\tendpointList: make([]Endpoint, 0),\n\t\thostListMap: make(map[string]struct{}),\n\t\teventHandlers: make(map[EventHandler]struct{}),\n\t\tlog: logger,\n\t}\n\n\tregex := regexp.MustCompile(IPRegexp)\n\t// input domain is an IP\n\tif regex.MatchString(domain) {\n\t\tip := net.ParseIP(domain)\n\t\tdis.endpointList = []Endpoint{{Host: ip.String(), Port: port, Addr: BuildAddr(ip.String(), port)}}\n\t\tdis.hostListStr = ip.String()\n\n\t\treturn dis, nil\n\t}\n\n\t// domain\n\tdis.lookup()\n\tdis.update()\n\treturn dis, nil\n}", "title": "" }, { "docid": "461a05bb275e411b8603f4fe6a9b9e57", "score": "0.44736505", "text": "func dnsLookup(host string) ([]string, error) {\n\tprint(&msg{Message: \"dnsLookup(): Entering\", LogLevel: \"debug\"})\n\tdefer print(&msg{Message: \"dnsLookup(): Returning\", LogLevel: \"debug\"})\n\n\tret := []string{}\n\n\tips, err := net.LookupIP(host)\n\tif err != nil {\n\t\treturn []string{}, fmt.Errorf(\"dnsLookup(): Couldn't do hostname lookup on %s. Error %s\", host, err.Error())\n\t}\n\n\t// Get all IPs and append them in CIDR /32 annotation to ret.\n\tfor _, ip := range ips {\n\t\tret = append(ret, fmt.Sprintf(\"%s/32\", ip.String()))\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "92db61a94a59ee11c5ab1230b1a13f80", "score": "0.44715932", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tfqdn, value, _ := acme.DNS01Record(domain, keyAuth)\n\tzone, err := d.getHostedZoneInfo(fqdn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err = d.client.CreateDomainResourceTXT(zone.domainID, acme.UnFqdn(fqdn), value, d.config.TTL); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cf828336566853f3124d88a45e88fc4f", "score": "0.44653302", "text": "func NewDomain(c *client.Client, name string) (*Domain, error) {\n\td := Domain{\n\t\tName: name,\n\t}\n\n\tr, err := c.Post(\"dns\", d)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"internal-server-error: %w\", err)\n\t}\n\n\tdefer r.Body.Close()\n\tvar v = &Domain{}\n\tif err := json.NewDecoder(r.Body).Decode(v); err != nil {\n\t\treturn nil, fmt.Errorf(\"internal-server-error: %w\", err)\n\t}\n\n\tif v.Result != \"success\" {\n\t\treturn nil, fmt.Errorf(\"internal-server-error: Result=%s\", v.Result)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "7bacc85319483e04601ee7dda9fa7524", "score": "0.44605482", "text": "func (c *Client) GetDNSRecords(domain, value, host, t string, page int) (*lbapi.DNSRecordList, error) {\n\tvar err error\n\tu, err := url.Parse(c.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif page == 0 {\n\t\tpage = 1\n\t}\n\n\tu.Path = PathDNSGet\n\tq := u.Query()\n\tq.Set(\"token\", c.Token)\n\tq.Set(\"domain\", domain)\n\tq.Set(\"type\", t)\n\tq.Set(\"count\", \"50\")\n\tq.Set(\"page\", fmt.Sprintf(\"%d\", page))\n\tif host != \"\" {\n\t\tq.Set(\"host\", host)\n\t}\n\tif value != \"\" {\n\t\tq.Set(\"value\", value)\n\t}\n\tu.RawQuery = q.Encode()\n\n\tres, err := lbapi.GetResponse(c.Client, u.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist := *res\n\trl := lbapi.DNSRecordList{\n\t\tCount: lbapi.Atoi(fmt.Sprintf(\"%v\", list[\"recsonpage\"])),\n\t\tMaxRecords: lbapi.Atoi(fmt.Sprintf(\"%v\", list[\"recsindb\"])),\n\t}\n\tdelete(list, \"recsonpage\")\n\tdelete(list, \"recsindb\")\n\n\tfor _, rec := range list {\n\t\tr := lbapi.ParseDNS(rec)\n\t\tif r != nil {\n\t\t\trl.Records = append(rl.Records, r)\n\t\t}\n\t}\n\treturn &rl, nil\n}", "title": "" }, { "docid": "2a643dd4bb45e5df773273d1a4bb5dc5", "score": "0.4454625", "text": "func (a *App) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {\n\tif req.Opcode == dns.OpcodeQuery {\n\t\ta.handleDNSQuery(w, req)\n\t\treturn\n\t}\n\ta.forwardDNSRequest(w, req)\n}", "title": "" }, { "docid": "f5f2fa0a5264dfbe469c99b40e173587", "score": "0.4451338", "text": "func (k *DNSKEY) ToDS(h uint8) *DS {\r\n\tif k == nil {\r\n\t\treturn nil\r\n\t}\r\n\tds := new(DS)\r\n\tds.Hdr.Name = k.Hdr.Name\r\n\tds.Hdr.Class = k.Hdr.Class\r\n\tds.Hdr.Rrtype = TypeDS\r\n\tds.Hdr.Ttl = k.Hdr.Ttl\r\n\tds.Algorithm = k.Algorithm\r\n\tds.DigestType = h\r\n\tds.KeyTag = k.KeyTag()\r\n\r\n\tkeywire := new(dnskeyWireFmt)\r\n\tkeywire.Flags = k.Flags\r\n\tkeywire.Protocol = k.Protocol\r\n\tkeywire.Algorithm = k.Algorithm\r\n\tkeywire.PublicKey = k.PublicKey\r\n\twire := make([]byte, DefaultMsgSize)\r\n\tn, err := packKeyWire(keywire, wire)\r\n\tif err != nil {\r\n\t\treturn nil\r\n\t}\r\n\twire = wire[:n]\r\n\r\n\towner := make([]byte, 255)\r\n\toff, err1 := PackDomainName(CanonicalName(k.Hdr.Name), owner, 0, nil, false)\r\n\tif err1 != nil {\r\n\t\treturn nil\r\n\t}\r\n\towner = owner[:off]\r\n\t// RFC4034:\r\n\t// digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA);\r\n\t// \"|\" denotes concatenation\r\n\t// DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key.\r\n\r\n\tvar hash crypto.Hash\r\n\tswitch h {\r\n\tcase SHA1:\r\n\t\thash = crypto.SHA1\r\n\tcase SHA256:\r\n\t\thash = crypto.SHA256\r\n\tcase SHA384:\r\n\t\thash = crypto.SHA384\r\n\tcase SHA512:\r\n\t\thash = crypto.SHA512\r\n\tdefault:\r\n\t\treturn nil\r\n\t}\r\n\r\n\ts := hash.New()\r\n\ts.Write(owner)\r\n\ts.Write(wire)\r\n\tds.Digest = hex.EncodeToString(s.Sum(nil))\r\n\treturn ds\r\n}", "title": "" }, { "docid": "ecaa0689ada52cc8c90e013f4d6726b7", "score": "0.44456103", "text": "func DNSRecord() *cobra.Command {\n\tdnsRecordCmd := &cobra.Command{\n\t\tUse: \"record\",\n\t\tShort: \"dns record\",\n\t\tLong: ``,\n\t}\n\n\tdnsRecordCmd.AddCommand(recordCreate, recordGet, recordList, recordDelete, recordUpdate)\n\n\t// Create\n\trecordCreate.Flags().StringP(\"domain\", \"m\", \"\", \"name of domain you want to create this record for\")\n\trecordCreate.Flags().StringP(\"type\", \"t\", \"\", \"record type you want to create : Possible values A, AAAA, CNAME, NS, MX, SRV, TXT CAA, SSHFP\")\n\trecordCreate.Flags().StringP(\"name\", \"n\", \"\", \"name of record\")\n\trecordCreate.Flags().StringP(\"data\", \"d\", \"\", \"data for the record\")\n\tif err := recordCreate.MarkFlagRequired(\"domain\"); err != nil {\n\t\tfmt.Printf(\"error marking dns record create 'domain' flag required: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tif err := recordCreate.MarkFlagRequired(\"type\"); err != nil {\n\t\tfmt.Printf(\"error marking dns record create 'type' flag required: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tif err := recordCreate.MarkFlagRequired(\"name\"); err != nil {\n\t\tfmt.Printf(\"error marking dns record create 'name' flag required: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tif err := recordCreate.MarkFlagRequired(\"data\"); err != nil {\n\t\tfmt.Printf(\"error marking dns record create 'data' flag required: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\t// Create Optional\n\trecordCreate.Flags().IntP(\"ttl\", \"\", 0, \"time to live for the record\")\n\trecordCreate.Flags().IntP(\"priority\", \"p\", 0, \"only required for MX and SRV\")\n\n\t// Update\n\trecordUpdate.Flags().StringP(\"name\", \"n\", \"\", \"name of record\")\n\trecordUpdate.Flags().StringP(\"data\", \"d\", \"\", \"data for the record\")\n\trecordUpdate.Flags().IntP(\"ttl\", \"\", 0, \"time to live for the record\")\n\trecordUpdate.Flags().IntP(\"priority\", \"p\", -1, \"only required for MX and SRV\")\n\n\t// List\n\trecordList.Flags().StringP(\"cursor\", \"c\", \"\", \"(optional) Cursor for paging.\")\n\trecordList.Flags().IntP(\"per-page\", \"p\", 100, \"(optional) Number of items requested per page. Default is 100 and Max is 500.\")\n\n\treturn dnsRecordCmd\n}", "title": "" }, { "docid": "a38439fe959145561860ec712ee15696", "score": "0.44431075", "text": "func getdns(vm string) string{\n cmd := exec.Command(\"/usr/bin/dig\",\"+short\", vm)\n resultsBytes, err := cmd.CombinedOutput()\n resultsBytes = bytes.Trim(resultsBytes, \"\\n\")\n errHandler(err,\"#Couldn't lookup machine address:\" + vm, true )\n return string(resultsBytes)\n}", "title": "" }, { "docid": "a6d3640554ee2ddd81e1590b6c49c9f5", "score": "0.44387642", "text": "func (u UBFile) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\tqname := strings.ToLower(state.Req.Question[0].Name)\n\n\trecs, ok := u.uBData.Records[qname]\n\tif ok {\n\t\tif recs.zone != nil && recs.zone.zonetype == zoneTransparent && recs.rr[state.QType()] == nil {\n\t\t\treturn plugin.NextOrFailure(u.Name(), u.Next, ctx, w, r)\n\t\t}\n\t\tu.returnOK(r, w, recs.rr[state.QType()])\n\t\treturn dns.RcodeSuccess, nil\n\t}\n\tvar (\n\t\toff int\n\t\tend bool\n\t)\n\tfor {\n\t\tif zone, ok := u.uBData.Zones[qname[off:]]; ok {\n\t\t\tswitch zone.zonetype {\n\t\t\tcase zoneStatic:\n\t\t\t\t// return NXDOMAIN\n\t\t\t\tu.returnNXDomain(r, w, zone.fqdn)\n\t\t\t\treturn dns.RcodeSuccess, nil\n\t\t\tcase zoneTransparent:\n\t\t\t\treturn plugin.NextOrFailure(u.Name(), u.Next, ctx, w, r)\n\t\t\tcase zoneRedirect:\n\t\t\t\tu.returnOK(r, w, zone.GetRedirectedRecord(qname, state.QType()))\n\t\t\t\treturn dns.RcodeSuccess, nil\n\t\t\t}\n\t\t}\n\t\toff, end = dns.NextLabel(qname, off)\n\t\tif end {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Still not find any zone, defaults to next\n\treturn plugin.NextOrFailure(u.Name(), u.Next, ctx, w, r)\n\n}", "title": "" }, { "docid": "ea5c678bec70da14efeca9a5cfa57d24", "score": "0.44357863", "text": "func dnsQuery(q *dns.Msg, d string) (*dns.Msg, error) {\n\t// wrap the query with a timer for latency stats\n\tstart := time.Now()\n\tr, err := dns.Exchange(q, d)\n\tmetricsDnsRespTime(float64(time.Since(start).Milliseconds()), dns.TypeToString[q.Question[0].Qtype], d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// need to associate the rcode with the original query type and server info\n\tmetricsDnsReq(dns.TypeToString[q.Question[0].Qtype], d, dns.RcodeToString[r.Rcode])\n\n\t// assumes single query message; multiple query messages are best left as a theoretical possibility rather than actuality\n\tif r.Rcode != dns.RcodeSuccess {\n\t\tmetricsDnsResp(dns.TypeToString[r.Question[0].Qtype], d, dns.RcodeToString[r.Rcode])\n\t\tlog.Printf(\"%v: %v; %v\", dns.TypeToString[r.Question[0].Qtype], r.Question[0].Name, dns.RcodeToString[r.Rcode])\n\t\treturn r, nil\n\t}\n\n\t// note that AAAA queries may result in a response that has *no* RRs. this is the defined behavior ala RFC4074\n\t// it signals there's no AAAA record but there *are* other record types for that domain\n\tfor _, a := range r.Answer {\n\t\tmetricsDnsResp(dns.TypeToString[a.Header().Rrtype], d, dns.RcodeToString[r.Rcode])\n\n\t\t// omit log for each record received; may reenable later with a logging level option\n\t\t/*\n\t\t\tswitch a.(type) {\n\t\t\tcase *dns.A:\n\t\t\t\trr := a.(*dns.A)\n\t\t\t\tlog.Printf(\"%v: %v->%v; %v\", dns.TypeToString[rr.Header().Rrtype], q.Question[0].Name, rr.A, dns.RcodeToString[r.Rcode])\n\t\t\tcase *dns.AAAA:\n\t\t\t\trr := a.(*dns.AAAA)\n\t\t\t\tlog.Printf(\"%v: %v->%v; %v\", dns.TypeToString[rr.Header().Rrtype], q.Question[0].Name, rr.AAAA, dns.RcodeToString[r.Rcode])\n\t\t\tcase *dns.CNAME:\n\t\t\t\trr := a.(*dns.CNAME)\n\t\t\t\tlog.Printf(\"%v: %v->%v; %v\", dns.TypeToString[rr.Header().Rrtype], q.Question[0].Name, rr.Target, dns.RcodeToString[r.Rcode])\n\t\t\tcase *dns.MX:\n\t\t\t\trr := a.(*dns.MX)\n\t\t\t\tlog.Printf(\"%v: %v->%v; %v\", dns.TypeToString[rr.Header().Rrtype], q.Question[0].Name, rr.Mx, dns.RcodeToString[r.Rcode])\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"%v: Unexpected answer type\", reflect.TypeOf(a))\n\t\t\t}\n\t\t*/\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "fcebf46595f8de4a0799fde7d05d2e96", "score": "0.4431341", "text": "func NewDnsCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"dns\",\n\t\tShort: \"DNS lookup\",\n\t\tLong: `DNS lookup\nExample:\n\tatt net dns -t google.com\n\tatt net dns -r -t 142.250.187.206`,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tvar err error\n\n\t\t\tos.Setenv(\"GODEBUG\", \"netdns=go\")\n\t\t\tif reverse {\n\t\t\t\tif err = getAddr(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif err = getNS(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = getIP(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = getCNAME(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = getMX(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = getTXT(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.Flags().StringVarP(&target, \"target\", \"t\", \"\", \"Target domain / IP\")\n\tcmd.Flags().BoolVarP(&reverse, \"reverse\", \"r\", false, \"Reverse lookup (target must be an IP)\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "d98a4b423f11c68c3ce6dc57ed607296", "score": "0.4418316", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\tconnector, err := infoblox.NewConnector(d.ibConfig, d.transportConfig, &infoblox.WapiRequestBuilder{}, &infoblox.WapiHttpRequestor{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"infoblox: %w\", err)\n\t}\n\n\tdefer func() { _ = connector.Logout() }()\n\n\tobjectManager := infoblox.NewObjectManager(connector, defaultUserAgent, \"\")\n\n\trecord, err := objectManager.CreateTXTRecord(dns01.UnFqdn(info.EffectiveFQDN), info.Value, uint(d.config.TTL), d.config.DNSView)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"infoblox: could not create TXT record for %s: %w\", domain, err)\n\t}\n\n\td.recordRefsMu.Lock()\n\td.recordRefs[token] = record.Ref\n\td.recordRefsMu.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "5341be4a367ef2607f17e57dc1a907eb", "score": "0.44065392", "text": "func GenerateDNSTXTKey(hostname string) (string, string, error) {\r\n\tresp, err := net.LookupTXT(hostname)\r\n\tif err != nil {\r\n\t\treturn \"\", \"\", err\r\n\t}\r\n\tresult := resp[0]\r\n\r\n\thash, _ := GenerateHash([]byte(result), \"sha512\")\r\n\treturn result, hash, nil\r\n}", "title": "" }, { "docid": "625062c8bac02abc3db3cc7e6be94971", "score": "0.43928885", "text": "func fetchResults(domains []string, ip net.IP) (map[int]map[string][]myrasec.DNSRecord, error) {\n\tresultMap := make(map[int]map[string][]myrasec.DNSRecord)\n\n\trecordTypes := strings.Join([]string{RecordTypeA, RecordTypeAAAA}, \",\")\n\tparams := map[string]string{\n\t\t\"recordTypes\": recordTypes,\n\t\t\"activeOnly\": \"true\",\n\t\t\"pageSize\": \"1000\",\n\t}\n\tfor _, domain := range domains {\n\n\t\tdomains, err := api.ListDomains(map[string]string{\"search\": domain})\n\t\tif err != nil {\n\t\t\treturn resultMap, err\n\t\t}\n\n\t\tif len(domains) != 1 {\n\t\t\treturn resultMap, fmt.Errorf(\"Expected to fetch a single domain\")\n\t\t}\n\n\t\tdomain := domains[0]\n\t\tresultMap[domain.ID] = make(map[string][]myrasec.DNSRecord)\n\n\t\trecords, err := api.ListDNSRecords(domain.ID, params)\n\t\tif err != nil {\n\t\t\treturn resultMap, err\n\t\t}\n\n\t\tfor _, rec := range records {\n\t\t\tif rec.Value == ip.String() {\n\t\t\t\tlog.Printf(\"INFO: No change required for %s (%s)\\n\", rec.Name, rec.Value)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresultMap[domain.ID][rec.Name] = append(resultMap[domain.ID][rec.Name], rec)\n\t\t}\n\t}\n\n\treturn resultMap, nil\n\n}", "title": "" }, { "docid": "e4a52e56e3c290c9b9af733001a48b64", "score": "0.43869996", "text": "func dnsHandler(w http.ResponseWriter, r *http.Request) {\r\n\r\n\tp := strings.Split(r.URL.Path, \"/\")\r\n\tfmt.Println(p)\r\n\td := readDNS()\r\n\r\n\tswitch r.Method {\r\n\r\n\tcase \"GET\":\r\n\t\tif p[3] != \"\" {\r\n\t\t\tfor _, dns := range d {\r\n\t\t\t\t// var j []byte\r\n\t\t\t\tid := `ObjectID(\"` + p[3] + `\")`\r\n\t\t\t\tif (dns.ID).String() == id {\r\n\t\t\t\t\tj, err := json.Marshal(dns)\r\n\t\t\t\t\tif err != nil {\r\n\t\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\t\t\t\t\tw.Write(j)\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tj, err := json.Marshal(d)\r\n\t\t\tif err != nil {\r\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\t\t\tw.Write(j)\r\n\t\t}\r\n\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t\tlog.Println(string(body))\r\n\t\tvar d dns\r\n\t\terr = json.Unmarshal(body, &d)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t\tlog.Println(d)\r\n\r\n\t\tclient, err := mongo.NewClient(\"mongodb://mongo:27017\")\r\n\t\terr = client.Connect(context.TODO())\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\r\n\t\tcollection := client.Database(\"governor\").Collection(\"dns\")\r\n\t\tdoc, err := bson.Marshal(d)\r\n\t\tfilter := bson.NewDocument(bson.EC.ObjectID(\"_id\", d.ID))\r\n\r\n\t\tres, err := collection.ReplaceOne(context.Background(), filter, doc)\r\n\t\tlog.Println(res.UpsertedID)\r\n\r\n\t\tif res.UpsertedID == nil {\r\n\t\t\twriteDNS(d.Record, d.RecordType, d.Zone, d.Target, d.Action, d.Email, d.Source, d.SourceID)\r\n\r\n\t\t}\r\n\r\n\tdefault:\r\n\t}\r\n}", "title": "" }, { "docid": "b18f69651da123a9a29e16c4bddacded", "score": "0.43849567", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\tapiHost, apiDomain := splitFqdn(info.EffectiveFQDN)\n\n\trecord := internal.ZoneRecord{\n\t\tDomain: apiDomain,\n\t\tHost: apiHost,\n\t\tType: \"TXT\",\n\t\tRdata: info.Value,\n\t\tTTL: strconv.Itoa(d.config.TTL),\n\t\tPriority: \"0\",\n\t}\n\n\trecordID, err := d.client.AddRecord(context.Background(), apiDomain, record)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"easydns: error adding zone record: %w\", err)\n\t}\n\n\tkey := getMapKey(info.EffectiveFQDN, info.Value)\n\n\td.recordIDsMu.Lock()\n\td.recordIDs[key] = recordID\n\td.recordIDsMu.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "8df6ae86cad3b9f25afb8736e136101b", "score": "0.4381908", "text": "func (n *nim) queryControllerDNS() {\n\tvar etchosts, controllerServer []byte\n\tvar ttlSec int\n\tvar ipaddrCached string\n\n\tif _, err := os.Stat(etcHostFileName); err == nil {\n\t\tetchosts, err = os.ReadFile(etcHostFileName)\n\t\tif err == nil {\n\t\t\tcontrollerServer, _ = os.ReadFile(types.ServerFileName)\n\t\t\tcontrollerServer = bytes.TrimSuffix(controllerServer, []byte(\"\\n\"))\n\t\t\tif bytes.Contains(controllerServer, []byte(\":\")) {\n\t\t\t\tserverport := bytes.Split(controllerServer, []byte(\":\"))\n\t\t\t\tif len(serverport) == 2 {\n\t\t\t\t\tcontrollerServer = serverport[0]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(controllerServer) == 0 {\n\t\tn.Log.Errorf(\"can't read /etc/hosts or server file\")\n\t\treturn\n\t}\n\n\tdnsTimer := time.NewTimer(time.Duration(minTTLSec) * time.Second)\n\n\twdName := agentName + \"dnsQuery\"\n\tstillRunning := time.NewTicker(stillRunTime)\n\tn.PubSub.StillRunning(wdName, warningTime, errorTime)\n\tn.PubSub.RegisterFileWatchdog(wdName)\n\n\tfor {\n\t\tselect {\n\t\tcase <-dnsTimer.C:\n\t\t\t// base on ttl from server dns update frequency for controller IP resolve\n\t\t\t// even if the dns server implementation returns the remaining value of the TTL it caches,\n\t\t\t// it will still work.\n\t\t\tipaddrCached, ttlSec = n.controllerDNSCache(etchosts, controllerServer, ipaddrCached)\n\t\t\tdnsTimer = time.NewTimer(time.Duration(ttlSec) * time.Second)\n\n\t\tcase <-stillRunning.C:\n\t\t}\n\t\tn.PubSub.StillRunning(wdName, warningTime, errorTime)\n\t}\n}", "title": "" }, { "docid": "18e02f6334f84ce0e6673ed0c58705b1", "score": "0.43791187", "text": "func NewRecordSRV(\n\tname string, content string, ttl int, priority int, weight uint,\n\tport uint,\n) (RecordSRV, error) {\n\tif ttlErr := checkValidTTL(ttl); ttlErr != nil {\n\t\treturn RecordSRV{}, ttlErr\n\t}\n\n\tif priErr := checkValidPriority(priority); priErr != nil {\n\t\treturn RecordSRV{}, priErr\n\t}\n\n\treturn RecordSRV{\n\t\tType: \"SRV\",\n\t\tName: name,\n\t\tContent: content,\n\t\tTTL: ttl,\n\t\tPriority: priority,\n\t\tWeight: weight,\n\t\tPort: port,\n\t}, nil\n}", "title": "" }, { "docid": "5b229248a69f12a6520f9ef402bd1785", "score": "0.43768957", "text": "func parseDNSQuestion(reqData []byte) (string, error) {\n\t// initialize the message parser\n\tvar dnsParser dnsmessage.Parser\n\n\t// consume the dns message\n\tif _, err := dnsParser.Start(reqData); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// parse the question\n\tfor {\n\t\tq, err := dnsParser.Question()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tlogrus.Debugf(\"Lookup: %s, %s, %s\\n\", q.Name, q.Class, q.Type)\n\n\t\t// Telemetry: Logging DNS request type\n\t\ttelemetryChannel <- TelemetryValues[q.Type.String()]\n\t\tlogrus.Debugf(\"Logging DNS Telemetry for %s request.\", q.Type)\n\n\t\t// return a Base64 encoded string generated from (DNS RR, Class and Type)\n\t\t// this string will be used to perform cache set/get actions\n\t\treturn base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(\"%s:%s:%s\", q.Name, q.Class, q.Type))), nil\n\t}\n}", "title": "" }, { "docid": "844501612107497d738b9af3f42c8fb9", "score": "0.4366387", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tinfo := dns01.GetChallengeInfo(domain, keyAuth)\n\n\tzoneName, err := d.getHostedZone(info.EffectiveFQDN)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dnsimple: %w\", err)\n\t}\n\n\taccountID, err := d.getAccountID()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dnsimple: %w\", err)\n\t}\n\n\trecordAttributes, err := newTxtRecord(zoneName, info.EffectiveFQDN, info.Value, d.config.TTL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dnsimple: %w\", err)\n\t}\n\n\t_, err = d.client.Zones.CreateRecord(context.Background(), accountID, zoneName, recordAttributes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dnsimple: API call failed: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fccb86f7cc63afcbe8f9b20fa54aea6f", "score": "0.43512988", "text": "func (o LookupInstanceResultOutput) PrivateDns() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.PrivateDns }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6f428dac66ff6461409605cdc039b2c3", "score": "0.43465322", "text": "func NewDNSRecordType(t types.EDNSRecordType) *types.EDNSRecordType { return &t }", "title": "" }, { "docid": "50e471567cfd68aad92da2e8a54320b7", "score": "0.43452677", "text": "func sendMsg(name string, dnsType uint16) Response {\n\t//Now send the data out to the server\n\n\tclient := http.Client{\n\t\tTimeout: time.Second * 20,\n\t}\n\n\tr, err := http.NewRequest(\"GET\", \"https://dns.google.com/resolve\", nil)\n\tif err != nil {\n\t\tagentfunctions.AllOutput.Mutex.Lock()\n\t\tagentfunctions.JobCount++\n\t\tagentfunctions.AllOutput.List[agentfunctions.JobCount] = &agentscommon.JobOutput{\"error\", err.Error()}\n\t\tagentfunctions.AllOutput.Mutex.Unlock()\n\t}\n\n\tq := r.URL.Query()\n\tq.Add(\"name\", name+\".\"+host)\n\tq.Add(\"type\", strconv.Itoa(int(dnsType)))\n\tq.Add(\"cd\", \"false\") // ignore DNSSEC\n\tr.URL.RawQuery = q.Encode()\n\tres, err := client.Do(r)\n\tif err != nil {\n\t\tagentfunctions.AllOutput.Mutex.Lock()\n\t\tagentfunctions.JobCount++\n\t\tagentfunctions.AllOutput.List[agentfunctions.JobCount] = &agentscommon.JobOutput{\"error\", err.Error()}\n\t\tagentfunctions.AllOutput.Mutex.Unlock()\n\t}\n\n\tdefer res.Body.Close()\n\tif res.StatusCode == http.StatusOK {\n\t\tbodyBytes, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\tagentfunctions.AllOutput.Mutex.Lock()\n\t\t\tagentfunctions.JobCount++\n\t\t\tagentfunctions.AllOutput.List[agentfunctions.JobCount] = &agentscommon.JobOutput{\"error\", err.Error()}\n\t\t\tagentfunctions.AllOutput.Mutex.Unlock()\n\t\t}\n\t\tdnsRequestResponse := requestResponse{}\n\t\terr = json.Unmarshal(bodyBytes, &dnsRequestResponse)\n\t\tif err != nil {\n\t\t\tagentfunctions.AllOutput.Mutex.Lock()\n\t\t\tagentfunctions.JobCount++\n\t\t\tagentfunctions.AllOutput.List[agentfunctions.JobCount] = &agentscommon.JobOutput{\"error\", err.Error()}\n\t\t\tagentfunctions.AllOutput.Mutex.Unlock()\n\t\t}\n\n\t\tfout := Response{}\n\n\t\tif len(dnsRequestResponse.Answer) <= 0 {\n\t\t\treturn fout\n\t\t}\n\n\t\tfout.TTL = dnsRequestResponse.Answer[0].TTL\n\t\tfout.Data = dnsRequestResponse.Answer[0].Data\n\t\tfout.Status = dns.RcodeToString[dnsRequestResponse.Status]\n\n\t\treturn fout\n\t}\n\treturn Response{}\n}", "title": "" }, { "docid": "64504b80e2dc2f354eab02aa95e3af66", "score": "0.4340886", "text": "func (o *NetworkconfigPolicyInventoryAllOf) GetDynamicDnsDomainOk() (*string, bool) {\n\tif o == nil || o.DynamicDnsDomain == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DynamicDnsDomain, true\n}", "title": "" }, { "docid": "fc99aeb81ee9447843664ecab319d3cc", "score": "0.43405443", "text": "func SRV(name, target string, ttl time.Duration, priority, weight, port uint16) (*SRVRecord, error) {\n if len(name) <= 0 {\n return nil, errors.New(\"A base hostname is required.\")\n } else if len(target) <= 0 {\n return nil, errors.New(\"The record must contain a target hostname.\")\n } else if ttl.Seconds() < 5 { // TODO: get actual max class int\n return nil, errors.New(fmt.Sprintf(\"TTL of <5s is not supported. Received: %d\", ttl.Seconds))\n }\n\n var result = &SRVRecord{\n RecordHeader{\n Name: name,\n Type: SRV_RECORD,\n Class: uint16( 1 ), // 'IN' class\n TTL: ttl,\n },\n priority,\n weight,\n port,\n target,\n }\n\n // serialize to catch errors\n _, err := result.Serialize()\n return result, err\n}", "title": "" }, { "docid": "efcccabff806d21c585ebd56ce7a9ec8", "score": "0.4319484", "text": "func (e *DNSExecuter) ExecuteDNS(p progress.IProgress, URL string) (result Result) {\n\t// Parse the URL and return domain if URL.\n\tvar domain string\n\tif isURL(URL) {\n\t\tdomain = extractDomain(URL)\n\t} else {\n\t\tdomain = URL\n\t}\n\n\t// Compile each request for the template based on the URL\n\tcompiledRequest, err := e.dnsRequest.MakeDNSRequest(domain)\n\tif err != nil {\n\t\tresult.Error = errors.Wrap(err, \"could not make dns request\")\n\t\tp.Drop(1)\n\t\treturn\n\t}\n\n\tif e.debug {\n\t\tgologger.Infof(\"Dumped DNS request for %s (%s)\\n\\n\", URL, e.template.ID)\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", compiledRequest.String())\n\t}\n\n\t// Send the request to the target servers\n\tresp, err := e.dnsClient.Do(compiledRequest)\n\tif err != nil {\n\t\tresult.Error = errors.Wrap(err, \"could not send dns request\")\n\t\tp.Drop(1)\n\t\treturn\n\t}\n\n\tp.Update()\n\n\tgologger.Verbosef(\"Sent DNS request to %s\\n\", \"dns-request\", URL)\n\n\tif e.debug {\n\t\tgologger.Infof(\"Dumped DNS response for %s (%s)\\n\\n\", URL, e.template.ID)\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", resp.String())\n\t}\n\n\tmatcherCondition := e.dnsRequest.GetMatchersCondition()\n\tfor _, matcher := range e.dnsRequest.Matchers {\n\t\t// Check if the matcher matched\n\t\tif !matcher.MatchDNS(resp) {\n\t\t\t// If the condition is AND we haven't matched, return.\n\t\t\tif matcherCondition == matchers.ANDCondition {\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\t// If the matcher has matched, and its an OR\n\t\t\t// write the first output then move to next matcher.\n\t\t\tif matcherCondition == matchers.ORCondition && len(e.dnsRequest.Extractors) == 0 {\n\t\t\t\te.writeOutputDNS(domain, compiledRequest, resp, matcher, nil)\n\t\t\t\tresult.GotResults = true\n\t\t\t}\n\t\t}\n\t}\n\n\t// All matchers have successfully completed so now start with the\n\t// next task which is extraction of input from matchers.\n\tvar extractorResults []string\n\tfor _, extractor := range e.dnsRequest.Extractors {\n\t\tfor match := range extractor.ExtractDNS(resp) {\n\t\t\tif !extractor.Internal {\n\t\t\t\textractorResults = append(extractorResults, match)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Write a final string of output if matcher type is\n\t// AND or if we have extractors for the mechanism too.\n\tif len(e.dnsRequest.Extractors) > 0 || matcherCondition == matchers.ANDCondition {\n\t\te.writeOutputDNS(domain, compiledRequest, resp, nil, extractorResults)\n\t\tresult.GotResults = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e11ef34618fcc40e1a8b2e64579177ba", "score": "0.431317", "text": "func New(opts ...Option) (Daemon, error) {\n\tc := &pubkeyd{\n\t\tconfCache: &AthenzConfig{\n\t\t\tZMSPubKeys: new(sync.Map),\n\t\t\tZTSPubKeys: new(sync.Map),\n\t\t},\n\t\teTagCache: gache.New(),\n\t}\n\n\tfor _, opt := range append(defaultOptions, opts...) {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error create pubkeyd\")\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "4f8bb8de55eb88dd3105e832a2388e3e", "score": "0.43082315", "text": "func (hpe *HpeCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string) {\n\treturn nameservers, searches\n}", "title": "" }, { "docid": "3ce181805bf5bc958be51a86201e628b", "score": "0.43064952", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tfqdn, value := dns01.GetRecord(domain, keyAuth)\n\n\terr := d.login()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tviewID, err := d.lookupViewID(d.config.DNSView)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tparentZoneID, name, err := d.lookupParentZoneID(viewID, fqdn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqueryArgs := map[string]string{\n\t\t\"parentId\": strconv.FormatUint(uint64(parentZoneID), 10),\n\t}\n\n\tbody := bluecatEntity{\n\t\tName: name,\n\t\tType: \"TXTRecord\",\n\t\tProperties: fmt.Sprintf(\"ttl=%d|absoluteName=%s|txt=%s|\", d.config.TTL, fqdn, value),\n\t}\n\n\tresp, err := d.sendRequest(http.MethodPost, \"addEntity\", body, queryArgs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\taddTxtBytes, _ := ioutil.ReadAll(resp.Body)\n\taddTxtResp := string(addTxtBytes)\n\t// addEntity responds only with body text containing the ID of the created record\n\t_, err = strconv.ParseUint(addTxtResp, 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"bluecat: addEntity request failed: %s\", addTxtResp)\n\t}\n\n\terr = d.deploy(parentZoneID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn d.logout()\n}", "title": "" }, { "docid": "85a55e2a8112f851029642dd569fa0f3", "score": "0.43007275", "text": "func GetPkandValidatorPkUsingAddress(w http.ResponseWriter, req *http.Request) {\n\tnow, userIP := globalPkg.SetLogObj(req)\n\tlogStruct := logpkg.LogStruct{\"\", now, userIP, \"macAdress\", \"GetPublickeyUsingAddress\", \"Account\", \"\", \"\", \"\", 0}\n\n\taccountObj := accountdb.AccountStruct{}\n\n\tdecoder := json.NewDecoder(req.Body)\n\tdecoder.DisallowUnknownFields()\n\terr := decoder.Decode(&accountObj)\n\tif err != nil {\n\t\tglobalPkg.SendError(w, \"please enter your correct request \")\n\t\tglobalPkg.WriteLog(logStruct, \"failed to decode Object\", \"failed\")\n\t\treturn\n\t}\n\n\taccountobj := GetAccountByAccountPubicKey(accountObj.AccountPublicKey)\n\tif accountObj.AccountPublicKey == \"\" {\n\t\tglobalPkg.SendError(w, \"invalid address \")\n\t\tglobalPkg.WriteLog(logStruct, \"invalid address\", \"failed\")\n\t\treturn\n\t}\n\tif accountObj.AccountPassword != accountobj.AccountPassword {\n\t\tglobalPkg.SendError(w, \"incorrect password \")\n\t\tglobalPkg.WriteLog(logStruct, \"incorrect password\", \"failed\")\n\t\treturn\n\t}\n\n\tif accountObj.AccountName != accountobj.AccountName {\n\t\tglobalPkg.SendError(w, \"incorrect name\")\n\t\tglobalPkg.WriteLog(logStruct, \"incorrect name\", \"failed\")\n\t\treturn\n\t}\n\n\t//pk := FindpkByAddress(accountObj.AccountPublicKey)\n\n\tpkValidator := validator.CurrentValidator.ValidatorPublicKey\n\n\tdata := map[string]interface{}{\n\t\t//\"Public key for User\": pk.Publickey,\n\t\t\"validator Public Key \": pkValidator,\n\t}\n\tjsonObj, _ := json.Marshal(data)\n\tglobalPkg.SendResponse(w, jsonObj)\n\treturn\n}", "title": "" }, { "docid": "c7dff992ebf018f97333447e4820b247", "score": "0.4298292", "text": "func (d *DNSData) ParseFromMsg(msg *dns.Msg) error {\n\tfor _, record := range msg.Answer {\n\t\tswitch record.(type) {\n\t\tcase *dns.A:\n\t\t\td.A = append(d.A, trimChars(record.(*dns.A).A.String()))\n\t\tcase *dns.NS:\n\t\t\td.NS = append(d.NS, trimChars(record.(*dns.NS).Ns))\n\t\tcase *dns.CNAME:\n\t\t\td.CNAME = append(d.CNAME, trimChars(record.(*dns.CNAME).Target))\n\t\tcase *dns.SOA:\n\t\t\td.SOA = append(d.SOA, trimChars(record.(*dns.SOA).Mbox))\n\t\tcase *dns.PTR:\n\t\t\td.PTR = append(d.PTR, trimChars(record.(*dns.PTR).Ptr))\n\t\tcase *dns.MX:\n\t\t\td.MX = append(d.MX, trimChars(record.(*dns.MX).Mx))\n\t\tcase *dns.TXT:\n\t\t\tfor _, txt := range record.(*dns.TXT).Txt {\n\t\t\t\td.TXT = append(d.TXT, trimChars(txt))\n\t\t\t}\n\t\tcase *dns.AAAA:\n\t\t\td.AAAA = append(d.AAAA, trimChars(record.(*dns.AAAA).AAAA.String()))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9737469b0386f89391ff81db0541f37", "score": "0.42913315", "text": "func (d *DNSProvider) Present(domain, token, keyAuth string) error {\n\tfqdn, value, _ := acme.DNS01Record(domain, keyAuth)\n\n\tzone, err := d.getHostedZone(domain)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sakuracloud: %v\", err)\n\t}\n\n\tname := d.extractRecordName(fqdn, zone.Name)\n\n\tzone.AddRecord(zone.CreateNewRecord(name, \"TXT\", value, d.config.TTL))\n\t_, err = d.client.GetDNSAPI().Update(zone.ID, zone)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sakuracloud: API call failed: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2862ab1dd6eefb67a1e32120338b957b", "score": "0.42900327", "text": "func NewDNSResolver() *DNSResolver {\n\treturn &DNSResolver{lookupTXT: net.LookupTXT}\n}", "title": "" }, { "docid": "f7e515b8b036813e2de83f476d28aa07", "score": "0.42896214", "text": "func (*DNSProviderManual) Present(domain, token, keyAuth string) error {\n\tfqdn, value, ttl := DNS01Record(domain, keyAuth)\n\tdnsRecord := fmt.Sprintf(dnsTemplate, fqdn, ttl, value)\n\n\tauthZone, err := FindZoneByFqdn(fqdn, RecursiveNameservers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogf(\"[INFO] acme: Please create the following TXT record in your %s zone:\", authZone)\n\tlogf(\"[INFO] acme: %s\", dnsRecord)\n\tlogf(\"[INFO] acme: Press 'Enter' when you are done\")\n\n\treader := bufio.NewReader(os.Stdin)\n\t_, _ = reader.ReadString('\\n')\n\treturn nil\n}", "title": "" }, { "docid": "314b8641380d1feb808339c40cc51ed7", "score": "0.42725793", "text": "func (o LookupInstanceResultOutput) PublicDns() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.PublicDns }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e2a43d9db5f1fc34557c1219f04da3fe", "score": "0.4272225", "text": "func (wdb *WzWorkerClientKeysAPI) GetRSAPubkeyByFQDN(fqdn string) {}", "title": "" }, { "docid": "fdfc325c568de7f5e835d530c326ab17", "score": "0.42713305", "text": "func DecodePubKey(b []byte) *Signature {\n\tdecoder := bytes.NewBuffer(b) // Stand-in for a network connection\n\tdec := gob.NewDecoder(decoder) // Will read from network.\n\n\tvar dsign = CreateSignature()\n\terr := dec.Decode(dsign)\n\tif err != nil {\n\t\tlog.Fatal(\"decode error:\", err)\n\t}\n\n\treturn dsign\n}", "title": "" }, { "docid": "b400b2c6092cb4006567baaaf29f0dfe", "score": "0.4260297", "text": "func (k *DNSKEY) publicKeyECDSA() *ecdsa.PublicKey {\r\n\tkeybuf, err := fromBase64([]byte(k.PublicKey))\r\n\tif err != nil {\r\n\t\treturn nil\r\n\t}\r\n\tpubkey := new(ecdsa.PublicKey)\r\n\tswitch k.Algorithm {\r\n\tcase ECDSAP256SHA256:\r\n\t\tpubkey.Curve = elliptic.P256()\r\n\t\tif len(keybuf) != 64 {\r\n\t\t\t// wrongly encoded key\r\n\t\t\treturn nil\r\n\t\t}\r\n\tcase ECDSAP384SHA384:\r\n\t\tpubkey.Curve = elliptic.P384()\r\n\t\tif len(keybuf) != 96 {\r\n\t\t\t// Wrongly encoded key\r\n\t\t\treturn nil\r\n\t\t}\r\n\t}\r\n\tpubkey.X = new(big.Int).SetBytes(keybuf[:len(keybuf)/2])\r\n\tpubkey.Y = new(big.Int).SetBytes(keybuf[len(keybuf)/2:])\r\n\treturn pubkey\r\n}", "title": "" } ]
8bdd05680801a3ad2018b805ed17c5ca
GetBooleanFalsePreparer prepares the GetBooleanFalse request.
[ { "docid": "28dd82a45cda17978232518429046deb", "score": "0.794896", "text": "func (client PathsClient) GetBooleanFalsePreparer(boolPath bool) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"boolPath\": autorest.Encode(\"path\",boolPath),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/paths/bool/false/{boolPath}\",pathParameters))\n return preparer.Prepare(&http.Request{})\n}", "title": "" } ]
[ { "docid": "36a8686b5f7e4bb0e90a20e4ac830af9", "score": "0.81748915", "text": "func (client BoolClient) GetFalsePreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/false\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "e08654a2dd7945499cb0b4e041dfbab1", "score": "0.68086153", "text": "func (client BoolClient) PutFalsePreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/false\"),\n\t\tautorest.WithJSON(false))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d3185813b25a854c71d577c4d08176e2", "score": "0.6488043", "text": "func (client PathsClient) GetBooleanTruePreparer(boolPath bool) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"boolPath\": autorest.Encode(\"path\",boolPath),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/paths/bool/true/{boolPath}\",pathParameters))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "3f1ea10c0af1332d7a2a63847287c72d", "score": "0.64333403", "text": "func (client BoolClient) GetInvalidPreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/invalid\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "06cdec5db1dd6650992e1c81e363e3d5", "score": "0.641139", "text": "func (client BoolClient) GetTruePreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/true\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "3db761bfaa2c2646345fefb0ac6fd62f", "score": "0.6018943", "text": "func (client PathsClient) GetBooleanFalse(boolPath bool) (result autorest.Response, err error) {\n req, err := client.GetBooleanFalsePreparer(boolPath)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"urlgroup.PathsClient\", \"GetBooleanFalse\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.GetBooleanFalseSender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"urlgroup.PathsClient\", \"GetBooleanFalse\", resp, \"Failure sending request\")\n }\n\n result, err = client.GetBooleanFalseResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"urlgroup.PathsClient\", \"GetBooleanFalse\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "d5a1608ea651b53ff57cbc62e5476e47", "score": "0.60159713", "text": "func (client BoolClient) GetFalseResponder(resp *http.Response) (result BoolModel, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "31a2b9835c0963a1758fb884af768e04", "score": "0.5979978", "text": "func (client BoolClient) GetFalse(ctx context.Context) (result BoolModel, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/BoolClient.GetFalse\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetFalsePreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"booleangroup.BoolClient\", \"GetFalse\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetFalseSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"booleangroup.BoolClient\", \"GetFalse\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetFalseResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"booleangroup.BoolClient\", \"GetFalse\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a6598d1afc95fecca17fcc773813423d", "score": "0.58842826", "text": "func (client BoolClient) GetNullPreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/null\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "5e3bfd41f77ed3926646744c61cb38f6", "score": "0.58223", "text": "func NewFalse() routing.PredicateSpec { return &falseSpec{} }", "title": "" }, { "docid": "fd0493d44730d70e935bd6fdb954b1bc", "score": "0.5779985", "text": "func (client PathsClient) GetBooleanFalseResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "4c41344b09e77f7aa0d3064972cc912e", "score": "0.5681109", "text": "func (client PathsClient) GetBooleanFalseSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "c4ec92ff54bcfcdf7098f95d432e0a92", "score": "0.55383164", "text": "func (validator *ValidatorBoolP[T]) False(template ...string) *ValidatorBoolP[T] {\n\tvalidator.context.Add(\n\t\tfunc() bool {\n\t\t\treturn validator.context.Value().(*T) != nil && isBoolFalse(*(validator.context.Value().(*T)))\n\t\t},\n\t\tErrorKeyFalse, template...)\n\n\treturn validator\n}", "title": "" }, { "docid": "064ce1afede0946ee1cf6cc931da2de8", "score": "0.5351679", "text": "func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"columnName\": autorest.Encode(\"path\", columnName),\n\t\t\"databaseName\": autorest.Encode(\"path\", databaseName),\n\t\t\"managedInstanceName\": autorest.Encode(\"path\", managedInstanceName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"schemaName\": autorest.Encode(\"path\", schemaName),\n\t\t\"sensitivityLabelSource\": autorest.Encode(\"path\", \"recommended\"),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"tableName\": autorest.Encode(\"path\", tableName),\n\t}\n\n\tconst APIVersion = \"2020-11-01-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "2daf3c5c2062b8267d78cf410c22d456", "score": "0.51682925", "text": "func (client SQLPoolSensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"columnName\": autorest.Encode(\"path\", columnName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"schemaName\": autorest.Encode(\"path\", schemaName),\n\t\t\"sensitivityLabelSource\": autorest.Encode(\"path\", \"recommended\"),\n\t\t\"sqlPoolName\": autorest.Encode(\"path\", SQLPoolName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"tableName\": autorest.Encode(\"path\", tableName),\n\t\t\"workspaceName\": autorest.Encode(\"path\", workspaceName),\n\t}\n\n\tconst APIVersion = \"2021-06-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d6236a9c677d8d677e8b21aaa3ae7bb9", "score": "0.49817765", "text": "func (client BoolClient) PutTruePreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/bool/true\"),\n\t\tautorest.WithJSON(true))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "044add66b416d5c62deb6e44f2755d65", "score": "0.4916529", "text": "func GetBoolOrFalse(key string) bool {\n\tval, err := strconv.ParseBool(Get(key))\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn val\n}", "title": "" }, { "docid": "26c80b2af80579405d510f08acad368b", "score": "0.49080884", "text": "func TestBiddingPacerFalse(t *testing.T) {\n\tr := new(rtb.BidRequest)\n\tr.Imp = make([]rtb.Imp, 1)\n\tr.Imp[0] = rtb.Imp{}\n\n\tpacer := mocks.NewMockPacer(map[int64]bool{100: false})\n\n\tcampaign := mocks.NewMockCampaign(100, rtb.CpmToMicroCents(0.25), rtb.DollarsToMicroCents(1), nil)\n\n\tcampaignsReturnedByTargeting := []rtb.Campaign{campaign}\n\n\tcp := mocks.NewMockCampaignProvider(campaignsReturnedByTargeting, map[int64]int64{100: rtb.DollarsToMicroCents(1)}, map[int64]error{100: nil}, nil)\n\n\tb := NewBidRequestBidder(r, cp, pacer, time.Now().UTC())\n\n\tresponse, _, err := b.Bid()\n\n\tif err != nil {\n\t\tt.Fail()\n\t}\n\n\tif response != nil {\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "afcabdc4405ad307bb82fed18ba1fe3e", "score": "0.48946834", "text": "func NewFalse() *bool {\n\tb := false\n\treturn &b\n}", "title": "" }, { "docid": "afcabdc4405ad307bb82fed18ba1fe3e", "score": "0.48946834", "text": "func NewFalse() *bool {\n\tb := false\n\treturn &b\n}", "title": "" }, { "docid": "7af5be28fc9252027dbea5caed3d0484", "score": "0.4863555", "text": "func FalseP() *bool {\n\treturn falseP\n}", "title": "" }, { "docid": "0d7bcdda0a7ecfa28ffe815eab75506a", "score": "0.48544732", "text": "func (t *RPCGetDescriptor) ConvertToBool() *ggt.MethodDescriptor { return t.methodConvertToBool }", "title": "" }, { "docid": "8bb1d2eeee0e2e6318a6da2c820999a7", "score": "0.48456028", "text": "func (client ExtendedClient) DisablePreparer(ctx context.Context, cwKey string, instanceIds string) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"cw_key\": autorest.Encode(\"query\", cwKey),\n\t\t\"instanceIds\": autorest.Encode(\"query\", instanceIds),\n\t}\n\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"PUT\", common.GetPath(DefaultBaseURI, \"/cw_fea/real/cw/api/schema/extended/disable\")+\"?\"+common.GetQuery(queryParameters), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/cw_fea/real/cw/api/schema/extended/disable\"),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-api-key\", client.APIGatewayAPIKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "169c7780683fd4cebacd495bbbca665f", "score": "0.48128137", "text": "func (c *Base) QueryBool(ctx *iris.Context, key string, defaultVal bool) bool {\n\tif str := ctx.URLParam(key); str != \"\" {\n\t\tif b, err := strconv.ParseBool(str); err == nil {\n\t\t\treturn b\n\t\t}\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "3db8e85686411f89ee74019bdb8d6ebc", "score": "0.4782079", "text": "func False() *Bool {\n\treturn &Bool{Bool: false, Valid: true}\n}", "title": "" }, { "docid": "c1f6f4368c41840d8d102fbe48fbcf17", "score": "0.47784674", "text": "func (b *Boolean) False() *Boolean {\n\treturn b.IsFalse()\n}", "title": "" }, { "docid": "223fe8af5a3e435f1d618278a4ced579", "score": "0.4715269", "text": "func (client BoolClient) GetFalseSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "a9674a1ecace46255133915d62546145", "score": "0.46933013", "text": "func (e EnvTree) GetBoolUnsecured() bool {\n\tif val, err := getBool(getRootValue(e)); err == nil {\n\t\treturn val\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "faee4e8bc1487bc47bde727b3de4d35e", "score": "0.4675016", "text": "func (client ImplicitClient) GetOptionalGlobalQueryPreparer() (*http.Request, error) {\n queryParameters := map[string]interface{} {\n }\n if client.OptionalGlobalQuery != nil {\n queryParameters[\"optional-global-query\"] = autorest.Encode(\"query\",*client.OptionalGlobalQuery)\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/reqopt/global/optional/query\"),\n autorest.WithQueryParameters(queryParameters))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "f994da066cc9d788c72a882489c834be", "score": "0.46629536", "text": "func False() BooleanValue {\n\treturn Boolean(false)\n}", "title": "" }, { "docid": "ecd01344ea01d7bee8913551c45d5ff8", "score": "0.4636293", "text": "func GetBoolean(data []byte, path ...string) (value bool, err error) {\n\treturn jsonparser.GetBoolean(data, path...)\n}", "title": "" }, { "docid": "de4fdb03d2e95a0835f161e44b1d070c", "score": "0.46360362", "text": "func (boolean *Bool) False() {\n\tboolean.Set(false)\n}", "title": "" }, { "docid": "ecf5072fa6acfb9c47ae1c97f2bb6447", "score": "0.46270204", "text": "func (ctx *Context) GetBool(key string, def ...bool) (bool, error) {\n\tstrv := ctx.Query(key)\n\tif len(strv) == 0 && len(def) > 0 {\n\t\treturn def[0], nil\n\t}\n\treturn strconv.ParseBool(strv)\n}", "title": "" }, { "docid": "0c6664ac4de062d1254f0cdc9d6691cd", "score": "0.46208146", "text": "func (e *Env) GetNegBool(def bool, flist []NegBoolFunc) bool {\n\tfor _, f := range flist {\n\t\tif val, isSet := f.f(); isSet {\n\t\t\treturn (val != f.neg)\n\t\t}\n\t}\n\treturn def\n}", "title": "" }, { "docid": "b97ca9d2ff087dfd5e4599f4c1de6034", "score": "0.46109703", "text": "func FalsePredicate(x interface{}) bool {\n return false\n}", "title": "" }, { "docid": "1e7cc71713c7ad290f5a789553315017", "score": "0.46074063", "text": "func BoolFalse(value bool, errorType util.ErrorType, message string) Rule {\n\treturn &boolFalse{value: value, errorType: errorType, message: message}\n}", "title": "" }, { "docid": "d3cc959e54061d46724f20bd8a14b7d8", "score": "0.46060753", "text": "func (_e *GosoConf_Expecter) GetBool(key interface{}, optionalDefault ...interface{}) *GosoConf_GetBool_Call {\n\treturn &GosoConf_GetBool_Call{Call: _e.mock.On(\"GetBool\",\n\t\tappend([]interface{}{key}, optionalDefault...)...)}\n}", "title": "" }, { "docid": "cd37f9e0823d405fab1e07829664e9fe", "score": "0.45985687", "text": "func builtinIsFalse(_ *lisp.LEnv, _ *lisp.LVal) *lisp.LVal {\n\t// NB these aren't normal functions - they aren't looking for an array of args\n\treturn lisp.Fun(GenSymbol(), lisp.Formals(), func(env *lisp.LEnv, input *lisp.LVal) *lisp.LVal {\n\t\tif input.Str != lisp.FalseSymbol {\n\t\t\treturn lisp.ErrorConditionf(FailedConstraint, \"Value %v is not false\", input)\n\t\t}\n\t\treturn lisp.Nil()\n\t})\n}", "title": "" }, { "docid": "71e560fcd28fb9b360671016a8272f54", "score": "0.45950383", "text": "func GetBool(ctx *pulumi.Context, key string) bool {\n\treturn getBool(ctx, key, \"GetSecretBool\", \"GetBool\")\n}", "title": "" }, { "docid": "c479a485c4adad5dfb6c1e46854c5258", "score": "0.45904452", "text": "func False() *VBoolean {\n\treturn New(false)\n}", "title": "" }, { "docid": "65abbda3c00b63f91129e07f1d0f942b", "score": "0.45866916", "text": "func GetBoolP(s bool) *bool {\n\tp := s\n\treturn &p\n}", "title": "" }, { "docid": "20dfdc02eb4408ab2e8b0602c11cda82", "score": "0.45724025", "text": "func (client PathsClient) GetBooleanTrueResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "b81dbfe6c837015d42dc1e12f6e71277", "score": "0.45592618", "text": "func GetBoolP(key string) bool {\n\tv, err := GetBoolE(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "48af399d832c60dbe7e45c563133e771", "score": "0.45531255", "text": "func False(v bool) bool {\n\tif v {\n\t\tpanic(\"got true\")\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5452fe19bd8dccb4bbec2f6456855265", "score": "0.45518416", "text": "func (baseService *BaseController) GetCtxBool(ctx *fasthttp.RequestCtx, key string) bool {\n\tstr := string(ctx.QueryArgs().Peek(key))\n\tif str == \"1\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "159299bc1f7621d27ac0787e091c3bb3", "score": "0.45449308", "text": "func (client ImplicitClient) GetRequiredGlobalQueryPreparer() (*http.Request, error) {\n queryParameters := map[string]interface{} {\n \"required-global-query\": autorest.Encode(\"query\",client.RequiredGlobalQuery),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsGet(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/reqopt/global/required/query\"),\n autorest.WithQueryParameters(queryParameters))\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "d30bedf0deab4b705e0bb323345a87d5", "score": "0.45441592", "text": "func BoolNotFalse(value bool, errorType util.ErrorType, message string) Rule {\n\treturn BoolTrue(value, errorType, message)\n}", "title": "" }, { "docid": "4ef0c16f84e41332987caa101c473ede", "score": "0.45347923", "text": "func GetBoolean(key string) bool {\n\treturn defaultConfig.GetBoolean(key)\n}", "title": "" }, { "docid": "cc1c054a422a8282d2e488b6e2a6a3dd", "score": "0.45345512", "text": "func (t *RPCGet) ConvertToBool(w http.ResponseWriter, r *http.Request) {\n\tt.Log.Handle(w, r, nil, \"begin\", \"RPCGet\", \"ConvertToBool\")\n\tvar getArg1 bool\n\t{\n\t\tinput := struct {\n\t\t\tgetArg1 bool\n\t\t}{}\n\t\tdecErr := json.NewDecoder(r.Body).Decode(&input)\n\n\t\tif decErr != nil {\n\n\t\t\tt.Log.Handle(w, r, decErr, \"json\", \"decode\", \"input\", \"error\", \"RPCGet\", \"ConvertToBool\")\n\t\t\thttp.Error(w, decErr.Error(), http.StatusInternalServerError)\n\n\t\t\treturn\n\t\t}\n\n\t\tgetArg1 = input.getArg1\n\t}\n\n\tt.embed.ConvertToBool(getArg1)\n\n\tw.WriteHeader(200)\n\n\tt.Log.Handle(w, r, nil, \"end\", \"RPCGet\", \"ConvertToBool\")\n\n}", "title": "" }, { "docid": "f503967863ee6f11767812371ceaa132", "score": "0.4531935", "text": "func getPassthroughBool(titusInfo *titus.ContainerInfo, key string) (bool, bool, error) {\n\tvalue, ok := titusInfo.GetPassthroughAttributes()[key]\n\n\tif !ok {\n\t\treturn false, false, nil\n\t}\n\tval, err := strconv.ParseBool(value)\n\tif err != nil {\n\t\treturn false, true, err\n\t}\n\n\treturn val, true, nil\n}", "title": "" }, { "docid": "41b9e97368bbe421d67e18f17cc78d24", "score": "0.45317706", "text": "func (n *Node) ParamGetBool(key string) (bool, error) {\n\treturn n.apiParamClient.GetParamBool(key)\n}", "title": "" }, { "docid": "d59505750d683e55abdf18965504627b", "score": "0.45151258", "text": "func (validator *ValidatorBoolP[T]) Not() *ValidatorBoolP[T] {\n\tvalidator.context.Not()\n\n\treturn validator\n}", "title": "" }, { "docid": "a75f9fa3775ecbeb2d3d23c3238461b4", "score": "0.44940707", "text": "func (c *Config) DefBool(key string, def bool) bool {\n\tif value, ok := c.Bool(key); ok {\n\t\treturn value\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "fea658b86643382af041335e8d1be135", "score": "0.44920227", "text": "func False(t testing.TB, value bool) bool {\n\treturn Equal(Tracing(t), value, false)\n}", "title": "" }, { "docid": "d364f56a5e2832956bf70f2e4ee99709", "score": "0.44869438", "text": "func GetBool(key string) bool { return owl.GetBool(key) }", "title": "" }, { "docid": "61af623c6ebba7a32b26a1a1e7a3e875", "score": "0.44861382", "text": "func DecodeBoolean(d Decoder, x interface{}) (interface{}, error) {\n\ts := x.(string)\n\tif s == \"t\" {\n\t\treturn true, nil\n\t} else if s == \"f\" {\n\t\treturn false, nil\n\t} else {\n\t\treturn nil, &TransitError{Message: \"Unknown boolean value.\"}\n\t}\n}", "title": "" }, { "docid": "fe8f2b012845fb20779f76253c7ada68", "score": "0.44836786", "text": "func (b *Bool) SetFalse() {\n\tb.Lock()\n\tdefer b.Unlock()\n\tb.v = false\n}", "title": "" }, { "docid": "674e1610f71a6059857440f25be9a800", "score": "0.44759536", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\r\n\treturn graphql.UnmarshalBoolean(v)\r\n}", "title": "" }, { "docid": "f048a2db1dc455041f378b52bc443f66", "score": "0.44737026", "text": "func QueryBool(r *http.Request, param string) bool {\n\treturn converter.StringToBool(r.URL.Query().Get(param))\n}", "title": "" }, { "docid": "2b0d18f8fd14c257fed387157c2fcc42", "score": "0.4471629", "text": "func (t TermBuilder) IsFalse() bool { return t.isLitFalse }", "title": "" }, { "docid": "b8f6c0b43acce350b64ff079c4786c38", "score": "0.44686717", "text": "func GetBool(key string, defaultValue bool) (value bool) {\n\n\tenvVal := GetEnv(TransformKey(key), \"\")\n\tif envVal != \"\" {\n\t\treturn cast.ToBool(envVal)\n\t}\n\n\tif !viper.IsSet(key) {\n\t\treturn defaultValue\n\t}\n\treturn viper.GetBool(key)\n}", "title": "" }, { "docid": "8277dfef71e36b8f68b27f3f5212e1b1", "score": "0.44662976", "text": "func getBool(value bool) *bool {\n\taux := value\n\treturn &aux\n}", "title": "" }, { "docid": "47fb4845a2f61794b72f5b869c8b8bd9", "score": "0.4463445", "text": "func (n Boolean) Get() interface{} {\n\treturn n\n}", "title": "" }, { "docid": "55d8881b0d5294146dbb9b606ac3943d", "score": "0.44628242", "text": "func GetBool(key string, def bool) bool {\n\ts, ok := os.LookupEnv(key)\n\tif !ok {\n\t\treturn def\n\t}\n\n\tif s == \"\" || s == \"1\" || s == \"true\" {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1389ef38052bb0f3928d07561b274f07", "score": "0.44618315", "text": "func GetSecretBool(ctx *pulumi.Context, key string) pulumi.BoolOutput {\n\treturn pulumi.ToSecret(getBool(ctx, key, \"\", \"\")).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "f0fc24f30539fdf65e801aefb012f1e0", "score": "0.44612506", "text": "func (s *Statement) False() *Statement {\n\tt := token{\n\t\tcontent: \"false\",\n\t\ttyp: keywordToken,\n\t}\n\t*s = append(*s, t)\n\treturn s\n}", "title": "" }, { "docid": "90cbc679f1f427e364d628836b6f06e9", "score": "0.44592613", "text": "func (t *T) False(cond bool) {\n\tif cond {\n\t\tt.context.incFailCount()\n\t\tt.context.log(t.decorate(\"Expression was not false\"))\n\t\tt.test.Fail()\n\t}\n}", "title": "" }, { "docid": "1b0e5ca7a56947c330522b9face28d22", "score": "0.4452402", "text": "func (client PathsClient) GetBooleanTrueSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "ca7196636c4895be875ce264d8450500", "score": "0.4452392", "text": "func (scope *Scope) GetBool(name string, defaul ...bool) bool {\n\tvalue, ok := scope.db.Get(name)\n\tif ok {\n\t\treturn value.(bool)\n\t}\n\tfor _, defaul := range defaul {\n\t\treturn defaul\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a764d7eb241234849a9de3928f28f7b8", "score": "0.44402373", "text": "func BoolP(v bool) *bool {\n\treturn &v\n}", "title": "" }, { "docid": "77b3bfe0fef32971b8db4c8b684b68e6", "score": "0.44388616", "text": "func getCRWCRInstanceBoolean(value *bool) bool {\n\tnewVal := value\n\tif newVal == nil {\n\t\tdefaultVal := false\n\t\tnewVal = &defaultVal\n\t}\n\treturn *newVal\n}", "title": "" }, { "docid": "43099dccfad15eedab33443b3f93bfe9", "score": "0.44312686", "text": "func (client BoolClient) GetTrueResponder(resp *http.Response) (result BoolModel, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "5174d2db878cea3f2eae2aa820e34595", "score": "0.44287908", "text": "func guardBoolNegProxy(p string) bool {\n\treturn !guardBool(p)\n}", "title": "" }, { "docid": "38e6410320263217706b41500f6e6125", "score": "0.44226864", "text": "func guardBoolNegProxyToNil(p string) *retStruct {\n\tif !guardBool(p) {\n\t\treturn &retStruct{\"good\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f5259239ab90df44efc39641f4cb80de", "score": "0.44193125", "text": "func False(t *testing.T, got bool) {\n\tet.ExpectInner(t, \"\", &et.False{got}, 2)\n}", "title": "" }, { "docid": "0fe01da984d2e8f43685714de7d23ade", "score": "0.4417049", "text": "func (i *Inp) GetBool(out *bool) {\n\ti.readUnsafe(out)\n}", "title": "" }, { "docid": "db0ed1804a5b8b279d3c7d07f2cd2a1a", "score": "0.44135654", "text": "func (e *Engine) False() *Value {\n\treturn e.newValue(lua.LFalse)\n}", "title": "" }, { "docid": "b4a0d3a0a0c000f5423df27620ffba9e", "score": "0.44102937", "text": "func (client DateClient) GetNullPreparer(ctx context.Context) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/date/null\"))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "a927d882415b15b71f064b607d6790d4", "score": "0.4409607", "text": "func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {\n\treturn graphql.UnmarshalBoolean(v)\n}", "title": "" }, { "docid": "383419a5d6de2c770fab438dfb3a2436", "score": "0.44052908", "text": "func DerefBool(b *bool) bool {\n\tif b != nil {\n\t\treturn *b\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4da6a97635707ef7ead04d459cae3cc6", "score": "0.44050437", "text": "func (c *Config) GetBoolean(name string, defaultValue bool) bool {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\tif result, ok := c.Parameters[name]; ok {\n\t\treturn toolbox.AsBoolean(result)\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "bd476a1a9fcd5b2b0846239ffc48782f", "score": "0.44004455", "text": "func NewBool(b bool) *bool { return &b }", "title": "" }, { "docid": "bd476a1a9fcd5b2b0846239ffc48782f", "score": "0.44004455", "text": "func NewBool(b bool) *bool { return &b }", "title": "" }, { "docid": "bd476a1a9fcd5b2b0846239ffc48782f", "score": "0.44004455", "text": "func NewBool(b bool) *bool { return &b }", "title": "" }, { "docid": "5fcdd576fd32a4507ba7b9dd2e8d6515", "score": "0.43991303", "text": "func (m *EducationAssignment) GetAllowLateSubmissions()(*bool) {\n val, err := m.GetBackingStore().Get(\"allowLateSubmissions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "55a1a9c299b862623c1980a5afa15de8", "score": "0.4395406", "text": "func (cfg ConfigurationObject) GetBoolean(key string) bool {\n\treturn cfg.GetBooleanWithDefaultValue(key, false)\n}", "title": "" }, { "docid": "aa382f250cce4c5f899c15d07159b2e4", "score": "0.4389366", "text": "func boolRef(b bool) *bool {\n\treturn &b\n}", "title": "" }, { "docid": "2c16b367cb397c2531fd39347b6e8885", "score": "0.43885615", "text": "func (b Bool) GetBool(Runtime) (Bool, error) {\n\treturn b, nil\n}", "title": "" } ]
367545ccae81db2e0f0b3ff21f83c4f5
RemovedEdges returns all edge names that were removed in this mutation.
[ { "docid": "fb3e3809fbb82138ed02e0e1ef6998f8", "score": "0.81371266", "text": "func (m *AreaMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstatistic != nil {\n\t\tedges = append(edges, area.EdgeStatistic)\n\t}\n\treturn edges\n}", "title": "" } ]
[ { "docid": "ae2c1c2e223badb1f888a7752cf6331f", "score": "0.837938", "text": "func (m *WalletNodeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "c1b6f9a1e0398d45eec5c5663fc412e7", "score": "0.8370107", "text": "func (m *UkmMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedprofiles != nil {\n\t\tedges = append(edges, ukm.EdgeProfiles)\n\t}\n\tif m.removedannouncement != nil {\n\t\tedges = append(edges, ukm.EdgeAnnouncement)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "2da9e68f64f6c9842efd24d728119f7a", "score": "0.83534104", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstatistic != nil {\n\t\tedges = append(edges, patient.EdgeStatistic)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "cace767161694651455b9f03c05c03ee", "score": "0.83407086", "text": "func (m *VisitMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "d55f21ec52d24334eba97e9dc91e60c7", "score": "0.83263737", "text": "func (m *EmployeeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstatistic != nil {\n\t\tedges = append(edges, employee.EdgeStatistic)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "3bb37dacdee30c3f8ee0d88648c3eddc", "score": "0.8323648", "text": "func (m *CarrierMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstatistic != nil {\n\t\tedges = append(edges, carrier.EdgeStatistic)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c7425b1a4ee1be33d95198c93880e539", "score": "0.83092314", "text": "func (m *GroceryListMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedmembers != nil {\n\t\tedges = append(edges, grocerylist.EdgeMembers)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "f7e3e6305b974d4cf1397180e5e97b05", "score": "0.83034223", "text": "func (m *ProfileMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedowner != nil {\n\t\tedges = append(edges, profile.EdgeOwner)\n\t}\n\tif m.removedukms != nil {\n\t\tedges = append(edges, profile.EdgeUkms)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "12cd1a263a6cb9c0a028926fa5a8428d", "score": "0.8301821", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedmachines != nil {\n\t\tedges = append(edges, user.EdgeMachines)\n\t}\n\tif m.removedkeys != nil {\n\t\tedges = append(edges, user.EdgeKeys)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c603f0c0469086a620f1bab2a34beabd", "score": "0.83013", "text": "func (m *MachineMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedips != nil {\n\t\tedges = append(edges, machine.EdgeIps)\n\t}\n\tif m.removedusers != nil {\n\t\tedges = append(edges, machine.EdgeUsers)\n\t}\n\tif m.removedkeys != nil {\n\t\tedges = append(edges, machine.EdgeKeys)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "bee6e95844b50ccff9f55e5bc0718188", "score": "0.82856643", "text": "func (m *ReviewMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "3adfa8583b3cfa5a538146d2faac3bd0", "score": "0.82847345", "text": "func (m *StatisticMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\treturn edges\n}", "title": "" }, { "docid": "11eaa14f22682e771cc527749aab9206", "score": "0.82738286", "text": "func (m *RatingMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "39d28db41d74b299fcc9078e04803586", "score": "0.82726747", "text": "func (m *RoleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedaccess != nil {\n\t\tedges = append(edges, role.EdgeAccess)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d322276dde6c51674aeddc88eb509101", "score": "0.8272122", "text": "func (m *AntenatalMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "1453b0ddddb344bfade9e5f51845c3e9", "score": "0.8270938", "text": "func (m *ModelsMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "5be9b710a7d33c4866ce2f38e81710cf", "score": "0.82677543", "text": "func (m *RawEventMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "5c5d48da35f9cbd8ab5b1cb4ef88d76b", "score": "0.82654405", "text": "func (m *ContagiousMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstatistic != nil {\n\t\tedges = append(edges, contagious.EdgeStatistic)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "a5f7edd312304d6d2599b3ec644505f4", "score": "0.82652795", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removeddepts != nil {\n\t\tedges = append(edges, user.EdgeDepts)\n\t}\n\tif m.removedproperties_in_dept != nil {\n\t\tedges = append(edges, user.EdgePropertiesInDept)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "7cc84fa31500fe11db797c5462b9adc5", "score": "0.8262698", "text": "func (m *IPMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "a07795e7f711eba7ea83912d88b12e19", "score": "0.8260069", "text": "func (m *IPMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedqueries != nil {\n\t\tedges = append(edges, ip.EdgeQueries)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "71af8499eef5cc6ed4ec6a6a5bb3d9b6", "score": "0.8249117", "text": "func (m *DUserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "3db8c68d35b9c0ef3d8cbfd20f21dd05", "score": "0.8247793", "text": "func (m *WalletMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedaccounts != nil {\n\t\tedges = append(edges, wallet.EdgeAccounts)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "16f199e06c638fab9e5dd415d68fc1b5", "score": "0.82468724", "text": "func (m *RestaurantMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\tif m.removedtags != nil {\n\t\tedges = append(edges, restaurant.EdgeTags)\n\t}\n\tif m.removedowner != nil {\n\t\tedges = append(edges, restaurant.EdgeOwner)\n\t}\n\tif m.removedproducts != nil {\n\t\tedges = append(edges, restaurant.EdgeProducts)\n\t}\n\tif m.removedimages != nil {\n\t\tedges = append(edges, restaurant.EdgeImages)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "3699770a48abf2e0b49551b9f322cc06", "score": "0.82443935", "text": "func (m *SummaryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "594e489aaa14726d5cac9917a7d6e3ba", "score": "0.8240396", "text": "func (m *UserOpInfoMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "aed49e24287819e6c452849a03d7548f", "score": "0.82383895", "text": "func (m *KeyMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "ab0b54d4fbfcf23a4258164b9ef0f21a", "score": "0.82381016", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "24b106db3bc85694cec708b07008ea31", "score": "0.8236892", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "4ad21156d627b538c3e5705e33f0097e", "score": "0.8234577", "text": "func (m *DSessionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "87d040e127c4c22fb11bea6b9ca759c5", "score": "0.8229927", "text": "func (m *DRoomMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "b1362b3cf291cd6c06ffd1181b018ae2", "score": "0.82255596", "text": "func (m *DChatMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "53d8b5459afea5fdd4795490d7d60d73", "score": "0.821728", "text": "func (m *TransactionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedreview != nil {\n\t\tedges = append(edges, transaction.EdgeReview)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "69b34ffa44b687c52432b07f4eb65218", "score": "0.8216246", "text": "func (m *UsersMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "1fd848b74e743f05150f61b4db3a6b90", "score": "0.8216089", "text": "func (m *GroupsMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedusers != nil {\n\t\tedges = append(edges, groups.EdgeUsers)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "9ddfcfcf739dcde964f9eb40ae7f9d3c", "score": "0.8209675", "text": "func (m *OperationMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "fb97bf76a096981a5cff0c82796234ac", "score": "0.8207667", "text": "func (m *JobMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedvisits != nil {\n\t\tedges = append(edges, job.EdgeVisits)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "f3c500812ea3bbea1c5bc67b3301f61d", "score": "0.8204509", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedpatient_diagnose != nil {\n\t\tedges = append(edges, patient.EdgePatientDiagnose)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "1a7d0d5a148d6fcd57999f4b5171b974", "score": "0.81954205", "text": "func (m *RoleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedrole != nil {\n\t\tedges = append(edges, role.EdgeRole)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "6d905822f94df55f6d39e04f4618c856", "score": "0.81942225", "text": "func (m *EatinghistoryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "0289b584f5b1929236d4d82ef94f9748", "score": "0.8192916", "text": "func (m *GroupBandwidthMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedgroups != nil {\n\t\tedges = append(edges, groupbandwidth.EdgeGroups)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "2b23019a5a1881055a8fd9f6cb52c728", "score": "0.8190036", "text": "func (m *MealplanMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedeatinghistory != nil {\n\t\tedges = append(edges, mealplan.EdgeEatinghistory)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "570498fd7c2f6f01a6a2c53bd8cfa108", "score": "0.8190016", "text": "func (m *PhysicianMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedforuser != nil {\n\t\tedges = append(edges, physician.EdgeForuser)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "eb9e092efb65222bdb3f0eb06cec68da", "score": "0.8185941", "text": "func (m *KeyStoreMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "122cd87d800a246a07de551fe21ef5bf", "score": "0.81806564", "text": "func (m *ResearchMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "4f3bacecb99b87353fc8a22e042c69b1", "score": "0.81759375", "text": "func (m *FoodmenuMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedeatinghistory != nil {\n\t\tedges = append(edges, foodmenu.EdgeEatinghistory)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "81be85c0ff02cc9fbc0114c7a0a82b79", "score": "0.8175702", "text": "func (m *DiagnoseMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\treturn edges\n}", "title": "" }, { "docid": "eff53dd11dad5096f18f92890fac7ec3", "score": "0.8173875", "text": "func (m *StatusMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedstatus != nil {\n\t\tedges = append(edges, status.EdgeStatus)\n\t}\n\tif m.removedstatusofbook != nil {\n\t\tedges = append(edges, status.EdgeStatusofbook)\n\t}\n\tif m.removedstatusbookborrow != nil {\n\t\tedges = append(edges, status.EdgeStatusbookborrow)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "e21196b426d5cbae2672051ad1c0acb9", "score": "0.8166882", "text": "func (m *PatientMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removed_SETMOM != nil {\n\t\tedges = append(edges, patient.EdgeSETMOM)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "656a44cd98da5193056aa048c8dce296", "score": "0.8161039", "text": "func (m *OrganMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedforogan != nil {\n\t\tedges = append(edges, organ.EdgeForogan)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "d99f76c165c8094d49d24101a3b42fb5", "score": "0.8159768", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedgrocerylist != nil {\n\t\tedges = append(edges, user.EdgeGrocerylist)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "73dc78a96fd4f22a634899379b7e1e13", "score": "0.8155353", "text": "func (m *TagMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedproduct != nil {\n\t\tedges = append(edges, tag.EdgeProduct)\n\t}\n\tif m.removedrestaurant != nil {\n\t\tedges = append(edges, tag.EdgeRestaurant)\n\t}\n\tif m.removedimages != nil {\n\t\tedges = append(edges, tag.EdgeImages)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "630cd01a52542470296e97b5d0c4f79c", "score": "0.81553304", "text": "func (m *FixMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\treturn edges\n}", "title": "" }, { "docid": "6fd82d6ce2980783f105a88890d0d654", "score": "0.8153838", "text": "func (m *ValidMessageMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "062d68c43c8ee7f502e66a41f9e317d9", "score": "0.81538314", "text": "func (m *PortalMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "4d70dac0c3b192144cea0dfb6eca4b59", "score": "0.81538033", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedjobs != nil {\n\t\tedges = append(edges, user.EdgeJobs)\n\t}\n\tif m.removedexperiences != nil {\n\t\tedges = append(edges, user.EdgeExperiences)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "e84634f2d78f99b6fd826edcbce6948d", "score": "0.8152213", "text": "func (m *DeptMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\tif m.removedusers != nil {\n\t\tedges = append(edges, dept.EdgeUsers)\n\t}\n\tif m.removeduser_properties_in_dept != nil {\n\t\tedges = append(edges, dept.EdgeUserPropertiesInDept)\n\t}\n\tif m.removedsub_depts != nil {\n\t\tedges = append(edges, dept.EdgeSubDepts)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "b1e57d89e1ec39d5cef1af7949ac0ae9", "score": "0.81511116", "text": "func (m *UserLogMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "47027f28381bd413bfba90e27914cda0", "score": "0.8148209", "text": "func (m *OnlineSessionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "e92c333ca784633edc15296da46e5880", "score": "0.81477326", "text": "func (m *RoominfoMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedpreemption != nil {\n\t\tedges = append(edges, roominfo.EdgePreemption)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "5d4d0cbf3812c896feda48c513361c46", "score": "0.814624", "text": "func (m *GenderMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedpersonal != nil {\n\t\tedges = append(edges, gender.EdgePersonal)\n\t}\n\tif m.removedcustomer != nil {\n\t\tedges = append(edges, gender.EdgeCustomer)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c38667baaa5b069395b1a6d0ab5c21e8", "score": "0.8145472", "text": "func (m *SymptomsMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedsymptoms_diagnose != nil {\n\t\tedges = append(edges, symptoms.EdgeSymptomsDiagnose)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "ecca05a7a4c139caaacf345605ed1766", "score": "0.8141814", "text": "func (m *EmptyMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "bb2fc0345db29d43b76a3c4df6355904", "score": "0.8141132", "text": "func (m *DNSBLQueryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedresponses != nil {\n\t\tedges = append(edges, dnsblquery.EdgeResponses)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "2d014b072cc56f44e6d59895533f76a3", "score": "0.8139012", "text": "func (m *UserIDMappingMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "a6f6173e521b517ffa44986ba352daf8", "score": "0.8136604", "text": "func (m *BlockMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "269c66414091ed53ae6d29ab670a9e8c", "score": "0.8132294", "text": "func (m *MessageWithEnumMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "054770cbb22fef2818883c716b09bf4f", "score": "0.8128183", "text": "func (m *RestaurantOwnerMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "b8fcb4d991523b7768ea0ff6f49b72e2", "score": "0.8123409", "text": "func (m *MessageWithIDMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "7a560ce93fbe05bdfd2a14604c15aadc", "score": "0.81155264", "text": "func (m *UserPropertyInDeptMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\treturn edges\n}", "title": "" }, { "docid": "26376ab4dc2c197b2d4a5a5c7c582dec", "score": "0.8114607", "text": "func (m *TasteMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedeatinghistory != nil {\n\t\tedges = append(edges, taste.EdgeEatinghistory)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "419e271217d58bd27cfd401b5f049ab6", "score": "0.8113405", "text": "func (m *AccountMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedblocks != nil {\n\t\tedges = append(edges, account.EdgeBlocks)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "c9f6f93eab7d60dc6276eddf7a735ee6", "score": "0.8113068", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 7)\n\tif m.removedbooking != nil {\n\t\tedges = append(edges, user.EdgeBooking)\n\t}\n\tif m.removedaddby != nil {\n\t\tedges = append(edges, user.EdgeAddby)\n\t}\n\tif m.removedborrow != nil {\n\t\tedges = append(edges, user.EdgeBorrow)\n\t}\n\tif m.removedpreemption != nil {\n\t\tedges = append(edges, user.EdgePreemption)\n\t}\n\tif m.removedrecord != nil {\n\t\tedges = append(edges, user.EdgeRecord)\n\t}\n\tif m.removed_return != nil {\n\t\tedges = append(edges, user.EdgeReturn)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "5e58240dfc6a3dc175d0e0277460104f", "score": "0.81126595", "text": "func (m *UserOaInfoMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "0cceb99b3f563ca3ae9cc0aa92a51cf5", "score": "0.81110513", "text": "func (m *SpacialityMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "6644bb6fbcf58b73a08f93c3f21918e4", "score": "0.81092703", "text": "func (m *DoctorMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removeddoctor_diagnose != nil {\n\t\tedges = append(edges, doctor.EdgeDoctorDiagnose)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "39ad7b0474be92520a6fa8885078449a", "score": "0.81070334", "text": "func (m *SkillMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedexperiences != nil {\n\t\tedges = append(edges, skill.EdgeExperiences)\n\t}\n\tif m.removedjobs != nil {\n\t\tedges = append(edges, skill.EdgeJobs)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "84c5cbbfe8977a3a601a80ef34cb0d51", "score": "0.81032467", "text": "func (m *BankingDataMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "7d4eb68c2d9205031ef0ec3486e0729b", "score": "0.8102438", "text": "func (m *ArticleMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "4cb0eba1077b88840ded5c128ad69e9f", "score": "0.80992097", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removed_CARE != nil {\n\t\tedges = append(edges, user.EdgeCARE)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "87057c570ad2e600c9748a162a93d947", "score": "0.8097727", "text": "func (m *AddressMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "f17fd8ac32dcf343f3bbe9e56c1f0de2", "score": "0.8095141", "text": "func (m *BookingMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "a63a104fc02db53c35c09fd6a9ddec31", "score": "0.80946714", "text": "func (m *DealMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "3bfb3d466ffcf54c09b4224ee90009cd", "score": "0.80923283", "text": "func (m *ReceiptMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 5)\n\treturn edges\n}", "title": "" }, { "docid": "2d1f7d6f240a633671244b6a104bbfec", "score": "0.8090711", "text": "func (m *AnnouncementMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\treturn edges\n}", "title": "" }, { "docid": "2a9819294bd0a0762ed77828f7274035", "score": "0.80839837", "text": "func (m *UserMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\tif m.removedmealplan != nil {\n\t\tedges = append(edges, user.EdgeMealplan)\n\t}\n\tif m.removedfoodmenu != nil {\n\t\tedges = append(edges, user.EdgeFoodmenu)\n\t}\n\tif m.removedeatinghistory != nil {\n\t\tedges = append(edges, user.EdgeEatinghistory)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "152114f029e8496fb4d7c4ccb8d3a50b", "score": "0.8079645", "text": "func (m *DChessdbCacheMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "3aac9bea17519c978dd3cd8005c5b2dd", "score": "0.8077606", "text": "func (m *ClientEntityMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedbooked != nil {\n\t\tedges = append(edges, cliententity.EdgeBooked)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "32ee07c53e57b1617f5af5d4ffb9dcf3", "score": "0.8072123", "text": "func (m *DuplicateNumberMessageMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "11ca3b79ddb885b2bde47f27e52556ae", "score": "0.8068208", "text": "func (m *ImplicitSkippedMessageMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "8f32425a5946a69be5dde06b980b561e", "score": "0.8063905", "text": "func (m *PreemptionMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "e8091ae47e599db58b988a12c97dc23f", "score": "0.8063543", "text": "func (m *ResearchtypeMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedresearchType != nil {\n\t\tedges = append(edges, researchtype.EdgeResearchType)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "a15ce4c24a219db27fd7f4c736ed699c", "score": "0.806351", "text": "func (m *BookreturnMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "3fb669463e597cf38f9e8fb6b4ad1664", "score": "0.80621016", "text": "func (m *MessageWithPackageNameMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "9b92bacb9da99dde9f23313585175cff", "score": "0.80543697", "text": "func (m *ProfileUKMMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 3)\n\treturn edges\n}", "title": "" }, { "docid": "2dc7dcbf9aaeb07548825810ae8b31a3", "score": "0.80471087", "text": "func (m *CompanyMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedstaffs != nil {\n\t\tedges = append(edges, company.EdgeStaffs)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "da20dc1d9279ea8435a0221d4eb12c41", "score": "0.8041369", "text": "func (m *ExplicitSkippedMessageMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 0)\n\treturn edges\n}", "title": "" }, { "docid": "bee069fcc38aa055e2819d9bbeb4f505", "score": "0.8039893", "text": "func (m *CategoryMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 1)\n\tif m.removedcatof != nil {\n\t\tedges = append(edges, category.EdgeCatof)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "4c7e75a88787c4efcc904344123392f6", "score": "0.80388707", "text": "func (m *AuthorMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 2)\n\tif m.removedowner != nil {\n\t\tedges = append(edges, author.EdgeOwner)\n\t}\n\tif m.removedwriter != nil {\n\t\tedges = append(edges, author.EdgeWriter)\n\t}\n\treturn edges\n}", "title": "" }, { "docid": "9936c3865358ca30085880fdc8ab168a", "score": "0.80387205", "text": "func (m *AdminrepairMutation) RemovedEdges() []string {\n\tedges := make([]string, 0, 4)\n\tif m.removedreceipt != nil {\n\t\tedges = append(edges, adminrepair.EdgeReceipt)\n\t}\n\treturn edges\n}", "title": "" } ]
744f3f6eac72e3ba37d041b0c74836c7
GetByTitle returns all projects with titles containing the given query string
[ { "docid": "e7d175451944196a614357e2cb38840a", "score": "0.750742", "text": "func (ps *ProjectStore) GetByTitle(title string) ([]Project, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tfilter := bson.D{{\"title\", primitive.Regex{Pattern: \".*\" + title + \".*\", Options: \"\"}}}\n\tcursor, err := ps.collection.Find(ctx, filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojects, err := ps.extractProjectsFromCursor(ctx, cursor)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcursor.Close(ctx)\n\treturn projects, nil\n}", "title": "" } ]
[ { "docid": "3a23b68d6ff04a1ffe6b2a275c5d6ad6", "score": "0.61139935", "text": "func (th *TaskHandler) GetTaskByTitle(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tpID, err := strconv.Atoi(vars[\"projectID\"])\n\tif err != nil {\n\t\thelpers.Response(http.StatusInternalServerError, ServerError, w)\n\t\treturn\n\t}\n\ttitle := r.URL.Query().Get(\"title\")\n\tif title == \"\" {\n\t\thelpers.Response(http.StatusBadRequest, \"Invalid query parameter\", w)\n\t\treturn\n\t}\n\ttask, err := th.taskUC.GetTaskByTitle(title, uint64(pID))\n\tif err != nil {\n\t\thelpers.Response(http.StatusBadRequest, ResourceNotFound, w)\n\t\treturn\n\t}\n\thelpers.PayloadResponse(task, w)\n\treturn\n}", "title": "" }, { "docid": "0a18d02d77f1fd190a492cd1f2301585", "score": "0.5720025", "text": "func (ps *ProjectStore) GetFullSearch(title, category, order string) ([]Project, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tvar query bson.M\n\tif category != \"todos\" {\n\t\tquery = bson.M{\"$and\": bson.A{\n\t\t\tbson.M{\"title\": primitive.Regex{Pattern: \".*\" + title + \".*\", Options: \"\"}},\n\t\t\tbson.M{\"category\": category},\n\t\t}}\n\t} else {\n\t\tquery = bson.M{\"$and\": bson.A{\n\t\t\tbson.M{\"title\": primitive.Regex{Pattern: \".*\" + title + \".*\", Options: \"\"}},\n\t\t}}\n\t}\n\n\toptions := &options.FindOptions{}\n\tswitch order {\n\tcase \"popularity\":\n\t\toptions.SetSort(bson.M{\"votes_count\": -1})\n\tcase \"date\":\n\t\toptions.SetSort(bson.M{\"created_at\": 1})\n\tdefault:\n\t\toptions = nil\n\t}\n\n\tcursor, err := ps.collection.Find(ctx, query, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojects, err := ps.extractProjectsFromCursor(ctx, cursor)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcursor.Close(ctx)\n\treturn projects, nil\n}", "title": "" }, { "docid": "f8cacf7841ddbf81af8c36bee2b3329f", "score": "0.54912776", "text": "func (r *Repo) FindByTitle(name string) []Schema {\n\tvar movies []Schema\n\tre := regexp.MustCompile(\"(?i)\" + name)\n\n\tfor _, movie := range r.MovieList {\n\t\tif re.Match([]byte(movie.MovieName)) {\n\t\t\tmovies = append(movies, movie)\n\t\t}\n\t}\n\n\treturn movies\n}", "title": "" }, { "docid": "5f7f9ca91b7178eb6489c63de11fd857", "score": "0.5482732", "text": "func QueryProjectsByUsername(username string) ([]Project, error) {\n\tclient := pb.NewMongoDBClient(MongoGrpcClient)\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tstream, err := client.QueryProjects(ctx, &pb.Condition{\n\t\tValue: []*pb.Value{\n\t\t\t{Key: \"user\", Value: username},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar results []Project\n\tfor {\n\t\tfeature, err := stream.Recv()\n\t\tif err == io.EOF || feature == nil {\n\t\t\tbreak\n\t\t}\n\t\tresults = append(results, Project{\n\t\t\tID: feature.Id,\n\t\t\tUser: feature.User,\n\t\t\tTitle: feature.Title,\n\t\t\tScore: feature.Score,\n\t\t\tEquipment: feature.Equipment,\n\t\t\tMap: feature.Map,\n\t\t})\n\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "4d8c54e68a438bcf0f855fc284339254", "score": "0.5437175", "text": "func TitleContains(v string) predicate.CheckListItem {\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldTitle), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "c7c3b2cc606a1b2f0decedab953538e2", "score": "0.5387559", "text": "func findProjectByName(c *gin.Context) {\n\tqueryProject := &model.Project{\n\t\tName: c.Param(RProject),\n\t}\n\tif project, err := controllers.FindProjectByName(queryProject); err != nil {\n\t\t_ = c.AbortWithError(InternalError, err)\n\t} else {\n\t\tc.JSON(http.StatusOK, project)\n\t}\n}", "title": "" }, { "docid": "81c1fa80808e806e9962f07d96b4238e", "score": "0.5370221", "text": "func TitleContains(v string) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "27844be9a8b0f35538a19b839baeefeb", "score": "0.536143", "text": "func (qs PageQuerySet) TitleEq(title string) PageQuerySet {\n\treturn qs.w(qs.db.Where(\"title = ?\", title))\n}", "title": "" }, { "docid": "b9b52e0cfe1b315c2a15d29c1643763f", "score": "0.5303378", "text": "func (qs PageQuerySet) TitleIn(title string, titleRest ...string) PageQuerySet {\n\tiArgs := []interface{}{title}\n\tfor _, arg := range titleRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"title IN (?)\", iArgs))\n}", "title": "" }, { "docid": "35226982191094ee1cc85c433dfcdaaa", "score": "0.53018206", "text": "func TitleContains(v string) predicate.Metric {\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "6c06643a6e6b247d67334cd2c6983315", "score": "0.5238505", "text": "func (p *projects) GetByName(name string) (*model.Project, error) {\n\n\tprojects, err := p.store.List(projectNS)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, guid := range projects {\n\t\tprj, err := p.Get(guid)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif prj.Name == name {\n\t\t\treturn prj, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "42081b26ae3cf1d2117bd0edec57aa90", "score": "0.5232535", "text": "func FilterByProject(project string) Predicate {\n\treturn func(t Task) bool {\n\t\tfor _, p := range t.Projects {\n\t\t\tif strings.EqualFold(p, project) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "20f73c374162c6aa00f0f8165027bb2b", "score": "0.5211458", "text": "func (m MockedAlbumsService) GetByTitle(ctx context.Context, title string) (*albums.Album, error) {\n\treturn m.GetByTitleFn(ctx, title)\n}", "title": "" }, { "docid": "d61ed0b9267ae37dbfcc158ebd2d54b9", "score": "0.5207843", "text": "func Title(v string) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "207254d15ea30f7bb246ee3ccb705653", "score": "0.51721895", "text": "func (s *ProjectService) GetByName(projectName string) (*Project, error) {\n\tvar foundProject Project\n\tprojects, err := s.GetAll()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, project := range *projects {\n\t\tif project.Name == projectName {\n\t\t\treturn &project, nil\n\t\t}\n\t}\n\n\treturn &foundProject, fmt.Errorf(\"no project found with project name %s\", projectName)\n}", "title": "" }, { "docid": "a782d14aff0154dd1a4086d1b5f78374", "score": "0.5159028", "text": "func (r PhotosLibraryAlbumsRepository) GetByTitle(ctx context.Context, title string) (*Album, error) {\n\tErrAlbumWasFound := fmt.Errorf(\"album was found\")\n\tvar result *Album\n\tif err := r.service.List().ExcludeNonAppCreatedData().Pages(ctx, func(response *photoslibrary.ListAlbumsResponse) error {\n\t\tif album, found := r.findByTitle(title, response.Albums); found {\n\t\t\tresult = album\n\t\t\treturn ErrAlbumWasFound\n\t\t}\n\t\treturn nil\n\t}); err == ErrAlbumWasFound {\n\t\treturn result, nil\n\t}\n\treturn &NullAlbum, ErrAlbumNotFound\n}", "title": "" }, { "docid": "07db86d8227da15501fd96c096a8bc58", "score": "0.5148529", "text": "func (p *ProjectService) Search(ctx context.Context, opts *ProjectSearchOptionsScheme, startAt, maxResults int) (result *ProjectSearchScheme, response *Response, err error) {\n\n\tparams := url.Values{}\n\tparams.Add(\"startAt\", strconv.Itoa(startAt))\n\tparams.Add(\"maxResults\", strconv.Itoa(maxResults))\n\n\tif opts != nil {\n\n\t\tvar expand string\n\t\tfor index, value := range opts.Expand {\n\n\t\t\tif index == 0 {\n\t\t\t\texpand = value\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\texpand += \",\" + value\n\t\t}\n\n\t\tif len(expand) != 0 {\n\t\t\tparams.Add(\"expand\", expand)\n\t\t}\n\n\t\tif len(opts.OrderBy) != 0 {\n\t\t\tparams.Add(\"orderBy\", opts.OrderBy)\n\t\t}\n\n\t\tif len(opts.Query) != 0 {\n\t\t\tparams.Add(\"query\", opts.Query)\n\t\t}\n\n\t\tif len(opts.ProjectKeyType) != 0 {\n\t\t\tparams.Add(\"typeKey\", opts.ProjectKeyType)\n\t\t}\n\n\t\tif opts.CategoryID != 0 {\n\t\t\tparams.Add(\"categoryId\", strconv.Itoa(opts.CategoryID))\n\t\t}\n\n\t\tif len(opts.Action) != 0 {\n\t\t\tparams.Add(\"action\", opts.Action)\n\t\t}\n\t}\n\n\tvar endpoint = fmt.Sprintf(\"rest/api/3/project/search?%v\", params.Encode())\n\n\trequest, err := p.client.newRequest(ctx, http.MethodGet, endpoint, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\n\tresponse, err = p.client.Do(request)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresult = new(ProjectSearchScheme)\n\tif err = json.Unmarshal(response.BodyAsBytes, &result); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5c158c9a7db240210309a4b02d369856", "score": "0.51254135", "text": "func ProjectsSearchFunc() {\n\topt := &ProjectsSearchOption{\n\t\tAnalyzedBefore: \"\",\n\t\tOnProvisionedOnly: \"\",\n\t\tP: \"\",\n\t\tProjectIds: \"\",\n\t\tProjects: \"\",\n\t\tPs: \"\",\n\t\tQ: \"\",\n\t\tQualifiers: \"\",\n\t}\n\tv, resp, err := client.Projects.Search(opt)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(resp.StatusCode)\n\tspew.Dump(v)\n}", "title": "" }, { "docid": "220aa53d597374dac0a7fae592834943", "score": "0.5110608", "text": "func (f *VehicleClassFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(vehicleclass.FieldTitle))\n}", "title": "" }, { "docid": "5af1412d50c8d8324e4fde5d4227f3fd", "score": "0.51095647", "text": "func (c *Client) GetProjectBy(extProjectID string) (*ProjectResponse, error) {\n\terr := ValidateNotEmpty(extProjectID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := &ProjectResponse{}\n\tpath := fmt.Sprintf(\"/projects/%s\", extProjectID)\n\terr = c.requestAndParseResponse(\"GET\", path, nil, res)\n\treturn res, err\n}", "title": "" }, { "docid": "766c7ffd353a08afdc77e8afc04d53ee", "score": "0.5083747", "text": "func (f *VehicleMakeFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(vehiclemake.FieldTitle))\n}", "title": "" }, { "docid": "69043f08f120f7d732d66905386b06e4", "score": "0.50773823", "text": "func (a *ProjectApiService) GetProjectBySlug(ctx context.Context, projectSlug string) (Project, *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 Project\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/project/{project-slug}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project-slug\"+\"}\", fmt.Sprintf(\"%v\", projectSlug), -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 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[\"Circle-Token\"] = key\n\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\n\t\t\tlocalVarQueryParams.Add(\"circle-token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v Project\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\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "4426683e91e3509a78427e5cfb34e146", "score": "0.5048443", "text": "func (d *DatabaseProvider) GetByName(projectname string) (entity.Project, error) {\n\tvar project entity.Project\n\terr := d.SharedProvider.GetFirstBy(\"Name\", \"==\", projectname, &project)\n\tif err != nil {\n\t\treturn entity.Project{}, fmt.Errorf(\"%s: %w\", err, ErrProjectNotFound)\n\t}\n\n\treturn project, nil\n}", "title": "" }, { "docid": "20dbcb2d4476b562dd7e378b045fc312", "score": "0.50410753", "text": "func (qs ArticleQuerySet) TitleEq(title string) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"title = ?\", title))\n}", "title": "" }, { "docid": "16bd441066701fc4ef5daf0cff4cf346", "score": "0.50291574", "text": "func getProjectsFromApplicationQuery(q application.ApplicationQuery) []string {\n\tif q.Project != nil {\n\t\treturn q.Project\n\t}\n\treturn q.Projects\n}", "title": "" }, { "docid": "fe8c3b2109ffadb77133aa0f1a82856a", "score": "0.5024143", "text": "func getdatabytitle(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tsearchtitle := vars[\"searchtitle\"]\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\n\tsession, err := mgo.Dial(mongodbHostName+\":\"+mongodbPort)\n\tif err != nil {\n\t panic(err)\n\t}\n\tdefer session.Close()\n\tcollection := session.DB(mongodbDatabaseName).C(mongodbCollectionName)\n\n\terr = collection.Find(bson.M{\"title\" : bson.M{\"$regex\":searchtitle}}).All(&regexResult)\n\tif err != nil {\n\t\tsearchNotFoundText := \"search Id not found\"\n\t\tjsonResult, _ := json.Marshal(searchNotFoundText)\n\t\tw.Write(jsonResult)\n\t\tio.WriteString(w, \"\\n\")\n\t} else {\n\t\tjsonResult, _ := json.Marshal(regexResult)\n\t\tw.Write(jsonResult)\n\t\tio.WriteString(w, \",\\n\")\n\t}\n}", "title": "" }, { "docid": "d6ed77e3a265a61988d06cebcc26f0b3", "score": "0.49983788", "text": "func (f *RaceFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(race.FieldTitle))\n}", "title": "" }, { "docid": "896888117593d6692a4aa7b822e7fb74", "score": "0.49820897", "text": "func (f *VehicleModelFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(vehiclemodel.FieldTitle))\n}", "title": "" }, { "docid": "f17f8d4e4c5139b88c53d343c3a73f41", "score": "0.49659872", "text": "func (lib *Library) QueryBookTitle(keyTitle string) ([]Books, error) {\n\trows, err := lib.db.Query(`SELECT `+AllBookArgs+\n\t\t` FROM Booklist WHERE title LIKE ? \n\t\tORDER BY LENGTH(title) ASC, title ASC;`,\n\t\t\"%\"+keyTitle+\"%\")\n\tif err != nil {\n\t\tlog.Println(\"Exec error: \", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tBookList := []Books{}\n\tvar res Books\n\tfor rows.Next() {\n\t\tres, err = lib.BooksRowsScan(rows)\n\t\tif err != nil {\n\t\t\tlog.Println(\"rows.scan error: \", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tBookList = append(BookList, res)\n\t}\n\n\treturn BookList, nil\n}", "title": "" }, { "docid": "eab6c39318f4cf74602543fc4b220a20", "score": "0.49606565", "text": "func (p *Projects) SearchProject(c echo.Context) error {\n\tps := new(projectSearch)\n\tif err := c.Bind(&ps); err != nil {\n\t\treturn c.String(http.StatusBadRequest, \"Can't bind request body\")\n\t}\n\n\tvar projects []models.Project\n\tvar err error\n\n\tswitch ps.SearchType {\n\tcase \"title\":\n\t\tprojects, err = p.projectStore.GetByTitle(ps.Title)\n\n\tcase \"category\":\n\t\tprojects, err = p.projectStore.GetByCategory(ps.Category)\n\n\tcase \"tags\":\n\t\ttags := strings.Fields(ps.Tags)\n\t\tprojects, err = p.projectStore.GetByTags(tags)\n\n\tcase \"full\":\n\t\tprojects, err = p.projectStore.GetFullSearch(ps.Title, ps.Category, ps.Order)\n\n\tdefault:\n\t\treturn c.String(http.StatusBadRequest, \"Please provide a valid search type (title, tags, category)\")\n\t}\n\n\tif err != nil {\n\t\treturn c.String(http.StatusNotFound, \"No projects matching search\")\n\t}\n\n\treturn c.JSON(http.StatusFound, projects)\n}", "title": "" }, { "docid": "b6871d08773f29bfd387196e1ab67e85", "score": "0.49565238", "text": "func Title(v string) predicate.CheckListItem {\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "bc4e6438a6de0d4d7c890e4e11f315f9", "score": "0.4942501", "text": "func FindGameByTitle(title, username string, storageVar *[]Game) {\n\tdbmap.Select(storageVar, \"select * from games where \\\"Title\\\"=$1 and user_name=$1\", title, username)\n}", "title": "" }, { "docid": "a893e97562cc01e4174fb1e5ff250a2c", "score": "0.49406138", "text": "func (client *Client) GetDashboardByTitle(ctx context.Context, title string) (*Dashboard, error) {\n\tresp, err := client.get(ctx, \"/api/search?type=dash-db&query=\"+url.QueryEscape(title))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, client.httpError(resp)\n\t}\n\n\tvar dashboards []Dashboard\n\tif err := decodeJSON(resp.Body, &dashboards); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(dashboards) == 0 {\n\t\treturn nil, ErrDashboardNotFound\n\t}\n\n\tfor i := range dashboards {\n\t\tif strings.EqualFold(dashboards[i].Title, title) {\n\t\t\treturn &dashboards[i], nil\n\t\t}\n\t}\n\n\treturn nil, ErrDashboardNotFound\n}", "title": "" }, { "docid": "310b74abae456c6c4fbac957e60fb86c", "score": "0.49293366", "text": "func TitleEQ(v string) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "3bb6397bdc434b844a18e9838db6abd9", "score": "0.49289146", "text": "func (c Client) Search(title string) ([]Movie, error) {\n\tparams := url.Values{}\n\n\tparams.Set(\"term\", title)\n\n\tresp, err := c.get(\"/api/movie/lookup\", params)\n\n\tif err != nil {\n\t\treturn []Movie{}, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn []Movie{}, errors.New(resp.Status)\n\t}\n\n\tvar results []Movie\n\n\tif err := json.NewDecoder(resp.Body).Decode(&results); err != nil {\n\t\treturn results, err\n\t}\n\n\treturn results, nil\n}", "title": "" }, { "docid": "b815ed40d7faec27c35a9c877a649e0f", "score": "0.4924506", "text": "func (c *Controller) FindBookByTitle(ctx *gin.Context) {\n\tvar data Book = c.BookService.FindBookByTitle(ctx.Param(\"title\"))\n\tctx.JSON(http.StatusOK, data)\n}", "title": "" }, { "docid": "a333119e5a06e48a1363c1372ca66ee3", "score": "0.49225402", "text": "func (pm ProjectManager) FindByName(name string) *Item {\n\tfor _, project := range pm.projects {\n\t\tif strings.Compare(project.Name, name) == 0 {\n\t\t\treturn project\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9cea42c9f4e4193b3701f0367c757ba8", "score": "0.4907085", "text": "func (cpt *MChapter) FindByTitle(title string) (code int, err error) {\n\tmConn := Conn()\n\n\tbc := mConn.DB(\"web\").C(\"chapter\")\n\terr = bc.Find(bson.M{\"title\": title}).One(cpt)\n\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\tcode = ErrNotFound\n\t\t} else {\n\t\t\tcode = ErrDatabase\n\t\t}\n\t} else {\n\t\tcode = 0\n\t}\n\treturn\n}", "title": "" }, { "docid": "006a5a89259bbc15b372f262d75fe45f", "score": "0.4871004", "text": "func (pmm *Client) GetProjectByName(projectName string) (*models.ProjectList, error) {\n\ttok, err := token.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclientAuth := runtimeClient.BearerToken(tok)\n\tresult, err := pmm.cl.Project.SearchProjects(&project.SearchProjectsParams{\n\t\tName: []string{projectName},\n\t}, clientAuth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.Payload, nil\n}", "title": "" }, { "docid": "9ed0784cc5f7937863251f4d9328d523", "score": "0.4869436", "text": "func (f *DeathPlaceFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(deathplace.FieldTitle))\n}", "title": "" }, { "docid": "1266961ac155a22f9547ca7b276d3c17", "score": "0.48372352", "text": "func TitleContainsFold(v string) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "11e2f2a8034b966d46beefc5a2c8011a", "score": "0.4834098", "text": "func (r *SQLiteIssueRepository) Find(title string, projectID uint, labels []string) ([]domain.Issue, error) {\n\tvar items []domain.Issue\n\tquery := \"\"\n\targs := []interface{}{}\n\tif title != \"\" {\n\t\tquery = \"title LIKE ?\"\n\t\targs = append(args, \"%\"+title+\"%\")\n\t}\n\tif projectID != uint(0) {\n\t\tif query != \"\" {\n\t\t\tquery += \" AND project_id = ?\"\n\t\t} else {\n\t\t\tquery += \"project_id = ?\"\n\t\t}\n\t\targs = append(args, projectID)\n\t}\n\tif len(labels) > 0 {\n\t\tif query != \"\" {\n\t\t\tquery += \" AND \\\"issues_labels\\\".\\\"label_id\\\" IN (?)\"\n\t\t} else {\n\t\t\tquery += \"\\\"issues_labels\\\".\\\"label_id\\\" IN (?)\"\n\t\t}\n\t\targs = append(args, labels)\n\t}\n\tif query == \"\" {\n\t\tif err := r.db.Preload(\"Project\").Preload(\"Labels\").Find(&items).Error; err != nil {\n\t\t\treturn items, err\n\t\t}\n\t} else if len(labels) > 0 {\n\t\tif err := r.db.Preload(\"Project\").Preload(\"Labels\").Joins(\"INNER JOIN \\\"issues_labels\\\" ON \\\"issues_labels\\\".\\\"issue_id\\\" = \\\"issues\\\".\\\"id\\\"\").Where(query, args...).Select(\"DISTINCT \\\"issues\\\".*\").Find(&items).Error; err != nil {\n\t\t\treturn items, err\n\t\t}\n\t} else {\n\t\tif err := r.db.Preload(\"Project\").Preload(\"Labels\").Where(query, args...).Find(&items).Error; err != nil {\n\t\t\treturn items, err\n\t\t}\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "e7b61d77b0a388078eccd9ed15e857db", "score": "0.483078", "text": "func findProjectById(c *gin.Context) {\n\tqueryProject := &model.Project{}\n\n\tprojectId, err := strconv.ParseInt(c.Query(\"projectId\"), 10, 64)\n\tif err != nil {\n\t\t_ = c.AbortWithError(InternalError, err)\n\t}\n\tqueryProject.ID = uint(projectId)\n\n\tif project, err := controllers.FindProjectById(queryProject); err != nil {\n\t\t_ = c.AbortWithError(InternalError, err)\n\t} else {\n\t\tc.JSON(http.StatusOK, project)\n\t}\n}", "title": "" }, { "docid": "7cf80bbd155f24f7ce068ab5626c33ed", "score": "0.48254085", "text": "func TitleEQ(v string) predicate.CheckListItem {\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "bb083ebc4932b79543d45a7b948c0630", "score": "0.48209134", "text": "func (reduce Reducer) getTitle(address string) (string, error) {\n\tclient := urlfetch.Client(reduce.c)\n\tresp, err := client.Get(address)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn reduce.scrapeTitle(resp)\n}", "title": "" }, { "docid": "eb743c5e8f364d2171cb368ae8f9feb4", "score": "0.4810468", "text": "func TitleIn(vs ...string) predicate.BlogPost {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldTitle), v...))\n\t})\n}", "title": "" }, { "docid": "858b80b670dbba6c89b675c7d0389944", "score": "0.4805682", "text": "func (f *StateFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(state.FieldTitle))\n}", "title": "" }, { "docid": "cc7c009f6ed1c02f51c07afb433213a2", "score": "0.4799536", "text": "func (p *ProjectDetailAPIView) GET(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\n\t// prepare blank response\n\tresponse := response.New()\n\n\tmanager := models.NewProjectManager(p.context)\n\n\tproject := manager.NewProject()\n\terr = manager.GetFromRequest(project, r)\n\tif err != nil {\n\t\tif err == models.ErrObjectDoesNotExists {\n\t\t\tresponse.Status(http.StatusNotFound).Write(w, r)\n\t\t} else {\n\t\t\tglog.Error(err)\n\t\t\tresponse.Status(http.StatusInternalServerError).Write(w, r)\n\t\t}\n\t\treturn\n\t}\n\n\tresponse.Status(http.StatusOK).Result(project).Write(w, r)\n}", "title": "" }, { "docid": "be21dd9a7306f05253ebaf868a30506f", "score": "0.47962838", "text": "func (pmm *Client) GetProjectByName(ctx context.Context, projectName string) (*models.ProjectListSearch, error) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"v2.project-service.client.GetProjectByName\",\n\t\tutils.XREQUESTID: ctx.Value(utils.XREQUESTID),\n\t\t\"projectName\": projectName,\n\t\t\"apiGWHost\": apiGWHost,\n\t}\n\ttok, err := token.GetToken()\n\tif err != nil {\n\t\tlog.WithFields(f).WithError(err).Warning(\"problem retrieving token\")\n\t\treturn nil, err\n\t}\n\n\tclientAuth := runtimeClient.BearerToken(tok)\n\tresult, err := pmm.cl.Project.SearchProjects(&project.SearchProjectsParams{\n\t\tName: []string{projectName},\n\t\tContext: ctx,\n\t}, clientAuth)\n\tif err != nil {\n\t\tlog.WithFields(f).WithError(err).Warning(\"problem searching projects by name\")\n\t\treturn nil, err\n\t}\n\n\treturn result.Payload, nil\n}", "title": "" }, { "docid": "ab0a336869bbdaa8cce142c3226d75d5", "score": "0.47907335", "text": "func findProjectByPath(c *gin.Context) {\n\tqueryProject := &model.Project{\n\t\tPath: c.Query(\"projectPath\"),\n\t}\n\tif project, err := controllers.FindProjectByPath(queryProject); err != nil {\n\t\t_ = c.AbortWithError(InternalError, err)\n\t} else {\n\t\tc.JSON(http.StatusOK, project)\n\t}\n}", "title": "" }, { "docid": "8d08263584543e5e782923ea9a988f37", "score": "0.47906023", "text": "func (api *API) GetProjectByName(siteID, name string) (Project, error) {\n\tprojects, err := api.QueryProjects(siteID)\n\tif err != nil {\n\t\treturn Project{}, err\n\t}\n\tfor _, project := range projects {\n\t\tif project.Name == name {\n\t\t\treturn project, nil\n\t\t}\n\t}\n\treturn Project{}, fmt.Errorf(\"Project Named '%s' Not Found\", name)\n}", "title": "" }, { "docid": "58648d60dd23484b0af94befe16dd0c1", "score": "0.47873467", "text": "func (n *hamelnQuery) FindTitle() string {\n\treturn n.d.Find(\"span[itemprop=name]\").Text()\n}", "title": "" }, { "docid": "14905884294a926eb8ba9decb6b6ca8a", "score": "0.47859922", "text": "func FindProjectListByTeamId(d *mgo.Database, HexTeamId string) []ProjectListResponse {\n projectList := []ProjectList{}\n result := []ProjectListResponse{}\n if bson.IsObjectIdHex(HexTeamId) {\n Id := bson.ObjectIdHex(HexTeamId)\n Collection(d).FindId(Id).All(&projectList)\n }\n\n for _, each := range projectList {\n newPList := ProjectListResponse{}\n newPList.Id = each.Id.Hex()\n newPList.Name = each.Name\n result = append(result, newPList)\n }\n return result\n}", "title": "" }, { "docid": "6c7678abe12215533e3cd213eea0db8e", "score": "0.47768444", "text": "func (f *DeathMannerFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(deathmanner.FieldTitle))\n}", "title": "" }, { "docid": "1e257f35e6fb53855e7a7f551d50d048", "score": "0.47742555", "text": "func (p *Projects) GetByID(c echo.Context) error {\n\tid := c.Param(\"id\")\n\tproject, err := p.projectStore.GetByID(id)\n\tif err != nil {\n\t\tc.Logger().Errorf(\"Can't find project\", err)\n\t\treturn c.String(http.StatusNotFound, \"Can't find project\")\n\t}\n\treturn c.JSON(http.StatusFound, project)\n}", "title": "" }, { "docid": "94f9f5061e73c6ede56b51b924489af4", "score": "0.47712618", "text": "func (f *EthnicityFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(ethnicity.FieldTitle))\n}", "title": "" }, { "docid": "3e3ba1120194a9061f565a5872e37759", "score": "0.47706968", "text": "func (p *v1Provider) GetProject(w http.ResponseWriter, r *http.Request) {\n\ttoken := p.CheckToken(r)\n\tif !token.Require(w, \"project:show\") {\n\t\treturn\n\t}\n\tcluster := p.FindClusterFromRequest(w, r, token)\n\tif cluster == nil {\n\t\treturn\n\t}\n\tdbDomain := p.FindDomainFromRequest(w, r, cluster)\n\tif dbDomain == nil {\n\t\treturn\n\t}\n\tdbProject := p.FindProjectFromRequest(w, r, dbDomain)\n\tif dbProject == nil {\n\t\treturn\n\t}\n\n\t_, withSubresources := r.URL.Query()[\"detail\"]\n\tprojects, err := reports.GetProjects(cluster, dbDomain.ID, &dbProject.ID, db.DB, reports.ReadFilter(r), withSubresources)\n\tif ReturnError(w, err) {\n\t\treturn\n\t}\n\tif len(projects) == 0 {\n\t\thttp.Error(w, \"no resource data found for project\", 500)\n\t\treturn\n\t}\n\n\tReturnJSON(w, 200, map[string]interface{}{\"project\": projects[0]})\n}", "title": "" }, { "docid": "f25a19f118e9d4a9000d744aa455da8d", "score": "0.4764333", "text": "func (f *VehicleColorFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(vehiclecolor.FieldTitle))\n}", "title": "" }, { "docid": "d2573113ca242cd77f15e71d1da33597", "score": "0.47562024", "text": "func (d *Db) GetJobsByTitle(title string) []Job {\n\n\t// Prepare query, takes a name argument, protects from sql injection\n\tstmt, err := d.Prepare(`SELECT \"id\", \"title\" FROM \"Jobs\" WHERE \"title\"=$1`)\n\n\tif err != nil {\n\t\tfmt.Println(\"GetJobsByTitle Preperation Err: \", err)\n\t}\n\n\t// Make query with our stmt, passing in name argument\n\trows, err := stmt.Query(title)\n\tif err != nil {\n\t\tfmt.Println(\"GetJobsByTitle Query Err: \", err)\n\t}\n\n\t// Create User struct for holding each row's data\n\tvar r Job\n\t// Create slice of Users for our response\n\tjobs := []Job{}\n\t// Copy the columns from row into the values pointed at by r (User)\n\tfor rows.Next() {\n\t\terr = rows.Scan(\n\t\t\t&r.ID,\n\t\t\t&r.Title,\n\t\t)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error scanning rows: \", err)\n\t\t}\n\t\tjobs = append(jobs, r)\n\t}\n\n\treturn jobs\n}", "title": "" }, { "docid": "b23ac86fcbfac027f9c5178cd3e9fe93", "score": "0.47528356", "text": "func Title(v string) predicate.Metric {\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "8e3dbe9ce0799927331a85809e55d58e", "score": "0.47525132", "text": "func (p *Post) FindPostsByTitle(db *gorm.DB, title string) (*[]Post, error) {\n\tvar posts []Post\n\terr := db.Where(\"title like ?\", \"%\"+title+\"%\").Find(&posts).Error\n\tif err == gorm.ErrRecordNotFound || len(posts) <= 0 {\n\t\treturn &[]Post{}, errors.New(\"Posts not found\")\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\treturn &posts, nil\n}", "title": "" }, { "docid": "198461c307ef889d83732644d01c5293", "score": "0.47478613", "text": "func (repo *PageFileRepo) FindByTitle(title string) (*domain.Page, error) {\n\tfilename := title + \".txt\"\n\tbody, err := ioutil.ReadFile(filename)\n\n\treturn &domain.Page{Title: title, Body: body}, err\n}", "title": "" }, { "docid": "93dd6519d1c95ea0fc2758ea5cee2d34", "score": "0.4743986", "text": "func (s *SearchAPI) SearchByUsername() {\n\tusername := s.GetStringFromPath(\":username\")\n\n\tisAuthenticated := s.SecurityCtx.IsAuthenticated()\n\tisSysAdmin := s.SecurityCtx.IsSysAdmin()\n\n\tvar projects []*models.Project\n\tvar err error\n\tvar user *models.User\n\n\tmode, err := config.AuthMode()\n\tif err != nil {\n\t\tlog.Errorf(\"failed to get auth mode: %v\", err)\n\t\ts.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))\n\t\treturn\n\t}\n\n\tif mode != common.DBAuth {\n\t\tlog.Errorf(\"auth mode need to be : db_auth \")\n\t\ts.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))\n\t\treturn\n\t}\n\n\tif isAuthenticated && isSysAdmin {\n\t\tlog.Warningf(\"user is authenticate and isSystemAdmin\")\n\t\tqueryUser := models.User{Username:username}\n\t\terr := validateName(queryUser)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"Bad request in Register: %v\", err)\n\t\t\ts.RenderError(http.StatusBadRequest, \"register error:\"+err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tlog.Warningf(\"after validate\")\n\t\tuser,err = dao.GetUser(queryUser)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"get user by username error: %v\", err)\n\t\t\ts.CustomAbort(http.StatusInternalServerError, \"Internal error.\")\n\t\t}\n\t\tif user == nil {\n\t\t\tlog.Warning(\"user with username : %S not found!\",username)\n\t\t\ts.RenderError(http.StatusNotFound, \"query user not found!\")\n\t\t\treturn\n\t\t}\n\t\tlog.Warningf(\"get user success\")\n\t\tprojects, err = s.ProjectMgr.GetPublic()\n\t\tif err != nil {\n\t\t\ts.ParseAndHandleError(\"failed to get projects\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Warningf(\"after get public projects\")\n\t\t//取出projects\n\t\tmys, mErr := dao.GetProjects(&models.ProjectQueryParam{\n\t\t\tMember: &models.MemberQuery{\n\t\t\t\tName: user.Username,\n\t\t\t},\n\t\t})\n\n\t\tif mErr != nil {\n\t\t\ts.HandleInternalServerError(fmt.Sprintf(\n\t\t\t\t\"failed to get projects: %v\", err))\n\t\t\treturn\n\t\t}\n\t\tlog.Warningf(\"after get projects of user:%s\",username)\n\n\n\t\texist := map[int64]bool{}\n\t\tfor _, p := range projects {\n\t\t\texist[p.ProjectID] = true\n\t\t}\n\n\t\tfor _, p := range mys {\n\t\t\tif !exist[p.ProjectID] {\n\t\t\t\tprojects = append(projects, p)\n\t\t\t}\n\t\t}\n\n\t\tprojectIds := make([]int64, len(projects))\n\t\tfor i, p := range projects {\n\t\t\tprojectIds[i] = p.ProjectID\n\t\t}\n\n\t\tpage, size := s.GetPaginationParams()\n\t\tquery := &models.RepositoryQuery{\n\t\t\tProjectIDs: projectIds,\n\t\t\tName: s.GetString(\"q\"),\n\t\t\tPagination: models.Pagination{\n\t\t\t\tPage: page,\n\t\t\t\tSize: size,\n\t\t\t},\n\t\t}\n\n\t\ttotal, tErr := dao.GetTotalOfRepositories(query)\n\t\tif tErr != nil {\n\t\t\tlog.Errorf(\"failed to get total of repositories %v\", err)\n\t\t\ts.CustomAbort(http.StatusInternalServerError, \"\")\n\t\t}\n\n\t\trepositoryResult,rErr:= dao.GetRepositoriesWithProject(query)\n\n\t\tif rErr != nil {\n\t\t\tlog.Errorf(\"failed to filter repositories: %v\", err)\n\t\t\ts.CustomAbort(http.StatusInternalServerError, \"\")\n\t\t}\n\t\tresult := &searchRepositoryPageResult{Total: total, Page: page, Page_size: size, Repository: repositoryResult}\n\t\ts.Data[\"json\"] = result\n\t\ts.ServeJSON()\n\t}else{\n\t\ts.CustomAbort(http.StatusUnauthorized, \"Unauthorized or login user is not admin!\")\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "59da40ac5fde59b19677a52b28f481c5", "score": "0.47412637", "text": "func (c *Client) Search(url string) ([]*Build, error) {\n\trv := []*Build{}\n\tcursor := \"\"\n\tfor {\n\t\tnewUrl := url\n\t\tif cursor != \"\" {\n\t\t\tnewUrl += fmt.Sprintf(\"&start_cursor=%s\", cursor)\n\t\t}\n\t\tvar builds []*Build\n\t\tvar err error\n\t\tbuilds, cursor, err = c.getOnePage(newUrl)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trv = append(rv, builds...)\n\t\tif cursor == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "62ccdf6a829c741a283d91c71f0471c5", "score": "0.4732941", "text": "func (j *Jira) SearchProjects(searchString string) (*[]JiraProject, error) {\n\turl := j.BaseUrl + j.ApiPath + project_url\n\tcontents := j.buildAndExecRequest(\"GET\", url, nil)\n\n\tprojects := new([]JiraProject)\n\terr := json.Unmarshal(contents, &projects)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t}\n\tsearchResult := new([]JiraProject)\n\tvar rgx = regexp.MustCompile(fmt.Sprintf(\"(?i).*%s.*\", searchString))\n\tfor _, project := range *projects {\n\t\tif rgx.MatchString(project.Name) {\n\t\t\t*searchResult = append(*searchResult, project)\n\t\t}\n\t}\n\treturn searchResult, nil\n}", "title": "" }, { "docid": "9ddd9133ecb89a3b8a5e42898018fad9", "score": "0.47299942", "text": "func (f *PostFilter) WhereTitle(p entql.StringP) {\n\tf.Where(p.Field(post.FieldTitle))\n}", "title": "" }, { "docid": "f571fbf76f94a28a7558ada4ab8185c5", "score": "0.47278845", "text": "func (b *Repository) FindBookByTitle(bookTitle string) Book {\n\tvar book Book\n\tb.DB.Where(\"title = ?\", bookTitle).Find(&book)\n\treturn book\n}", "title": "" }, { "docid": "d8acdf2c78f60442518c4eae2069088d", "score": "0.47234666", "text": "func (o *V1BioProject) GetTitle() string {\n\tif o == nil || o.Title == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Title\n}", "title": "" }, { "docid": "f8e4fc4ba610f98d6d7e25ab74c01de5", "score": "0.47072324", "text": "func (s *APIKeyServiceOp) ProjectGet(projectID, apiKeyID string, opts *GetOptions) (*APIKey, error) {\n\tif validateErr := ValidateUUID(projectID); validateErr != nil {\n\t\treturn nil, validateErr\n\t}\n\tif validateErr := ValidateUUID(apiKeyID); validateErr != nil {\n\t\treturn nil, validateErr\n\t}\n\tpkeys, _, err := s.ProjectList(projectID, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, k := range pkeys {\n\t\tif k.ID == apiKeyID {\n\t\t\treturn &k, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"Project (%s) API key %s not found\", projectID, apiKeyID)\n}", "title": "" }, { "docid": "a7e143d6964973bdec361b5c08949de3", "score": "0.4701407", "text": "func TitleContainsFold(v string) predicate.Metric {\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "46abf59ff9730dd0b77a896b50e4b4d6", "score": "0.47002953", "text": "func FilterByProject(key string) func(*Record) bool {\n\tmodule := strings.Split(key, \"@\") // if a module is given mod@project\n\treturn func(r *Record) bool {\n\t\trecordModule := strings.Split(r.Project.Key, \"@\")\n\t\t// mod@key - mod@key -> search for project with module X\n\t\tif r.Project.IsModule() && len(module) > 1 {\n\t\t\treturn recordModule[0] == module[0] && recordModule[1] == module[1]\n\t\t}\n\t\t// key - mod@key || key - key -> search for project where key\n\t\tif len(module) == 1 {\n\t\t\tif r.Project.IsModule() {\n\t\t\t\treturn recordModule[1] == key\n\t\t\t}\n\t\t\treturn r.Project.Key == key\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "2d4f8b018d1f4a6e02675ad41cff1bfc", "score": "0.4687836", "text": "func GetDataTitle(c echo.Context) (err error) {\n\n\tdata := strings.Split(c.QueryString(), \"=\")\n\tkey := data[0]\n\tif key == \"title\" {\n\t\tvalue := c.QueryParam(\"title\")\n\t\tresult, err := models.GetDatabyTitle(dbs.DB, value)\n\t\tfmt.Println(\"return result\", result)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\tFinalvalue := getvalues(result)\n\t\tif len(Finalvalue) == 0 {\n\t\t\tnewresult := models.GetMovieInfo(value)\n\t\t\tfmt.Println(\"new result:\", newresult)\n\t\t\tdataResult, err := models.InsertData(dbs.DB, newresult)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t}\n\t\t\tfmt.Println(\"data result:\", dataResult)\n\t\t\tif result != nil {\n\t\t\t\treturn c.JSON(http.StatusCreated, newresult)\n\t\t\t}\n\t\t\treturn c.JSON(http.StatusNotFound, \"data is not created\")\n\t\t}\n\t\treturn c.JSON(http.StatusOK, Finalvalue)\n\t}\n\treturn c.JSON(http.StatusNotFound, \"Data Not Found\")\n}", "title": "" }, { "docid": "e71f5bae9964f13547ab9eb4fe2b5adb", "score": "0.46854615", "text": "func FindFilmBytitle(title string) model.Film {\n\tvar film model.Film\n\tfor _, element := range filmList {\n\t\tif element.Title == title {\n\t\t\tfilm = element\n\t\t\tbreak\n\t\t}\n\t}\n\treturn film\n}", "title": "" }, { "docid": "a5993b39e1761c111fd8103f3e4ffc80", "score": "0.46651432", "text": "func loadPage(projectId string) (*objects.Project, error) {\n\t//filename := \"projects/\" + title + \".txt\"\n\tp, err := mysql_data_access.GetProject(projectId)\n\t//body, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//return &Page{Title: title, Body: body}, nil\n\treturn p, nil\n}", "title": "" }, { "docid": "6d8c5666af4a1d4a4da2b2ee6b945011", "score": "0.46645454", "text": "func GetProject(c *gin.Context) {\n\tuuid := c.Param(\"uuid\")\n\n\tac := middleware.GetAppContext(c)\n\n\tprojectStore := project_store.New(ac.MainDB)\n\tservice := project_service.New(project_service.Context{\n\t\tConfig: ac.Config,\n\t\tProjectStore: projectStore,\n\t})\n\n\trequest := &project_service.FindRequest{\n\t\tUUID: uuid,\n\t}\n\n\tproject, err := service.Find(request)\n\n\tif err != nil {\n\t\tc.Error(err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, project)\n}", "title": "" }, { "docid": "f8117cdc37177d66dac2f637533d8aaf", "score": "0.46643484", "text": "func GetProject(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Context-Type\", \"application/x-www-form-urlencoded\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tparams := mux.Vars(r)\n\n\tid, err := strconv.Atoi(params[\"id\"])\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to convert the string into int. %v\", err)\n\t}\n\n\tproject, err := getProject(int64(id))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get project. %v\", err)\n\t}\n\n\tjson.NewEncoder(w).Encode(project)\n}", "title": "" }, { "docid": "fcc6647654e69d9ff9e9b71954b3428a", "score": "0.4662669", "text": "func GetAllProjectsByStatus(Status string) ([]Project, error) {\n\tprojects := []Project{}\n\tdb, err := getDBConnection()\n\tdefer db.Close()\n\tif err == nil {\n\t\tdb.Preload(\"Jobs\").Preload(\"Tasks\").Preload(\"Bids\").Preload(\"ProjectFiles\").Where(\"status = ?\", Status).Find(&projects)\n\t\tif err == nil {\n\t\t\treturn projects, nil\n\t\t}\n\t\treturn []Project{}, errors.New(\"Unable to get project for session\")\n\t}\n\treturn projects, errors.New(\"Unable to getdatabase connection\")\n}", "title": "" }, { "docid": "12aa70cbef216dd57bda7cd999973709", "score": "0.4659056", "text": "func (api *API) QueryProjects(siteID string) ([]Project, error) {\n\turl := fmt.Sprintf(\"%s/api/%s/sites/%s/projects\", api.Server, api.Version, siteID)\n\theaders := make(map[string]string)\n\tretval := QueryProjectsResponse{}\n\terr := api.makeRequest(url, GET, nil, &retval, headers, connectTimeOut, readWriteTimeout, \"\")\n\treturn retval.Projects.Projects, err\n}", "title": "" }, { "docid": "c0a6b55d71624131e70ca5fdb618013f", "score": "0.46577618", "text": "func SearchTask(query string, done bool, all bool, page int, limit int) ([]*Task, int, error) {\n\n\t// Get the DB.\n\ts, c, err := getDatabase()\n\tdefer s.Close()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treg := bson.RegEx{Pattern: query, Options: \"\"}\n\tbq := bson.M{\"title\": reg}\n\n\tif !all {\n\t\tbq[\"done\"] = done\n\t}\n\n\tq := c.Find(bq)\n\n\tn, err := q.Count()\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"unexpected error %v\", err)\n\t}\n\n\tq.Sort(\"title\", \"_id\").Limit(limit)\n\n\t// To get the nth page:\n\tq = q.Skip((page - 1) * limit)\n\n\tvar tasks []*Task\n\tif err = q.All(&tasks); err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"unexpected error %v\", err)\n\t}\n\n\treturn tasks, n, nil\n}", "title": "" }, { "docid": "2dec75219479b96973da70b082363b9a", "score": "0.46559626", "text": "func FindProject(exec boil.Executor, iD null.Int64, selectCols ...string) (*Project, error) {\n\tprojectObj := &Project{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"projects\\\" where \\\"id\\\"=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(nil, exec, projectObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"db: unable to select from projects\")\n\t}\n\n\treturn projectObj, nil\n}", "title": "" }, { "docid": "6acc6f96a1bdfaf5de7d40664b680eee", "score": "0.4653544", "text": "func (a ProjectsApi) ApiProjectsGet(skip int32, take int32) (*ResourceCollectionProjectResource, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/api/projects\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(APIKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-Octopus-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-Octopus-ApiKey\")\n\t// authentication '(APIKeyQuery)' required\n\t// set key with prefix in query string\n\tlocalVarQueryParams[\"ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"ApiKey\")\n\t// authentication '(NugetApiKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-NuGet-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-NuGet-ApiKey\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\tlocalVarQueryParams.Add(\"skip\", a.Configuration.APIClient.ParameterToString(skip, \"\"))\n\tlocalVarQueryParams.Add(\"take\", a.Configuration.APIClient.ParameterToString(take, \"\"))\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new(ResourceCollectionProjectResource)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"ApiProjectsGet\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "ff3a1b2290f920af25e2cf20dfd37b1d", "score": "0.4647437", "text": "func (c *Collection) Search(searchParameter string) ([]models.App, error) {\n\tmodelApp := []models.App{}\n\tsID := strings.ToLower(searchParameter[:strings.Index(searchParameter, \"=\")])\n\tsParameter := strings.ToLower(searchParameter[len(sID)+1:])\n\tfor _, v := range c.data {\n\t\tswitch sID {\n\t\tcase \"id\":\n\t\t\tif strings.Contains(strings.ToLower(v.ID), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"title\":\n\t\t\tif strings.Contains(strings.ToLower(v.Title), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"maintainers\":\n\t\t\tmodelApp = maintainers(v, sParameter, modelApp)\n\t\tcase \"company\":\n\t\t\tif strings.Contains(strings.ToLower(v.Company), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"website\":\n\t\t\tif strings.Contains(strings.ToLower(v.Title), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"source\":\n\t\t\tif strings.Contains(strings.ToLower(v.Source), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"license\":\n\t\t\tif strings.Contains(strings.ToLower(v.License), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tif strings.Contains(strings.ToLower(v.Description), sParameter) {\n\t\t\t\tmodelApp = append(modelApp, v)\n\t\t\t}\n\t\t}\n\t}\n\tif len(modelApp) == 0 {\n\t\treturn modelApp, ErrNotFound\n\t}\n\treturn modelApp, nil\n}", "title": "" }, { "docid": "d702204bb31463b63b62116ec0c45336", "score": "0.46472082", "text": "func (c *TowerAPI) GetProject(id string) Project {\n}", "title": "" }, { "docid": "77b5c7b3039a2a5d2b8f6680d3ac2526", "score": "0.46442482", "text": "func (ps *ProjectStore) GetByTags(tags []string) ([]Project, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tcursor, err := ps.collection.Find(ctx, bson.D{{\"tags\", bson.D{{\"$in\", tags}}}})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojects, err := ps.extractProjectsFromCursor(ctx, cursor)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcursor.Close(ctx)\n\treturn projects, nil\n}", "title": "" }, { "docid": "023b8f713a80ce6ee5bc4db52a4b8f17", "score": "0.46435532", "text": "func TestSearchByTitle(t *testing.T) {\n\tdatastore, bookTable, deferFn := testhelper.SearchIn(t)\n\tdefer deferFn()\n\n\tserver := New(nil, &SearchIn{\n\t\tDatastore: datastore,\n\t\tBookTable: bookTable,\n\t})\n\n\tfor _, test := range []struct {\n\t\ttitle string\n\t\tresponse string\n\t\tstatus int\n\t}{\n\t\t{\n\t\t\ttitle: \"NoTitle\",\n\t\t\tresponse: \"[]\",\n\t\t\tstatus: 200,\n\t\t},\n\t\t{\n\t\t\ttitle: \"1\",\n\t\t\tresponse: \"[]\",\n\t\t\tstatus: 200,\n\t\t},\n\t\t{\n\t\t\ttitle: \"The Adventures of Sherlock Holmes\",\n\t\t\tresponse: fmt.Sprint(\n\t\t\t\t\"[\\n\",\n\t\t\t\t\"\\t{\\n\",\n\t\t\t\t\"\\t\\t\\\"ID\\\": 3588,\\n\",\n\t\t\t\t\"\\t\\t\\\"Title\\\": \\\"The Adventures of Sherlock Holmes\\\",\\n\",\n\t\t\t\t\"\\t\\t\\\"Authors\\\": \\\"Arthur Conan Doyle-Eoin Colfer\\\",\\n\",\n\t\t\t\t\"\\t\\t\\\"AverageRating\\\": 4.31,\\n\",\n\t\t\t\t\"\\t\\t\\\"ISBN\\\": \\\"439574285\\\",\\n\",\n\t\t\t\t\"\\t\\t\\\"ISBN13\\\": \\\"9780439574280\\\",\\n\",\n\t\t\t\t\"\\t\\t\\\"LanguageCode\\\": \\\"eng\\\",\\n\",\n\t\t\t\t\"\\t\\t\\\"Pages\\\": 336,\\n\",\n\t\t\t\t\"\\t\\t\\\"RatingsCount\\\": 811,\\n\",\n\t\t\t\t\"\\t\\t\\\"ReviewsCount\\\": 86\\n\",\n\t\t\t\t\"\\t}\\n\",\n\t\t\t\t\"]\",\n\t\t\t),\n\t\t\tstatus: 200,\n\t\t},\n\t} {\n\t\tt.Run(\n\t\t\tfmt.Sprintf(\"title:%s\", test.title),\n\t\t\tfunc(*testing.T) {\n\t\t\t\trecorder := recordResponse(t, fmt.Sprintf(\"/books/%s\", test.title), \"/books/{title}\", server.searchByTitle)\n\t\t\t\tif recorder.Code != test.status {\n\t\t\t\t\tt.Errorf(\"incorrect status, want: %d, got: %d\", test.status, recorder.Code)\n\t\t\t\t}\n\t\t\t\tif recorder.Body.String() != test.response {\n\t\t\t\t\tt.Errorf(\"incorrect response, want: %s, got: %s\", test.response, recorder.Body.String())\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\t}\n}", "title": "" }, { "docid": "29f69ca8269830d7876985dac2b45840", "score": "0.46393454", "text": "func (s *ProjectsServiceOp) GetOneProjectByName(ctx context.Context, projectName string) (*Project, *atlas.Response, error) {\n\tif projectName == \"\" {\n\t\treturn nil, nil, atlas.NewArgError(\"projectName\", \"must be set\")\n\t}\n\n\tpath := fmt.Sprintf(\"%s/byName/%s\", projectBasePath, projectName)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\troot := new(Project)\n\tresp, err := s.client.Do(ctx, req, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn root, resp, err\n}", "title": "" }, { "docid": "5a8ff77e5d37faa16dd00a91951fddeb", "score": "0.46346557", "text": "func TitleContainsFold(v string) predicate.CheckListItem {\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "37771846bf8c13b76263f9a6e5a3c2d1", "score": "0.46194118", "text": "func TitleGTE(v string) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "a922c3461e09c0f6861b98581785e939", "score": "0.46152765", "text": "func TitleEQ(v string) predicate.Metric {\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "eaf6a82662c1f19c8cc9fc03269e447a", "score": "0.45899603", "text": "func getVisibleProjects(rbac rbac.Interface, user string, cli kubernetes.Client, ctx context.Context, tenant string) (result, error) {\n\tvar lists []tenantv1.Project\n\tprojectList := tenantv1.ProjectList{}\n\terr := cli.Cache().List(ctx, &projectList)\n\tif err != nil {\n\t\treturn result{}, err\n\t}\n\n\tfor _, p := range projectList.Items {\n\t\tif isAllowedAccess(rbac, user, p.Spec.Namespace) {\n\t\t\tlists = append(lists, p)\n\t\t}\n\t}\n\n\tlists = filterBy(tenant, lists)\n\n\tres := result{\n\t\tTotal: len(lists),\n\t\tItems: lists,\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "419e23fcc5a8a5c68f96098d6f163ff2", "score": "0.45899603", "text": "func TitleIn(vs ...string) predicate.CheckListItem {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldTitle), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "974ead4edf60c1d71dce460007147718", "score": "0.45864752", "text": "func (o OpenShift) getProjects() (projects []string, err error) {\n\treq, err := o.reqOAPI(\"GET\", \"\", \"projects\", nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tresp, err := o.do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer bodyClose(resp)\n\n\tps := model.Projects{}\n\terr = json.NewDecoder(resp.Body).Decode(&ps)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, p := range ps.Items {\n\t\tif strings.HasSuffix(p.Metadata.Name, \"-jenkins\") {\n\t\t\tprojects = append(projects, p.Metadata.Name[:len(p.Metadata.Name)-8])\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "17264b179b800d9f7c77d1017ff1dbd1", "score": "0.45855", "text": "func GetNewsTitle(id int) string {\n\n\tif sqlConnStr == \"\" {\n\t\tpanic(\"Database not initialized\")\n\t}\n\n\trows := querySql(\"select-title\", id)\n\tvar title string\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&title); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn title\n}", "title": "" }, { "docid": "7998708b05555eeed2e1f123df77a36c", "score": "0.4566309", "text": "func (qs ArticleQuerySet) TitleIn(title ...string) ArticleQuerySet {\n\tif len(title) == 0 {\n\t\tqs.db.AddError(errors.New(\"must at least pass one title in TitleIn\"))\n\t\treturn qs.w(qs.db)\n\t}\n\treturn qs.w(qs.db.Where(\"title IN (?)\", title))\n}", "title": "" }, { "docid": "e97a1890f4c797d8f8686afd42330136", "score": "0.45654595", "text": "func (h *APIResource) ProjectGetAll(c *gin.Context) {\n\n\tlog.Debug(\"ProjectGetall Endpoint\")\n\tProject := models.NewProject(h.DB, h.Jira)\n\n\tprojects, err := Project.GetAllProject()\n\tif err != nil {\n\t\tlog.Errorf(\"Error retrieving Project Name: %s %s\", Project.Name, err)\n\t\terror := \"Error Project Does not exist\"\n\n\t\tc.JSON(400, gin.H{\"error\": error})\n\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": \"ok\", \"projects\": projects})\n\n}", "title": "" }, { "docid": "1cd372f19b74eef6eb33070775feb123", "score": "0.45626244", "text": "func (o ProjectIssueOutput) Title() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ProjectIssue) pulumi.StringOutput { return v.Title }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1d7ade97b98e0b5a0ecdf86ac95669c0", "score": "0.45621374", "text": "func TitleIn(vs ...string) predicate.Metric {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldTitle), v...))\n\t})\n}", "title": "" }, { "docid": "7588302107bb4108f6c9decd899bc546", "score": "0.4562117", "text": "func WikiPageTitle(link *url.URL) string {\n\tquery, err := url.ParseQuery(link.RawQuery)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif title, found := query[\"title\"]; found {\n\t\treturn title[0]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e7e78d9a37f8bb8b32380f6d73e5f35e", "score": "0.4559882", "text": "func (articles Articles) find(keyword string) Articles {\n\tvar filtered Articles\n\tfor _, a := range articles {\n\t\tif strings.Contains(a.Title, keyword) {\n\t\t\tfiltered = append(filtered, a)\n\t\t}\n\t}\n\treturn filtered\n}", "title": "" }, { "docid": "f2f7b3cc0c6e99986f39f33a20a9ef97", "score": "0.455703", "text": "func (c DefaultStorageService) GetBuildsByProject(project v1.Project, since uint64, limit uint64) ([]v1.Build, error) {\n\tparams := &dynamodb.QueryInput{\n\t\tTableName: aws.String(\"decap-build-metadata\"),\n\t\tIndexName: aws.String(\"project-key-build-start-time-index\"),\n\t\tKeyConditionExpression: aws.String(\"#pkey = :pkey and #bst > :since\"),\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#pkey\": aws.String(\"project-key\"),\n\t\t\t\"#bst\": aws.String(\"build-start-time\"),\n\t\t},\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":pkey\": {\n\t\t\t\tS: aws.String(project.Key()),\n\t\t\t},\n\t\t\t\":since\": {\n\t\t\t\tN: aws.String(fmt.Sprintf(\"%d\", since)),\n\t\t\t},\n\t\t},\n\t\tScanIndexForward: aws.Bool(false),\n\t\tLimit: aws.Int64(int64(limit)),\n\t}\n\n\tresp, err := c.db.Query(params)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"Error retrieving build information for project %s\\n\", project.Key()))\n\t}\n\n\tvar builds []v1.Build\n\tfor _, v := range resp.Items {\n\t\tbuildDuration, err := strconv.ParseUint(*v[\"build-duration\"].N, 10, 64)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"Error converting build-duration to ordinal value: %v\\n\", err)\n\t\t}\n\t\tbuildResult, err := strconv.ParseInt(*v[\"build-result\"].N, 10, 32)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"Error converting build-result to ordinal value: %v\\n\", err)\n\t\t}\n\t\tbuildTime, err := strconv.ParseUint(*v[\"build-start-time\"].N, 10, 64)\n\t\tif err != nil {\n\t\t\tc.logger.Printf(\"Error converting build-start-time to ordinal value: %v\\n\", err)\n\t\t}\n\n\t\tbuild := v1.Build{\n\t\t\tID: *v[\"build-id\"].S,\n\t\t\tProjectKey: *v[\"project-key\"].S,\n\t\t\tBranch: *v[\"branch\"].S,\n\t\t\tDuration: buildDuration,\n\t\t\tResult: int(buildResult),\n\t\t\tUnixTime: buildTime,\n\t\t}\n\t\tbuilds = append(builds, build)\n\t}\n\n\treturn builds, nil\n}", "title": "" } ]
9099d11823dda245c5c4476af99ec2fa
TestValidGetEnvValueForField1 ensures a correct response for getting hostname, env vars and an unmodified value
[ { "docid": "8cd4fffecbfa334039fe8c2ac2f62614", "score": "0.7712718", "text": "func TestValidGetEnvValueForField(t *testing.T) {\n\tosHostname = mockValidOsHostname\n\tosGetenv = mockValidOsGetenv\n\n\tfor _, dataToCheck := range []string{\"$HOSTNAME\", \"$ENV_VAR\", \"test_value\"} {\n\t\tcheckedData, err := getEnvValueForField(dataToCheck)\n\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error Encountered Getting Env Value For Field: %s\", err.Error())\n\t\t}\n\n\t\tif checkedData != \"test_value\" {\n\t\t\tt.Errorf(\"Value Does Not Match 'test_value': %s\", checkedData)\n\t\t}\n\t}\n\n}", "title": "" } ]
[ { "docid": "d90b8d8386390ec9d323f5269e6818e9", "score": "0.82046115", "text": "func TestValidGetEnvValueForField2(t *testing.T) {\n\tosHostname = mockInvalidOsHostname\n\n\tif _, err := getEnvValueForField(\"$HOSTNAME\"); err == nil {\n\t\tt.Errorf(\"Invalid Hostname Returned No Error\")\n\t}\n}", "title": "" }, { "docid": "351c936dc59800b26b68dac07b5c0ffa", "score": "0.80374813", "text": "func TestValidGetEnvValueForField3(t *testing.T) {\n\tosGetenv = mockInvalidOsGetenv\n\n\tif _, err := getEnvValueForField(\"$ENV_VAR\"); err == nil {\n\t\tt.Errorf(\"Invalid Hostname Returned No Error\")\n\t}\n}", "title": "" }, { "docid": "cbcea824185c332fa546460d02d3afc2", "score": "0.62380224", "text": "func assertEnv(ctx context.Context, client client.Client, spec corev1.PodSpec, component, container, key, expectedValue string) error {\n\tvalue, err := getEnv(ctx, client, spec, component, container, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif value != nil && strings.ToLower(*value) != expectedValue {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"%s=%s is not supported\", key, *value),\n\t\t\tcomponent: component,\n\t\t\tfix: fmt.Sprintf(\"remove the %s env var or set it to '%s'\", key, expectedValue),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a146c7316dc274b7386388d6418b5054", "score": "0.6137714", "text": "func TestEnvironmentGet(t *testing.T) {\n\tport := make(chan int, 1)\n\tdefer createTestServer(port, t).Close()\n\taddr := <-port\n\tresp, err := http.Get(fmt.Sprintf(\"http://localhost:%d/env/get\", addr))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\tbodyContent, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif string(bodyContent) != \"Testing env.set function\" {\n\t\tt.Fatalf(\"Wrong env.get value. Expected 'Testing env.set function' but got '%s'\", string(bodyContent))\n\t}\n}", "title": "" }, { "docid": "28ad9aaa63d4ce318cd603e289ec02a5", "score": "0.58855224", "text": "func TestParseEnvURLStr(t *testing.T) {\n\ttestCases := []struct {\n\t\thostURL string\n\t\taccessKey string\n\t\tsecretKey string\n\t\tsessionToken string\n\t\thostname string\n\t\tport string\n\t}{\n\t\t{\n\t\t\thostURL: \"https://minio:minio1#23@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\tsecretKey: \"minio1#23\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio:minio123@@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\tsecretKey: \"minio123@\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio:minio@123@@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\tsecretKey: \"minio@123@\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://localhost:9000\",\n\t\t\taccessKey: \"\",\n\t\t\tsecretKey: \"\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio:minio123:token@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\tsecretKey: \"minio123\",\n\t\t\tsessionToken: \"token\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio:minio@123:token@@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\tsecretKey: \"minio@123\",\n\t\t\tsessionToken: \"token@\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://minio:@localhost:9000\",\n\t\t\taccessKey: \"minio\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://:@localhost:9000\",\n\t\t\thostname: \"localhost\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://:minio123@localhost:9000\",\n\t\t\thostname: \"localhost\",\n\t\t\tsecretKey: \"minio123\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://:minio123:token@localhost:9000\",\n\t\t\thostname: \"localhost\",\n\t\t\tsecretKey: \"minio123\",\n\t\t\tsessionToken: \"token\",\n\t\t\tport: \"9000\",\n\t\t},\n\t\t{\n\t\t\thostURL: \"https://:minio123:@localhost:9000\",\n\t\t\thostname: \"localhost\",\n\t\t\tsecretKey: \"minio123\",\n\t\t\tport: \"9000\",\n\t\t},\n\t}\n\n\tfor _, testCase := range testCases {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\turl, ak, sk, token, err := parseEnvURLStr(testCase.hostURL)\n\t\t\tif testCase.accessKey != ak {\n\t\t\t\tt.Fatalf(\"Expected %s, got %s\", testCase.accessKey, ak)\n\t\t\t}\n\t\t\tif testCase.secretKey != sk {\n\t\t\t\tt.Fatalf(\"Expected %s, got %s\", testCase.secretKey, sk)\n\t\t\t}\n\t\t\tif testCase.sessionToken != token {\n\t\t\t\tt.Fatalf(\"Expected %s, got %s\", testCase.sessionToken, token)\n\t\t\t}\n\t\t\tif testCase.hostname != url.Hostname() {\n\t\t\t\tt.Fatalf(\"Expected %s, got %s\", testCase.hostname, url.Hostname())\n\t\t\t}\n\t\t\tif testCase.port != url.Port() {\n\t\t\t\tt.Fatalf(\"Expected %s, got %s\", testCase.port, url.Port())\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Expected test to pass. Failed with err %s\", err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "13702aff2fc818d1eca3aaefd387b75d", "score": "0.5863845", "text": "func GetEnv(w http.ResponseWriter, r *http.Request, status int) error {\n\tvar env string\n\tvname, ok := r.URL.Query()[\"vname\"]\n\tif ok && len(vname) > 0 {\n\t\tenv = os.Getenv(vname[0])\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(status)\n\tw.Write([]byte(env))\n\n\treturn nil\n}", "title": "" }, { "docid": "574da2e85d5823ca8f9257867f5e4f07", "score": "0.58092165", "text": "func mustGetEnv(t *testing.T, key string) string {\n\tt.Helper()\n\tval := os.Getenv(key)\n\trequire.NotEmpty(t, val, \"%s environment variable must be set and not empty\", key)\n\treturn val\n}", "title": "" }, { "docid": "4433da89bb63422f94c97812b4978d6d", "score": "0.5731409", "text": "func getEnvValue(w http.ResponseWriter, req *http.Request) {\n\tenvVar, ok := req.URL.Query()[\"var\"]\n\tif !ok {\n\t\terrMessage := \"variable \" + envVar[0] + \" not found\"\n\t\tfmt.Fprintf(w, errMessage)\n\t}\n\n\tvalue := os.Getenv(envVar[0])\n\tfmt.Fprintf(w, value+\"\\n\")\n}", "title": "" }, { "docid": "538afbed764ee5d1574f8b34b2d40635", "score": "0.57253426", "text": "func assertEnvIsSet(ctx context.Context, client client.Client, spec corev1.PodSpec, component, container, key, expectedValue string) error {\n\tvalue, err := getEnv(ctx, client, spec, component, container, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif value == nil || strings.ToLower(*value) != expectedValue {\n\t\treturn ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"%s=%s is not supported\", key, *value),\n\t\t\tcomponent: component,\n\t\t\tfix: fmt.Sprintf(\"remove the %s env var or set it to '%s'\", key, expectedValue),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2bb237b18094fefd57446c180465f7f8", "score": "0.57062495", "text": "func EnvVarTest(resourceName string, sourceType string, envString string) {\n\n\tif sourceType == \"git\" {\n\t\t// checking the values of the env vars pairs in bc\n\t\tenvVars := runCmd(\"oc get bc \" + resourceName + \" -o go-template='{{range .spec.strategy.sourceStrategy.env}}{{.name}}{{.value}}{{end}}'\")\n\t\tExpect(envVars).To(Equal(envString))\n\t}\n\n\t// checking the values of the env vars pairs in dc\n\tenvVars := runCmd(\"oc get dc \" + resourceName + \" -o go-template='{{range .spec.template.spec.containers}}{{range .env}}{{.name}}{{.value}}{{end}}{{end}}'\")\n\tExpect(envVars).To(Equal(envString))\n}", "title": "" }, { "docid": "c2252f4aa04841836f636b4aaaca72b9", "score": "0.5684333", "text": "func validateEnv(vars []corev1.EnvVar, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tfor i, ev := range vars {\n\t\tidxPath := fldPath.Index(i)\n\t\tif len(ev.Name) == 0 {\n\t\t\tallErrs = append(allErrs, field.Required(idxPath.Child(\"name\"), \"\"))\n\t\t} else {\n\t\t\tfor _, msg := range validation.IsEnvVarName(ev.Name) {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(idxPath.Child(\"name\"), ev.Name, msg))\n\t\t\t}\n\t\t}\n\t\tallErrs = append(allErrs, validateEnvVarValueFrom(ev, idxPath.Child(\"valueFrom\"))...)\n\t}\n\treturn allErrs\n}", "title": "" }, { "docid": "951c819f89436d34d2c86bdc15ab3a70", "score": "0.56511736", "text": "func reqEnv(name string) string {\n\tval := os.Getenv(name)\n\tif len(val) == 0 {\n\t\tlog.Fatalf(\"no %s environment variable set\", name)\n\t}\n\treturn val\n}", "title": "" }, { "docid": "c87b43e12561c7592c79513dc8feec06", "score": "0.5620053", "text": "func TestCreateWithEnv(t *testing.T) {\n\tcases := []struct {\n\t\tenvs map[string]string\n\t\texpectedError string\n\t\texpectedVersion string\n\t}{\n\t\t{\n\t\t\tenvs: map[string]string{},\n\t\t\texpectedVersion: \"v1.20\",\n\t\t},\n\t\t{\n\t\t\tenvs: map[string]string{\n\t\t\t\t\"DOCKER_CERT_PATH\": \"invalid/path\",\n\t\t\t},\n\t\t\texpectedError: \"Could not load X509 key pair: open invalid/path/cert.pem: no such file or directory\",\n\t\t},\n\t\t{\n\t\t\tenvs: map[string]string{\n\t\t\t\t\"DOCKER_HOST\": \"host\",\n\t\t\t},\n\t\t\texpectedError: \"unable to parse docker host\",\n\t\t},\n\t\t{\n\t\t\tenvs: map[string]string{\n\t\t\t\t\"DOCKER_HOST\": \"invalid://url\",\n\t\t\t},\n\t\t\texpectedVersion: \"v1.20\",\n\t\t},\n\t\t{\n\t\t\tenvs: map[string]string{\n\t\t\t\t\"DOCKER_API_VERSION\": \"anything\",\n\t\t\t},\n\t\t\texpectedVersion: \"anything\",\n\t\t},\n\t\t{\n\t\t\tenvs: map[string]string{\n\t\t\t\t\"DOCKER_API_VERSION\": \"1.22\",\n\t\t\t},\n\t\t\texpectedVersion: \"1.22\",\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\trecoverEnvs := setupEnvs(t, c.envs)\n\t\tapiclient, err := Create(Options{})\n\t\tif c.expectedError != \"\" {\n\t\t\tif err == nil || !strings.Contains(err.Error(), c.expectedError) {\n\t\t\t\tt.Errorf(\"expected an error '%s', got '%s', for %v\", c.expectedError, err.Error(), c)\n\t\t\t}\n\t\t} else {\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tversion := apiclient.ClientVersion()\n\t\t\tif version != c.expectedVersion {\n\t\t\t\tt.Errorf(\"expected %s, got %s, for %v\", c.expectedVersion, version, c)\n\t\t\t}\n\t\t}\n\t\trecoverEnvs(t)\n\t}\n}", "title": "" }, { "docid": "9eb39a78bb56b4a688c6f8ece98b3d80", "score": "0.56101716", "text": "func validateAndGetEnvVars() (*environmentVariables, error) {\n\tenvVars := &environmentVariables{}\n\tuploadAPIURL := os.Getenv(\"UPLOAD_API_URL\")\n\tif len(uploadAPIURL) == 0 {\n\t\treturn nil, errors.Errorf(\"UPLOAD_API_URL environment variable is not set\")\n\t}\n\tenvVars.UploadAPIURL = uploadAPIURL\n\n\tpostAPIURL := os.Getenv(\"POST_API_URL\")\n\tif len(postAPIURL) == 0 {\n\t\treturn nil, errors.Errorf(\"POST_API_URL environment variable is not set\")\n\t}\n\tenvVars.PostAPIURL = postAPIURL\n\n\tmattermostDeployments := os.Getenv(\"MATTERMOST_DEPLOYMENTS\")\n\tif len(mattermostDeployments) == 0 {\n\t\tenvVars.MattermostDeployments = []string{}\n\t} else {\n\t\tenvVars.MattermostDeployments = strings.Split(mattermostDeployments, \",\")\n\t}\n\n\tmattermostNamespace := os.Getenv(\"MATTERMOST_NAMESPACE\")\n\tif len(mattermostNamespace) == 0 {\n\t\treturn nil, errors.Errorf(\"CHANNEL_ID environment variable is not set.\")\n\t}\n\tenvVars.MattermostNamespace = mattermostNamespace\n\n\tprofilingTime := os.Getenv(\"PROFILING_TIME\")\n\tif len(profilingTime) == 0 {\n\t\treturn nil, errors.Errorf(\"PROFILING_TIME environment variable is not set.\")\n\t}\n\tenvVars.ProfilingTime = profilingTime\n\n\tchannelID := os.Getenv(\"CHANNEL_ID\")\n\tif len(channelID) == 0 {\n\t\treturn nil, errors.Errorf(\"CHANNEL_ID environment variable is not set.\")\n\t}\n\tenvVars.ChannelID = channelID\n\n\ttoken := os.Getenv(\"TOKEN\")\n\tif len(token) == 0 {\n\t\treturn nil, errors.Errorf(\"TOKEN environment variable is not set.\")\n\t}\n\tenvVars.Token = token\n\n\tdeveloperMode := os.Getenv(\"DEVELOPER_MODE\")\n\tif len(developerMode) == 0 {\n\t\tenvVars.DevMode = \"false\"\n\t} else {\n\t\tenvVars.DevMode = developerMode\n\t}\n\n\treturn envVars, nil\n}", "title": "" }, { "docid": "f111bd6d8fdceaa7e48878cde0ffe893", "score": "0.55942714", "text": "func testGetenv(s string) string {\n\tswitch s {\n\tcase \"*\":\n\t\treturn \"all the args\"\n\tcase \"#\":\n\t\treturn \"NARGS\"\n\tcase \"$\":\n\t\treturn \"PID\"\n\tcase \"1\":\n\t\treturn \"ARGUMENT1\"\n\tcase \"HOME\":\n\t\treturn \"/usr/gopher\"\n\tcase \"H\":\n\t\treturn \"(Value of H)\"\n\tcase \"home_1\":\n\t\treturn \"/usr/foo\"\n\tcase \"_\":\n\t\treturn \"underscore\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a109412c15a0517d0b1d6e3e57cf91ef", "score": "0.5575708", "text": "func checkEnv(envVar string) string {\n\tv := os.Getenv(envVar)\n\tif v == \"\" {\n\t\tlog.Panicf(\"%s environment variable not set.\", envVar)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "70c770e1049bf0dd223748b4f9ab0630", "score": "0.55704486", "text": "func (r *CheckedDaemonSet) assertEnv(ctx context.Context, client client.Client, container, key, expectedValue string) error {\n\tif err := assertEnv(ctx, client, r.Spec.Template.Spec, ComponentCalicoNode, container, key, expectedValue); err != nil {\n\t\treturn err\n\t}\n\tr.ignoreEnv(container, key)\n\treturn nil\n}", "title": "" }, { "docid": "03ae10d1e817c01189030efc1250f175", "score": "0.555133", "text": "func ValidateEnv(val string) (string, error) {\n\tarr := strings.Split(val, \"=\")\n\tif arr[0] == \"\" {\n\t\treturn \"\", errors.New(fmt.Sprintf(\"invalid environment variable: %s\", val))\n\t}\n\tif len(arr) > 1 {\n\t\treturn val, nil\n\t}\n\tif !doesEnvExist(val) {\n\t\treturn val, nil\n\t}\n\treturn fmt.Sprintf(\"%s=%s\", val, os.Getenv(val)), nil\n}", "title": "" }, { "docid": "4f63f74a46d9085266f095c794e094ca", "score": "0.5545417", "text": "func getEnv(env, devaultValue string) string {\n\tvalue := os.Getenv(env)\n\tif value == \"\" {\n\t\treturn devaultValue\n\t}\n\treturn value\n}", "title": "" }, { "docid": "4f63f74a46d9085266f095c794e094ca", "score": "0.5545417", "text": "func getEnv(env, devaultValue string) string {\n\tvalue := os.Getenv(env)\n\tif value == \"\" {\n\t\treturn devaultValue\n\t}\n\treturn value\n}", "title": "" }, { "docid": "a5b9da68d1dd4c7e378d031aa5f65066", "score": "0.5501676", "text": "func MatchHostsEnv(k string) bool {\n\n\tkey := strings.TrimPrefix(k, \"/\")\n\tkeyEnv := strings.Split(key, \"/\")\n\tif len(keyEnv) > 3 {\n\t\tif (keyEnv[2] == os.Getenv(\"VINE_ENV\")) && (keyEnv[3] == \"hosts\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4f74d75e37ecf2a08bff214cf30c6e56", "score": "0.5481748", "text": "func requireEnv(envVar string) string {\n\tval, _ := getEnv(envVar, true)\n\treturn val\n}", "title": "" }, { "docid": "e9dc9ca3fb5418f167c99f707596b540", "score": "0.546612", "text": "func TestEnvVars(t *testing.T) {\n\t// Arrange\n\tos.Setenv(snapEnv, \"/snap/testsnap/x1\")\n\tos.Setenv(snapCommonEnv, \"/snap/testsnap/common\")\n\tos.Setenv(snapDataEnv, \"/var/snap/testsnap/x1\")\n\tos.Setenv(snapInstNameEnv, \"testsnap\")\n\tos.Setenv(snapRevEnv, \"2112\")\n\n\t// Test\n\terr := getEnvVars()\n\n\t// Assert values\n\tassert.Nil(t, err)\n\tassert.Equal(t, Snap, \"/snap/testsnap/x1\")\n\tassert.Equal(t, SnapCommon, \"/snap/testsnap/common\")\n\tassert.Equal(t, SnapData, \"/var/snap/testsnap/x1\")\n\tassert.Equal(t, SnapInst, \"testsnap\")\n\tassert.Equal(t, SnapRev, \"2112\")\n\tassert.Equal(t, SnapConf, \"/snap/testsnap/x1/config\")\n\tassert.Equal(t, SnapDataConf, \"/var/snap/testsnap/x1/config\")\n}", "title": "" }, { "docid": "460c1fc37f03a00ec12019356a0294c0", "score": "0.543391", "text": "func env(key string, fallback string) string {\n\tif v := os.Getenv(key); v != \"\" {\n\t\treturn v\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "a958d10dcd38ab4abf0e4faab27d183b", "score": "0.5411315", "text": "func getEnvFun(args ...object.Object) object.Object {\n\tif len(args) != 1 {\n\t\treturn newError(\"wrong number of arguments. got=%d, want=1\",\n\t\t\tlen(args))\n\t}\n\tif args[0].Type() != object.STRING_OBJ {\n\t\treturn newError(\"argument must be a string, got=%s\",\n\t\t\targs[0].Type())\n\t}\n\tinput := args[0].(*object.String).Value\n\treturn &object.String{Value: os.Getenv(input)}\n\n}", "title": "" }, { "docid": "15e38c2dea21ca5721c8f6f02c630f3b", "score": "0.5410748", "text": "func (a *Client) GetCredentialByEnvironmentNameV1(params *GetCredentialByEnvironmentNameV1Params) (*GetCredentialByEnvironmentNameV1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCredentialByEnvironmentNameV1Params()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getCredentialByEnvironmentNameV1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/credentials/environment/name/{environmentName}\",\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: &GetCredentialByEnvironmentNameV1Reader{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.(*GetCredentialByEnvironmentNameV1OK), nil\n\n}", "title": "" }, { "docid": "924d6af4ae2dcdfe272192bbb5db3a9b", "score": "0.54096013", "text": "func getUrlFromEnv(t *testing.T, key string) string {\n\turl := os.Getenv(key)\n\tif url == \"\" {\n\t\tt.Fatalf(\"Please set the environment variable: %s\\n\", key)\n\t}\n\treturn url\n}", "title": "" }, { "docid": "541f205d0ec93d7f701e415016a9e97c", "score": "0.5404287", "text": "func getEnvOrFail(envVar string) string {\n\tvalue := os.Getenv(envVar)\n\tif value == \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"Error: environment variable %s doesn't exist or it's empty, set it and try it again\", envVar)\n\t\tos.Exit(1)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "4c3396148445b24fb1959f32c3100d28", "score": "0.5388516", "text": "func getCleanedEnv(envKey string) (value string) {\n\tvalue = os.Getenv(envKey)\n\tvalue = strings.TrimSpace(value)\n\tvalue = strings.TrimSuffix(value, \"\\r\\n\")\n\tvalue = strings.TrimSuffix(value, \"\\n\")\n\treturn value\n}", "title": "" }, { "docid": "38061b2ae186758cad8fef36ba639b69", "score": "0.5387432", "text": "func getEnv(env, value string) string {\n\tif v := os.Getenv(env); v != \"\" {\n\t\treturn v\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "4bbd405a2896a98db4ba775fa9a6b08f", "score": "0.5384708", "text": "func Getenv(key string) string", "title": "" }, { "docid": "27eec0107d3d112fc9fb10862f1b31cf", "score": "0.5379508", "text": "func getEnvRequired(envVar string) string {\n\tval := strings.TrimSpace(os.Getenv(envVar))\n\n\tif val == \"\" {\n\t\tlog.Fatalf(\"required environmental variable %q not set, exiting.\", envVar)\n\t}\n\n\tlog.Debugf(\"%s set to: %s\", envVar, val)\n\n\treturn val\n}", "title": "" }, { "docid": "c1042ac7f9419fe64ce673db3fef10ce", "score": "0.53728133", "text": "func TestEnviron(t *testing.T) {\n\ttests := map[string]string{\n\t\t\"KEY_0\": \"Abc\",\n\t\t\"KEY_1\": \"Def\",\n\t}\n\n\t// Set test data.\n\tos.Clearenv()\n\tfor key, value := range tests {\n\t\tif err := os.Setenv(key, value); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\t// Test function.\n\tfor i, str := range Environ() {\n\t\ttmp := strings.Split(str, \"=\")\n\t\tkey, value := tmp[0], tmp[1]\n\t\tif v, ok := tests[key]; v != value || !ok {\n\t\t\tif !ok {\n\t\t\t\tt.Errorf(\"test %v. extra key`%v`\", i, key)\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"test %v. expected `%v` but `%v`\", i, v, value)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "316a4b157e9bfe203608bd6ccc7f4bf7", "score": "0.5366439", "text": "func env() error {\n\t// regexp for TF_VAR_ terraform vars\n\ttfVar := regexp.MustCompile(`^TF_VAR_.*$`)\n\n\t// match terraform vars in environment\n\tfor _, e := range os.Environ() {\n\t\t// split on value\n\t\tpair := strings.SplitN(e, \"=\", 2)\n\n\t\t// match on TF_VAR_*\n\t\tif tfVar.MatchString(pair[0]) {\n\t\t\t// pull out the name\n\t\t\tname := strings.Split(pair[0], \"TF_VAR_\")\n\n\t\t\t// lower case the terraform variable\n\t\t\t// to accommodate cicd injection capitalization\n\t\t\terr := os.Setenv(fmt.Sprintf(\"TF_VAR_%s\",\n\t\t\t\tstrings.ToLower(name[1])), pair[1])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "046eb7c1b74c3253769b01f48b54bb22", "score": "0.5363387", "text": "func mustEnv(key string, value *string, defaultVal string) {\r\n\tif *value = os.Getenv(key); *value == \"\" {\r\n\t\t*value = defaultVal\r\n\t\tfmt.Printf(\"%s env variable not set, using default value.\\n\", key)\r\n\t}\r\n}", "title": "" }, { "docid": "08cb033359215cd7146f28af921c1c8f", "score": "0.53590333", "text": "func (m *wasiSnapshotPreview1Impl) environGet(penviron pointer, penvironBuf pointer) (err wasiErrno) {\n\tfor _, s := range m.env {\n\t\tbuf := m.bytes(penvironBuf)\n\t\tcopy(buf, s)\n\t\tbuf[len(s)] = 0\n\n\t\tm.putUint32(uint32(penvironBuf), penviron)\n\t\tpenvironBuf, penviron = penvironBuf+pointer(len(s))+1, penviron+4\n\t}\n\treturn wasiErrnoSuccess\n}", "title": "" }, { "docid": "b89bb9e7d72ab6d50edf50295fdd0429", "score": "0.53512603", "text": "func (field *Field) SetValueFromEnv() {\n\tif len(field.KeyName) > 0 {\n\t\tfield.EnvText, _ = LookupEnv(field.KeyName)\n\t}\n\tif len(field.EnvText) != 0 {\n\t\tfield.Value = field.EnvText\n\t}\n}", "title": "" }, { "docid": "723d61843652e67aeed13ad5290dcfa0", "score": "0.5337622", "text": "func TestEnvironment_DashesInTaskName(t *testing.T) {\n\ta := mock.Alloc()\n\ttask := a.Job.TaskGroups[0].Tasks[0]\n\ttask.Env = map[string]string{\"test-one-two\": \"three-four\"}\n\tenvMap := NewBuilder(mock.Node(), a, task, \"global\").Build().Map()\n\n\tif envMap[\"test_one_two\"] != \"three-four\" {\n\t\tt.Fatalf(\"Expected test_one_two=three-four in TaskEnv; found:\\n%#v\", envMap)\n\t}\n}", "title": "" }, { "docid": "3e2fe7229a0742e01daab68f4faa3552", "score": "0.53320354", "text": "func getEnv(ctx context.Context, client client.Client, pts v1.PodSpec, component, container, key string) (*string, error) {\n\tc := getContainer(pts, container)\n\tif c == nil {\n\t\treturn nil, ErrIncompatibleCluster{\n\t\t\terr: fmt.Sprintf(\"couldn't find container '%s' in %s\", container, component),\n\t\t\tcomponent: component,\n\t\t\tfix: fmt.Sprintf(\"restore the %s container if you've renamed or removed it\", container),\n\t\t}\n\t}\n\n\tfor _, e := range c.Env {\n\t\tif e.Name == key {\n\t\t\tif e.ValueFrom == nil {\n\t\t\t\treturn &e.Value, nil\n\t\t\t}\n\t\t\tif e.ValueFrom.ConfigMapKeyRef != nil {\n\t\t\t\tcm := v1.ConfigMap{}\n\t\t\t\terr := client.Get(ctx, types.NamespacedName{\n\t\t\t\t\tName: e.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name,\n\t\t\t\t\tNamespace: \"kube-system\",\n\t\t\t\t}, &cm)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tv := cm.Data[e.ValueFrom.ConfigMapKeyRef.Key]\n\t\t\t\treturn &v, nil\n\t\t\t}\n\n\t\t\treturn nil, ErrIncompatibleCluster{\n\t\t\t\terr: fmt.Sprintf(\"failed to read %s/%s: only configMapRef & explicit values supported for env vars at this time\", container, key),\n\t\t\t\tcomponent: \"\",\n\t\t\t\tfix: fmt.Sprintf(\"adjust %s to be an explicit value or configMapRef\", key),\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "ee4dd4153f59b50f373e74f9041e222c", "score": "0.5320848", "text": "func tmplENV(keys ...string) (value string) {\n\tswitch len(keys) {\n\tcase 1:\n\t\tvalue = os.Getenv(keys[0])\n\tcase 2:\n\t\tvalue = os.Getenv(keys[0])\n\t\tif value == \"\" {\n\t\t\tvalue = keys[1]\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e1f6e03d63ace27bad04e6228910701", "score": "0.5288124", "text": "func environ(envVars []*apiclient.EnvEntry) []string {\n\tvar environ []string\n\tfor _, item := range envVars {\n\t\tif item != nil && item.Name != \"\" && item.Value != \"\" {\n\t\t\tenviron = append(environ, fmt.Sprintf(\"%s=%s\", item.Name, item.Value))\n\t\t}\n\t}\n\treturn environ\n}", "title": "" }, { "docid": "f8f580dadefaf18a0a155bf8cb5b80a3", "score": "0.5288021", "text": "func (a *DefaultApiService) ProjectUsernameProjectEnvvarGet(ctx context.Context, username string, project string) (Envvars, *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 \tsuccessPayload Envvars\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/project/{username}/{project}/envvar\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project\"+\"}\", fmt.Sprintf(\"%v\", project), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json; charset=utf-8\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\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\tlocalVarQueryParams.Add(\"circle-token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "3261e17e37c81e620651cd47ec49ea53", "score": "0.5279593", "text": "func parseEnv(env string) (string, string, error) {\n\tparts := strings.SplitN(env, \"=\", 2)\n\tif len(parts) != 2 {\n\t\treturn \"\", \"\", errors.Errorf(\"environment variable must contain '=': %s\", env)\n\t}\n\n\tname, value := parts[0], parts[1]\n\tif name == \"\" {\n\t\treturn \"\", \"\", errors.Errorf(\"environment variable must have non-empty name: %s\", env)\n\t}\n\treturn name, value, nil\n}", "title": "" }, { "docid": "b1726333bad01c300f592f6884afdeee", "score": "0.526666", "text": "func getEnv(envVar string, require bool) (val string, ok bool) {\n\tif val, ok = os.LookupEnv(envVar); !ok {\n\t\tif require {\n\t\t\tpanic(fmt.Sprintf(\"env: missing required environment variable: %s\", envVar))\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a208e339bbd6cd07ae893c7179425533", "score": "0.5264737", "text": "func getEnvKeyValue(match string, partial bool) (string, string, error) {\n\tfor _, e := range os.Environ() {\n\t\tpair := strings.Split(e, \"=\")\n\t\tif len(pair) != 2 {\n\t\t\tcontinue\n\t\t}\n\n\t\tkey := pair[0]\n\t\tvalue := pair[1]\n\n\t\tif partial && strings.Contains(key, match) {\n\t\t\treturn key, value, nil\n\t\t}\n\n\t\tif strings.Compare(key, match) == 0 {\n\t\t\treturn key, value, nil\n\t\t}\n\t}\n\n\tmatchType := \"match\"\n\tif partial {\n\t\tmatchType = \"partial match\"\n\t}\n\n\treturn \"\", \"\", fmt.Errorf(\"Failed to find %s with %s\", matchType, match)\n}", "title": "" }, { "docid": "52b60b057353667c2b9f0d92a8a8a174", "score": "0.5259897", "text": "func GetEnvStr(key, def string) string {\n\tif value := os.Getenv(key); value != \"\" {\n\t\treturn value\n\t}\n\treturn def\n}", "title": "" }, { "docid": "7e1eb6aa82d2836ff1af90444ef19b77", "score": "0.5259097", "text": "func MustGetEnv(key string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tLogFail(fmt.Sprintf(\"%s not set!\", key))\n\t}\n\treturn value\n}", "title": "" }, { "docid": "0f9c1282ac5f400428a2208f217717e6", "score": "0.52393824", "text": "func env(key string, defaultValue string) string {\n\tvalue := os.Getenv(key)\n\n\tif len(value) > 0 {\n\t\treturn value\n\t}\n\treturn defaultValue\n\n}", "title": "" }, { "docid": "05ddd0c4c025a6fe6f59cf68c8254032", "score": "0.52371895", "text": "func parseEnvURL(envURL string) (*url.URL, string, string, *probe.Error) {\n\tu, e := url.Parse(envURL)\n\tif e != nil {\n\t\treturn nil, \"\", \"\", probe.NewError(e).Trace(envURL)\n\t}\n\n\tvar accessKey, secretKey string\n\t// Check if username:password is provided in URL, with no\n\t// access keys or secret we proceed and perform anonymous\n\t// requests.\n\tif u.User != nil {\n\t\taccessKey = u.User.Username()\n\t\tsecretKey, _ = u.User.Password()\n\t}\n\n\t// Look for if URL has invalid values and return error.\n\tif !((u.Scheme == \"http\" || u.Scheme == \"https\") &&\n\t\t(u.Path == \"/\" || u.Path == \"\") && u.Opaque == \"\" &&\n\t\tu.ForceQuery == false && u.RawQuery == \"\" && u.Fragment == \"\") {\n\t\treturn nil, \"\", \"\", errInvalidArgument().Trace(u.String())\n\t}\n\n\t// Now that we have validated the URL to be in expected style.\n\tu.User = nil\n\n\treturn u, accessKey, secretKey, nil\n}", "title": "" }, { "docid": "7d821ff60ae6b6132fdd6d4afd7f0c1f", "score": "0.5236652", "text": "func getenvRequired(key string) string {\n\tvalue := os.Getenv(key)\n\tif value == \"\" {\n\t\tPtEnvError(fmt.Sprintf(\"no %s environment variable\", key))\n\t}\n\treturn value\n}", "title": "" }, { "docid": "93e490eca1635316bc47f27b3a148221", "score": "0.5232709", "text": "func LookupEnv(key string) (string, bool)", "title": "" }, { "docid": "8fc6f1b676e5061e95004cbfb206cbc1", "score": "0.5231756", "text": "func isALPNConnUpgradeRequiredByEnv(addr, envValue string) bool {\n\ttokens := strings.FieldsFunc(envValue, func(r rune) bool {\n\t\treturn r == ';' || r == ','\n\t})\n\n\tvar upgradeRequiredForAll bool\n\tfor _, token := range tokens {\n\t\tswitch {\n\t\tcase strings.ContainsRune(token, '='):\n\t\t\tif _, boolText, ok := strings.Cut(token, addr+\"=\"); ok {\n\t\t\t\tupgradeRequiredForAddr, err := utils.ParseBool(boolText)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Debugf(\"Failed to parse %v: %v\", envValue, err)\n\t\t\t\t}\n\t\t\t\treturn upgradeRequiredForAddr\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif boolValue, err := utils.ParseBool(token); err != nil {\n\t\t\t\tlogrus.Debugf(\"Failed to parse %v: %v\", envValue, err)\n\t\t\t} else {\n\t\t\t\tupgradeRequiredForAll = boolValue\n\t\t\t}\n\t\t}\n\t}\n\treturn upgradeRequiredForAll\n}", "title": "" }, { "docid": "24bdacd02960f23a94a1b79373b645fc", "score": "0.5230515", "text": "func GetENV(experimentDetails *experimentTypes.ExperimentDetails) {\n\texperimentDetails.ExperimentName = Getenv(\"EXPERIMENT_NAME\", \"\")\n\texperimentDetails.AppNS = Getenv(\"APP_NS\", \"\")\n\texperimentDetails.TargetContainer = Getenv(\"APP_CONTAINER\", \"\")\n\texperimentDetails.TargetPods = Getenv(\"APP_POD\", \"\")\n\texperimentDetails.AppLabel = Getenv(\"APP_LABEL\", \"\")\n\texperimentDetails.ChaosDuration, _ = strconv.Atoi(Getenv(\"TOTAL_CHAOS_DURATION\", \"30\"))\n\texperimentDetails.ChaosNamespace = Getenv(\"CHAOS_NAMESPACE\", \"litmus\")\n\texperimentDetails.EngineName = Getenv(\"CHAOS_ENGINE\", \"\")\n\texperimentDetails.ChaosUID = clientTypes.UID(Getenv(\"CHAOS_UID\", \"\"))\n\texperimentDetails.ChaosPodName = Getenv(\"POD_NAME\", \"\")\n\texperimentDetails.ContainerRuntime = Getenv(\"CONTAINER_RUNTIME\", \"\")\n\texperimentDetails.NetworkInterface = Getenv(\"NETWORK_INTERFACE\", \"eth0\")\n\texperimentDetails.TargetIPs = Getenv(\"TARGET_IPs\", \"\")\n}", "title": "" }, { "docid": "599442fa7f2169d93953fd3e157ea44e", "score": "0.52235144", "text": "func Getenv(env []string, key string) string {\n\tif len(key) == 0 {\n\t\treturn \"\"\n\t}\n\n\tprefix := strings.ToLower(key + \"=\")\n\tfor _, pair := range env {\n\t\tif len(pair) > len(prefix) && prefix == strings.ToLower(pair[:len(prefix)]) {\n\t\t\treturn pair[len(prefix):]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "81cb7197f4901ab8b7c21d7af22f517a", "score": "0.5218438", "text": "func (r *CheckedDaemonSet) getEnv(ctx context.Context, client client.Client, container string, key string) (*string, error) {\n\tv, err := getEnv(ctx, client, r.Spec.Template.Spec, ComponentCalicoNode, container, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.ignoreEnv(container, key)\n\n\treturn v, nil\n}", "title": "" }, { "docid": "0f57cbdce89174e8e699dc7d340bd0b8", "score": "0.52183235", "text": "func Getenv(key string, fallbacks ...string) (value string) {\n\tvalue, _ = LookupEnv(key, fallbacks...)\n\treturn\n}", "title": "" }, { "docid": "43006471dc4ddf72ec7d7080eacc29e4", "score": "0.52160746", "text": "func TestGetEnvAsInt32(t *testing.T) {\n for i := 0; i < len(testInt32s); i++ {\n // set environment variables\n if testInt32s[i].ShouldSet {\n os.Setenv(\n testInt32s[i].Key,\n testInt32s[i].Value,\n )\n }\n\n // get environment variables\n if v := GetEnvAsInt32(\n testInt32s[i].Key,\n testInt32s[i].Default,\n ); v != testInt32s[i].Expected {\n t.Errorf(\n \"ENV %s is %d; expected %d\",\n testInt32s[i].Key,\n v,\n testInt32s[i].Expected,\n )\n }\n }\n}", "title": "" }, { "docid": "6b89f66b724e85c1f76cefc6edf85929", "score": "0.52126783", "text": "func getEnv(key string) string {\r\n\tvalue, exists := os.LookupEnv(key)\r\n\tif !exists {\r\n\t\tvalue = readInput(key)\r\n\t}\r\n\treturn value\r\n}", "title": "" }, { "docid": "71bb3aa53f70387b27db10f38f3409da", "score": "0.5209868", "text": "func (a *DefaultApiService) ProjectUsernameProjectEnvvarNameGet(ctx context.Context, username string, project string, name string) (Envvar, *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 \tsuccessPayload Envvar\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/project/{username}/{project}/envvar/{name}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project\"+\"}\", fmt.Sprintf(\"%v\", project), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json; charset=utf-8\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\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\tlocalVarQueryParams.Add(\"circle-token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "dec7fb5c62cf7e98d8f4ebfc339e0008", "score": "0.52039886", "text": "func validateVariable(value string, envName string) {\n\tif len(value) == 0 {\n\t\tlog.Printf(\"The environment variable %s has not been set\", envName)\n\t} else {\n\t\tlog.Printf(\"The environment variable %s is %s\", envName, value)\n\t}\n}", "title": "" }, { "docid": "10dcdc064b06736e41dfb76ba7728fe2", "score": "0.5197194", "text": "func (lkp OsEnvVariableLookuper) GetEnv(envVarName string) string {\n\tif TestingEnvVariableLookup != nil {\n\t\treturn TestingEnvVariableLookup.GetEnv(envVarName)\n\t}\n\n\treturn GetEnv(envVarName)\n}", "title": "" }, { "docid": "8a37a4c97a30ee9e296eff7259cdf938", "score": "0.51945204", "text": "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "8a37a4c97a30ee9e296eff7259cdf938", "score": "0.51945204", "text": "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "8a37a4c97a30ee9e296eff7259cdf938", "score": "0.51945204", "text": "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "8a37a4c97a30ee9e296eff7259cdf938", "score": "0.51945204", "text": "func getEnv(key, fallback string) string {\n\tvalue := os.Getenv(key)\n\tif len(value) == 0 {\n\t\treturn fallback\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "e75934d8127ed44e21f52ed351ebc4fd", "score": "0.5188403", "text": "func checkEnvVar(envVars *map[string]string) error {\n\tvar missingVars []string\n\tfor name, v := range *envVars {\n\t\tif v == \"\" {\n\t\t\tmissingVars = append(missingVars, name)\n\t\t}\n\t}\n\tif len(missingVars) > 0 {\n\t\treturn fmt.Errorf(\"Missing environment variables %v\", missingVars)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32b209ff9852c373f25ec3eb2e3a0144", "score": "0.51718384", "text": "func (m *MockTenantPluginVersionEnvDao) GetVersionEnvByEnvName(serviceID, pluginID, envName string) (*model.TenantPluginVersionEnv, error) {\n\tret := m.ctrl.Call(m, \"GetVersionEnvByEnvName\", serviceID, pluginID, envName)\n\tret0, _ := ret[0].(*model.TenantPluginVersionEnv)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1aace66d043e465336828c85396a8f1c", "score": "0.51711226", "text": "func (q BaseQuestion) GetEnvInfo(lang string) (info []string, err error) {\n\ts, err := strconv.Unquote(strconv.Quote(q.EnvInfo))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tm := make(map[string][]string)\n\tif err = json.Unmarshal([]byte(s), &m); err != nil {\n\t\treturn\n\t}\n\n\tif temp, ok := m[lang]; ok && len(temp) != 0 {\n\t\tinfo = temp\n\t}\n\treturn\n}", "title": "" }, { "docid": "ccbc5c35e134fe7578b049b9c7e62b0f", "score": "0.517034", "text": "func getRequiredEnv(key string) string {\n\tvalue, exists := os.LookupEnv(key)\n\tif !exists {\n\t\tlogrus.Fatalf(\"Environment variable not set: %s\", key)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "91ed965817d5530124f8e0f488e651e9", "score": "0.5169754", "text": "func mustGetEnv(name string) string {\n\tenv, ok := os.LookupEnv(name)\n\tif !ok {\n\t\tlog.WithField(\"env\", name).Fatalf(\"missing required environment variable for configuration\")\n\t}\n\tlog.WithField(name, env).Info(\"using env variable\")\n\treturn env\n}", "title": "" }, { "docid": "111ff32ac90fdc8f9fc9d646b64c8b0c", "score": "0.51695013", "text": "func mustGetenv(name string) string {\n\tvalue := os.Getenv(name)\n\tif value == \"\" {\n\t\tpanic(name + \" not defined in environment\")\n\t}\n\treturn value\n}", "title": "" }, { "docid": "06ff6e712241bae19ab50a4bd8dab808", "score": "0.5164464", "text": "func TestGetCredentials_EnvVars(t *testing.T) {\n\tcredentialChain = nil\n\t// unset any env var credentials on system to run this test\n\torigAKID := os.Getenv(\"AWS_ACCESS_KEY_ID\")\n\torigSecret := os.Getenv(\"AWS_SECRET_ACCESS_KEY\")\n\tos.Setenv(\"AWS_ACCESS_KEY_ID\", \"TESTKEYID\")\n\tos.Setenv(\"AWS_SECRET_ACCESS_KEY\", \"TESTSECRET\")\n\t// reset before exiting\n\tdefer os.Setenv(\"AWS_ACCESS_KEY_ID\", origAKID)\n\tdefer os.Setenv(\"AWS_SECRET_ACCESS_KEY\", origSecret)\n\n\tcreds := GetCredentials(false)\n\trequire.NotNil(t, creds)\n\tv, err := creds.Get()\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"EnvProvider\", v.ProviderName)\n\trequire.Equal(t, \"TESTKEYID\", v.AccessKeyID)\n\trequire.Equal(t, \"TESTSECRET\", v.SecretAccessKey)\n}", "title": "" }, { "docid": "e31d3bd5cc055af251ca84c71d956340", "score": "0.51589864", "text": "func getEnvString(env string, def string) string {\n\tval := os.Getenv(env)\n\tif len(val) == 0 {\n\t\treturn def\n\t}\n\treturn val\n}", "title": "" }, { "docid": "d03a81074be7d17c277ec1e717a29b76", "score": "0.51583105", "text": "func TestGet(t *testing.T) {\n\ttests := []struct {\n\t\tkey string\n\t\tvalue string\n\t}{\n\t\t{\"KEY_0\", \"Abc\"},\n\t\t{\"KEY_1\", \"Def\"},\n\t}\n\n\t// Call methods from os module to set test\n\t// variables to the environment.\n\tos.Clearenv()\n\tfor _, test := range tests {\n\t\tos.Setenv(test.key, test.value)\n\t}\n\n\t// Test the method.\n\tfor _, test := range tests {\n\t\tif v := Get(test.key); v != test.value {\n\t\t\tt.Errorf(\"expected `%s` but `%s`\", test.value, v)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6f9c5c29b370f50186346723b72576e8", "score": "0.5138997", "text": "func TestEnv(t *testing.T) {\n\tvar tests = []struct {\n\t\tpathVal string\n\t\tnels int\n\t\terr error\n\t}{\n\t\t{\"\", 0, ErrEmptyEnv},\n\t\t{\"a\", 1, nil},\n\t\t{\"A:B\", 2, nil},\n\t}\n\tfor _, tst := range tests {\n\t\tt.Logf(\"tst %v\", tst)\n\t\tif err := os.Setenv(\"PATH\", tst.pathVal); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\te, err := NewPathCompleter()\n\t\tif tst.err != err {\n\t\t\tt.Errorf(\"tst %v: got %v, want %v\", tst, err, tst.err)\n\t\t\tcontinue\n\t\t}\n\t\tt.Logf(\"NewPathCompleter returns %v, %v\", e, err)\n\t\tif tst.nels == 0 && e != nil {\n\t\t\tt.Errorf(\"tst %v: got %v, want nil\", tst, e)\n\t\t\tcontinue\n\t\t}\n\t\tif tst.nels == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif e == nil {\n\t\t\tt.Errorf(\"tst %v: got nil, want MultiCompleter\", tst)\n\t\t\tcontinue\n\t\t}\n\t\tnels := len(e.(*MultiCompleter).Completers)\n\t\tif nels != tst.nels {\n\t\t\tt.Errorf(\"tst %v: got %d els, want %d\", tst, nels, tst.nels)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eb2c8b71fe2f548fbc715da9a360b24f", "score": "0.513609", "text": "func getEnv(key string, fallback string) string {\n\tif value, ok := os.LookupEnv(key); ok {\n\t\tif value != \"\" {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "51bb9949eb003c03875c9302b2d64c8d", "score": "0.5132416", "text": "func mockEnvValue(key, val string, fn func()) {\n\told := os.Getenv(key)\n\t_ = os.Setenv(key, val)\n\n\tfn()\n\n\tif old != \"\" {\n\t\t_ = os.Setenv(key, old)\n\t}\n}", "title": "" }, { "docid": "26c9e89513ed2d2d41b1fe92451817a2", "score": "0.51308775", "text": "func (s RunSpec) GetEnv() (env []string) {\n\tif s.Environment == nil {\n\t\ts.Environment = make(map[string]string)\n\t}\n\n\ts.Environment[\"RANNA_HOSTDIR\"] = s.HostDir\n\n\tenv = make([]string, len(s.Environment))\n\ti := 0\n\tfor k, v := range s.Environment {\n\t\tenv[i] = fmt.Sprintf(`%s=%s`, k, v)\n\t\ti++\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c407637f09fb0834910c659cd7110724", "score": "0.5127596", "text": "func GetenvString(key, fallback string) string {\n\tif v, ok := syscall.Getenv(key); ok {\n\t\treturn v\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "5c5c2678138b2e76662c9f0dc7c8fca5", "score": "0.5126743", "text": "func GetEnvStr(name, def string) (res string) {\n\tres = def\n\n\ts := os.Getenv(name)\n\tif len(s) > 0 {\n\t\tres = s\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bd2b6734904988d5e4105e4c30cd5d42", "score": "0.51248336", "text": "func GetEnvStrArray(key string, def []string) []string {\n\tif value := os.Getenv(key); value != \"\" {\n\t\tvar arr []string\n\t\tjson.Unmarshal([]byte(key), &arr)\n\t\treturn arr\n\t}\n\treturn def\n}", "title": "" }, { "docid": "028cb5653896ed2092d5adb2fea48243", "score": "0.51241904", "text": "func EnvDevCreate(ctx *Context, id int64, key, value string) (*Env, error) {\n\th := authHeader(ctx.Config.AuthToken)\n\turi := ctx.Config.APIEndpoint(\"device_environment_variable\")\n\tdata := make(map[string]interface{})\n\tdata[\"device\"] = id\n\tdata[\"env_var_name\"] = key\n\tdata[\"value\"] = value\n\tbody, err := marhsalReader(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb, err := doJSON(ctx, \"POST\", uri, h, nil, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te := &Env{}\n\terr = json.Unmarshal(b, e)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn e, nil\n}", "title": "" }, { "docid": "af680aefde1016f1dc481603058b5f67", "score": "0.51160866", "text": "func mustGetenv(k string) string {\n\tv := os.Getenv(k)\n\tif v == \"\" {\n\t\tlog.Fatalf(\"Warning: %s environment variable not set.\\n\", k)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "af680aefde1016f1dc481603058b5f67", "score": "0.51160866", "text": "func mustGetenv(k string) string {\n\tv := os.Getenv(k)\n\tif v == \"\" {\n\t\tlog.Fatalf(\"Warning: %s environment variable not set.\\n\", k)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2b49eff41fe3a46872a2897050f02f17", "score": "0.5103512", "text": "func env(key string, defaultValue string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "39346fc2eb8ee3a04569cefa76c68c5d", "score": "0.5099707", "text": "func getEnv(env string) string {\n\tvalue := os.Getenv(env)\n\tif len(value) == 0 {\n\t\tlog.Printf(\"Environment variable %s not found!\", env)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "b23ea3a58b95ce992ff83f1b70fd9b9e", "score": "0.5097879", "text": "func getTestCredsFromEnv() string {\n\treturn multiEnvSearch(credsEnvVars)\n}", "title": "" }, { "docid": "973389a9c8eb802683f12365e12c42eb", "score": "0.509365", "text": "func (r *CheckedDaemonSet) assertEnvIsSet(ctx context.Context, client client.Client, container, key, expectedValue string) error {\n\tif err := assertEnvIsSet(ctx, client, r.Spec.Template.Spec, ComponentCalicoNode, container, key, expectedValue); err != nil {\n\t\treturn err\n\t}\n\tr.ignoreEnv(container, key)\n\treturn nil\n}", "title": "" }, { "docid": "5e46ee2dcb578a31cdc44b15faddb284", "score": "0.5089879", "text": "func Env(env string) (value []byte, err error) {\n\tvalue, err = exec.Command(\"go\", \"env\", env).Output()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvalue = bytes.TrimSpace(value)\n\n\tif len(value) == 0 {\n\t\terr = ErrEmptyEnv{env}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "295c09b126314c3d073efc1194b60286", "score": "0.5085254", "text": "func getEnv(key string) string {\n\tif value, exists := os.LookupEnv(key); exists {\n\t\treturn value\n\t}\n\tpanic(fmt.Errorf(\"Env Variable is not defined %v\", key))\n}", "title": "" }, { "docid": "2a7955cb737a4f380a4238bbde234bb7", "score": "0.508068", "text": "func Env(env ...string) string {\n\tvar returnVar string\n\tif len(env) == 0 {\n\t\tlogger.Error(\" env number is zero\")\n\t\treturn \"\"\n\t}\n\tfor i := 0; i < len(env); i++ {\n\t\tif returnVar == \"\" {\n\t\t\treturnVar = os.Getenv(env[i])\n\t\t} else {\n\t\t\treturn returnVar\n\t\t}\n\t}\n\treturn returnVar\n}", "title": "" }, { "docid": "fecafca635172c387060fa31fde75b1d", "score": "0.50795794", "text": "func getRequiredEnv(name string) string {\n\tval := os.Getenv(name)\n\tif val == \"\" {\n\t\tlog.Fatalf(\"Missing required environment variable %s\\n\", name)\n\t}\n\treturn val\n}", "title": "" }, { "docid": "2b2995b3c728ad498ed36a232559ef5d", "score": "0.5066795", "text": "func getEnv(key, fallback string) string {\r\n\tif value, ok := os.LookupEnv(key); ok {\r\n\t\treturn value\r\n\t}\r\n\treturn fallback\r\n}", "title": "" }, { "docid": "223fc1ee139c6345840b3b5e553d8221", "score": "0.5062831", "text": "func CheckEnv(lookupFunc func(key string) (string, bool)) (err error) {\n\tif lookupFunc == nil {\n\t\tlookupFunc = os.LookupEnv\n\t}\n\n\tenvVars := [4]string{\n\t\tEnvHueBridgeAddress,\n\t\tEnvHueBridgeUsername,\n\t\tEnvHueRemoteToken,\n\t\tEnvRedisURL,\n\t}\n\n\tfor _, v := range envVars {\n\t\tif _, ok := lookupFunc(v); !ok {\n\t\t\treturn models.NewMissingEnvError(v)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bd7add4085082dda7644479a5651f1c0", "score": "0.5060947", "text": "func (d *Docker) checkHostname(env []string) bool {\n\tfor _, e := range env {\n\t\tps := strings.SplitN(e, \"=\", 2)\n\t\tif len(ps) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tif ps[0] == \"ERU_NODE_NAME\" && ps[1] == d.config.HostName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e2f6357d0151c0c1e86b9711355e9071", "score": "0.50594187", "text": "func Test(w http.ResponseWriter, r *http.Request) {\n\tres, err := json.Marshal(EnvVariablesModel{Vars: os.Environ(), A: \"b\", C: 123})\n\tif err != nil {\n\t\tcommon.DisplayAppError(\n\t\t\tw,\n\t\t\terr,\n\t\t\t\"An unexpected error has occurred\",\n\t\t\t500,\n\t\t)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(res)\n}", "title": "" }, { "docid": "3a43ddd5684b423024096d3e8f9db00f", "score": "0.5056025", "text": "func MustGetEnv(env string) string {\n\tenvValue := os.Getenv(env)\n\tif envValue == \"\" {\n\t\tlogrus.WithField(\"env\", env).Fatal(\"MustGetEnv did not find env\")\n\t}\n\treturn envValue\n}", "title": "" }, { "docid": "0912a2a3a297ce99cba15bfb0feb9643", "score": "0.50473285", "text": "func GetEnvAsString(name, fallback string) string {\n\tif value, ok := os.LookupEnv(name); ok && len(value) > 0 {\n\t\treturn value\n\t}\n\treturn fallback\n}", "title": "" }, { "docid": "f0f82c63dea04920daac17020c0e61e9", "score": "0.50472", "text": "func validateEnv() (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_, err = utils.MultiErrorList(err)\n\t\t\terr = fmt.Errorf(\"invalid environment: %w\", err)\n\t\t}\n\t}()\n\tfor _, kv := range strings.Split(emptyStringsEnv, \"\\n\") {\n\t\tif strings.TrimSpace(kv) == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ti := strings.Index(kv, \"=\")\n\t\tif i == -1 {\n\t\t\treturn errors.Errorf(\"malformed .env file line: %s\", kv)\n\t\t}\n\t\tk := kv[:i]\n\t\t_, ok := os.LookupEnv(k)\n\t\tif ok {\n\t\t\terr = multierr.Append(err, fmt.Errorf(\"environment variable %s must not be set: %v\", k, v2.ErrUnsupported))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9755728b8509dd8158d922d155179747", "score": "0.5042173", "text": "func Getenv(key string) (string, error) {\n\tfor _, b := range []byte(key) {\n\t\tif b == '(' || b == ')' || b == '_' ||\n\t\t\t'0' <= b && b <= '9' ||\n\t\t\t'a' <= b && b <= 'z' ||\n\t\t\t'A' <= b && b <= 'Z' {\n\t\t\tcontinue\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"wine: invalid character %q in variable name\", b)\n\t}\n\n\tserver.wg.Wait()\n\tout, err := exec.Command(\"wine\", \"cmd\", \"/c\", \"if defined\", key, \"echo\", \"%\"+key+\"%\").Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes.TrimSuffix(out, []byte(\"\\r\\n\"))), nil\n}", "title": "" } ]
9508091fd4ff268436d479621c89a9e7
/ mysql or cockroach ? or $1 handlers
[ { "docid": "f188e499f7110a6afe06018830a820d2", "score": "0.0", "text": "func (m *__Post_Selector) nextDollars(size int) string {\n\tr := DollarsForSqlIn(size, m.dollarIndex, m.isMysql)\n\tm.dollarIndex += size\n\treturn r\n}", "title": "" } ]
[ { "docid": "1f5cd3fd4a2d4a46e205cad38b29bcac", "score": "0.5956916", "text": "func dispatch(uid string, conn net.Conn, conns map[string]net.Conn, recMsg []byte) {\n\tvar tcpReq dataconversion.TCPRequest\n\tjson.Unmarshal(recMsg, &tcpReq)\n\tswitch tcpReq.Hd.HandlerID {\n\tcase protocol.USER:\n\t\t// Go to user handler\n\t\tuserHandler.MainHandler(uid, conn, tcpReq)\n\tcase protocol.MESSAGE:\n\t\t// Go to chat message handler\n\t\tmessageHandler.MainHandler(conn, conns, tcpReq)\n\t}\n}", "title": "" }, { "docid": "e27189df6ccf38a20011a5b885bd1cbd", "score": "0.58478427", "text": "func (t *tinkerforge) handle(p *Packet) {\n\tt.handlersMutex.RLock()\n\n\tvar handler Handler\n\thandler, ok := t.handlers[handlerIDFromPacket(p)]\n\tif !ok {\n\t\t// Maybe a wildcard?\n\t\thandler = t.handlers[handlerIDFromParam(0, p.FunctionID(), p.SequenceNum())]\n\t}\n\n\tt.handlersMutex.RUnlock()\n\tif handler != nil {\n\t\thandler.Handle(p)\n\t}\n}", "title": "" }, { "docid": "d1bb4780eee1cd9fcb4591ae33627a0a", "score": "0.57033694", "text": "func (s *Server) QueryHandler(q ipcrouter.Query) {\n\tswitch t := q.GetType(); t {\n\tcase message.Ping:\n\t\tq.Respond([]byte{q.GetBody()[0] + 1})\n\tcase message.GetPubKey:\n\t\tq.Respond(s.key.Pub().Slice())\n\tcase message.GetPort:\n\t\tq.Respond(uint32(s.net.Port()))\n\tcase overlaymessages.GetID:\n\t\tq.Respond(\n\t\t\t(&overlaymessages.ID{\n\t\t\t\tSign: s.key.Pub(),\n\t\t\t\tXchng: s.keyX.Pub(),\n\t\t\t}).Serialize(),\n\t\t)\n\tdefault:\n\t\tlog.Info(log.Lbl(\"unknown_query_type\"), t)\n\t}\n}", "title": "" }, { "docid": "504f7a5e4e9b01a9d918ceddb433f808", "score": "0.55975723", "text": "func (p *Postgres) Handler() (err error) {\n\t//defer handlePanic()\n\tdefer p.Close()\n\n\tsuccess, err := p.handleLogin()\n\tif err != nil {\n\t\treturn\n\t}\n\tif !success {\n\t\tlogger.Warning(\"Login failed\")\n\t\treturn\n\t}\n\tsessionID := db.RandString(32)\n\tfor {\n\t\tvar buf []byte\n\t\t//Read client request\n\t\tbuf, err = p.reader(p.client)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tconAct := new(sql.QueryAction)\n\n\t\tswitch buf[0] {\n\t\tcase 0x51: //Simple query\n\t\t\tcontext := sql.QueryContext{\n\t\t\t\tQuery: buf[5:],\n\t\t\t\tDatabase: p.currentDB,\n\t\t\t\tUser: p.username,\n\t\t\t\tClient: remoteAddrToIP(p.client.RemoteAddr()),\n\t\t\t\tTime: time.Now(),\n\t\t\t}\n\t\t\tconAct.QueryContext = context\n\t\t\tconAct.SessionID = sessionID\n\t\t\taction, _ := processContext(context)\n\t\t\tconAct.Action = action\n\n\t\tcase 0x58: //Terminate\n\t\t\t_, err = p.server.Write(buf)\n\t\t\treturn\n\t\t}\n\n\t\ttimeStart := time.Now()\n\t\t//Send request to server\n\t\t_, err = p.server.Write(buf)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t//Read server response\n\t\tbuf, err = p.reader(p.server)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t//Send response to client\n\t\t_, err = p.client.Write(buf)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\telapsed := time.Since(timeStart)\n\t\tconAct.Duration = elapsed\n\t\tlogger.Debugf(\"Query elapsed: %s\", elapsed)\n\t\tif conAct.Action != \"drop\" {\n\t\t\tprocessQueryRecording(*conAct)\n\t\t}\n\n\t\tswitch buf[0] {\n\t\tcase 0x45: //Error\n\t\t\tbuf, err = p.reader(p.server)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_, err = p.client.Write(buf)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fb3ec80a451179555fd707f46e2239c2", "score": "0.5595924", "text": "func sqliteHandler (vp *viper.Viper, cbBucket *gocb.Bucket) (int, interface{}) {\n\n // get database name\n dbname := vp.GetString(\"sqlite.dbpath\")\n if dbname == \"\" {\n return 0, \"No database path has been provided\"\n }\n\n // connect to database\n db, err := sqlite3.Open(dbname)\n if err != nil {\n return 0, err.Error()\n }\n defer db.Close()\n\n // number of added documents\n count := 0\n\n // query.sql array from config.toml\n var queries []map[string]interface{}\n vp.UnmarshalKey(\"query\", &queries)\n\n // loop over sql queries\n for i := range queries {\n\n query := queries[i]\n doc := make(sqlite3.RowMap)\n\n for s, dbErr := db.Query(query[\"sql\"].(string)); dbErr == nil; dbErr = s.Next() {\n s.Scan(doc)\n }\n\n // add additional field values\n if props, ok := query[\"props\"].(map[string]interface{}); ok {\n for propKey, propValue := range props {\n doc[propKey] = propValue\n }\n }\n\n // convert doc to json and upsert into couchbase\n jsonDoc, _ := json.Marshal(doc)\n _, err := upsert(cbBucket, sue.New2(), jsonDoc)\n if err != nil {\n return 0, err\n }\n\n count++\n }\n return count, nil\n}", "title": "" }, { "docid": "9a1d0fcfae344eaffa4d6a1f724648a7", "score": "0.5536671", "text": "func sighandler()", "title": "" }, { "docid": "ab98b87cbada54c062d3270a1fdc9bd4", "score": "0.5534938", "text": "func SQLHandler(args interface{}) {\n\tif args == nil {\n\t\tfmt.Println(\"Pretending I am using the variable so go compiler will not go crazy.\")\n\t}\n\tpanic(\"Not Implemented yet.\")\n}", "title": "" }, { "docid": "fd5bc53c38a486c01813246d44c68f5e", "score": "0.55224663", "text": "func handleRequest(c net.Conn, tablechan chan<- Table, tables *Cache, query string) {\n\tquery_split := strings.Fields(query)\n\n\tif len(query_split) >= 2 {\n\t\tswitch strings.ToLower(query_split[1]) {\n\t\t\tcase \"set\":\n\t\t\t\tsetVal(c, tablechan, tables, query_split)\n\t\t\tcase \"get\":\n\t\t\t\tgetVal(c, tables, query_split)\n\t\t\tcase \"del\":\n\t\t\t\tdelKey(c, tablechan, tables, query_split)\n\t\t\tdefault:\n\t\t\t\tc.Write([]byte(string(\"Unknown command\\n\")))\n\t\t}\n\t} else if len(query_split) == 1 {\n\t\tswitch strings.ToLower(query_split[0]) {\n\t\t\tcase \"q\":\n\t\t\t\tquit(c)\n\t\t\tdefault:\n\t\t\t\tc.Write([]byte(string(\"Unknown command\\n\")))\n\t\t\t}\n\t} else {\n\t\tc.Write([]byte(string(\"Unknown command\\n\")))\n\t}\n}", "title": "" }, { "docid": "576ea731bcba86ed209df9e2d877bb6d", "score": "0.5507976", "text": "func (srv *server) handleConn(conn net.Conn, done *sync.WaitGroup) {\n\tremote := strings.Split(conn.RemoteAddr().String(), \":\")[0]\n\tdec := json.NewDecoder(conn)\n\tenc := json.NewEncoder(conn)\n\treq := &ntv.Request{}\n\tif err := dec.Decode(req); err != nil {\n\t\tans := ntv.ErrAnswer(err.Error())\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\t\tconn.Close()\n\t\treturn\n\t}\n\ttable := req.Table\n\tswitch req.Query {\n\tcase jdh.Add:\n\t\tvar ans *ntv.Answer\n\t\tif remote == \"127.0.0.1\" {\n\t\t\tif id, err := srv.db.Add(table, dec); err != nil {\n\t\t\t\tans = ntv.ErrAnswer(err.Error())\n\t\t\t} else {\n\t\t\t\tans = ntv.Success(id)\n\t\t\t}\n\t\t} else {\n\t\t\tans = ntv.ErrAnswer(\"forbidden\")\n\t\t}\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\tcase jdh.Close:\n\t\tvar ans *ntv.Answer\n\t\tif remote == \"127.0.0.1\" {\n\t\t\tans = ntv.Success(\"ok\")\n\t\t} else {\n\t\t\tans = ntv.ErrAnswer(\"forbidden\")\n\t\t}\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\t\tclose(srv.end)\n\tcase jdh.Commit:\n\t\tvar ans *ntv.Answer\n\t\tif remote == \"127.0.0.1\" {\n\t\t\tif err := srv.db.Commit(); err != nil {\n\t\t\t\tans = ntv.ErrAnswer(err.Error())\n\t\t\t} else {\n\t\t\t\tans = ntv.Success(\"ok\")\n\t\t\t}\n\t\t} else {\n\t\t\tans = ntv.ErrAnswer(\"forbidden\")\n\t\t}\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\tcase jdh.Delete:\n\t\tvar ans *ntv.Answer\n\t\tif remote == \"127.0.0.1\" {\n\t\t\tif len(req.Kvs) == 0 {\n\t\t\t\tans = ntv.ErrAnswer(\"expecting arguments\")\n\t\t\t} else {\n\t\t\t\tif err := srv.db.Delete(table, req.Kvs); err != nil {\n\t\t\t\t\tans = ntv.ErrAnswer(err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tans = ntv.Success(\"ok\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tans = ntv.ErrAnswer(\"forbidden\")\n\t\t}\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\tcase jdh.Get:\n\t\tdone.Add(1)\n\t\tgo func() {\n\t\t\tdefer conn.Close()\n\t\t\tdefer done.Done()\n\t\t\tid := \"\"\n\t\t\tfor _, kv := range req.Kvs {\n\t\t\t\tif len(kv.Value) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif kv.Key == jdh.KeyId {\n\t\t\t\t\tid = kv.Value[0]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tv, err := srv.db.Get(table, id)\n\t\t\tif err != nil {\n\t\t\t\tans := ntv.ErrAnswer(err.Error())\n\t\t\t\tenc.Encode(ans)\n\t\t\t\tlog(remote, req, ans)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tans := ntv.Success(\"ok\")\n\t\t\tenc.Encode(ans)\n\t\t\tenc.Encode(v)\n\t\t\tlog(remote, req, ans)\n\t\t}()\n\t\treturn\n\tcase jdh.List:\n\t\tdone.Add(1)\n\t\tgo func() {\n\t\t\tdefer conn.Close()\n\t\t\tdefer done.Done()\n\t\t\tl, err := srv.db.List(table, req.Kvs)\n\t\t\tif err != nil {\n\t\t\t\tans := ntv.ErrAnswer(err.Error())\n\t\t\t\tenc.Encode(ans)\n\t\t\t\tlog(remote, req, ans)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tans := ntv.Success(\"ok\")\n\t\t\tenc.Encode(ans)\n\t\t\tfor e := l.Front(); e != nil; e = e.Next() {\n\t\t\t\tenc.Encode(e.Value)\n\t\t\t}\n\t\t\tlog(remote, req, ans)\n\t\t}()\n\t\treturn\n\tcase jdh.Set:\n\t\tvar ans *ntv.Answer\n\t\tif remote == \"127.0.0.1\" {\n\t\t\tif len(req.Kvs) == 0 {\n\t\t\t\tans = ntv.ErrAnswer(\"expecting arguments\")\n\t\t\t} else {\n\t\t\t\tif err := srv.db.Set(table, req.Kvs); err != nil {\n\t\t\t\t\tans = ntv.ErrAnswer(err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tans = ntv.Success(\"ok\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tans = ntv.ErrAnswer(\"forbidden\")\n\t\t}\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\tdefault:\n\t\tans := ntv.ErrAnswer(\"not implemented\")\n\t\tenc.Encode(ans)\n\t\tlog(remote, req, ans)\n\t}\n\tconn.Close()\n}", "title": "" }, { "docid": "d117d4214b4a45d3062590ba64d32339", "score": "0.5442029", "text": "func (b *Binlog) getHandler(fmtStr string, args []interface{}) (*Handler, error) {\n\tvar h = &defaultHandler\n\tvar err error\n\tvar sIndex uint\n\tvar isMiss = false\n\tsIndex = b.getStringIndex(fmtStr)\n\tif sIndex != b.config.ConstDataSize {\n\t\th = b.L1Cache[sIndex]\n\t\tif h != nil { // fast cache hit? (20% of the whole function is here. Blame CPU data cache?)\n\t\t\tb.statistics.L1CacheHit++\n\t\t} else {\n\t\t\tisMiss = true\n\t\t\tb.statistics.L1CacheMiss++\n\t\t\th, err = b.createHandler(fmtStr, args)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tb.L1Cache[sIndex] = h\n\t\t\tb.handlersLookupByHash[h.HashUint] = h\n\t\t}\n\t} else {\n\t\tb.statistics.L2CacheUsed++\n\t\t// log.Printf(\"%v, use L2Cache instead\", err)\n\t\tvar ok bool\n\t\tif h, ok = b.L2Cache[fmtStr]; ok {\n\t\t\tb.statistics.L2CacheHit++\n\t\t} else {\n\t\t\tisMiss = true\n\t\t\tb.statistics.L2CacheMiss++\n\t\t\th, err = b.createHandler(fmtStr, args)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tb.L2Cache[fmtStr] = h\n\t\t\tb.handlersLookupByHash[h.HashUint] = h\n\t\t}\n\t}\n\t// Set filename and source line number\n\tif ADD_SOURCE_LINE && isMiss {\n\t\tvar filenameHash uint16 = 0xBADB\n\t\tvar fileLine uint16 = 0xADBA\n\t\t// Caller(0) is this function, Caller(1) is Log()\n\t\t_, filename, line, ok := runtime.Caller(2)\n\t\tif ok {\n\t\t\tfilenameHash = uint16(md5sum(filename))\n\t\t\tfileLine = uint16(line)\n\t\t}\n\t\th.FilenameHashUint = filenameHash\n\t\th.LineNumberUint = fileLine\n\t\th.filenameHash = intToSlice(&filenameHash)\n\t\th.lineNumber = intToSlice(&fileLine)\n\t\tb.Filenames[h.FilenameHashUint] = filename\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "b7a296c8fd479e1634f50716411939f6", "score": "0.5435363", "text": "func handleMap(c *Conn) {\n\n\n}", "title": "" }, { "docid": "5410b72df293f39f94699908921123fa", "score": "0.5431876", "text": "func handler1(msg interface{}) {\n\tcount1++\n}", "title": "" }, { "docid": "48d2d648fb63d1f70b9056406ec9ccd1", "score": "0.5392516", "text": "func (c *Client) handle(hdr string, cmd string, arg string, line string) {\n\tc.argId = hdr\n\tc.logTrace(\"In state %d, got command '%s', args '%s'\", c.state, cmd, arg)\n\n\tif cmd == \"\" || !commands[cmd] {\n\t\tc.Write(fmt.Sprintf(\"%s NO %v command unrecognized\", c.argId, cmd))\n\t\tc.logWarn(\"Unrecognized command: %v\", cmd)\n\t}\n\n\tswitch cmd {\n\tcase \"LOGIN\":\n\t\tc.loginHandler(cmd, arg)\n\t\t//return\n\tcase \"CAPABILITY\":\n\t\tc.capabilityHandler(cmd, arg)\n\t\t//return\n\tcase \"NOOP\":\n\t\tc.Write(c.argId + \" OK I have sucessfully done nothing\")\n\t\t//return\n\tcase \"LIST\":\n\t\t// Reset session\n\t\tc.listHandler(cmd, arg)\n\t\t//return\n\tcase \"LSUB\":\n\t\tc.lsubHandler(cmd, arg)\n\tcase \"SELECT\":\n\t\tc.selectHandler(cmd, arg)\t\n\tcase \"CREATE\":\n\t\tc.createHandler(cmd, arg)\t\t\n\t\t//return\n\tcase \"LOGOUT\":\n\t\tc.Write(\"* BYE IMAP4rev1 server logging out\\r\\n\")\n\t\tc.state = STATE_UNAUTHORIZED\n\t\tc.user = nil\n\t\tc.Write(c.argId + \" OK LOGOUT completed\\r\\n\")\n\t\tc.server.killClient(c)\n\t\t//return\n\tcase \"CLOSE\":\n\t\tc.state = STATE_UNAUTHORIZED\n\t\tc.Write(c.argId + \" OK CLOSE completed\\r\\n\")\n\t\t//return\n\tcase \"AUTHENTICATE\":\n\t\tc.authHandler(cmd, arg)\n\tcase \"UID\":\n\t\tc.uidHandler(cmd, arg)\t\n\tcase \"STATUS\":\n\t\tc.statusHandler(cmd, arg)\n\tcase \"SUBSCRIBE\":\n\t\tc.subHandler(cmd, arg)\n\tcase \"UNSUBSCRIBE\":\n\t\tc.unsubHandler(cmd, arg)\t\t\n\tcase \"NAMESPACE\":\n\t\tc.nsHandler(cmd, arg)\t\n\tcase \"STARTTLS\":\n\t\tc.tlsHandler()\n\t\t//return\n\tdefault:\n\t\tc.errors++\n\t\tif c.errors > 3 {\n\t\t\tc.Write(c.argId + \" NO Too many unrecognized commands\")\n\t\t\tc.server.killClient(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14e369d602c67e63f5fc6e843b90b2d5", "score": "0.53914493", "text": "func (c *Client) handleV1(uid tornet.IdentityFingerprint, conn net.Conn, enc *gob.Encoder, dec *gob.Decoder, logger log.Logger) {\n\tlogger = logger.New(\"event\", c.infos.Identity.Fingerprint())\n\n\tc.lock.Lock()\n\tcheckin := c.infos.Checkin != nil\n\tc.infos.Checkin = nil\n\tc.lock.Unlock()\n\n\t// Depending on the protocol phase, descend into checkin or data exchange\n\tif checkin {\n\t\tc.handleV1CheckIn(uid, conn, enc, dec, logger)\n\t\treturn\n\t}\n\tc.handleV1DataExchange(uid, conn, enc, dec, logger)\n}", "title": "" }, { "docid": "734248b71608bd11653f3d7cae6dca70", "score": "0.53904986", "text": "func (p *proxyrunner) queryHandler(w http.ResponseWriter, r *http.Request) {\n\tif !p.ClusterStarted() {\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\tswitch r.Method {\n\tcase http.MethodGet:\n\t\tp.httpqueryget(w, r)\n\tcase http.MethodPost:\n\t\tp.httpquerypost(w, r)\n\tdefault:\n\t\tcmn.WriteErr405(w, r, http.MethodGet, http.MethodPost)\n\t}\n}", "title": "" }, { "docid": "c7daf9496178b730199bb270968f300a", "score": "0.5376203", "text": "func (db *DatabaseHandler) handler(w http.ResponseWriter, r *http.Request) {\n\t//If we have a GET request, serve a file in the server-root directory\n\tfmt.Printf(\"Recieved connection from %s\\n\", r.RemoteAddr)\n\tif r.Method == \"GET\" {\n\t\tgetFileRequestHandler(w, r)\n\t} else if r.Method == \"POST\" {\n\t\tif r.URL.Path == \"/api/login\" {\n\t\t\tdb.postLoginHandler(w, r)\n\t\t} else if r.URL.Path == \"/api/createAccount\" {\n\t\t\tdb.postCreateAccountHandler(w, r)\n\t\t}\n\t} else {\n\t\tfmt.Fprintf(w, \"Hello, %s!\", r.URL.Path[1:])\n\t}\n}", "title": "" }, { "docid": "6e91b1ad4a7e15bff8f384a6e713bba6", "score": "0.53605455", "text": "func (kv *ShardKV) execute(op Op, seq int) {\n\tty := op.Ty\n\n\t// print some information about this execute call:\n\n\tif ty == \"Get\" {\n\t\tfmt.Printf(\"\\tSrv %v-%v EXECUTING(op: %v(%v), seq: %v).\\n\", kv.gid, kv.me, ty, op.Key, seq)\n\t} else if ty == \"Put\" || ty == \"Append\" {\n\t\tfmt.Printf(\"\\tSrv %v-%v EXECUTING(op: %v(%v, %v), seq: %v).\\n\", kv.gid, kv.me, ty, op.Key, op.Value, seq)\n\t} else if ty == \"Receive\" {\n\t\tfmt.Printf(\"\\tSrv %v-%v EXECUTING(op: %v(%v), seq: %v).\\n\", kv.gid, kv.me, ty, op.Sid, seq)\n\t} else if ty == \"Advance\" {\n\t\tfmt.Printf(\"\\tSrv %v-%v EXECUTING(op: %v(%v), seq: %v).\\n\", kv.gid, kv.me, ty, op.Config.Num, seq)\n\t}\n\n\t// apply writes (as applicable) and cache reply\n\n\tif ty == \"Get\" {\n\t\tkv.logRead(op, seq)\n\t} else if ty == \"Put\" || ty == \"Append\" {\n\t\tkv.applyAndLogWrite(op, seq)\n\t} else if ty == \"Receive\" {\n\t\tkv.applyAndLogReceive(op, seq)\n\t} else if ty == \"Advance\" {\n\t\tkv.applyAdvance(op, seq)\n\t}\n}", "title": "" }, { "docid": "eb417616d1522048a4dbaee867194fd6", "score": "0.53567845", "text": "func (s *store) handle(value interface{}) {\n\tif msg, ok := value.(meta.RaftMessage); ok {\n\t\ts.onRaftMessage(msg)\n\t} else if msg, ok := value.(meta.SnapshotMessage); ok {\n\t\ts.onSnapshotMessage(msg)\n\t}\n}", "title": "" }, { "docid": "181cb47026aad6641aa41f23235aa601", "score": "0.5338071", "text": "func (c *Conn) handle(cmd string, arg string) {\n\t// If panic happens during command handling - send 421 response\n\t// and close connection.\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tc.WriteResponse(421, EnhancedCode{4, 0, 0}, \"Internal server error\")\n\t\t\tc.Close()\n\n\t\t\tstack := debug.Stack()\n\t\t\tc.server.errorLog.Printf(\"panic serving %v: %v\\n%s\", c.State().RemoteAddr, err, stack)\n\t\t}\n\t}()\n\n\tif cmd == \"\" {\n\t\tc.WriteResponse(500, EnhancedCode{5, 5, 2}, \"Speak up\")\n\t\treturn\n\t}\n\n\tcmd = strings.ToUpper(cmd)\n\tswitch cmd {\n\tcase \"SEND\", \"SOML\", \"SAML\", \"EXPN\", \"HELP\", \"TURN\":\n\t\t// These commands are not implemented in any state\n\t\tc.WriteResponse(502, EnhancedCode{5, 5, 1}, fmt.Sprintf(\"%v command not implemented\", cmd))\n\tcase \"HELO\", \"EHLO\", \"LHLO\":\n\t\tlmtp := cmd == \"LHLO\"\n\t\tenhanced := lmtp || cmd == \"EHLO\"\n\t\tif c.server.lmtp && !lmtp {\n\t\t\tc.WriteResponse(500, EnhancedCode{5, 5, 1}, \"This is a LMTP server, use LHLO\")\n\t\t}\n\t\tif !c.server.lmtp && lmtp {\n\t\t\tc.WriteResponse(500, EnhancedCode{5, 5, 1}, \"This is not a LMTP server\")\n\t\t}\n\t\tc.handleGreet(enhanced, arg)\n\tcase \"XFORWARD\":\n\t\tif !c.server.allowXForward {\n\t\t\tc.unrecognizedCommand(cmd)\n\t\t} else {\n\t\t\tc.handleXForward(arg)\n\t\t}\n\tcase \"MAIL\":\n\t\tc.handleMail(arg)\n\tcase \"RCPT\":\n\t\tc.handleRcpt(arg)\n\tcase \"VRFY\":\n\t\tc.WriteResponse(252, EnhancedCode{2, 5, 0}, \"Cannot VRFY user, but will accept message\")\n\tcase \"NOOP\":\n\t\tc.WriteResponse(250, EnhancedCode{2, 0, 0}, \"I have sucessfully done nothing\")\n\tcase \"RSET\": // Reset session\n\t\tc.reset()\n\t\tc.WriteResponse(250, EnhancedCode{2, 0, 0}, \"Session reset\")\n\tcase \"DATA\":\n\t\tc.handleData(arg)\n\tcase \"QUIT\":\n\t\tc.WriteResponse(221, EnhancedCode{2, 0, 0}, \"Goodnight and good luck\")\n\t\tc.Close()\n\tcase \"AUTH\":\n\t\tif c.server.authDisabled {\n\t\t\tc.unrecognizedCommand(cmd)\n\t\t} else {\n\t\t\tc.handleAuth(arg)\n\t\t}\n\tcase \"STARTTLS\":\n\t\tc.handleStartTLS()\n\tdefault:\n\t\tc.unrecognizedCommand(cmd)\n\t}\n}", "title": "" }, { "docid": "f609679508c509e8cd7708f1b096afcc", "score": "0.53037256", "text": "func (handler *CoreDNSMySql) Name() string { return \"handler\" }", "title": "" }, { "docid": "5495917339a26a9277c246e8b9427237", "score": "0.52824277", "text": "func (crd *Coordinator) handleMux(request *netstring.Netstring) (bool, error) {\n\tcrd.isRead = false\n\tcrd.preppendCorrID = (crd.worker == nil)\n\tif request.IsComposite() {\n\t\t// TODO: avoid full parsing if necessary\n\t\t// if this is a worker command, only a shallow parse might be needed (if sharding is enabled, full parsing still needed anyway)\n\t\tnss, err := netstring.SubNetstrings(request)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tcrd.nss = nss\n\t\tif GetConfig().EnableQueryBindBlocker {\n\t\t\tblock, _ := crd.PreprocessQueryBindBlocker(nss)\n\t\t\tif block {\n\t\t\t\tns := netstring.NewNetstringFrom(common.RcError, []byte(ErrQueryBindBlocker.Error()))\n\t\t\t\tcrd.respond(ns.Serialized)\n\t\t\t\tcrd.conn.Close()\n\t\t\t\treturn true /*handled*/, nil\n\t\t\t}\n\t\t} // end GetConfig().EnableQueryBindBlocker\n\t\tfor _, ns := range nss {\n\t\t\tif (ns.Cmd == common.CmdPrepare) || (ns.Cmd == common.CmdPrepareV2) || (ns.Cmd == common.CmdPrepareSpecial) {\n\t\t\t\tcrd.sqlhash = int32(utility.GetSQLHash(string(ns.Payload)))\n\t\t\t\tcrd.isRead = crd.sqlParser.IsRead(string(ns.Payload))\n\t\t\t\thandled := false\n\t\t\t\tif GetConfig().EnableSharding {\n\t\t\t\t\thangup, err := crd.PreprocessSharding(nss)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\thandled = true\n\t\t\t\t\t\tif logger.GetLogger().V(logger.Debug) {\n\t\t\t\t\t\t\tlogger.GetLogger().Log(logger.Debug, crd.id, \"Error preprocessing sharding, hangup:\", err.Error(), hangup)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif hangup {\n\t\t\t\t\t\t\tcrd.conn.Close()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn handled, err\n\t\t\t}\n\t\t\thandled, err := crd.processMuxCommand(ns)\n\t\t\tif !handled {\n\t\t\t\tif nss[0].Cmd == common.CmdClientCalCorrelationID {\n\t\t\t\t\tcrd.preppendCorrID = false\n\t\t\t\t}\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\t\treturn true, nil\n\t}\n\tcrd.nss = nil\n\t// an individual request\n\tif (request.Cmd == common.CmdPrepare) || (request.Cmd == common.CmdPrepareV2) || (request.Cmd == common.CmdPrepareSpecial) {\n\t\tcrd.isRead = crd.sqlParser.IsRead(string(request.Payload))\n\t\treturn false, nil\n\t}\n\treturn crd.processMuxCommand(request)\n}", "title": "" }, { "docid": "af23093337132a8dbd2fac610b3c4365", "score": "0.5277331", "text": "func _db_query_callback(tls *crt.TLS, _pUser unsafe.Pointer, _nArg int32, _azArg **int8, _NotUsed **int8) (r0 int32) {\n\tvar _i int32\n\tvar _pResult *TQueryResult\n\t_pResult = (*TQueryResult)(_pUser)\n\tif (_pResult.XnElem + _nArg) < _pResult.XnAlloc {\n\t\tgoto _0\n\t}\n\tif _pResult.XnAlloc == int32(0) {\n\t\t_pResult.XnAlloc = _nArg + int32(1)\n\t\tgoto _2\n\t}\n\t_pResult.XnAlloc = ((_pResult.XnAlloc * int32(2)) + _nArg) + int32(1)\n_2:\n\t_pResult.XazElem = (**int8)(crt.Xrealloc(tls, unsafe.Pointer(_pResult.XazElem), uint32(_pResult.XnAlloc)*uint32(4)))\n\tif _pResult.XazElem == nil {\n\t\tcrt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(426), unsafe.Pointer(_pResult.XzFile))\n\t\treturn int32(1)\n\t}\n_0:\n\tif _azArg == nil {\n\t\treturn int32(0)\n\t}\n\t_i = int32(0)\n_5:\n\tif _i >= _nArg {\n\t\tgoto _8\n\t}\n\t*elem0(_pResult.XazElem, uintptr(postInc1(&_pResult.XnElem, 1))) = bin.Xsqlite3_mprintf(tls, str(445), unsafe.Pointer(func() *int8 {\n\t\tif (*elem0(_azArg, uintptr(_i))) != nil {\n\t\t\treturn (*elem0(_azArg, uintptr(_i)))\n\t\t}\n\t\treturn str(448)\n\t}()))\n\t_i += 1\n\tgoto _5\n_8:\n\treturn int32(0)\n}", "title": "" }, { "docid": "de66499c919b4738a8a2f90edc9d4bcf", "score": "0.52597255", "text": "func handler(conn net.Conn, context *libcoap.Context) {\n\n\tdefer conn.Close()\n\n\tvar (\n\t\tbuf = make([]byte, 1024)\n\t\tr = bufio.NewReader(conn)\n\t)\n\nILOOP:\n\tfor {\n\t\tn, err := r.Read(buf)\n\t\tdata := string(buf[:n])\n\n\t\tswitch err {\n\t\tcase io.EOF:\n\t\t\tbreak ILOOP\n\t\tcase nil:\n\t\t\tlog.Debugf(\"[MySQL-Notification]: Received data changed notification from DB trigger for: %+v\", data)\n\t\t\tif isTransportOver(data) {\n\t\t\t\tbreak ILOOP\n\t\t\t}\n\n\t\t\t// Parse json data from notification to parameters\n\t\t\tvar mapData map[string]interface{}\n\t\t\terr := json.Unmarshal([]byte (data), &mapData)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"[MySQL-Notification]: Failed to encode json message to map data.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif mapData[\"table_trigger\"].(string) == string(MITIGATION_SCOPE) {\n\t\t\t\tid, iErr := strconv.ParseInt(mapData[\"id\"].(string), 10, 64)\n\t\t\t\tcid, cErr := strconv.Atoi(mapData[\"cid\"].(string))\n\t\t\t\tcuid := mapData[\"cuid\"].(string)\n\t\t\t\tcdid := mapData[\"cdid\"].(string)\n\t\t\t\tmid, mErr := strconv.Atoi(mapData[\"mid\"].(string))\n\t\t\t\tstatus, sErr := strconv.Atoi(mapData[\"status\"].(string))\n\t\t\t\tif iErr != nil || mErr != nil || sErr != nil || cErr != nil {\n\t\t\t\t\tlog.Errorf(\"[MySQL-Notification]:Failed to parse string to integer\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\thandleNotifyMitigation(id, cid, cuid, cdid, mid, status, context, false)\n\t\t\t} else if mapData[\"table_trigger\"].(string) == string(SESSION_CONFIGURATION) {\n\t\t\t\tsidStr := mapData[\"sid\"].(string)\n\t\t\t\tsid, err := strconv.Atoi(sidStr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"[MySQL-Notification]:Failed to parse string to integer\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif sid > 0 {\n\t\t\t\t\t// Notify session configuration changed to those clients who are observing this mitigation request\n\t\t\t\t\tlog.Debug(\"[MySQL-Notification]: Send notification if obsevers exists\")\n\t\t\t\t\turiPath := messages.MessageTypes[messages.SESSION_CONFIGURATION].Path\n\t\t\t\t\tquery := uriPath + \"/sid=\" + sidStr\n\t\t\t\t\tresource := context.GetResourceByQuery(&query)\n\t\t\t\t\tdirty := context.EnableResourceDirty(resource)\n\t\t\t\t\tif dirty > 0 {\n\t\t\t\t\t\tresource.SetIsNotification(true)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if mapData[\"table_trigger\"].(string) == string(PREFIX_ADDRESS_RANGE) {\n\n\t\t\t\t// re-check ip address range for each mitigation request, acl that are inactive\n\t\t\t\tlog.Debug(\"[MySQL-Notification]: Re-check ip-address range for mitigations and acls\")\n\t\t\t\tcid, err := strconv.Atoi(mapData[\"cid\"].(string))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"[MySQL-Notification]: Failed to parse string to integer\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// Get customer from customer id\n\t\t\t\tcustomer, err := models.GetCustomer(cid)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"[MySQL-Notification]: new addressrange: %+v\", customer.CustomerNetworkInformation.AddressRange)\n\n\t\t\t\t// Re-check ip address range for mitigations\n\t\t\t\terr = controllers.RecheckIpRangeForMitigations(&customer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"[MySQL-Notification]: Re-check ip range for mitigations failed. Error: %+v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Re-check ip address range for acls\n\t\t\t\terr = data_controllers.RecheckIpRangeForAcls(&customer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"[MySQL-Notification]: Re-check ip range for acls failed. Error: %+v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else if mapData[\"table_trigger\"].(string) == string(DATA_ACLS) {\n\t\t\t\thandleNotifyACL(mapData[\"aclId\"].(string), context)\n\t\t\t} else if mapData[\"table_trigger\"].(string) == string(TELEMETRY_TRAFFIC) || mapData[\"table_trigger\"].(string) == string(TELEMETRY_TOTAL_ATTACK_CONNECTION) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(TELEMETRY_ATTACK_DETAIL) || mapData[\"table_trigger\"].(string) == string(TELEMETRY_SOURCE_COUNT) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(TELEMETRY_TOP_TALKER) || mapData[\"table_trigger\"].(string) == string(TELEMETRY_SOURCE_PREFIX) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(TELEMETRY_SOURCE_PORT_RANGE) || mapData[\"table_trigger\"].(string) == string(TELEMETRY_SOURCE_ICMP_TYPE_RANGE) {\n\t\t\t\thandleNotifyTelemetryMitigationStatusUpdate(mapData, context)\n\t\t\t} else if mapData[\"table_trigger\"].(string) == string(URI_FILTERING_TRAFFIC) || mapData[\"table_trigger\"].(string) == string(URI_FILTERING_TRAFFIC_PROTOCOL) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(URI_FILTERING_TRAFFIC_PORT) || mapData[\"table_trigger\"].(string) == string(URI_FILTERING_TOTAL_ATTACK_CONNECTION) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(URI_FILTERING_TOTAL_ATTACK_CONNECTION_PORT) || mapData[\"table_trigger\"].(string) == string(URI_FILTERING_ATTACK_DETAIL) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(URI_FILTERING_SOURCE_COUNT) || mapData[\"table_trigger\"].(string) == string(URI_FILTERING_TOP_TALKER) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(URI_FILTERING_SOURCE_PREFIX) || mapData[\"table_trigger\"].(string) == string(URI_FILTERING_SOURCE_PORT_RANGE) ||\n\t\t\t\tmapData[\"table_trigger\"].(string) == string(URI_FILTERING_ICMP_TYPE_RANGE) {\n\t\t\t\t// Handle notification telemetry pre-mitigation\n\t\t\t\thandleNotifyUriFilteringTelemetryPreMitigation(mapData, context)\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.Errorf(\"[MySQL-Notification]: Failed to receive data:%+v\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0b3eab9bd52d13354ef21f3fb92b7ccc", "score": "0.51961356", "text": "func (self *Replication) getnHandler(msg Message) {\n var prefix string\n if msg.DecodePayload(&prefix) != nil {\n log.Printf(\"Error in GETN request\")\n return\n }\n self.getnHandlerIntern(prefix, msg.connection)\n}", "title": "" }, { "docid": "5f5703ad4bf92b976c6f15ac38f3f452", "score": "0.5194597", "text": "func (p *Pool) QueryHandler(q ipcrouter.Query) {\n\tlog.Info(log.Lbl(\"handling_query\"))\n\tswitch t := q.GetType(); t {\n\tcase message.GetPort:\n\t\tname := q.BodyString()\n\t\tprg, ok := p.programs[name]\n\t\tif !ok {\n\t\t\tlog.Info(log.Lbl(\"bad_port_request\"), name, q.Port())\n\t\t\treturn\n\t\t}\n\t\tq.Respond(serial.MarshalUint32(prg.Port32, nil))\n\tdefault:\n\t\tlog.Info(\"unknown_query\", t)\n\t}\n}", "title": "" }, { "docid": "f2ab3a3c90559a1c69b278d68a7bc8f3", "score": "0.51835877", "text": "func (r *Redis) TestHandler() {\n}", "title": "" }, { "docid": "108725037303d4d6f5428e0c84c3d269", "score": "0.51807123", "text": "func main() {\r\n // Set up the DB connection\r\n // Handle the incoming route requests\r\n // Load the listener | server\r\n var err error\r\n\r\n // create the DB link !! todo: using hard coded credentials for testing !!\r\n db.Conn, err = sql.Open(config.Database.Type, config.Database.User + \":\" + config.Database.Pwd + \"@tcp(\" + config.Database.Host + \":\" + config.Database.Port + \")/\" + config.Database.Name)\r\n if err != nil {\r\n log.Panic(\"DB connection error: %s\", err)\r\n }\r\n\r\n // To avoid error due to connection being closed on the server\r\n db.Conn.SetConnMaxLifetime(14000 * time.Second)\r\n\r\n // check that the db link works\r\n err = db.Conn.Ping()\r\n if err != nil {\r\n log.Panic(\"DB ping error: %s\", err)\r\n }\r\n\r\n // Using imported router library\r\n // !! this flashy router wont work correctly for me at the moment\r\n router := httprouter.New()\r\n\r\n // This router isn't working for me !! keep getting 404's\r\n // But this 'wildcard' route works !!\r\n router.GET(\"/pet/*segment\", handlers.GetSwitch)\r\n\r\n // Send to the POST switch\r\n router.POST(\"/pet/*segment\", handlers.PostSwitch)\r\n\r\n // There is only 1 DELETE route\r\n router.DELETE(\"/pet/*segment\", handlers.DeletePet)\r\n\r\n // There is only 1 PUT route\r\n // This needs to share the UpdatePet handler\r\n router.PUT(\"/pet/*segment\", handlers.PutSwitch)\r\n\r\n // set to listen on external facing IP address on DEV box\r\n log.Fatal(http.ListenAndServe(config.Server.Host + \":\" + config.Server.Port, router))\r\n}", "title": "" }, { "docid": "b72711d80322e40b09dfd9e527ffb2b8", "score": "0.5180116", "text": "func dispatchHandler(s *state) {\n\n\tif len(s.cmd) > 0 {\n\n\t\tif s.cmd[0] == '$' && !s.scripting {\n\t\t\ts.msg.Actor.SendBad(\"Unknown command, type HELP to get a list of commands\")\n\t\t\treturn\n\t\t}\n\n\t\t// Check the player stack for the command first\n\t\tif val, ok := s.actor.Menu[strings.ToLower(s.cmd)]; ok {\n\t\t\tlog.Println(\"Match\" + val.Command)\n\t\t\ts.scriptActor(val.Command, strings.Join(s.input, \" \"))\n\t\t\treturn\n\t\t}\n\t\ts.actor.EmptyMenu()\n\n\t\t// Check the room stack for a command second:\n\t\tif val, ok := s.where.Commands[s.cmd]; ok {\n\t\t\tlog.Println(\"Match\" + val.Command)\n\t\t\ts.scriptAll(val.Command, strings.Join(s.input, \" \"))\n\t\t\treturn\n\t\t}\n\n\t\tswitch handler, valid := handlers[s.cmd]; {\n\t\tcase valid:\n\t\t\thandler.process(s)\n\t\tdefault:\n\t\t\ts.msg.Actor.SendBad(\"Unknown command, type HELP to get a list of commands\")\n\t\t}\n\n\t}else{\n\t\ts.msg.Actor.SendBad(\"Unknown command, type HELP to get a list of commands\")\n\t}\n}", "title": "" }, { "docid": "71936b4fb2f700c5c30eb902fc6d02af", "score": "0.5175642", "text": "func (sm *ShardMaster) Query(args *QueryArgs, reply *QueryReply) error {\n // many clients can be calling this\n sm.mu.Lock()\n defer sm.mu.Unlock()\n\n op := Op{Type:\"QUERY\", Num: args.Num, ID: args.ID}\n\n seq := sm.propose(op, func(a Op, b Op) bool {\n if a.Type == b.Type && a.Num == b.Num && a.ID == b.ID {\n return true\n }\n return false\n })\n\n sm.update(seq, args.Num)\n \n if args.Num == -1 {\n reply.Config = sm.configs[len(sm.configs)-1]\n } else {\n if args.Num >= len(sm.configs) {\n reply.Config = Config{}\n } else {\n reply.Config = sm.configs[args.Num] \n }\n }\n \n\n // create an op from args + call the handler\n // update until we can return the right configuration\n // reply with the right configuration\n return nil\n}", "title": "" }, { "docid": "a3ee0b9fb71d0a9c59788a0dca36be6c", "score": "0.5151534", "text": "func Dispatch(dbName, rpc string, data []byte) (ret []byte, err error) {\n\tt0 := time.Now()\n\tl := log.Default().With().\n\t\tStr(\"db\", dbName).\n\t\tStr(\"req\", rpc).\n\t\tUint64(\"rid\", atomic.AddUint64(&rid, 1)).\n\t\tLogger()\n\n\tl.Debug().Bytes(\"data\", data).Msg(\"rpc -->\")\n\n\tdefer func() {\n\t\tt1 := time.Now()\n\t\tl.Debug().Bytes(\"ret\", ret).Dur(\"dur\", t1.Sub(t0)).Msg(\"rpc <--\")\n\t\tif r := recover(); r != nil {\n\t\t\tvar msg string\n\t\t\tif e, ok := r.(error); ok {\n\t\t\t\tmsg = e.Error()\n\t\t\t} else {\n\t\t\t\tmsg = fmt.Sprintf(\"%v\", r)\n\t\t\t}\n\t\t\tl.Error().Stack().Msgf(\"Replicache panicked with: %s\\n\", msg)\n\t\t\tret = nil\n\t\t\terr = fmt.Errorf(\"Replicache panicked with: %s - see stderr for more\", msg)\n\t\t}\n\t}()\n\n\tswitch rpc {\n\tcase \"list\":\n\t\treturn list(l)\n\tcase \"open\":\n\t\treturn nil, open(dbName, l)\n\tcase \"close\":\n\t\treturn nil, close(dbName)\n\tcase \"drop\":\n\t\treturn nil, drop(dbName)\n\tcase \"version\":\n\t\treturn []byte(version.Version()), nil\n\tcase \"profile\":\n\t\tprofile(l)\n\t\treturn nil, nil\n\tcase \"setLogLevel\":\n\t\t// dbName param is ignored\n\t\treturn nil, setLogLevel(data)\n\t}\n\n\tconn := connections[dbName]\n\tif conn == nil {\n\t\treturn nil, errors.New(\"specified database is not open\")\n\t}\n\n\tl = l.With().Str(\"cid\", conn.db.ClientID()).Logger()\n\n\tswitch rpc {\n\tcase \"getRoot\":\n\t\treturn conn.dispatchGetRoot(data)\n\tcase \"has\":\n\t\treturn conn.dispatchHas(data)\n\tcase \"get\":\n\t\treturn conn.dispatchGet(data)\n\tcase \"scan\":\n\t\treturn conn.dispatchScan(data)\n\tcase \"put\":\n\t\treturn conn.dispatchPut(data)\n\tcase \"del\":\n\t\treturn conn.dispatchDel(data)\n\tcase \"beginSync\":\n\t\treturn conn.dispatchBeginSync(data, l)\n\tcase \"maybeEndSync\":\n\t\treturn conn.dispatchMaybeEndSync(data)\n\tcase \"openTransaction\":\n\t\treturn conn.dispatchOpenTransaction(data)\n\tcase \"closeTransaction\":\n\t\treturn conn.dispatchCloseTransaction(data)\n\tcase \"commitTransaction\":\n\t\treturn conn.dispatchCommitTransaction(data, l)\n\t}\n\tchk.Fail(\"Unsupported rpc name: %s\", rpc)\n\treturn nil, nil\n}", "title": "" }, { "docid": "c130546ffdc587e46478c33b61c7ed34", "score": "0.5136557", "text": "func dataStoreHandler() {\n\n\tfor {\n\n\t\t//Receive request bundle from queue and process sequentially\n\t\trequestBundle := <-requestQueue\n\n\t\tdebug(\"Request received : \" + requestBundle.command[0])\n\t\tswitch requestBundle.command[0] {\n\n\t\tcase \"get\":\n\t\t\tgetValueMeta(requestBundle.clientConn, requestBundle.command, \"value\")\n\t\tcase \"getm\":\n\t\t\tgetValueMeta(requestBundle.clientConn, requestBundle.command, \"meta\")\n\t\tcase \"set\":\n\t\t\tsetValue(requestBundle.clientConn, requestBundle.command, requestBundle.data)\n\t\tcase \"cas\":\n\t\t\tcasValue(requestBundle.clientConn, requestBundle.command, requestBundle.data)\n\t\tcase \"delete\":\n\t\t\tdeleteValue(requestBundle.clientConn, requestBundle.command)\n\t\tcase \"expire\":\n\t\t\texpiryHandler(requestBundle.command)\n\t\t}\n\n\t\t//Send ACK\n\t\trequestBundle.ack <- true\n\t}\n}", "title": "" }, { "docid": "1f6117c9d6194a42709734c604b5e393", "score": "0.5136063", "text": "func stateMachine() {\n\t// LevelDb for kv store\n\tdb, err := leveldb.OpenFile(\"table1.db\"+fmt.Sprintf(\"%d\", server.Id), nil)\n\tCheck(err)\n\n\t// Contain reply to client\n\tvar reply string\n\tfor {\n\t\ttime.Sleep(time.Millisecond * 10)\n\t\tif server.lastApplied < server.commitIndex {\n\t\t\tserver.lastApplied = server.lastApplied + 1\n\t\t\tcommand := s.Split(server.logEntry[server.lastApplied], \" \")\n\t\t\tif command[2] == SET {\n\t\t\t\tvalue := \"\"\n\t\t\t\tfor i := 4; i < len(command); i = i + 1 {\n\t\t\t\t\tif i < len(command)-1 {\n\t\t\t\t\t\tvalue = value + command[i] + \" \"\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = value + command[i]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\terr = db.Put([]byte(command[3]), []byte(value), nil)\n\t\t\t\treply = command[1] + \" \" + NOERROR\n\t\t\t} else if command[2] == GET {\n\t\t\t\ttemp, err := db.Get([]byte(command[3]), nil)\n\t\t\t\tCheck(err)\n\t\t\t\treply = command[1] + \" \" + btos(temp)\n\n\t\t\t} else if command[2] == DELETE {\n\t\t\t\terr = db.Delete([]byte(command[3]), nil)\n\t\t\t\treply = command[1] + \" \" + NOERROR\n\t\t\t} else {\n\t\t\t\treply = command[1] + \" \" + ERROR\n\t\t\t}\n\t\t\tCheck(err)\n\n\t\t\t// Only leader can be reply to client\n\t\t\tif phase == LEADER {\n\t\t\t\tresponder.Send(reply, 0)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "80cab92e35c214c2f1606f8bcf5969b3", "score": "0.5134946", "text": "func handleDnsQuery(database *Database, resolver *Resolver) func (dnsResponseWriter dns.ResponseWriter, requestDnsMsg *dns.Msg) {\n\treturn func (dnsResponseWriter dns.ResponseWriter, requestDnsMsg *dns.Msg) {\n\n\t\tlog.Printf(\"DEBUG Received query for resolver '%s' on local addr %s network %s. Message is: \\n%s\\n\",\n\t\t\tresolver.Id, dnsResponseWriter.LocalAddr(), dnsResponseWriter.LocalAddr().Network(), requestDnsMsg)\n\t\t\n\t\tswitch requestDnsMsg.Opcode {\n\t\tcase dns.OpcodeQuery:\n\t\t\t// Try to find answer in our internal db\n\t\t\tlog.Printf(\"DEBUG Trying internal resolution with resolver '%s'\\n\", resolver.Id)\n\t\t\tdnsMsg := queryOperation(database, dnsResponseWriter, requestDnsMsg, resolver)\n\t\t\tlog.Printf(\"DEBUG Internal resolution Rcode is %s\\n\", dnsMsg.Rcode)\n\t\t\tif dnsMsg.Rcode == dns.RcodeSuccess {\n\t\t\t\tlog.Printf(\"DEBUG Internal resolution succeeded. Responding with message \\n%s\\n\", dnsMsg)\n\t\t\t\tdnsResponseWriter.WriteMsg(dnsMsg)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// We did not succeed in internal lookup, so try forwarders\n\t\t\tlog.Printf(\"DEBUG Trying resolver '%s' forwarders: %s\\n\", resolver.Id, resolver.Forwarders)\n\t\t\terr, forwardDnsMsg := resolver.Forward(requestDnsMsg)\n\t\t\tif err == nil && forwardDnsMsg != nil {\n\t\t\t\t// Return successful forward resolution\n\t\t\t\tlog.Printf(\"DEBUG Forward resolution succeeded with Rcode %s. Responding with message: \\n%s\\n\", forwardDnsMsg.Rcode, forwardDnsMsg)\n\t\t\t\tdnsResponseWriter.WriteMsg(forwardDnsMsg)\n\t\t\t} else {\n\t\t\t\t// TODO separate log message for nil and not nil forwardDnsMsg\n\t\t\t\t// TODO is this correct behavior?\n\t\t\t\t// Default to our (failed) internal lookup\n\t\t\t\tlog.Printf(\"DEBUG Forward resolution failed. Returning (failed) internal lookup: \\n%s\\n\", dnsMsg)\n\t\t\t\tdnsResponseWriter.WriteMsg(dnsMsg)\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.Printf(\"WARN Opcode %s not supported\\n\", requestDnsMsg.Opcode)\n\t\t\t// Return a failure message\n\t\t\tdnsMsg := new(dns.Msg)\n\t\t\tdnsMsg.Rcode = dns.RcodeNotImplemented\n\t\t\tdnsMsg.Id = requestDnsMsg.Id\n\t\t\tdnsMsg.RecursionDesired = requestDnsMsg.RecursionDesired // Copy rd bit\n\t\t\tdnsMsg.Response = true\n\t\t\tdnsMsg.Opcode = requestDnsMsg.Opcode\n\t\t\tdnsMsg.RecursionAvailable = false\n\t\t\tdnsResponseWriter.WriteMsg(dnsMsg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44cb9f3cb562c56db924ed1205f7634d", "score": "0.51269686", "text": "func Process(DBAbstract *model.DBAbstract) {\n\n\tendpoint := DBAbstract.DBType\n\n\tif endpoint == \"cassandra\" {\n\n\t\tcassandra.Handle(DBAbstract)\n\t} else if endpoint == \"presto\" {\n\n\t\tpresto.Handle(DBAbstract)\n\t}\n\n}", "title": "" }, { "docid": "820f9f2cfe595b16c5de5e2e0ba1da69", "score": "0.51147", "text": "func (self *Replication) getnxHandler(msg Message) {\n query := &struct {\n Prefix string \"prefix\"\n Except []string \"except\"\n }{}\n if msg.DecodePayload(query) != nil {\n log.Printf(\"Error in GETNX request\")\n return\n }\n except := make(map[string]bool)\n for _, e := range query.Except {\n except[e] = true\n }\n go self.getnxHandlerIntern(query.Prefix, except, msg.connection)\n}", "title": "" }, { "docid": "2256a3fe901d7fae46399daf2fc8a337", "score": "0.50953716", "text": "func ControlDB(oper string) error {\n\tvar arg1, arg2 string\n\tfmt.Scanln(&arg1, &arg2)\n\t//fmt.Println(arg1, arg2)\n\trc := myredis.RedisClient.Get()\n\tdefer rc.Close()\n\tif arg2 == \"_\" {\n\t\trep, err := rc.Do(oper, arg1)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif rep != nil {\n\t\t\tfmt.Println(rep)\n\t\t}\n\t} else {\n\n\t\trep, err := rc.Do(oper, arg1, arg2)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif rep != nil {\n\t\t\tfmt.Println(rep)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4ebcbd9d4983e392e1448b67c437444", "score": "0.5095033", "text": "func (m *MySQL) Handler() error {\n\tdefer handlePanic()\n\n\tsuccess, err := m.handleLogin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !success {\n\t\tlogger.Warning(\"Login failed\")\n\t\treturn nil\n\t}\n\tfor {\n\t\tvar buf []byte\n\t\tbuf, err = m.reader(m.client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := buf[4:]\n\n\t\tswitch data[0] {\n\t\tcase 0x01: //Quit\n\t\t\treturn nil\n\t\tcase 0x02: //UseDB\n\t\t\tm.currentDB = string(data[1:])\n\t\t\tlogger.Infof(\"Using database: %v\", m.currentDB)\n\t\tcase 0x03: //Query\n\t\t\tquery := data[1:]\n\t\t\tlogger.Infof(\"Query: %s\", query)\n\t\t\tcontext := sql.QueryContext{\n\t\t\t\tQuery: string(query),\n\t\t\t\tDatabase: m.currentDB,\n\t\t\t\tUser: m.username,\n\t\t\t\tClient: remoteAddrToIP(m.client.RemoteAddr()),\n\t\t\t\tTime: time.Now().Unix(),\n\t\t\t}\n\t\t\tif config.Config.Learning {\n\t\t\t\tgo training.AddToTrainingSet(context)\n\t\t\t} else {\n\t\t\t\tif config.Config.ActionFunc != nil && !training.CheckQuery(context) {\n\t\t\t\t\treturn config.Config.ActionFunc(m.client)\n\t\t\t\t}\n\t\t\t}\n\t\tcase 0x04: //Show fields\n\t\t\tlogger.Debugf(\"Show fields: %s\", data[1:])\n\t\tdefault:\n\t\t\tlogger.Debugf(\"Unknown Data[0]: %x\", data[0])\n\t\t}\n\n\t\t//Send query/request to server\n\t\t_, err = m.server.Write(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Recive response\n\t\tbuf, err = m.reader(m.server)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//Send response to client\n\t\t_, err = m.client.Write(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a5a2bc9745983a454063cbf79920534a", "score": "0.50950235", "text": "func (s ServerResource) QueryHandlerV1_1(w http.ResponseWriter, r *http.Request) {\n\ts.QueryHandler(w, r)\n}", "title": "" }, { "docid": "ea615dfc9b0dd18e1a782430c9de3d28", "score": "0.5089759", "text": "func dummyQueryHandler(w http.ResponseWriter, r *http.Request, db *sql.DB) *apiError {\n\n\terr := db.Ping()\n\tif err != nil {\n\t\treturn &apiError{\n\t\t\terr,\n\t\t\t\"db ping error\",\n\t\t\thttp.StatusInternalServerError,\n\t\t}\n\t}\n\n\trow := db.QueryRow(\"select (1 + 4) * 20\")\n\tif row == nil {\n\t\treturn &apiError{\n\t\t\terr,\n\t\t\t\"sql query error\",\n\t\t\thttp.StatusInternalServerError,\n\t\t}\n\t}\n\n\tvar result int\n\terr = row.Scan(&result)\n\tif err != nil {\n\t\treturn &apiError{\n\t\t\terr,\n\t\t\t\"sql query error\",\n\t\t\thttp.StatusInternalServerError,\n\t\t}\n\t}\n\n\tlog.Println(\"sql success\")\n\treturn apiStringHelper(\n\t\t200,\n\t\t\"{\\\"result\\\": \\\"\"+strconv.Itoa(result)+\"\\\"}\",\n\t\tw)\n}", "title": "" }, { "docid": "2825c57aabe2952c04158fde394a7838", "score": "0.50861794", "text": "func (s *Server) handler(w http.ResponseWriter, r *http.Request) {\n\treq := struct {\n\t\tID uint64 `json:\"id\"`\n\t\tMethod string `json:\"method\"`\n\t\tParams *json.RawMessage `json:\"params\"`\n\t}{}\n\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\trest.SendErrorJSON(w, r, s.logger, http.StatusBadRequest, err, req.Method)\n\t\treturn\n\t}\n\tfn, ok := s.funcs.m[req.Method]\n\tif !ok {\n\t\trest.SendErrorJSON(w, r, s.logger, http.StatusNotImplemented, fmt.Errorf(\"unsupported method\"), req.Method)\n\t\treturn\n\n\t}\n\n\tparams := json.RawMessage{}\n\tif req.Params != nil {\n\t\tparams = *req.Params\n\t}\n\n\trender.JSON(w, r, fn(req.ID, params))\n}", "title": "" }, { "docid": "4b71edd313c6052939790e82750b7c2e", "score": "0.50816405", "text": "func graphQLHandler(c echo.Context) error {\n\n\tgrq := new(GQLRequest)\n\tif err := c.Bind(grq); err != nil {\n\t\treturn err\n\t}\n\n\tquery := grq.Query\n\tvariables := grq.Variables\n\tgqlContext := map[string]interface{}{}\n\t// log.Printf(\"variables: %v\\n\\n\", variables)\n\tresult, err := executor.Execute(gqlContext, query, variables, \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn c.JSON(http.StatusOK, result)\n\n}", "title": "" }, { "docid": "2bfbceac73d4ad552cadb55c9363d012", "score": "0.50777364", "text": "func (t *tcpServer) handle(c net.Conn) {\n\treply := make([]byte, 1)\n\tbuf := make([]byte, 0)\n\n\t// load msg\n\tfor {\n\t\txx := make([]byte, bufSize)\n\t\tres, err := c.Read(xx)\n\t\tbuf = append(buf, xx[:res]...)\n\t\tif err != nil || res < bufSize {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar b Box\n\terr := json.Unmarshal(buf, &b)\n\tif err != nil {\n\t\treply[0] = reError\n\t\treply = append(reply, []byte(err.Error())...)\n\t\tgoto sendReply\n\t}\n\tif p, ok := t.procedures[b.Method]; ok {\n\t\tdoc := gojsonschema.NewBytesLoader(b.Query)\n\t\tresult, err := gojsonschema.Validate(p.schema, doc)\n\n\t\tif err != nil {\n\t\t\treply[0] = reError\n\t\t\treply = append(reply, []byte(err.Error())...)\n\t\t\tgoto sendReply\n\t\t}\n\t\tif !result.Valid() {\n\t\t\tvar errStr string\n\t\t\tfor _, desc := range result.Errors() {\n\t\t\t\terrStr = fmt.Sprintf(\"%s %v; \", errStr, desc)\n\t\t\t}\n\t\t\treply[0] = reError\n\t\t\treply = append(reply, []byte(errStr)...)\n\t\t\tgoto sendReply\n\t\t}\n\n\t\tif err != nil {\n\t\t\treply[0] = reError\n\t\t\treply = append(reply, []byte(err.Error())...)\n\t\t\tgoto sendReply\n\t\t}\n\n\t\tdst := p.getStruct()\n\n\t\tif err := json.Unmarshal(b.Query, dst); err != nil {\n\t\t\treply[0] = reError\n\t\t\treply = append(reply, []byte(err.Error())...)\n\t\t} else {\n\t\t\treply[0] = reOk\n\t\t\treply = append(reply, p.method(dst)...)\n\t\t}\n\t\tgoto sendReply\n\t} else {\n\t\treply[0] = reError\n\t\treply = append(reply, []byte(\"No procedure\")...)\n\t\tgoto sendReply\n\t}\nsendReply:\n\tc.Write(reply)\n}", "title": "" }, { "docid": "107e43d61cb75322b78bf7c1279dedf0", "score": "0.50747305", "text": "func handleConnection(conn *net.UnixConn) {\n\t// Close connection when finish handling\n\tdefer func() {\n\t\tconn.Close()\n\t}()\n\n\t// Read data and return response\n\tdata, err := parseRequest(conn)\n\n\tif err != nil {\n\t\tLogger.Error(\"read the request data error\", zap.Error(err))\n\t\treturn\n\t}\n\n\t// 反序列化\n\tvar call model.Call\n\tdecoder := gob.NewDecoder(bytes.NewReader(data))\n\tdecoder.Decode(&call)\n\n\t// 存储到 redis 交给 logstash 处理\n\tcall.Save()\n\n\t// Send back response\n\tsendResponse(conn, []byte(time.Now().String()))\n\n}", "title": "" }, { "docid": "908eccbcc1c3e0e40fb056dec883a3a6", "score": "0.50734025", "text": "func processQuery(conn *net.UnixConn) {\n\t// Read a query from the given socket.\n\tdefer conn.Close()\n\tjsonDec := json.NewDecoder(conn)\n\tvar query RemoteQuery\n\tjsonDec.Decode(&query)\n\n\t// Process the query.\n\tswitch query.Request {\n\tcase \"hello\":\n\t\thelloFromMake(&query, conn)\n\tcase \"spawn\":\n\t\tenqueueCommand(&query, conn)\n\tcase \"status\":\n\t\tawaitCommand(&query, conn)\n\tcase \"kill\":\n\t\tkillProcess(&query, conn)\n\tdefault:\n\t\tlog.Fatalf(\"Received unrecognized request %q\", query.Request)\n\t}\n}", "title": "" }, { "docid": "06a8dda5cce43b2647a41f50386bbae5", "score": "0.50649047", "text": "func (ns *NameServer) handle(w dns.ResponseWriter, req *dns.Msg) {\n\tdefer w.Close()\n\n\tif req.MsgHdr.Response {\n\t\treturn\n\t}\n\n\tvar resp, err = ns.service.Query(w.RemoteAddr().String(), req)\n\tif nil != err {\n\t\tns.service.Logger.Write(LevelError, \" [E] client %s query %#v error: %v\\n\", w.RemoteAddr().String(), req, err)\n\t} else if nil == resp {\n\t\tns.service.Logger.Write(LevelError, \" [E] client %s query %#v result is empty\\n\", w.RemoteAddr().String(), req)\n\t} else if err = w.WriteMsg(resp); nil != err {\n\t\tns.service.Logger.Write(LevelError, \" [E] send result to client %s %#v error: %v\\n\", w.RemoteAddr().String(), req, err)\n\t}\n}", "title": "" }, { "docid": "a29b797b88445038dc8bf0eb0225bd95", "score": "0.5043224", "text": "func rawDispatch(dispatcher map[string]CommandHandler) CommandHandler {\n\treturn func(c *common.Ctx) {\n\t\tif v, ok := dispatcher[c.DbUser.State]; ok {\n\t\t\tv(c)\n\t\t} else {\n\t\t\tlog.Printf(\"Unbound state %v in text dispatcher\\n\", c.DbUser.State)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d23d4c5e4ea35692b4a5d823b71dd6ec", "score": "0.50401574", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n\t//qpath := r.URL.Path[1:]\n\tqkey := r.URL.Query().Get(\"q\")\n\n\tswitch strings.ToUpper(r.Method) { // process http verbs:\n\n\tcase \"GET\":\n\t\tvar val string\n\t\tvar ok bool\n\t\tsubk := r.URL.Query().Get(\"k\") // subkey\n\n\t\tif len(subk) == 0 {\n\t\t\tval, ok = hdGet(w, r, qkey)\n\t\t} else {\n\t\t\tval, ok = hdGetSubk(w, r, qkey, subk)\n\t\t}\n\n\t\tif !ok {\n\t\t\tw.WriteHeader(http.StatusNotFound) // 404 ERROR CODE\n\t\t\tfmt.Fprintf(w, \"key %s not found\", qkey)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s\", val)\n\t\t}\n\n\tcase \"DELETE\":\n\n\t\tif ok := hdDel(w, r, qkey); !ok {\n\t\t\tw.WriteHeader(http.StatusNotFound) // 404 if cant delete\n\t\t\tfmt.Fprintf(w, \"Can`t delete key(s) %s\", qkey)\n\t\t}\n\t\t//else {fmt.Fprintf(w, \"DELETED key==%s\", qkey) }\n\n\tcase \"POST\": // add error check etc\n\t\tvar ttl int // 0\n\t\tttl, _ = strconv.Atoi(r.URL.Query().Get(\"t\"))\n\t\tif ok := hdPost(w, r, qkey, ttl); !ok { // process post\n\t\t\tw.WriteHeader(http.StatusNotFound) // 404 cant add the key\n\t\t\tfmt.Fprintf(w, \"Can`t add key %s with ttl==%d\", qkey, ttl)\n\t\t}\n\t\t//else {w.WriteHeader(http.StatusCreated)} // 201 commented means: 200\n\n\tcase \"HEAD\": // return list of keys matched the mask (regex)\n\n\t\tval, ok := hdHead(w, r, qkey)\n\t\tif !ok {\n\t\t\tw.WriteHeader(http.StatusNotFound) // 404 ERROR CODE\n\t\t\tfmt.Fprintf(w, \"no keys found for the pattern: %s\", qkey)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s\", val)\n\t\t}\n\n\tdefault: //PUT verb are also here\n\t\tw.WriteHeader(http.StatusNotImplemented) // 501\n\t\tfmt.Fprintf(w, \"unknown method: %s\\n\", r.Method)\n\t\treturn\n\t}\n\n\t//fmt.Printf(\"qpath==[%s], qkey==[%s]\\n\", qpath, qkey) //html.EscapeString()\n}", "title": "" }, { "docid": "890bd43713cf474bdb611f7f0128e187", "score": "0.5036199", "text": "func handleQuery(uc *net.UDPConn, a net.Addr, b []byte, sni string) {\n\ttag := a.String()\n\n\t/* Make sure the query is a DNS query */\n\tvar m dnsmessage.Message\n\tif err := m.Unpack(b); nil != err {\n\t\tlog.Printf(\"[%v] Invalid query: %v\", tag, err)\n\t\treturn\n\t}\n\n\t/* We only support one question at a time */\n\tswitch len(m.Questions) {\n\tcase 0:\n\t\tlog.Printf(\"[%v] No questions in query\", tag)\n\t\treturn\n\tcase 1: /* This is what we expect */\n\tdefault:\n\t\tlog.Printf(\n\t\t\t\"[%v] Got %v questions in query, but only \"+\n\t\t\t\t\"1 question is supported\",\n\t\t\ttag,\n\t\t\tlen(m.Questions),\n\t\t)\n\t\treturn\n\t}\n\n\t/* We'll need to stick the ID in the repsonse */\n\tid := m.ID\n\n\t/* Now that we've parsed the query, make a better logging tag */\n\ttag = fmt.Sprintf(\n\t\t\"%s-%s/%s\",\n\t\ta,\n\t\tm.Questions[0].Name,\n\t\tm.Questions[0].Type,\n\t)\n\n\t/* Roll an HTTP request for the DNS query */\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\tfmt.Sprintf(\n\t\t\t\"https://\"+sni+\"/resolve\"+\n\t\t\t\t\"?name=%s\"+\n\t\t\t\t\"&type=%d\"+\n\t\t\t\t\"&ct=application/dns-message\",\n\t\t\tm.Questions[0].Name,\n\t\t\tm.Questions[0].Type,\n\t\t),\n\t\tnil,\n\t)\n\tif nil != err {\n\t\tlog.Printf(\"[%v] Error creating HTTPS request: %v\", tag, err)\n\t\treturn\n\t}\n\treq.Host = host\n\n\t/* Send forth the request */\n\tres, err := http.DefaultClient.Do(req)\n\tif nil != err {\n\t\tlog.Printf(\"[%v] Error making HTTPS query: %v\", tag, err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\n\t/* Make sure we got it back */\n\trb, err := ioutil.ReadAll(res.Body)\n\tif nil != err {\n\t\tlog.Printf(\"[%v] Error reading HTTPS response: %v\", tag, err)\n\t\treturn\n\t}\n\tif http.StatusOK != res.StatusCode {\n\t\tif 0 == len(rb) {\n\t\t\tlog.Printf(\n\t\t\t\t\"[%v] Non-OK HTTP response: %v\",\n\t\t\t\ttag,\n\t\t\t\tres.Status,\n\t\t\t)\n\t\t} else {\n\t\t\tlog.Printf(\"[%v] Non-OK HTTP response: %v (%q)\",\n\t\t\t\ttag,\n\t\t\t\tres.Status,\n\t\t\t\trb,\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\tif 0 == len(rb) {\n\t\tlog.Printf(\"[%v] Empty HTTPS response body\", tag)\n\t\treturn\n\t}\n\n\t/* Make sure the body is also DNS and put back the ID */\n\tif err := m.Unpack(rb); nil != err {\n\t\tlog.Printf(\"[%v] Invalid DNS response %q: %v\", tag, rb, err)\n\t\treturn\n\t}\n\tm.ID = id\n\n\t/* Send the response back */\n\trb, err = m.AppendPack(rb[:0])\n\tif nil != err {\n\t\tlog.Printf(\"[%v] Error packing DNS response: %v\", tag, err)\n\t\treturn\n\t}\n\tif _, err := uc.WriteTo(rb, a); nil != err {\n\t\tlog.Printf(\"[%v] Error sending response: %v\", tag, err)\n\t}\n\tlog.Printf(\"[%v] %s %s\", a, m.Questions[0].Name, m.Questions[0].Type)\n}", "title": "" }, { "docid": "f13bd79376aa6d9afb854fa733a9c119", "score": "0.50336003", "text": "func Handler(db2 *sql.DB) *mux.Router {\n\tdb = db2\n\troute := mux.NewRouter()\n\troute.HandleFunc(\"/fund\", fundPlayerHandler).Queries(\"playerId\", \"{playerId:[0-9]+}\", \"points\", \"{points:[0-9]+}\").Methods(\"GET\")\n\troute.HandleFunc(\"/announceTournament\", announceTournamentHandler).Queries(\"tournamentId\", \"{tournamentId:[0-9]+}\", \"deposit\", \"{deposit:[0-9]+}\").Methods(\"GET\")\n\troute.HandleFunc(\"/joinTournament\", joinTournamentHandler).Queries(\"playerId\", \"{playerId:[0-9]+}\", \"tournamentId\", \"{tournamentId:[0-9]+}\").Methods(\"GET\")\n\troute.HandleFunc(\"/finishTournament\", finishTournamentHandler).Queries(\"tournamentId\", \"{tournamentId:[0-9]+}\").Methods(\"GET\")\n\troute.HandleFunc(\"/resultTournament\", resultTournamentHandler).Methods(\"GET\")\n\troute.HandleFunc(\"/balance\", playerBalanceHandler).Queries(\"playerId\", \"{playerId:[0-9]+}\").Methods(\"GET\")\n\treturn route\n}", "title": "" }, { "docid": "69367c3a0f1b5911689626a4026a8281", "score": "0.5017784", "text": "func (c *Client) handle(cmd string, arg string, line string) {\n\tc.logTrace(\"In state %d, got command '%s', args '%s'\", c.state, cmd, arg)\n\n\t// Check against valid POP3 commands\n\tif cmd == \"\" {\n\t\tc.Write(\"-ERR Speak up\")\n\t\t//return\n\t}\n\n\tif cmd != \"\" && !commands[cmd] {\n\t\tc.Write(\"-ERR \" + fmt.Sprintf(\"Syntax error, %v command unrecognized\", cmd))\n\t\tc.logWarn(\"Unrecognized command: %v\", cmd)\n\t}\n\n\tswitch cmd {\n\tcase \"CAPA\":\n\t\tc.capaHandler(cmd, arg)\n\tcase \"USER\":\n\t\tc.userHandler(cmd, arg)\n\tcase \"PASS\":\n\t\tc.passHandler(cmd, arg)\n\tcase \"STAT\":\n\t\t// Reset session\n\t\tc.statHandler(cmd, arg)\n\tcase \"LIST\":\n\t\t// Reset session\n\t\tc.listHandler(cmd, arg)\n\t\t//return\n\tcase \"UIDL\":\n\t\t// Reset session\n\t\tc.uidlHandler(cmd, arg)\n\t\t//return\t\n\tcase \"RETR\":\n\t\tc.retrHandler(cmd, arg)\t\n\tcase \"TOP\":\n\t\tc.topHandler(cmd, arg)\n\tcase \"DELE\":\n\t\tc.deleHandler(cmd, arg)\t\n\t/*\t\n\tcase \"APOP\":\n\t\tc.apopHandler(cmd, arg)\t\t\n\t\t//return\n\t\t*/\n\tcase \"QUIT\":\n\t\tc.Write(\"+OK server logging out\\r\\n\")\n\t\tc.state = STATE_UNAUTHORIZED\n\t\tc.user = nil\n\t\tc.username = \"\"\n\t\tc.server.killClient(c)\n\t\t//return\n\tdefault:\n\t\tc.errors++\n\t\tif c.errors > 3 {\n\t\t\tc.Write(\"-ERR Too many unrecognized commands\")\n\t\t\tc.server.killClient(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d7b29d1a6dec69d44feaebeb4de062e", "score": "0.500842", "text": "func handlerDb(r *ghttp.Request) {\n\tvar world World\n\terr := worldStatement.QueryRow(grand.Intn(worldRowCount)+1).\n\t\tScan(\n\t\t\t&world.Id,\n\t\t\t&world.RandomNumber,\n\t\t)\n\tif err != nil {\n\t\tr.Response.WriteStatusExit(500, err.Error())\n\t}\n\tr.Response.WriteJson(world)\n}", "title": "" }, { "docid": "c06c3fc27514f8ab5717777a02179b05", "score": "0.5007674", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n\n\tvar message []byte\n\t\n\t// Handle different functions\n\tswitch function {\n\t\tcase \"getAll\" :\n\n\t\t\tvoters ,err := getAllRows(stub)\n\t\t\tif err != nil { \n\t\t\t\treturn nil, fmt.Errorf(\"Error in getting all records.. %s\", err)\n\t\t\t}\n\t\n\t\t\tjsonVoters, jsonErr := json.Marshal(voters)\n\t\t\tif jsonErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Error in marshaling JSON: %s\", err)\n\t\t\t}\n\t\t\tmessage = jsonVoters\n\t\t\t\n\t\tcase \"getOne\" :\n\t\t\n\t\t\t_, voter , err := getRow(stub, args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Error in getting a record.. %s\", err)\n\t\t\t}\n\t\t\t\n\t\t\tjsonVoter, jsonErr := json.Marshal(voter)\n\t\t\tif jsonErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Error in marshaling JSON: %s\", err)\n\t\t\t}\n\t\t\tmessage = jsonVoter\n\t\t\t\n\t\tcase \"authentication\" :\n\t\t\n\t\t\texist, voter , err := getRow(stub, args[0])\n\t\t\tif err != nil { \n\t\t\t\treturn nil, fmt.Errorf(\"Error in getting a ecord.. %s\", err)\n\t\t\t}\n\t\t\t\n\t\t\tif !exist {\n\t\t\t\tmessage = []byte(\"Not Exist\")\n\t\t\t} else {\n\t\t\t\tif (voter.Password == args[1]) {\n\t\t\t\t\tmessage = []byte(\"Authenticated\")\n\t\t\t\t} else {\n\t\t\t\t\tmessage = []byte(\"Not Authenticated\")\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\tcase \"existCheck\" :\n\t\t\n\t\t\texist, _ , err := getRow(stub, args[0])\n\t\t\tif err != nil { \n\t\t\t\treturn nil, fmt.Errorf(\"Error in getting a record.. %s\", err)\n\t\t\t}\n\t\t\n\t\t\tif !exist {\n\t\t\t\tmessage = []byte(\"Not Exist\")\n\t\t\t} else {\n\t\t\t\tmessage = []byte(\"Exist\")\n\t\t\t} \t\t\n\t\t\t\n\t\tcase \"count\" :\n\n\t\t\tvoters ,err := getAllRows(stub)\n\t\t\tif err != nil { \n\t\t\t\treturn nil, fmt.Errorf(\"Error in getting all records.. %s\", err)\n\t\t\t}\n\t\t\t\n\t\t\tvar count [64]int\n\t\t\tfor i := 0 ; i < len(voters) ; i++ {\n\t\t\t\tcount[voters[i].Destination] = count[voters[i].Destination] + 1 \n\t\t\t}\n\t\t\t\n\t\t\tjsonCount, jsonErr := json.Marshal(count)\n\t\t\tif jsonErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Error in marshaling JSON: %s\", err)\n\t\t\t}\n\t\t\tmessage = jsonCount\n\t\t\t\n\t\tdefault :\n\t\t\treturn nil, errors.New(\"Received unknown function invocation: \" + function)\n\t}\n\t\n\t\treturn message, nil\n}", "title": "" }, { "docid": "7b721aa3f4a87ebbf97b77b60ec0a7a3", "score": "0.5006791", "text": "func (c *gatewayConn) handle(request *protocol.Request) (*protocol.Response, error) {\n\tvar message proto.Message\n\n\tswitch request.Code {\n\tcase protocol.RequestCode_OPEN:\n\t\tmessage = &protocol.RequestOpen{}\n\tcase protocol.RequestCode_PREPARE:\n\t\tmessage = &protocol.RequestPrepare{}\n\tcase protocol.RequestCode_EXEC:\n\t\tmessage = &protocol.RequestExec{}\n\tcase protocol.RequestCode_QUERY:\n\t\tmessage = &protocol.RequestQuery{}\n\tcase protocol.RequestCode_NEXT:\n\t\tmessage = &protocol.RequestNext{}\n\tcase protocol.RequestCode_COLUMN_TYPE_SCAN_TYPE:\n\t\tmessage = &protocol.RequestColumnTypeScanType{}\n\tcase protocol.RequestCode_COLUMN_TYPE_DATABASE_TYPE_NAME:\n\t\tmessage = &protocol.RequestColumnTypeDatabaseTypeName{}\n\tcase protocol.RequestCode_ROWS_CLOSE:\n\t\tmessage = &protocol.RequestRowsClose{}\n\tcase protocol.RequestCode_STMT_CLOSE:\n\t\tmessage = &protocol.RequestStmtClose{}\n\tcase protocol.RequestCode_BEGIN:\n\t\tmessage = &protocol.RequestBegin{}\n\tcase protocol.RequestCode_COMMIT:\n\t\tmessage = &protocol.RequestCommit{}\n\tcase protocol.RequestCode_ROLLBACK:\n\t\tmessage = &protocol.RequestRollback{}\n\tcase protocol.RequestCode_CLOSE:\n\t\tmessage = &protocol.RequestClose{}\n\tcase protocol.RequestCode_CONN_EXEC:\n\t\tmessage = &protocol.RequestConnExec{}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid request code %d\", request.Code)\n\t}\n\n\tif err := proto.Unmarshal(request.Data, message); err != nil {\n\t\treturn nil, fmt.Errorf(\"request parse error: %w\", err)\n\t}\n\n\t// The very first request must be an OPEN one.\n\tif c.driverConn == nil && request.Code != protocol.RequestCode_OPEN {\n\t\treturn nil, fmt.Errorf(\"expected OPEN request, got %s\", request.Code)\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tswitch r := message.(type) {\n\tcase *protocol.RequestOpen:\n\t\treturn c.handleOpen(ctx, r)\n\tcase *protocol.RequestPrepare:\n\t\treturn c.handlePrepare(ctx, r)\n\tcase *protocol.RequestExec:\n\t\treturn c.handleExec(ctx, r)\n\tcase *protocol.RequestQuery:\n\t\treturn c.handleQuery(ctx, r)\n\tcase *protocol.RequestNext:\n\t\treturn c.handleNext(ctx, r)\n\tcase *protocol.RequestColumnTypeScanType:\n\t\treturn c.handleColumnTypeScanType(ctx, r)\n\tcase *protocol.RequestColumnTypeDatabaseTypeName:\n\t\treturn c.handleColumnTypeDatabaseTypeName(ctx, r)\n\tcase *protocol.RequestRowsClose:\n\t\treturn c.handleRowsClose(ctx, r)\n\tcase *protocol.RequestStmtClose:\n\t\treturn c.handleStmtClose(ctx, r)\n\tcase *protocol.RequestBegin:\n\t\treturn c.handleBegin(ctx, r)\n\tcase *protocol.RequestCommit:\n\t\treturn c.handleCommit(ctx, r)\n\tcase *protocol.RequestRollback:\n\t\treturn c.handleRollback(ctx, r)\n\tcase *protocol.RequestClose:\n\t\treturn c.handleClose(ctx, r)\n\tcase *protocol.RequestConnExec:\n\t\treturn c.handleConnExec(ctx, r)\n\tdefault:\n\t\tpanic(\"unhandled request payload type\")\n\t}\n}", "title": "" }, { "docid": "9768d0d61939d954be250c41a6ba7cf0", "score": "0.49983084", "text": "func RunHTTPServer(_db *gorm.DB, _lock *sync.Mutex, _synced *d.SyncState, _redisClient *redis.Client) {\n\n\t// Extracted from, to field of range based block query ( using block numbers/ time stamps )\n\t// gets parsed into unsigned integers\n\trangeChecker := func(from string, to string, limit uint64) (uint64, uint64, error) {\n\t\t_from, err := strconv.ParseUint(from, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, 0, errors.New(\"Failed to parse integer\")\n\t\t}\n\n\t\t_to, err := strconv.ParseUint(to, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, 0, errors.New(\"Failed to parse integer\")\n\t\t}\n\n\t\tif !(_to-_from < limit) {\n\t\t\treturn 0, 0, errors.New(\"Range too long\")\n\t\t}\n\n\t\treturn _from, _to, nil\n\t}\n\n\t// Extracted numeric query param, gets parsed into\n\t// unsigned integer\n\tparseNumber := func(number string) (uint64, error) {\n\t\t_num, err := strconv.ParseUint(number, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, errors.New(\"Failed to parse integer\")\n\t\t}\n\n\t\treturn _num, nil\n\t}\n\n\t// Return topics to be used for finding out events in hex form\n\t// topics are extracted out from query params in string form\n\tgetTopics := func(topics ...string) []common.Hash {\n\t\tif topics[0] != \"\" && topics[1] != \"\" && topics[2] != \"\" && topics[3] != \"\" {\n\t\t\treturn []common.Hash{common.HexToHash(topics[0]), common.HexToHash(topics[1]), common.HexToHash(topics[2]), common.HexToHash(topics[3])}\n\t\t}\n\n\t\tif topics[0] != \"\" && topics[1] != \"\" && topics[2] != \"\" {\n\t\t\treturn []common.Hash{common.HexToHash(topics[0]), common.HexToHash(topics[1]), common.HexToHash(topics[2])}\n\t\t}\n\n\t\tif topics[0] != \"\" && topics[1] != \"\" {\n\t\t\treturn []common.Hash{common.HexToHash(topics[0]), common.HexToHash(topics[1])}\n\t\t}\n\n\t\tif topics[0] != \"\" {\n\t\t\treturn []common.Hash{common.HexToHash(topics[0])}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\trespondWithJSON := func(data []byte, c *gin.Context) {\n\t\tif data != nil {\n\t\t\tc.Data(http.StatusOK, \"application/json\", data)\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"msg\": \"JSON encoding failed\",\n\t\t})\n\t\treturn\n\t}\n\n\trouter := gin.Default()\n\n\tgrp := router.Group(\"/v1\")\n\n\t{\n\t\t// For checking whether `ette` has synced upto blockchain latest state or not\n\t\tgrp.GET(\"/synced\", func(c *gin.Context) {\n\n\t\t\t_lock.Lock()\n\t\t\tdefer _lock.Unlock()\n\n\t\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\t\"synced\": _synced.Synced,\n\t\t\t})\n\n\t\t})\n\n\t\t// Query block data using block hash/ number/ block number range ( 10 at max )\n\t\tgrp.GET(\"/block\", func(c *gin.Context) {\n\n\t\t\thash := c.Query(\"hash\")\n\t\t\tnumber := c.Query(\"number\")\n\t\t\ttx := c.Query(\"tx\")\n\n\t\t\t// Block hash based all tx retrieval request handler\n\t\t\tif strings.HasPrefix(hash, \"0x\") && len(hash) == 66 && tx == \"yes\" {\n\t\t\t\tif tx := db.GetTransactionsByBlockHash(_db, common.HexToHash(hash)); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Given block number, finds out all tx(s) present in that block\n\t\t\tif number != \"\" && tx == \"yes\" {\n\n\t\t\t\t_num, err := parseNumber(number)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsByBlockNumber(_db, _num); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Block hash based single block retrieval request handler\n\t\t\tif strings.HasPrefix(hash, \"0x\") && len(hash) == 66 {\n\t\t\t\tif block := db.GetBlockByHash(_db, common.HexToHash(hash)); block != nil {\n\t\t\t\t\trespondWithJSON(block.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Block number based single block retrieval request handler\n\t\t\tif number != \"\" {\n\n\t\t\t\t_num, err := parseNumber(number)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif block := db.GetBlockByNumber(_db, _num); block != nil {\n\t\t\t\t\trespondWithJSON(block.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Block number range based query\n\t\t\t// At max 10 blocks at a time to be returned\n\t\t\tfromBlock := c.Query(\"fromBlock\")\n\t\t\ttoBlock := c.Query(\"toBlock\")\n\n\t\t\tif fromBlock != \"\" && toBlock != \"\" {\n\n\t\t\t\t_from, _to, err := rangeChecker(fromBlock, toBlock, 10)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif blocks := db.GetBlocksByNumberRange(_db, _from, _to); blocks != nil {\n\t\t\t\t\trespondWithJSON(blocks.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Query blocks by timestamp range, at max 60 seconds of timestamp\n\t\t\t// can be mentioned, otherwise request to be rejected\n\t\t\tfromTime := c.Query(\"fromTime\")\n\t\t\ttoTime := c.Query(\"toTime\")\n\n\t\t\tif fromTime != \"\" && toTime != \"\" {\n\n\t\t\t\t_from, _to, err := rangeChecker(fromTime, toTime, 60)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif blocks := db.GetBlocksByTimeRange(_db, _from, _to); blocks != nil {\n\t\t\t\t\trespondWithJSON(blocks.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"msg\": \"Bad query param(s)\",\n\t\t\t})\n\n\t\t})\n\n\t\t// Transaction fetch ( by query params ) request handler\n\t\tgrp.GET(\"/transaction\", func(c *gin.Context) {\n\n\t\t\thash := c.Query(\"hash\")\n\n\t\t\t// Simply returns single tx object, when queried using tx hash\n\t\t\tif strings.HasPrefix(hash, \"0x\") && len(hash) == 66 {\n\t\t\t\tif tx := db.GetTransactionByHash(_db, common.HexToHash(hash)); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// block number range\n\t\t\tfromBlock := c.Query(\"fromBlock\")\n\t\t\ttoBlock := c.Query(\"toBlock\")\n\n\t\t\t// block time span range\n\t\t\tfromTime := c.Query(\"fromTime\")\n\t\t\ttoTime := c.Query(\"toTime\")\n\n\t\t\t// Contract deployer address\n\t\t\tdeployer := c.Query(\"deployer\")\n\n\t\t\t// account pair, in between this pair tx(s) to be extracted out in time span range/ block number range\n\t\t\t//\n\t\t\t// only single one can be supplied to enforce tx search\n\t\t\t// for incoming/ outgoing tx to & from an account\n\t\t\tfromAccount := c.Query(\"fromAccount\")\n\t\t\ttoAccount := c.Query(\"toAccount\")\n\n\t\t\t// Account nonce, to be used for finding\n\t\t\t// tx, in combination with `fromAccount`\n\t\t\tnonce := c.Query(\"nonce\")\n\n\t\t\t// Responds with tx sent from account with specified nonce\n\t\t\tif nonce != \"\" && strings.HasPrefix(fromAccount, \"0x\") && len(fromAccount) == 42 {\n\n\t\t\t\t_nonce, err := parseNumber(nonce)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad account nonce\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionFromAccountWithNonce(_db, common.HexToAddress(fromAccount), _nonce); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Responds with all contract creation tx(s) sent from specific account\n\t\t\t// ( i.e. deployer ) with in given block number range\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(deployer, \"0x\") && len(deployer) == 42 {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 100)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetContractCreationTransactionsFromAccountByBlockNumberRange(_db, common.HexToAddress(deployer), _fromBlock, _toBlock); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Responds with all contract creation tx(s) sent from specific account\n\t\t\t// ( i.e. deployer ) with in given time frame\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(deployer, \"0x\") && len(deployer) == 42 {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromTime, toTime, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetContractCreationTransactionsFromAccountByBlockTimeRange(_db, common.HexToAddress(deployer), _fromTime, _toTime); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block number range & a pair of accounts, can find out all tx performed\n\t\t\t// between that pair, where `from` & `to` fields are fixed\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(fromAccount, \"0x\") && len(fromAccount) == 42 && strings.HasPrefix(toAccount, \"0x\") && len(toAccount) == 42 {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 100)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsBetweenAccountsByBlockNumberRange(_db, common.HexToAddress(fromAccount), common.HexToAddress(toAccount), _fromBlock, _toBlock); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block time range & a pair of accounts, can find out all tx performed\n\t\t\t// between that pair, where `from` & `to` fields are fixed\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(fromAccount, \"0x\") && len(fromAccount) == 42 && strings.HasPrefix(toAccount, \"0x\") && len(toAccount) == 42 {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromTime, toTime, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsBetweenAccountsByBlockTimeRange(_db, common.HexToAddress(fromAccount), common.HexToAddress(toAccount), _fromTime, _toTime); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block number range & account, can find out all tx performed\n\t\t\t// from account\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(fromAccount, \"0x\") && len(fromAccount) == 42 {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 100)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsFromAccountByBlockNumberRange(_db, common.HexToAddress(fromAccount), _fromBlock, _toBlock); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block mining time stamp range & account address, returns all outgoing tx\n\t\t\t// from this account in that given time span\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(fromAccount, \"0x\") && len(fromAccount) == 42 {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromTime, toTime, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsFromAccountByBlockTimeRange(_db, common.HexToAddress(fromAccount), _fromTime, _toTime); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block number range & account address, returns all incoming tx\n\t\t\t// to this account in that block range\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(toAccount, \"0x\") && len(toAccount) == 42 {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 100)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsToAccountByBlockNumberRange(_db, common.HexToAddress(toAccount), _fromBlock, _toBlock); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block mining time stamp range & account address, returns all incoming tx\n\t\t\t// to this account in that given time span\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(toAccount, \"0x\") && len(toAccount) == 42 {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromBlock, toBlock, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif tx := db.GetTransactionsToAccountByBlockTimeRange(_db, common.HexToAddress(toAccount), _fromTime, _toTime); tx != nil {\n\t\t\t\t\trespondWithJSON(tx.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"msg\": \"Bad query param(s)\",\n\t\t\t})\n\n\t\t})\n\n\t\t// Event(s) fetched by query params handler end point\n\t\tgrp.GET(\"/event\", func(c *gin.Context) {\n\n\t\t\tfromBlock := c.Query(\"fromBlock\")\n\t\t\ttoBlock := c.Query(\"toBlock\")\n\n\t\t\tfromTime := c.Query(\"fromTime\")\n\t\t\ttoTime := c.Query(\"toTime\")\n\n\t\t\tcontract := c.Query(\"contract\")\n\n\t\t\tcount := c.Query(\"count\")\n\n\t\t\ttopic0 := c.Query(\"topic0\")\n\t\t\ttopic1 := c.Query(\"topic1\")\n\t\t\ttopic2 := c.Query(\"topic2\")\n\t\t\ttopic3 := c.Query(\"topic3\")\n\n\t\t\tblockHash := c.Query(\"blockHash\")\n\t\t\ttxHash := c.Query(\"txHash\")\n\n\t\t\t// Given blockhash, retrieves all events emitted by tx present in block\n\t\t\tif strings.HasPrefix(blockHash, \"0x\") && len(blockHash) == 66 {\n\n\t\t\t\tif event := db.GetEventsByBlockHash(_db, common.HexToHash(blockHash)); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given txhash, retrieves all events emitted by that tx ( i.e. during tx execution )\n\t\t\tif strings.HasPrefix(txHash, \"0x\") && len(txHash) == 66 {\n\n\t\t\t\tif event := db.GetEventsByTransactionHash(_db, common.HexToHash(txHash)); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Finds out last `x` events emitted by contract\n\t\t\tif count != \"\" && strings.HasPrefix(contract, \"0x\") && len(contract) == 42 {\n\n\t\t\t\t_count, err := strconv.Atoi(count)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad event count\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif _count > 50 {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Too many events requested\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event := db.GetLastXEventsFromContract(_db, common.HexToAddress(contract), _count); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block number range, contract address & topics of log event, returns\n\t\t\t// events satisfying criteria\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(contract, \"0x\") && len(contract) == 42 && ((strings.HasPrefix(topic0, \"0x\") && len(topic0) == 66) || (strings.HasPrefix(topic1, \"0x\") && len(topic1) == 66) || (strings.HasPrefix(topic2, \"0x\") && len(topic2) == 66) || (strings.HasPrefix(topic3, \"0x\") && len(topic3) == 66)) {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 10)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event := db.GetEventsFromContractWithTopicsByBlockNumberRange(_db, common.HexToAddress(contract), _fromBlock, _toBlock, getTopics([]string{topic0, topic1, topic2, topic3}...)...); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given time span, contract address & topic 0 of log event, returns\n\t\t\t// events satisfying criteria\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(contract, \"0x\") && len(contract) == 42 && ((strings.HasPrefix(topic0, \"0x\") && len(topic0) == 66) || (strings.HasPrefix(topic1, \"0x\") && len(topic1) == 66) || (strings.HasPrefix(topic2, \"0x\") && len(topic2) == 66) || (strings.HasPrefix(topic3, \"0x\") && len(topic3) == 66)) {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromTime, toTime, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event := db.GetEventsFromContractWithTopicsByBlockTimeRange(_db, common.HexToAddress(contract), _fromTime, _toTime, getTopics([]string{topic0, topic1, topic2, topic3}...)...); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block number range & contract address, finds out all events emitted by this contract\n\t\t\tif fromBlock != \"\" && toBlock != \"\" && strings.HasPrefix(contract, \"0x\") && len(contract) == 42 {\n\n\t\t\t\t_fromBlock, _toBlock, err := rangeChecker(fromBlock, toBlock, 10)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block number range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event := db.GetEventsFromContractByBlockNumberRange(_db, common.HexToAddress(contract), _fromBlock, _toBlock); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\t// Given block time span & contract address, returns a list of\n\t\t\t// events emitted by this contract during time span\n\t\t\tif fromTime != \"\" && toTime != \"\" && strings.HasPrefix(contract, \"0x\") && len(contract) == 42 {\n\n\t\t\t\t_fromTime, _toTime, err := rangeChecker(fromTime, toTime, 600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\t\"msg\": \"Bad block time range\",\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event := db.GetEventsFromContractByBlockTimeRange(_db, common.HexToAddress(contract), _fromTime, _toTime); event != nil {\n\t\t\t\t\trespondWithJSON(event.ToJSON(), c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\t\"msg\": \"Not found\",\n\t\t\t\t})\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"msg\": \"Bad query param(s)\",\n\t\t\t})\n\n\t\t})\n\t}\n\n\tupgrader := websocket.Upgrader{}\n\n\trouter.GET(\"/v1/ws\", func(c *gin.Context) {\n\t\tconn, err := upgrader.Upgrade(c.Writer, c.Request, nil)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[!] Failed to upgrade to websocket : %s\\n\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// Registering websocket connection closing, to be executed when leaving\n\t\t// this function block\n\t\tdefer conn.Close()\n\n\t\t// keeping track of which topics this client has already subscribed to\n\t\t// or unsubscrribed from\n\t\ttopics := make(map[string]d.Consumer)\n\n\t\t// Communication with client handling logic\n\t\tfor {\n\t\t\tvar req d.SubscriptionRequest\n\n\t\t\tif err := conn.ReadJSON(&req); err != nil {\n\t\t\t\tlog.Printf(\"[!] Failed to read message : %s\\n\", err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Validating incoming request on websocket subscription channel\n\t\t\tif !req.Validate(topics) {\n\t\t\t\tif err := conn.WriteJSON(&d.SubscriptionResponse{Code: 0, Message: \"Bad Payload\"}); err != nil {\n\t\t\t\t\tlog.Printf(\"[!] Failed to write message : %s\\n\", err.Error())\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tswitch req.Type {\n\t\t\tcase \"subscribe\":\n\t\t\t\tswitch req.Topic() {\n\t\t\t\tcase \"block\":\n\t\t\t\t\ttopics[req.Name] = d.NewBlockConsumer(_redisClient, conn, &req)\n\t\t\t\tcase \"transaction\":\n\t\t\t\t\ttopics[req.Name] = d.NewTransactionConsumer(_redisClient, conn, &req)\n\t\t\t\tcase \"event\":\n\t\t\t\t\ttopics[req.Name] = d.NewEventConsumer(_redisClient, conn, &req)\n\t\t\t\t}\n\t\t\tcase \"unsubscribe\":\n\t\t\t\tswitch req.Topic() {\n\t\t\t\tcase \"block\":\n\t\t\t\t\tif v, ok := topics[req.Name].(*d.BlockConsumer); ok {\n\t\t\t\t\t\tv.Request.Type = req.Type\n\t\t\t\t\t}\n\t\t\t\tcase \"transaction\":\n\t\t\t\t\tif v, ok := topics[req.Name].(*d.TransactionConsumer); ok {\n\t\t\t\t\t\tv.Request.Type = req.Type\n\t\t\t\t\t}\n\t\t\t\tcase \"event\":\n\t\t\t\t\tif v, ok := topics[req.Name].(*d.EventConsumer); ok {\n\t\t\t\t\t\tv.Request.Type = req.Type\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttopics[req.Name] = nil\n\t\t\t}\n\t\t}\n\t})\n\n\trouter.Run(fmt.Sprintf(\":%s\", cfg.Get(\"PORT\")))\n}", "title": "" }, { "docid": "85956672bd111e5d165d6cbed40d09aa", "score": "0.49962634", "text": "func (concrete1 ConcreteHandler1) handleRequest(request string) {\n \tfmt.Printf(\"R1 got the request...\") \n\tif ( request == \"R1\" ){\n fmt.Println(\" => This one is mine!\")\n }else{\n\t fmt.Println(\" => This one is not mine!\")\n if ( concrete1.Successor != nil ){\n\t\t\t\tconcrete1.Successor.handleRequest(request);\n\t\t\t}\t\n \n }\n}", "title": "" }, { "docid": "f6d80124690424eecb3fe0f147768e6d", "score": "0.49939346", "text": "func (s *natsServer) chooseClientHandler(subject string) func(*nats.Msg) wyc.Marshalable {\n\tvar handler func(*nats.Msg) wyc.Marshalable\n\n\tswitch subjectSuffix(subject) {\n\tcase callCreateCollection:\n\t\thandler = s.createCollection\n\tcase callCreateItem:\n\t\thandler = s.createItem\n\tcase callCreateVersion:\n\t\thandler = s.createVersion\n\tcase callCreateResource:\n\t\thandler = s.createResource\n\tcase callCreateLink:\n\t\thandler = s.createLink\n\n\tcase callDeleteCollection:\n\t\thandler = s.deleteCollection\n\tcase callDeleteItem:\n\t\thandler = s.deleteItem\n\tcase callDeleteVersion:\n\t\thandler = s.deleteVersion\n\tcase callDeleteResource:\n\t\thandler = s.deleteResource\n\n\tcase callFindCollection:\n\t\thandler = s.findCollection\n\tcase callFindItem:\n\t\thandler = s.findItem\n\tcase callFindVersion:\n\t\thandler = s.findVersion\n\tcase callFindResource:\n\t\thandler = s.findResource\n\tcase callFindLink:\n\t\thandler = s.findLink\n\n\tcase callGetPublished:\n\t\thandler = s.publishedVersion\n\tcase callSetPublished:\n\t\thandler = s.setPublished\n\n\tcase callUpdateCollection:\n\t\thandler = s.updateCollection\n\tcase callUpdateItem:\n\t\thandler = s.updateItem\n\tcase callUpdateVersion:\n\t\thandler = s.updateVersion\n\tcase callUpdateResource:\n\t\thandler = s.updateResource\n\tcase callUpdateLink:\n\t\thandler = s.updateLink\n\t}\n\n\treturn handler\n}", "title": "" }, { "docid": "7d9f6beebf75ac17e50475e10dd9389b", "score": "0.49932194", "text": "func main() {\n\t// connect to redis cache\n\trdb := redis.NewClient(&redis.Options{\n\t\tAddr: os.Getenv(\"REDISADDR\"), // use ENV variable REDISADDR\n\t\tPassword: \"\", // no password set\n\t\tDB: 0, // use default DB\n\t})\n\n\tpong, err := rdb.Ping().Result()\n\tlog.Println(pong, err)\n\n\tredisStore := sessions.NewRedisStore(rdb, 10*time.Minute)\n\n\t// connect to mysql database\n\t// Bradley: set database password as an environment variable\n\t// and connect to MySQL database\n\tdsn := os.Getenv(\"DSN\")\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Printf(\"error opening database: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tdefer db.Close()\n\tif err := db.Ping(); err != nil {\n\t\tlog.Printf(\"error pinging database: %v\\n\", err)\n\t} else {\n\t\tlog.Printf(\"successfully connected!\\n\")\n\t}\n\n\tuserStore := users.NewMySQLStore(db)\n\tsigningKey := os.Getenv(\"SESSIONKEY\")\n\n\tctx := handlers.NewHandlerContext(signingKey, redisStore, userStore)\n\n\t/* TODO: add code to do the following\n\t- Read the ADDR environment variable to get the address\n\t the server should listen on. If empty, default to \":80\" */\n\taddr := os.Getenv(\"AUTHPORT\")\n\tif len(addr) == 0 {\n\t\taddr = \":443\"\n\t}\n\n\t/*- Create a new mux for the web server.*/\n\tmux := http.NewServeMux()\n\t/*- Tell the mux to call your handlers.SummaryHandler function\n\twhen the \"/v1/summary\" URL path is requested.*/\n\n\tmux.HandleFunc(\"/login\", ctx.SessionsHandler)\n\tmux.HandleFunc(\"/login/\", ctx.SpecificSessionHandler)\n\t/*- Start a web server listening on the address you read from\n\t the environment variable, using the mux you created as\n\t the root handler. Use log.Fatal() to report any errors\n\t that occur when trying to start the web server.\n\t*/\n\tlog.Printf(\"server is listening at https://%s\", addr)\n\tlog.Fatal(http.ListenAndServe(addr, mux))\n\n}", "title": "" }, { "docid": "a8d4244566996597465a532a9724e554", "score": "0.4984533", "text": "func registerHandlers(cfg *ServerConfig, db Storage) {\n\thandle(\"helo\", func(ctx *context, arg string) error {\n\t\t// 250, 504\n\t\tctx.reset()\n\t\treturn ctx.send(\"250 \" + cfg.Hostname)\n\t})\n\thandle(\"ehlo\", func(ctx *context, arg string) error {\n\t\t// 250, 504\n\t\tctx.reset()\n\t\terr := ctx.send(\"250-\" + cfg.Hostname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif cfg.doTLS { // do tls for this server\n\t\t\tif !ctx.tls { // already in tls stream\n\t\t\t\terr = ctx.send(\"250-STARTTLS\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// SIZE\n\t\treturn ctx.send(\"250 SIZE 35882577\") // from gmail\n\t})\n\n\thandle(\"mail\", func(ctx *context, arg string) error {\n\t\t// MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>\n\t\t// 250\n\t\t// 552, 451, 452, 550, 553, 503, 455, 555\n\t\tctx.from = extractMailbox(arg)\n\t\tif !cfg.fromOk(ctx.from) {\n\t\t\treturn ctx.send(fmt.Sprint(\"550 bad reverse-path: \", arg))\n\t\t}\n\t\tswitch ctx.state {\n\t\tcase sstateGotRcpt:\n\t\t\tctx.state = sstateReadyForData\n\t\tcase sstateInit:\n\t\t\tctx.state = sstateGotMail\n\t\tdefault:\n\t\t\tctx.state = sstateBadSequence\n\t\t}\n\t\treturn ctx.send(fmt.Sprint(\"250 sender <\", ctx.from, \"> ok\"))\n\t})\n\thandle(\"rcpt\", func(ctx *context, arg string) error {\n\t\t// RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>\n\t\t// 250: address is ok, 251: address ok, but has changed and I will take care of it\n\t\t// 550, 551, 552, 553, 450, 451, 452, 503, 455, 555\n\t\tto := extractMailbox(arg)\n\t\tif !cfg.toOk(to) {\n\t\t\treturn ctx.send(fmt.Sprint(\"550 bad recipient <\", to, \">\", arg))\n\t\t}\n\t\tctx.to = append(ctx.to, to)\n\t\tswitch ctx.state {\n\t\tcase sstateGotMail:\n\t\t\tctx.state = sstateReadyForData\n\t\tcase sstateInit:\n\t\t\tctx.state = sstateGotRcpt\n\t\tdefault:\n\t\t\tctx.state = sstateBadSequence\n\t\t}\n\t\treturn ctx.send(fmt.Sprint(\"250 recipient <\", to, \"> ok\"))\n\t})\n\n\thandle(\"data\", func(ctx *context, arg string) error {\n\t\t// 354: send data\n\t\t// 503: command out of sequence\n\t\t// 554: no valid recipients\n\t\tif ctx.state != sstateReadyForData {\n\t\t\treturn ctx.send(\"503 command out of sequence\")\n\t\t}\n\t\terr := ctx.send(\"354 Ok send data ending with <CRLF>.<CRLF>\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts := ctx.scanner\n\t\tfor s.Scan() {\n\t\t\tfmt.Println(\"server got data:\", s.Text())\n\t\t\tif s.Text() == \".\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t_, err := ctx.data.Write(s.Bytes())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = ctx.data.Write([]byte(\"\\r\\n\"))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif s.Err() != nil {\n\t\t\treturn s.Err()\n\t\t}\n\t\t// 250\n\t\t// 552,554,\n\t\t// 451: Requested action aborted: error in processing\n\t\t// 452\n\t\t// 450\n\t\t// 550: mailbox not found\n\t\terr = db.Save(ctx.from, ctx.to, &ctx.data)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn ctx.send(\"451 error\")\n\t\t}\n\t\tctx.state = sstateDataDone\n\t\treturn ctx.send(\"250 Thank You\")\n\t})\n\thandle(\"rset\", func(ctx *context, arg string) error {\n\t\tctx.reset()\n\t\treturn ctx.send(\"250 Ok\")\n\t})\n\thandle(\"vrfy\", func(ctx *context, arg string) error {\n\t\t// 250, 251, 252\n\t\t// 550, 551, 553, 502, 504\n\t\treturn fmt.Errorf(\"not implemented\")\n\t})\n\thandle(\"expn\", func(ctx *context, arg string) error {\n\t\t// 250, 251, 252\n\t\t// 550, 551, 553, 502, 504\n\t\treturn fmt.Errorf(\"not implemented\")\n\t})\n\thandle(\"help\", func(ctx *context, arg string) error {\n\t\t// 211, 214\n\t\t// 502, 504\n\t\treturn fmt.Errorf(\"not implemented\")\n\t})\n\thandle(\"noop\", func(ctx *context, arg string) error {\n\t\treturn ctx.send(\"250 Ok\")\n\t})\n\thandle(\"quit\", func(ctx *context, arg string) error {\n\t\tdefer ctx.c.Close()\n\t\treturn ctx.send(\"221 server closing connection\")\n\t})\n\n\t// extensions\n\thandle(\"starttls\", func(ctx *context, arg string) error {\n\t\tif ctx.tls {\n\t\t\treturn nil\n\t\t}\n\t\terr := ctx.send(\"220 TLS ok\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsc := tls.Server(ctx.c, &tls.Config{Certificates: cfg.Certificates})\n\t\tctx.reset()\n\t\tctx.c = sc\n\t\tctx.scanner = bufio.NewScanner(sc)\n\n\t\terr = sc.Handshake()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t\tctx.tls = true\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "c352b51a3bb9c49cf5e98d88b11e18cf", "score": "0.4980932", "text": "func (c *client) handle(buf []byte, ua *net.UDPAddr, conn *net.UDPConn) error {\n\n\t// validate this is an ok request first\n\treqMsg := dns.Msg{}\n\terr := reqMsg.Unpack(buf)\n\tif err != nil {\n\t\tlog.Printf(\"not valid DNS request: %v\\n\", err)\n\t\treturn err\n\t}\n\tif len(reqMsg.Question) < 1 {\n\t\treturn fmt.Errorf(\"no questions in request\")\n\t}\n\n\tqname := reqMsg.Question[0].Name\n\tqtype := dns.TypeToString[reqMsg.Question[0].Qtype]\n\tqid := fmt.Sprintf(\"%s|%s\", qtype, qname)\n\tlog.Printf(\"resolving %s\", qid)\n\n\t// handle returning results from cache if present\n\t// lifted from https://github.com/pforemski/dingo/blob/master/dingo.go#L100\n\tif x, found := c.cache.Get(qid); found {\n\t\t// FIXME: update TTLs\n\t\tlog.Printf(\"cached entry for %s found\\n\", qid)\n\t\tcachedData := x.([]byte)\n\t\t//unpack message and update the header ID to match the request\n\t\tvar cachedMsg dns.Msg\n\t\terr := cachedMsg.Unpack(cachedData)\n\t\tif err == nil {\n\t\t\tcachedMsg.Id = reqMsg.Id\n\t\t\t// now, repack the message and transmit to the udpaddr\n\t\t\trepacked, err := cachedMsg.Pack()\n\t\t\tif err == nil {\n\t\t\t\t_, err := conn.WriteToUDP(repacked, ua)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error writing cached response for %s to %s: %v\\n\", qid, ua, err)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Printf(\"error repacking cached message %s with id %d; invalidating cache and continuing: %v\\n\", qid, reqMsg.Id, err)\n\t\t\tc.cache.Delete(qid)\n\t\t} else {\n\t\t\tlog.Printf(\"error unpacking cached message %s; invalidating cache and continuing: %v\\n\", qid, err)\n\t\t\tc.cache.Delete(qid)\n\t\t}\n\t}\n\n\t// body=base64url(wireformat) IFF method=GET\n\tbase64dnsreq := make([]byte, base64.URLEncoding.EncodedLen(len(buf)))\n\tbase64.URLEncoding.Encode(base64dnsreq, buf)\n\n\t// path: /.well-known/dns-query\n\t//NOTE: using GET becuase its cachable\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\tfmt.Sprintf(\"%s/.well-known/dns-query\", c.cfg.DOH.URL),\n\t\tnil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set params for the request\n\tparams := req.URL.Query()\n\tparams.Add(\"ct\", types.TypeDNSUDPWireFormat)\n\tparams.Add(\"body\", bytes.NewBuffer(base64dnsreq).String())\n\treq.URL.RawQuery = params.Encode()\n\n\t// set headers, etc\n\treq.Header.Set(\"accept\", types.TypeDNSUDPWireFormat)\n\treq.Header.Set(\"content-type\", types.TypeDNSUDPWireFormat)\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// process resp\n\tlength := resp.Header.Get(\"content-length\")\n\tlog.Printf(\"got %s response with content-length: %s\\n\", resp.Status, length)\n\tif resp.Header.Get(\"content-type\") != types.TypeDNSUDPWireFormat {\n\t\treturn fmt.Errorf(\"response had wrong content type! unable to process %v\", resp.Header.Get(\"content-type\"))\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tlog.Printf(\"bummer, got %s\\n\", resp.Status)\n\t\t// TODO: should return a simulated message to resolver to indicate SERVFAIL\n\t\treturn fmt.Errorf(\"fuck something was wrong with the request\")\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Printf(\"read %d bytes from body\\n\", len(body))\n\n\t/* put resp in cache for 10 seconds (FIXME: use minimum TTL) */\n\t// TODO: make the cached value = msg.Answer[0].Ttl\n\tc.cache.Set(qid, body, 10*time.Second)\n\n\tnBytes, err := conn.WriteToUDP(body, ua)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"wrote %d bytes of response back to %s\\n\", nBytes, ua)\n\treturn nil\n}", "title": "" }, { "docid": "3fad06ce9374c3f0ec36331d27a8797a", "score": "0.49720174", "text": "func (m *Monitor) connectionHandler1_0(parentCtx context.Context, server net.Listener) {\n\tfor !isCtxDone(parentCtx) {\n\t\tconn, err := server.Accept()\n\t\tswitch {\n\t\tcase isCtxDone(parentCtx) && conn != nil:\n\t\t\tconn.Close()\n\t\t\tfallthrough\n\n\t\tcase isCtxDone(parentCtx) && conn == nil:\n\t\t\treturn\n\n\t\tcase err != nil:\n\t\t\tlog.WithError(err).Warn(\"Error accepting connection\")\n\t\t\tcontinue\n\t\t}\n\n\t\tm.registerNewListener(parentCtx, conn, listener.Version1_0)\n\t}\n}", "title": "" }, { "docid": "b18628d1b9a62c8dd011679a892bafa4", "score": "0.4970743", "text": "func init () {\n \n odie.Handle(\"add $addend1 $addend2\", additionHandler) \n odie.Handle(\"subtract $minuend $subtrahend\", subtractionHandler)\n odie.Handle(\"multiply $multiplicand $multiplier\", multiplicationHandler)\n odie.Handle(\"divide $dividend $divisor\", divisionHandler)\n odie.Handle(\"exponent $base $exponent\", exponentHandler)\n odie.Handle(\"math help\", helpHandler)\n}", "title": "" }, { "docid": "4dc467b5c82b2bb180a94f0afaa28044", "score": "0.49687526", "text": "func (ch *serverSecureChannel) handleRequest(req ua.ServiceRequest, requestid uint32) error {\n\tswitch req := req.(type) {\n\tcase *ua.PublishRequest:\n\t\treturn ch.srv.handlePublish(ch, requestid, req)\n\tcase *ua.RepublishRequest:\n\t\treturn ch.srv.handleRepublish(ch, requestid, req)\n\tcase *ua.ReadRequest:\n\t\treturn ch.srv.handleRead(ch, requestid, req)\n\tcase *ua.WriteRequest:\n\t\treturn ch.srv.handleWrite(ch, requestid, req)\n\tcase *ua.CallRequest:\n\t\treturn ch.srv.handleCall(ch, requestid, req)\n\tcase *ua.BrowseRequest:\n\t\treturn ch.srv.handleBrowse(ch, requestid, req)\n\tcase *ua.BrowseNextRequest:\n\t\treturn ch.srv.handleBrowseNext(ch, requestid, req)\n\tcase *ua.TranslateBrowsePathsToNodeIDsRequest:\n\t\treturn ch.srv.handleTranslateBrowsePathsToNodeIds(ch, requestid, req)\n\tcase *ua.CreateSubscriptionRequest:\n\t\treturn ch.srv.handleCreateSubscription(ch, requestid, req)\n\tcase *ua.ModifySubscriptionRequest:\n\t\treturn ch.srv.handleModifySubscription(ch, requestid, req)\n\tcase *ua.SetPublishingModeRequest:\n\t\treturn ch.srv.handleSetPublishingMode(ch, requestid, req)\n\tcase *ua.DeleteSubscriptionsRequest:\n\t\treturn ch.srv.handleDeleteSubscriptions(ch, requestid, req)\n\tcase *ua.CreateMonitoredItemsRequest:\n\t\treturn ch.srv.handleCreateMonitoredItems(ch, requestid, req)\n\tcase *ua.ModifyMonitoredItemsRequest:\n\t\treturn ch.srv.handleModifyMonitoredItems(ch, requestid, req)\n\tcase *ua.SetMonitoringModeRequest:\n\t\treturn ch.srv.handleSetMonitoringMode(ch, requestid, req)\n\tcase *ua.DeleteMonitoredItemsRequest:\n\t\treturn ch.srv.handleDeleteMonitoredItems(ch, requestid, req)\n\tcase *ua.HistoryReadRequest:\n\t\treturn ch.srv.handleHistoryRead(ch, requestid, req)\n\tcase *ua.CreateSessionRequest:\n\t\treturn ch.srv.handleCreateSession(ch, requestid, req)\n\tcase *ua.ActivateSessionRequest:\n\t\treturn ch.srv.handleActivateSession(ch, requestid, req)\n\tcase *ua.CloseSessionRequest:\n\t\treturn ch.srv.handleCloseSession(ch, requestid, req)\n\tcase *ua.OpenSecureChannelRequest:\n\t\treturn ch.handleOpenSecureChannel(requestid, req)\n\tcase *ua.CloseSecureChannelRequest:\n\t\treturn ch.srv.handleCloseSecureChannel(ch, requestid, req)\n\tcase *ua.FindServersRequest:\n\t\treturn ch.srv.findServers(ch, requestid, req)\n\tcase *ua.GetEndpointsRequest:\n\t\treturn ch.srv.getEndpoints(ch, requestid, req)\n\tcase *ua.RegisterNodesRequest:\n\t\treturn ch.srv.handleRegisterNodes(ch, requestid, req)\n\tcase *ua.UnregisterNodesRequest:\n\t\treturn ch.srv.handleUnregisterNodes(ch, requestid, req)\n\tcase *ua.SetTriggeringRequest:\n\t\treturn ch.srv.handleSetTriggering(ch, requestid, req)\n\tcase *ua.CancelRequest:\n\t\treturn ch.srv.handleCancel(ch, requestid, req)\n\n\tdefault:\n\t\tch.Write(\n\t\t\t&ua.ServiceFault{\n\t\t\t\tResponseHeader: ua.ResponseHeader{\n\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\tRequestHandle: req.Header().RequestHandle,\n\t\t\t\t\tServiceResult: ua.BadServiceUnsupported,\n\t\t\t\t},\n\t\t\t},\n\t\t\trequestid,\n\t\t)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "af830f06725d8c1c19ca5720de80780a", "score": "0.49681947", "text": "func (t *SimpleChaincode) Query(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\n fmt.Println(\"query is running \" + function)\n\n // Handle different functions\n if function == \"read\" { //read a variable\n return t.Read(stub, args)\n }\n \n fmt.Println(\"query did not find func: \" + function)\n\n return nil, errors.New(\"Received unknown function query\")\n}", "title": "" }, { "docid": "09cfa8f1c2242a8cb6c29de5f9db2854", "score": "0.49649635", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n fmt.Println(\"query is running \" + function)\n\n if function == \"getUUID\" {\n return t.getUUID()\n } else if function == \"getAppointment\" {\n return t.getAppointment(stub,args)\n } else if function == \"getActiveUUIDs\" {\n return t.getActiveUUIDs(stub,args)\n } else if function == \"getActiveUUIDsForID\" {\n return t.getActiveUUIDsForID(stub,args)\n }\n\n\n \n fmt.Println(\"query did not find func: \" + function)\n\n return nil, errors.New(\"Received unknown function query\")\n}", "title": "" }, { "docid": "4a7891e602a08a2a47c4e6a7299e92e0", "score": "0.49625862", "text": "func evaluate(query string, conn net.Conn) {\n\tdelimiter := \":\"\n\tparsed_query := strings.Split(query, delimiter)\n\t//trims white space at the ends\n\tfor i := 0; i < len(parsed_query); i++ {\n\t\tparsed_query[i] = strings.TrimSpace(parsed_query[i])\n\t}\n\n\tquery_function := parsed_query[0]\n\n\t//check if query function is valid\n\tvalid_queries := []string{DOES_USER_EXIST, CHECK_PASS, ADD_USER, DELETE_USER, ADD_MESSAGE, READ_MESSAGES}\n\tis_valid_query := false\n\tfor _, query := range valid_queries {\n\t\tif query_function == query {\n\t\t\tis_valid_query = true\n\t\t}\n\t}\n\tif !is_valid_query {\n\t\t//not a valid queries\n\t\tfmt.Fprintf(conn, \"error: %s is not a valid query.%s\\n\", parsed_query[0], END_TAG)\n\t\treturn\n\t}\n\n\t//for all queries, args should start with query, username\n\t//all queries have >= 2 args\n\tif !check_args(parsed_query, 2, conn) {\n\t\t//check args failed\n\t\treturn //skip this query\n\t}\n\tuname := parsed_query[1]\n\n\t//check the only query with 2 arg, does user exist, else check for >= 3 args\n\tif query_function == DOES_USER_EXIST {\n\t\tdoes_user_exist(uname, conn)\n\t\treturn\n\t} else {\n\t\t// check for more args\n\t\tif !check_args(parsed_query, 3, conn) {\n\t\t\t//check args failed\n\t\t\treturn //skip this query\n\t\t}\n\t}\n\n\t//------following requires >=3 args; passed checked args 3 above\n\tif query_function == ADD_USER {\n\t\t//doesn't need password authentication\n\t\tadd_user(uname, parsed_query[2], conn)\n\t\treturn\n\t} else if query_function == READ_MESSAGES {\n\t\t//args should be query, username, num_message\n\n\t\tif num_message, convert_err := strconv.Atoi(parsed_query[2]); convert_err != nil {\n\t\t\tfmt.Fprintf(conn, \"error: third arg must be integer.%s\\n\", END_TAG)\n\t\t} else {\n\t\t\tread_messages(uname, num_message, conn)\n\t\t}\n\t\treturn\n\t}\n\n\tpsw := parsed_query[2]\n\t//following functions needs password authentication\n\tif !authenticate(uname, psw, conn) {\n\t\t//uname and psw don't match\n\t\treturn\n\t}\n\n\tswitch query_function {\n\tcase CHECK_PASS:\n\t\t//reply passed username + password check\n\t\t//already passed when called authenticate\n\t\tfmt.Fprintf(conn, \"success: correct username and password %s\\n\", END_TAG)\n\t\treturn\n\tcase DELETE_USER:\n\t\tdelete_user(uname, conn)\n\t\treturn\n\tcase ADD_MESSAGE:\n\t\t//args should be query, username, password, message\n\t\tif !check_args(parsed_query, 4, conn) {\n\t\t\t//check args failed\n\t\t\treturn //skip this query\n\t\t}\n\t\tmessage := parsed_query[3]\n\t\tadd_message(uname, message, conn)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "df8a3210d085facf9de4acb867e1a3ca", "score": "0.4962093", "text": "func (s *Server) getHandler(rawcfg []byte) (*Handler, error) {\n\ts.builderLock.RLock()\n\tif bytes.Equal(rawcfg, s.rawcfg) {\n\t\th := s.handler\n\t\ts.builderLock.RUnlock()\n\t\treturn h, nil\n\t}\n\ts.builderLock.RUnlock()\n\n\t// build a handler for the rawcfg and establish session.\n\tcfg := &config.Params{}\n\tif err := cfg.Unmarshal(rawcfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.builderLock.Lock()\n\tdefer s.builderLock.Unlock()\n\n\t// check again if someone else beat you to this.\n\tif bytes.Equal(rawcfg, s.rawcfg) {\n\t\treturn s.handler, nil\n\t}\n\n\tmh, err := nrmetric.BuildHandler(cfg, s.harvester)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tth, err := trace.BuildHandler(cfg, s.harvester)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.rawcfg = rawcfg\n\ts.handler = &Handler{m: mh, t: th}\n\n\treturn s.handler, nil\n}", "title": "" }, { "docid": "b1347691041b28029e19b48e9f909185", "score": "0.49588606", "text": "func lookupAnyHandler(method string) (f requestHandler, ok bool) {\n\tf, ok = rpcHandlers[method]\n\treturn\n}", "title": "" }, { "docid": "72c9fc185e5bb78f232b3cafeced0982", "score": "0.49563274", "text": "func handler(ctx context.Context, event events.SQSEvent) {\n\tfmt.Println(\"Received new sqs event\")\n\n\t// Process each of the records within the queue.\n\tfor _, record := range event.Records {\n\t\tprocessRecords(record)\n\t}\n}", "title": "" }, { "docid": "227220a0231f6a0df25e87e4819f5553", "score": "0.49518558", "text": "func logUpgrade(this upgradeHandle) upgradeHandle {\n\treturn func(w http.ResponseWriter, r *http.Request, url string) {\n\t\tfuncName := runtime.FuncForPC(reflect.ValueOf(this).Pointer()).Name()\n\t\tglog.Infoln(\"Node upgrade func called : \", funcName)\n\t\tglog.Infof(\"Request from edged host: %s\", r.Host)\n\t\tthis(w, r, url)\n\t}\n}", "title": "" }, { "docid": "3965aff910052610b3452d78817c73c9", "score": "0.49471757", "text": "func (*DataRow) Backend() {}", "title": "" }, { "docid": "1f9e275720c9b1bd2218e3639dabd7a0", "score": "0.49422887", "text": "func (c *CrateDriver) query(stmt string, args []driver.Value) (*endpointResponse, error) {\n\tendpoint := c.Url + \"/_sql?types\"\n\n\tquery := &endpointQuery{\n\t\tStmt: stmt,\n\t}\n\n\tif len(args) > 0 {\n\t\tquery.Args = args\n\t}\n\n\tbuf, err := json.Marshal(query)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := bytes.NewReader(buf)\n\n\treq, err := http.NewRequest(\"POST\", endpoint, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.username != \"\" {\n\t\treq.SetBasicAuth(c.username, c.password)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 200 && resp.StatusCode <= 299 {\n\t\t// Parse response\n\t\tres := &endpointResponse{}\n\t\td := json.NewDecoder(resp.Body)\n\n\t\t// We need to set this, or long integers will be interpreted as floats\n\t\td.UseNumber()\n\n\t\terr = d.Decode(res)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Check for db errors\n\t\tif res.Error.Code != 0 {\n\t\t\terr = &CrateErr{\n\t\t\t\tCode: res.Error.Code,\n\t\t\t\tMessage: res.Error.Message,\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn res, nil\n\t} else {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmsg := fmt.Sprintf(\"Invalid http status code %d, body: %s\", resp.StatusCode, string(body))\n\n\t\treturn nil, errors.New(msg)\n\t}\n}", "title": "" }, { "docid": "55c248d6823b1c89f2f9f82703e14b80", "score": "0.49420327", "text": "func HandleQueryServer(connect http.ResponseWriter, response *http.Request) {\n\tlog := config.Log.WithField(\"package\", \"tsak\")\n\tlog.Info(\"start running HandleGETServer \")\n\tlog.Info(response.Host + \" Connection successful\")\n\n\tgetstr := response.URL.Query()\n\tgetQuery, err := server.MapTOString(getstr)\n\tif err != nil {\n\t\tfmt.Println(getQuery, err)\n\t\treturn\n\t}\n\tpostQuery, err := ioutil.ReadAll(response.Body)\n\tresponse.Body.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tlog.Info(\"start running switch\")\n\tswitch {\n\tcase getQuery != \"\":\n\t\tlog.Info(\"start running getQuery\")\n\t\tserver.DealQuery(connect, getQuery)\n\t\tbreak\n\tcase postQuery != nil:\n\t\tlog.Info(\"start running postQuery\")\n\t\tserver.DealQuery(connect, string(postQuery))\n\t\tbreak\n\tdefault:\n\t\tlog.Info(\"start running other\")\n\t\tlog.Printf(\"%v,%v\", postQuery, getstr)\n\t\tfmt.Fprintf(connect, \"%v,%v\", string(postQuery), getstr)\n\t}\n\tlog.Info(\"HandleIPServer running over\")\n}", "title": "" }, { "docid": "283eb0fc183caaf490459e962d05f77e", "score": "0.49374935", "text": "func putHandler(this *ForwardConnection, cmd []byte) error {\n\tvar pri, delay, ttr, bodyLen int\n\tn, err := fmt.Sscanf(string(cmd), CMD_PUT_FORMAT, &pri, &delay, &ttr, &bodyLen)\n\tif err != nil || n != 4 {\n\t\treturn this.writeLine([]byte(REPLY_BAD_FORMAT))\n\t}\n\n\twholeCmd := util.BufferPool.Get()\n\tdefer func() {\n\t\tutil.BufferPool.Release(wholeCmd)\n\t}()\n\n\twholeCmd.Write(cmd)\n\twholeCmd.WriteString(\"\\r\\n\")\n\n\tbody := make([]byte, bodyLen+2) //include \\r\\n\n\terr = this.read(body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twholeCmd.Write(body[:len(body)-2])\n\n\tvar response []byte\n\thandler := func(bwConn *BackwardConnection) bool {\n\t\tline, err := bwConn.readLine()\n\t\tif err == nil {\n\t\t\tresponse = line\n\t\t\tvar hid uint64\n\t\t\tn, err := fmt.Sscanf(string(response), REPLY_INSERTED_FORMAT, &hid)\n\t\t\tif err == nil && n == 1 {\n\t\t\t\tresponse = []byte(fmt.Sprintf(REPLY_INSERTED_FORMAT, util.IdMgr.ToGlobalID(bwConn.HostAddr(), hid)))\n\t\t\t}\n\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tthis.talkToBackward(wholeCmd.Bytes(), noSkipFilter, handler)\n\tif response != nil {\n\t\treturn this.writeLine(response)\n\t} else {\n\t\treturn this.writeLine([]byte(ERR_BACKWARD_SVRS_DOWN))\n\t}\n}", "title": "" }, { "docid": "b2f93104bd35495c887950faef755da4", "score": "0.49349532", "text": "func handler(uid string, conn net.Conn, conns map[string]net.Conn, message chan string) {\n\tlog.Printf(\"new boy join: %v\\n\", conn.RemoteAddr().String())\n\tbuff := make([]byte, 1024)\n\tfor {\n\t\tlength, err := conn.Read(buff)\n\t\t// errorpkg.CheckErrors(err)\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\tbreak\n\t\t}\n\t\tif length > 0 {\n\t\t\tbuff[length] = 0\n\t\t}\n\t\tgo dispatch(uid, conn, conns, buff[0:length])\n\t\treviveMsg := string(buff[0:length])\n\t\tmessage <- reviveMsg\n\t}\n}", "title": "" }, { "docid": "6d11990128092a95c9a0f7e7054edb28", "score": "0.49234068", "text": "func main() {\n\t/* TODO: add code to do the following\n\t- Read the ADDR environment variable to get the address\n\t the server should listen on. If empty, default to \":80\"\n\t- Create a new mux for the web server.\n\t- Tell the mux to call your handlers.SummaryHandler function\n\t when the \"/v1/summary\" URL path is requested.\n\t- Start a web server listening on the address you read from\n\t the environment variable, using the mux you created as\n\t the root handler. Use log.Fatal() to report any errors\n\t that occur when trying to start the web server.\n\t*/\n\n\tsessionKey := reqEnv(\"SESSIONKEY\")\n\tredisADDR := reqEnv(\"REDISADDR\")\n\tdsn := reqEnv(\"DSN\")\n\n\tsummaryServiceAddrs := reqEnv(\"SUMMARYADDR\")\n\tmessagesServiceAddrs := reqEnv(\"MESSAGESADDR\")\n\n\tmqAddr := reqEnv(\"MQADDR\")\n\tmqName := reqEnv(\"MQNAME\")\n\n\taddr := os.Getenv(\"ADDR\")\n\tif len(addr) == 0 {\n\t\taddr = \":443\"\n\t}\n\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening database: %v\", err)\n\t}\n\n\tredisClient := redis.NewClient(&redis.Options{\n\t\tAddr: redisADDR,\n\t\tPassword: \"\",\n\t\tDB: 0,\n\t})\n\n\tsessionsStore := sessions.NewRedisStore(redisClient, time.Hour)\n\tusersStore := users.NewMySQLStore(db)\n\ttrie, err := usersStore.LoadExistingUsersToTrie()\n\tif err != nil {\n\t\ttrie = indexes.NewTrie()\n\t}\n\tnotifier := handlers.NewNotifier()\n\n\thctx := handlers.Context {\n\t\tSigningKey: sessionKey,\n\t\tSessionStore: sessionsStore,\n\t\tUsersStore: usersStore,\n\t\tTrie: trie,\n\t\tNotifier: notifier,\n\t}\n\n\thctx.StartMQ(mqAddr, mqName)\n\n\ttlsKeyPath := os.Getenv(\"TLSKEY\")\n\ttlsCertPath := os.Getenv(\"TLSCERT\")\n\tif len(tlsKeyPath) == 0 || len(tlsCertPath) == 0 {\n\t\tlog.Fatal(\"please set TLSKEY and TLSCERT\")\n\t}\n\n\tr := mux.NewRouter()\n\tr.Handle(\"/v1/summary\", handlers.NewServiceProxy(summaryServiceAddrs, hctx))\n\tr.HandleFunc(\"/v1/users\", hctx.UsersHandler)\n\tr.HandleFunc(\"/v1/users/{userID}\", hctx.SpecificUserHandler)\n\tr.HandleFunc(\"/v1/sessions\", hctx.SessionsHandler)\n\tr.HandleFunc(\"/v1/sessions/{currSession}\", hctx.SpecificSessionHandler)\n\tr.Handle(\"/v1/channels\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/channels/{channelID}\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/channels/{channelID}/members\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/messages/{messageID}\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/messages/{messageID}/reactions\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/me/starred/messages\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/me/starred/messages/{messageID}\", handlers.NewServiceProxy(messagesServiceAddrs, hctx))\n\tr.Handle(\"/v1/ws\", handlers.NewWebSocketsHandler(hctx))\n\n\tcorsWrappedMux := handlers.WrappedCORSHandler(r)\n\n\tlog.Printf(\"Server is listening at https://%s\", addr)\n\tlog.Fatal(http.ListenAndServeTLS(addr, tlsCertPath, tlsKeyPath, corsWrappedMux))\n}", "title": "" }, { "docid": "b5a0130a6d8e4d25ee5788fe76b3b6a0", "score": "0.49225423", "text": "func (self *Replication) heloHandler(msg Message) {\n if msg.connection.userID != \"\" {\n log.Printf(\"Error: Second HELO is being sent\")\n }\n var userID string\n if msg.DecodePayload(&userID) != nil {\n log.Printf(\"Error in HELO request\")\n return\n }\n if userID != self.userID {\n log.Printf(\"Error: syncing replicas owned by multiple users is not allowed\")\n msg.connection.Close()\n return\n }\n println(\"HELO\", userID)\n msg.connection.userID = userID\n}", "title": "" }, { "docid": "11a3623c961f81ee26dd0eddcddce051", "score": "0.490974", "text": "func main() {\n\n\tuseCache := cnf.GetInstance().Get().Cache.UseCache\n\tif useCache {\n\t\tcacheClient, er := cache.GetCacheClient()\n\t\tif er != nil {\n\t\t\tpanic(\"failed to connect to in-memory store\")\n\n\t\t} else {\n\t\t\tif cacheClient.Set(\"hello\", \"hello world!!!\") == nil {\n\t\t\t\t_ = cacheClient.Delete(\"hello\")\n\t\t\t} else {\n\t\t\t\tpanic(\"failed to read from in-memory store\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Initialize the database and populate with the sample data\n\tdbClient = db.GetConnection()\n\n\t// var textInfo []m.TextInfo\n\t// dbClient.Raw(\"select * from text_info\").Scan(textInfo)\n\n\tdefer func() {\n\t\tfmt.Println(\"\\nClose DB connection\")\n\t\tif err := dbClient.Close(); err != nil {\n\t\t\tlog.Printf(\"ERROR!!! - failed to close DB connection\")\n\t\t}\n\t}()\n\n\t// Initialize router\n\tr.InitRouter()\n\n}", "title": "" }, { "docid": "080e6e03f02bff1aff8289d06c7632d0", "score": "0.48968077", "text": "func (hs *hashServer) handleRequest() {\n\tswitch {\n\tcase strings.Index(hs.r.URL.Path, \"/hash/\") == 0:\n\t\ths.lookupHash()\n\tcase hs.r.URL.Path == \"/hash\":\n\t\ths.generateHash()\n\tcase hs.r.URL.Path == \"/stats\":\n\t\ths.reportStats()\n\tcase hs.r.URL.Path == \"/shutdown\":\n\t\ths.shutdown()\n\t}\n}", "title": "" }, { "docid": "fd3e7458acfde1846fe949ed071999b7", "score": "0.4892947", "text": "func commandsTransaction(m *Miniredis, srv *redeo.Server) {\n\tsrv.HandleFunc(\"DISCARD\", m.cmdDiscard)\n\tsrv.HandleFunc(\"EXEC\", m.cmdExec)\n\tsrv.HandleFunc(\"MULTI\", m.cmdMulti)\n\tsrv.HandleFunc(\"UNWATCH\", m.cmdUnwatch)\n\tsrv.HandleFunc(\"WATCH\", m.cmdWatch)\n}", "title": "" }, { "docid": "b60ea702b64086d223be5521534e98aa", "score": "0.48917615", "text": "func HandlerGetAlgo(db *sql.DB) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar value string\n\t\terr := db.QueryRow(\"SELECT 'Hola!'\").Scan(&value)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"message\": \"Úps, esto no deberia pasar\",\n\t\t\t\t\"err\": err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(200, gin.H{\n\t\t\t\"message\": value,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "3ba1ac01b5523131ff6be8d83d5f06de", "score": "0.48856646", "text": "func mainHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"SOURCE\" {\n\t\t/* This is a new icecast source, pass it to the separate handler */\n\t\tmakeAuthHandler(sourceHandler, PERM_SOURCE)(w, r)\n\t} else if r.Method == \"GET\" {\n\t\tpath := r.URL.Path\n\t\tlenPath := len(path)\n\t\tif path == \"/admin/metadata\" {\n\t\t\t/* An mp3 metadata update */\n\t\t\tmakeAuthHandler(metadataHandler, PERM_META)(w, r)\n\t\t} else if path == \"/admin/listclients\" {\n\t\t\t/* A request to get the mountpoint listeners. */\n\t\t\tmakeAuthHandler(listclientsHandler, PERM_SOURCE)(w, r)\n\t\t} else if lenPath >= 6 && path[:6] == \"/admin\" {\n\t\t\t/* Admin access, pass it to the handler */\n\t\t\tmakeAuthHandler(adminHandler, PERM_ADMIN)(w, r)\n\t\t} else {\n\t\t\thttp.NotFound(w, r)\n\t\t}\n\t} else {\n\t\terrorHandler(w, r, \"Unsupported HTTP Method\")\n\t}\n}", "title": "" }, { "docid": "9432c4f93de774cc646a7c5e0f602cd9", "score": "0.48735705", "text": "func (s *ServerResource) QSLHandlerV1_1(w http.ResponseWriter, r *http.Request) {\n\ts.QSLHandler(w, r)\n}", "title": "" }, { "docid": "0d1bdf29a775cf3320d71828ff6a296b", "score": "0.4873014", "text": "func (t *tinkerforge) handler(uid uint32, funcID, seqNum uint8, h Handler) {\n\tt.handlersMutex.Lock()\n\tdefer t.handlersMutex.Unlock()\n\n\t// Make the handler removable\n\tif h == nil {\n\t\tdelete(t.handlers, handlerIDFromParam(uid, funcID, seqNum))\n\t\treturn\n\t}\n\n\t// Add handler\n\tt.handlers[handlerIDFromParam(uid, funcID, seqNum)] = h\n}", "title": "" }, { "docid": "be847c3b9255fd98b5ae5e2ec78fcc42", "score": "0.48720458", "text": "func getQueryHandlers(s *Server) *datasource.QueryTypeMux {\n\tmux := datasource.NewQueryTypeMux()\n\n\tmux.HandleFunc(models.QueryMetricValue, s.HandleGetMetricValueQuery)\n\tmux.HandleFunc(models.QueryMetricHistory, s.HandleGetMetricHistoryQuery)\n\tmux.HandleFunc(models.QueryMetricAggregate, s.HandleGetMetricAggregate)\n\tmux.HandleFunc(models.QueryDimensions, s.HandleListDimensionKeysQuery)\n\tmux.HandleFunc(models.QueryDimensionValues, s.HandleListDimensionValuesQuery)\n\tmux.HandleFunc(models.QueryMetrics, s.HandleListMetricsQuery)\n\n\treturn mux\n}", "title": "" }, { "docid": "6c324a8cbbf460c32a14b3baa645e6c8", "score": "0.48669165", "text": "func Handle(req []byte) string {\n\tconst (\n\t\thost = \"postgresql\"\n\t\tport = 5432\n\t\tuser = \"postgres\"\n\t\tpassword = \"spark123\"\n\t\tdbname = \"postgres\"\n\t\tsslmode = \"disable\"\n\t)\n\tq := \"SELECT name,age FROM \\\"user\\\"\"\n\n\tconnStr := fmt.Sprintf(\"user=%s password=%s dbname=%s sslmode=%s host=%s port=%d\", user, password, dbname, sslmode, host, port)\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trows, err := db.Query(q)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\n\tvar names []string\n\tvar ages []int\n\tfor rows.Next() {\n\t\tvar name string\n\t\tvar age int\n\t\terr := rows.Scan(&name, &age)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tnames = append(names, name)\n\t\tages = append(ages, age)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn fmt.Sprintf(\"Names: %v, Ages: %v\", names, ages)\n}", "title": "" }, { "docid": "c38c08b9c240b577bd1648e1abbb5bab", "score": "0.4864818", "text": "func listenDB (context *libcoap.Context) {\n\tconfig := dots_config.GetServerSystemConfig()\n\tport := config.Network.DBNotificationPort\n\tlisten, err := net.Listen(\"tcp4\", \":\" + strconv.Itoa(port))\n\tif err != nil {\n\t\tlog.Errorf(\"[MySQL-Notification]:Socket listening on port %+v failed,%+v\", port, err)\n\t\tos.Exit(1)\n\t}\n\tlog.Debugf(\"[MySQL-Notification]:Begin listening on port: %+v\", port)\n\n\tfor {\n\t\tconn, err := listen.Accept()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[MySQL-Notification]:Error : %+v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tgo handler(conn, context)\n\t}\n\n}", "title": "" }, { "docid": "0977eb56993a3d971de359bcf017a598", "score": "0.48631507", "text": "func (h *Handler) handle(c *Conn, config uint32) {\n\n // Set initial handshake packet.\n c.sendHandshake(HANDSHAKEv10)\n // fmt.Println(c.GetSequenceID())\n\n // Read handshake response packet from client.\n c.readPacket(true)\n // fmt.Println(c.GetSequenceID())\n\n // Send OK packet.\n c.sendOKPacket(\"Welcome!\")\n\n // Switch over to command phase to receive commands from the client.\n // receiveCommand is what 'handles' the commands, so nothing else\n // needs to be done out here.\n for {\n if !c.receiveCommand() { break }\n }\n fmt.Println(\"Closing connection.\")\n c.CloseConnection()\n}", "title": "" }, { "docid": "38f81eb68d66e1d0723d6d301f9cdd8f", "score": "0.4863146", "text": "func handleH(c *net.TCPConn, cmd []string) {\n\twl(c, \"Commands:\")\n\twl(c, \"\\ta - Attack a host or hosts\")\n\twl(c, \"\\ts - Stop an attack on a host or hosts\")\n\twl(c, \"\\tl - List attacks in progress\")\n\twl(c, \"\\tg - Display global information.\")\n\twl(c, \"\\ti - Display information about an attack or attacks\")\n\twl(c, \"\\tm - Get or set the maximum number of concurrent attacks \"+\n\t\t\"against a host\")\n\twl(c, \"\\tM - Get or set maximum number of concurrant attacks globally\")\n\twl(c, \"\\tk - Kill sshbf\")\n\twl(c, \"\\tq - Exit (quit) this command session\")\n\twl(c, \"\\th - This help\")\n\twl(c, \"Enter a command by itself for more information.\")\n}", "title": "" }, { "docid": "00f87e2319034feef3230037570bdc87", "score": "0.48630798", "text": "func query(q string) {\n\tprices := lookup(q)\n\tif prices == nil {\n\t\treturn\n\t}\n\tanalyze(prices[0])\n}", "title": "" }, { "docid": "c718d0ae4bd4062b4b2d4aedd24c10b4", "score": "0.4858805", "text": "func (db *DB) send(description, method, path string, body []byte) (chan interface{}, error) {\n\tin := make(chan interface{}, 16)\n\tout := make(chan interface{}, 16)\n\n\turl, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb.l.LogBegin(description, method, db.url+db.dbPath()+path, body)\n\tstart := time.Now()\n\tpath = url.EscapedPath()\n\n\treq := db.conn.Request().\n\t\tMethod(method).\n\t\tAddPath(path).\n\t\tSetQueryParams(db.queryParams(url))\n\n\tif body != nil {\n\t\treq.Body(bytes.NewBuffer(body))\n\t}\n\n\tres, err := req.Send()\n\tif err != nil {\n\t\tdb.l.LogError(err.Error(), start)\n\t\treturn nil, err\n\t}\n\n\tif !res.Ok && len(res.Bytes()) == 0 {\n\t\terr := errors.New(\"the database returned a \" + strconv.Itoa(res.StatusCode))\n\n\t\tswitch res.StatusCode {\n\t\tcase http.StatusUnauthorized:\n\t\t\terr = errors.New(\"unauthorized: invalid credentials\")\n\t\tcase http.StatusTemporaryRedirect:\n\t\t\terr = errors.New(\"the database returned a 307 to \" + res.Header.Get(\"Location\"))\n\t\t}\n\n\t\tdb.l.LogError(err.Error(), start)\n\n\t\treturn nil, err\n\t}\n\n\tresult := &result{}\n\tjson.Unmarshal(res.Bytes(), result)\n\n\tif result.Error {\n\t\tdb.l.LogError(result.ErrorMessage, start)\n\t\tswitch {\n\t\tcase strings.Contains(result.ErrorMessage, \"unique constraint violated\"):\n\t\t\treturn nil, &ErrUnique{result.ErrorMessage}\n\t\tcase strings.Contains(result.ErrorMessage, \"not found\"):\n\t\t\treturn nil, &ErrNotFound{result.ErrorMessage}\n\t\tcase strings.Contains(result.ErrorMessage, \"unknown collection\"):\n\t\t\treturn nil, &ErrNotFound{result.ErrorMessage}\n\t\tcase strings.Contains(result.ErrorMessage, \"duplicate name\"):\n\t\t\treturn nil, &ErrDuplicate{result.ErrorMessage}\n\t\tdefault:\n\t\t\treturn nil, errors.New(result.ErrorMessage)\n\t\t}\n\t}\n\n\tgo db.l.LogResult(result.Cached, start, in, out)\n\n\tif len(result.Content) != 0 {\n\t\tin <- result.Content\n\t} else {\n\t\tin <- json.RawMessage(res.Bytes())\n\t}\n\n\tif result.HasMore {\n\t\tgo db.followCursor(path+\"/\"+result.ID, in)\n\t} else {\n\t\tin <- nil\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "08b7b36504acafcef0fd0ef59eda21ed", "score": "0.48570886", "text": "func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error {\n\t// little bit of gRPC internals never hurt anyone\n\tfullMethodName, ok := grpc.MethodFromServerStream(serverStream)\n\tif !ok {\n\t\treturn status.Errorf(codes.Internal, \"lowLevelServerStream doesn't exist in the context\")\n\t}\n\n\tmode, backends, err := s.director(serverStream.Context(), fullMethodName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbackendConnections := make([]backendConnection, len(backends))\n\n\tclientCtx, clientCancel := context.WithCancel(serverStream.Context())\n\tdefer clientCancel()\n\n\tfor i := range backends {\n\t\tbackendConnections[i].backend = backends[i]\n\n\t\t// We require that the backend's returned context inherits from the serverStream.Context().\n\t\tvar outgoingCtx context.Context\n\t\toutgoingCtx, backendConnections[i].backendConn, backendConnections[i].connError = backends[i].GetConnection(clientCtx)\n\n\t\tif backendConnections[i].connError != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tbackendConnections[i].clientStream, backendConnections[i].connError = grpc.NewClientStream(outgoingCtx, clientStreamDescForProxying,\n\t\t\tbackendConnections[i].backendConn, fullMethodName)\n\n\t\tif backendConnections[i].connError != nil {\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tswitch mode {\n\tcase One2One:\n\t\tif len(backendConnections) != 1 {\n\t\t\treturn status.Errorf(codes.Internal, \"one2one proxying should have exactly one connection (got %d)\", len(backendConnections))\n\t\t}\n\n\t\treturn s.handlerOne2One(serverStream, backendConnections)\n\tcase One2Many:\n\t\tif len(backendConnections) == 0 {\n\t\t\treturn status.Errorf(codes.Unavailable, \"no backend connections for proxying\")\n\t\t}\n\n\t\treturn s.handlerOne2Many(fullMethodName, serverStream, backendConnections)\n\tdefault:\n\t\treturn status.Errorf(codes.Internal, \"unsupported proxy mode\")\n\t}\n}", "title": "" }, { "docid": "a848850654b5b680610edc552e355d31", "score": "0.48497194", "text": "func main() {\n\tvar err error\n\tdb, err = sql.Open(\"postgres\", \"user=ohtu dbname=multi-axis sslmode=disable\")\n\tif err != nil { \n\t\tlog.Fatal(err)\n\t\t}\n\thttp.HandleFunc(\"/graph.js\", jsHandler)\t\t\n\thttp.HandleFunc(\"/\", handler)\n\thttp.HandleFunc(\"/test\", testHandler)\n\thttp.HandleFunc(\"/dashboard\", dashBoardHandler)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "7f9694200587cebf27bd78d2c7bf6ddb", "score": "0.48457694", "text": "func (orderbookHandler *OrderbookHandler) handle(ctx context.Context, msg interface{}) error {\n\n\t// we got message or handshake\n\tswitch messageType := msg.(type) {\n\tcase *OrderbookMsg:\n\t\treturn orderbookHandler.handleOrderbookMsg(msg.(*OrderbookMsg))\n\tcase *OrderbookCancelMsg:\n\t\treturn orderbookHandler.handleOrderbookCancelMsg(msg.(*OrderbookCancelMsg))\n\tcase *OrderbookHandshake:\n\t\treturn orderbookHandler.handleOrderbookHandshake(msg.(*OrderbookHandshake))\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown orderbook message type :%v\", messageType)\n\t}\n\n}", "title": "" }, { "docid": "31e7418f0546e42a70723284b8075cb0", "score": "0.48448867", "text": "func graphqlHandler(resolver *graph.Resolver) gin.HandlerFunc {\n\t// NewExecutableSchema and Config are in the generated.go file\n\t// Resolver is in the resolver.go file\n\t// h := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: &graph.Resolver{}}))\n\th := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: resolver}))\n\n\treturn func(c *gin.Context) {\n\t\th.ServeHTTP(c.Writer, c.Request)\n\t}\n}", "title": "" }, { "docid": "275cb6bf7193675b2efc97da518a9cb3", "score": "0.48366758", "text": "func(t * POEChaincode) Query(stub shim.ChaincodeStubInterface, function string, args[] string)([] byte, error) {\n\n switch\n function {\n\n case \"get_hash_details\":\n return t.get_hash_details(stub, args)\n\n default:\n return nil, errors.New(\"Received unknown function invocation \" + function)\n }\n}", "title": "" }, { "docid": "2022d79bc5994a18b913680c2187ce97", "score": "0.48336422", "text": "func (t *tinkerforge) Handler(uid uint32, funcID uint8, h Handler) {\n\tt.handler(uid, funcID, 0, h)\n}", "title": "" }, { "docid": "51eee2e01a2061f6ea8cdfecff13e36a", "score": "0.4833276", "text": "func main() {\n\n db, err := postgres.Open(os.Getenv(\"DATABASE_URL\")) //open db connection\n if err != nil {\n log.Fatal(err)\n }\n defer db.Close()\n\n us := &postgres.UserService{DB: db} //inject db into the UserService\n\n var h http.Handler //declare Handler\n\n h.UserHandler = http.NewUserHandler() //create instance of user handler\n\n h.UserHandler.UserService = us //attach UserService to UserHandler\n\n server := http.NewServer() //create a new server\n\n server.Handler = &h //attach handler to server\n\n err = server.Open() //start the server\n if err != nil {\n fmt.Println(err)\n }\n\n select{} // block main from terminating to allow our http server to continue to run\n}", "title": "" }, { "docid": "8afb714281a50c1fc2670e7e803b275b", "score": "0.48330817", "text": "func (mux *ServeMux) handler(selector string) (h Handler, pattern string) {\n\tmux.mu.RLock()\n\tdefer mux.mu.RUnlock()\n\n\th, pattern = mux.match(selector)\n\tif h == nil {\n\t\th, pattern = NotFoundHandler(), \"\"\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5bcc1a7f52aa59f5dd3b016ab958a006", "score": "0.4832125", "text": "func (*EmptyQueryResponse) Backend() {}", "title": "" }, { "docid": "1f5d69423bd9aab1f9adabbc3c38c778", "score": "0.48285332", "text": "func (cm *ConnManager) connHandler() {\r\nout:\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase req := <-cm.requests:\r\n\t\t\tswitch msg := req.(type) {\r\n\t\t\tcase *WebData:\r\n\t\t\t\tgo cm.cfg.OnWebData(msg)\r\n\t\t\tcase *webFlowReq:\r\n\t\t\t\tgo cm.cfg.HandleWebFlow(msg)\r\n\t\t\tcase *Duration:\r\n\t\t\t\tgo cm.cfg.HandleDuration(msg)\r\n\t\t\t}\r\n\t\tcase <-cm.quit:\r\n\t\t\tbreak out\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "82a16a9ae6d2fd065d189af6f0f59cf7", "score": "0.4819924", "text": "func (s *server) handler(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path == \"/\" {\n\t\ts.home(w, r)\n\t\treturn\n\t}\n\tif r.URL.Path == \"/favicon.ico\" {\n\t\treturn\n\t}\n\tif r.URL.Path == \"/robots.txt\" {\n\t\tfmt.Fprintf(w, \"User-agent: *\\nDisallow: /\")\n\t\treturn\n\t}\n\tif r.URL.Path == \"/new\" {\n\t\tfmt.Fprintf(w, \"%s%s\", s.baseURL, randKey(keySize))\n\t\treturn\n\t}\n\tif r.Method == \"OPTIONS\" {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT\")\n\t\treturn\n\t}\n\n\tparams := parseParams(r)\n\tif params == nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\ts.maxID++\n\tparams.id = s.maxID\n\n\tif r.Method == \"GET\" {\n\t\ts.recv(w, r, params)\n\t\treturn\n\t}\n\tif r.Method == \"POST\" || r.Method == \"PUT\" {\n\t\ts.send(w, r, params)\n\t\treturn\n\t}\n\thttp.Error(w, \"Invalid Method\", http.StatusNotFound)\n}", "title": "" } ]
f46c5f1f14cd1e1f0b80fd10258a402b
Optional extracts the argument from args at the given offset if len(args) > offset, returning the specified default if args is not long enough. If args contains more elements than limit, the function panics. Useful for implementing optional arguments of variable arity, while enforcing their length.
[ { "docid": "c1f6ab2f5290ad2374b287dc25b724cc", "score": "0.7764186", "text": "func Optional(offset int, limit int, def interface{}, args ...interface{}) interface{} {\n\tswitch {\n\tcase limit < 1:\n\t\tpanic(fmt.Errorf(errLimitLessThanOne))\n\tcase offset < 0 || offset >= limit:\n\t\tpanic(fmt.Errorf(errOffsetOutsideRange))\n\t}\n\n\tlength := len(args)\n\tswitch {\n\tcase length > limit:\n\t\tpanic(fmt.Errorf(\"expected at most %d argument(s), got %d\", limit, length))\n\tcase offset < length:\n\t\treturn args[offset]\n\tdefault:\n\t\treturn def\n\t}\n}", "title": "" } ]
[ { "docid": "fe18cfd2af9cd04b365e1fc468fb1206", "score": "0.6514136", "text": "func (a *ArrayBytes) GetOptionalArgOrDefault(argIdx int, defaultValue int64) int64 {\n\tx := *a\n\tif argIdx < len(x) {\n\t\treturn x[argIdx].N\n\t}\n\tif len(x) == 1 {\n\t\treturn x[0].N\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "43a12098a7f60cb0acfa13d30febdc55", "score": "0.631889", "text": "func (a *ArrayDuration) GetOptionalArgOrDefault(argIdx int, defaultValue time.Duration) time.Duration {\n\tx := *a\n\tif argIdx >= len(x) {\n\t\tif len(x) == 1 {\n\t\t\treturn x[0]\n\t\t}\n\t\treturn defaultValue\n\t}\n\treturn x[argIdx]\n}", "title": "" }, { "docid": "0dc6817ff042938e04703ea4d5eb0f04", "score": "0.614311", "text": "func OptionalUntyped(offset int, limit int, def interface{}, args interface{}) interface{} {\n\treturn Optional(offset, limit, def, ListifyOrPanic(args)...)\n}", "title": "" }, { "docid": "88228609ea61ee2c25f3afe36113c14d", "score": "0.6098555", "text": "func (a *ArrayInt) GetOptionalArgOrDefault(argIdx, defaultValue int) int {\n\tx := *a\n\tif argIdx < len(x) {\n\t\treturn x[argIdx]\n\t}\n\tif len(x) == 1 {\n\t\treturn x[0]\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "f9b615a91626caa3be7504db8629b055", "score": "0.55884534", "text": "func defaultFunc(v ...interface{}) interface{} {\n\tif len(v) == 1 {\n\t\treturn v[0]\n\t} else if len(v) == 2 {\n\t\tif v[1] == nil {\n\t\t\treturn v[0]\n\t\t}\n\t\treturn v[1]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "88b8e9fcf0bc79915d9d277183c7b97f", "score": "0.55477417", "text": "func (a *ArrayString) GetOptionalArg(argIdx int) string {\n\tx := *a\n\tif argIdx >= len(x) {\n\t\tif len(x) == 1 {\n\t\t\treturn x[0]\n\t\t}\n\t\treturn \"\"\n\t}\n\treturn x[argIdx]\n}", "title": "" }, { "docid": "e6f552295c613b3939d27b9bd029b177", "score": "0.528928", "text": "func (a *ArrayBool) GetOptionalArg(argIdx int) bool {\n\tx := *a\n\tif argIdx >= len(x) {\n\t\tif len(x) == 1 {\n\t\t\treturn x[0]\n\t\t}\n\t\treturn false\n\t}\n\treturn x[argIdx]\n}", "title": "" }, { "docid": "812225605d1966d4a405755d7e65b190", "score": "0.51937926", "text": "func PullSliceValueWithDefault(out interface{}, slice interface{}, i int,\n\t_default interface{}) error {\n\treturn pullSliceValue(out, slice, i, _default, true)\n}", "title": "" }, { "docid": "72e5fd9504de64339829139ec22946df", "score": "0.50991833", "text": "func WithDefaultOffset(offset int64) Option {\n\treturn &withDefaultOffset{offset}\n}", "title": "" }, { "docid": "fcf3d39f68d20fe0833b042473d025b8", "score": "0.48843354", "text": "func SliceDefaults() {\n\ts := []int{2, 3, 5, 7, 11, 13}\n\tfmt.Println(s)\n\ts = s[1:5]\n\tfmt.Println(s)\n\ts = s[:3]\n\tfmt.Println(s)\n\ts = s[0:2]\n\tfmt.Println(s)\n\n}", "title": "" }, { "docid": "bd02e62521eef544a24c70a30c07a363", "score": "0.48813334", "text": "func MustGetArg(argIndex int) string {\n\tif len(os.Args) < argIndex+1 {\n\t\tlog.Fatalf(\"No arg at position os.Args[%d]\", argIndex)\n\t}\n\treturn os.Args[argIndex]\n}", "title": "" }, { "docid": "922f4781c854e18ee9515a58d1b74994", "score": "0.48519516", "text": "func (c *Context) maybeSelectDefault(flags []*Flag, node *Node) error {\n\tfor _, flag := range flags {\n\t\tif flag.Name == \"help\" && flag.Set {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif node.DefaultCmd != nil {\n\t\tc.Path = append(c.Path, &Path{\n\t\t\tParent: node.DefaultCmd,\n\t\t\tCommand: node.DefaultCmd,\n\t\t\tFlags: node.DefaultCmd.Flags,\n\t\t})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1985e8c48b541c2a00210221eaec75d5", "score": "0.48481163", "text": "func ExtractOption(args []string, position int, names []string, prefixes []string) (int, *string) {\n\tif (position + 1) < len(args) {\n\t\tfor _, name := range names {\n\t\t\tif args[position] == name {\n\t\t\t\tvalue := args[position+1]\n\t\t\t\treturn position + 2, &value\n\t\t\t}\n\t\t}\n\t}\n\tfor _, prefix := range prefixes {\n\t\tif strings.HasPrefix(args[position], prefix) {\n\t\t\tvalue := args[position][len(prefix):]\n\t\t\treturn position + 1, &value\n\t\t}\n\t}\n\treturn position, nil\n}", "title": "" }, { "docid": "5e76ef1b38b1369d7772b16697cf2cc5", "score": "0.4794314", "text": "func DefineFunctionOptionalArgs(name string, fun PrimitiveFunction, result Value, args []Value, defaults ...Value) {\n\tprim := NewPrimitive(name, fun, result, args, nil, defaults, nil)\n\tdefinePrimitive(name, prim)\n}", "title": "" }, { "docid": "7440716ace9b6437241ef4d864924826", "score": "0.47690687", "text": "func defaultParameterValueDemo(stringArg string, intArg int) {\n\tif stringArg == \"\" {\n\t\t// default value used\n\t}\n\n\tif intArg == 0 {\n\t\t// default value used\n\t}\n}", "title": "" }, { "docid": "5b7593af7464f41ca04391baf7887d60", "score": "0.4644252", "text": "func RequiresMaxArgs(max int) cobra.PositionalArgs {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) <= max {\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Errorf(\n\t\t\t\"%q requires at most %d %s.\\nSee '%s --help'.\\n\\nUsage: %s\\n\\n%s\",\n\t\t\tcmd.CommandPath(),\n\t\t\tmax,\n\t\t\tpluralize(\"argument\", max),\n\t\t\tcmd.CommandPath(),\n\t\t\tcmd.UseLine(),\n\t\t\tcmd.Short,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "00a6af1a404c9e7cccd42e6229c26910", "score": "0.46119556", "text": "func helpArgsFunc(args []string) interface{} {\n\tif len(args) == 1 {\n\t\treturn helpCommandArgs{Command: args[0], Rest: nil}\n\t} else if len(args) > 1 {\n\t\treturn helpCommandArgs{Command: args[0], Rest: args[1:]}\n\t}\n\treturn helpCommandArgs{}\n}", "title": "" }, { "docid": "e49a91e63e420937bd2bd3f79d52c4c5", "score": "0.4599095", "text": "func (args Args) Get(i int) string {\n\tif len(args) <= i {\n\t\treturn \"\"\n\t}\n\n\treturn args[i]\n}", "title": "" }, { "docid": "e322afde1f1b2742ba2f30828e5e3a1d", "score": "0.45607", "text": "func DefaultValueObscurator (limit int, str string) string {\n\treturn ObscurateLeft(limit, str)\n}", "title": "" }, { "docid": "42ad3f656116947867d7b11d20d03538", "score": "0.45552674", "text": "func (o *Option) calcArgLimit (v2 []interface{}) {\n\tfor _,vi := range v2 {\n\t\tv := reflect.ValueOf(vi)\n\t\tif v.Kind() != reflect.Ptr {\n\t\t\tpanic(\"expected struct or slice pointer\")\n\t\t}\n\t\tv = v.Elem()\n\t\tswitch v.Kind() {\n\t\tcase reflect.Struct:\n\t\t\to.argLimit += v.NumField()\n\t\tcase reflect.Slice:\n\t\t\tif v.Cap() == 0 {\n\t\t\t\to.argLimit = slice_limit\n\t\t\t\to.argSliceCap = slice_limit\n\t\t\t\tbreak\n\t\t\t}\n\t\t\to.argSliceCap = v.Cap()\n\t\t\to.argLimit += v.Cap()\n\t\tcase reflect.Array:\n\t\t\to.argSliceCap = v.Cap()\n\t\t\to.argLimit += v.Cap()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7494cabf072cc48deb70db985354cea4", "score": "0.45462596", "text": "func defaultIP(ips []net.IP) []net.IP {\n\tif len(ips) <= 1 {\n\t\treturn ips\n\t}\n\tv6 := -1\n\tfor i, ip := range ips {\n\t\tif ipLen := len(ip); ipLen == net.IPv4len {\n\t\t\treturn ips[i : i+1]\n\t\t} else if v6 == -1 && ipLen == net.IPv6len {\n\t\t\tv6 = i\n\t\t}\n\t}\n\tif v6 == -1 {\n\t\treturn nil // shouldn't ever happen\n\t}\n\treturn ips[v6 : v6+1]\n}", "title": "" }, { "docid": "2047029b043712a9709d5bff9a3f7731", "score": "0.45229375", "text": "func ParsePerPageOrDefault(in string) int {\n\tif x, err := ParsePerPage(in); err == nil {\n\t\treturn x\n\t}\n\n\treturn DefaultPerPage\n}", "title": "" }, { "docid": "4beaa63af71334add3c5c1af6e61a4c2", "score": "0.45210525", "text": "func Int64Default(reply interface{}, def ...int64) int64 {\n\tresult, err := conv.ToInt64E(reply)\n\tif err != nil && def != nil && len(def) > 0 {\n\t\treturn def[0]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "7d0bc85fbddd3596351b450c50467d59", "score": "0.4504758", "text": "func (this *ArrayRange) MaxArgs() int { return 3 }", "title": "" }, { "docid": "a3aa57785c63b56b691c19390127bd6e", "score": "0.44993544", "text": "func IntDefault(reply interface{}, def ...int) int {\n\tresult, err := conv.ToIntE(reply)\n\tif err != nil && def != nil && len(def) > 0 {\n\t\treturn def[0]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "87dee7ec95b4be581223f2090cef480a", "score": "0.44884607", "text": "func Uint64Default(reply interface{}, def ...uint64) uint64 {\n\tresult, err := conv.ToUint64E(reply)\n\tif err != nil && def != nil && len(def) > 0 {\n\t\treturn def[0]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "6db0841d199d2e3777ee6c6a155e98d2", "score": "0.44780612", "text": "func ParseOffsetLimit(vars map[string]string) (int, int) {\n\tvar offset, limit int\n\toffsetStr, ok := vars[\"offset\"]\n\tif !ok {\n\t\toffset = 0\n\t} else {\n\t\toffset, _ = strconv.Atoi(offsetStr)\n\t}\n\n\tif offset < 0 {\n\t\toffset = 10\n\t}\n\n\tlimitStr, ok := vars[\"limit\"]\n\tif !ok {\n\t\tlimit = 10\n\t} else {\n\t\tlimit, _ = strconv.Atoi(limitStr)\n\t}\n\n\tif limit < 0 || limit > 100 {\n\t\tlimit = 10\n\t}\n\n\treturn offset, limit\n}", "title": "" }, { "docid": "52f43f2f712221ee7c9f628aaf48aa18", "score": "0.44401297", "text": "func (a argAny) Get(i int, args ...interface{}) (r interface{}) {\n\tif i >= 0 && i < len(a) {\n\t\tr = a[i]\n\t}\n\tif len(args) > 0 {\n\t\tr = args[0]\n\t}\n\treturn\n}", "title": "" }, { "docid": "51b54edd99a47e09d9d5eae766f79b56", "score": "0.4414068", "text": "func Optional(elts ...RxElement) RxElement {\n\treturn Mod(Sequence(elts...), \"?\")\n}", "title": "" }, { "docid": "06c9f6a805b1737e86359c1e63e31b19", "score": "0.44048", "text": "func Default(arg string) func(*types.Cmd) {\n\treturn func(g *types.Cmd) {\n\t\tg.AddOptions(\"--default\")\n\t\tg.AddOptions(arg)\n\t}\n}", "title": "" }, { "docid": "37e662a1fb8b37f5b37d0cddf69b326a", "score": "0.44024062", "text": "func ValidateOptionalArgs(args []core.Value, t ...core.Type) error {\n\texp := len(t)\n\tgot := len(args)\n\tif got > exp {\n\t\treturn fmt.Errorf(\"expected %d arguments max, got %d\", exp, got)\n\t}\n\n\tfor i, v := range args {\n\t\ta := t[i]\n\t\tt := v.Type\n\t\tif t == core.Undefined {\n\t\t\tcontinue\n\t\t}\n\t\tif !validateType(t, a) {\n\t\t\treturn fmt.Errorf(\"expected argument %d to be %v, got %s\", i, a, v.TypeName())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "87b504202af574515e1e7ecade4b0c76", "score": "0.4402054", "text": "func defaultFromConfig(config *pyConfig, arg pyObject, name string) pyObject {\n\tif arg == nil || arg == None {\n\t\treturn config.Get(name, arg)\n\t}\n\treturn arg\n}", "title": "" }, { "docid": "7f9502734a02b73f3d69cc56ba4c48e8", "score": "0.43989336", "text": "func (q *Query) DefaultLimit(n int) {\n\tif q.Limit == 0 {\n\t\tq.Limit = n\n\t}\n}", "title": "" }, { "docid": "cddca973fe7c0b77217b4545848dc337", "score": "0.43956384", "text": "func (opt Int64Slice) UnwrapOrDefault() []int64 {\n\tif opt.getHasValue() {\n\t\treturn opt.getValue()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47058e06377f262a30001d5c34598258", "score": "0.43850714", "text": "func Sole(def interface{}, args ...interface{}) interface{} {\n\treturn Optional(0, 1, def, args...)\n}", "title": "" }, { "docid": "34078a4b6e6a060b5c66197bbc78f770", "score": "0.4383923", "text": "func intMoreDefault(s string, defaultN int) int {\n\tn, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tif n < defaultN {\n\t\treturn defaultN\n\t}\n\treturn n\n}", "title": "" }, { "docid": "4bf5e9628038248f4a9a57769a73810e", "score": "0.4375835", "text": "func FindTargetWithDefault(targets Targets, target *Target) *Target {\n\tif len(targets) == 1 && !target.IsSet() {\n\t\ttmp := *targets[0]\n\t\treturn &tmp\n\t}\n\treturn FindTarget(targets, target)\n}", "title": "" }, { "docid": "e8b17c8d57b825225f14e2b9437811e7", "score": "0.43560842", "text": "func (s *BasePowerQueryParserListener) ExitOptional_parameter(ctx *Optional_parameterContext) {}", "title": "" }, { "docid": "a5a56e608cc6d54ef6541b979181976b", "score": "0.435382", "text": "func (s *BaseMySqlParserListener) ExitLengthTwoOptionalDimension(ctx *LengthTwoOptionalDimensionContext) {\n}", "title": "" }, { "docid": "67dc3a5b76fcea0a9c6cc42aad71e4de", "score": "0.43537632", "text": "func DefaultArgs() *Args {\n\treturn &Args{\n\t\tsrc: \"src\",\n\t\tdst: \"dst\",\n\t\tposts: \"posts\",\n\t\ttemplates: \"templates\",\n\t\tstatic: \"static\",\n\t\tconfig: \"config.yaml\",\n\t\tpostTemplate: \"post.tmpl\",\n\t\ttagsTemplate: \"tags.tmpl\",\n\t\tbefore: \"\",\n\t}\n}", "title": "" }, { "docid": "742509ca5c322b824a0b9cc4931a062d", "score": "0.43532577", "text": "func DefaultAppendEntriesCaller(ctx context.Context, req *AppendEntriesRequest) (*AppendEntriesReply, error) {\n\treply := &AppendEntriesReply{}\n\treply.Term = req.Term\n\treply.Success = true\n\treturn reply, nil\n}", "title": "" }, { "docid": "bf145239de58170162a65e2aafcb72a2", "score": "0.4350685", "text": "func (this *ArrayRange) MinArgs() int { return 2 }", "title": "" }, { "docid": "7f677072270eafa9e7d238e2d4bd2a82", "score": "0.43321237", "text": "func getOffset(kvArgs ...*KVArg) int64 {\n\tfor _, arg := range kvArgs {\n\t\tif arg.Key == Offset {\n\t\t\treturn arg.Value.(int64)\n\t\t}\n\t}\n\treturn sarama.OffsetNewest\n}", "title": "" }, { "docid": "d11fecf66d8b648a311de33bce1d9369", "score": "0.43302113", "text": "func requireArgs(c *cli.Context, option int, args []string) error {\n\tfor idx, arg := range args {\n\t\tif option == cliAllArgs && c.String(arg) == \"\" {\n\t\t\tfmt.Printf(\"You need to specify all the following arguments: %s\\n\", formatArgs(args))\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif option == cliOneArg && c.String(arg) != \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tif option == cliAllIfFirstArg && c.String(args[0]) != \"\" && c.String(arg) == \"\" {\n\t\t\tfmt.Printf(\"After setting the argument \\\"--%s\\\", you need to specify all the following arguments: %s\\n\", args[0], formatArgs(args[1:]))\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif idx > 0 && option == cliOneIfFirstArg && c.String(args[0]) != \"\" && c.String(arg) != \"\" {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif option == cliOneArg {\n\t\tfmt.Printf(\"You need to specify one of the following arguments: %s\\n\", formatArgs(args))\n\t\tos.Exit(1)\n\t}\n\tif option == cliOneIfFirstArg && c.String(args[0]) != \"\" {\n\t\tfmt.Printf(\"After setting the argument \\\"--%s\\\", you need to specify at least one of the following arguments: %s\\n\", args[0], formatArgs(args[1:]))\n\t\tos.Exit(1)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be959824a606fd129a1f57180e5440a0", "score": "0.43267024", "text": "func (c *Command) SliceArgument(arg string, def []interface{}) []interface{} {\n\targ = strings.TrimSpace(arg)\n\tanon, ok := docoptArguments[arg]\n\tif ok && anon != nil {\n\t\treturn anon.([]interface{})\n\t}\n\treturn def\n}", "title": "" }, { "docid": "e3d6275ed59296ca0c25352da929d7cc", "score": "0.43076095", "text": "func ExactArgs(number int) cobra.PositionalArgs {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) == number {\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Errorf(\n\t\t\t\"%q requires exactly %d %s.\\nSee '%s --help'.\\n\\nUsage: %s\\n\\n%s\",\n\t\t\tcmd.CommandPath(),\n\t\t\tnumber,\n\t\t\tpluralize(\"argument\", number),\n\t\t\tcmd.CommandPath(),\n\t\t\tcmd.UseLine(),\n\t\t\tcmd.Short,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "cb17bd81fb9ba0f4927d42cdf3810029", "score": "0.42994663", "text": "func OptionalParamInt(oType []int) int {\n\tif len(oType) == 0 {\n\t\treturn 0\n\t} else {\n\t\treturn oType[0]\n\t}\n}", "title": "" }, { "docid": "b6bd22a899670b5e4f44089d556349ed", "score": "0.42986917", "text": "func (this *ArrayReplace) MaxArgs() int { return 4 }", "title": "" }, { "docid": "92da8a25e70025cc0ec2f085de0c3fdf", "score": "0.42985892", "text": "func Default(value interface{}) OptionalParameter {\n\treturn func(fn unescapedObj) {\n\t\tfn[\"default\"] = wrap(value)\n\t}\n}", "title": "" }, { "docid": "327f7f90169b4bfc8b34dd7db60cfd7e", "score": "0.42923632", "text": "func ensureArgAtIndex(pos int, argType string, f makeArgExprFunc) transformer {\n\treturn transformFunc(func(c *transformFileContext) {\n\t\tif len(c.call.Args) > pos {\n\t\t\ttypeOf := c.pkg.TypesInfo.TypeOf(c.call.Args[pos])\n\t\t\tif typeOf == nil {\n\t\t\t\t// can happen on a rerun if there is a local variable masking the inserted package alias\n\t\t\t\tc.Warning(fmt.Sprintf(\"cannot determine type of arg %d, skipping inserting %s (check for variables shadowing import)\", pos, argType))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif typeOf.String() == argType || strings.HasSuffix(typeOf.String(), makeVendorSuffix(argType)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t// pos cannot be greater than the current length\n\t\tif pos > len(c.call.Args) {\n\t\t\tc.Error(fmt.Errorf(\"cannot set arg %d; current arg length is %d\", pos, len(c.call.Args)))\n\t\t\treturn\n\t\t}\n\n\t\t// Modify AST\n\t\texpr, err := f(c)\n\t\tif err != nil {\n\t\t\tc.Error(err)\n\t\t\treturn\n\t\t}\n\n\t\t// Modify DST\n\t\tdecArg, err := argToDecArg(c, expr, 0)\n\t\tif err != nil {\n\t\t\tc.Error(err)\n\t\t\treturn\n\t\t}\n\n\t\tif pos == 0 {\n\t\t\tc.call.Args = append([]ast.Expr{expr}, c.call.Args...)\n\t\t\tc.decCall.Args = append([]dst.Expr{decArg}, c.decCall.Args...)\n\t\t} else if pos == len(c.call.Args) {\n\t\t\tc.call.Args = append(c.call.Args, expr)\n\t\t\tc.decCall.Args = append(c.decCall.Args, decArg)\n\t\t} else {\n\t\t\tc.call.Args = append(c.call.Args[:pos], append([]ast.Expr{expr}, c.call.Args[pos:]...)...)\n\t\t\tc.decCall.Args = append(c.decCall.Args[:pos], append([]dst.Expr{decArg}, c.decCall.Args[pos:]...)...)\n\t\t}\n\n\t\tc.Modified(fmt.Sprintf(\"inserted %s as arg %d\", argType, pos))\n\t})\n}", "title": "" }, { "docid": "0867d067fe6f60a3d0f2eb332dcceb44", "score": "0.4291932", "text": "func OptionLength(l int) func(p *NPParams) error {\n return func(p *NPParams) error {\n p.length = l\n return nil\n }\n}", "title": "" }, { "docid": "1759cb2dc28856b1c44a89c583d27c3e", "score": "0.42778516", "text": "func firstFilled(def string, options ...string) string {\n\tfor _, o := range options {\n\t\tif o != \"\" {\n\t\t\treturn o\n\t\t}\n\t}\n\treturn def\n}", "title": "" }, { "docid": "05dc1e90c60d84dcde1b731679d2d724", "score": "0.42683625", "text": "func (cmd *FinderCmd) DefaultFlags() error {\n\tflags := cmd.Cmd.Flags()\n\tflags.StringP(\n\t\t\"container\",\n\t\t\"c\",\n\t\t\"\",\n\t\t\"Container name. Defaults to first container.\")\n\tif err := cmd.BindFlag(\"container\"); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: is this best as an arg instead of positional?\n\tflags.StringP(\n\t\t\"pod\",\n\t\t\"p\",\n\t\t\"\",\n\t\t\"Pod name.\")\n\tif err := cmd.BindFlag(\"pod\"); err != nil {\n\t\treturn err\n\t}\n\n\tflags.StringSliceP(\n\t\t\"selector\",\n\t\t\"l\",\n\t\tnil,\n\t\t\"Selector (label query) to filter on, supports '=', '==', and '!='.\")\n\treturn cmd.BindFlag(\"selector\")\n}", "title": "" }, { "docid": "ade9b155ba36130d1ea1e3983ea21bd4", "score": "0.42612255", "text": "func Optional(value interface{}, optionalValid ...bool) interface{} {\n\tok := true\n\tswitch len(optionalValid) {\n\tcase 0:\n\t\tok = !reflect.ValueOf(value).IsZero()\n\tcase 1:\n\t\tok = optionalValid[0]\n\tdefault:\n\t\tpanic(\"Optional: bad arguments\")\n\t}\n\n\tif ok {\n\t\treturn value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6595dcc29b36a350c701bcd81bc6322", "score": "0.42543885", "text": "func (this *ArrayReplace) MinArgs() int { return 3 }", "title": "" }, { "docid": "01ed78f4819368386bdebed8167db669", "score": "0.4245505", "text": "func ClearDefaultStringSliceValue(stringSliceArgs ...string) (res []string) {\n\tif isJustDefault(stringSliceArgs) {\n\t\tres = stringSliceArgs\n\n\t} else {\n\t\tres = stringSliceArgs[1:]\n\t}\n\treturn\n}", "title": "" }, { "docid": "119a1db1cc3f3ae98f13a41c71e97464", "score": "0.42421895", "text": "func (s *BasePowerQueryParserListener) ExitOptional_parameter_specification(ctx *Optional_parameter_specificationContext) {\n}", "title": "" }, { "docid": "efb0ebeb27ef0ecdaba9bf2b9a549ccb", "score": "0.42410022", "text": "func (n *Node) ArgMax(val VarSet) (VarSet, float64) {\n\treturn nil, -1\n}", "title": "" }, { "docid": "0816cdbd1eeef98d546265fb4cd8d376", "score": "0.422779", "text": "func capToLimit(m *Metadata, limit int) *Metadata {\n\ttotal := len(m.ToolName) + len(m.ToolVersion) + len(m.ActionID) + len(m.InvocationID) + len(m.CorrelatedInvocationID)\n\texcess := total - limit\n\tif excess <= 0 {\n\t\treturn m\n\t}\n\t// We ignore the tool name, because in practice this is a\n\t// very short constant which makes no sense to truncate.\n\tdiff := len(m.ActionID) - len(m.InvocationID)\n\tif diff > 0 {\n\t\tif diff > excess {\n\t\t\tm.ActionID = m.ActionID[:len(m.ActionID)-excess]\n\t\t} else {\n\t\t\tm.ActionID = m.ActionID[:len(m.ActionID)-diff]\n\t\t\trem := (excess - diff + 1) / 2\n\t\t\tm.ActionID = m.ActionID[:len(m.ActionID)-rem]\n\t\t\tm.InvocationID = m.InvocationID[:len(m.InvocationID)-rem]\n\t\t}\n\t} else {\n\t\tdiff = -diff\n\t\tif diff > excess {\n\t\t\tm.InvocationID = m.InvocationID[:len(m.InvocationID)-excess]\n\t\t} else {\n\t\t\tm.InvocationID = m.InvocationID[:len(m.InvocationID)-diff]\n\t\t\trem := (excess - diff + 1) / 2\n\t\t\tm.InvocationID = m.InvocationID[:len(m.InvocationID)-rem]\n\t\t\tm.ActionID = m.ActionID[:len(m.ActionID)-rem]\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "9c5e5a860c7bbe5dbad5edea4fa10663", "score": "0.42249584", "text": "func (opt Int64Slice) UnwrapOr(def []int64) []int64 {\n\tif opt.getHasValue() {\n\t\treturn opt.getValue()\n\t}\n\treturn def\n}", "title": "" }, { "docid": "e2ff90a944a5f93c9ab374fc1af14f93", "score": "0.42066556", "text": "func LimitOffset(pageNumberStr, pageSizeStr string) (paginatedQuery string, err error) {\n\tpageNumber, err := strconv.Atoi(pageNumberStr)\n\tif err != nil {\n\t\treturn\n\t}\n\tpageSize, err := strconv.Atoi(pageSizeStr)\n\tif err != nil {\n\t\treturn\n\t}\n\tif pageNumber-1 < 0 {\n\t\tpageNumber = 1\n\t}\n\tpaginatedQuery = fmt.Sprintf(\"LIMIT %d OFFSET(%d - 1) * %d\", pageSize, pageNumber, pageSize)\n\treturn\n}", "title": "" }, { "docid": "6c4cace03d06dee8c5999a0ad730203a", "score": "0.42047206", "text": "func ZerothArgFromString(s string) (ZerothArg, error) {\n\n\tl := len(s)\n\tif l > maxArgLen {\n\t\treturn ZerothArg(\"\"), fmt.Errorf(\"cannot exceed %d characters\", maxArgLen)\n\t}\n\n\treturn ZerothArg(s), nil\n\n}", "title": "" }, { "docid": "2bd081008d848473279b837fca4aa4a1", "score": "0.41994798", "text": "func OptionArgumentHint(args []string, last []rune, opt *flags.Option) (hint []rune) {\n\treturn\n}", "title": "" }, { "docid": "3d547289577403642aee99772dd7fc09", "score": "0.41958627", "text": "func (p *Params) GetOptional(exec bool) (bool, string, error) {\n\tv, err := p.Get(exec)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\tif len(v) > 0 && v[0] == '-' {\n\t\treturn true, v[1:], nil\n\t}\n\treturn false, v, nil\n}", "title": "" }, { "docid": "59359110e9c7714e30fb61379d892a8b", "score": "0.41930646", "text": "func ParseDurationWithDefault(d string, def time.Duration) time.Duration {\n\tif len(d) == 0 {\n\t\treturn def\n\t}\n\tv, err := ParseDuration(d)\n\tif err != nil {\n\t\treturn def\n\t}\n\treturn v\n}", "title": "" }, { "docid": "517f2c91adca217ee7fb44b3845ef18e", "score": "0.41832027", "text": "func ShiftArgs(c cookoo.Context, params *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\n\tn := params.Get(\"n\", 1).(int)\n\targName := params.Get(\"args\", \"os.Args\").(string)\n\n\targs, ok := c.Get(argName, nil).([]string)\n\tif !ok {\n\t\treturn nil, &cookoo.FatalError{\"Could not get arg out of context: No such arg name.\"}\n\t}\n\n\tif len(args) < n {\n\t\tc.Put(argName, make([]string, 0))\n\t\t//log.Printf(\"Not enough args in %s\", argName)\n\t\treturn nil, &cookoo.RecoverableError{\"Not enough arguments.\"}\n\t}\n\ttargetArg := n - 1\n\tshifted := args[targetArg]\n\tc.Put(argName, args[n:])\n\n\treturn shifted, nil\n}", "title": "" }, { "docid": "1c21a2e479e2891570ab38952dbdee4d", "score": "0.41757375", "text": "func (this *Lag) MaxArgs() int { return 3 }", "title": "" }, { "docid": "d4d53e899c018d2da3330e8d38b0574d", "score": "0.41723764", "text": "func (ann *annotated) applyOptionalTag() {\n\tft := reflect.TypeOf(ann.Target)\n\tif !ft.IsVariadic() {\n\t\treturn\n\t}\n\n\tresultTypes, _ := ann.currentResultTypes()\n\n\tfields := []reflect.StructField{_inAnnotationField}\n\tfor i := 0; i < ft.NumIn(); i++ {\n\t\tfield := reflect.StructField{\n\t\t\tName: fmt.Sprintf(\"Field%d\", i),\n\t\t\tType: ft.In(i),\n\t\t}\n\t\tif i == ft.NumIn()-1 {\n\t\t\t// Mark a variadic argument optional by default\n\t\t\t// so that just wrapping a function in fx.Annotate does not\n\t\t\t// suddenly introduce a required []arg dependency.\n\t\t\tfield.Tag = reflect.StructTag(`optional:\"true\"`)\n\t\t}\n\t\tfields = append(fields, field)\n\t}\n\tparamType := reflect.StructOf(fields)\n\torigFn := reflect.ValueOf(ann.Target)\n\tnewFnType := reflect.FuncOf([]reflect.Type{paramType}, resultTypes, false)\n\tnewFn := reflect.MakeFunc(newFnType, func(args []reflect.Value) []reflect.Value {\n\t\tparams := args[0]\n\t\targs = args[:0]\n\t\tfor i := 0; i < ft.NumIn(); i++ {\n\t\t\targs = append(args, params.Field(i+1))\n\t\t}\n\t\treturn origFn.CallSlice(args)\n\t})\n\tann.Target = newFn.Interface()\n}", "title": "" }, { "docid": "e706d5f1cb55d3b7e7c97a4f5cbd809f", "score": "0.415597", "text": "func NewFakeVariadicDefaultFatal(t VariadicTestingT) *FakeVariadic {\n\treturn &FakeVariadic{\n\t\tSingleVariadicHook: func(...string) {\n\t\t\tt.Fatal(\"Unexpected call to Variadic.SingleVariadic\")\n\t\t\treturn\n\t\t},\n\t\tMixedVariadicHook: func(int, int, int, ...string) {\n\t\t\tt.Fatal(\"Unexpected call to Variadic.MixedVariadic\")\n\t\t\treturn\n\t\t},\n\t}\n}", "title": "" }, { "docid": "14bde5dae6217830d74fe81e7381c6c6", "score": "0.41447473", "text": "func ottoOptionalStringParam(call otto.FunctionCall, arg int, what string) *string {\n\tval := call.Argument(arg)\n\tif val.IsString() {\n\t\treturn base.StringPtr(val.String())\n\t} else if val.IsNull() || val.IsUndefined() {\n\t\treturn nil\n\t} else {\n\t\tpanic(call.Otto.MakeTypeError(fmt.Sprintf(\"%s() param %d must be a string or null\", what, arg+1)))\n\t}\n}", "title": "" }, { "docid": "69e9c6cd1025cbd1904ae5c98cf7cd3a", "score": "0.41445848", "text": "func checkArg() {\n if len(os.Args) != 4 { \n fmt.Println(\"#Usage: \" + os.Args[0] + \" <name> <port> <n>\") \n os.Exit(0) \n }\n}", "title": "" }, { "docid": "d30eece19a3003762ffc3e4e52c77c36", "score": "0.41381845", "text": "func getLastUint8SliceArgument(params [][]uint8) ([]uint8, bool) {\n\tif i := len(params); i > 0 {\n\t\treturn params[i-1], true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "6845221a9eea808e4dfde37b2bed6d2c", "score": "0.41070732", "text": "func defaultInfoArguments() infoArguments {\n\treturn infoArguments{\n\t\ttoken: cmdToken,\n\t\tverbose: cmdVerbose,\n\t\tapiEndpoint: config.Config.ChooseEndpoint(cmdAPIEndpoint),\n\t}\n}", "title": "" }, { "docid": "4995387f65ad54c4f893cee41af1c9c9", "score": "0.41024393", "text": "func getLastByteSliceArgument(params [][]byte) ([]byte, bool) {\n\tif i := len(params); i > 0 {\n\t\treturn params[i-1], true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "e481d4b68f94c3ce1bb4dd1b0c8b8516", "score": "0.41004944", "text": "func Float64Default(reply interface{}, def ...float64) float64 {\n\tresult, err := conv.ToFloat64E(reply)\n\tif err != nil && def != nil && len(def) > 0 {\n\t\treturn def[0]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "779cca5d93bf5a3b1abe86f3c85cf246", "score": "0.41004777", "text": "func Optional(parser Parser) Parser {\n\treturn FuncParser(func(state ParserState) (*ParserResult, error) {\n\t\tpr, err := parser.Apply(state)\n\t\tif err != nil {\n\t\t\treturn Success(state, nil)\n\t\t}\n\n\t\treturn Success(pr.Remaining, pr.Result)\n\t})\n}", "title": "" }, { "docid": "eb45d71eed55c0970ab84b824726e441", "score": "0.40856415", "text": "func ApplyBookQueryArgsDefaults(queryArgs *BookQueryArguments) *BookQueryArguments {\n\tif queryArgs == nil {\n\t\tqueryArgs = &BookQueryArguments{\n\t\t\tCursor: DefaultCursor,\n\t\t}\n\t\treturn queryArgs\n\t}\n\tif queryArgs.Offset == nil {\n\t\tqueryArgs.Offset = DefaultCursor.Offset\n\t}\n\tif queryArgs.Limit == nil {\n\t\tqueryArgs.Limit = DefaultCursor.Limit\n\t}\n\tif queryArgs.OrderBy == nil {\n\t\tqueryArgs.OrderBy = DefaultCursor.OrderBy\n\t}\n\tif queryArgs.Desc == nil {\n\t\tqueryArgs.Desc = DefaultCursor.Desc\n\t}\n\tif queryArgs.Dead == nil {\n\t\tqueryArgs.Dead = DefaultCursor.Dead\n\t}\n\tif queryArgs.After == nil {\n\t\tqueryArgs.After = DefaultCursor.After\n\t}\n\tif queryArgs.First == nil {\n\t\tqueryArgs.First = DefaultCursor.First\n\t}\n\tif queryArgs.Before == nil {\n\t\tqueryArgs.Before = DefaultCursor.Before\n\t}\n\tif queryArgs.Last == nil {\n\t\tqueryArgs.Last = DefaultCursor.Last\n\t}\n\treturn queryArgs\n}", "title": "" }, { "docid": "fde3fbc6ea18f90bbbde1717b460f6d3", "score": "0.407779", "text": "func Default(defaultValue interface{}) MethodParamOption {\n\treturn func(p *MethodParam) {\n\t\tif defaultValue != nil {\n\t\t\tp.defaultValue = fmt.Sprint(defaultValue)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6d503b793f9b52a5b502147b48f30a8", "score": "0.40697002", "text": "func inject_default_help_option(opts *jsonOptions) {\n\n helpDefault := \"true\"\n *opts = append(*opts,\n jsonOption{\"h\", \"help\", \"print this help text and exit\", \"bool\",\n &helpDefault, nil, nil})\n}", "title": "" }, { "docid": "573aff66faa86bf40f2a39c00066e1ff", "score": "0.40696824", "text": "func DefaultUsageFunc(sf *pflag.FlagSet, c *cobra.Command) string {\n\tvar b strings.Builder\n\n\tfmt.Fprintf(&b, \"continuous profiling platform\\n\\n\")\n\theaderClr.Fprintf(&b, \"USAGE\\n\")\n\tif c.Use != \"\" {\n\t\tfmt.Fprintf(&b, \" %s\\n\", c.Use)\n\t} else {\n\t\tfmt.Fprintf(&b, \" %s\\n\", c.Name())\n\t}\n\tfmt.Fprintf(&b, \"\\n\")\n\n\tif c.Long != \"\" {\n\t\tfmt.Fprintf(&b, \"%s\\n\\n\", c.Long)\n\t}\n\n\tif hasSubCommands(c) {\n\t\theaderClr.Fprintf(&b, \"SUBCOMMANDS\\n\")\n\t\ttw := tabwriter.NewWriter(&b, 0, 2, 2, ' ', 0)\n\t\tfor _, subcommand := range c.Commands() {\n\t\t\tif !subcommand.Hidden {\n\t\t\t\tfmt.Fprintf(tw, \" %s\\t%s\\n\", itemClr.Sprintf(subcommand.Name()), subcommand.Short)\n\t\t\t}\n\t\t}\n\t\ttw.Flush()\n\t\tfmt.Fprintf(&b, \"\\n\")\n\t}\n\n\tif countFlags(c.Flags()) > 0 {\n\t\t// headerClr.Fprintf(&b, \"FLAGS\\n\")\n\t\ttw := tabwriter.NewWriter(&b, 0, 2, 2, ' ', 0)\n\t\tfmt.Fprintf(tw, \"%s\\t %s@new-line@\\n\", headerClr.Sprintf(\"FLAGS\"), defClr.Sprint(\"DEFAULT VALUES\"))\n\n\t\t// TODO: it would be nice to sort by how often people would use these.\n\t\t// But for that we'd have to have a conversion from flag-set back to struct\n\t\tsf.VisitAll(func(f *pflag.Flag) {\n\t\t\tif f.Hidden {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdef := f.DefValue\n\t\t\t// if def == \"\" {\n\t\t\t// \tdef = \"...\"\n\t\t\t// }\n\t\t\tdef = defClr.Sprint(def)\n\t\t\t// def = fmt.Sprintf(\"(%s)\", def)\n\t\t\tfmt.Fprintf(tw, \" %s\\t%s\", itemClr.Sprintf(\"--\"+f.Name), def)\n\t\t\tif f.Usage != \"\" {\n\t\t\t\tfmt.Fprintf(tw, \"@new-line@ \")\n\t\t\t\tdescClr.Fprint(tw, f.Usage)\n\t\t\t}\n\t\t\tdescClr.Fprint(tw, \"@new-line@\")\n\t\t\tfmt.Fprint(tw, \"\\n\")\n\t\t})\n\t\ttw.Flush()\n\t\t// fmt.Fprintf(&b, \"\\n\")\n\t}\n\n\tif hasSubCommands(c) {\n\t\tb.WriteString(\"Run 'pyroscope SUBCOMMAND --help' for more information on a subcommand.\\n\")\n\t}\n\n\treturn strings.ReplaceAll(b.String(), \"@new-line@\", \"\\n\")\n}", "title": "" }, { "docid": "e74f7eb62a25d1c104619d63b3b891e7", "score": "0.40680185", "text": "func customUsage() {\n fmt.Fprintf(flag.CommandLine.Output(), \"Usage of %s:\\n\", os.Args[0])\n fmt.Fprintf(flag.CommandLine.Output(),\n \"$ %s [OPTIONS ...] PORT [SERVICE] [ADDRESS]\\n\", os.Args[0])\n\n fmt.Fprintf(flag.CommandLine.Output(), \"\\nOPTIONS:\\n\")\n flag.PrintDefaults()\n\n fmt.Fprintf(flag.CommandLine.Output(), \"\\nPOSITIONAL PARAMETERS:\\n\")\n posArgs := map[string]string {\n \"PORT\": \"Local port for proxy to listen on\",\n \"SERVICE\": \"Human-readable name of the service for proxy to represent\",\n \"ADDRESS\": \"A string in \\\"IP:SERVICE_PORT\\\" format of the address for the proxy to advertise\",\n }\n\n for name, usage := range posArgs {\n // Altered from golang's flag.go's PrintDefaults() implementation\n s := \" \" + name\n if len(s) <= 4 {\n s += \"\\t\"\n } else {\n s += \"\\n \\t\"\n }\n s += strings.ReplaceAll(usage, \"\\n\", \"\\n \\t\")\n fmt.Fprint(flag.CommandLine.Output(), s + \"\\n\")\n }\n\n s := \"NOTE: PORT, SERVICE, and ADDRESS *must* come after any OPTIONS flag arguments.\"\n fmt.Fprint(flag.CommandLine.Output(), \"\\n\" + s + \"\\n\")\n\n s = \"If service and address are omitted, proxy launches in anonymous mode.\\n\" +\n \"Using \\\"anonymous mode\\\" allows a client to access the network without\\n\" +\n \"having to register and advertise itself in the network.\"\n fmt.Fprint(flag.CommandLine.Output(), \"\\n\" + s + \"\\n\")\n}", "title": "" }, { "docid": "d8a6e5984b2cd9f482ec10afb2226de3", "score": "0.40630832", "text": "func limitAndOffset(lim, off, n int) (int, int) {\n\tif off >= n {\n\t\treturn 0, 0\n\t}\n\n\to := off\n\tl := n\n\n\tif lim > 0 && o+lim < l {\n\t\tl = o + lim\n\t}\n\n\tif o > l {\n\t\treturn 0, 0\n\t}\n\n\treturn l, o\n}", "title": "" }, { "docid": "50070c33799d7ba64f54da028f5e5daf", "score": "0.4057278", "text": "func TailOptionDefaults() TailOptions {\n\treturn TailOptions{\n\t\tWithTailNumberLines(0),\n\t\tWithTailSpace(\"default\"),\n\t\tWithTailTimeout(time.Second),\n\t}\n}", "title": "" }, { "docid": "070e1008163129db05ae0f2dd0875df1", "score": "0.40514252", "text": "func MinimumNArgsAndUUID(argsCount int) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif err := cobra.MinimumNArgs(argsCount)(cmd, args); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(args[0]) != 32 {\n\t\t\t_ = cmd.Help()\n\t\t\treturn errInvalidUUID\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "28c6407716fda1b967e655e1530d8d98", "score": "0.40473685", "text": "func (s *BasePowerQueryParserListener) ExitOptional_parameter_list(ctx *Optional_parameter_listContext) {\n}", "title": "" }, { "docid": "ed984221ff1c47429f005020636ec215", "score": "0.4037664", "text": "func (e *Engine) Limit(args ...int) *Engine {\n\n\t//TODO postgresql/mssql limit statement\n\tnArgs := len(args)\n\tif nArgs == 0 {\n\t\treturn e\n\t}\n\n\tswitch e.adapterSqlx {\n\tcase types.AdapterSqlx_Mssql:\n\t\t{\n\t\t\te.setLimit(fmt.Sprintf(\"TOP %v\", args[0]))\n\t\t}\n\tdefault:\n\t\t{\n\t\t\tif nArgs == 1 {\n\t\t\t\te.setLimit(fmt.Sprintf(\"LIMIT %v\", args[0]))\n\t\t\t} else if nArgs == 2 {\n\t\t\t\te.setLimit(fmt.Sprintf(\"LIMIT %v,%v\", args[0], args[1]))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "a4fda3056a2dcf24332e4705e23f997e", "score": "0.4032303", "text": "func BuildLimitOffsetClause(limit int, offset int) string {\n\treturn \" LIMIT \" + strconv.Itoa(limit) + \" OFFSET \" + strconv.Itoa(offset)\n}", "title": "" }, { "docid": "15a90fce6fdbde8b9f3d435b65f66cff", "score": "0.40302137", "text": "func (s State) PullAnyFromArrayOpt(table *lua.LTable, index int, d types.Value, t ...string) (v types.Value) {\n\tv, err := s.World.PullAnyFromArrayOpt(table, index, v)\n\tif err != nil {\n\t\ts.RaiseError(\"index %d: %s\", index, err.Error())\n\t\treturn nil\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e942af7d2ad2e45ceb741022ab7f1127", "score": "0.4027981", "text": "func MakeOrDefJivaReplicaArgs(profileMap map[string]string, ctrlIP string) []string {\n\tif profileMap == nil || strings.TrimSpace(ctrlIP) == \"\" {\n\t\treturn nil\n\t}\n\n\t// Extract the runtime values\n\tstorSize := profileMap[string(PVPStorageSizeLbl)]\n\tif storSize == \"\" {\n\t\tstorSize = string(JivaStorSizeDef)\n\t}\n\n\trepArgs := make([]string, len(JivaReplicaArgs))\n\n\tfor _, rArg := range JivaReplicaArgs {\n\t\trArg = strings.Replace(rArg, string(JivaCtrlIPHolder), ctrlIP, 1)\n\t\trArg = strings.Replace(rArg, string(JivaStorageSizeHolder), storSize, 1)\n\t\trepArgs = append(repArgs, rArg)\n\t}\n\n\treturn repArgs\n}", "title": "" }, { "docid": "448adfd04f8d796d3c1c758f8e583f4a", "score": "0.40276745", "text": "func NewFakeVariadicDefaultPanic() *FakeVariadic {\n\treturn &FakeVariadic{\n\t\tSingleVariadicHook: func(...string) {\n\t\t\tpanic(\"Unexpected call to Variadic.SingleVariadic\")\n\t\t},\n\t\tMixedVariadicHook: func(int, int, int, ...string) {\n\t\t\tpanic(\"Unexpected call to Variadic.MixedVariadic\")\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2b5a30d39a6fe1d2de9ce63016c9af1b", "score": "0.40241942", "text": "func (s *ArgumentListSlice) Get(i int) Any {\n\tif i < 0 || s.start+i >= s.stop {\n\t\tpanic(\"Index out of bounds\")\n\t}\n\n\treturn s.vector.Get(s.start + i)\n}", "title": "" }, { "docid": "d3d6c6fa81bd7f592e3a6d7f8a93674e", "score": "0.40234143", "text": "func GetExpandedArg(v *viper.Viper, key string) string {\n\treturn GetExpandedString(v, v.GetString(key))\n}", "title": "" }, { "docid": "83c89d0368d5bcb9eef41649eac07e25", "score": "0.40085047", "text": "func (c *CustomFuncs) SimplifyLimitOffsetOrdering(\n\tinput memo.RelExpr, ordering physical.OrderingChoice,\n) physical.OrderingChoice {\n\treturn c.simplifyOrdering(input, ordering)\n}", "title": "" }, { "docid": "2818d43b14250110d61b1b8618e070e8", "score": "0.4006663", "text": "func HitokotoEmptyArg() HitokotoArg {\n\treturn \"\"\n}", "title": "" }, { "docid": "ee4fd1481fa923ed39e62d780c8dd7fb", "score": "0.40061823", "text": "func (s *BaseMySqlParserListener) EnterLengthTwoOptionalDimension(ctx *LengthTwoOptionalDimensionContext) {\n}", "title": "" }, { "docid": "c6a84410f05bf999ba2f5fe8441d37a1", "score": "0.39990807", "text": "func GetQueryArg(r *http.Request, name string, defaultVal string) string {\n\tv := r.URL.Query().Get(name)\n\tif v == \"\" {\n\t\tv = defaultVal\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "2264be9da7647b662806b9282e0edc88", "score": "0.39954364", "text": "func StringDefault(reply interface{}, def ...string) string {\n\tresult, err := String(reply)\n\tif err != nil && def != nil && len(def) > 0 {\n\t\treturn def[0]\n\t}\n\treturn strings.TrimSpace(result)\n}", "title": "" }, { "docid": "3493a1273600c04f7608fef2005ddc2e", "score": "0.39815933", "text": "func (a *ArgSet) Remaining(p *[]string, name string, minmax Range, usage string) {\n\ta.RemainingVar((*stringList)(p), name, minmax, usage)\n}", "title": "" }, { "docid": "94126d7401db2594df197e35d8918d68", "score": "0.3981387", "text": "func (s *State) Arg(index int) interface{} {\n\tif index < len(s.args) {\n\t\treturn s.args[index]\n\t} else {\n\t\t//log.Println(\"warning: in\", s.File, \"argument\", index, \"not provided\")\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "6b247fa23cbfee78b05ca7543c7afe18", "score": "0.39796507", "text": "func (finder Finder) FindOptionalString(val string, paths ...interface{}) (string, error) {\n\ts, err := finder.FindString(paths...)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase EmptyStringError, EntryNotExistsError, NullValueError:\n\t\t\treturn val, nil\n\t\t}\n\t}\n\treturn s, err\n}", "title": "" } ]
402ff53caeaa7145f0898d255333a335
PDFString returns a string representation as found in and written to a PDF file.
[ { "docid": "53054633c23e73e78a38ad5aef85712e", "score": "0.75022364", "text": "func (nameObject Name) PDFString() string {\n\ts := \" \"\n\tif len(nameObject) > 0 {\n\t\ts = string(nameObject)\n\t}\n\treturn fmt.Sprintf(\"/%s\", s)\n}", "title": "" } ]
[ { "docid": "fdcffaa12b466c7f229704a91706463a", "score": "0.79430693", "text": "func (ir IndirectRef) PDFString() string {\n\treturn fmt.Sprintf(\"%d %d R\", ir.ObjectNumber, ir.GenerationNumber)\n}", "title": "" }, { "docid": "235eee321fa8341298b7cb1717483944", "score": "0.74705106", "text": "func (boolean Boolean) PDFString() string {\n\treturn boolean.String()\n}", "title": "" }, { "docid": "9a9a974597be5a989944cfb3a1f5ebe4", "score": "0.72132134", "text": "func (i Integer) PDFString() string {\n\treturn i.String()\n}", "title": "" }, { "docid": "19464a6c7ab43449015473bc247e14f3", "score": "0.70973796", "text": "func (f Float) PDFString() string {\n\t// The max precision encountered so far has been 12 (fontType3 fontmatrix components).\n\treturn strconv.FormatFloat(f.Value(), 'f', 12, 64)\n}", "title": "" }, { "docid": "7dd7e8022ce5801c51732f52c55d05cc", "score": "0.700019", "text": "func (stringliteral StringLiteral) PDFString() string {\n\treturn stringliteral.String()\n}", "title": "" }, { "docid": "348ea490da0fb9e90aeed4f0f61916a5", "score": "0.6903529", "text": "func (hexliteral HexLiteral) PDFString() string {\n\treturn hexliteral.String()\n}", "title": "" }, { "docid": "d233a952a039abc0ce1b1f67bc8b53ac", "score": "0.68624073", "text": "func (str *PdfObjectString) WriteString() string {\n\tvar output bytes.Buffer\n\n\t// Handle hex representation.\n\tif str.isHex {\n\t\tshex := hex.EncodeToString(str.Bytes())\n\t\toutput.WriteString(\"<\")\n\t\toutput.WriteString(shex)\n\t\toutput.WriteString(\">\")\n\t\treturn output.String()\n\t}\n\n\t// Otherwise regular string.\n\tescapeSequences := map[byte]string{\n\t\t'\\n': \"\\\\n\",\n\t\t'\\r': \"\\\\r\",\n\t\t'\\t': \"\\\\t\",\n\t\t'\\b': \"\\\\b\",\n\t\t'\\f': \"\\\\f\",\n\t\t'(': \"\\\\(\",\n\t\t')': \"\\\\)\",\n\t\t'\\\\': \"\\\\\\\\\",\n\t}\n\n\toutput.WriteString(\"(\")\n\tfor i := 0; i < len(str.val); i++ {\n\t\tchar := str.val[i]\n\t\tif escStr, useEsc := escapeSequences[char]; useEsc {\n\t\t\toutput.WriteString(escStr)\n\t\t} else {\n\t\t\toutput.WriteByte(char)\n\t\t}\n\t}\n\toutput.WriteString(\")\")\n\treturn output.String()\n}", "title": "" }, { "docid": "75f2d1f5816330aecf0b7fc63604c47d", "score": "0.6592647", "text": "func (p *PDFFile) String() string {\n\ttpl := `\nFilepath : %s\nPages : %d\nDimensions : %0.7f (w) %0.7f (h)\nOrientation : %s\n`\n\treturn fmt.Sprintf(tpl, p.FilePath, p.Pages, p.Width, p.Height, p.Orientation)\n}", "title": "" }, { "docid": "154bd883bb9ef895a405c2a3da810495", "score": "0.64429235", "text": "func (stream *PdfObjectStream) WriteString() string {\n\tvar b strings.Builder\n\tb.WriteString(strconv.FormatInt(stream.ObjectNumber, 10))\n\tb.WriteString(\" 0 R\")\n\treturn b.String()\n}", "title": "" }, { "docid": "803b2a36d74dc359a3b75c7c8cc20a23", "score": "0.64407486", "text": "func (ref *PdfObjectReference) WriteString() string {\n\tvar b strings.Builder\n\tb.WriteString(strconv.FormatInt(ref.ObjectNumber, 10))\n\tb.WriteString(\" \")\n\tb.WriteString(strconv.FormatInt(ref.GenerationNumber, 10))\n\tb.WriteString(\" R\")\n\treturn b.String()\n}", "title": "" }, { "docid": "6bdff6ef2989bfbd0dff5510e1f1d7fb", "score": "0.6405268", "text": "func PDF(filename string, newlineDelimiter string) (text string, err error) {\n\tr, err := pdf.Open(filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buf bytes.Buffer\n\tvar prev, cur pdf.Text\n\tfor p := 1; p <= r.NumPage(); p++ {\n\t\tfor _, letter := range r.Page(p).Content().Text {\n\t\t\tprev = cur\n\t\t\tcur = letter\n\n\t\t\tif prev.S != \"\" && prev.Y != cur.Y {\n\t\t\t\tbuf.WriteString(newlineDelimiter)\n\t\t\t}\n\t\t\tbuf.WriteString(letter.S)\n\t\t}\n\t}\n\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "252acb72630538e1de8b2905ca695b03", "score": "0.6392389", "text": "func (w *PdfWriter) writeString(s string) error {\n\tn, err := w.writer.WriteString(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.writePos += int64(n)\n\treturn nil\n}", "title": "" }, { "docid": "be6503f107df102b2e960227995b0ff0", "score": "0.6346658", "text": "func (streams *PdfObjectStreams) WriteString() string {\n\tvar b strings.Builder\n\tb.WriteString(strconv.FormatInt(streams.ObjectNumber, 10))\n\tb.WriteString(\" 0 R\")\n\treturn b.String()\n}", "title": "" }, { "docid": "c40217ce89a9d357813ef75ab5dfc773", "score": "0.6079313", "text": "func (t *Transformer) pdfToText() {\n\t// Safety first!\n\tif t.err != nil {\n\t\treturn\n\t}\n\n\tt.Logger.Infof(\"Running pdftotext on %q\", t.PDFFilename)\n\n\tvar tmpfile, err = fileutil.TempNamedFile(\"\", \"\", \".html\")\n\tif err != nil {\n\t\tt.err = fmt.Errorf(\"unable to create tempfile for HTML output: %w\", err)\n\t\treturn\n\t}\n\tdefer os.Remove(tmpfile)\n\n\tif !shell.ExecSubgroup(\"pdftotext\", t.Logger, t.PDFFilename, \"-bbox-layout\", tmpfile) {\n\t\tt.err = fmt.Errorf(\"unable to run pdftotext\")\n\t\treturn\n\t}\n\n\tvar f *os.File\n\tf, err = os.Open(tmpfile)\n\tif err != nil {\n\t\tt.err = fmt.Errorf(\"error opening HTML file: %w\", err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tt.html, err = io.ReadAll(f)\n\tif err != nil {\n\t\tt.err = fmt.Errorf(\"error reading HTML file: %w\", err)\n\t}\n}", "title": "" }, { "docid": "d9d52411fa8f8e6f238f2e646c1296ef", "score": "0.6074226", "text": "func (f *PdfField) String() string {\n\tif obj, ok := f.ToPdfObject().(*core.PdfIndirectObject); ok {\n\t\treturn fmt.Sprintf(\"%T: %s\", f.context, obj.PdfObject.String())\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ce0cbaec60199752af0d6eb80b02eb82", "score": "0.60491866", "text": "func (str *PdfObjectString) String() string {\n\treturn str.val\n}", "title": "" }, { "docid": "12e1fede5c5f042463b84b4927505ee4", "score": "0.5933994", "text": "func (d *PdfObjectDictionary) WriteString() string {\n\tvar b strings.Builder\n\n\tb.WriteString(\"<<\")\n\tfor _, k := range d.keys {\n\t\tv := d.dict[k]\n\t\tb.WriteString(k.WriteString())\n\t\tb.WriteString(\" \")\n\t\tb.WriteString(v.WriteString())\n\t}\n\n\tb.WriteString(\">>\")\n\treturn b.String()\n}", "title": "" }, { "docid": "f8a7933252b2c1d571d26aca572f39e1", "score": "0.5912495", "text": "func (ind *PdfIndirectObject) WriteString() string {\n\tvar b strings.Builder\n\tb.WriteString(strconv.FormatInt(ind.ObjectNumber, 10))\n\tb.WriteString(\" 0 R\")\n\treturn b.String()\n}", "title": "" }, { "docid": "0c02b2052469f4ed158545e8e5b23d45", "score": "0.58994055", "text": "func (p *program) pdf(file, addr string) error {\n\tdata := \"data:application/pdf;base64,\"\n\tif b, err := ioutil.ReadFile(file); err != nil {\n\t\treturn err\n\t} else {\n\t\tdata += base64.StdEncoding.EncodeToString(b)\n\t}\n\n\tp.Type = \"html\"\n\tp.Text = `<object data=` + data + ` type=\"application/pdf\" width=\"100%\" height=\"100%\"></object>`\n\treturn nil\n}", "title": "" }, { "docid": "ffe1c9d79310bef006714865999dbcb6", "score": "0.5797714", "text": "func pdfReader(filePath string) string {\n\n\tcmd := exec.Command(\"./pdftotext.exe\", filePath, \"-\")\n\n\tvar out bytes.Buffer\n\n\tcmd.Stdout = &out\n\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn out.String()\n}", "title": "" }, { "docid": "a78a2ec41f04d5244e9f9988dd6464b2", "score": "0.5758727", "text": "func (array *PdfObjectArray) WriteString() string {\n\tvar b strings.Builder\n\tb.WriteString(\"[\")\n\n\tfor ind, o := range array.Elements() {\n\t\tb.WriteString(o.WriteString())\n\t\tif ind < (array.Len() - 1) {\n\t\t\tb.WriteString(\" \")\n\t\t}\n\t}\n\n\tb.WriteString(\"]\")\n\treturn b.String()\n}", "title": "" }, { "docid": "7ea17e059cd1afdfcb2f2c54ec147167", "score": "0.57462627", "text": "func PdfFile(fileStr string) string {\n\treturn filepath.Join(PdfDir(), fileStr)\n}", "title": "" }, { "docid": "7ea17e059cd1afdfcb2f2c54ec147167", "score": "0.57462627", "text": "func PdfFile(fileStr string) string {\n\treturn filepath.Join(PdfDir(), fileStr)\n}", "title": "" }, { "docid": "471a7fe5fb25e9c6082a7d14aaaf9293", "score": "0.57101643", "text": "func (name *PdfObjectName) WriteString() string {\n\tvar output bytes.Buffer\n\n\tif len(*name) > 127 {\n\t\tcommon.Log.Debug(\"ERROR: Name too long (%s)\", *name)\n\t}\n\n\toutput.WriteString(\"/\")\n\tfor i := 0; i < len(*name); i++ {\n\t\tchar := (*name)[i]\n\t\tif !IsPrintable(char) || char == '#' || IsDelimiter(char) {\n\t\t\toutput.WriteString(fmt.Sprintf(\"#%.2x\", char))\n\t\t} else {\n\t\t\toutput.WriteByte(char)\n\t\t}\n\t}\n\n\treturn output.String()\n}", "title": "" }, { "docid": "ea62fed42504441e717178e468067b8e", "score": "0.5679098", "text": "func pdfhandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Printf(\"%s %s\\n\", r.Method, r.URL.Path)\n\tfmt.Printf(\"%s\\n\", r.Header.Get(\"Accept\"))\n\theader := w.Header()\n\n\tid := assignId(r)\n\tdoc, err := DB.Fetch(id)\n\tif err != nil {\n\t\tweb.Error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\theader.Set(\"Content-Type\", \"application/pdf\")\n\t//header.Set(\"Content-Disposition\", \"attachment;filename=foo.pdf\")\n\tpdf := textproc.MakePDFStreamTextObject(w, 8.5*72, 11*72)\n\tdefer pdf.Close()\n\tprops := textproc.TypesettingProps{}\n\tprops.Fontname = doc.Font\n\tprops.Fontsize = doc.FontSize.Points()\n\tprops.Baselineskip = doc.BaselineSkip.Points()\n\tprops.PageWidth = doc.PageWidth.Points()\n\tprops.PageHeight = doc.PageHeight.Points()\n\tprops.LeftMargin = doc.LeftMargin.Points()\n\tprops.RightMargin = doc.RightMargin.Points()\n\tpdf.WriteAt(doc.Text, props, props.LeftMargin, doc.TopMargin.Points()+props.Fontsize)\n}", "title": "" }, { "docid": "2a20f05eaa652cd88d81aad05a2f5b69", "score": "0.5669408", "text": "func (null *PdfObjectNull) WriteString() string {\n\treturn \"null\"\n}", "title": "" }, { "docid": "bd7865c692a556eebdf9cb71a8a78a8d", "score": "0.5629309", "text": "func ReadPdf(filePath string) (string, error) {\n\tvar content bytes.Buffer\n\tf, r, err := pdf.Open(filePath)\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttotalPage := r.NumPage()\n\tfor pageIndex := 1; pageIndex <= totalPage; pageIndex++ {\n\t\tp := r.Page(pageIndex)\n\t\tif p.V.IsNull() {\n\t\t\tcontinue\n\t\t}\n\n\t\trows, _ := p.GetTextByRow()\n\t\tfor _, row := range rows {\n\t\t\tfor _, word := range row.Content {\n\t\t\t\tcontent.WriteString(word.S)\n\t\t\t}\n\t\t}\n\t}\n\treturn content.String(), nil\n}", "title": "" }, { "docid": "deb07a7e9624096a5495c90adb0422bf", "score": "0.56234354", "text": "func (float *PdfObjectFloat) WriteString() string {\n\treturn strconv.FormatFloat(float64(*float), 'f', -1, 64)\n}", "title": "" }, { "docid": "3a1b1f07185009b89ecd97f40be8ff20", "score": "0.5613489", "text": "func GeneratePdf(w http.ResponseWriter, r *http.Request) {\n\n\tif r.Header.Get(\"Content-Type\") != \"application/json\" {\n\t\tmsg := \"Content-Type header is not application/json\"\n\t\thttp.Error(w, msg, http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tuserId := vars[\"user_id\"]\n\n\texpiryTime := time.Duration(301 * 1000 * 1000 * 1000) // 5 mins 1 second\n\tcurrentTs := time.Now().Unix()\n\n\tif !redis.SetValue(\"pdftsuser_\"+userId, strconv.FormatInt(currentTs, 10), expiryTime) {\n\t\tLogger.Errorf(\"error setting timestamp for userId \" + userId)\n\t}\n\n\tvar pdfOutput map[string]interface{}\n\tvar resp Response\n\t//decode json\n\terr := json.NewDecoder(r.Body).Decode(&pdfOutput)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tpdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\tpdf.AddPage()\n\tpdf.Image(\"static/db.jpeg\", -5, 5, 10, 0, false, \"\", 0, \"\")\n\tpdf.SetFont(\"Arial\", \"B\", 12)\n\tcount := 0\n\tfor _, value := range pdfOutput {\n\t\tword := value.(string)\n\t\two := \"\"\n\t\tvar st []string\n\t\tfor i := range word {\n\t\t\tif i == 0 {\n\t\t\t\two = strconv.Itoa(count+1) + \".\"\n\t\t\t}\n\t\t\two = wo + string(word[i])\n\t\t\tif len((wo)) > 60 {\n\t\t\t\tst = append(st, wo)\n\t\t\t\two = \"\"\n\t\t\t}\n\t\t}\n\t\tst = append(st, wo)\n\t\tfor i := range st {\n\t\t\tpdf.Cell(float64(1), 10, st[i])\n\t\t\tpdf.Ln(6)\n\n\t\t}\n\t\tpdf.Ln(12)\n\t\tcount++\n\t}\n\n\terr = pdf.OutputFileAndClose(\"static/pdfs/\" + userId + \"_\" + strconv.FormatInt(currentTs, 10) + \".pdf\")\n\n\tif err != nil {\n\t\tresp.Output = err.Error()\n\t\tLogger.Errorf(\"error generating pdf for userId \" + userId)\n\t}\n\n\tif resp.Output != \"\" {\n\t\tresp.Success = false\n\t} else {\n\t\tresp.Success = true\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\terr = json.NewEncoder(w).Encode(&resp)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "02c83281d22f12684de9e348cd92dd8d", "score": "0.56079286", "text": "func (name *PdfObjectName) String() string {\n\treturn string(*name)\n}", "title": "" }, { "docid": "898d4e097437aeadb69d5320d16710e8", "score": "0.56005573", "text": "func ReadPlainTextFromPDF(pdfpath string) (text string, err error) {\n\tf, r, err := pdf.Open(pdfpath)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar buf bytes.Buffer\n\tb, err := r.GetPlainText()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuf.ReadFrom(b)\n\ttext = buf.String()\n\treturn\n}", "title": "" }, { "docid": "4ab3ef7d880018efadad684deabbc08c", "score": "0.5543462", "text": "func (p *Page) PDF() []byte {\n\tpdf, err := p.PDFE(nil)\n\tkit.E(err)\n\treturn pdf\n}", "title": "" }, { "docid": "eb0649d6a0c7585b0d91aef79dc5715a", "score": "0.55354935", "text": "func GetTitoloPDF(text string) (string, error) {\n\n\tvar substitution = \"${titolo}\"\n\n\ttitolo := title.ReplaceAllString(text, substitution)\n\n\ttitolo = identificativo.ReplaceAllString(titolo, \"\")\n\ttitolo = space.ReplaceAllString(titolo, \" \")\n\n\treturn strings.TrimSpace(titolo), nil\n}", "title": "" }, { "docid": "0794a294f320d58bb3c683924ba93925", "score": "0.5463597", "text": "func (ref *PdfObjectReference) String() string {\n\treturn fmt.Sprintf(\"Ref(%d %d)\", ref.ObjectNumber, ref.GenerationNumber)\n}", "title": "" }, { "docid": "2b03c86de7625961f97db29c66ddf1a3", "score": "0.5445594", "text": "func (doc *Document) createPDF() (*bytes.Buffer, error) {\n\n\tvar stdin io.Reader\n\tswitch {\n\tcase doc.readers() == 1:\n\n\t\t// Pipe through stdin for a single reader.\n\t\tfor _, pg := range doc.pages {\n\t\t\tif pg.reader {\n\t\t\t\tstdin = pg.buf\n\t\t\t\tpg.filename = \"-\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\tcase doc.readers() > 1:\n\n\t\t// Write multiple readers to temp files\n\t\terr := doc.writeTempPages()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error writing temp files: %v\", err)\n\t\t}\n\t}\n\n\targs := append(doc.args(), \"-\")\n\n\tbuf := &bytes.Buffer{}\n\terrbuf := &bytes.Buffer{}\n\n\tcmd := exec.Command(Executable, args...)\n\tcmd.Stdin = stdin\n\tcmd.Stdout = buf\n\tcmd.Stderr = errbuf\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error running wkhtmltopdf: %v\", errbuf.String())\n\t}\n\n\tif doc.tmp != \"\" {\n\t\terr = os.RemoveAll(TempDir + \"/\" + doc.tmp)\n\t}\n\treturn buf, err\n\n}", "title": "" }, { "docid": "c47325639639e427ed5ec3241cc9a54d", "score": "0.5419967", "text": "func (stream *PdfObjectStream) String() string {\n\treturn fmt.Sprintf(\"Object stream %d: %s\", stream.ObjectNumber, stream.PdfObjectDictionary)\n}", "title": "" }, { "docid": "a7c8448dc030a2affdfecd9eea03211d", "score": "0.5399305", "text": "func (bool *PdfObjectBool) WriteString() string {\n\tif *bool {\n\t\treturn \"true\"\n\t}\n\treturn \"false\"\n}", "title": "" }, { "docid": "466755e52f9329e3fc29fb276580218d", "score": "0.53608465", "text": "func (s *stream) dict2pdf() string {\n\tdict := make([]string, 0, len(s.dict))\n\tfor k, v := range s.dict {\n\t\tdict = append(dict, fmt.Sprintf(\"%s %s\", k, v))\n\t}\n\treturn strings.Join(dict, \" \")\n}", "title": "" }, { "docid": "ffdaae9fb3a2c3c16d33aef751d75790", "score": "0.53414243", "text": "func (ind *PdfIndirectObject) String() string {\n\t// Avoid printing out the object, can cause problems with circular\n\t// references.\n\treturn fmt.Sprintf(\"IObject:%d\", (*ind).ObjectNumber)\n}", "title": "" }, { "docid": "eb245a1a862e7462f3e25146cc1268e6", "score": "0.53349173", "text": "func ReadPdf(path string) (string, error) {\n\tf, r, err := pdf.Open(path)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar buf bytes.Buffer\n b, err := r.GetPlainText()\n if err != nil {\n return \"\", err\n }\n buf.ReadFrom(b)\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "28e4a627a1ac2762bb2b988f5fefd1c5", "score": "0.53309065", "text": "func GetString(obj PdfObject) (so *PdfObjectString, found bool) {\n\tso, found = TraceToDirectObject(obj).(*PdfObjectString)\n\treturn so, found\n}", "title": "" }, { "docid": "bf7a134819ef9146769f593d90ae4c68", "score": "0.532401", "text": "func (null *PdfObjectNull) String() string {\n\treturn \"null\"\n}", "title": "" }, { "docid": "4306ce96af98c59b144e9fa5a4a2fe3e", "score": "0.52774", "text": "func (d *PdfObjectDictionary) String() string {\n\tvar b strings.Builder\n\tb.WriteString(\"Dict(\")\n\tfor _, k := range d.keys {\n\t\tv := d.dict[k]\n\t\tb.WriteString(`\"` + k.String() + `\": `)\n\t\tb.WriteString(v.String())\n\t\tb.WriteString(`, `)\n\t}\n\tb.WriteString(\")\")\n\treturn b.String()\n}", "title": "" }, { "docid": "3cf6a8ac6bd36eabc16664fde66b8d61", "score": "0.5272976", "text": "func MakeStringFromBytes(data []byte) *PdfObjectString {\n\treturn MakeString(string(data))\n}", "title": "" }, { "docid": "305c88897406cdfc66d691faf6ef7c3a", "score": "0.5232489", "text": "func NewPdfDate(dateStr string) (PdfDate, error) {\n\td := PdfDate{}\n\n\tmatches := reDate.FindAllStringSubmatch(dateStr, 1)\n\tif len(matches) < 1 {\n\t\treturn d, fmt.Errorf(\"Invalid date string (%s)\", dateStr)\n\t}\n\tif len(matches[0]) != 10 {\n\t\treturn d, errors.New(\"Invalid regexp group match length != 10\")\n\t}\n\n\t// No need to handle err from ParseInt, as pre-validated via regexp.\n\td.year, _ = strconv.ParseInt(matches[0][1], 10, 32)\n\td.month, _ = strconv.ParseInt(matches[0][2], 10, 32)\n\td.day, _ = strconv.ParseInt(matches[0][3], 10, 32)\n\td.hour, _ = strconv.ParseInt(matches[0][4], 10, 32)\n\td.minute, _ = strconv.ParseInt(matches[0][5], 10, 32)\n\td.second, _ = strconv.ParseInt(matches[0][6], 10, 32)\n\t// Some poor implementations do not include the offset.\n\tif len(matches[0][7]) > 0 {\n\t\td.utOffsetSign = matches[0][7][0]\n\t} else {\n\t\td.utOffsetSign = '+'\n\t}\n\tif len(matches[0][8]) > 0 {\n\t\td.utOffsetHours, _ = strconv.ParseInt(matches[0][8], 10, 32)\n\t} else {\n\t\td.utOffsetHours = 0\n\t}\n\tif len(matches[0][9]) > 0 {\n\t\td.utOffsetMins, _ = strconv.ParseInt(matches[0][9], 10, 32)\n\t} else {\n\t\td.utOffsetMins = 0\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "0451f62ba8db8015baa68ab7a411cc71", "score": "0.5212928", "text": "func WritePDFReport(w io.Writer, tsh *SingleTableReportHandler, ri *ReporterInfo, rctx *ReportContext, tbl *gotable.Table) error {\n\t// custom template if available\n\ttfname := tsh.HTMLTemplate\n\t// rlib.Console(\"report.go: tfname = %s\\n\", tfname)\n\tif len(tfname) > 0 {\n\t\tvar err error\n\t\tbud := rlib.GetBUDFromBIDList(ri.Bid)\n\t\ttfname = \"webclient/html/rpt-templates/\" + strings.ToUpper(string(bud)) + \"/\" + tfname\n\n\t\t// cwd, err := os.Getwd()\n\t\t// rlib.Console(\"report.go: cwd = %s\\n\", cwd)\n\t\t// rlib.Console(\"report.go: setHTMLTemplate to %s\\n\", tfname)\n\t\terr = tbl.SetHTMLTemplate(tfname)\n\t\tif err != nil {\n\t\t\ts := fmt.Sprintf(\"Error in CSVprintTable: %s\\n\", err.Error())\n\t\t\tfmt.Print(s)\n\t\t\tfmt.Fprintf(w, \"%s\\n\", s)\n\t\t}\n\t}\n\n\t// pdf props title\n\tvar pdfProps []*gotable.PDFProperty\n\tif tsh.PDFprops != nil {\n\t\tpdfProps = tsh.PDFprops\n\t} else {\n\t\tpdfProps = GetReportPDFProps()\n\t}\n\n\t// get page size and orientation, set title\n\tif tsh.NeedsPDFTitle {\n\t\t// NOTE: There is no support of custom title right now\n\t\tpdfProps = SetPDFOption(pdfProps, \"--header-center\", tbl.Title)\n\t}\n\n\t// if custom dimension needy, then get those from client side\n\tif tsh.NeedsCustomPDFDimension {\n\t\t// pdf page width from the UI\n\t\tpdfPageWidth := rlib.Float64ToString(rctx.PDFPageWidth) + rctx.PDFPageSizeUnit\n\t\tpdfProps = SetPDFOption(pdfProps, \"--page-width\", pdfPageWidth)\n\n\t\t// pdf page height from the UI\n\t\tpdfPageHeight := rlib.Float64ToString(rctx.PDFPageHeight) + rctx.PDFPageSizeUnit\n\t\tpdfProps = SetPDFOption(pdfProps, \"--page-height\", pdfPageHeight)\n\t}\n\n\terr := tbl.PDFprintTable(w, pdfProps)\n\tif err != nil {\n\t\ts := fmt.Sprintf(\"Error in PDFprintTable: %s\\n\", err.Error())\n\t\trlib.Ulog(s)\n\t\tfmt.Fprintf(w, \"%s\\n\", s)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "79249f5413d8a1100a138b818d62e877", "score": "0.5206982", "text": "func (pt PageText) String() string {\n\tsummary := fmt.Sprintf(\"PageText: %d elements\", len(pt.marks))\n\tparts := []string{\"-\" + summary}\n\tfor _, tm := range pt.marks {\n\t\tparts = append(parts, tm.String())\n\t}\n\tparts = append(parts, \"+\"+summary)\n\treturn strings.Join(parts, \"\\n\")\n}", "title": "" }, { "docid": "7a87a5ad810ccfee48033295046c3155", "score": "0.51874244", "text": "func (date *PdfDate) ToPdfObject() PdfObject {\n\tstr := fmt.Sprintf(\"D:%.4d%.2d%.2d%.2d%.2d%.2d%c%.2d'%.2d'\",\n\t\tdate.year, date.month, date.day, date.hour, date.minute, date.second,\n\t\tdate.utOffsetSign, date.utOffsetHours, date.utOffsetMins)\n\tpdfStr := PdfObjectString(str)\n\treturn &pdfStr\n}", "title": "" }, { "docid": "f1b8ec48b4472dc00240f22bb2db37e4", "score": "0.51481783", "text": "func (remote *RemoteDebugger) PrintToPDF(options ...PrintToPDFOption) ([]byte, error) {\n\tmOptions := map[string]interface{}{}\n\n\tfor _, o := range options {\n\t\to(mOptions)\n\t}\n\n\tres, err := remote.SendRequest(\"Page.printToPDF\", mOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res == nil {\n\t\treturn nil, ErrorNoResponse\n\t}\n\n\treturn base64.StdEncoding.DecodeString(res[\"data\"].(string))\n}", "title": "" }, { "docid": "d0a7e7f3c3bb5c8f1e4ea856ce4bd7a1", "score": "0.5137626", "text": "func GetStringBytes(obj PdfObject) (val []byte, found bool) {\n\tso, found := TraceToDirectObject(obj).(*PdfObjectString)\n\tif found {\n\t\treturn so.Bytes(), true\n\t}\n\treturn\n}", "title": "" }, { "docid": "d62f1f63e116749e2addf91090307874", "score": "0.51010615", "text": "func createPDF(t *testing.T, msg, inFile, inFileJSON, outFile string, conf *model.Configuration) {\n\n\tt.Helper()\n\n\t// inFile\tinFileJSON \toutFile\t\taction\n\t// ---------------------------------------------------------------\n\t// \"\"\t\tjsonFile \toutfile\t\twrite outFile\n\t// inFile \tjsonFile\t\"\"\t\t\tupdate (read and write inFile)\n\t// inFile \tjsonFile \toutFile\t\tread inFile and write outFile\n\n\tif outFile == \"\" {\n\t\toutFile = inFile\n\t}\n\n\tif err := api.CreateFile(inFile, inFileJSON, outFile, conf); err != nil {\n\t\tt.Fatalf(\"%s: %v\\n\", msg, err)\n\t}\n\n\tif err := api.ValidateFile(outFile, nil); err != nil {\n\t\tt.Fatalf(\"%s: %v\\n\", msg, err)\n\t}\n\n}", "title": "" }, { "docid": "4cb4217d6bffdf261315a4b280dda30d", "score": "0.5087495", "text": "func runDoctorPDF(inputpath, outputpath string) error {\n\n\tcmd := exec.Command(\"asciidoctor-pdf\", \"-b\", \"pdf\", inputpath, \"-o\", outputpath)\n\n\tstdoutStderr, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"runDoctorPDF: %w, cmd output: %s\", err, stdoutStderr)\n\t}\n\n\tif len(stdoutStderr) != 0 {\n\t\treturn fmt.Errorf(\"runDoctorPDF: cmd output: %s\", stdoutStderr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "023dd0e840207b4f4b9c77f95778dd35", "score": "0.50669426", "text": "func (array *PdfObjectArray) String() string {\n\toutStr := \"[\"\n\tfor ind, o := range array.Elements() {\n\t\toutStr += o.String()\n\t\tif ind < (array.Len() - 1) {\n\t\t\toutStr += \", \"\n\t\t}\n\t}\n\toutStr += \"]\"\n\treturn outStr\n}", "title": "" }, { "docid": "9e107449b4808e511bd93f39c89bfca0", "score": "0.50616187", "text": "func (p *Proj4Text) String() string {\n\treturn string(p.cStr[:len(p.cStr)-1])\n}", "title": "" }, { "docid": "6b593f962307da4080851c31fb59a574", "score": "0.50576586", "text": "func (m *Client) GetPDF(signatureRequestID string) ([]byte, error) {\n\treturn m.GetFiles(signatureRequestID, \"pdf\")\n}", "title": "" }, { "docid": "8cae883dc9b87972332174c811960581", "score": "0.50532746", "text": "func MakeString(s string) *PdfObjectString {\n\tstr := PdfObjectString{val: s}\n\treturn &str\n}", "title": "" }, { "docid": "fa338e35d2429e3a30f25b009e44e3f8", "score": "0.50462097", "text": "func (service InvoicesService) GetPDF(invoiceNumber int, language string) (*Response, *bytes.Buffer, error) {\n\taction := fmt.Sprintf(\"invoices/%d\", invoiceNumber)\n\treq, err := service.client.newRequest(\"GET\", action, nil, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif language == \"\" {\n\t\tlanguage = \"English\"\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/pdf\")\n\treq.Header.Set(\"Accept-Language\", language)\n\n\tpdf := new(bytes.Buffer)\n\tres, err := service.client.do(req, pdf)\n\n\treturn res, pdf, err\n}", "title": "" }, { "docid": "afaccb135a1242efb594bf6b0f0d3b84", "score": "0.50364774", "text": "func (str *PdfObjectString) Str() string {\n\treturn str.val\n}", "title": "" }, { "docid": "7173fb42d0a3a869b29ee2534ea9e252", "score": "0.50285935", "text": "func (bool *PdfObjectBool) String() string {\n\tif *bool {\n\t\treturn \"true\"\n\t}\n\treturn \"false\"\n}", "title": "" }, { "docid": "2f8587f005c814e51f64ef21d2245bae", "score": "0.50259304", "text": "func (r Billing_Invoice_Next) GetPdf(documentCreateDate *datatypes.Time) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tdocumentCreateDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice_Next\", \"getPdf\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "dc7ca8deb88d0cb576b2a2cdbb9a8eed", "score": "0.50169206", "text": "func (streams *PdfObjectStreams) String() string {\n\treturn fmt.Sprintf(\"Object stream %d\", streams.ObjectNumber)\n}", "title": "" }, { "docid": "b3626ce803acd463969b5152efbf87b2", "score": "0.49822554", "text": "func Example() {\n\t pdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\t pdf.AddPage()\n\t pdf.SetFont(\"Arial\", \"B\", 16)\n\t pdf.Cell(40, 10, \"Hello World!\")\n\t fileStr := Filename(\"basic\")\n\t err := pdf.OutputFileAndClose(fileStr)\n\t Summary(err, fileStr)\n\t // Output:\n\t // Successfully generated pdf/basic.pdf\n }", "title": "" }, { "docid": "8f2f3eb6591b4e8e5135ef48a137639d", "score": "0.49744347", "text": "func (s GetDocumentPathOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "10cf3a510f81da8da3222dba3d8240f4", "score": "0.495441", "text": "func (c *Canon123) Printing(aStr string) string{\n c.pages = aStr\n return aStr\n}", "title": "" }, { "docid": "da0b0e868be8aa52408432a7e57d56f2", "score": "0.49532604", "text": "func (remote *RemoteDebugger) SavePDF(filename string, perm os.FileMode, options ...PrintToPDFOption) error {\n\trawPDF, err := remote.PrintToPDF(options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(filename, rawPDF, perm)\n}", "title": "" }, { "docid": "60f1882b16da38ea8583af9755d53685", "score": "0.49523923", "text": "func (o *Faxdocument) String() string {\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n o.Thumbnails = []Documentthumbnail{{}} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "30c673117efec86d46be89aa25d28f8f", "score": "0.49320927", "text": "func (int *PdfObjectInteger) WriteString() string {\n\treturn strconv.FormatInt(int64(*int), 10)\n}", "title": "" }, { "docid": "6865986ff8d12e7b2d1fb62df264889d", "score": "0.49304044", "text": "func (r Billing_Invoice) GetPdf() (resp []byte, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice\", \"getPdf\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a43c402bf4b67ecacf54c85b741c7047", "score": "0.48947033", "text": "func (s GetDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cdb7a646972768c52b423c7b1b064c45", "score": "0.4889865", "text": "func (s DeleteDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3106af3ea88ca86eec0c4af2f25d0d16", "score": "0.4873866", "text": "func (p Paragraph) String() string {\n\tret := \"<p\" + p.Attrs() + \">\"\n\tif p.HTMLEncode {\n\t\tret += html.EscapeString(p.Text)\n\t} else {\n\t\tret += p.Text\n\t}\n\tret += \"</p>\"\n\treturn ret\n}", "title": "" }, { "docid": "44a226dab89916e9c165c318d016ef5f", "score": "0.48721692", "text": "func NewPDFBuilder() *PDFBuilder {\n\treturn &PDFBuilder{\n\t\tmessage: make(map[string]interface{}),\n\t}\n}", "title": "" }, { "docid": "513772b439881f61b39831b3e2c68dc3", "score": "0.486787", "text": "func (c *PDF) Create(options *PDFOptions) ([]byte, error) {\n\tparams := options.ToParameters()\n\n\tvar resp bytes.Buffer\n\terr := c.client.post(\"/v1/pdf/create\", params, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Bytes(), nil\n}", "title": "" }, { "docid": "8e1ae128dba2ce6706d02bd061db6cda", "score": "0.48546192", "text": "func SavePDF(exporter common.PDFExporter, dashboardURI string, dstFile string) error {\n\t// \tValidate the URI. This is because if the URI is wrong, the\n\t// nodejs will block forever.\n\tif _, err := url.ParseRequestURI(dashboardURI); err != nil {\n\t\treturn err\n\t}\n\n\tcommand := []string{\n\t\tstring(exporter),\n\t\tdashboardURI,\n\t\tUser,\n\t\tdstFile,\n\t}\n\n\t_, err := process.Execute(env.Default.NodeJS(), command...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tui.Success(\"Saved pdf\", dstFile)\n\n\treturn err\n}", "title": "" }, { "docid": "141a2a810aca4de4f32e80c8469abd0a", "score": "0.48257017", "text": "func (r Billing_Invoice) GetPdfDetailed() (resp []byte, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice\", \"getPdfDetailed\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "3612b06430415d535b74448d7578062b", "score": "0.48066846", "text": "func (r Billing_Invoice_Next) GetPdfDetailed(documentCreateDate *datatypes.Time) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tdocumentCreateDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice_Next\", \"getPdfDetailed\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a645b23edc84a03aa041a1c47fdb9b60", "score": "0.48052326", "text": "func NewStringerText(str fmt.Stringer, x, y float64) *Text {\n\treturn DefaultFont().NewStringerText(str, x, y)\n}", "title": "" }, { "docid": "5996e9e63ff3134a78190b9d6e0a2191", "score": "0.48023748", "text": "func TextFile(fileStr string) string {\n\treturn filepath.Join(gofpdfDir, \"text\", fileStr)\n}", "title": "" }, { "docid": "5996e9e63ff3134a78190b9d6e0a2191", "score": "0.48023748", "text": "func TextFile(fileStr string) string {\n\treturn filepath.Join(gofpdfDir, \"text\", fileStr)\n}", "title": "" }, { "docid": "0c707e7a7e6c0223b765e21fbe458099", "score": "0.4778795", "text": "func (l *markupList) saveOutputPdf() {\n\tif !markupPDFs {\n\t\treturn\n\t}\n\tif len(l.pageNums()) == 0 {\n\t\tcommon.Log.Info(\"No marked-up PDFs to save\")\n\t\treturn\n\t}\n\tcommon.Log.Info(\"Saving marked-up PDFs. %s\", l)\n\n\tos.Mkdir(markupDir, 0777)\n\toutPath := filepath.Join(markupDir, filepath.Base(l.inPath))\n\text := path.Ext(outPath)\n\tmetaPath := outPath[:len(outPath)-len(ext)] + \".json\"\n\n\t// Make a new PDF creator.\n\tc := creator.New()\n\n\tfor _, pageNum := range l.pageNums() {\n\n\t\tcommon.Log.Debug(\"saveOutputPdf: %a pageNum=%d\", l.inPath, pageNum)\n\t\tpage, err := l.pdfReader.GetPage(pageNum)\n\t\tif err != nil {\n\t\t\tl.t.Fatalf(\"saveOutputPdf: Could not get page pageNum=%d. err=%v\", pageNum, err)\n\t\t}\n\t\tmediaBox, err := page.GetMediaBox()\n\t\tif err == nil && page.MediaBox == nil {\n\t\t\t// Deal with MediaBox inherited from Parent.\n\t\t\tcommon.Log.Info(\"MediaBox: %v -> %v\", page.MediaBox, mediaBox)\n\t\t\tpage.MediaBox = mediaBox\n\t\t}\n\t\th := mediaBox.Ury\n\n\t\tif err := c.AddPage(page); err != nil {\n\t\t\tl.t.Fatalf(\"AddPage failed %s:%d err=%v \", l, pageNum, err)\n\t\t}\n\n\t\tfor _, m := range l.pageMatches[pageNum] {\n\t\t\tr := m.BBox\n\t\t\trect := c.NewRectangle(r.Llx, h-r.Lly, r.Urx-r.Llx, -(r.Ury - r.Lly))\n\t\t\trect.SetBorderColor(creator.ColorRGBFromHex(\"#0000ff\")) // Blue border.\n\t\t\trect.SetBorderWidth(1.0)\n\t\t\tif err := c.Draw(rect); err != nil {\n\t\t\t\tl.t.Fatalf(\"Draw failed. pageNum=%d match=%v err=%v\", pageNum, m, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tc.SetOutlineTree(l.pdfReader.GetOutlineTree())\n\tif err := c.WriteToFile(outPath); err != nil {\n\t\tl.t.Fatalf(\"WriteToFile failed. err=%v\", err)\n\t}\n\n\tb, err := json.MarshalIndent(l.pageMatches, \"\", \"\\t\")\n\tif err != nil {\n\t\tl.t.Fatalf(\"MarshalIndent failed. err=%v\", err)\n\t}\n\terr = ioutil.WriteFile(metaPath, b, 0666)\n\tif err != nil {\n\t\tl.t.Fatalf(\"WriteFile failed. metaPath=%q err=%v\", metaPath, err)\n\t}\n}", "title": "" }, { "docid": "066742515ebd223965c5873d14be9bbb", "score": "0.47641692", "text": "func (ft *PdfFieldText) ToPdfObject() core.PdfObject {\n\tft.PdfField.ToPdfObject()\n\tcontainer := ft.container\n\td := container.PdfObject.(*core.PdfObjectDictionary)\n\td.Set(\"FT\", core.MakeName(\"Tx\"))\n\tif ft.DA != nil {\n\t\td.Set(\"DA\", ft.DA)\n\t}\n\tif ft.Q != nil {\n\t\td.Set(\"Q\", ft.Q)\n\t}\n\tif ft.DS != nil {\n\t\td.Set(\"DS\", ft.DS)\n\t}\n\tif ft.RV != nil {\n\t\td.Set(\"RV\", ft.RV)\n\t}\n\tif ft.MaxLen != nil {\n\t\td.Set(\"MaxLen\", ft.MaxLen)\n\t}\n\n\treturn container\n}", "title": "" }, { "docid": "6245e751edb135668e4e924258718fb4", "score": "0.4752022", "text": "func (d *Document) String() string {\n\treturn fmt.Sprintf(\"Document(class: %v, terms: %v)\", d.class, d.terms)\n}", "title": "" }, { "docid": "9a1331a5f516cc473d9467085621b33e", "score": "0.47458667", "text": "func TestIssue0116(t *testing.T) {\n\tvar pdf *gofpdf.Fpdf\n\n\tpdf = gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\tpdf.AddPage()\n\tpdf.SetFont(\"Arial\", \"B\", 16)\n\tpdf.Cell(40, 10, \"OK\")\n\tif pdf.Error() != nil {\n\t\tt.Fatalf(\"not expecting error when rendering text\")\n\t}\n\n\tpdf = gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\n\tpdf.AddPage()\n\tpdf.Cell(40, 10, \"Not OK\") // Font not set\n\tif pdf.Error() == nil {\n\t\tt.Fatalf(\"expecting error when rendering text without having set font\")\n\t}\n}", "title": "" }, { "docid": "4778e29a590317816d8630954d733495", "score": "0.4740441", "text": "func (bx Bytex) String() string {\n\treturn string(bx)\n}", "title": "" }, { "docid": "253bbbc1932099986a5eeccce7bc2dec", "score": "0.4725274", "text": "func (r Billing_Order) GetPdfFilename() (resp string, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Order\", \"getPdfFilename\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "13fef6c4b0a88077f8b4b41aeef9ff6e", "score": "0.4712684", "text": "func Filename(baseStr string) string {\n\treturn PdfFile(baseStr + \".pdf\")\n}", "title": "" }, { "docid": "13fef6c4b0a88077f8b4b41aeef9ff6e", "score": "0.4712684", "text": "func Filename(baseStr string) string {\n\treturn PdfFile(baseStr + \".pdf\")\n}", "title": "" }, { "docid": "0d095ffd59dbd32f317db148134783ae", "score": "0.47012264", "text": "func NewPdfWriter() PdfWriter {\n\tw := PdfWriter{}\n\n\tw.objectsMap = map[core.PdfObject]struct{}{}\n\tw.objects = []core.PdfObject{}\n\tw.pendingObjects = map[core.PdfObject][]*core.PdfObjectDictionary{}\n\tw.traversed = map[core.PdfObject]struct{}{}\n\n\t// PDF Version. Can be changed if using more advanced features in PDF.\n\t// By default it is set to 1.3.\n\tw.majorVersion = 1\n\tw.minorVersion = 3\n\n\t// Creation info.\n\tinfoDict := core.MakeDict()\n\tmetadata := []struct {\n\t\tkey core.PdfObjectName\n\t\tvalue string\n\t}{\n\t\t{\"Creator\", getPdfCreator()},\n\t\t{\"Author\", getPdfAuthor()},\n\t\t{\"Subject\", getPdfSubject()},\n\t\t{\"Title\", getPdfTitle()},\n\t\t{\"Keywords\", getPdfKeywords()},\n\t}\n\tfor _, tuple := range metadata {\n\t\tif tuple.value != \"\" {\n\t\t\tinfoDict.Set(tuple.key, core.MakeString(tuple.value))\n\t\t}\n\t}\n\n\t// Set creation and modified dates.\n\tif creationDate := getPdfCreationDate(); !creationDate.IsZero() {\n\t\tif cd, err := NewPdfDateFromTime(creationDate); err == nil {\n\t\t\tinfoDict.Set(\"CreationDate\", cd.ToPdfObject())\n\t\t}\n\t}\n\tif modifiedDate := getPdfModifiedDate(); !modifiedDate.IsZero() {\n\t\tif md, err := NewPdfDateFromTime(modifiedDate); err == nil {\n\t\t\tinfoDict.Set(\"ModDate\", md.ToPdfObject())\n\t\t}\n\t}\n\n\tinfoObj := core.PdfIndirectObject{}\n\tinfoObj.PdfObject = infoDict\n\tw.infoObj = &infoObj\n\tw.addObject(&infoObj)\n\n\t// Root catalog.\n\tcatalog := core.PdfIndirectObject{}\n\tcatalogDict := core.MakeDict()\n\tcatalogDict.Set(\"Type\", core.MakeName(\"Catalog\"))\n\tcatalog.PdfObject = catalogDict\n\n\tw.root = &catalog\n\tw.addObject(w.root)\n\n\t// Pages.\n\tpages := core.PdfIndirectObject{}\n\tpagedict := core.MakeDict()\n\tpagedict.Set(\"Type\", core.MakeName(\"Pages\"))\n\tkids := core.PdfObjectArray{}\n\tpagedict.Set(\"Kids\", &kids)\n\tpagedict.Set(\"Count\", core.MakeInteger(0))\n\tpages.PdfObject = pagedict\n\n\tw.pages = &pages\n\tw.addObject(w.pages)\n\n\tcatalogDict.Set(\"Pages\", &pages)\n\tw.catalog = catalogDict\n\n\tcommon.Log.Trace(\"Catalog %s\", catalog)\n\n\treturn w\n}", "title": "" }, { "docid": "3fc23b872c952a274380af80ba2a0c70", "score": "0.47001356", "text": "func (s *LSym) WriteString(ctxt *Link, off int64, siz int, str string)", "title": "" }, { "docid": "dea547d295ab130b6c2174ea18a38312", "score": "0.4699355", "text": "func (str *PdfObjectString) Decoded() string {\n\tif str == nil {\n\t\treturn \"\"\n\t}\n\tb := []byte(str.val)\n\tif len(b) >= 2 && b[0] == 0xFE && b[1] == 0xFF {\n\t\t// UTF16BE.\n\t\treturn strutils.UTF16ToString(b[2:])\n\t}\n\n\treturn strutils.PDFDocEncodingToString(b)\n}", "title": "" }, { "docid": "41896f99b242733bfd16523fa423ced8", "score": "0.46992853", "text": "func (doc *DefaultDocument) String() string {\n\tvar result string\n\n\tfor _, page := range doc.Pages {\n\t\tresult += fmt.Sprintf(\"%v, \", page)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "f0067d23d10ad7216554ab8b23d704a5", "score": "0.46980846", "text": "func (r Billing_Order) GetPdf() (resp []byte, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Order\", \"getPdf\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "c3c6803436e2be857652aaa736a4e810", "score": "0.46965718", "text": "func PdfDir() string {\n\treturn filepath.Join(gofpdfDir, \"pdf\")\n}", "title": "" }, { "docid": "c3c6803436e2be857652aaa736a4e810", "score": "0.46965718", "text": "func PdfDir() string {\n\treturn filepath.Join(gofpdfDir, \"pdf\")\n}", "title": "" }, { "docid": "1aa8e4cdd6b463ecbb7aac732bca4dd4", "score": "0.46962318", "text": "func (fapi *FyndiqAPI) GetDeliveryNotesPDF(params RequestParams, orders *DeliveryListOrders) (*http.Response, error) {\n\tpost, err := json.Marshal(orders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, _ := http.NewRequest(\"POST\", fapi.deliveryNotesURL(params), bytes.NewBuffer(post))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tdefer resp.Body.Close()\n\treturn resp, err\n}", "title": "" }, { "docid": "be7a7f2a6164167564765ea35d427d99", "score": "0.46901813", "text": "func (c *Context) String(code int, s string) (err error) {\n\treturn c.Blob(code, MIMETextPlainCharsetUTF8, []byte(s))\n}", "title": "" }, { "docid": "1efb5a64b3a9669f1ae5c4914cde869f", "score": "0.4685622", "text": "func (doc *Document) WriteToFile(filename string) error {\n\n\tbuf, err := doc.createPDF()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(filename, buf.Bytes(), 0666)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating file: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "719a3ef2f05f72dabca317abef07e04e", "score": "0.467332", "text": "func (s GetDocumentPathInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "412f397949b499e3b5ee48ef1f4b5556", "score": "0.46505848", "text": "func (r Billing_Invoice) GetPreliminaryPdf() (resp []byte, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice\", \"getPreliminaryPdf\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e9bf0dfbec642f7400ea11b4fdb416d2", "score": "0.46460238", "text": "func (r Billing_Invoice) GetPreliminaryPdfDetailed() (resp []byte, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Invoice\", \"getPreliminaryPdfDetailed\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" } ]
da47b41ef08f57511559b1aa3f3e72a7
SetDetails sets the Details field's value.
[ { "docid": "8aaf19d7702c86176e69d9059c7f779a", "score": "0.7592843", "text": "func (s *ScalingActivity) SetDetails(v string) *ScalingActivity {\n\ts.Details = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "95b72fe2d4f104ba4540193961bcc29d", "score": "0.80646455", "text": "func (o *ProvenanceEventDTO) SetDetails(v string) {\n\to.Details = &v\n}", "title": "" }, { "docid": "724c4d6e634428b4e9cb7f89bc3bfe9a", "score": "0.78145814", "text": "func (o *Error) SetDetails(v string) {\n\to.Details = &v\n}", "title": "" }, { "docid": "724c4d6e634428b4e9cb7f89bc3bfe9a", "score": "0.78145814", "text": "func (o *Error) SetDetails(v string) {\n\to.Details = &v\n}", "title": "" }, { "docid": "b0fb58adbb8829e804545211d64d4b74", "score": "0.77660155", "text": "func (o *ReportAllOf) SetDetails(v string) {\n\to.Details = &v\n}", "title": "" }, { "docid": "f2e6f8445ff27ac1fe6a5254940c5d8a", "score": "0.7754664", "text": "func (s *Activity) SetDetails(v string) *Activity {\n\ts.Details = &v\n\treturn s\n}", "title": "" }, { "docid": "7b64f005ed9787dbb30048a4efa69aa3", "score": "0.76334774", "text": "func (m *ProvisionedIdentity) SetDetails(value DetailsInfoable)() {\n err := m.GetBackingStore().Set(\"details\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "37dc3f0625db5f737e3e4f707f245da6", "score": "0.7601641", "text": "func (s *S3BucketRepository) SetDetails(v *S3RepositoryDetails) *S3BucketRepository {\n\ts.Details = v\n\treturn s\n}", "title": "" }, { "docid": "36ce63c8aa122ed371d6356d680cdebc", "score": "0.75536126", "text": "func (s *ResourceChange) SetDetails(v []*ResourceChangeDetail) *ResourceChange {\n\ts.Details = v\n\treturn s\n}", "title": "" }, { "docid": "44b594e0f046535cb2c4f6101a947093", "score": "0.7534733", "text": "func (o *ReportAnnotationAllOf) SetDetails(v string) {\n\to.Details = &v\n}", "title": "" }, { "docid": "05130a0a3d535dc4a3c5684f6a14dc48", "score": "0.7533967", "text": "func (t *Transaction) SetDetails(details []*TransactionDetail) {\n\tt.source = &transactionSource{detailsByTxID: map[int64][]*TransactionDetail{t.ID: details}}\n}", "title": "" }, { "docid": "340cccbf27f258cb692148929049e5bb", "score": "0.7319435", "text": "func SetDetails(d string) func() private {\n\treturn func() private {\n\t\tidentifier.details = d\n\t\treturn private{}\n\t}\n}", "title": "" }, { "docid": "071b41201bdfe4af6a43fa8a2df00816", "score": "0.7277783", "text": "func (m *ConditionalAccessTemplate) SetDetails(value ConditionalAccessPolicyDetailable)() {\n m.details = value\n}", "title": "" }, { "docid": "e8a72620f8eceb10fa14f14e645b50cc", "score": "0.726799", "text": "func (m *LandingPage) SetDetails(value []LandingPageDetailable)() {\n err := m.GetBackingStore().Set(\"details\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4ff53e2cb16503175b5679e5dad31c24", "score": "0.6869575", "text": "func (m *EndUserNotification) SetDetails(value []EndUserNotificationDetailable)() {\n err := m.GetBackingStore().Set(\"details\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d31922a8f1151699a0e7e890f610de74", "score": "0.66795415", "text": "func (m *ClassificationError) SetDetails(value []ClassifcationErrorBaseable)() {\n err := m.GetBackingStore().Set(\"details\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8b9f8b265d9b4008230f3904ecdbf4eb", "score": "0.66463965", "text": "func (anonymousAuthenticationToken *TAnonymousAuthenticationToken) SetDetails(details interface{}) {\n\t// gob.Register(details)\n\tanonymousAuthenticationToken.Details = details\n}", "title": "" }, { "docid": "0ac337949a98db6815e9aa2ae2c9b565", "score": "0.6633517", "text": "func (_CertificateTracker *CertificateTrackerTransactor) SetCertificateDetails(opts *bind.TransactOpts, _ownerAddress common.Address, _name string, _email string, _certificate string) (*types.Transaction, error) {\n\treturn _CertificateTracker.contract.Transact(opts, \"setCertificateDetails\", _ownerAddress, _name, _email, _certificate)\n}", "title": "" }, { "docid": "9cd7d1956b082ab11ff8b00450849098", "score": "0.6296124", "text": "func (e *defaultReplyTransferObjectError) SetDetail(detail string) {\n\te.Detail = detail\n}", "title": "" }, { "docid": "57b0b2a5613b62f06a35b6fcee9d0e00", "score": "0.6273843", "text": "func (b *InflightCheckBuilder) Details(value interface{}) *InflightCheckBuilder {\n\tb.details = value\n\tb.bitmap_ |= 8\n\treturn b\n}", "title": "" }, { "docid": "8391c2cafe21db326ae6fda815138559", "score": "0.6261544", "text": "func (m *VirtualEventPresenter) SetPresenterDetails(value VirtualEventPresenterDetailsable)() {\n err := m.GetBackingStore().Set(\"presenterDetails\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1ec3cea60a0c63ab9acc59d3ee1811be", "score": "0.62476337", "text": "func (m *ProjectParticipation) SetDetail(value PositionDetailable)() {\n err := m.GetBackingStore().Set(\"detail\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "154c22161d1ee4d16db177767a06f7ca", "score": "0.6193691", "text": "func (o *JsonErrorResponse) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "7d55649af39e530e9cf017214c24c63a", "score": "0.6183264", "text": "func (b *LimitedSupportReasonBuilder) Details(value string) *LimitedSupportReasonBuilder {\n\tb.details = value\n\tb.bitmap_ |= 16\n\treturn b\n}", "title": "" }, { "docid": "f782fc1eefe234e216d6b7fe3e2f25eb", "score": "0.6128026", "text": "func (tr *Tracker) SetDetail(key Key, detail string) error {\n\t// NOTE: This is not a deep copy. Shares the History elements.\n\tstatus, err := tr.GetStatus(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstatus.SetDetail(detail)\n\tstatus.UpdateCount++\n\treturn tr.UpdateJob(key, status)\n}", "title": "" }, { "docid": "71a8c8c7b09a9a36c3b80b4245dcd776", "score": "0.6088743", "text": "func (auo *ActivitiesUpdateOne) SetDetail(s string) *ActivitiesUpdateOne {\n\tauo.mutation.SetDetail(s)\n\treturn auo\n}", "title": "" }, { "docid": "08dd5b20172b8e4c5366d2166319bd3d", "score": "0.60678214", "text": "func (o *ViewError) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "6c1f677bf15266f738154b505b992d36", "score": "0.60675246", "text": "func SetDetail(f func(error) string) {\n\tif f == nil {\n\t\treturn\n\t}\n\tdetail = f\n}", "title": "" }, { "docid": "72d543893f84ef652e24f7747dc8768d", "score": "0.6063772", "text": "func (o *ErrorErrors) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "73a82be58556f4bcc45ae5c112e1a435", "score": "0.6036138", "text": "func (m *ActivitiesMutation) SetDetail(s string) {\n\tm.detail = &s\n}", "title": "" }, { "docid": "6239d08c7f5ace43408adfcac15878e4", "score": "0.6032325", "text": "func (f *FlagSet) Details(details string) (old string) {\n\told, f.details = f.details, f.ReplaceTags(details)\n\treturn\n}", "title": "" }, { "docid": "db402fdef12ffd17710b1884b27b5a32", "score": "0.6029026", "text": "func (o *InlineResponseDefault) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "69956a54bbd9b64d13383aaabaed89d4", "score": "0.599724", "text": "func (o *GetPolicyParams) SetDetail(detail *bool) {\n\to.Detail = detail\n}", "title": "" }, { "docid": "4f843da85f1d3445af16eb584ea4e1b0", "score": "0.59698564", "text": "func (o *ErrorError) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "8e391a98cd2be91ca8dccd151c7fb44d", "score": "0.594547", "text": "func (s *PutPartnerEventsRequestEntry) SetDetail(v string) *PutPartnerEventsRequestEntry {\n\ts.Detail = &v\n\treturn s\n}", "title": "" }, { "docid": "8d0eb144361409eef998e90b1987e298", "score": "0.5940553", "text": "func (s *FindingSource) SetDetail(v *FindingSourceDetail) *FindingSource {\n\ts.Detail = v\n\treturn s\n}", "title": "" }, { "docid": "0d8561f0720125148efa35ebce9514be", "score": "0.59344536", "text": "func (au *ActivitiesUpdate) SetDetail(s string) *ActivitiesUpdate {\n\tau.mutation.SetDetail(s)\n\treturn au\n}", "title": "" }, { "docid": "32ee31fda723a8d56cd1f3940958dfe1", "score": "0.58959454", "text": "func (o *DeleteImageResponse) SetDetail(v string) {\n\to.Detail = &v\n}", "title": "" }, { "docid": "8d6bda2d5e2461ceae2375e8da790078", "score": "0.5895783", "text": "func (_CertificateTracker *CertificateTrackerTransactorSession) SetCertificateDetails(_ownerAddress common.Address, _name string, _email string, _certificate string) (*types.Transaction, error) {\n\treturn _CertificateTracker.Contract.SetCertificateDetails(&_CertificateTracker.TransactOpts, _ownerAddress, _name, _email, _certificate)\n}", "title": "" }, { "docid": "afd5ad25a801192e9be3ea5ae4904825", "score": "0.5881458", "text": "func (o *SyntheticsBrowserTestResultData) SetStepDetails(v []SyntheticsStepDetail) {\n\to.StepDetails = v\n}", "title": "" }, { "docid": "847885ec6078857d5081d4f8d94409e3", "score": "0.58632076", "text": "func (_CertificateTracker *CertificateTrackerSession) SetCertificateDetails(_ownerAddress common.Address, _name string, _email string, _certificate string) (*types.Transaction, error) {\n\treturn _CertificateTracker.Contract.SetCertificateDetails(&_CertificateTracker.TransactOpts, _ownerAddress, _name, _email, _certificate)\n}", "title": "" }, { "docid": "61084180b1b70624957bb05a2694e96e", "score": "0.5852351", "text": "func (ahuo *AlertHistoryUpdateOne) SetDetail(shd sub.AlertHistoryDetail) *AlertHistoryUpdateOne {\n\tahuo.mutation.SetDetail(shd)\n\treturn ahuo\n}", "title": "" }, { "docid": "21d60b8e8c4553c19042e318f2888019", "score": "0.58489746", "text": "func Details() *HTMLDetails {\n\te := &HTMLDetails{}\n\te.a = make(map[string]interface{})\n\te.tagName = \"details\"\n\treturn e\n}", "title": "" }, { "docid": "3a9341db7a8d5e1fdcf9fddc909d82ba", "score": "0.5810099", "text": "func (s *PutEventsRequestEntry) SetDetail(v string) *PutEventsRequestEntry {\n\ts.Detail = &v\n\treturn s\n}", "title": "" }, { "docid": "105aac5a1221242016de81af90a4db6f", "score": "0.57653254", "text": "func (s *ListFleetsOutput) SetFleetDetails(v []*Fleet) *ListFleetsOutput {\n\ts.FleetDetails = v\n\treturn s\n}", "title": "" }, { "docid": "5fd354775fb7b32096ef7eaa563378e7", "score": "0.57312644", "text": "func (s *ChannelMessageStatusStructure) SetDetail(v string) *ChannelMessageStatusStructure {\n\ts.Detail = &v\n\treturn s\n}", "title": "" }, { "docid": "520bf1a682a19b47d2669459d0d63ee1", "score": "0.5721678", "text": "func (m *ActivityMutation) SetClockDetails(ad activity.ClockDetails) {\n\tm.clock_details = &ad\n}", "title": "" }, { "docid": "5ad423b6f8d9e8de37a8dc776b445da2", "score": "0.5702238", "text": "func (ahu *AlertHistoryUpdate) SetDetail(shd sub.AlertHistoryDetail) *AlertHistoryUpdate {\n\tahu.mutation.SetDetail(shd)\n\treturn ahu\n}", "title": "" }, { "docid": "c87e169d0901025258fb090044e540ed", "score": "0.5655744", "text": "func (o *GetIterationChartImageParams) SetShowDetails(showDetails *bool) {\n\to.ShowDetails = showDetails\n}", "title": "" }, { "docid": "fd75508d82f9a87a4d2e8fea9d4ed036", "score": "0.55828387", "text": "func (mr *MockResultCollectorMockRecorder) SetResultDetails() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetResultDetails\", reflect.TypeOf((*MockResultCollector)(nil).SetResultDetails))\n}", "title": "" }, { "docid": "e27698323555949a5cfac56e29454855", "score": "0.55786383", "text": "func (v *SyncActivityRequest) IsSetDetails() bool {\n\treturn v != nil && v.Details != nil\n}", "title": "" }, { "docid": "f97afbb6fe32c8f55ed74a47cf3b4f9a", "score": "0.5535655", "text": "func (r *ServerService) Details() *ServerDetailsCall {\n\tc := &ServerDetailsCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "title": "" }, { "docid": "291a6e4387eaf16175939f41819f23b0", "score": "0.5529215", "text": "func (p *Service) Details(placeid string) *DetailsCall {\n\treturn &DetailsCall{\n\t\tservice: p,\n\t\tplaceID: placeid,\n\t}\n}", "title": "" }, { "docid": "a5c4e49eb9a3dddf4beffd96289b2bd9", "score": "0.55243915", "text": "func (m *MockClient) OfferDetails(offerID string) (hProtocol.Offer, error) {\n\ta := m.Called(offerID)\n\treturn a.Get(0).(hProtocol.Offer), a.Error(1)\n}", "title": "" }, { "docid": "a51470b48f9a175b968dbd8ca5e01b57", "score": "0.55046296", "text": "func Details(markup ...vecty.MarkupOrChild) *vecty.HTML {\n\treturn vecty.Tag(\"details\", markup...)\n}", "title": "" }, { "docid": "e16915b0c559a00f1155cbd13beb8612", "score": "0.5452036", "text": "func (e StoreError) detailed(details string) StoreError {\n\te.Details = details\n\treturn e\n}", "title": "" }, { "docid": "1111b42a18a6d84ac6b9eb58c15c3ab3", "score": "0.54444605", "text": "func (s *ChangeSetHook) SetTargetDetails(v *ChangeSetHookTargetDetails) *ChangeSetHook {\n\ts.TargetDetails = v\n\treturn s\n}", "title": "" }, { "docid": "cf4703ca1c3c241d5d00400413d0c8d8", "score": "0.5423049", "text": "func (s *Scan) SetResourceDetails(v *ResourceDetails) *Scan {\n\ts.ResourceDetails = v\n\treturn s\n}", "title": "" }, { "docid": "bcf9dd19a7ac4f92c6b1d544e7093907", "score": "0.53865147", "text": "func (s *Resource) SetContainerDetails(v *Container) *Resource {\n\ts.ContainerDetails = v\n\treturn s\n}", "title": "" }, { "docid": "53d6beebba9bdc906010f2233e46a460", "score": "0.53783613", "text": "func (b *barError) SetDetail(detail string) {\n\tb.Message = detail\n}", "title": "" }, { "docid": "a170273459d8b1129151bf13e8cddf09", "score": "0.536173", "text": "func (c Error) WithDetails(details ...string) Error {\n\n\tc.details = make([]string, len(details))\n\tcopy(c.details, details)\n\treturn c\n}", "title": "" }, { "docid": "0a98dfc1493d99ef07db5584a08cb2d5", "score": "0.5304117", "text": "func (s *SystemEvent) DecodeDetails(details any) error {\n\tif s.Details == nil {\n\t\treturn errors.New(\"unable to decode System Event details: Details are nil\")\n\t}\n\n\t// Must encode the details to JSON since if the target SystemEvent was decoded from JSON the details are\n\t// captured in a map[string]interface{}.\n\tdata, err := json.Marshal(s.Details)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to encode System Event details to JSON: %s\", err.Error())\n\t}\n\n\terr = json.Unmarshal(data, details)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to decode System Event details from JSON: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1e1efa598b456ede5346d9c88b491533", "score": "0.52702945", "text": "func (_m *Status) Details() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "242568f1dc00ec62a0d82144f61f3a59", "score": "0.5213137", "text": "func (v *Vault) Details() *Details {\n\treturn &v.details\n}", "title": "" }, { "docid": "625315c53615ff4af00a4d7235af3809", "score": "0.5212856", "text": "func (s *CoverageResource) SetResourceDetails(v *CoverageResourceDetails) *CoverageResource {\n\ts.ResourceDetails = v\n\treturn s\n}", "title": "" }, { "docid": "596015723518e5ee68451d35a704edf0", "score": "0.51421046", "text": "func (o *Info) SetImageDetailsToCache(imageDetails []*contentservice.ImageDetail) error {\n\tkey := fmt.Sprintf(\"OrderNumber:%q\", o.OrderNumber)\n\tencBuf := new(bytes.Buffer)\n\terr := gob.NewEncoder(encBuf).Encode(imageDetails)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = o.MemClient.Set(&memcache.Item{Key: key, Value: encBuf.Bytes(), Expiration: o.SecondsToExpiry})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e3568489f74084c2e623eca80db7ca52", "score": "0.5135636", "text": "func (o *HyperflexHealthAllOf) SetResiliencyDetails(v HyperflexHxResiliencyInfoDt) {\n\to.ResiliencyDetails.Set(&v)\n}", "title": "" }, { "docid": "9df536e021a3672ac842883641647113", "score": "0.5120983", "text": "func (s *CreateMembersInput) SetAccountDetails(v []*AccountDetail) *CreateMembersInput {\n\ts.AccountDetails = v\n\treturn s\n}", "title": "" }, { "docid": "4ea396e556fc11387a0a124b1be6838e", "score": "0.5112892", "text": "func (s *Scan) SetScanResultDetails(v *ScanResultDetails) *Scan {\n\ts.ScanResultDetails = v\n\treturn s\n}", "title": "" }, { "docid": "738288cc76aa3a800ea78fc86706eaad", "score": "0.51105565", "text": "func (s *FraudsterRegistrationJob) SetFailureDetails(v *FailureDetails) *FraudsterRegistrationJob {\n\ts.FailureDetails = v\n\treturn s\n}", "title": "" }, { "docid": "242273cbb0fcdb961b37eb4045858e3f", "score": "0.51004183", "text": "func (m *CourseMutation) ResetDetails() {\n\tm.details = nil\n\tm.removeddetails = nil\n}", "title": "" }, { "docid": "bee1b4380bf1920cf5d001ea0f241a31", "score": "0.51002187", "text": "func (run *Run) WithAutomationDetails(automationDetails *RunAutomationDetails) *Run {\n\trun.AutomationDetails = automationDetails\n\treturn run\n}", "title": "" }, { "docid": "3f1fc927d1f28007b0a50c3f1b16c400", "score": "0.50855064", "text": "func (r Report) WithReportDetails(reportDetail int) Report {\n\tr.ReportDetail = reportDetail\n\treturn r\n}", "title": "" }, { "docid": "5c2f6dcaada0f4a630a8d2d08e183dae", "score": "0.50824535", "text": "func (s *VoiceToneAnalysisTask) SetCallDetails(v *CallDetails) *VoiceToneAnalysisTask {\n\ts.CallDetails = v\n\treturn s\n}", "title": "" }, { "docid": "93bfa9fb35ada6900e543bc601910a84", "score": "0.50674963", "text": "func (s *Resource) SetInstanceDetails(v *InstanceDetails) *Resource {\n\ts.InstanceDetails = v\n\treturn s\n}", "title": "" }, { "docid": "7c9950b9cec4fd3b1eb8633b9562bdd3", "score": "0.50657946", "text": "func (o ProvisioningIssueResponseOutput) Details() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ProvisioningIssueResponse) string { return v.Details }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3241bfd1004919fbe507bb31e1abb923", "score": "0.5053298", "text": "func (o CertificateManagedProvisioningIssueOutput) Details() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CertificateManagedProvisioningIssue) *string { return v.Details }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a0da7344c3bd3fa7ed8d95411dc35e50", "score": "0.5043511", "text": "func (s *Resource) SetKubernetesDetails(v *KubernetesDetails) *Resource {\n\ts.KubernetesDetails = v\n\treturn s\n}", "title": "" }, { "docid": "05c9490d3526e16178867036bca195fa", "score": "0.50355023", "text": "func (s *KubernetesApiCallAction) SetRemoteIpDetails(v *RemoteIpDetails) *KubernetesApiCallAction {\n\ts.RemoteIpDetails = v\n\treturn s\n}", "title": "" }, { "docid": "9aef20ca2024f20c36e0209292fabb85", "score": "0.50340617", "text": "func (a *Responses) Set(fieldName string, value ResponseDetail) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]ResponseDetail)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "title": "" }, { "docid": "44c95d99bb0064760df0c34865a0d932", "score": "0.5028695", "text": "func (s *SpeakerEnrollmentJob) SetFailureDetails(v *FailureDetails) *SpeakerEnrollmentJob {\n\ts.FailureDetails = v\n\treturn s\n}", "title": "" }, { "docid": "015a553afbbd3e87bab74923dbba337e", "score": "0.50170577", "text": "func (s *StopInstancesOutput) SetOperationDetails(v []*OperationDetailForStopInstancesOutput) *StopInstancesOutput {\n\ts.OperationDetails = v\n\treturn s\n}", "title": "" }, { "docid": "345ff7398ce70fb9a4e0ff947da32076", "score": "0.5012344", "text": "func (s *EcsClusterDetails) SetTaskDetails(v *EcsTaskDetails) *EcsClusterDetails {\n\ts.TaskDetails = v\n\treturn s\n}", "title": "" }, { "docid": "17ee980ad76551663bf5b2cb77ed7f1a", "score": "0.49996504", "text": "func (o *ReportAllOf) GetDetails() string {\n\tif o == nil || o.Details == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Details\n}", "title": "" }, { "docid": "8698d90c2113400e126a36a237646621", "score": "0.49983513", "text": "func (m *PlannerTaskDetails) SetDescription(value *string)() {\n err := m.GetBackingStore().Set(\"description\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "00c1bb4e84081a2091f0a3943a1614b9", "score": "0.4995909", "text": "func (s *FraudsterRegistrationJobSummary) SetFailureDetails(v *FailureDetails) *FraudsterRegistrationJobSummary {\n\ts.FailureDetails = v\n\treturn s\n}", "title": "" }, { "docid": "f30f3ecaf5c40067da03a57ba2b0c511", "score": "0.4992138", "text": "func (oauo *OrderAddressUpdateOne) SetDetailed(s string) *OrderAddressUpdateOne {\n\toauo.mutation.SetDetailed(s)\n\treturn oauo\n}", "title": "" }, { "docid": "8300b03e8a8039933a4cbde4a896a1ed", "score": "0.4989653", "text": "func (s *NetworkConnectionAction) SetRemotePortDetails(v *RemotePortDetails) *NetworkConnectionAction {\n\ts.RemotePortDetails = v\n\treturn s\n}", "title": "" }, { "docid": "7879b341eb6f9eb5fa01f73aff006a84", "score": "0.49893725", "text": "func (o AuthorizationAttemptInfoResponseOutput) Details() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AuthorizationAttemptInfoResponse) string { return v.Details }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4acaf2a4ef9155dbffbefa96bea47f31", "score": "0.4988488", "text": "func (s *SpeakerSearchTask) SetCallDetails(v *CallDetails) *SpeakerSearchTask {\n\ts.CallDetails = v\n\treturn s\n}", "title": "" }, { "docid": "724a27bde56b6633f1861f0cc9425771", "score": "0.498578", "text": "func (o *IamDomainNameInfoAllOf) SetFailureDetails(v IamFailureDetails) {\n\to.FailureDetails.Set(&v)\n}", "title": "" }, { "docid": "930b0e570088bd82de274085eaf6007c", "score": "0.49846712", "text": "func (o *BillOp) Details(ctx context.Context, MemberCode string, id types.ID) (*sacloud.BillDetailsResult, error) {\n\trawResults := ds().Get(o.key+\"Details\", sacloud.APIDefaultZone, id)\n\tif rawResults == nil {\n\t\treturn nil, newErrorNotFound(o.key+\"Details\", id)\n\t}\n\n\tresults := rawResults.(*[]*sacloud.BillDetail)\n\tvar values []*sacloud.BillDetail\n\tfor _, res := range *results {\n\t\tdest := &sacloud.BillDetail{}\n\t\tcopySameNameField(res, dest)\n\t\tvalues = append(values, dest)\n\t}\n\n\treturn &sacloud.BillDetailsResult{\n\t\tTotal: len(*results),\n\t\tCount: len(*results),\n\t\tFrom: 0,\n\t\tBillDetails: values,\n\t}, nil\n}", "title": "" }, { "docid": "87b5bef9c451fb006389ebd23bd99925", "score": "0.49770507", "text": "func (a *Client) SetPaymentDetailsUsingPUT(params *SetPaymentDetailsUsingPUTParams, authInfo runtime.ClientAuthInfoWriter) (*SetPaymentDetailsUsingPUTOK, *SetPaymentDetailsUsingPUTCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSetPaymentDetailsUsingPUTParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"setPaymentDetailsUsingPUT\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/{baseSiteId}/users/{userId}/carts/{cartId}/paymentdetails\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &SetPaymentDetailsUsingPUTReader{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 *SetPaymentDetailsUsingPUTOK:\n\t\treturn value, nil, nil\n\tcase *SetPaymentDetailsUsingPUTCreated:\n\t\treturn nil, value, nil\n\t}\n\treturn nil, nil, nil\n\n}", "title": "" }, { "docid": "afdcaef7268295f1a0400ee48dbc0322", "score": "0.49692723", "text": "func (o *ProvenanceEventDTO) GetDetails() string {\n\tif o == nil || o.Details == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Details\n}", "title": "" }, { "docid": "6fdb2d0f149aaf48c5c91545083a0016", "score": "0.4961411", "text": "func (o CertificateManagedAuthorizationAttemptInfoOutput) Details() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CertificateManagedAuthorizationAttemptInfo) *string { return v.Details }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f16878c0c6f70834af595b486b4e1d1b", "score": "0.49571213", "text": "func (m *MissionMutation) ResetDetails() {\n\tm.details = nil\n\tm.removeddetails = nil\n}", "title": "" }, { "docid": "d011d8d0f538ecd35545a2c814b9ae3f", "score": "0.49567473", "text": "func (s *Service) SetRuntimeDetails(v *RuntimeDetails) *Service {\n\ts.RuntimeDetails = v\n\treturn s\n}", "title": "" }, { "docid": "82d09e04ee537b1fece30d80cdc02657", "score": "0.49500522", "text": "func (r *DetailsRepository) SaveDetails(ctx context.Context, details []Details) error {\n\ttxn, err := r.db.Begin()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"begin transaction failed\")\n\t}\n\tdefer txn.Rollback()\n\n\tstmt, err := txn.PrepareContext(ctx, pq.CopyIn(\"device_details\", \"device_id\", \"time\", \"name\", \"customer_id\", \"customer_name\"))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to prepare context\")\n\t}\n\n\tfor _, d := range details {\n\t\t_, err = stmt.ExecContext(ctx, d.DeviceID, d.Time, d.Name, d.CustomerID, d.CustomerName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed exec\")\n\t\t}\n\t}\n\n\terr = stmt.Close()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to close\")\n\t}\n\n\terr = txn.Commit()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to commit\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af8c4d3b261145c649c24dace40961a6", "score": "0.49463162", "text": "func (s *CategoryEvent) SetMatchedDetails(v map[string]*PointsOfInterest) *CategoryEvent {\n\ts.MatchedDetails = v\n\treturn s\n}", "title": "" }, { "docid": "4807006a852e364af7a88625a29b81d6", "score": "0.49426022", "text": "func (s *DeleteInstancesOutput) SetOperationDetails(v []*OperationDetailForDeleteInstancesOutput) *DeleteInstancesOutput {\n\ts.OperationDetails = v\n\treturn s\n}", "title": "" }, { "docid": "d97b2cd23f0761128a72a5ab6a2dc71d", "score": "0.49389943", "text": "func (s *UpdateLifecyclePolicyInput) SetPolicyDetails(v *PolicyDetails) *UpdateLifecyclePolicyInput {\n\ts.PolicyDetails = v\n\treturn s\n}", "title": "" } ]
5934aab1e2da6848dcb8baf4a33cbf35
GenerateKey generates an RSA accumulator keypair. The private key is mostly used for debugging and should usually be destroyed as part of a trusted setup phase.
[ { "docid": "1ecaa60e49e748e4dbed5208a7bc83ac", "score": "0.6418496", "text": "func GenerateKey(random io.Reader) (*PublicKey, *PrivateKey, error) {\n\tfor {\n\t\tp, err := rand.Prime(random, 1024)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tq, err := rand.Prime(random, 1024)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tpminus1 := new(big.Int).Sub(p, bigOne)\n\t\tqminus1 := new(big.Int).Sub(q, bigOne)\n\t\ttotient := new(big.Int).Mul(pminus1, qminus1)\n\n\t\tg := new(big.Int).GCD(nil, nil, base, totient)\n\t\tif g.Cmp(bigOne) == 0 {\n\t\t\tprivateKey := &PrivateKey{\n\t\t\t\tP: p,\n\t\t\t\tQ: q,\n\t\t\t\tN: new(big.Int).Mul(p, q),\n\t\t\t\tTotient: totient,\n\t\t\t}\n\t\t\tpublicKey := &PublicKey{\n\t\t\t\tN: new(big.Int).Set(privateKey.N),\n\t\t\t}\n\t\t\treturn publicKey, privateKey, nil\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "88114cae1c7adefa2a061567ecefe322", "score": "0.7388213", "text": "func GenerateKey(privatekeypath string) (*string, error) {\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Error getting process working directory\")\n\t}\n\n\tcm := childminder.NewChildMinder(nil, wd, os.Environ(), \"ssh-keygen\", \"-f\", privatekeypath, \"-t\", \"rsa\", \"-C\",\n\t\t\"simulator-key\", \"-N\", \"\")\n\tout, stderr, err := cm.RunSilently()\n\tif *stderr != \"\" {\n\t\tfmt.Println(*stderr)\n\t}\n\n\treturn out, err\n}", "title": "" }, { "docid": "fa7efae67a0459fa7b7746403c0be07e", "score": "0.7341605", "text": "func (pu *KeyManagerPeruser) GenerateKey(a utils.Appliance) error {\n\tprivBytes, pubBytes, err := utils.GenerateRSAKeyPair(defaultBitsSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprivKey := fmt.Sprintf(\"%s/%s/%s/%s\", a.Proto, a.Version, a.Namespace, defaultPrivateKey)\n\t_, err = pu.store.Put(privKey, privBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpubKey := fmt.Sprintf(\"%s/%s/%s/%s\", a.Proto, a.Version, a.Namespace, defaultPublicKey)\n\t_, err = pu.store.Put(pubKey, pubBytes)\n\tif err != nil {\n\t\t// make sure priv/pub key exist in pairs.\n\t\tpu.store.Delete(privKey)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "81cf69222ca37dfb2453dc4efe4966fd", "score": "0.7279722", "text": "func generatePrivateKey(privKey string) error {\n\treturn openssl(\"genrsa\", \"-out\", privKey, \"1024\")\n}", "title": "" }, { "docid": "00a47b9b5924b46ba0859c62b5524b86", "score": "0.7161303", "text": "func GenerateKey() (PrivateKey, error) {\n\treturn newSecp256k1PrvKey()\n}", "title": "" }, { "docid": "79536025d9e3464076c2a6875a544720", "score": "0.7126259", "text": "func generateKeyPair() *rsa.PrivateKey {\n\n\tkey_pair, err := rsa.GenerateKey(rand.Reader, 2048)\n\n\tif err != nil {\n\t\tconsoleLog(\"Error during key pair generation: \" + err.Error())\n\t\tos.Exit(1)\n\t} else {\n\t\tconsoleLog(\"Key pair generetad successfully\")\n\t}\n\n\treturn key_pair\n}", "title": "" }, { "docid": "7dc09b686a903c83e054898a0d7564a6", "score": "0.7118524", "text": "func GenerateKeypair(privateKey *[32]byte) *KeyPair {\n\n\tvar keyPair KeyPair\n\tif privateKey != nil {\n\t\tcopy(keyPair.PrivateKey[:], privateKey[:])\n\t} else {\n\t\tif _, err := rand.Read(keyPair.PrivateKey[:]); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tcurve25519.ScalarBaseMult(&keyPair.PublicKey, &keyPair.PrivateKey)\n\n\treturn &keyPair\n}", "title": "" }, { "docid": "610762258b46e25274d6c55d6d65377c", "score": "0.7086826", "text": "func GenerateKey() (*PrivateKey, error) {\n\tprivByte := make([]byte, 256)\n\tpubByte := make([]byte, 256)\n\tvar privlen C.int\n\tvar publen C.int\n\n\tif C.X_GenerateKey((*C.char)(unsafe.Pointer(&privByte[0])), &privlen, (*C.char)(unsafe.Pointer(&pubByte[0])), &publen) != 1 {\n\t\treturn nil, errors.New(\"Failed to generate key: \" + OpenError())\n\t}\n\n\tpub := &PublicKey{\n\t\tKey: pubByte[:publen],\n\t}\n\tpriv := &PrivateKey{\n\t\tPublicKey: pub,\n\t\tKey: privByte[:privlen],\n\t}\n\n\treturn priv, nil\n}", "title": "" }, { "docid": "0a8e08ac02fe99dc9955a5d15475893d", "score": "0.69529074", "text": "func (self *Wallet) GenerateKey(crytoCurve elliptic.Curve) {\n\tself.curve = crytoCurve\n\tprivatekey, err := ecdsa.GenerateKey(self.curve, rand.Reader)\n\n\t// error handling\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tself.privatekey = privatekey\n\tself.publickey = privatekey.PublicKey\n\t// fmt.Println(\"The private key is: \", self.privatekey)\n}", "title": "" }, { "docid": "b871685889ecfc916c9d8df2c359768b", "score": "0.689471", "text": "func Generate(param *Params) (*PrivateKey, error) {\n\tprikey, err := btcec.NewPrivateKey(secp256k1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkey := &PrivateKey{\n\t\tPublicKey: &PublicKey{\n\t\t\tPublicKey: prikey.PubKey(),\n\t\t\tisCompressed: true,\n\t\t\tparam: param,\n\t\t},\n\t\tPrivateKey: prikey,\n\t}\n\n\treturn key, nil\n}", "title": "" }, { "docid": "de025670383a560ae8d8c0b1da94542f", "score": "0.68469876", "text": "func GenerateKey() (key *rsa.PrivateKey, err error) {\n\treturn rsa.GenerateKey(rand.Reader, KeySize)\n}", "title": "" }, { "docid": "96556ef52a3844ea4453fcd3c2a2cc7a", "score": "0.68257535", "text": "func GenerateKeyPair() (crabfsCrypto.PrivKey, error) {\n\tprivateKey, err := crabfsCrypto.PrivateKeyNew(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privateKey.(crabfsCrypto.PrivKey), nil\n}", "title": "" }, { "docid": "a15ef0c3c96bb2d15432f3a63911a698", "score": "0.67850024", "text": "func generateKeyPair() *rsa.PrivateKey {\n\tkeypair, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tlogger.Fatalf(\"Could not generate an RSA keypair: %s\", err)\n\t}\n\n\treturn keypair\n}", "title": "" }, { "docid": "3be81a362e5c7a959ae1a7ffb9b07f05", "score": "0.6759548", "text": "func generatePrivateKey(pwd string) (privateKey *rsa.PrivateKey, privatePEM []byte, err kv.Error) {\n\tif len(pwd) == 0 {\n\t\treturn nil, nil, kv.NewError(\"passphrase must be specified\").With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\tprivateKey, errGo := rsa.GenerateKey(rand.Reader, 4096)\n\tif errGo != nil {\n\t\treturn nil, nil, kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\tif errGo = privateKey.Validate(); errGo != nil {\n\t\treturn nil, nil, kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\tblock, err := encryptPrivateKeyToPEM(privateKey, pwd)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn privateKey, pem.EncodeToMemory(block), nil\n}", "title": "" }, { "docid": "0be3ac9e90f4398cf7524e4cbaac1d3b", "score": "0.6738173", "text": "func GenerateKey() (*rsa.PrivateKey, *rsa.PublicKey, error) {\n\tpri, err := rsa.GenerateKey(rand.Reader, rsaKeySize)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn pri, &pri.PublicKey, nil\n}", "title": "" }, { "docid": "7812d08ffde05614ae2e61dcb3bf69c9", "score": "0.6733431", "text": "func KeyPairGenerate() *KeyPair {\n\tpublicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\treturn &KeyPair{\n\t\tPublicKey: base64.StdEncoding.EncodeToString(publicKey),\n\t\tPrivateKey: base64.StdEncoding.EncodeToString(privateKey),\n\t}\n}", "title": "" }, { "docid": "4d5254be87068998c2c01345e3f2b4b6", "score": "0.6719113", "text": "func GenerateKeyGen() ([]byte, []byte, error) {\n\tp, b, err := btcaddr.Bitcoin_GenerateKeypair()\n\tpriv := p.D.Bytes()\n\n\tpub := public(b.X, b.Y, true)\n\n\treturn priv, pub, err\n}", "title": "" }, { "docid": "c9145ad0b7582142cb29feda121816a1", "score": "0.67144245", "text": "func GeneratePrivateKey() (pk *ecdsa.PrivateKey, err error) {\n\tcurve := elliptic.P256()\n\tpk, err = ecdsa.GenerateKey(curve, rand.Reader)\n\treturn\n}", "title": "" }, { "docid": "d6983f6c527389d88d21b24795e54886", "score": "0.67054886", "text": "func generateKey(filename string) (*rsa.PrivateKey, error) {\n\tk, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb := pem.EncodeToMemory(&pem.Block{\n\t\tType: keyType,\n\t\tBytes: x509.MarshalPKCS1PrivateKey(k),\n\t})\n\tif err := ioutil.WriteFile(filename, b, 0600); err != nil {\n\t\treturn nil, err\n\t}\n\treturn k, nil\n}", "title": "" }, { "docid": "c6d4685af585a18835d7d3dbdfcdc962", "score": "0.6699794", "text": "func GenerateKey(random io.Reader) (*PrivateKey, error) {\n\tprivateKey := new(PrivateKey)\n\tif _, err := io.ReadFull(random, privateKey.b[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Masking X25519 key as documented at https://cr.yp.to/ecdh.html\n\tprivateKey.b[0x00] &= 0xf8\n\tprivateKey.b[0x1f] &= 0x7f\n\tprivateKey.b[0x1f] |= 0x40\n\n\t// Calculate public key\n\tcurve25519.ScalarBaseMult(&privateKey.PublicKey.b, &privateKey.b)\n\n\treturn privateKey, nil\n}", "title": "" }, { "docid": "025d1328d61dd097d6fc6beb5bb6b251", "score": "0.66935635", "text": "func GenerateKey(rnd io.Reader) (KeyPair, error) {\n\tif rnd == nil {\n\t\trnd = rand.Reader\n\t}\n\trndByts := make([]byte, 32)\n\tif _, err := io.ReadFull(rnd, rndByts); err != nil {\n\t\treturn nil, err\n\t}\n\tdigest := sha512.Sum512(rndByts)\n\tdigest[0] &= 248\n\tdigest[31] &= 127\n\tdigest[31] |= 64\n\treturn PrivateKey(digest[:]).KeyPair(), nil\n}", "title": "" }, { "docid": "eabed8ae8199ca5a03e1ccdc532ece17", "score": "0.6689513", "text": "func GeneratePrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, RSA_BITS)\n}", "title": "" }, { "docid": "3f1914f9bf03082cbbe742d4deeb8f15", "score": "0.66724044", "text": "func GenerateKey(id SuiteID, rnd io.Reader) (*PrivateKey, error) {\n\tsuite, err := suiteFromID(id, BaseMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif rnd == nil {\n\t\tpanic(\"rnd must be an non-nil io.Reader\")\n\t}\n\tprivateKey := suite.Group.RandomScalar(rnd)\n\treturn &PrivateKey{suite.SuiteID, privateKey}, nil\n}", "title": "" }, { "docid": "7ac2ea7b21df3b2fa2699e64bf92e703", "score": "0.6666834", "text": "func GenerateKeyPair(pwd string) (privatePEM []byte, publicPEM []byte, err kv.Error) {\n\tprivateKey, privatePEM, err := generatePrivateKey(pwd)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tpublicPEM, err = extractPublicPEM(privateKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn privatePEM, publicPEM, nil\n}", "title": "" }, { "docid": "bda355844ada755f95454ca71335fa52", "score": "0.6664578", "text": "func (kg KeyGenerator) GenerateKey() string {\n\trecord := kg.recordToHash()\n\th := sha256.New()\n\th.Write([]byte(record))\n\thashed := h.Sum(nil)\n\treturn hex.EncodeToString(hashed)\n}", "title": "" }, { "docid": "5a1ff87b50782cbf3fac22bc6875ea3e", "score": "0.6651086", "text": "func GenKeypair(this js.Value, inputs []js.Value) (interface{}, error) {\n\tissuer, err := credentials.NewAttester(SysParams, inputs[0].Int(), int64(inputs[1].Int()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn map[string]interface{}{\n\t\t\"privateKey\": issuer.PrivateKey,\n\t\t\"publicKey\": issuer.PublicKey,\n\t}, nil\n}", "title": "" }, { "docid": "51365ae0c6db20b65e00de1f85c5a92c", "score": "0.6645558", "text": "func GenerateKey() (PrivateKey, error) {\n\tpriv, err := rsa.GenerateKey(rand.Reader, 4096)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn RSAPrivateKey(priv), nil\n}", "title": "" }, { "docid": "e9c4666a41a5feb9e39189b91e6b1c3e", "score": "0.66317403", "text": "func GenerateKeypair(bitLength int) (*Keypair, error) {\n\tpublic, private, err := GenerateKeys(bitLength)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewKeypair(public, private)\n}", "title": "" }, { "docid": "4aba0d4ccd34a42f129c9b7ea52860f2", "score": "0.66122043", "text": "func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n\t// Private Key generation\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validate Private Key\n\terr = privateKey.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"Private Key generated\")\n\treturn privateKey, nil\n}", "title": "" }, { "docid": "9672f482014bed0b4f9015484bbdccc2", "score": "0.6609783", "text": "func generatePrivateKey(privateKeyName string) (string, error) {\n\tcmd := wgManageBin + \" genkey\"\n\tlog.Info().Msgf(\"Generating private key with name %s\", privateKeyName)\n\tout, err := WireGuardCmd(cmd)\n\tif err != nil {\n\t\treturn \"Error on running wg bin, unable to generate private key\", fmt.Errorf(\"GeneratePrivateKey error %v\", err)\n\t}\n\tlog.Info().Msgf(\"Private key is generated %s\", privateKeyName)\n\toutput := strings.Replace(string(out), \"\\n\", \"\", 1)\n\tif err := writeToFile(privateKeyName, output); err != nil {\n\t\treturn \"WriteToFile Error \", err\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "a9380ff67a219752950424239ff7d384", "score": "0.66057706", "text": "func GenerateKey(c elliptic.Curve, rand io.Reader) (*PrivateKey, error) {\n\tk, err := randFieldElement(c, rand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpriv := new(PrivateKey)\n\tpriv.PublicKey.Curve = c\n\tpriv.D = k\n\tpriv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes())\n\treturn priv, nil\n}", "title": "" }, { "docid": "984851eb171c96d8b223311e37a765fb", "score": "0.66033024", "text": "func GeneratePrivateKey(keyType KeyType) (crypto.PrivateKey, error) {\n\tvar key crypto.PrivateKey\n\tvar err error\n\tswitch keyType {\n\tcase KeyTypeRSA:\n\t\tkey, err = rsa.GenerateKey(rand.Reader, 2048)\n\tcase KeyTypeECDSAP224:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n\tcase KeyTypeECDSAP256:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tcase KeyTypeECDSAP384:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tcase KeyTypeECDSAP521:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn key, nil\n}", "title": "" }, { "docid": "2a05b29b0b3f41439fbf3981ac7d28df", "score": "0.6573034", "text": "func generatePrivateKey() ([]byte, error) {\n\tvar keyData []byte\n\tkey, err := rsa.GenerateKey(rand.Reader, 1024)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error generating key\")\n\t}\n\tvar privateKey = &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(key),\n\t}\n\tbuf := bytes.NewBuffer(keyData)\n\terr = pem.Encode(buf, privateKey)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error encoding generated private key\")\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "c89f5e9f5d2d0323d0cf10f602de31c1", "score": "0.65695333", "text": "func generateRSAPrivateKey(bits int) (k *rsaPrivateKey, err error) {\n\tk = new(rsaPrivateKey)\n\tk.PrivateKey, err = rsa.GenerateKey(rand.Reader, bits)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tk.rsaPublicKey.PublicKey = &k.PrivateKey.PublicKey\n\tk.extended = make(map[string]interface{})\n\n\treturn\n}", "title": "" }, { "docid": "1bc0aab3c233dd6ba5e4ed5b4169cf55", "score": "0.6561449", "text": "func GenerateKey(bitSize int) (rsa.PublicKey, rsa.PrivateKey) {\n\tkey, _ := rsa.GenerateKey(randReader, bitSize)\n\tpub := key.PublicKey\n\treturn pub, *key\n}", "title": "" }, { "docid": "c003c44e7fd754b6f78d0b80bb7c5d4b", "score": "0.65321445", "text": "func GenerateKeypair(loginInfo string) error {\n\n\tos.Mkdir(CONFIG_FOLDER_NAME, 0700)\n\n\tconfigString := \"/C=US/O=Gopherbox/emailAddress=\" + loginInfo\n\tcmd := exec.Command(\n\t\t\"openssl\",\n\t\t\"req\",\n\t\t\"-new\",\n\t\t\"-nodes\",\n\t\t\"-x509\",\n\t\t\"-out\", CONFIG_FOLDER_NAME+\"/\"+CLIENT_PRIVATE_KEY_FILENAME,\n\t\t\"-keyout\", CONFIG_FOLDER_NAME+\"/\"+CLIENT_PUBLIC_KEY_FILENAME,\n\t\t\"-subj\", configString)\n\n\terr := cmd.Start()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7e8b19ac95c247041980ea475a40c91b", "score": "0.652745", "text": "func (k *Keypair) Generate() (err error) {\n\tvar pub, priv *[32]byte\n\tpub, priv, err = box.GenerateKey(rand.Reader)\n\tif err != nil {\n\t\treturn\n\t}\n\tk.Public = *pub\n\tk.Private = *priv\n\treturn\n}", "title": "" }, { "docid": "913ccfce8dc0c252021245bed45f5b42", "score": "0.6514715", "text": "func (u *TestUser) GenerateKey() (privateKeyPEM string, publicKeyAuthorizedKeys string) {\n\trandom := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tprivateKey, err := rsa.GenerateKey(random, 2048)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprivPEM := &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(privateKey),\n\t}\n\tvar privateKeyPEMBuffer bytes.Buffer\n\tif err := pem.Encode(&privateKeyPEMBuffer, privPEM); err != nil {\n\t\tpanic(err)\n\t}\n\tprivateKeyPEM = privateKeyPEMBuffer.String()\n\n\tpub, err := ssh.NewPublicKey(&privateKey.PublicKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpublicKeyAuthorizedKeys = string(ssh.MarshalAuthorizedKey(pub))\n\n\tu.privateKeys = append(u.privateKeys, privateKey)\n\tu.authorizedKeys = append(u.authorizedKeys, privateKeyPEM)\n\n\treturn privateKeyPEM, publicKeyAuthorizedKeys\n}", "title": "" }, { "docid": "604935726dbef1f3985a1cf727b3509a", "score": "0.6507365", "text": "func GenerateKey(c elliptic.Curve, rand io.Reader) (*ecdsa.PrivateKey, error)", "title": "" }, { "docid": "77be8e50a50480b3cc13722cfcff0244", "score": "0.65064627", "text": "func GenRSAPrivateKey() (key *rsa.PrivateKey, err error) {\n\tkey, err = rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed generating the RSA Key. %s\", err)\n\t}\n\treturn key, err\n}", "title": "" }, { "docid": "3f2bed368cc458322ccc07e0e95bd5a5", "score": "0.649552", "text": "func GeneratePrivateKey(algorithm string) (interface{}, []byte, error) {\n\tswitch algorithm {\n\tcase \"RSAWithSize2048\":\n\t\treturn genRSA(2048)\n\n\tcase \"RSAWithSize4096\":\n\t\treturn genRSA(4096)\n\n\tcase \"RSAWithSize8192\":\n\t\treturn genRSA(8192)\n\n\tcase \"ECDSAWithCurve256\":\n\t\treturn genECDSA(elliptic.P256())\n\n\tcase \"ECDSAWithCurve384\":\n\t\treturn genECDSA(elliptic.P384())\n\n\tcase \"ECDSAWithCurve521\":\n\t\treturn genECDSA(elliptic.P521())\n\n\tdefault:\n\t\treturn genRSA(2048)\n\t}\n}", "title": "" }, { "docid": "a5ea7d2e1a12eeba52adc7826edf1e67", "score": "0.64916563", "text": "func GeneratePrivateKey(keyType string) (crypto.PrivateKey, error) {\n\tswitch keyType {\n\tcase RSA1024, RSA2048, RSA4096:\n\t\treturn rsa.GenerateKey(rand.Reader, rsaTypes[keyType])\n\tcase ECDSA224, ECDSA256, ECDSA384, ECDSA521:\n\t\treturn ecdsa.GenerateKey(ecdsaTypes[keyType](), rand.Reader)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%s key type not implemented\", keyType)\n\t}\n}", "title": "" }, { "docid": "af7b9c9d53cb0b57fb38b963fd636df6", "score": "0.648675", "text": "func (d Driver) GenKey() (crypto.PrivKey, error) {\n\tprivKeyBytes := [privateKeyECDSALength]byte{}\n\tcopy(privKeyBytes[:], crypto.CRandBytes(privateKeyECDSALength))\n\tpriv, _ := privKeyFromBytes(elliptic.P256(), privKeyBytes[:])\n\tcopy(privKeyBytes[:], SerializePrivateKey(priv))\n\treturn PrivKeyECDSA(privKeyBytes), nil\n}", "title": "" }, { "docid": "1713fc20d065108105e186dbc0821d48", "score": "0.6475087", "text": "func GenerateKey(request *specs.CertificateKeyRequest) (specs.Key, error) {\n\tif err := request.Algorithm.ValidKeySize(request.Size); err != nil {\n\t\treturn nil, err\n\t}\n\tswitch request.Algorithm {\n\tcase specs.ECDSAKey:\n\t\treturn generateECDSAKey(request.Size)\n\tcase specs.RSAKey:\n\t\treturn generateRSAKey(request.Size)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported key algorithm %s\", request.Algorithm)\n\t}\n}", "title": "" }, { "docid": "cb007686ad2a30a6bbd4fb6c2d3bf9eb", "score": "0.6468653", "text": "func GenerateKey(name, email string, passphrase []byte, keyType string, bits int) (string, error) {\n\tkey, err := crypto.GenerateKey(name, email, keyType, bits)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"gopenpgp: unable to generate new key\")\n\t}\n\tdefer key.ClearPrivateParams()\n\n\tlocked, err := key.Lock(passphrase)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"gopenpgp: unable to lock new key\")\n\t}\n\n\treturn locked.Armor()\n}", "title": "" }, { "docid": "b97488b7bfcd30ac3c852316998bcd15", "score": "0.64351887", "text": "func GenerateKeyPair(typ, bits int) (PrivKey, PubKey, error) {\n\treturn core.GenerateKeyPair(typ, bits)\n}", "title": "" }, { "docid": "e8a4e766b2cd726660c0331f9a0fc937", "score": "0.6421189", "text": "func GenRSAPrivateKey(bits int) error {\n\n\t// Generate the raw RSA private key\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bits)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Convert the raw private key to a ASN.1 DER encoded form\n\tderStream := x509.MarshalPKCS1PrivateKey(privateKey)\n\n\t// Create a new PEM object with derStream\n\tblock := &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: derStream,\n\t}\n\n\t// Create a file object for save the PEM object\n\tfile, err := os.Create(\"private.pem\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Encode the PEM object to the file created before\n\terr = pem.Encode(file, block)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get the raw public key of the private key created before\n\tpublicKey := &privateKey.PublicKey\n\n\t// Convert the raw public key to a PXIX encoded form\n\tderPkix, err := x509.MarshalPKIXPublicKey(publicKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a new PEM object with derStream\n\tblock = &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: derPkix,\n\t}\n\n\t// Create a file object for save the PEM object of public key\n\tfile, err = os.Create(\"public.pem\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Encode the PEM object to the file created before\n\terr = pem.Encode(file, block)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0135931bc22bc10ca8098a2c0b36a666", "score": "0.640517", "text": "func GenerateKeys() (*KeyPair){\n\tprivateKey := newPrivateKey()\n\tpublicKey := newPublicKey(privateKey.H)\n\tkeys := &KeyPair{\n\t\tPrivateKey: *privateKey,\n\t\tPublicKey: *publicKey,\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "7383bc8a6a2d29a298910eebdc688ac0", "score": "0.6403294", "text": "func GeneratePrivateKey() (*PrivateKey, error) {\n\tkey, err := ecdsa.GenerateKey(S256(), rand.Reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn (*PrivateKey)(key), nil\n}", "title": "" }, { "docid": "626117079aab9a35a31a7dae5450d6f2", "score": "0.6398561", "text": "func generateKey(keytype acme.KeyType) (crypto.PrivateKey, error) {\n\tswitch keytype {\n\tcase acme.RSA2048:\n\t\treturn rsa.GenerateKey(rand.Reader, 2048)\n\tcase acme.RSA4096:\n\t\treturn rsa.GenerateKey(rand.Reader, 4096)\n\tcase acme.RSA8192:\n\t\treturn rsa.GenerateKey(rand.Reader, 8192)\n\tcase acme.EC256:\n\t\treturn ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tcase acme.EC384:\n\t\treturn ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tdefault:\n\t\treturn nil, errors.New(\"Unrecognized key type\")\n\t}\n}", "title": "" }, { "docid": "3f6fa4afc225fb7751cb6c4e884b6d91", "score": "0.63956183", "text": "func GenerateKey(passphrase, salt []byte) []byte {\n\treturn pbkdf2.Key(passphrase, salt, 64000, 32, sha256.New)\n}", "title": "" }, { "docid": "38e3d2d607380b45c778c4e618a0eed6", "score": "0.6393041", "text": "func GenerateKey(keyType KeyType, encoding KeyEncodingType, bits *int) ([]byte, error) {\n\tvar key crypto.PrivateKey\n\n\tvar err error\n\n\tswitch keyType {\n\tcase KeyTypeRSA:\n\t\tif bits == nil {\n\t\t\treturn nil, errors.NewConfigurationError(\"RSA key length not specified\")\n\t\t}\n\n\t\tkey, err = rsa.GenerateKey(rand.Reader, *bits)\n\tcase KeyTypeEllipticP224:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n\tcase KeyTypeEllipticP256:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tcase KeyTypeEllipticP384:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tcase KeyTypeEllipticP521:\n\t\tkey, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader)\n\tcase KeyTypeED25519:\n\t\t_, key, err = ed25519.GenerateKey(rand.Reader)\n\tdefault:\n\t\treturn nil, errors.NewConfigurationError(\"invalid key type %s\", keyType)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar t string\n\n\tvar b []byte\n\n\tswitch encoding {\n\tcase KeyEncodingPKCS1:\n\t\tt = pemTypeRSAPrivateKey\n\n\t\trsaKey, ok := key.(*rsa.PrivateKey)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewConfigurationError(\"invalid key for PKCS#1 encoding\")\n\t\t}\n\n\t\tb = x509.MarshalPKCS1PrivateKey(rsaKey)\n\tcase KeyEncodingPKCS8:\n\t\tt = pemTypePrivateKey\n\n\t\tb, err = x509.MarshalPKCS8PrivateKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase KeyEncodingSEC1:\n\t\tt = pemTypeECPrivateKey\n\n\t\tecKey, ok := key.(*ecdsa.PrivateKey)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewConfigurationError(\"invalid key for EC encoding\")\n\t\t}\n\n\t\tb, err = x509.MarshalECPrivateKey(ecKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, errors.NewConfigurationError(\"invalid encoding type %s\", encoding)\n\t}\n\n\tblock := &pem.Block{\n\t\tType: t,\n\t\tBytes: b,\n\t}\n\n\tpemData := pem.EncodeToMemory(block)\n\n\treturn pemData, nil\n}", "title": "" }, { "docid": "46e177e88a8c34b8d9f61a4eac12eeea", "score": "0.63894135", "text": "func (c *Client) generate() error {\n\tvar (\n\t\tkey interface{}\n\t\terr error\n\t)\n\tlog := Log.WithField(\"action\", \"generate\").\n\t\tWithField(\"type\", c.Config.GenerateKeypairType)\n\tsize := c.Config.GenerateKeypairSize\n\tif size == 0 {\n\t\tsize = DefaultGenerateKeypairSize\n\t}\n\tswitch strings.ToLower(c.Config.GenerateKeypairType) {\n\tcase \"rsa\":\n\t\tlog = log.WithField(\"size\", size)\n\t\tkey, err = rsa.GenerateKey(rand.Reader, size)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"could not generate RSA key\")\n\t\t}\n\tcase \"ed25519\":\n\t\tlog = log.WithField(\"size\", ed25519.PrivateKeySize)\n\t\t_, edKey, err := ed25519.GenerateKey(rand.Reader)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"could not generate RSA key\")\n\t\t}\n\t\t// Workaround: store ed25519 as pointer to slice as that is what\n\t\t// golang.org/x/crypto/ssh parsing functions return\n\t\tkey = &edKey\n\t}\n\tlog.Debug(\"generated keypair\")\n\tc.userPrivateKey = key\n\treturn nil\n}", "title": "" }, { "docid": "0ffb23e61cd240eb6c110a29864a2b4a", "score": "0.6383077", "text": "func GenerateKey() []byte {\n\t_, privKey, _ := sign.GenerateKey(rand.Reader)\n\treturn privKey[:]\n}", "title": "" }, { "docid": "360eeb5b2d4233c0c9ed17486a5b01c4", "score": "0.63611794", "text": "func GenerateKey(rand io.Reader) (priv []byte, x,\n\ty *big.Int, err error) {\n\tkey, err := ecdsa.GenerateKey(S256(), rand)\n\tif err != nil {\n\t\treturn\n\t}\n\tpriv = key.D.Bytes()\n\tx = key.PublicKey.X\n\ty = key.PublicKey.Y\n\n\treturn\n}", "title": "" }, { "docid": "d5c44ffee14b981c25bb16148ee2f528", "score": "0.63396466", "text": "func GenerateKey(c elliptic.Curve, rand io.Reader) (*ecdsa.PrivateKey, error) {\n\tk, err := randFieldElement(c, rand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpriv := new(ecdsa.PrivateKey)\n\tpriv.PublicKey.Curve = c\n\tpriv.D = k\n\tpriv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes())\n\treturn priv, nil\n}", "title": "" }, { "docid": "5f8ab36a270a8102805c4bc6eca20f38", "score": "0.6335202", "text": "func GenerateKey()(Key,error) {\n reader := rand.Reader\n\treturn rsa.GenerateKey(reader,2048)\n}", "title": "" }, { "docid": "452d323722dfc2d06c2fe819b07cd01a", "score": "0.6317759", "text": "func GenerateKeyPair() (string, string, error) {\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, KeyBytes*8)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tmPublic, err := x509.MarshalPKIXPublicKey(privateKey.Public())\n\treturn base64.StdEncoding.EncodeToString(x509.MarshalPKCS1PrivateKey(privateKey)),\n\t\tbase64.StdEncoding.EncodeToString(mPublic), err\n}", "title": "" }, { "docid": "db4592defa690c0451826cfe0f3fff3a", "score": "0.63131905", "text": "func GenerateKey(curve elliptic.Curve, rand io.Reader) (*ecdsa.PrivateKey, error) {\n\treturn ecdsa.GenerateKey(curve, rand)\n}", "title": "" }, { "docid": "63c2d1d5dcfe0851f3145552872f0aa1", "score": "0.63072187", "text": "func GeneratePrivateKey() *PrivateKey {\n\tkey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err == nil {\n\t\treturn &PrivateKey{\n\t\t\tPublicKey: PublicKey{x: key.X, y: key.Y},\n\t\t\td: key.D,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "72bb6140c4fa08b2ceed9f5398565940", "score": "0.62902135", "text": "func GeneratePrivateKey() (PrivateKey, error) {\n\t_, privateKey, err := ed25519.GenerateKey(rand.Reader)\n\tif err != nil {\n\t\treturn PrivateKey{}, err\n\t}\n\n\treturn PrivateKey{\n\t\tkeyData: privateKey,\n\t}, nil\n}", "title": "" }, { "docid": "1bd0fd17a0b6b37cc0dae1b0482df229", "score": "0.62870324", "text": "func GenerateKeypair(bits int) ([]byte, []byte, error) {\n\tif bits == 0 || bits%2 != 0 {\n\t\treturn nil, nil, errors.New(\"invalid bits count\")\n\t}\n\n\tvar private bytes.Buffer\n\tvar public []byte\n\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bits)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tprivatePEM := &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}\n\tif err := pem.Encode(&private, privatePEM); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpublicKey, err := ssh.NewPublicKey(&privateKey.PublicKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tpublic = ssh.MarshalAuthorizedKey(publicKey)\n\n\treturn private.Bytes(), public, nil\n}", "title": "" }, { "docid": "f1ce9c669f67839c6e416afd45085e0d", "score": "0.62811124", "text": "func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey) {\n\tprivkey, err := rsa.GenerateKey(rand.Reader, bits)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"\")\n\t}\n\treturn privkey, &privkey.PublicKey\n}", "title": "" }, { "docid": "d2e78a9e0bbbb7376decbd07eef3685a", "score": "0.6280325", "text": "func GeneratePrivateKey(assetsDir, fileName string) ([]byte, error) {\n\tpk, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpemKeyBytes := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(pk),\n\t})\n\n\tkeyFile := path.Join(assetsDir, fileName+\".key\")\n\tif err := ioutil.WriteFile(keyFile, pemKeyBytes, 0600); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to write to %s: %v\", keyFile, err)\n\t}\n\treturn pemKeyBytes, nil\n}", "title": "" }, { "docid": "78d9557f0685ab9c6547264d76c612d7", "score": "0.62781185", "text": "func GenerateRSAKey() (*rsa.PrivateKey, error) {\n\tprivate, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn private, nil\n}", "title": "" }, { "docid": "c3a35ef06c14c4086ced71ae956ee1a6", "score": "0.62469834", "text": "func GenerateCertificateAndKey(options *GenerateOptions) (key *rsa.PrivateKey, err error) {\n\tif options == nil {\n\t\treturn nil, errNoOptions\n\t}\n\n\tif options.FileName == \"\" {\n\t\treturn nil, errNoName\n\t}\n\n\tif options.TemplateCert == nil && options.TemplateCertificateFunc == nil {\n\t\treturn nil, errNoTemplate\n\t}\n\n\tvar (\n\t\tcert *x509.Certificate\n\t\tcertKey *rsa.PrivateKey\n\t\tparentKey *rsa.PrivateKey\n\t\tparentCert *x509.Certificate\n\t\tks int\n\t)\n\tcert = options.TemplateCert\n\tif cert == nil {\n\t\tcert = options.TemplateCertificateFunc()\n\t}\n\n\tks = options.KeyStrength\n\tif ks <= 0 {\n\t\tks = 2048\n\t}\n\n\tif certKey, err = rsa.GenerateKey(crand.Reader, ks); err != nil {\n\t\treturn nil, err\n\t}\n\n\tparentKey = options.ParentKey\n\tif options.ParentKey == nil {\n\t\tparentKey = certKey\n\t}\n\n\tparentCert = options.ParentCert\n\tif options.ParentCert == nil {\n\t\tparentCert = cert\n\t}\n\n\tcreateOpt := &GenerateOptions{\n\t\tFileName: options.FileName,\n\t\tTemplateCert: cert,\n\t\tParentCert: parentCert,\n\t\tParentKey: parentKey,\n\t}\n\n\tif err = createCertFile(certKey, createOpt); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = createKeyFile(certKey, createOpt); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn certKey, nil\n}", "title": "" }, { "docid": "44275668d2ea015fc67ede74d8e54eb8", "score": "0.6236883", "text": "func GenerateKey(name string) Key {\n\tres, err := doRequest(TimeoutTime, \"key/gen?arg=\"+KeySpace+name)\n\tif err != nil {\n\t\tlog.Panicln(\"[ERROR]\", err)\n\t}\n\tkey := new(Key)\n\terr = json.Unmarshal([]byte(res), key)\n\tif err != nil {\n\t\tlog.Panicln(\"[ERROR]\", err)\n\t}\n\treturn *key\n}", "title": "" }, { "docid": "6a0aeb8f06404b51b3a92222b1e6563d", "score": "0.6236686", "text": "func GenerateKey(random io.Reader) (priv *PrivateKey, err error) {\n\tprivBytes := make([]byte, Size)\n\tif _, err = io.ReadFull(random, privBytes); err != nil {\n\t\treturn\n\t}\n\tpriv, err = generateKey(privBytes)\n\n\treturn\n}", "title": "" }, { "docid": "4289b040a9a1bb779423545e5b0f5bc6", "score": "0.6221201", "text": "func GenKey(c ctl.Control, p interface{}) error {\n\tflags := ensureGenKeyFlags(p.(*GenKeyFlags))\n\n\tcryptoprov := c.(*cli.Cli).CryptoProv()\n\n\tif !*flags.Force && *flags.Output != \"\" && fileutil.FileExists(*flags.Output) == nil {\n\t\treturn errors.Errorf(\"%q file exists, specify --force flag to override\", *flags.Output)\n\t}\n\n\tcrypto := cryptoprov.Default()\n\tcsr := csrprov.New(cryptoprov.Default())\n\n\tpurpose := csrprov.Signing\n\tswitch *flags.Purpose {\n\tcase \"s\", \"sign\", \"signing\":\n\t\tpurpose = csrprov.Signing\n\tcase \"e\", \"encrypt\", \"encryption\":\n\t\tpurpose = csrprov.Encryption\n\tdefault:\n\t\treturn errors.Errorf(\"unsupported purpose: %q\", *flags.Purpose)\n\t}\n\n\treq := csr.NewKeyRequest(prefixKeyLabel(*flags.Label), *flags.Algo, *flags.Size, purpose)\n\tprv, err := req.Generate()\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tkeyID, _, err := crypto.IdentifyKey(prv)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\turi, key, err := crypto.ExportKey(keyID)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif key == nil {\n\t\tkey = []byte(uri)\n\t}\n\n\tif *flags.Output == \"\" {\n\t\tcfsslcli.PrintCert(key, nil, nil)\n\t} else {\n\t\terr = cli.WriteFile(*flags.Output, key, 0600)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c84b17b22999518c6a4671f884ea2ae9", "score": "0.6220159", "text": "func generatePrivateKey(certificateSeed seed.CertificateSeed, logger logger.LoggingClient) (crypto.PrivateKey, error) {\n\n\tif certificateSeed.RSAScheme {\n\t\tlogger.Debug(fmt.Sprintf(\"Generating private key with RSA scheme %v\", certificateSeed.RSAKeySize))\n\t\treturn rsa.GenerateKey(rand.Reader, int(certificateSeed.RSAKeySize))\n\t}\n\n\tif certificateSeed.ECScheme {\n\t\tlogger.Debug(fmt.Sprintf(\"Generating private key with EC scheme %v\", certificateSeed.ECCurve))\n\t\tswitch certificateSeed.ECCurve {\n\t\tcase seed.EC_224: // secp224r1 NIST P-224\n\t\t\treturn ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n\t\tcase seed.EC_256: // secp256v1 NIST P-256\n\t\t\treturn ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\t\tcase seed.EC_384: // secp384r1 NIST P-384\n\t\t\treturn ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\t\tcase seed.EC_521: // secp521r1 NIST P-521\n\t\t\treturn ecdsa.GenerateKey(elliptic.P521(), rand.Reader)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Unknown key scheme: RSA[%t] EC[%t]\", certificateSeed.RSAScheme, certificateSeed.ECScheme)\n}", "title": "" }, { "docid": "f1833ab713e7c2c34be31574cd4ed6d4", "score": "0.621972", "text": "func (vrf Ed25519VRF) GenerateKey(rnd io.Reader) (pk PublicKey, sk PrivateKey, err error) {\n\tif rnd == nil {\n\t\trnd = rand.Reader\n\t}\n\tsk = make([]byte, PrivateKeySize)\n\t_, err = io.ReadFull(rnd, sk[:32])\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tx := expandPrivateKey(sk)\n\n\tvar pkP ed.ExtendedGroupElement\n\ted.GeScalarMultBase(&pkP, x)\n\tvar pkBytes [PublicKeySize]byte\n\tpkP.ToBytes(&pkBytes)\n\n\tcopy(sk[32:], pkBytes[:])\n\treturn pkBytes[:], sk, err\n}", "title": "" }, { "docid": "1d9ca5a36e364d2e87beb773bd28a5b0", "score": "0.6209051", "text": "func Generate(conf config.Config, overwrite bool) error {\n\terr := GenerateNewSSHKey(conf.GetCAKeyLocation(), overwrite, true)\n\tif err == nil {\n\t\tlog.Log(conf, fmt.Sprintf(\"Wrote new SSH CA key to %s\", conf.GetCAKeyLocation()))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "ee5a286cf7170f9c88a1bc0028de0ab3", "score": "0.6207464", "text": "func (c *CryptoContext) GenerateKey(name string, id uuid.UUID) error {\n\tk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.storeKey(name, id, k)\n}", "title": "" }, { "docid": "50f2120b5b3765a6bd82f0100f96ac5b", "score": "0.61994463", "text": "func GenerateKeyPair(h func() hash.Hash, seed []byte) (*PublicKey, *PrivateKey, error) {\n\tif len(seed) != 0 && len(seed) != seedSize {\n\t\treturn nil, nil, errors.New(\"invalid size of seed\")\n\t}\n\n\tokm, err := generateOKM(seed, h)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tprivKeyFr := frFromOKM(okm)\n\n\tprivKey := &PrivateKey{privKeyFr}\n\tpubKey := privKey.PublicKey()\n\n\treturn pubKey, privKey, nil\n}", "title": "" }, { "docid": "a55769e7f0d1755bc8c166ed469cea09", "score": "0.61929744", "text": "func GenerateKeys(c *cli.Context) error {\n\t// validate\n\tif !c.IsSet(\"public\") {\n\t\treturn cli.NewExitError(\"public key output file is not provided\", 2)\n\t}\n\tif !c.IsSet(\"private\") {\n\t\treturn cli.NewExitError(\"private key output file is not provided\", 2)\n\t}\n\n\t// open files\n\tprvWriter, err := os.Create(c.String(\"private\"))\n\tdefer prvWriter.Close()\n\tif err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"unable to create private key file %q\\n\", err), 2)\n\t}\n\tpubWriter, err := os.Create(c.String(\"public\"))\n\tdefer pubWriter.Close()\n\tif err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"unable to create public key file %q\\n\", err), 2)\n\t}\n\n\t// generate and write to files\n\tprivate, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"error in generating private key %q\\n\", err), 2)\n\t}\n\tif err := private.Validate(); err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"error in validating private key %q\\n\", err), 2)\n\t}\n\tprvPem := &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(private),\n\t}\n\tpublic := private.Public()\n\tpubCont, err := x509.MarshalPKIXPublicKey(public)\n\tif err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"unable to marshall private key %q\\n\", err), 2)\n\t}\n\tpubPem := &pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: pubCont,\n\t}\n\tif err := pem.Encode(prvWriter, prvPem); err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"unable to write private key %q\\n\", err), 2)\n\t}\n\tif err := pem.Encode(pubWriter, pubPem); err != nil {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"unable to write public key %q\\n\", err), 2)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4def14732d24c9ef749b4cff4b495f90", "score": "0.619183", "text": "func GenKeys() {\n reader := rand.Reader\n bitsize := 2048 // If you change this, change the value of e in crypto/crypto.go\n\n key, or := rsa.GenerateKey(reader, bitsize)\n e.Rr(or, true)\n\n fmt.Println(\"===========Public Key==========\")\n fmt.Println(key.PublicKey.N)\n fmt.Println(\"===============================\")\n fmt.Println(\"===========Private Key=========\")\n fmt.Println(key.D)\n fmt.Println(\"===============================\")\n}", "title": "" }, { "docid": "b219c9889769b8c19b6eb80a535de97b", "score": "0.61836094", "text": "func GenerateKey(r io.Reader) (PrivateKey, error) {\n\n\tc := twistededwards.GetEdwardsCurve()\n\n\tvar pub PublicKey\n\tvar priv PrivateKey\n\n\t// hash(h) = private_key || random_source, on 32 bytes each\n\tseed := make([]byte, 32)\n\t_, err := r.Read(seed)\n\tif err != nil {\n\t\treturn priv, err\n\t}\n\th := blake2b.Sum512(seed[:])\n\tfor i := 0; i < 32; i++ {\n\t\tpriv.randSrc[i] = h[i+32]\n\t}\n\n\t// prune the key\n\t// https://tools.ietf.org/html/rfc8032#section-5.1.5, key generation\n\n\th[0] &= 0xF8\n\th[31] &= 0x7F\n\th[31] |= 0x40\n\n\t// reverse first bytes because setBytes interpret stream as big endian\n\t// but in eddsa specs s is the first 32 bytes in little endian\n\tfor i, j := 0, sizeFr; i < j; i, j = i+1, j-1 {\n\n\t\th[i], h[j] = h[j], h[i]\n\n\t}\n\n\tcopy(priv.scalar[:], h[:sizeFr])\n\n\tvar bscalar big.Int\n\tbscalar.SetBytes(priv.scalar[:])\n\tpub.A.ScalarMul(&c.Base, &bscalar)\n\n\tpriv.PublicKey = pub\n\n\treturn priv, nil\n}", "title": "" }, { "docid": "a7521b854dbff8b6a766e8444009c526", "score": "0.6170252", "text": "func Keygen(secretStr string) (*Keys, error) {\n\t// Because obj-c and golang and.. oh man..\n\tvar keys Keys\n\n\t// Our secret\n\tb := make([]byte, 16)\n\n\t// P256 because that's default in upspin\n\tcurveName := \"p256\"\n\n\tif !validSecretSeed(secretStr) {\n\t\treturn nil, fmt.Errorf(\"Invalid seed\")\n\t}\n\tfor i := 0; i < 8; i++ {\n\t\tbinary.BigEndian.PutUint16(b[2*i:2*i+2], proquint.Decode([]byte((secretStr)[6*i:6*i+5])))\n\t}\n\n\t// Regenerate our keys\n\tpublic, private, err := ee.CreateKeys(curveName, b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkeys.Public = string(public)\n\tkeys.Private = private\n\n\treturn &keys, nil\n}", "title": "" }, { "docid": "a2950e78c3899cc13cc909d5adc7c4da", "score": "0.61691034", "text": "func GenerateKey() ([]byte, error) {\n\treturn GenRandBytes(KeySize)\n}", "title": "" }, { "docid": "776a9b0549d7eeafab828fd4edf23587", "score": "0.6167423", "text": "func GeneratePrivateKey() (crypto.Signer, string, error) {\n\tvar pk *ecdsa.PrivateKey\n\n\tpk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"error generating private key: %s\", err)\n\t}\n\n\tbs, err := x509.MarshalECPrivateKey(pk)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"error generating private key: %s\", err)\n\t}\n\n\tvar buf bytes.Buffer\n\terr = pem.Encode(&buf, &pem.Block{Type: \"EC PRIVATE KEY\", Bytes: bs})\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"error encoding private key: %s\", err)\n\t}\n\n\treturn pk, buf.String(), nil\n}", "title": "" }, { "docid": "048d9ead63dcfca988262cb819800412", "score": "0.61338437", "text": "func (w *BaseWallet) GenerateNewKeyPair() (string, string, error) {\n\tprivKey, err := prototype.GenerateNewKey()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpubKey, err := privKey.PubKey()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tprivKeyStr := privKey.ToWIF()\n\tpubKeyStr := pubKey.ToWIF()\n\treturn pubKeyStr, privKeyStr, nil\n}", "title": "" }, { "docid": "2233fc3620bfe70d143af736a8d7e21c", "score": "0.61216384", "text": "func GenerateKeyPair(r io.Reader) (*PrivateKey, *PublicKey, error) {\n\tpub := new(PublicKey)\n\tpriv := new(PrivateKey)\n\terr := kexGenerateKeypair(r, &rlweARef, &priv.privateKey, &pub.publicKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn priv, pub, nil\n}", "title": "" }, { "docid": "01eba53abb03d4409662787a4daf62cc", "score": "0.6118198", "text": "func GenerateKeyPair(bits int) (string, string, error) {\n\tpriv, _ := rsa.GenerateKey(rand.Reader, bits)\n\tprivPem, err := pemBlockForPriv(priv)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpubPem, err := pemBlockForPub(&priv.PublicKey)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn privPem, pubPem, nil\n}", "title": "" }, { "docid": "71ac3672f45eb2fcffd513f3ff9e8992", "score": "0.6113163", "text": "func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) {\n\tif rand == nil {\n\t\trand = cryptorand.Reader\n\t}\n\n\tseed := make([]byte, SeedSize)\n\tif _, err := io.ReadFull(rand, seed); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tprivateKey := NewKeyFromSeed(seed)\n\tpublicKey := make([]byte, PublicKeySize)\n\tcopy(publicKey, privateKey[32:])\n\n\treturn publicKey, privateKey, nil\n}", "title": "" }, { "docid": "71ac3672f45eb2fcffd513f3ff9e8992", "score": "0.6113163", "text": "func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) {\n\tif rand == nil {\n\t\trand = cryptorand.Reader\n\t}\n\n\tseed := make([]byte, SeedSize)\n\tif _, err := io.ReadFull(rand, seed); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tprivateKey := NewKeyFromSeed(seed)\n\tpublicKey := make([]byte, PublicKeySize)\n\tcopy(publicKey, privateKey[32:])\n\n\treturn publicKey, privateKey, nil\n}", "title": "" }, { "docid": "2a1890606872dbea6860d293bdd27dbb", "score": "0.61117804", "text": "func Keygen(datadir string) (*ecdsa.PrivateKey, error) {\n\tpemKey := crypto.NewPemKey(datadir)\n\n\t_, err := pemKey.ReadKey()\n\n\tif err == nil {\n\t\treturn nil, fmt.Errorf(\"another key already lives under %s\", datadir)\n\t}\n\n\tprivKey, err := crypto.GenerateECDSAKey()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := pemKey.WriteKey(privKey); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privKey, nil\n}", "title": "" }, { "docid": "a5a42809e68ca40793c249b64909f7ed", "score": "0.6111463", "text": "func Generate() (vapidPrivateKey string, vapidPublicKey string, err error) {\n\tcurve := ecdh.GenericCurve(elliptic.P256())\n\tprivateKey, publicKey, err := curve.GenerateKey(nil)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tprivKey := base64.RawURLEncoding.EncodeToString(privateKey)\n\tpubKey := base64.RawURLEncoding.EncodeToString(publicKey)\n\treturn privKey, pubKey, nil\n}", "title": "" }, { "docid": "f3bb8f7c1d02f88d6fcb155c05f10c3e", "score": "0.61049265", "text": "func GenerateKeyPair() (*PrivateKey, *PublicKey, error) {\n\tecdsaKey, err := crypto.GenerateKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn (*PrivateKey)(ecdsaKey), (*PublicKey)(&ecdsaKey.PublicKey), nil\n}", "title": "" }, { "docid": "77975c3fcbab986bc7a466c9a0d2ca6d", "score": "0.6103064", "text": "func (key *Key) GenerateKey(wrapkey *Key) (err error) {\n\terr = tspiError(C.Tspi_Key_CreateKey((C.TSS_HKEY)(key.handle), (C.TSS_HKEY)(wrapkey.handle), 0))\n\treturn err\n}", "title": "" }, { "docid": "90e81d4cfed8b72ed0d16f08b2859a89", "score": "0.6093487", "text": "func CreateKey(t require.TestingT) *rsa.PrivateKey {\n\tkey, err := GenerateKey()\n\trequire.NoError(t, err)\n\n\treturn key\n}", "title": "" }, { "docid": "71a01a4e5d59c77e5c3b2e021c32e58d", "score": "0.60903543", "text": "func RSAGenerateKey(exponent, bits int) (*RSAPrivateKey, error) {\n\te := big.NewInt(int64(exponent))\n\tif exponent < 3 || !e.ProbablyPrime(0) {\n\t\treturn nil, errors.New(\"RSAGenerateKey: invalid exponent\")\n\t}\nRetry:\n\tp, err := rand.Prime(rand.Reader, bits/2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq, err := rand.Prime(rand.Reader, bits/2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif equal(p, q) {\n\t\tgoto Retry\n\t}\n\tpMinusOne := new(big.Int).Sub(p, one)\n\tqMinusOne := new(big.Int).Sub(q, one)\n\ttotient := pMinusOne.Mul(pMinusOne, qMinusOne)\n\td := new(big.Int)\n\tif gcd := new(big.Int).GCD(d, nil, e, totient); !equal(gcd, one) {\n\t\tgoto Retry\n\t}\n\tif d.Sign() < 0 {\n\t\td.Add(d, totient)\n\t}\n\treturn &RSAPrivateKey{\n\t\tRSAPublicKey{\n\t\t\tn: p.Mul(p, q),\n\t\t\te: e,\n\t\t},\n\t\td,\n\t}, nil\n}", "title": "" }, { "docid": "a2cdc5f4d97971a3c51ca65824846120", "score": "0.60897416", "text": "func (r *RR_DNSKEY) Generate(bits int) (PrivateKey, error) {\n\tswitch r.Algorithm {\n\tcase RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1:\n\t\tif bits < 512 || bits > 4096 {\n\t\t\treturn nil, ErrKeySize\n\t\t}\n\tcase RSASHA512:\n\t\tif bits < 1024 || bits > 4096 {\n\t\t\treturn nil, ErrKeySize\n\t\t}\n\tcase ECDSAP256SHA256:\n\t\tif bits != 256 {\n\t\t\treturn nil, ErrKeySize\n\t\t}\n\tcase ECDSAP384SHA384:\n\t\tif bits != 384 {\n\t\t\treturn nil, ErrKeySize\n\t\t}\n\t}\n\n\tswitch r.Algorithm {\n\tcase RSAMD5, RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1:\n\t\tpriv, err := rsa.GenerateKey(rand.Reader, bits)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.setPublicKeyRSA(priv.PublicKey.E, priv.PublicKey.N)\n\t\treturn priv, nil\n\tcase ECDSAP256SHA256, ECDSAP384SHA384:\n\t\tvar c elliptic.Curve\n\t\tswitch r.Algorithm {\n\t\tcase ECDSAP256SHA256:\n\t\t\tc = elliptic.P256()\n\t\tcase ECDSAP384SHA384:\n\t\t\tc = elliptic.P384()\n\t\t}\n\t\tpriv, err := ecdsa.GenerateKey(c, rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.setPublicKeyCurve(priv.PublicKey.X, priv.PublicKey.Y)\n\t\treturn priv, nil\n\tdefault:\n\t\treturn nil, ErrAlg\n\t}\n\treturn nil, nil // Dummy return\n}", "title": "" }, { "docid": "7c6b95074e0764d801c9ac82f4908ac3", "score": "0.60776615", "text": "func (d *Driver) generateSSHKey(ctx *azureutil.DeploymentContext) error {\n\tprivPath := d.GetSSHKeyPath()\n\tpubPath := privPath + \".pub\"\n\n\tlog.Debug(\"Creating SSH key...\", logutil.Fields{\n\t\t\"pub\": pubPath,\n\t\t\"priv\": privPath,\n\t})\n\n\tif err := ssh.GenerateSSHKey(privPath); err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"SSH key pair generated.\")\n\n\tpublicKey, err := ioutil.ReadFile(pubPath)\n\tctx.SSHPublicKey = string(publicKey)\n\treturn err\n}", "title": "" }, { "docid": "3554603e2a3ebdcfc8af59ca59b32a23", "score": "0.6074492", "text": "func genKeys() (*rsa.PrivateKey, string, error) {\n\treader := rand.Reader\n\tbitSize := 2048\n\tprivateKey, err := rsa.GenerateKey(reader, bitSize)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tpkBytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tpem := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: pkBytes,\n\t})\n\treturn privateKey, string(pem), nil\n}", "title": "" }, { "docid": "235b4e33e9cad4d3cd9eddfa4f9dc63b", "score": "0.60663605", "text": "func generatePublicKey(privKey, pubKey string) error {\n\treturn openssl(\"rsa\", \"-in\", privKey, \"-out\", pubKey, \"-pubout\")\n}", "title": "" }, { "docid": "380465d6813306d0dd9a3fc823541a60", "score": "0.606141", "text": "func GenerateKeyPair() (*ecdsa.PrivateKey, error) {\n\treturn ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n}", "title": "" }, { "docid": "8fafcb77fa3bc74e63f31665eb12483a", "score": "0.60447955", "text": "func GenerateKey() (ssh.Signer, error) {\n\tpk, err := libtrust.GenerateECP521PrivateKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := ssh.NewSignerFromKey(pk.CryptoPrivateKey())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "5901df671f661999ebc6873faf9400e7", "score": "0.60323894", "text": "func KeyGen(curve CurveSystem) (*big.Int, Point, Point, error) {\n\t//Create private key\n\tx, err := rand.Int(rand.Reader, curve.GetG1Order())\n\n\t//Check for error\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t//Compute public key\n\tW, X := ComputePublicKey(curve, x)\n\n\treturn x, W, X, nil\n}", "title": "" }, { "docid": "db4c226bf5f9735e736b1063b51d1170", "score": "0.6028209", "text": "func (s *SymmetricKey) GenerateKey(keyJSON *RawKeyJSON) error {\n\n\t*s = SymmetricKey{\n\t\tStandardHeaders: &keyJSON.StandardHeaders,\n\t\tkey: keyJSON.K,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edde76fb52afe8ae14cd6b50d5f0e1fc", "score": "0.6012811", "text": "func (t *Tkm) DhGenerateKey(theirPublic *big.Int) (err error) {\n\tt.DhShared, err = t.suite.DhGroup.DiffieHellman(theirPublic, t.dhPrivate)\n\treturn\n}", "title": "" }, { "docid": "997142b3854b3af51e8e5aa282de1726", "score": "0.5999212", "text": "func GenerateNewSSHKey(filename string, overwrite bool, printPubKey bool) error {\n\t_, err := os.Stat(filename)\n\tif err == nil {\n\t\tif overwrite {\n\t\t\terr := os.Remove(filename)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"Refusing to overwrite existing key (try with FORCE_WRITE=true if you're sure): %s\", filename)\n\t\t}\n\t}\n\n\terr = generateNewSSHKey(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif printPubKey {\n\t\tbytes, err := ioutil.ReadFile(shared.KeyPathToPubKey(filename))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Generated new public key: \\n%s\\n\", string(bytes))\n\t}\n\n\treturn nil\n}", "title": "" } ]
c356c3f6c01fca298c0ff643f4c946aa
SubmitContactEvaluationWithContext is the same as SubmitContactEvaluation with the addition of the ability to pass a context and additional request options. See SubmitContactEvaluation for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create subcontexts for http.Requests. See for more information on using Contexts.
[ { "docid": "41972c42e86aa28426795b36e79b2493", "score": "0.8565474", "text": "func (c *Connect) SubmitContactEvaluationWithContext(ctx aws.Context, input *SubmitContactEvaluationInput, opts ...request.Option) (*SubmitContactEvaluationOutput, error) {\n\treq, out := c.SubmitContactEvaluationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" } ]
[ { "docid": "3c00d9d4ad04f8c45318534a56f64bd6", "score": "0.6395414", "text": "func (c *Connect) UpdateContactEvaluationWithContext(ctx aws.Context, input *UpdateContactEvaluationInput, opts ...request.Option) (*UpdateContactEvaluationOutput, error) {\n\treq, out := c.UpdateContactEvaluationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "b1532364a054d2aab7e939b66b916788", "score": "0.63468057", "text": "func (c *Connect) StartContactEvaluationWithContext(ctx aws.Context, input *StartContactEvaluationInput, opts ...request.Option) (*StartContactEvaluationOutput, error) {\n\treq, out := c.StartContactEvaluationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "0944b9ca96c5efca1e1d5f465c732e37", "score": "0.55201876", "text": "func (c *Connect) DeleteContactEvaluationWithContext(ctx aws.Context, input *DeleteContactEvaluationInput, opts ...request.Option) (*DeleteContactEvaluationOutput, error) {\n\treq, out := c.DeleteContactEvaluationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d7253fd22f5640927fff3fbf0807f6cb", "score": "0.54286826", "text": "func (c *CodeGuruProfiler) SubmitFeedbackWithContext(ctx aws.Context, input *SubmitFeedbackInput, opts ...request.Option) (*SubmitFeedbackOutput, error) {\n\treq, out := c.SubmitFeedbackRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "9ea438b0d7ec84948fab692c64062406", "score": "0.5070001", "text": "func (c *Connect) ActivateEvaluationFormWithContext(ctx aws.Context, input *ActivateEvaluationFormInput, opts ...request.Option) (*ActivateEvaluationFormOutput, error) {\n\treq, out := c.ActivateEvaluationFormRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "974d34ea9835e7f73a149c7557bc1707", "score": "0.4920611", "text": "func (c *Connect) DescribeContactEvaluationWithContext(ctx aws.Context, input *DescribeContactEvaluationInput, opts ...request.Option) (*DescribeContactEvaluationOutput, error) {\n\treq, out := c.DescribeContactEvaluationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "fc9bb2e2141178214ccf687ef52a9001", "score": "0.47685772", "text": "func (c *Connect) CreateEvaluationFormWithContext(ctx aws.Context, input *CreateEvaluationFormInput, opts ...request.Option) (*CreateEvaluationFormOutput, error) {\n\treq, out := c.CreateEvaluationFormRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "17e01f2efa93457a63a3ee68a5a275ed", "score": "0.47139946", "text": "func (c *Connect) ListContactEvaluationsWithContext(ctx aws.Context, input *ListContactEvaluationsInput, opts ...request.Option) (*ListContactEvaluationsOutput, error) {\n\treq, out := c.ListContactEvaluationsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e4f53a3da1d497ad869abcbcbdb02b5a", "score": "0.44456762", "text": "func (b *PrometheusSpecApplyConfiguration) WithEvaluationInterval(value monitoringv1.Duration) *PrometheusSpecApplyConfiguration {\n\tb.EvaluationInterval = &value\n\treturn b\n}", "title": "" }, { "docid": "318492fbe6c705ce02455af464b92204", "score": "0.4371077", "text": "func (c *Connect) UpdateEvaluationFormWithContext(ctx aws.Context, input *UpdateEvaluationFormInput, opts ...request.Option) (*UpdateEvaluationFormOutput, error) {\n\treq, out := c.UpdateEvaluationFormRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "8965577f40b4b74e14d4e80420294e6d", "score": "0.42400435", "text": "func (c *SageMaker) SendPipelineExecutionStepFailureWithContext(ctx aws.Context, input *SendPipelineExecutionStepFailureInput, opts ...request.Option) (*SendPipelineExecutionStepFailureOutput, error) {\n\treq, out := c.SendPipelineExecutionStepFailureRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "252c6445ca66c350a60dd9c8151a5ae4", "score": "0.42236125", "text": "func (c *Connect) CreateContactFlowModuleWithContext(ctx aws.Context, input *CreateContactFlowModuleInput, opts ...request.Option) (*CreateContactFlowModuleOutput, error) {\n\treq, out := c.CreateContactFlowModuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "da04a4f06902e59c83d4f6b76b64a38e", "score": "0.41223884", "text": "func (c *ECS) SubmitContainerStateChangeWithContext(ctx aws.Context, input *SubmitContainerStateChangeInput, opts ...request.Option) (*SubmitContainerStateChangeOutput, error) {\n\treq, out := c.SubmitContainerStateChangeRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "80e8900d61783c1fee87ec4279005192", "score": "0.41167203", "text": "func (c *MediaTailor) PutChannelPolicyWithContext(ctx aws.Context, input *PutChannelPolicyInput, opts ...request.Option) (*PutChannelPolicyOutput, error) {\n\treq, out := c.PutChannelPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "fccce506b173dff0275c9357079503fe", "score": "0.41099882", "text": "func (s *DescribeContactEvaluationOutput) SetEvaluation(v *Evaluation) *DescribeContactEvaluationOutput {\n\ts.Evaluation = v\n\treturn s\n}", "title": "" }, { "docid": "7d79bf0c1837ee39c36c2ac2e019ded2", "score": "0.40845108", "text": "func (c *Connect) SuspendContactRecordingWithContext(ctx aws.Context, input *SuspendContactRecordingInput, opts ...request.Option) (*SuspendContactRecordingOutput, error) {\n\treq, out := c.SuspendContactRecordingRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "f5ca581ec9f75d67504a6d4f5cd18fed", "score": "0.40720814", "text": "func (c *Connect) ResumeContactRecordingWithContext(ctx aws.Context, input *ResumeContactRecordingInput, opts ...request.Option) (*ResumeContactRecordingOutput, error) {\n\treq, out := c.ResumeContactRecordingRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "814be8cb7a27bdf79287ef4012729e4f", "score": "0.40584156", "text": "func (c *Connect) UpdateRoutingProfileConcurrencyWithContext(ctx aws.Context, input *UpdateRoutingProfileConcurrencyInput, opts ...request.Option) (*UpdateRoutingProfileConcurrencyOutput, error) {\n\treq, out := c.UpdateRoutingProfileConcurrencyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "1f32eb7f075cd32d237bce5a3e0fa8e0", "score": "0.40428165", "text": "func (c *Connect) DeleteEvaluationFormWithContext(ctx aws.Context, input *DeleteEvaluationFormInput, opts ...request.Option) (*DeleteEvaluationFormOutput, error) {\n\treq, out := c.DeleteEvaluationFormRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "08f1a75acdfed232a53515ab7ac43f1b", "score": "0.40232688", "text": "func (c *Connect) StartContactRecordingWithContext(ctx aws.Context, input *StartContactRecordingInput, opts ...request.Option) (*StartContactRecordingOutput, error) {\n\treq, out := c.StartContactRecordingRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "36822dc8cb64405fa5a2dd88d6b35edc", "score": "0.40008983", "text": "func (c *Connect) CreateContactFlowWithContext(ctx aws.Context, input *CreateContactFlowInput, opts ...request.Option) (*CreateContactFlowOutput, error) {\n\treq, out := c.CreateContactFlowRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d4c56f4770ea2ae4c5f740c71dceecd0", "score": "0.3998861", "text": "func (c *Connect) AssociatePhoneNumberContactFlowWithContext(ctx aws.Context, input *AssociatePhoneNumberContactFlowInput, opts ...request.Option) (*AssociatePhoneNumberContactFlowOutput, error) {\n\treq, out := c.AssociatePhoneNumberContactFlowRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "4de4fd5562201a3bbab3eaccaa834660", "score": "0.3961357", "text": "func NewForumKickBanFireteamApplicantParamsWithContext(ctx context.Context) *ForumKickBanFireteamApplicantParams {\n\tvar ()\n\treturn &ForumKickBanFireteamApplicantParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "720f0a6e2a3151eb20356dced92bae77", "score": "0.3931023", "text": "func (c *Route53RecoveryControlConfig) CreateSafetyRuleWithContext(ctx aws.Context, input *CreateSafetyRuleInput, opts ...request.Option) (*CreateSafetyRuleOutput, error) {\n\treq, out := c.CreateSafetyRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "9e5e3a2a2a2df8f374f3b2f1be9bb298", "score": "0.39236408", "text": "func (c *SageMaker) UpdatePipelineExecutionWithContext(ctx aws.Context, input *UpdatePipelineExecutionInput, opts ...request.Option) (*UpdatePipelineExecutionOutput, error) {\n\treq, out := c.UpdatePipelineExecutionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "63e7b3a12b4bdf651572dbacf137684b", "score": "0.38968208", "text": "func NewRecoverySubmitParamsWithContext(ctx context.Context) *RecoverySubmitParams {\n\tvar ()\n\treturn &RecoverySubmitParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "52b647704325a0d45f7c6a6917ff935c", "score": "0.38963613", "text": "func (o *CreateDealSubmissionRequest) WithContext(ctx context.Context) *CreateDealSubmissionRequest {\n\to.Context = ctx\n\treturn o\n}", "title": "" }, { "docid": "3586282dca0a186dd070fe1ba5f5654f", "score": "0.38947433", "text": "func (c *SageMaker) RetryPipelineExecutionWithContext(ctx aws.Context, input *RetryPipelineExecutionInput, opts ...request.Option) (*RetryPipelineExecutionOutput, error) {\n\treq, out := c.RetryPipelineExecutionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "4c87074cfabdef62f1964154de940312", "score": "0.38880038", "text": "func (c *Connect) CreateUseCaseWithContext(ctx aws.Context, input *CreateUseCaseInput, opts ...request.Option) (*CreateUseCaseOutput, error) {\n\treq, out := c.CreateUseCaseRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "3a0833328bd2d6abbd87ac649f9414c4", "score": "0.3877453", "text": "func (c *Connect) ListContactEvaluationsPagesWithContext(ctx aws.Context, input *ListContactEvaluationsInput, fn func(*ListContactEvaluationsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListContactEvaluationsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListContactEvaluationsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListContactEvaluationsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "96f20121b5028d6a3e16e0107c9718b6", "score": "0.3874421", "text": "func (c *Connect) ListEvaluationFormsWithContext(ctx aws.Context, input *ListEvaluationFormsInput, opts ...request.Option) (*ListEvaluationFormsOutput, error) {\n\treq, out := c.ListEvaluationFormsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "f45beabf7cfe597eb072cc82b5352c39", "score": "0.38439354", "text": "func (c *SageMaker) CreateModelQualityJobDefinitionWithContext(ctx aws.Context, input *CreateModelQualityJobDefinitionInput, opts ...request.Option) (*CreateModelQualityJobDefinitionOutput, error) {\n\treq, out := c.CreateModelQualityJobDefinitionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5214be1e84df8074e6923c58f9950d30", "score": "0.38317293", "text": "func (c *SageMaker) UpdatePipelineWithContext(ctx aws.Context, input *UpdatePipelineInput, opts ...request.Option) (*UpdatePipelineOutput, error) {\n\treq, out := c.UpdatePipelineRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "89a49a47de61c19a42ee5c66bc9c8a57", "score": "0.38239115", "text": "func (c *SageMaker) CreateWorkforceWithContext(ctx aws.Context, input *CreateWorkforceInput, opts ...request.Option) (*CreateWorkforceOutput, error) {\n\treq, out := c.CreateWorkforceRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d1466ece886c98ba8b7d8fbc430bcbce", "score": "0.3790813", "text": "func NewUpdateContactMethodParamsWithContext(ctx context.Context) *UpdateContactMethodParams {\n\tvar ()\n\treturn &UpdateContactMethodParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "c87494105eea6a503a4438701cc20d24", "score": "0.3783117", "text": "func (c *ElasticTranscoder) UpdatePipelineWithContext(ctx aws.Context, input *UpdatePipelineInput, opts ...request.Option) (*UpdatePipelineOutput, error) {\n\treq, out := c.UpdatePipelineRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "0d59dab4c10ec88917b3be98acfd5063", "score": "0.37763074", "text": "func WithEvalContext[T any](ctx context.Context, state T, f func(ctx context.Context, state T) error) error {\r\n\t_, ok := ctxutil.Value(ctx, (*exprEvaluator)(nil)).(*exprEvaluator)\r\n\tif !ok {\r\n\t\teev := exprEvaluators.Get()\r\n\t\tdefer exprEvaluators.Put(eev)\r\n\t\tee := eev.(*exprEvaluator)\r\n\t\tctx = ctxutil.WithValue(ctx, ee.ContextKey(), eev)\r\n\t}\r\n\treturn f(ctx, state)\r\n}", "title": "" }, { "docid": "7835d29614f440df49a178d18d3edc10", "score": "0.37352258", "text": "func (mr *MockClientMockRecorder) CreateCommentWithContext(ctx, org, repo, number, comment interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateCommentWithContext\", reflect.TypeOf((*MockClient)(nil).CreateCommentWithContext), ctx, org, repo, number, comment)\n}", "title": "" }, { "docid": "73f47ec6009e981b79028f1e1bbcb15b", "score": "0.3733266", "text": "func (c *Krds) CreateSecurityGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.CreateSecurityGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "aef4aad563368c8b54c8d3b40896e6f8", "score": "0.3728527", "text": "func (c *CodeGuruProfiler) PostAgentProfileWithContext(ctx aws.Context, input *PostAgentProfileInput, opts ...request.Option) (*PostAgentProfileOutput, error) {\n\treq, out := c.PostAgentProfileRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e74d48333ee3c0d4f56fedfd5f11f25c", "score": "0.3721517", "text": "func (c *SMS) PutAppValidationConfigurationWithContext(ctx aws.Context, input *PutAppValidationConfigurationInput, opts ...request.Option) (*PutAppValidationConfigurationOutput, error) {\n\treq, out := c.PutAppValidationConfigurationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "f2fb5d0cb7a4934b91536ed1de08dd80", "score": "0.37209296", "text": "func (c *SageMaker) CreateTrialComponentWithContext(ctx aws.Context, input *CreateTrialComponentInput, opts ...request.Option) (*CreateTrialComponentOutput, error) {\n\treq, out := c.CreateTrialComponentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e30e2ed902af26be38a731b022e3d85a", "score": "0.37202612", "text": "func (c *Connect) DeactivateEvaluationFormWithContext(ctx aws.Context, input *DeactivateEvaluationFormInput, opts ...request.Option) (*DeactivateEvaluationFormOutput, error) {\n\treq, out := c.DeactivateEvaluationFormRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "3191b7c256338bffe01fbf773c772fd8", "score": "0.37180156", "text": "func (c *Connect) UpdateContactScheduleWithContext(ctx aws.Context, input *UpdateContactScheduleInput, opts ...request.Option) (*UpdateContactScheduleOutput, error) {\n\treq, out := c.UpdateContactScheduleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "bf97e60e20cbd9064bc1225fd7a959c7", "score": "0.37135178", "text": "func (e *Edge) CreateTraceObserverWithContext(ctx context.Context, accountID int, name string, providerRegion EdgeProviderRegion) (*EdgeTraceObserver, error) {\n\tresp := createTraceObserverResponse{}\n\tvars := map[string]interface{}{\n\t\t\"accountId\": accountID,\n\t\t\"traceObserverConfigs\": []EdgeCreateTraceObserverInput{{true, name, providerRegion}},\n\t}\n\n\tif err := e.client.NerdGraphQueryWithContext(ctx, createTraceObserverMutation, vars, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\terrors := resp.EdgeCreateTraceObserver.Responses[0].Errors\n\tif len(errors) > 0 {\n\t\treturn nil, fmt.Errorf(\"error creating trace observer: %s\", errors[0].Message)\n\t}\n\n\treturn &resp.EdgeCreateTraceObserver.Responses[0].TraceObserver, nil\n}", "title": "" }, { "docid": "f169626101fab49974348a49de594958", "score": "0.37087336", "text": "func (s *Synthetics) UpdateSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error) {\n\tsc := &SecureCredential{\n\t\tKey: key,\n\t\tValue: value,\n\t\tDescription: description,\n\t}\n\n\t_, err := s.client.PutWithContext(ctx, s.config.Region().SyntheticsURL(\"/v1/secure-credentials\", key), nil, sc, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sc, nil\n}", "title": "" }, { "docid": "bda47a1a2f53def35d7b1bde37f2e044", "score": "0.370274", "text": "func (mr *MockCommentClientMockRecorder) CreateCommentWithContext(ctx, org, repo, number, comment interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateCommentWithContext\", reflect.TypeOf((*MockCommentClient)(nil).CreateCommentWithContext), ctx, org, repo, number, comment)\n}", "title": "" }, { "docid": "b3b7e4230f5ee780c19da1549855ca32", "score": "0.36817068", "text": "func (c *DataExchange) CreateRevisionWithContext(ctx aws.Context, input *CreateRevisionInput, opts ...request.Option) (*CreateRevisionOutput, error) {\n\treq, out := c.CreateRevisionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5bb6696f0c83e888c1888215e7131588", "score": "0.36740926", "text": "func (c *Connect) TransferContactWithContext(ctx aws.Context, input *TransferContactInput, opts ...request.Option) (*TransferContactOutput, error) {\n\treq, out := c.TransferContactRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "59a097b9a636eef72d196a1f45796b5b", "score": "0.3659683", "text": "func (c *SageMaker) StartPipelineExecutionWithContext(ctx aws.Context, input *StartPipelineExecutionInput, opts ...request.Option) (*StartPipelineExecutionOutput, error) {\n\treq, out := c.StartPipelineExecutionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "6e0366d557905791afc6ba5808ad345a", "score": "0.36545244", "text": "func (c *Mongodb) AddSecurityGroupRuleWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.AddSecurityGroupRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "8d79e091378539b6128fa2814f3deb10", "score": "0.36468485", "text": "func (s *Synthetics) AddSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error) {\n\tsc := &SecureCredential{\n\t\tKey: key,\n\t\tValue: value,\n\t\tDescription: description,\n\t}\n\n\t_, err := s.client.PostWithContext(ctx, s.config.Region().SyntheticsURL(\"/v1/secure-credentials\"), nil, sc, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sc, nil\n}", "title": "" }, { "docid": "032c6136b382220935a62e456d962f93", "score": "0.36416292", "text": "func (c *Connect) StartOutboundVoiceContactWithContext(ctx aws.Context, input *StartOutboundVoiceContactInput, opts ...request.Option) (*StartOutboundVoiceContactOutput, error) {\n\treq, out := c.StartOutboundVoiceContactRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "78789ce1704ce53b7ce1ff038d9a36a1", "score": "0.36391905", "text": "func NewEvaluation(ctx *pulumi.Context,\n\tname string, args *EvaluationArgs, opts ...pulumi.ResourceOption) (*Evaluation, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ConversationModelId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ConversationModelId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"conversationModelId\",\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Evaluation\n\terr := ctx.RegisterResource(\"google-native:dialogflow/v2:Evaluation\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "efe04e185e97dc9d7f766d55e8fea072", "score": "0.36336946", "text": "func (c *Connect) StartChatContactWithContext(ctx aws.Context, input *StartChatContactInput, opts ...request.Option) (*StartChatContactOutput, error) {\n\treq, out := c.StartChatContactRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "2c4b38370d87506e8fc6f363d8456b3c", "score": "0.36334127", "text": "func (c *Connect) StopContactRecordingWithContext(ctx aws.Context, input *StopContactRecordingInput, opts ...request.Option) (*StopContactRecordingOutput, error) {\n\treq, out := c.StopContactRecordingRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "eef7a1f64c9d0f22470bffea31721202", "score": "0.36264604", "text": "func (c *SageMaker) UpdateTrialWithContext(ctx aws.Context, input *UpdateTrialInput, opts ...request.Option) (*UpdateTrialOutput, error) {\n\treq, out := c.UpdateTrialRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "c207b4e8e2158ee0e64bfc5581a19f1f", "score": "0.36241663", "text": "func (c *Connect) AssociateLambdaFunctionWithContext(ctx aws.Context, input *AssociateLambdaFunctionInput, opts ...request.Option) (*AssociateLambdaFunctionOutput, error) {\n\treq, out := c.AssociateLambdaFunctionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5004c55c2bf4c0aca62644c448a5b3ac", "score": "0.36222726", "text": "func (c *WAF) PutPermissionPolicyWithContext(ctx aws.Context, input *PutPermissionPolicyInput, opts ...request.Option) (*PutPermissionPolicyOutput, error) {\n\treq, out := c.PutPermissionPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5f92d5459096db91b1aa6ea70d6ea2d6", "score": "0.3617183", "text": "func (c *WAF) CreateRateBasedRuleWithContext(ctx aws.Context, input *CreateRateBasedRuleInput, opts ...request.Option) (*CreateRateBasedRuleOutput, error) {\n\treq, out := c.CreateRateBasedRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "88681fa3b243d56ef64f6a8fe06466fc", "score": "0.36040607", "text": "func (c *Route53Resolver) CreateResolverEndpointWithContext(ctx aws.Context, input *CreateResolverEndpointInput, opts ...request.Option) (*CreateResolverEndpointOutput, error) {\n\treq, out := c.CreateResolverEndpointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "88681fa3b243d56ef64f6a8fe06466fc", "score": "0.36040607", "text": "func (c *Route53Resolver) CreateResolverEndpointWithContext(ctx aws.Context, input *CreateResolverEndpointInput, opts ...request.Option) (*CreateResolverEndpointOutput, error) {\n\treq, out := c.CreateResolverEndpointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d0160fb1e1f856fbd26a13eb4db08989", "score": "0.36014435", "text": "func (c *LexModelsV2) StartBotRecommendationWithContext(ctx aws.Context, input *StartBotRecommendationInput, opts ...request.Option) (*StartBotRecommendationOutput, error) {\n\treq, out := c.StartBotRecommendationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "7820a95df257c9f26f45ef9c7afc87ca", "score": "0.36003545", "text": "func NewUpdateCredentialParamsWithContext(ctx context.Context) *UpdateCredentialParams {\n\tvar ()\n\treturn &UpdateCredentialParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "f6f17de67c6011f80e5cbe90b209de2f", "score": "0.35940886", "text": "func (c *Connect) CreateSecurityProfileWithContext(ctx aws.Context, input *CreateSecurityProfileInput, opts ...request.Option) (*CreateSecurityProfileOutput, error) {\n\treq, out := c.CreateSecurityProfileRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "3b4c8b32846098dd9436fa9e91353fa2", "score": "0.35940298", "text": "func (c *MediaTailor) CreateChannelWithContext(ctx aws.Context, input *CreateChannelInput, opts ...request.Option) (*CreateChannelOutput, error) {\n\treq, out := c.CreateChannelRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "93a57e32499b16e421c52ed099a64181", "score": "0.35901222", "text": "func (c *SageMaker) CreatePipelineWithContext(ctx aws.Context, input *CreatePipelineInput, opts ...request.Option) (*CreatePipelineOutput, error) {\n\treq, out := c.CreatePipelineRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "69b63c170d609a83a27fd99473a8ad66", "score": "0.3585636", "text": "func (c *Client) CreateEWalletChargeWithContext(ctx context.Context, data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error) {\n\tif err := validator.ValidateRequired(ctx, data); err != nil {\n\t\treturn nil, validator.APIValidatorErr(err)\n\t}\n\n\tresponse := &xendit.EWalletCharge{}\n\theader := &http.Header{}\n\n\tif data.ForUserID != \"\" {\n\t\theader.Add(\"for-user-id\", data.ForUserID)\n\t}\n\tif data.WithFeeRule != \"\" {\n\t\theader.Add(\"with-fee-rule\", data.WithFeeRule)\n\t}\n\n\terr := c.APIRequester.Call(\n\t\tctx,\n\t\t\"POST\",\n\t\tfmt.Sprintf(\"%s/ewallets/charges\", c.Opt.XenditURL),\n\t\tc.Opt.SecretKey,\n\t\theader,\n\t\tdata,\n\t\tresponse,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "f6e33e5c6c41f09e5236668f89d424c5", "score": "0.35842624", "text": "func (c *SageMaker) CreateDataQualityJobDefinitionWithContext(ctx aws.Context, input *CreateDataQualityJobDefinitionInput, opts ...request.Option) (*CreateDataQualityJobDefinitionOutput, error) {\n\treq, out := c.CreateDataQualityJobDefinitionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "17282e4304ce89bca8574b7abc71890d", "score": "0.3572771", "text": "func (c *SageMaker) StartInferenceExperimentWithContext(ctx aws.Context, input *StartInferenceExperimentInput, opts ...request.Option) (*StartInferenceExperimentOutput, error) {\n\treq, out := c.StartInferenceExperimentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "26923b537851724ef4f607cda583f76a", "score": "0.356131", "text": "func (c *LexModelsV2) CreateSlotWithContext(ctx aws.Context, input *CreateSlotInput, opts ...request.Option) (*CreateSlotOutput, error) {\n\treq, out := c.CreateSlotRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "dede1fd3ae6b7ec1959edb860706290b", "score": "0.35548732", "text": "func (c *MediaTailor) CreateProgramWithContext(ctx aws.Context, input *CreateProgramInput, opts ...request.Option) (*CreateProgramOutput, error) {\n\treq, out := c.CreateProgramRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "c7ed116d5fd4a57afa2d2dcaae29ea02", "score": "0.35503536", "text": "func (c Client) CreateWithContext(context context.Context, input *CreateExecutionInput) (*CreateExecutionResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodPost,\n\t\tURI: \"/Flows/{flowSid}/Executions\",\n\t\tContentType: client.URLEncoded,\n\t\tPathParams: map[string]string{\n\t\t\t\"flowSid\": c.flowSid,\n\t\t},\n\t}\n\n\tif input == nil {\n\t\tinput = &CreateExecutionInput{}\n\t}\n\n\tresponse := &CreateExecutionResponse{}\n\tif err := c.client.Send(context, op, input, response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "2334d0c7e247faa86b5dc79ffdebe3b6", "score": "0.35497406", "text": "func (c *Organizations) CreateOrganizationWithContext(ctx aws.Context, input *CreateOrganizationInput, opts ...request.Option) (*CreateOrganizationOutput, error) {\n\treq, out := c.CreateOrganizationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "fe9bf6312e1e3f3b9e5ba985ba5db1e9", "score": "0.35452813", "text": "func (c *WAF) CreateRuleWithContext(ctx aws.Context, input *CreateRuleInput, opts ...request.Option) (*CreateRuleOutput, error) {\n\treq, out := c.CreateRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "445f056ba585e322f4face99aa0c91f5", "score": "0.35446858", "text": "func (c *SMS) GenerateChangeSetWithContext(ctx aws.Context, input *GenerateChangeSetInput, opts ...request.Option) (*GenerateChangeSetOutput, error) {\n\treq, out := c.GenerateChangeSetRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5ed309eb5313eaf0c43645e3d0b0af55", "score": "0.35446766", "text": "func (c *SageMaker) UpdateTrainingJobWithContext(ctx aws.Context, input *UpdateTrainingJobInput, opts ...request.Option) (*UpdateTrainingJobOutput, error) {\n\treq, out := c.UpdateTrainingJobRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "ef738d6688792db6c913e8179946cf24", "score": "0.35406226", "text": "func WithPolicyEvaluationTraces(ctx context.Context, traces []PolicyEvaluationTrace) context.Context {\n\treturn context.WithValue(ctx, policyEvaluationTraceKey{}, traces)\n}", "title": "" }, { "docid": "42c8892b955e98718c539d9e490eb8ed", "score": "0.3539041", "text": "func (c *WorkSpacesWeb) UpdateIdentityProviderWithContext(ctx aws.Context, input *UpdateIdentityProviderInput, opts ...request.Option) (*UpdateIdentityProviderOutput, error) {\n\treq, out := c.UpdateIdentityProviderRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "707d647064c9aa5013260f74b970a021", "score": "0.35389444", "text": "func (c *SageMaker) UpdateTrialComponentWithContext(ctx aws.Context, input *UpdateTrialComponentInput, opts ...request.Option) (*UpdateTrialComponentOutput, error) {\n\treq, out := c.UpdateTrialComponentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "1e6b9c9b6f023742ae86835adfc5ad45", "score": "0.35374898", "text": "func (c *Organizations) AttachPolicyWithContext(ctx aws.Context, input *AttachPolicyInput, opts ...request.Option) (*AttachPolicyOutput, error) {\n\treq, out := c.AttachPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "969da7836dde2b3df1a2442f9a9eb0ae", "score": "0.35370788", "text": "func (c *Connect) CreateRuleWithContext(ctx aws.Context, input *CreateRuleInput, opts ...request.Option) (*CreateRuleOutput, error) {\n\treq, out := c.CreateRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d841e196b05422232738c4b8dff2e9de", "score": "0.35254332", "text": "func (c *SageMaker) AssociateTrialComponentWithContext(ctx aws.Context, input *AssociateTrialComponentInput, opts ...request.Option) (*AssociateTrialComponentOutput, error) {\n\treq, out := c.AssociateTrialComponentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "baba6be1079b09a1207e14e020072cf8", "score": "0.35179842", "text": "func (o *ForumKickBanFireteamApplicantParams) WithContext(ctx context.Context) *ForumKickBanFireteamApplicantParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "e8efa07da6e8c7129fb5a0fbd0b36993", "score": "0.35169268", "text": "func (c *Connect) CreateRoutingProfileWithContext(ctx aws.Context, input *CreateRoutingProfileInput, opts ...request.Option) (*CreateRoutingProfileOutput, error) {\n\treq, out := c.CreateRoutingProfileRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "59d7118b7480b4406e8ad1199c0a51db", "score": "0.35160127", "text": "func (c *MediaTailor) StartChannelWithContext(ctx aws.Context, input *StartChannelInput, opts ...request.Option) (*StartChannelOutput, error) {\n\treq, out := c.StartChannelRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "60258744707478701391bc7cbc700386", "score": "0.35149217", "text": "func (c *SageMaker) CreateTrainingJobWithContext(ctx aws.Context, input *CreateTrainingJobInput, opts ...request.Option) (*CreateTrainingJobOutput, error) {\n\treq, out := c.CreateTrainingJobRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "b673e7dd5f65548a61a0778d052bd495", "score": "0.34945872", "text": "func (c *SageMaker) CreateTrialWithContext(ctx aws.Context, input *CreateTrialInput, opts ...request.Option) (*CreateTrialOutput, error) {\n\treq, out := c.CreateTrialRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "eea22c82cfce8c6cb42107aad8c51988", "score": "0.34929994", "text": "func (c *SQS) AddPermissionWithContext(ctx aws.Context, input *AddPermissionInput, opts ...request.Option) (*AddPermissionOutput, error) {\n\treq, out := c.AddPermissionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "4276880386f39b6fa8c7458573225a22", "score": "0.34873706", "text": "func (c *SageMaker) EnableSagemakerServicecatalogPortfolioWithContext(ctx aws.Context, input *EnableSagemakerServicecatalogPortfolioInput, opts ...request.Option) (*EnableSagemakerServicecatalogPortfolioOutput, error) {\n\treq, out := c.EnableSagemakerServicecatalogPortfolioRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "23cc7a1eeb079c4a2e053ace68ad1b79", "score": "0.34800354", "text": "func NewSafeContactCreateParamsWithContext(ctx context.Context) *SafeContactCreateParams {\n\tvar ()\n\treturn &SafeContactCreateParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "014ac99133624feb808bc48547417cd6", "score": "0.34692836", "text": "func (c *SageMaker) CreateWorkteamWithContext(ctx aws.Context, input *CreateWorkteamInput, opts ...request.Option) (*CreateWorkteamOutput, error) {\n\treq, out := c.CreateWorkteamRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "8be3dc59c02ed8da8705d0197279ccbc", "score": "0.34660685", "text": "func NewUpdateOrganizationTeamParamsWithContext(ctx context.Context) *UpdateOrganizationTeamParams {\n\tvar ()\n\treturn &UpdateOrganizationTeamParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8eecd6512560e8c6aff1ab6b437d1aa4", "score": "0.3465602", "text": "func (c *ElasticTranscoder) CreatePipelineWithContext(ctx aws.Context, input *CreatePipelineInput, opts ...request.Option) (*CreatePipelineOutput, error) {\n\treq, out := c.CreatePipelineRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e2a1e70af3684b3e7887e314a2e58acb", "score": "0.34650975", "text": "func (c *Kce) CreateClusterWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.CreateClusterRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "a05b77739056c0f97bd405783bc54570", "score": "0.34606525", "text": "func (c *EntityResolution) CreateMatchingWorkflowWithContext(ctx aws.Context, input *CreateMatchingWorkflowInput, opts ...request.Option) (*CreateMatchingWorkflowOutput, error) {\n\treq, out := c.CreateMatchingWorkflowRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "96177dd757f3251c1c43f5ccfbfe67e4", "score": "0.34597653", "text": "func (c *WorkSpacesWeb) CreateIdentityProviderWithContext(ctx aws.Context, input *CreateIdentityProviderInput, opts ...request.Option) (*CreateIdentityProviderOutput, error) {\n\treq, out := c.CreateIdentityProviderRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "46b0d6f2887538f63357f22d12d94d5a", "score": "0.34465244", "text": "func (c *EFS) PutFileSystemPolicyWithContext(ctx aws.Context, input *PutFileSystemPolicyInput, opts ...request.Option) (*PutFileSystemPolicyOutput, error) {\n\treq, out := c.PutFileSystemPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "02a44c1b7eda7a2100c3d31f1b5c8455", "score": "0.34455007", "text": "func (c *Route53Resolver) CreateResolverRuleWithContext(ctx aws.Context, input *CreateResolverRuleInput, opts ...request.Option) (*CreateResolverRuleOutput, error) {\n\treq, out := c.CreateResolverRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "02a44c1b7eda7a2100c3d31f1b5c8455", "score": "0.34455007", "text": "func (c *Route53Resolver) CreateResolverRuleWithContext(ctx aws.Context, input *CreateResolverRuleInput, opts ...request.Option) (*CreateResolverRuleOutput, error) {\n\treq, out := c.CreateResolverRuleRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" } ]
0c1a40594a33da56545035d30906bbb2
Get a single todo from the DB
[ { "docid": "238eaeb15c03b5fd5a4d10ec5ed6c9b8", "score": "0.70306206", "text": "func GetATodo(w http.ResponseWriter, r *http.Request) {\n\t// utils.ReadFromJSONDB()\n\ttodoID := chi.URLParam(r, \"todoID\")\n\ttodos := models.Todo{\n\t\tID: todoID,\n\t\tTitle: \"Hello World\",\n\t\tDescription: \"Hello from Planet Earth\",\n\t}\n\n\trender.JSON(w, r, todos)\n}", "title": "" } ]
[ { "docid": "a1bbc52e70c617b5a9a9d0991ad068ed", "score": "0.8022932", "text": "func (pq PostgresTodoDB) Get(id int) todo.Todo {\n\tvar t todo.Todo\n\trow := pq.connection.QueryRow(`SELECT * FROM todo WHERE uid=$1`, id)\n\terr := row.Scan(&t.UID, &t.Title, &t.Description, &t.Username, &t.Completed)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn t\n\t}\n\treturn t\n\n}", "title": "" }, { "docid": "35156c1e3a66ff96d083e31c39d03a0d", "score": "0.7841703", "text": "func GetTodo(id primitive.ObjectID) (models.ToDo) {\n\tvar todo models.ToDo\n\t// collection := DbWale.Collection(\"todoList\")\n\t\n\terr := Collection.FindOne(context.Background(), bson.D{{Key: \"_id\", Value: id}}).Decode(&todo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn todo\n}", "title": "" }, { "docid": "f008264fa46207415b71734df8f14e63", "score": "0.7614281", "text": "func fetchSingleTodo(c *gin.Context) {\n\tvar todo todoModel\n\ttodoID := c.Param(\"id\")\n\n\tdb.First(&todo, todoID)\n\n\tif todo.ID == 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound, \"message\": \"No todo found!\"})\n\t\treturn\n\t}\n\n\tcompleted := false\n\tif todo.Completed == 1 {\n\t\tcompleted = true\n\t} else {\n\t\tcompleted = false\n\t}\n\n\t_todo := transformedTodo{ID: todo.ID, Title: todo.Title, Completed: completed}\n\tc.JSON(http.StatusOK, gin.H{\"status\": http.StatusOK, \"data\": _todo})\n}", "title": "" }, { "docid": "180d092d16122e27cb0478e36e20d542", "score": "0.75354296", "text": "func (t *TodoManagerServer) GetTodo(ctx context.Context, grpcTodo *todomgrpb.TodoIdReq) (*todomgrpb.Todo, error) {\n\tfound := TodoEntry{}\n\t_, span := trace.StartSpan(ctx, \"db-get\")\n\tt.db.First(&found, grpcTodo.GetId())\n\tspan.End()\n\tif found.ID == 0 || found.Owner != grpcTodo.GetOwner() {\n\t\treturn nil, errors.New(\"Todo not found\")\n\t}\n\treturn found.ToGrpc(), nil\n}", "title": "" }, { "docid": "c8c10eadb8631999a8c099f63c26cca4", "score": "0.7482263", "text": "func (svc *TodoService) Get(id string) (*models.Todo, error) {\n\ttodo, err := svc.TodoStore.Get(id)\n\tif err != nil {\n\t\tif err == utils.ErrorNotFound {\n\t\t\treturn nil, ErrorNotFound(`todo item not found.`)\n\t\t}\n\n\t\tgo svc.Logger.Error(err)\n\t\treturn nil, ErrorInternal(`Internal error.`)\n\t}\n\n\treturn todo, nil\n}", "title": "" }, { "docid": "7b8ede77ce8864797b42fa29623aecd6", "score": "0.72860754", "text": "func (r *Resolver) Todo(args struct{ ID graphql.ID }) *Todo {\n\tdb := db.Connect()\n\tdefer db.Close()\n\ttodo := &Todo{}\n\tdb.Get(&todo, \"SELECT * FROM todos WHERE id=$1\", args.ID)\n\treturn todo\n}", "title": "" }, { "docid": "f9ea31a4474b6bc6d79f567a3873a818", "score": "0.7255617", "text": "func (l *PostgresLoader) GetTodo(ctx context.Context, id int) (o todo.Row, err error) {\n\treturn l.getTodo(ctx, id, l.pool)\n}", "title": "" }, { "docid": "4e276ba75e146a2c3afb40bebd72416d", "score": "0.725047", "text": "func GetTodo(c echo.Context) error {\n\tid, err := getUUIDFromParam(c)\n\tif err != nil {\n\t\treturn echo.ErrNotFound\n\t}\n\n\tvar todo models.Todo\n\terr = todo.Get(id)\n\tif err == gorm.ErrRecordNotFound {\n\t\treturn echo.NewHTTPError(http.StatusNotFound, err.Error())\n\t}\n\tif err != nil {\n\t\treturn internalServerError(err)\n\t}\n\n\treturn c.JSON(http.StatusOK, todo)\n}", "title": "" }, { "docid": "115fdff3eb4fde63360d22a7c575fe0f", "score": "0.7071836", "text": "func (l *PostgresLoader) getTodo(ctx context.Context, id int, db gnorm.DB) (o todo.Row, err error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"GetTodo\")\n\tdefer span.Finish()\n\n\tr, err := l.batchedGetTodo(id, l.pool)\n\n\tif err != nil {\n\t\terr = sanitiseError(err)\n\t\treturn\n\t}\n\n\to = hydrateModelTodo(ctx, r)\n\n\treturn\n}", "title": "" }, { "docid": "42ac51e3e942c0125a5098f149dd4b2f", "score": "0.7006303", "text": "func Get(id string) (foundTask *Task) {\n\tfoundTask = db.Get(id)\n\treturn foundTask\n}", "title": "" }, { "docid": "86c3426fa1725a3fac20dc049c3020e8", "score": "0.7004657", "text": "func (c *ToDoService) Read(ctx context.Context, req *api.ReadRequest) (*api.ReadResponse, error) {\n\n\terr := CheckApi(req.Api)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//c := &config.Config{}\n\t//c.InitDB()\n\t//defer c.DB.Close()\n\n\tvar row ToDoList\n\n\terr = c.DB.ModelContext(ctx, &ToDoList{}).Where(\"id=?\", req.Id).Select(&row)\n\tvar resp api.ReadResponse\n\tvar todo api.ToDo\n\tresp.Api = req.Api\n\ttodo.Id = row.ID\n\ttodo.Title = row.Title\n\ttodo.Description = row.Description\n\ttodo.Reminder, _ = ptypes.TimestampProto(row.Reminder)\n\tresp.Todo = &todo\n\treturn &resp, err\n}", "title": "" }, { "docid": "e85fa9a65aca57f3fdbca98e6045a4c7", "score": "0.6901363", "text": "func GetOneTodo(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": \"Not Implemented yet\",\n\t})\n}", "title": "" }, { "docid": "0d5afeccedb7137cb005528b0ca3827f", "score": "0.68880516", "text": "func (d *dataStore) Get(id string) (*task.Task, error) {\n\tdb, err := d.db()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trow := db.QueryRow(\"SELECT title, content FROM tasks WHERE id = $1\", id)\n\ttask := &task.Task{ID: id}\n\tif err := row.Scan(&(task.Title), &(task.Description)); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get task %q: %s\", id, err)\n\t}\n\treturn task, nil\n}", "title": "" }, { "docid": "d56f5d49215420fbf3bb8a0ebfd537a1", "score": "0.6827449", "text": "func Get(status string) ([]Todo, error) {\n\tvar rows *sql.Rows\n\tvar err error\n\tif status == \"\" {\n\t\trows, err = DB.Query(\"SELECT id, task, status FROM todo\")\n\t} else {\n\t\trows, err = DB.Query(\"SELECT id, task, status FROM todo where status = ?\", status)\n\t}\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tvar t []Todo\n\n\tfor rows.Next() {\n\t\tti := Todo{}\n\t\trows.Scan(&ti.ID, &ti.Task, &ti.Status)\n\t\tt = append(t, ti)\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "53007b8384a760b2d6349158b5de81f9", "score": "0.6773326", "text": "func clientGetTodo(ID uint) (*todoModel, error) {\n\turl := TodoURL + \"/todos/\" + strconv.Itoa(int(ID))\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tLog.Printf(\"Error creating HTTP request: %v\", err)\n\t\treturn nil, err\n\t}\n\tLog.Printf(\"Client GET with URL %s\", url)\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tLog.Printf(\"Error sending HTTP request: %v\", err)\n\t\treturn nil, err\n\t}\n\tif res.StatusCode != 200 {\n\t\tLog.Printf(\"Unexpected HTTP response code %d\", res.StatusCode)\n\t\treturn nil, errors.New(\"Response code not 200\")\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tLog.Printf(\"Error reading response body: %v\", err)\n\t\treturn nil, err\n\t}\n\tvar tm todoModel\n\terr = json.Unmarshal(body, &tm)\n\tif err != nil {\n\t\tLog.Printf(\"Error de-marshaling model from body: %v\", err)\n\t\treturn nil, err\n\t}\n\tLog.Printf(\"Retrieved Greeting with id %v\\n\", tm.ID)\n\treturn &tm, nil\n}", "title": "" }, { "docid": "36988b66f708959dbc709b13edad2636", "score": "0.6754773", "text": "func GetTodo(db DBGetTodo) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tuserID, ok := getUserIDFromContext(c)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\ttodoID, ok := getTodoIDFromContext(c)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\ttodo, err := db.GetTodo(todoID, userID)\n\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\t\"message\": \"Unable to find todo\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t_todo := todo.Serialize()\n\t\tc.JSON(http.StatusOK, gin.H{\"status\": http.StatusOK, \"data\": _todo})\n\t}\n}", "title": "" }, { "docid": "f343bb06fb4e12db3122026344cc97cf", "score": "0.674169", "text": "func (s sqlStore) Find(id string) (Todo, error) {\n\tvar t Todo\n\n\tvar query = `SELECT id, title, status, created\n FROM todo\n WHERE id = $1`\n\t// println(query)\n\n\tvar err = s.db.Get(&t, query, id)\n\n\tif err == sql.ErrNoRows {\n\t\terr = NotFound{sql.ErrNoRows}\n\t} else if err != nil {\n\t\tlog.Printf(\"store: find - %s\\n\", err)\n\t}\n\n\treturn t, err\n}", "title": "" }, { "docid": "f1ba20cf95831c2ce553011376d01ed9", "score": "0.6695514", "text": "func GetTask(c *gin.Context) {\n\t// Connection to the database\n\tdb := InitDb()\n\t// Close connection database\n\tdefer db.Close()\n\n\tid := c.Params.ByName(\"id\")\n\tvar task Tasks\n\t// SELECT * FROM tasks WHERE id = *;\n\tdb.First(&task, id)\n\n\tif task.Id != 0 {\n\t\t// Display JSON result\n\t\tc.JSON(200, task)\n\t} else {\n\t\t// Display JSON error\n\t\tc.JSON(404, gin.H{\"error\": \"Task not found\"})\n\t}\n\n\t// curl -i http://localhost:8080/api/v1/tasks/1\n}", "title": "" }, { "docid": "f2ac514460fb9fd9e893a165ea95b961", "score": "0.66953564", "text": "func GetATodo(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar todo models.Todo\n\terr := models.GetATodo(&todo, id)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, todo)\n\t}\n}", "title": "" }, { "docid": "43af2efe88b3620d56c0fe22e625a1eb", "score": "0.6651546", "text": "func GetTodo() *Todo {\n\t// perform request\n\tresp, err := http.Get(todoURI)\n\terror.Handle(err)\n\t// read data\n\tdata, err := ioutil.ReadAll(resp.Body)\n\terror.Handle(err)\n\t// create Todo\n\tvar t Todo\n\terr = json.Unmarshal(data, &t)\n\terror.Handle(err)\n\treturn &t\n}", "title": "" }, { "docid": "13ef56e1b698ec1e02d559e1f181a573", "score": "0.664256", "text": "func (mc *MicroserviceClient) GetTodo() (api.Todo, error) {\n\tvar respTodo api.Todo\n\n\turl := mc.Host + \"/todo\"\n\n\tr, err := queryService(mc, \"GET\", url, typeJSON, nil)\n\tif err != nil {\n\t\treturn respTodo, err\n\t}\n\n\t// Check for HTTP StatusCode\n\tswitch r.StatusCode {\n\tcase http.StatusNotFound:\n\t\treturn respTodo, api.ErrDataNotFound\n\tcase http.StatusUnauthorized:\n\t\treturn respTodo, api.ErrUnauthorized\n\tcase http.StatusServiceUnavailable:\n\t\treturn respTodo, api.ErrConnectingEndpoint\n\tcase http.StatusInternalServerError:\n\t\treturn respTodo, api.ErrInternalServer\n\t}\n\terr = processResponseEntity(r, &respTodo, http.StatusOK)\n\treturn respTodo, err\n}", "title": "" }, { "docid": "92f4219753c2b2bac1231b1056f72522", "score": "0.6601266", "text": "func (n *noteRepository) getOne(filter bson.M) (*entity.Note, error) {\n\tctx, cancel := n.getContext()\n\tdefer cancel()\n\n\tcollection := n.getNoteCollection()\n\tvar retrievedNote entity.Note\n\terr := collection.FindOne(ctx, filter).Decode(&retrievedNote)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &retrievedNote, nil\n}", "title": "" }, { "docid": "cc1590990b4a5a83dc082e429416cf74", "score": "0.6580143", "text": "func (l *PostgresLoader) OneTodo(ctx context.Context, where []sq.Sqlizer, order *gnorm.Order) (o todo.Row, err error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"OneTodo\")\n\tdefer span.Finish()\n\n\tr, err := todo.One(ctx, l.pool, where, order)\n\n\to = hydrateModelTodo(ctx, r)\n\n\treturn o, err\n}", "title": "" }, { "docid": "2573d3d277d76f85fd194a7e486a0527", "score": "0.65689075", "text": "func getOneHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvar err os.Error\n\n\tif r.Method != \"GET\" {\n\t\treturn\n\t}\n\n\tc := appengine.NewContext(r)\n\n\terr = r.ParseForm()\n\tcheck(err)\n\tvar id int64\n\tid, err = strconv.Atoi64(r.FormValue(\"id\"))\n\tk := datastore.NewKey(\"Tasks\", \"\", id, nil)\n\n\tvar task *Tasks\n\terr = datastore.Get(c, k, task)\n\tcheck(err)\n\n\treturnJson(w, task)\n\n}", "title": "" }, { "docid": "a8c7745fea7a6a2004132eaefba2de16", "score": "0.65636975", "text": "func (model *Todo) Find(id uint) *Todo {\n\trow := db.QueryRow(\"SELECT * FROM todos WHERE id = ?\", id)\n\n\ttodo := &Todo{}\n\terr := row.Scan(&todo.ID, &todo.Title, &todo.IsDone)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn todo\n}", "title": "" }, { "docid": "5bf2c23483260e91b584e7f0d35646f5", "score": "0.6547134", "text": "func (m *Model) TodoTask(id int64, token string) (TodoTask, error) {\n\tvar res TodoTask\n\tif err := m.db.Raw(`\n\t\tSELECT * FROM todo_tasks tts \n\t\tJOIN todo_lists tls ON tls.id = tts.todo_list_id AND tls.authorization_token = $1\n\t\tWHERE tts.id = $2;`, token, id).Scan(&res).Error; err != nil {\n\t\tif gorm.IsRecordNotFoundError(err) {\n\t\t\treturn TodoTask{}, ErrModelNotFound\n\t\t}\n\t\tlogrus.WithError(err).Errorf(\"can't get todo task by id: %v\", id)\n\t\treturn TodoTask{}, ErrInternal\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "8ea17fa7aee778018422f20db459ca19", "score": "0.6497119", "text": "func GetTodoByIdHandler(db *gorm.DB) echo.HandlerFunc{\n\t//return newTodoHandlerLocal;\n\treturn func(c echo.Context) error {\n\t\t//var todo Todo\n\n\t\t// assert type\n\t\tlogger := logger.Extract(c)//c.Get(\"logger\").(*zap.Logger)\n\t\t\n\t\tid := c.Param(\"id\")\n\t\tvar funcAlias = fmt.Sprintf(\"GET /todos/%s\",id)\n\n\t\tlogger.Info(funcAlias + \" get todo by id........\")\n\t\t\n\t\t\n\t\tif id == \"\"{\n\t\t\tlogger.Info(funcAlias+\" id is empty \")\n\t\t\treturn c.JSON(http.StatusBadRequest , map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\":\"id is empty\" ,\n\t\t\t})\n\t\t}\n\n\t\tidInt,err := strconv.Atoi(id)\n\t\tif err != nil{\n\t\t\tlogger.Info(funcAlias+\" id invalid format \",zap.String(\"id\",id))\n\t\t\treturn c.JSON(http.StatusBadRequest , map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\": errors.Wrap(err,\" id invalid format\").Error(),\n\t\t\t})\n\t\t}\n\n\t\tvar task Task;\n\t\tvar result = db.First(&task, idInt)\n\n\t\tif goerror.Is(result.Error, gorm.ErrRecordNotFound){\n\t\t\tlogger.Info(funcAlias+\" not found record with id \",zap.String(\"id\",id))\n\t\t\treturn c.JSON(http.StatusBadRequest , map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\": \"not found record with id \"+id,\n\t\t\t})\n\t\t}\n\n\t\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\t\"success\": true,\n\t\t\t\"result\": task,\n\t\t})\n\t\t//return c.JSON(http.StatusOK, task)\n\t}\n}", "title": "" }, { "docid": "dfb12ab3ab83b9fc35d4dfb65f23454f", "score": "0.6494435", "text": "func SelectTodo(id int) (*types.Todo, *shared.AppError) {\n\tvar todo types.Todo\n\n\tif err := db.DbCon.QueryRow(\"SELECT * FROM todo WHERE todoID = ?\", id).Scan(\n\t\t&todo.TodoID,\n\t\t&todo.Status,\n\t\t&todo.Value,\n\t\t&todo.ParentFK,\n\t\t&todo.BoardFK); err != nil {\n\t\treturn &todo, shared.ErrorRetrievingRecord(err)\n\t}\n\n\treturn &todo, nil\n}", "title": "" }, { "docid": "21f8b098d25ad89e6db3b82b27595de0", "score": "0.6455275", "text": "func (r *repository) FindByID(id string) (*Todo, error) {\n\tfound := Todo{}\n\terr := r.db.Model(&found).Where(\"id = ?\", id).Select()\n\tif err != nil {\n\t\tr.logger.Errorf(\"[Repository] FindById - Error while getting item, Reason: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn &found, nil\n}", "title": "" }, { "docid": "90afe1938838543e73744b23c7649327", "score": "0.6414045", "text": "func (dao *DAO) GetOne(rs app.RequestScope, id bson.ObjectId) (*models.Testimonial, error) {\n\tvar testimonial models.Testimonial\n\tc := rs.Tx().DB(app.Config.DBNAME).C(collection)\n\terr := c.Find(bson.M{\"_id\": id}).One(&testimonial)\n\treturn &testimonial, err\n}", "title": "" }, { "docid": "a24d22561f0f2d64371598135689db68", "score": "0.6385133", "text": "func (s *TODOService) ReadTODO(ctx context.Context, prevID, size int64) ([]*model.TODO, error) {\n\tconst (\n\t\tread = `SELECT id, subject, description, created_at, updated_at FROM todos ORDER BY id DESC LIMIT ?`\n\t\treadWithID = `SELECT id, subject, description, created_at, updated_at FROM todos WHERE id < ? ORDER BY id DESC LIMIT ?`\n\t)\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "e096dda20b5340e2a662cd6ddacd2448", "score": "0.63146186", "text": "func GetTask(dbConn *sql.DB, taskId int) (*TaskRow, error) {\r\n\treturn getTaskRow(dbConn,\r\n\t\t\"SELECT K.task_id, K.model_id, K.task_name FROM task_lst K\"+\r\n\t\t\t\" WHERE K.task_id =\"+strconv.Itoa(taskId))\r\n}", "title": "" }, { "docid": "214a96b3ba48b6400a57cc3c522396a1", "score": "0.6305424", "text": "func (ds *DataStore) GetByID(id, url string) (todos.Todo, error) {\n\tvar todo todos.Todo\n\tdocsnap, err := ds.Collection.Doc(id).Get(ds.ctx)\n\tif err != nil {\n\t\treturn todo, err\n\t}\n\terr = docsnap.DataTo(&todo)\n\ttodo.URL = url\n\treturn todo, nil\n}", "title": "" }, { "docid": "69c742dad949d8c5211271c4511b8d6f", "score": "0.63034487", "text": "func (m MockTodoRepository) GetTodoByID(todoID uuid.UUID) (*models.Todo, error) {\n\tfor _, t := range list {\n\t\tif t.ID == todoID {\n\t\t\treturn &t, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "9ec0b4b937f9ac96e57998702c53bee5", "score": "0.6285242", "text": "func getTask(id int64) (models.Tasks, error) {\n\tdb := drivers.CreateConnection()\n\n\tdefer db.Close()\n\n\tvar task models.Tasks\n\n\tsqlStatement := `select task_id,task_name,task_desc,username,status_name,priority_name,tasks.created_timestamp,tasks.modified_timestamp\n\t\t\t\t\tfrom tasks\n\n\t\t\t\t\tinner join users\n\t\t\t\t\t\ton assigned_to = user_id\n\t\t\t\t\tinner join priority\n\t\t\t\t\t\ton priority = priority_id\n\t\t\t\t\tinner join status\n\t\t\t\t\t\ton status = status_id\n\t\t\t\t\t\twhere task_id=$1;\n\t\t\t\t\t`\n\n\trow := db.QueryRow(sqlStatement, id)\n\n\terr := row.Scan(&task.Task_id, &task.Task_name, &task.Task_desc, &task.Username, &task.Status_name, &task.Priority_name, &task.Created_timestamp, &task.Modified_timestamp)\n\n\tswitch err {\n\tcase sql.ErrNoRows:\n\t\tfmt.Println(\"No rows were returned!\")\n\t\treturn task, nil\n\tcase nil:\n\t\treturn task, nil\n\tdefault:\n\t\tlog.Fatalf(\"Unable to scan the row. %v\", err)\n\t}\n\n\treturn task, err\n}", "title": "" }, { "docid": "743c3a71607b5b233ecc6e6e4e0d4d84", "score": "0.6261302", "text": "func GetOne(id string) (*Item, error) {\n\tres := Item{}\n\n\n\t//http://www.blog.labouardy.com/build-restful-api-in-go-and-mongodb/\n\t//https://www.mycodesmells.com/post/mongodb-api-with-go-lang\n\tif err := collection().FindId(bson.ObjectIdHex(id)).One(&res); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &res, nil\n}", "title": "" }, { "docid": "42067702112bba365a3b4dd78ec329d4", "score": "0.62553144", "text": "func (s *TODOService) ReadTODO(ctx context.Context, prevID, size int64) ([]model.TODO, error) {\n\tconst (\n\t\tread = `SELECT id, subject, description, created_at, updated_at FROM todos ORDER BY id DESC LIMIT ?`\n\t\treadWithID = `SELECT id, subject, description, created_at, updated_at FROM todos WHERE id < ? ORDER BY id DESC LIMIT ?`\n\t\tdefaultSize = 10000\n\t)\n\tvar (\n\t\trows *sql.Rows\n\t\terr error\n\t)\n\n\tif size == 0 {\n\t\tsize = defaultSize\n\t}\n\tif prevID == 0 {\n\t\trows, err = s.db.QueryContext(ctx, read, size)\n\t} else {\n\t\trows, err = s.db.QueryContext(ctx, readWithID, prevID, size)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttodos := make([]model.TODO, 0, size)\n\tfor rows.Next() {\n\t\tvar todo model.TODO\n\n\t\tif err := rows.Scan(&todo.ID, &todo.Subject, &todo.Description, &todo.CreatedAt, &todo.UpdatedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttodos = append(todos, todo)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn todos, nil\n}", "title": "" }, { "docid": "037a6c5f7d3c0804121a721af3ff975e", "score": "0.62486744", "text": "func (s *ToDoService) GetToDoByID(ctx context.Context, id *pb.ID) (*pb.ToDo, error) {\n\ttoDo := store.GetToDoByID(id.Id)\n\treturn toDo, nil\n}", "title": "" }, { "docid": "f25a02329636ad5a0f7aaa636a86442d", "score": "0.6233136", "text": "func (m MockTodoRepository) GetTodo() ([]models.Todo, error) {\n\treturn list, nil\n}", "title": "" }, { "docid": "4c842718965d174559c598fbc2175cfe", "score": "0.6221374", "text": "func getTaskById(w http.ResponseWriter, r *http.Request) {\n\tvar jsonForTask TaskJSON\n\terr := db.FindOneQ(collection, db.Query(bson.M{TaskIdKey: mux.Vars(r)[\"task_id\"], NameKey: mux.Vars(r)[\"name\"]}), &jsonForTask)\n\tif err != nil {\n\t\tif err != mgo.ErrNotFound {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\thttp.Error(w, \"{}\", http.StatusNotFound)\n\t\treturn\n\t}\n\tplugin.WriteJSON(w, http.StatusOK, jsonForTask)\n\n}", "title": "" }, { "docid": "306cb42a489580446369d0b89cf5cac7", "score": "0.6201715", "text": "func (a Application) GetTask(title string) (types.Task, error) {\n\tvar task = types.Task{Title: title}\n\tif err := a.db.FirstOrCreate(&task, \"title = ?\", title).Error; err != nil {\n\t\treturn task, err\n\t}\n\treturn task, nil\n}", "title": "" }, { "docid": "3e62fc4c26ae04c561a1b90ae02dbe9c", "score": "0.6196653", "text": "func (store TodoListStore) FindOne(cond ...interface{}) (*TodoList, error) {\n\tvar todolist *TodoList\n\tif err := store.Find(cond...).One(&todolist); err != nil {\n\t\treturn nil, err\n\t}\n\treturn todolist, nil\n}", "title": "" }, { "docid": "13ef40de9ebf2cd4ff522f2d29f616bf", "score": "0.61535364", "text": "func (dao *DAO) GetOne(rs app.RequestScope) (*models.About, error) {\n\tvar about models.About\n\tc := rs.Tx().DB(app.Config.DBNAME).C(collection)\n\terr := c.Find(bson.M{}).One(&about)\n\treturn &about, err\n}", "title": "" }, { "docid": "16c72eca272451d4ae53f2340a5e1fe6", "score": "0.614553", "text": "func NewGetTodoHandler(db *gorm.DB) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\tidStr := c.Param(\"id\")\n\n\t\tdb.AutoMigrate(Task{})\n\n\t\tlogger := logger.Extract(c)\n\t\tlogger.Info(\"get task ...\" + idStr)\n\n\t\tvar id int\n\t\tvar err error\n\n\t\tif id, err = strconv.Atoi(idStr); err != nil {\n\t\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\t\"error\": errors.Wrap(err, \"Get Task\").Error(),\n\t\t\t})\n\t\t}\n\t\tvar task = Task{}\n\n\t\tif result := db.Find(&task, id); result.Error != nil {\n\t\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\n\t\t\t\t\"error\": errors.Wrap(result.Error, \"Get Task\").Error(),\n\t\t\t})\n\t\t} else if result.RowsAffected == 0 {\n\t\t\treturn c.JSON(http.StatusNotFound, map[string]string{\n\t\t\t\t\"error\": \"task not found\",\n\t\t\t})\n\t\t}\n\n\t\treturn c.JSON(http.StatusOK, task)\n\t}\n}", "title": "" }, { "docid": "014cc6158c54fb9b32ea2e6ad26772e6", "score": "0.61034775", "text": "func TodoShow(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar todoID int\n\tvar err error\n\tif todoID, err = strconv.Atoi(vars[\"todoId\"]); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(JsError{Message: \"Todo.ID must be an integer\"})\n\t\treturn\n\t}\n\tif todo, present := RepoFindTodo(todoID); present {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(todo)\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tjson.NewEncoder(w).Encode(JsError{Message: \"Not Found\"})\n\t}\n}", "title": "" }, { "docid": "71a261ea11b48a908101b21f09609e55", "score": "0.6093649", "text": "func (s *Tasks) Get(id uuid.UUID, txes ...*sql.Tx) (*db.Task, error) {\n\tdat, err := db.Tasks(db.TaskWhere.ID.EQ(id.String()),\n\t\tqm.Load(db.TaskRels.TaskSteps, qm.Select(db.TaskStepColumns.ID, db.TaskStepColumns.Name, db.TaskStepColumns.Description)),\n\t).One(s.Conn)\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\treturn dat, nil\n}", "title": "" }, { "docid": "fb20ee927245e8e1bfc24300e14b3fea", "score": "0.60848844", "text": "func GetTodo(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"OK\"})\n}", "title": "" }, { "docid": "8433a13b99b5ea4c36d9d53987cb79e5", "score": "0.60748976", "text": "func GetTodos(c *gin.Context) {\n\tvar td []models.Todos\n\tcompleted := c.DefaultQuery(\"completed\", \"true\")\n\ttdName := c.Query(\"name\")\n\n\tq := fmt.Sprintf(`SELECT * FROM todos WHERE completed=%s`, completed)\n\tif tdName != \"\" {\n\t\tq += fmt.Sprintf(` AND name ILIKE '%s%%'`, tdName)\n\t}\n\tq += \";\"\n\n\tdb := models.GetDBMap()\n\t_, err := db.Select(&td, q)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(500, gin.H{\n\t\t\t\"message\": \"Todo could not be fetched\",\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t}\n\n\tresponseJSON, err := json.Marshal(td)\n\n\tc.Writer.Header().Set(\"Content-Type\", \"application/json\")\n\tc.Writer.WriteHeader(200)\n\tc.Writer.Write(responseJSON)\n}", "title": "" }, { "docid": "ce16127ce5a4cefb690539c03ef71c59", "score": "0.60721487", "text": "func (w *dbWrapper) GetRestaurant(id int64) (*restaurant, error) {\n // construct empty record\n r := new(restaurant)\n\n // run query and handle error\n if err := w.db.Conn.\n Model(r).\n Where(\"restaurant_id = ?\", id).\n Select(); err != nil {\n return nil, err\n } else {\n return r, nil\n }\n}", "title": "" }, { "docid": "80501a9054c1f455683f0f65f42b76c5", "score": "0.60421157", "text": "func GetUserTodoByID(\n\tctx context.Context, db model.Queryer, userID, todoID string) (*model.Todo, bool, error) {\n\ttd, found, err := model.GetUserTodoByID(db, userID, todoID)\n\tif err != nil {\n\t\treturn nil, false, errors.Wrap(err, \"model.GetUserTodoByID failed\")\n\t}\n\tif !found {\n\t\treturn nil, false, nil\n\t}\n\treturn td, true, nil\n}", "title": "" }, { "docid": "ff7fd23564a177733d3a42a6b7c06c2c", "score": "0.6028901", "text": "func GetTask(n string) Task {\n\tvar t Task\n\tn = strings.TrimSpace(n)\n\t// DB.Where(&Task{Name: n}).First(&t)\n\tDB.Model(&CurrentProject).Where(&Task{Name: n}).Related(&t)\n\treturn t\n}", "title": "" }, { "docid": "afc468bf208c06733baa6b9770e1f5d4", "score": "0.60280716", "text": "func (m *mariaDB) FindToDoByID(id int64) (model.ToDo, error) {\n\tsql, args, _ := squirrel.\n\t\tSelect(\"id\", \"name\", \"description\").\n\t\tFrom(\"todos\").\n\t\tWhere(squirrel.Eq{\"id\": id}).\n\t\tToSql()\n\n\tvar toDo model.ToDo\n\n\terr := m.db.QueryRowx(sql, args...).StructScan(&toDo)\n\tif err != nil {\n\t\treturn model.ToDo{}, ErrToDoNotFound\n\t}\n\n\ttasks, err := m.findTasksByToDoID(toDo.ID)\n\tif err != nil {\n\t\treturn model.ToDo{}, err\n\t}\n\n\ttoDo.Tasks = tasks\n\n\treturn toDo, nil\n}", "title": "" }, { "docid": "568572577bab3dd1128c971fe226484b", "score": "0.60197496", "text": "func (s *TODOService) CreateTODO(ctx context.Context, subject, description string) (*model.TODO, error) {\n\tconst (\n\t\tinsert = `INSERT INTO todos(subject, description) VALUES(?, ?)`\n\t\tconfirm = `SELECT subject, description, created_at, updated_at FROM todos WHERE id = ?`\n\t)\n\tlog.Println(subject)\n\tlog.Println(description)\n\tif len(subject) == 0 {\n\t\tlog.Println(\"subject should not be empty\")\n\t\treturn nil, sqlite3.ErrConstraint\n\t}\n\n\tinsertStmt, err := s.db.PrepareContext(ctx, insert)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tconfirmStmt, err := s.db.PrepareContext(ctx, confirm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tresult, err := insertStmt.ExecContext(ctx, subject, description)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\ttodo := &model.TODO{ID: int(id)}\n\terr = confirmStmt.QueryRowContext(ctx, id).Scan(&todo.Subject, &todo.Description, &todo.CreatedAt, &todo.UpdatedAt)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn todo, nil\n}", "title": "" }, { "docid": "b01a3510deb51e07a19b39038dbe4b53", "score": "0.60079104", "text": "func FindOne(query db.Q) (*Task, error) {\n\ttask := &Task{}\n\terr := db.FindOneQ(Collection, query, task)\n\tif adb.ResultsNotFound(err) {\n\t\treturn nil, nil\n\t}\n\treturn task, err\n}", "title": "" }, { "docid": "d2accd222a8796b6fa4e7097030ff258", "score": "0.60036016", "text": "func (h TodoHandlers) TodoIndex(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tuserID := r.Context().Value(\"user_id\").(uint64)\n\tif userID < 1 {\n\t\tlog.Println(\"Incorrect User ID\")\n\t\tresponses.WriteErrorResponse(w, http.StatusUnprocessableEntity, \"Incorrect User ID\")\n\t\treturn\n\t}\n\tres, err := h.SQL.Index(strconv.FormatUint(userID, 10))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tresponses.WriteErrorResponse(w, http.StatusUnprocessableEntity, \"Unprocessible Entity\")\n\t\treturn\n\t}\n\tresponses.WriteOKResponse(w, res)\n}", "title": "" }, { "docid": "285a8f4e2914d8d528e2a64db38f4087", "score": "0.6001099", "text": "func (v *PatientDAO) Get(ctx context.Context, id string) (*dto.Patient, error) {\n\tcollection := v.client.Database(constants.Mhpss).Collection(constants.Patients)\n\n\tfilter := bson.D{{constants.ID, id}}\n\n\tpatient := &dto.Patient{}\n\tif err := collection.FindOne(ctx, filter).Decode(&patient); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn patient, nil\n}", "title": "" }, { "docid": "ed87c39c2498c99e2721838f3120756a", "score": "0.5969588", "text": "func (tc *TodoController) Show(c *gin.Context) {\n\n\tdb := tc.DB\n\n\tvar todo models.TodoModel\n\tid := c.Param(\"id\")\n\n\tdb.First(&todo, id)\n\n\tif todo.ID == 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": \"No todo found\",\n\t\t})\n\t\treturn\n\t}\n\n\tcompleted := (todo.Completed == 1)\n\n\tapiTodo := models.ApiTodo{\n\t\tID: todo.ID,\n\t\tTitle: todo.Title,\n\t\tCompleted: completed,\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"data\": apiTodo,\n\t})\n}", "title": "" }, { "docid": "00713e4fbec2a97e3fa7f8e1b69653c6", "score": "0.5963778", "text": "func GetTaskOr404(db *gorm.DB, id int, w http.ResponseWriter, r *http.Request) *Task {\n\ttask := Task{}\n\tif err := db.First(&task, id).Error; err != nil {\n\t\trespondError(w, http.StatusNotFound, err.Error())\n\t\treturn nil\n\t}\n\treturn &task\n}", "title": "" }, { "docid": "8b764357bfbebfdc4f0575f2f836e5a8", "score": "0.59630716", "text": "func deleteTodo(c *gin.Context) {\n\tvar todo todoModel\n\ttodoID := c.Param(\"id\")\n\n\tdb.First(&todo, todoID)\n\n\tif todo.ID == 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound, \"message\": \"No todo found!\"})\n\t\treturn\n\t}\n\n\tdb.Delete(&todo)\n\tc.JSON(http.StatusOK, gin.H{\"status\": http.StatusOK, \"message\": \"Todo deleted successfully!\"})\n}", "title": "" }, { "docid": "74b23e2197061a192eb2fa2a395fa88d", "score": "0.5936933", "text": "func (c *Controller) ReadTask(id string) (p *models.Project, err error) {\n\tp = new(models.Project)\n\tc.Store.Get(id)\n\treturn p, nil\n}", "title": "" }, { "docid": "861d1630f55f6344759f8e919484d46b", "score": "0.59331965", "text": "func getitem(context appengine.Context, url string) (*TodoItem, error) {\n\tparts := strings.Split(strings.Replace(url, \"/list/\", \"\", 1), \"/type/\")\n\tid := parts[0]\n\n\tkey, err := datastore.DecodeKey(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\titem := new(TodoItem)\n\terr = datastore.Get(context, key, item)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\titem.Key = key\n\n\treturn item, nil\n}", "title": "" }, { "docid": "7dde8d9bccc44dfd9602b2fd9e77c8dc", "score": "0.5930545", "text": "func GetNote(c *gin.Context) {\n\ttracer := opentracing.GlobalTracer()\n\tspan := tracer.StartSpan(\"GetNote\")\n\tdefer span.Finish()\n\n\tvar note models.Note\n\tid := c.Params.ByName(\"id\")\n\n\tspan, ctx := opentracing.StartSpanFromContext(c, \"GetNote\")\n\tdb := utils.GetDB(ctx)\n\n\tif err := db.First(&note, id).Error; err != nil {\n\t\tc.JSON(\n\t\t\thttp.StatusOK,\n\t\t\tgin.H{\n\t\t\t\t\"error\": \"Note not found\",\n\t\t\t},\n\t\t)\n\t} else {\n\t\tc.JSON(http.StatusOK, note)\n\t}\n}", "title": "" }, { "docid": "71c1ca42df1700b69f71491af53321ac", "score": "0.59066355", "text": "func Get(db *gorm.DB, id int64) (MDNoteModel, error) {\n\tvar note MDNoteModel\n\tif err := db.First(&note, id).Error; err != nil {\n\t\treturn MDNoteModel{}, err\n\t}\n\treturn note, nil\n}", "title": "" }, { "docid": "ac4a233c9978c99bc44834fd2fc3ff7f", "score": "0.5901077", "text": "func (s *PostStorage) GetOne(ID string) (*model.Post, error) {\n\tvar post model.Post\n\n\terr := s.DB.Get(&post, \"SELECT * FROM posts WHERE id=?\", ID)\n\n\treturn &post, err\n}", "title": "" }, { "docid": "79eedaa36c91a4c09216dd5197751a90", "score": "0.5900359", "text": "func (pr *PostRepository) GetOne(ctx context.Context, id uint) (post.Post, error) {\n\tq := `\n\tSELECT id, body, user_id, created_at, updated_at\n\t\tFROM posts WHERE id = $1;\n\t`\n\n\trow := pr.Data.DB.QueryRowContext(ctx, q, id)\n\n\tvar p post.Post\n\terr := row.Scan(&p.ID, &p.Body, &p.UserID, &p.CreatedAt, &p.UpdatedAt)\n\tif err != nil {\n\t\treturn post.Post{}, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "1e75dd8f885cd5832b991b313e60f3e7", "score": "0.58874786", "text": "func FindTask(c *gin.Context) {\n\tvar task models.Task\n\n\tif err := models.DB.First(&task, \"id = ?\", c.Param(\"id\")).Error; err != nil {\n\t\tc.JSON(http.StatusOK, gin.H{\"data\": nil})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": task})\n}", "title": "" }, { "docid": "8ab4ba51c3ca5095ce93b807bc6c9b79", "score": "0.5871182", "text": "func GetTask(d models.TaskStore, w http.ResponseWriter, r *http.Request) {\n\t// get task_id\n\ttaskId := mux.Vars(r)[\"id\"]\n\tif !bson.IsObjectIdHex(taskId) {\n\t\tcommon.DisplayAppError(w, errors.New(\"taskId is not objectId\"), common.FetchError, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tuserClaims := r.Context().Value(\"userContext\").(*common.UserClaims)\n\ttask, err := d.GetTaskByUserIdAndTaskId(userClaims.UserId, bson.ObjectIdHex(taskId))\n\tif err != nil {\n\t\tcommon.DisplayAppError(w, err, common.FetchError, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tcommon.WriteJson(w, \"success\", &task, http.StatusOK)\n}", "title": "" }, { "docid": "f7e846a2448b4dc43e0badca90092309", "score": "0.5855452", "text": "func (v *DailyDAO) Get(ctx context.Context, id string) (*dto.Daily, error) {\n\tcollection := v.client.Database(constants.GalaSejahtera).Collection(constants.Dailies)\n\tdaily := &dto.Daily{}\n\tif err := collection.FindOne(ctx, bson.D{{constants.ID, id}}).Decode(&daily); err != nil {\n\t\treturn nil, err\n\t}\n\treturn daily, nil\n}", "title": "" }, { "docid": "79efbc611eb334d0b58cc14c4e917ec3", "score": "0.5852966", "text": "func (ctrl *NoteController) Retrieve(c *gin.Context) {\n\tnoteID := c.Param(\"id\")\n\tuserID := c.GetString(auth.UserIDKey)\n\n\tnote := models.Note{}\n\tif err := ctrl.Repository.FindByID(&note, noteID); err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, utils.Err(\"Note not found\"))\n\t\t\treturn\n\t\t}\n\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, utils.Err(\"Could not handle your request\"))\n\t\treturn\n\t}\n\n\tif note.UserID != userID {\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, utils.Err(\"You don't own this note\"))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, note)\n}", "title": "" }, { "docid": "e34db8a3ef2dc3d3abd1d01f994af9d6", "score": "0.5852046", "text": "func (c *RestaurantClient) Get(ctx context.Context, id int) (*Restaurant, error) {\n\treturn c.Query().Where(restaurant.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "488b5a91a6f260eb3728c896340101d5", "score": "0.584653", "text": "func (c *Controller) get(txn *mojura.Transaction, entryID string) (e *Entry, err error) {\n\tvar entry Entry\n\tif err = txn.Get(entryID, &entry); err != nil {\n\t\treturn\n\t}\n\n\te = &entry\n\treturn\n}", "title": "" }, { "docid": "832747353474e7b9ea042d573b2e5e91", "score": "0.5843395", "text": "func (w *ServerInterfaceWrapper) GetTodo(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"todoId\" -------------\n\tvar todoId int32\n\n\terr = runtime.BindStyledParameterWithLocation(\"simple\", false, \"todoId\", runtime.ParamLocationPath, ctx.Param(\"todoId\"), &todoId)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter todoId: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.GetTodo(ctx, todoId)\n\treturn err\n}", "title": "" }, { "docid": "ef176e11d86e4f82f64fd423e5d7eb34", "score": "0.5818393", "text": "func (taskBolt *BoltDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error) {\n\tvar task *tes.Task\n\tvar err error\n\n\terr = taskBolt.db.View(func(tx *bolt.Tx) error {\n\t\ttask, err = getTaskView(tx, req.Id, req.View)\n\t\treturn err\n\t})\n\treturn task, err\n}", "title": "" }, { "docid": "6bdfb205fadb3fe56cc146e85c275894", "score": "0.5811423", "text": "func RepoFindTodo(id int) (todo.Todo, error) {\n\tif id > len(TodosList) {\n\t\treturn todo.Todo{}, fmt.Errorf(\"could not find todo with id %d to delete\", id)\n\t}\n\tfor _, t := range TodosList {\n\t\tif t.ID == id {\n\t\t\treturn t, nil\n\t\t}\n\t}\n\treturn todo.Todo{}, fmt.Errorf(\"could not find todo with id %d\", id)\n}", "title": "" }, { "docid": "5f481c142e464ea6d6c4fc98fbea33a5", "score": "0.58025116", "text": "func DbGetOne(id int) Person {\n\tdb, err := gorm.Open(\"sqlite3\", \"test.sqlite3\")\n\tif err != nil {\n\t\tpanic(\"failed to connect database(DbGetOne)\\n\")\n\t}\n\tvar person Person\n\tdb.First(&person, id)\n\tdb.Close()\n\treturn person\n}", "title": "" }, { "docid": "2bffd4217a5fc887f91c54f7568ce3aa", "score": "0.5794504", "text": "func (db *MongoDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error) {\n\tvar task tes.Task\n\tvar q *mgo.Query\n\n\tq = db.tasks.Find(bson.M{\"id\": req.Id})\n\tswitch req.View {\n\tcase tes.TaskView_BASIC:\n\t\tq = q.Select(basicView)\n\tcase tes.TaskView_MINIMAL:\n\t\tq = q.Select(minimalView)\n\t}\n\n\terr := q.One(&task)\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn nil, grpc.Errorf(codes.NotFound, fmt.Sprintf(\"%v: taskID: %s\", mgo.ErrNotFound.Error(), req.Id))\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &task, nil\n}", "title": "" }, { "docid": "54f909fe4e44fb9738b18a25236363a3", "score": "0.57790804", "text": "func (m *TodoTaskItemRequestBuilder) Get(ctx context.Context, requestConfiguration *TodoTaskItemRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TodoTaskable, error) {\n requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTodoTaskFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TodoTaskable), nil\n}", "title": "" }, { "docid": "b000cb129c7ecce63a569d41ce2e018e", "score": "0.57584345", "text": "func DeleteTodo(id primitive.ObjectID) error {\n\t// collection := DbWale.Collection(\"todoList\")\n\t_, err := Collection.DeleteOne(context.Background(), bson.D{{Key: \"_id\", Value: id}})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab0d0a9d75bc0b6b9f8e1c7211262ace", "score": "0.5757362", "text": "func (pc *PostController) GetSingle(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tp := pc.repository.FetchOne(params[\"key\"])\n\tpc.viewSet.PostSingleView(p).Render(w)\n}", "title": "" }, { "docid": "ae1a0689c634ffa171e595ddb980bf56", "score": "0.57565093", "text": "func (h *TODOHandler) Read(ctx context.Context, req *model.ReadTODORequest) (*model.ReadTODOResponse, error) {\n\tres, err := h.svc.ReadTODO(ctx, req.PrevID, req.Size)\n\tif err != nil {\n\t\treturn &model.ReadTODOResponse{}, err\n\t}\n\n\treturn &model.ReadTODOResponse{TODOs: res}, nil\n}", "title": "" }, { "docid": "73d9ca9319e87f7a32f6949aeedd94ff", "score": "0.5755066", "text": "func (accessor *PostGresAccessor) Get(db interface{}, id *ID) (*Recipe, error) {\n\trecipe := Recipe{}\n\terr := db.(*sql.DB).QueryRow(\"SELECT name, prep, difficulty, vegetarian FROM recipes WHERE id=$1\", fmt.Sprintf(\"%s\", *id)).Scan(&recipe.Name, &recipe.Prep, &recipe.Difficulty, &recipe.Vegetarian)\n\treturn &recipe, err\n}", "title": "" }, { "docid": "619b1e60ed11034c246e237fce49af84", "score": "0.57384825", "text": "func (tr TransactionRepository) FindOne(id uint64) (interface{}, error) {\n\tvar findTransModel model.TransactionModel\n\ttr.Db.Where(\"ID = ?\", id).First(&findTransModel)\n\n\tfmt.Println(\"finding\", findTransModel)\n\treturn findTransModel, nil\n}", "title": "" }, { "docid": "c2326dbc7484ff9fa96ce15af102caf0", "score": "0.5737719", "text": "func GetOne(c *gin.Context) {\n\tids := c.Param(\"id\")\n\tid, _ := strconv.Atoi(ids)\n\tr := Router{\n\t\tID: id,\n\t}\n\trs, _ := r.GetRow()\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": rs,\n\t\t\"code\": 100,\n\t})\n}", "title": "" }, { "docid": "21b932bb474d9450cc5a685d79a12d04", "score": "0.5729031", "text": "func (dm *DefaultManager) GetTask(id int64) (*models.Task, error) {\n\treturn dao.GetTask(id)\n}", "title": "" }, { "docid": "9035fdec1f9ce376a220911123da1bfd", "score": "0.57268006", "text": "func (dao *LanguageDAO) GetOne(conditions bson.M) (*models.Language, error) {\n\tsession := dao.Session.Copy()\n\tdefer session.Close()\n\n\tmodel := &models.Language{}\n\n\terr := session.DB(\"\").C(dao.Collection).\n\t\tFind(conditions).\n\t\tOne(model)\n\n\treturn model, err\n}", "title": "" }, { "docid": "5c79e97e68bdfe34d90955cc9f45a42b", "score": "0.5719665", "text": "func (user *User) GetOne(id int64) (*User, error) {\n\tvar users []User\n\terr := DB.Where(\"id = ?\", id).Cols(\"id\", \"email\", \"status\").Find(&users)\n\tif len(users) == 0 {\n\t\treturn nil, errors.New(\"not found page\")\n\t}\n\treturn &users[0], err\n}", "title": "" }, { "docid": "216aac98c62604fe624c3694cbca5cc3", "score": "0.57040924", "text": "func (mng *Mongo) GetByTID(ctx context.Context, tid string) (*entities.Admin, error) {\n\tresult := &entities.Admin{}\n\tcollection := mng.db.Collection(\"Admins\")\n\terr := collection.FindOne(ctx, bson.D{primitive.E{Key: \"tid\", Value: tid}}).Decode(result)\n\tif err != nil {\n\t\tfmt.Println(\"Error decoding result\", err)\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "468cde9117144a395e469572be915dcb", "score": "0.57033825", "text": "func (s *TODOService) CreateTODO(ctx context.Context, subject, description string) (*model.TODO, error) {\n\tconst (\n\t\tinsert = `INSERT INTO todos(subject, description) VALUES(?, ?)`\n\t\tconfirm = `SELECT id, subject, description, created_at, updated_at FROM todos WHERE id = ?`\n\t)\n\n\tresult, err := s.db.ExecContext(ctx, insert, subject, description)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ti, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trow := s.db.QueryRowContext(ctx, confirm, i)\n\tvar todo model.TODO\n\tif err := row.Scan(&todo.ID, &todo.Subject, &todo.Description, &todo.CreatedAt, &todo.UpdatedAt); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &todo, nil\n}", "title": "" }, { "docid": "3e80d9f8648448ffdbe3155a9f13f6a1", "score": "0.56933284", "text": "func (r *XrpDetailTxInputRepository) GetOne(id int64) (*models.XRPDetailTX, error) {\n\tctx := context.Background()\n\n\ttxItem, err := models.FindXRPDetailTX(ctx, r.dbConn, id) // unique\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to call models.FindTXInput()\")\n\t}\n\treturn txItem, nil\n}", "title": "" }, { "docid": "b2a64ccd33c02e396a575db7fc793539", "score": "0.569035", "text": "func GetHandlerFunction(w http.ResponseWriter, r *http.Request) {\n\tvar id = getID(r.URL.String())\n\tctx, _ := context.WithTimeout(context.Background(), 15*time.Second)\n\tdocID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\thttp.Error(w, \"Cannot get the id\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tvar result Todo\n\terr = col.FindOne(ctx, bson.M{\"_id\": docID}).Decode(&result)\n\tif err != nil {\n\t\thttp.Error(w, \"Cannot find the data of particular id\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(result)\n}", "title": "" }, { "docid": "a9968cc9a892a8d498fecaf26963982d", "score": "0.56890124", "text": "func returnAllTodos(w http.ResponseWriter, r *http.Request) {\n // Code for returning all items here\n\n // DB接続する\n db := utils.GetConnection()\n defer db.Close()\n\n // 空のスライス\n var todoList []Todo\n // SELECT文が発行されて結果がtodoListに入る\n db.Find(&todoList)\n\n utils.RespondWithJSON(w, http.StatusOK, todoList)\n}", "title": "" }, { "docid": "ec03bf56761166df3bbd92c774b489e3", "score": "0.568757", "text": "func (m *MgoFun) Get() error {\n\tquery := m.findByIdQ()\n\terr := query.One(m.model)\n\treturn err\n}", "title": "" }, { "docid": "5adec685771e06d63e9ba4a13d8c1497", "score": "0.56832623", "text": "func (s *BlogService) GetOne(rs app.RequestScope, id bson.ObjectId) (*models.Blog, error) {\n\treturn s.dao.GetOne(rs, id)\n}", "title": "" }, { "docid": "0787dd479dea26bce29786fed2a11f7f", "score": "0.56733453", "text": "func (m *Model) TodoList(token string) (TodoList, error) {\n\tvar res TodoList\n\tif err := m.db.Raw(`\n\t\tSELECT * FROM todo_lists tls\n\t\tWHERE tls.authorization_token = ?\n\t\tLIMIT 1;`, token).Scan(&res).Error; err != nil {\n\t\tif gorm.IsRecordNotFoundError(err) {\n\t\t\treturn TodoList{}, ErrModelNotFound\n\t\t}\n\t\tlogrus.WithError(err).Errorf(\"can't get todo list by token: %s\", token)\n\t\treturn TodoList{}, ErrInternal\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "4d76eb23bbb7b953b9579a188941cd7f", "score": "0.5673306", "text": "func Get(id string) (s Story, err error) {\n\t// open story db\n\tdb, err := storm.Open(DB)\n\tdefer db.Close()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get story\n\tquery := db.Select(q.Eq(\"ID\", id))\n\terr = query.First(&s)\n\treturn\n}", "title": "" }, { "docid": "f1fc04b1a9f9de3d1a94620d4534ae07", "score": "0.56716084", "text": "func (reminders *Reminders) Get(db *gorm.DB) error {\n\tif err := db.Find(&reminders).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66b6267e70945467d58e2e39daf6b772", "score": "0.5659246", "text": "func GetTodoRepository() TodoRepository {\n\treturn &databaseTodo{\n\t\tclient: dbclient,\n\t\tdbName: DATABASE,\n\t\tcName: COLLECTIONTODOS,\n\t}\n}", "title": "" }, { "docid": "871f1a9b54fed39d017b86df0b0268fe", "score": "0.56463337", "text": "func (h *TODOHandler) Read(ctx context.Context, req *model.ReadTODORequest) (*model.ReadTODOResponse, error) {\n\t_, _ = h.svc.ReadTODO(ctx, 0, 0)\n\treturn &model.ReadTODOResponse{}, nil\n}", "title": "" }, { "docid": "150e967bd71f97a5da3e585e146f6884", "score": "0.56421506", "text": "func CreateTodo(todo models.ToDo) {\n\t// collection := DbWale.Collection(\"todoList\")\n\tinsertResult, err := Collection.InsertOne(context.Background(), todo)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Inserted a Single TODO Record \", insertResult.InsertedID)\n}", "title": "" }, { "docid": "0fdf75b82e85439248a7beda78bd0947", "score": "0.5641365", "text": "func GetTodos(c *fiber.Ctx) error {\n\tvar todos []models.Todo\n\n\tdatabase.DB.Model(&models.Todo{}).Find(&todos)\n\n\treturn c.JSON(fiber.Map{\n\t\t\"error\": false,\n\t\t\"message\": \"ok\",\n\t\t\"todos\": todos,\n\t})\n}", "title": "" } ]
a9e578a1534d780f60d0819aa6041e3a
findSelectorDeclaration returns function declaration called by selector expression.
[ { "docid": "9b9f61e2fc8434d7e7c58d79755798ed", "score": "0.7549955", "text": "func findSelectorDeclaration(pass *analysis.Pass, expr *ast.SelectorExpr) *ast.FuncDecl {\n\txsel, ok := pass.TypesInfo.Selections[expr]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tfor _, file := range pass.Files {\n\t\tfor _, decl := range file.Decls {\n\t\t\tfd, ok := decl.(*ast.FuncDecl)\n\t\t\tif ok && fd.Recv != nil && len(fd.Recv.List) == 1 {\n\t\t\t\trecvType, ok := fd.Recv.List[0].Type.(*ast.Ident)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\trecvObj, ok := pass.TypesInfo.Uses[recvType]\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif !(types.Identical(recvObj.Type(), xsel.Recv())) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif fd.Name.Name == expr.Sel.Name {\n\t\t\t\t\treturn fd\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "2342f9e60029473070d39540b3ba586d", "score": "0.6272298", "text": "func findFunctionDeclaration(pass *analysis.Pass, ident *ast.Ident) *ast.FuncDecl {\n\tif ident.Obj != nil {\n\t\tif funObjDecl, ok := ident.Obj.Decl.(*ast.FuncDecl); ok {\n\t\t\treturn funObjDecl\n\t\t}\n\t}\n\n\tobj := pass.TypesInfo.ObjectOf(ident)\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\tfor _, file := range pass.Files {\n\t\tfor _, decl := range file.Decls {\n\t\t\tfuncDecl, ok := decl.(*ast.FuncDecl)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif funcDecl.Name.Pos() == obj.Pos() {\n\t\t\t\treturn funcDecl\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af206d75eedb1032f8ca50afeeec8661", "score": "0.560914", "text": "func findFunction(name, arguments estring, constness bool) *Function {\n\tfor _, f := range functions {\n\t\tif arguments.isEmpty() {\n\t\t\tif f.n != name {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tt := typesOnly(arguments)\n\t\t\tif f.n != name {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif f.a != t {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif f.cn != constness {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\treturn f\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4b33e979c81d92e0a8515c767b8a770", "score": "0.5200276", "text": "func (s *baseNode) FindDeclaration(usage *Ident) *Ident {\n\tif decl, ok := s.cachedDeclaration(usage); ok {\n\t\treturn decl\n\t}\n\n\tdecls := s.findIdents(s.Info().Defs, func(node *Ident) bool {\n\t\treturn node.Name == usage.Name\n\t})\n\tif len(decls) == 1 {\n\t\treturn decls[0]\n\t}\n\n\tvar (\n\t\tcorrectDecl *Ident\n\t\tcorrectScope *types.Scope\n\t)\n\tfor _, decl := range decls {\n\t\tscopeNode, scope := decl.GetScope()\n\t\tif !scope.Contains(usage.Pos()) {\n\t\t\tcontinue\n\t\t}\n\t\tif correctDecl != nil && correctScope != nil && !correctScope.Contains(scopeNode.Pos()) {\n\t\t\tcontinue\n\t\t}\n\t\tcorrectDecl = decl\n\t\tcorrectScope = scope\n\t}\n\n\ts.cacheDeclaration(usage, correctDecl)\n\treturn correctDecl\n}", "title": "" }, { "docid": "fa32fd7ec8b483d13cf13faa9f8c507e", "score": "0.5146193", "text": "func findIdentifier(f *ast.File, pos token.Pos) (ident, error) {\n\tm, err := checkIdentifier(f, pos)\n\tif err != nil {\n\t\treturn ident{}, err\n\t}\n\tif m.ident != nil {\n\t\treturn m, nil\n\t}\n\t// If the position is not an identifier but immediately follows\n\t// an identifier or selector period (as is common when\n\t// requesting a completion), use the path to the preceding node.\n\treturn checkIdentifier(f, pos-1)\n}", "title": "" }, { "docid": "dfb7c492f6076681f0de91d3abc4f7f7", "score": "0.50458145", "text": "func FindCallable(fileContent string, parserPos int) (int, Callable) {\n\tvar declarationStart int\n\tvar matched bool\n\tvar functionOpener string\n\tvar callable Callable\n\n\tdeclarationStart, matched = MatchToken(\"func\", fileContent, parserPos)\n\n\tif matched {\n\t\t// Find only function in the outer scope of the file\n\t\tif fileContent[declarationStart-5] == '\\n' {\n\t\t\t_, functionOpener = FindNextToken(fileContent, declarationStart)\n\t\t\tif functionOpener == \"(\" {\n\t\t\t\tparserPos, callable = FindMethod(fileContent, declarationStart)\n\t\t\t} else {\n\t\t\t\tparserPos, callable = FindFunction(fileContent, declarationStart)\n\t\t\t}\n\t\t\treturn parserPos, callable\n\t\t} else {\n\t\t\treturn FindCallable(fileContent, declarationStart)\n\t\t}\n\t}\n\treturn declarationStart, callable\n}", "title": "" }, { "docid": "caee47b703050b899d9e51ca4116dc7d", "score": "0.50380826", "text": "func matchFunc(bd ast.Stmt, packageName string, methodName string) (bool, *ast.CallExpr) {\n\tif exprStmt, ok := bd.(*ast.ExprStmt); ok {\n\t\tif call, ok := exprStmt.X.(*ast.CallExpr); ok {\n\t\t\tif fun, ok := call.Fun.(*ast.SelectorExpr); ok {\n\t\t\t\tif astid, ok := fun.X.(*ast.Ident); ok {\n\t\t\t\t\tif astid.String() == packageName && fun.Sel.String() == methodName {\n\t\t\t\t\t\treturn true, call\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "3bb63d7276bc2f0407de83b166eb4a3f", "score": "0.48631117", "text": "func findSqlFunc(tls *libc.TLS, pDb uintptr, zName uintptr) uintptr { /* tclsqlite.c:471:16: */\n\tvar p uintptr\n\tvar pNew uintptr\n\tvar nName int32 = strlen30(tls, zName)\n\tpNew = tcl.XTcl_Alloc(tls, (uint32((uint64(unsafe.Sizeof(SqlFunc{})) + uint64(nName)) + uint64(1))))\n\t(*SqlFunc)(unsafe.Pointer(pNew)).FzName = (pNew + 1*48)\n\tlibc.Xmemcpy(tls, (*SqlFunc)(unsafe.Pointer(pNew)).FzName, zName, (uint64(nName + 1)))\n\tfor p = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc; p != 0; p = (*SqlFunc)(unsafe.Pointer(p)).FpNext {\n\t\tif sqlite3.Xsqlite3_stricmp(tls, (*SqlFunc)(unsafe.Pointer(p)).FzName, (*SqlFunc)(unsafe.Pointer(pNew)).FzName) == 0 {\n\t\t\ttcl.XTcl_Free(tls, pNew)\n\t\t\treturn p\n\t\t}\n\t}\n\t(*SqlFunc)(unsafe.Pointer(pNew)).Finterp = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp\n\t(*SqlFunc)(unsafe.Pointer(pNew)).FpDb = pDb\n\t(*SqlFunc)(unsafe.Pointer(pNew)).FpScript = uintptr(0)\n\t(*SqlFunc)(unsafe.Pointer(pNew)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc\n\t(*SqliteDb)(unsafe.Pointer(pDb)).FpFunc = pNew\n\treturn pNew\n}", "title": "" }, { "docid": "124d76ce03d3c872001f2017413a37c5", "score": "0.48147008", "text": "func (f *cgoFile) getASTDeclName(name string, found clangCursor, iscall bool) string {\n\t// Some types are defined in stdint.h and map directly to a particular Go\n\t// type.\n\tif alias := cgoAliases[\"C.\"+name]; alias != \"\" {\n\t\treturn alias\n\t}\n\tnode := f.getASTDeclNode(name, found, iscall)\n\tif node, ok := node.(*ast.FuncDecl); ok {\n\t\tif !iscall {\n\t\t\treturn node.Name.Name + \"$funcaddr\"\n\t\t}\n\t\treturn node.Name.Name\n\t}\n\treturn \"C.\" + name\n}", "title": "" }, { "docid": "9189509221f6be06bb55d3c6ac201612", "score": "0.47995436", "text": "func nameSelector(k string) Selector {\n\treturn func(n base.Node) bool {\n\t\tresult := (n.Type() == base.ElementNode && n.Data() == k)\n\t\treturn result\n\t}\n}", "title": "" }, { "docid": "1fe4b8b8365534b215c241be6ff537c2", "score": "0.47939453", "text": "func (s *baseNode) FindDeclarations() []*Ident {\n\treturn s.findIdents(s.Info().Defs, func(node *Ident) bool {\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "2a5f7efa50085a1deb9ce949ec7e7c6a", "score": "0.47864202", "text": "func (*BadDecl) declNode() {}", "title": "" }, { "docid": "2113881b135e16be4411eb65195cd0cd", "score": "0.4782641", "text": "func (f *cgoFile) getASTDeclNode(name string, found clangCursor, iscall bool) ast.Node {\n\tif node, ok := f.defined[name]; ok {\n\t\t// Declaration was found in the current file, so return it immediately.\n\t\treturn node\n\t}\n\n\tif node, ok := f.definedGlobally[name]; ok {\n\t\t// Declaration was previously created, but not for the current file. It\n\t\t// may be different (because it comes from a different CGo snippet), so\n\t\t// we need to check whether the AST for this definition is equivalent.\n\t\tf.defined[name] = nil\n\t\tnewNode, _ := f.createASTNode(name, found)\n\t\tif !f.isEquivalentAST(node, newNode) {\n\t\t\t// It's not. Return a nice error with both locations.\n\t\t\t// Original cgo reports an error like\n\t\t\t// cgo: inconsistent definitions for C.myint\n\t\t\t// which is far less helpful.\n\t\t\tf.addError(getPos(node), name+\" defined previously at \"+f.fset.Position(getPos(newNode)).String()+\" with a different type\")\n\t\t}\n\t\tf.defined[name] = node\n\t\treturn node\n\t}\n\n\t// The declaration has no AST node. Create it now.\n\tf.defined[name] = nil\n\tnode, extra := f.createASTNode(name, found)\n\tf.defined[name] = node\n\tswitch node := node.(type) {\n\tcase *ast.FuncDecl:\n\t\tif strings.HasPrefix(node.Doc.List[0].Text, \"//export _Cgo_static_\") {\n\t\t\t// Static function. Only accessible in the current Go file.\n\t\t\tglobalName := strings.TrimPrefix(node.Doc.List[0].Text, \"//export \")\n\t\t\t// Make an alias. Normally this is done using the alias function\n\t\t\t// attribute, but MacOS for some reason doesn't support this (even\n\t\t\t// though the linker has support for aliases in the form of N_INDR).\n\t\t\t// Therefore, create an actual function for MacOS.\n\t\t\tvar params []string\n\t\t\tfor _, param := range node.Type.Params.List {\n\t\t\t\tparams = append(params, param.Names[0].Name)\n\t\t\t}\n\t\t\tcallInst := fmt.Sprintf(\"%s(%s);\", name, strings.Join(params, \", \"))\n\t\t\tif node.Type.Results != nil {\n\t\t\t\tcallInst = \"return \" + callInst\n\t\t\t}\n\t\t\taliasDeclaration := fmt.Sprintf(`\n#ifdef __APPLE__\n%s {\n\t%s\n}\n#else\nextern __typeof(%s) %s __attribute__((alias(%#v)));\n#endif\n`, extra.(string), callInst, name, globalName, name)\n\t\t\tf.cgoHeaders[f.index] += \"\\n\\n\" + aliasDeclaration\n\t\t} else {\n\t\t\t// Regular (non-static) function.\n\t\t\tf.definedGlobally[name] = node\n\t\t}\n\t\tf.generated.Decls = append(f.generated.Decls, node)\n\t\t// Also add a declaration like the following:\n\t\t// var C.foo$funcaddr unsafe.Pointer\n\t\tf.generated.Decls = append(f.generated.Decls, &ast.GenDecl{\n\t\t\tTok: token.VAR,\n\t\t\tSpecs: []ast.Spec{\n\t\t\t\t&ast.ValueSpec{\n\t\t\t\t\tNames: []*ast.Ident{{Name: node.Name.Name + \"$funcaddr\"}},\n\t\t\t\t\tType: &ast.SelectorExpr{\n\t\t\t\t\t\tX: &ast.Ident{Name: \"unsafe\"},\n\t\t\t\t\t\tSel: &ast.Ident{Name: \"Pointer\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\tcase *ast.GenDecl:\n\t\tf.definedGlobally[name] = node\n\t\tf.generated.Decls = append(f.generated.Decls, node)\n\tcase *ast.TypeSpec:\n\t\tf.definedGlobally[name] = node\n\t\tf.generated.Decls = append(f.generated.Decls, &ast.GenDecl{\n\t\t\tTok: token.TYPE,\n\t\t\tSpecs: []ast.Spec{node},\n\t\t})\n\tcase nil:\n\t\t// Node may be nil in case of an error. In that case, just don't add it\n\t\t// as a declaration.\n\tdefault:\n\t\tpanic(\"unexpected AST node\")\n\t}\n\n\t// If this is a struct or union it may need bitfields or union accessor\n\t// methods.\n\tswitch elaboratedType := extra.(type) {\n\tcase *elaboratedTypeInfo:\n\t\t// Add struct bitfields.\n\t\tfor _, bitfield := range elaboratedType.bitfields {\n\t\t\tf.createBitfieldGetter(bitfield, \"C.\"+name)\n\t\t\tf.createBitfieldSetter(bitfield, \"C.\"+name)\n\t\t}\n\t\tif elaboratedType.unionSize != 0 {\n\t\t\t// Create union getters/setters.\n\t\t\tfor _, field := range elaboratedType.typeExpr.Fields.List {\n\t\t\t\tif len(field.Names) != 1 {\n\t\t\t\t\tf.addError(elaboratedType.pos, fmt.Sprintf(\"union must have field with a single name, it has %d names\", len(field.Names)))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tf.createUnionAccessor(field, \"C.\"+name)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn node\n}", "title": "" }, { "docid": "8a0589fd4272f35f812faa1f399b4998", "score": "0.4766433", "text": "func (s *Scopes) FindFunction(name string) *exprpb.Decl {\n\tfor i := len(s.scopes) - 1; i >= 0; i-- {\n\t\tscope := s.scopes[i]\n\t\tif fn, found := scope.functions[name]; found {\n\t\t\treturn fn\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "261ebc68f7e76769bf5caa473df07701", "score": "0.47654554", "text": "func evaluateSelector(sel *ast.SelectorExpr, fields []string) ([]string, error) {\n\tfields = append([]string{sel.Sel.Name}, fields...)\n\tswitch l := sel.X.(type) {\n\tcase *ast.SelectorExpr:\n\t\treturn evaluateSelector(l, fields)\n\n\tcase *ast.Ident:\n\t\tfields = append([]string{l.Name}, fields...)\n\t\treturn fields, nil\n\n\tdefault:\n\t\treturn nil, trace.BadParameter(\"unsupported selector type: %T\", l)\n\t}\n}", "title": "" }, { "docid": "ea95395c3f043d4417b4d29a55f8f206", "score": "0.4705277", "text": "func searchFuncParam(pass *analysis.Pass, f funcDecl, p types.Type) (*ast.Field, int, bool) {\n\tfor i, f := range f.Type.Params.List {\n\t\tif isExprHasType(pass, f.Type, p) {\n\t\t\treturn f, i, true\n\t\t}\n\t}\n\treturn nil, 0, false\n}", "title": "" }, { "docid": "4b0a193d3cef1f5b8e6e7c756fb4a03e", "score": "0.46968463", "text": "func findFuncs(name string, target *regexp.Regexp) ([]*FuncExtent, error) {\n\tfset := token.NewFileSet()\n\tparsedFile, err := parser.ParseFile(fset, name, nil, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvisitor := &FuncVisitor{\n\t\tfset: fset,\n\t\tname: name,\n\t\ttarget: target,\n\t\tastFile: parsedFile,\n\t}\n\tast.Walk(visitor, visitor.astFile)\n\treturn visitor.funcs, nil\n}", "title": "" }, { "docid": "e18c64f1546552cbe40e14bb6d227524", "score": "0.46874094", "text": "func (ImportDecl) symbol() {}", "title": "" }, { "docid": "7c71128ff44fdb46101d6ad78ee03b91", "score": "0.46780345", "text": "func selectExecutor(e *Engine, selectDecl *parser.Decl, conn protocol.EngineConn) error {\n\tvar attributes []Attribute\n\tvar tables []*Table\n\tvar predicates []PredicateLinker\n\tvar functors []selectFunctor\n\tvar joiners []joiner\n\tvar err error\n\n\tselectDecl.Stringy(0)\n\tfor i := range selectDecl.Decl {\n\t\tswitch selectDecl.Decl[i].Token {\n\t\tcase parser.FromToken:\n\t\t\t// get selected tables\n\t\t\ttables = fromExecutor(selectDecl.Decl[i])\n\t\tcase parser.WhereToken:\n\t\t\t// get WHERE declaration\n\t\t\tpred, err := whereExecutor2(e, selectDecl.Decl[i].Decl, tables[0].name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpredicates = []PredicateLinker{pred}\n\t\tcase parser.JoinToken:\n\t\t\tj, err := joinExecutor(selectDecl.Decl[i])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tjoiners = append(joiners, j)\n\t\tcase parser.OrderToken:\n\t\t\torderFunctor, err := orderbyExecutor(selectDecl.Decl[i], tables)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfunctors = append(functors, orderFunctor)\n\t\tcase parser.LimitToken:\n\t\t\tlimit, err := strconv.Atoi(selectDecl.Decl[i].Decl[0].Lexeme)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"wrong limit value: %s\", err)\n\t\t\t}\n\t\t\tconn = limitedConn(conn, limit)\n\t\tcase parser.OffsetToken:\n\t\t\toffset, err := strconv.Atoi(selectDecl.Decl[i].Decl[0].Lexeme)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"wrong offset value: %s\", err)\n\t\t\t}\n\t\t\tconn = offsetedConn(conn, offset)\n\t\t}\n\t}\n\n\tfor i := range selectDecl.Decl {\n\t\tif selectDecl.Decl[i].Token != parser.StringToken &&\n\t\t\tselectDecl.Decl[i].Token != parser.StarToken &&\n\t\t\tselectDecl.Decl[i].Token != parser.CountToken {\n\t\t\tcontinue\n\t\t}\n\n\t\t// get attribute to selected\n\t\tattr, err := getSelectedAttribute(e, selectDecl.Decl[i], tables)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tattributes = append(attributes, attr...)\n\n\t}\n\n\tif len(functors) == 0 {\n\t\t// Instanciate a new select functor\n\t\tfunctors, err = getSelectFunctors(selectDecl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = generateVirtualRows(e, attributes, conn, tables[0].name, joiners, predicates, functors)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1d9a5bbdfb63ee10e08d9d1b0a07e08", "score": "0.46761355", "text": "func extractFunc(\n\tpkg *goloader.PackageInfo,\n\tfset *token.FileSet,\n\texpr *ast.CallExpr,\n) (funcLike, *ast.Ident, []*gotypes.Var) {\n\tvar funcIdent *ast.Ident\n\n\tswitch x := expr.Fun.(type) {\n\n\tcase *ast.Ident: // e.g. ServeHTTP(...)\n\t\tfuncIdent = x\n\n\tcase *ast.SelectorExpr: // e.g. http.ServeHTTP(...)\n\t\tfuncIdent = x.Sel\n\n\tcase *ast.ArrayType: // e.g. []byte(...)\n\t\t// No possibility of errors\n\t\treturn nil, nil, nil\n\n\tcase *ast.IndexExpr: // e.g. rw.beforeFuncs[i](...)\n\t\tswitch y := x.X.(type) {\n\t\tcase *ast.Ident:\n\t\t\tfuncIdent = y\n\t\tcase *ast.SelectorExpr:\n\t\t\tfuncIdent = y.Sel\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown x.X %#v\", x.X))\n\t\t}\n\n\tcase *ast.FuncLit: // e.g. func(){}(...)\n\t\treturn nil, nil, nil // todo\n\n\tcase *ast.ParenExpr: // ???\n\t\treturn nil, nil, nil // todo\n\n\tcase *ast.TypeAssertExpr: // e.g. X.(type)\n\t\treturn nil, nil, nil // todo\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown expr.Fun %#v\", expr.Fun))\n\t}\n\n\tvar funcObj funcLike\n\n\tswitch x := pkg.Uses[funcIdent].(type) {\n\tcase *gotypes.Func:\n\t\tfuncObj = x\n\tcase *gotypes.Var: // closure? method?\n\t\tfuncObj = x\n\tcase *gotypes.TypeName: // huh?\n\t\treturn nil, nil, nil\n\tcase *gotypes.Builtin:\n\t\t// Builtin funcs (e.g. append) do not have types\n\t\treturn nil, nil, nil\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown funcIdent %#v\", pkg.Uses[funcIdent]))\n\t}\n\n\tvar funcSig *gotypes.Signature\n\n\tswitch x := funcObj.Type().(type) {\n\tcase *gotypes.Signature:\n\t\tfuncSig = x\n\tcase *gotypes.Named:\n\t\tfuncSig = x.Underlying().(*gotypes.Signature)\n\tcase *gotypes.Slice: // funcObj is slice of callables\n\t\tfuncSig = x.Elem().Underlying().(*gotypes.Signature)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"not types.Signature %#v\", funcObj.Type()))\n\t}\n\n\tvar funcReturnVars []*gotypes.Var\n\n\tsigReturnVars := funcSig.Results()\n\tfor i := 0; i < sigReturnVars.Len(); i++ {\n\t\tfuncReturnVars = append(funcReturnVars, sigReturnVars.At(i))\n\t}\n\n\treturn funcObj, funcIdent, funcReturnVars\n}", "title": "" }, { "docid": "9c059313d2af52677e3881cd0c36fee2", "score": "0.46385014", "text": "func (fl *FunctionLiteral) expressionNode() {}", "title": "" }, { "docid": "b891ac900e69da26529f285bbc00b22e", "score": "0.46295875", "text": "func isSelector(id string) bool {\n\treturn len(id) > 0 && id[0] == '$'\n}", "title": "" }, { "docid": "ae6810d5ccf83df9a569525f6b0998c2", "score": "0.46154848", "text": "func (c Cursor) OverloadedDecl(index uint32) Cursor {\n\treturn Cursor{C.clang_getOverloadedDecl(c.c, C.uint(index))}\n}", "title": "" }, { "docid": "066c42f2be45111d077ad8545edcab92", "score": "0.46147102", "text": "func FindIdent(ident string) TokenType {\n\tif token, ok := keywords[ident]; ok {\n\t\treturn token\n\t}\n\treturn IDENT\n}", "title": "" }, { "docid": "a2f7bd683593cbe0df0bd2459f7a4622", "score": "0.45789242", "text": "func findFunction(p humanize.Package, t string) (*humanize.File, *humanize.Function, bool) {\n\tfor i := range p.Files {\n\t\tfor j := range p.Files[i].Functions {\n\t\t\tif p.Files[i].Functions[j].Name == t {\n\t\t\t\treturn p.Files[i], p.Files[i].Functions[j], true\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil, false\n}", "title": "" }, { "docid": "fcf571ff0823b0d2e457456f1d94751c", "score": "0.45548627", "text": "func (p *parser) parseFuncDecl() ast.Decl {\n\tfoff := p.match(scanner.FUNC)\n\tvar r *ast.Param\n\tif p.token == '(' {\n\t\tr = p.parseReceiver()\n\t}\n\tname, off := p.matchString(scanner.ID)\n\tsig := p.parseSignature()\n\tvar blk *ast.Block\n\tif p.token == '{' {\n\t\tblk = p.parseBlock()\n\t}\n\tfn := &ast.FuncDecl{\n\t\tOff: off,\n\t\tFile: p.file,\n\t\tName: name,\n\t\tFunc: ast.Func{\n\t\t\tOff: foff,\n\t\t\tRecv: r,\n\t\t\tSig: sig,\n\t\t\tBlk: blk,\n\t\t},\n\t}\n\tfn.Func.Decl = fn\n\treturn fn\n}", "title": "" }, { "docid": "0528c7bb6b1c6e36b7f841d8347d77b3", "score": "0.45190057", "text": "func parseMethodDeclaration(s string) *methodDeclaration {\n\tmatch := methodDeclarationMatch.FindStringSubmatch(s)\n\tif match == nil {\n\t\tmatch = constructorDeclarationMatch.FindStringSubmatch(s)\n\t}\n\tif match == nil {\n\t\treturn nil\n\t}\n\t// match is []string, index 1 is the line number, index 2 is the method name,\n\t// index 3 is the type string,\n\tn, err := strconv.ParseInt(match[1], 10, 32)\n\tif err != nil {\n\t\tglog.Errorf(\"Cannot parse line number from %s\", match[1])\n\t\treturn nil\n\t}\n\t// match 3 looks something like \"_Bool (const void *, size_t) const\"\n\t// We want the args on the inside of the params\n\targs := match[3]\n\ti := strings.Index(args, \"(\")\n\tj := strings.LastIndex(args, \")\")\n\targs = keywords.ReplaceAllString(args[i:j+1], \"\")\n\n\treturn &methodDeclaration{\n\t\tStartLine: int(n),\n\t\tName: match[2] + args,\n\t}\n}", "title": "" }, { "docid": "c67edacb09a9d41b86346263ab4665ea", "score": "0.45159987", "text": "func isTTDecl(pkg *ast.Package, ttIdent string) (*ttDecl, bool) {\n\tvs, ok := containsVar(pkg, ttIdent)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tttD := &ttDecl{pkg: pkg, tt: vs, ttIdent: ttIdent}\n\t// First, attempt to find a function with the name. A function may\n\t// contain underscore also.\n\t// Otherwise attempt to find a method.\n\tident := strings.TrimPrefix(ttIdent, \"tt\")\n\tif fd, ok := containsFunction(pkg, ident); ok {\n\t\tttD.f = fd\n\t\tttD.fIdent = ident\n\t\treturn ttD, true\n\t} else {\n\t\t// Try to find a method, by trying all the various type and\n\t\t// method names that can be inferred from the original ident.\n\t\tparts := strings.Split(ident, \"_\")\n\t\tfor i := 0; i < len(parts)-1; i++ {\n\t\t\ttIdent := strings.Join(parts[:i+1], \"_\") // type ident\n\t\t\tmIdent := strings.Join(parts[i+1:], \"_\") // method ident\n\t\t\tmd, ok := containsMethod(pkg, mIdent, tIdent, true)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttd, ok := containsType(pkg, tIdent)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tttD.f = md\n\t\t\tttD.fIdent = mIdent\n\t\t\tttD.t = td\n\t\t\tttD.tIdent = tIdent\n\t\t\treturn ttD, true\n\t\t}\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "d4b9add290329c160e6cf6de6d83a5da", "score": "0.45075554", "text": "func findAndModifyFunc(n ast.Node, f string) error {\n\tfound := false\n\tast.Inspect(n, func(inner ast.Node) bool {\n\t\tswitch x := inner.(type) {\n\t\tcase *ast.FuncDecl:\n\t\t\tif x.Name.Name == f {\n\t\t\t\tmodifyFunc(x.Body)\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\treturn !found\n\t})\n\tif !found {\n\t\treturn errFuncNotFound\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1172a20cd0da5674844258d33c38be49", "score": "0.4491575", "text": "func (m Method) Declaration() string {\n\treturn m.Name + m.Signature()\n}", "title": "" }, { "docid": "cb417ee98cd1e33512e778191abe6868", "score": "0.44898835", "text": "func extractDecl(tw *trap.Writer, decl ast.Decl, parent trap.Label, idx int) {\n\tlbl := tw.Labeler.LocalID(decl)\n\tvar kind int\n\tswitch decl := decl.(type) {\n\tcase *ast.BadDecl:\n\t\tkind = dbscheme.BadDeclType.Index()\n\tcase *ast.GenDecl:\n\t\tif decl == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch decl.Tok {\n\t\tcase token.IMPORT:\n\t\t\tkind = dbscheme.ImportDeclType.Index()\n\t\tcase token.CONST:\n\t\t\tkind = dbscheme.ConstDeclType.Index()\n\t\tcase token.TYPE:\n\t\t\tkind = dbscheme.TypeDeclType.Index()\n\t\tcase token.VAR:\n\t\t\tkind = dbscheme.VarDeclType.Index()\n\t\tdefault:\n\t\t\tlog.Fatalf(\"unknown declaration of kind %v\", decl.Tok)\n\t\t}\n\t\tfor i, spec := range decl.Specs {\n\t\t\textractSpec(tw, spec, lbl, i)\n\t\t}\n\t\textractDoc(tw, decl.Doc, lbl)\n\tcase *ast.FuncDecl:\n\t\tif decl == nil {\n\t\t\treturn\n\t\t}\n\t\tkind = dbscheme.FuncDeclType.Index()\n\t\textractFields(tw, decl.Recv, lbl, -1, -1)\n\t\textractExpr(tw, decl.Name, lbl, 0)\n\t\textractExpr(tw, decl.Type, lbl, 1)\n\t\textractStmt(tw, decl.Body, lbl, 2)\n\t\textractDoc(tw, decl.Doc, lbl)\n\t\textractTypeParamDecls(tw, decl.Type.TypeParams, lbl)\n\n\t\t// Note that we currently don't extract any kind of declaration for\n\t\t// receiver type parameters. There isn't an explicit declaration, but\n\t\t// we could consider the index/indices of an IndexExpr/IndexListExpr\n\t\t// receiver as declarations.\n\tdefault:\n\t\tlog.Fatalf(\"unknown declaration of type %T\", decl)\n\t}\n\tdbscheme.DeclsTable.Emit(tw, lbl, kind, parent, idx)\n\textractNodeLocation(tw, decl, lbl)\n}", "title": "" }, { "docid": "82aed9d443392c9ae3f0943566629f2d", "score": "0.4483198", "text": "func (node *FuncExpr) ResolvedOverload() *Overload {\n\treturn node.fn\n}", "title": "" }, { "docid": "a5ab0433294baaef5669da4b1cabfc72", "score": "0.44368747", "text": "func (UnqualifiedStar) Variable() {}", "title": "" }, { "docid": "f89443ce21031a938b91972d59376766", "score": "0.4428505", "text": "func (p *Parser) fieldDeclaration(symID string, id string, idType string) ([]string, error) {\n\t// ids of the symbols that are the parameters\n\tparams := []string{}\n\tvar err error\n\ttok := p.lexer.CurrentToken()\n\n\tif tok.LexemeType() == lex.ParenOpen {\n\t\tp.lexer.LexToken()\n\t\ttok = p.lexer.CurrentToken()\n\n\t\tif tokenIsType(tok) {\n\t\t\tparams, err = p.parameterList()\n\t\t\tif err != nil {\n\t\t\t\treturn params, err\n\t\t\t}\n\t\t\tp.lexer.LexToken()\n\t\t\ttok = p.lexer.CurrentToken()\n\t\t}\n\n\t\tif tok.LexemeType() != lex.ParenClose {\n\t\t\treturn params, syntaxError(tok, lex.CloseParen)\n\t\t}\n\n\t\tif !p.secondPass {\n\t\t\tp.addThisToSymbolTable() // all methods have a this\n\t\t}\n\n\t\tif p.secondPass {\n\t\t\tq := icode.NewQuad(symID, icode.FUNC, symID, \"\", \"\", idType+\" \"+id)\n\t\t\tp.icode.AddNewQuad(q)\n\t\t}\n\n\t\tp.lexer.LexToken()\n\t\terr := p.methodBody()\n\t\tif err != nil {\n\t\t\treturn params, err\n\t\t}\n\n\t\tif p.secondPass {\n\t\t\tq := icode.NewQuad(\"\", icode.RTN, \"\", \"\", \"\", idType+\" \"+id)\n\t\t\tp.icode.AddNewQuad(q)\n\t\t}\n\t} else if tok.LexemeType() == lex.ArrayOpen || tok.LexemeType() == lex.Assingment || tok.LexemeType() == lex.Semicolon {\n\t\tif tok.LexemeType() == lex.ArrayOpen {\n\t\t\tp.lexer.LexToken()\n\t\t\ttok = p.lexer.CurrentToken()\n\t\t\tif tok.LexemeType() != lex.ArrayClose {\n\t\t\t\treturn params, syntaxError(tok, lex.CloseBracket)\n\t\t\t}\n\t\t\tp.lexer.LexToken()\n\t\t\ttok = p.lexer.CurrentToken()\n\t\t}\n\n\t\tvar tempIcode icode.Icode\n\t\thasAssign := false\n\t\tif p.secondPass {\n\t\t\t// this way we don't need to\n\t\t\t// change the parsing methods when we are parsing static initilizers.\n\t\t\ttempIcode = p.icode\n\t\t\tp.icode = p.staticInitIcode\n\t\t\tp.currentStaticInitSymID, p.currentMethodSymID = p.currentMethodSymID, p.currentStaticInitSymID\n\n\t\t\t// only ref if next token is an assingment\n\t\t\tif tok.LexemeType() == lex.Assingment {\n\t\t\t\thasAssign = true\n\t\t\t\t// to make sure all the temp stuff adds to the size of the static initilizer\n\t\t\t\tclassName := p.currentScope.SplitScope()[1]\n\t\t\t\tp.currentScope.AddScope(Scope(className + staticInit))\n\n\t\t\t\tthisSymID := p.findStaticInitThisSymID()\n\t\t\t\tif thisSymID == \"\" {\n\t\t\t\t\treturn []string{}, thisSymbolNotFound(p.currentScope)\n\t\t\t\t}\n\n\t\t\t\ttSymID, err := p.addRef(thisSymID, symID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn []string{}, err\n\t\t\t\t}\n\t\t\t\tp.vPush(tSymID, id, p.currentScope, idType)\n\t\t\t} else {\n\t\t\t\tp.vPush(symID, id, p.currentScope, idType)\n\t\t\t}\n\t\t}\n\n\t\tif tok.LexemeType() == lex.Assingment {\n\t\t\tif p.secondPass {\n\t\t\t\terr := p.oPush(tok.Lexeme(), tok.LineNumber())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn []string{}, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tp.lexer.LexToken()\n\t\t\terr := p.assingmentExpression()\n\t\t\tif err != nil {\n\t\t\t\treturn params, err\n\t\t\t}\n\t\t\tp.lexer.LexToken()\n\t\t}\n\n\t\ttok = p.lexer.CurrentToken()\n\t\tif tok.Lexeme() != lex.SemicolonLit {\n\t\t\treturn params, syntaxError(tok, lex.SemicolonLit)\n\t\t}\n\n\t\tif p.secondPass {\n\t\t\terr = p.eoePopAll()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif hasAssign {\n\t\t\t\terr = p.currentScope.PopScope()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.staticInitIcode = p.icode\n\t\t\tp.icode = tempIcode\n\t\t\tp.currentMethodSymID, p.currentStaticInitSymID = p.currentStaticInitSymID, p.currentMethodSymID\n\t\t}\n\t} else {\n\t\treturn params, syntaxError(tok, lex.OpenBracket+\" or \"+lex.Eq+\" or \"+lex.OpenParen)\n\t}\n\n\treturn params, nil\n}", "title": "" }, { "docid": "881979006f55850a50b9ee03f655256c", "score": "0.4409829", "text": "func findFuncs(name string) ([]*FuncExtent, error) {\n\tfset := token.NewFileSet()\n\tparsedFile, err := parser.ParseFile(fset, name, nil, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvisitor := &FuncVisitor{\n\t\tfset: fset,\n\t\tname: name,\n\t\tastFile: parsedFile,\n\t}\n\tast.Walk(visitor, visitor.astFile)\n\treturn visitor.funcs, nil\n}", "title": "" }, { "docid": "aa1a8b4c33f33428c3ee97a3a9b496b7", "score": "0.44075337", "text": "func NewSelector() *selector {\n\treturn &selector{}\n}", "title": "" }, { "docid": "3e234560365e2ae402b18de35ef922f0", "score": "0.43901917", "text": "func (p *Parser) parseFunctionDecl() (AST, error) {\n\t// we already know it starts with \"func\"\n\tfuncToken, _ := p.lexer.GetToken()\n\n\t// get an identifier for the function name or possibly a receiver.\n\ttok, err := p.lexer.PeekToken(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar receiver AST\n\tif tok.TokenKind() == TokenKindOpenBracket {\n\t\t// it's a receiver.\n\t\treceiver, err = p.parseReceiver()\n\n\t\t// take a look at the next token.\n\t\ttok, err = p.lexer.PeekToken(0)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif tok.TokenKind() != TokenKindIdentifier {\n\t\treturn nil, NewError(p.filename, tok.Pos(), fmt.Sprint(\"this should have been a function name, but it's not\"))\n\t}\n\tfuncName := tok.(StringToken).strVal\n\tp.lexer.GetToken()\n\n\t// get a signature.\n\tparams, returns, err := p.parseSignature()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// this might be followed by a function body.\n\tbodyToken, err := p.lexer.PeekToken(0)\n\tvar body AST\n\tif bodyToken.TokenKind() == TokenKindOpenBrace {\n\t\t// parse a function body.\n\t\tbody, err = p.parseBlock()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn ASTFunctionDecl{funcToken.Pos().Add(tok.Pos()), funcName, receiver, params, returns, body}, nil\n}", "title": "" }, { "docid": "4601a2e0900a1b2b914d71f086504c3e", "score": "0.43779302", "text": "func (p *Parser) parseSelector() SimpleSelector {\n\tm := SimpleSelector{class: map[int]string{}}\nLoopsel:\n\tfor !p.eof() {\n\t\tc := p.nextChar()\n\t\tswitch {\n\t\tcase c == \"#\":\n\t\t\tp.consumeChar()\n\t\t\tm.id = p.parseIdentifier()\n\t\tcase c == \".\":\n\t\t\tp.consumeChar()\n\t\t\tm.class[len(m.class)] = p.parseIdentifier()\n\t\tcase c == \"*\":\n\t\t\t// universal selector\n\t\t\tp.consumeChar()\n\t\tcase validIdentifierChar(c):\n\t\t\tm.tag_name = p.parseIdentifier()\n\t\tdefault:\n\t\t\tbreak Loopsel\n\t\t}\n\t\tp.consumeWhitespace()\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2c039358b587b30fb567ca9979b38429", "score": "0.4359007", "text": "func (i *Identifier) expressionNode() {}", "title": "" }, { "docid": "2c039358b587b30fb567ca9979b38429", "score": "0.4359007", "text": "func (i *Identifier) expressionNode() {}", "title": "" }, { "docid": "cacd4ff4b8804587b7e6d08202c56bf6", "score": "0.43554157", "text": "func (d *defaultDispatcher) FindOverload(overload string) (*functions.Overload, bool) {\n\to, found := d.overloads[overload]\n\treturn o, found\n}", "title": "" }, { "docid": "49f5d443af578af780677e875e2fd105", "score": "0.43265095", "text": "func (p *parser) acceptFuncDeclare() (*node.PosNode, *node.ErrorNode) {\n\tif !p.accept(tokenFunc) {\n\t\treturn nil, p.errorf(\n\t\t\t\"expected %s but got %s\",\n\t\t\ttokenName(tokenFunc),\n\t\t\ttokenName(p.peek().typ),\n\t\t)\n\t}\n\tpos := p.token.pos\n\n\tvar mods []string\n\tvar name string\n\tvar args []argument\n\tvar retType string\n\tvar err *node.ErrorNode\n\n\t// Modifiers\n\tif p.accept(tokenLt) {\n\t\tp.backup()\n\t\tmods, err = p.acceptModifiers()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Function name (if empty, this is an expression not a statement)\n\tif p.accept(tokenIdentifier) {\n\t\tname = p.token.val\n\t}\n\n\t// functionCallSignature\n\targs, retType, err = p.acceptFunctionCallSignature()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := &funcDeclareStatement{mods, name, args, retType}\n\treturn node.NewPosNode(pos, f), nil\n}", "title": "" }, { "docid": "5ee21cc73cfd7fe708b2cd9183f46b46", "score": "0.43226498", "text": "func identOnlySelector(sel ast.Node) error {\n\tvar err error\n\tast.Inspect(sel, func(node ast.Node) bool {\n\t\tif node == nil {\n\t\t\treturn false\n\t\t}\n\t\tswitch v := node.(type) {\n\t\tcase *ast.SelectorExpr:\n\t\t\treturn true\n\t\tcase *ast.Ident:\n\t\t\treturn true\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"unsupported syntax %T in ref %q\", toStr(sel), v)\n\t\t\treturn false\n\t\t}\n\t})\n\treturn err\n}", "title": "" }, { "docid": "ee678e9c8b7d8831e8b3024ad3a38432", "score": "0.43178043", "text": "func (s *baseNode) FindDeclarationsByType(nodeType NodeType) []*Ident {\n\treturn s.findIdents(s.Info().Defs, func(node *Ident) bool {\n\t\treturn node.Parent().IsNodeType(nodeType)\n\t})\n}", "title": "" }, { "docid": "33a52398c11c81a7c8bac6cc77bceffc", "score": "0.43068883", "text": "func ExprDeclToDeclaration(d *exprpb.Decl) (EnvOption, error) {\n\tswitch d.GetDeclKind().(type) {\n\tcase *exprpb.Decl_Function:\n\t\toverloads := d.GetFunction().GetOverloads()\n\t\topts := make([]FunctionOpt, len(overloads))\n\t\tfor i, o := range overloads {\n\t\t\targs := make([]*Type, len(o.GetParams()))\n\t\t\tfor j, p := range o.GetParams() {\n\t\t\t\ta, err := types.ExprTypeToType(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\targs[j] = a\n\t\t\t}\n\t\t\tres, err := types.ExprTypeToType(o.GetResultType())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif o.IsInstanceFunction {\n\t\t\t\topts[i] = decls.MemberOverload(o.GetOverloadId(), args, res)\n\t\t\t} else {\n\t\t\t\topts[i] = decls.Overload(o.GetOverloadId(), args, res)\n\t\t\t}\n\t\t}\n\t\treturn Function(d.GetName(), opts...), nil\n\tcase *exprpb.Decl_Ident:\n\t\tt, err := types.ExprTypeToType(d.GetIdent().GetType())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif d.GetIdent().GetValue() == nil {\n\t\t\treturn Variable(d.GetName(), t), nil\n\t\t}\n\t\tval, err := ast.ConstantToVal(d.GetIdent().GetValue())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn Constant(d.GetName(), t, val), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported decl: %v\", d)\n\t}\n}", "title": "" }, { "docid": "d4a9630118c9d05cb778319dc686b18b", "score": "0.43058214", "text": "func Sel(x ast.Expr, sel string) *ast.SelectorExpr {\n\treturn &ast.SelectorExpr{X: x, Sel: &ast.Ident{Name: sel}}\n}", "title": "" }, { "docid": "c59394d9ea87e92d4ebf8184b387e2c1", "score": "0.43020853", "text": "func (*BadExpr) exprNode() {}", "title": "" }, { "docid": "c59394d9ea87e92d4ebf8184b387e2c1", "score": "0.43020853", "text": "func (*BadExpr) exprNode() {}", "title": "" }, { "docid": "2d9a1b223f2c6b3f0dce8a934724eb93", "score": "0.42860532", "text": "func (s *baseNode) FindFirstUsage(declaration *Ident) *Ident {\n\tusgs := s.FindUsages(declaration)\n\n\tvar (\n\t\tfirstUsage *Ident\n\t\tminPos token.Pos = math.MaxInt32\n\t)\n\tfor _, usage := range usgs {\n\t\tif usage.NamePos < minPos {\n\t\t\tminPos = usage.NamePos\n\t\t\tfirstUsage = usage\n\t\t}\n\t}\n\treturn firstUsage\n}", "title": "" }, { "docid": "7318f62117e82d50b6ce18d19f4b6017", "score": "0.42828715", "text": "func funcSym(fn *Node) *types.Sym {\n\tif fn == nil || fn.Func.Nname == nil {\n\t\treturn nil\n\t}\n\treturn fn.Func.Nname.Sym\n}", "title": "" }, { "docid": "c7e233b1b17b7d9e3c835cad240e5125", "score": "0.42817485", "text": "func FindValidateFunc(funcName string) AnnotationValidateFunc {\n\tfor _, f := range AnnotationValidateFuncs {\n\t\t// extract the function name into a string , it will be like following\n\t\t// github.com/apache/skywalking-swck/pkg/operator/injector.ValidateBool\n\t\tfname := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()\n\t\t// get real validate function name in injector\n\t\tindex := strings.LastIndex(fname, \".\")\n\t\tfuncname := fname[index+1:]\n\n\t\tif funcname == funcName {\n\t\t\treturn f\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c466d7d1d670f66395ea560cfd66e57c", "score": "0.42783332", "text": "func (n FunctionDefinition) Stmt() {}", "title": "" }, { "docid": "0e316fb3e0e8b70c4f4e1c2ceab6038e", "score": "0.42720038", "text": "func findInterestingNode(pkginfo *loader.PackageInfo, path []ast.Node) ([]ast.Node, action) {\n\t// TODO(adonovan): integrate with go/types/stdlib_test.go and\n\t// apply this to every AST node we can find to make sure it\n\t// doesn't crash.\n\n\t// TODO(adonovan): audit for ParenExpr safety, esp. since we\n\t// traverse up and down.\n\n\t// TODO(adonovan): if the users selects the \".\" in\n\t// \"fmt.Fprintf()\", they'll get an ambiguous selection error;\n\t// we won't even reach here. Can we do better?\n\n\t// TODO(adonovan): describing a field within 'type T struct {...}'\n\t// describes the (anonymous) struct type and concludes \"no methods\".\n\t// We should ascend to the enclosing type decl, if any.\n\n\tfor len(path) > 0 {\n\t\tswitch n := path[0].(type) {\n\t\tcase *ast.GenDecl:\n\t\t\tif len(n.Specs) == 1 {\n\t\t\t\t// Descend to sole {Import,Type,Value}Spec child.\n\t\t\t\tpath = append([]ast.Node{n.Specs[0]}, path...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn path, actionUnknown // uninteresting\n\n\t\tcase *ast.FuncDecl:\n\t\t\t// Descend to function name.\n\t\t\tpath = append([]ast.Node{n.Name}, path...)\n\t\t\tcontinue\n\n\t\tcase *ast.ImportSpec:\n\t\t\treturn path, actionPackage\n\n\t\tcase *ast.ValueSpec:\n\t\t\tif len(n.Names) == 1 {\n\t\t\t\t// Descend to sole Ident child.\n\t\t\t\tpath = append([]ast.Node{n.Names[0]}, path...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn path, actionUnknown // uninteresting\n\n\t\tcase *ast.TypeSpec:\n\t\t\t// Descend to type name.\n\t\t\tpath = append([]ast.Node{n.Name}, path...)\n\t\t\tcontinue\n\n\t\tcase *ast.Comment, *ast.CommentGroup, *ast.File, *ast.KeyValueExpr, *ast.CommClause:\n\t\t\treturn path, actionUnknown // uninteresting\n\n\t\tcase ast.Stmt:\n\t\t\treturn path, actionStmt\n\n\t\tcase *ast.ArrayType,\n\t\t\t*ast.StructType,\n\t\t\t*ast.FuncType,\n\t\t\t*ast.InterfaceType,\n\t\t\t*ast.MapType,\n\t\t\t*ast.ChanType:\n\t\t\treturn path, actionType\n\n\t\tcase *ast.Ellipsis:\n\t\t\t// Continue to enclosing node.\n\t\t\t// e.g. [...]T in ArrayType\n\t\t\t// f(x...) in CallExpr\n\t\t\t// f(x...T) in FuncType\n\n\t\tcase *ast.Field:\n\t\t\t// TODO(adonovan): this needs more thought,\n\t\t\t// since fields can be so many things.\n\t\t\tif len(n.Names) == 1 {\n\t\t\t\t// Descend to sole Ident child.\n\t\t\t\tpath = append([]ast.Node{n.Names[0]}, path...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Zero names (e.g. anon field in struct)\n\t\t\t// or multiple field or param names:\n\t\t\t// continue to enclosing field list.\n\n\t\tcase *ast.FieldList:\n\t\t\t// Continue to enclosing node:\n\t\t\t// {Struct,Func,Interface}Type or FuncDecl.\n\n\t\tcase *ast.BasicLit:\n\t\t\tif _, ok := path[1].(*ast.ImportSpec); ok {\n\t\t\t\treturn path[1:], actionPackage\n\t\t\t}\n\t\t\treturn path, actionExpr\n\n\t\tcase *ast.SelectorExpr:\n\t\t\t// TODO(adonovan): use Selections info directly.\n\t\t\tif pkginfo.Uses[n.Sel] == nil {\n\t\t\t\t// TODO(adonovan): is this reachable?\n\t\t\t\treturn path, actionUnknown\n\t\t\t}\n\t\t\t// Descend to .Sel child.\n\t\t\tpath = append([]ast.Node{n.Sel}, path...)\n\t\t\tcontinue\n\n\t\tcase *ast.Ident:\n\t\t\tswitch pkginfo.ObjectOf(n).(type) {\n\t\t\tcase *types.PkgName:\n\t\t\t\treturn path, actionPackage\n\n\t\t\tcase *types.Const:\n\t\t\t\treturn path, actionExpr\n\n\t\t\tcase *types.Label:\n\t\t\t\treturn path, actionStmt\n\n\t\t\tcase *types.TypeName:\n\t\t\t\treturn path, actionType\n\n\t\t\tcase *types.Var:\n\t\t\t\t// For x in 'struct {x T}', return struct type, for now.\n\t\t\t\tif _, ok := path[1].(*ast.Field); ok {\n\t\t\t\t\t_ = path[2].(*ast.FieldList) // assertion\n\t\t\t\t\tif _, ok := path[3].(*ast.StructType); ok {\n\t\t\t\t\t\treturn path[3:], actionType\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn path, actionExpr\n\n\t\t\tcase *types.Func:\n\t\t\t\treturn path, actionExpr\n\n\t\t\tcase *types.Builtin:\n\t\t\t\t// For reference to built-in function, return enclosing call.\n\t\t\t\tpath = path[1:] // ascend to enclosing function call\n\t\t\t\tcontinue\n\n\t\t\tcase *types.Nil:\n\t\t\t\treturn path, actionExpr\n\t\t\t}\n\n\t\t\t// No object.\n\t\t\tswitch path[1].(type) {\n\t\t\tcase *ast.SelectorExpr:\n\t\t\t\t// Return enclosing selector expression.\n\t\t\t\treturn path[1:], actionExpr\n\n\t\t\tcase *ast.Field:\n\t\t\t\t// TODO(adonovan): test this.\n\t\t\t\t// e.g. all f in:\n\t\t\t\t// struct { f, g int }\n\t\t\t\t// interface { f() }\n\t\t\t\t// func (f T) method(f, g int) (f, g bool)\n\t\t\t\t//\n\t\t\t\t// switch path[3].(type) {\n\t\t\t\t// case *ast.FuncDecl:\n\t\t\t\t// case *ast.StructType:\n\t\t\t\t// case *ast.InterfaceType:\n\t\t\t\t// }\n\t\t\t\t//\n\t\t\t\t// return path[1:], actionExpr\n\t\t\t\t//\n\t\t\t\t// Unclear what to do with these.\n\t\t\t\t// Struct.Fields -- field\n\t\t\t\t// Interface.Methods -- field\n\t\t\t\t// FuncType.{Params.Results} -- actionExpr\n\t\t\t\t// FuncDecl.Recv -- actionExpr\n\n\t\t\tcase *ast.File:\n\t\t\t\t// 'package foo'\n\t\t\t\treturn path, actionPackage\n\n\t\t\tcase *ast.ImportSpec:\n\t\t\t\treturn path[1:], actionPackage\n\n\t\t\tdefault:\n\t\t\t\t// e.g. blank identifier\n\t\t\t\t// or y in \"switch y := x.(type)\"\n\t\t\t\t// or code in a _test.go file that's not part of the package.\n\t\t\t\treturn path, actionUnknown\n\t\t\t}\n\n\t\tcase *ast.StarExpr:\n\t\t\tif pkginfo.Types[n].IsType() {\n\t\t\t\treturn path, actionType\n\t\t\t}\n\t\t\treturn path, actionExpr\n\n\t\tcase ast.Expr:\n\t\t\t// All Expr but {BasicLit,Ident,StarExpr} are\n\t\t\t// \"true\" expressions that evaluate to a value.\n\t\t\treturn path, actionExpr\n\t\t}\n\n\t\t// Ascend to parent.\n\t\tpath = path[1:]\n\t}\n\n\treturn nil, actionUnknown // unreachable\n}", "title": "" }, { "docid": "cc4e64776bc60082170e019ddd9c1e8a", "score": "0.42550927", "text": "func IsSelectorExpr(node ast.Node) bool {\n\t_, ok := node.(*ast.SelectorExpr)\n\treturn ok\n}", "title": "" }, { "docid": "e20c6f38d722bde15aba071abedcfdcb", "score": "0.4251425", "text": "func locateFuncSigs(input []byte) (map[bin.Address]FuncSig, error) {\n\tconst regFuncSig = `(;[ \\t]*([^\\n]+))?[\\n][.]text[:]00([0-9a-fA-F]+)[ \\t]+([a-zA-Z0-9_?@$]+)[ \\t]+proc[ \\t]near`\n\tre, err := regexp.Compile(regFuncSig)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tsubs := re.FindAllSubmatch(input, -1)\n\tsigs := make(map[bin.Address]FuncSig)\n\tfor _, sub := range subs {\n\t\tvar sig FuncSig\n\t\t// parse function signature.\n\t\tsig.Sig = string(sub[2])\n\t\t// parse address.\n\t\ts := string(sub[3])\n\t\tx, err := strconv.ParseUint(s, 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\taddr := bin.Address(x)\n\t\t// parse function name.\n\t\tsig.Name = string(sub[4])\n\t\tsigs[addr] = sig\n\t}\n\treturn sigs, nil\n}", "title": "" }, { "docid": "388ab68c9224b3048901ed11f8b94e09", "score": "0.4242931", "text": "func callSelector(x, sel string, args []ast.Expr) ast.Expr {\n\treturn &ast.CallExpr{\n\t\tFun: &ast.SelectorExpr{\n\t\t\tX: &ast.Ident{Name: x},\n\t\t\tSel: &ast.Ident{Name: sel}},\n\t\tArgs: args,\n\t}\n}", "title": "" }, { "docid": "30211fcedc9f028db75c9367bef9850c", "score": "0.4239676", "text": "func (macros Macros) Find(m Macro) int {\n\tfor i, v := range macros {\n\t\tif v.Condition == m.Condition {\n\t\t\tif (v.Type == \"variable\" && v.Name == m.Name) || (v.Type == \"function\" && getFunctionName(v.Name) == m.Name) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "1d0ba4263bd8c1f861ed71884404fd5f", "score": "0.42386273", "text": "func FindMethod(recvType reflect.Type, funcVal reflect.Value) *reflect.Method {\n\t// It is not possible to get the name of the method from the Func.\n\t// Instead, compare it to each method of the Controller.\n\tfor i := 0; i < recvType.NumMethod(); i++ {\n\t\tmethod := recvType.Method(i)\n\t\tif method.Func.Pointer() == funcVal.Pointer() {\n\t\t\treturn &method\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95a3a923bb77c0453215837f2d3f40cc", "score": "0.42328835", "text": "func (a *Field) Declaration() string {\n\treturn fmt.Sprintf(\"%s %s\", a.Name(), a.ArgType())\n}", "title": "" }, { "docid": "4f457cf1d5b250820aced9f4d7c87f60", "score": "0.42308834", "text": "func (r *OpRule) isSelectorExprDeprecated(sel *ast.SelectorExpr) []error {\n\tmethodName := sel.Sel.Name\n\n\tvar infos []pepperlint.TypeInfo\n\tvar ok bool\n\terrs := []error{}\n\n\texternalPkg := false\n\tif infos, ok = r.getExternalPackageType(sel.X); ok {\n\t\texternalPkg = true\n\t} else if infos, ok = r.getInternalPackageType(sel.X); !ok {\n\t\treturn nil\n\t}\n\n\tfor _, info := range infos {\n\t\tspec := info.Spec\n\t\tvar pkg *pepperlint.Package\n\t\tfound := false\n\n\t\tif externalPkg {\n\t\t\tfile, ok := r.helper.PackagesCache.CurrentFile()\n\t\t\tif !ok {\n\t\t\t\tpanic(\"CurrentFile was not properly set\")\n\t\t\t}\n\n\t\t\tpkgImportPath := file.Imports[info.PkgName]\n\t\t\tpkg, found = r.helper.PackagesCache.Packages.Get(pkgImportPath)\n\t\t} else {\n\t\t\tpkg, found = r.helper.PackagesCache.CurrentPackage()\n\t\t}\n\n\t\t// Potentially received a package we didn't crawl for the cache\n\t\tif !found {\n\t\t\tcontinue\n\t\t}\n\n\t\topInfo, ok := pkg.Files.GetOpInfo(methodName)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check to see if the type has the associated method name\n\t\tif spec != nil && !opInfo.HasReceiverType(spec) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif hasDeprecatedComment(opInfo.Decl.Doc) {\n\t\t\terrs = append(errs, pepperlint.NewErrorWrap(\n\t\t\t\tr.fset,\n\t\t\t\tsel,\n\t\t\t\tfmt.Sprintf(\"deprecated '%s.%s' struct used\", r.currentPkgName, opInfo.Decl.Name),\n\t\t\t))\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "4c8a43b2e9b187d44c82b3c9c1f84c61", "score": "0.42228642", "text": "func Name(n Node) string {\n\tswitch n := n.(type) {\n\tcase *Ident:\n\t\tif n == nil {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn n.String()\n\tcase *SelectorExpr:\n\t\tname := Name(n.X)\n\t\tif n.Sel != nil {\n\t\t\tname += \".\" + Name(n.Sel)\n\t\t}\n\t\treturn name\n\tcase *CallExpr:\n\t\treturn Name(n.Fun)\n\tcase *LengthExpr:\n\t\treturn Name(n.X)\n\tcase *ParametrizedIdent:\n\t\treturn Name(n.Ident)\n\tcase *Module:\n\t\treturn Name(n.Name)\n\tcase *Field:\n\t\treturn Name(n.Name)\n\tcase *PortTypeDecl:\n\t\treturn Name(n.Name)\n\tcase *ComponentTypeDecl:\n\t\treturn Name(n.Name)\n\tcase *StructTypeDecl:\n\t\treturn Name(n.Name)\n\tcase *EnumTypeDecl:\n\t\treturn Name(n.Name)\n\tcase *BehaviourTypeDecl:\n\t\treturn Name(n.Name)\n\tcase *Declarator:\n\t\treturn Name(n.Name)\n\tcase *FormalPar:\n\t\treturn Name(n.Name)\n\tcase *TemplateDecl:\n\t\treturn Name(n.Name)\n\tcase *FuncDecl:\n\t\treturn Name(n.Name)\n\tcase *RefSpec:\n\t\treturn Name(n.X)\n\tcase *SignatureDecl:\n\t\treturn Name(n.Name)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "02b2e0b0e5de7618cd531f6798d67e38", "score": "0.42190504", "text": "func parseFuncQuery(decl ast.Decl, info *types.Info) *Query {\n\tfn, ok := decl.(*ast.FuncDecl)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tsql, typ, ok := parseQuery(fn.Doc.Text())\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn &Query{\n\t\tName: fn.Name.Name,\n\t\tQueryString: sql,\n\t\tArgs: parseArgs(fn, info),\n\t\tBindArgs: parseBindArgs(fn, info),\n\t\tType: typ,\n\t}\n}", "title": "" }, { "docid": "d29903fb38ce333bd4a1fe5f15222137", "score": "0.4202602", "text": "func Find(node *html.Node, selector string) []*html.Node {\n\tselectors := parseSelector(selector)\n\n\treturn findNodes(node, selectors)\n}", "title": "" }, { "docid": "a38ca9d19db8e89a69ae1a60a7a30d63", "score": "0.42022896", "text": "func (p *Parser) parseDeclaration() Declaration {\n\tname := p.parseIdentifier()\n\tp.consumeWhitespace()\n\tfor p.consumeChar() != \":\" {\n\t}\n\tp.consumeWhitespace()\n\tvalue := p.parseValue()\n\tp.consumeWhitespace()\n\tfor p.consumeChar() != \";\" {\n\t}\n\n\treturn Declaration{name, value}\n}", "title": "" }, { "docid": "3b81d76f1a1b146239103bb216d5b814", "score": "0.41965672", "text": "func findStruct(scope *ast.Scope, name string) *ast.StructType {\n\tobj := scope.Lookup(name)\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\ttyp, ok := obj.Decl.(*ast.TypeSpec)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tstr, ok := typ.Type.(*ast.StructType)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "c256328fea265c6fbd98b3c18e3c61a9", "score": "0.41927332", "text": "func (m methodDeclarations) find(startLine int, name string) (int, bool) {\n\ti := sort.Search(len(m), func(i int) bool { return m[i].StartLine >= startLine })\n\t// Test to see if it is in the list\n\tif !(i < len(m) && m[i].Name == name && m[i].StartLine == startLine) {\n\t\treturn i, false\n\t}\n\treturn i, true\n}", "title": "" }, { "docid": "1fa7cc744f15685eb60e74e4ebf91aa8", "score": "0.4183981", "text": "func (o AclBindingRuleOutput) Selector() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AclBindingRule) pulumi.StringPtrOutput { return v.Selector }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "32506f27e3caded0e0f175198f5f0ac7", "score": "0.41806117", "text": "func NewSelector() Selector {\n\treturn Selector{}\n}", "title": "" }, { "docid": "1441d0333a6bb696b5f55c009c0f35a2", "score": "0.41771647", "text": "func (s *Scopes) FindIdent(name string) *exprpb.Decl {\n\tfor i := len(s.scopes) - 1; i >= 0; i-- {\n\t\tscope := s.scopes[i]\n\t\tif ident, found := scope.idents[name]; found {\n\t\t\treturn ident\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "681ccb40833f200a4cbd8664c54c705e", "score": "0.4175428", "text": "func (this *Selection) IndexSelector(selector string) int {\n\tif len(this.Nodes) > 0 {\n\t\tsel := this.document.Find(selector)\n\t\treturn indexInSlice(sel.Nodes, this.Nodes[0])\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "d2e2f042bd18191ef810d8e83a239daf", "score": "0.4170678", "text": "func hasCall(f ast.Node, mod, sym string) bool {\n\tfound := false\n\tast.Inspect(f, func(n ast.Node) bool {\n\t\tswitch x := n.(type) {\n\t\tcase *ast.SelectorExpr:\n\t\t\tif m, ok := x.X.(*ast.Ident); ok {\n\t\t\t\tif m.Name == mod && x.Sel.Name == sym {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn !found\n\t})\n\treturn found\n}", "title": "" }, { "docid": "99c0c176ac913f6d1f34f6029b5ecab2", "score": "0.41552278", "text": "func (p *parser) acceptFunction(isExpr bool) (*node.PosNode, *node.ErrorNode) {\n\tdeclare, err := p.acceptFuncDeclare()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// No body, declaration only.\n\tt := p.peek()\n\tif t.typ == tokenNewline || t.typ == tokenEOF {\n\t\treturn declare, nil\n\t}\n\tif p.declareOnly {\n\t\tp.drain()\n\t\treturn nil, p.declareOnlyError(p.peek().pos)\n\t}\n\n\tvar bodyIsStmt bool\n\tvar body []node.Node\n\n\t// Body\n\tif p.accept(tokenCOpen) {\n\t\tp.backup()\n\t\tbodyIsStmt = true\n\t\tblock, err := p.acceptBlock()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbody = block\n\t} else {\n\t\texpr, err := p.acceptExpr()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbody = []node.Node{expr}\n\t}\n\n\tfuncNode := &funcStmtOrExpr{\n\t\tdeclare.TerminalNode().(*funcDeclareStatement),\n\t\tbodyIsStmt,\n\t\tbody,\n\t\tisExpr,\n\t}\n\treturn node.NewPosNode(declare.Position(), funcNode), nil\n}", "title": "" }, { "docid": "de2e932002336fa230b6cc59615f2058", "score": "0.41510838", "text": "func (sei *session) getFuncExprs(stmt *sqlparser.Select) map[int]string {\n\tvar f *sqlparser.FuncExpr\n\tfuncExprs := make(map[int]string)\n\n\tfor i, expr := range stmt.SelectExprs {\n\t\tnonStarExpr, ok := expr.(*sqlparser.NonStarExpr)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tf, ok = nonStarExpr.Expr.(*sqlparser.FuncExpr)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tf = nonStarExpr.Expr.(*sqlparser.FuncExpr)\n\t\t\tname, ok := funcNameMap[string(f.Name)]\n\t\t\tif ok {\n\t\t\t\tfuncExprs[i] = name\n\t\t\t}\n\t\t}\n\t}\n\treturn funcExprs\n}", "title": "" }, { "docid": "296c2109c0d42574b197d490c51bc48b", "score": "0.41506597", "text": "func docComment(prog *loader.Program, sel *types.Selection) string {\n\tobj := sel.Obj()\n\ttokFile := prog.Fset.File(obj.Pos())\n\tif tokFile == nil {\n\t\tpanic(\"no file found for method\")\n\t}\n\tfilename := tokFile.Name()\n\tfor _, pkgInfo := range prog.AllPackages {\n\t\tfor _, f := range pkgInfo.Files {\n\t\t\tif tokFile := prog.Fset.File(f.Pos()); tokFile == nil || tokFile.Name() != filename {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// We've found the file we're looking for. Now traverse all\n\t\t\t// top level declarations looking for the right function declaration.\n\t\t\tfor _, decl := range f.Decls {\n\t\t\t\tfdecl, ok := decl.(*ast.FuncDecl)\n\t\t\t\tif ok && fdecl.Name.Pos() == obj.Pos() {\n\t\t\t\t\t// Found it!\n\t\t\t\t\treturn commentStr(fdecl.Doc)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tpanic(\"method declaration not found\")\n}", "title": "" }, { "docid": "0cff983d32959cdb1f1e249dbb624eda", "score": "0.41485456", "text": "func SignatureExpr(expr string) { ctx.SignatureExpr(expr) }", "title": "" }, { "docid": "a8ee96189cc856b697b6e385ecd597a5", "score": "0.4139564", "text": "func SelectNodeByName(serviceName, nodeID string) func([]*registry.Service) selector.Next {\n\treturn func(services []*registry.Service) selector.Next {\n\t\tvar node *registry.Node\n\n\t\tfor _, service := range services {\n\t\t\tif service.Name != serviceName {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, n := range service.Nodes {\n\t\t\t\tif n.Id == nodeID {\n\t\t\t\t\tnode = n\n\t\t\t\t\tbreak // We've found the node, no need to explore the rest\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn func() (*registry.Node, error) {\n\t\t\tif node == nil {\n\t\t\t\treturn nil, selector.ErrNoneAvailable\n\t\t\t}\n\t\t\treturn node, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b92f4f2ca542cf007ecdbd49b281e1b", "score": "0.41359836", "text": "func (c Cursor) SelectorIndex() int32 {\n\treturn int32(C.clang_Cursor_getObjCSelectorIndex(c.c))\n}", "title": "" }, { "docid": "c156e871a1103c7e7bd62d9fbbc65411", "score": "0.41297734", "text": "func (p *Package) Find(name string) (kind SymKind, v interface{}, ok bool) {\n\tif v, ok = p.syms[name]; !ok {\n\t\treturn\n\t}\n\tswitch v.(type) {\n\tcase *constVal:\n\t\tkind = SymConst\n\tcase *exec.Var:\n\t\tkind = SymVar\n\tcase *funcDecl:\n\t\tkind = SymFunc\n\tcase *typeDecl:\n\t\tkind = SymType\n\tdefault:\n\t\tlog.Panicln(\"Package.Find: unknown symbol type -\", reflect.TypeOf(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d2d66d63364171478d63aca75b99b876", "score": "0.41213873", "text": "func TestFunctionSelector1(t *testing.T) {\n func_sig := \"identity(uint256)\"\n expected := \"0xac37eebb\"\n actual := FunctionSelector(\"identity\", \"uint256\")\n cryptoTestError(t, func_sig, expected, actual)\n}", "title": "" }, { "docid": "7db10bb8335574e631652763c8eb7a68", "score": "0.4118747", "text": "func FindHoverContext(ctx context.Context, s Snapshot, pkg Package, obj types.Object, pkgNode ast.Node, fullDecl ast.Decl) (*HoverContext, error) {\n\tvar info *HoverContext\n\n\t// Type parameters get their signature from their declaration object.\n\tif _, isTypeName := obj.(*types.TypeName); isTypeName {\n\t\tif _, isTypeParam := obj.Type().(*typeparams.TypeParam); isTypeParam {\n\t\t\treturn &HoverContext{signatureSource: obj}, nil\n\t\t}\n\t}\n\n\t// This is problematic for a number of reasons. We really need to have a more\n\t// general mechanism to validate the coherency of AST with type information,\n\t// but absent that we must do our best to ensure that we don't use fullNode\n\t// when we actually need the node that was type checked.\n\t//\n\t// pkgNode may be nil, if it was eliminated from the type-checked syntax. In\n\t// that case, use fullDecl if available.\n\tnode := pkgNode\n\tif node == nil && fullDecl != nil {\n\t\tnode = fullDecl\n\t}\n\n\tswitch node := node.(type) {\n\tcase *ast.Ident:\n\t\t// The package declaration.\n\t\tfor _, f := range pkg.GetSyntax() {\n\t\t\tif f.Name == pkgNode {\n\t\t\t\tinfo = &HoverContext{Comment: f.Doc}\n\t\t\t}\n\t\t}\n\tcase *ast.ImportSpec:\n\t\t// Try to find the package documentation for an imported package.\n\t\timportPath, err := strconv.Unquote(node.Path.Value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timp, err := pkg.ResolveImportPath(ImportPath(importPath))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Assume that only one file will contain package documentation,\n\t\t// so pick the first file that has a doc comment.\n\t\tfor _, file := range imp.GetSyntax() {\n\t\t\tif file.Doc != nil {\n\t\t\t\tinfo = &HoverContext{Comment: file.Doc}\n\t\t\t\tif file.Name != nil {\n\t\t\t\t\tinfo.signatureSource = \"package \" + file.Name.Name\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\tcase *ast.GenDecl:\n\t\tswitch obj := obj.(type) {\n\t\tcase *types.TypeName, *types.Var, *types.Const, *types.Func:\n\t\t\t// Always use the full declaration here if we have it, because the\n\t\t\t// dependent code doesn't rely on pointer identity. This is fragile.\n\t\t\tif d, _ := fullDecl.(*ast.GenDecl); d != nil {\n\t\t\t\tnode = d\n\t\t\t}\n\t\t\t// obj may not have been produced by type checking the AST containing\n\t\t\t// node, so we need to be careful about using token.Pos.\n\t\t\ttok := pkg.FileSet().File(obj.Pos())\n\t\t\toffset, err := safetoken.Offset(tok, obj.Pos())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// fullTok and fullPos are the *token.File and object position in for the\n\t\t\t// full AST.\n\t\t\tfullTok := pkg.FileSet().File(node.Pos())\n\t\t\tfullPos, err := safetoken.Pos(fullTok, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar spec ast.Spec\n\t\t\tfor _, s := range node.Specs {\n\t\t\t\t// Avoid panics by guarding the calls to token.Offset (golang/go#48249).\n\t\t\t\tstart, err := safetoken.Offset(fullTok, s.Pos())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tend, err := safetoken.Offset(fullTok, s.End())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif start <= offset && offset <= end {\n\t\t\t\t\tspec = s\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinfo, err = hoverGenDecl(node, spec, fullPos, obj)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\tcase *ast.TypeSpec:\n\t\tif obj.Parent() == types.Universe {\n\t\t\tif genDecl, ok := fullDecl.(*ast.GenDecl); ok {\n\t\t\t\tinfo = hoverTypeSpec(node, genDecl)\n\t\t\t}\n\t\t}\n\tcase *ast.FuncDecl:\n\t\tswitch obj.(type) {\n\t\tcase *types.Func:\n\t\t\tinfo = &HoverContext{signatureSource: obj, Comment: node.Doc}\n\t\tcase *types.Builtin:\n\t\t\tinfo = &HoverContext{Comment: node.Doc}\n\t\t\tif sig, err := NewBuiltinSignature(ctx, s, obj.Name()); err == nil {\n\t\t\t\tinfo.signatureSource = \"func \" + sig.name + sig.Format()\n\t\t\t} else {\n\t\t\t\t// Fall back on the object as a signature source.\n\t\t\t\tbug.Report(\"invalid builtin hover\", bug.Data{\n\t\t\t\t\t\"err\": err.Error(),\n\t\t\t\t})\n\t\t\t\tinfo.signatureSource = obj\n\t\t\t}\n\t\tcase *types.Var:\n\t\t\t// Object is a function param or the field of an anonymous struct\n\t\t\t// declared with ':='. Skip the first one because only fields\n\t\t\t// can have docs.\n\t\t\tif isFunctionParam(obj, node) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t_, field := FindDeclAndField(pkg.GetSyntax(), obj.Pos())\n\t\t\tif field != nil {\n\t\t\t\tcomment := field.Doc\n\t\t\t\tif comment.Text() == \"\" {\n\t\t\t\t\tcomment = field.Comment\n\t\t\t\t}\n\t\t\t\tinfo = &HoverContext{signatureSource: obj, Comment: comment}\n\t\t\t}\n\t\t}\n\t}\n\n\tif info == nil {\n\t\tinfo = &HoverContext{signatureSource: obj}\n\t}\n\n\treturn info, nil\n}", "title": "" }, { "docid": "1fb80b04a32642ff184aeae00f97cc07", "score": "0.40985656", "text": "func (m *macro) findFunctions() error {\n\tresources, _, _, err := jsonparser.Get(m.fragment, cf.ResourceKey)\n\n\terr = jsonparser.ObjectEach(resources, func(key []byte, value []byte, dataType jsonparser.ValueType, offset int) error {\n\t\trt, err := jsonparser.GetString(value, cf.TypeKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif rt != cf.FunctionResourceType {\n\t\t\treturn nil\n\t\t}\n\n\t\tevents, err := findEvents(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(events) > 0 {\n\t\t\tm.addFunctionEvents(string(key), events)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"finding function resources\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b4085faecb908834dbcb1be0f5569a0", "score": "0.40802246", "text": "func (p *printer) funcDecl(d *ast.FuncDecl, multiLine *bool) {\n\tp.leadComment(d.Doc);\n\tp.print(d.Pos(), token.FUNC, blank);\n\tif recv := d.Recv; recv != nil {\n\t\t// method: print receiver\n\t\tp.print(token.LPAREN);\n\t\tif len(recv.Names) > 0 {\n\t\t\tp.expr(recv.Names[0], multiLine);\n\t\t\tp.print(blank);\n\t\t}\n\t\tp.expr(recv.Type, multiLine);\n\t\tp.print(token.RPAREN, blank);\n\t}\n\tp.expr(d.Name, multiLine);\n\tp.signature(d.Type.Params, d.Type.Results, multiLine);\n\tp.funcBody(d.Body, false, multiLine);\n}", "title": "" }, { "docid": "7079d913866be5f3657226b213fa4672", "score": "0.4064629", "text": "func (z *Zone) FindFunc(s string, f func(interface{}) bool) (*ZoneData, bool, bool) {\n\tz.mutex.RLock()\n\tdefer z.mutex.RUnlock()\n\tzd, e, b := z.Radix.FindFunc(toRadixName(s), f)\n\tif zd == nil {\n\t\treturn nil, false, false\n\t}\n\treturn zd.Value.(*ZoneData), e, b\n}", "title": "" }, { "docid": "331b382c74a8b9f8a714c5922040e500", "score": "0.4050159", "text": "func resolveTypeName(typ ast.Expr) (field string, qualified string) {\n\tfor done := false; !done; {\n\t\t// Resolve star expressions.\n\t\tswitch rs := typ.(type) {\n\t\tcase *ast.StarExpr:\n\t\t\tqualified += \"*\"\n\t\t\ttyp = rs.X\n\t\tcase *ast.ArrayType:\n\t\t\tif rs.Len == nil {\n\t\t\t\t// Slice type declaration.\n\t\t\t\tqualified += \"[]\"\n\t\t\t} else {\n\t\t\t\t// Array type declaration.\n\t\t\t\tqualified += \"[\" + rs.Len.(*ast.BasicLit).Value + \"]\"\n\t\t\t}\n\t\t\ttyp = rs.Elt\n\t\tdefault:\n\t\t\t// No more descent.\n\t\t\tdone = true\n\t\t}\n\t}\n\n\t// Resolve a package selector.\n\tsel, ok := typ.(*ast.SelectorExpr)\n\tif ok {\n\t\tqualified = qualified + sel.X.(*ast.Ident).Name + \".\"\n\t\ttyp = sel.Sel\n\t}\n\n\t// Figure out actual type name.\n\tfield = typ.(*ast.Ident).Name\n\tqualified = qualified + field\n\treturn\n}", "title": "" }, { "docid": "088e881d9b2d57cc6e4111e04d77fb1c", "score": "0.40498465", "text": "func funcDefPosition(pass *analysis.Pass, e ast.Expr) token.Pos {\n\tanonFunLit, ok := e.(*ast.FuncLit)\n\tif ok {\n\t\treturn anonFunLit.Pos()\n\t}\n\n\tfunIdent, ok := e.(*ast.Ident)\n\tif !ok {\n\t\tselExpr, ok := e.(*ast.SelectorExpr)\n\t\tif !ok {\n\t\t\treturn token.NoPos\n\t\t}\n\t\tfunIdent = selExpr.Sel\n\t}\n\n\tfunDef, ok := pass.TypesInfo.Uses[funIdent]\n\tif !ok {\n\t\treturn token.NoPos\n\t}\n\n\treturn funDef.Pos()\n}", "title": "" }, { "docid": "b5450b962c9f422b4ec5bb79f793e2ab", "score": "0.40469274", "text": "func (fs *FileSet) GetDeclFor(n Name) (*FileNode, *Decl) {\n\t// XXX index to bound to linear time.\n\tfor _, fn := range fs.Files {\n\t\tfor i, dn := range fn.Body {\n\t\t\tif _, isImport := dn.(*ImportDecl); isImport {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif dn.GetName() == n {\n\t\t\t\t// found the decl that declares n.\n\t\t\t\treturn fn, &fn.Body[i]\n\t\t\t}\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\n\t\t\"name %s not defined in fileset %v\",\n\t\tn, fs))\n}", "title": "" }, { "docid": "502fd80157c37270b75a02e882b27fa0", "score": "0.40457776", "text": "func FindMethod(name string) func(string) (io.ReadCloser, error) {\n\tfor _, file := range ExpectedFiles {\n\t\tif file.Name == name {\n\t\t\treturn file.Method\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c556fc66814fd6fe6b693cf0dbda1a5", "score": "0.40421662", "text": "func (*BadStmt) stmtNode() {}", "title": "" }, { "docid": "689458eeb37e87efef446f5994ae5b4e", "score": "0.40408316", "text": "func (_ *FuncDecl) assertDecl() {}", "title": "" }, { "docid": "eb93b47c35923d1015b4f65f69241c20", "score": "0.40402848", "text": "func (t Type) Declaration() Cursor {\n\to := C.clang_getTypeDeclaration(t.c)\n\treturn Cursor{o}\n}", "title": "" }, { "docid": "75bd4e677d7056879b75f3bad27826a7", "score": "0.4038691", "text": "func parseFunctionDefinition(s *State, t *tokenizer) {\n\n}", "title": "" }, { "docid": "5171cdaf8243715e3d1bcc35af19f75b", "score": "0.4031049", "text": "func (d MachoDisass) FindSymbol(addr uint64) (string, bool) {\n\tif symName, ok := d.a2s[addr]; ok {\n\t\tif d.cfg.Demangle {\n\t\t\treturn demangle.Do(symName, false, false), true\n\t\t}\n\t\treturn symName, true\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "893c125ed8ea5c55340ac47bb8ed3fb4", "score": "0.402454", "text": "func (r *Registry) FindType(name string) (*DeclType, bool) {\n\tr.rwMux.RLock()\n\tdefer r.rwMux.RUnlock()\n\ttyp, found := r.types[name]\n\tif found {\n\t\treturn typ, true\n\t}\n\treturn typ, found\n}", "title": "" }, { "docid": "036bc47fd2ebda74665da03c14361321", "score": "0.4021433", "text": "func (in *DNSChaosSpec) GetSelector() SelectorSpec {\n\treturn in.Selector\n}", "title": "" }, { "docid": "cfeb7af6fa89009a8e98a1ae447d7f40", "score": "0.40165213", "text": "func LookupIdentifier(identifier string) Type {\n\tif tok, ok := keywords[identifier]; ok {\n\t\treturn tok\n\t}\n\treturn IDENT\n}", "title": "" }, { "docid": "cfeb7af6fa89009a8e98a1ae447d7f40", "score": "0.40165213", "text": "func LookupIdentifier(identifier string) Type {\n\tif tok, ok := keywords[identifier]; ok {\n\t\treturn tok\n\t}\n\treturn IDENT\n}", "title": "" }, { "docid": "76734269230739693187a80734391e41", "score": "0.40164766", "text": "func (r *OpRule) getInternalPackageOp(ident *ast.Ident) (*ast.FuncDecl, bool) {\n\tif ident.Obj == nil {\n\t\treturn nil, false\n\t}\n\n\tif ident.Obj.Decl == nil {\n\t\treturn nil, false\n\t}\n\n\tswitch t := ident.Obj.Decl.(type) {\n\tcase *ast.FuncDecl:\n\t\treturn t, true\n\t}\n\n\treturn nil, false\n}", "title": "" }, { "docid": "52076ff4185392f7a7840e51674a35ce", "score": "0.4010745", "text": "func (a *analysis) findIntrinsic(fn *ssa.Function) intrinsic {\n\t// Consult the *Function-keyed cache.\n\t// A cached nil indicates a normal non-intrinsic function.\n\timpl, ok := a.intrinsics[fn]\n\tif !ok {\n\t\timpl = intrinsicsByName[fn.String()] // may be nil\n\n\t\tif a.isReflect(fn) {\n\t\t\tif !a.config.Reflection {\n\t\t\t\timpl = ext۰NoEffect // reflection disabled\n\t\t\t} else if impl == nil {\n\t\t\t\t// Ensure all \"reflect\" code is treated intrinsically.\n\t\t\t\timpl = ext۰NotYetImplemented\n\t\t\t}\n\t\t}\n\n\t\ta.intrinsics[fn] = impl\n\t}\n\treturn impl\n}", "title": "" }, { "docid": "b42fba90fd8a72baee0b4851c2c17b7c", "score": "0.4006903", "text": "func processFuncDecl(decl *ast.FuncDecl) *Func {\n\t// Check whether there is a receiver.\n\tvar recv *Arg\n\targs := processFieldList(decl.Recv)\n\tif len(args) > 0 {\n\t\trecv = &args[0]\n\t}\n\n\treturn &Func{\n\t\tComments: processCommentGroup(decl.Doc),\n\t\tName: decl.Name.Name,\n\t\tParams: processFieldList(decl.Type.Params),\n\t\tResults: processFieldList(decl.Type.Results),\n\t\tRecv: recv,\n\t}\n}", "title": "" }, { "docid": "adc4000240202f80f9ac92ccb182576e", "score": "0.40007174", "text": "func FuncDecl(name string, params, results []*ast.Field, stmts []ast.Stmt) *ast.FuncDecl {\n\treturn &ast.FuncDecl{\n\t\tName: NewIdentObj(name),\n\t\tType: &ast.FuncType{\n\t\t\tParams: &ast.FieldList{\n\t\t\t\tList: params,\n\t\t\t},\n\t\t\tResults: &ast.FieldList{\n\t\t\t\tList: results,\n\t\t\t},\n\t\t},\n\t\tBody: &ast.BlockStmt{\n\t\t\tList: stmts,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "63137912def4a3325d5acd96ac63c558", "score": "0.39937022", "text": "func FindBracket(f Func1D, left, right float64) (float64, float64, error) {\n\tbracket, err := bracketHelper(f, left, right, InitialBracketNumber, 1)\n\tif err != nil {\n\t\treturn 0.0, 0.0, err\n\t}\n\tbl, br := bracket[0][0], bracket[0][1]\n\treturn bl, br, err\n}", "title": "" } ]
6ee1d7bb973012176fd706ac55361553
NewMockCounter creates a new mock instance
[ { "docid": "fcdb74f6c28c75c484e29218cacb7a82", "score": "0.6734388", "text": "func NewMockCounter(ctrl *gomock.Controller) *MockCounter {\n\tmock := &MockCounter{ctrl: ctrl}\n\tmock.recorder = &MockCounterMockRecorder{mock}\n\treturn mock\n}", "title": "" } ]
[ { "docid": "64e10b375335bb278021bdeee01255dd", "score": "0.67516416", "text": "func NewCounter() *Counter {\n newCounter := new(Counter)\n newCounter.Reset()\n\n time.AfterFunc(1 * time.Second, newCounter.calcPerSec)\n\n return newCounter\n}", "title": "" }, { "docid": "104f55c74a831d38a498eda617850c4b", "score": "0.67182875", "text": "func newCounter() *counter {\n\treturn &counter{num: 0, mu: &sync.Mutex{}}\n}", "title": "" }, { "docid": "d8b993fcb36a860cf457d03f94a250d6", "score": "0.6428581", "text": "func newCounter(c prometheus.Counter) server.Counter {\n\tprometheus.MustRegister(c)\n\treturn counter{c}\n}", "title": "" }, { "docid": "e4441632585bdcaf42f672c862051018", "score": "0.63948005", "text": "func New() Counter {\n\treturn &counter{\n\t\tm: make(M),\n\t}\n}", "title": "" }, { "docid": "188e80ebb3eb636677159bbd285eb3ad", "score": "0.6354353", "text": "func newReferenceCounter() *ReferenceCounter {\n\treturn &ReferenceCounter{\n\t\tnum: new(uint32),\n\t\tpool: &sync.Pool{},\n\t\tremoved: new(uint32),\n\t}\n}", "title": "" }, { "docid": "8da7718755c5a3007667ac1552267205", "score": "0.6217843", "text": "func (n *Node) NewCounter() {}", "title": "" }, { "docid": "70beb983df2fe51b5f54f8cbc84e9145", "score": "0.6181521", "text": "func NewMock() *Mock {\n\treturn &Mock{now: time.Now()}\n}", "title": "" }, { "docid": "6a293140fe8009d0e2ce3c1720d72dd7", "score": "0.6180206", "text": "func newHLLCounter() counter {\n\treturn hll.NewDefaultPlus()\n}", "title": "" }, { "docid": "e33c119b25eb65527b527fbd410404cc", "score": "0.61606604", "text": "func (pr *PilotRegistry) newCounter(name string) *pilotCounter {\n\tc := newPilotCounter(name)\n\tpr.counters[name] = c\n\n\treturn c\n}", "title": "" }, { "docid": "ed4ddb62670dc9bc919cf1045e927e55", "score": "0.61530787", "text": "func NewCounter(reset bool) *Counter {\n\treturn &Counter{\n\t\treset: reset,\n\t}\n}", "title": "" }, { "docid": "287da45041dc81888a3f94f9efe13b44", "score": "0.61231506", "text": "func NewMock() *Mock {\n\treturn &Mock{\n\t\tcache: map[string]*MockResult{},\n\t}\n}", "title": "" }, { "docid": "84fd34c458add86e2d709226680c930b", "score": "0.60862523", "text": "func NewMock() (*Mock, error) {\n\treturn &Mock{\n\t\thost: common.MockOrigin,\n\t\tcounter: 1,\n\t}, nil\n}", "title": "" }, { "docid": "9fe011ae1b95e5f784496bad18f4b51d", "score": "0.6079999", "text": "func NewMock() *Mock {\n\tm := &Mock{}\n\tm.changed = make(chan time.Time)\n\tm.now = time.Unix(0, 0)\n\treturn m\n}", "title": "" }, { "docid": "d0e0ae1d1ef1ef53b45a1dd0d512b3b8", "score": "0.6065323", "text": "func NewMock(opts MockOptions) *mockClock {\n\treturn &mockClock{\n\t\tnow: time.Time{},\n\t}\n}", "title": "" }, { "docid": "1fea53ed14c2d168522c7c3ad00b15b1", "score": "0.60457027", "text": "func NewMock() *Mock {\n\treturn &Mock{\n\t\tmu: &sync.Mutex{},\n\t\tcache: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "84166d9ca73038b0f1051ddbffd18f75", "score": "0.602886", "text": "func NewCounter(config CounterConfig) (objectspec.InstrumentorCounter, error) {\n\tnewCounter := &counter{\n\t\tCounterConfig: config,\n\t}\n\n\treturn newCounter, nil\n}", "title": "" }, { "docid": "36269fee7911a279f133d9abcb966abb", "score": "0.6006831", "text": "func New(value int) altCounter {\n\treturn altCounter(value)\n}", "title": "" }, { "docid": "7bce42a66412d6b3ca49d8d613e81d14", "score": "0.5910932", "text": "func newCounter(path string) (*counter, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open bam file: %v\", err)\n\t}\n\tr, err := bam.NewReader(f, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open bam stream: %v\", err)\n\t}\n\n\tir, err := os.Open(path + \".bai\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open bai file: %v\", err)\n\t}\n\tidx, err := bam.ReadIndex(ir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open bai data: %v\", err)\n\t}\n\tir.Close()\n\n\treturn &counter{f: f, r: r, h: r.Header(), idx: idx}, nil\n}", "title": "" }, { "docid": "c78c638de9f26976e4d26553cedddac2", "score": "0.5891262", "text": "func NewCounter(fileName string, lables []string) Counter {\n v := setViper(fileName)\n return newCounter(v, lables)\n}", "title": "" }, { "docid": "7953365b32a6cd54d22f02574654e32b", "score": "0.5879827", "text": "func NewMockClock(now time.Time) *MockClock {\n\treturn &MockClock{\n\t\tmutex: new(sync.Mutex),\n\t\tcurrentTime: now,\n\t\tsubscribers: make([]TimeChannel, 0, 10),\n\t}\n}", "title": "" }, { "docid": "3698ad04e8e207e6c9645b48164f0a8f", "score": "0.58648956", "text": "func New(maxcount int) *Counter {\n\treturn &Counter{maxCount: maxcount, count: 0}\n}", "title": "" }, { "docid": "ba7ec611a26f37e608c9e1ce0452396b", "score": "0.5837925", "text": "func NewMockRedis(ctrl *gomock.Controller) *MockRedis {\n mock := &MockRedis{ctrl: ctrl}\n mock.recorder = &MockRedisMockRecorder{mock}\n return mock\n}", "title": "" }, { "docid": "7162cd30d04a3a953984d64e8dea089f", "score": "0.58326894", "text": "func NewIncrementalCache(t testing.TB) *IncrementalCache {\n\tmock := &IncrementalCache{}\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "964365d85ff25be83debc3f7c87dbbb0", "score": "0.58314353", "text": "func newMockSubscriber() mockSubscriber {\n\treturn mockSubscriber{}\n}", "title": "" }, { "docid": "8ceef1e1955f36ef7a43686b57b09da6", "score": "0.581457", "text": "func New() *Mocker {\n\treturn &Mocker{}\n}", "title": "" }, { "docid": "0d103d786ac14a46f27bba8c0319fa8b", "score": "0.5782121", "text": "func newMockApiClientLogical(t mockConstructorTestingTnewMockApiClientLogical) *mockApiClientLogical {\n\tmock := &mockApiClientLogical{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "0db9d25de5798fe0c8aa006a39824902", "score": "0.5777711", "text": "func NewCounter(c int64) *Counter {\n\tvar counter = new(Counter)\n\tatomic.StoreInt64(&counter.c, c)\n\treturn counter\n}", "title": "" }, { "docid": "82208ec930904cd7ce984ace4de2d34f", "score": "0.57760227", "text": "func TestNewWrapMock(t *testing.T) {\n\tglobalFruit = &fruit{\n\t\tNewWrapMock(t),\n\t}\n\tbanana()\n\tglobalFruit.AssertCalled()\n}", "title": "" }, { "docid": "c3c1dbd152d6947bcd3279249e2451e1", "score": "0.5770563", "text": "func NewMockMounter(ctrl *gomock.Controller) *MockMounter {\n\tmock := &MockMounter{ctrl: ctrl}\n\tmock.recorder = &MockMounterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "a27a084f15b60002b825715698de9676", "score": "0.5767421", "text": "func New(value int) alertCounter {\n\treturn alertCounter(value)\n\n}", "title": "" }, { "docid": "a7462c3cbc4a5ac883ff27bc018562ed", "score": "0.5763086", "text": "func (m *MockScope) Counter(name string) metrics.Counter {\n\tret := m.ctrl.Call(m, \"Counter\", name)\n\tret0, _ := ret[0].(metrics.Counter)\n\treturn ret0\n}", "title": "" }, { "docid": "ad1c5bea4856182926f417f7c49b3a85", "score": "0.56918293", "text": "func NewMock() *Mock {\n\treturn &Mock{}\n}", "title": "" }, { "docid": "28bed02d831e2861bf6b2451bd2ea765", "score": "0.56813914", "text": "func newFakeController() (*Controller, agtesting.Mocks) {\n\tm := agtesting.NewMocks()\n\twh := webhooks.NewWebHook(http.NewServeMux())\n\tc := NewController(wh, healthcheck.NewHandler(), m.KubeClient, m.ExtClient, m.AgonesClient, m.AgonesInformerFactory)\n\tc.recorder = m.FakeRecorder\n\treturn c, m\n}", "title": "" }, { "docid": "cf87665ce7b520ebaa671e8bcc674c38", "score": "0.5678714", "text": "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileCounterService{client: mgr.GetClient(), scheme: mgr.GetScheme()}\n}", "title": "" }, { "docid": "e3842de4150f9df8d49fdf5226a5c292", "score": "0.5674822", "text": "func Counter(initCount int) *counter {\n\tcounter := &counter{\n\t\tcount: initCount,\n\t\teventBuffer: make(map[string]eventEntry),\n\t\t// mux: &sync.Mutex{},\n\t}\n\tgo counter.clearTicker()\n\n\treturn counter\n}", "title": "" }, { "docid": "58564ae653aac1832172513ec61c9692", "score": "0.56667894", "text": "func newFakeReconciler(initObjects ...runtime.Object) *ReconcilePerformanceProfile {\n\tfakeClient := fake.NewFakeClient(initObjects...)\n\tfakeRecorder := record.NewFakeRecorder(10)\n\treturn &ReconcilePerformanceProfile{\n\t\tclient: fakeClient,\n\t\tscheme: scheme.Scheme,\n\t\trecorder: fakeRecorder,\n\t\tassetsDir: assetsDir,\n\t}\n}", "title": "" }, { "docid": "6d7c91e70137784061fb390c2a2f5a0b", "score": "0.565196", "text": "func (m *SimpleMetrics) NewCounter(name string) chan int64 {\n\tch := make(chan int64)\n\tm.counters[name] = ch\n\tgo m.newMetric(\"counters\", name, ch)\n\treturn ch\n}", "title": "" }, { "docid": "f9115b1586b44a3c7954e17c1b456084", "score": "0.565113", "text": "func NewTestCounter() *TestCounter {\n\treturn &TestCounter{node: &node{}}\n}", "title": "" }, { "docid": "b975bb4094a06c918da264c9d6025d8f", "score": "0.5643141", "text": "func NewMock() Service {\n\treturn &mock{}\n}", "title": "" }, { "docid": "86acbb845acf574342ded60f4d6eb517", "score": "0.5631484", "text": "func NewMock() *MockClient {\n\treturn &MockClient{\n\t\tnextPatientConfigCall: make(map[string]*patientConfigCall),\n\t}\n}", "title": "" }, { "docid": "056e135390d143132c3bfe1484096913", "score": "0.56311214", "text": "func newMockTestClient(t mockConstructorTestingTnewMockTestClient) *mockTestClient {\n\tmock := &mockTestClient{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.56218", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.56218", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "5546db9a44760a2163c292214ef0e22d", "score": "0.56129533", "text": "func NewCounter(name, help string) *MetricCounter {\n\treturn &MetricCounter{\n\t\tMetric: Metric{\n\t\t\tName: name,\n\t\t\tHelp: help,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7b25e7cb202f937a6d4724ef854679de", "score": "0.5604137", "text": "func TestCounterIncrement(t *testing.T) {\n\tGatewayCreated.Increment()\n\tGatewayUpdated.Increment()\n\tGatewayRemoved.Increment()\n\tApplicationCreated.Increment()\n\tApplicationUpdated.Increment()\n\tApplicationRemoved.Increment()\n\tDeviceCreated.Increment()\n\tDeviceUpdated.Increment()\n\tDeviceRemoved.Increment()\n\tLoRaMICFailed.Increment()\n\tLoRaConfirmedUp.Increment()\n\tLoRaConfirmedDown.Increment()\n\tLoRaUnconfirmedUp.Increment()\n\tLoRaUnconfirmedDown.Increment()\n\tLoRaJoinRequest.Increment()\n\tLoRaJoinAccept.Increment()\n\tLoRaCounterFailed.Increment()\n\tGatewayIn.Increment()\n\tGatewayOut.Increment()\n\tDecoder.Increment()\n\tDecrypter.Increment()\n\tMACProcessor.Increment()\n\tSchedulerIn.Increment()\n\tSchedulerOut.Increment()\n\tEncoder.Increment()\n\n\tGatewayChannelOut.Add(1.0)\n\tDecoderChannelOut.Add(1.0)\n\tDecrypterChannelOut.Add(1.0)\n\tMACProcessorChannelOut.Add(1.0)\n\tSchedulerChannelOut.Add(1.0)\n\tEncoderChannelOut.Add(1.0)\n\n\tTimeGatewaySend.Add(2.0)\n\tTimeGatewayReceive.Add(2.0)\n\tTimeDecoder.Add(2.0)\n\tTimeDecrypter.Add(2.0)\n\tTimeEncoder.Add(2.0)\n\tTimeMACProcessor.Add(2.0)\n\tTimeSchedulerSend.Add(2.0)\n\tTimeSchedulerProcess.Add(2.0)\n\n\tTimeIncoming.Add(3.0)\n\tTimeOutgoing.Add(3.0)\n}", "title": "" }, { "docid": "300d0b13d5695889de11befc962a2d0d", "score": "0.5599453", "text": "func (r *Registry) NewCounter(opts Opts) (Counter, error) {\n\topts = r.addConstLabels(opts)\n\tif err := opts.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tc := newCounter(opts)\n\tif err := r.register(c); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "9055295063db739dab4548c1168ef2a4", "score": "0.5581442", "text": "func Counter() Tracker {\n\treturn newTracker(func() trackerData { return &counterData{^uint(0)} })\n}", "title": "" }, { "docid": "43263008d17f3f759aba2a0ff5e5c72d", "score": "0.5580613", "text": "func NewCounters() *Counters {\n\tcounters := make(map[string]map[string]int)\n\tfor _, m := range metrics {\n\t\tcounters[m] = make(map[string]int)\n\t}\n\n\treturn &Counters{\n\t\tcounters,\n\t\tmake(map[string]string),\n\t}\n}", "title": "" }, { "docid": "2ce4f4160a0aa2dc6dc18b6271473863", "score": "0.5559757", "text": "func NewCounter(name string, tagsAndOptions ...string) *Counter {\n\tc := &Counter{\n\t\tnewMetricBase(name, tagsAndOptions),\n\t}\n\n\treturn globalRegistry.FindOrCreate(c).(*Counter)\n}", "title": "" }, { "docid": "61aebfed6eb62efda17a0e31096b080b", "score": "0.5538663", "text": "func NewMock() *Mock {\n\treturn &Mock{\n\t\tValues: &sync.Map{},\n\t\tGetError: nil,\n\t\tSetError: nil,\n\t\tListError: nil,\n\t}\n}", "title": "" }, { "docid": "ae85b3d7df6bbf83cae99a76a4b1fe2e", "score": "0.553763", "text": "func New() *TestLogger {\n\tb := &bytes.Buffer{}\n\n\treturn &TestLogger{\n\t\tbuf: b,\n\t\tcount: newCounter(),\n\t}\n}", "title": "" }, { "docid": "d5bcf94a691e8441ba9f2bd678aab1fb", "score": "0.5534991", "text": "func NewMockCtrl(t *testing.T) (*gomock.Controller, func()) {\n\tMockCtrl = gomock.NewController(t)\n\treturn MockCtrl, func() { MockCtrl.Finish() }\n}", "title": "" }, { "docid": "152c41afc78fc9c0a0afb0bdc6362030", "score": "0.5521505", "text": "func newFakeController() (*Controller, agtesting.Mocks) {\n\tm := agtesting.NewMocks()\n\tc := NewController(healthcheck.NewHandler(), m.KubeClient, m.ExtClient, m.AgonesClient, m.AgonesInformerFactory)\n\tc.recorder = m.FakeRecorder\n\treturn c, m\n}", "title": "" }, { "docid": "3093501f2df82eb95627ee080d18ad16", "score": "0.5519538", "text": "func NewMock(addRouteCallback func(netlink.Route) error) (Component, func(Notification)) {\n\tc := &mockComponent{\n\t\tobserverSubComponent: newObserver(),\n\t\taddRouteCallback: addRouteCallback,\n\t}\n\treturn c, c.inject\n}", "title": "" }, { "docid": "e57491165953ea14adf74d1c3f6215c6", "score": "0.55133754", "text": "func NewMockPerfClient() *MockPerfClient {\n\treturn &MockPerfClient{}\n}", "title": "" }, { "docid": "3e73cb28b54b267e78c447b3b13a134f", "score": "0.5506527", "text": "func NewCounter(n, m int) *Counter {\n\te := make([]int, n)\n\te[n-1] = -1\n\tlength := int(math.Pow(float64(m), float64(n)))\n\treturn &Counter{e, length, n, m, n - 1}\n}", "title": "" }, { "docid": "855fc627d83ffa85e5d1579febdb0cda", "score": "0.55020463", "text": "func NewMockMetrics() *MockMetrics {\n\treturn &MockMetrics{\n\t\tData: &MockMetricsData{\n\t\t\tCPU: &CPUResult{\n\t\t\t\tInfo: []cpu.InfoStat{\n\t\t\t\t\t{\n\t\t\t\t\t\tCPU: 0,\n\t\t\t\t\t\tVendorID: \"\",\n\t\t\t\t\t\tFamily: \"6\",\n\t\t\t\t\t\tModel: \"69\",\n\t\t\t\t\t\tStepping: 1,\n\t\t\t\t\t\tPhysicalID: \"0\",\n\t\t\t\t\t\tCoreID: \"0\",\n\t\t\t\t\t\tCores: 1,\n\t\t\t\t\t\tModelName: \"Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz\",\n\t\t\t\t\t\tMhz: 2599.79,\n\t\t\t\t\t\tCacheSize: 3072,\n\t\t\t\t\t\tFlags: []string{},\n\t\t\t\t\t}, {\n\t\t\t\t\t\tCPU: 1,\n\t\t\t\t\t\tVendorID: \"\",\n\t\t\t\t\t\tFamily: \"6\",\n\t\t\t\t\t\tModel: \"69\",\n\t\t\t\t\t\tStepping: 1,\n\t\t\t\t\t\tPhysicalID: \"0\",\n\t\t\t\t\t\tCoreID: \"1\",\n\t\t\t\t\t\tCores: 1,\n\t\t\t\t\t\tModelName: \"Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz\",\n\t\t\t\t\t\tMhz: 2599.79,\n\t\t\t\t\t\tCacheSize: 3072,\n\t\t\t\t\t\tFlags: []string{},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tLoad: load.AvgStat{\n\t\t\t\t\tLoad1: 0.72,\n\t\t\t\t\tLoad5: 0.22,\n\t\t\t\t\tLoad15: 0.11,\n\t\t\t\t},\n\t\t\t\tTimes: []cpu.TimesStat{\n\t\t\t\t\t{\n\t\t\t\t\t\tCPU: \"cpu0\",\n\t\t\t\t\t\tUser: 4973.34,\n\t\t\t\t\t\tSystem: 3579.08,\n\t\t\t\t\t\tIdle: 824805.64,\n\t\t\t\t\t\tNice: 0.93,\n\t\t\t\t\t\tIowait: 921.25,\n\t\t\t\t\t\tIrq: 0,\n\t\t\t\t\t\tSoftirq: 674.86,\n\t\t\t\t\t\tSteal: 0,\n\t\t\t\t\t\tGuest: 0,\n\t\t\t\t\t\tGuestNice: 0,\n\t\t\t\t\t\tStolen: 0,\n\t\t\t\t\t}, {\n\t\t\t\t\t\tCPU: \"cpu1\",\n\t\t\t\t\t\tUser: 5104.66,\n\t\t\t\t\t\tSystem: 3458.4,\n\t\t\t\t\t\tIdle: 837419.2,\n\t\t\t\t\t\tNice: 1.29,\n\t\t\t\t\t\tIowait: 869.55,\n\t\t\t\t\t\tIrq: 0,\n\t\t\t\t\t\tSoftirq: 161.14,\n\t\t\t\t\t\tSteal: 0,\n\t\t\t\t\t\tGuest: 0,\n\t\t\t\t\t\tGuestNice: 0,\n\t\t\t\t\t\tStolen: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tDisk: &DiskResult{\n\t\t\t\tIO: make(map[string]disk.IOCountersStat),\n\t\t\t\tPartitions: []disk.PartitionStat{},\n\t\t\t\tUsage: []*disk.UsageStat{\n\t\t\t\t\t{\n\t\t\t\t\t\tPath: \"/\",\n\t\t\t\t\t\tFstype: \"zfs\",\n\t\t\t\t\t\tTotal: 100000,\n\t\t\t\t\t\tFree: 50000,\n\t\t\t\t\t\tUsed: 50000,\n\t\t\t\t\t\tUsedPercent: 0.5,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tHardware: struct{}{},\n\t\t\tHost: &host.InfoStat{\n\t\t\t\tHostname: \"mockMetrics\",\n\t\t\t\tUptime: uint64(123456),\n\t\t\t\tBootTime: uint64(123456),\n\t\t\t\tProcs: 5,\n\t\t\t\tOS: \"linux\",\n\t\t\t\tPlatform: \"cerana\",\n\t\t\t\tPlatformFamily: \"nix\",\n\t\t\t},\n\t\t\tMemory: &MemoryResult{\n\t\t\t\tSwap: &mem.SwapMemoryStat{\n\t\t\t\t\tTotal: 100000,\n\t\t\t\t\tUsed: 50000,\n\t\t\t\t\tFree: 50000,\n\t\t\t\t\tUsedPercent: 0.5,\n\t\t\t\t},\n\t\t\t\tVirtual: &mem.VirtualMemoryStat{\n\t\t\t\t\tTotal: 100000,\n\t\t\t\t\tAvailable: 100000,\n\t\t\t\t\tUsed: 50000,\n\t\t\t\t\tFree: 50000,\n\t\t\t\t\tUsedPercent: 0.5,\n\t\t\t\t},\n\t\t\t},\n\t\t\tNetwork: &NetworkResult{\n\t\t\t\tIO: []net.IOCountersStat{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"fooIface\",\n\t\t\t\t\t\tBytesSent: 12345,\n\t\t\t\t\t\tBytesRecv: 54321,\n\t\t\t\t\t\tPacketsSent: 12345,\n\t\t\t\t\t\tPacketsRecv: 54321,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tInterfaces: []net.InterfaceStat{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: \"fooIface\",\n\t\t\t\t\t\tMTU: 1500,\n\t\t\t\t\t\tHardwareAddr: \"en0\",\n\t\t\t\t\t\tAddrs: []net.InterfaceAddr{\n\t\t\t\t\t\t\t{Addr: \"123.123.123.123/24\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b9f766dbd869da3704f364f051202c4a", "score": "0.5500126", "text": "func Constructor() HitCounter {\n\treturn HitCounter{[300]int{}, [300]int{}}\n}", "title": "" }, { "docid": "9036d7254bd89024ec81bce2099cab30", "score": "0.54910475", "text": "func NewMockClock(t time.Time) *MockClock {\n\treturn &MockClock{\n\t\tnow: t,\n\t\tnowChs: map[chan<- time.Time]struct{}{},\n\t}\n}", "title": "" }, { "docid": "512d81444e54b540b7548a2238b451ce", "score": "0.5489115", "text": "func NewCounter(name string) *Counter {\n\treturn newCounter(std, name)\n}", "title": "" }, { "docid": "19e796359e226482794f201ab0483404", "score": "0.54844946", "text": "func NewMock(idlerAPI string, state PodState, throwError bool) (idler *Mock) {\n\treturn &Mock{\n\t\tidlerAPI: idlerAPI,\n\t\tIdlerState: state,\n\t\tthrowError: throwError,\n\t}\n}", "title": "" }, { "docid": "fa6a098d2ac266f922560029aaa19e4d", "score": "0.54825133", "text": "func (mmCreate *AccountRepositoryMock) CreateBeforeCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmCreate.beforeCreateCounter)\n}", "title": "" }, { "docid": "6cdf8c702ba57a45729ca052f1ee05e5", "score": "0.5468558", "text": "func CounterNow() uint { return TimeToCounter(timeNow(), DefaultPeriod) }", "title": "" }, { "docid": "2ff92020c79b210b62b4813d00d51e96", "score": "0.54683584", "text": "func NewCounter(iData map[uint32]uint32, count uint64) *Counter {\n\tiHash, _ := utils.HashMapUint32(iData)\n\treturn &Counter {\n\t\tiHash: iHash,\n\t\tiData: iData,\n\t\tcount: count,\n\t}\n\t\n}", "title": "" }, { "docid": "30c269fd162f5b7a984935693f9d8131", "score": "0.5464903", "text": "func NewCounter(clusterID proto.ClusterID, taskType string, kind string) prometheus.Counter {\n\tlabels := map[string]string{\n\t\t\"cluster_id\": fmt.Sprintf(\"%d\", clusterID),\n\t\t\"task_type\": taskType,\n\t\t\"kind\": kind,\n\t}\n\tshardCntCounter := prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"task\",\n\t\tName: \"shard_cnt\",\n\t\tHelp: \"shard cnt\",\n\t\tConstLabels: labels,\n\t})\n\tif err := prometheus.Register(shardCntCounter); err != nil {\n\t\tif are, ok := err.(prometheus.AlreadyRegisteredError); ok {\n\t\t\treturn are.ExistingCollector.(prometheus.Counter)\n\t\t}\n\t\tpanic(err)\n\t}\n\treturn shardCntCounter\n}", "title": "" }, { "docid": "6307f653a817c9f3eed6c4fc599d29ca", "score": "0.54238683", "text": "func New() *MockTracer {\n\treturn &MockTracer{\n\t\tfinishedSpans: []*MockSpan{},\n\t}\n}", "title": "" }, { "docid": "13877d38e6b56f7931e0bbde723bbbe9", "score": "0.54200965", "text": "func init() {\n counter = 0\n}", "title": "" }, { "docid": "b9c62524d20a94f2e684cbfaedd3bf5b", "score": "0.54135615", "text": "func newMockKeyProtoValLister() *mockKeyProtoValLister {\n\treturn &mockKeyProtoValLister{\n\t\titer: mockProtoKeyValIterator{\n\t\t\tvalues: []keyval.ProtoKeyVal{},\n\t\t\tidx: 0,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e92c554b4b3adf40fdad12e3e0ad7629", "score": "0.54015887", "text": "func (mmCreate *AccountRepositoryMock) CreateAfterCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmCreate.afterCreateCounter)\n}", "title": "" }, { "docid": "12b7dd3c3ec307777b25233eb37627c6", "score": "0.5398492", "text": "func NewMock() Fetcher {\n\treturn &Mock{\n\t\tpages: map[string][]byte{},\n\t\tdelays: map[string]delay{},\n\t}\n}", "title": "" }, { "docid": "c328f83645ff2bdfeae5a30afad7b9e1", "score": "0.53941494", "text": "func New() *Mock {\n\tmock := &Mock{\n\t\tCalls: Calls{},\n\t\tdisabled: false,\n\t\tpermissions: []accesscontrol.Permission{},\n\t\tbuiltInRoles: []string{},\n\t\tscopeResolvers: accesscontrol.NewResolvers(log.NewNopLogger()),\n\t}\n\n\treturn mock\n}", "title": "" }, { "docid": "a453f53a5e011184284bbd967eef0566", "score": "0.53866005", "text": "func (m *Metrics) NewCounter(name string) func(delta uint64) {\n\tif m.m == nil {\n\t\treturn func(_ uint64) {}\n\t}\n\n\tm.m.Add(name, 0)\n\ti := m.m.Get(name).(*expvar.Int)\n\n\treturn func(d uint64) {\n\t\ti.Add(int64(d))\n\t}\n}", "title": "" }, { "docid": "0f96e7c89887565c0b7100ba2eab9c59", "score": "0.53863883", "text": "func NewCounter(name, desc string, labelKeys []string) *Counter {\n\t// new CounterVec\n\tcounterVec := prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tName: name,\n\t\tHelp: desc,\n\t}, labelKeys)\n\n\t// register\n\tprometheus.MustRegister(counterVec)\n\n\treturn &Counter{\n\t\tcounterVec: counterVec,\n\t}\n}", "title": "" }, { "docid": "ba241d0ef57872d8ca4b340d59ae0878", "score": "0.53838754", "text": "func New(size uint) (Counter, error) {\n\tif size%byteSize > 0 {\n\t\treturn Counter(nil), ErrCounterInvalidSize\n\t}\n\n\treturn Counter(make([]byte, size/byteSize, size/byteSize)), nil\n}", "title": "" }, { "docid": "2376bfedeedff1041915cd149f95aa7c", "score": "0.5383747", "text": "func newMockKV() *mockKV {\n\tkv := &mockKV{\n\t\tvalues: make(map[string]mvccpb.KeyValue),\n\t\tvaluesMtx: sync.Mutex{},\n\t\tclose: make(chan struct{}),\n\t\tevents: make(map[chan clientv3.Event]struct{}),\n\t\teventsMtx: sync.Mutex{},\n\t}\n\n\treturn kv\n}", "title": "" }, { "docid": "7ce0ad9c9cddd4a780eafdf2ec7bcda0", "score": "0.5379396", "text": "func TestCounter(t *testing.T) {\n\tt.Run(\"incrementing the counter 3 times leaves it at 3\", func(t *testing.T) {\n counter := Counter{}\n counter.Inc()\n counter.Inc()\n counter.Inc()\n\n assertCounter(t, &counter, 3)\n\t})\n\n\tt.Run(\"it runs safely concurrently\", func(t *testing.T) {\n wantedCount := 1000\n counter := Counter{}\n\n var wg sync.WaitGroup\n wg.Add(wantedCount)\n\n for i:=0; i<wantedCount; i++ {\n go func(w *sync.WaitGroup) {\n counter.Inc()\n w.Done()\n }(&wg)\n }\n wg.Wait()\n\t\t// A Mutex must not be copied after first use.\n\t\t// counter punya atrribute mutex jdi hrs pass by ref\n assertCounter(t, &counter, wantedCount)\n\t})\n}", "title": "" }, { "docid": "85f8ab759dad0467934424e79763de63", "score": "0.5376858", "text": "func newMockDialer() *mockDialer {\n\tmd := &mockDialer{}\n\tmd.dial = md.defaultDial\n\treturn md\n}", "title": "" }, { "docid": "da38e4dabf4d340c762ea1c32cb41b41", "score": "0.53719145", "text": "func NewMockCollector() *MockCollector {\n\treturn &MockCollector{\n\t\tEvents: make(chan MockMetric, 32),\n\t\tErrors: make(chan error, 32),\n\t\tFlushErrors: make(chan error, 32),\n\t\tCloseErrors: make(chan error, 32),\n\t}\n}", "title": "" }, { "docid": "0b189b6f1920b1be2c15f6a5fd7125de", "score": "0.5358333", "text": "func newPoolCounterCollector(configuration PrometheusExporterConfiguration) *PoolCounterCollector {\n\treturn &PoolCounterCollector{\n\t\tpoolCounterAddress: configuration.PoolCounterAddress,\n\t\tcollectorTimeoutSeconds: configuration.CollectorTimeoutSeconds,\n\t\ttotalProcessingTimeSeconds: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"total_processing_time_seconds\"),\n\t\t\t\"Total processing time in seconds\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\taverageProcessingTimeSeconds: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"avg_processing_time_seconds\"),\n\t\t\t\"Average processing time in seconds\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\ttotalGainedTimeSeconds: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"total_gained_time_seconds\"),\n\t\t\t\"Total processing time saved by the use of PoolCounter in seconds\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\ttotalExclusiveWaitTimeSeconds: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"total_excl_wait_time_seconds\"),\n\t\t\t\"Total waiting time for exclusive locks in seconds\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\ttotalSharedWaitTimeSeconds: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"total_shared_wait_time_seconds\"),\n\t\t\t\"Total waiting time for shared locks in seconds\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\ttotalAcquired: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", totalAcquired),\n\t\t\t\"Total acquired locks count\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\ttotalReleases: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", totalReleases),\n\t\t\t\"Total released locks count\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\thashTableEntries: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", hashTableEntries),\n\t\t\t\"Number of entries in poolcounter hash table\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\tprocessingWorkers: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", processingWorkers),\n\t\t\t\"Number of workers busy processing tasks\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\twaitingWorkers: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", waitingWorkers),\n\t\t\t\"Number of workers waiting for tasks to be completed\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\tconnectErrors: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", connectErrors),\n\t\t\t\"Total count of client connection errors\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\tfullQueues: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", fullQueues),\n\t\t\t\"Number of queues full of waiting workers\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\tlockMismatch: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", lockMismatch),\n\t\t\t\"Total count of mismatched lock requests\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\treleaseMismatch: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", releaseMismatch),\n\t\t\t\"Total count of mismatched release requests\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t\tprocessedCount: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", processedCount),\n\t\t\t\"Total count of processed tasks\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b534fc59335ea0030ffba15f1b399124", "score": "0.5347236", "text": "func NewMockObject(ctrl *gomock.Controller) *MockObject {\n\tmock := &MockObject{ctrl: ctrl}\n\tmock.recorder = &MockObjectMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "742ecc2941ea5ea21156a40070ffbace", "score": "0.53446645", "text": "func (c FakeClient) addCount() {\n\tc.waitGroup.Add(1)\n}", "title": "" }, { "docid": "e0e8a121da9146f7e472b31edc9cb390", "score": "0.5342311", "text": "func (m *MockReaderWriter) PushProgramCounter() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"PushProgramCounter\")\n}", "title": "" }, { "docid": "44ff0914ff6c3cc105eec12fb74fe847", "score": "0.5339496", "text": "func newMock(opt *RingOptions) *adapterMock {\n\tropt := redis.RingOptions(*opt)\n\treturn &adapterMock{\n\t\t&redisCache.Codec{\n\t\t\tRedis: redis.NewRing(&ropt),\n\t\t\tMarshal: func(v interface{}) ([]byte, error) {\n\t\t\t\treturn msgpack.Marshal(v)\n\n\t\t\t},\n\t\t\tUnmarshal: func(b []byte, v interface{}) error {\n\t\t\t\treturn msgpack.Unmarshal(b, v)\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7a454faaf4dd90ffb2171786932ba9c5", "score": "0.5329863", "text": "func RTCounter(new NewCounterFn) rrOptSetter {\n\treturn func(r *RTMetrics) error {\n\t\tr.newCounter = new\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "dd469a0a85bcc366c1c13605170f99d2", "score": "0.5323633", "text": "func newMock_ServiceAccessPoint(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *mock_ServiceAccessPoint {\n\tmock := &mock_ServiceAccessPoint{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "3d1f06171a81ce2ce7c2b954c402b480", "score": "0.531744", "text": "func NewMockCRUD(ctrl *gomock.Controller) *MockCRUD {\n mock := &MockCRUD{ctrl: ctrl}\n mock.recorder = &MockCRUDMockRecorder{mock}\n return mock\n}", "title": "" }, { "docid": "3d914ab29b55a9eb27c569590d81ac96", "score": "0.5315314", "text": "func NewCounter(config spec.CounterConfig) (*Counter, error) {\n\tnewCounter := &Counter{}\n\n\treturn newCounter, nil\n}", "title": "" }, { "docid": "085e8896e8981aef404ced5d1a334506", "score": "0.5309296", "text": "func newInstruments() *ActorMetrics {\n\tmeter := global.Meter(LibName)\n\tinstruments := ActorMetrics{mu: &sync.Mutex{}}\n\n\tvar err error\n\n\tif instruments.ActorFailureCount, err = meter.Int64Counter(\n\t\t\"protoactor_actor_failure_count\",\n\t\tinstrument.WithDescription(\"Number of actor failures\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ActorFailureCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.ActorMessageReceiveHistogram, err = meter.Float64Histogram(\n\t\t\"protoactor_actor_message_receive_duration_seconds\",\n\t\tinstrument.WithDescription(\"Actor's messages received duration in seconds\"),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ActorMessageReceiveHistogram instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.ActorRestartedCount, err = meter.Int64Counter(\n\t\t\"protoactor_actor_restarted_count\",\n\t\tinstrument.WithDescription(\"Number of actors restarts\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ActorRestartedCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.ActorStoppedCount, err = meter.Int64Counter(\n\t\t\"protoactor_actor_stopped_count\",\n\t\tinstrument.WithDescription(\"Number of actors stopped\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ActorStoppedCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.ActorSpawnCount, err = meter.Int64Counter(\n\t\t\"protoactor_actor_spawn_count\",\n\t\tinstrument.WithDescription(\"Number of actors spawn\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ActorSpawnCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.DeadLetterCount, err = meter.Int64Counter(\n\t\t\"protoactor_deadletter_count\",\n\t\tinstrument.WithDescription(\"Number of deadletters\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create DeadLetterCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.FuturesCompletedCount, err = meter.Int64Counter(\n\t\t\"protoactor_futures_completed_count\",\n\t\tinstrument.WithDescription(\"Number of futures completed\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create FuturesCompletedCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.FuturesStartedCount, err = meter.Int64Counter(\n\t\t\"protoactor_futures_started_count\",\n\t\tinstrument.WithDescription(\"Number of futures started\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create FuturesStartedCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.FuturesTimedOutCount, err = meter.Int64Counter(\n\t\t\"protoactor_futures_timed_out_count\",\n\t\tinstrument.WithDescription(\"Number of futures timed out\"),\n\t\tinstrument.WithUnit(unit.Dimensionless),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create FuturesTimedOutCount instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\tif instruments.ThreadPoolLatency, err = meter.Int64Histogram(\n\t\t\"protoactor_thread_pool_latency_duration_seconds\",\n\t\tinstrument.WithDescription(\"History of latency in second\"),\n\t\tinstrument.WithUnit(unit.Milliseconds),\n\t); err != nil {\n\t\terr = fmt.Errorf(\"failed to create ThreadPoolLatency instrument, %w\", err)\n\t\tplog.Error(err.Error(), log.Error(err))\n\t}\n\n\treturn &instruments\n}", "title": "" }, { "docid": "e908dc92e5f9f453e4494680806e6799", "score": "0.52884465", "text": "func (m *MockHistogram) Count() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Count\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "title": "" }, { "docid": "9c6a48f4b782e6e537fba14c95f7643e", "score": "0.528548", "text": "func (m *SimpleMetrics) NewCustomCounter(name string) chan map[string]int64 {\n\tch := make(chan map[string]int64)\n\tm.customCounters[name] = ch\n\tgo m.newMetric(\"counters\", name, ch)\n\treturn ch\n}", "title": "" }, { "docid": "ec8bda52bf586542313b57a563d8d759", "score": "0.5284864", "text": "func (m *MockBookKeeping) Count(ctx context.Context, action string) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Count\", ctx, action)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5512e96cb8d7a371389605167963be6b", "score": "0.52817976", "text": "func NewMockCounterRepository(ctrl *gomock.Controller) *MockCounterRepository {\n\tmock := &MockCounterRepository{ctrl: ctrl}\n\tmock.recorder = &MockCounterRepositoryMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "11ec1e7907fe3058f2cb5e4ab1c5726d", "score": "0.52791274", "text": "func (m *MockCounter) EXPECT() *MockCounterMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "8516620211f369f5eeed6de7ed5c8880", "score": "0.5268475", "text": "func NewCounter(raddr, rpass, rkey string, rdb int) (*RedisCounter, error) {\n\n\t// create the redis client and check it can connect\n\trclient := redis.NewClient(&redis.Options{\n\t\tAddr: raddr,\n\t\tDB: rdb,\n\t\tPassword: rpass,\n\t})\n\n\t// Check if rkey exist and create it if it does not.\n\t_, err := rclient.Get(rkey).Result()\n\tif err == redis.Nil {\n\t\t_, err = rclient.Set(rkey, 0, 0).Result()\n\t}\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed connecting to redis: %v\", err)\n\t}\n\n\treturn &RedisCounter{rclient: rclient, rkey: rkey, mutex: &sync.Mutex{}}, err\n}", "title": "" }, { "docid": "47326c23d79a5d79e08d1964cef727b6", "score": "0.52677685", "text": "func NewCount() Count {\n\treturn Count{}\n}", "title": "" }, { "docid": "8a7353ad60769496af14b1f813a99c21", "score": "0.5262594", "text": "func newMockJwtProvider(addr, respKeys string) (*MockJwtProvider, error) {\n\tl, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to create MockJwtProvider %v\", err)\n\t}\n\tmockJwtProvider := &MockJwtProvider{\n\t\tcnt: new(int32),\n\t}\n\tmockJwtProvider.s = httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tatomic.AddInt32(mockJwtProvider.cnt, 1)\n\t\tglog.Infof(\"Provider at addr %v responding with: %v\", addr, respKeys)\n\t\tw.Write([]byte(respKeys))\n\t}))\n\tmockJwtProvider.s.Listener.Close()\n\tmockJwtProvider.s.Listener = l\n\tmockJwtProvider.s.Start()\n\treturn mockJwtProvider, nil\n}", "title": "" }, { "docid": "0f3d59f692bd0121c92cb610a1cca645", "score": "0.5259111", "text": "func newWasmQuerierWithCounter(keeper Keeper) wasmQuerierWithCounter {\n\treturn wasmQuerierWithCounter{real: NewWasmQuerier(keeper)}\n}", "title": "" }, { "docid": "e95d2f41ab612f3cb46c61fdc1eaeaa0", "score": "0.525743", "text": "func newMockPusher() *logPusher {\n\tsvc := newAlwaysPassMockLogClient(func(args mock.Arguments) {})\n\treturn newLogPusher(PusherKey{\n\t\tLogGroupName: logGroup,\n\t\tLogStreamName: logStreamName,\n\t}, *svc, zap.NewNop())\n}", "title": "" }, { "docid": "36465cccb52d18a5d71c1e96b1e9e68c", "score": "0.5255892", "text": "func NewCounter(capacity uint8, freeCb func()) *Counter {\n\treturn &Counter{\n\t\tcapacity: capacity,\n\t\tfreeCb: freeCb,\n\t\titems: make(map[string]*itemNode),\n\t}\n}", "title": "" }, { "docid": "a86a10054fdc43b21efdaa3d924cc7b0", "score": "0.5243342", "text": "func NewCounter(metadata Metadata) *Counter {\n\treturn &Counter{metadata, metrics.NewCounter()}\n}", "title": "" } ]
64a477cbef8edf0870fffa86cd02f3e9
/ It returns a value type NUMBER.
[ { "docid": "1a1398c712762f223b33fd817eb1b0b6", "score": "0.5430281", "text": "func (this *DateTruncMillis) Type() value.Type { return value.NUMBER }", "title": "" } ]
[ { "docid": "af420c9c8657c1f284fbbf79e164a70f", "score": "0.7012813", "text": "func (v Value) Number() (Number, error) {\n\tr := bytes.NewReader(v.bytes)\n\treturn byteReaderToNumber(v.dataType, r)\n}", "title": "" }, { "docid": "989ef832b94151d58629c0e7d935856f", "score": "0.6969279", "text": "func getNumber(v interface{}) (int64, error) {\n\tswitch v := v.(type) {\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 []byte:\n\t\treturn parseString(string(v))\n\tcase string:\n\t\treturn parseString(v)\n\tcase sqltypes.Value:\n\t\treturn parseValue(v.Type(), v.Raw())\n\tcase *querypb.BindVariable:\n\t\treturn parseValue(v.Type, v.Value)\n\t}\n\treturn 0, fmt.Errorf(\"getNumber: unexpected type for %v: %T\", v, v)\n}", "title": "" }, { "docid": "f3588ea07978571da6de237a1635d8a1", "score": "0.6675658", "text": "func (v *Value) Number() (float64, error) {\n\tif v.kind == kindNumber {\n\t\treturn v.numberContent, nil\n\t}\n\treturn 0.0, errors.New(\"JSON value is not a number\")\n}", "title": "" }, { "docid": "be56af645469f5fa696c69c4a39bc427", "score": "0.6643727", "text": "func getNumber(e Expr) (float64, error) {\n\tswitch n := e.(type) {\n\tcase *NumberLiteral:\n\t\treturn n.Val, nil\n\tcase *NilLiteral:\n\t\treturn 0, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"Literal is not a number: %v\", n)\n\t}\n}", "title": "" }, { "docid": "8abe310f0f62e7f467872bcdb597899e", "score": "0.6592061", "text": "func NumberVal(v *big.Rat) cty.Value {\n\treturn cty.CapsuleVal(Number, v)\n}", "title": "" }, { "docid": "d890c2a0246e59e19a8b22a21b16b9b9", "score": "0.65532523", "text": "func (p *parser) number() Node {\n\ttoken := p.expect(TokenNumber)\n\tnum, err := newNumber(token.pos, token.val)\n\tif err != nil {\n\t\tp.error(err)\n\t}\n\treturn num\n}", "title": "" }, { "docid": "64cd52414b4d124889c8aaa136138744", "score": "0.64673233", "text": "func (u *sqlSymUnion) numVal() *NumVal {\n\treturn u.val.(*NumVal)\n}", "title": "" }, { "docid": "64cd52414b4d124889c8aaa136138744", "score": "0.64673233", "text": "func (u *sqlSymUnion) numVal() *NumVal {\n\treturn u.val.(*NumVal)\n}", "title": "" }, { "docid": "64cd52414b4d124889c8aaa136138744", "score": "0.64673233", "text": "func (u *sqlSymUnion) numVal() *NumVal {\n\treturn u.val.(*NumVal)\n}", "title": "" }, { "docid": "64cd52414b4d124889c8aaa136138744", "score": "0.64673233", "text": "func (u *sqlSymUnion) numVal() *NumVal {\n\treturn u.val.(*NumVal)\n}", "title": "" }, { "docid": "4f3cf0eefe5f0a4edf63d18529d4ee46", "score": "0.6376399", "text": "func (v *JSONValue) Number() float64 {\n\tv.parseNumber()\n\treturn v.valNumber\n}", "title": "" }, { "docid": "45ca37944a21232c76eeb8f146ad985f", "score": "0.6373832", "text": "func ToNumber(v Value) (int64, float64, NumberType) {\n\tswitch v.iface.(type) {\n\tcase int64:\n\t\treturn v.AsInt(), 0, IsInt\n\tcase float64:\n\t\treturn 0, v.AsFloat(), IsFloat\n\tcase string:\n\t\ts := v.AsString()\n\t\treturn StringToNumber(strings.TrimSpace(s))\n\t}\n\treturn 0, 0, NaN\n}", "title": "" }, { "docid": "db4b08c08fc73739b8a67e732017df7b", "score": "0.6349944", "text": "func (n SNumber) ToNum() float64 {\n\treturn float64(n)\n}", "title": "" }, { "docid": "35344cf2d16de4ded6de4558cff6bc9b", "score": "0.62996775", "text": "func (n Number) Value() (driver.Value, error) {\n\treturn string(n), nil\n}", "title": "" }, { "docid": "b5857171b5250057434e8f5dfc70d8da", "score": "0.62972", "text": "func (v Value) NumberType() ValueType {\n\tswitch v.iface.(type) {\n\tcase int64:\n\t\treturn IntType\n\tcase float64:\n\t\treturn FloatType\n\t}\n\treturn UnknownType\n}", "title": "" }, { "docid": "d19d9d6a3b77295458baee6c5851712f", "score": "0.6235369", "text": "func ToNumberValue(v Value) (Value, NumberType) {\n\tswitch v.NumberType() {\n\tcase IntType:\n\t\treturn v, IsInt\n\tcase FloatType:\n\t\treturn v, IsFloat\n\t}\n\tif s, ok := v.TryString(); ok {\n\t\tn, f, tp := StringToNumber(strings.TrimSpace(s))\n\t\tswitch tp {\n\t\tcase IsInt:\n\t\t\treturn IntValue(n), IsInt\n\t\tcase IsFloat:\n\t\t\treturn FloatValue(f), IsFloat\n\t\t}\n\t}\n\treturn v, NaN\n}", "title": "" }, { "docid": "5eb5d00f75119768df24a8bee78034cb", "score": "0.6179907", "text": "func Number() {\n\tfmt.Println(232, reflect.TypeOf(232))\n\tfmt.Println(232.67, reflect.TypeOf(232.67))\n}", "title": "" }, { "docid": "3bce58350285a6ea16d40ecdbc70acf8", "score": "0.6162765", "text": "func lvalNum(x int64) *lval {\n\tv := new(lval)\n\tv.ltype = lvalNumType\n\tv.num = x\n\treturn v\n}", "title": "" }, { "docid": "c8bf0cc19cc4a9d26097edf422d48e8c", "score": "0.6157204", "text": "func NumberIntVal(v int64) cty.Value {\n\tbr := big.NewRat(v, 1)\n\treturn cty.CapsuleVal(Number, br)\n}", "title": "" }, { "docid": "f40c490cffbab330c8b2c45aa78f7b30", "score": "0.61416274", "text": "func (j *JSONData) Number() *float64 {\n\tif j != nil && j.value != nil {\n\t\tif float, ok := (*j.value).(float64); ok {\n\t\t\treturn &float\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5241db7a9bce99bca62636a3184985c", "score": "0.60729116", "text": "func NewNumber(value float64) *Value {\n\treturn &Value{kind: kindNumber, numberContent: value}\n}", "title": "" }, { "docid": "40c743fc1b0a5501df988d04f0fc185d", "score": "0.5975871", "text": "func (rt *operatorRuntime) numVal(op func(float64) interface{}, vs parser.Scope,\n\tis map[string]interface{}, tid uint64) (interface{}, error) {\n\n\tvar ret interface{}\n\n\terrorutil.AssertTrue(len(rt.node.Children) == 1,\n\t\tfmt.Sprint(\"Operation requires 1 operand\", rt.node))\n\n\tres, err := rt.node.Children[0].Runtime.Eval(vs, is, tid)\n\tif err == nil {\n\n\t\t// Check if the value is a number\n\n\t\tresNum, ok := res.(float64)\n\n\t\tif !ok {\n\n\t\t\t// Produce a runtime error if the value is not a number\n\n\t\t\treturn nil, rt.erp.NewRuntimeError(util.ErrNotANumber,\n\t\t\t\trt.errorDetailString(rt.node.Children[0].Token, res), rt.node.Children[0])\n\t\t}\n\n\t\tret = op(resNum)\n\t}\n\n\treturn ret, err\n}", "title": "" }, { "docid": "a9c29bc1b74461c86a38cb61a12eb995", "score": "0.59715605", "text": "func (v Value10) Get() any { return int(v) }", "title": "" }, { "docid": "f686e5033e1324b8e448c65534069375", "score": "0.5946786", "text": "func (t Token) Numberlike() float64 {\n\treturn float64(t)\n}", "title": "" }, { "docid": "b3390c7cfd55ac624ce2bc700a0d9d08", "score": "0.5891357", "text": "func (l *lexer) getNumber() float64 {\n\tvalueEndIndex := l.pos + 1\n\tfor valueEndIndex < len(l.input) {\n\t\tch := l.input[valueEndIndex]\n\t\tif ch >= '0' && ch <= '9' {\n\t\t\tvalueEndIndex++\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tvalue, err := strconv.ParseFloat(l.input[l.pos:valueEndIndex], 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tl.pos = valueEndIndex\n\treturn value\n}", "title": "" }, { "docid": "6b01385df3c78e2ab284d005d487680f", "score": "0.58031094", "text": "func ToNumber(o Value) (*Number, error) {\n\tswitch p := o.(type) {\n\tcase *Number:\n\t\treturn p, nil\n\tcase *Character:\n\t\treturn Integer(int(p.Value)), nil\n\tcase *Boolean:\n\t\tif p.Value {\n\t\t\treturn One, nil\n\t\t}\n\t\treturn Zero, nil\n\tcase *String:\n\t\tf, err := strconv.ParseFloat(p.Value, 64)\n\t\tif err == nil {\n\t\t\treturn Float(f), nil\n\t\t}\n\t}\n\treturn nil, NewError(ArgumentErrorKey, \"cannot convert to an number: \", o)\n}", "title": "" }, { "docid": "8d4616075d15eee16fdf83a0e62844d3", "score": "0.5730639", "text": "func (f Number) Native(context.Context) interface{} {\n\treturn float64(f)\n}", "title": "" }, { "docid": "87ac902f95bc6ecfbf8aa96388cd80af", "score": "0.57247335", "text": "func (n Int64String) Value() (driver.Value, error) {\n\tif n == 0 {\n\t\treturn nil, nil\n\t}\n\treturn float64(n), nil\n}", "title": "" }, { "docid": "7a872bd6185f8198ca4a260c0b71d481", "score": "0.57143056", "text": "func (e *Expect) Number(value float64) *Number {\n\topChain := e.chain.enter(\"Number()\")\n\tdefer opChain.leave()\n\n\treturn newNumber(opChain, value)\n}", "title": "" }, { "docid": "518b83980b5b44bd324b81e6f5a7bc30", "score": "0.57064116", "text": "func (l *NumberLiteral) Type() Type {\n\treturn l.ExprType\n}", "title": "" }, { "docid": "daa10d86887afe7964ee1395947d00c1", "score": "0.5703687", "text": "func (p *Parser) number() {\n\tnum, _ := strconv.Atoi(p.previous.Literal)\n\tp.emitConstant(IntVal(num))\n}", "title": "" }, { "docid": "9147ad0750b10a09b65201f8388d2312", "score": "0.5702364", "text": "func (this *DateAddMillis) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "33e7cf842e24777a6f4f7c5699744b9f", "score": "0.5690589", "text": "func (p *parser) number(val string) float64 {\n\tn, err := strconv.ParseInt(val, 0, 64)\n\tf := float64(n)\n\tif err != nil {\n\t\tf, err = strconv.ParseFloat(val, 64)\n\t}\n\tif err != nil {\n\t\tp.errorf(\"error parsing number: %s\", err)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "3d4012ea51828a84665c650edc320818", "score": "0.56899375", "text": "func readNumber(pt *pathtokenizer, tokenType *int, token *string) (v float64, err error) {\n\tif *tokenType != scanNum {\n\t\treturn 0, fmt.Errorf(\"this token is not a Number but %d\", *tokenType)\n\t}\n\tv, err = strconv.ParseFloat(*token, 64) // parse float64\n\t*tokenType, *token = pt.get() // read next token\n\treturn\n}", "title": "" }, { "docid": "38304b089c6a810d36474e7c5823a18f", "score": "0.56866306", "text": "func AllocNumber(val float64, numtype int) *GoJSON {\n\tchild := new(GoJSON)\n\n\tif numtype == JSON_INT {\n\t\tchild.Valint = int64(val)\n\t\tchild.Jsontype = JSON_INT\n\t} else if numtype == JSON_UINT {\n\t\tchild.Valuint = uint64(val)\n\t\tchild.Jsontype = JSON_UINT\n\t} else {\n\t\tchild.Valdouble = val\n\t\tchild.Jsontype = JSON_DOUBLE\n\t}\n\n\treturn child\n}", "title": "" }, { "docid": "56bd1d2bb9d332f271d5bb5f4a39b6e4", "score": "0.5629455", "text": "func (n NullNumeric) Value() (driver.Value, error) {\n\tif !n.Valid {\n\t\treturn nil, nil\n\t}\n\treturn n.Numeric.Value()\n}", "title": "" }, { "docid": "bd0342655b975369fe344fe95fa7271b", "score": "0.56284064", "text": "func (l *Lexer) Number() float64 {\n\ts := l.pos // l.start is reset through the multiple scans\n\tif l.Peek() == '-' {\n\t\tl.pos += l.width\n\t}\n\tl.Scan(unicode.IsDigit)\n\tif l.Next() == \".\" {\n\t\tl.Scan(unicode.IsDigit)\n\t} else {\n\t\tl.Rewind()\n\t}\n\tif c := l.Next(); c == \"e\" || c == \"E\" {\n\t\tif l.Peek() == '-' || l.Peek() == '+' {\n\t\t\tl.pos += l.width\n\t\t}\n\t\tl.Scan(unicode.IsDigit)\n\t} else {\n\t\tl.Rewind()\n\t}\n\tl.start = s\n\tn, err := strconv.ParseFloat(l.Input[s:l.pos], 64)\n\tif err != nil {\n\t\t// This might be a bad idea in the long run.\n\t\treturn 0\n\t}\n\treturn n\n}", "title": "" }, { "docid": "c8accfccef0a5acf77bda4376c1350f1", "score": "0.56143534", "text": "func (*BigInt) Type() types.Type {\n\treturn types.Number\n}", "title": "" }, { "docid": "65e1df6c415e3df66a3712fc9ae8a7db", "score": "0.56102544", "text": "func (p *Parser) number(tok token.Token) (expr value.Expr, str string) {\n\tvar err error\n\ttext := tok.Text\n\tswitch tok.Type {\n\tcase token.Identifier:\n\t\texpr = p.variable(text)\n\tcase token.String:\n\t\t// TODO\n\t\tstr = \"<token.String>\"\n\tcase token.Number, token.Rational:\n\t\texpr, err = value.Parse(p.context.Config(), text)\n\tcase token.LeftParen:\n\t\texpr = p.expr(p.next())\n\t\ttok := p.next()\n\t\tif tok.Type != token.RightParen {\n\t\t\tp.errorf(\"expected right paren, found %s\", tok)\n\t\t}\n\t}\n\tif err != nil {\n\t\tp.errorf(\"%s: %s\", text, err)\n\t}\n\treturn expr, str\n}", "title": "" }, { "docid": "dc6a570989b4d4f1bcce4e6fc9e0634d", "score": "0.56073403", "text": "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}", "title": "" }, { "docid": "c1363fcd6e98b9d8803e6c11eea486cf", "score": "0.56034446", "text": "func (number Number) Value() (value driver.Value, err error) {\n\tif number == \"\" {\n\t\treturn \"\", nil\n\t}\n\n\tif err = number.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn number.String(), nil\n}", "title": "" }, { "docid": "e38e8d68d7381b049ca4ab71fda773a3", "score": "0.5577278", "text": "func convertNumber(n json.Number) (interface{}, error) {\n\t// Attempt to convert to an int64 first\n\tif i, err := n.Int64(); err == nil {\n\t\treturn i, nil\n\t}\n\t// Return a float64 (default json.Decode() behavior)\n\t// An overflow will return an error\n\treturn n.Float64()\n}", "title": "" }, { "docid": "5cd43a203aa4fc85ed942dce1df6d708", "score": "0.5557429", "text": "func (l *Lexer) readNumber() (token.TokenType, string) {\n\tposition := l.position\n\tdecimals := 0\n\tfor isDigit(l.ch) || l.ch == '.' {\n\t\tif l.ch == '.' {\n\t\t\tif decimals > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdecimals++\n\t\t}\n\t\tl.readChar()\n\t}\n\tif decimals > 0 {\n\t\treturn token.FLOAT, l.input[position:l.position]\n\t}\n\n\treturn token.INT, l.input[position:l.position]\n}", "title": "" }, { "docid": "80137d6b92da2b923211bee8693d893d", "score": "0.55527085", "text": "func (v Value10) Int() int { return int(v) }", "title": "" }, { "docid": "0b1979f4e51462dea8e651eea56779f9", "score": "0.55305743", "text": "func numberType(f func(...Expression) Expression) func(...Expression) (Expression, error) {\n\n\treturn func(args ...Expression) (Expression, error) {\n\t\tfor _, arg := range args {\n\t\t\tif _, ok := arg.(Number); !ok {\n\t\t\t\treturn nil, errors.New(fmt.Sprintf(\"Type Error: Recieved %T, Expected Number\", arg))\n\t\t\t}\n\t\t}\n\t\treturn f(args...), nil\n\t}\n}", "title": "" }, { "docid": "e55f5f8778c32b164ba9d18d9c72bfd2", "score": "0.552407", "text": "func (me TSAFPTPortugueseVatNumber) ToXsdtInteger() xsdt.Integer { return xsdt.Integer(me) }", "title": "" }, { "docid": "ea62df02461d97d74312be9b6bf9d303", "score": "0.5522733", "text": "func IntValue(n int64) Value {\n\treturn Value{iface: n}\n}", "title": "" }, { "docid": "d517cadfcd03b461746fd31efd54c900", "score": "0.5513656", "text": "func (this *ObjectLength) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "d517cadfcd03b461746fd31efd54c900", "score": "0.5513656", "text": "func (this *ObjectLength) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "49162fea061a6dd4a31a0435c130c2fd", "score": "0.5504865", "text": "func (Integer) Type() types.Type {\n\treturn types.Number\n}", "title": "" }, { "docid": "06e3ddf9703365726c7c7e34b7129716", "score": "0.5489754", "text": "func (p *parser) parseNumber() (num *tree.NumberExpr) {\n\tswitch p.tok {\n\tcase token.NUMBERFLOAT, token.NUMBERHEX:\n\t\tnum = &tree.NumberExpr{NumberToken: p.token()}\n\tdefault:\n\t\tp.error(p.off, \"'\"+token.NUMBERFLOAT.String()+\"' expected\")\n\t}\n\tp.next()\n\treturn\n}", "title": "" }, { "docid": "6df76c3e74e44c35dbfea291b119915d", "score": "0.5476243", "text": "func (s *Scanner) scanNumber() Token {\n\tline, offset := s.line, s.lineOffset\n\tvar buf bytes.Buffer\n\tbuf.WriteByte(s.read())\n\tfor {\n\t\tif ch := s.read(); ch == eof {\n\t\t\tbreak\n\t\t} else if isNumber(ch) {\n\t\t\tbuf.WriteByte(ch)\n\t\t} else {\n\t\t\ts.unread()\n\t\t\tbreak\n\t\t}\n\t}\n\treturn Token{tpe: NUMBER, val: buf.String(), line: line, offset: offset}\n}", "title": "" }, { "docid": "7efb261de69f9aa1c1650400d0e0d0c5", "score": "0.54723406", "text": "func (s *Scanner) number() {\n\tfor s.isDigit(s.peek()) {\n\t\ts.advance()\n\t}\n\tif s.peek() == '.' && s.isDigit(s.peekNext()) {\n\t\ts.advance()\n\t\tfor s.isDigit(s.peek()) {\n\t\t\ts.advance()\n\t\t}\n\t}\n\t// this seems a bit convoluted just to cast []byte into []rune\n\tliteral := []rune(string(s.source[s.start:s.current]))\n\ts.addToken(token.NUMBER, literal)\n}", "title": "" }, { "docid": "8efccb2123cfc53dff5af22c146f6479", "score": "0.5462097", "text": "func (p *Parser) number(tok scan.Token) (expr value.Expr, str string) {\n\tvar err error\n\ttext := tok.Text\n\tswitch tok.Type {\n\tcase scan.Identifier:\n\t\texpr = p.index(p.variable(text))\n\tcase scan.String:\n\t\tstr = value.ParseString(text)\n\tcase scan.Number, scan.Rational, scan.Complex:\n\t\texpr, err = value.Parse(p.context.Config(), text)\n\tcase scan.LeftParen:\n\t\texpr = p.expr()\n\t\ttok := p.next()\n\t\tif tok.Type != scan.RightParen {\n\t\t\tp.errorf(\"expected right paren, found %s\", tok)\n\t\t}\n\t}\n\tif err != nil {\n\t\tp.errorf(\"%s: %s\", text, err)\n\t}\n\treturn expr, str\n}", "title": "" }, { "docid": "4b64830eb2b43aa46789e83d8522a0d1", "score": "0.5432897", "text": "func (t *Type) Val() *Type", "title": "" }, { "docid": "b210fed51250c184f6016b444692277c", "score": "0.5431276", "text": "func AsNumber(f Field) uint32 {\n\tv, _ := f.(uint32)\n\treturn v\n}", "title": "" }, { "docid": "ab11e51e4c0777e2d754bd5db0b39da5", "score": "0.54235893", "text": "func execmNumberInt64(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret, ret1 := args[0].(json.Number).Int64()\n\tp.Ret(1, ret, ret1)\n}", "title": "" }, { "docid": "13d548296bdc799daa2dfaebe7ea1cf6", "score": "0.54192615", "text": "func GetNumber(data []byte, keys ...string) (val float64, offset int, err error) {\n\tv, t, offset, e := Get(data, keys...)\n\n\tif e != nil {\n\t\treturn 0, offset, e\n\t}\n\n\tif t != Number {\n\t\treturn 0, offset, fmt.Errorf(\"Value is not a number: %s\", string(v))\n\t}\n\n\tval, err = strconv.ParseFloat(string(v), 64)\n\treturn\n}", "title": "" }, { "docid": "1941d93a8c8a836197daa26c0e2fbbdb", "score": "0.54183376", "text": "func processNumber(i interface{}) uint64 {\n\tvar n uint64\n\tswitch v := i.(type) {\n\tcase uint64:\n\t\tn = v\n\tcase string:\n\t\ts := strings.Split(v, \".\")\n\t\tn, _ = strconv.ParseUint(s[0], 10, 64)\n\tcase float64:\n\t\tn = uint64(v)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "baa67702b1f918a598db556f5409fe2c", "score": "0.54180175", "text": "func IntValue(obj Value) int {\n\tif p, ok := obj.(*Number); ok {\n\t\treturn int(p.Value)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "1de0a4fb27131069394a578ab6f4a56a", "score": "0.5416243", "text": "func (v *Value) GetNum() *string {\n\tret := C.zj_GetNumStr(v.V)\n\tif ret == nil {\n\t\treturn nil\n\t}\n\tretStr := C.GoString(ret)\n\treturn &retStr\n}", "title": "" }, { "docid": "e4e4b84e9b8247e34d6c5e3e371556ba", "score": "0.5409647", "text": "func (self ValueKind) IsNumber() bool {\n\treturn bool(C.wasm_valkind_is_num(C.wasm_valkind_t(self)))\n}", "title": "" }, { "docid": "8fcbc0e8cc93dfe574deaa920dbb9f4b", "score": "0.53881174", "text": "func (n *Number) Int() *big.Int {\n\tif !n.isInteger {\n\t\treturn nil\n\t}\n\treturn &n.integer\n}", "title": "" }, { "docid": "d38b6ef081b345719a1b9d51679e412c", "score": "0.5366519", "text": "func (*Base) LiteralNumber(p ASTPass, node *ast.LiteralNumber, ctx Context) {\n}", "title": "" }, { "docid": "8c8986c1af253822a49d16204e2d91ce", "score": "0.5362223", "text": "func (this *DatePartStr) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "5127fae42f5609493a53d64e90aba0a0", "score": "0.5360302", "text": "func readNumericToken(r *bufio.Reader) tok.Token {\n\tliteral, ok := readNumericLiteral(r)\n\tif !ok {\n\t\treturn tok.Token{TokenType: tok.Invalid, Literal: literal}\n\t}\n\n\tif ok := validateNumericLiteral(literal); !ok {\n\t\treturn tok.Token{TokenType: tok.Invalid, Literal: literal}\n\t}\n\n\ttokType := numericLiteralTokenType(literal)\n\n\treturn tok.Token{TokenType: tokType, Literal: literal}\n}", "title": "" }, { "docid": "b6073525d448251699fd28ef32dfaa7a", "score": "0.5360037", "text": "func eeNumInt(v int) (n eeNum) {\r\n\t*n.int() = v\r\n\treturn\r\n}", "title": "" }, { "docid": "604a93b8d89f5cbc2d0a841e5c2480e0", "score": "0.5355204", "text": "func (v Int) Native() interface{} {\n\treturn int64(v)\n}", "title": "" }, { "docid": "f67ab47f341c3ffa7168015e2cab1793", "score": "0.5354741", "text": "func (a *Argument) Number() float64 {\n\treturn float64(a.state.CheckNumber(a.number))\n}", "title": "" }, { "docid": "b0812d1077e451f83d916f1a373d342b", "score": "0.53504443", "text": "func (v Value2) Get() any { return int(v) }", "title": "" }, { "docid": "f5ac59bf71119d31314da122088a97b9", "score": "0.5350011", "text": "func (this *DatePartMillis) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "849b5e335645bb68e73cd7268ac3a3c5", "score": "0.5349797", "text": "func (d DecimalObj) Value() (driver.Value, error) {\n\tif !d.Valid {\n\t\treturn nil, nil\n\t}\n\treturn d.Number.Value()\n}", "title": "" }, { "docid": "653e92536b29f64e3a6c8d23184ed250", "score": "0.5330489", "text": "func (lx *Lexer) numeralLiteral() Token {\n\tlx.token.Type = IntegerLiteral\n\tlx.token.Sub = Decimal\n\n\tdefer func() {\n\t\terr := recover()\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// FIXME: Show more helpful messages\n\t\tmsg := fmt.Sprintf(\"`%s` Illegal syntax of %s %s.\\n%s\",\n\t\t\tlx.token.Value(),\n\t\t\tlx.token.Sub,\n\t\t\tlx.token.Type,\n\t\t\terr,\n\t\t)\n\n\t\tpanic(lx.errf(msg))\n\t}()\n\n\tr, e := lx.peekChar()\n\tif e != nil {\n\t\tpanic(\"End of file nothing to read here\")\n\t}\n\n\tif r > '0' && r <= '9' {\n\t\tlx.consume()\n\t\tlx.separatedByUnderscore(IsNonZeroDigit, false)\n\t} else if r != '.' {\n\t\tlx.consume()\n\t\tp, _ := lx.peekChar()\n\t\tswitch {\n\t\tcase IsRuneIn(p, \"Xx\"):\n\t\t\tlx.token.Sub = Hex\n\t\t\tlx.consume()\n\n\t\t\t// 0x.BEEF is a valid float literal\n\t\t\t// but 0x is invalid integer literal\n\t\t\tif p, _ := lx.peekChar(); p != '.' {\n\t\t\t\tlx.separatedByUnderscore(IsHexDigit, true)\n\t\t\t}\n\n\t\tcase IsRuneIn(p, \"Bb\"):\n\t\t\tlx.token.Sub = Binary\n\t\t\tlx.consume()\n\t\t\tlx.separatedByUnderscore(IsBinaryDigit, true)\n\t\tcase IsDigit(p):\n\t\t\tif IsOctalDigit(p) {\n\t\t\t\tlx.token.Sub = Octal\n\t\t\t\tlx.separatedByUnderscore(IsOctalDigit, true)\n\t\t\t} else {\n\t\t\t\tpanic(\"Integer are too large.\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lx.returnAndReset()\n}", "title": "" }, { "docid": "53da1cdcb99199b4ec78f6ae2b697644", "score": "0.5324667", "text": "func (n SStr) ToNum() float64 {\n\tv, _ := strconv.ParseFloat(string(n), 64)\n\treturn v\n}", "title": "" }, { "docid": "a2344fcf5ea55dc313c6dd301edd3865", "score": "0.5317645", "text": "func ParseNumber(f float64) *types.TypedValue {\n\tw := &wrappers.DoubleValue{Value: f}\n\tbs, err := proto.Marshal(w)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &types.TypedValue{\n\t\tType: string(TypeNumber),\n\t\tValue: bs,\n\t}\n}", "title": "" }, { "docid": "2511edd5d654cc8552b40a0e25c6826e", "score": "0.5315685", "text": "func (i *Number) AsInt() int {\n\treturn int(i.value)\n}", "title": "" }, { "docid": "919a4052789da148c2c1c2542b77c73a", "score": "0.53153735", "text": "func (n NullInt64) Value() (driver.Value, error) {\n\tif n == 0 {\n\t\treturn nil, nil\n\t}\n\treturn int64(n), nil\n}", "title": "" }, { "docid": "58273f92cf92fe1552ccd7acb5b37e8f", "score": "0.53102845", "text": "func (v Value) Integer() int {\n\tswitch v.Typ {\n\tdefault:\n\t\tn, _ := strconv.ParseInt(v.String(), 10, 64)\n\t\treturn int(n)\n\tcase ':':\n\t\treturn v.IntegerV\n\t}\n}", "title": "" }, { "docid": "8e6572f7d86dac0eef006e8a52b519f0", "score": "0.53074735", "text": "func ParseNumberVal(s string) (cty.Value, error) {\n\t// The parsing done by big.Rat.SetString is more liberal than we want in\n\t// that it permits giving two numbers separated by a slash to give the\n\t// value as a fraction. We'll pre-screen the given string to make sure\n\t// it's using the subset of Rat number syntax we're expecting, and then\n\t// delegate to big.Rat.SetString only if it is.\n\n\tfor _, c := range s {\n\t\tif !((c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e' || c == 'E') {\n\t\t\treturn cty.NilVal, errors.New(\"invalid number syntax\")\n\t\t}\n\t}\n\n\tbr := new(big.Rat)\n\t_, ok := br.SetString(s)\n\tif !ok {\n\t\treturn cty.NilVal, errors.New(\"invalid number syntax\")\n\t}\n\treturn cty.CapsuleVal(Number, br), nil\n}", "title": "" }, { "docid": "305c0c1917c7b963d495ef886d7359ae", "score": "0.5305551", "text": "func (p Packet) ValueNumbers() ([]Number, error) {\n\tr := make([]Number, len(p.DataTypes))\n\n\tvar err error\n\treader := bytes.NewReader(p.Bytes)\n\tfor i, t := range p.DataTypes {\n\t\tr[i], err = byteReaderToNumber(t, reader)\n\t\tif err != nil {\n\t\t\treturn []Number{}, err\n\t\t}\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "a29ce81ea252ac2eb7285ac8a519902f", "score": "0.5293655", "text": "func NewValue(s string, native bool) (*Value, error) {\n\tvar err error\n\tv := Value{\n\t\tnative: native,\n\t}\n\tmatches := valueRegex.FindStringSubmatch(s)\n\tif matches == nil {\n\t\treturn nil, fmt.Errorf(\"Invalid Number: %s\", s)\n\t}\n\tif len(matches[2])+len(matches[4]) > 32 {\n\t\treturn nil, fmt.Errorf(\"Overlong Number: %s\", s)\n\t}\n\tif matches[1] == \"-\" {\n\t\tv.negative = true\n\t}\n\tif len(matches[4]) == 0 {\n\t\tif v.num, err = strconv.ParseUint(matches[2], 10, 64); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Invalid Number: %s Reason: %s\", s, err.Error())\n\t\t}\n\t\tv.offset = 0\n\t} else {\n\t\tif v.num, err = strconv.ParseUint(matches[2]+matches[4], 10, 64); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Invalid Number: %s Reason: %s\", s, err.Error())\n\t\t}\n\t\tv.offset = -int64(len(matches[4]))\n\t}\n\tif len(matches[5]) > 0 {\n\t\texp, err := strconv.ParseInt(matches[7], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Invalid Number: %s %s\", s, err.Error())\n\t\t}\n\t\tif matches[6] == \"-\" {\n\t\t\tv.offset -= exp\n\t\t} else {\n\t\t\tv.offset += exp\n\t\t}\n\t}\n\tif v.IsNative() && len(matches[3]) > 0 {\n\t\tv.offset += 6\n\t}\n\treturn &v, v.canonicalise()\n}", "title": "" }, { "docid": "12c3d5ff6041f232f8f6f556dd7b993e", "score": "0.52883774", "text": "func (p *PSParser) parseNumber() (PSObject, error) {\n\tisFloat := false\n\tallowSigns := true\n\tnumStr := \"\"\n\tfor {\n\t\tcommon.Log.Trace(\"Parsing number \\\"%s\\\"\", numStr)\n\t\tbb, err := p.reader.Peek(1)\n\t\tif err == io.EOF {\n\t\t\t// GH: EOF handling. Handle EOF like end of line. Can happen with\n\t\t\t// encoded object streams that the object is at the end.\n\t\t\t// In other cases, we will get the EOF error elsewhere at any rate.\n\t\t\tbreak // Handle like EOF\n\t\t}\n\t\tif err != nil {\n\t\t\tcommon.Log.Debug(\"PS ERROR: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif allowSigns && (bb[0] == '-' || bb[0] == '+') {\n\t\t\t// Only appear in the beginning, otherwise serves as a delimiter.\n\t\t\tb, _ := p.reader.ReadByte()\n\t\t\tnumStr += string(b)\n\t\t\tallowSigns = false // Only allowed in beginning, and after e (exponential).\n\t\t} else if pdfcore.IsDecimalDigit(bb[0]) {\n\t\t\tb, _ := p.reader.ReadByte()\n\t\t\tnumStr += string(b)\n\t\t} else if bb[0] == '.' {\n\t\t\tb, _ := p.reader.ReadByte()\n\t\t\tnumStr += string(b)\n\t\t\tisFloat = true\n\t\t} else if bb[0] == 'e' {\n\t\t\t// Exponential number format.\n\t\t\t// TODO: Is this supported in PS?\n\t\t\tb, _ := p.reader.ReadByte()\n\t\t\tnumStr += string(b)\n\t\t\tisFloat = true\n\t\t\tallowSigns = true\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif isFloat {\n\t\tfVal, err := strconv.ParseFloat(numStr, 64)\n\t\to := MakeReal(fVal)\n\t\treturn o, err\n\t}\n\tintVal, err := strconv.ParseInt(numStr, 10, 64)\n\to := MakeInteger(int(intVal))\n\treturn o, err\n}", "title": "" }, { "docid": "af871a85aa9604e48fd1152c675811d2", "score": "0.5283582", "text": "func (n SNumber) ToInt() int {\n\treturn int(n)\n}", "title": "" }, { "docid": "95fa072707cf29ef5d6dc56f21b3e6f0", "score": "0.52817607", "text": "func (vl LongValue) GetType() int {\n\treturn ParticleType.INTEGER\n}", "title": "" }, { "docid": "95fa072707cf29ef5d6dc56f21b3e6f0", "score": "0.52817607", "text": "func (vl LongValue) GetType() int {\n\treturn ParticleType.INTEGER\n}", "title": "" }, { "docid": "839c7573a3c766e5b3b5308d25d8e9c9", "score": "0.5268895", "text": "func (o *IncomeSummaryFieldNumber) GetValue() float64 {\n\tif o == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn o.Value\n}", "title": "" }, { "docid": "cb8b754cf332b815144faab9038e03c9", "score": "0.5260419", "text": "func ToNumber(v interface{}) (f float64, err error) {\n\tswitch i := v.(type) {\n\tcase string:\n\t\tf, err = strconv.ParseFloat(i, 64)\n\tcase int:\n\t\tf = float64(i)\n\tcase int8:\n\t\tf = float64(i)\n\tcase int16:\n\t\tf = float64(i)\n\tcase int32:\n\t\tf = float64(i)\n\tcase int64:\n\t\tf = float64(i)\n\tcase uint:\n\t\tf = float64(i)\n\tcase uint8:\n\t\tf = float64(i)\n\tcase uint16:\n\t\tf = float64(i)\n\tcase uint32:\n\t\tf = float64(i)\n\tcase uint64:\n\t\tf = float64(i)\n\tcase float32:\n\t\tf = float64(i)\n\tcase float64:\n\t\tf = i\n\tdefault:\n\t\terr = errors.New(\"NaN\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "96809bb877a47a57256604e10cc9fc04", "score": "0.5259585", "text": "func (n Number) Int() int {\n\tif n == 0 {\n\t\treturn 0\n\t}\n\treturn int(math.Round(float64(n)))\n}", "title": "" }, { "docid": "14e0e7fc4cd8c65689184ec1edd3d810", "score": "0.5258483", "text": "func (s *Scanner) scanNumber() (RichToken, error) {\n\toffs := s.srcPos.Offset\n\tstartCol := s.srcPos.Column\n\ttok := NUMBER\n\tch := s.ch\n\tvar err error\n\n\t// if ch is -, move on to next digit\n\tif ch == '-' {\n\t\tch, err = s.next()\n\t}\n\n\tif ch == '0' {\n\t\tif isDecimal(s.peek()) {\n\t\t\treturn RichToken{}, fmt.Errorf(\"Column %d, Line %d: 0 cannot be followed by digit without . or exponent\",\n\t\t\t\ts.srcPos.Column, s.srcPos.Line)\n\t\t}\n\n\t\tch, err = s.next()\n\t}\n\n\t// can only have one 0, or arbitrary number of decimals\n\tif ch != '0' {\n\t\tfor isDecimal(ch) {\n\t\t\tch, err = s.next()\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn RichToken{}, err\n\t}\n\n\t// can only have one ., following by arbitrary number of decimals\n\tif ch == '.' {\n\t\tch, err = s.next()\n\n\t\tif err != nil {\n\t\t\treturn RichToken{}, err\n\t\t} else if !isDecimal(ch) {\n\t\t\t// must have at least one decimal\n\t\t\treturn RichToken{}, fmt.Errorf(\"Column %d, Line %d: . must be followed by at least one digit\",\n\t\t\t\ts.srcPos.Column, s.srcPos.Line)\n\t\t}\n\n\t\tfor isDecimal(ch) {\n\t\t\tch, err = s.next()\n\n\t\t\tif err != nil {\n\t\t\t\treturn RichToken{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// can have e or E\n\tif ch == 'e' || ch == 'E' {\n\t\tch, err = s.next()\n\n\t\tif err != nil {\n\t\t\treturn RichToken{}, err\n\t\t}\n\n\t\t// exponent has optional sign\n\t\tif ch == '+' || ch == '-' {\n\t\t\tch, err = s.next()\n\n\t\t\tif err != nil {\n\t\t\t\treturn RichToken{}, err\n\t\t\t}\n\t\t}\n\n\t\t// must have at least one decimal\n\t\tif !isDecimal(ch) {\n\t\t\treturn RichToken{}, fmt.Errorf(\"Column %d, Line %d: e or E must be followed by at least one digit\",\n\t\t\t\ts.srcPos.Column, s.srcPos.Line)\n\t\t}\n\n\t\t// exponent followed by arbitrary number of decimals\n\t\tfor isDecimal(ch) {\n\t\t\tch, err = s.next()\n\n\t\t\tif err != nil {\n\t\t\t\treturn RichToken{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn RichToken{\n\t\tpos: Position{\n\t\t\tOffset: offs,\n\t\t\tColumn: startCol,\n\t\t\tLine: s.srcPos.Line,\n\t\t},\n\t\ttok: tok,\n\t\tlit: string(s.src[offs:s.srcPos.Offset]),\n\t}, nil\n}", "title": "" }, { "docid": "3440c7e6dd41b7b9828b986385e2ecb3", "score": "0.5257939", "text": "func Number(in string) (out string, err error) {\n\tf := func(r rune) bool {\n\t\treturn !unicode.IsNumber(r)\n\t}\n\n\tout = strings.Join(strings.FieldsFunc(in, f), \"\")\n\tswitch {\n\tcase len(out) == 11 && out[0] == '1' && out[1] >= '2' && out[4] >= '2':\n\t\treturn out[1:], nil\n\tcase len(out) == 11 && out[0] > '1':\n\t\treturn \"\", fmt.Errorf(\"invalid number: %s\", in)\n\tcase len(out) < 10 || out[0] <= '1' || out[3] <= '1' || len(out) > 11:\n\t\treturn \"\", fmt.Errorf(\"invalid number: %s\", in)\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "de90f388b6aae8f7e0d70bdc6194b9ab", "score": "0.52567804", "text": "func (f *Feature) Number(x Example) float64 {\n\tif f.Kind != Feature_NUMERICAL {\n\t\treturn math.NaN()\n\t}\n\treturn numerify(x.GetExampleValue(f.Name))\n}", "title": "" }, { "docid": "1ea8c0f5a075b23d50162f122f9c0d92", "score": "0.52546287", "text": "func Number(x string) (geometry.Number, error) {\n\tn, err := strconv.ParseFloat(x, 64)\n\tif err != nil {\n\t\treturn 0, ErrBadNumber\n\t}\n\treturn geometry.Number(n), nil\n}", "title": "" }, { "docid": "879cfc7296154e64b7ab5fa22942104a", "score": "0.52542835", "text": "func (n NullMoney) Value() (driver.Value, error) {\n\tif n == 0.0 {\n\t\treturn nil, nil\n\t}\n\treturn float64(n), nil\n}", "title": "" }, { "docid": "d9a44eb35d98a78535c1f78388a66f0c", "score": "0.5251321", "text": "func lexNumber(l *lexer) stateFn {\r\nLoop:\r\n\tfor {\r\n\t\tswitch r := l.next(); {\r\n\t\tcase isDigit(r):\r\n\t\tcase r == '.':\r\n\t\t\treturn lexFloat\r\n\t\tdefault:\r\n\t\t\tl.backup()\r\n\t\t\tl.emit(TokInt)\r\n\t\t\tbreak Loop\r\n\t\t}\r\n\t}\r\n\treturn lexAny\r\n}", "title": "" }, { "docid": "a7da65ee5917d607355c288962cfb7a9", "score": "0.52363634", "text": "func (lex *Lexer) NextNumberLit() {\n\tlex.nextWithSpecificMode(scanner.ScanNumberLit)\n}", "title": "" }, { "docid": "49b49b0ffbab22badaaad1d6fad7a61c", "score": "0.5228249", "text": "func (ns Int64) Value() (driver.Value, error) {\n\tif !ns.Valid {\n\t\treturn nil, nil\n\t}\n\treturn ns.Int64, nil\n}", "title": "" }, { "docid": "73f7d042fdb7060b2c52825e9a10f58f", "score": "0.52280015", "text": "func (d *Document) Number(f float64) Node {\n\tid := uint(len(d.nodes))\n\tn := d.grow()\n\tn.reset(vNumber|infRoot, numjson.FormatFloat(f, 64), n.values[:0])\n\treturn d.Node(id)\n}", "title": "" }, { "docid": "13a4ff5ba10bd17883f82436a478de4e", "score": "0.52242297", "text": "func (this *Mod) Type() value.Type { return value.NUMBER }", "title": "" }, { "docid": "bdd9577e8bb6d3eadb8767f7089bc480", "score": "0.5219287", "text": "func (vl IntegerValue) GetType() int {\n\treturn ParticleType.INTEGER\n}", "title": "" }, { "docid": "bdd9577e8bb6d3eadb8767f7089bc480", "score": "0.5219287", "text": "func (vl IntegerValue) GetType() int {\n\treturn ParticleType.INTEGER\n}", "title": "" } ]
d542d964b5c74635f9c7a2f6f42d5cdd
PerformBridgeShuntCal function as declared in nidaqmx\NIDAQmx.h:3113
[ { "docid": "cc8f976cf29d004bcccf7e12731114db", "score": "0.7943895", "text": "func PerformBridgeShuntCal(TaskHandle unsafe.Pointer, Channel string, ShuntResistorValue float64, ShuntResistorLocation int32, BridgeResistance float64, SkipUnsupportedChannels uint32) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\tcShuntResistorValue, _ := (C.float64)(ShuntResistorValue), cgoAllocsUnknown\n\tcShuntResistorLocation, _ := (C.int32)(ShuntResistorLocation), cgoAllocsUnknown\n\tcBridgeResistance, _ := (C.float64)(BridgeResistance), cgoAllocsUnknown\n\tcSkipUnsupportedChannels, _ := (C.bool32)(SkipUnsupportedChannels), cgoAllocsUnknown\n\t__ret := C.DAQmxPerformBridgeShuntCal(cTaskHandle, cChannel, cShuntResistorValue, cShuntResistorLocation, cBridgeResistance, cSkipUnsupportedChannels)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" } ]
[ { "docid": "61addc6d6d90a3167e60b58bf7b633d1", "score": "0.744603", "text": "func PerformBridgeShuntCalEx(TaskHandle unsafe.Pointer, Channel string, ShuntResistorValue float64, ShuntResistorLocation int32, ShuntResistorSelect int32, ShuntResistorSource int32, BridgeResistance float64, SkipUnsupportedChannels uint32) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\tcShuntResistorValue, _ := (C.float64)(ShuntResistorValue), cgoAllocsUnknown\n\tcShuntResistorLocation, _ := (C.int32)(ShuntResistorLocation), cgoAllocsUnknown\n\tcShuntResistorSelect, _ := (C.int32)(ShuntResistorSelect), cgoAllocsUnknown\n\tcShuntResistorSource, _ := (C.int32)(ShuntResistorSource), cgoAllocsUnknown\n\tcBridgeResistance, _ := (C.float64)(BridgeResistance), cgoAllocsUnknown\n\tcSkipUnsupportedChannels, _ := (C.bool32)(SkipUnsupportedChannels), cgoAllocsUnknown\n\t__ret := C.DAQmxPerformBridgeShuntCalEx(cTaskHandle, cChannel, cShuntResistorValue, cShuntResistorLocation, cShuntResistorSelect, cShuntResistorSource, cBridgeResistance, cSkipUnsupportedChannels)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "78b7e5244253af2f574cf46005bc6679", "score": "0.60571164", "text": "func ResetAIBridgeShuntCalShuntCalBResistance(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalShuntCalBResistance(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "bb5188baa01fa9c4a27fd16bdd080249", "score": "0.6020127", "text": "func CalBridgeAs(tType int, pesi, bf1, h0 float64) float64 {\n\tif tType != 0 {\n\t\treturn calBridgeAs(pesi, bf1, h0)\n\t}\n\treturn calBridgeSupportAs(pesi, h0)\n}", "title": "" }, { "docid": "d4e36557ea28cd30d09d9ee7d75bafa9", "score": "0.6016146", "text": "func ResetAIBridgeShuntCalShuntCalASrc(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalShuntCalASrc(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "afa396ecf24a654c4523ef0ed651f4a0", "score": "0.59133124", "text": "func ResetAIBridgeShuntCalShuntCalBActualResistance(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalShuntCalBActualResistance(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "553d50edb1adfd9dea605db8ed89896e", "score": "0.587663", "text": "func ResetAIBridgeShuntCalShuntCalAResistance(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalShuntCalAResistance(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "22d2a1c34d9ba576707ac0a13a6a6c0a", "score": "0.5844932", "text": "func PerformBridgeOffsetNullingCal(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxPerformBridgeOffsetNullingCal(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b6961233868bb94d12dfa7187db015a3", "score": "0.5841063", "text": "func PerformStrainShuntCal(TaskHandle unsafe.Pointer, Channel string, ShuntResistorValue float64, ShuntResistorLocation int32, SkipUnsupportedChannels uint32) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\tcShuntResistorValue, _ := (C.float64)(ShuntResistorValue), cgoAllocsUnknown\n\tcShuntResistorLocation, _ := (C.int32)(ShuntResistorLocation), cgoAllocsUnknown\n\tcSkipUnsupportedChannels, _ := (C.bool32)(SkipUnsupportedChannels), cgoAllocsUnknown\n\t__ret := C.DAQmxPerformStrainShuntCal(cTaskHandle, cChannel, cShuntResistorValue, cShuntResistorLocation, cSkipUnsupportedChannels)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "4ebe04d1fa40d617b4ba886cacdd750d", "score": "0.5820635", "text": "func ResetAIBridgeShuntCalShuntCalAActualResistance(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalShuntCalAActualResistance(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "af37801fac0bfb01332e2e1dc681ee5a", "score": "0.5731347", "text": "func CalBridgeRealAs(ns, diameters []float64, As float64) (rbas []RealBridgeAs) {\n\tfor _, n := range ns {\n\t\tfor _, d := range diameters {\n\t\t\tcal := calBridgeRealAs(n, d)\n\n\t\t\tif checkd(n, d) && checkAs(cal, As) {\n\t\t\t\trba := RealBridgeAs{\n\t\t\t\t\tN: n,\n\t\t\t\t\tD: d,\n\t\t\t\t\tAs: cal,\n\t\t\t\t}\n\t\t\t\trbas = append(rbas, rba)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9898bbadd2769fda5d9aeee9626cf8f0", "score": "0.56097835", "text": "func ResetAIBridgeShuntCalGainAdjust(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalGainAdjust(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8a8b5404fc2709848585189f82dcc06b", "score": "0.5549143", "text": "func CalBridgeReinforcementNum() []float64 {\n\tns := []float64{}\n\tfor n := 2.0; n < 10; n++ {\n\t\tns = append(ns, n)\n\t}\n\treturn ns\n}", "title": "" }, { "docid": "2091ca8e5abb1baa9c6571cf94410d4e", "score": "0.54864264", "text": "func (_RollupAdminFacet *RollupAdminFacetCaller) DelayedBridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _RollupAdminFacet.contract.Call(opts, &out, \"delayedBridge\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "6746a641692cb3fa0d9966e83494a52d", "score": "0.54454774", "text": "func PerformBridgeOffsetNullingCalEx(TaskHandle unsafe.Pointer, Channel string, SkipUnsupportedChannels uint32) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\tcSkipUnsupportedChannels, _ := (C.bool32)(SkipUnsupportedChannels), cgoAllocsUnknown\n\t__ret := C.DAQmxPerformBridgeOffsetNullingCalEx(cTaskHandle, cChannel, cSkipUnsupportedChannels)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "302343ccdab3b86433e0eb2f9819f8f5", "score": "0.5376291", "text": "func CreateAIPressureBridgeTableChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ElectricalVals []float64, NumElectricalVals uint32, ElectricalUnits int32, PhysicalVals []float64, NumPhysicalVals uint32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcElectricalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ElectricalVals)).Data)), cgoAllocsUnknown\n\tcNumElectricalVals, _ := (C.uInt32)(NumElectricalVals), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&PhysicalVals)).Data)), cgoAllocsUnknown\n\tcNumPhysicalVals, _ := (C.uInt32)(NumPhysicalVals), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIPressureBridgeTableChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cElectricalVals, cNumElectricalVals, cElectricalUnits, cPhysicalVals, cNumPhysicalVals, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "882305b2f36823bc5b3f2fe4413ea85d", "score": "0.5302902", "text": "func PerformStrainShuntCalEx(TaskHandle unsafe.Pointer, Channel string, ShuntResistorValue float64, ShuntResistorLocation int32, ShuntResistorSelect int32, ShuntResistorSource int32, SkipUnsupportedChannels uint32) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\tcShuntResistorValue, _ := (C.float64)(ShuntResistorValue), cgoAllocsUnknown\n\tcShuntResistorLocation, _ := (C.int32)(ShuntResistorLocation), cgoAllocsUnknown\n\tcShuntResistorSelect, _ := (C.int32)(ShuntResistorSelect), cgoAllocsUnknown\n\tcShuntResistorSource, _ := (C.int32)(ShuntResistorSource), cgoAllocsUnknown\n\tcSkipUnsupportedChannels, _ := (C.bool32)(SkipUnsupportedChannels), cgoAllocsUnknown\n\t__ret := C.DAQmxPerformStrainShuntCalEx(cTaskHandle, cChannel, cShuntResistorValue, cShuntResistorLocation, cShuntResistorSelect, cShuntResistorSource, cSkipUnsupportedChannels)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ef2765c3aa66cc5c582cd2df2d83a2d1", "score": "0.5298003", "text": "func CreateAIForceBridgeTableChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ElectricalVals []float64, NumElectricalVals uint32, ElectricalUnits int32, PhysicalVals []float64, NumPhysicalVals uint32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcElectricalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ElectricalVals)).Data)), cgoAllocsUnknown\n\tcNumElectricalVals, _ := (C.uInt32)(NumElectricalVals), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&PhysicalVals)).Data)), cgoAllocsUnknown\n\tcNumPhysicalVals, _ := (C.uInt32)(NumPhysicalVals), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIForceBridgeTableChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cElectricalVals, cNumElectricalVals, cElectricalUnits, cPhysicalVals, cNumPhysicalVals, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "067362495e22ff0c1f341baa15a771b3", "score": "0.52936655", "text": "func (_RollupAdminFacet *RollupAdminFacetCaller) RollupEventBridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _RollupAdminFacet.contract.Call(opts, &out, \"rollupEventBridge\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "3566ef5d8bd1a94a434b42754da31058", "score": "0.5269943", "text": "func SCBaseboardCalAdjust(CalHandle uint32, ReferenceVoltage float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcReferenceVoltage, _ := (C.float64)(ReferenceVoltage), cgoAllocsUnknown\n\t__ret := C.DAQmxSCBaseboardCalAdjust(cCalHandle, cReferenceVoltage)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f3f86d0d2673c37bd9e9998bf9fd0445", "score": "0.5237201", "text": "func ResetAIBridgeShuntCalSelect(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalSelect(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "178f051bec5d85aaa6628982ed8d9bcc", "score": "0.5197472", "text": "func ResetAIBridgeShuntCalEnable(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeShuntCalEnable(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0e2752b2e9f8d0a4b3958ce86ea76d24", "score": "0.51418465", "text": "func CreateAIPressureBridgeTwoPointLinChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, FirstElectricalVal float64, SecondElectricalVal float64, ElectricalUnits int32, FirstPhysicalVal float64, SecondPhysicalVal float64, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcFirstElectricalVal, _ := (C.float64)(FirstElectricalVal), cgoAllocsUnknown\n\tcSecondElectricalVal, _ := (C.float64)(SecondElectricalVal), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcFirstPhysicalVal, _ := (C.float64)(FirstPhysicalVal), cgoAllocsUnknown\n\tcSecondPhysicalVal, _ := (C.float64)(SecondPhysicalVal), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIPressureBridgeTwoPointLinChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cFirstElectricalVal, cSecondElectricalVal, cElectricalUnits, cFirstPhysicalVal, cSecondPhysicalVal, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8689a62ce94d1006931ad6c7cdd9239d", "score": "0.50994265", "text": "func CreateAIForceBridgePolynomialChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ForwardCoeffs []float64, NumForwardCoeffs uint32, ReverseCoeffs []float64, NumReverseCoeffs uint32, ElectricalUnits int32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcForwardCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ForwardCoeffs)).Data)), cgoAllocsUnknown\n\tcNumForwardCoeffs, _ := (C.uInt32)(NumForwardCoeffs), cgoAllocsUnknown\n\tcReverseCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ReverseCoeffs)).Data)), cgoAllocsUnknown\n\tcNumReverseCoeffs, _ := (C.uInt32)(NumReverseCoeffs), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIForceBridgePolynomialChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cForwardCoeffs, cNumForwardCoeffs, cReverseCoeffs, cNumReverseCoeffs, cElectricalUnits, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b24f8d56dbc0e48195288c325ac66e9c", "score": "0.50802296", "text": "func CreateAIForceBridgeTwoPointLinChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, FirstElectricalVal float64, SecondElectricalVal float64, ElectricalUnits int32, FirstPhysicalVal float64, SecondPhysicalVal float64, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcFirstElectricalVal, _ := (C.float64)(FirstElectricalVal), cgoAllocsUnknown\n\tcSecondElectricalVal, _ := (C.float64)(SecondElectricalVal), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcFirstPhysicalVal, _ := (C.float64)(FirstPhysicalVal), cgoAllocsUnknown\n\tcSecondPhysicalVal, _ := (C.float64)(SecondPhysicalVal), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIForceBridgeTwoPointLinChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cFirstElectricalVal, cSecondElectricalVal, cElectricalUnits, cFirstPhysicalVal, cSecondPhysicalVal, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b2d12885b1a2d6a4161a1042858cbacf", "score": "0.5070122", "text": "func CreateAITorqueBridgeTableChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ElectricalVals []float64, NumElectricalVals uint32, ElectricalUnits int32, PhysicalVals []float64, NumPhysicalVals uint32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcElectricalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ElectricalVals)).Data)), cgoAllocsUnknown\n\tcNumElectricalVals, _ := (C.uInt32)(NumElectricalVals), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalVals, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&PhysicalVals)).Data)), cgoAllocsUnknown\n\tcNumPhysicalVals, _ := (C.uInt32)(NumPhysicalVals), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAITorqueBridgeTableChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cElectricalVals, cNumElectricalVals, cElectricalUnits, cPhysicalVals, cNumPhysicalVals, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b74c48edc033db00405a9943a830a3e7", "score": "0.5018965", "text": "func Adjust9205Cal(CalHandle uint32, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9205Cal(cCalHandle, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3d0a1b2e44e7b399c8343759b384fe90", "score": "0.50182605", "text": "func (_BridgeBank *BridgeBankCaller) HarmonyBridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BridgeBank.contract.Call(opts, out, \"harmonyBridge\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "32f3ebf4723b6dadc62fdfcaebabc018", "score": "0.49804914", "text": "func CreateTEDSAIPressureBridgeChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, VoltageExcitSource int32, VoltageExcitVal float64, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateTEDSAIPressureBridgeChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cVoltageExcitSource, cVoltageExcitVal, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3817257667cde5df5bc7c166d751e08c", "score": "0.49452096", "text": "func updateCompassCal(cc *CompassCal) {\n\tfmt.Println(\"updateCompassCal - ID\", cc.ID)\n\n\terr := Vault.Mongo.C(\"CompassCalResults\").Update(bson.M{\"_id\": cc.ID}, bson.M{\"$set\": bson.M{\n\t\t\"SerialNumber\": cc.SerialNumber,\n\t\t\"IsSelected\": cc.IsSelected,\n\t\t\"UserName\": cc.UserName,\n\t\t\"Firmware\": cc.Firmware,\n\t\t\"CalScoreStdDevErr\": cc.CalScoreStdDevErr,\n\t\t\"CalScore_XCoverage\": cc.CalScoreXCoverage,\n\t\t\"CalScore_YCoverage\": cc.CalScoreYCoverage,\n\t\t\"CalScore_ZCoverage\": cc.CalScoreZCoverage,\n\t\t\"CalScore_AccelStdDevErr\": cc.CalScoreAccelStdDevErr,\n\t\t\"CalScore_XAccelCoverage\": cc.CalScoreXAccelCoverage,\n\t\t\"CalScore_YAccelCoverage\": cc.CalScoreYAccelCoverage,\n\t\t\"CalScore_ZAccelCoverage\": cc.CalScoreZAccelCoverage,\n\t\t\"Point1_Pre_Hdg\": cc.Point1PreHdg,\n\t\t\"Point1_Pre_Ptch\": cc.Point1PrePtch,\n\t\t\"Point1_Pre_Roll\": cc.Point1PreRoll,\n\t\t\"Point2_Pre_Hdg\": cc.Point2PreHdg,\n\t\t\"Point2_Pre_Ptch\": cc.Point2PrePtch,\n\t\t\"Point2_Pre_Roll\": cc.Point2PreRoll,\n\t\t\"Point3_Pre_Hdg\": cc.Point3PreHdg,\n\t\t\"Point3_Pre_Ptch\": cc.Point3PrePtch,\n\t\t\"Point3_Pre_Roll\": cc.Point3PreRoll,\n\t\t\"Point4_Pre_Hdg\": cc.Point4PreHdg,\n\t\t\"Point4_Pre_Ptch\": cc.Point4PrePtch,\n\t\t\"Point4_Pre_Roll\": cc.Point4PreRoll,\n\t\t\"Point1_Post_Hdg\": cc.Point1PostHdg,\n\t\t\"Point1_Post_Ptch\": cc.Point1PostPtch,\n\t\t\"Point1_Post_Roll\": cc.Point1PostRoll,\n\t\t\"Point2_Post_Hdg\": cc.Point2PostHdg,\n\t\t\"Point2_Post_Ptch\": cc.Point2PostPtch,\n\t\t\"Point2_Post_Roll\": cc.Point2PostRoll,\n\t\t\"Point3_Post_Hdg\": cc.Point3PostHdg,\n\t\t\"Point3_Post_Ptch\": cc.Point3PostPtch,\n\t\t\"Point3_Post_Roll\": cc.Point3PostRoll,\n\t\t\"Point4_Post_Hdg\": cc.Point4PostHdg,\n\t\t\"Point4_Post_Ptch\": cc.Point4PostPtch,\n\t\t\"Point4_Post_Roll\": cc.Point4PostRoll,\n\t\t\"Notes\": cc.Notes,\n\t\t\"Modified\": time.Now()}})\n\n\tif err != nil {\n\t\tfmt.Printf(\"Can't update CompassCal %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "31abdae607e0a9949896b76e2476eb45", "score": "0.4944033", "text": "func CreateAIPressureBridgePolynomialChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ForwardCoeffs []float64, NumForwardCoeffs uint32, ReverseCoeffs []float64, NumReverseCoeffs uint32, ElectricalUnits int32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcForwardCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ForwardCoeffs)).Data)), cgoAllocsUnknown\n\tcNumForwardCoeffs, _ := (C.uInt32)(NumForwardCoeffs), cgoAllocsUnknown\n\tcReverseCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ReverseCoeffs)).Data)), cgoAllocsUnknown\n\tcNumReverseCoeffs, _ := (C.uInt32)(NumReverseCoeffs), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIPressureBridgePolynomialChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cForwardCoeffs, cNumForwardCoeffs, cReverseCoeffs, cNumReverseCoeffs, cElectricalUnits, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "10c9801fd6e244829740cb63ad40c5ad", "score": "0.49043944", "text": "func Adjust9244Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9244Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "979e7066955c2ce2af766244895c01cf", "score": "0.4896433", "text": "func (_RollupAdminFacet *RollupAdminFacetCallerSession) RollupEventBridge() (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.RollupEventBridge(&_RollupAdminFacet.CallOpts)\n}", "title": "" }, { "docid": "579c29bb6511c163142792fbab329420", "score": "0.48758784", "text": "func (_RollupAdminFacet *RollupAdminFacetCallerSession) DelayedBridge() (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.DelayedBridge(&_RollupAdminFacet.CallOpts)\n}", "title": "" }, { "docid": "335e78da1d4b38b1462a123e62e70040", "score": "0.48654583", "text": "func AdjustDSAAOTimebaseCal(CalHandle uint32, MeasuredFrequency float64, CalComplete []uint32) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcMeasuredFrequency, _ := (C.float64)(MeasuredFrequency), cgoAllocsUnknown\n\tcCalComplete, _ := (*C.bool32)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&CalComplete)).Data)), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjustDSAAOTimebaseCal(cCalHandle, cMeasuredFrequency, cCalComplete)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8e0ffcfc85a7c39a32fe3cc3d1109b42", "score": "0.48523378", "text": "func CreateAITorqueBridgeTwoPointLinChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, FirstElectricalVal float64, SecondElectricalVal float64, ElectricalUnits int32, FirstPhysicalVal float64, SecondPhysicalVal float64, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcFirstElectricalVal, _ := (C.float64)(FirstElectricalVal), cgoAllocsUnknown\n\tcSecondElectricalVal, _ := (C.float64)(SecondElectricalVal), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcFirstPhysicalVal, _ := (C.float64)(FirstPhysicalVal), cgoAllocsUnknown\n\tcSecondPhysicalVal, _ := (C.float64)(SecondPhysicalVal), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAITorqueBridgeTwoPointLinChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cFirstElectricalVal, cSecondElectricalVal, cElectricalUnits, cFirstPhysicalVal, cSecondPhysicalVal, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "9572718998b63a6f7bdd06ef081428cc", "score": "0.48444176", "text": "func Adjust9227Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9227Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "bedb9d476b69782a4dc1aeada0e7f0b5", "score": "0.4844145", "text": "func (_RollupAdminFacet *RollupAdminFacetCaller) SequencerBridge(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _RollupAdminFacet.contract.Call(opts, &out, \"sequencerBridge\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "7e6b322287c7837c4eaf005f55646bb1", "score": "0.48316255", "text": "func Adjust9260Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9260Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d2f5705fb78e5b52d5ad455b19e7e2ab", "score": "0.4827463", "text": "func Adjust9226Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9226Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8e9a7fe767b116b2fa8944b2afcd444c", "score": "0.48155645", "text": "func DeployBridge(auth *bind.TransactOpts, backend bind.ContractBackend, token_ common.Address, authorizers_ common.Address) (common.Address, *types.Transaction, *Bridge, error) {\n\tparsed, err := BridgeMetaData.GetAbi()\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\tif parsed == nil {\n\t\treturn common.Address{}, nil, nil, errors.New(\"GetABI returned nil\")\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(BridgeBin), backend, token_, authorizers_)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Bridge{BridgeCaller: BridgeCaller{contract: contract}, BridgeTransactor: BridgeTransactor{contract: contract}, BridgeFilterer: BridgeFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "94d8c1c9ad53958104eb6bff0d4e53b1", "score": "0.48029932", "text": "func Adjust9210Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9210Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "267c7314ebac9dbeaf6c9caa6ebfd5fb", "score": "0.47979456", "text": "func Adjust9222Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9222Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "5e6cdc176cc6138007d095ac1d581ee9", "score": "0.4795886", "text": "func Adjust9206Cal(CalHandle uint32, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9206Cal(cCalHandle, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f2154d05463a71be9fd09f4491d0b8e9", "score": "0.4795455", "text": "func Adjust9215Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9215Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "112789aa87b50fff309cdc0326232512", "score": "0.4788917", "text": "func CreateAITorqueBridgePolynomialChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, ForwardCoeffs []float64, NumForwardCoeffs uint32, ReverseCoeffs []float64, NumReverseCoeffs uint32, ElectricalUnits int32, PhysicalUnits int32, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcForwardCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ForwardCoeffs)).Data)), cgoAllocsUnknown\n\tcNumForwardCoeffs, _ := (C.uInt32)(NumForwardCoeffs), cgoAllocsUnknown\n\tcReverseCoeffs, _ := (*C.float64)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ReverseCoeffs)).Data)), cgoAllocsUnknown\n\tcNumReverseCoeffs, _ := (C.uInt32)(NumReverseCoeffs), cgoAllocsUnknown\n\tcElectricalUnits, _ := (C.int32)(ElectricalUnits), cgoAllocsUnknown\n\tcPhysicalUnits, _ := (C.int32)(PhysicalUnits), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAITorqueBridgePolynomialChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cForwardCoeffs, cNumForwardCoeffs, cReverseCoeffs, cNumReverseCoeffs, cElectricalUnits, cPhysicalUnits, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "01b080d423ac4da52e3bbe41861c73a0", "score": "0.4785197", "text": "func Adjust9264Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9264Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ae95dad41dfc6388dad7a571c304d6bc", "score": "0.47816968", "text": "func bindBridge(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BridgeABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "acf268755772236f1659879e60a4ed92", "score": "0.47757098", "text": "func CreateTEDSAIForceBridgeChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, VoltageExcitSource int32, VoltageExcitVal float64, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateTEDSAIForceBridgeChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cVoltageExcitSource, cVoltageExcitVal, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "4d17c0994188369725e3e01dc6812fd4", "score": "0.4753823", "text": "func CreateTEDSAITorqueBridgeChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, VoltageExcitSource int32, VoltageExcitVal float64, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateTEDSAITorqueBridgeChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cVoltageExcitSource, cVoltageExcitVal, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8b5b33dfa04146dfbac223f8da440138", "score": "0.47350705", "text": "func Adjust9220Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9220Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8cb9bfe0eded944bb1c2cc32d2340344", "score": "0.47125468", "text": "func (_RollupAdminFacet *RollupAdminFacetSession) DelayedBridge() (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.DelayedBridge(&_RollupAdminFacet.CallOpts)\n}", "title": "" }, { "docid": "a645eb13a9e523b31d0f1f9b1345e175", "score": "0.47115976", "text": "func (_RollupAdminFacet *RollupAdminFacetSession) RollupEventBridge() (common.Address, error) {\n\treturn _RollupAdminFacet.Contract.RollupEventBridge(&_RollupAdminFacet.CallOpts)\n}", "title": "" }, { "docid": "84c76116c5bc96e5069354eef82e5d62", "score": "0.4698268", "text": "func CreateAIBridgeChan(TaskHandle unsafe.Pointer, PhysicalChannel string, NameToAssignToChannel string, MinVal float64, MaxVal float64, Units int32, BridgeConfig int32, VoltageExcitSource int32, VoltageExcitVal float64, NominalBridgeResistance float64, CustomScaleName string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcPhysicalChannel, _ := unpackPCharString(PhysicalChannel)\n\tcNameToAssignToChannel, _ := unpackPCharString(NameToAssignToChannel)\n\tcMinVal, _ := (C.float64)(MinVal), cgoAllocsUnknown\n\tcMaxVal, _ := (C.float64)(MaxVal), cgoAllocsUnknown\n\tcUnits, _ := (C.int32)(Units), cgoAllocsUnknown\n\tcBridgeConfig, _ := (C.int32)(BridgeConfig), cgoAllocsUnknown\n\tcVoltageExcitSource, _ := (C.int32)(VoltageExcitSource), cgoAllocsUnknown\n\tcVoltageExcitVal, _ := (C.float64)(VoltageExcitVal), cgoAllocsUnknown\n\tcNominalBridgeResistance, _ := (C.float64)(NominalBridgeResistance), cgoAllocsUnknown\n\tcCustomScaleName, _ := unpackPCharString(CustomScaleName)\n\t__ret := C.DAQmxCreateAIBridgeChan(cTaskHandle, cPhysicalChannel, cNameToAssignToChannel, cMinVal, cMaxVal, cUnits, cBridgeConfig, cVoltageExcitSource, cVoltageExcitVal, cNominalBridgeResistance, cCustomScaleName)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3d429258b939c2f2b07afaee17a0395f", "score": "0.46904495", "text": "func Adjust9242Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9242Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "7ddde1fe8bb08391fe48702eee1669da", "score": "0.46789056", "text": "func (a *Asterisk) Bridge(chan1, chan2 string, tone bool, f *func(Message)) error {\n\n\tt := \"no\"\n\tif tone {\n\t\tt = \"yes\"\n\t}\n\n\tm := Message{\n\t\t\"Action\": \"Bridge\",\n\t\t\"Channel1\": chan1,\n\t\t\"Channel2\": chan2,\n\t\t\"Tone\": t,\n\t}\n\n\treturn a.SendAction(m, f)\n}", "title": "" }, { "docid": "27d34630e265620242a48253dee8c6ea", "score": "0.46773744", "text": "func Adjust9212Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9212Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "0b19c2233453dde0880dd4427eb259f8", "score": "0.46660995", "text": "func addBridgeOps(bridgeName, rootUUID string, stpEnabled bool) transactOperations {\n\n\tvar containerId string\n\tvar containerIface string\n\n\t// interface first, because we need the UUID\n\tinsertInterfaceOp, insertInterfaceUUID := newInterfaceOp(bridgeName, INTERFACE_INTERNAL)\n\n\t// then the port using the interface UUID\n\tinsertPortOp, insertPortUUID := newPortOp(bridgeName, insertInterfaceUUID, containerId, containerIface, 0)\n\n\t// finally the bridge with the port UUID\n\tinsertBridgeOp, insertBridgeUUID := newBridgeOp(bridgeName, insertPortUUID, stpEnabled, 0)\n\n\t// Inserting a Bridge row in Bridge table requires mutating the open_vswitch table.\n\tmutateUuid := []UUID{UUID{insertBridgeUUID}}\n\tmutateSet, _ := newOvsSet(mutateUuid)\n\tmutation := newMutation(\"bridges\", \"insert\", mutateSet)\n\tcondition := newCondition(\"_uuid\", \"==\", UUID{rootUUID})\n\n\t// simple mutate operation\n\tmutateOp := operation{\n\t\tOp: \"mutate\",\n\t\tTable: \"Open_vSwitch\",\n\t\tMutations: []interface{}{mutation},\n\t\tWhere: []interface{}{condition},\n\t}\n\n\toperations := []operation{insertInterfaceOp, insertPortOp, insertBridgeOp, mutateOp}\n\n\treturn newTransactArgs(\"Open_vSwitch\", true, operations...)\n\n}", "title": "" }, { "docid": "3eb658db4332b6141ac23df59487c954", "score": "0.4653583", "text": "func Adjust9229Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9229Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "6abded9c01376caed823f854a7cc7a0d", "score": "0.4653086", "text": "func L2ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, fromHeight *big.Int, toHeight *big.Int) error {\n\t// (1) L2CrossDomainMessenger relayedMessage\n\tcrossDomainRelayedMessages, err := contracts.CrossDomainMessengerRelayedMessageEvents(\"l2\", predeploys.L2CrossDomainMessengerAddr, db, fromHeight, toHeight)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trelayedMessages := make(map[logKey]*contracts.CrossDomainMessengerRelayedMessageEvent, len(crossDomainRelayedMessages))\n\tfor i := range crossDomainRelayedMessages {\n\t\trelayed := crossDomainRelayedMessages[i]\n\t\trelayedMessages[logKey{BlockHash: relayed.Event.BlockHash, LogIndex: relayed.Event.LogIndex}] = &relayed\n\t\tmessage, err := db.BridgeMessages.L1BridgeMessage(relayed.MessageHash)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if message == nil {\n\t\t\tlog.Error(\"missing indexed L1CrossDomainMessenger message\", \"message_hash\", relayed.MessageHash, \"tx_hash\", relayed.Event.TransactionHash)\n\t\t\treturn fmt.Errorf(\"missing indexed L1CrossDomainMessager message\")\n\t\t}\n\n\t\tif err := db.BridgeMessages.MarkRelayedL1BridgeMessage(relayed.MessageHash, relayed.Event.GUID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(crossDomainRelayedMessages) > 0 {\n\t\tlog.Info(\"relayed L1CrossDomainMessenger messages\", \"size\", len(crossDomainRelayedMessages))\n\t}\n\n\t// (2) L2StandardBridge BridgeFinalized\n\tfinalizedBridges, err := contracts.StandardBridgeFinalizedEvents(\"l2\", predeploys.L2StandardBridgeAddr, db, fromHeight, toHeight)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(finalizedBridges) > len(crossDomainRelayedMessages) {\n\t\treturn fmt.Errorf(\"missing cross-domain message for each finalized bridge event. messages: %d, bridges: %d\", len(crossDomainRelayedMessages), len(finalizedBridges))\n\t}\n\n\tfor i := range finalizedBridges {\n\t\t// Nothing actionable on the database. However, we can treat the relayed message\n\t\t// as an invariant by ensuring we can query for a deposit by the same hash\n\t\tfinalizedBridge := finalizedBridges[i]\n\t\trelayedMessage, ok := relayedMessages[logKey{finalizedBridge.Event.BlockHash, finalizedBridge.Event.LogIndex + 1}]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"missing following RelayedMessage for BridgeFinalized event. tx_hash = %s\", finalizedBridge.Event.TransactionHash)\n\t\t}\n\n\t\t// Since the message hash is computed from the relayed message, this ensures the withdrawal fields must match. For good measure,\n\t\t// we may choose to make sure `deposit.BridgeTransfer` matches with the finalized bridge\n\t\tdeposit, err := db.BridgeTransfers.L1BridgeDepositWithFilter(database.BridgeTransfer{CrossDomainMessageHash: &relayedMessage.MessageHash})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if deposit == nil {\n\t\t\tlog.Error(\"missing L1StandardBridge deposit on L2 finalization\", \"tx_hash\", finalizedBridge.Event.TransactionHash)\n\t\t\treturn errors.New(\"missing L1StandardBridge deposit on L2 finalization\")\n\t\t}\n\t}\n\n\t// a-ok!\n\treturn nil\n}", "title": "" }, { "docid": "5fc35f8b5f385fcef9481dcf38b03134", "score": "0.46431774", "text": "func Adjust9211Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9211Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c98e7ada00bf54a68f69ba3f95126fa9", "score": "0.46363917", "text": "func Adjust9219Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9219Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "752c1167ae0a13183d5349b142ce9739", "score": "0.46279165", "text": "func (_BridgeBank *BridgeBankCaller) BridgeRegistry(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BridgeBank.contract.Call(opts, out, \"bridgeRegistry\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "39664cf959f528e4f02395bfe910105d", "score": "0.46217674", "text": "func Adjust9201Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9201Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "983996a55f39825fcc481e34e1314064", "score": "0.46066818", "text": "func Adjust9232Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9232Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b1be6a9d4036949e7f58830c4fbdd2ac", "score": "0.46034306", "text": "func Adjust9251Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9251Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "290a43c0f01ec0f80f00a41b510d5716", "score": "0.4585638", "text": "func Calibrate() {\n\n\treturn\n}", "title": "" }, { "docid": "2ed1894a0d33380675bd6a465b96d706", "score": "0.45855212", "text": "func Adjust1126Cal(CalHandle uint32, RefFreq float64, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefFreq, _ := (C.float64)(RefFreq), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1126Cal(cCalHandle, cRefFreq, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "5d4258898b17d4d6ab53a66431d7c9f2", "score": "0.4577766", "text": "func (data *Loan) CalculateASchedule(schedChan chan AmortizationSched) {\n\n\taSched := AmortizationSched{OriginalBalance: data.Balance}\n\n\tiRMonthly := (data.APR / 12) / 100\n\tTotalPaid := 0.00\n\tTotalPaidInterest := 0.00\n\n\tDF := (math.Pow((1+iRMonthly), data.LengthInMonths) - 1) / (iRMonthly * math.Pow((1+iRMonthly), data.LengthInMonths))\n\tfmt.Println(DF)\n\tMonthlyPayment := math.Round(data.Balance / DF)\n\taSched.MonthlyPayment = MonthlyPayment\n\n\t//total interest paid if no extra principle is paid\n\tti := (data.LengthInMonths * MonthlyPayment) - data.Balance\n\taSched.InterestPaidOrig = ti\n\n\tbalance := data.Balance\n\tAint := make([]float64, int(data.LengthInMonths)+1)\n\tfor i := 1; true; i++ {\n\t\tMonthlyInterest := iRMonthly * balance\n\t\tPriPaid := MonthlyPayment - MonthlyInterest\n\t\tTotalPriPaid := PriPaid + data.ExtraPaidPri\n\t\tbalance = balance - TotalPriPaid\n\t\tAint[i-1] = MonthlyInterest\n\t\tif balance < 1 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor i := 1; true; i++ {\n\t\t//MonthlyInterest := iRMonthly * data.Balance\n\t\tPriPaid := MonthlyPayment - Aint[i-1] //MonthlyInterest\n\t\tTotalPriPaid := PriPaid + data.ExtraPaidPri\n\t\tdata.Balance = data.Balance - TotalPriPaid\n\n\t\tmonthB := MonthBreakdown{\n\t\t\tRemainingBalance: data.Balance,\n\t\t\tInterestPaid: Aint[i-1],\n\t\t\tPrinciplePaid: TotalPriPaid,\n\t\t\tTotalPayment: TotalPriPaid + Aint[i-1],\n\t\t}\n\n\t\taSched.MonthBreakdown = append(aSched.MonthBreakdown, monthB)\n\n\t\tTotalPaid = TotalPaid + TotalPriPaid + Aint[i-1] //MonthlyInterest\n\t\tTotalPaidInterest = TotalPaidInterest + Aint[i-1] //MonthlyInterest\n\t\tif data.Balance < 1 {\n\t\t\taSched.InterestPaidAdj = TotalPaidInterest\n\t\t\taSched.InterestSaved = ti - TotalPaidInterest\n\t\t\taSched.TotalPayment = TotalPaid\n\t\t\tbreak\n\t\t}\n\t}\n\tschedChan <- aSched\n}", "title": "" }, { "docid": "ea08eb3dfb93bb25f0dd04c4ae8d64a1", "score": "0.456931", "text": "func L2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, fromHeight *big.Int, toHeight *big.Int) error {\n\t// (1) L2ToL1MessagePasser\n\tl2ToL1MPMessagesPassed, err := contracts.L2ToL1MessagePasserMessagePassedEvents(predeploys.L2ToL1MessagePasserAddr, db, fromHeight, toHeight)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmessagesPassed := make(map[logKey]*contracts.L2ToL1MessagePasserMessagePassed, len(l2ToL1MPMessagesPassed))\n\ttransactionWithdrawals := make([]database.L2TransactionWithdrawal, len(l2ToL1MPMessagesPassed))\n\tfor i := range l2ToL1MPMessagesPassed {\n\t\tmessagePassed := l2ToL1MPMessagesPassed[i]\n\t\tmessagesPassed[logKey{messagePassed.Event.BlockHash, messagePassed.Event.LogIndex}] = &messagePassed\n\t\ttransactionWithdrawals[i] = database.L2TransactionWithdrawal{\n\t\t\tWithdrawalHash: messagePassed.WithdrawalHash,\n\t\t\tInitiatedL2EventGUID: messagePassed.Event.GUID,\n\t\t\tNonce: messagePassed.Nonce,\n\t\t\tGasLimit: messagePassed.GasLimit,\n\t\t\tTx: messagePassed.Tx,\n\t\t}\n\t}\n\n\tif len(messagesPassed) > 0 {\n\t\tlog.Info(\"detected transaction withdrawals\", \"size\", len(transactionWithdrawals))\n\t\tif err := db.BridgeTransactions.StoreL2TransactionWithdrawals(transactionWithdrawals); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// (2) L2CrossDomainMessenger\n\tcrossDomainSentMessages, err := contracts.CrossDomainMessengerSentMessageEvents(\"l2\", predeploys.L2CrossDomainMessengerAddr, db, fromHeight, toHeight)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(crossDomainSentMessages) > len(messagesPassed) {\n\t\treturn fmt.Errorf(\"missing L2ToL1MP withdrawal for each cross-domain message. withdrawals: %d, messages: %d\", len(messagesPassed), len(crossDomainSentMessages))\n\t}\n\n\tsentMessages := make(map[logKey]*contracts.CrossDomainMessengerSentMessageEvent, len(crossDomainSentMessages))\n\tl2BridgeMessages := make([]database.L2BridgeMessage, len(crossDomainSentMessages))\n\tfor i := range crossDomainSentMessages {\n\t\tsentMessage := crossDomainSentMessages[i]\n\t\tsentMessages[logKey{sentMessage.Event.BlockHash, sentMessage.Event.LogIndex}] = &sentMessage\n\n\t\t// extract the withdrawal hash from the previous MessagePassed event\n\t\tmessagePassed, ok := messagesPassed[logKey{sentMessage.Event.BlockHash, sentMessage.Event.LogIndex - 1}]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"missing expected preceding MessagePassedEvent for SentMessage. tx_hash = %s\", sentMessage.Event.TransactionHash)\n\t\t}\n\n\t\tl2BridgeMessages[i] = database.L2BridgeMessage{TransactionWithdrawalHash: messagePassed.WithdrawalHash, BridgeMessage: sentMessage.BridgeMessage}\n\t}\n\n\tif len(l2BridgeMessages) > 0 {\n\t\tlog.Info(\"detected L2CrossDomainMessenger messages\", \"size\", len(l2BridgeMessages))\n\t\tif err := db.BridgeMessages.StoreL2BridgeMessages(l2BridgeMessages); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// (3) L2StandardBridge\n\tinitiatedBridges, err := contracts.StandardBridgeInitiatedEvents(\"l2\", predeploys.L2StandardBridgeAddr, db, fromHeight, toHeight)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(initiatedBridges) > len(crossDomainSentMessages) {\n\t\treturn fmt.Errorf(\"missing cross-domain message for each initiated bridge event. messages: %d, bridges: %d\", len(crossDomainSentMessages), len(initiatedBridges))\n\t}\n\n\tl2BridgeWithdrawals := make([]database.L2BridgeWithdrawal, len(initiatedBridges))\n\tfor i := range initiatedBridges {\n\t\tinitiatedBridge := initiatedBridges[i]\n\n\t\t// extract the cross domain message hash & deposit source hash from the following events\n\t\tmessagePassed, ok := messagesPassed[logKey{initiatedBridge.Event.BlockHash, initiatedBridge.Event.LogIndex + 1}]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"missing expected following MessagePassed for BridgeInitiated. tx_hash = %s\", initiatedBridge.Event.TransactionHash)\n\t\t}\n\t\tsentMessage, ok := sentMessages[logKey{initiatedBridge.Event.BlockHash, initiatedBridge.Event.LogIndex + 2}]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"missing expected following SentMessage for BridgeInitiated. tx_hash = %s\", initiatedBridge.Event.TransactionHash)\n\t\t}\n\n\t\tinitiatedBridge.BridgeTransfer.CrossDomainMessageHash = &sentMessage.BridgeMessage.MessageHash\n\t\tl2BridgeWithdrawals[i] = database.L2BridgeWithdrawal{TransactionWithdrawalHash: messagePassed.WithdrawalHash, BridgeTransfer: initiatedBridge.BridgeTransfer}\n\t}\n\n\tif len(l2BridgeWithdrawals) > 0 {\n\t\tlog.Info(\"detected L2StandardBridge withdrawals\", \"size\", len(l2BridgeWithdrawals))\n\t\tif err := db.BridgeTransfers.StoreL2BridgeWithdrawals(l2BridgeWithdrawals); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// a-ok!\n\treturn nil\n}", "title": "" }, { "docid": "ffc858f0a5958e55d354f142140c56c3", "score": "0.45658842", "text": "func (p *PTPEventManager) GenPhc2SysEvent(iface string, ifaceType types.IFace, offsetFromMaster int64, clockState ceevent.SyncState) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(\"Recovered in f\", r)\n\t\t}\n\t}()\n\tif clockState == \"\" {\n\t\treturn\n\t}\n\tlastClockState := p.Stats[ifaceType].lastSyncState\n\tthreshold := p.PtpThreshold(iface)\n\tswitch clockState {\n\tcase ceevent.LOCKED:\n\t\tswitch lastClockState {\n\t\tcase ceevent.FREERUN: //last state was already sent for FreeRUN , but if its within then send again with new state\n\t\t\tif isOffsetInRange(offsetFromMaster, threshold.MaxOffsetThreshold, threshold.MinOffsetThreshold) { // within range\n\t\t\t\tlog.Infof(\" publishing event for %s with last state %s and current clock state %s and offset %d\", iface, p.Stats[ifaceType].lastSyncState, clockState, offsetFromMaster)\n\t\t\t\tp.PublishEvent(clockState, offsetFromMaster, string(ifaceType), channel.PTPEvent) // change to locked\n\t\t\t\tp.Stats[ifaceType].lastSyncState = clockState\n\t\t\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t\t\t\tp.Stats[ifaceType].addValue(int64(offsetFromMaster)) // update off set when its in locked state and hold over only\n\t\t\t}\n\t\tcase ceevent.LOCKED: // last state was in sync , check if it is out of sync now\n\t\t\tif isOffsetInRange(offsetFromMaster, threshold.MaxOffsetThreshold, threshold.MinOffsetThreshold) {\n\t\t\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t\t\t\tp.Stats[ifaceType].addValue(int64(offsetFromMaster)) // update off set when its in locked state and hold over only\n\t\t\t} else {\n\t\t\t\tlog.Infof(\" publishing event for %s with last state %s and current clock state %s and offset %d\", iface, p.Stats[ifaceType].lastSyncState, clockState, offsetFromMaster)\n\t\t\t\tp.PublishEvent(ceevent.FREERUN, offsetFromMaster, string(ifaceType), channel.PTPEvent)\n\t\t\t\tp.Stats[ifaceType].lastSyncState = ceevent.FREERUN\n\t\t\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t\t\t}\n\n\t\tcase ceevent.HOLDOVER:\n\t\t\t//do nothing , the time out will switch holdover to FREERUN\n\t\tdefault: // not yet used states\n\t\t\tlog.Warnf(\"unknown %s sync state %s ,has last ptp state %s\", ifaceType, clockState, lastClockState)\n\t\t\tif !isOffsetInRange(offsetFromMaster, threshold.MaxOffsetThreshold, threshold.MinOffsetThreshold) {\n\t\t\t\tclockState = ceevent.FREERUN\n\t\t\t}\n\t\t\tlog.Infof(\" publishing event for %s with last state %s and current clock state %s and offset %d\", iface, p.Stats[ifaceType].lastSyncState, clockState, offsetFromMaster)\n\t\t\tp.PublishEvent(clockState, offsetFromMaster, string(ifaceType), channel.PTPEvent) // change to unknown\n\t\t\tp.Stats[ifaceType].lastSyncState = clockState\n\t\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t\t}\n\tcase ceevent.FREERUN:\n\t\tif lastClockState != ceevent.FREERUN { // within range\n\t\t\tlog.Infof(\" publishing event for %s with last state %s and current clock state %s and offset %d\", iface, p.Stats[ifaceType].lastSyncState, clockState, offsetFromMaster)\n\t\t\tp.PublishEvent(clockState, offsetFromMaster, string(ifaceType), channel.PTPEvent) // change to locked\n\t\t\tp.Stats[ifaceType].lastSyncState = clockState\n\t\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t\t\tp.Stats[ifaceType].addValue(int64(offsetFromMaster))\n\t\t}\n\tdefault:\n\t\tlog.Warnf(\"%s unknown current ptp state %s\", iface, clockState)\n\t\tif offsetFromMaster > threshold.MaxOffsetThreshold || offsetFromMaster < threshold.MinOffsetThreshold {\n\t\t\tclockState = ceevent.FREERUN\n\t\t}\n\t\tlog.Infof(\" publishing event for %s with last state %s and current clock state %s and offset %d\", iface, p.Stats[ifaceType].lastSyncState, clockState, offsetFromMaster)\n\t\tp.PublishEvent(clockState, offsetFromMaster, string(ifaceType), channel.PTPEvent) // change to unknown state\n\t\tp.Stats[ifaceType].lastSyncState = clockState\n\t\tp.Stats[ifaceType].lastOffset = int64(offsetFromMaster)\n\t}\n}", "title": "" }, { "docid": "2e8bf5900e3728f92d5af3011013ac09", "score": "0.4565386", "text": "func main() {\n\tcyberArmAddr, err := net.ResolveUDPAddr(\"udp\", \"0.0.0.0:10001\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tpca9685 := new(device.PCA9685)\n\terr = pca9685.Start()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tamg88xx := device.AMG88XX{}\n\terr = amg88xx.Start()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Make sure periph is initialized.\n\tif _, err := host.Init(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\trelayPin := rpi.P1_37\n\trelayPin.Out(gpio.Low)\n\n\ts.ListenCyberArmCommands(cyberArmAddr, func(command *command.Command) {\n\t\tswitch command.Name {\n\t\tcase \"ROTATE\":\n\t\t\talpha, err := strconv.ParseFloat(command.Arguments[0], 32)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Failed to parse argument: %s\", err)\n\t\t\t}\n\t\t\tbeta, err := strconv.ParseFloat(command.Arguments[1], 32)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Failed to parse argument: %s\", err)\n\t\t\t}\n\t\t\tlog.Printf(\"Perform cyber-arm rotation to (%f,%f)\\n\", alpha, beta)\n\t\t\t//rotate(alpha, beta)\n\t\t\tif alpha < 0 {\n\t\t\t\talpha = 0\n\t\t\t}\n\t\t\tif alpha > 100 {\n\t\t\t\talpha = 100\n\t\t\t}\n\t\t\txChannel := pca9685.GetChannel(0)\n\t\t\txChannel.SetPercentage(float32(alpha))\n\n\t\t\tif beta < 50 {\n\t\t\t\tbeta = 50\n\t\t\t}\n\t\t\tif beta > 100 {\n\t\t\t\tbeta = 100\n\t\t\t}\n\t\t\tyChannel := pca9685.GetChannel(1)\n\t\t\tyChannel.SetPercentage(float32(beta))\n\n\t\tcase \"FIRE\":\n\t\t\tlog.Printf(\"Perform fire action\\n\")\n\t\t\t//fire()\n\t\t\tif relayPin.Read() == gpio.High {\n\t\t\t\treturn\n\t\t\t}\n\t\t\trelayPin.Out(gpio.High)\n\t\t\ttime.Sleep(300 * time.Millisecond)\n\t\t\trelayPin.Out(gpio.Low)\n\t\t}\n\t})\n\t//s.ConnectServer(cyberArmAddr, []byte(`{\"name\":\"ROTATE\",\"arguments\":[\"50\", \"100\"]}`))\n\t//s.ConnectServer(cyberArmAddr, []byte(`{\"name\":\"FIRE\"}`))\n\n\tthermalSensorAddr, err := net.ResolveUDPAddr(\"udp\", \"0.0.0.0:10002\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ts.StreamThermalSensorData(thermalSensorAddr, func() []byte {\n\t\treturn amg88xx.ReadPixelsRAW()\n\t})\n\t//s.ConnectServer(thermalSensorAddr, nil)\n\n\t//var server, thermalServer *s.Server\n\t//\n\t//var rootCmd = &cobra.Command{Use: \"cyber-arm-service\"}\n\t//var start = &cobra.Command{\n\t//\tUse: \"start\",\n\t//\tShort: \"Start server\",\n\t//\tRun: func(cmd *cobra.Command, args []string) {\n\t//\t\tserverConfig, err := readConfiguration()\n\t//\t\tif err != nil {\n\t//\t\t\tlog.Fatalf(\"Failed to initialize server configuration: %s\", err)\n\t//\t\t}\n\t//\n\t//\t\tserver, err = s.NewServer(serverConfig)\n\t//\t\tif err != nil {\n\t//\t\t\tlog.Fatalf(\"Failed to create server: %s\", err)\n\t//\t\t}\n\t//\n\t//\t\terr = server.Start(func(message *s.Message) error {\n\t//\t\t\tlog.Printf(\"Received message: %s\\n\", string(message.Data))\n\t//\t\t\treturn nil\n\t//\t\t})\n\t//\t\tif err != nil {\n\t//\t\t\tlog.Fatalf(\"Failed to start server: %s\", err)\n\t//\t\t}\n\t//\t},\n\t//}\n\t//\n\t//start.PersistentFlags().StringVar(&host, \"host\", \"0.0.0.0\", \"server host\")\n\t//start.PersistentFlags().StringVar(&port, \"port\", \"10001\", \"server port\")\n\t//start.PersistentFlags().StringVar(&messageBufferSize, \"messageBufferSize\", \"1024\", \"message buffer size (in bytes)\")\n\t//start.PersistentFlags().StringVar(&messageQueueSize, \"messageQueueSize\", \"10\", \"message queue size\")\n\t//\n\tstopSignal := make(chan os.Signal)\n\tsignal.Notify(stopSignal, syscall.SIGTERM)\n\tsignal.Notify(stopSignal, syscall.SIGINT)\n\n\t//rootCmd.AddCommand(start)\n\t//go rootCmd.Execute()\n\t//\n\t<-stopSignal\n\tlog.Println(\"Server is shutting down...\")\n}", "title": "" }, { "docid": "d9be15caf43b25bc06c864ed68e8c903", "score": "0.45642024", "text": "func Adjust9216Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9216Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "2a1ec48368e60ecbc5425806195f8040", "score": "0.45526013", "text": "func (_BridgeBank *BridgeBankCallerSession) HarmonyBridge() (common.Address, error) {\n\treturn _BridgeBank.Contract.HarmonyBridge(&_BridgeBank.CallOpts)\n}", "title": "" }, { "docid": "d652e89cc0b52553ddca4bc88a6b4f5a", "score": "0.45452935", "text": "func Adjust9218Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9218Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "37681e4b2fcc5ac10c8e02abb629f73d", "score": "0.45404524", "text": "func (f *featurePodConnectivity) hostBridgeUplinkFlows() []binding.Flow {\n\t// outputToBridgeRegMark marks that the output interface is OVS bridge.\n\toutputToBridgeRegMark := binding.NewRegMark(TargetOFPortField, f.hostIfacePort)\n\tcookieID := f.cookieAllocator.Request(f.category).Raw()\n\tflows := f.hostBridgeLocalFlows()\n\tif f.networkConfig.IPv4Enabled {\n\t\tflows = append(flows,\n\t\t\t// This generates the flow to forward ARP packets from uplink port in normal way since uplink port is set to enable\n\t\t\t// flood.\n\t\t\tARPSpoofGuardTable.ofTable.BuildFlow(priorityHigh).\n\t\t\t\tCookie(cookieID).\n\t\t\t\tMatchInPort(f.uplinkPort).\n\t\t\t\tMatchProtocol(binding.ProtocolARP).\n\t\t\t\tAction().Normal().\n\t\t\t\tDone(),\n\t\t\t// This generates the flow to forward ARP from bridge local port in normal way since bridge port is set to enable\n\t\t\t// flood.\n\t\t\tARPSpoofGuardTable.ofTable.BuildFlow(priorityHigh).\n\t\t\t\tCookie(cookieID).\n\t\t\t\tMatchInPort(f.hostIfacePort).\n\t\t\t\tMatchProtocol(binding.ProtocolARP).\n\t\t\t\tAction().Normal().\n\t\t\t\tDone())\n\t}\n\tflows = append(flows,\n\t\t// Handle packet to Node.\n\t\t// Must use a separate flow to Output(config.BridgeOFPort), otherwise OVS will drop the packet:\n\t\t// output:NXM_NX_REG1[]\n\t\t// >> output port 4294967294 is out of range\n\t\t// Datapath actions: drop\n\t\t// TODO(gran): support Traceflow\n\t\tL2ForwardingCalcTable.ofTable.BuildFlow(priorityNormal).\n\t\t\tCookie(cookieID).\n\t\t\tMatchDstMAC(f.nodeConfig.UplinkNetConfig.MAC).\n\t\t\tAction().LoadToRegField(TargetOFPortField, f.hostIfacePort).\n\t\t\tAction().LoadRegMark(OFPortFoundRegMark).\n\t\t\tAction().GotoStage(stageConntrack).\n\t\t\tDone(),\n\t\tL2ForwardingOutTable.ofTable.BuildFlow(priorityHigh).\n\t\t\tCookie(cookieID).\n\t\t\tMatchProtocol(binding.ProtocolIP).\n\t\t\tMatchRegMark(outputToBridgeRegMark, OFPortFoundRegMark).\n\t\t\tAction().Output(f.hostIfacePort).\n\t\t\tDone(),\n\t\t// Handle outgoing packet from AntreaFlexibleIPAM Pods. Broadcast is not supported.\n\t\tL2ForwardingCalcTable.ofTable.BuildFlow(priorityLow).\n\t\t\tCookie(cookieID).\n\t\t\tMatchRegMark(AntreaFlexibleIPAMRegMark).\n\t\t\tAction().LoadToRegField(TargetOFPortField, f.uplinkPort).\n\t\t\tAction().LoadRegMark(OFPortFoundRegMark).\n\t\t\tAction().GotoStage(stageConntrack).\n\t\t\tDone())\n\treturn flows\n}", "title": "" }, { "docid": "ecd84184c18ed11c7678801528fe219e", "score": "0.45356047", "text": "func Adjust9269Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9269Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f2487574a8613918a5ffd6072cd50717", "score": "0.4534412", "text": "func Adjust1102Cal(CalHandle uint32, RefVoltage float64, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1102Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "1a51b9240913ed979404ccda06fc9ce9", "score": "0.45238754", "text": "func hostCallbackBridge(p *C.CPlugin, opcode int32, index int32, value int64, ptr unsafe.Pointer, opt float32) int64 {\n\t// HostVersion is requested when plugin is created\n\t// It's never in map\n\tif HostOpcode(opcode) == HostVersion {\n\t\treturn version\n\t}\n\tcallbacks.RLock()\n\tc, ok := callbacks.mapping[unsafe.Pointer(p)]\n\tcallbacks.RUnlock()\n\tif !ok {\n\t\tpanic(\"plugin was closed\")\n\t}\n\n\tif c == nil {\n\t\tpanic(\"host callback is undefined\")\n\t}\n\treturn c(HostOpcode(opcode), index, value, ptr, opt)\n}", "title": "" }, { "docid": "a160bc8e43207bfc26df22fd7ca1fde8", "score": "0.45197916", "text": "func (plugin *FIBConfigurator) ResolveCreatedBridgeDomain(domainName string, domainID uint32, callback func(error)) error {\n\tplugin.Log.Infof(\"Resolve created bridge domain %v from FIB perspective \", domainID)\n\tfirstIndex := 1\n\tlastIndex := plugin.FibIndexSeq - 1 // Number of all registered FIB Indexes\n\tvar wasError error\n\tfor index := uint32(firstIndex); index <= lastIndex; index++ {\n\t\tmac, meta, found := plugin.FibDesIndexes.LookupName(index)\n\t\tif found {\n\t\t\t// Check interface\n\t\t\tfibInterface := meta.(*FIBMeta).InterfaceName\n\t\t\tifIndex, _, ifFound := plugin.SwIfIndexes.LookupIdx(fibInterface)\n\t\t\t// Validate interface/bridge domain pair\n\t\t\tvalidated := plugin.validateInterfaceBDPair(fibInterface, domainID)\n\t\t\tif !ifFound {\n\t\t\t\tplugin.Log.Infof(\"FIB entry %v - required interface %v not found\", mac, fibInterface)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !validated {\n\t\t\t\tplugin.Log.Infof(\"FIB entry %v - required interface %v is not a part of bridge domain %v\",\n\t\t\t\t\tmac, domainID)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tfibBvi := meta.(*FIBMeta).BVI\n\t\t\t\tfibStatic := meta.(*FIBMeta).StaticConfig\n\t\t\t\terr := plugin.vppcalls.Add(mac, domainID, ifIndex, fibBvi, fibStatic, func(err error) {\n\t\t\t\t\tplugin.Log.Infof(\"Previously not configurable FIB entry with MAC %v is now configured\", mac)\n\t\t\t\t\t// Resolve registration\n\t\t\t\t\tplugin.FibIndexes.RegisterName(mac, plugin.FibIndexSeq, meta)\n\t\t\t\t\tplugin.FibIndexSeq++\n\t\t\t\t\tplugin.Log.Debug(\"Registering FIB table entry with MAC \", mac)\n\t\t\t\t\tplugin.FibDesIndexes.UnregisterName(mac)\n\t\t\t\t\tplugin.Log.Debugf(\"Unconfigured FIB entry with MAC %v removed from cache\", mac)\n\t\t\t\t\tcallback(err)\n\t\t\t\t}, plugin.Log)\n\t\t\t\tif err != nil {\n\t\t\t\t\twasError = err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tplugin.Log.Infof(\"FIB: resolution of created bridge domain %v is done\", domainName)\n\treturn wasError\n}", "title": "" }, { "docid": "35b32e0eda5ba48110a373141df67fb4", "score": "0.45160022", "text": "func (_BridgeBank *BridgeBankSession) HarmonyBridge() (common.Address, error) {\n\treturn _BridgeBank.Contract.HarmonyBridge(&_BridgeBank.CallOpts)\n}", "title": "" }, { "docid": "60bcf2157cc8f63732616753642fdd2d", "score": "0.4508941", "text": "func Adjust1502Cal(CalHandle uint32, RefVoltage float64, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1502Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "703b91009052618110a4a48434a9d1ae", "score": "0.4507374", "text": "func addFullBridge(bridgeName string, stpEnabled bool, manager *vswitchManager) (string, error) {\n\t//fmt.Println(\"ROOT UUID\", manager.GetRootUUID())\n\tops := addBridgeOps(bridgeName, manager.GetRootUUID(), false)\n\n\tresults, err := manager.Transact(\"Open_vSwitch\", \"ADD_BRIDGE\", ops)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t//fmt.Println(results)\n\terr = checkForErrors(results)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tres := parseOVSDBOpsResult(results[2])\n\n\treturn res.UUID.GoUuid, err\n}", "title": "" }, { "docid": "6c4ead0b0f0db53d64157ae437c5bd17", "score": "0.44990087", "text": "func TestBurstCount(){\n\n}", "title": "" }, { "docid": "7b5d87e69bd2e8f6252d2ee5ce80f506", "score": "0.44876373", "text": "func rentertriggercontractrecoveryrescancmd() {\n\tcrpg, err := httpClient.RenterContractRecoveryProgressGet()\n\tif err != nil {\n\t\tdie(\"Failed to get recovery status\", err)\n\t}\n\tif crpg.ScanInProgress {\n\t\tfmt.Println(\"Scan already in progress\")\n\t\tfmt.Println(\"Scanned height:\\t\", crpg.ScannedHeight)\n\t\treturn\n\t}\n\tif err := httpClient.RenterInitContractRecoveryScanPost(); err != nil {\n\t\tdie(\"Failed to trigger recovery scan\", err)\n\t}\n\tfmt.Println(\"Successfully triggered contract recovery scan.\")\n}", "title": "" }, { "docid": "380ccb27b8197ba54cf444035e9d46ad", "score": "0.44811052", "text": "func Adjust9246Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9246Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "adafdf68f17b0e6eb145a7a73cc2991e", "score": "0.4480481", "text": "func Adjust9230Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9230Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "74ffe0acd810f48418335fca276a23a1", "score": "0.44614863", "text": "func Adjust1520Cal(CalHandle uint32, RefVoltage float64, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1520Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d3bf597c68b55f82a68a54fbb956234e", "score": "0.44535413", "text": "func Adjust9217Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9217Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "bbcb937961b2996a3fb111665f5d41da", "score": "0.44374016", "text": "func Adjust9221Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9221Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "3a8c8111a15bbb8b8f2a1f437eadf6fa", "score": "0.44320253", "text": "func procPin() {\n}", "title": "" }, { "docid": "c803802c669d41fcb2e5bbfe62491b96", "score": "0.44297415", "text": "func (b *bridged) initBridge(n *driver.Network) error {\n\tbridgeName := n.Name\n\tif err := CreateBridgeInterface(bridgeName); err != nil {\n\t\treturn errors.Wrap(err, \"create bridge\")\n\t}\n\n\tgatewayIP := *n.IpRange\n\tgatewayIP.IP = n.IpRange.IP\n\tif err := SetInterfaceIP(bridgeName, gatewayIP.String()); err != nil {\n\t\treturn errors.Wrap(err, \"set interface ip\")\n\t}\n\n\tif err := SetInterfaceUP(bridgeName); err != nil {\n\t\treturn errors.Errorf(\"set bridge up: %s: %v\", bridgeName, err)\n\t}\n\n\tif err := setupIPTables(bridgeName, n.IpRange); err != nil {\n\t\treturn errors.Errorf(\"set iptables for %s: %v\", bridgeName, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f02f5f226f76d9ab321f479cb564700e", "score": "0.44240195", "text": "func Adjust9223Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9223Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d1fe94e7234be609337265f08e13f4dc", "score": "0.44185066", "text": "func Adjust433xCal(CalHandle uint32, RefVoltage float64, RefExcitation float64, ShuntLocation int32) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcRefExcitation, _ := (C.float64)(RefExcitation), cgoAllocsUnknown\n\tcShuntLocation, _ := (C.int32)(ShuntLocation), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust433xCal(cCalHandle, cRefVoltage, cRefExcitation, cShuntLocation)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "1a3daa26dcffc34cb4929bf8b9ded1ec", "score": "0.44178313", "text": "func _cgoexp_ebd397278953_proxyholochain_ActionBridge_Name(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_ebd397278953_proxyholochain_ActionBridge_Name\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "170c9aaf1ca37d5b87090ef56119418a", "score": "0.44167417", "text": "func Adjust9238Cal(CalHandle uint32, ChannelNames string, Value float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcValue, _ := (C.float64)(Value), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust9238Cal(cCalHandle, cChannelNames, cValue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "6ebec3cbce97baffc2df1a8d6d5a4dfb", "score": "0.44147548", "text": "func (c *Com) OnInvoke() {}", "title": "" }, { "docid": "bb2f3bfe755a07a22b80ef4a9240f8f1", "score": "0.44124514", "text": "func ResetAIBridgeNomResistance(TaskHandle unsafe.Pointer, Channel string) int32 {\n\tcTaskHandle, _ := (C.TaskHandle)(TaskHandle), cgoAllocsUnknown\n\tcChannel, _ := unpackPCharString(Channel)\n\t__ret := C.DAQmxResetAIBridgeNomResistance(cTaskHandle, cChannel)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "ac80292d52eb0dd6ff904c862a93dcae", "score": "0.43964547", "text": "func Adjust1521Cal(CalHandle uint32, RefVoltage float64, MeasOutput float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcRefVoltage, _ := (C.float64)(RefVoltage), cgoAllocsUnknown\n\tcMeasOutput, _ := (C.float64)(MeasOutput), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust1521Cal(cCalHandle, cRefVoltage, cMeasOutput)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c5175dc014191daf068774969d7412eb", "score": "0.43961865", "text": "func Adjust4322Cal(CalHandle uint32, ChannelNames string, RefVal float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcRefVal, _ := (C.float64)(RefVal), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4322Cal(cCalHandle, cChannelNames, cRefVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "8c86d08d3b55fc412fa7a7cbeffdf3c3", "score": "0.43951946", "text": "func Adjust4220Cal(CalHandle uint32, ChannelNames string, Gain float64, InputVal float64) int32 {\n\tcCalHandle, _ := (C.CalHandle)(CalHandle), cgoAllocsUnknown\n\tcChannelNames, _ := unpackPCharString(ChannelNames)\n\tcGain, _ := (C.float64)(Gain), cgoAllocsUnknown\n\tcInputVal, _ := (C.float64)(InputVal), cgoAllocsUnknown\n\t__ret := C.DAQmxAdjust4220Cal(cCalHandle, cChannelNames, cGain, cInputVal)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" } ]
cba043e128cd43b62ce98a9438a49bc6
GetUserOfficerships retrieves all officerships held by the user with the given ID. This consumes one API request.
[ { "docid": "5cd9eecc7eef7a815caf8c5053ba4905", "score": "0.84516567", "text": "func (s *Session) GetUserOfficerships(id int) (officerships []Officership, err error) {\n\terr = s.getf(\"/user/%d/officerships/\", id).Into(&officerships)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor k, v := range officerships {\n\t\tif officerships[k].FromDateRaw != \"\" {\n\t\t\tofficerships[k].FromDate, err = time.Parse(\"2006-01-02\", v.FromDateRaw)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif officerships[k].TillDateRaw != \"\" {\n\t\t\tofficerships[k].TillDate, err = time.Parse(\"2006-01-02\", v.TillDateRaw)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "064d1a8fb661b535a54782fdef06ad42", "score": "0.51121324", "text": "func GetUserOffers(c *gin.Context) {\n\tdb := c.MustGet(\"db\").(*mgo.Database)\n\tuserid := getIDfromContex(c, \"userid\")\n\n\toffers := []models.Offer{}\n\terr := db.C(models.OfferC).Find(bson.M{\"_autherid\": userid}).Sort(\"-created_at\").All(&offers)\n\tif err != nil {\n\t\tSendBadRequest(c, &gin.H{\"message\": \"empty\"})\n\t\treturn\n\t}\n\n\tSendOK(c, &gin.H{\"offers\": &offers})\n}", "title": "" }, { "docid": "d0b93035d381c9e678b56fe29cea37f6", "score": "0.4815498", "text": "func GetTournamentsForOffice(w http.ResponseWriter, r *http.Request) {\n\tSetHeaders(w)\n\tparams := mux.Vars(r)\n\tofficeID, err := strconv.Atoi(params[\"office_id\"])\n\tif err != nil {\n\t\tlog.Println(\"Invalid id parameter\")\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\ttournament, err := data.GetTournamentsForOffice(officeID)\n\tif err != nil {\n\t\tlog.Println(\"Unable to get tournaments for office\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif tournament == nil {\n\t\thttp.Error(w, \"No tournaments for office\", http.StatusNotFound)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(tournament)\n}", "title": "" }, { "docid": "0e970aa38337e09f79f7e02f12e4daab", "score": "0.4766147", "text": "func (m *PeopleModel) Get(id int) (user *myradio.User, officerships []myradio.Officership, credits []myradio.ShowMeta, currentAndNext *myradio.CurrentAndNext, err error) {\n\tuser, err = m.session.GetUser(id)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tofficerships, err = m.session.GetUserOfficerships(id)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcredits, err = m.session.GetUserShowCredits(id)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcurrentAndNext, err = m.session.GetCurrentAndNext()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6e2b742b6e56bd85e11abd3b1ebb76aa", "score": "0.469466", "text": "func GetManyUserOKOwner(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.UserController, id []string) (http.ResponseWriter, app.UserOwnerCollection) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := id\n\t\tquery[\"id\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/user/multi\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := id\n\t\tprms[\"id\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"UserTest\"), rw, req, prms)\n\tgetManyCtx, _err := app.NewGetManyUserContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.GetMany(getManyCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt app.UserOwnerCollection\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(app.UserOwnerCollection)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.UserOwnerCollection\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "ddb9b939be39900828c5bec2b36f2265", "score": "0.46090776", "text": "func GetEventsByOwners(w http.ResponseWriter, r *http.Request) {\n\towners := mux.Vars(r)[\"userID\"]\n\tevents := user.GetEventsByOwner(owners)\n\teventsJSON, err := json.Marshal(events)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(eventsJSON)\n}", "title": "" }, { "docid": "2e558d538d58d344e1e09099629d49ba", "score": "0.46090117", "text": "func (r *Roster) GetRoster(pid int, since time.Time, includeAssignee bool) ([]*User, error) {\n\tvar users []*User\n\tmrs, _, err := r.client.MergeRequests.ListProjectMergeRequests(pid, &gitlab.ListProjectMergeRequestsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 100, // should not be more than 100 opened merge requests\n\t\t},\n\t\tState: gitlab.String(\"opened\"),\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, mr := range mrs {\n\t\tusers = append(users, extractUsersFromMergeRequest(mr, includeAssignee)...)\n\t}\n\n\tvar mergeRequests []*gitlab.MergeRequest\n\n\tmergeRequests, err = r.listProjectMergeRequestsSince(pid, since, \"merged\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, mr := range mergeRequests {\n\t\tusers = append(users, extractUsersFromMergeRequest(mr, includeAssignee)...)\n\t}\n\n\tmergeRequests, err = r.listProjectMergeRequestsSince(pid, since, \"closed\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, mr := range mergeRequests {\n\t\tusers = append(users, extractUsersFromMergeRequest(mr, includeAssignee)...)\n\t}\n\n\treturn dedupUsers(users), nil\n}", "title": "" }, { "docid": "4d4a0a4415e4a4ccef9c03124e62f53a", "score": "0.45635346", "text": "func (c *Company) Officers(options ...Option) (*Officers, error) {\n\t// Prepare the response\n\tres := Officers{}\n\tparams := url.Values{}\n\tfor _, option := range options {\n\t\toption(&params)\n\t}\n\n\t// Make a call to the service\n\tpath := fmt.Sprintf(\"/company/%s/officers\", c.CompanyNumber)\n\terr := c.api.Do(context.Background(), http.MethodGet, path, params, nil, &res)\n\t// Ensure to close the ReadCloser\n\t// defer b.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decode the service's response to a Company struct and return the result or error\n\t// if err := json.NewDecoder(b).Decode(&res); err != nil {\n\t// \treturn nil, err\n\t// }\n\treturn &res, nil\n}", "title": "" }, { "docid": "e0a2c67301411e1dfc5b278a8eb41932", "score": "0.44812632", "text": "func GetUser(c echo.Context) error {\n\tuser := User{}\n\tid := c.Param(\"id\")\n\n\tdb := db.Session()\n\tif err := db.Where(\"id = ?\", id).Preload(\"Dealerships\").First(&user).Error; gorm.IsRecordNotFoundError(err) {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"User ID is not exist!\")\n\t}\n\n\treturn c.JSON(http.StatusOK, &user)\n}", "title": "" }, { "docid": "70945148c2cdefa8cf5c521f17235392", "score": "0.44783336", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tidstring := params[\"id\"]\n\tidInt64, err := strconv.ParseInt(idstring, 10, 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tres, err := service.GetUser(idInt64)\n\t\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(dictionary.APIResponse{Data: nil, Error: dictionary.UndisclosedError})\n\t} else {\n\t\tjson.NewEncoder(w).Encode(dictionary.APIResponse{Data: res, Error: dictionary.NoError})\n\t}\n}", "title": "" }, { "docid": "8ae61c65df729d056c5e4c559e328caf", "score": "0.44708794", "text": "func (a *API) getUsers(kind string) (crmData, error) {\n\treturn a.makeRequest(\"Users\", \"/getUsers\", \"GET\", BlankOptions{\"type\": kind})\n}", "title": "" }, { "docid": "967dee875c4b58fa6bb1a0220b23153c", "score": "0.4467623", "text": "func (u *User) GetObservables() []observable.Observable {\n\tobservables := []observable.Observable{}\n\n\tdatabase.\n\t\tOrder(`\"order\"`).\n\t\tFind(&observables, \"user_id = ?\", u.ID)\n\n\treturn observables\n}", "title": "" }, { "docid": "c9e77972a71c643abc98cfeb25dc93fe", "score": "0.44598117", "text": "func (c *Client) UserOwnedEvents(ctx context.Context, id string, req *UserOwnedEventsRequest) (*UserOwnedEventResponse, error) {\n\tr := new(UserOwnedEventResponse)\n\n\treturn r, c.getJSON(ctx, fmt.Sprintf(\"/users/%s/owned_events/\", id), req, r)\n}", "title": "" }, { "docid": "1737cedaeeb1dce80117c9bd7aa7b8b2", "score": "0.44317356", "text": "func GetPeople(w http.ResponseWriter, r *http.Request) {\n\t// return the whole list of users\n}", "title": "" }, { "docid": "748661acd112212af4d310a63376769c", "score": "0.44203368", "text": "func (a *Client) GetPeoplePersonIDVehicles(params *GetPeoplePersonIDVehiclesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPeoplePersonIDVehiclesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPeoplePersonIDVehiclesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetPeoplePersonIDVehicles\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/people/{person_id}/vehicles\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetPeoplePersonIDVehiclesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetPeoplePersonIDVehiclesOK), nil\n}", "title": "" }, { "docid": "c268bb0066f4505465bd639e9f024efe", "score": "0.44200736", "text": "func (h *UserAPI) GetExclusivePartners(c *gin.Context) {\n\tctx := context.Background()\n\tuserID := c.MustGet(\"userID\").(uint)\n\tctx = context.WithValue(ctx, entities.UserIDKey, userID)\n\tpartners, err := h.UserUsecase.GetExclusivePartners(ctx)\n\tif err != nil {\n\t\tentities.SendValidationError(c, \"There has been an error while processing your request, please try again\", err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"users\": partners,\n\t})\n\treturn\n}", "title": "" }, { "docid": "f09e0e42f5754cec70a7307bc3a203f2", "score": "0.44189918", "text": "func (dc *DeviceController) GetByUser(ctx context.Context, user primitive.ObjectID) ([]Device, error) {\n\tcursor, err := dc.collection.Find(ctx, bson.M{\"user\": user})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevices := make([]Device, 0)\n\n\tfor cursor.Next(ctx) {\n\t\tvar device Device\n\t\tif err := cursor.Decode(&device); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdevices = append(devices, device)\n\t}\n\n\treturn devices, nil\n}", "title": "" }, { "docid": "1b2f62f7f80fdb85ce04b38f1f60b710", "score": "0.44111902", "text": "func (c Client) GetOwnedGames(playerID int64) (games OwnedGames, err error) {\n\n\toptions := url.Values{}\n\toptions.Set(\"steamid\", strconv.FormatInt(playerID, 10))\n\toptions.Set(\"include_appinfo\", \"1\")\n\toptions.Set(\"include_played_free_games\", \"1\")\n\n\tb, err := c.getFromAPI(\"IPlayerService/GetOwnedGames/v1\", options, true)\n\tif err != nil {\n\t\treturn games, err\n\t}\n\n\tvar resp OwnedGamesResponse\n\terr = json.Unmarshal(b, &resp)\n\tif err != nil {\n\t\treturn games, err\n\t}\n\n\treturn resp.Response, nil\n}", "title": "" }, { "docid": "3739e59958be9614fb74b6b6a90e50a4", "score": "0.43985918", "text": "func (e Endpoints) GetUser(ctx context.Context, id string) (s0 string, e1 error) {\n\trequest := GetUserRequest{ID: id}\n\tresponse, err := e.GetUserEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetUserResponse).S0, response.(GetUserResponse).E1\n}", "title": "" }, { "docid": "8d1833c6cc720ae4968b6dda8892c569", "score": "0.43903247", "text": "func GetUserRooms(db interface{}) func(server.Request) (handler.Response, error) {\n\n\treturn func(req server.Request) (handler.Response, error) {\n\n\t\t// Parse model object\n\t\tvar model models.GetUserRoomsModel\n\t\tif err := json.Unmarshal(req.Body, &model); err != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Unmarshal models.ActivePeerRoomModel %s\", err.Error())\n\t\t\tlog.Error(errorMessage)\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"modelUnMarshalError\", errorMessage)}, nil\n\t\t}\n\n\t\t// Create service\n\t\troomService, serviceErr := service.NewRoomService(db)\n\t\tif serviceErr != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Vang room service %s\", serviceErr.Error())\n\t\t\tlog.Error(errorMessage)\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"roomServiceError\", errorMessage)}, nil\n\t\t}\n\n\t\trooms, findRoomErr := roomService.GetRoomsByUserId(model.UserId.String(), 0)\n\t\tif findRoomErr != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Vang find room %s\", findRoomErr.Error())\n\t\t\tlog.Error(errorMessage)\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"findRoomError\", errorMessage)}, nil\n\t\t}\n\n\t\tif len(rooms) == 0 {\n\t\t\treturn handler.Response{\n\t\t\t\tBody: []byte(\"{\\n \\\"rooms\\\": {},\\n \\\"roomIds\\\": []\\n}\"),\n\t\t\t\tStatusCode: http.StatusOK,\n\t\t\t}, nil\n\t\t}\n\n\t\t// Use map to record duplicates as we find them.\n\t\tencountered := map[string]bool{}\n\n\t\tvar allMembers []string\n\n\t\t// Map to response model\n\t\tvar resRooms models.ResUserRoomModel\n\t\tresRooms.Rooms = make(map[string]interface{})\n\t\tfor _, v := range rooms {\n\t\t\troomId := v.ObjectId.String()\n\t\t\tmappedRoom := make(map[string]interface{})\n\t\t\tmappedRoom[\"objectId\"] = roomId\n\t\t\tmappedRoom[\"members\"] = v.Members\n\t\t\tmappedRoom[\"type\"] = v.Type\n\t\t\tmappedRoom[\"readDate\"] = v.ReadDate\n\t\t\tmappedRoom[\"readCount\"] = v.ReadCount\n\t\t\tmappedRoom[\"ReadMessageId\"] = v.ReadMessageId\n\t\t\tmappedRoom[\"lastMessage\"] = v.LastMessage\n\t\t\tmappedRoom[\"memberCount\"] = v.MemberCount\n\t\t\tmappedRoom[\"messageCount\"] = v.MessageCount\n\t\t\tmappedRoom[\"createdDate\"] = v.CreatedDate\n\t\t\tmappedRoom[\"updatedDate\"] = v.UpdatedDate\n\n\t\t\tresRooms.Rooms[roomId] = mappedRoom\n\t\t\tresRooms.RoomIds = append(resRooms.RoomIds, roomId)\n\n\t\t\t// Merge members into a single array\n\t\t\tfor _, v := range v.Members[:2] {\n\t\t\t\tif encountered[v] != true {\n\t\t\t\t\tencountered[v] = true\n\t\t\t\t\tallMembers = append(allMembers, v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdispatchProfileModel := models.DispatchProfilesModel{\n\t\t\tUserIds: allMembers,\n\t\t\tReqUserId: model.UserId,\n\t\t}\n\n\t\tuserInfoInReq := &UserInfoInReq{\n\t\t\tUserId: req.UserID,\n\t\t\tUsername: req.Username,\n\t\t\tAvatar: req.Avatar,\n\t\t\tDisplayName: req.DisplayName,\n\t\t\tSystemRole: req.SystemRole,\n\t\t}\n\t\tgo dispatchProfileByUserIds(dispatchProfileModel, userInfoInReq)\n\n\t\tbody, marshalError := json.Marshal(&resRooms)\n\t\tif marshalError != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Marshal rooms %s\", marshalError.Error())\n\t\t\tlog.Error(errorMessage)\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"roomsMarshalError\", errorMessage)}, nil\n\t\t}\n\n\t\treturn handler.Response{\n\t\t\tBody: body,\n\t\t\tStatusCode: http.StatusOK,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "0c830a3e1852b9fbdd9e5394370db949", "score": "0.43877542", "text": "func (c *Client) GetOfficers(companyNumber string, startIndex string, itemsPerPage string) (*GetOfficersResponse, error) {\n\n\tlogContext := log.Data{\"company_number\": companyNumber}\n\n\tpath := fmt.Sprintf(\"/emergency-auth-code/company/%s/eligible-officers?start_index=%s&items_per_page=%s\", companyNumber, startIndex, itemsPerPage)\n\n\tresp, err := c.sendRequest(http.MethodGet, path)\n\n\t// deal with any http transport errors\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, nil\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// determine if there are unexpected 4xx/5xx errors. an error here relates to a response parsing issue\n\terr = c.checkResponseForError(resp)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, err\n\t}\n\n\tout := &GetOfficersResponse{}\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, ErrFailedToReadBody\n\t}\n\n\terr = json.Unmarshal(b, out)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, ErrFailedToReadBody\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "39178d38a4ef7cb8fe9790efe32ea6bc", "score": "0.43865883", "text": "func (session *Session) GetUsersByOpenIds(openIds string) (Result, error) {\n\tparams := Params{\"open_ids\": openIds}\n\treturn session.Get(\"/api/user/info\", params)\n}", "title": "" }, { "docid": "d3fc3030eab0283e207f402be8679b57", "score": "0.43518624", "text": "func GetUsers(db *gorm.DB, requestedID string) model.Output {\n\n\tuser := new(model.User)\n\tuser.ID, _ = strconv.Atoi(requestedID)\n\n\tdb.Take(&user)\n\n\tif user.Email != \"\" {\n\t\tresponse = helpers.Output(\"SuccessUserFound\", nil)\n\t\tresponse.Users = append(response.Users, *user)\n\t} else {\n\t\tresponse = helpers.Output(\"SuccessUserNotFound\", nil)\n\t}\n\n\treturn response\n}", "title": "" }, { "docid": "ec12df667f74a228c4821e8bbf22abe4", "score": "0.43511707", "text": "func (a *UserAPIService) UserGetCommission(ctx context.Context) ([]UserCommission, *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 []UserCommission\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/user/commission\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/x-www-form-urlencoded\"}\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/xml\", \"text/xml\", \"application/javascript\", \"text/javascript\"}\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[\"api-key\"] = key\n\n\t\t}\n\t}\n\t// if 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[\"api-nonce\"] = key\n\n\t// \t}\n\t// }\n\t// if 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[\"api-signature\"] = key\n\n\t// \t}\n\t// }\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn 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 []UserCommission\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "923c2c4190c9da3c5bc6a2ce9da770f3", "score": "0.43507242", "text": "func GetUsersEndpoint(response http.ResponseWriter, request *http.Request) {\r\n\tlock.Lock()\r\n\tdefer lock.Unlock()\r\n\tresponse.Header().Add(\"content-type\", \"application/json\")\r\n\tparams := mux.Vars(request)\r\n\tid, _ := primitive.ObjectIDFromHex(params[\"id\"])\r\n\tvar user Person\r\n\tcollection := client.Database(\"instagramAPI\").Collection(\"users\")\r\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\r\n\terr := collection.FindOne(ctx, Person{ID: id}).Decode(&user)\r\n\tif err != nil {\r\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\r\n\t\tresponse.Write([]byte(`{\"message\": \"` + err.Error() + `\"}`))\r\n\t\treturn\r\n\t}\r\n\tjson.NewEncoder(response).Encode(user)\r\n\ttime.Sleep(1 * time.Second)\r\n}", "title": "" }, { "docid": "2500bc172bfc9f0cc6b064196fa382e2", "score": "0.43407002", "text": "func (c *Client) GetOfficer(companyNumber, officerID string) (*Officer, error) {\n\n\tlogContext := log.Data{\"company_number\": companyNumber}\n\n\tpath := fmt.Sprintf(\"/emergency-auth-code/company/%s/eligible-officers/%s\", companyNumber, officerID)\n\n\tresp, err := c.sendRequest(http.MethodGet, path)\n\n\t// deal with any http transport errors\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, nil\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// determine if there are unexpected 4xx/5xx errors. an error here relates to a response parsing issue\n\terr = c.checkResponseForError(resp)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, err\n\t}\n\n\tout := &Officer{}\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, ErrFailedToReadBody\n\t}\n\n\terr = json.Unmarshal(b, out)\n\tif err != nil {\n\t\tlog.Error(err, logContext)\n\t\treturn nil, ErrFailedToReadBody\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "0f14415bab8c98897265dd3246420810", "score": "0.4337734", "text": "func GetUserConstroller(c echo.Context) error {\n\tuser, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"messages\": \"success get user by id\",\n\t\t\"userId\": users[user],\n\t})\n}", "title": "" }, { "docid": "272b6b8663028954b5869b115de91b47", "score": "0.43313038", "text": "func (uc UserController) GetUsers(c echo.Context) error {\n\tappUsers, err := uc.userInteractor.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar httpUsers []User\n\tfor _, u := range appUsers {\n\t\thttpUsers = append(httpUsers, userToHTTPResponse(u))\n\t}\n\n\treturn c.JSON(http.StatusOK, httpUsers)\n}", "title": "" }, { "docid": "8693f0c0c02cff702d308f377d403eea", "score": "0.4328155", "text": "func (c *UserController) GetMany(ctx *app.GetManyUserContext) error {\n\t// UserController_GetMany: start_implement\n\n\tuserIDs := make([]string, 0, len(ctx.ID))\n\tfor _, v := range ctx.ID {\n\t\tuID := v\n\t\tif uID == \"\" {\n\t\t\treturn ctx.BadRequest(goa.ErrBadRequest(\"ID is not valid\", \"id\", v))\n\t\t}\n\t\tuserIDs = append(userIDs, uID)\n\t}\n\n\tusers, err := database.GetUserMulti(ctx, userIDs)\n\tif err == database.ErrUserNotFound {\n\t\treturn ctx.NotFound(goa.ErrNotFound(\"Unable to find all users\"))\n\t} else if err != nil {\n\t\treturn ctx.InternalServerError(goa.ErrInternal(err))\n\t}\n\n\tif c.IsAdmin(ctx.Request) {\n\t\tres := make(app.UserAdminCollection, 0, len(users))\n\t\tfor _, v := range users {\n\t\t\tdata := database.UserToUserAdmin(v)\n\t\t\tres = append(res, data)\n\t\t}\n\n\t\treturn ctx.OKAdmin(res)\n\t}\n\n\tres := make(app.UserCollection, 0, len(users))\n\tfor _, v := range users {\n\t\tdata := database.UserToUser(v)\n\t\tres = append(res, data)\n\t}\n\n\treturn ctx.OK(res)\n\n\t// UserController_GetMany: end_implement\n}", "title": "" }, { "docid": "22769e336794afb9287fe54d5b7f4b7a", "score": "0.43246025", "text": "func NewGetUserOperationByIDUsingGETUnauthorized() *GetUserOperationByIDUsingGETUnauthorized {\n\treturn &GetUserOperationByIDUsingGETUnauthorized{}\n}", "title": "" }, { "docid": "ee43cf78078b9699f09a984dab3d594f", "score": "0.43153584", "text": "func (ws *Users) Get(c echo.Context) error {\n\tscope, err := getScopeFromContext(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tusers, err := ws.interactor.GetAll(scope)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t}\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\"data\": users})\n}", "title": "" }, { "docid": "2a2c4f6ed2332c599fb41ef84af38363", "score": "0.430456", "text": "func (session *Session) GetUsersFace(openIds string, typeId int) (Result, error) {\n\tif typeId == 0 {\n\t\ttypeId = 4\n\t}\n\n\tparams := Params{\"open_ids\": openIds, \"type_id\": typeId}\n\treturn session.Get(\"/api/user/face\", params)\n}", "title": "" }, { "docid": "99abddc422baa525412cce2413b92b9d", "score": "0.43004042", "text": "func GetDurataionUsers(c echo.Context) error {\n\n\tdata := durationdata.GetUsersData()\n\n\treturn c.JSON(200, Response{\n\t\tStatus: 0,\n\t\tSuccess: true,\n\t\tMessage: \"ok!\",\n\t\tContent: data.GetSafeContent(),\n\t})\n}", "title": "" }, { "docid": "4a28983a201fa1f92e33a1c393b25ff0", "score": "0.42962375", "text": "func GetUsersEvents(w http.ResponseWriter, r *http.Request) {\n\tidStr := mux.Vars(r)[\"userID\"]\n\tid, converted := strconv.Atoi(idStr)\n\tif converted != nil {\n\t\tlog.Printf(\"%v\", converted)\n\t}\n\tevents := user.GetUsersEvents(id)\n\teventsJSON, err := json.Marshal(events)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Allow\", \"GET,HEAD\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(eventsJSON)\n}", "title": "" }, { "docid": "1a414ec9f3fd682ae6fb5fe5a330a26b", "score": "0.42909694", "text": "func GetActors(ctx context.Context, repoID int64) ([]*user_model.User, error) {\n\tactors := make([]*user_model.User, 0, 10)\n\n\treturn actors, db.GetEngine(ctx).Where(builder.In(\"id\", builder.Select(\"`action_run`.trigger_user_id\").From(\"`action_run`\").\n\t\tGroupBy(\"`action_run`.trigger_user_id\").\n\t\tWhere(builder.Eq{\"`action_run`.repo_id\": repoID}))).\n\t\tCols(\"id\", \"name\", \"full_name\", \"avatar\", \"avatar_email\", \"use_custom_avatar\").\n\t\tOrderBy(user_model.GetOrderByName()).\n\t\tFind(&actors)\n}", "title": "" }, { "docid": "c5c7feafed08adfc54ff6a67157ad244", "score": "0.42821288", "text": "func GetUserRatingsResponse(userID int, appCtx *ctx.AppContext) (Response, error) {\n\n\t//pointer receiver\n\tuserCtx := new(UserCtx)\n\tuserCtx.ctx = appCtx\n\n\t// make\n\tuserChannel := make(chan User)\n\tgo userCtx.GetUserDetails(userID, userChannel)\n\n\tratingsChannel := make(chan []Ratings)\n\tgo userCtx.GetUserRatings(userID, ratingsChannel)\n\n\tuser := <-userChannel\n\tratings := <-ratingsChannel\n\n\tresponse := Response{\n\t\tName: user.Name,\n\t\tGender: user.Gender,\n\t\tUserRatings: ratings,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "97e4c094723745a8eff124fb1af4fb31", "score": "0.42588785", "text": "func (m *Mongo) GetParticipants(id string) ([]string, error) {\n\tvar participants []string\n\terr := m.tournaments.FindId(id).Select(bson.M{\"participants\": 1}).One(participants)\n\tif err != nil {\n\t\treturn nil, errors.Error{Code: errors.NotFoundError, Message: \"get participants: tournament is not found, id \" + id}\n\t}\n\treturn participants, nil\n}", "title": "" }, { "docid": "508bcfbcce25d7d9221fa69fa63d42fa", "score": "0.42528093", "text": "func (a *Client) GetTeachersForUser(params *GetTeachersForUserParams, authInfo runtime.ClientAuthInfoWriter) (*GetTeachersForUserOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetTeachersForUserParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getTeachersForUser\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/users/{id}/myteachers\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetTeachersForUserReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetTeachersForUserOK)\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 getTeachersForUser: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "c1af41c2f593028fddec3432a8a7ef45", "score": "0.42436892", "text": "func (c *UserControllerV1) GetUserById(writer http.ResponseWriter, request *http.Request) {\n\tvars := mux.Vars(request)\n\tidVal := vars[\"id\"]\n\t// We simply do this to validate it's an integer\n\t_, err := strconv.Atoi(idVal)\n\tif err != nil {\n\t\terrorResponse(writer, http.StatusBadRequest, fmt.Sprintf(\"Invalid ID %s\", idVal))\n\t\treturn\n\t}\n\n\tvar users []models.UserModel\n\tusers, err = models.GetUsers(c.Service.Dbh, \"id\", idVal, 1, 0)\n\tif err != nil {\n\t\terrorResponse(writer, http.StatusInternalServerError, err.Error())\n\t} else {\n\t\t// return the first element of the slice so it isn't serialized as an array\n\t\tjsonResponse(writer, http.StatusOK, users[0])\n\t}\n}", "title": "" }, { "docid": "d32a28105547462fc1f0b9d16ddb5dcf", "score": "0.42410025", "text": "func GetUsersConstroller(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"messages\": \"success get all users\",\n\t\t\"users\": users,\n\t})\n}", "title": "" }, { "docid": "ec62ef2833b8ccb07e047dfd43050722", "score": "0.42354813", "text": "func GetOauthByUserId(uid int64) (oas []*Oauth2, err error) {\n\terr = orm.Find(&oas, Oauth2{Uid: uid})\n\treturn oas, err\n}", "title": "" }, { "docid": "5b95c826af5441d401df7ba658d8e6ac", "score": "0.4230157", "text": "func (r *ReaderDB) GetBookingsByUser(bookedBy int64) ([]Booking, error) {\n\trows, err := r.db.Query(\"select id,v_name,st,et,customer,phone from bookings where booked_by=?\", bookedBy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar bookings []Booking\n\n\tfor rows.Next() {\n\t\tbooking := Booking{}\n\n\t\tif err = rows.Scan(&booking.ID, &booking.VenueName, &booking.St, &booking.Et, &booking.CustName, &booking.CustPhone); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbookings = append(bookings, booking)\n\t}\n\treturn bookings, nil\n}", "title": "" }, { "docid": "473bcbd6737b32edf15fb2d09bde2086", "score": "0.4211787", "text": "func GetUsers(ctx *context.AppContext, w http.ResponseWriter, r *http.Request) {\n\tvar toSerialize []iserial.Serializable\n\tusers, err := ctx.UserManager.FindAll()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"%s Seek users failed: %s\", utils.Use().GetStack(GetUsers), err.Error())\n\t\tctx.Rw.SendError(ctx, w, http.StatusInternalServerError, msg, \"\")\n\t\treturn\n\t}\n\tfor _, u := range users {\n\t\ttoSerialize = append(toSerialize, u)\n\t}\n\tctx.Rw.SendArraySerializable(ctx, w, http.StatusOK, toSerialize, \"\", \"\")\n\treturn\n}", "title": "" }, { "docid": "ac3ccb8bc23631e8963ea8f423efbd21", "score": "0.42081517", "text": "func NewGetUserOperationByIDUsingGETForbidden() *GetUserOperationByIDUsingGETForbidden {\n\treturn &GetUserOperationByIDUsingGETForbidden{}\n}", "title": "" }, { "docid": "25b81af6941d6b7ca6fa72f9b65e98aa", "score": "0.41964775", "text": "func (s UserService) GetUser(id string) ([]model.User, error) {\n\tdb := db.GetDB()\n\tusers := []model.User{}\n\n\t// SELECT実行\n\terr := db.Raw(\"SELECT * FROM user where id = ?\", id).Scan(&users).Error\n\tif err != nil {\n\t\treturn nil, &ErrorMessage{\n\t\t\tStatusCd: http.StatusInternalServerError,\n\t\t\tMessage: \"\",\n\t\t\tErrorCd: \"1005\",\n\t\t\tDetail: err,\n\t\t}\n\t}\n\treturn users, nil\n}", "title": "" }, { "docid": "f4fbbbc67341d647925a8ed0f177fcdd", "score": "0.41940957", "text": "func (c *UsersApiController) GetUsers(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\tclientGravatar, err := parseBoolParameter(query.Get(\"client_gravatar\"))\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\tincludeCustomProfileFields, err := parseBoolParameter(query.Get(\"include_custom_profile_fields\"))\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n\tresult, err := c.service.GetUsers(r.Context(), clientGravatar, includeCustomProfileFields)\n\t// If an error occurred, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t// If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\n}", "title": "" }, { "docid": "2e87b194c46c5c136253219e4a5c98fa", "score": "0.41909808", "text": "func (a *Client) GetUsersForResource(params *GetUsersForResourceParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersForResourceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetUsersForResourceParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getUsersForResource\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/resources/{id}/users\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetUsersForResourceReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetUsersForResourceOK)\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 getUsersForResource: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "06a5d6ec73e8dcc6fa925fb0620c4544", "score": "0.41830862", "text": "func GetUsersViaId(iId int64) (*Users, error) {\n\tvar _Users = &Users{Id: iId}\n\thas, err := Engine.Get(_Users)\n\tif has {\n\t\treturn _Users, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "f0142ed206e061747349d2aae7717ea0", "score": "0.4178911", "text": "func GetPersonYpiresies(id int, c chan []models.Ypiresia) {\n\tdb, _ := datastorage.GetDataRouter().GetDb(\"common\")\n\tdbc := db.GetMysqlClient()\n\tres, _ := dbc.Query(\"select idypiresies,perigrafi,date from ypiresies join typoiypiresiwn on typeid = typoiypiresiwn.id where personid=?\", id)\n\tvar ypiresia models.Ypiresia\n\tvar ypiresies []models.Ypiresia\n\tfor res.Next() {\n\t\t_ = res.Scan(\n\t\t\t&ypiresia.ID,\n\t\t\t&ypiresia.Perigrafi,\n\t\t\t&ypiresia.Date,\n\t\t)\n\t\typiresia.Date = models.DateBuilder(ypiresia.Date)\n\t\typiresies = append(ypiresies, ypiresia)\n\t}\n\tres.Close()\n\tc <- ypiresies\n}", "title": "" }, { "docid": "c6827f6dafd13c877319f533b32db502", "score": "0.41763675", "text": "func (m *DatabaseManager) GetOwners(ctx context.Context, obj runtime.Object) ([]scaleway.Owner, error) {\n\tdatabase, err := convertDatabase(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif database.Spec.InstanceRef.Name == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tinstance := &rdbv1alpha1.RDBInstance{}\n\n\tdatabaseNamespace := database.Spec.InstanceRef.Namespace\n\tif databaseNamespace == \"\" {\n\t\tdatabaseNamespace = database.Namespace\n\t}\n\n\terr = m.Get(ctx, client.ObjectKey{Name: database.Spec.InstanceRef.Name, Namespace: databaseNamespace}, instance)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn []scaleway.Owner{\n\t\t{\n\t\t\tKey: types.NamespacedName{\n\t\t\t\tName: instance.Name,\n\t\t\t\tNamespace: instance.Namespace,\n\t\t\t},\n\t\t\tObject: &rdbv1alpha1.RDBInstance{},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "60a2a7bb084d14a2c85c49a8b5e096f7", "score": "0.4176018", "text": "func (s leadServer) GetUserLeads(ctx context.Context, req *core.UserLeadsRequest) (reply *core.UserLeadsReply, err error) {\n\tif req.UserId == 0 {\n\t\treturn nil, errors.New(\"user_id is required\")\n\t}\n\n\tuser, err := models.GetUserByID(uint(req.UserId))\n\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\treply = &core.UserLeadsReply{\n\t\tLeads: []*core.LeadInfo{},\n\t}\n\tleads, err := models.GetUserLeads(user, req.Role, req.RelatedShop, req.Limit, req.FromUpdatedAt, req.Direction)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\treply.Leads = leads.Encode()\n\treturn\n}", "title": "" }, { "docid": "6e5b27ec764cef4caf4d3aca3a3805ee", "score": "0.41700006", "text": "func (o *GetUserGetSpacesParams) WithID(id string) *GetUserGetSpacesParams {\n\to.SetID(id)\n\treturn o\n}", "title": "" }, { "docid": "16c7d01eea13012e6c9028b4507a1d47", "score": "0.4164865", "text": "func GetFoos(userID int, opts ...FooQueryOption) ([]*Foo, error) {\n\tm, err := GetUser(userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn m.GetFoos(opts...)\n}", "title": "" }, { "docid": "c1326a9a375895fe10e64161528fe749", "score": "0.41470143", "text": "func (friendship *Friendship) GetUser(id string) *errors.RestErr {\n\t// ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\t// if err := collection.FindOne(ctx, User{ID: user.ID}).Decode(&user); err != nil {\n\t// \treturn errors.NewInternalServerError(err.Error())\n\t// }\n\treturn nil\n}", "title": "" }, { "docid": "0608b48cdb11106b96b088e06890b8fa", "score": "0.4140507", "text": "func (user *User) GetUserDiaries(userID string) []Diary {\n\turlPath := fmt.Sprintf(path.UserHome, userID)\n\n\treturn doGetDiaries(user, urlPath)\n}", "title": "" }, { "docid": "b82e7311dd427d910a34a0743da8c27d", "score": "0.41364074", "text": "func GetManyUsersHandler(env *Env, w http.ResponseWriter, r *http.Request) error {\n\topts := govalidator.Options{\n\t\tRequest: r,\n\t\tRules: getManyUsersRules,\n\t}\n\tv := govalidator.New(opts)\n\tif e := v.Validate(); len(e) > 0 {\n\t\terr := map[string]interface{}{\"validationError\": e}\n\t\treturn StatusData{http.StatusBadRequest, err}\n\t}\n\n\tpayload := getManyUsersPayload{}\n\tpayload.Fields = r.URL.Query()[\"fields\"][0]\n\tpayload.Page, _ = strconv.Atoi(r.URL.Query()[\"page\"][0]) // nolint: gosec\n\tpayload.OrderBy = r.URL.Query()[\"orderby\"][0]\n\n\tctx := cnt.Background()\n\tuserManager := user_proto.NewUserCheckerClient(env.GRCPUser)\n\tstream, err := userManager.GetMany(ctx,\n\t\t&user_proto.ManyUsersOptions{\n\t\t\tPage: int64(payload.Page),\n\t\t\tOrderBy: payload.OrderBy,\n\t\t})\n\tif err := handleGeneralGrpcError(env, err); err != nil {\n\t\treturn err\n\t}\n\tdefer stream.CloseSend()\n\n\tanswer := []map[string]interface{}{}\n\tfieldsToReturn := strings.Split(payload.Fields, \",\")\n\n\tfor {\n\t\tu, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tenv.Logger.Errorw(\"Stream read error\",\n\t\t\t\t\"err\", err.Error(),\n\t\t\t)\n\t\t\treturn StatusData{\n\t\t\t\tCode: http.StatusBadRequest,\n\t\t\t\tData: map[string]string{\n\t\t\t\t\t\"error\": err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tanswer = append(answer, extractFields(u, fieldsToReturn))\n\t}\n\treturn StatusData{http.StatusOK, answer}\n}", "title": "" }, { "docid": "f4ebd467d4404f575d667d30ee20df54", "score": "0.413383", "text": "func (a *UserManagementApiService) UmUsersOwnsGet(ctx _context.Context, userId string, optionals *UmUsersOwnsGetOpts) (ResourcesUsers, *APIResponse, 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 ResourcesUsers\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/um/users/{userId}/owns\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"userId\"+\"}\", _neturl.PathEscape(parameterToString(userId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif optionals != nil && optionals.Pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*optionals.Pretty, \"\"))\n\t}\n\tif optionals != nil && optionals.Depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*optionals.Depth, \"\"))\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\tif optionals != nil && optionals.XContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*optionals.XContractNumber, \"\")\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\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"UmUsersOwnsGet\",\n\t}\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarAPIResponse.Payload = localVarBody\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarAPIResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarAPIResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarAPIResponse, 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, localVarAPIResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarAPIResponse, nil\n}", "title": "" }, { "docid": "bbfbcc0547e3123c3ae207d3bc81f2e7", "score": "0.4132295", "text": "func (ser *UserCharacterService) GetByUser(\n\tuID int, first *int, skip *int, tx db.Tx,\n) ([]*models.UserCharacter, error) {\n\treturn ser.GetFilter(first, skip, tx, func(uc *models.UserCharacter) bool {\n\t\treturn uc.UserID == uID\n\t})\n}", "title": "" }, { "docid": "faa6dbf5c0901dfba251ead95915d730", "score": "0.41256267", "text": "func (usrHdlr *UserHandler) GetManyUsers(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tuser, err := usrHdlr.usrSrv.GetManyUsers()\n\tif err != nil {\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\toutput, err := json.MarshalIndent(user, \"\", \"\\t\\t\")\n\tif err != nil {\n\t\tw.Header().Set(\"Content-type\", \"application/json\")\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.Write(output)\n\treturn\n}", "title": "" }, { "docid": "17a4c8117ccba160c17e8679d0e5921a", "score": "0.41192934", "text": "func GetProfileByIds(db interface{}) func(server.Request) (handler.Response, error) {\n\treturn func(req server.Request) (handler.Response, error) {\n\n\t\t// Parse model object\n\t\tvar model models.GetProfilesModel\n\t\tif err := json.Unmarshal(req.Body, &model); err != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Unmarshal models.GetProfilesModel array %s\", err.Error())\n\t\t\tprintln(errorMessage)\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError, Body: utils.MarshalError(\"getProfilesModelMarshalError\", errorMessage)}, nil\n\t\t}\n\n\t\t// Create service\n\t\tuserProfileService, serviceErr := service.NewUserProfileService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\n\t\tfoundUsers, err := userProfileService.FindProfileByUserIds(model.UserIds)\n\t\tif err != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\tbody, marshalErr := json.Marshal(foundUsers)\n\t\tif marshalErr != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Error while marshaling userProfiles: %s\",\n\t\t\t\tmarshalErr.Error())\n\t\t\treturn handler.Response{StatusCode: http.StatusBadRequest, Body: utils.MarshalError(\"marshalUserProfilesError\", errorMessage)},\n\t\t\t\tmarshalErr\n\n\t\t}\n\t\treturn handler.Response{\n\t\t\tBody: body,\n\t\t\tStatusCode: http.StatusOK,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "e9cc7e1a34440830cffb9beb52e47fb5", "score": "0.4116299", "text": "func (c *clientService) GetUsers(ctx context.Context) ([]model.User, error) {\n\treturn c.clientRepo.ShowUsers()\n}", "title": "" }, { "docid": "7bc4894d117bcd74322f9de552cdc871", "score": "0.41156426", "text": "func (o *Ops) GetRoomUsers(room string) []string {\n\treturn o.server.clientHolder.GetRoomUsers(room)\n}", "title": "" }, { "docid": "7d46a55b1eddbc5a4c2ba1b25870c34c", "score": "0.41138017", "text": "func (o *OrderController) FetchOrdersByUserID(ctx *gin.Context) {\n\tmp := make(map[string]interface{})\n\t_ = ctx.Bind(&mp)\n\n\tuserID := mp[\"user_id\"].(string)\n\n\tif userID == \"\" {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"message\": \"UserID not found!\"})\n\t\treturn\n\t}\n\n\torders, err := o.orderRepo.FetchOrdersByUserID(userID)\n\n\tif err != nil {\n\t\tctx.JSON(http.StatusInternalServerError, gin.H{\"message\": \"Unable to fetch orders!\", \"error\": err.Error()})\n\t} else {\n\t\tctx.JSON(http.StatusOK, gin.H{\"orders\": orders, \"message\": \"Orders Fetched Successfully\"})\n\t}\n}", "title": "" }, { "docid": "d3510a47eb133af8067aaccd41a4da15", "score": "0.41125724", "text": "func (api *API) GetUserAvatars(username string) (*Avatars, error) {\n\tresult := &Avatars{}\n\tstatusCode, err := api.doRequest(\n\t\t\"GET\", \"/rest/api/2/user/avatars?username=\"+username,\n\t\tEmptyParameters{}, result, nil, true,\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch statusCode {\n\tcase 200:\n\t\treturn result, nil\n\tcase 401:\n\t\treturn nil, ErrNoAuth\n\tcase 404:\n\t\treturn nil, ErrNoContent\n\tcase 500:\n\t\treturn nil, ErrGenResponse\n\tdefault:\n\t\treturn nil, makeUnknownError(statusCode)\n\t}\n}", "title": "" }, { "docid": "8cec830349e52d6fbee6cefa3446fbf4", "score": "0.41078857", "text": "func (this *User) GetRolesByUserId(responseWrite http.ResponseWriter, request *http.Request, params httprouter.Params) {\n\n\tuserId := request.FormValue(\"user_id\")\n\tif userId == \"\" {\n\t\tjsonError(responseWrite, \"user_id is not empty!\", nil)\n\t\treturn\n\t}\n\tdb := G.DB()\n\tvar rs *mysql.ResultSet\n\t//查找用户角色对应关系\n\trs, err := db.Query(db.AR().From(\"user_role\").Where(map[string]interface{}{\n\t\t\"user_id\": userId,\n\t}))\n\tif err != nil {\n\t\tjsonError(responseWrite, err.Error(), nil)\n\t\treturn\n\t}\n\tuserRoles := rs.Rows()\n\troleIds := []string{}\n\tfor _, userRole := range userRoles {\n\t\troleIds = append(roleIds, userRole[\"role_id\"])\n\t}\n\n\t//根据roleIds查找角色\n\trs, err = db.Query(db.AR().From(\"role\").Where(map[string]interface{}{\n\t\t\"role_id\": roleIds,\n\t}))\n\tif err != nil {\n\t\tjsonError(responseWrite, err.Error(), nil)\n\t\treturn\n\t}\n\troles := rs.Rows()\n\n\tjsonSuccess(responseWrite, \"ok\", roles)\n}", "title": "" }, { "docid": "359f0f7ae62724d9cb343001d3164fce", "score": "0.4100043", "text": "func GetUsers(w http.ResponseWriter, r *http.Request) {\n\t// Slice (array) donde se guardaran los datos\n\tusers := []models.Contact{}\n\t// Conexión a la DB\n\tdb := utils.GetConnection()\n\tdefer db.Close()\n\t// Consulta a la DB - SELECT * FROM users\n\tdb.Find(&users)\n\t// Se codifican los datos a formato JSON\n\tj, _ := json.Marshal(users)\n\t// Se envian los datos\n\tutils.SendResponse(w, http.StatusOK, j)\n}", "title": "" }, { "docid": "850c2fc6463ea01c760db700be358bab", "score": "0.40931398", "text": "func GetRooms(db *gorm.DB, userID uint) ([]*RoomDetail, error) {\n\trooms := []*RoomDetail{}\n\tsubquery := db.Select(\"usersrooms.*\").Table(\"usersrooms\").Where(\"user_id = ?\", userID).SubQuery()\n\trows, err := db.Select(`rooms.id, rooms.name, rooms.room_type,\n\t\tur.user_id IS NOT NULL as inroom, COALESCE(ur.unread, false) as unread`).\n\t\tTable(\"rooms\").\n\t\tJoins(\"LEFT JOIN ? as ur ON rooms.id = ur.room_id\", subquery).\n\t\tWhere(\"ur.user_id IS NOT NULL OR rooms.room_type = B'0'\").\n\t\tRows()\n\n\tif gorm.IsRecordNotFoundError(err) {\n\t\treturn rooms, nil\n\t}\n\n\tif err != nil {\n\t\treturn rooms, err\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\troom := &RoomDetail{}\n\t\terr = db.ScanRows(rows, room)\n\t\tif err != nil {\n\t\t\treturn []*RoomDetail{}, err\n\t\t}\n\t\trooms = append(rooms, room)\n\t}\n\treturn rooms, nil\n}", "title": "" }, { "docid": "39a0ab11b57399cacd602f8407d77cd1", "score": "0.40912038", "text": "func (d *Service) GetUsers(PokerID string) []*thunderdome.PokerUser {\n\tvar users = make([]*thunderdome.PokerUser, 0)\n\trows, err := d.DB.Query(\n\t\t`SELECT\n\t\t\tu.id, u.name, u.type, u.avatar, pu.active, pu.spectator, COALESCE(u.email, '')\n\t\tFROM thunderdome.poker_user pu\n\t\tLEFT JOIN thunderdome.users u ON pu.user_id = u.id\n\t\tWHERE pu.poker_id = $1\n\t\tORDER BY u.name`,\n\t\tPokerID,\n\t)\n\tif err == nil {\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar w thunderdome.PokerUser\n\t\t\tif err := rows.Scan(&w.Id, &w.Name, &w.Type, &w.Avatar, &w.Active, &w.Spectator, &w.GravatarHash); err != nil {\n\t\t\t\td.Logger.Error(\"error getting poker users\", zap.Error(err))\n\t\t\t} else {\n\t\t\t\tif w.GravatarHash != \"\" {\n\t\t\t\t\tw.GravatarHash = db.CreateGravatarHash(w.GravatarHash)\n\t\t\t\t} else {\n\t\t\t\t\tw.GravatarHash = db.CreateGravatarHash(w.Id)\n\t\t\t\t}\n\t\t\t\tusers = append(users, &w)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn users\n}", "title": "" }, { "docid": "37dfc36c65bab9c3fc8aa5a1d7c147f0", "score": "0.40898633", "text": "func (chatUsecase *ChatUsecase) GetUserRooms(username string) ([]domain.Room, error) {\n\tif roomIDs, err := chatUsecase.userRoomDomain.GetUserRooms(username); err != nil {\n\t\treturn []domain.Room{}, err\n\t} else {\n\t\tvar rooms []domain.Room\n\n\t\tfor _, roomID := range roomIDs {\n\t\t\tif room, found, err := chatUsecase.roomDomain.FindRoom(roomID); !found || err != nil {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn []domain.Room{}, err\n\t\t\t\t} else {\n\t\t\t\t\treturn []domain.Room{}, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trooms = append(rooms, room)\n\t\t\t}\n\t\t}\n\n\t\treturn rooms, nil\n\t}\n}", "title": "" }, { "docid": "3539fdb05475049c52bd659e39b0d853", "score": "0.40865391", "text": "func (uc UserController) GetUsers(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tcur, err := uc.collection.Find(context.TODO(), bson.D{{}})\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Get all restuls\n\tvar results []models.User\n\tfor cur.Next(context.TODO()) {\n\t\t// create a value into which the single document can be decoded\n\t\tvar elem models.User\n\t\terr := cur.Decode(&elem)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tresults = append(results, elem)\n\t}\n\n\t// Marshal and send back to user\n\tuj, _ := json.Marshal(results)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"%s\\n\", uj)\n}", "title": "" }, { "docid": "9e850adc2411683ab07a6210efea40a0", "score": "0.40852895", "text": "func GetAdUsersById(id int) (v *AdUsers, err error) {\n\to := orm.NewOrm()\n\tv = &AdUsers{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "f0ce7334134bb958754ef14b8fe6cd92", "score": "0.40794352", "text": "func (c *Client) UserEventAttendees(ctx context.Context, id string, request *UserEventAttendeesRequest) (*UserEventAttendeesResponse, error) {\n\tr := new(UserEventAttendeesResponse)\n\n\treturn r, c.getJSON(ctx, fmt.Sprintf(\"/users/%s/owned_event_attendees/\", id), request, r)\n\n}", "title": "" }, { "docid": "dceeea62f4d689e62b96679ae7e7d251", "score": "0.40766296", "text": "func (config *Connection) GetUsers(officeID, livingSpaceID string) ([]User, error) {\n\tvar (\n\t\terr error\n\t\tnewUsers []User\n\t\tusers []UserSpaces\n\t)\n\n\tswitch {\n\tcase officeID == \"\" && livingSpaceID != \"\":\n\t\terr = config.Model(&users).Where(\"Living_Space_ID = ?\", livingSpaceID).Select()\n\n\tcase livingSpaceID == \"\" && officeID != \"\":\n\t\terr = config.Model(&users).Where(\"Office_ID = ?\", officeID).Select()\n\n\tdefault:\n\t\terr = config.Model(&users).Where(\"Office_ID = ?\", officeID).Where(\"Living_Space_ID = ?\", livingSpaceID).Select()\n\t}\n\n\tif err != nil && err.Error() != \"pg: no rows in result set\" {\n\t\treturn newUsers, err\n\t}\n\n\tfor _, user := range users {\n\t\tnewUsers = append(newUsers, user.User)\n\t}\n\n\treturn newUsers, nil\n}", "title": "" }, { "docid": "d1f3efb9e3a2c78653508ca3779ef169", "score": "0.40735003", "text": "func (a *Client) GetUsersForSchool(params *GetUsersForSchoolParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersForSchoolOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetUsersForSchoolParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getUsersForSchool\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schools/{id}/users\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetUsersForSchoolReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetUsersForSchoolOK)\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 getUsersForSchool: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "ecccc35899851cdd7605d3e11ae8c33f", "score": "0.40701792", "text": "func (srv *Chat) GetChats(ctx context.Context, user *core.User) ([]*core.Chat, error) {\n\tchats, err := srv.Chat.Query().OwnerID(user.ID).All(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"query user chats\")\n\t}\n\treturn chats, nil\n}", "title": "" }, { "docid": "8ffaea1bb3983919dfe2b6ec64b00a07", "score": "0.40693915", "text": "func (a *API) FetchUserBots(id string) ([]Bot, error) {\n\tuser, err := a.FetchUser(id)\n\treturn user.Bots, err\n}", "title": "" }, { "docid": "af3b794e9b827426569b8232f3a823c0", "score": "0.4068994", "text": "func (h *Handler) GetUsers(w http.ResponseWriter, r *http.Request) {\n\tpage := &data.PagedQuery{Page: 2, PageSize: 10, Order: \"id asc\"}\n\tusers, err := h.Users.List(page)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ttotal, err := h.Users.Count()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresponse := &UsersResponse{\n\t\tUsers: ConvertUsersToUserResponse(users),\n\t\tTotal: total,\n\t}\n\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "48887317f323ff657b9df2d42fd1d0a1", "score": "0.40682995", "text": "func (s *SmartContract) GetAllUsers(ctx contractapi.TransactionContextInterface) ([]*Person, \n\terror) {\n\tresultsIterator, err := ctx.GetStub().GetStateByRange(\"\", \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resultsIterator.Close()\n\n\tvar persons []*Person\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar person Person\n\t\terr = json.Unmarshal(queryResponse.Value, &person)\n\t\tif err == nil {\n\t\t\tif strings.HasPrefix(person.ID, \"person\") {\n\t\t\t\tpersons = append(persons, &person)\n\t\t\t}\t\n\t\t}\n\t\t\n\t}\n\treturn persons, nil\n}", "title": "" }, { "docid": "fdd693fc7aa432ad32de1898c8f6daee", "score": "0.40649623", "text": "func GetUsersInARoom(db *gorm.DB, roomID uint) ([]*User, error) {\n\trows, err := db.Select(\"users.id, users.name\").\n\t\tTable(\"users\").\n\t\tJoins(\"LEFT JOIN usersrooms ON users.id = usersrooms.user_id\").\n\t\tWhere(\"usersrooms.room_id = ?\", roomID).Rows()\n\n\tif err != nil {\n\t\treturn []*User{}, err\n\t}\n\n\tusers := []*User{}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tuser := &User{}\n\t\terr = db.ScanRows(rows, user)\n\t\tif err != nil {\n\t\t\t// handle this error\n\t\t\treturn []*User{}, err\n\t\t}\n\t\tusers = append(users, user)\n\t}\n\treturn users, nil\n}", "title": "" }, { "docid": "d8c8a8516ebdd27e93a0eea9c09c38a8", "score": "0.406273", "text": "func (api *Api) UsersGet(idsi interface{}, args ...url.Values) (res []User, e error) {\n\tvar (\n\t\tids []string\n\t)\n\tswitch idsi := idsi.(type) {\n\tcase []string:\n\t\tids = idsi\n\tcase []int:\n\t\tids = arrIntToStr(idsi)\n\tcase int:\n\t\tids = []string{fmt.Sprint(idsi)}\n\tcase int64:\n\t\tids = []string{fmt.Sprint(idsi)}\n\tcase map[int]struct{}:\n\t\tfor k := range idsi {\n\t\t\tids = append(ids, fmt.Sprint(k))\n\t\t}\n\tdefault:\n\t\tids = []string{}\n\t}\n\n\tids = uniqStrArr(ids)\n\n\tif len(ids) == 0 {\n\t\treturn api.usersGet1K(ids, args...)\n\t}\n\n\tvar lim = 1000\n\tstop := false\n\tfor i := 0; i < len(ids) && !stop; i += lim {\n\n\t\tif len(ids)-1 < i+lim {\n\t\t\tlim = (len(ids)) - i\n\t\t\tstop = true\n\t\t}\n\t\t//color.Cyan(\"%v %v\", ids[i:i+lim], ids)\n\t\tusers, e := api.usersGet1K(ids[i:i+lim], args...)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tres = append(res, users...)\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8a1493d676184fe4f5e601dbca92b08e", "score": "0.40611243", "text": "func (a *Client) GetUsers(params *GetUsersParams, authInfo runtime.ClientAuthInfoWriter) (*GetUsersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetUsersParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getUsers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/users\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetUsersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetUsersOK)\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 getUsers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "2dfb2dda14fad5178e44a25105361646", "score": "0.40561193", "text": "func (o *Orders) GetUserOrders(w http.ResponseWriter, r *http.Request) {\n\n\to.l.Println(\"Handle GET Orders\")\n\n\tvars := mux.Vars(r)\n\tuserID, _ := strconv.ParseUint(vars[\"user\"], 10, 64)\n\torders := models.GetAll(userID)\n\tToJSON(w, orders, http.StatusOK)\n}", "title": "" }, { "docid": "f9a54392bffb0df13330a2e4d5b6e52e", "score": "0.40561154", "text": "func (h *Handlers) GetOwnedByUser(w http.ResponseWriter, r *http.Request) {\n\tjsonData, err := h.hubAPI.ChartRepositories.GetOwnedByUserJSON(r.Context())\n\tif err != nil {\n\t\th.logger.Error().Err(err).Str(\"method\", \"GetOwnedByUser\").Send()\n\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\thelpers.RenderJSON(w, jsonData, 0)\n}", "title": "" }, { "docid": "c7814b8c3557a98caf3bf7627c1b66aa", "score": "0.40558502", "text": "func (theService userbookService) GetUserBooks(bearer string, userId int, offset int, limit int, bookId int, title string, tags []string) (UserBooks, error) {\n\t////////////////////\n\t// Get data from mysql\n\t// mysql\n\tif err := theService.mysqlDb.Ping(); err != nil {\n\t\ttheService.mysqlDb.Close()\n\t\treturn UserBooks{}, errors.New(\"unable to ping mysql\")\n\t}\n\n\tif len(title) > 0 ||\n\t\tlen(tags) > 0 ||\n\t\tbookId > 0 {\n\t\treturn theService.getUserBooksByFilter(bearer, userId, offset, limit, bookId, title, tags)\n\t} else {\n\t\treturn theService.getAllUserBooks(bearer, userId, offset, limit)\n\t}\n}", "title": "" }, { "docid": "7e332f8756e99908a28218d6be520d93", "score": "0.40539983", "text": "func (t *Agency) GetUsers() {\n\tCheckPermission(t.Ctx, common.GetStaticPermissions().Agency.View)\n\tt.RenderJSON(m.GetUsers(GetLoginStatus(t.Ctx.Request()).ID, false), http.StatusOK)\n}", "title": "" }, { "docid": "1f8c65a4bb1e204e9bfc71217cb8374a", "score": "0.40538764", "text": "func (repository *Repository) GetByUser(ctx context.Context, userId string) ([]UsersReceipt, error) {\n\tcollection := repository.getCollection()\n\n\tid, err := primitive.ObjectIDFromHex(userId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcursor, err := collection.Find(ctx, bson.D{{\"owner\", id}})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer dispose.Dispose(func() error {\n\t\treturn cursor.Close(ctx)\n\t}, \"error while mongo cursor close\")\n\treceipts := readReceipts(cursor, ctx)\n\treturn receipts, nil\n}", "title": "" }, { "docid": "8ef17df2098d677f57aebb3f7d2ab512", "score": "0.4052357", "text": "func GetUsersById(id int) (v *Users, err error) {\n\to := orm.NewOrm()\n\tv = &Users{Id: id}\n\tif err = o.Read(v); err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "73b6aae7808f71c88859ced6e532676c", "score": "0.40513176", "text": "func GetOrdersByUser(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tdata := []model.Order{}\n\tvars := mux.Vars(r)\n\tuid := vars[\"uid\"]\n\tif err := db.Where(\"uid=?\", uid).Find(&data).Error; err != nil {\n\t\trespondError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\trespondJSON(w, http.StatusOK, data)\n}", "title": "" }, { "docid": "9afa5a8efaea7f23913afb4d8728a310", "score": "0.40490136", "text": "func (a *API) GetUsers(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\n\tvar users []User\n\tvar userTmp User\n\n\tid := r.FormValue(\"id\")\n\tuserTmp.ID, err = strconv.Atoi(id)\n\tif err != nil {\n\t\ta.Log.Error(\"problem with convert string to int (id) | Error: \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"ERROR\"))\n\t\treturn\n\t}\n\n\tuserTmp.FirstName = r.FormValue(\"first_name\")\n\n\tuserTmp.SecondName = r.FormValue(\"second_name\")\n\n\trID := r.FormValue(\"role_id\")\n\tuserTmp.RoleID, err = strconv.Atoi(rID)\n\tif err != nil {\n\t\ta.Log.Error(\"problem with convert string to int (role_id) | Error: \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"ERROR\"))\n\t\treturn\n\t}\n\n\terr = a.DB.Where(&userTmp).Find(&users).Error\n\tif err != nil {\n\t\ta.Log.Error(\"Get query error | Error: \", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"ERROR\"))\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(users)\n}", "title": "" }, { "docid": "70d29fa6231c65d22e0175e13d0341d8", "score": "0.40469077", "text": "func GetUsers(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdb, err := db.Open()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\tdb = util.SetDBPagination(db, r)\n\n\tvar users types.Users\n\tif err := users.Get(db); err != nil {\n\t\tutil.ErrorResponder(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tutil.PaginationResponder(w, r, users)\n}", "title": "" }, { "docid": "05dc63874a04433595550245888c95a8", "score": "0.40458935", "text": "func (d *Service) GetGamesByUser(UserID string, Limit int, Offset int) ([]*thunderdome.Poker, int, error) {\n\tvar Count int\n\tvar games = make([]*thunderdome.Poker, 0)\n\n\te := d.DB.QueryRow(`\n\t\tSELECT COUNT(*) FROM thunderdome.poker b\n\t\tLEFT JOIN thunderdome.poker_user bw ON b.id = bw.poker_id\n\t\tWHERE bw.user_id = $1 AND bw.abandoned = false;\n\t`, UserID).Scan(\n\t\t&Count,\n\t)\n\tif e != nil {\n\t\treturn nil, Count, e\n\t}\n\n\tgameRows, gamesErr := d.DB.Query(`\n\t\tSELECT b.id, b.name, b.voting_locked, COALESCE(b.active_story_id::text, ''), b.point_values_allowed, b.auto_finish_voting,\n\t\t b.point_average_rounding, b.created_date, b.updated_date,\n\t\tCASE WHEN COUNT(p) = 0 THEN '[]'::json ELSE array_to_json(array_agg(row_to_json(p))) END AS stories,\n\t\tCASE WHEN COUNT(bl) = 0 THEN '[]'::json ELSE array_to_json(array_agg(bl.user_id)) END AS facilitators\n\t\tFROM thunderdome.poker b\n\t\tLEFT JOIN thunderdome.poker_story p ON b.id = p.poker_id\n\t\tLEFT JOIN thunderdome.poker_facilitator bl ON b.id = bl.poker_id\n\t\tLEFT JOIN thunderdome.poker_user bw ON b.id = bw.poker_id\n\t\tWHERE bw.user_id = $1 AND bw.abandoned = false\n\t\tGROUP BY b.id ORDER BY b.created_date DESC\n\t\tLIMIT $2 OFFSET $3\n\t`, UserID, Limit, Offset)\n\tif gamesErr != nil {\n\t\treturn nil, Count, errors.New(\"not found\")\n\t}\n\n\tdefer gameRows.Close()\n\tfor gameRows.Next() {\n\t\tvar stories string\n\t\tvar pv string\n\t\tvar facilitators string\n\t\tvar b = &thunderdome.Poker{\n\t\t\tUsers: make([]*thunderdome.PokerUser, 0),\n\t\t\tStories: make([]*thunderdome.Story, 0),\n\t\t\tVotingLocked: true,\n\t\t\tPointValuesAllowed: make([]string, 0),\n\t\t\tAutoFinishVoting: true,\n\t\t\tFacilitators: make([]string, 0),\n\t\t}\n\t\tif err := gameRows.Scan(\n\t\t\t&b.Id,\n\t\t\t&b.Name,\n\t\t\t&b.VotingLocked,\n\t\t\t&b.ActiveStoryID,\n\t\t\t&pv,\n\t\t\t&b.AutoFinishVoting,\n\t\t\t&b.PointAverageRounding,\n\t\t\t&b.CreatedDate,\n\t\t\t&b.UpdatedDate,\n\t\t\t&stories,\n\t\t\t&facilitators,\n\t\t); err != nil {\n\t\t\td.Logger.Error(\"error getting poker by user\", zap.Error(e))\n\t\t} else {\n\t\t\t_ = json.Unmarshal([]byte(stories), &b.Stories)\n\t\t\t_ = json.Unmarshal([]byte(pv), &b.PointValuesAllowed)\n\t\t\t_ = json.Unmarshal([]byte(facilitators), &b.Facilitators)\n\n\t\t\tgames = append(games, b)\n\t\t}\n\t}\n\n\treturn games, Count, nil\n}", "title": "" }, { "docid": "afdfd56ab8624f90d72cd9d941a0a548", "score": "0.4039278", "text": "func (o *InvestmentsAuthGetResponse) GetOwners() []InvestmentsAuthOwner {\n\tif o == nil {\n\t\tvar ret []InvestmentsAuthOwner\n\t\treturn ret\n\t}\n\n\treturn o.Owners\n}", "title": "" }, { "docid": "f9735ab73bdcd5162b1e73048553235b", "score": "0.40379205", "text": "func GetUserById(c echo.Context) error {\n\tex := &models.User{UID: intParam(c, Uid), GID: -1}\n\tusers := userService(c).FindUsers(ex)\n\tif len(users) == 0 {\n\t\treturn c.JSON(http.StatusNotFound, \"not found\")\n\t}\n\treturn c.JSONPretty(http.StatusOK, users[0], Indent)\n}", "title": "" }, { "docid": "96a5fc9da2857763d6f20a55e58abc54", "score": "0.40359527", "text": "func (a UsersApi) ApiUsersInvitationsIdGet(id string) (*InvitationResource, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/api/users/invitations/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(APIKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-Octopus-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-Octopus-ApiKey\")\n\t// authentication '(APIKeyQuery)' required\n\t// set key with prefix in query string\n\tlocalVarQueryParams[\"ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"ApiKey\")\n\t// authentication '(NugetApiKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-NuGet-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-NuGet-ApiKey\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new(InvitationResource)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"ApiUsersInvitationsIdGet\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "c184b930b78643f4f3852c07aaf813c3", "score": "0.40340817", "text": "func GetUsers(w http.ResponseWriter, r *http.Request) {\n\tvar user model.User\n\tvar arrUser []model.User\n\tvar response model.ResponseUsers\n\n\tdb := database.Connect()\n\tdefer db.Close()\n\n\trows, err := db.Query(\"Select user_id, username, fullname, email, birthday from users\")\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&user.ID, &user.Username, &user.Fullname, &user.Email, &user.Birthday); err != nil {\n\t\t\tlog.Fatal(err.Error())\n\n\t\t} else {\n\t\t\tarrUser = append(arrUser, user)\n\t\t}\n\t}\n\n\tresponse.Status = 200\n\tresponse.Message = \"Success\"\n\tresponse.Data = arrUser\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "17e03a43aa5f46c047100e60244b5fc6", "score": "0.40340185", "text": "func (m *EducationSchool) GetUsers()([]EducationUserable) {\n val, err := m.GetBackingStore().Get(\"users\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]EducationUserable)\n }\n return nil\n}", "title": "" }, { "docid": "208c44325ed2012264aeb37f669e46c5", "score": "0.40335023", "text": "func (c *Client) pollCarForUserID(userID string) ([]byte, error) {\n\ttoken, err := c.tokenForUserID(userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tteslaClient := &ownerapi.Client{\n\t\tHttpClient: c.HTTPClient,\n\t\tOwnerAPIAuthResponse: &ownerapi.OwnerAPIAuthResponse{\n\t\t\tAccessToken: token,\n\t\t},\n\t}\n\tresp, err := teslaClient.GetVehiclesList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// for now only poll the first vehicle\n\tif resp.Count > 0 {\n\t\tfirstID := resp.Response[0].ID\n\n\t\twakeResp, err := teslaClient.WakeUp(firstID)\n\t\tif err != nil || wakeResp.Response.State != \"online\" {\n\t\t\treturn nil, fmt.Errorf(\"failed to wake up vehicle for user: %s | id: %d\", userID, firstID)\n\t\t}\n\n\t\tresp, err := teslaClient.GetVehicleData(firstID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get vehicle data for user: %s | id: %d\", userID, firstID)\n\t\t}\n\t\treturn resp, nil\n\t}\n\treturn nil, errors.New(\"No available vehicles for given userID\")\n}", "title": "" }, { "docid": "39c20282f88b690d6155a385b5a40fb0", "score": "0.40321782", "text": "func (userService *UserService) Get(organizationID int) ([]Organizations_Users, responses.ErrorData) {\n\tusers, err := userService.userRepo.Get(organizationID)\n\tif err != nil {\n\t\treturn []Organizations_Users{}, responses.HandleError(http.StatusInternalServerError, err.Error())\n\t}\n\treturn users, responses.ErrorData{}\n}", "title": "" }, { "docid": "57d57872b84e740e3adec59f70a88599", "score": "0.40310502", "text": "func GetManyUserNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.UserController, id []string) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := id\n\t\tquery[\"id\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v1/user/user/multi\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := id\n\t\tprms[\"id\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"UserTest\"), rw, req, prms)\n\tgetManyCtx, _err := app.NewGetManyUserContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\n\t// Perform action\n\t_err = ctrl.GetMany(getManyCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "278dfea033b0b04fa12cd6cfeb4e1768", "score": "0.40306398", "text": "func (u UserHandler) GetUsers(ctx context.Context, params api.GetUsersParams) middleware.Responder {\n\t// validateErr := u.userService.Validate(params.HTTPRequest.Header.Get(\"X-API-Key\"), \"\")\n\t// if validateErr != nil {\n\t// \terr := models.Error{\n\t// \t\tMessage: validateErr.Error(),\n\t// \t}\n\t// \treturn api.NewGetUsersUnauthorized().WithPayload(&err)\n\t// }\n\tuserResponse := &models.UserResponse{}\n\tuserList, err := u.userService.GetUsers()\n\tif err != nil {\n\t\tpostErr := fmt.Errorf(\"failed to get the users: %w\", err)\n\t\tlogrus.Warnf(postErr.Error())\n\t\tresponseErr := &models.Response{\n\t\t\tStatus: \"Failed\",\n\t\t\tCode: 400,\n\t\t\tMessage: postErr.Error(),\n\t\t}\n\t\treturn api.NewGetUsersBadRequest().WithPayload(responseErr)\n\t}\n\n\tlogrus.Infoln(\"We get the User List:\", userList)\n\tuserResponse.Response = &models.Response{\n\t\tCode: 200,\n\t\tStatus: \"Success\",\n\t\tMessage: \"Users has been fetched Successfully\",\n\t}\n\tuserResponse.Users = userList\n\n\treturn api.NewGetUsersOK().WithPayload(userResponse)\n}", "title": "" }, { "docid": "b3eb19166f8eb71b63b84877cc985728", "score": "0.40287495", "text": "func (dc *DeviceController) GetByUserWithEvents(ctx context.Context, user primitive.ObjectID) ([]DeviceEvents, error) {\n\tcursor, err := dc.collection.Find(ctx, bson.M{\"user\": user})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tec, err := NewEventController()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdevices := make([]DeviceEvents, 0)\n\n\tfor cursor.Next(ctx) {\n\t\tvar device Device\n\t\tvar deviceEvent DeviceEvents\n\t\tif err := cursor.Decode(&device); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdeviceEvent.SetDevice(device)\n\n\t\tevents, err := ec.GetByDevice(ctx, device.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdeviceEvent.Events = events\n\n\t\tdevices = append(devices, deviceEvent)\n\t}\n\n\treturn devices, nil\n}", "title": "" } ]
9f6686a871725e8b1bda0ab90c961cdb
UnmarshalJSON supports json.Unmarshaler interface
[ { "docid": "2ec7709f88521c708ea435bd362d0a5b", "score": "0.0", "text": "func (v *GetIndustryFacilities200OkList) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB29675b3DecodeGithubComAntihaxGoesiEsi(&r, v)\n\treturn r.Error()\n}", "title": "" } ]
[ { "docid": "334ade55ffcd1b6e65a825f25dc0fb35", "score": "0.7140971", "text": "func (j *Rich) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "4ebd651884a6e4cd4c69219c0e90c3dc", "score": "0.698139", "text": "func unmarshalJSON(j extv1.JSON, output *any) error {\n\tif len(j.Raw) == 0 {\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(j.Raw, output)\n}", "title": "" }, { "docid": "c7131cb5bd9e0a12236b01a8a6c98f0e", "score": "0.6963972", "text": "func (j *Provider) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "3e27ed8973aab859cb0ca07b12592d41", "score": "0.69538194", "text": "func (j *Bot) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "d1fb3116aeece974046eeee786238f75", "score": "0.69307494", "text": "func (jc JsonCracker) Unmarshal(data []byte, dest interface{}) error {\n\treturn jc.Json.Unmarshal(data, dest)\n}", "title": "" }, { "docid": "566bc3150e021c71b3e5e79538f07f3e", "score": "0.68660766", "text": "func unmarshal(b []byte, target interface{}) error {\n\tjson.Unmarshal(b, &target)\n\treturn nil\n}", "title": "" }, { "docid": "6ae02c0fc5db3ff53b1b90ad277bb774", "score": "0.68653154", "text": "func UnmarshalJSON(data []byte, v interface{}) error {\n\tif vm, ok := v.(easyjson.Unmarshaler); ok {\n\t\treturn easyjson.Unmarshal(data, vm)\n\t}\n\n\tif vm, ok := v.(json.Unmarshaler); ok {\n\t\treturn vm.UnmarshalJSON(data)\n\t}\n\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "b2ff153cfba787246619fa24269e63c5", "score": "0.6744858", "text": "func (j *Contract) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "c3bb6ecd7ce3ba00ac5f46d3ef96c595", "score": "0.6658554", "text": "func Unmarshal(jsonContent string, dest interface{}) (err error) {\n\tcontent := []byte(jsonContent)\n\terr = json.Unmarshal(content, dest)\n\treturn\n}", "title": "" }, { "docid": "f15d0a2e7eba406129e925c84875bee6", "score": "0.6631095", "text": "func (v *Bft) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita20(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "66ae89accfad33f11f7d3fea09fe3ab4", "score": "0.66304517", "text": "func UnmarshalJSON(body io.ReadCloser, v interface{}) error {\n\tdefer body.Close()\n\terr := json.NewDecoder(body).Decode(&v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d4ae3ca018733b22084e46de90d45f5e", "score": "0.65938544", "text": "func (j *BidResponse) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "852d7986335bbd948e744a38307d410d", "score": "0.65743035", "text": "func Unmarshal(data []byte, v interface{}) error {\n\tast, err := Parse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tast.Standardize()\n\tdata = ast.Pack()\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "91716cc4c556826b37e0dc5ba48a612e", "score": "0.6564567", "text": "func (j *OEmbed) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "44e63ca0df3ea9a286d8d6c491e515fc", "score": "0.6537283", "text": "func (j *Error) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "9441206b4458ea93f819b99dc7b2bf89", "score": "0.65357584", "text": "func (v *BodyTrue) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita18(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a69d0170d633ea32088a1ea9bb54eebd", "score": "0.65164477", "text": "func JSONUnmarshal(msg drpc.Message, enc drpc.Encoding, buf []byte) error {\n\tif enc, ok := enc.(interface {\n\t\tJSONUnmarshal(buf []byte, msg drpc.Message) error\n\t}); ok {\n\t\treturn enc.JSONUnmarshal(buf, msg)\n\t}\n\n\t// fallback to JSON Unmarshal + normal Unmarshal\n\tvar data []byte\n\tif err := json.Unmarshal(buf, &data); err != nil {\n\t\treturn err\n\t}\n\treturn enc.Unmarshal(data, msg)\n}", "title": "" }, { "docid": "6f3a62216a519309fa358454a9119e86", "score": "0.6513576", "text": "func UnmarshalJSON(r io.Reader, v interface{}) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(body, v)\n}", "title": "" }, { "docid": "6f3a62216a519309fa358454a9119e86", "score": "0.6513576", "text": "func UnmarshalJSON(r io.Reader, v interface{}) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(body, v)\n}", "title": "" }, { "docid": "d7e063f92f46d7e6f1c744a28902c997", "score": "0.65000945", "text": "func (j *BlindInput) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "70234bf1e7577c51f2856ab7e2d59213", "score": "0.64917207", "text": "func (j *BlindOutput) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "d3c1e62581f82cabff8f79008257c696", "score": "0.6487749", "text": "func (j *EventHolder) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "ec7662d9807e4a4113dd923f0b22cf3c", "score": "0.6473282", "text": "func (sj *SerializerJSON) Unmarshal(data []byte, protoData proto.Message) error {\n\treturn json.Unmarshal(data, protoData)\n}", "title": "" }, { "docid": "b64f60f4acab8628d1ad1549792c43ce", "score": "0.64637876", "text": "func (j *JSON) UnmarshalJSON(b []byte) error {\n\tstr := string(b)\n\tif !gjson.Valid(str) {\n\t\treturn fmt.Errorf(\"invalid JSON: %v\", str)\n\t}\n\t*j = JSON{gjson.Parse(str)}\n\treturn nil\n}", "title": "" }, { "docid": "b64f60f4acab8628d1ad1549792c43ce", "score": "0.64637876", "text": "func (j *JSON) UnmarshalJSON(b []byte) error {\n\tstr := string(b)\n\tif !gjson.Valid(str) {\n\t\treturn fmt.Errorf(\"invalid JSON: %v\", str)\n\t}\n\t*j = JSON{gjson.Parse(str)}\n\treturn nil\n}", "title": "" }, { "docid": "a0b8a1924b52d513840fb09d2774b786", "score": "0.64540136", "text": "func (j *JSON) UnmarshalJSON(data []byte) error {\n\tif string(data) == \"null\" {\n\t\t*j = nil\n\t\treturn nil\n\t}\n\n\tvar jj json.RawMessage\n\terr := json.Unmarshal(data, &jj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*j = JSON(jj)\n\treturn nil\n}", "title": "" }, { "docid": "0a8f4401a4d86bf376a181cf627f9831", "score": "0.6425901", "text": "func (s *JSONMapItem) UnmarshalJSON(data []byte) error {\n\tl := jlexer.Lexer{Data: data}\n\ts.UnmarshalEasyJSON(&l)\n\treturn l.Error()\n}", "title": "" }, { "docid": "2feb326205804ca59b413a752c31db4b", "score": "0.6420283", "text": "func (g *Generator) JSONUnmarshaler(t types.Type) (code meta.Code) {\n\treturn g.Code(`\n\tif err := n.WrapUnmarshalJSON(r); err != nil {\n\t\treturn err\n\t}\n\t`)\n}", "title": "" }, { "docid": "d7fd89067e351382533dbaa3bca4c0fa", "score": "0.641077", "text": "func (input *Input) UnmarshalJSON(b []byte) error {\n\td, err := input.ToData()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(b, d); err != nil {\n\t\treturn err\n\t}\n\treturn d.ToInput(input)\n}", "title": "" }, { "docid": "ddd35632bd78d2d98af9163cd3fa528a", "score": "0.63855124", "text": "func (j *Event) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "416a2f5507b3de3e894e468b4f4d68ca", "score": "0.6382176", "text": "func (j *AccessResponse) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "88d5e96c2dd5525182f3eed85f836b18", "score": "0.63740736", "text": "func (t *Then) UnmarshalJSON(data []byte) error {\n\tvar sch Schema\n\tif err := json.Unmarshal(data, &sch); err != nil {\n\t\treturn err\n\t}\n\t*t = Then(sch)\n\treturn nil\n}", "title": "" }, { "docid": "30d982b6cdbf4b0f58604e7b46f95799", "score": "0.63729256", "text": "func GoldenJSONUnmarshal(t *testing.T, filename string, input interface{}) {\n\t_bytes := GetGolden(t, filename)\n\n\terr := json.Unmarshal(_bytes, &input)\n\n\tif err != nil {\n\t\tt.Fatal(t)\n\t}\n}", "title": "" }, { "docid": "25ab983ac936bdbecb6076a6138ef3c0", "score": "0.6365255", "text": "func unmarshal(body *http.Response, target interface{}) error {\n\tdefer body.Body.Close()\n\treturn json.NewDecoder(body.Body).Decode(target)\n}", "title": "" }, { "docid": "78ccac22bc4e906a41eff3b81f5a673a", "score": "0.63553596", "text": "func FromJSON(i interface{}, r io.Reader) error {\n\td := json.NewDecoder(r)\n\treturn d.Decode(i)\n}", "title": "" }, { "docid": "d813c4ba1c60f9fa44f2e6406f3f8e53", "score": "0.63552856", "text": "func (v *FormulaAndFunctionResponseFormat) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = FormulaAndFunctionResponseFormat(value)\n\treturn nil\n}", "title": "" }, { "docid": "c6e65ee8c683a14ff1902ec1a3ddc0ac", "score": "0.635526", "text": "func (j *Endpoint) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "60fd4fd4a87b8908c43c9224dcd5b09d", "score": "0.63522035", "text": "func JsonUnmarshal(b []byte, v interface{}) error {\n\treturn json.Unmarshal(\n\t\tb,\n\t\tconjson.NewUnmarshaler(v, transform.ConventionalKeys()),\n\t)\n}", "title": "" }, { "docid": "9f7dbc63bae53150dac2c6c30376d729", "score": "0.63452035", "text": "func (u *Unstructured) UnmarshalJSON(b []byte) error {\n\treturn json.Unmarshal(b, &u.Object)\n}", "title": "" }, { "docid": "1d4c8874cdb8cb56201f8b6ceb749ca1", "score": "0.6344103", "text": "func (j *SubmitOutput) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "51865b20d84757e31ddfd64afaff695f", "score": "0.6333432", "text": "func (j *Video) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "c90cd2fce43de6add1f69233995c1898", "score": "0.6331771", "text": "func UnmarshalJSON(url string, target interface{}) error {\n\tr, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Body.Close()\n\treturn json.NewDecoder(r.Body).Decode(target)\n}", "title": "" }, { "docid": "71e93266d8fd9770b51130ad9c993f65", "score": "0.63267696", "text": "func FromJson(i interface{}, r io.Reader) error {\n\tdecoder := json.NewDecoder(r)\n\n\treturn decoder.Decode(i)\n}", "title": "" }, { "docid": "6ae19f1f7e87aab7aa66e1b0156b1a34", "score": "0.63171005", "text": "func (s *Source) UnmarshalJSON(b []byte) error {\n\tvar unpacker sourceUnpacker\n\tif err := json.Unmarshal(b, &unpacker); err != nil {\n\t\treturn err\n\t}\n\n\ts.Type = unpacker.Type\n\n\tswitch s.Type {\n\tcase \"directory\":\n\t\tif target, err := strconv.Unquote(string(unpacker.Target)); err == nil {\n\t\t\ts.Target = target\n\t\t} else {\n\t\t\ts.Target = string(unpacker.Target[:])\n\t\t}\n\n\tcase \"image\":\n\t\tvar payload source.ImageMetadata\n\t\tif err := json.Unmarshal(unpacker.Target, &payload); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.Target = payload\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported package metadata type: %+v\", s.Type)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9440c18d238ac85600e20d6cc0995674", "score": "0.6313641", "text": "func Unmarshal[T absser.Parsable](data []byte, model *T, parser absser.ParsableFactory) error {\n\tjpn, err := absser.DefaultParseNodeFactoryInstance.GetRootParseNode(\"application/json\", data)\n\tif err != nil {\n\t\tif jpn, err = NewJsonParseNode(data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tv, err := jpn.GetObjectValue(parser)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif v != nil {\n\t\t*model = v.(T)\n\t} else {\n\t\t// hand off to the std library to set model to its zero value\n\t\treturn json.Unmarshal(data, model)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cefc8c1dbe223fec334732f44d73bc41", "score": "0.63090956", "text": "func (v *ResultMetaData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3821a52ea649278b3faff1a26b1191b7", "score": "0.63070756", "text": "func (v *Filter) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita15(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2f1a74dccd1fc254d215c5d97bf724ac", "score": "0.6296437", "text": "func DecoderDecode(dec *json.Decoder, v interface{}) error", "title": "" }, { "docid": "d14b4b6b39068d1b15417c76df42b823", "score": "0.62949824", "text": "func (x *JSONObject) UnmarshalJSON(src []byte) error {\n\tif string(src) == \"null\" {\n\t\tx.Data = nil\n\t\treturn nil\n\t}\n\n\tvar iface map[string]interface{}\n\tif err := json.Unmarshal(src, &iface); err != nil {\n\t\treturn err\n\t}\n\n\tvar err error\n\tx.Data, err = structpb.NewStruct(iface)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "042707c783b56cf9c572f742bceabb28", "score": "0.62882787", "text": "func Unmarshal(src []byte, dst interface{}) error {\n\tparser := Parse(string(src))\n\tobj, err := parser.ReadObject()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !parser.EOF() {\n\t\treturn errors.New(\"js: object has not ended\")\n\t}\n\tbin, _ := json.Marshal(obj)\n\treturn json.Unmarshal(bin, dst)\n}", "title": "" }, { "docid": "d91aaf0139cf006992128bceccd453e7", "score": "0.62811816", "text": "func (v *TransactionParser) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson461f4b12DecodeGithubComKamaiuOandaGoModel2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "05889c4ecf9333717919017350eeb6f0", "score": "0.62792957", "text": "func (v *tag) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "32a08ccce851236f3748062f542b3ab0", "score": "0.6276269", "text": "func (v *MyBody) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson635ef9aeDecodeGithubComUberZanzibarRuntime(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "58269dbce8c278bebfe926871929f371", "score": "0.6272721", "text": "func (v *user) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9e1087fdDecodeFakeCom(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a26efef738cc07f30b4b3a81afc5dcc2", "score": "0.6271682", "text": "func (j *Witness) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "e6d2314e0681574d042a91a958b08ce0", "score": "0.62706393", "text": "func (t *Table) UnmarshalJSON(b []byte) error {\n\tt1, err := FromJSON(string(b))\n\tif err == nil {\n\t\t*t = *t1\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "3b44e5bab9d9de4b6eacfb669365e952", "score": "0.62679577", "text": "func (j *OrderBook) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "347f6cc6145a2f5c282d0cfff6726fea", "score": "0.62646323", "text": "func (v *IPTranslation) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonF642ad3eDecodeGithubComDataDogDatadogProcessAgentNetlink(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "299284d3ada3c6a3f10947cd82502b73", "score": "0.6264114", "text": "func (e *JSONEncoding) Unmarshal(data []byte, dataType interface{}) error {\n\treturn json.Unmarshal(data, dataType)\n}", "title": "" }, { "docid": "55c352082dc1e1404e85bdcd1adfac82", "score": "0.6260028", "text": "func (v *Data) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2718c19ba07eb8a2c7cdea663d2c3456", "score": "0.62591976", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3486653aDecodeCourseraHw3Bench(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "660ee67741e217713ed557ac71355784", "score": "0.62570214", "text": "func TestUnmarshal(t *testing.T) {\n\tvar dst JsonnetFile\n\terr := json.Unmarshal([]byte(jsonJF), &dst)\n\trequire.NoError(t, err)\n\tassert.Equal(t, testData(), dst)\n}", "title": "" }, { "docid": "c727da793300ddefed032339fc751328", "score": "0.6253198", "text": "func JSONUnmarshal(buf []byte, msg drpc.Message) error {\n\treturn protojson.Unmarshal(buf, msg.(proto.Message))\n}", "title": "" }, { "docid": "9c22c01f38acd23dbb16765f47b1423a", "score": "0.6247443", "text": "func (v *Validator) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComJopoleonMinterTestPps(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9bfb9196439c481d8c84caef7dc10194", "score": "0.6242641", "text": "func (v *Response) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9cce455ef8eaf1cbf91d20e8c936c619", "score": "0.62394345", "text": "func (g jsonEncoding) Unmarshal(data []byte, objs []interface{}) error {\n\tdec := json.NewDecoder(bytes.NewBuffer(data))\n\tdec.UseNumber()\n\tfor i, obj := range objs {\n\t\tif err := dec.Decode(obj); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"unable to decode argument: %d, %v, with json error: %v\", i, reflect.TypeOf(obj), err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "118e6533cd14243dcd04957be007bdb4", "score": "0.62362266", "text": "func (i *Interface) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &i.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &i.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &i.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &i.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e84f2fb736ca3c12911d143ca4b3bbef", "score": "0.62350893", "text": "func (t *DeepCachingType) UnmarshalJSON(data []byte) error {\n\tif string(data) == \"null\" {\n\t\t*t = DeepCachingTypeNever\n\t\treturn nil\n\t}\n\ts, err := strconv.Unquote(string(data))\n\tif err != nil {\n\t\treturn errors.New(string(data) + \" JSON not quoted\")\n\t}\n\t*t = DeepCachingTypeFromString(s)\n\tif *t == DeepCachingTypeInvalid {\n\t\treturn errors.New(string(data) + \" is not a DeepCachingType\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f07df44b70621ea646d9653ef70c8ee", "score": "0.62295926", "text": "func (fi *Info) Unmarshal(data []byte) {\n\terr := json.Unmarshal(data, fi)\n\tif err != nil {\n\t\tmyLogger.Print(err)\n\t}\n}", "title": "" }, { "docid": "cf4562960d54f8e559a8374fc9849f92", "score": "0.6225157", "text": "func TestJSONUnmarshalErrors(t *testing.T) {\n\trequire := require.New(t)\n\t// encoding/json considers and empty byte stream to be invalid JSON.\n\t// This is correct; _nothing_ is not a valid JSON _something_.\n\tvar iface interface{}\n\terr := json.Unmarshal([]byte(\"\"), &iface)\n\trequire.Error(err)\n\n\t// A pair of double-quotes with nothing between them will be parsed as a\n\t// string or a []byte, but nothing else.\n\tvar (\n\t\ts string\n\t\tbs []byte\n\t\ti int\n\t\tis []int\n\t)\n\terr = json.Unmarshal([]byte(`\"\"`), &s)\n\trequire.NoError(err)\n\terr = json.Unmarshal([]byte(`\"\"`), &bs)\n\trequire.NoError(err)\n\terr = json.Unmarshal([]byte(`\"\"`), &i)\n\trequire.Error(err)\n\terr = json.Unmarshal([]byte(`\"\"`), &is)\n\trequire.Error(err)\n}", "title": "" }, { "docid": "8b94245916109c847b3a60a12b240240", "score": "0.62238735", "text": "func (v *DigIn) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeHlc21Client3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f1c5411d589ebff798435076fcc85e7c", "score": "0.6223507", "text": "func (v *Error) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson69c461c7DecodeCita16(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3afcec1ef9707e4e1d086e6473221509", "score": "0.6223464", "text": "func (strct *ValueOrMethodCall) UnmarshalJSON(b []byte) error {\n\tvar err error\n\n\tif err = json.Unmarshal(b, &strct.Call); err == nil {\n\t\treturn nil\n\t}\n\tif err = json.Unmarshal(b, &strct.Single); err == nil {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "5d449ca6abf52da7745f59341fbf52ba", "score": "0.6223428", "text": "func (j *JSONPb) Unmarshal(data []byte, v interface{}) error {\n\tif str, err := strconv.Unquote(string(data)); err == nil {\n\t\treturn json.Unmarshal([]byte(str), v)\n\t}\n\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "56352aaa8b40945164aa0e5894aeb2e6", "score": "0.62216455", "text": "func (v *PostUniverseNames200Ok) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7ff5cd1DecodeGithubComAntihaxGoesiEsi1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ad72064402f0ae428566cc0a37f4cb00", "score": "0.6219344", "text": "func (v *AidCache) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson7be57abeDecodeGithubComForrestSuGoLearnHelloWorldAdvance05Benchmark1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "986fdc4b1457290ffb8f0434b23341a8", "score": "0.6218218", "text": "func (v *Common) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct25(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7ddfa923953af75db239e1570a43195e", "score": "0.62139237", "text": "func (j *JSONSerialization) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &j.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &j.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ddfa923953af75db239e1570a43195e", "score": "0.62139237", "text": "func (j *JSONSerialization) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &j.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &j.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f33499381e002c80a66611bc9cac342", "score": "0.6212034", "text": "func (i *Ref) UnmarshalJSON(data []byte) (err error) {\n\tvar str string\n\tif err := json.Unmarshal(data, &str); err != nil {\n\t\treturn err\n\t}\n\t*i, err = ParseRef(string(str))\n\treturn err\n}", "title": "" }, { "docid": "1082a8825b7054bc4f23d75360180daa", "score": "0.6202456", "text": "func (s *JSONMapSlice) UnmarshalJSON(data []byte) error {\n\tl := jlexer.Lexer{Data: data}\n\ts.UnmarshalEasyJSON(&l)\n\treturn l.Error()\n}", "title": "" }, { "docid": "a81f3ccdc9bf4f566edc8c27be61d865", "score": "0.6195975", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeHighloadcup3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "3c5a1ab3ecd82e2ea8c72314dd43dc0c", "score": "0.61925364", "text": "func (v *Tags) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1c889379DecodeGithubComToomoreLazyflickrgoJsonstruct4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6a380fcc15b3a6d67baad6f8b1fc30fe", "score": "0.618687", "text": "func (e *Event) UnmarshalJSON(b []byte) error {\n\titerator := jsoniter.ConfigFastest.BorrowIterator(b)\n\tdefer jsoniter.ConfigFastest.ReturnIterator(iterator)\n\treturn readJsonFromIterator(e, iterator)\n}", "title": "" }, { "docid": "58c388cf483e13a5f116a8aff6585a81", "score": "0.61856455", "text": "func (v *Payload) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC1cedd36DecodeGithubComHumansNetGoApnsApns1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5658b2ed7d5c4589a351819a364cf076", "score": "0.6184109", "text": "func (v *User) UnmarshalJSON(data []byte, excludeFields []string) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9e1087fdDecodeSandboxHw3BenchData(&r, v, excludeFields)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ebb5f6800d5589fde31d1bb14994dfb0", "score": "0.61801785", "text": "func (v *NewsfeedItem) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk37(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "b8ffc62889e9d51a56af440d195d6a52", "score": "0.6177215", "text": "func (v *TransStruct) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1bcb5839DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBazBaz(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "5e781a2119bedf39949868177feb3957", "score": "0.6174125", "text": "func (e *Event) UnmarshalJSON(b []byte) error {\n\titerator := jsoniter.ConfigFastest.BorrowIterator(b)\n\tdefer jsoniter.ConfigFastest.ReturnIterator(iterator)\n\treturn readJSONFromIterator(e, iterator)\n}", "title": "" }, { "docid": "53a28f56e43a31818dbab65e363012d3", "score": "0.61722857", "text": "func (v *Posts) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonUnmarshalPosts(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "084a16cb1ada4b0f8242f606b2afe3e1", "score": "0.6168046", "text": "func (t *Function) UnmarshalJSON(bs []byte) error {\n\n\ttpe, err := Unmarshal(bs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, ok := tpe.(*Function)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid type\")\n\t}\n\n\t*t = *f\n\treturn nil\n}", "title": "" }, { "docid": "f4ec6023f00b026f562875c6e07c1e24", "score": "0.6167474", "text": "func (j *Order) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "e8fba3dfb2753bfc7807e2b2ac5b81f0", "score": "0.61619675", "text": "func (v *GetEPGItemsResponce) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComRestreamGophercon2019FtTesterModels4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "19356732537da37a886744fa951608cf", "score": "0.6156201", "text": "func (v *GetMediaItemsResponce) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComRestreamGophercon2019FtTesterModels3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "8c942dc82f91a2c276d8de64bf2280fa", "score": "0.61558205", "text": "func (v *Sticker) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk22(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "12407ba8262936855bdbfb417200eb18", "score": "0.6154357", "text": "func (v *BaseObject) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC7452bc1DecodeGithubComStek29Vk87(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a363a32475996c007b511622259caffb", "score": "0.6146098", "text": "func unmarshalJSON(src string) (map[string]interface{}, error) {\n\tres := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(src), &res)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal %s. %v\", src, err)\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "8cb5f052640878413238aad09c02f33a", "score": "0.6144167", "text": "func (a *UnitConvertResponse) UnmarshalJSON(data []byte) error {\n\ttype Alias UnitConvertResponse\n\tchil := &struct {\n\t\t*Alias\n\t\tConvertType int `json:\"type,string\"`\n\t}{\n\t\tAlias: (*Alias)(a),\n\t}\n\tif err := json.Unmarshal(data, chil); err != nil {\n\t\treturn err\n\t}\n\tswitch chil.ConvertType {\n\tcase 1:\n\t\ta.ConvertType = 1\n\tcase 2:\n\t\ta.ConvertType = 2\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a2d669d83c9876590db77c1c0722389", "score": "0.6142316", "text": "func (d *RedfishEvent) UnmarshalJSON(b []byte) error {\n\titerator := jsoniter.ConfigFastest.BorrowIterator(b)\n\tdefer jsoniter.ConfigFastest.ReturnIterator(iterator)\n\treturn readRedfishEventJSONFromIterator(d, iterator)\n}", "title": "" }, { "docid": "061fd7d91e9e178df20b1447d8427153", "score": "0.6134381", "text": "func (j *status) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "4bc0f369b02b04d3463fa86b88cd415a", "score": "0.6133967", "text": "func (i IMSI) UnmarshalJSON(b []byte) (e error) {\n\tvar s string\n\tif e = json.Unmarshal(b, &s); e != nil {\n\t\treturn e\n\t}\n\tif len(s) != 0 {\n\t\ti, e = ParseIMSI(s)\n\t}\n\treturn e\n}", "title": "" } ]
385a0e57b81739fbae96fcad8e687803
FilterMapUint64PtrErr filters given list, then apply function(2nd argument) on each item in the list and returns a new list Takes 3 inputs 1. Function: takes one input(uint64) and returns (bool, error). 2. Function: takes uint64 as argument and returns (uint64, error) 3. Slice of type []uint64 Returns: New List ([]uint64, error). Empty list if all there parameters are nil or either of parameter is nil
[ { "docid": "c3ac6619f7f2919ffbee8a2ef232c253", "score": "0.7864594", "text": "func FilterMapUint64PtrErr(fFilter func(*uint64) (bool, error), fMap func(*uint64) (*uint64, error), list []*uint64) ([]*uint64, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*uint64{}, nil\n\t}\n\tvar newList []*uint64\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" } ]
[ { "docid": "95e8569f641c80f7593edd17febc9324", "score": "0.76020473", "text": "func FilterUint64PtrErr(f func(*uint64) (bool, error), list []*uint64) ([]*uint64, error) {\n\tif f == nil {\n\t\treturn []*uint64{}, nil\n\t}\n\tvar newList []*uint64\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "8c25d4285e04e4a606b5f902bceddf50", "score": "0.72518384", "text": "func FilterMapInt64PtrErr(fFilter func(*int64) (bool, error), fMap func(*int64) (*int64, error), list []*int64) ([]*int64, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*int64{}, nil\n\t}\n\tvar newList []*int64\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "839edf0f3347072649ca4a4ff1ab8d2d", "score": "0.7184388", "text": "func FilterMapFloat64PtrErr(fFilter func(*float64) (bool, error), fMap func(*float64) (*float64, error), list []*float64) ([]*float64, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*float64{}, nil\n\t}\n\tvar newList []*float64\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "2445ef9fa0e859f9f19f0630cf825102", "score": "0.7174011", "text": "func FilterInt64PtrErr(f func(*int64) (bool, error), list []*int64) ([]*int64, error) {\n\tif f == nil {\n\t\treturn []*int64{}, nil\n\t}\n\tvar newList []*int64\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "cda09c7fa7485b274d1a9e854c813448", "score": "0.7068394", "text": "func FilterMapFloat64Uint(fFilter func(float64) bool, fMap func(float64) uint, list []float64) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "36a9c23131d977a6dbbf896aa50693f5", "score": "0.70622045", "text": "func FilterMapInt64Uint(fFilter func(int64) bool, fMap func(int64) uint, list []int64) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b6f013ac4c9f128f63bdc9849bc5f69a", "score": "0.7055136", "text": "func FilterMapFloat64Uint64(fFilter func(float64) bool, fMap func(float64) uint64, list []float64) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "fb058ddf1b2197d381a7fff98f9ec1eb", "score": "0.70527965", "text": "func FilterMapInt64Uint64(fFilter func(int64) bool, fMap func(int64) uint64, list []int64) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "db5a8b27c0e1c9c0c7d44d3aab88a5f4", "score": "0.7030388", "text": "func FilterMapUint64Float64(fFilter func(uint64) bool, fMap func(uint64) float64, list []uint64) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "e0a5fc3052fa49544c219311b17380d2", "score": "0.7027797", "text": "func FilterMapUint64Uint(fFilter func(uint64) bool, fMap func(uint64) uint, list []uint64) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b46b1f580b702c1c82a6921016b43073", "score": "0.70197254", "text": "func FilterMapUintPtrErr(fFilter func(*uint) (bool, error), fMap func(*uint) (*uint, error), list []*uint) ([]*uint, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*uint{}, nil\n\t}\n\tvar newList []*uint\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "e2a6928fd7e6fc54bea4aad9b39f1283", "score": "0.7006734", "text": "func FilterMapUint32Uint64(fFilter func(uint32) bool, fMap func(uint32) uint64, list []uint32) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "4d6f82c87dfac32e8348f0e83f818de3", "score": "0.6987325", "text": "func FilterMapUintUint64(fFilter func(uint) bool, fMap func(uint) uint64, list []uint) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "61708703d724eb6df0a6f56806c34789", "score": "0.69547063", "text": "func FilterMapUint64Int64(fFilter func(uint64) bool, fMap func(uint64) int64, list []uint64) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "0f1835608cc6d7bc429613d0cf478f23", "score": "0.6904246", "text": "func FilterMapIntUint64(fFilter func(int) bool, fMap func(int) uint64, list []int) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b8a3b34bb3c4fe76b7518964e6e45c91", "score": "0.68784076", "text": "func MapUint64Err(f func(uint64) (uint64, error), list []uint64) ([]uint64, error) {\n\tif f == nil {\n\t\treturn []uint64{}, nil\n\t}\n\tnewList := make([]uint64, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "c7876888801f27b003621e597ee7429e", "score": "0.6873464", "text": "func FilterFloat64PtrErr(f func(*float64) (bool, error), list []*float64) ([]*float64, error) {\n\tif f == nil {\n\t\treturn []*float64{}, nil\n\t}\n\tvar newList []*float64\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "15c2b964352be0ad108cd2b226ebb695", "score": "0.68589467", "text": "func FilterUintPtrErr(f func(*uint) (bool, error), list []*uint) ([]*uint, error) {\n\tif f == nil {\n\t\treturn []*uint{}, nil\n\t}\n\tvar newList []*uint\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "f7fa7436ca540ca00d5aa7e69b45a5fb", "score": "0.6843812", "text": "func FilterMapUintFloat64(fFilter func(uint) bool, fMap func(uint) float64, list []uint) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "e00a894b719fa52d39fd74b80c49e384", "score": "0.68422836", "text": "func FilterMapUintInt64(fFilter func(uint) bool, fMap func(uint) int64, list []uint) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "802e82e6a241050806905bf65ef303c1", "score": "0.68163913", "text": "func FilterMapStrUint64(fFilter func(string) bool, fMap func(string) uint64, list []string) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "5e8a6b5bf79ddb669d4ea56a96b57996", "score": "0.68107253", "text": "func FilterMapFloat32Uint64(fFilter func(float32) bool, fMap func(float32) uint64, list []float32) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "fe88051283cb377b4131568b2e0d6344", "score": "0.6786994", "text": "func FilterMapUint32Int64(fFilter func(uint32) bool, fMap func(uint32) int64, list []uint32) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d3acdfc67b54c5dcb3fec7b1e9882cc1", "score": "0.677073", "text": "func FilterMapUint64Uint32(fFilter func(uint64) bool, fMap func(uint64) uint32, list []uint64) []uint32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint32{}\n\t}\n\tvar newList []uint32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "c9a534400f16c1fddfc1f2a7aad0c86f", "score": "0.6770358", "text": "func FilterMapInt32Uint64(fFilter func(int32) bool, fMap func(int32) uint64, list []int32) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "0ba91c325cd882b70090a8d808144e13", "score": "0.67567986", "text": "func FilterMapUint32Float64(fFilter func(uint32) bool, fMap func(uint32) float64, list []uint32) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "ef00520d8fcfabe2b3ab023c4ef7acfc", "score": "0.6728407", "text": "func FilterMapBoolUint64(fFilter func(bool) bool, fMap func(bool) uint64, list []bool) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "64b17d0c84385e8dc5d82e0b236dc4da", "score": "0.6701899", "text": "func FilterMapInt64Uint32(fFilter func(int64) bool, fMap func(int64) uint32, list []int64) []uint32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint32{}\n\t}\n\tvar newList []uint32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "bc3fecd6a16203fa1b119924c81ec89e", "score": "0.66965014", "text": "func FilterMapUint32PtrErr(fFilter func(*uint32) (bool, error), fMap func(*uint32) (*uint32, error), list []*uint32) ([]*uint32, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*uint32{}, nil\n\t}\n\tvar newList []*uint32\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "abf90095723287e689de0c7745ab559a", "score": "0.6638651", "text": "func FilterMapUint64Float32(fFilter func(uint64) bool, fMap func(uint64) float32, list []uint64) []float32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float32{}\n\t}\n\tvar newList []float32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "4bf171f3e72e6229c937db3ce3cf8866", "score": "0.659859", "text": "func FilterMapFloat64Uint32(fFilter func(float64) bool, fMap func(float64) uint32, list []float64) []uint32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint32{}\n\t}\n\tvar newList []uint32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "1697454016b76e2e645c063c85ffd650", "score": "0.6590927", "text": "func FilterMapInt64Float64(fFilter func(int64) bool, fMap func(int64) float64, list []int64) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "934037be089d823f9f5c7d419c53dde9", "score": "0.6564359", "text": "func FilterMapUint64Int(fFilter func(uint64) bool, fMap func(uint64) int, list []uint64) []int {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int{}\n\t}\n\tvar newList []int\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "95a71e7142f1eece022b8b9698aadb43", "score": "0.6546027", "text": "func FilterMapUint64Bool(fFilter func(uint64) bool, fMap func(uint64) bool, list []uint64) []bool {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []bool{}\n\t}\n\tvar newList []bool\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "e989d53267c0262a75bebfefdb5983e0", "score": "0.65395415", "text": "func FilterMapUint64Str(fFilter func(uint64) bool, fMap func(uint64) string, list []uint64) []string {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []string{}\n\t}\n\tvar newList []string\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "76ccc5a53ce30ed58ee4abb770d42aee", "score": "0.65229625", "text": "func FilterMapUint8PtrErr(fFilter func(*uint8) (bool, error), fMap func(*uint8) (*uint8, error), list []*uint8) ([]*uint8, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*uint8{}, nil\n\t}\n\tvar newList []*uint8\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "4bc886c6d123c314727c8d8f6336ace5", "score": "0.6494976", "text": "func FilterMapFloat64Int64(fFilter func(float64) bool, fMap func(float64) int64, list []float64) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "3c6cfe021baab0745b7263fa89680eac", "score": "0.6442839", "text": "func FilterMapUint8Int64(fFilter func(uint8) bool, fMap func(uint8) int64, list []uint8) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "b7a971a72b6879d9a24eafb0f982cb4c", "score": "0.6425776", "text": "func FilterMapIntFloat64(fFilter func(int) bool, fMap func(int) float64, list []int) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "78054e01597634fb5b70899a4e8dd69d", "score": "0.64042574", "text": "func FilterUint32PtrErr(f func(*uint32) (bool, error), list []*uint32) ([]*uint32, error) {\n\tif f == nil {\n\t\treturn []*uint32{}, nil\n\t}\n\tvar newList []*uint32\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "0ad40c1b8cd5888bcc94f5ac61053ab9", "score": "0.63983923", "text": "func FilterMapUint8Uint64(fFilter func(uint8) bool, fMap func(uint8) uint64, list []uint8) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "6688135c6a04231480426da2fcc56ec0", "score": "0.63859403", "text": "func FilterMapUint64Int32(fFilter func(uint64) bool, fMap func(uint64) int32, list []uint64) []int32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int32{}\n\t}\n\tvar newList []int32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d2d8efede0baf7bd23e8c816c30419db", "score": "0.6378649", "text": "func FilterMapStrInt64(fFilter func(string) bool, fMap func(string) int64, list []string) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "3b0d624680ebbc4be817965968d15aeb", "score": "0.63777626", "text": "func FilterMapInt8Uint64(fFilter func(int8) bool, fMap func(int8) uint64, list []int8) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "82c93724b1ca84dc8a676a7c72f3928c", "score": "0.63742864", "text": "func MapInt64Err(f func(int64) (int64, error), list []int64) ([]int64, error) {\n\tif f == nil {\n\t\treturn []int64{}, nil\n\t}\n\tnewList := make([]int64, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "198f95ed6630142337f984b623e71589", "score": "0.6347274", "text": "func FilterMapIntInt64(fFilter func(int) bool, fMap func(int) int64, list []int) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "33f6ea780294221c6036cf5afc04f1ec", "score": "0.6342066", "text": "func MapBoolErr(f func(bool) (bool, error), list []bool) ([]bool, error) {\n\tif f == nil {\n\t\treturn []bool{}, nil\n\t}\n\tnewList := make([]bool, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "242e3d825663cd55f17c154171e69ff4", "score": "0.63254267", "text": "func FilterMapInt64Uint8(fFilter func(int64) bool, fMap func(int64) uint8, list []int64) []uint8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint8{}\n\t}\n\tvar newList []uint8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "683e6799ce5968ab1fbffc9f3f4d8212", "score": "0.6308443", "text": "func FilterUint8PtrErr(f func(*uint8) (bool, error), list []*uint8) ([]*uint8, error) {\n\tif f == nil {\n\t\treturn []*uint8{}, nil\n\t}\n\tvar newList []*uint8\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "36770f22e0153c0b0b63ff9f026d73f0", "score": "0.62822914", "text": "func FilterMapFloat32Int64(fFilter func(float32) bool, fMap func(float32) int64, list []float32) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "857476fd260948c166eb4bc9cde6f656", "score": "0.62772614", "text": "func FilterMapIntPtrErr(fFilter func(*int) (bool, error), fMap func(*int) (*int, error), list []*int) ([]*int, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*int{}, nil\n\t}\n\tvar newList []*int\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "c5e72947d8009a4133684131ced0d125", "score": "0.6276553", "text": "func FilterBoolPtrErr(f func(*bool) (bool, error), list []*bool) ([]*bool, error) {\n\tif f == nil {\n\t\treturn []*bool{}, nil\n\t}\n\tvar newList []*bool\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "4c81d0aebb2cf94d4e76a07061cb180d", "score": "0.626114", "text": "func FilterMapInt32Int64(fFilter func(int32) bool, fMap func(int32) int64, list []int32) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "ae024be5772882cd81438efaa9e21e7d", "score": "0.6228015", "text": "func FilterMapInt32Float64(fFilter func(int32) bool, fMap func(int32) float64, list []int32) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "44d1d5f92b7c85f3a5093d39370496e8", "score": "0.6222691", "text": "func MapUint64Ptr(f func(*uint64) *uint64, list []*uint64) []*uint64 {\n\tif f == nil {\n\t\treturn []*uint64{}\n\t}\n\tnewList := make([]*uint64, len(list))\n\tfor i, v := range list {\n\t\tnewList[i] = f(v)\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "ac4d250bc9d4141578ea049b1c0d39c9", "score": "0.62200546", "text": "func FilterMapInt64Float32(fFilter func(int64) bool, fMap func(int64) float32, list []int64) []float32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float32{}\n\t}\n\tvar newList []float32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "9cbb6bbf5ce7140befc0c46c0464b49a", "score": "0.6216205", "text": "func MapFloat64Err(f func(float64) (float64, error), list []float64) ([]float64, error) {\n\tif f == nil {\n\t\treturn []float64{}, nil\n\t}\n\tnewList := make([]float64, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "d7dace48ecc3de3d3ac52363118f05e6", "score": "0.62159836", "text": "func FilterMapUint64Uint8(fFilter func(uint64) bool, fMap func(uint64) uint8, list []uint64) []uint8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint8{}\n\t}\n\tvar newList []uint8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "adb48d94cac689049ecb6cacd19cc44f", "score": "0.6214929", "text": "func FilterMapFloat32Uint(fFilter func(float32) bool, fMap func(float32) uint, list []float32) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "ba71e6e729f9cf372b00e54c21632ccd", "score": "0.6213477", "text": "func FilterMapBoolInt64(fFilter func(bool) bool, fMap func(bool) int64, list []bool) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "319747a607d6fa15ebcbbf143bcf0069", "score": "0.6199948", "text": "func FilterMapFloat32PtrErr(fFilter func(*float32) (bool, error), fMap func(*float32) (*float32, error), list []*float32) ([]*float32, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*float32{}, nil\n\t}\n\tvar newList []*float32\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "15820c943e884d4983245959c813205b", "score": "0.6197296", "text": "func MapUintErr(f func(uint) (uint, error), list []uint) ([]uint, error) {\n\tif f == nil {\n\t\treturn []uint{}, nil\n\t}\n\tnewList := make([]uint, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "9b4557ce74d3220b6ebc0925e657f5a7", "score": "0.61912084", "text": "func FilterMapInt8PtrErr(fFilter func(*int8) (bool, error), fMap func(*int8) (*int8, error), list []*int8) ([]*int8, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*int8{}, nil\n\t}\n\tvar newList []*int8\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "940fd88adc226e0ef7afc26c9b153bc7", "score": "0.6191189", "text": "func FilterMapInt64Str(fFilter func(int64) bool, fMap func(int64) string, list []int64) []string {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []string{}\n\t}\n\tvar newList []string\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "1cd23e730f00426ebc460b1562533a38", "score": "0.6184695", "text": "func FilterMapUint32Uint(fFilter func(uint32) bool, fMap func(uint32) uint, list []uint32) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "2bcace898ff5cc4fac377a4e2886393a", "score": "0.617219", "text": "func FilterMapFloat64Int(fFilter func(float64) bool, fMap func(float64) int, list []float64) []int {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int{}\n\t}\n\tvar newList []int\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "5cf6faa424444fc852f61d73b96858ef", "score": "0.6169843", "text": "func FilterMapInt64Int(fFilter func(int64) bool, fMap func(int64) int, list []int64) []int {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int{}\n\t}\n\tvar newList []int\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "49e829682e4fbf5056f765b2de59c54f", "score": "0.6166843", "text": "func FilterMapUint8Float64(fFilter func(uint8) bool, fMap func(uint8) float64, list []uint8) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "53829701d9629bb4cf2c4ac36eb31793", "score": "0.6155735", "text": "func FilterMapInt64Bool(fFilter func(int64) bool, fMap func(int64) bool, list []int64) []bool {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []bool{}\n\t}\n\tvar newList []bool\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "90ebb4506c7380adf50f5a08edc5d3a2", "score": "0.615206", "text": "func FilterIntPtrErr(f func(*int) (bool, error), list []*int) ([]*int, error) {\n\tif f == nil {\n\t\treturn []*int{}, nil\n\t}\n\tvar newList []*int\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "70df791fb6950dff4b58539a846aa191", "score": "0.6145765", "text": "func FilterMapUint16PtrErr(fFilter func(*uint16) (bool, error), fMap func(*uint16) (*uint16, error), list []*uint16) ([]*uint16, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*uint16{}, nil\n\t}\n\tvar newList []*uint16\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "43767ab0a24a00a7ac4b8404b060954c", "score": "0.6133772", "text": "func FilterMapFloat32Float64(fFilter func(float32) bool, fMap func(float32) float64, list []float32) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "0d743b013090baf5201eb98ef8fb14b5", "score": "0.61085063", "text": "func FilterMapUint16Int64(fFilter func(uint16) bool, fMap func(uint16) int64, list []uint16) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "dd527ef96eabd7fd02107185064e767e", "score": "0.61022913", "text": "func FilterMapInt8Int64(fFilter func(int8) bool, fMap func(int8) int64, list []int8) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "9279b92cba8196ac3cd65e4cb2e862fb", "score": "0.60999894", "text": "func FilterMapBoolUint(fFilter func(bool) bool, fMap func(bool) uint, list []bool) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "f490f12365b45927544fd5875ecb62ba", "score": "0.609558", "text": "func FilterMapStrUint(fFilter func(string) bool, fMap func(string) uint, list []string) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d9336b441989c8b44b37b029101c499a", "score": "0.60952073", "text": "func FilterMapInt32Uint(fFilter func(int32) bool, fMap func(int32) uint, list []int32) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "01ed128109ab525d8c7847c399cc1e27", "score": "0.6089808", "text": "func FilterInt8PtrErr(f func(*int8) (bool, error), list []*int8) ([]*int8, error) {\n\tif f == nil {\n\t\treturn []*int8{}, nil\n\t}\n\tvar newList []*int8\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "ccdad454788ae457a5ae6c7fff6663e2", "score": "0.6079538", "text": "func FilterMapUint64Int8(fFilter func(uint64) bool, fMap func(uint64) int8, list []uint64) []int8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int8{}\n\t}\n\tvar newList []int8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "13f113ed8e2204fbfb32480fba07bcc2", "score": "0.6076957", "text": "func FilterMapInt64Uint16(fFilter func(int64) bool, fMap func(int64) uint16, list []int64) []uint16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint16{}\n\t}\n\tvar newList []uint16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "185d660ff86e254bbef74ea87493facd", "score": "0.6063073", "text": "func FilterMapInt16Uint64(fFilter func(int16) bool, fMap func(int16) uint64, list []int16) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "1717b4e96a7c3a576ac93e01d2741712", "score": "0.605095", "text": "func FilterMapInt64Int8(fFilter func(int64) bool, fMap func(int64) int8, list []int64) []int8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int8{}\n\t}\n\tvar newList []int8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "e426d0da2d46668a752f27bd9ffceb90", "score": "0.60500044", "text": "func FilterMapBoolFloat64(fFilter func(bool) bool, fMap func(bool) float64, list []bool) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "a60198cee223b04174b78904f4763a51", "score": "0.603472", "text": "func FilterMapFloat64Uint8(fFilter func(float64) bool, fMap func(float64) uint8, list []float64) []uint8 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint8{}\n\t}\n\tvar newList []uint8\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "695d9c0a1b45784efd28c8ca48079518", "score": "0.6026982", "text": "func FilterMapInt64Int32(fFilter func(int64) bool, fMap func(int64) int32, list []int64) []int32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int32{}\n\t}\n\tvar newList []int32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "924b290de3180d28034ab2d7f49e68e7", "score": "0.6022864", "text": "func FilterMapUint16Uint64(fFilter func(uint16) bool, fMap func(uint16) uint64, list []uint16) []uint64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint64{}\n\t}\n\tvar newList []uint64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "86cead48befa19e8717b892d7cfd1031", "score": "0.6007513", "text": "func MapUint32Err(f func(uint32) (uint32, error), list []uint32) ([]uint32, error) {\n\tif f == nil {\n\t\treturn []uint32{}, nil\n\t}\n\tnewList := make([]uint32, len(list))\n\tfor i, v := range list {\n\t\tvar err error\n\t\tnewList[i], err = f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "5299dd33c429a95353e30273e531d756", "score": "0.6000973", "text": "func FilterMapIntUint(fFilter func(int) bool, fMap func(int) uint, list []int) []uint {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint{}\n\t}\n\tvar newList []uint\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d6203ce3fd57ae7b9983ba96bd4bcdc8", "score": "0.5994235", "text": "func FilterMapFloat64Float32(fFilter func(float64) bool, fMap func(float64) float32, list []float64) []float32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float32{}\n\t}\n\tvar newList []float32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "c9391b6904bfd86f7da45ccb315ad7cf", "score": "0.5984779", "text": "func FilterMapStrFloat64(fFilter func(string) bool, fMap func(string) float64, list []string) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "649afa239612451a4ff836d83e31d60f", "score": "0.59734124", "text": "func FilterMapUintFloat32(fFilter func(uint) bool, fMap func(uint) float32, list []uint) []float32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float32{}\n\t}\n\tvar newList []float32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "f4701586f8847da5d646a8a1241b634f", "score": "0.5970825", "text": "func FilterMapUintUint32(fFilter func(uint) bool, fMap func(uint) uint32, list []uint) []uint32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint32{}\n\t}\n\tvar newList []uint32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "3273ef25d8cdb845ef24970e31b45d9e", "score": "0.5935035", "text": "func FilterMapUint64Uint16(fFilter func(uint64) bool, fMap func(uint64) uint16, list []uint64) []uint16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint16{}\n\t}\n\tvar newList []uint16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "d3fa8df9e14e6da8acee8e930302a4ca", "score": "0.5929507", "text": "func FilterMapBoolUint32(fFilter func(bool) bool, fMap func(bool) uint32, list []bool) []uint32 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []uint32{}\n\t}\n\tvar newList []uint32\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "0fd61f536aac643f4a6bff06e5bc112a", "score": "0.5929124", "text": "func FilterMapInt16Int64(fFilter func(int16) bool, fMap func(int16) int64, list []int16) []int64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int64{}\n\t}\n\tvar newList []int64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "a0ad6f697dbf0291d7e8356cd89d8b31", "score": "0.59178656", "text": "func FilterMapInt8Float64(fFilter func(int8) bool, fMap func(int8) float64, list []int8) []float64 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []float64{}\n\t}\n\tvar newList []float64\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "1ea99eb152d11b01e3cb700ab34dc4fd", "score": "0.5906542", "text": "func FilterMapInt32PtrErr(fFilter func(*int32) (bool, error), fMap func(*int32) (*int32, error), list []*int32) ([]*int32, error) {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []*int32{}, nil\n\t}\n\tvar newList []*int32\n\tfor _, v := range list {\n\t\tr, err := fFilter(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tr, err := fMap(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewList = append(newList, r)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "a65893f0fffe2a5bdccb6e77c588852a", "score": "0.58958375", "text": "func FilterMapFloat64Bool(fFilter func(float64) bool, fMap func(float64) bool, list []float64) []bool {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []bool{}\n\t}\n\tvar newList []bool\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "5372186817c5b54cafafbc87cfe47083", "score": "0.58870155", "text": "func FilterFloat32PtrErr(f func(*float32) (bool, error), list []*float32) ([]*float32, error) {\n\tif f == nil {\n\t\treturn []*float32{}, nil\n\t}\n\tvar newList []*float32\n\tfor _, v := range list {\n\t\tr, err := f(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif r {\n\t\t\tnewList = append(newList, v)\n\t\t}\n\t}\n\treturn newList, nil\n}", "title": "" }, { "docid": "85fd04260ced622001dcad5522c4f4ba", "score": "0.588542", "text": "func FilterMapInt64Int16(fFilter func(int64) bool, fMap func(int64) int16, list []int64) []int16 {\n\tif fFilter == nil || fMap == nil {\n\t\treturn []int16{}\n\t}\n\tvar newList []int16\n\tfor _, v := range list {\n\t\tif fFilter(v) {\n\t\t\tnewList = append(newList, fMap(v))\n\t\t}\n\t}\n\treturn newList\n}", "title": "" } ]
6dde328a0bf77d5e655ac5bf04f051f5
New reads PoprepConfig from toml file
[ { "docid": "a9fa243b85a80f0db8b004368740fb92", "score": "0.7069892", "text": "func New(configpath string) (PoprepConfig, error) {\n\tconf := &PoprepConfig{}\n\tdata, err := ioutil.ReadFile(configpath)\n\tif err != nil {\n\t\treturn *conf, errors.New(\"Could not find poprep config file\")\n\t}\n\tif _, err = toml.Decode(string(data), &conf); err != nil {\n\t\tlogrus.Info(\"Could not parse configuration\")\n\t\treturn *conf, errors.New(\"Could not parse poprep config file\")\n\t}\n\treturn *conf, nil\n}", "title": "" } ]
[ { "docid": "e8e9ab3ba9dc3457f73ff9f0b53440c0", "score": "0.6188902", "text": "func readConfig(fromPath string) {\n\tviper.SetEnvPrefix(\"GPM\")\n\tviper.AutomaticEnv()\n\tviper.AddConfigPath(fromPath)\n\tviper.SetConfigName(\".gpm\") // name of config file (without extension)\n\tviper.SetConfigType(\"yaml\") // REQUIRED if the config file does not have the extension in the name\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t\tlog.Warn().Msg(\"No config file found on given path, create a .gpm.yaml file for consistent results.\")\n\t\t} else {\n\t\t\tlog.Fatal().Err(err).Msg(\"unable to read configuration file\")\n\t\t}\n\t}\n\n\tif err := viper.Unmarshal(&appConfig); err != nil {\n\t\tlog.Fatal().Err(err).Msg(\"unable to unmarshal resolved configuration into config structure. Check structure/file structure for a mismatch\")\n\t}\n\tappConfig.ProjectPath = fromPath\n\tlog.Info().Str(\"path\", viper.ConfigFileUsed()).Msg(\"configuration loaded\")\n}", "title": "" }, { "docid": "e5b56eb35789a9a69d2c88e055e25aec", "score": "0.60388815", "text": "func newConfig() (*Config, error) {\n\tvar c Config\n\tviper.SetConfigType(\"yaml\")\n\tviper.SetConfigName(\".alfred-bookmarks\")\n\tviper.AddConfigPath(\".\")\n\tviper.AddConfigPath(\"$HOME/\")\n\n\t// Set Default Value overwritten with config file\n\tviper.SetDefault(\"firefox.profile\", \"default\")\n\tviper.SetDefault(\"chrome.profile\", \"default\")\n\tif err := viper.ReadInConfig(); err != nil {\n\t\treturn &Config{}, err\n\t}\n\n\tif err := viper.Unmarshal(&c); err != nil {\n\t\treturn &Config{}, err\n\t}\n\n\treturn &c, nil\n}", "title": "" }, { "docid": "a537526c1876bdc9db10b9a9c34359fe", "score": "0.60294676", "text": "func readConfig(filename string) Config {\n\tconfig := Config{\n\t\tTimeout: 10,\n\t\tTargets: []Target{Target{Name: \"Local HTTP Server\", Addr: \"http://localhost\"}},\n\t}\n\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\t// unaccessible or not exisiting file -> creatoin\n\t\tfile, err = os.Create(filename)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// config file just created\n\t\t//err := toml.NewEncoder(file).Encode(config)\n\t\terr := json.NewEncoder(file).Encode(config)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t} else {\n\t\t//_, err := toml.DecodeReader(file, &config)\n\t\terr = json.NewDecoder(file).Decode(&config)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// number targets\n\tfor i, _ := range config.Targets {\n\t\tconfig.Targets[i].Id = i + 1\n\t}\n\treturn config\n}", "title": "" }, { "docid": "015c66486d4dc1ff33dac81cfa203582", "score": "0.6002292", "text": "func newConfig(path string, env string) error {\n\tvar conf Config\n\n\tconfPath := path + env + \".toml\" // tomlファイルを読み設定情報を取得\n\tif _, err := toml.DecodeFile(confPath, &conf); err != nil {\n\t\treturn err\n\t}\n\n\tDynamoDB = conf.DynamoDB\n\n\treturn nil\n}", "title": "" }, { "docid": "f6262c06e73be332662489071eb0884f", "score": "0.5982294", "text": "func New(file string) (*P, error) {\n\tdata := new(configFile)\n\t_, err := toml.DecodeFile(file, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &P{data: *data}, nil\n}", "title": "" }, { "docid": "57f65fc11220b61ec522502a30bc7f44", "score": "0.586913", "text": "func newConfig() (*config, error) {\n\n\t//Read config file\n\tfile, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif file == nil {\n\t\tlog.Fatalf(\"No config file defined in config path: %v\", configPath)\n\t}\n\n\tvar config *config\n\n\t//Unmarshal yaml to config struct\n\tif err := yaml.Unmarshal(file, &config); err != nil {\n\t\treturn nil, errors.New(\"ERROR: Unable to unmarshal config\")\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "cf6758dce63273d0eeb8cf67a1af9b32", "score": "0.57860523", "text": "func readConfig() {\r\n\r\n\tf, err := os.Open(\"config.dat\")\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer f.Close()\r\n\r\n\tbuf, err := ioutil.ReadAll(f)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tf.Close()\r\n\tif err := toml.Unmarshal(buf, &config); err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n}", "title": "" }, { "docid": "52189bede9d0704fa49af540832649ea", "score": "0.5748483", "text": "func newConfig(configPath string) (*Config, error) {\n\tconfig := &Config{}\n\n\tfile, err := os.Open(configPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\td := yaml.NewDecoder(file)\n\tif err := d.Decode(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "368532c1fc276dab6a403cdcff166601", "score": "0.5734512", "text": "func readConfig(configPath string) *model.ProtoformConfig {\n\tlog.Print(\"*************** [protoform] initializing viper ****************\")\n\tviper.SetConfigName(\"protoform\")\n\tviper.AddConfigPath(configPath)\n\tpc := &model.ProtoformConfig{}\n\tlog.Print(configPath)\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.Print(\" ^^ Didnt see a config file ! Making a reasonable default.\")\n\t\treturn nil\n\t}\n\tviper.Unmarshal(pc)\n\tPrettyPrint(pc)\n\tlog.Print(\"*************** [protoform] done reading in viper ****************\")\n\treturn pc\n}", "title": "" }, { "docid": "b07dd712c16a76d4ad61df6ef1407ea0", "score": "0.5724322", "text": "func newSyncConfigFromFile(path string) (*syncConfig, error) {\n\tsc := newSyncConfig()\n\n\tyamlFile, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tglog.Errorf(\"yamlFile get err #%v \", err)\n\t\treturn nil, err\n\t}\n\terr = yaml.Unmarshal(yamlFile, &sc)\n\tif err != nil {\n\t\tglog.Errorf(\"Unmarshal: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &sc, nil\n}", "title": "" }, { "docid": "5f69a60e85b070056101a3556015cca9", "score": "0.5679326", "text": "func loadConfig(config *tomlConfig) {\n // Config file path is stored in env for simplicity\n\tvar cfgFilePath string\n cfgFilePath = os.Getenv(\"GO_TOML_CONFIG\")\n if _, err := toml.DecodeFile(cfgFilePath, &config); err != nil {\n log.Println(err)\n // Configure behavior for a failed config file load\n\t\treturn\n }\n log.Println(fmt.Sprintf(\"[Config] Successfully loaded %s\", cfgFilePath))\n}", "title": "" }, { "docid": "d8607611cccff78263d2225fd5e98d4d", "score": "0.5677104", "text": "func NewConfigFromFile(path string) (*Config, error) {\n\tfilename, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, errors.New(\"can not find the file :\" + filename)\n\t}\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, errors.New(\"read config file fail. \" + err.Error())\n\t}\n\tfmt.Printf(\"start parse config path:%s \\n\", path)\n\tm := make(map[interface{}]interface{})\n\terr = yaml.Unmarshal([]byte(data), &m)\n\tif err != nil {\n\t\tfmt.Printf(\"config unmarshal failed. \" + err.Error())\n\t\treturn nil, errors.New(\"config unmarshal failed. \" + err.Error())\n\t}\n\treturn &Config{conf: m}, nil\n}", "title": "" }, { "docid": "f37b15e4cd9c65742e5d37a358c5d50c", "score": "0.56740737", "text": "func (c *Config) configFromFile(path string) error {\n\t_, err := toml.DecodeFile(path, c)\n\treturn errors.Trace(err)\n}", "title": "" }, { "docid": "f37b15e4cd9c65742e5d37a358c5d50c", "score": "0.56740737", "text": "func (c *Config) configFromFile(path string) error {\n\t_, err := toml.DecodeFile(path, c)\n\treturn errors.Trace(err)\n}", "title": "" }, { "docid": "619bd46fe9fc5f392c353017c1d5d288", "score": "0.5669264", "text": "func readConfig(configFilename string) Config {\n\t_, err := os.Stat(configFilename)\n\tif err != nil {\n\t\tfmt.Println(\"Config file is missing: \", configFilename)\n\t}\n\n\tif _, err := toml.DecodeFile(configFilename, &config); err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "e2e16d10c5fa87926394583922c50a93", "score": "0.5633188", "text": "func getConfig(conf *Config, configFile string) error {\n\n // check for existance of file\n if _, err := os.Stat(configFile); err != nil {\n return errors.New(\"Config File \" + configFile + \" does not exist\")\n }\n\n // read file\n b, err := ioutil.ReadFile(configFile)\n if err != nil {\n return err\n }\n\n // parse TOML config file into struct\n if _, err := toml.Decode(string(b), &conf); err != nil {\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "87b2cd67e87ca0692aeba943e279b463", "score": "0.56203294", "text": "func load_configs() {\n file, _ := os.Open(\"conf.json\")\n decoder := json.NewDecoder(file)\n \n Config = Configs{}\n \n err := decoder.Decode(&Config)\n \n if err != nil {\n fmt.Println(\"Config.go Error:\", err)\n } \n}", "title": "" }, { "docid": "fa785469c6cb11465f6d7b9257088981", "score": "0.56155837", "text": "func (cfg *Config) Load(file string) error {\n\t_, err := os.Stat(file)\n\tif err == nil {\n\t\t_, err := toml.DecodeFile(file, cfg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcfg.General.SnippetFile = expandPath(cfg.General.SnippetFile)\n\t\treturn nil\n\t}\n\n\tif !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tf, err := os.Create(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := GetDefaultConfigDir()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to get the default config directory\")\n\t}\n\tcfg.General.SnippetFile = filepath.Join(dir, \"snippet.toml\")\n\t_, err = os.Create(cfg.General.SnippetFile)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to create a config file\")\n\t}\n\n\tcfg.General.Editor = os.Getenv(\"EDITOR\")\n\tif cfg.General.Editor == \"\" && runtime.GOOS != \"windows\" {\n\t\tif isCommandAvailable(\"sensible-editor\") {\n\t\t\tcfg.General.Editor = \"sensible-editor\"\n\t\t} else {\n\t\t\tcfg.General.Editor = \"vim\"\n\t\t}\n\t}\n\tcfg.General.Column = 40\n\tcfg.General.SelectCmd = \"fzf\"\n\tcfg.General.Backend = \"gist\"\n\n\tcfg.Gist.FileName = \"pet-snippet.toml\"\n\n\tcfg.GitLab.FileName = \"pet-snippet.toml\"\n\tcfg.GitLab.Visibility = \"private\"\n\n\treturn toml.NewEncoder(f).Encode(cfg)\n}", "title": "" }, { "docid": "e2db1a907e72ad094b5261fd909b45b0", "score": "0.5607989", "text": "func loadConfig(filename string) (gontribs gontrib.Configuration, err error) {\n\tfile, err := os.OpenFile(filename, os.O_RDONLY, 0660)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&gontribs)\n\treturn\n}", "title": "" }, { "docid": "9443cb0d7358c54440ab5f82e2d45896", "score": "0.55906117", "text": "func (c *Config) configFromFile(path string) error {\n\t_, err := toml.DecodeFile(path, c)\n\treturn terror.ErrTracerConfigTomlTransform.Delegate(err)\n}", "title": "" }, { "docid": "e8cddd01040c9b958dcdb3b301e1462b", "score": "0.556467", "text": "func (b *ConfigBuilder) LoadTxt(r io.Reader) (GoConfig, error) {\n\n\tscanner := bufio.NewScanner(r)\n\tlineNb := 0\n\tobj := make(map[string]interface{})\n\tconf := &ConfigImpl{values: obj, parent: nil, def: b.conf.def}\n\tfor scanner.Scan() {\n\t\tlineNb++\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\t// ignore empty lines and comments\n\t\tif \"\" != line && !strings.HasPrefix(line, \"#\") && !strings.HasPrefix(line, \"//\") {\n\t\t\t// Parse key=value\n\t\t\twords := strings.SplitN(line, \"=\", 2)\n\t\t\tif len(words) != 2 {\n\t\t\t\treturn b.conf, &ParseError{line: lineNb, msg: \"missing '=' : '\" + line + \"'\"}\n\t\t\t}\n\t\t\tkey := strings.TrimSpace(words[0])\n\t\t\tvalue := strings.TrimSpace(words[1])\n\t\t\t// Set Value in a spare config\n\t\t\tconf.SetValue(key, value)\n\t\t}\n\n\t}\n\t// Merge new config and current one.\n\tmergeMap(conf.values, b.conf.values)\n\n\treturn b.conf, nil\n}", "title": "" }, { "docid": "5c1283c6c5d64d55de3bb9e9c096ea86", "score": "0.5557702", "text": "func (c *Config) configFromFile(path string) error {\n\tmetaData, err := toml.DecodeFile(path, c)\n\tif err != nil {\n\t\treturn terror.ErrMasterConfigTomlTransform.Delegate(err)\n\t}\n\tundecoded := metaData.Undecoded()\n\tif len(undecoded) > 0 {\n\t\tvar undecodedItems []string\n\t\tfor _, item := range undecoded {\n\t\t\tundecodedItems = append(undecodedItems, item.String())\n\t\t}\n\t\treturn terror.ErrMasterConfigUnknownItem.Generate(strings.Join(undecodedItems, \",\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad609012f1ab86e2adbd334c52ab2d5a", "score": "0.55394953", "text": "func NewConfig(fullpath, kind string) (Config, error) {\n\tfullpath = libstring.ExpandTildeAndEnv(fullpath)\n\n\tvar config Config\n\t_, err := toml.DecodeFile(fullpath, &config)\n\n\tif config.Command != \"\" {\n\t\tconfig.Command = libstring.ExpandTildeAndEnv(config.Command)\n\t}\n\n\tif config.Interval == \"\" {\n\t\tconfig.Interval = \"1m\"\n\t}\n\n\tconfig.Kind = kind\n\n\treturn config, err\n}", "title": "" }, { "docid": "c8d22aabc26ce85caeb8ccd6f626bc62", "score": "0.5535228", "text": "func Readconfig(version, cfile string) *Config {\n\tfmt.Printf(\"Using %s as config file.\\n\", cfile)\n\tfile, e := ioutil.ReadFile(cfile)\n\tif e != nil {\n\t\tpanic(\"Couldn't read config file!\")\n\t}\n\n\tvar c Config\n\terr := json.Unmarshal(file, &c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc.Version = version\n\n\tif c.Type == \"\" {\n\t\tc.Type = \"irc\"\n\t}\n\n\tfmt.Printf(\"godeepintir version %s running.\\n\", c.Version)\n\n\treturn &c\n}", "title": "" }, { "docid": "cb2705ce9a9a086b840baa3285658767", "score": "0.5509419", "text": "func NewConfigFromFile(path string) (*Config, error) {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := new(Config)\n\tif err = toml.Unmarshal(data, c); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "67a2dbbf43da72c45c6a41e389ee93d8", "score": "0.5504095", "text": "func readConfig(path string) *ExampleTargetConf {\n\tfile, e := ioutil.ReadFile(path)\n\tif e != nil {\n\t\tglog.Infof(\"File error: %v\\n\", e)\n\t\tos.Exit(1)\n\t}\n\tglog.Infoln(string(file))\n\n\tvar config ExampleTargetConf\n\terr := json.Unmarshal(file, &config)\n\n\tif err != nil {\n\t\tglog.Errorf(\"Unmarshall error :%v\\n\", err)\n\t}\n\tglog.Infof(\"Results: %+v\\n\", config)\n\n\treturn &config\n}", "title": "" }, { "docid": "2b9b0fa3a088611ff2cba279d7839e7e", "score": "0.55010736", "text": "func read() utils.Configuration {\n\t//Set the file name of the configurations file\n\tviper.SetConfigName(\"config\")\n\n\t// Set the path to look for the configurations file\n\tviper.AddConfigPath(\".\")\n\n\t// Enable VIPER to read Environment Variables\n\tviper.AutomaticEnv()\n\n\tviper.SetConfigType(\"yml\")\n\tvar config utils.Configuration\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tlog.Error(\"Error reading config file, %s\", err)\n\t}\n\n\tif err := viper.Unmarshal(&config); err != nil {\n\t\tlog.Error(\"Unable to decode into struct, %v\", err)\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "3e2e45e7644d6f7414df7b42ce37aadb", "score": "0.5496492", "text": "func fromFile() {\n\tonce.Do(func() {\n\t\tb, err := ioutil.ReadFile(\"config.json\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"no se pudo leer el archivo de configuración: %s\", err.Error())\n\t\t}\n\n\t\terr = json.Unmarshal(b, config)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"no se pudo parsear el archivo de configuración: %s\", err.Error())\n\t\t}\n\n\t\tif config.DB.Engine == \"\" {\n\t\t\tlog.Fatal(\"no se ha cargado la información de configuración\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "59d1aaf58904db5369395b933b6a1bb2", "score": "0.5493307", "text": "func loadConfig() error {\n\t// The file exists, let's parse it\n\tbytes, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = toml.Decode(string(bytes), &config)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1fa7dbb70c2de36e91341521b737a646", "score": "0.5492505", "text": "func ReadInConf(content []byte) error { return owl.ReadInConf(content) }", "title": "" }, { "docid": "0fe4d989ca9bf29d1ddd464e8a2a0783", "score": "0.5492469", "text": "func (p *Package) readConfig() error {\n\t// ReadFile following statement is useful for reading small files,\n\t// \tdon't use it for reading large files\n\tif p.PackageYml == \"\" {\n\t\treturn errors.New(\"package.yml path not set\")\n\t}\n\tpackageYml = p.PackageYml\n\tb, err := ioutil.ReadFile(packageYml)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := yaml.Unmarshal(b, p); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "743315a9481e61ddfa23bc3bf03d3cc2", "score": "0.54901105", "text": "func readTestCfg(testCfgFile string) testCfg {\n\tvar t testCfg\n\tyamlFile, err := ioutil.ReadFile(testCfgFile)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed read test config file from virtual path KYMA_PROJECT_DIR/test-infra/vpath/pjtester.yaml\")\n\t}\n\terr = yaml.Unmarshal(yamlFile, &t)\n\tif err != nil {\n\t\tlog.Fatal(\"Failed unmarshal test config yaml.\")\n\t}\n\tif len(t.PjNames) == 0 {\n\t\tlog.WithError(err).Fatalf(\"PjNames were not provided.\")\n\t}\n\tfor index, pj := range t.PjNames {\n\t\tif pj.PjName == \"\" {\n\t\t\tlog.WithError(err).Fatalf(\"jobName to test was not provided.\")\n\t\t}\n\t\tif pj.PjPath == \"\" {\n\t\t\tt.PjNames[index].PjPath = defaultPjPath\n\t\t}\n\t}\n\tif t.ConfigPath == \"\" {\n\t\tt.ConfigPath = defaultConfigPath\n\t}\n\tif len(t.PrConfigs) > 0 {\n\t\tfor _, repo := range t.PrConfigs {\n\t\t\tif len(repo) > 0 {\n\t\t\t\tfor _, pr := range repo {\n\t\t\t\t\tif pr.PrNumber == 0 {\n\t\t\t\t\t\tlog.WithError(err).Fatalf(\"Pull request number for repo was not provided.\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.WithError(err).Fatalf(\"Pull request number for repo was not provided.\")\n\t\t\t}\n\t\t}\n\t}\n\treturn t\n}", "title": "" }, { "docid": "0478fe55a1ccfaad4f771c1202140fe1", "score": "0.54560333", "text": "func (c *Config) Read() {\n\tif len(os.Args) < 1 {\n\t\tpanic(\"Please input the config file dir for the service\")\n\t}\n\tcomfigFile := os.Args[1]\n\tfmt.Println(\"Service config file in: \", comfigFile)\n\tif _, err := toml.DecodeFile(comfigFile, &c); err != nil {\n\t\tfmt.Println(\"Cannot parse config file : \" ,err)\n\t}\n}", "title": "" }, { "docid": "a88649a27d595199bfb4877489a4e1ac", "score": "0.5455838", "text": "func ReadFromFile() (*Config, error) {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\tlog.Printf(\"Error while reading current user : %v\", err)\n\t}\n\n\tconfigPath := path.Join(usr.HomeDir, `.solana-mc/config/`) // will be used to run as system service using script file\n\tlog.Printf(\"Config Path of root: %s\", configPath)\n\n\tenvConfigPath := os.Getenv(\"CONFIG_PATH\") // read exported config path if any\n\tlog.Printf(\"Exported env config path : %s\", envConfigPath)\n\n\tv := viper.New()\n\tv.AddConfigPath(\".\")\n\tv.AddConfigPath(\"../\")\n\tv.AddConfigPath(configPath)\n\tv.AddConfigPath(envConfigPath)\n\tv.SetConfigName(\"config\")\n\tif err := v.ReadInConfig(); err != nil {\n\t\tlog.Fatalf(\"error while reading config.toml: %v\", err)\n\t}\n\n\tvar cfg Config\n\tif err := v.Unmarshal(&cfg); err != nil {\n\t\tlog.Fatalf(\"error unmarshaling config.toml to application config: %v\", err)\n\t}\n\n\tif err := cfg.Validate(); err != nil {\n\t\tlog.Fatalf(\"error occurred in config validation: %v\", err)\n\t}\n\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "818fb8fcf552813160130a57be756326", "score": "0.54545707", "text": "func readConfig() {\n Config = make(map[string]interface{})\n file, e := ioutil.ReadFile(\"/etc/mumbo-conf.json\")\n\n if e != nil {\n extendConfig(Config)\n } else {\n json.Unmarshal(file, &Config)\n\n // extend config with defaults\n extendConfig(Config)\n }\n\n // initialize the system\n initializer()\n}", "title": "" }, { "docid": "cce8eab37454a14cb68c139faecf4637", "score": "0.54365915", "text": "func readConfig(filename string) Config {\n\n\tconfig := Config{\n\t\tTargets: []Target{Target{Name: \"Local HTTP Server\", Addr: \"localhost:80\"}},\n\t}\n\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\t// unaccessible or not exisiting file -> creatoin\n\t\tfile, err = os.Create(filename)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// config file just created\t\t\n\t\terr := json.NewEncoder(file).Encode(config)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t} else {\n\n\t\terr = json.NewDecoder(file).Decode(&config)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\treturn config\n}", "title": "" }, { "docid": "ff1f821cbd8dbf830e3ccec177bd2874", "score": "0.54308796", "text": "func openAndParseConfig(t *testing.T, path string) {\n\tviper.SetConfigType(\"yaml\")\n\tviper.SetConfigFile(path + \"/config.yaml\")\n\t_, err := parseConfig()\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "704fd265effb64914deb2a8e92f7a347", "score": "0.5429837", "text": "func (c *Config) Read() {\r\n\tif _, err := toml.DecodeFile(\"config.toml\", &c); err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}", "title": "" }, { "docid": "c20c7ba0fd4a0724936c9950077b8f9c", "score": "0.54269207", "text": "func newConfig(path string) Configuration {\n\tdefaultHosts := []TraefikHost{{\n\t\tHost: \"127.0.0.1:8080\",\n\t\tMinServices: 0,\n\t}}\n\n\tconfig := Configuration{\n\t\tListenAddr: \"0.0.0.0:10700\",\n\t\tPollInterval: 10,\n\t\tTraefikHosts: defaultHosts,\n\t\tConsulHost: \"127.0.0.1:8500\",\n\t\tHealthyTTLSec: 0,\n\t\tHealthyTTLOffset: 43200,\n\t}\n\n\tif _, err := os.Stat(path); err == nil {\n\t\tfile, _ := os.Open(path)\n\t\tdefer file.Close()\n\n\t\tdecoder := json.NewDecoder(file)\n\t\terr := decoder.Decode(&config)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Unable to read config file. Check json is correct.\", err)\n\t\t}\n\t}\n\n\tif config.HealthyTTLSec > 0 {\n\t\tconfig.HealthyTTLSec = computeTtl(config.HealthyTTLSec, config.HealthyTTLOffset)\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "dfb13732ba4a75b3a809d9b76700d1d8", "score": "0.54260427", "text": "func initConfig() {\n\tlog.Info(\"扫描到的配置文件\", cfgFile)\n\tif cfgFile != \"\" {\n\t\tb, err := ioutil.ReadFile(cfgFile)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).WithField(\"config:\", cfgFile).Fatal(\"error loading config file\")\n\t\t}\n\t\tfmt.Printf(\"配置文件打印 \\n %s \\n\",string(b))\n\t\tviper.SetConfigType(\"toml\")\n\t\t// Use config file from the flag.\n\t\tif err = viper.ReadConfig(bytes.NewBuffer(b)); err != nil {\n\t\t\tlog.WithError(err).WithField(\"config:\", cfgFile).Fatal(\"error read config file\")\n\t\t}\n\t} else {\n\t\tviper.SetConfigType(\"toml\")\n\t\tviper.SetConfigName(\"source\")\n\t\tviper.AddConfigPath(\".\")\n\t\tviper.AddConfigPath(\"$HOME/.config/source\")\n\t\tviper.AddConfigPath(\"./config/\")\n\t\t//viper.AddConfigPath(\"./config/\")\n\t\tif err := viper.ReadInConfig(); err != nil {\n\t\t\tswitch err.(type) {\n\t\t\tcase viper.ConfigFileNotFoundError:\n\t\t\t\tlog.Warning(\"no config file found\")\n\t\t\tdefault:\n\t\t\t\tlog.WithError(err).Fatal(\"read config file err, exit\")\n\t\t\t}\n\n\t\t}\n\t}\n\n\t// If a config file is found, read it in.\n\tif err := viper.Unmarshal(&config.C); err != nil {\n\t\tlog.WithError(err).Fatal(\"unmarshal config error\")\n\t}\n}", "title": "" }, { "docid": "ea780e74a220028d346a21258441df22", "score": "0.5418772", "text": "func newConfig() *config {\n\tcfg := &config{\n\t\tnarration: os.Stdout,\n\t\troles: make(map[string]*role),\n\t\tactors: make(map[string]*actor),\n\t\tsceneSpecs: make(map[byte]*sceneSpec),\n\t\tpVars: make(map[string]string),\n\t\ttempo: time.Second,\n\t\taudience: make(map[string]*audienceMember),\n\t\tvars: make(map[varName]*variable),\n\t\ttextPlotHeight: 24,\n\t\ttextPlotWidth: 160,\n\t\ttextPlotTerm: \"ansi256\",\n\t\trepeatCount: -1,\n\t\trepeatTimeout: -1,\n\t}\n\tif sh, ok := os.LookupEnv(\"SHELL\"); ok {\n\t\tcfg.shellPath = sh\n\t} else {\n\t\tcfg.shellPath = \"/bin/bash\"\n\t}\n\tif gp, ok := os.LookupEnv(\"GNUPLOT\"); ok {\n\t\tcfg.gnuplotPath = gp\n\t} else {\n\t\tcfg.gnuplotPath = \"gnuplot\"\n\t}\n\tcfg.maybeAddVar(nil, varName{sigName: \"t\"}, false)\n\tcfg.maybeAddVar(nil, varName{sigName: \"mood\"}, false)\n\tcfg.maybeAddVar(nil, varName{sigName: \"moodt\"}, false)\n\treturn cfg\n}", "title": "" }, { "docid": "a17cb56fcb0ab35ac1437765faa0987b", "score": "0.5417216", "text": "func (c *TricksterConfig) loadFile() error {\n\tmd, err := toml.DecodeFile(Flags.ConfigPath, c)\n\tif err != nil {\n\t\tc.setDefaults(&toml.MetaData{})\n\t\treturn err\n\t}\n\terr = c.setDefaults(&md)\n\treturn err\n}", "title": "" }, { "docid": "8c09696bd9ffedb019ad5059ec3c6016", "score": "0.5416648", "text": "func (c *Config) Read() error {\n\tdata, err := ioutil.ReadFile(c.File)\n\tif err != nil {\n\t\tfmt.Printf(\"Error reading config file: %s\", err)\n\t\treturn err\n\t}\n\n\tif err := toml.Unmarshal(data, c); err != nil {\n\t\tfmt.Printf(\"Error unmarshaling toml: %s\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd1ac7b1449b879d8d1a343dc6445a1a", "score": "0.5414121", "text": "func load() Conf {\n\tlocal_config := Conf{}\n\tlocal_config.new()\n\treturn local_config\n}", "title": "" }, { "docid": "bb343732ec0eabaf6a2822534aad2dc5", "score": "0.5411287", "text": "func initConfig() {\n\tif cfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\t\t// Find home directory.\n\t\thome, err := homedir.Dir()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// Search config in home directory with name \".terramove\" (without extension).\n\t\tviper.AddConfigPath(home)\n\t\tviper.SetConfigName(\".terramove\")\n\n\t}\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tpanic(fmt.Errorf(\"Fatal error config file: %s \\n\", err))\n\t}\n\n\t// If a config file is found, read it into terramoveConfig\n\tif err := viper.Unmarshal(&config); err != nil {\n\t\tfmt.Printf(\"Unable to decode into struct, %v\", err)\n\t}\n}", "title": "" }, { "docid": "cce1996e32c5d37c09b6a0571ea2504e", "score": "0.5411038", "text": "func loadConfig() (*Spacetime, error) {\n\t// Get file.\n\tconfig := getConfigFile()\n\n\t// Read data from file.\n\tfile, err := ioutil.ReadFile(config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Load data into new spacetime object.\n\tpvdr := new(Spacetime)\n\tif err = json.Unmarshal(file, &pvdr); err != nil {\n\t\tpvdr = &Spacetime{Providers: map[string]Provider{}}\n\t\treturn pvdr, nil\n\t}\n\n\treturn pvdr, nil\n}", "title": "" }, { "docid": "acd81b6a825b987f5870a0491789dd41", "score": "0.5409588", "text": "func newPopulation(config ConfigPopulation) generationPopulation {\n\treturn generationPopulation{config: config}\n}", "title": "" }, { "docid": "be2e7c4495bcbda952c5a343d7a19e0f", "score": "0.540025", "text": "func Load(wd string) (*Config, error) {\n\tcwd := wd\n\tif len(cwd) == 0 {\n\t\tvar err error\n\t\tcwd, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\twhich, err := findUp(cwd, configFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cached, ok := cache[which]; ok {\n\t\treturn cached, nil\n\t}\n\n\tbytes, err := readFile(which)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := &Config{}\n\terr = toml.Unmarshal(bytes, config)\n\tif err != nil {\n\t\tfmt.Printf(\"bad TOML? %s: %v\\n\", which, err)\n\t\treturn nil, err\n\t}\n\n\tcache[which] = config\n\n\treturn config, nil\n}", "title": "" }, { "docid": "ce088607bbeee0f2d3025af8753153f0", "score": "0.5397517", "text": "func New(filename string) (Config, error) {\n\tcfgFile, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tc := Config{}\n\terr = yaml.Unmarshal(cfgFile, &c)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "d71eb92a2317a0883b6c9e5103bb89af", "score": "0.5392764", "text": "func ReadConfig(in io.Reader) error { return v.ReadConfig(in) }", "title": "" }, { "docid": "9c4a959fa5e0a380b8178fc81f66019b", "score": "0.53921294", "text": "func Read(repoPath string) (*Config, error) {\n\n\tdata, err := ioutil.ReadFile(path.Join(repoPath, \"textile\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar conf *Config\n\tif err := json.Unmarshal(data, &conf); err != nil {\n\t\treturn nil, err\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "1a30c4965e291a9daba1274ab2832bf7", "score": "0.5387382", "text": "func ParseConfig() Packages {\n p := Packages{}\n if (checkGopacfileExists(&p) == true) {\n config_data := jconfig.LoadConfig(p.file_path)\n require := config_data.GetStringMap(\"require\")\n\n sortRequiredPackages(&p, require)\n }\n return p\n}", "title": "" }, { "docid": "11df4ae43b0a0911221edbe0e589911b", "score": "0.5376168", "text": "func New(filepath string) (Config, error) {\n\tfile, err := os.Open(filepath)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\n\tvar config Config\n\tif err := yaml.NewDecoder(file).Decode(&config); err != nil {\n\t\treturn Config{}, err\n\t}\n\n\tif err = file.Close(); err != nil {\n\t\treturn Config{}, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "950c4c5111eeb1d330e69fc682701d26", "score": "0.53735745", "text": "func NewConfig(fp string) (Config, error) {\n\tbuf, err := ioutil.ReadFile(fp)\n\tc := Config{}\n\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\terr = json.Unmarshal(buf, &c)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "6e4da0e7ed9f6467041886b6c800e222", "score": "0.5371093", "text": "func loadConfig() (*windowConfig, error) {\n\tvar config windowConfig\n\tpath := path.Join(\".\", configFileName)\n\n\tif _, err := file.NewFileData(path); os.IsNotExist(err) {\n\t\treturn &config, nil //no added config bail out early\n\t}\n\n\tconfigFile, fileErr := file.NewFile(configFileName)\n\tif fileErr != nil {\n\t\treturn nil, fileErr\n\t}\n\n\tif _, err := toml.DecodeReader(configFile, &config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "title": "" }, { "docid": "96951ea366ddec7503eed5e81d043759", "score": "0.5368099", "text": "func readConfig(confDir string) (Configuration, error) {\n\tvar config Configuration\n\tif _, err := os.Stat(confDir + \"/gore/config.toml\"); !os.IsNotExist(err) { //OK -> read\n\t\tif _, err := toml.DecodeFile(confDir+\"/gore/config.toml\", &config); err != nil {\n\t\t\treturn config, ErrFileError\n\t\t}\n\t} else {\n\t\treturn config, ErrFileNotExist //NOT OK -> write\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "5283a12969f4e6f0f754aac260cdca6f", "score": "0.53675544", "text": "func ReadConfig(configFile string) (config Config) {\n\n\tif _, err := toml.DecodeFile(configFile, &config); err != nil {\n\t\tlog.Panicf(\"Unable to parse config file: %v\", err)\n\t}\n\n\tif config.Graphite.Interval == 0 {\n\t\tconfig.Graphite.Interval = 10\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "13238d8f776aafa2834c07464d072664", "score": "0.53590214", "text": "func ReadInConfig() error { return v.ReadInConfig() }", "title": "" }, { "docid": "7ce749b6fc33f24b3eebbb01e2fb6164", "score": "0.5355501", "text": "func parseConfig(file *os.File) (Config, error) {\n\tbuilderConfig := Config{}\n\ttomlMetadata, err := toml.NewDecoder(file).Decode(&builderConfig)\n\tif err != nil {\n\t\treturn Config{}, errors.Wrap(err, \"decoding toml contents\")\n\t}\n\n\tundecodedKeys := tomlMetadata.Undecoded()\n\tif len(undecodedKeys) > 0 {\n\t\tunknownElementsMsg := config.FormatUndecodedKeys(undecodedKeys)\n\n\t\treturn Config{}, errors.Errorf(\"%s in %s\",\n\t\t\tunknownElementsMsg,\n\t\t\tstyle.Symbol(file.Name()),\n\t\t)\n\t}\n\n\treturn builderConfig, nil\n}", "title": "" }, { "docid": "b9de3597340b238e7733f9836c674326", "score": "0.5348137", "text": "func ConfigFileToPackageToml(path string) (*models.PackageToml, error) {\n\tvar returnPackageToml models.PackageToml\n\t_, err := toml.DecodeFile(path, &returnPackageToml)\n\treturn &returnPackageToml, err\n}", "title": "" }, { "docid": "8e01266edb8ff67e49921d6fe39a573d", "score": "0.5339208", "text": "func ReadConf() error { return owl.ReadConf() }", "title": "" }, { "docid": "f05ee9e9051a9a8ab7446d4c4e8d4a23", "score": "0.5329978", "text": "func getConfigFromViper(cmd *cobra.Command, v *viper.Viper) (*config.Properties, error) {\n\t// override supernodes in config file if --node is specified in cli.\n\t// use default value if no supernodes is configured in config file\n\tif cmd.Flags().Lookup(\"node\").Changed ||\n\t\tlen(v.GetStringSlice(\"supernodes\")) == 0 {\n\t\tv.Set(\"supernodes\", v.GetStringSlice(\"node\"))\n\t}\n\n\tvar cfg config.Properties\n\tif err := v.Unmarshal(&cfg, func(dc *mapstructure.DecoderConfig) {\n\t\tdc.TagName = \"yaml\"\n\t\tdc.DecodeHook = decodeWithYAML(\n\t\t\treflect.TypeOf(config.Regexp{}),\n\t\t\treflect.TypeOf(config.URL{}),\n\t\t\treflect.TypeOf(config.CertPool{}),\n\t\t\treflect.TypeOf(time.Second),\n\t\t\treflect.TypeOf(rate.B),\n\t\t)\n\t}); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unmarshal yaml\")\n\t}\n\n\t// use `{WorkHome}/dfdaemon/data/` as repo dir if localrepo is not configured.\n\tif cfg.DFRepo == \"\" {\n\t\tcfg.DFRepo = filepath.Join(cfg.WorkHome, \"dfdaemon/data/\")\n\t}\n\n\treturn &cfg, cfg.Validate()\n}", "title": "" }, { "docid": "a5cad40fa78a25578f1af54b46ac0854", "score": "0.53297085", "text": "func readConfig(filename string) CoreConf {\n\tvar conf CoreConf\n\n\tif filename == \"\" {\n\t\tconf.DbPath = \"./urls.bolt\"\n\t\tconf.ListenPort = 8080\n\t} else {\n\t\tb, err := ioutil.ReadFile(filename)\n\t\tif err != nil {\n\t\t\t/*fmt.Println(\"Cannot read configuration file \", filename)\n\t\t\t os.Exit(1)*/\n\t\t\tlog.Fatal(\"Cannot read configuration file \", filename)\n\t\t}\n\t\tvar conf CoreConf\n\t\terr = json.Unmarshal(b, &conf)\n\t\tif err != nil {\n\t\t\t/*fmt.Println(\"Cannot parse configuration file: \", err)\n\t\t\t os.Exit(1)*/\n\t\t\tlog.Fatal(\"Cannot read configuration file \", filename)\n\t\t}\n\t}\n\treturn conf\n}", "title": "" }, { "docid": "252e3da48476df516371142c7e1608bd", "score": "0.5321843", "text": "func New(filename string) *Config {\n\tfmt.Println(\"Loading config\")\n\n\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\n\tvar err error\n\tvar configReader *cfg.Config\n\tconfigReader, err = cfg.ParseYamlFile(filename)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tconfig := Config{}\n\n\tconfig.Slack.Token, err = configReader.String(\"slack.token\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tconfig.Wrike.Token, err = configReader.String(\"wrike.token\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tconfig.Wrike.ID, err = configReader.String(\"wrike.id\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tconfig.Wrike.Secret, err = configReader.String(\"wrike.secret\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn &config\n}", "title": "" }, { "docid": "3eef6da996a0438ff03c6552c71e20c7", "score": "0.5313653", "text": "func LoadConfig(fp string) (Config, error) {\n\tvar c Config\n\tvar err error\n\tif _, err = toml.DecodeFile(fp, &c); err != nil {\n\t\treturn c, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "75bf90472c5539ddc814ab3dc7996aed", "score": "0.53134954", "text": "func (gc *GoCart) loadConfig() error {\n\n text, err := ioutil.ReadFile(\"./config.yml\")\n if err != nil {\n panic(err)\n }\n config := Configuration{}\n yaml_err := yaml.Unmarshal([]byte(text), &config)\n\n if yaml_err != nil {\n panic(yaml_err)\n }\n gc.Config = config\n return nil\n}", "title": "" }, { "docid": "b1974ef9d3daefded38568982d669eef", "score": "0.5311949", "text": "func newProjectsConfig() (*projectsConfig, error) {\n\tc := &projectsConfig{\n\t\tProjects: map[string]string{},\n\t}\n\n\t// Lookup custom config path and default to ~/.monorails.yml\n\tprojectsConfig, ok := os.LookupEnv(\"MONORAILS_CONFIG\")\n\tif !ok {\n\t\thome, err := os.UserHomeDir()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprojectsConfig = path.Join(home, \".monorails.yml\")\n\t}\n\tc.configPath = projectsConfig\n\n\t// Read config file and instantiate a new projectsConfig\n\tin, err := ioutil.ReadFile(c.configPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := yaml.Unmarshal(in, c); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "d08020a6f18efbc08eee1182a77e5f66", "score": "0.5309873", "text": "func readConfig() *Data {\n\tloadFile(configfile)\n\n\tvar config Data\n\tif _, err := toml.DecodeFile(configfile, &config); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif config.Parties == nil {\n\t\tconfig.Parties = make(map[string]Party)\n\t}\n\n\tif config.Invoices == nil {\n\t\tconfig.Invoices = make(map[string][]Invoice)\n\t}\n\n\treturn &config\n}", "title": "" }, { "docid": "00cdf389aeddf13330449554138daa8e", "score": "0.5305446", "text": "func (f *File) Config() (*Config, error) {\n\tc := new(Config)\n\tr := newTgzReader(f.find(\"control.tar.gz\"), \"config.json\")\n\tdefer r.Close()\n\n\terr := json.NewDecoder(r).Decode(c)\n\treturn c, err\n}", "title": "" }, { "docid": "ca799fc752aa3b505e822d67d84b719c", "score": "0.5301856", "text": "func LoadConfigFromFile(path string) (*Project, error) {\n\tviper.SetConfigFile(path)\n\n\tconf := new(Project)\n\tviper.Unmarshal(conf)\n\n\tviper.ReadInConfig()\n\terr := viper.Unmarshal(&conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "03412b50329d72541e50af4ed99d87ac", "score": "0.530054", "text": "func initConfig() {\n\tif cfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\t\t// Find home directory.\n\t\thome, err := homedir.Dir()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// Search config in home directory with name \".newApp\" (without extension).\n\t\tviper.AddConfigPath(home)\n\t\tviper.SetConfigName(\".iotc.yml\")\n\t\tviper.SetConfigType(\"yml\")\n\t}\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\tvar format = `Add a configuration file $HOME/.iotc.yml with the file format:\n\napps:\n - name: myapp1\n subdomain: app1\n appToken: app1Token\n - name: myapp2\n subdomain: app2\n appToken: app2Token\n\n# Maximum number of rows to retrieve for 'list' commands\nmaxRows: 25\n\n# Default format of the tables\nformat: pretty\n`\n\t\tfmt.Print(format)\n\t} else {\n\t\t//fmt.Println(\"Using config file:\", viper.ConfigFileUsed())\n\t}\n\n\tinitAppConfig()\n}", "title": "" }, { "docid": "0399150f3447c61b19d10af9e1a5c042", "score": "0.53000355", "text": "func NewConfig(workspace string) *LPNConfig {\n\tlpnConfig, err := readConfig(workspace, fileName, map[string]interface{}{\n\t\t\"container\": map[string]interface{}{\n\t\t\t\"names\": map[string]interface{}{\n\t\t\t\t\"db\": dbContainerNames,\n\t\t\t\t\"portal\": portalContainerNames,\n\t\t\t},\n\t\t},\n\t\t\"images\": map[string]interface{}{\n\t\t\t\"db\": dbImages,\n\t\t\t\"portal\": portalImages,\n\t\t},\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Error when reading config: %v\\n\", err)\n\t}\n\n\treturn &lpnConfig\n}", "title": "" }, { "docid": "09dc083b62778c521ce2128005a21874", "score": "0.52896786", "text": "func readViperConfig(appName string) *viper.Viper {\n\n\tv := viper.New()\n\t// global defaults\n\tv.SetDefault(\"json_logs\", false)\n\tv.SetDefault(\"loglevel\", \"info\")\n\tv.SetDefault(\"log_filename\", \"minidoc.log\")\n\tv.SetDefault(\"generated_doc_path\", \"/Documents/minidocs\")\n\n\t// Find home directory.\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tv.AddConfigPath(home)\n\tv.SetConfigName(\".minidoc\")\n\t//v.SetConfigType(\"yml\")\n\n\tv.SetEnvPrefix(appName)\n\tv.AutomaticEnv()\n\n\t// If a config file is found, read it in.\n\tif err := v.ReadInConfig(); err != nil {\n\t\t// if the error occurs, rely on default\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "f5db0e1685761459ca2361226df36cab", "score": "0.52876997", "text": "func ExampleFromFile() {\n\tos.Setenv(\"PORT\", \"9000\")\n\tvar c = new(AppConfig)\n\tif err := FromFile(\"config_example.yaml\", c); err != nil {\n\t\tfmt.Printf(\"Error: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", *c)\n\t// OUTPUT: {Server:{Port:9000} Database:{Driver:postgres Hostname:localhost Port:5432 Username:postgres Password:dummy Name:my_database}}\n}", "title": "" }, { "docid": "d6dc7bcf46dec175674b6dd07d1ee1f3", "score": "0.5282483", "text": "func NewConfig(file string) (*TomlConfig, error) {\n\tconfigInstance = &TomlConfig{}\n\n\tif _, err := toml.DecodeFile(file, configInstance); err != nil {\n\t\treturn nil, err\n\t}\n\tdump(configInstance)\n\n\t// check required fields\n\t// Main\n\tif configInstance.Main.ListenAddr == \"\" {\n\t\trequest.GetLogger().Fatalln(\"Main.ListenAddr must be specified. Check your Config file\")\n\t}\n\tif configInstance.Main.ListenPort == 0 {\n\t\trequest.GetLogger().Fatalln(\"Main.ListenPort must be specified. Check your Config file\")\n\t}\n\treturn configInstance, nil\n}", "title": "" }, { "docid": "b9bb4b69fef958b9f715a2ef48a4abdd", "score": "0.52768856", "text": "func ReadConfig() Config {\n\tvar configfile = \"properties.ini\"\n\t_, err := os.Stat(configfile)\n\tif err != nil {\n\t\tlog.Fatal(\"Config file is missing: \", configfile)\n\t}\n\n\tvar config Config\n\tif _, err := toml.DecodeFile(configfile, &config); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t//log.Print(config.Index)\n\treturn config\n}", "title": "" }, { "docid": "d47b53e1c2f45becbeadf2a25c6f2bed", "score": "0.52729315", "text": "func parseConfig(stream io.Reader) (*Config, error) {\n\tvar config *Config\n\terr := jconf.ParseInto(stream, &config)\n\treturn config, err\n}", "title": "" }, { "docid": "21fec4af22ed669400e3ae804d30b261", "score": "0.5270978", "text": "func newConfig(path string, prefix string, camelCase bool) *multiconfig.DefaultLoader {\n\tvar loaders []multiconfig.Loader\n\n\t// Read default values defined via tag fields \"default\"\n\tloaders = append(loaders, &multiconfig.TagLoader{})\n\n\tif path != \"\" {\n\t\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\t\tlog.Warnf(\"Provided local config file [%s] does not exist. Flags and \"+\n\t\t\t\t\"Environment variables will be used \", path)\n\t\t} else {\n\t\t\tlog.Infof(\"Local config file [%s] will be used\", path)\n\t\t\t// Choose what while is passed\n\t\t\tif strings.HasSuffix(path, \"toml\") {\n\t\t\t\tlog.Debugf(\"Toml detected\")\n\t\t\t\tloaders = append(loaders, &multiconfig.TOMLLoader{Path: path})\n\t\t\t}\n\t\t}\n\t}\n\n\te := &multiconfig.EnvironmentLoader{\n\t\tPrefix: prefix,\n\t\tCamelCase: camelCase,\n\t}\n\n\tusageMsg := setFlagsHelp()\n\tf := &multiconfig.FlagLoader{\n\t\tPrefix: \"\",\n\t\tFlatten: false,\n\t\tCamelCase: camelCase,\n\t\tEnvPrefix: prefix,\n\t\tErrorHandling: 0,\n\t\tArgs: nil,\n\t\tFlagUsageFunc: func(s string) string { return usageMsg[s] },\n\t}\n\n\tloaders = append(loaders, e, f)\n\tloader := multiconfig.MultiLoader(loaders...)\n\n\td := &multiconfig.DefaultLoader{}\n\td.Loader = loader\n\td.Validator = multiconfig.MultiValidator(&multiconfig.RequiredValidator{})\n\n\treturn d\n}", "title": "" }, { "docid": "3ab56a9ea7d7f8cb42d07e5b56b1d5a2", "score": "0.5266498", "text": "func readConfig(cfgFile string) (*Config, error) {\n\tvar cfg Config\n\tswitch {\n\tcase !fileExists(cfgFile):\n\t\tcfg = DefaultCfg\n\tdefault:\n\t\tcfg.Path = cfgFile\n\t\tif err := checkCfgFilePerms(cfgFile); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := toml.DecodeFile(cfgFile, &cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "43db00bfcda4aea410aa5dc9859116c7", "score": "0.52651155", "text": "func ReadConfig() {\n\n\t// Config aus file laden:\n\n\tAppConfig.Info = \"TestInfoComment\"\n\n\terr := gonfig.GetConf(\"./config.development.json\", &AppConfig)\n\tif err != nil {\n\t\tfmt.Printf(\"ERROR: Could not read config: %v\\n \", err.Error())\n\t\tfmt.Printf(\"Trying second file location\\n\")\n\t\terr2 := gonfig.GetConf(\"../config.development.json\", &AppConfig)\n\t\tif err2 != nil {\n\t\t\tfmt.Printf(\"ERROR: Config second location also failed: %v\\n \", err.Error())\n\t\t}\n\t}\n\n\t//fmt.Println(\"Info: DBHost: \", AppConfig.DBHost)\n\t//fmt.Println(\"Info: DBPort: \", AppConfig.DBPort)\n\n\tmodels.DBInfo = AppConfig.DBUser + \":\" + AppConfig.DBPassword + \"@tcp(\" + AppConfig.DBHost + \":\" + AppConfig.DBPort + \")/\" + AppConfig.DBName\n\t//DBInfo := AppConfig.DBUser + \":\" + AppConfig.DBPassword + \"@tcp(\" + AppConfig.DBHost + \":\" + AppConfig.DBPort + \")/\" + AppConfig.DBName\n\t//fmt.Printf(\"got DBInfo: %s\", models.DBInfo)\n}", "title": "" }, { "docid": "ac27ab95ee47bba60a8576314bc856fb", "score": "0.52597034", "text": "func Load(mc *minio.Client, bucket string) (*Cfg, error) {\n\tobject, err := mc.GetObject(bucket, \"quice.toml\", minio.GetObjectOptions{})\n\tif err != nil {\n\t\tlog.Fatal(\"Could not read config file\")\n\t\treturn nil, err\n\t}\n\tbuf := new(bytes.Buffer)\n\tn, err := buf.ReadFrom(object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.WithField(\"size\", n).Debug(\"reading quice.toml\")\n\tf := buf.Bytes()\n\n\tvar v Cfg\n\t_, err = toml.Decode(string(f), &v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &v, nil\n\n}", "title": "" }, { "docid": "ce6bdbe89f132c7b373f83234200f151", "score": "0.5257342", "text": "func ConfigFromFile(named string) Config {\n\tc := ConfigFromFlags() // always parse flags\n\tf, err := os.Open(named)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to read configuration\", err)\n\t}\n\tdefer f.Close()\n\terr = json.NewDecoder(f).Decode(&c)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to decode configuration\", err)\n\t}\n\tapplyFlagOverrides(&c)\n\treturn c\n}", "title": "" }, { "docid": "fded4796528434a14519e623181eaaf0", "score": "0.5257335", "text": "func New(path string) (*Settings, error) {\n\tconfig := new(Settings)\n\tif _, err := toml.DecodeFile(path, config); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "e83b0df7878fc98aaacb5bd7793371ad", "score": "0.52563095", "text": "func (nr *ProviderNewRelic) LoadConfig(pathToConfig string) error {\n\tconfigFile, openErr := os.Open(pathToConfig)\n\tif openErr != nil {\n\t\treturn openErr\n\t}\n\tdefer configFile.Close()\n\n\tjsonParser := json.NewDecoder(configFile)\n\n\tvar relicConf NRConfig\n\tdecodeErr := jsonParser.Decode(&relicConf)\n\tif decodeErr != nil {\n\t\treturn decodeErr\n\t}\n\n\tnr.Config = relicConf\n\n\treturn nil\n}", "title": "" }, { "docid": "a3f2ca12949de83c4937efe5630bc55e", "score": "0.5255082", "text": "func NewConfig(file string) (c *Config, err error) {\n\tvar gconf = goconf.New()\n\tc = &Config{}\n\tif err = gconf.Parse(file); err != nil {\n\t\treturn\n\t}\n\tif err = gconf.Unmarshal(c); err != nil {\n\t\treturn\n\t}\n\tc.setDefault()\n\treturn\n}", "title": "" }, { "docid": "a3f2ca12949de83c4937efe5630bc55e", "score": "0.5255082", "text": "func NewConfig(file string) (c *Config, err error) {\n\tvar gconf = goconf.New()\n\tc = &Config{}\n\tif err = gconf.Parse(file); err != nil {\n\t\treturn\n\t}\n\tif err = gconf.Unmarshal(c); err != nil {\n\t\treturn\n\t}\n\tc.setDefault()\n\treturn\n}", "title": "" }, { "docid": "a94be41c3f84cd911c19ed2b194d874a", "score": "0.52513313", "text": "func load_cfg() {\n\tcleanenv.ReadConfig(\"./config.yml\", &cfg)\n}", "title": "" }, { "docid": "da1643efc2ca0a80a104b84fefe36384", "score": "0.5251154", "text": "func newProjectConfig(conf projectJSON) (*ProjectConfig, error) {\n\tunits := []systemdUnit{}\n\tfor _, unitFile := range conf.Units {\n\t\tunit, err := newSystemdUnit(unitFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tunits = append(units, *unit)\n\t}\n\tfor _, d := range conf.Dropins {\n\t\tdropin, err := d.Load()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tunits = append(units, *dropin)\n\t}\n\treturn &ProjectConfig{\n\t\tunits: units,\n\t\tfiles: conf.Files,\n\t\tsecretFiles: conf.Secrets,\n\t}, nil\n}", "title": "" }, { "docid": "a94892337c21f104ba75d9d50519fbaf", "score": "0.5248988", "text": "func existingConfig(path string) *ConfigState {\n\tconf, err := ioutil.ReadFile(path)\n\tcs := &ConfigState{}\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tfmt.Println(\"missing configuration... will just create a new one\")\n\t\t\treturn cs\n\t\t}\n\t\tpanic(fmt.Sprintf(\"cannot open config: %v\", err))\n\t}\n\n\tparts := strings.Split(string(conf), \"\\n\")\n\tcs.Config = strings.Join(parts[1:], \"\\n\")\n\tcs.Md5Sum = parseMarkerTag(parts[0])\n\treturn cs\n}", "title": "" }, { "docid": "2b6f3a436a676560519c95768f4bfd72", "score": "0.5247536", "text": "func ParseFromFile(filename string) (*Config, error) {\n\tconf := newConf()\n\terr := cmtjson.ParseFromFile(filename, &conf.origin)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "4acf20665a0ed88cd97ff87703e7dd9a", "score": "0.52460665", "text": "func NewConfig(c *Config, data string) error {\n\n\t_, err := toml.Decode(data, c)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a65bdd1248eb2623ea8ff97f4d4279f", "score": "0.52421975", "text": "func loadConfig(mapFile string) (*config.Map, error) {\n\tfile, err := os.Open(mapFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar parser config.Parser\n\tm, err := parser.Parse(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Infof(\"loadConfig successful: %+v\", *m)\n\n\treturn m, nil\n}", "title": "" }, { "docid": "773cc122ec304d00063412a9b90b26ba", "score": "0.5239928", "text": "func FromFile(filePath string) (Config, error) {\n\tb, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\n\tconf := &Config{\n\t\tBackgroundVerification: DefaultBackgroundVerificationConfig(),\n\t\tReconciliation: DefaultReconciliationConfig(),\n\t\tReplication: DefaultReplicationConfig(),\n\t\tPrometheus: prometheus.DefaultConfig(),\n\t\tPrometheusExcludeDatabaseFromDefaultMetrics: true,\n\t\t// Sets the default Failover, to be overwritten when deserializing the TOML\n\t\tFailover: Failover{Enabled: true, ElectionStrategy: ElectionStrategyPerRepository},\n\t\tRepositoriesCleanup: DefaultRepositoriesCleanup(),\n\t}\n\tif err := toml.Unmarshal(b, conf); err != nil {\n\t\treturn Config{}, err\n\t}\n\n\t// TODO: Remove this after failover_enabled has moved under a separate failover section. This is for\n\t// backwards compatibility only\n\tif conf.FailoverEnabled {\n\t\tconf.Failover.Enabled = true\n\t}\n\n\tconf.setDefaults()\n\n\treturn *conf, nil\n}", "title": "" }, { "docid": "20068fc6288f0ce9d026f01ada452c4f", "score": "0.5239503", "text": "func ConfParser(file string, in interface{}) (error) {\n yamlFile, err := ioutil.ReadFile(file)\n if err != nil {\n msg := fmt.Sprintf(\"failed to read '%s' with err: %s\", file, err.Error())\n return errors.New(msg)\n }\n err = yaml.UnmarshalStrict(yamlFile, in)\n if err != nil {\n msg := fmt.Sprintf(\"failed to unmarshal '%s' with err: %s\", file, err.Error())\n return errors.New(msg)\n }\n return nil\n}", "title": "" }, { "docid": "025c86283399746b80b7a63af37af67f", "score": "0.52388513", "text": "func newApp(cfgFile string) (*app, error) {\n\tf, err := common.LoadFile(cfgFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load config file: %w\", err)\n\t}\n\n\tcfg := &config{}\n\tif _, err = toml.Decode(string(f), cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse toml config: %w\", err)\n\t}\n\n\treturn &app{\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "a13082b838fe984fd5215d3804ec49d0", "score": "0.523533", "text": "func ReadConfig() tomlConfig {\n\t_, err := os.Stat(\"/Users/david/workspace/GolangVideoProject/config.toml\")\n\tif err != nil {\n\t\tlog.Fatal(\"Config file is missing: \", \"/Users/david/workspace/GolangVideoProject/config.toml\")\n\t}\n\tvar conf tomlConfig\n\tif _, err := toml.DecodeFile(\"/Users/david/workspace/GolangVideoProject/config.toml\", &conf); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn conf\n}", "title": "" }, { "docid": "5bcdd5c2728c8788d17df4e47514a2d3", "score": "0.5234671", "text": "func New(path string) (*Settings, error) {\n\tconfig := &Settings{}\n\tif _, err := toml.DecodeFile(path, config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "aae72d30338c546fee5090598e3b65a8", "score": "0.5231501", "text": "func New() Config {\n\tfileName := flag.String(\"config.file\", \"\", \"Relative path to config file yaml\")\n\tflag.Parse()\n\n\treturn newConfig(*fileName)\n}", "title": "" }, { "docid": "1c388ad68358678408b06e7aa940c212", "score": "0.5229738", "text": "func New(f string)(Config, error){\n\tc := Config{}\n\terr := c.LoadFile(f)\n\treturn c, err\n}", "title": "" }, { "docid": "6282d9537b18f2e6397121f204fbb906", "score": "0.5227626", "text": "func initConfig() {\n\tif cfgFile != \"\" {\n\t\tb, err := ioutil.ReadFile(cfgFile)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error loading config file:\", cfgFile)\n\t\t}\n\t\tviper.SetConfigType(\"toml\")\n\t\tif err := viper.ReadConfig(bytes.NewBuffer(b)); err != nil {\n\t\t\tfmt.Println(\"Error loading config file:\", cfgFile)\n\t\t}\n\t} else {\n\t\tif err := viper.ReadInConfig(); err != nil {\n\t\t\tswitch err.(type) {\n\t\t\tcase viper.ConfigFileNotFoundError:\n\t\t\t\tfmt.Println(\"No configuration file found\")\n\t\t\tdefault:\n\t\t\t\tfmt.Println(\"Configuration file error\")\n\t\t\t}\n\t\t}\n\t}\n\n\t//\tviperBindEnvs(config.C)\n\tif err := viper.Unmarshal(&config.C); err != nil {\n\t\tfmt.Println(\"unmarshal config error\")\n\t}\n}", "title": "" } ]
e4b682f693a3fa15d097885744ee30a1
Set status code of response.
[ { "docid": "1ed27874dc74152fdd4dcbda054a9263", "score": "0.714504", "text": "func (apiSession *ApiSessionClass) SetStatusCode(code _type.StatusCode) {\n\tapiSession.statusCode = code\n}", "title": "" } ]
[ { "docid": "e5855920b7da0fb6de5464a4337c75db", "score": "0.7705633", "text": "func (c *Context) SetStatusCode(code int) {\n\tif c.StatusCode == 0 {\n\t\tc.StatusCode = code\n\t\tc.Res.WriteHeader(code)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "52db5fca03f22659ad8a432317ba9395", "score": "0.74111605", "text": "func (self *Handler) SetStatus(statusCode uint16) {\n self.Status = statusCode\n}", "title": "" }, { "docid": "8ddd52e8ecc45933244616d79f275ac0", "score": "0.7376248", "text": "func (o *UpdateDeviceDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "bc0b77ddd72331f48514c615581d706b", "score": "0.736349", "text": "func (o *GetTimestampResponseDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "a94d9b66bb37272d91f17579a8b6e655", "score": "0.7359373", "text": "func (o *PatchMeetupDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "cf5ab0894239623ceb8e2103b2fc5f8e", "score": "0.73332626", "text": "func (o *CreateRingDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "83007449be6c2d07ec61db44a95316b3", "score": "0.7330492", "text": "func (o *GetTickerDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "b68d9e7da058fd391ec7a2e15bc24165", "score": "0.7329708", "text": "func (e *Error) setHTTPStatus(code int) {\n\te.Status = strconv.Itoa(code)\n}", "title": "" }, { "docid": "2c3da5c2dcda9d29a6d2dc07842c756e", "score": "0.73272324", "text": "func (o *DigDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "66fa2784911fb5e0dddd279f793f057a", "score": "0.73243093", "text": "func (rsp *FastHTTPResponseAdapter) SetStatusCode(code int) {\n\trsp.delegate.SetStatusCode(code)\n}", "title": "" }, { "docid": "1583444007cd4826526bafdd29130f95", "score": "0.73043525", "text": "func (o *ReplaceServerSwitchingRuleDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "9daaeb34dd48f7788259c342d4da4ad0", "score": "0.7269297", "text": "func (r *Response) SetHeader(w http.ResponseWriter, statusCode int) {\n\tw.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "04221a19233724864699e2dc6e0bea14", "score": "0.7263234", "text": "func (res *APIGatewayProxyResponse) SetStatus(status int) {\n\tres.StatusCode = status\n}", "title": "" }, { "docid": "2749df89e4103b6fee55d788f10eb4f1", "score": "0.72569484", "text": "func (o *GetStartEndDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "76fee10e557b347daf1adf62b028bc34", "score": "0.72545576", "text": "func (o *GetRemediationsForContextDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "cd78f1fe2f4825b11a662608a4a11bd7", "score": "0.72524583", "text": "func (o *ReplaceProgramDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "113600a733d2afdcd8a6424aed37d361", "score": "0.72493184", "text": "func (o *AddSpoonDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "e53c4ae8c220068ebf63a2d841f07a72", "score": "0.723544", "text": "func (o *GetKingDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "24f40d52671733b1992e2d99ecea0ee0", "score": "0.7222397", "text": "func (o *LoadDeckDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "bc5d3c098753b3413b9be5d85a3c2deb", "score": "0.7207169", "text": "func (m *Event) SetResponseStatus(value ResponseStatusable)() {\n err := m.GetBackingStore().Set(\"responseStatus\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "403cac3d8bccff891a609f2fe5402627", "score": "0.71972173", "text": "func (o *ReplaceConsulDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "5c236ba7232da0af5f08fb9566753cfd", "score": "0.7160452", "text": "func (o *GeosmartDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "268da1e0fef8b89743f8ac19085644fd", "score": "0.7143152", "text": "func (r Response) Status(code int) Response {\n\tr.StatusCode = code\n\treturn r\n}", "title": "" }, { "docid": "f0fa94b0a29dbbdaabfdd53f38e1274b", "score": "0.71400356", "text": "func (o *RegisterDeviceDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "05c6ec2f47c308ff4d7bc051d3ff4031", "score": "0.7117308", "text": "func (o *GetHashesDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "4d239fbde5a4071aaf180eb6fe2c8843", "score": "0.7101483", "text": "func (o *CatalogGetDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "03bd30649d61863583bc611c2ad963cf", "score": "0.70992017", "text": "func (o *AllocateOrReleaseFromIPPoolDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "c50a885ae2b4e1cc173b7399dccc70f0", "score": "0.7094038", "text": "func (o *GetServiceClassByNameDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "06cd4e7938fdcb06bc4927d7213c7fc4", "score": "0.709192", "text": "func (o *ReplaceNameserverDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "b60d1586129bfa9f36ee06c50db0e0ae", "score": "0.70908636", "text": "func (o *DeleteShareEntryByIDDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "166eefd1c4062e1e7e94c182a24b9609", "score": "0.70903563", "text": "func (o *LoginDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "731a3907d31d4a1c4b36568e764faa15", "score": "0.7071044", "text": "func (o *ForwardDroneDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "1a8fa75523e215bec065bf18c709f4bd", "score": "0.7048653", "text": "func (self *Builder) SetStatus(statusCode int) {\n self.statusCode = statusCode\n}", "title": "" }, { "docid": "8e5251b6d89aabba99a0f2800ec2239a", "score": "0.70388097", "text": "func (o *DownloadFileDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "a8067095b276e5aa84c8f366ff774f3f", "score": "0.70370924", "text": "func (o *ReplaceTCPRequestRuleDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "a7860db256c768fed173edec56297790", "score": "0.7021231", "text": "func (o *PutTestDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "1c918412d7dd281d8cf4aa958a2aa77a", "score": "0.70057476", "text": "func (o *PostXwordDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "3500142145b41ca51979ab8d266c447e", "score": "0.698651", "text": "func (o *FindPetsDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "f9a9d5ba17909e29c58c572361086f5b", "score": "0.697522", "text": "func (o *GetExportSqliteDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "cd0298606707038fc1562185d2583a44", "score": "0.69612414", "text": "func (o *InsertPoolDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "3f2930c48aa2ebfaf9c838c4dd6dc867", "score": "0.69487464", "text": "func (o *GetFacesDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "8dea0bd47f65973f5708296d6de5cfc9", "score": "0.69404244", "text": "func (o *CreatePeerEntryDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "398b62db9be0d0ae33a3fa7ebfb8f3dd", "score": "0.6935788", "text": "func (o *NrRelationAlbumBooklistEditDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "c5dcbb2ad0c88070f9b291b5f00348e3", "score": "0.6889561", "text": "func (o *PutUserIDLocationDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "b116aec36de7f0d4ef8b302c50fe8c08", "score": "0.68784523", "text": "func (o *AddItemDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "c3f641a411e5475a90d61bdfab9bd077", "score": "0.68702626", "text": "func (o *PostNewGradeDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "709f06d49eb519180cb8554f73306cb5", "score": "0.6867694", "text": "func (o *NrPassportBindMobileDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "9efda0d53ec5702a5df59c44bdc2ddef", "score": "0.68635297", "text": "func (ctx *RequestCtx) SetStatusCode(statusCode int) {\n\tctx.Response.SetStatusCode(statusCode)\n}", "title": "" }, { "docid": "b4b60b97fb9800625f6e1d321d859265", "score": "0.6854601", "text": "func (o *UpdateUserDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "37827525d1c779ebd22dcc8487fec552", "score": "0.68525654", "text": "func (o *GetTalkAttendeesDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "b03b5965905e0be082c7e5a0167c0c70", "score": "0.6848345", "text": "func (o *GetWebNamespacePackageNameActionNameExtensionDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "fada8e1a8cfb84bc08cf17b5efa8dce4", "score": "0.6842576", "text": "func (o *NrMemberUploadRecordDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "98c328a21f8ee0f96543f91df71b076c", "score": "0.6838759", "text": "func (o *GetCopyInstancesDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "f893ab90bd705b7e827f070d5933a7e9", "score": "0.68356514", "text": "func (o *GetAPIInventoryAPIIDProvidedSwaggerJSONDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "2798d35cc061267e387db938893341ee", "score": "0.6835139", "text": "func (e Errors) setHTTPStatus(code int) {\n\tstatus := strconv.Itoa(code)\n\tfor _, err := range e {\n\t\terr.Status = status\n\t}\n}", "title": "" }, { "docid": "17d57b5de05386dafd1ebf0326ea3739", "score": "0.68343663", "text": "func (o *GetAllStatsDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "b9624ec1a184248214898da49d8fb0fe", "score": "0.6815631", "text": "func (c *Context) SetCode(i int) {\n\tc.ctx.SetStatusCode(i)\n}", "title": "" }, { "docid": "7afed4d5ff3c015f705ded474d4be966", "score": "0.6813279", "text": "func (o *CreateStorageMapFileDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "09df8d9f3cc800e87cd902375ec6f321", "score": "0.68009514", "text": "func (o *AddNewRuleDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "fd679e24c034db35587ac62fa6154b3a", "score": "0.67985773", "text": "func (o *DeleteSpoeFileDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "de9f1d73c5431106361ba08af976b525", "score": "0.6785369", "text": "func (o *GetUserByTokenDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "a1e0a0d5f88a6775b00ae44a9fc7677d", "score": "0.6769385", "text": "func (o *DeleteAPIInventoryAPIIDSpecsProvidedSpecDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "813df24008ff5e9cf5adc47d3ee3751b", "score": "0.67582905", "text": "func (o *DeleteProjectProjectNameResourceResourceURIDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "bbf2b870297e9954b1a020940feb8ccf", "score": "0.6750131", "text": "func SetHTTPStatusCode(span interface{}, statusCode int) {\n\tglobalTracer.SetHTTPStatusCode(span, statusCode)\n}", "title": "" }, { "docid": "4c4b072b3159069a3f101929f3ce19de", "score": "0.6741275", "text": "func (h *HttpResponse) StatusCode() int {\n\treturn h.r.StatusCode\n}", "title": "" }, { "docid": "5e0c1620a8eea1d4eb472b6484e05833", "score": "0.6737521", "text": "func (r *Response) StatusCode() int {\n\tif r == nil || r.resp == nil {\n\t\treturn 0\n\t}\n\treturn r.resp.StatusCode\n}", "title": "" }, { "docid": "b208e7776fdff3ca64ae51bff91d645c", "score": "0.67299336", "text": "func (o *GetCovid19ReportDataDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "0d8df85cc7f8bf9eb32d38a929abcc65", "score": "0.67222464", "text": "func (o *FindKeysDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "d0e9ec8228876041b50808cc5d9b0671", "score": "0.67050344", "text": "func (o *NrActivityJoinDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "13eadf0e13b1d8815db86421acba317d", "score": "0.6698103", "text": "func (o *NrUserUpdateProfileDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "e001890a08457dc0980bbaa2f0eff061", "score": "0.6687035", "text": "func (o *GetSlideUsersDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "e20df05d583a3cefe670f9ee98163c6e", "score": "0.66859096", "text": "func (o *PutUserIDDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "9858824152278638f1adec8cba626923", "score": "0.6682882", "text": "func (o *ValueGetDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "4f32e0b1a32e63c27d470a7d35b16dba", "score": "0.6682125", "text": "func (o *GetProjectProjectNameStageDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "28ea603e41584df660ce484ab28cfa7d", "score": "0.66752106", "text": "func (o *PostTemplatesDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "6c7d734315cf64336b56c15b3105fb27", "score": "0.6668525", "text": "func (o *DeleteTCPCheckDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "617bfb33266a084813e1c4479db90eec", "score": "0.6663078", "text": "func (r *Responder) SetResponse(code *int, hdrs *http.Header, body *[]byte, connectionClose bool) {\n\tr.ResponseCode = code\n\tr.F = func() (uint64, error) {\n\t\tif r.Req.Method == http.MethodHead {\n\t\t\t*body = nil\n\t\t}\n\t\treturn web.Respond(r.W, *code, *hdrs, *body, connectionClose)\n\t}\n}", "title": "" }, { "docid": "55cb3daac553b575c1790a4f3711afdb", "score": "0.6647554", "text": "func (i ToHttpStatus) SetHttpStatus(status int) {\n\terrorCodeToHttpStatus[int(i)] = status\n}", "title": "" }, { "docid": "c171f7ab0a1d3645e11fd1151dae5081", "score": "0.6625739", "text": "func (o *FindSensorAvgBySensorIDAndDayDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "71b57b1f6a268c3f3478586bc64f53ca", "score": "0.6613283", "text": "func (r BaseResponse) StatusCode() int {\n\treturn r.code\n}", "title": "" }, { "docid": "17c0471b9d65e20b3f851b2a58c35c59", "score": "0.6607832", "text": "func (o *CreateUserDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "74cfaa4baaf29ac5bf68c06e834f0fa4", "score": "0.6595945", "text": "func (o *RechargeListDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "6c484436fa7008f731409de5b89f449e", "score": "0.6591384", "text": "func (o *FeedbackListDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "c25c8d9b5e51a8a109ca4146a009b018", "score": "0.65832376", "text": "func (resp *Response) WriteHeader(code int) {\n\tresp.status = code\n\tresp.ResponseWriter.WriteHeader(code)\n}", "title": "" }, { "docid": "6aa2dc9e3f7f96604dd80e16b6e47ce1", "score": "0.6577735", "text": "func (se StatusError) HTTPCode() int { return se.httpCode }", "title": "" }, { "docid": "8400184b54db2b9bb137b0da8803dea5", "score": "0.65760475", "text": "func (r *Response) writeStatusCode(status int) {\n\tr.writer.WriteHeader(status)\n}", "title": "" }, { "docid": "b2a9cb4c9fd616661cc2d4df502e002a", "score": "0.65733", "text": "func (rw *ResponseWriter) StatusCode() int {\n\treturn rw.statusCode\n}", "title": "" }, { "docid": "cb3cb143fa25e7c4e93c0951fafc539d", "score": "0.6572116", "text": "func (o *ListItemsDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "a1828808d48e2e4666949b3c7802827c", "score": "0.6567658", "text": "func (o *PutUserRoleIDDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "208d66676134584d8ec921a3e18cd295", "score": "0.6544896", "text": "func (o *CreateItemTypeDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "54abfd8bcb9a41ce46fc51c3965bf72d", "score": "0.6543102", "text": "func (r *Response) SetStatus(status int) {\n\tr.Status = status\n}", "title": "" }, { "docid": "6051ffe543454e9016cc99fc71c5f407", "score": "0.65425235", "text": "func SetStatusResponse(statusCode int, descriptionCode string, description string) models.StatusResponse {\n\treturn models.StatusResponse{\n\t\tStatusCode: statusCode,\n\t\tDescriptionCode: descriptionCode,\n\t\tDescription: description,\n\t}\n}", "title": "" }, { "docid": "2d7bad4d8b73d433118c00269ddfeeb9", "score": "0.6536305", "text": "func (o *GetProjectProjectNameStageStageNameServiceServiceNameResourceDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "5783a26be5e3088e9c229b063ecdc914", "score": "0.65288955", "text": "func (o *DeleteClusterDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "7919df71dca98326a56e90fa0b86fb9b", "score": "0.652314", "text": "func WithStatusCode(c int) ResponseOption {\n\treturn fnRespOpt(func(mr *mockResponse) {\n\t\tmr.code = c\n\t})\n}", "title": "" }, { "docid": "45da9e0e56c75a53009ebe7cee12e9e0", "score": "0.6521153", "text": "func (o *AddUserToTeamDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "7497a78f8bf33c1612d3edcbd71fc764", "score": "0.65143055", "text": "func (this *BufferedResponseWriter) WriteHeader(code int) {\n\tthis.Status = code\n}", "title": "" }, { "docid": "cfbcccaa1c472dae3d02bacdffcd8b81", "score": "0.6507272", "text": "func (o *PeerDeleteDefault) SetStatusCode(code int) {\n\to._statusCode = code\n}", "title": "" }, { "docid": "4e4a97756846a34843958a94c5ba0a30", "score": "0.65049195", "text": "func (f *FakeResponseWriter) WriteHeader(status int) {\n\tf.StatusCode = status\n}", "title": "" }, { "docid": "9118be2c01742aabb2b9ccfcb2e1c2ed", "score": "0.6460731", "text": "func (m mockResponse) StatusCode() int {\n\treturn m.statusCode\n}", "title": "" } ]
0a5db832cff43ebbb28cc722f627c4e0
SuspendResponder handles the response to the Suspend request. The method always closes the http.Response Body.
[ { "docid": "68a9635c5a55f43b4d8f65c32f62f3e3", "score": "0.7035636", "text": "func (client TestJobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" } ]
[ { "docid": "2c8c1614b80c11bafe5bebf85c987f80", "score": "0.6964096", "text": "func (client StorageTargetClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "018316b97ebdfd2e6a42b6c520392d5b", "score": "0.60554326", "text": "func (client HostingEnvironmentsClient) SuspendHostingEnvironmentResponder(resp *http.Response) (result SiteCollection, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "071599c231791b2b495fcfb60da44b36", "score": "0.5967504", "text": "func (client AppsClient) StopResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "093e39335cb8ca691ec715cebf212484", "score": "0.5873041", "text": "func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "22739345f39cf681f7a0ceedb0cb3c0d", "score": "0.5847058", "text": "func (client VirtualMachineClient) StopResponder(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.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "495000c8cf511567f03366196d0f35c9", "score": "0.57653844", "text": "func (client BaseClient) ResumeApplicationUpgradeResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "2dab8d2fc339c13352e80538b996d0e7", "score": "0.5535666", "text": "func (client AppsClient) StopSlotResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "a14e8e534bdc1ec0ca72cde51dc652b8", "score": "0.5517273", "text": "func (client TestJobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "7b9e43480c91d0d8598b2f14a61fa4c4", "score": "0.5479543", "text": "func (client StorageTargetClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "00dc438a8339b16746b887532828e4e0", "score": "0.54344404", "text": "func (client StorageTargetClient) FlushResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "28ed60bcea2038b1bd4b8da1f78cdfa9", "score": "0.53596854", "text": "func (client DevicesClient) DeactivateResponder(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.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "1f253f1a474df907bc72415497f77655", "score": "0.53195226", "text": "func (client TestJobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "fb9d68d9a010d4f8c328bb715ebc3da3", "score": "0.52922696", "text": "func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "4a4e3704ca534d1ed50fc6c7467ccf4c", "score": "0.5221313", "text": "func (client BaseClient) StopChaosResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "f56b95aa09c35435150a38b9e69b4019", "score": "0.5161138", "text": "func (e *Emulator) Pause(w http.ResponseWriter, req *http.Request) { e.pause = true }", "title": "" }, { "docid": "c670c7d5cdaea673f1b1a91cc840eb41", "score": "0.5084064", "text": "func (o *PostDialogDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "706bc86cb7e21191fee9e3716a3298f0", "score": "0.50822395", "text": "func (client HostingEnvironmentsClient) ResumeHostingEnvironmentResponder(resp *http.Response) (result SiteCollection, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "e571979f995264cda3752f3102469139", "score": "0.50732225", "text": "func (client VirtualMachineScaleSetVMsClient) SimulateEvictionResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "dd7a96644f9a2d9e9024aa6196e35990", "score": "0.50452554", "text": "func (o *NrSpareClickDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5bf2e35bffe913d1d34e0df5b49f8f78", "score": "0.5041748", "text": "func (p *ServersSuspendPoller) FinalResponse(ctx context.Context) (ServersSuspendResponse, error) {\n\trespType := ServersSuspendResponse{}\n\tresp, err := p.pt.FinalResponse(ctx, nil)\n\tif err != nil {\n\t\treturn ServersSuspendResponse{}, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "6a0251eeb574459d7260a93007ddc676", "score": "0.5025227", "text": "func (client BaseClient) RollbackApplicationUpgradeResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "410d97b5ebb76bfdda725b5d97e324a7", "score": "0.4995897", "text": "func (o *ToggleAlarmDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f2fe0411832fcded0db829eb839f297d", "score": "0.49918002", "text": "func (r *ResponseCapture) Flush() {\n\tif flusher, ok := r.delegate.(http.Flusher); ok {\n\t\tflusher.Flush()\n\t}\n}", "title": "" }, { "docid": "449f41a43ce95e53ed0e78992fa709f1", "score": "0.49791607", "text": "func (client AppsClient) RecoverSlotResponder(resp *http.Response) (result RecoverResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "44b9f899bb0090f5cffaafccb870c1d4", "score": "0.49758595", "text": "func (client LabsClient) PublishResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "aaa2e1420e335243fec8c47a8c0a5f89", "score": "0.4963989", "text": "func (ctx *context) Respond(bytes []byte) {\n\tctx.response = bytes\n}", "title": "" }, { "docid": "f5fc94f8bfc1a62fa8dcf162f85ceb79", "score": "0.49482504", "text": "func (r *Response) Close() {\n\tr.Response.Body.Close()\n}", "title": "" }, { "docid": "749162a9287d72301c613bfe6f405b3c", "score": "0.4947948", "text": "func (client BaseClient) StartDataLossResponder(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.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "fb48e502711b4a817710c2a6cbad015c", "score": "0.4945073", "text": "func (client BlockStorageClient) DetachResponder(resp *http.Response) (result BlockStorageInstanceDetachResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "994a2a6beed6e06a22d2e9fea893e275", "score": "0.4932759", "text": "func (o *FinishAnswerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "53e4f9f8b6c9b594656ec832287e7e81", "score": "0.49301228", "text": "func (client BaseClient) ResumeClusterUpgradeResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "18038d5a0707a04ed2209897f5d3513c", "score": "0.4919314", "text": "func (client AppsClient) RestoreSlotResponder(resp *http.Response) (result RestoreResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "45c6273117de670b291ae312f7aa658a", "score": "0.48972145", "text": "func (client TranslatorClient) BreakSentenceResponder(resp *http.Response) (result ListBreakSentenceResultItem, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "3ed9b18683d60b109263ecdb5bd6ebb8", "score": "0.4890854", "text": "func (o *PostUIOpenwindowMarketdetailsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "b7f6fb7c5ce521991e9eb7d7dc6c0bd5", "score": "0.4890545", "text": "func (client BaseClient) UpdateApplicationUpgradeResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "a9a31dea8598f6edcc5c0c6855ee11e5", "score": "0.48899603", "text": "func (o *AcceptCurrentUserInviteUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(401)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "081a7a6459346a24a5e632806a52985c", "score": "0.48889992", "text": "func endHandler(w http.ResponseWriter, r *http.Request) {\n\trespond.With(w, r, http.StatusOK, \"Ending Gracefully!\")\n\tfmt.Println(\"Ending Gracefully!\")\n\n\tos.Exit(0)\n}", "title": "" }, { "docid": "4a35e1d740215d919c0975719834494e", "score": "0.488621", "text": "func (rm *ResponseManager) UnpauseResponse(p peer.ID, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error {\n\tresponse := make(chan error, 1)\n\treturn rm.sendSyncMessage(&unpauseRequestMessage{p, requestID, response, extensions}, response)\n}", "title": "" }, { "docid": "ff702bb9103ea50b99ebfe1e600bcb36", "score": "0.48796314", "text": "func (o *AcceptCurrentUserInviteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a6b194294e989da62ff53678c34f175", "score": "0.487154", "text": "func (client AppsClient) RestoreResponder(resp *http.Response) (result RestoreResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "3308336f3018002260730b155d5bd6a5", "score": "0.4869459", "text": "func (r *Response) Close() error {\n\tif r.body != nil {\n\t\tbuffersPool.Put(r.body)\n\t}\n\t// close response body\n\t// even it should be closed after a read\n\t// but to make sure we can just close again\n\tr.Response.Body.Close()\n\treturn nil\n}", "title": "" }, { "docid": "9287a961bec6b9cd62576ce60e952572", "score": "0.4865604", "text": "func (o *PostDialogOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fdf2ac10914dbb8af19df5d21fe89f60", "score": "0.48566225", "text": "func (m *resInjectorHandler) Stop() {\n\tclose(m.agent.Responses)\n}", "title": "" }, { "docid": "06927795d1277e26d519fc7f1364ce82", "score": "0.4848206", "text": "func (o *PostDialogBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "d1c01314a6c26e04a4a3f1eccef580f1", "score": "0.48467457", "text": "func (client EnumClient) PutNotExpandableResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "d1c01314a6c26e04a4a3f1eccef580f1", "score": "0.48467457", "text": "func (client EnumClient) PutNotExpandableResponder(resp *http.Response) (result autorest.Response, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n}", "title": "" }, { "docid": "7c78ff6fae6f31be46979a0dbb7ea205", "score": "0.48250923", "text": "func (o *StageRequestURITooLong) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(414)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c33d85219ea2dd2d01ccd257ef4bd05", "score": "0.48164284", "text": "func (o *SpareClickOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7def4261aff5b1de672a137976dacc72", "score": "0.47977173", "text": "func (o *FinishAnswerGone) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(410)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "506768511df5aa289268727c360253e1", "score": "0.47920305", "text": "func (r *Response) FlushBody() { r.bytes = nil }", "title": "" }, { "docid": "b4f32e00e247b46dba8b2917c0bce224", "score": "0.4779369", "text": "func (o *AcceptCurrentUserInviteInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e592b1cf59891829e3b755e10fb91ae", "score": "0.47772604", "text": "func (client LabsClient) UpdateResponder(resp *http.Response) (result Lab, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "88a397366a0bbe9cdff805bccac7a671", "score": "0.47753394", "text": "func (o *PostDialogInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "7a4bf9344d30b5fe349f9ad3689ff25f", "score": "0.47707465", "text": "func (client ReplicationProtectedItemsClient) PurgeResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "02a5d336f0c850c6b9594963e1c14ba7", "score": "0.4765287", "text": "func (o *ShowPPMIncentiveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "790e1e1cb64c9a53e30f9fc379cca4ca", "score": "0.47645566", "text": "func (a *windowHandler) Stop() {\n\tclose(a.agent.Responses)\n}", "title": "" }, { "docid": "1e63986ceafdd81c2ded691b2c351a54", "score": "0.4763442", "text": "func (o *PostUIOpenwindowMarketdetailsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cc4f786ac8f4b16ebe532e7b4fb1f4e0", "score": "0.4759422", "text": "func (client WebServicesClient) PatchResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "1a49609dd813323f0696f41e34c87b4b", "score": "0.4751112", "text": "func (client AppsClient) ResetProductionSlotConfigResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "d269a64f254476bbdd2beb0fd9b9d3f9", "score": "0.47499055", "text": "func (client AppsClient) RecoverResponder(resp *http.Response) (result RecoverResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "600d182e2f314d052b7f8a9ca186c348", "score": "0.4749111", "text": "func (o *PutExhaustPortOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "db0bcbd7df8006a0b131051627ea8e23", "score": "0.47407618", "text": "func (o *UpdateAppDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "451f7f8d7f39fe26a9f9ec7117445699", "score": "0.473909", "text": "func (o *DownloadHostIgnitionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "a01accfb11264e6aefcf6b23bd805fd3", "score": "0.47361368", "text": "func (o *DownloadHostIgnitionMethodNotAllowed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(405)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d2494a3cccbdc63dd2fc825dc6d7e143", "score": "0.47348297", "text": "func (client HostingEnvironmentsClient) RebootHostingEnvironmentResponder(resp *http.Response) (result SetObject, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "64a52ced8b7f5785538a8a12f2fa835d", "score": "0.47333083", "text": "func (client AppsClient) RestartSlotResponder(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),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "8bafc244aa8519d4bc60423451153e32", "score": "0.47278064", "text": "func Respond(w http.ResponseWriter, data []byte) {\n\tw.Write(data)\n}", "title": "" }, { "docid": "487b9fa2e9a49e1b909cf1dc91834371", "score": "0.47250062", "text": "func (client BaseClient) DeleteFlowMethodResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "527afaaa5d27306934b0eea57b243200", "score": "0.47224364", "text": "func Respond(w http.ResponseWriter, data interface{}) {\n\t// Marshal the data into JSON bytes..\n\tbytes, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Printf(\"Error marshalling data: %v\", err)\n\t\treturn\n\t}\n\n\t// Write the bytes to the stream.\n\t_, err = w.Write(bytes)\n\tif err != nil {\n\t\tlog.Printf(\"Error writing bytes to stream: %v\", err)\n\t}\n}", "title": "" }, { "docid": "5dde3309e2ca88223ef28fcd40c3c93e", "score": "0.47197714", "text": "func (o *ShowPPMIncentiveBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "16af2fb163df3fd140f0a33b78121e79", "score": "0.47087896", "text": "func (o *MsgUnsendListDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e090573cdf68cae862816f319195e76", "score": "0.47063318", "text": "func (o *DeprovisionServiceInstanceDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "87aa03aa951c3512fe96aa55134656d7", "score": "0.47055426", "text": "func (o *PostUserF2aDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d5d140fc4fd71ffbed986e3c5605aadb", "score": "0.47044882", "text": "func (o *NrUserUpdatePwdDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0a7513d041e65ce8ed4580c223f1edf2", "score": "0.4704274", "text": "func Shutdown(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Cache-Control\", \"must-revalidate\")\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, OPTIONS\")\n\tHttpDB.Close()\n\tos.Exit(0)\n}", "title": "" }, { "docid": "097d5e2d79097d4df2069f0d158456a6", "score": "0.4702732", "text": "func (client WebServicesClient) RemoveResponder(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.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "5d65ebf22b1d31acba8bee16d357691b", "score": "0.46969566", "text": "func HandleEnd(w http.ResponseWriter, r *http.Request) {\n\trequest := GameRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&request)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Nothing to respond with here\n\tfmt.Print(\"END\\n\")\n}", "title": "" }, { "docid": "320781cd0c4eb9a4c07e6cc35a0af480", "score": "0.46958914", "text": "func Send(w http.ResponseWriter) {\n\tw.(http.Flusher).Flush()\n}", "title": "" }, { "docid": "7a73db54f084a39c3c405a91a6b83360", "score": "0.4695148", "text": "func (o *DesireTaskBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "2de4b130301fc3235b3e596eb27dd159", "score": "0.46927637", "text": "func (c *Context) CloseResponse() {\n\tc.Set(\"response_closed\", true)\n}", "title": "" }, { "docid": "29d282977738e92b9b852e01875dbc94", "score": "0.46896994", "text": "func (o *PostUIOpenwindowMarketdetailsForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(403)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2efa14d26f6ca83e12df87346e1a899a", "score": "0.46888387", "text": "func (client BaseClient) UpdateRepairExecutionStateResponder(resp *http.Response) (result RepairTaskUpdateInfo, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "4d1790b24a8f0c84475e6e85e05e6fb8", "score": "0.46878383", "text": "func (client BaseClient) UnprovisionApplicationTypeResponder(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.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "ef20b92979b3fa66b5448118ab1c5aa0", "score": "0.46862978", "text": "func (o *GetPreflightRequirementsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b3f4630b6c07f7bb124d5471e621ac9c", "score": "0.4685956", "text": "func (a *GowebAPIResponder) Respond(ctx context.Context, status int, data interface{}, errors []string) error {\n\n\tif data != nil {\n\n\t\tvar dataErr error\n\t\tdata, dataErr = codecs.PublicData(data, nil)\n\n\t\tif dataErr != nil {\n\t\t\treturn dataErr\n\t\t}\n\n\t}\n\n\t// make the standard response object\n\tif (a.AlwaysEnvelopResponse && ctx.QueryValue(\"envelop\") != \"false\") || ctx.QueryValue(\"envelop\") == \"true\" {\n\t\tsro := map[string]interface{}{\n\t\t\ta.StandardFieldStatusKey: status,\n\t\t}\n\n\t\tif data != nil {\n\t\t\tsro[a.StandardFieldDataKey] = data\n\t\t}\n\n\t\tif len(errors) > 0 {\n\t\t\tsro[a.StandardFieldErrorsKey] = errors\n\t\t}\n\n\t\tdata = sro\n\t}\n\n\t// transform the object\n\tvar transformErr error\n\tdata, transformErr = a.TransformStandardResponseObject(ctx, data)\n\n\tif transformErr != nil {\n\t\treturn transformErr\n\t}\n\n\treturn a.WriteResponseObject(ctx, status, data)\n\n}", "title": "" }, { "docid": "4c881aa8efe2f936d9fe251bac88dd74", "score": "0.46856764", "text": "func (o *DeleteCurrentAPISessionCertificateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e5ce9d9a3f519a6e4237cc2ad37959d9", "score": "0.46850145", "text": "func (client VirtualMachineScaleSetVMsClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "34f60158f1545035977bfc4447e8aed9", "score": "0.46848443", "text": "func (o *ListMTOPaymentRequestsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cddf68c07996c699d0acf15cb078f597", "score": "0.4682258", "text": "func (o *GetCorrectedAnswersFromUserAnsweredTestBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32f3bcb0936bb4d663b69da18cb3b38d", "score": "0.46795994", "text": "func (o *LoginUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "adbb4d57f8601079a5a6c232b5d9fd59", "score": "0.46765137", "text": "func (o *LoginUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "d1226c7e6ea6b6cce9d644d090d3c959", "score": "0.46759707", "text": "func (o *DesireTaskAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\n}", "title": "" }, { "docid": "745f3e8947493b479b99de8f2d6a20e2", "score": "0.46752605", "text": "func (r *recordTrafficResponse) Flush() {\n\tr.ResponseWriter.(http.Flusher).Flush()\n}", "title": "" }, { "docid": "d1e0baa570bf575eea99091cfe3b240d", "score": "0.46720156", "text": "func (client SpatialClient) PostBufferResponder(resp *http.Response) (result BufferResponse, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "title": "" }, { "docid": "897409f6bf2a561a09f930152ada9bdc", "score": "0.46715006", "text": "func (o *ToggleAlarmMethodNotAllowed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(405)\n}", "title": "" }, { "docid": "afd2a7ca5f997af07974a0f5c88ea653", "score": "0.46698442", "text": "func (o *VerifyLdapCloseConnectionBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "092c6838c5c59ee721ff1fbdb9d64998", "score": "0.4668622", "text": "func (r *Response) Flush() {\n\tif rw, ok := r.rw.(http.Flusher); ok {\n\t\trw.Flush()\n\t}\n}", "title": "" }, { "docid": "18b7f9532264d60fc6a3fb820b724321", "score": "0.4667943", "text": "func (p *AsyncAppend) Response() pb.AppendResponse { return p.app.Response }", "title": "" }, { "docid": "53a749c14ebe75e2c582d4c8e0b32618", "score": "0.46660784", "text": "func (o *UpdateMaxBillableWeightAsTIONotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90d7bb33a0f36018fdd15a49f3b7441b", "score": "0.46658784", "text": "func (o *CheckDecryptionStatusBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(400)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" } ]
4925111e803766705ff30dec0e165c2e
GetConf returns the configuration for this PlanExecutor
[ { "docid": "09616fcf7a47cc0f4d91899cfb9cfc41", "score": "0.86006993", "text": "func (pe *planExecutorImpl) GetConf() *itypes.PlanExecutorConfig {\n\treturn pe.conf\n}", "title": "" } ]
[ { "docid": "d54515694ce5713beba57d9a2731a5dd", "score": "0.66735035", "text": "func GetConf() configure.Config {\n\treturn conf\n}", "title": "" }, { "docid": "66d8acca258c785e19f40021929056fc", "score": "0.6634978", "text": "func GetConf() *Conf {\n\treturn &config\n}", "title": "" }, { "docid": "08be07d218558ef720d112ba48f8be85", "score": "0.6128292", "text": "func (a *ExecCMD) GetConfiguration() *property.Configuration {\n\treturn a.Cfg\n}", "title": "" }, { "docid": "633f17ccd69d4661f72521f1ea655b7f", "score": "0.6052898", "text": "func getConfig() (zconfig.Conf, error) {\n\n\t// fullfill appParams from config\n\t// HARDCODE it temporary\n\tappParams := map[string]string{\n\t\t\"db_type\": \"redis\",\n\t\t\"db_addr\": \"127.0.0.1\",\n\t\t\"db_port\": \"6379\",\n\t\t\"db_password\": \"\",\n\t\t\"db_num\": \"0\",\n\t\t\"app_port\": \"8421\",\n\t}\n\n\t// not implemented yet\n\t// validateParams()\n\n\treturn zconfig.Conf{Params: appParams}, nil\n}", "title": "" }, { "docid": "dfad770f23dc3f2a5b8fc880f046dcde", "score": "0.603674", "text": "func (a *application) GetConf() *conf.Conf {\n\ta.init()\n\treturn a.conf\n}", "title": "" }, { "docid": "32fb2e60b40dbb12faab87041a11b5f0", "score": "0.5951099", "text": "func GetConf() ProxyConf {\n\treturn getConf()\n}", "title": "" }, { "docid": "258b9611060b28a430cd33b208f198be", "score": "0.58484584", "text": "func (task *CronTask) GetConfig() *TaskConfig {\n\treturn &TaskConfig{\n\t\tTaskID: task.taskID,\n\t\tTaskType: task.TaskType,\n\t\tIsRun: task.IsRun,\n\t\tHandler: task.handler,\n\t\tDueTime: task.DueTime,\n\t\tInterval: 0,\n\t\tExpress: task.RawExpress,\n\t\tTaskData: task.TaskData,\n\t}\n}", "title": "" }, { "docid": "2979a3c1884c580993778d4bdbbcf54a", "score": "0.5838836", "text": "func Get() *OperatorConfig {\n\treturn globalConf\n}", "title": "" }, { "docid": "227092248a7de5db7a29ec96c0952a88", "score": "0.5820345", "text": "func (me *Coor) GetConfig() *pb.Configuration {\n\tme.Lock()\n\tdefer me.Unlock()\n\treturn me.config\n}", "title": "" }, { "docid": "c4e51ac77ffe801dac22f479aed6a8e6", "score": "0.57311505", "text": "func GetConfig() *cfg.Config {\n\tif conf == nil {\n\t\tpathname := makePathname()\n\t\tconf = cfg.ResetTestRoot(pathname)\n\t\t// and we use random ports to run in parallel\n\t\ttm, rpc, grpc := makeAddrs()\n\t\tprintln(conf.Consensus.TimeoutCommit)\n\t\tconf.P2P.ListenAddress = tm\n\t\tconf.RPCListenAddress = rpc\n\t\tconf.GRPCListenAddress = grpc\n\t}\n\treturn conf\n}", "title": "" }, { "docid": "707d059a74928ba5033f0deabf103cd6", "score": "0.57259834", "text": "func Get() *Config {\n\treturn conf\n}", "title": "" }, { "docid": "97bc458d77bdb5ac98cba2d2004b8eb5", "score": "0.569517", "text": "func GetConf() *conf.Conf {\n\treturn defaultApp.GetConf()\n}", "title": "" }, { "docid": "399411a840eab7bfd926bec3205d19fa", "score": "0.56461895", "text": "func Cfg() *Config {\n\treturn conf\n}", "title": "" }, { "docid": "5cdec56327919506a221ca11584cf994", "score": "0.56409365", "text": "func (t *Torrent) GetConf() (peer.TorConf, error) {\n\tch := make(chan peer.TorConf)\n\tselect {\n\tcase t.Event <- peer.TorGetConf{ch}:\n\t\tselect {\n\t\tcase v := <-ch:\n\t\t\treturn v, nil\n\t\tcase <-t.Done:\n\t\t\treturn peer.TorConf{}, ErrTorrentDead\n\t\t}\n\tcase <-t.Done:\n\t\treturn peer.TorConf{}, ErrTorrentDead\n\t}\n}", "title": "" }, { "docid": "8144e93bdd9b8fb448c5de1a8bd29f59", "score": "0.5616007", "text": "func (_Lendingpool *LendingpoolCallerSession) GetConfiguration(asset common.Address) (DataTypesReserveConfigurationMap, error) {\n\treturn _Lendingpool.Contract.GetConfiguration(&_Lendingpool.CallOpts, asset)\n}", "title": "" }, { "docid": "9661327ccc495effdfe995090ade0336", "score": "0.56102484", "text": "func (c *APIClient) GetConfig() *Configuration {\n\treturn c.cfg\n}", "title": "" }, { "docid": "ed53066d98bc490eceb05324f6520580", "score": "0.5600013", "text": "func GetConf() *viper.Viper {\n\tif vprConf == nil {\n\t\tpanic(\"tried to get uninited config\")\n\t}\n\treturn vprConf\n}", "title": "" }, { "docid": "f67c7b4c9b0d368cd4d1fd1a436854a3", "score": "0.5587549", "text": "func (c *ShuttleConfig) getConf(projectPath string, strictConfigLookup bool) (string, error) {\n\tif projectPath == \"\" {\n\t\treturn projectPath, nil\n\t}\n\n\tfile, err := locateShuttleConfigurationFile(projectPath, strictConfigLookup)\n\tif err != nil {\n\t\treturn \"\", shuttleerrors.NewExitCode(\n\t\t\t2,\n\t\t\t\"Failed to load shuttle configuration: %s\\n\\nMake sure you are in a project using shuttle and that a 'shuttle.yaml' file is available.\",\n\t\t\terr,\n\t\t)\n\t}\n\tdefer file.Close()\n\n\tdecoder := yaml.NewDecoder(file)\n\tdecoder.SetStrict(true)\n\terr = decoder.Decode(c)\n\tif err != nil {\n\t\treturn \"\", shuttleerrors.NewExitCode(\n\t\t\t2,\n\t\t\t\"Failed to parse shuttle configuration: %s\\n\\nMake sure your 'shuttle.yaml' is valid.\",\n\t\t\terr,\n\t\t)\n\t}\n\n\tswitch c.PlanRaw {\n\tcase false:\n\t\t// no plan\n\tdefault:\n\t\tc.Plan = c.PlanRaw.(string)\n\t}\n\t// return the path where the shuttle.yaml file was found\n\treturn path.Dir(file.Name()), nil\n}", "title": "" }, { "docid": "4de7531c2194129295ea634f4fbcee17", "score": "0.5556048", "text": "func GetConfig(r *od.HandleOrionadapterRequest) (*config.Params, error) {\n\tcfg := &config.Params{}\n\n\tif r.AdapterConfig == nil {\n\t\treturn nil, missingConfigError()\n\t}\n\n\tif err := cfg.Unmarshal(r.AdapterConfig.Value); err != nil {\n\t\treturn nil, configReadError(err)\n\t}\n\treturn cfg, nil\n}", "title": "" }, { "docid": "2e0f0f54c0b1ea4d1437d66171923242", "score": "0.5549127", "text": "func (s *Service) Conf() *ServiceConfig {\n\treturn &s.conf\n}", "title": "" }, { "docid": "270d27260ff09794ef0b13504767cde4", "score": "0.551959", "text": "func (w *KafkaTopicChangeWaiter) Conf() *resource.StateChangeConf {\n\tstate := &resource.StateChangeConf{\n\t\tPending: []string{\"CONFIGURING\"},\n\t\tTarget: []string{\"ACTIVE\"},\n\t\tRefresh: w.RefreshFunc(),\n\t}\n\tstate.Delay = 10 * time.Second\n\tstate.Timeout = 10 * time.Minute\n\tstate.MinTimeout = 2 * time.Second\n\treturn state\n}", "title": "" }, { "docid": "6d8341d62b97b00a4b3f2b5b8e208072", "score": "0.5479576", "text": "func (w *PqModel) GetConfiguration() *Configuration {\n\treturn &w.Config\n}", "title": "" }, { "docid": "cf1b069c7fe8af495cab735e58dabb05", "score": "0.54751176", "text": "func Conf() *Config {\n\treturn single\n}", "title": "" }, { "docid": "c0dc43a42ceb125232aea3d6eb25ee35", "score": "0.54596645", "text": "func (r *RedisJob) Config() *job.JobConfig {\n\treturn r.config\n}", "title": "" }, { "docid": "360381095e4acd1ff189fb1f58e418bd", "score": "0.5458718", "text": "func GetConfig() interface{} {\n\treturn container.actualConfig\n}", "title": "" }, { "docid": "bcbe534912ec247099ef8d829c0bf3b5", "score": "0.5443915", "text": "func (p *Runner) GetConfig() (*core.Config, string, error) {\n\t// Return a []byte of the yaml we find or create.\n\tvar werckerYaml []byte\n\tvar err error\n\tif p.options.WerckerYml != \"\" {\n\t\twerckerYaml, err = ioutil.ReadFile(p.options.WerckerYml)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrapf(err, \"could not read file %s while getting configuration\",\n\t\t\t\tp.options.WerckerYml)\n\t\t}\n\t} else {\n\t\twerckerYaml, err = core.ReadWerckerYaml([]string{p.ProjectDir()}, false)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"could not read wercker yml while getting config\")\n\t\t}\n\t}\n\n\t// Parse that bad boy.\n\trawConfig, err := core.ConfigFromYaml(werckerYaml)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrapf(err, \"could not get configuration from yaml %s\", werckerYaml)\n\t}\n\n\t// Add some options to the global config\n\tif rawConfig.SourceDir != \"\" {\n\t\tp.options.SourceDir = rawConfig.SourceDir\n\t}\n\n\t// Only use the ignore file from the config when it is not empty and not defined as a command-line option\n\tif rawConfig.IgnoreFile != \"\" && p.options.DefaultsUsed.IgnoreFile {\n\t\tp.options.IgnoreFile = rawConfig.IgnoreFile\n\t}\n\n\tMaxCommandTimeout := 60 // minutes\n\tMaxNoResponseTimeout := 60 // minutes\n\n\tif rawConfig.CommandTimeout > 0 {\n\t\tcommandTimeout := util.MinInt(rawConfig.CommandTimeout, MaxCommandTimeout)\n\t\tp.options.CommandTimeout = commandTimeout * 60 * 1000 // convert to milliseconds\n\t\tp.logger.Debugln(\"CommandTimeout set in config, new CommandTimeout:\", commandTimeout)\n\t}\n\n\tif rawConfig.NoResponseTimeout > 0 {\n\t\tnoResponseTimeout := util.MinInt(rawConfig.NoResponseTimeout, MaxNoResponseTimeout)\n\t\tp.options.NoResponseTimeout = noResponseTimeout * 60 * 1000 // convert to milliseconds\n\t\tp.logger.Debugln(\"NoReponseTimeout set in config, new NoReponseTimeout:\", noResponseTimeout)\n\t}\n\n\treturn rawConfig, string(werckerYaml), nil\n}", "title": "" }, { "docid": "b17f68b9540a5cf454275dfda8848e9a", "score": "0.5422769", "text": "func GetConfig() (CONFIG){\n\n\treturn config;\n\n}", "title": "" }, { "docid": "8a180c65ecbc516beab3e1a54e1a8102", "score": "0.541868", "text": "func (c *ServerConn) Config() interface{} {\n\treturn c.cfg\n}", "title": "" }, { "docid": "74bb16488fa46f86a714746b0d310af4", "score": "0.5399942", "text": "func (l localQuerier) GetConfig() (io.Reader, error) {\n\tdir := l.getWorkdir()\n\tcontent, err := ioutil.ReadFile(filepath.Join(dir, \".clog.toml\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes.NewBuffer(content), nil\n}", "title": "" }, { "docid": "9c8beb8cbd3f3816aaded804b218bc8f", "score": "0.53848314", "text": "func GetConf(confPath string, c string) *models.Conf {\n\tlog.Info(\"Conf - Path defined at \", confPath+c)\n\tfile, err := os.Open(confPath + c)\n\tif err != nil {\n\t\t// If the conf file is not loaded, we exit the app\n\t\tlog.Fatal(\"Conf - Failed to open file : \", err.Error())\n\t} else {\n\t\tlog.Debug(\"Conf - Open\")\n\t}\n\tdefer file.Close()\n\tdefer log.Debug(\"Conf - Closed\")\n\n\t// Decode the conf file and initiate the model\n\tdecoder := json.NewDecoder(file)\n\tconfiguration := models.Conf{}\n\n\terr = decoder.Decode(&configuration)\n\tif err != nil {\n\t\tlog.Fatal(\"Conf - Failed to decode conf file : \", err.Error())\n\t}\n\n\treturn &configuration\n}", "title": "" }, { "docid": "e9e826a28a7d4dc1bda305d79882e8f3", "score": "0.5382975", "text": "func GetConfig(params ...string) Configuration {\n\tconfiguration := Configuration{}\n\tfileName := fmt.Sprintf(Root + \"/config/conf.json\")\n\tgonfig.GetConf(fileName, &configuration)\n\treturn configuration\n}", "title": "" }, { "docid": "9b2fe10fc2e286ac854189698d232d93", "score": "0.53825206", "text": "func (a *DemoAdapter) Config() interface{} {\n\treturn a.cfg\n}", "title": "" }, { "docid": "ea33aa70933cd0bea3bff802ee704873", "score": "0.53668404", "text": "func (r *DaskJobReconciler) getConfig(namespace string, name string) (*corev1.ConfigMap, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"looking for config\", name)\n\tobjkey := client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\n\tconfig := corev1.ConfigMap{}\n\tif err := r.Get(ctx, objkey, &config); err != nil {\n\t\tErrorf(log, err, \"configStatus.Get Error: %+v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "title": "" }, { "docid": "57f90716b6ddf7eec92b0e65f8ffa4da", "score": "0.53511906", "text": "func (q *NQPU) GetConfig() (*pbQPU.ConfigResponse, error) {\n\tconf, err := q.qpu.Conns[0].Client.GetConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conf, err\n}", "title": "" }, { "docid": "fa82f8c9681fb477df0337e2119bcca7", "score": "0.5349013", "text": "func (conn SplunkConnection) GetConf(app string, file string) (map[string]map[string]interface{}, error) {\n\tdata := make(url.Values)\n\tdata.Add(\"output_mode\", \"json\")\n\tresponse, err := conn.HTTPGet(fmt.Sprintf(\"%s/servicesNS/%s/%s/configs/conf-%s?output_mode=json\", conn.BaseURL, conn.Username, app, file), &data)\n\tvar conf Conf\n\terr = json.Unmarshal([]byte(response), &conf)\n\tconfMap := make(map[string]map[string]interface{})\n\tfor _, entry := range conf.Entry {\n\t\tconfMap[entry.Name] = entry.Content\n\t}\n\treturn confMap, err\n}", "title": "" }, { "docid": "08e36c42d826372302f9120777e5f7e0", "score": "0.5333701", "text": "func Get() (*Configuration, error) {\n\tif cfg != nil {\n\t\treturn cfg, nil\n\t}\n\n\tcfg = &Configuration{\n\t\tBindAddr: \":22300\",\n\t\tDefaultLimit: 20,\n\t\tDefaultMaxLimit: 1000,\n\t\tDefaultOffset: 0,\n\t\tGracefulShutdownTimeout: 5 * time.Second,\n\t\tHealthCheckInterval: 30 * time.Second,\n\t\tHealthCheckCriticalTimeout: 90 * time.Second,\n\t\tZebedeeURL: \"http://localhost:8082\",\n\t\tMongoConfig: MongoConfig{\n\t\t\tClusterEndpoint: \"localhost:27017\",\n\t\t\tUsername: \"\",\n\t\t\tPassword: \"\",\n\t\t\tDatabase: \"recipes\",\n\t\t\tCollections: map[string]string{RecipesCollection: \"recipes\"},\n\t\t\tReplicaSet: \"\",\n\t\t\tIsStrongReadConcernEnabled: false,\n\t\t\tIsWriteConcernMajorityEnabled: true,\n\t\t\tConnectTimeout: 5 * time.Second,\n\t\t\tQueryTimeout: 15 * time.Second,\n\t\t\tTLSConnectionConfig: mongodriver.TLSConnectionConfig{\n\t\t\t\tIsSSL: false,\n\t\t\t\tVerifyCert: false,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn cfg, envconfig.Process(\"\", cfg)\n}", "title": "" }, { "docid": "7fe8e205e5098ba1b1ed550e7303f85b", "score": "0.5321017", "text": "func (t *OpenconfigPlatform_Components_Component_Transceiver) GetConfig() *OpenconfigPlatform_Components_Component_Transceiver_Config {\n\tif t != nil && t.Config != nil {\n\t\treturn t.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "933b65dac113669945f2384a6b67c319", "score": "0.5310042", "text": "func (m *AbstractManager) Config() *Config {\n\treturn m.config\n}", "title": "" }, { "docid": "45eeadfa7589ad6db125c7e8a10ec150", "score": "0.530841", "text": "func (e *DBClient) GetConfig() Config {\n\treturn e.config\n}", "title": "" }, { "docid": "32f1a6a96021978c2ba60a3661caaa76", "score": "0.5307205", "text": "func (t *TransactionsManager) Config() TransactionsConfig {\n\treturn t.config\n}", "title": "" }, { "docid": "b8d8f36071d30616e656eefadf2446f7", "score": "0.5305406", "text": "func ConfGetter() string {\n\treturn conf\n}", "title": "" }, { "docid": "92f27f97c53147b4412eed3d89ca9e9d", "score": "0.52987", "text": "func GetConfiguration(settings map[string]string) Configuration {\n\treturn Configuration{\n\t\tServerConfig: &config.Config{\n\t\t\tBroker: settings[\"broker\"],\n\t\t\tDefaultQueue: settings[\"downstream_queue\"],\n\t\t\tResultBackend: settings[\"result_backend\"],\n\t\t\tAMQP: &config.AMQPConfig{\n\t\t\t\tExchange: settings[\"amqp_exchange\"],\n\t\t\t\tExchangeType: settings[\"amqp_exchange_type\"],\n\t\t\t\tBindingKey: settings[\"amqp_binding_key\"],\n\t\t\t},\n\t\t},\n\t\tUpstreamQueues: strings.Split(settings[\"upstream_queues\"], \";\"),\n\t}\n}", "title": "" }, { "docid": "424a1e7f1a7aeae6a04f9bf3c3a9481d", "score": "0.5297917", "text": "func (bc *command) Config() error {\n\tbc.wrkr.Settings = config.ConfigWithEnv(\"iron_worker\", *envFlag)\n\tif *projectIDFlag != \"\" {\n\t\tbc.wrkr.Settings.ProjectId = *projectIDFlag\n\t}\n\tif *tokenFlag != \"\" {\n\t\tbc.wrkr.Settings.Token = *tokenFlag\n\t}\n\n\tif bc.wrkr.Settings.ProjectId == \"\" {\n\t\treturn errors.New(\"did not find project id in any config files or env variables\")\n\t}\n\tif bc.wrkr.Settings.Token == \"\" {\n\t\treturn errors.New(\"did not find token in any config files or env variables\")\n\t}\n\n\tbc.hud_URL_str = `Check 'https://hud.iron.io/tq/projects/` + bc.wrkr.Settings.ProjectId + \"/\"\n\n\tfmt.Println(LINES, `Configuring client`)\n\n\tpName, err := projectName(bc.wrkr.Settings)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(`%s Project '%s' with id='%s'`, BLANKS, pName, bc.wrkr.Settings.ProjectId)\n\tfmt.Println()\n\treturn nil\n}", "title": "" }, { "docid": "2634db3f1e345d3a942797f64678955e", "score": "0.52911043", "text": "func (c *Chain) GetConfig() *ichain.Config {\n\treturn proto.Clone(c.conf).(*ichain.Config)\n}", "title": "" }, { "docid": "b51d96fa19e8d83be930f70cad50811a", "score": "0.5260201", "text": "func Get() (*Configuration, error) {\n\tif cfg != nil {\n\t\treturn cfg, nil\n\t}\n\n\tbrokers := []string{\"localhost:9092\"}\n\n\tcfg = &Configuration{\n\t\tBindAddr: \":21800\",\n\t\tHost: \"http://localhost:21800\",\n\t\tBrokers: brokers,\n\t\tDatabakerImportTopic: \"data-bake-job-available\",\n\t\tInputFileAvailableTopic: \"input-file-available\",\n\t\tKafkaMaxBytes: 2000000,\n\t\tMongoDBURL: \"localhost:27017\",\n\t\tMongoDBDatabase: \"imports\",\n\t\tMongoDBCollection: \"imports\",\n\t\tServiceAuthToken: \"0C30662F-6CF6-43B0-A96A-954772267FF5\",\n\t\tDatasetAPIURL: \"http://localhost:22000\",\n\t\tRecipeAPIURL: \"http://localhost:22300\",\n\t\tGracefulShutdownTimeout: time.Second * 5,\n\t\tZebedeeURL: \"http://localhost:8082\",\n\t\tHealthCheckInterval: 30 * time.Second,\n\t\tHealthCheckCriticalTimeout: 90 * time.Second,\n\t\tDefaultLimit: 20,\n\t\tDefaultMaxLimit: 1000,\n\t\tDefaultOffset: 0,\n\t}\n\n\terr := envconfig.Process(\"\", cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cfg, nil\n}", "title": "" }, { "docid": "7a56bd5b750439b78e6cec6711d3602a", "score": "0.5250316", "text": "func (p *Port) Config() Config {\n\treturn p.config\n}", "title": "" }, { "docid": "8c3530a8cec1bf8dab4fb3e0c8ee0cfd", "score": "0.52489734", "text": "func (_Lendingpool *LendingpoolSession) GetConfiguration(asset common.Address) (DataTypesReserveConfigurationMap, error) {\n\treturn _Lendingpool.Contract.GetConfiguration(&_Lendingpool.CallOpts, asset)\n}", "title": "" }, { "docid": "af6c7752c6c213bf680a0296e93871f3", "score": "0.52403325", "text": "func (b *BasicCompiler) GetConfig(ctx context.Context) configs.ConfigItem {\n\treturn b.config\n}", "title": "" }, { "docid": "af6c7752c6c213bf680a0296e93871f3", "score": "0.52403325", "text": "func (b *BasicCompiler) GetConfig(ctx context.Context) configs.ConfigItem {\n\treturn b.config\n}", "title": "" }, { "docid": "fca619f3b49fc4a1703b3f0f5731de11", "score": "0.5219505", "text": "func (t ThemeClient) GetConfiguration() Configuration {\n\treturn t.config\n}", "title": "" }, { "docid": "eb1b75d2ce8637419976bbab605aa341", "score": "0.52132505", "text": "func GetConfigOperatorCliPath() (string, error) {\n\treturn filepath.Abs(env.cliPath)\n}", "title": "" }, { "docid": "5a061f0adf2dd7c2fffed27719e144ac", "score": "0.5212563", "text": "func (_ValidatorUtils *ValidatorUtilsCallerSession) GetConfig(rollup common.Address) (struct {\n\tConfirmPeriodBlocks *big.Int\n\tExtraChallengeTimeBlocks *big.Int\n\tArbGasSpeedLimitPerBlock *big.Int\n\tBaseStake *big.Int\n}, error) {\n\treturn _ValidatorUtils.Contract.GetConfig(&_ValidatorUtils.CallOpts, rollup)\n}", "title": "" }, { "docid": "ce52d8938211aad8b1f8b256ab60dbc9", "score": "0.52016497", "text": "func (p *Protocol) GetConfigInstance() interface{} { return &p.Cfg }", "title": "" }, { "docid": "e7665ea5ecc1767b3c8e76cbaeb815af", "score": "0.5194149", "text": "func Get() *Config {\n\tif conf == nil {\n\t\tpanic(\"config has not been initialized\")\n\t}\n\n\treturn conf\n}", "title": "" }, { "docid": "2c5618644f82a84fd3f15a2ff08c6b29", "score": "0.51907957", "text": "func GetRunningConfiguration() (Configuration, error){\n\tfile, err := os.Open(CONFIG_FILE)\n\t//Error if we can't open the file\n\tif err != nil{\n\t\treturn Configuration{},err\n\t}\n\n\t//Close when we are done with it\n\tdefer file.Close()\n\n\t//Our JSON decoder\n\tdecoder := json.NewDecoder(file)\n\n\t//Holder for the Config\n\tconfig := Configuration{}\n\n\t//Try to Decode JSON\n\terr = decoder.Decode(&config)\n\n\t//Error if we can't decode the JSON\n\tif err != nil{\n\t\treturn Configuration{}, err\n\t}\n\n\treturn config, nil\n\n}", "title": "" }, { "docid": "962da12739b752060a556385caa429a9", "score": "0.51899135", "text": "func (t *OpenconfigPlatform_Components_Component_Cpu) GetConfig() *OpenconfigPlatform_Components_Component_Cpu_Config {\n\tif t != nil && t.Config != nil {\n\t\treturn t.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "826ca09b99252194064f1b095c31fc05", "score": "0.5186219", "text": "func (r *DaskReconciler) getConfig(namespace string, name string) (*corev1.ConfigMap, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"looking for config\", name)\n\tobjkey := client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\n\tconfig := corev1.ConfigMap{}\n\tif err := r.Get(ctx, objkey, &config); err != nil {\n\t\tErrorf(log, err, \"configStatus.Get Error: %+v\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "title": "" }, { "docid": "d9b041474a0e53cdba5017969bc4c2cf", "score": "0.5184953", "text": "func (c *apiClient) getConfig() Config {\n\treturn c.config\n}", "title": "" }, { "docid": "2a25fc75634a25611097f8f2fdb7ca4e", "score": "0.51840204", "text": "func (m *RetryPolicy_RetryHostPredicate) GetConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*RetryPolicy_RetryHostPredicate_Config); ok {\n\t\treturn x.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c1e4e5aba5cf94e0451aca59bdbc237", "score": "0.51699716", "text": "func getConfig(ctx context.Context) *conf.Configuration {\n\tobj := ctx.Value(configKey)\n\tif obj == nil {\n\t\treturn nil\n\t}\n\treturn obj.(*conf.Configuration)\n}", "title": "" }, { "docid": "d5b7b2f1192c2151af35b0b88a02e93a", "score": "0.51693296", "text": "func (t *Topology) Conf() *wireguard.Conf {\n\tc := &wireguard.Conf{\n\t\tConfig: wgtypes.Config{\n\t\t\tPrivateKey: &t.key,\n\t\t\tListenPort: &t.port,\n\t\t\tReplacePeers: true,\n\t\t},\n\t}\n\tfor _, s := range t.segments {\n\t\tif s.location == t.location {\n\t\t\tcontinue\n\t\t}\n\t\tpeer := wireguard.Peer{\n\t\t\tPeerConfig: wgtypes.PeerConfig{\n\t\t\t\tAllowedIPs: append(s.allowedIPs, s.allowedLocationIPs...),\n\t\t\t\tPersistentKeepaliveInterval: &t.persistentKeepalive,\n\t\t\t\tPublicKey: s.key,\n\t\t\t\tReplaceAllowedIPs: true,\n\t\t\t},\n\t\t\tEndpoint: t.updateEndpoint(s.endpoint, s.key, &s.persistentKeepalive),\n\t\t}\n\t\tc.Peers = append(c.Peers, peer)\n\t}\n\tfor _, p := range t.peers {\n\t\tpeer := wireguard.Peer{\n\t\t\tPeerConfig: wgtypes.PeerConfig{\n\t\t\t\tAllowedIPs: p.AllowedIPs,\n\t\t\t\tPersistentKeepaliveInterval: &t.persistentKeepalive,\n\t\t\t\tPresharedKey: p.PresharedKey,\n\t\t\t\tPublicKey: p.PublicKey,\n\t\t\t\tReplaceAllowedIPs: true,\n\t\t\t},\n\t\t\tEndpoint: t.updateEndpoint(p.Endpoint, p.PublicKey, p.PersistentKeepaliveInterval),\n\t\t}\n\t\tc.Peers = append(c.Peers, peer)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "2de343b7b2f04518c471b38c92b810c3", "score": "0.51664203", "text": "func (c *client) GetConfig() *Config {\n\treturn c.config\n}", "title": "" }, { "docid": "8551055046b0574bcd99c7dc75362180", "score": "0.51572543", "text": "func (c *controllerConfig) GetConfig() config.Config {\n\treturn c.conf\n}", "title": "" }, { "docid": "386f38a546df7af6394cadc53308fc4e", "score": "0.5152083", "text": "func Get() config {\n\tmutex.RLock()\n\tdefer mutex.RUnlock()\n\treturn *cfg\n}", "title": "" }, { "docid": "d1425b03c40a8ba0fe2eb5a65c6eae9b", "score": "0.5148089", "text": "func (t *OpenconfigPlatform_Components_Component_Backplane) GetConfig() *OpenconfigPlatform_Components_Component_Backplane_Config {\n\tif t != nil && t.Config != nil {\n\t\treturn t.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c3e2d70fcf36578ca194d9b7698db361", "score": "0.5144672", "text": "func (t *OpenconfigPlatform_Components_Component_Fabric) GetConfig() *OpenconfigPlatform_Components_Component_Fabric_Config {\n\tif t != nil && t.Config != nil {\n\t\treturn t.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c74189720e9b72ff7d1cc6abcaab0ed", "score": "0.5128389", "text": "func (c *Client) Config() (config *rest.Config, err error) {\n\t// IsInCluster flag holds the top most priority\n\tif c.IsInCluster {\n\t\treturn c.getInClusterConfig()\n\t}\n\n\t// ENV holds second priority\n\tif strings.TrimSpace(c.getKubeMasterIPFromENV(K8sMasterIPEnvironmentKey)) != \"\" ||\n\t\tstrings.TrimSpace(c.getKubeConfigPathFromENV(KubeConfigEnvironmentKey)) != \"\" {\n\t\treturn c.getConfigFromENV()\n\t}\n\n\t// Defaults to InClusterConfig\n\treturn c.getInClusterConfig()\n}", "title": "" }, { "docid": "b06be45d2092ad55fccb7eb079c512d0", "score": "0.5125918", "text": "func (m *RetryPolicy_RetryHostPredicate) GetConfig() *types.Struct {\n\tif x, ok := m.GetConfigType().(*RetryPolicy_RetryHostPredicate_Config); ok {\n\t\treturn x.Config\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18e17a9365144068c9dfa02b4db5f68f", "score": "0.51179767", "text": "func (c *client) GetConfiguration(ctx context.Context, throttlerName string) (map[string]*throttlerdatapb.Configuration, error) {\n\tresponse, err := c.gRPCClient.GetConfiguration(ctx, &throttlerdatapb.GetConfigurationRequest{\n\t\tThrottlerName: throttlerName,\n\t})\n\tif err != nil {\n\t\treturn nil, vterrors.FromGRPC(err)\n\t}\n\treturn response.Configurations, nil\n}", "title": "" }, { "docid": "afbc3147667ddb163fd21cb4438d4222", "score": "0.5116467", "text": "func (a *APIv1) GetConfig() *configuration.Config {\n\treturn &a.config\n}", "title": "" }, { "docid": "9624fa77b8702fa5499daec91525c2a1", "score": "0.5113311", "text": "func (_ValidatorUtils *ValidatorUtilsSession) GetConfig(rollup common.Address) (struct {\n\tConfirmPeriodBlocks *big.Int\n\tExtraChallengeTimeBlocks *big.Int\n\tArbGasSpeedLimitPerBlock *big.Int\n\tBaseStake *big.Int\n}, error) {\n\treturn _ValidatorUtils.Contract.GetConfig(&_ValidatorUtils.CallOpts, rollup)\n}", "title": "" }, { "docid": "9efad33cd38d2d775a59e2c32d2dcf4d", "score": "0.511267", "text": "func C() Configuration {\n\tconfigLock.Lock()\n\tdefer configLock.Unlock()\n\treturn *conf\n}", "title": "" }, { "docid": "133a3b3112bd5188c95192dc0a374e67", "score": "0.5107863", "text": "func GetConfig() *Config {\n\treturn configuration\n}", "title": "" }, { "docid": "c74a35320eaf0a146e359da3101039ee", "score": "0.5102573", "text": "func LoadConf() (conf Conf, err error) {\n\tdbReconnectSec, err := strconv.Atoi(os.Getenv(\"SCHEDULER_POSTGRES_RECONNECT_SEC\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tdbPort, err := strconv.Atoi(os.Getenv(\"SCHEDULER_POSTGRES_PORT\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tdbReset, err := strconv.ParseBool(os.Getenv(\"SCHEDULER_POSTGRES_RESET\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tport, err := strconv.Atoi(os.Getenv(\"SCHEDULER_PORT\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tminioPort, err := strconv.Atoi(os.Getenv(\"SCHEDULER_MINIO_PORT\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tminioSecure, err := strconv.ParseBool(os.Getenv(\"SCHEDULER_MINIO_SECURE\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tredisPort, err := strconv.Atoi(os.Getenv(\"SCHEDULER_REDIS_PORT\"))\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\tconf = Conf{\n\t\tDB: pg.DBConf{\n\t\t\tDatabase: os.Getenv(\"SCHEDULER_POSTGRES_DB\"),\n\t\t\tUsername: os.Getenv(\"SCHEDULER_POSTGRES_USER\"),\n\t\t\tPassword: os.Getenv(\"SCHEDULER_POSTGRES_PASSWORD\"),\n\t\t\tPort: dbPort,\n\t\t\tHost: os.Getenv(\"SCHEDULER_POSTGRES_HOST\"),\n\t\t\tReconnectSec: time.Duration(dbReconnectSec) * time.Second,\n\t\t\tReset: dbReset,\n\t\t},\n\t\tMinio: minio.MinioConf{\n\t\t\tAccessKey: os.Getenv(\"SCHEDULER_MINIO_ACCESS_KEY\"),\n\t\t\tSecretKey: os.Getenv(\"SCHEDULER_MINIO_SECRET_KEY\"),\n\t\t\tHost: os.Getenv(\"SCHEDULER_MINIO_HOST\"),\n\t\t\tPort: minioPort,\n\t\t\tSecure: minioSecure,\n\t\t},\n\t\tRedis: redis.RedisConf{\n\t\t\tHost: os.Getenv(\"SCHEDULER_REDIS_HOST\"),\n\t\t\tPort: redisPort,\n\t\t},\n\t\tScheduler: SchedulerConf{\n\t\t\tPort: port,\n\t\t\tShutdownWaitInSec: 10 * time.Second,\n\t\t},\n\t}\n\n\tif err = conf.Validate(); err != nil {\n\t\tglog.Error(err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fe92931be63198a5d7a8ffac2a52c440", "score": "0.5100714", "text": "func GetConfig() BaseConfig {\n\treturn config\n}", "title": "" }, { "docid": "a2b991e4a7a3471830e319ff958e9266", "score": "0.50994503", "text": "func (c *Core) GetConfig() *ConfigNode {\n\treturn c.config\n}", "title": "" }, { "docid": "b2e33c4ce987b0ccaa1d006ee6f76539", "score": "0.5097068", "text": "func (rpcClient *AdminRPCClient) GetConfig() ([]byte, error) {\n\targs := AuthArgs{}\n\tvar reply []byte\n\n\terr := rpcClient.Call(adminServiceName+\".GetConfig\", &args, &reply)\n\treturn reply, err\n}", "title": "" }, { "docid": "063e40e3e06d1e89c244c3489c076b06", "score": "0.50964683", "text": "func (s *Service) GetConfig() *config.Config {\n\treturn s.cnf\n}", "title": "" }, { "docid": "f63ad3a7a5c2e4372d7c310621fad3aa", "score": "0.5091146", "text": "func GetConfig() Config {\n\treturn config\n}", "title": "" }, { "docid": "6f3e05674c2a03f95fc9a9dfdac3bbd8", "score": "0.5090434", "text": "func (p *OctopusDeployProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.apiKey),\n\t\t\"address\": cty.StringVal(p.address),\n\t})\n}", "title": "" }, { "docid": "8326186bac951414c780d957f38cc295", "score": "0.5090003", "text": "func GetConfig() map[string]interface{} {\n\treturn config\n}", "title": "" }, { "docid": "8326186bac951414c780d957f38cc295", "score": "0.5090003", "text": "func GetConfig() map[string]interface{} {\n\treturn config\n}", "title": "" }, { "docid": "d94af2fc5d9e16f261c17afb461734c1", "score": "0.50843644", "text": "func GetConfig(ctx context.Context, conn *grpc.ClientConn, js string, id int64) (string, error) {\n\tvar s string\n\t// 'c' is the gRPC stub.\n\tc := pb.NewGRPCConfigOperClient(conn)\n\n\t// 'a' is the object we send to the router via the stub.\n\ta := pb.ConfigGetArgs{ReqId: id, Yangpathjson: js}\n\n\t// 'st' is the streamed result that comes back from the target.\n\tst, err := c.GetConfig(ctx, &a)\n\tif err != nil {\n\t\treturn s, fmt.Errorf(\"gRPC GetConfig failed: %w\", err)\n\t}\n\n\tfor {\n\t\t// Loop through the responses in the stream until there is nothing left.\n\t\tr, err := st.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn s, nil\n\t\t}\n\t\tif len(r.GetErrors()) != 0 {\n\t\t\treturn s, fmt.Errorf(\"error triggered by remote host for ReqId: %v; %s\", id, r.GetErrors())\n\t\t}\n\t\tif len(r.GetYangjson()) > 0 {\n\t\t\ts += r.GetYangjson()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e63aba8b8b3d988cb40130d5716f5ce9", "score": "0.5077439", "text": "func getConfig() *Configuration {\n\tconfigFile := filepath.Join(getApolloDir(), \"config.json\")\n\tconfigContent, e := readFile(configFile)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\n\tconfig, e := readJSON(configContent)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "20cef9626b1280b28e423861dc7e614b", "score": "0.5075704", "text": "func (r *RoomServer) ConfigBase() runner.ConfigBase {\n\treturn &r.conf\n}", "title": "" }, { "docid": "31b43cdd5931180593e3e75b810fcd16", "score": "0.50742173", "text": "func GetConfiguration() Configuration {\n\treturn config\n}", "title": "" }, { "docid": "8437837b081b0cc5694fe31b0e7757b4", "score": "0.50722873", "text": "func (q *FQPU) GetConfig() (*pbQPU.ConfigResponse, error) {\n\tresp := protoutils.ConfigRespοnse(\n\t\tq.qpu.Config.QpuType,\n\t\tq.qpu.QueryingCapabilities,\n\t\tq.qpu.Dataset)\n\treturn resp, nil\n}", "title": "" }, { "docid": "accddadfc771584cc253342cfc783e6b", "score": "0.50716907", "text": "func GetAPIConf() APIConf {\n\treturn APIConf{\n\t\tHost: apiHost,\n\t\tPort: apiPort,\n\t\tCORS: apiCORS,\n\t\tPermitUserToCreateTeam: apiPermitUserToCreateTeam,\n\t}\n}", "title": "" }, { "docid": "0f86ee5dd4ea7bed9cdfd046cb010985", "score": "0.5057336", "text": "func (b *Builder) Config() []byte {\n\treturn b.config\n}", "title": "" }, { "docid": "62528eb1f4988fe86ed67371969491ba", "score": "0.50517046", "text": "func (cmd *EnforceCmd) Config() EnforceConfig {\n\treturn EnforceConfig{\n\t\tServer: cmd.Server,\n\t\tPassive: cmd.Passive,\n\t\tDebug: cmd.Debug,\n\t}\n}", "title": "" }, { "docid": "f764d03dfb80213483a0b4197399542e", "score": "0.50432396", "text": "func (p *producer) Config() interface{} {\n\treturn p.c\n}", "title": "" }, { "docid": "47b62942a2c7669ad8899ae386be43d2", "score": "0.5040146", "text": "func getConfig(t *testing.T) *cfg.Config {\n\tc := cfg.ResetTestRoot(t.Name())\n\n\t// and we use random ports to run in parallel\n\ttm, rpc, grpc := makeAddrs()\n\tc.P2P.ListenAddress = tm\n\tc.RPC.ListenAddress = rpc\n\tc.RPC.GRPCListenAddress = grpc\n\treturn c\n}", "title": "" }, { "docid": "d36fcf54a2c0c089d6403dacad4ebca7", "score": "0.50386834", "text": "func (c *Client) Config() *Config {\n\treturn c.config\n}", "title": "" }, { "docid": "c0ec319c5cfb54a7596f6c3b93e96398", "score": "0.5028131", "text": "func (task *Task) GetConfig(index int) *ProcessConfig {\n\tif index < len(task.TaskConfig.Processes) {\n\t\treturn task.TaskConfig.Processes[index]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17dc9fbc3f2a740ba02fa4192cf7885c", "score": "0.5023246", "text": "func getConfig(cfgFile string) (*config, error) {\n\tlogger.Infof(\"reading config from file : %s\", cfgFile)\n\tf, err := os.Open(cfgFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tconf, err := loadConfig(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "d68665b1198636f5f5ec0f4047ef9882", "score": "0.5020709", "text": "func Get() *ProxyConfig {\r\n\treturn &conf\r\n}", "title": "" }, { "docid": "e0302d457afae3824f377c6de9cc5084", "score": "0.50170743", "text": "func (r *Remote) Config() *config.RemoteConfig {\n\treturn r.c\n}", "title": "" }, { "docid": "03fb4f7feac82dc755b6fb33a7dd89df", "score": "0.50056833", "text": "func (b *backend) Config(ctx context.Context, s logical.Storage) (*config, error) {\n\tentry, err := s.Get(ctx, \"config\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result config\n\tif entry != nil {\n\t\tif err := entry.DecodeJSON(&result); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading configuration: %s\", err)\n\t\t}\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "7f6bfc7819f4b04abb51036b9263fa73", "score": "0.49999806", "text": "func (w *VPCPeeringBuildWaiter) Conf(timeout time.Duration) *resource.StateChangeConf {\n\tlog.Printf(\"[DEBUG] Create waiter timeout %.0f minutes\", timeout.Minutes())\n\n\treturn &resource.StateChangeConf{\n\t\tPending: []string{\"APPROVED\"},\n\t\tTarget: []string{\n\t\t\t\"ACTIVE\",\n\t\t\t\"REJECTED_BY_PEER\",\n\t\t\t\"PENDING_PEER\",\n\t\t\t\"INVALID_SPECIFICATION\",\n\t\t\t\"DELETING\",\n\t\t\t\"DELETED\",\n\t\t\t\"DELETED_BY_PEER\",\n\t\t},\n\t\tRefresh: w.RefreshFunc(),\n\t\tDelay: 10 * time.Second,\n\t\tTimeout: timeout,\n\t\tMinTimeout: 2 * time.Second,\n\t}\n}", "title": "" }, { "docid": "d06ebfe16460047dfbd985aa99a5f0e2", "score": "0.4997136", "text": "func (_Lendingpool *LendingpoolCaller) GetConfiguration(opts *bind.CallOpts, asset common.Address) (DataTypesReserveConfigurationMap, error) {\n\tvar out []interface{}\n\terr := _Lendingpool.contract.Call(opts, &out, \"getConfiguration\", asset)\n\n\tif err != nil {\n\t\treturn *new(DataTypesReserveConfigurationMap), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(DataTypesReserveConfigurationMap)).(*DataTypesReserveConfigurationMap)\n\n\treturn out0, err\n\n}", "title": "" } ]
2807799c21a722574648853aea1004d9
Merge merges other into info. The returned error is ErrBuildNumberConflict when other.BuildNumbers[0] already has the latest build number. This can happen if a single build reuses a step name, or the normalized test name derived from the step name is the same as another step in the same build.
[ { "docid": "cc2e87628cce2d521d81e75126682626", "score": "0.76697224", "text": "func (info *BuilderInfo) Merge(other *BuilderInfo) error {\n\tif len(info.BuildNumbers) > 0 && len(other.BuildNumbers) > 0 {\n\t\tif info.BuildNumbers[0] == other.BuildNumbers[0] {\n\t\t\treturn ErrBuildNumberConflict\n\t\t}\n\t}\n\n\tinfo.SecondsEpoch = append(other.SecondsEpoch, info.SecondsEpoch...)\n\tinfo.BlinkRevs = append(other.BlinkRevs, info.BlinkRevs...)\n\tinfo.BuildNumbers = append(other.BuildNumbers, info.BuildNumbers...)\n\tinfo.ChromeRevs = append(other.ChromeRevs, info.ChromeRevs...)\n\n\tif info.FailuresByType == nil && other.FailuresByType != nil {\n\t\tinfo.FailuresByType = make(map[string][]int)\n\t}\n\tfor k, v := range other.FailuresByType {\n\t\tinfo.FailuresByType[k] = append(v, info.FailuresByType[k]...)\n\t}\n\n\tinfo.FailureMap = FailureLongNames\n\n\tif info.Tests == nil {\n\t\tinfo.Tests = AggregateTest{}\n\t}\n\n\tinfo.Tests.WalkLeaves(func(_ string, leaf *AggregateTestLeaf) {\n\t\tleaf.Expected = nil\n\t\tleaf.Bugs = nil\n\t})\n\n\treturn info.Tests.Merge(other.Tests)\n}", "title": "" } ]
[ { "docid": "ec5e22b8f588a0c1b1fcd8b10a54adf6", "score": "0.61282706", "text": "func (ag *AggregateResult) Merge(other *AggregateResult) error {\n\tif ag.Builder != other.Builder {\n\t\treturn ErrBuilderNameConflict\n\t}\n\tif ag.BuilderInfo == nil {\n\t\tag.BuilderInfo = &BuilderInfo{}\n\t}\n\tag.Version = ResultsVersion\n\treturn ag.BuilderInfo.Merge(other.BuilderInfo)\n}", "title": "" }, { "docid": "450e23374106b6bc5e14ff065287689d", "score": "0.5838556", "text": "func (leaf *AggregateTestLeaf) Merge(other *AggregateTestLeaf) error {\n\t// Bugs and Expected should come from from other only.\n\tleaf.Bugs = other.Bugs\n\tif len(other.Expected) == 1 && other.Expected[0] != \"PASS\" {\n\t\tleaf.Expected = other.Expected\n\t}\n\n\tfor _, r := range other.Results {\n\t\tif len(leaf.Results) > 0 && r.Type == leaf.Results[0].Type {\n\t\t\tleaf.Results[0].Count += r.Count\n\t\t} else {\n\t\t\tleaf.Results = append([]ResultSummary{r}, leaf.Results...)\n\t\t}\n\t}\n\n\tfor _, r := range other.Runtimes {\n\t\tif len(leaf.Runtimes) > 0 && r.Runtime == leaf.Runtimes[0].Runtime {\n\t\t\tleaf.Runtimes[0].Count += r.Count\n\t\t} else {\n\t\t\tleaf.Runtimes = append([]RuntimeSummary{r}, leaf.Runtimes...)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "328d2220ef84638117e8640a0b63ec9c", "score": "0.5407514", "text": "func (e *IndexMergeRuntimeStat) Merge(other execdetails.RuntimeStats) {\n\ttmp, ok := other.(*IndexMergeRuntimeStat)\n\tif !ok {\n\t\treturn\n\t}\n\te.IndexMergeProcess += tmp.IndexMergeProcess\n\te.FetchIdxTime += tmp.FetchIdxTime\n\te.FetchRow += tmp.FetchRow\n\te.WaitTime += e.WaitTime\n\te.TableTaskNum += tmp.TableTaskNum\n}", "title": "" }, { "docid": "c5d2995f9702963ca2a8b847d7322518", "score": "0.5368241", "text": "func (h *HLL) Merge(other Aggregator) error {\n\th2, ok := other.(*HLL)\n\tif !ok {\n\t\treturn fmt.Errorf(\"cannot merge %T into %T\", other, h)\n\t}\n\n\th.h.Merge(h2.h)\n\th.n += h2.n\n\treturn nil\n}", "title": "" }, { "docid": "14f9fbda00b919d20a9939e226d93de4", "score": "0.5353662", "text": "func (e *Expectations) MergeExpectations(other *Expectations) {\n\tif other == nil {\n\t\treturn\n\t}\n\tother.mutex.RLock()\n\tdefer other.mutex.RUnlock()\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\te.ensureInit()\n\tfor testName, digests := range other.labels {\n\t\te.setDigests(testName, digests)\n\t}\n}", "title": "" }, { "docid": "6bf677286785e486b3bc7f7dc1013e82", "score": "0.53406966", "text": "func (n *Nagios) Merge(other *Nagios) {\n\tn.EscalateIf(other.Code)\n\tn.AddMessage(other.Message)\n\tn.Metrics = append(n.Metrics, other.Metrics...)\n}", "title": "" }, { "docid": "6a25536df37b694c954caaa4bc4aa426", "score": "0.5287583", "text": "func (cd *CommitDetails) Merge(other *CommitDetails) {\n\tcd.GetCommitTsTime += other.GetCommitTsTime\n\tcd.PrewriteTime += other.PrewriteTime\n\tcd.WaitPrewriteBinlogTime += other.WaitPrewriteBinlogTime\n\tcd.CommitTime += other.CommitTime\n\tcd.LocalLatchTime += other.LocalLatchTime\n\tcd.ResolveLockTime += other.ResolveLockTime\n\tcd.WriteKeys += other.WriteKeys\n\tcd.WriteSize += other.WriteSize\n\tcd.PrewriteRegionNum += other.PrewriteRegionNum\n\tcd.TxnRetry += other.TxnRetry\n\tcd.Mu.CommitBackoffTime += other.Mu.CommitBackoffTime\n\tcd.Mu.BackoffTypes = append(cd.Mu.BackoffTypes, other.Mu.BackoffTypes...)\n}", "title": "" }, { "docid": "7ca0f1dcf79ab3ce6fa0e272020ea510", "score": "0.52191603", "text": "func (hll HLL) Merge(other HLL) error {\n\t// verify that num register bits are equal\n\tif hll.numRegisterBits != other.numRegisterBits {\n\t\treturn errors.New(\"hll: can't merge HLLs with different number of registers\")\n\t}\n\n\tfor index, registerVal := range other.registers {\n\t\thll.registers[index] = int(math.Max(float64(registerVal), float64(hll.registers[index])))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3cd1f0ce5ce85e77723ed7416a288827", "score": "0.50017047", "text": "func (r *Result) Merge(other *Result) {\n\tr.Cluster = append(r.Cluster, other.Cluster...)\n\tr.Velero = append(r.Velero, other.Velero...)\n\tfor k, v := range other.Namespaces {\n\t\tif r.Namespaces == nil {\n\t\t\tr.Namespaces = make(map[string][]string)\n\t\t}\n\t\tr.Namespaces[k] = append(r.Namespaces[k], v...)\n\t}\n}", "title": "" }, { "docid": "a19b6362b1710f8f79a241bd39b9411c", "score": "0.49749124", "text": "func (v *Result) mergeErrors(otherResult *Result) {\n\tv.errors = append(v.errors, otherResult.Errors()...)\n\tv.score += otherResult.score\n}", "title": "" }, { "docid": "ac1a488217fc986c14704a91c41ddccf", "score": "0.48826733", "text": "func (mapping *Mapping) Merge(newThing manager.Thing) error {\n\treturn errors.New(\"Not implemented\", errors.NotImplemented, \"mapping.Merge\", true)\n}", "title": "" }, { "docid": "9e438a6d4cc904eb5734e3fee4ae4043", "score": "0.4779404", "text": "func (di *DriverInfo) MergeHealthCheck(other *DriverInfo) {\n\tdi.Healthy = other.Healthy\n\tdi.HealthDescription = other.HealthDescription\n\tdi.UpdateTime = other.UpdateTime\n}", "title": "" }, { "docid": "6247921eacdc32812a87b9784e744d67", "score": "0.47711685", "text": "func (a UASignature) Merge(b UASignature) UASignature {\n\tvar merged UASignature\n\tif a.BrowserName != b.BrowserName {\n\t\tmerged.BrowserName = 0\n\t\tmerged.BrowserVersion.Min = UAVersion{anyVersion, anyVersion, anyVersion}\n\t\tmerged.BrowserVersion.Max = UAVersion{anyVersion, anyVersion, anyVersion}\n\t} else {\n\t\tmerged.BrowserName = a.BrowserName\n\t\tmerged.BrowserVersion = a.BrowserVersion.Merge(b.BrowserVersion)\n\t}\n\tif a.OSPlatform != b.OSPlatform {\n\t\tmerged.OSPlatform = 0\n\t} else {\n\t\tmerged.OSPlatform = a.OSPlatform\n\t}\n\tif a.OSName != b.OSName {\n\t\tmerged.OSName = 0\n\t\tmerged.OSVersion.Min = UAVersion{anyVersion, anyVersion, anyVersion}\n\t\tmerged.OSVersion.Max = UAVersion{anyVersion, anyVersion, anyVersion}\n\t} else {\n\t\tmerged.OSName = a.OSName\n\t\tmerged.OSVersion = a.OSVersion.Merge(b.OSVersion)\n\t}\n\tif a.DeviceType != b.DeviceType {\n\t\tmerged.DeviceType = 0\n\t} else {\n\t\tmerged.DeviceType = a.DeviceType\n\t}\n\tmerged.Quirk = a.Quirk.Merge(b.Quirk)\n\treturn merged\n}", "title": "" }, { "docid": "9d872eeb82d32c3e305d5002b8ff930c", "score": "0.47555795", "text": "func (s *Stats) Merge(other *Stats) {\n\tif s == nil || other == nil {\n\t\treturn\n\t}\n\n\ts.AddWallTime(other.LoadWallTime())\n\ts.AddFetchedSeries(other.LoadFetchedSeries())\n\ts.AddFetchedChunkBytes(other.LoadFetchedChunkBytes())\n}", "title": "" }, { "docid": "2badd97a77d990b73f5594f6b4e7cf6b", "score": "0.47212422", "text": "func (wd WriteDiffer) Merge(wd2 WriteDiffer) error {\n\tfor k, v := range wd2 {\n\t\tif _, has := wd[k]; has {\n\t\t\treturn fmt.Errorf(\"path %s already exists in write differ\", k)\n\t\t}\n\t\twd[k] = v\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fca257a5ef4533fed8d4933bab72cc8c", "score": "0.4695178", "text": "func (idx *Index) Merge(other *Index) {\n\tdebug.Log(\"Index.Merge\", \"Merge index with %p\", other)\n\tidx.m.Lock()\n\tdefer idx.m.Unlock()\n\n\tfor k, v := range other.pack {\n\t\tif _, ok := idx.pack[k]; ok {\n\t\t\tdebug.Log(\"Index.Merge\", \"index already has key %v, updating\", k[:8])\n\t\t}\n\n\t\tidx.pack[k] = v\n\t}\n\tdebug.Log(\"Index.Merge\", \"done merging index\")\n}", "title": "" }, { "docid": "87182763652b1fafe19a4683d7309249", "score": "0.46616793", "text": "func (value1 Value) Merge(value2 Value) (Value, error) {\n\tif value1.Value.Key != value2.Value.Key {\n\t\treturn Value{},\n\t\t\terrors.New(\"Objets non missibles: clés '\" +\n\t\t\t\tvalue1.Value.Key + \"' et '\" +\n\t\t\t\tvalue2.Value.Key + \"'\")\n\t}\n\tfor idBatch := range value2.Value.Batch {\n\t\tif value1.Value.Batch == nil {\n\t\t\tvalue1.Value.Batch = make(map[string]Batch)\n\t\t}\n\t\tvalue1.Value.Batch[idBatch].Merge(value2.Value.Batch[idBatch])\n\t}\n\treturn value1, nil\n}", "title": "" }, { "docid": "53c00fc3b580738c66c7b4e62912aa73", "score": "0.46160617", "text": "func (r *Record) Merge(r2 Record) error {\n\tif r.PartOne == false || r2.PartOne {\n\t\treturn errors.New(\"Expected part1 and part2 of the same record - usage: part1.Merge(part2)\")\n\t}\n\tif r.SessionID != r2.SessionID {\n\t\treturn errors.New(\"Records to merge are not from the same sesion - r1:\" + r.SessionID + \" r2:\" + r2.SessionID)\n\t}\n\tif r.CmdLine != r2.CmdLine {\n\t\treturn errors.New(\"Records to merge are not parts of the same records - r1:\" + r.CmdLine + \" r2:\" + r2.CmdLine)\n\t}\n\tif r.RecordID != r2.RecordID {\n\t\treturn errors.New(\"Records to merge do not have the same ID - r1:\" + r.RecordID + \" r2:\" + r2.RecordID)\n\t}\n\t// r.RealtimeBefore != r2.RealtimeBefore - can't be used because of bash-preexec runs when it's not supposed to\n\tr.ExitCode = r2.ExitCode\n\tr.PwdAfter = r2.PwdAfter\n\tr.RealPwdAfter = r2.RealPwdAfter\n\tr.GitDirAfter = r2.GitDirAfter\n\tr.GitRealDirAfter = r2.GitRealDirAfter\n\tr.RealtimeAfter = r2.RealtimeAfter\n\tr.GitOriginRemoteAfter = r2.GitOriginRemoteAfter\n\tr.TimezoneAfter = r2.TimezoneAfter\n\tr.RealtimeAfterLocal = r2.RealtimeAfterLocal\n\tr.RealtimeDuration = r2.RealtimeDuration\n\n\tr.PartsMerged = true\n\tr.PartOne = false\n\treturn nil\n}", "title": "" }, { "docid": "6cb2fe1fb3d5baaafb45c8a3e93e8ac6", "score": "0.460667", "text": "func (r *Result) Concat(other *Result) {\n\tfor _, dj := range other.DeltaJob {\n\t\tr.DeltaJob = append(r.DeltaJob, dj)\n\t}\n}", "title": "" }, { "docid": "4d876654d7fadbf6d7f7ff662e33c4a3", "score": "0.46048698", "text": "func (s *CountMinSketch) Merge(other *CountMinSketch) error {\n\tif s.d != other.d {\n\t\treturn errors.New(\"matrix depth must match\")\n\t}\n\n\tif s.w != other.w {\n\t\treturn errors.New(\"matrix width must match\")\n\t}\n\n\tfor i := uint(0); i < s.d; i++ {\n\t\tfor j := uint(0); j < s.w; j++ {\n\t\t\ts.count[i][j] += other.count[i][j]\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b9a2df60c254793cf7cbc391e72e5b1", "score": "0.45529473", "text": "func (r Run) Merge(o changes.Change) (changes.Change, changes.Change) {\n\treturn r.merge(o, false)\n}", "title": "" }, { "docid": "f1b4c780962bfaf2f5ec759906a0a734", "score": "0.45277813", "text": "func mergeBuildIntoAnnotation(c context.Context, step *miloProto.Step, build *buildbot.Build) error {\n\tallProps := stringset.New(len(step.Property) + len(build.Properties))\n\tfor _, prop := range step.Property {\n\t\tallProps.Add(prop.Name)\n\t}\n\tfor _, prop := range build.Properties {\n\t\t// Annotation protobuf overrides BuildBot properties.\n\t\tif allProps.Has(prop.Name) {\n\t\t\tcontinue\n\t\t}\n\t\tallProps.Add(prop.Name)\n\n\t\tstep.Property = append(step.Property, &miloProto.Step_Property{\n\t\t\tName: prop.Name,\n\t\t\tValue: fmt.Sprintf(\"%v\", prop.Value),\n\t\t})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1eb61249f244f319d1da663116b27971", "score": "0.45273733", "text": "func (s *Store) Merge() (int, error) {\n\treturn s.merger.run()\n}", "title": "" }, { "docid": "db2487a2feadc6e3387eba9f7b58ceae", "score": "0.4502664", "text": "func (targetBuildInfo *BuildInfo) Append(buildInfo *BuildInfo) {\n\tfor i, newModule := range buildInfo.Modules {\n\t\texists := false\n\t\tfor j := range targetBuildInfo.Modules {\n\t\t\tif newModule.Id == targetBuildInfo.Modules[j].Id {\n\t\t\t\tmergeModules(&buildInfo.Modules[i], &targetBuildInfo.Modules[j])\n\t\t\t\texists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !exists {\n\t\t\ttargetBuildInfo.Modules = append(targetBuildInfo.Modules, newModule)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b2e1f1bc1f314b82fe3daced9a22a7b2", "score": "0.44996113", "text": "func (c *Config) Merge(other *Config) {\n\tc.SkipDirs = append(c.SkipDirs, other.SkipDirs...)\n\tc.SkipFiles = append(c.SkipFiles, other.SkipFiles...)\n\tc.ProhibitedLicenseTypes = append(c.ProhibitedLicenseTypes, other.ProhibitedLicenseTypes...)\n\tc.TextExtensionList = append(c.TextExtensionList, other.TextExtensionList...)\n\tc.StrictTextExtensionList = append(c.StrictTextExtensionList, other.StrictTextExtensionList...)\n\tc.ExitOnDirRestrictedLicense = c.ExitOnDirRestrictedLicense || other.ExitOnDirRestrictedLicense\n\tc.ExitOnProhibitedLicenseTypes = c.ExitOnProhibitedLicenseTypes || other.ExitOnProhibitedLicenseTypes\n\tc.ExitOnUnlicensedFiles = c.ExitOnUnlicensedFiles || other.ExitOnUnlicensedFiles\n\tc.StrictAnalysis = c.StrictAnalysis || other.StrictAnalysis\n\tc.OutputLicenseFile = c.OutputLicenseFile || other.OutputLicenseFile\n\tif c.MaxReadSize == 0 {\n\t\tc.MaxReadSize = other.MaxReadSize\n\t}\n\tif c.OutputFilePrefix == \"\" {\n\t\tc.OutputFilePrefix = other.OutputFilePrefix\n\t}\n\tif c.OutputFileExtension == \"\" {\n\t\tc.OutputFileExtension = other.OutputFileExtension\n\t}\n\tc.SingleLicenseFiles = append(c.SingleLicenseFiles, other.SingleLicenseFiles...)\n\tc.StopLicensePropagation = append(c.StopLicensePropagation, other.StopLicensePropagation...)\n\tif c.LicensePatternDir == \"\" {\n\t\tc.LicensePatternDir = other.LicensePatternDir\n\t}\n\tc.CustomProjectLicenses = append(c.CustomProjectLicenses, other.CustomProjectLicenses...)\n\tc.FlutterLicenses = append(c.FlutterLicenses, other.FlutterLicenses...)\n\tc.NoticeTxtFiles = append(c.NoticeTxtFiles, other.NoticeTxtFiles...)\n\tif c.BaseDir == \"\" {\n\t\tc.BaseDir = other.BaseDir\n\t}\n\tif c.Target == \"\" {\n\t\tc.Target = other.Target\n\t}\n\tif c.LogLevel == \"\" {\n\t\tc.LogLevel = other.LogLevel\n\t}\n\n\tif c.LicenseAllowList == nil {\n\t\tc.LicenseAllowList = make(map[string][]string)\n\t}\n\tif other.LicenseAllowList != nil {\n\t\tfor k := range other.LicenseAllowList {\n\t\t\tc.LicenseAllowList[k] = append(c.LicenseAllowList[k], other.LicenseAllowList[k]...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8e5670e6e4690a47f8e06d4bd7310116", "score": "0.44830796", "text": "func TestGitHubDriver_MergePullRequest_MergeFails(t *testing.T) {\n\tdriver, teardown := setupGithubDriver(t, \"TOKEN\")\n\tdefer teardown()\n\toptions := hosting.MergePullRequestOptions{\n\t\tBranch: \"feature\",\n\t\tCommitMessage: \"title\\nextra detail1\\nextra detail2\",\n\t\tParentBranch: \"main\",\n\t}\n\thttpmock.RegisterResponder(\"GET\", githubChildOpen, httpmock.NewStringResponder(200, \"[]\"))\n\thttpmock.RegisterResponder(\"GET\", githubCurrOpen, httpmock.NewStringResponder(200, `[{\"number\": 1}]`))\n\thttpmock.RegisterResponder(\"PUT\", githubPR1Merge, httpmock.NewStringResponder(404, \"\"))\n\t_, err := driver.MergePullRequest(options)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "515dc10f2e70f458a775dee01b877c8e", "score": "0.4461333", "text": "func (c *Config) Merge(other Config) *Config {\n\tc.Execution.merge(other.Execution)\n\tc.Fallback.merge(other.Fallback)\n\tc.Metrics.merge(other.Metrics)\n\tc.General.merge(other.General)\n\treturn c\n}", "title": "" }, { "docid": "1c2b3ad3c89e7e7fcce9e457cb73c7e9", "score": "0.44596803", "text": "func (vc *VariantConfig) Merge(vc2 VariantConfig) {\n\tvc.Copies.Merge(vc2.Copies)\n\tvc.CommonConfig.Merge(vc2.CommonConfig)\n}", "title": "" }, { "docid": "0b244fcbd403057b6029abc8eaa592a8", "score": "0.44539586", "text": "func (d *Dependency) Merge(src *Dependency) error {\n\tif src == nil {\n\t\treturn nil\n\t}\n\n\t// do not merge dependencies that do not match\n\tif d.Name != src.Name {\n\t\treturn nil\n\t}\n\n\tif src.Source != \"\" {\n\t\td.Source = src.Source\n\t}\n\n\tif src.RunInSeparateEnv {\n\t\td.RunInSeparateEnv = src.RunInSeparateEnv\n\t}\n\n\tif d.Backend == nil && src.Backend != nil {\n\t\td.Backend = src.Backend\n\t\treturn nil\n\t}\n\n\tif err := d.Backend.Merge(src.Backend); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b63d21109d30c36c1f3809bbe295fd3", "score": "0.44340795", "text": "func (a UAVersionSignature) Merge(b UAVersionSignature) UAVersionSignature {\n\treturn UAVersionSignature{Min: a.Min.minMerge(b.Min), Max: a.Max.maxMerge(b.Max)}\n}", "title": "" }, { "docid": "add97632cf9f8cc63250c3dfd83ac4bb", "score": "0.44241276", "text": "func (graph *Graph) Merge(o *Output) error {\r\n\r\n\t// Remove edges\r\n\tfor _, edgeKey := range o.Delete.Edges {\r\n\t\tgraph.DeleteEdge(edgeKey)\r\n\t}\r\n\r\n\t// Remove edges from legacy index\r\n\tfor _, legacyEdgeKey := range o.Delete.LegacyEdges {\r\n\t\tgraph.DeleteEdgeFromLegacyIndex(legacyEdgeKey)\r\n\t}\r\n\r\n\t// Remove nodes\r\n\tfor _, nodeKey := range o.Delete.Nodes {\r\n\t\tgraph.DeleteNode(nodeKey)\r\n\t}\r\n\r\n\t// Remove nodes from legacy index\r\n\tfor _, legacyNodeKey := range o.Delete.LegacyNodes {\r\n\t\tgraph.DeleteNodeFromLegacyIndex(legacyNodeKey)\r\n\t}\r\n\r\n\t// Add new nodes\r\n\tfor nodeKey, node := range o.Merge.Nodes {\r\n\t\tgraph.MergeNode(nodeKey, node.Props)\r\n\t}\r\n\r\n\t// Add new edges\r\n\tfor edgeKey, edge := range o.Merge.Edges {\r\n\t\tgraph.MergeEdge(edgeKey, edge.Label, edge.Start, edge.End, edge.Props)\r\n\t}\r\n\r\n\t// Add nodes legacy index\r\n\tfor legacyNodeIndex, nodeKey := range o.Merge.LegacyIndex.Nodes {\r\n\t\tgraph.AddNodeLegacyIndex(legacyNodeIndex, nodeKey)\r\n\t}\r\n\r\n\t// Add edges legacy index\r\n\tfor legacyEdgeIndex, edgeKey := range o.Merge.LegacyIndex.Edges {\r\n\t\tgraph.AddEdgeLegacyIndex(legacyEdgeIndex, edgeKey)\r\n\t}\r\n\treturn nil\r\n\r\n}", "title": "" }, { "docid": "c2dd33d29929ffaaebcd23cff7534a72", "score": "0.44118473", "text": "func (s *Set) Combine(other []byte) error {\n\totherHLL, _ := hyperloglog.NewPlus(18)\n\tif err := otherHLL.GobDecode(other); err != nil {\n\t\treturn err\n\t}\n\tif err := s.hll.Merge(otherHLL); err != nil {\n\t\t// does not error unless compressions are different\n\t\t// however, decoding the other hll causes us to use its compression\n\t\t// parameter, which might be different from ours\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40059a93714169b272bb6132305021db", "score": "0.43982822", "text": "func (a L7ParserType) Merge(b L7ParserType) (L7ParserType, error) {\n\tif a == b {\n\t\treturn a, nil\n\t}\n\tif a.canPromoteTo(b) {\n\t\treturn b, nil\n\t}\n\tif b.canPromoteTo(a) {\n\t\treturn a, nil\n\t}\n\treturn ParserTypeNone, fmt.Errorf(\"cannot merge conflicting L7 parsers (%s/%s)\", a, b)\n}", "title": "" }, { "docid": "000b342fb6be05c5eda0c64ae26c56c5", "score": "0.43886933", "text": "func (o *Output) MergeVerification(v verifier.Output) {\n\tfor i, n := range o.Names {\n\t\tif v, ok := v[n.Name]; ok {\n\t\t\to.Names[i].Verification = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e89ba885d31bd2c623d53d99e997d8d8", "score": "0.4383067", "text": "func (bag MetricsBag) Merge(other MetricsBag) {\n\tfor key, val := range other {\n\t\tswitch key[0] {\n\t\tcase 'c', 'd':\n\t\t\t// Counters and deltas should be summed\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = int64(0)\n\t\t\t}\n\t\t\tbag[key] = bag[key].(int64) + val.(int64)\n\t\tcase 'g':\n\t\t\t// Gauges must be averaged\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = val.(float64)\n\t\t\t}\n\t\t\tbag[key] = (bag[key].(float64) + val.(float64)) / 2\n\n\t\tcase 'h':\n\t\t\t// Histograms are concatenated\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = []float64{}\n\t\t\t}\n\t\t\tbag[key] = append(bag[key].([]float64), val.([]float64)...)\n\n\t\tcase 't':\n\t\t\t// timings are concatenated\n\t\t\tif _, ok := bag[key]; !ok {\n\t\t\t\tbag[key] = []time.Duration{}\n\t\t\t}\n\t\t\tbag[key] = append(bag[key].([]time.Duration), val.([]time.Duration)...)\n\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unsupported key %q\", key))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2316b5c9b506ac29e84b64cc9a3fda2", "score": "0.4382308", "text": "func (m *Merger) Merge(logger io.Writer) error {\n\tsrcMethod, err := mergeCheck(m.srcRoot)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"src dir invalid: %s\", err.Error())\n\t}\n\n\tdstMethod, err := mergeCheck(m.dstRoot)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dst dir invalid: %s\", err.Error())\n\t}\n\n\tif srcMethod != dstMethod {\n\t\treturn fmt.Errorf(\"src %s sorted by %s, dst %s sorted by %s\",\n\t\t\tm.srcRoot, srcMethod, m.dstRoot, dstMethod)\n\t}\n\n\treturn m.mergeRoots(logger)\n}", "title": "" }, { "docid": "3a80a76791b7932104c52aab78471d58", "score": "0.43683976", "text": "func (p *Patcher) buildMergePatch(original, modified, current []byte) ([]byte, error) {\n\tpreconditions := []mergepatch.PreconditionFunc{mergepatch.RequireKeyUnchanged(\"apiVersion\"),\n\t\tmergepatch.RequireKeyUnchanged(\"kind\"), mergepatch.RequireMetadataKeyUnchanged(\"name\")}\n\tpatch, err := jsonmergepatch.CreateThreeWayJSONMergePatch(original, modified, current, preconditions...)\n\tif err != nil {\n\t\tif mergepatch.IsPreconditionFailed(err) {\n\t\t\treturn nil, fmt.Errorf(\"%s\", \"At least one of apiVersion, kind and name was changed\")\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn patch, nil\n}", "title": "" }, { "docid": "8dd8e5a8e1a31a2301b33cff503f8c58", "score": "0.43625244", "text": "func TestGiteaDriver_MergePullRequest_MergeFails(t *testing.T) {\n\tdriver, teardown := setupGiteaDriver(t, \"TOKEN\")\n\tdefer teardown()\n\toptions := hosting.MergePullRequestOptions{\n\t\tBranch: \"feature\",\n\t\tCommitMessage: \"title\\nextra detail1\\nextra detail2\",\n\t\tParentBranch: \"main\",\n\t}\n\thttpmock.RegisterResponder(\"GET\", giteaCurrOpen, httpmock.NewStringResponder(200, `[{\"number\": 1, \"base\": {\"label\": \"main\"}, \"head\": {\"label\": \"foo\"} }]`))\n\thttpmock.RegisterResponder(\"GET\", giteaVersion, httpmock.NewStringResponder(200, `{\"version\": \"1.11.5\"}`))\n\thttpmock.RegisterResponder(\"POST\", giteaPR1Merge, httpmock.NewStringResponder(404, \"\"))\n\t_, err := driver.MergePullRequest(options)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "98657755f0471f659dd0b9b8fdd0b27e", "score": "0.43503982", "text": "func (a UAVersion) maxMerge(b UAVersion) UAVersion {\n\tif a.Major == anyVersion || b.Major == anyVersion {\n\t\treturn UAVersion{anyVersion, anyVersion, anyVersion}\n\t}\n\tif a.Major > b.Major {\n\t\treturn a\n\t}\n\tif a.Major < b.Major {\n\t\treturn b\n\t}\n\tif a.Minor == anyVersion || b.Minor == anyVersion {\n\t\treturn UAVersion{a.Major, anyVersion, anyVersion}\n\t}\n\tif a.Minor > b.Minor {\n\t\treturn a\n\t}\n\tif a.Minor < b.Minor {\n\t\treturn b\n\t}\n\tif a.Patch == anyVersion || b.Patch == anyVersion {\n\t\treturn UAVersion{a.Major, a.Minor, anyVersion}\n\t}\n\tif a.Patch > b.Patch {\n\t\treturn a\n\t}\n\tif a.Patch < b.Patch {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "0ea146e987dae6120700a98b783cd23f", "score": "0.43493924", "text": "func (ld *LockKeysDetails) Merge(lockKey *LockKeysDetails) {\n\tld.TotalTime += lockKey.TotalTime\n\tld.RegionNum += lockKey.RegionNum\n\tld.LockKeys += lockKey.LockKeys\n\tld.ResolveLockTime += lockKey.ResolveLockTime\n\tld.BackoffTime += lockKey.BackoffTime\n\tld.LockRPCTime += lockKey.LockRPCTime\n\tld.LockRPCCount += ld.LockRPCCount\n\tld.Mu.BackoffTypes = append(ld.Mu.BackoffTypes, lockKey.Mu.BackoffTypes...)\n\tld.RetryCount++\n}", "title": "" }, { "docid": "461c3d530b661683114ae015826af6bb", "score": "0.43445945", "text": "func merge(ar1 accessRegister, ar2 accessRegister) accessRegister {\n\tpanic(\"implement me!\")\n}", "title": "" }, { "docid": "9adf00a2f6e62dc9a3cd149bcdcc1b3f", "score": "0.43415612", "text": "func Test_merge_with_meter(t *testing.T) {\n\n\t// Time unit and token calculations\n\tm1 := Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tm2 := Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(m1) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, m1)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(m1) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, m1)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(m1) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, m1)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tmm := Meter{Tokens: 180, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tmm = Meter{Tokens: 4320, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tmm = Meter{Tokens: 72, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 200, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tmm = Meter{Tokens: 200, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 4321, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tmm = Meter{Tokens: 4321, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"hour\", NotificationIntervalS: 100}\n\tm2 = Meter{Tokens: 73, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tmm = Meter{Tokens: 73, PerTimeUnit: \"day\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\t// Notification interval time\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 90}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 100}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(m1) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, m1)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 10}\n\tif am := m1.MergeWith(m2, 0); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 10}\n\tif am := m1.MergeWith(m2, 10); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 30}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 0, PerTimeUnit: \"\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tm2 = Meter{Tokens: 0, PerTimeUnit: \"\", NotificationIntervalS: 0}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 0, PerTimeUnit: \"\", NotificationIntervalS: 0}\n\tm2 = Meter{Tokens: 0, PerTimeUnit: \"\", NotificationIntervalS: 0}\n\tmm = Meter{Tokens: 0, PerTimeUnit: \"\", NotificationIntervalS: 0}\n\tif am := m1.MergeWith(m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n}", "title": "" }, { "docid": "b641483f36c7db49f2368508674bd56f", "score": "0.43349746", "text": "func (s Settings) Merge(s1 Settings) error {\n\tif s1 == nil {\n\t\treturn nil\n\t}\n\treturn mapper.Map(s, s1)\n}", "title": "" }, { "docid": "2ba89bbc2262b1b117b17586f4defb41", "score": "0.433153", "text": "func (m *CachingManager) Merge(thing, thingToMerge Thing, params string) error {\n\terr := m.component.Combine(thing, thingToMerge, params)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cachingManger.Merge (\"+thing.Type()+\")\")\n\t}\n\t// deal with errors below\n\terr = m.Save(thing)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cachingManger.Merge (\"+thing.Type()+\")\")\n\t}\n\terr = m.Delete(thingToMerge)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cachingManger.Merge (\"+thing.Type()+\")\")\n\t}\n\tdelete(m.thingMap, thingToMerge.GetID())\n\treturn nil\n}", "title": "" }, { "docid": "a31d0a837242ef85811375d26503d029", "score": "0.43262315", "text": "func (gsm *GaugeSampleMetric) Merge(x GaugeSampleMetric) {\n\tgsm.sampleSum += x.sampleSum\n\tgsm.count += x.count\n}", "title": "" }, { "docid": "d4b0bf9eb0f98dcd5f9b9a97688c51fb", "score": "0.43222228", "text": "func Merge(err ...error) error {\n\tvar errs []error\n\tfor _, e := range err {\n\t\tif e != nil {\n\t\t\terrs = append(errs, e)\n\t\t}\n\t}\n\tif len(errs) == 0 {\n\t\treturn nil\n\t}\n\treturn &merged{s: err}\n}", "title": "" }, { "docid": "844479d10a6c38892cdfadbe22c3be40", "score": "0.43017522", "text": "func Merge(filesIn []string, fileOut string, config *pdfcpu.Configuration) error {\n\n\tfmt.Printf(\"merging into %s: %v\\n\", fileOut, filesIn)\n\t//logErrorAPI.Printf(\"Merge: filesIn: %v\\n\", filesIn)\n\n\tctxDest, _, _, err := readAndValidate(filesIn[0], config, time.Now())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ctxDest.XRefTable.Version() < pdfcpu.V15 {\n\t\tv, _ := pdfcpu.Version(\"1.5\")\n\t\tctxDest.XRefTable.RootVersion = &v\n\t\tlog.Stats.Println(\"Ensure V1.5 for writing object & xref streams\")\n\t}\n\n\t// Repeatedly merge files into fileDest's xref table.\n\tfor _, f := range filesIn[1:] {\n\t\terr = appendTo(f, ctxDest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = pdfcpu.OptimizeXRefTable(ctxDest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = pdfcpu.ValidateXRefTable(ctxDest.XRefTable)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctxDest.Write.Command = \"Merge\"\n\n\tdirName, fileName := filepath.Split(fileOut)\n\tctxDest.Write.DirName = dirName\n\tctxDest.Write.FileName = fileName\n\n\terr = Write(ctxDest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Stats.Printf(\"XRefTable:\\n%s\\n\", ctxDest)\n\n\treturn nil\n}", "title": "" }, { "docid": "2e696478a8eedbb3c7c9bf7c109a7cbe", "score": "0.4301719", "text": "func (gcl *GitCommandLine) Merge(ref string, args ...string) error {\n\n\tout, err := exec.Command(\n\t\t\"git\",\n\t\t\"-c\",\n\t\t\"user.name=prwatch\",\n\t\t\"-c\",\n\t\t\"user.email=prwatch@github.bot\",\n\t\t\"merge\",\n\t\tref,\n\t\t\"-m\",\n\t\t\"Test merge\").CombinedOutput()\n\n\tif err != nil {\n\t\tlog.Println(\"Error merging branch:\", string(out))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "101d50475af4ef4998224f040713d73f", "score": "0.42869025", "text": "func (pDiffs *Diffs) CleanupMerge() (diffs Diffs) {\n\tvar insBuf, delBuf strbuf\n\tdiffs = append(*pDiffs, Diff{Equal, \"\"})\n\tiw := 0 // write index\n\n\tw := func(op int, text string) {\n\t\tdiffs[iw] = Diff{op, text}\n\t\tiw++\n\t}\n\tprevEqual := func() (eq *Diff) {\n\t\tif iw == 0 {\n\t\t\treturn\n\t\t}\n\t\tif p := &diffs[iw-1]; p.Op == Equal {\n\t\t\teq = p\n\t\t}\n\t\treturn\n\t}\n\n\tfor _, d := range diffs {\n\t\tswitch d.Op {\n\t\tcase noop:\n\t\tcase Insert:\n\t\t\tinsBuf = append(insBuf, d.Text)\n\t\tcase Delete:\n\t\t\tdelBuf = append(delBuf, d.Text)\n\t\tcase deleteInsert:\n\t\t\tinsBuf = append(insBuf, d.Text)\n\t\t\tdelBuf = append(delBuf, d.Text)\n\t\tcase Equal:\n\t\t\ttextIns := insBuf.join()\n\t\t\ttextDel := delBuf.join()\n\t\t\tif textDel != \"\" && textIns != \"\" { // both types\n\t\t\t\t// Factor out any common prefixes\n\t\t\t\tif pfx := commonPrefix(textIns, textDel); pfx != \"\" {\n\t\t\t\t\tif iw != 0 {\n\t\t\t\t\t\tif prev := prevEqual(); prev == nil {\n\t\t\t\t\t\t\tpanic(\"Previous diff should have been an equality\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprev.Text += pfx\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tw(Equal, pfx)\n\t\t\t\t\t}\n\t\t\t\t\ttextIns = textIns[len(pfx):]\n\t\t\t\t\ttextDel = textDel[len(pfx):]\n\t\t\t\t}\n\t\t\t\t// Factor out any common suffixies.\n\t\t\t\tif sfx := commonSuffix(textIns, textDel); sfx != \"\" {\n\t\t\t\t\td.Text = sfx + d.Text\n\t\t\t\t\ttextIns = textIns[:len(textIns)-len(sfx)]\n\t\t\t\t\ttextDel = textDel[:len(textDel)-len(sfx)]\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Insert the merged records.\n\t\t\tif textDel != \"\" {\n\t\t\t\tw(Delete, textDel)\n\t\t\t}\n\t\t\tif textIns != \"\" {\n\t\t\t\tw(Insert, textIns)\n\t\t\t}\n\t\t\tif prev := prevEqual(); prev != nil {\n\t\t\t\tprev.Text += d.Text\n\t\t\t} else {\n\t\t\t\tw(Equal, d.Text)\n\t\t\t}\n\t\t}\n\t}\n\tdiffs = diffs[:iw]\n\tif last := len(diffs) - 1; diffs[last].Text == \"\" {\n\t\tdiffs = diffs[:last]\n\t}\n\n\t// Second pass: look for single edits surrounded on both sides by equalities\n\t// which can be shifted sideways to eliminate an equality.\n\t// e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC\n\tchanges := false\n\tiLast := len(diffs) - 1\n\tfor i, d := range diffs {\n\t\tif i == 0 || i == iLast {\n\t\t\tcontinue\n\t\t}\n\t\tprev, next := &diffs[i-1], &diffs[i+1]\n\t\tif prev.Op != Equal || next.Op != Equal {\n\t\t\tcontinue\n\t\t}\n\t\t// This is a single edit surrounded by equalities.\n\t\tif strings.HasSuffix(d.Text, prev.Text) {\n\t\t\tdiffs[i].Text = prev.Text + d.Text[:len(d.Text)-len(prev.Text)]\n\t\t\tnext.Text = prev.Text + next.Text\n\t\t\tprev.Op = noop\n\t\t\tchanges = true\n\t\t} else if strings.HasPrefix(d.Text, next.Text) {\n\t\t\tprev.Text += next.Text\n\t\t\tdiffs[i].Text = d.Text[len(next.Text):] + next.Text\n\t\t\tnext.Op = noop\n\t\t\tchanges = true\n\t\t}\n\t}\n\n\t// If shifts were made, the diff needs reordering and another shift sweep\n\tif changes {\n\t\tdiffs.CleanupMerge()\n\t}\n\t*pDiffs = diffs\n\treturn diffs\n}", "title": "" }, { "docid": "f9c61a09d4e9d535c7f8f761ad51652c", "score": "0.42760548", "text": "func (d *Server) Merge(ctx context.Context, m *pb.MergeRequest) (*pb.MergeResponse, error) {\n aRef := ReferenceId(m.ReferenceId)\n bRef := ReferenceId(m.OtherReferenceId)\n\n if e := d.database.Merge(aRef, bRef); e != nil {\n return &pb.MergeResponse{Status:&pb.Status{Success:false, ErrorType:e.Error()}}, nil\n }\n return &pb.MergeResponse{Status:&pb.Status{Success:true}}, nil\n}", "title": "" }, { "docid": "f41ac8baf62b8d137b6b61442ab6f01f", "score": "0.42696598", "text": "func (targetDepConfig *Dependency) DeepMerge(sourceDepConfig Dependency) error {\n\tif sourceDepConfig.ConfigPath != \"\" {\n\t\ttargetDepConfig.ConfigPath = sourceDepConfig.ConfigPath\n\t}\n\n\tif sourceDepConfig.SkipOutputs != nil {\n\t\ttargetDepConfig.SkipOutputs = sourceDepConfig.SkipOutputs\n\t}\n\n\tif sourceDepConfig.MockOutputs != nil {\n\t\tif targetDepConfig.MockOutputs == nil {\n\t\t\ttargetDepConfig.MockOutputs = sourceDepConfig.MockOutputs\n\t\t} else {\n\t\t\tnewMockOutputs, err := deepMergeCtyMaps(*targetDepConfig.MockOutputs, *sourceDepConfig.MockOutputs)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttargetDepConfig.MockOutputs = newMockOutputs\n\t\t}\n\t}\n\n\tif sourceDepConfig.MockOutputsAllowedTerraformCommands != nil {\n\t\tif targetDepConfig.MockOutputsAllowedTerraformCommands == nil {\n\t\t\ttargetDepConfig.MockOutputsAllowedTerraformCommands = sourceDepConfig.MockOutputsAllowedTerraformCommands\n\t\t} else {\n\t\t\tmergedCmds := append(*targetDepConfig.MockOutputsAllowedTerraformCommands, *sourceDepConfig.MockOutputsAllowedTerraformCommands...)\n\t\t\ttargetDepConfig.MockOutputsAllowedTerraformCommands = &mergedCmds\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43b18443915719d4698f4043c09c2d3d", "score": "0.4247016", "text": "func (p *PointsWriterDefault) Merge(mergeState *MergeState) error {\n\t// check each incoming reader\n\tfor _, reader := range mergeState.PointsReaders {\n\t\tif reader == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := reader.CheckIntegrity(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// merge field at a time\n\tfor _, fieldInfo := range mergeState.MergeFieldInfos.List() {\n\t\tif fieldInfo.GetPointDimensionCount() == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif err := p.MergeOneField(mergeState, fieldInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn p.Finish()\n}", "title": "" }, { "docid": "0dd1e8bf2f99f19e24e61e4fb783a481", "score": "0.42425698", "text": "func merge(pExecor Execor, pModel Model) Result {\n\treturn exec(pExecor, pModel, update, updateArgs, updateHooks)\n}", "title": "" }, { "docid": "0090065ed9785ceb66830d8f13f41b34", "score": "0.42420864", "text": "func (d Dependencies) Merge(other schema.Annotation) schema.Annotation {\n\tif deps, ok := other.(Dependencies); ok {\n\t\treturn append(d, deps...)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "552f44e81b340774a2ac6e5690c38847", "score": "0.4232581", "text": "func (a MetricAnnotations) Merge(other MetricAnnotations) MetricAnnotations {\n\tif other.BleemeoItem != \"\" {\n\t\ta.BleemeoItem = other.BleemeoItem\n\t}\n\n\tif other.ContainerID != \"\" {\n\t\ta.ContainerID = other.ContainerID\n\t}\n\n\tif other.ServiceName != \"\" {\n\t\ta.ServiceName = other.ServiceName\n\t}\n\n\tif other.ServiceInstance != \"\" {\n\t\ta.ServiceInstance = other.ServiceInstance\n\t}\n\n\tif other.StatusOf != \"\" {\n\t\ta.StatusOf = other.StatusOf\n\t}\n\n\tif other.SNMPTarget != \"\" {\n\t\ta.SNMPTarget = other.SNMPTarget\n\t}\n\n\tif other.BleemeoAgentID != \"\" {\n\t\ta.BleemeoAgentID = other.BleemeoAgentID\n\t}\n\n\tif other.Status.CurrentStatus.IsSet() {\n\t\ta.Status = other.Status\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "3dab24174f04887e858a31760e285a68", "score": "0.42228082", "text": "func (c EdgeMetadatas) Merge(other EdgeMetadatas) EdgeMetadatas {\n\tvar (\n\t\tcSize = c.Size()\n\t\totherSize = other.Size()\n\t\toutput = c.psMap\n\t\titer = other.psMap\n\t)\n\tswitch {\n\tcase cSize == 0:\n\t\treturn other\n\tcase otherSize == 0:\n\t\treturn c\n\tcase cSize < otherSize:\n\t\toutput, iter = iter, output\n\t}\n\titer.ForEach(func(key string, otherVal interface{}) {\n\t\tif val, ok := output.Lookup(key); ok {\n\t\t\toutput = output.Set(key, otherVal.(EdgeMetadata).Merge(val.(EdgeMetadata)))\n\t\t} else {\n\t\t\toutput = output.Set(key, otherVal)\n\t\t}\n\t})\n\treturn EdgeMetadatas{output}\n}", "title": "" }, { "docid": "957b43c09e42baca74a1d776741b10b3", "score": "0.42088482", "text": "func (di *DriverInfo) MergeFingerprintInfo(other *DriverInfo) {\n\tdi.Detected = other.Detected\n\tdi.Attributes = other.Attributes\n}", "title": "" }, { "docid": "f1eeb05fb2ac242db5c1561725720e31", "score": "0.41997018", "text": "func TestMerge(t *testing.T) {\n\t// Crea an expected merged slice\n\texpected := new([]*models.Ticket)\n\tfor i := 0; i < 6; i++ {\n\t\tticket := &models.Ticket{\n\t\t\tID: i,\n\t\t}\n\t\t*expected = append(*expected, ticket)\n\t}\n\t// Create a sorted left slice\n\tleft := new([]*models.Ticket)\n\tfor i := 0; i < 3; i++ {\n\t\titem := &models.Ticket{\n\t\t\tID: i,\n\t\t}\n\n\t\t*left = append(*left, item)\n\t}\n\t// Create a sorted right slice\n\tright := new([]*models.Ticket)\n\tfor i := 3; i < 6; i++ {\n\t\titem := &models.Ticket{\n\t\t\tID: i,\n\t\t}\n\n\t\t*right = append(*right, item)\n\t}\n\toutput := merge(*left, *right)\n\tfor i := 0; i < 6; i++ {\n\t\tif (*expected)[i].ID != output[i].ID {\n\t\t\tt.Errorf(\"Output: %d, did not equal expected: %d.\", output[i].ID, (*expected)[i].ID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bcb53a9d48fe8d1086f25454fc004820", "score": "0.41891846", "text": "func (v *ValidationExpr) Merge(other *ValidationExpr) {\n\tif v.Values == nil {\n\t\tv.Values = other.Values\n\t}\n\tif v.Format == \"\" {\n\t\tv.Format = other.Format\n\t}\n\tif v.Pattern == \"\" {\n\t\tv.Pattern = other.Pattern\n\t}\n\tif v.ExclusiveMinimum == nil || (other.ExclusiveMinimum != nil && *v.ExclusiveMinimum > *other.ExclusiveMinimum) {\n\t\tv.ExclusiveMinimum = other.ExclusiveMinimum\n\t}\n\tif v.Minimum == nil || (other.Minimum != nil && *v.Minimum > *other.Minimum) {\n\t\tv.Minimum = other.Minimum\n\t}\n\tif v.ExclusiveMaximum == nil || (other.ExclusiveMaximum != nil && *v.ExclusiveMaximum > *other.ExclusiveMaximum) {\n\t\tv.ExclusiveMaximum = other.ExclusiveMaximum\n\t}\n\tif v.Maximum == nil || (other.Maximum != nil && *v.Maximum < *other.Maximum) {\n\t\tv.Maximum = other.Maximum\n\t}\n\tif v.MinLength == nil || (other.MinLength != nil && *v.MinLength > *other.MinLength) {\n\t\tv.MinLength = other.MinLength\n\t}\n\tif v.MaxLength == nil || (other.MaxLength != nil && *v.MaxLength < *other.MaxLength) {\n\t\tv.MaxLength = other.MaxLength\n\t}\n\tv.AddRequired(other.Required...)\n}", "title": "" }, { "docid": "873b46fd53d91e6a45dec293e127396d", "score": "0.41837505", "text": "func merge(dst, src *specs.Spec) *specs.Spec {\n\terr := mergo.Merge(dst, src, mergo.WithAppendSlice)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\n\t\t\t\"failed to merge specs %v %v - programming mistake? %w\",\n\t\t\tdst, src, err,\n\t\t))\n\t}\n\n\treturn dst\n}", "title": "" }, { "docid": "c7d085e02cb1a7e28389db6ec989c5a0", "score": "0.4182881", "text": "func (a *AppendValueMerger) MergeOlder(value []byte) error {\n\tbuf := make([]byte, len(a.buf)+len(value))\n\tcopy(buf, value)\n\tcopy(buf[len(value):], a.buf)\n\ta.buf = buf\n\treturn nil\n}", "title": "" }, { "docid": "136a8bf54fade4de82eb1ffb3521c1a6", "score": "0.41811427", "text": "func Merge(mta *MTA, mtaExt *EXT, extFilePath string) error {\n\terr := chain().\n\t\textendMap(&mta.Parameters, mta.ParametersMetaData, mtaExt.Parameters, mergeRootParametersErrorMsg).\n\t\terr\n\tif err != nil {\n\t\treturn wrapMergeError(err, extFilePath)\n\t}\n\n\tif err = mergeModules(*mta, mtaExt.Modules); err != nil {\n\t\treturn wrapMergeError(err, extFilePath)\n\t}\n\n\tif err = mergeResources(*mta, mtaExt.Resources); err != nil {\n\t\treturn wrapMergeError(err, extFilePath)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8b81d51ab507ce0cc85dec8ee64115ea", "score": "0.41783124", "text": "func Merge(dest interface{}, src interface{}) error {\n\tvSrc := reflect.ValueOf(src)\n\tvDst := reflect.ValueOf(dest)\n\treturn merge(vDst, vSrc)\n}", "title": "" }, { "docid": "e29ae1841e60ae0704cbe9c7c346c442", "score": "0.41755664", "text": "func (h *StringHash) Merge(other *StringHash) (merged *StringHash) {\n\tmerged = h.Copy()\n\tmerged.PutAll(other)\n\treturn\n}", "title": "" }, { "docid": "d380088b3bfba6af8cc4b5b660fecbe3", "score": "0.4157474", "text": "func MergeJSON(firstSource, secondSource []byte) ([]byte, error) {\n\tsecondSourceJSON, err := gabs.ParseJSON(secondSource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfirstSourceJSON, err := gabs.ParseJSON(firstSource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = firstSourceJSON.MergeFn(secondSourceJSON, func(destination, source interface{}) interface{} {\n\t\tif source == nil {\n\t\t\treturn destination\n\t\t}\n\t\tif s, ok := source.(string); ok && s == \"\" {\n\t\t\treturn destination\n\t\t}\n\t\treturn source\n\t})\n\n\treturn firstSourceJSON.Bytes(), nil\n}", "title": "" }, { "docid": "6edeedae81530e1cd2562381c6122c38", "score": "0.41514227", "text": "func Merge(a, b *Config) {\n\tcommon.Merge(&a.Config, &b.Config)\n\n\tif b.Nodes != 0 {\n\t\ta.Nodes = b.Nodes\n\t}\n}", "title": "" }, { "docid": "494b0c6e34e9be62cae110ba009ccd6b", "score": "0.41499344", "text": "func MergeCombinedStats(dest, src *messages.CombinedStats) {\n\tif src.TotalTestTime > dest.TotalTestTime {\n\t\tdest.TotalTestTime = src.TotalTestTime\n\t}\n\tMergeSummaryStats(dest.Interactions, src.Interactions)\n\tfor srcReqName, srcReqStats := range src.Requests {\n\t\tMergeSummaryStats(dest.Requests[srcReqName], srcReqStats)\n\t}\n}", "title": "" }, { "docid": "2db8a97fb100dc21d58f0d75e99e7638", "score": "0.41484168", "text": "func MergeJobs(x, y MerkleNode) (job.Job, error) {\n\txTask, err := x.GetJob().GetTask()\n\tif err != nil {\n\t\treturn job.Job{}, err\n\t}\n\tyTask, err := y.GetJob().GetTask()\n\tif err != nil {\n\t\treturn job.Job{}, err\n\t}\n\treturn job.Job{\n\t\tID: x.GetJob().GetID() + y.GetJob().GetID(),\n\t\tHash: x.GetJob().GetHash() + y.GetJob().GetHash(),\n\t\tExecs: append(x.GetJob().GetExecs(), y.GetJob().GetExecs()...),\n\t\tTask: helpers.Encode64(bytes.Join([][]byte{[]byte(xTask), []byte(yTask)}, []byte{})),\n\t\tSignature: x.GetJob().GetSignature() + y.GetJob().GetSignature(),\n\t}, nil\n}", "title": "" }, { "docid": "f345027120970158e0e38ae61a2f05e9", "score": "0.41442072", "text": "func Merge(dst, src interface{}) error {\n\treturn mergo.MergeWithOverwrite(dst, src)\n}", "title": "" }, { "docid": "e7571c2e2b0700bb7e95f4ae59e1a3aa", "score": "0.41371578", "text": "func (r *Row) Merge(r2 Row) {\n\tr.cmd_line = merge(r.cmd_line, r2.cmd_line)\n\tr.option_file = merge(r.option_file, r2.option_file)\n\tr.system_var = merge(r.system_var, r2.system_var)\n\tr.var_scope = merge(r.var_scope, r2.var_scope)\n\tr.dynamic = merge(r.dynamic, r2.dynamic)\n\tr.command_line_format = merge(r.command_line_format, r2.command_line_format)\n\tr.default_value = merge(r.default_value, r2.default_value)\n\tr.data_type = merge(r.data_type, r2.data_type)\n}", "title": "" }, { "docid": "0de610cd9588d62a5aa842b4d0a42a03", "score": "0.41356206", "text": "func (rl ReplicationLatency) merge(other ReplicationLatency) (newReplLatency ReplicationLatency) {\n\tnewReplLatency.UploadHistogram = rl.UploadHistogram.Merge(other.UploadHistogram)\n\treturn\n}", "title": "" }, { "docid": "00ceb26686e6f1573c864b62ccbab78e", "score": "0.41328514", "text": "func WithBuildNumber() string {\n\treturn fmt.Sprintf(\"%s (build %s)\", WithRevision(), buildNumber)\n}", "title": "" }, { "docid": "945a12a6b349e8f8afe48488ede4542e", "score": "0.4123626", "text": "func (s *Stats) Merge(s1 *Stats) {\n\t// qps & tps\n\ts.TotalAddProcessed += s1.TotalAddProcessed\n\ts.TotalWriteProcessed += s1.TotalWriteProcessed\n\ts.TotalDelProcessed += s1.TotalDelProcessed\n\ts.TotalGetProcessed += s1.TotalGetProcessed\n\ts.TotalFlushProcessed += s1.TotalFlushProcessed\n\ts.TotalCompactProcessed += s1.TotalCompactProcessed\n\t// bytes\n\ts.TotalReadBytes += s1.TotalReadBytes\n\ts.TotalWriteBytes += s1.TotalWriteBytes\n\t// delay\n\ts.TotalAddDelay += s1.TotalAddDelay\n\ts.TotalWriteDelay += s1.TotalWriteDelay\n\ts.TotalDelDelay += s1.TotalDelDelay\n\ts.TotalGetDelay += s1.TotalGetDelay\n\ts.TotalFlushDelay += s1.TotalFlushDelay\n\ts.TotalCompactDelay += s1.TotalCompactDelay\n}", "title": "" }, { "docid": "03fb88eb923d7e986c96ad4d036082ae", "score": "0.41192678", "text": "func TestCombine(t *testing.T) {\n\tunittest.SmallTest(t)\n\n\tfirst := SummaryMap{\n\t\tFirstTest: {\n\t\t\tName: FirstTest,\n\t\t\tDiameter: 4,\n\t\t\tPos: 2,\n\t\t\tNeg: 3,\n\t\t\tUntriaged: 1,\n\t\t\tUntHashes: types.DigestSlice{AlphaDigest},\n\t\t\tNum: 6,\n\t\t\tCorpus: \"gm\",\n\t\t\tBlame: []blame.WeightedBlame{\n\t\t\t\t{\n\t\t\t\t\tAuthor: \"test@example.com\",\n\t\t\t\t\tProb: 1.00,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tSecondTest: {\n\t\t\tName: SecondTest,\n\t\t\tDiameter: 14,\n\t\t\tPos: 12,\n\t\t\tNeg: 13,\n\t\t\tUntriaged: 1,\n\t\t\tUntHashes: types.DigestSlice{BetaDigest},\n\t\t\tNum: 26,\n\t\t\tCorpus: \"gm\",\n\t\t\tBlame: []blame.WeightedBlame{\n\t\t\t\t{\n\t\t\t\t\tAuthor: \"other@example.com\",\n\t\t\t\t\tProb: 0.5,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tAuthor: \"test@example.com\",\n\t\t\t\t\tProb: 0.5,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tsecond := SummaryMap{\n\t\tFirstTest: {\n\t\t\tName: FirstTest,\n\t\t\tDiameter: 24,\n\t\t\tPos: 22,\n\t\t\tNeg: 23,\n\t\t\tUntriaged: 0,\n\t\t\tUntHashes: types.DigestSlice{},\n\t\t\tNum: 45,\n\t\t\tCorpus: \"gm\",\n\t\t\tBlame: []blame.WeightedBlame{},\n\t\t},\n\t\tThirdTest: {\n\t\t\tName: ThirdTest,\n\t\t\tDiameter: 34,\n\t\t\tPos: 32,\n\t\t\tNeg: 33,\n\t\t\tUntriaged: 1,\n\t\t\tUntHashes: types.DigestSlice{GammaDigest},\n\t\t\tNum: 66,\n\t\t\tCorpus: \"gm\",\n\t\t\tBlame: []blame.WeightedBlame{\n\t\t\t\t{\n\t\t\t\t\tAuthor: \"nobody@example.com\",\n\t\t\t\t\tProb: 1.0,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tresult := first.Combine(second)\n\n\t// Originals first and second should be unchanged\n\trequire.Len(t, first, 2)\n\trequire.Len(t, second, 2)\n\trequire.Len(t, result, 3)\n\n\trequire.Len(t, first[FirstTest].Blame, 1)\n\trequire.Len(t, second[FirstTest].Blame, 0)\n\trequire.Len(t, result[FirstTest].Blame, 0)\n\n\trequire.Contains(t, result, FirstTest)\n\trequire.Contains(t, result, SecondTest)\n\trequire.Contains(t, result, ThirdTest)\n}", "title": "" }, { "docid": "98ebce863ca0b1892016df1c9455b08c", "score": "0.41192043", "text": "func mergeErrorHooks(terragruntOptions *options.TerragruntOptions, childHooks []ErrorHook, parentHooks *[]ErrorHook) {\n\tresult := *parentHooks\n\tfor _, child := range childHooks {\n\t\tparentHookWithSameName := getIndexOfErrorHookWithName(result, child.Name)\n\t\tif parentHookWithSameName != -1 {\n\t\t\t// If the parent contains a hook with the same name as the child,\n\t\t\t// then override the parent's hook with the child's.\n\t\t\tterragruntOptions.Logger.Debugf(\"hook '%v' from child overriding parent\", child.Name)\n\t\t\tresult[parentHookWithSameName] = child\n\t\t} else {\n\t\t\t// If the parent does not contain a hook with the same name as the child\n\t\t\t// then add the child to the end.\n\t\t\tresult = append(result, child)\n\t\t}\n\t}\n\t*parentHooks = result\n}", "title": "" }, { "docid": "0e321ce3f99591e51964fa10874d3736", "score": "0.4118627", "text": "func TestGiteaDriver_MergePullRequest_GetPullRequestToMergeFails(t *testing.T) {\n\tdriver, teardown := setupGiteaDriver(t, \"TOKEN\")\n\tdefer teardown()\n\toptions := hosting.MergePullRequestOptions{\n\t\tBranch: \"feature\",\n\t\tPullRequestNumber: 1,\n\t\tCommitMessage: \"title\\nextra detail1\\nextra detail2\",\n\t\tParentBranch: \"main\",\n\t}\n\thttpmock.RegisterResponder(\"GET\", giteaCurrOpen, httpmock.NewStringResponder(200, \"[]\"))\n\thttpmock.RegisterResponder(\"GET\", giteaPR1Merge, httpmock.NewStringResponder(404, \"\"))\n\t_, err := driver.MergePullRequest(options)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "bef9ec03023bea70098f36c42d2e2cf6", "score": "0.41139713", "text": "func (sd *ScanDetail) Merge(scanDetail *ScanDetail) {\n\tatomic.AddInt64(&sd.TotalKeys, scanDetail.TotalKeys)\n\tatomic.AddInt64(&sd.ProcessedKeys, scanDetail.ProcessedKeys)\n\tatomic.AddUint64(&sd.RocksdbDeleteSkippedCount, scanDetail.RocksdbDeleteSkippedCount)\n\tatomic.AddUint64(&sd.RocksdbKeySkippedCount, scanDetail.RocksdbKeySkippedCount)\n\tatomic.AddUint64(&sd.RocksdbBlockCacheHitCount, scanDetail.RocksdbBlockCacheHitCount)\n\tatomic.AddUint64(&sd.RocksdbBlockReadCount, scanDetail.RocksdbBlockReadCount)\n\tatomic.AddUint64(&sd.RocksdbBlockReadByte, scanDetail.RocksdbBlockReadByte)\n}", "title": "" }, { "docid": "4be2e86580b254a276905e12453f95fb", "score": "0.41107464", "text": "func (a UAVersion) minMerge(b UAVersion) UAVersion {\n\tif a.Major == anyVersion || b.Major == anyVersion {\n\t\treturn UAVersion{anyVersion, anyVersion, anyVersion}\n\t}\n\tif a.Major < b.Major {\n\t\treturn a\n\t}\n\tif a.Major > b.Major {\n\t\treturn b\n\t}\n\tif a.Minor == anyVersion || b.Minor == anyVersion {\n\t\treturn UAVersion{a.Major, anyVersion, anyVersion}\n\t}\n\tif a.Minor < b.Minor {\n\t\treturn a\n\t}\n\tif a.Minor > b.Minor {\n\t\treturn b\n\t}\n\tif a.Patch == anyVersion || b.Patch == anyVersion {\n\t\treturn UAVersion{a.Major, a.Minor, anyVersion}\n\t}\n\tif a.Patch < b.Patch {\n\t\treturn a\n\t}\n\tif a.Patch > b.Patch {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "7a123e8c7912a2288af27247fb895a29", "score": "0.41093388", "text": "func (o *Options) Merge(from *Options) {\n\tif o.Pipeline == \"\" {\n\t\to.Pipeline = from.Pipeline\n\t}\n\n\tif o.Delay == 0 {\n\t\to.Delay = from.Delay\n\t}\n}", "title": "" }, { "docid": "ef62fd9965c5707376540cbd55d309df", "score": "0.41084567", "text": "func TestGitHubDriver_MergePullRequest_GetPullRequestToMergeFails(t *testing.T) {\n\tdriver, teardown := setupGithubDriver(t, \"TOKEN\")\n\tdefer teardown()\n\toptions := hosting.MergePullRequestOptions{\n\t\tBranch: \"feature\",\n\t\tCommitMessage: \"title\\nextra detail1\\nextra detail2\",\n\t\tParentBranch: \"main\",\n\t}\n\thttpmock.RegisterResponder(\"GET\", githubChildOpen, httpmock.NewStringResponder(200, \"[]\"))\n\thttpmock.RegisterResponder(\"GET\", githubCurrOpen, httpmock.NewStringResponder(404, \"\"))\n\t_, err := driver.MergePullRequest(options)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "3fcc8c211ce67ba7e1c246f099520179", "score": "0.41074157", "text": "func (m *Metrics) Merge(nm *Metrics) {\n\tm.init()\n\n\tif nm.Requests == 0 {\n\t\treturn\n\t}\n\tm.Requests += nm.Requests\n\tfor k, v := range nm.StatusCodes {\n\t\tm.StatusCodes[k] += v\n\t}\n\tm.BytesIn.Total += nm.BytesIn.Total\n\tm.BytesOut.Total += nm.BytesOut.Total\n\n\tm.Earliest = minNonzeroTime(m.Earliest, nm.Earliest)\n\tm.Latest = maxTime(m.Latest, nm.Latest)\n\tm.End = maxTime(m.End, nm.End)\n\tm.success += uint64(nm.Throughput * (nm.Duration + nm.Wait).Seconds())\n\n\tm.Latencies.init()\n\tm.Latencies.Total += nm.Latencies.Total\n\tif m.Latencies.Min == 0 || (nm.Latencies.Min < m.Latencies.Min && nm.Latencies.Min > 0) {\n\t\tm.Latencies.Min = nm.Latencies.Min\n\t}\n\tm.Latencies.Max = time.Duration(math.Max(float64(m.Latencies.Max), float64(nm.Latencies.Max)))\n\tif len(nm.Latencies.Centroids) > 0 {\n\t\tm.Latencies.estimator.(tdigestMerger).MergeCentroids(nm.Latencies.Centroids)\n\t}\n\tif !m.discardErrors {\n\t\tfor _, e := range nm.Errors {\n\t\t\tif _, ok := m.errors[e]; !ok {\n\t\t\t\tm.errors[e] = struct{}{}\n\t\t\t\tm.Errors = append(m.Errors, e)\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ccc594c8363a7de66e9f638f5bcacbf5", "score": "0.40971872", "text": "func (this *apiResult) MergeWithResult(r IResult) {\n\tif r == nil {\n\t\treturn\n\t}\n\tfor _, v := range r.GetMessages() {\n\t\tthis.messages = append(this.messages, v)\n\t}\n\n\tif this.log_level < r.GetLogLevel() {\n\t\tthis.log_level = r.GetLogLevel()\n\t}\n\n\tthis.children = append(this.children, r.GetChildren()...)\n\tthis.response_message = r.GetResponseMessage()\n\tthis.status_code = r.GetStatusCode()\n}", "title": "" }, { "docid": "18fde10bddc875f5c241c0d20e8cf852", "score": "0.40824133", "text": "func MergeWithPreviousBuilds(builds, previous []graph.Artifact) []graph.Artifact {\n\tupdatedBuilds := map[string]graph.Artifact{}\n\tfor _, build := range builds {\n\t\tupdatedBuilds[build.ImageName] = build\n\t}\n\n\tadded := map[string]bool{}\n\tvar merged []graph.Artifact\n\n\tfor _, artifact := range previous {\n\t\tif updated, found := updatedBuilds[artifact.ImageName]; found {\n\t\t\tmerged = append(merged, updated)\n\t\t} else {\n\t\t\tmerged = append(merged, artifact)\n\t\t}\n\t\tadded[artifact.ImageName] = true\n\t}\n\n\tfor _, artifact := range builds {\n\t\tif !added[artifact.ImageName] {\n\t\t\tmerged = append(merged, artifact)\n\t\t}\n\t}\n\n\treturn merged\n}", "title": "" }, { "docid": "a4a59031100d1f41e383034f90834d1c", "score": "0.4081291", "text": "func (s Sketch) Merge(other Sketch) Sketch {\n\tif len(other) < len(s) {\n\t\ts = s[:len(other)]\n\t}\n\n\tfor i := range s {\n\t\ts[i] = s[i].Add(other[i])\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "776ae854c44ecd22be3752663c116a04", "score": "0.40811718", "text": "func Merge(repo *git.Repository, conflict git.IndexConflict) (*git.MergeFileResult, error) {\n\tvar ancestor, our, their git.MergeFileInput\n\n\tfor entry, input := range map[*git.IndexEntry]*git.MergeFileInput{\n\t\tconflict.Ancestor: &ancestor,\n\t\tconflict.Our: &our,\n\t\tconflict.Their: &their,\n\t} {\n\t\tif entry == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tblob, err := repo.LookupBlob(entry.Id)\n\t\tif err != nil {\n\t\t\treturn nil, helper.ErrFailedPreconditionf(\"could not get conflicting blob: %w\", err)\n\t\t}\n\n\t\tinput.Path = entry.Path\n\t\tinput.Mode = uint(entry.Mode)\n\t\tinput.Contents = blob.Contents()\n\t}\n\n\tmerge, err := git.MergeFile(ancestor, our, their, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not compute conflicts: %w\", err)\n\t}\n\n\t// In a case of tree-based conflicts (e.g. no ancestor), fallback to `Path`\n\t// of `their` side. If that's also blank, fallback to `Path` of `our` side.\n\t// This is to ensure that there's always a `Path` when we try to merge\n\t// conflicts.\n\tif merge.Path == \"\" {\n\t\tif their.Path != \"\" {\n\t\t\tmerge.Path = their.Path\n\t\t} else {\n\t\t\tmerge.Path = our.Path\n\t\t}\n\t}\n\n\treturn merge, nil\n}", "title": "" }, { "docid": "5cace4c7c5a7195522b550f4d12b0e5f", "score": "0.40652192", "text": "func (b *Buffer) Merge(other *Buffer) *Buffer {\n\tif b == nil || len(b.tags) == 0 {\n\t\treturn other\n\t}\n\tif other == nil || len(other.tags) == 0 {\n\t\treturn b\n\t}\n\n\t// Check for a common case where b's tags are a subsequence of the\n\t// other tags. In practice this happens when we start with an annotated\n\t// context and we annotate it again at a lower level (with more specific\n\t// information). Frequent examples seen in practice are when b has a node ID\n\t// tag and other has both a node and a store ID tag; and when b has a node ID\n\t// and store ID tag and other has node, store, and replica tags.\n\tif diff := len(other.tags) - len(b.tags); diff >= 0 {\n\t\ti, j := 0, 0\n\t\tfor i < len(b.tags) && j-i <= diff {\n\t\t\tif b.tags[i].key == other.tags[j].key {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tj++\n\t\t}\n\t\tif i == len(b.tags) {\n\t\t\treturn other\n\t\t}\n\t}\n\n\t// Another common case is when we aren't adding any new tags or values; find\n\t// and ignore the longest prefix of redundant tags.\n\ti := 0\n\tfor ; i < len(other.tags); i++ {\n\t\tidx := b.find(other.tags[i].key)\n\t\tif idx == -1 || b.tags[idx].value != other.tags[i].value {\n\t\t\tbreak\n\t\t}\n\t}\n\tif i == len(other.tags) {\n\t\treturn b\n\t}\n\n\tres := &Buffer{}\n\tres.init(len(b.tags), len(b.tags)+len(other.tags)-i)\n\tcopy(res.tags, b.tags)\n\n\tfor ; i < len(other.tags); i++ {\n\t\tres.addOrReplace(other.tags[i].key, other.tags[i].value)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "b567877e0c395a3e76d4499dcf6030c1", "score": "0.40523404", "text": "func (j JSON) Merge(j2 JSON) (JSON, error) {\n\tbody := j.Map()\n\tfor key, value := range j2.Map() {\n\t\tbody[key] = value\n\t}\n\n\tcleaned := map[string]interface{}{}\n\tfor k, v := range body {\n\t\tcleaned[k] = v.Value()\n\t}\n\n\tb, err := json.Marshal(cleaned)\n\tif err != nil {\n\t\treturn JSON{}, err\n\t}\n\n\tvar rval JSON\n\treturn rval, gjson.Unmarshal(b, &rval)\n}", "title": "" }, { "docid": "0de699ee8fbe0b40a794bb47b6992c72", "score": "0.40510902", "text": "func (c *Config) Merge(other *Config) *Config {\n if other.PluginDir != nil {\n c.PluginDir = other.PluginDir\n }\n\n if other.BindAddress != nil {\n c.BindAddress = other.BindAddress\n }\n\n if other.UiEnabled != nil {\n c.UiEnabled = other.UiEnabled\n }\n\n if other.LegacyApiEnabled != nil {\n c.LegacyApiEnabled = other.LegacyApiEnabled\n }\n\n if c.Storage == nil {\n c.Storage = other.Storage\n } else if other.Storage != nil {\n c.Storage.Merge(other.Storage)\n }\n\n if c.Ttl == nil {\n c.Ttl = other.Ttl\n } else if other.Ttl != nil {\n c.Ttl.Merge(other.Ttl)\n }\n\n return c\n}", "title": "" }, { "docid": "cf7c135be5216ac8b690773e3d40bea5", "score": "0.4050513", "text": "func (sub Substitute) Merge(dest ...Substitute) (Substitute, error) {\n\tintermediate := []Substitute{sub}\n\tresult := Substitute{}\n\tfor _, hash := range append(intermediate, dest...) {\n\t\tif err := mergo.Merge(&result, hash, mergo.WithAppendSlice, mergo.WithOverride); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "96c0530223e6f9b58c07f5b8373d7eb8", "score": "0.40445644", "text": "func (ui *CLI) Merge(m, n map[string]interface{}) (map[string]interface{}, error) {\n\tif len(ui.merger) > 0 {\n\t\treturn mergeAsJSON(m, n, ui.merger)\n\t}\n\n\treturn mergeMaps(m, n)\n}", "title": "" }, { "docid": "7b2f77a85ab0752c062a90f6272e28f0", "score": "0.40426692", "text": "func (h *FibbonaciHeap) Merge(ctx context.Context, other *FibbonaciHeap) (rerr error) {\n\tif h == nil || other == nil {\n\t\treturn errors.New(\"merge: one of the maps was nil\")\n\t}\n\n\th.mtx.Lock()\n\tdefer h.mtx.Unlock()\n\tdefer h.flushEntryCache(ctx, &rerr)\n\n\tother.mtx.Lock()\n\tdefer other.mtx.Unlock()\n\tdefer func() {\n\t\tother.entryCache = nil\n\t}()\n\n\tresultSize := h.root.Size\n\n\t// unfortunately, have to remove any keys in other that exist in h.\n\t// this is to avoid collisions\n\totherKeys, err := other.keyDb.List(ctx, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// remove any keys that would collide\n\tfor _, key := range otherKeys {\n\t\tid := string(key[1:])\n\t\totherEntry, err := other.getEntry(ctx, id, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif otherEntry == nil {\n\t\t\treturn errors.Errorf(\"cannot find entry: %s\", id)\n\t\t}\n\n\t\t_, hvOk, err := h.keyDb.Get(ctx, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif hvOk {\n\t\t\tif err := other.dequeueKeyByID(ctx, id, otherEntry); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\th.entryCache[id] = otherEntry\n\t\t\tresultSize++\n\t\t}\n\t}\n\n\theapMin, err := h.getEntry(ctx, h.root.Min, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\totherMin, err := h.getEntry(ctx, other.root.Min, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresultMinKey, resultMinEntry, err := h.mergeLists(\n\t\tctx,\n\t\theapMin, otherMin,\n\t\th.root.Min, other.root.Min,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.root.Min = resultMinKey\n\th.root.Size = resultSize\n\th.root.MinPriority = resultMinEntry.GetPriority()\n\treturn h.writeState(ctx)\n}", "title": "" }, { "docid": "0a361d5d6712eb53d7db4b4b348dab92", "score": "0.40387517", "text": "func (a *count) Merge(o sif.Accumulator) error {\n\tca, ok := o.(*count)\n\tif !ok {\n\t\treturn fmt.Errorf(\"incoming accumulator is not a Count Accumulator\")\n\t}\n\ta.count += ca.count\n\treturn nil\n}", "title": "" }, { "docid": "320069dc474e5adfd82d76fa8db8a23c", "score": "0.40384004", "text": "func (batch1 Batch) Merge(batch2 Batch) {\n\tfor k := range batch2 {\n\t\tif _, ok := batch1[k]; !ok {\n\t\t\tbatch1[k] = batch2[k]\n\t\t} else {\n\t\t\tfor i, j := range batch2[k] {\n\t\t\t\tbatch1[k][i] = j\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7bc81dcd0983aaade8bb222369e1f90", "score": "0.40379027", "text": "func (r Range) Merge(other Range) Range {\n\tstart := MinUnixNano(r.Start, other.Start)\n\tend := MaxUnixNano(r.End, other.End)\n\treturn Range{Start: start, End: end}\n}", "title": "" }, { "docid": "984f622539f5981a0755ed174721e29b", "score": "0.403184", "text": "func (b *Best) merge(o *Best, spoiler bool) {\n\tif o.Tkt > b.Tkt {\n\t\t*b = *o // strictly better ticket\n\t} else if o.Tkt == b.Tkt && o.From != b.From && spoiler {\n\t\tb.From = -1 // record ticket collision\n\t}\n}", "title": "" }, { "docid": "cb211378e000a570db2a2792b21225a8", "score": "0.40295577", "text": "func (h *Histo) Combine(other []byte) error {\n\totherHistogram := tdigest.NewMerging(100, false)\n\tif err := otherHistogram.GobDecode(other); err != nil {\n\t\treturn err\n\t}\n\th.value.Merge(otherHistogram)\n\treturn nil\n}", "title": "" }, { "docid": "f29740f928e666d6d1537d86ebea032c", "score": "0.4028907", "text": "func (m *merger) Merge(key uint32, metricBlocks [][]byte) error {\n\tblockCount := len(metricBlocks)\n\t// 1. prepare readers and metric level data(field/time slot/series ids)\n\tmergeCtx, err := m.prepare(metricBlocks)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// 2. Prepare metric\n\tm.dataFlusher.PrepareMetric(key, mergeCtx.targetFields)\n\t// 3. merge series data by roaring container\n\thighKeys := mergeCtx.seriesIDs.GetHighKeys()\n\tdecodeStreams := make([]*encoding.TSDDecoder, blockCount) // make decodeStreams for reuse\n\tdefer func() {\n\t\tfor _, stream := range decodeStreams {\n\t\t\tencoding.ReleaseTSDDecoder(stream)\n\t\t}\n\t}()\n\tfieldReaders := make([]FieldReader, blockCount)\n\tfor idx, highKey := range highKeys {\n\t\tcontainer := mergeCtx.seriesIDs.GetContainerAtIndex(idx)\n\t\tit := container.PeekableIterator()\n\t\tfor it.HasNext() {\n\t\t\tlowSeriesID := it.Next()\n\t\t\t// maybe series id not exist in some values block\n\t\t\tfor blockIdx, scanner := range mergeCtx.scanners {\n\t\t\t\tseriesEntry := scanner.scan(highKey, lowSeriesID)\n\t\t\t\tif len(seriesEntry) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttimeRange := scanner.slotRange()\n\t\t\t\tif fieldReaders[blockIdx] == nil {\n\t\t\t\t\tfieldReaders[blockIdx] = newFieldReader(scanner.fieldIndexes(), seriesEntry, timeRange)\n\t\t\t\t} else {\n\t\t\t\t\tfieldReaders[blockIdx].Reset(seriesEntry, timeRange)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := m.seriesMerger.merge(mergeCtx, decodeStreams, fieldReaders); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// flush series id\n\t\t\tif err := m.dataFlusher.FlushSeries(encoding.ValueWithHighLowBits(uint32(highKey)<<16, lowSeriesID)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// flush metric data\n\tif err := m.dataFlusher.CommitMetric(mergeCtx.targetRange); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b2e40ed98a3c3e1da97ec2e5633d387", "score": "0.4024487", "text": "func Test_merge_with_meter2(t *testing.T) {\n\n\tm1 := Meter{Tokens: 2, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tm2 := Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tmm := Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tm2 = Meter{Tokens: 2, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tmm = Meter{Tokens: 3, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 0, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tm2 = Meter{Tokens: 0, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tmm = Meter{Tokens: 0, PerTimeUnit: \"min\", NotificationIntervalS: 40}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{}\n\tm2 = Meter{}\n\tmm = Meter{}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{}\n\tm2 = Meter{Tokens: 1, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tmm = Meter{Tokens: 1, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 1, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tm2 = Meter{}\n\tmm = Meter{Tokens: 1, PerTimeUnit: \"min\", NotificationIntervalS: 60}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 1, PerTimeUnit: \"min\", NotificationIntervalS: 80}\n\tm2 = Meter{Tokens: 1, PerTimeUnit: \"hour\", NotificationIntervalS: 60}\n\tmm = Meter{Tokens: 60, PerTimeUnit: \"hour\", NotificationIntervalS: 60}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n\tm1 = Meter{Tokens: 1, PerTimeUnit: \"day\", NotificationIntervalS: 40}\n\tm2 = Meter{Tokens: 1, PerTimeUnit: \"hour\", NotificationIntervalS: 60}\n\tmm = Meter{Tokens: 24, PerTimeUnit: \"day\", NotificationIntervalS: 40}\n\tif am := m1.ProducerMergeWith(&m2, 30); !am.IsSame(mm) {\n\t\tt.Errorf(\"Meter %v was not merged correclty, expecting %v\\n\", am, mm)\n\t}\n\n}", "title": "" }, { "docid": "fe73c236a7fe49ac0327e733f8eea833", "score": "0.40188432", "text": "func (h *Headers) Merge(h2 Headers) {\n\tif h.vals == nil {\n\t\th.vals = map[string]string{}\n\t}\n\tif h2.vals == nil {\n\t\treturn\n\t}\n\tfor k, v := range h2.vals {\n\t\th.vals[k] = v\n\t}\n}", "title": "" }, { "docid": "cd7c889361e9c0c569375ee7303c5301", "score": "0.40151918", "text": "func (ps *PrometheusStats) Merge(s nodePrometheusStats) {\n\tif _, ok := ps.TargetNodesStats[s.hostID]; !ok {\n\t\tps.TargetNodesStats[s.hostID] = make(NodePrometheusStats)\n\t}\n\tps.TargetNodesStats[s.hostID].Merge(s.stats)\n\tfor mfID, mfDesc := range s.descriptions {\n\t\tps.MetricFamilyDescriptions[mfID] = mfDesc\n\t}\n}", "title": "" } ]
446fdef0125ab505355f1bd044ac6ab1
Key function returns key value.
[ { "docid": "273d16e2d1c6ab04e1da1d8b9a03a165", "score": "0.0", "text": "func (e PermissionValidationError) Key() bool { return e.key }", "title": "" } ]
[ { "docid": "98236cda6dd2e1db8c33573681fbe6da", "score": "0.7514719", "text": "func Key() interface{} { return key }", "title": "" }, { "docid": "e3db027ed70ba77b487843d13e2105aa", "score": "0.7222389", "text": "func (k *KeyValue) Key() string {\n return k.key\n}", "title": "" }, { "docid": "b878aa33d6c66645394310330f46aed0", "score": "0.67721766", "text": "func (k merableHeapNode) Key()(int){\r\n\treturn k.key\r\n}", "title": "" }, { "docid": "738c91e532bfb6060d3c8b32093f3e22", "score": "0.67663246", "text": "func (m *KeyUint) Key() driver.Value {\n\treturn driver.Value(m.ID)\n}", "title": "" }, { "docid": "42f6d43cad223062ac4b9abc3b368f0f", "score": "0.6761475", "text": "func (p *Pair) Key() string { return p.key }", "title": "" }, { "docid": "1c537c372eac2c69fc02e5bd5b928b64", "score": "0.67606086", "text": "func (pim PreimageMap) GetKey(loc tmproofs.Where) []byte {\n\tif loc == tmproofs.Left {\n\t\treturn pim.KeyFor(0)\n\t}\n\tif loc == tmproofs.Right {\n\t\treturn pim.KeyFor(len(pim.paths) - 1)\n\t}\n\t// select a random index between 1 and len-2\n\tidx := rand.Int()%(len(pim.paths)-2) + 1\n\treturn pim.KeyFor(idx)\n}", "title": "" }, { "docid": "f28bf8303a6a8d0ef6b2aee87cf2bb73", "score": "0.67021304", "text": "func (ev *Event) getKey() string {\n\treturn fmt.Sprintf(\"%+v\", ev.data)\n}", "title": "" }, { "docid": "652d9d2ea452860eeb54b66b59431d32", "score": "0.6695207", "text": "func (fe *FuncEntry) Key() string {\n\treturn fe.id\n}", "title": "" }, { "docid": "8e9c206b8f9940f5c9c6a9b6bddce48f", "score": "0.66785663", "text": "func (f KeyGeneratorFunc) GetKey(source interface{}, parameters imageserver.Parameters) string {\n\treturn f(source, parameters)\n}", "title": "" }, { "docid": "2eb09c70ee8550cbc423529e029fae7d", "score": "0.66686726", "text": "func (f KeyGeneratorFunc) GetKey(source interface{}, params imageserver.Params) string {\n\treturn f(source, params)\n}", "title": "" }, { "docid": "d87e5d4c6bf7fc4065288fd65c7e7cc0", "score": "0.6635686", "text": "func (v *VM) getKey() (uint16, error) {\n\tx := (v.opc & 0x0F00) >> 8\n\tfor i := range v.keys {\n\t\tif v.keys[i] == 1 {\n\t\t\tv.v[x] = v.keys[i]\n\t\t\tv.pc += 2\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn v.opc & 0xFFFF, nil\n}", "title": "" }, { "docid": "780f42fd24166db0c42fe9a77c94f6b1", "score": "0.66306764", "text": "func (i Int) Key() int {\n\treturn int(i)\n}", "title": "" }, { "docid": "cc8e4f3df6554d80837eed191c51c361", "score": "0.6620437", "text": "func GetKey(key string)string{\n\treturn \"\"\n}", "title": "" }, { "docid": "8d079d0d40f8b6b77c45dbc8530f8909", "score": "0.6618212", "text": "func (elem *Element[K, V]) Key() K {\n\treturn elem.key\n}", "title": "" }, { "docid": "08b279c409cdde15e14ddecd3d6ee2f7", "score": "0.6612664", "text": "func (n *Node) GetKey() int {\n\treturn n.key\n}", "title": "" }, { "docid": "5c91ad6ea4a119047a7d90302f864960", "score": "0.65702516", "text": "func (c Config) Key(key string) string {\n\treturn c[key]\n}", "title": "" }, { "docid": "09f3d3e21c0e1f35ae6654f0b985d10c", "score": "0.656557", "text": "func (m SyncMap) GetKey(value interface{}) string {\n\tvar key = \"\"\n\n\t// 遍历所有sync.Map中的键值对\n\tClientMap.Range(func(k, v interface{}) bool {\n\t\tif v == value {\n\t\t\tkey = k.(string)\n\n\t\t\t// 跳出循环\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t})\n\n\treturn key\n}", "title": "" }, { "docid": "c9c6465c3b10d6cb12b586a1f83db15e", "score": "0.6536541", "text": "func (mo *DistributedVirtualPortgroup) Key() (string, error) {\n\tp, err := mo.currentProperty(\"key\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif p != nil {\n\t\treturn p.(string), nil\n\t}\n\treturn \"\", nil\n\n}", "title": "" }, { "docid": "a21576b04e4d2c1ad96d9b479e226b5a", "score": "0.6530686", "text": "func (i *SimpleItem) Key() []byte { return []byte(i.K) }", "title": "" }, { "docid": "11bec9090c920ff853c2c20b6c56a919", "score": "0.64766926", "text": "func (this AggregateFunctionCall) Key() string {\n\treturn fmt.Sprintf(\"%s-%t-%v\", this.FunctionCall.Name, this.FunctionCall.Operands[0].Star, this.FunctionCall.Operands[0].Expr)\n}", "title": "" }, { "docid": "734ab5a9034c86e724d661b86eb5aa45", "score": "0.6465828", "text": "func GetKey(name string) art.Key {\n\treturn art.Key(name)\n}", "title": "" }, { "docid": "39f29bca85d7e27d6d13161b55053702", "score": "0.6460245", "text": "func (keyListerGetter) GetByKey(key string) (interface{}, bool, error) {\n\treturn \"\", true, nil\n}", "title": "" }, { "docid": "72a7ed1481452bfc7e5eb60b4f753c9a", "score": "0.6429677", "text": "func (h *handler) getKey(openshiftVersion string) (string, error) {\n\tv, err := version.NewVersion(openshiftVersion)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"%d.%d\", v.Segments()[0], v.Segments()[1]), nil\n}", "title": "" }, { "docid": "337696aaabc63ba5f3dcddcfee9b20f8", "score": "0.6426024", "text": "func Key(node string) string {\n\treturn KeyPrefix() + node\n}", "title": "" }, { "docid": "337696aaabc63ba5f3dcddcfee9b20f8", "score": "0.6426024", "text": "func Key(node string) string {\n\treturn KeyPrefix() + node\n}", "title": "" }, { "docid": "67bef58f6e77ca86bd9629dc74cdd3cc", "score": "0.6423325", "text": "func (m *Map) Key() Type { return m.key }", "title": "" }, { "docid": "80fbda72351670967c0475ad93d3660f", "score": "0.641972", "text": "func (id Key) Key() Key {\n\treturn id\n}", "title": "" }, { "docid": "f95378492161e529c928e3bb7f712185", "score": "0.6418151", "text": "func (kt *KeyTuple) Key() string {\n\treturn kt.key[kt.kIndex : kt.cIndex-1]\n}", "title": "" }, { "docid": "735bfdce8928aaa7b249c7c1ca502128", "score": "0.64139235", "text": "func (v *OptionalCompareAndSwap) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8d2dad10875005e1e40a2985486e89c8", "score": "0.6408804", "text": "func (node Map) Key(key string) Node {\n\treturn node[key]\n}", "title": "" }, { "docid": "5429670b6b7b493f0145418be8c0465a", "score": "0.6402098", "text": "func (v EnvVariable) Key() string {\n\treturn (string)(v)\n}", "title": "" }, { "docid": "c1f093a68762675fa805bfbc8e97b6eb", "score": "0.63977295", "text": "func (m *Manager) Key() Key {\n\tnow := time.Now().Add(time.Second)\n\tkeys := m.getKeys(now)\n\treturn keys[0]\n}", "title": "" }, { "docid": "0c43dc905443dad4692a796b87a2699c", "score": "0.63862216", "text": "func (vc *Config) Key() string {\n\treturn vc.Keys[0]\n}", "title": "" }, { "docid": "33ca4feff46bc094c88debfbfe439819", "score": "0.6381969", "text": "func (v *CompareAndSwap) GetKey() (o string) {\n\tif v != nil {\n\t\to = v.Key\n\t}\n\treturn\n}", "title": "" }, { "docid": "643a1177157296426cd242d6c7402bc0", "score": "0.63738275", "text": "func Key(c *gin.Context) *model.Key {\n\tv, ok := c.Get(KeyContextKey)\n\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tr, ok := v.(*model.Key)\n\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "0449ac7af52580425470298b16840aff", "score": "0.6357763", "text": "func (p IntSlice) Key(i int) Key { return Int64Key(int64(p[i])) }", "title": "" }, { "docid": "b33d0321d714ed88e3ba3de5d85e7042", "score": "0.63566375", "text": "func (slide *Slide) GetKey() string {\n\treturn \"id\"\n}", "title": "" }, { "docid": "d96b07b0837627e7a3df514012fdd024", "score": "0.6343287", "text": "func (H *Heapnode) GetKey() float64 {\r\n\treturn H.key\r\n}", "title": "" }, { "docid": "901518c499a9ff43b2f2ffe506ae5ac8", "score": "0.63425976", "text": "func (c *Counter) Key() string { return string(c.key) }", "title": "" }, { "docid": "c61697852cdd8ddb8b40c48f18c5fb9b", "score": "0.6327199", "text": "func (graph *Graph) getKey(node *Node) (key string) {\n for key ,val := range graph.Nodes{\n if(val == node){\n return key\n }\n }\n \n return \"ERROR\"\n}", "title": "" }, { "docid": "995f282037047679b5a901a4c2e732f3", "score": "0.63210124", "text": "func (p UintSlice) Key(i int) Key { return Key(p[i]) }", "title": "" }, { "docid": "b1e282c0881e29c4665661d07f085f47", "score": "0.6304506", "text": "func (i *Iterator) Key() []byte {\n\tif i.current == nil {\n\t\treturn nil\n\t}\n\treturn i.current.Key\n}", "title": "" }, { "docid": "ad6205bbc8e1cae70eef40e77b3ad71e", "score": "0.62845755", "text": "func (this *SortedSet) GetByKey(key string) *SortedSetNode {\n\treturn this.dict[key]\n}", "title": "" }, { "docid": "11fcb3fcaaa4087c6d1d399fc2db19db", "score": "0.62782395", "text": "func (p Int32Slice) Key(i int) Key { return Int64Key(int64(p[i])) }", "title": "" }, { "docid": "d852a4d7a4fb6fc70359947355f7d94b", "score": "0.62781006", "text": "func (b *Bigram) GetKey() string {\n\treturn fmt.Sprintf(\"%s#%s\", b.First, b.Second)\n}", "title": "" }, { "docid": "bda250acf085f19cfb553ad0bb20481b", "score": "0.6276523", "text": "func (n *Node) Key() string {\n\treturn n.Hostname\n}", "title": "" }, { "docid": "7c69a1ce186c1a3cb6b4003eaa861982", "score": "0.627248", "text": "func (v *ReadOnlyStore_Integer_Args) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e2784ad8db43b7d4201f4b519a22c2dc", "score": "0.62692535", "text": "func (k *Keys) GetKey(pepperID string) string {\n\tif k.useID == noneID {\n\t\treturn \"\"\n\t}\n\treturn k.ks[pepperID]\n}", "title": "" }, { "docid": "8d8fd432b55d1510b3a6835b9ddb7931", "score": "0.6269121", "text": "func (i RedisSetCondition) Key() string {\n\tif val, ok := _RedisSetConditionValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "7bc24283051468a8a970277baabca7d3", "score": "0.6266988", "text": "func (h *HashRing) eltKey(elt string, idx int) string {\n\t// return elt + \"|\" + strconv.Itoa(idx)\n\treturn strconv.Itoa(idx) + elt\n}", "title": "" }, { "docid": "055a83d9e37fa4bb1a19b9ea36f69834", "score": "0.62500525", "text": "func (o *ModelsResourcesFullJsonValuesCustom1) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "7030e4615f79b3cda6b41db8d3419b44", "score": "0.6248925", "text": "func (q queryParam) Key() string {\n\tif len(q.keyMatch) <= 2 {\n\t\treturn \"\"\n\t}\n\treturn q.keyMatch[1 : len(q.keyMatch)-1]\n}", "title": "" }, { "docid": "3e4a06222c8cc148220864c99ed6b742", "score": "0.62417823", "text": "func getKey(id string) (k string){\n\tt := time.Now().Format(\"20060102150405\")\n\tk = id + \"_\" + t\n\treturn\n}", "title": "" }, { "docid": "05df1cc05f5f4f4810dc6271d41f5e9b", "score": "0.62374437", "text": "func (p Uint64Slice) Key(i int) Key { return Key(p[i]) }", "title": "" }, { "docid": "6fa70699cea7d2972774cae05a09e0b1", "score": "0.6235028", "text": "func (it *iterator) Key() []byte {\n\tif len(it.data) == 0 {\n\t\treturn nil\n\t}\n\treturn it.data[0].Key\n}", "title": "" }, { "docid": "a8d13b0d0242b5679340242f5ea58aba", "score": "0.6228055", "text": "func (iterator Iterator) Key() K {\n\treturn iterator.Iterator.Key().(K)\n}", "title": "" }, { "docid": "d88fb5e680f4ddda89525650ec1540df", "score": "0.6213044", "text": "func (p Int64Slice) Key(i int) Key { return Int64Key(p[i]) }", "title": "" }, { "docid": "4ec8fdc0f963fa50821156cec454a333", "score": "0.62116736", "text": "func (np NodePort) GetKey() string {\n\treturn np.key\n}", "title": "" }, { "docid": "4a8b245d97d449159c63d3dd85c7b462", "score": "0.6207488", "text": "func (p Option) Key() string { return p.k }", "title": "" }, { "docid": "a9ab3899a664244c6699d51e27701c9f", "score": "0.6204866", "text": "func (o GetRegionInstanceTemplateSchedulingNodeAffinityOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetRegionInstanceTemplateSchedulingNodeAffinity) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aba2fac8d2ee52f8f6cb66ed7ab8c535", "score": "0.61882013", "text": "func (i *Iterator) Key() []byte {\n\tif i.curr == nil {\n\t\treturn nil\n\t}\n\n\tif i.store.sub == nil {\n\t\treturn i.curr.Key\n\t}\n\n\treturn i.store.unformatKey(i.curr.Key)\n}", "title": "" }, { "docid": "dffb6b6a8fadd935bafa31692b50b50f", "score": "0.6185089", "text": "func (p Uint32Slice) Key(i int) Key { return Key(p[i]) }", "title": "" }, { "docid": "b6b7ac8f2e971d310ca45683e7601447", "score": "0.6184761", "text": "func (r Result) GetKey() string {\n\treturn r.n.key\n}", "title": "" }, { "docid": "713c8eb59abb3bbd2960e16fab326934", "score": "0.6183403", "text": "func (self *LevelIterator) Key() (string) {\n\treturn string(self.iterator.Key())\n}", "title": "" }, { "docid": "8f27ee6c4979493d7a7084f3259b9d96", "score": "0.61681366", "text": "func (c *simpleCache) keyFunc(s []byte) string {\n\th := c.hashPool.Get().(hash.Hash)\n\th.Reset()\n\n\tif _, err := h.Write(s); err != nil {\n\t\tpanic(err) // Write() on hash never fails\n\t}\n\tkey := toString(h.Sum(nil)) // skip base64 encoding to save an allocation\n\tc.hashPool.Put(h)\n\n\treturn key\n}", "title": "" }, { "docid": "f9a0e59529b2451b5affa1e380d23a85", "score": "0.6167664", "text": "func key(k tcell.Key) rune {\n\treturn rune(-k)\n}", "title": "" }, { "docid": "7ef882c63b48114762505fd956c5d8e1", "score": "0.6165373", "text": "func (tm *TokenManager) keyFunc(token *jwt.Token) (key interface{}, err error) {\n\t// Per JWT security notice: do not forget to validate alg is expected\n\tif _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected signing method: %v\", token.Header[\"alg\"])\n\t}\n\n\tkid, ok := token.Header[\"kid\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"token does not have kid in header\")\n\t}\n\n\tvar keyID ksuid.KSUID\n\tif keyID, err = ksuid.Parse(kid.(string)); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse kid: %s\", err)\n\t}\n\n\tif key, ok = tm.verificationKeys[keyID]; !ok {\n\t\treturn nil, errors.New(\"unknown signing key\")\n\t}\n\treturn key, nil\n}", "title": "" }, { "docid": "15961561753ab0c9b2766760513bd21a", "score": "0.6164659", "text": "func (s *SliceIterator) Key() (key []byte) {\n\ts.assertValid()\n\treturn s.data[s.idx].Key\n}", "title": "" }, { "docid": "45259ce4150b52144161c0c6407f0fec", "score": "0.61590767", "text": "func (v *KeyDoesNotExist) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "92ec3afecd51f8d45ae6abbdb4398039", "score": "0.61500764", "text": "func (o GetInstanceTemplateSchedulingNodeAffinityOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstanceTemplateSchedulingNodeAffinity) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8a5678dc98ae8a4bae471d9c2ae6619d", "score": "0.6145156", "text": "func (o *StateEntryDTO) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "f81b38865f4c5b562a6368fcb2b394d5", "score": "0.6144154", "text": "func (node *Node) getKey(key string) ([]byte, error) {\n\tnode.dsMtx.RLock()\n\tval, ok := node.datastore[key]\n\tnode.dsMtx.RUnlock()\n\tif !ok {\n\t\treturn nil, errors.New(\"key does not exist\")\n\t}\n\n\tnode.tsMtx.RLock()\n\t_, ok1 := node.tempstore[key]\n\tnode.tsMtx.RUnlock()\n\tif ok1 {\n\t\treturn nil, nil\n\t}\n\n\treturn val, nil\n}", "title": "" }, { "docid": "c26be8cc2c053b5d1a939abd4721e3fa", "score": "0.61435676", "text": "func (this *AllOne) GetMinKey() string {\n \n}", "title": "" }, { "docid": "b3c0b44bba72d08edcfa493e07eecf82", "score": "0.61404186", "text": "func (c *StateEntry) GetKey() string {\n\treturn c.key\n}", "title": "" }, { "docid": "14a2a28cd80913e9d566d6e5b5db3f79", "score": "0.614021", "text": "func (e EnumInt32) Key() EnumInt32Key {\n return EnumInt32Key(e)\n}", "title": "" }, { "docid": "534b765e192de23548ebb205619cdcf4", "score": "0.61374134", "text": "func (t *Traceroute) Key() string {\n\treturn fmt.Sprintf(\"%s_%d_%d\", \"XXTR\", t.Src, t.Dst)\n}", "title": "" }, { "docid": "96a1da289c14a551cf7e0ff5d1149b69", "score": "0.61365", "text": "func (h *StubHashRing) eltKey(elt string, idx int) string {\n\t// return elt + \"|\" + strconv.Itoa(idx)\n\treturn strconv.Itoa(idx) + elt\n}", "title": "" }, { "docid": "5df65b903a62d32dd854f5b660dadca6", "score": "0.6135667", "text": "func (o GetRegionInstanceTemplateReservationAffinitySpecificReservationOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetRegionInstanceTemplateReservationAffinitySpecificReservation) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0ecfff02cff5a0ca6fb1f8a868ee9232", "score": "0.6128646", "text": "func (status Status) Key() string {\n\treturn Config.GetKeyPrefix() + string(status)\n}", "title": "" }, { "docid": "24c636f4400c40c24af40bc697915849", "score": "0.6128213", "text": "func (e BooleanDataEntry) GetKey() string {\n\treturn e.Key\n}", "title": "" }, { "docid": "36171fe58ac8515414b8a522b7adf1df", "score": "0.61171025", "text": "func (gi *GlobalIdentity) GetKey() string {\n\tvar str strings.Builder\n\tfor _, l := range gi.LabelArray {\n\t\tstr.Write(l.FormatForKVStore())\n\t}\n\treturn str.String()\n}", "title": "" }, { "docid": "c145b15303bc982dae5772d7938b8a10", "score": "0.6115305", "text": "func (brd Board) Key() string {\n\ttmp := make([]string, len(brd))\n\tfor i, val := range brd {\n\t\ttmp[i] = strconv.Itoa(val)\n\t}\n\treturn strings.Join(tmp, \"\")\n}", "title": "" }, { "docid": "323361b8ea58223c0b3c7f7f39cfd4a5", "score": "0.61093724", "text": "func (o GetInstanceTemplateReservationAffinitySpecificReservationOutput) Key() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstanceTemplateReservationAffinitySpecificReservation) string { return v.Key }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "69cb027fbd8b8bacf5686743ee54bdad", "score": "0.6108575", "text": "func (o InstanceReservationAffinityOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceReservationAffinity) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b997011ec4c061a02b285cf4d1f5db0e", "score": "0.6099392", "text": "func (status VaultStatus) Key() string {\n\treturn status.Name\n}", "title": "" }, { "docid": "e15eaa2bca366ca6558c5cb0dc001988", "score": "0.60987645", "text": "func (s *ObjectStore) GetKey(query interface{}) (_ js.Value, e error) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\te, _ = err.(error)\n\t\t}\n\t}()\n\tquery = MaybeConvertValueToJs(query)\n\treturn WaitRequest(s.val.Call(\"getKey\", query))\n}", "title": "" }, { "docid": "dfb406f17918f1e12634b41d835f1021", "score": "0.60943305", "text": "func (i *ReverseHashIterator) Key() []byte {\n\treturn i.field\n}", "title": "" }, { "docid": "cc51535036e8d48f97fc59bb6a4bc178", "score": "0.6094313", "text": "func (a *NodeAttribute) Key() string {\n\treturn (*netmap.Attribute)(a).\n\t\tGetKey()\n}", "title": "" }, { "docid": "e51c79381efec789c06e807db3c8bc7a", "score": "0.6089689", "text": "func (sie *IntIndexElement) Key() interface{} {\n\treturn sie.key\n}", "title": "" }, { "docid": "7e81f6b8b3fc9672ecbd58aec4174bc9", "score": "0.6089028", "text": "func (e Total) Key() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "0254f73002562f347a161d4a0abca952", "score": "0.60887444", "text": "func (tm *TracerouteMeasurement) Key() string {\n\treturn fmt.Sprintf(\"%s_%d_%d\", \"XXTR\", tm.Src, tm.Dst)\n}", "title": "" }, { "docid": "870feb73f0dd6aa942e8a924db9871f5", "score": "0.6081206", "text": "func (o LinkedServiceAzureFunctionOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinkedServiceAzureFunction) pulumi.StringPtrOutput { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "887d0f4d5c1c5870fa0565b729ea033f", "score": "0.60769683", "text": "func (i SQSSetQueueAttribute) Key() string {\n\tif val, ok := _SQSSetQueueAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "27418fc2513b5fd420299dcab94a60be", "score": "0.60750526", "text": "func (c *Cursor) keyValue() ([]byte, []byte, uint32) {\n\tref := &c.stack[len(c.stack)-1]\n\n\t// If the cursor is pointing to the end of page/node then return nil.\n\tif ref.count() == 0 || ref.index >= ref.count() {\n\t\treturn nil, nil, 0\n\t}\n\n\t// Retrieve value from node.\n\tif ref.node != nil {\n\t\tinode := &ref.node.inodes[ref.index]\n\t\treturn inode.key, inode.value, inode.flags\n\t}\n\n\t// Or retrieve value from page.\n\telem := ref.page.leafPageElement(uint16(ref.index))\n\treturn elem.key(), elem.value(), elem.flags\n}", "title": "" }, { "docid": "05a5370f87e19ad99e38eb6dac5c9e96", "score": "0.60731643", "text": "func (f *File) Key() string {\n\text := filepath.Ext(f.path)\n\treturn strings.TrimSuffix(f.path, ext)\n}", "title": "" }, { "docid": "9b4565102ac3dabd6de0a580863f6a28", "score": "0.60718596", "text": "func (c *Cursor) keyValue() ([]byte, []byte, uint32) {\n\tref := &c.stack[len(c.stack)-1]\n\tif ref.count() == 0 || ref.index >= ref.count() {\n\t\treturn nil, nil, 0\n\t}\n\n\t// Retrieve value from node.\n\tif ref.node != nil {\n\t\tinode := &ref.node.inodes[ref.index]\n\t\treturn inode.key, inode.value, inode.flags\n\t}\n\n\t// Or retrieve value from page.\n\telem := ref.page.leafPageElement(uint16(ref.index))\n\treturn elem.key(), elem.value(), elem.flags\n}", "title": "" }, { "docid": "8473e77b9893f6e24b6c1dff8de8f213", "score": "0.60684776", "text": "func (p *pather) Key() string {\n\treturn p.key\n}", "title": "" }, { "docid": "b2844d206538db91567244511fdf72e7", "score": "0.60651827", "text": "func (j Job)GetKey() interface{}{\n\treturn j.key\n}", "title": "" }, { "docid": "fe3d68e25840bf4e09b106984e1898b5", "score": "0.6064666", "text": "func getValueByKey(mappingNode *yamlv3.Node, key string) (*yamlv3.Node, error) {\n\tfor i := 0; i < len(mappingNode.Content); i += 2 {\n\t\tk, v := mappingNode.Content[i], mappingNode.Content[i+1]\n\t\tif k.Value == key {\n\t\t\treturn v, nil\n\t\t}\n\t}\n\n\treturn nil, &KeyNotFoundInMapError{\n\t\tMissingKey: key,\n\t\tAvailableKeys: listKeys(mappingNode),\n\t}\n}", "title": "" }, { "docid": "14575b5ca539bf239d3c426026b3d977", "score": "0.606431", "text": "func (f *FeatureFlag) GetKey() string {\n\treturn f.Key\n}", "title": "" }, { "docid": "14575b5ca539bf239d3c426026b3d977", "score": "0.606431", "text": "func (f *FeatureFlag) GetKey() string {\n\treturn f.Key\n}", "title": "" } ]
b61645bd7d20580e2b551c531af5cb36
SetPipelineExecutionSummaries sets the PipelineExecutionSummaries field's value.
[ { "docid": "0d7d9c85fa174012ae8eda4eada99780", "score": "0.76438254", "text": "func (s *ListPipelineExecutionsOutput) SetPipelineExecutionSummaries(v []*PipelineExecutionSummary) *ListPipelineExecutionsOutput {\n\ts.PipelineExecutionSummaries = v\n\treturn s\n}", "title": "" } ]
[ { "docid": "61321ec5d06421775ae36e98df868cef", "score": "0.6236462", "text": "func (s *ListChangeSetsOutput) SetSummaries(v []*ChangeSetSummary) *ListChangeSetsOutput {\n\ts.Summaries = v\n\treturn s\n}", "title": "" }, { "docid": "61ecaf3ea60c89ea75e347e184b0390b", "score": "0.541156", "text": "func (s *ListStacksOutput) SetStackSummaries(v []*StackSummary) *ListStacksOutput {\n\ts.StackSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "1997ee726996fee33b6b2bc774398ea1", "score": "0.5236935", "text": "func (s *GetInsightSummariesOutput) SetInsightSummaries(v []*InsightSummary) *GetInsightSummariesOutput {\n\ts.InsightSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "55d54856f36cf5ec7da7e6d572bb8148", "score": "0.51208556", "text": "func (s *GetPipelineExecutionOutput) SetPipelineExecution(v *PipelineExecution) *GetPipelineExecutionOutput {\n\ts.PipelineExecution = v\n\treturn s\n}", "title": "" }, { "docid": "704c9cf6e0edebc63edbc4a2abf08939", "score": "0.5102619", "text": "func (s *ListStackResourcesOutput) SetStackResourceSummaries(v []*StackResourceSummary) *ListStackResourcesOutput {\n\ts.StackResourceSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "bbf57280d81faaa1a273976eac2c11ac", "score": "0.5016468", "text": "func (s *ListDICOMImportJobsOutput) SetJobSummaries(v []*DICOMImportJobSummary) *ListDICOMImportJobsOutput {\n\ts.JobSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "d4232724fc354468d2ec6a7a642b7396", "score": "0.48012036", "text": "func (s *ListDatastoresOutput) SetDatastoreSummaries(v []*DatastoreSummary) *ListDatastoresOutput {\n\ts.DatastoreSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "037def6daa9368762f33c8bccb6e5432", "score": "0.47016326", "text": "func (s *ListPipelinesOutput) SetPipelines(v []*PipelineSummary) *ListPipelinesOutput {\n\ts.Pipelines = v\n\treturn s\n}", "title": "" }, { "docid": "dd72c257673ba5011e78d29531346c1a", "score": "0.45899045", "text": "func (s *WorkflowExecutionInfos) SetExecutionInfos(v []*WorkflowExecutionInfo) *WorkflowExecutionInfos {\n\ts.ExecutionInfos = v\n\treturn s\n}", "title": "" }, { "docid": "8e1f92ebfcd384c8c9f3973f8bbf18e6", "score": "0.45764497", "text": "func (s *GetTraceSummariesOutput) SetTraceSummaries(v []*TraceSummary) *GetTraceSummariesOutput {\n\ts.TraceSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "7cd51c323e3c7c7a37a47894c7ae157f", "score": "0.45452157", "text": "func (s *ListSkillsOutput) SetSkillSummaries(v []*SkillSummary) *ListSkillsOutput {\n\ts.SkillSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "fd0a19c0d3e1a90fe96567f8670c2b28", "score": "0.4527169", "text": "func (s *StageState) SetLatestExecution(v *StageExecution) *StageState {\n\ts.LatestExecution = v\n\treturn s\n}", "title": "" }, { "docid": "108e0110d1303828f9345feaa7379d71", "score": "0.44683465", "text": "func (s *ListNotebookExecutionsOutput) SetNotebookExecutions(v []*NotebookExecutionSummary) *ListNotebookExecutionsOutput {\n\ts.NotebookExecutions = v\n\treturn s\n}", "title": "" }, { "docid": "e827e0fe0ae12b87bdd6bd9ed7e48150", "score": "0.443102", "text": "func (s *SearchImageSetsOutput) SetImageSetsMetadataSummaries(v []*ImageSetsMetadataSummary) *SearchImageSetsOutput {\n\ts.ImageSetsMetadataSummaries = v\n\treturn s\n}", "title": "" }, { "docid": "ddb9244f93cb2e8bfffc5713f2b322e0", "score": "0.43723392", "text": "func (s *CancelFlowExecutionsInput) SetExecutionIds(v []*string) *CancelFlowExecutionsInput {\n\ts.ExecutionIds = v\n\treturn s\n}", "title": "" }, { "docid": "999cb63246d13f6e31b97802ca3c8714", "score": "0.43595338", "text": "func (o *PipelineScheduleExecutionExecutedAllOf) SetPipeline(v Pipeline) {\n\to.Pipeline = &v\n}", "title": "" }, { "docid": "beaafef22d77e0bbcc77d73913d9720a", "score": "0.4356337", "text": "func NewPipelineScheduleExecutionExecutedAllOf() *PipelineScheduleExecutionExecutedAllOf {\n\tthis := PipelineScheduleExecutionExecutedAllOf{}\n\treturn &this\n}", "title": "" }, { "docid": "4af78070a4070d8df8f96ba4db494948", "score": "0.43347496", "text": "func (s *ActionState) SetLatestExecution(v *ActionExecution) *ActionState {\n\ts.LatestExecution = v\n\treturn s\n}", "title": "" }, { "docid": "19e92832e63fd0ce14e0b339202976a4", "score": "0.43309474", "text": "func (o *EventQueryDefinition) SetTagsExecution(v string) {\n\to.TagsExecution = v\n}", "title": "" }, { "docid": "5b3ccaa5b1fb406e6310e80aaf211c27", "score": "0.43087053", "text": "func (s *PutActionRevisionOutput) SetPipelineExecutionId(v string) *PutActionRevisionOutput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "826e46e69c571adfd000af3cd4d32fdf", "score": "0.42921808", "text": "func (s *DescribeFlowExecutionRecordsOutput) SetFlowExecutions(v []*ExecutionRecord) *DescribeFlowExecutionRecordsOutput {\n\ts.FlowExecutions = v\n\treturn s\n}", "title": "" }, { "docid": "b57dd18319026cb3ef49e71f85afa96b", "score": "0.4291728", "text": "func (o *WorkflowWorkflowNotificationAllOf) SetExecutionTime(v float32) {\n\to.ExecutionTime = &v\n}", "title": "" }, { "docid": "3c8daed3b71c6bdf506b27b1f913b22b", "score": "0.42584512", "text": "func (s *PipelineExecutionSummary) SetPipelineExecutionId(v string) *PipelineExecutionSummary {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "2a6bd84ec66f28d014e8f61a0439e5b9", "score": "0.42440882", "text": "func (in *ActionOutageUpdateInput) SetCsSummary(value string) *ActionOutageUpdateInput {\n\tin.CsSummary = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"CsSummary\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "23351a55e8fa509b87a3520d610bf209", "score": "0.4229796", "text": "func (s *RetryStageExecutionOutput) SetPipelineExecutionId(v string) *RetryStageExecutionOutput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "3d0c51d42bd80a5bac3fe4f473605aef", "score": "0.42164174", "text": "func (mock *PipelineExecutionsGetterMock) PipelineExecutionsCalls() []struct {\n\tNamespace string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t}\n\tlockPipelineExecutionsGetterMockPipelineExecutions.RLock()\n\tcalls = mock.calls.PipelineExecutions\n\tlockPipelineExecutionsGetterMockPipelineExecutions.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f81f1ba57174f7f1767d27bf10b3c87b", "score": "0.42090198", "text": "func (s *ActionExecutionDetail) SetPipelineExecutionId(v string) *ActionExecutionDetail {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "a276010f122a6401de8dc7267d1e4ea5", "score": "0.41754794", "text": "func (s *RetryStageExecutionInput) SetPipelineExecutionId(v string) *RetryStageExecutionInput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "55ff65f2115efdbf672411e5f78c340f", "score": "0.41734225", "text": "func (o *CreateDirectDebitParams) SetExecutionDate(v string) {\n\to.ExecutionDate = v\n}", "title": "" }, { "docid": "1367bd5ed186b03babad2f96c3be21a9", "score": "0.4171429", "text": "func (m *ProvisioningObjectSummary) SetProvisioningSteps(value []ProvisioningStepable)() {\n m.provisioningSteps = value\n}", "title": "" }, { "docid": "f990c4688a333704f3125e9438c4de8d", "score": "0.4168904", "text": "func (s *PipelineContext) SetPipelineExecutionId(v string) *PipelineContext {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "3c5a3ec23930231a4df4af46a22935aa", "score": "0.41100714", "text": "func (s *StageExecution) SetPipelineExecutionId(v string) *StageExecution {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "40359d11060eac76d74f641f440c98aa", "score": "0.4103704", "text": "func (s *GetPipelineExecutionInput) SetPipelineExecutionId(v string) *GetPipelineExecutionInput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "96b54dc69d883063d4b1f46bcb1ca4a2", "score": "0.40991387", "text": "func (s *ActionExecutionFilter) SetPipelineExecutionId(v string) *ActionExecutionFilter {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "9330adac6fa4bad8486736cb222765aa", "score": "0.4090517", "text": "func (s *PipelineExecution) SetPipelineExecutionId(v string) *PipelineExecution {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "0b991a9ca067201bc39dba1f5324e9d8", "score": "0.40681002", "text": "func (s *StartPipelineExecutionOutput) SetPipelineExecutionId(v string) *StartPipelineExecutionOutput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "71e68482341cd26f31125c44cc66d61c", "score": "0.40229347", "text": "func (sdk *AppFunctionsSDK) SetPipeline(transforms ...func(edgexcontext *appcontext.Context, params ...interface{}) (bool, interface{})) error {\n\tif len(transforms) == 0 {\n\t\treturn errors.New(\"No transforms provided to pipeline\")\n\t}\n\tsdk.transforms = transforms\n\treturn nil\n}", "title": "" }, { "docid": "c655bca9a0425da2e3e993b1dcbf4702", "score": "0.40090793", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) SetDeviceSettingStateSummaries(v []MicrosoftGraphSettingStateDeviceSummary) {\n\to.DeviceSettingStateSummaries = &v\n}", "title": "" }, { "docid": "7488c281e080463828ddcf91cd0b83e3", "score": "0.39944762", "text": "func (s *ActionExecutionResult) SetExternalExecutionSummary(v string) *ActionExecutionResult {\n\ts.ExternalExecutionSummary = &v\n\treturn s\n}", "title": "" }, { "docid": "9dbe1f8c38aafce7eef6c5134966c0bf", "score": "0.39715734", "text": "func (o *MonitorExecutionResults) SetLocationsExecutionResults(v []LocationExecutionResults) {\n\to.LocationsExecutionResults = &v\n}", "title": "" }, { "docid": "211e2aae6dc49cf76ef20b03bf7446f7", "score": "0.3969212", "text": "func (o *PatchV1PostMortemsReportsReportIDParams) SetSummary(summary *string) {\n\to.Summary = summary\n}", "title": "" }, { "docid": "bf2e8b6319048b2b19d2e924c55fdf96", "score": "0.3966154", "text": "func (s *SimulatePolicyResponse) SetEvaluationResults(v []*EvaluationResult) *SimulatePolicyResponse {\n\ts.EvaluationResults = v\n\treturn s\n}", "title": "" }, { "docid": "742c430d6d94b29dfb2f52cb930a8ff8", "score": "0.39639127", "text": "func (o PipelineDescriptionOutput) ExecutionPipelineStage() ExecutionStageSummaryArrayOutput {\n\treturn o.ApplyT(func(v PipelineDescription) []ExecutionStageSummary { return v.ExecutionPipelineStage }).(ExecutionStageSummaryArrayOutput)\n}", "title": "" }, { "docid": "b478be8e59652c504f1c17fd59b780a6", "score": "0.39572433", "text": "func (o *MicrosoftGraphWindowsPhone81GeneralConfiguration) SetDeviceSettingStateSummaries(v []MicrosoftGraphSettingStateDeviceSummary) {\n\to.DeviceSettingStateSummaries = &v\n}", "title": "" }, { "docid": "41dedce2bfba7099a97c611b0dd07bd5", "score": "0.39488325", "text": "func SetNodeRevision_bodyViaBodySummary(iBodySummary string, node_revision__body *NodeRevision_body) (int64, error) {\n\tnode_revision__body.BodySummary = iBodySummary\n\treturn Engine.Insert(node_revision__body)\n}", "title": "" }, { "docid": "6bcca25a382919ab8f3f3ebacddb07b9", "score": "0.39457023", "text": "func (o PipelineDescriptionPtrOutput) ExecutionPipelineStage() ExecutionStageSummaryArrayOutput {\n\treturn o.ApplyT(func(v *PipelineDescription) []ExecutionStageSummary {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ExecutionPipelineStage\n\t}).(ExecutionStageSummaryArrayOutput)\n}", "title": "" }, { "docid": "9cdc9af7fd3017359f9fbfb31b9a8745", "score": "0.39403507", "text": "func (o *PkgContentSetArch) SetSummary(v string) {\n\to.Summary = &v\n}", "title": "" }, { "docid": "25dd727b3b588108a56689e6094da1db", "score": "0.3937401", "text": "func (o PipelineDescriptionResponseOutput) ExecutionPipelineStage() ExecutionStageSummaryResponseArrayOutput {\n\treturn o.ApplyT(func(v PipelineDescriptionResponse) []ExecutionStageSummaryResponse { return v.ExecutionPipelineStage }).(ExecutionStageSummaryResponseArrayOutput)\n}", "title": "" }, { "docid": "e66558b6e93202592994008ee9696cdf", "score": "0.3926027", "text": "func (s *StopPipelineExecutionOutput) SetPipelineExecutionId(v string) *StopPipelineExecutionOutput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "e4ee059241551cb93922690be0fed941", "score": "0.39177456", "text": "func (o PipelineDescriptionResponsePtrOutput) ExecutionPipelineStage() ExecutionStageSummaryResponseArrayOutput {\n\treturn o.ApplyT(func(v *PipelineDescriptionResponse) []ExecutionStageSummaryResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ExecutionPipelineStage\n\t}).(ExecutionStageSummaryResponseArrayOutput)\n}", "title": "" }, { "docid": "a8cec8ea98b70a5ce2a6a761d843cf94", "score": "0.38987982", "text": "func (mr *MockapiMockRecorder) ListPipelineExecutions(input interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListPipelineExecutions\", reflect.TypeOf((*Mockapi)(nil).ListPipelineExecutions), input)\n}", "title": "" }, { "docid": "39cb2d0139595e414e545f4dc1a396d5", "score": "0.389153", "text": "func (s *ActionExecution) SetSummary(v string) *ActionExecution {\n\ts.Summary = &v\n\treturn s\n}", "title": "" }, { "docid": "fd0f45f4e8fa4dc7e4ba29b59aa81c06", "score": "0.38821366", "text": "func (o *MultiAdminVerifyRuleCollectionGetParams) SetExecutionExpiry(executionExpiry *string) {\n\to.ExecutionExpiry = executionExpiry\n}", "title": "" }, { "docid": "9bbb26373aa45a6a4b0078362cbda549", "score": "0.38717014", "text": "func (m *ManagedAppPolicyDeploymentSummary) SetConfigurationDeploymentSummaryPerApp(value []ManagedAppPolicyDeploymentSummaryPerAppable)() {\n err := m.GetBackingStore().Set(\"configurationDeploymentSummaryPerApp\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9ada34336b84707fa3c257971e0375d8", "score": "0.3864716", "text": "func (client *JobTargetExecutionsClient) NewListByJobExecutionPager(resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, options *JobTargetExecutionsClientListByJobExecutionOptions) *runtime.Pager[JobTargetExecutionsClientListByJobExecutionResponse] {\n\treturn runtime.NewPager(runtime.PagingHandler[JobTargetExecutionsClientListByJobExecutionResponse]{\n\t\tMore: func(page JobTargetExecutionsClientListByJobExecutionResponse) bool {\n\t\t\treturn page.NextLink != nil && len(*page.NextLink) > 0\n\t\t},\n\t\tFetcher: func(ctx context.Context, page *JobTargetExecutionsClientListByJobExecutionResponse) (JobTargetExecutionsClientListByJobExecutionResponse, error) {\n\t\t\tvar req *policy.Request\n\t\t\tvar err error\n\t\t\tif page == nil {\n\t\t\t\treq, err = client.listByJobExecutionCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, options)\n\t\t\t} else {\n\t\t\t\treq, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn JobTargetExecutionsClientListByJobExecutionResponse{}, err\n\t\t\t}\n\t\t\tresp, err := client.internal.Pipeline().Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn JobTargetExecutionsClientListByJobExecutionResponse{}, err\n\t\t\t}\n\t\t\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\t\t\treturn JobTargetExecutionsClientListByJobExecutionResponse{}, runtime.NewResponseError(resp)\n\t\t\t}\n\t\t\treturn client.listByJobExecutionHandleResponse(resp)\n\t\t},\n\t})\n}", "title": "" }, { "docid": "1832bee632e53458cb025a37877debae", "score": "0.38565058", "text": "func (m *DeviceCompliancePolicy) SetDeviceSettingStateSummaries(value []SettingStateDeviceSummaryable)() {\n err := m.GetBackingStore().Set(\"deviceSettingStateSummaries\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dbe564ff2c615cdd7b606c52574358db", "score": "0.3844077", "text": "func (o *GetBuildStatusParams) SetPipeline(pipeline *string) {\n\to.Pipeline = pipeline\n}", "title": "" }, { "docid": "1fc3b7e59171b4fb6eef2010f4388681", "score": "0.38335538", "text": "func ExecutePipeline(in In, done In, stages ...Stage) Out {\n\tstream := wrapStage(done, in, func(in In) Out { return in })\n\n\tfor _, v := range stages {\n\t\tstream = wrapStage(done, stream, v)\n\t}\n\n\treturn stream\n}", "title": "" }, { "docid": "cf947d7beea202c04184aaf052fa2f7a", "score": "0.38286608", "text": "func (s *StopPipelineExecutionInput) SetPipelineExecutionId(v string) *StopPipelineExecutionInput {\n\ts.PipelineExecutionId = &v\n\treturn s\n}", "title": "" }, { "docid": "aa04521e9cf2cf10ee98af13a649aa87", "score": "0.38128906", "text": "func (m *Mockapi) ListPipelineExecutions(input *codepipeline.ListPipelineExecutionsInput) (*codepipeline.ListPipelineExecutionsOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPipelineExecutions\", input)\n\tret0, _ := ret[0].(*codepipeline.ListPipelineExecutionsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9ef9740359989c33201b3f0312c9c7cb", "score": "0.37965164", "text": "func NewPipelineScheduleExecutionExecutedAllOfWithDefaults() *PipelineScheduleExecutionExecutedAllOf {\n\tthis := PipelineScheduleExecutionExecutedAllOf{}\n\treturn &this\n}", "title": "" }, { "docid": "240837e823cfea387581b61cec0ecc23", "score": "0.37913513", "text": "func (me *XsdGoPkgHasElem_ExperienceSummarysequenceTxsdResumeUserAreaResumeUserAreaschema_ExperienceSummary_TxsdResumeUserAreaSequenceExperienceSummary_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ExperienceSummarysequenceTxsdResumeUserAreaResumeUserAreaschema_ExperienceSummary_TxsdResumeUserAreaSequenceExperienceSummary_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.ExperienceSummary.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a9ff5ddad539a6f2f8fa4b085873415", "score": "0.3787151", "text": "func (s *ExecutionDetails) SetSummary(v string) *ExecutionDetails {\n\ts.Summary = &v\n\treturn s\n}", "title": "" }, { "docid": "c8e1c89c7b5544a8cae3e19af3d12f09", "score": "0.37841967", "text": "func (c *CodePipeline) ListPipelineExecutionsPagesWithContext(ctx aws.Context, input *ListPipelineExecutionsInput, fn func(*ListPipelineExecutionsOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListPipelineExecutionsInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListPipelineExecutionsRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListPipelineExecutionsOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "8d1d1728d8059739fe5321a99f889afd", "score": "0.3773065", "text": "func (o *HyperflexHealthCheckDefinition) SetScriptExecutionOnComputeNodes(v bool) {\n\to.ScriptExecutionOnComputeNodes = &v\n}", "title": "" }, { "docid": "bafb82ce3ecec6798d179d7b5d9d5cf0", "score": "0.37599668", "text": "func (mr *MockSSMAPIMockRecorder) ListComplianceSummariesPages(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListComplianceSummariesPages\", reflect.TypeOf((*MockSSMAPI)(nil).ListComplianceSummariesPages), arg0, arg1)\n}", "title": "" }, { "docid": "8ddb09fc50786bd53c8cb81ae160ed50", "score": "0.37407896", "text": "func (s *DescribeWorkflowExecutionOutput) SetLatestExecutionContext(v string) *DescribeWorkflowExecutionOutput {\n\ts.LatestExecutionContext = &v\n\treturn s\n}", "title": "" }, { "docid": "f58296ae8c77c7a00bc24e078c220945", "score": "0.37157664", "text": "func (es *ElasticGoClient) SetPipeline(pipeline string) error {\n\treturn ErrNotSupportPipeline\n}", "title": "" }, { "docid": "cac3d512c935eed53ceaf9aefd5e3181", "score": "0.37130553", "text": "func (o *RecommendClusterParams) SetSumCPU(sumCPU *float64) {\n\to.SumCPU = sumCPU\n}", "title": "" }, { "docid": "5d33a04a3d9044850bba794aa62e13f8", "score": "0.37127572", "text": "func (s *InsightEvent) SetSummary(v string) *InsightEvent {\n\ts.Summary = &v\n\treturn s\n}", "title": "" }, { "docid": "3687bae6314ecd7587fadda5ac0bfdf1", "score": "0.37047145", "text": "func (s *PutJobSuccessResultInput) SetExecutionDetails(v *ExecutionDetails) *PutJobSuccessResultInput {\n\ts.ExecutionDetails = v\n\treturn s\n}", "title": "" }, { "docid": "4bfd3ddf9ec4691fd5dae9831ea1f609", "score": "0.3701764", "text": "func (o *ActivityStats) SetRecentRunTotals(v ActivityTotal) {\n\to.RecentRunTotals = &v\n}", "title": "" }, { "docid": "3047654ca8568a468c1172fc011d23e2", "score": "0.3698627", "text": "func (s *ChangeSetSummary) SetExecutionStatus(v string) *ChangeSetSummary {\n\ts.ExecutionStatus = &v\n\treturn s\n}", "title": "" }, { "docid": "bcd875cd36f0acebe7990a1003d4a37b", "score": "0.36983773", "text": "func (o *PipelineScheduleExecutionExecutedAllOf) HasPipeline() bool {\n\tif o != nil && o.Pipeline != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9cc4428c933f1bd684124ff566bd4ccb", "score": "0.3686755", "text": "func (this *ActivityStreamsActorPropertyIterator) SetActivityStreamsCollection(v vocab.ActivityStreamsCollection) {\n\tthis.clear()\n\tthis.activitystreamsCollectionMember = v\n}", "title": "" }, { "docid": "882abff88c382207a4c4fb6015fb2970", "score": "0.3666836", "text": "func (s *DescribeChangeSetOutput) SetExecutionStatus(v string) *DescribeChangeSetOutput {\n\ts.ExecutionStatus = &v\n\treturn s\n}", "title": "" }, { "docid": "c99c4857149a075126703c591ccbbb42", "score": "0.3666332", "text": "func (s *ErrorInfo) SetExecutionMessage(v string) *ErrorInfo {\n\ts.ExecutionMessage = &v\n\treturn s\n}", "title": "" }, { "docid": "231894fb48a1960ad64799375bcb55bd", "score": "0.36569872", "text": "func (this *ActivityStreamsActorProperty) SetActivityStreamsCollection(idx int, v vocab.ActivityStreamsCollection) {\n\t(this.properties)[idx].parent = nil\n\t(this.properties)[idx] = &ActivityStreamsActorPropertyIterator{\n\t\tactivitystreamsCollectionMember: v,\n\t\talias: this.alias,\n\t\tmyIdx: idx,\n\t\tparent: this,\n\t}\n}", "title": "" }, { "docid": "f6f80f108e762a0145d2296749dadcbf", "score": "0.36544803", "text": "func (s *GetInsightEventsOutput) SetInsightEvents(v []*InsightEvent) *GetInsightEventsOutput {\n\ts.InsightEvents = v\n\treturn s\n}", "title": "" }, { "docid": "361d49f223bc4f75e9f63e57b558246c", "score": "0.3654091", "text": "func (s *CountOpenWorkflowExecutionsInput) SetExecutionFilter(v *WorkflowExecutionFilter) *CountOpenWorkflowExecutionsInput {\n\ts.ExecutionFilter = v\n\treturn s\n}", "title": "" }, { "docid": "52d94ad4c8085cad1e36a8fa475ae045", "score": "0.3651145", "text": "func (this *ActivityStreamsActorProperty) SetActivityStreamsOrderedCollection(idx int, v vocab.ActivityStreamsOrderedCollection) {\n\t(this.properties)[idx].parent = nil\n\t(this.properties)[idx] = &ActivityStreamsActorPropertyIterator{\n\t\tactivitystreamsOrderedCollectionMember: v,\n\t\talias: this.alias,\n\t\tmyIdx: idx,\n\t\tparent: this,\n\t}\n}", "title": "" }, { "docid": "09e82feacf9501e7383a16876201854e", "score": "0.36456195", "text": "func (s *StartNotebookExecutionInput) SetExecutionEngine(v *ExecutionEngineConfig) *StartNotebookExecutionInput {\n\ts.ExecutionEngine = v\n\treturn s\n}", "title": "" }, { "docid": "5674927ba23dd8ea60dffff991f60a72", "score": "0.36436763", "text": "func (s *NotebookExecution) SetExecutionEngine(v *ExecutionEngineConfig) *NotebookExecution {\n\ts.ExecutionEngine = v\n\treturn s\n}", "title": "" }, { "docid": "f556f0cc2e7ec353f9cd9a76786015bc", "score": "0.36419982", "text": "func (mr *MockSSMAPIMockRecorder) ListResourceComplianceSummariesPages(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListResourceComplianceSummariesPages\", reflect.TypeOf((*MockSSMAPI)(nil).ListResourceComplianceSummariesPages), arg0, arg1)\n}", "title": "" }, { "docid": "8d4922b910ac03f1d3380fa3ac88e0c1", "score": "0.3641591", "text": "func (s *DescribeWorkflowExecutionInput) SetExecution(v *WorkflowExecution) *DescribeWorkflowExecutionInput {\n\ts.Execution = v\n\treturn s\n}", "title": "" }, { "docid": "72c76a810c1954cbc87238c0155011c1", "score": "0.3638957", "text": "func (m *SecurityBaselineTemplate) SetCategoryDeviceStateSummaries(value []SecurityBaselineCategoryStateSummaryable)() {\n err := m.GetBackingStore().Set(\"categoryDeviceStateSummaries\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "562556f3b17dfd8bfd39861a33bd9431", "score": "0.36380684", "text": "func (s *ApprovalResult) SetSummary(v string) *ApprovalResult {\n\ts.Summary = &v\n\treturn s\n}", "title": "" }, { "docid": "8242d625a9aa819542ff348f97aad02d", "score": "0.36309195", "text": "func (s PipelineExecutionSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5e387546e54b0a149abcdb8284c85dd1", "score": "0.362876", "text": "func (s *GetWorkflowExecutionHistoryInput) SetExecution(v *WorkflowExecution) *GetWorkflowExecutionHistoryInput {\n\ts.Execution = v\n\treturn s\n}", "title": "" }, { "docid": "0e77c87461eb234070f3acdb66854488", "score": "0.3621322", "text": "func (this *ActivityStreamsActorPropertyIterator) SetActivityStreamsOrderedCollection(v vocab.ActivityStreamsOrderedCollection) {\n\tthis.clear()\n\tthis.activitystreamsOrderedCollectionMember = v\n}", "title": "" }, { "docid": "0c8682e38bb751d384ef9e9563cd3c81", "score": "0.36186364", "text": "func (s *PutThirdPartyJobSuccessResultInput) SetExecutionDetails(v *ExecutionDetails) *PutThirdPartyJobSuccessResultInput {\n\ts.ExecutionDetails = v\n\treturn s\n}", "title": "" }, { "docid": "2fc3903e14e58945ad858334c48c8aa3", "score": "0.3602877", "text": "func (s *DescribeJobExecutionOutput) SetExecution(v *JobExecution) *DescribeJobExecutionOutput {\n\ts.Execution = v\n\treturn s\n}", "title": "" }, { "docid": "1e02a138673034d89da9983f33a94412", "score": "0.3596642", "text": "func (s *GetWorkflowExecutionHistoryOutput) SetEvents(v []*HistoryEvent) *GetWorkflowExecutionHistoryOutput {\n\ts.Events = v\n\treturn s\n}", "title": "" }, { "docid": "218d6975ad4863fca74d13d12fe2acee", "score": "0.35870802", "text": "func (o *CreateHostOut) SetFacts(v []FactSet) {\n\to.Facts = &v\n}", "title": "" }, { "docid": "669278914937cdac9f822a4c066192be", "score": "0.3584527", "text": "func (o LookupMonitoringScheduleResultOutput) LastMonitoringExecutionSummary() MonitoringScheduleMonitoringExecutionSummaryPtrOutput {\n\treturn o.ApplyT(func(v LookupMonitoringScheduleResult) *MonitoringScheduleMonitoringExecutionSummary {\n\t\treturn v.LastMonitoringExecutionSummary\n\t}).(MonitoringScheduleMonitoringExecutionSummaryPtrOutput)\n}", "title": "" }, { "docid": "5227812c55112e1f670af94d513dc663", "score": "0.35725054", "text": "func (c *ProjectsHistoriesExecutionsListCall) Pages(ctx context.Context, f func(*ListExecutionsResponse) error) error {\n\tc.ctx_ = ctx\n\tdefer c.PageToken(c.urlParams_.Get(\"pageToken\")) // reset paging to original point\n\tfor {\n\t\tx, err := c.Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif x.NextPageToken == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tc.PageToken(x.NextPageToken)\n\t}\n}", "title": "" }, { "docid": "1eb7d5cde548e54c5892e3941ebaf6e0", "score": "0.3571318", "text": "func (mr *MockCredentialsMetadataSetterMockRecorder) SetExecRoleCredentialsMetadata(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetExecRoleCredentialsMetadata\", reflect.TypeOf((*MockCredentialsMetadataSetter)(nil).SetExecRoleCredentialsMetadata), arg0)\n}", "title": "" }, { "docid": "a013281b13a163bd10e7281944f12443", "score": "0.3569678", "text": "func (s *WorkflowExecutionInfo) SetExecution(v *WorkflowExecution) *WorkflowExecutionInfo {\n\ts.Execution = v\n\treturn s\n}", "title": "" }, { "docid": "7c8a69fa1335d70a7dd2048dc8d8b3cc", "score": "0.3567269", "text": "func (m *TaskReportSummary) SetTotalTasks(value *int32)() {\n err := m.GetBackingStore().Set(\"totalTasks\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "08b8d16e56bdc4374c36210924400270", "score": "0.35664356", "text": "func (s *WorkflowExecutionInfo) SetExecutionStatus(v string) *WorkflowExecutionInfo {\n\ts.ExecutionStatus = &v\n\treturn s\n}", "title": "" } ]
ee92cdeaef6a6c152dfb53d7baa16cf3
TestHTTPSink mocks out an http endpoint and notifies it under a couple of conditions, ensuring correct behavior.
[ { "docid": "4d7e83a2ce2fe189bd5d16eb30dc7dce", "score": "0.7468644", "text": "func TestHTTPSink(t *testing.T) {\n\tserverHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer r.Body.Close()\n\t\tif r.Method != http.MethodPost {\n\t\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\tt.Fatalf(\"unexpected request method: %v\", r.Method)\n\t\t\treturn\n\t\t}\n\n\t\t// Extract the content type and make sure it matches\n\t\tcontentType := r.Header.Get(\"Content-Type\")\n\t\tmediaType, _, err := mime.ParseMediaType(contentType)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tt.Fatalf(\"error parsing media type: %v, contenttype=%q\", err, contentType)\n\t\t\treturn\n\t\t}\n\n\t\tif mediaType != EventsMediaType {\n\t\t\tw.WriteHeader(http.StatusUnsupportedMediaType)\n\t\t\tt.Fatalf(\"incorrect media type: %q != %q\", mediaType, EventsMediaType)\n\t\t\treturn\n\t\t}\n\n\t\tvar envelope Envelope\n\t\tdec := json.NewDecoder(r.Body)\n\t\tif err := dec.Decode(&envelope); err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tt.Fatalf(\"error decoding request body: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Let caller choose the status\n\t\tstatus, err := strconv.Atoi(r.FormValue(\"status\"))\n\t\tif err != nil {\n\t\t\tt.Logf(\"error parsing status: %v\", err)\n\n\t\t\t// May just be empty, set status to 200\n\t\t\tstatus = http.StatusOK\n\t\t}\n\n\t\tw.WriteHeader(status)\n\t})\n\tserver := httptest.NewTLSServer(serverHandler)\n\n\tmetrics := newSafeMetrics(\"\")\n\tsink := newHTTPSink(server.URL, 0, nil, nil,\n\t\t&endpointMetricsHTTPStatusListener{safeMetrics: metrics})\n\n\t// first make sure that the default transport gives x509 untrusted cert error\n\tevent := Event{}\n\terr := sink.Write(event)\n\tif !strings.Contains(err.Error(), \"x509\") && !strings.Contains(err.Error(), \"unknown ca\") {\n\t\tt.Fatal(\"TLS server with default transport should give unknown CA error\")\n\t}\n\tif err := sink.Close(); err != nil {\n\t\tt.Fatalf(\"unexpected error closing http sink: %v\", err)\n\t}\n\n\t// make sure that passing in the transport no longer gives this error\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tsink = newHTTPSink(server.URL, 0, nil, tr,\n\t\t&endpointMetricsHTTPStatusListener{safeMetrics: metrics})\n\terr = sink.Write(event)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error writing event: %v\", err)\n\t}\n\n\t// reset server to standard http server and sink to a basic sink\n\tmetrics = newSafeMetrics(\"\")\n\tserver = httptest.NewServer(serverHandler)\n\tsink = newHTTPSink(server.URL, 0, nil, nil,\n\t\t&endpointMetricsHTTPStatusListener{safeMetrics: metrics})\n\tvar expectedMetrics EndpointMetrics\n\texpectedMetrics.Statuses = make(map[string]int)\n\n\tcloseL, err := net.Listen(\"tcp\", \"localhost:0\")\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error creating listener: %v\", err)\n\t}\n\tdefer closeL.Close()\n\tgo func() {\n\t\tfor {\n\t\t\tc, err := closeL.Accept()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.Close()\n\t\t}\n\t}()\n\n\tfor _, tc := range []struct {\n\t\tevent events.Event // events to send\n\t\turl string\n\t\tisFailure bool // true if there should be a failure.\n\t\tisError bool // true if the request returns an error\n\t\tstatusCode int // if not set, no status code should be incremented.\n\t}{\n\t\t{\n\t\t\tstatusCode: http.StatusOK,\n\t\t\tevent: createTestEvent(\"push\", \"library/test\", schema2.MediaTypeManifest),\n\t\t},\n\t\t{\n\t\t\tstatusCode: http.StatusOK,\n\t\t\tevent: createTestEvent(\"push\", \"library/test\", schema2.MediaTypeManifest),\n\t\t},\n\t\t{\n\t\t\tstatusCode: http.StatusOK,\n\t\t\tevent: createTestEvent(\"push\", \"library/test\", layerMediaType),\n\t\t},\n\t\t{\n\t\t\tstatusCode: http.StatusOK,\n\t\t\tevent: createTestEvent(\"push\", \"library/test\", layerMediaType),\n\t\t},\n\t\t{\n\t\t\tstatusCode: http.StatusTemporaryRedirect,\n\t\t},\n\t\t{\n\t\t\tstatusCode: http.StatusBadRequest,\n\t\t\tisFailure: true,\n\t\t},\n\t\t{\n\t\t\t// Case where connection is immediately closed\n\t\t\turl: \"http://\" + closeL.Addr().String(),\n\t\t\tisError: true,\n\t\t},\n\t} {\n\n\t\tif tc.isFailure {\n\t\t\texpectedMetrics.Failures++\n\t\t} else if tc.isError {\n\t\t\texpectedMetrics.Errors++\n\t\t} else {\n\t\t\texpectedMetrics.Successes++\n\t\t}\n\n\t\tif tc.statusCode > 0 {\n\t\t\texpectedMetrics.Statuses[fmt.Sprintf(\"%d %s\", tc.statusCode, http.StatusText(tc.statusCode))]++\n\t\t}\n\n\t\turl := tc.url\n\t\tif url == \"\" {\n\t\t\turl = server.URL + \"/\"\n\t\t}\n\t\t// setup endpoint to respond with expected status code.\n\t\turl += fmt.Sprintf(\"?status=%v\", tc.statusCode)\n\t\tsink.url = url\n\n\t\tt.Logf(\"testcase: %v, fail=%v, error=%v\", url, tc.isFailure, tc.isError)\n\t\t// Try a simple event emission.\n\t\terr := sink.Write(tc.event)\n\n\t\tif !tc.isFailure && !tc.isError {\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"unexpected error send event: %v\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err == nil {\n\t\t\t\tt.Fatalf(\"the endpoint should have rejected the request\")\n\t\t\t}\n\t\t\tt.Logf(\"write error: %v\", err)\n\t\t}\n\n\t\tif !reflect.DeepEqual(metrics.EndpointMetrics, expectedMetrics) {\n\t\t\tt.Fatalf(\"metrics not as expected: %#v != %#v\", metrics.EndpointMetrics, expectedMetrics)\n\t\t}\n\t}\n\n\tif err := sink.Close(); err != nil {\n\t\tt.Fatalf(\"unexpected error closing http sink: %v\", err)\n\t}\n\n\t// double close returns error\n\tif err := sink.Close(); err == nil {\n\t\tt.Fatalf(\"second close should have returned error: %v\", err)\n\t}\n}", "title": "" } ]
[ { "docid": "71cb2b90faa0915c8bede11313f8ce02", "score": "0.60349506", "text": "func TestHTTPResponse(t *testing.T, method, urlStr string, payload io.Reader) *httptest.ResponseRecorder {\n\treq, err := http.NewRequest(method, urlStr, payload)\n\tif err != nil {\n\t\tt.Fatalf(\"Unsuccessful %s on %q: %v\\n\", method, urlStr, err)\n\t}\n\tresp := httptest.NewRecorder()\n\tServeSingleHTTP(resp, req)\n\treturn resp\n}", "title": "" }, { "docid": "8d11997210f65e6ad3dbee95c7d455fa", "score": "0.60282046", "text": "func NewHTTPSink() (*HTTPSink, error) {\n\treturn NewHTTPSinkOnAddr(\"localhost:0\", 1000)\n}", "title": "" }, { "docid": "c29faf53ac37f6b95b7a8700f111257c", "score": "0.6001866", "text": "func TestNoWriteAfterServeHTTPReturns(t *testing.T) {\n\tcfdHTTP2Conn, edgeTCPConn := newTestHTTP2Connection()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tvar wg sync.WaitGroup\n\n\tserverDone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(serverDone)\n\t\tcfdHTTP2Conn.Serve(ctx)\n\t}()\n\n\tedgeTransport := http2.Transport{}\n\tedgeHTTP2Conn, err := edgeTransport.NewClientConn(edgeTCPConn)\n\trequire.NoError(t, err)\n\tmessage := []byte(t.Name())\n\n\tfor i := 0; i < 100; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\treadPipe, writePipe := io.Pipe()\n\t\t\treqCtx, reqCancel := context.WithCancel(ctx)\n\t\t\treq, err := http.NewRequestWithContext(reqCtx, http.MethodGet, \"http://localhost:8080/ws/flaky\", readPipe)\n\t\t\trequire.NoError(t, err)\n\t\t\treq.Header.Set(InternalUpgradeHeader, WebsocketUpgrade)\n\n\t\t\tresp, err := edgeHTTP2Conn.RoundTrip(req)\n\t\t\trequire.NoError(t, err)\n\t\t\t// http2RespWriter should rewrite status 101 to 200\n\t\t\trequire.Equal(t, http.StatusOK, resp.StatusCode)\n\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tfor {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-reqCtx.Done():\n\t\t\t\t\t\treturn\n\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t\t_ = wsutil.WriteClientBinary(writePipe, message)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\ttime.Sleep(time.Millisecond * 100)\n\t\t\treqCancel()\n\t\t}()\n\t}\n\n\twg.Wait()\n\tcancel()\n\t<-serverDone\n}", "title": "" }, { "docid": "8a6bb15d2454542a43f2365559a3b950", "score": "0.5988402", "text": "func TestProbeHTTPSHTTP(t *testing.T) {\n\tserver := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, \"Hello world\")\n\t}))\n\tserver.Start()\n\tdefer server.Close()\n\n\tregistry := prometheus.NewRegistry()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), server.URL, config.Module{}, registry); err == nil {\n\t\tt.Fatalf(\"expected error, but err was nil\")\n\t}\n}", "title": "" }, { "docid": "fccaad35b3331b323de5423efa9e19fa", "score": "0.59343934", "text": "func TestInvalidUrl(t *testing.T) {\n\n\tassert := assert.New(t)\n\n\tw := webhook.W{\n\t\tUntil: time.Now().Add(60 * time.Second),\n\t\tEvents: []string{\"iot\"},\n\t}\n\tw.Config.URL = \"invalid\"\n\tw.Config.ContentType = \"application/json\"\n\n\tobs, err := OutboundSenderFactory{\n\t\tListener: w,\n\t\tClient: &http.Client{},\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t\tLogger: getLogger(),\n\t}.New()\n\tassert.Nil(obs)\n\tassert.NotNil(err)\n\n\tw2 := webhook.W{\n\t\tUntil: time.Now().Add(60 * time.Second),\n\t\tEvents: []string{\"iot\"},\n\t}\n\tw2.Config.ContentType = \"application/json\"\n\n\tobs, err = OutboundSenderFactory{\n\t\tListener: w2,\n\t\tClient: &http.Client{},\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t\tLogger: getLogger(),\n\t}.New()\n\tassert.Nil(obs)\n\tassert.NotNil(err)\n\n}", "title": "" }, { "docid": "5c347b5bead2dda20e2a896e9286928f", "score": "0.5864862", "text": "func NewHTTPSinkOnAddr(addr string, capacity int) (*HTTPSink, error) {\n\ts := &HTTPSink{Capacity: capacity, mux: http.NewServeMux()}\n\ts.mux.HandleFunc(\"/get\", s.getHandler())\n\ts.mux.HandleFunc(\"/clear\", s.clearHandler())\n\ts.mux.HandleFunc(\"/\", s.setHandler())\n\n\tvar err error\n\ts.Listener, err = net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.Addr = strings.Replace(s.Listener.Addr().String(), \"[::]\", \"localhost\", 1)\n\n\treturn s, nil\n}", "title": "" }, { "docid": "a7c8d2934e344ff0408d4be2bb023ecc", "score": "0.5832743", "text": "func TestFailureURL(t *testing.T) {\n\tassert := assert.New(t)\n\n\tw := webhook.W{\n\t\tUntil: time.Now().Add(60 * time.Second),\n\t\tFailureURL: \"invalid\",\n\t\tEvents: []string{\"iot\"},\n\t}\n\tw.Config.URL = \"http://localhost:9999/foo\"\n\tw.Config.ContentType = \"application/json\"\n\n\tobs, err := OutboundSenderFactory{\n\t\tListener: w,\n\t\tClient: &http.Client{},\n\t\tCutOffPeriod: time.Second,\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t\tLogger: getLogger(),\n\t}.New()\n\tassert.Nil(obs)\n\tassert.NotNil(err)\n}", "title": "" }, { "docid": "7d5951343606f992ce213245c19eb3d1", "score": "0.57921726", "text": "func TestHTTP(t *testing.T, method, urlStr string, payload io.Reader) []byte {\n\tresp := TestHTTPResponse(t, method, urlStr, payload)\n\tif resp.Code != http.StatusOK {\n\t\t_, fn, line, _ := runtime.Caller(1)\n\t\tvar retstr string\n\t\tif resp.Body != nil {\n\t\t\tretbytes, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Error trying to read response body from request %q: %v [%s:%d]\\n\", urlStr, err, fn, line)\n\t\t\t} else {\n\t\t\t\tretstr = string(retbytes)\n\t\t\t}\n\t\t}\n\t\tt.Fatalf(\"Bad server response (%d) to %s %q: %s [%s:%d]\\n\", resp.Code, method, urlStr, retstr, fn, line)\n\t}\n\treturn resp.Body.Bytes()\n}", "title": "" }, { "docid": "dfb3306b422c1a6de5d1ef73361805e2", "score": "0.57702184", "text": "func TestWrapWriterHTTP2(t *testing.T) {\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t_, cn := w.(http.CloseNotifier)\n\t\tif !cn {\n\t\t\tt.Fatal(\"request should have been a http.CloseNotifier\")\n\t\t}\n\t\t_, fl := w.(http.Flusher)\n\t\tif !fl {\n\t\t\tt.Fatal(\"request should have been a http.Flusher\")\n\t\t}\n\t\t_, hj := w.(http.Hijacker)\n\t\tif hj {\n\t\t\tt.Fatal(\"request should not have been a http.Hijacker\")\n\t\t}\n\t\t_, rf := w.(io.ReaderFrom)\n\t\tif rf {\n\t\t\tt.Fatal(\"request should not have been a io.ReaderFrom\")\n\t\t}\n\t\t_, ps := w.(http.Pusher)\n\t\tif !ps {\n\t\t\tt.Fatal(\"request should have been a http.Pusher\")\n\t\t}\n\n\t\tw.Write([]byte(\"OK\"))\n\t})\n\n\twmw := func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tnext.ServeHTTP(NewWrapResponseWriter(w, r.ProtoMajor), r)\n\t\t})\n\t}\n\n\tserver := http.Server{\n\t\tAddr: \":7072\",\n\t\tHandler: wmw(handler),\n\t}\n\t// By serving over TLS, we get HTTP2 requests\n\tgo server.ListenAndServeTLS(testdataDir+\"/cert.pem\", testdataDir+\"/key.pem\")\n\tdefer server.Close()\n\t// We need the server to start before making the request\n\ttime.Sleep(100 * time.Millisecond)\n\n\tclient := &http.Client{\n\t\tTransport: &http2.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t// The certificates we are using are self signed\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tresp, err := client.Get(\"https://localhost:7072\")\n\tif err != nil {\n\t\tt.Fatalf(\"could not get server: %v\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Fatalf(\"non 200 response: %v\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "649ca6b064b5eb0be8d86d1ec370e91e", "score": "0.5717208", "text": "func testEndpoint(t *testing.T, handlerFuncName string, endpoint http.HandlerFunc, vars map[string]string, reqBody io.Reader, expectedStatus int, expectedBody string) {\n\tt.Helper()\n\n\treq, _ := http.NewRequest(\"\", \"\", reqBody)\n\tif req.ContentLength > 0 {\n\t\treq.Header.Add(\"content-type\", \"application/json\")\n\t}\n\trr := httptest.NewRecorder()\n\tif vars != nil {\n\t\treq = mux.SetURLVars(req, vars)\n\t}\n\tendpoint.ServeHTTP(rr, req)\n\n\tif status := rr.Code; status != expectedStatus {\n\t\tt.Errorf(\"%v returned status %v, expected %v\", handlerFuncName, status, expectedStatus)\n\t}\n\n\tif body := rr.Body.String(); body != expectedBody {\n\t\tt.Errorf(\"%v returned body\\n%v\\nexpected\\n%v\", handlerFuncName, body, expectedBody)\n\t}\n\n}", "title": "" }, { "docid": "03c874b8c8693824fc3417d1b642b7b9", "score": "0.5693239", "text": "func (h Handler) TestEndpoint() error {\n\tr, err := http.Get(h.url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.StatusCode != 200 {\n\t\treturn errors.New(\"Endpoint not replying typical 200 answer on ping\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "efd0abfbc9e1128d42af44604d441848", "score": "0.56829906", "text": "func TestBadHTTP(t *testing.T, method, urlStr string, payload io.Reader) {\n\treq, err := http.NewRequest(method, urlStr, payload)\n\tif err != nil {\n\t\t_, fn, line, _ := runtime.Caller(1)\n\t\tt.Fatalf(\"Unsuccessful %s on %q: %v [%s:%d]\\n\", method, urlStr, err, fn, line)\n\t}\n\tw := httptest.NewRecorder()\n\tServeSingleHTTP(w, req)\n\tif w.Code == http.StatusOK {\n\t\t_, fn, line, _ := runtime.Caller(1)\n\t\tt.Fatalf(\"Expected bad server response to %s on %q, got %d instead. [%s:%d]\\n\", method, urlStr, w.Code, fn, line)\n\t}\n}", "title": "" }, { "docid": "2b3452313e72b9523d4940027a5d6e89", "score": "0.56209546", "text": "func TestOverflowValidFailureURLWithSecret(t *testing.T) {\n\tassert := assert.New(t)\n\n\tvar output bytes.Buffer\n\tlogger := getNewTestOutputLogger(&output)\n\n\ttrans := &transport{}\n\ttrans.fn = func(req *http.Request, count int) (resp *http.Response, err error) {\n\t\tassert.Equal(\"POST\", req.Method)\n\t\tassert.Equal([]string{\"application/json\"}, req.Header[\"Content-Type\"])\n\t\t// There is a timestamp in the body, so it's not worth trying to do a string comparison\n\t\tassert.NotNil(req.Header[\"X-Webpa-Signature\"])\n\t\tpayload, _ := ioutil.ReadAll(req.Body)\n\t\tassert.NotNil(payload)\n\n\t\tresp = &http.Response{Status: \"200 OK\",\n\t\t\tStatusCode: 200,\n\t\t}\n\t\treturn\n\t}\n\n\tw := webhook.W{\n\t\tUntil: time.Now(),\n\t\tFailureURL: \"http://localhost:12345/bar\",\n\t\tEvents: []string{\"iot\", \"test\"},\n\t}\n\tw.Config.URL = \"http://localhost:9999/foo\"\n\tw.Config.ContentType = \"application/json\"\n\tw.Config.Secret = \"123456\"\n\n\tobs, err := OutboundSenderFactory{\n\t\tListener: w,\n\t\tClient: &http.Client{Transport: trans},\n\t\tCutOffPeriod: time.Second,\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t\tLogger: logger,\n\t}.New()\n\tassert.Nil(err)\n\n\tif _, ok := obs.(*CaduceusOutboundSender); !ok {\n\t\tassert.Fail(\"Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.\")\n\t}\n\n\tobs.(*CaduceusOutboundSender).queueOverflow()\n\tassert.NotNil(output.String())\n}", "title": "" }, { "docid": "db0d58c23c41430530b15cd2a1e1abed", "score": "0.5605961", "text": "func setupSink(config map[string]any) (*os.File, error) {\n\taddrOpaque, ok := config[\"endpoint\"]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"endpoint not present in configuration\")\n\t}\n\taddr, ok := addrOpaque.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"endpoint %q is not a string\", addrOpaque)\n\t}\n\treturn setup(addr)\n}", "title": "" }, { "docid": "41c8febc4d32356acf3acba823c85947", "score": "0.5553729", "text": "func newTestSink(interval time.Duration, client *monitoring.MetricClient) *Sink {\n\ts := &Sink{}\n\ts.taskInfo = &taskInfo{}\n\ts.interval = interval\n\ts.bucketer = DefaultBucketer\n\ts.reset()\n\tgo s.flushMetrics(context.Background())\n\treturn s\n}", "title": "" }, { "docid": "76f76dd13341412b81a65e4e6b18d347", "score": "0.5539424", "text": "func TestFailedEndpoint1(t *testing.T) {\n\tisTesting = true\n\tvar request = Request{\n\t\tPath: \"/api/device\",\n\t\tHTTPMethod: \"GET\",\n\t}\n\tvar response, _ = Handler(request)\n\tif response.StatusCode != 404 {\n\t\tt.Errorf(\"response status code has to be 404 but is %d\", response.StatusCode)\n\t}\n\tif response.Body != `{\"message\":\"requested endpoint not found\"}` {\n\t\tt.Errorf(\"body is: %s\", response.Body)\n\t}\n}", "title": "" }, { "docid": "dff5fad47b63d012a436e7eb5875d18f", "score": "0.5521401", "text": "func TestProbeHTTPSTimeout(t *testing.T) {\n\tserver, _, _, caFile, teardown, err := test.SetupHTTPSServer()\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tdefer teardown()\n\n\tserver.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\ttime.Sleep(3 * time.Second)\n\t\tfmt.Fprintln(w, \"Hello world\")\n\t})\n\n\tserver.StartTLS()\n\tdefer server.Close()\n\n\tmodule := config.Module{\n\t\tTLSConfig: config.TLSConfig{\n\t\t\tCAFile: caFile,\n\t\t},\n\t}\n\n\tregistry := prometheus.NewRegistry()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)\n\tdefer cancel()\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), server.URL, module, registry); err == nil {\n\t\tt.Fatalf(\"Expected error but returned error was nil\")\n\t}\n}", "title": "" }, { "docid": "0782a13877d59f77dd0740b3c9fff9e6", "score": "0.5489309", "text": "func newMockListener(endpoint net.Conn) *mockListener {\n \n c := make(chan net.Conn, 1)\n c <- endpoint\n listener := &mockListener{\n connChannel: c,\n serverEndpoint: endpoint,\n }\n return listener\n}", "title": "" }, { "docid": "6bf3cb9a28ec0106dfe1bd8dc743049e", "score": "0.5463281", "text": "func ProvideHTTPTransport(e endpoints.Endpoints, deps BaseDependencies) (HTTPTransport, error) {\n\t// The HTTP listener mounts the Go kit HTTP handler we created.\n\tvar (\n\t\tctx = context.Background()\n\t\thttpCfg = deps.Sample.HTTP\n\t\thttpAddress = httpCfg.Address()\n\t\thttpHndlr = http.TimeoutHandler(\n\t\t\ttransport.NewHTTPHandler(e, deps.OTTracer),\n\t\t\ttransport.Timeout,\n\t\t\ttransport.TimeoutError)\n\t)\n\n\tsrv := &http.Server{ // Setup server with Timeouts\n\t\tAddr: httpAddress,\n\t\tHandler: httpHndlr,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tTLSConfig: &tls.Config{\n\t\t\tClientAuth: tls.RequireAndVerifyClientCert,\n\t\t},\n\t}\n\n\tstartFn := func() error {\n\t\tdeps.Infow(ctx, \"Address\", httpAddress, \"msg\", \"starting HTTP server ...\")\n\t\tif httpCfg.Secure {\n\t\t\tdeps.Info(context.Background(), \"Am I \")\n\t\t\treturn srv.ListenAndServeTLS(httpCfg.TLSCert, httpCfg.TLSKey)\n\t\t}\n\t\treturn srv.ListenAndServe()\n\t}\n\n\tshutDownFn := func() {\n\t\tdeps.Infow(ctx, \"msg\", \"Shutting Down HTTP Handler\")\n\t\tsdctx, sdcancel := context.WithTimeout(context.Background(), 60*time.Second)\n\t\t// wait for 60 seconds max\n\t\tdefer sdcancel()\n\t\tif srv != nil {\n\t\t\tsrv.Shutdown(sdctx)\n\t\t}\n\t}\n\n\treturn HTTPTransport{\n\t\tEnabled: true,\n\t\tStart: startFn,\n\t\tShutdown: shutDownFn,\n\t}, nil\n}", "title": "" }, { "docid": "19db4a9fffd237b8ae0721be0f95bee3", "score": "0.5449271", "text": "func TestFailedEndpoint0(t *testing.T) {\n\tisTesting = true\n\tvar request = Request{\n\t\tPath: \"/api/devices\",\n\t\tHTTPMethod: \"PUT\",\n\t}\n\tvar response, _ = Handler(request)\n\tif response.StatusCode != 404 {\n\t\tt.Errorf(\"response status code has to be 404 but is %d\", response.StatusCode)\n\t}\n\tif response.Body != `{\"message\":\"requested endpoint not found\"}` {\n\t\tt.Errorf(\"body is: %s\", response.Body)\n\t}\n}", "title": "" }, { "docid": "848935f0ef6963da98eff69771ca37e9", "score": "0.54265434", "text": "func (s *Suite) checkHTTPResponse(t *testing.T, clientCert tls.Certificate, checkResp func(*http.Response)) {\n\tpr, pw := net.Pipe()\n\tdefer pw.Close()\n\tdefer pr.Close()\n\n\t// Create an HTTP client authenticated with the user's credentials. This acts\n\t// like the proxy does.\n\thttpClient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\t\t\treturn pr, nil\n\t\t\t},\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t// RootCAs is a pool of host certificates used to verify the identity of\n\t\t\t\t// the server this client is connecting to.\n\t\t\t\tRootCAs: s.hostCertPool,\n\t\t\t\t// Certificates is the user's application specific certificate.\n\t\t\t\tCertificates: []tls.Certificate{clientCert},\n\t\t\t\t// Time defines the time anchor for certificate validation\n\t\t\t\tTime: s.clock.Now,\n\t\t\t},\n\t\t},\n\t\t// Prevent client from following redirect to be able to test redirect locations.\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\n\t// Handle the connection in another goroutine.\n\tgo func() {\n\t\ts.appServer.HandleConnection(pw)\n\t\twg.Done()\n\t}()\n\n\t// Issue request.\n\tresp, err := httpClient.Get(\"https://\" + constants.APIDomain)\n\trequire.NoError(t, err)\n\n\t// Check response.\n\tcheckResp(resp)\n\trequire.NoError(t, resp.Body.Close())\n\n\t// Close should not trigger an error.\n\trequire.NoError(t, s.appServer.Close())\n\n\t// Wait for the application server to actually stop serving before\n\t// closing the test. This will make sure the server removes the listeners\n\twg.Wait()\n}", "title": "" }, { "docid": "c5e00360fee7b431a41e82909c697bf6", "score": "0.53931177", "text": "func (_m *MockHandler) ServeHTTP(_a0 http.ResponseWriter, _a1 *http.Request) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "e3912a097bd4dbd02562b80d55401a29", "score": "0.53640807", "text": "func TestProxyHandler(t *testing.T) {\n\tproxyRoute := &ProxyRoute{\n\t\tPrefix: \"/prefix\", RedirectURL: \"http://redirect\",\n\t}\n\thandler := ProxyHandler(proxyRoute.Prefix, proxyRoute.RedirectURL)\n\tswitch v := handler.(type) {\n\tcase http.HandlerFunc:\n\t\tlog.Println(\"ProxyHandler is an http.HandlerFunc\")\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"%v is not http.HandlerFunc\", v)\n\t\tassert.Fail(t, msg)\n\t}\n\n\tsavedClient := proxyClient\n\tsavedIoCopy := ioCopy\n\tdefer func() {\n\t\t// restoring ioCopy and proxyClient (see definition in proxy.go)\n\t\tioCopy = savedIoCopy\n\t\tproxyClient = savedClient\n\t}()\n\n\ttests := []struct {\n\t\trequestURL string\n\t\texpectedCode int\n\t\tioCopyMock func(dst io.Writer, src io.Reader) (int64, error)\n\t\tclientMock *MockProxyClient\n\t}{\n\t\t{\"\", http.StatusBadRequest, nil, nil},\n\t\t{\"http://test1/foo\", http.StatusBadGateway, ioCopyOkayFunc, clientResponseErr},\n\t\t{\"http://test2/foo\", http.StatusOK, ioCopyErrorFunc, clientResponse200},\n\t\t{\"http://test3/foo\", http.StatusNotFound, ioCopyOkayFunc, clientResponse404},\n\t\t{\"http://test4/foo\", http.StatusOK, ioCopyOkayFunc, clientResponse200},\n\t}\n\n\tfor idx, test := range tests {\n\t\tproxyClient = test.clientMock\n\t\tioCopy = test.ioCopyMock\n\t\treq, _ := http.NewRequest(\"GET\", test.requestURL, nil)\n\t\trwr := httptest.NewRecorder()\n\n\t\tlog.Printf(\"Test %2d: %s\\n\", idx, test.requestURL)\n\t\tproxyRoute.ServeHTTP(rwr, req)\n\t\thandler.ServeHTTP(rwr, req)\n\n\t\t// log.Printf(\"Test %2d - request: %s - %#v\\n\", idx, req.URL, req)\n\t\t// log.Printf(\"Test %2d - response: %#v\\n\", idx, rwr)\n\t\tassert.Equal(t, test.expectedCode, rwr.Code)\n\t}\n}", "title": "" }, { "docid": "41413396132f11cc1e870ba49fcb7504", "score": "0.536349", "text": "func testEndpoint(t *testing.T, method, url string, expectedCode int) string {\n\t// create request to pass to handler\n\trequest, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// create response recoder\n\trecorder := httptest.NewRecorder()\n\n\t// get router\n\trouter := backend.CreateRouter()\n\n\t// serve\n\trouter.ServeHTTP(recorder, request)\n\n\t// confirm status code\n\tcode := recorder.Code\n\tif code != expectedCode {\n\t\tt.Errorf(\"Handler returned wrong code: got %v instead of %v\", code, expectedCode)\n\t}\n\n\t// return body string\n\treturn recorder.Body.String()\n}", "title": "" }, { "docid": "fc860fa8149e0ec542889a9c02f8c725", "score": "0.53427476", "text": "func testHTTPResponse(t *testing.T, r *httprouter.Router, req *nethttp.Request) *httptest.ResponseRecorder {\n\n\t// Create a response recorder\n\tw := httptest.NewRecorder()\n\n\t// Create the service and process the above request.\n\tr.ServeHTTP(w, req)\n\n\treturn w\n}", "title": "" }, { "docid": "c61d638065db6c99b9a6bd120655cb55", "score": "0.5317835", "text": "func NewHTTPPublisher(endpoint string) *HTTPPublisher { return &HTTPPublisher{endpoint} }", "title": "" }, { "docid": "586e3b2a684c42c7ab19e02c171d2ee3", "score": "0.53174293", "text": "func ChannelDeadLetterSinkTestHelper(\n\tctx context.Context,\n\tt *testing.T,\n\tsubscriptionVersion SubscriptionVersion,\n\tchannelTestRunner testlib.ComponentsTestRunner,\n\toptions ...testlib.SetupClientOption) {\n\tconst (\n\t\tsenderName = \"e2e-channelchain-sender\"\n\t\trecordEventsPodName = \"e2e-channel-dls-recordevents-pod\"\n\t)\n\tchannelNames := []string{\"e2e-channel-dls\"}\n\t// subscriptionNames corresponds to Subscriptions\n\tsubscriptionNames := []string{\"e2e-channel-dls-subs1\"}\n\n\tchannelTestRunner.RunTests(t, testlib.FeatureBasic, func(st *testing.T, channel metav1.TypeMeta) {\n\t\tclient := testlib.Setup(st, true, options...)\n\t\tdefer testlib.TearDown(client)\n\n\t\t// create channels\n\t\tclient.CreateChannelsOrFail(channelNames, &channel)\n\t\tclient.WaitForResourcesReadyOrFail(&channel)\n\n\t\t// create event logger pod and service as the subscriber\n\t\teventTracker, _ := recordevents.StartEventRecordOrFail(ctx, client, recordEventsPodName)\n\t\t// create subscriptions that subscribe to a service that does not exist\n\t\tswitch subscriptionVersion {\n\t\tcase SubscriptionV1:\n\t\t\tclient.CreateSubscriptionsOrFail(\n\t\t\t\tsubscriptionNames,\n\t\t\t\tchannelNames[0],\n\t\t\t\t&channel,\n\t\t\t\tresources.WithSubscriberForSubscription(\"does-not-exist\"),\n\t\t\t\tresources.WithDeadLetterSinkForSubscription(recordEventsPodName),\n\t\t\t)\n\t\tdefault:\n\t\t\tt.Fatalf(\"Invalid subscription version\")\n\t\t}\n\n\t\t// wait for all test resources to be ready, so that we can start sending events\n\t\tclient.WaitForAllTestResourcesReadyOrFail(ctx)\n\n\t\t// send CloudEvent to the first channel\n\t\tevent := cloudevents.NewEvent()\n\t\tevent.SetID(\"test\")\n\t\teventSource := fmt.Sprintf(\"http://%s.svc/\", senderName)\n\t\tevent.SetSource(eventSource)\n\t\tevent.SetType(testlib.DefaultEventType)\n\t\tbody := fmt.Sprintf(`{\"msg\":\"TestChannelDeadLetterSink %s\"}`, uuid.New().String())\n\t\tif err := event.SetData(cloudevents.ApplicationJSON, []byte(body)); err != nil {\n\t\t\tt.Fatal(\"Cannot set the payload of the event:\", err.Error())\n\t\t}\n\t\tclient.SendEventToAddressable(ctx, senderName, channelNames[0], &channel, event)\n\n\t\t// check if the logging service receives the correct number of event messages\n\t\teventTracker.AssertAtLeast(len(subscriptionNames), recordevents.MatchEvent(\n\t\t\tHasSource(eventSource),\n\t\t\tHasData([]byte(body)),\n\t\t))\n\t})\n}", "title": "" }, { "docid": "81ed57bd941f965d55bf33b02c407303", "score": "0.5309336", "text": "func (s) TestHandlerTransport_HandleStreams_WriteStatusWrite(t *testing.T) {\n\ttestHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) {\n\t\tif want := \"/service/foo.bar\"; s.method != want {\n\t\t\tt.Errorf(\"stream method = %q; want %q\", s.method, want)\n\t\t}\n\t\tst.bodyw.Close() // no body\n\n\t\tst.ht.WriteStatus(s, status.New(codes.OK, \"\"))\n\t\tst.ht.Write(s, []byte(\"hdr\"), []byte(\"data\"), &Options{})\n\t})\n}", "title": "" }, { "docid": "4ebf8b459ec22d610165968a39f55b57", "score": "0.52892745", "text": "func TestPlainHTTPServer(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\ts, _, _ := serverutils.StartServer(t, base.TestServerArgs{\n\t\t// The default context uses embedded certs.\n\t\tInsecure: true,\n\t})\n\tdefer s.Stopper().Stop()\n\tts := s.(*TestServer)\n\n\thttpClient, err := s.GetHTTPClient()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\thttpURL := \"http://\" + ts.Ctx.HTTPAddr + healthPath\n\tif resp, err := httpClient.Get(httpURL); err != nil {\n\t\tt.Fatalf(\"error requesting health at %s: %s\", httpURL, err)\n\t} else {\n\t\tdefer resp.Body.Close()\n\t\tvar data serverpb.HealthResponse\n\t\tif err := jsonpb.Unmarshal(resp.Body, &data); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\thttpsURL := \"https://\" + ts.Ctx.HTTPAddr + healthPath\n\tif _, err := httpClient.Get(httpsURL); err == nil {\n\t\tt.Fatalf(\"unexpected success fetching %s\", httpsURL)\n\t}\n}", "title": "" }, { "docid": "6c223d45b1f0ec6a807f8b1470a19424", "score": "0.5279219", "text": "func TestBackend(ctx context.Context, t *testing.T, a *assertions.Assertion, backend events.PubSub) {\n\tnow := time.Now()\n\tcorrelationID := fmt.Sprintf(\"%s@%s\", t.Name(), now)\n\n\tctx = events.ContextWithCorrelationID(ctx, correlationID)\n\n\ttimeout := test.Delay\n\tif deadline, ok := ctx.Deadline(); ok {\n\t\ttimeout = time.Until(deadline) / 10\n\t}\n\n\teui := types.EUI64{1, 2, 3, 4, 5, 6, 7, 8}\n\tdevAddr := types.DevAddr{1, 2, 3, 4}\n\tappID := ttnpb.ApplicationIdentifiers{\n\t\tApplicationId: \"test-app\",\n\t}\n\tdevID := ttnpb.EndDeviceIdentifiers{\n\t\tApplicationIds: &appID,\n\t\tDeviceId: \"test-dev\",\n\t\tDevEui: eui.Bytes(),\n\t\tJoinEui: eui.Bytes(),\n\t\tDevAddr: devAddr.Bytes(),\n\t}\n\tgtwID := ttnpb.GatewayIdentifiers{\n\t\tGatewayId: \"test-gtw\",\n\t\tEui: eui.Bytes(),\n\t}\n\n\tch0 := make(events.Channel, 10)\n\tch1 := make(events.Channel, 10)\n\tch2 := make(events.Channel, 10)\n\n\tcheckEvent := func(e events.Event) {\n\t\ta.So(e.Time().IsZero(), should.BeFalse)\n\t\ta.So(e.Context(), should.NotBeNil)\n\t}\n\n\tsubCtx, unsubscribe := context.WithCancel(ctx)\n\tdefer unsubscribe()\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt1\", \"test event 1\", events.WithIdentifiers(&appID)))\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tif store, ok := backend.(events.Store); ok {\n\t\tchx := make(events.Channel, 10)\n\t\thistSubCtx, cancel := context.WithCancel(subCtx)\n\t\tvar g errgroup.Group\n\t\tg.Go(func() error {\n\t\t\tafter := now.Add(-1 * time.Second)\n\t\t\treturn store.SubscribeWithHistory(\n\t\t\t\thistSubCtx,\n\t\t\t\t[]string{\"test.some.evt1\"},\n\t\t\t\t[]*ttnpb.EntityIdentifiers{appID.GetEntityIdentifiers()},\n\t\t\t\t&after, 1, chx,\n\t\t\t)\n\t\t})\n\t\tdefer func() {\n\t\t\tcancel()\n\t\t\tif err := g.Wait(); err != nil && !errors.IsCanceled(err) {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\ta.So(chx, should.HaveLength, 2)\n\t\t}()\n\t}\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.some.evt0\", \"test.some.evt1\"},\n\t\tnil,\n\t\tch0,\n\t), should.BeNil)\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.some.evt0\", \"test.some.evt1\"},\n\t\t[]*ttnpb.EntityIdentifiers{appID.GetEntityIdentifiers()},\n\t\tch1,\n\t), should.BeNil)\n\n\ta.So(backend.Subscribe(\n\t\tsubCtx,\n\t\t[]string{\"test.other.evt2\"},\n\t\t[]*ttnpb.EntityIdentifiers{gtwID.GetEntityIdentifiers()},\n\t\tch2,\n\t), should.BeNil)\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt0\", \"test event 0\"))\n\tcheckEvt0 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.some.evt0\")\n\t\ta.So(e.Identifiers(), should.BeNil)\n\t}\n\n\tbackend.Publish(events.New(ctx, \"test.some.evt1\", \"test event 1\", events.WithIdentifiers(&appID)))\n\tcheckEvt1 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.some.evt1\")\n\t\tif a.So(e.Identifiers(), should.NotBeNil) && a.So(e.Identifiers(), should.HaveLength, 1) {\n\t\t\ta.So(e.Identifiers()[0].GetApplicationIds(), should.Resemble, &appID)\n\t\t}\n\t}\n\n\tbackend.Publish(events.New(ctx, \"test.other.evt2\", \"test event 2\", events.WithIdentifiers(&devID, &gtwID)))\n\tcheckEvt2 := func(e events.Event) {\n\t\tcheckEvent(e)\n\t\ta.So(e.Name(), should.Equal, \"test.other.evt2\")\n\t\tif a.So(e.Identifiers(), should.NotBeNil) && a.So(e.Identifiers(), should.HaveLength, 2) {\n\t\t\ta.So(e.Identifiers()[0].GetDeviceIds(), should.Resemble, &devID)\n\t\t\ta.So(e.Identifiers()[1].GetGatewayIds(), should.Resemble, &gtwID)\n\t\t}\n\t}\n\n\truntime.Gosched()\n\ttime.Sleep(timeout)\n\n\tif a.So(ch0, should.HaveLength, 2) {\n\t\tevt := <-ch0\n\t\tif evt.Name() == \"test.some.evt0\" { // Events may arrive out-of-order.\n\t\t\tcheckEvt0(evt)\n\t\t\tcheckEvt1(<-ch0)\n\t\t} else {\n\t\t\tcheckEvt1(evt)\n\t\t\tcheckEvt0(<-ch0)\n\t\t}\n\t}\n\n\tif a.So(ch1, should.HaveLength, 1) {\n\t\tcheckEvt1(<-ch1)\n\t}\n\n\tif a.So(ch2, should.HaveLength, 1) {\n\t\tcheckEvt2(<-ch2)\n\t}\n\n\tif store, ok := backend.(events.Store); ok {\n\t\tafter := now.Add(-1 * time.Second)\n\n\t\tevts, err := store.FetchHistory(ctx, []string{\n\t\t\t\"test.some.evt1\",\n\t\t}, []*ttnpb.EntityIdentifiers{\n\t\t\tappID.GetEntityIdentifiers(),\n\t\t\tdevID.GetEntityIdentifiers(),\n\t\t\tgtwID.GetEntityIdentifiers(),\n\t\t}, &after, 0)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 2)\n\n\t\tevts, err = store.FetchHistory(ctx, nil, []*ttnpb.EntityIdentifiers{\n\t\t\tappID.GetEntityIdentifiers(),\n\t\t}, &after, 1)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 1)\n\n\t\tevts, err = store.FindRelated(ctx, correlationID)\n\t\ta.So(err, should.BeNil)\n\t\ta.So(evts, should.HaveLength, 4)\n\t}\n}", "title": "" }, { "docid": "130a8b46092d7c8866ddc6607c60c57f", "score": "0.5273797", "text": "func mockConnUpgradeHandler(t *testing.T, upgradeType string, write []byte) http.Handler {\n\tt.Helper()\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\trequire.Equal(t, constants.WebAPIConnUpgrade, r.URL.Path)\n\t\trequire.Equal(t, upgradeType, r.Header.Get(constants.WebAPIConnUpgradeHeader))\n\t\trequire.Equal(t, upgradeType, r.Header.Get(constants.WebAPIConnUpgradeTeleportHeader))\n\t\trequire.Equal(t, constants.WebAPIConnUpgradeConnectionType, r.Header.Get(constants.WebAPIConnUpgradeConnectionHeader))\n\n\t\thj, ok := w.(http.Hijacker)\n\t\trequire.True(t, ok)\n\n\t\tconn, _, err := hj.Hijack()\n\t\trequire.NoError(t, err)\n\t\tdefer conn.Close()\n\n\t\t// Upgrade response.\n\t\tresponse := &http.Response{\n\t\t\tStatusCode: http.StatusSwitchingProtocols,\n\t\t\tProtoMajor: 1,\n\t\t\tProtoMinor: 1,\n\t\t}\n\t\trequire.NoError(t, response.Write(conn))\n\n\t\t// Upgraded.\n\t\tswitch upgradeType {\n\t\tcase constants.WebAPIConnUpgradeTypeALPNPing:\n\t\t\t// Wrap conn with Ping and write some pings.\n\t\t\tpingConn := pingconn.New(conn)\n\t\t\tpingConn.WritePing()\n\t\t\t_, err = pingConn.Write(write)\n\t\t\trequire.NoError(t, err)\n\t\t\tpingConn.WritePing()\n\n\t\tdefault:\n\t\t\t_, err = conn.Write(write)\n\t\t\trequire.NoError(t, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "b84d66a040c4aecc8865ef95df8a3f8d", "score": "0.5266697", "text": "func TestOverflowValidFailureURLError(t *testing.T) {\n\tassert := assert.New(t)\n\n\tvar output bytes.Buffer\n\tlogger := getNewTestOutputLogger(&output)\n\n\ttrans := &transport{}\n\ttrans.fn = func(req *http.Request, count int) (resp *http.Response, err error) {\n\t\tresp = nil\n\t\terr = fmt.Errorf(\"My Error.\")\n\t\treturn\n\t}\n\n\tw := webhook.W{\n\t\tUntil: time.Now(),\n\t\tFailureURL: \"http://localhost:12345/bar\",\n\t\tEvents: []string{\"iot\", \"test\"},\n\t}\n\tw.Config.URL = \"http://localhost:9999/foo\"\n\tw.Config.ContentType = \"application/json\"\n\n\tobs, err := OutboundSenderFactory{\n\t\tListener: w,\n\t\tClient: &http.Client{Transport: trans},\n\t\tCutOffPeriod: time.Second,\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tLogger: logger,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t}.New()\n\tassert.Nil(err)\n\n\tif _, ok := obs.(*CaduceusOutboundSender); !ok {\n\t\tassert.Fail(\"Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.\")\n\t}\n\n\tobs.(*CaduceusOutboundSender).queueOverflow()\n\tassert.NotNil(output.String())\n}", "title": "" }, { "docid": "4296844cf65bfbb796644e1f552ea8e1", "score": "0.5261087", "text": "func TestHealthHandler(t *testing.T) {\n\t// clear out existing checks.\n\tDefaultRegistry = NewRegistry()\n\n\t// protect an http server\n\thandler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}))\n\n\t// wrap it in our health handler\n\thandler = Handler(handler)\n\n\t// use this swap check status\n\tupdater := NewStatusUpdater()\n\tRegister(\"test_check\", updater)\n\n\t// now, create a test server\n\tserver := httptest.NewServer(handler)\n\n\tcheckUp := func(t *testing.T, message string) {\n\t\tresp, err := http.Get(server.URL)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error getting success status: %v\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusNoContent {\n\t\t\tt.Fatalf(\"unexpected response code from server when %s: %d != %d\", message, resp.StatusCode, http.StatusNoContent)\n\t\t}\n\t\t// NOTE(stevvooe): we really don't care about the body -- the format is\n\t\t// not standardized or supported, yet.\n\t}\n\n\tcheckDown := func(t *testing.T, message string) {\n\t\tresp, err := http.Get(server.URL)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error getting down status: %v\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusServiceUnavailable {\n\t\t\tt.Fatalf(\"unexpected response code from server when %s: %d != %d\", message, resp.StatusCode, http.StatusServiceUnavailable)\n\t\t}\n\t}\n\n\t// server should be up\n\tcheckUp(t, \"initial health check\")\n\n\t// now, we fail the health check\n\tupdater.Update(fmt.Errorf(\"the server is now out of commission\"))\n\tcheckDown(t, \"server should be down\") // should be down\n\n\t// bring server back up\n\tupdater.Update(nil)\n\tcheckUp(t, \"when server is back up\") // now we should be back up.\n}", "title": "" }, { "docid": "53168464e90698aa49c93adcb5fef1b6", "score": "0.5255968", "text": "func newDownstream(t *testing.T, expectedPayload string, called *bool) *httptest.Server {\n\tdownstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tassert.Equal(t, \"/v11/notify\", r.URL.Path)\n\t\tdefer r.Body.Close()\n\t\tbytes, err := ioutil.ReadAll(r.Body)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, expectedPayload, string(bytes))\n\t\tfmt.Fprintln(w, `{\"status\": \"OK\"}`)\n\t\t*called = true\n\t}))\n\treturn downstream\n}", "title": "" }, { "docid": "3970e379e681aac01a499c456e4dd587", "score": "0.52523243", "text": "func testHTTPResponse(\n\tt *testing.T,\n\tr *gin.Engine,\n\treq *http.Request,\n\tf func(w *httptest.ResponseRecorder) bool,\n) {\n\t// Create a response recorder\n\tw := httptest.NewRecorder()\n\n\t// Create the service and process the passed request\n\tr.ServeHTTP(w, req)\n\n\tif !f(w) { // check if test was successful\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "0817ca9e9b1585bb5446fc6b1d7d2db1", "score": "0.5231002", "text": "func TestGetWriteOnError(t *testing.T) {\n\t// set up test server and mocked LogStore\n\tmockLogStore := new(MockedLogStore)\n\tserver := newTestServer(mockLogStore)\n\ttestServer := httptest.NewServer(server.server.Handler)\n\tdefer testServer.Close()\n\tclient := testServer.Client()\n\n\t//\n\t// set up mock expectations\n\t//\n\n\t// LogStore.Ready() should fail\n\tmockLogStore.On(\"Ready\").Return(false, fmt.Errorf(\"connection refused\"))\n\n\t//\n\t// make call\n\t//\n\tresp, _ := client.Get(testServer.URL + \"/write\")\n\t// should return 503 (Service Unavailable)\n\tassert.Equalf(t, http.StatusServiceUnavailable, resp.StatusCode, \"unexpected response code\")\n\tassert.Equalf(t, []string{\"application/json\"}, resp.Header[\"Content-Type\"], \"unexpected Content-Type\")\n\tassert.Equalf(t, `{\"healthy\":false,\"detail\":\"connection refused\"}`, readBody(t, resp), \"unexpected json response\")\n\n\t// verify that expected calls were made\n\tmockLogStore.AssertExpectations(t)\n}", "title": "" }, { "docid": "80d816241bb765af27b84895d7e38553", "score": "0.52181655", "text": "func TestHealthCheckHandler(t *testing.T) {\n req, err := http.NewRequest(\"GET\", \"/healthcheck\", nil)\n if err != nil {\n t.Fatal(err)\n }\n s := server{\n router : httprouter.New(),\n }\n\n rr := httptest.NewRecorder()\n handler := s.HealthCheckHandler()\n\n s.router.GET(\"/healthcheck\", handler)\n\n s.router.ServeHTTP(rr, req)\n\n // Check if the status code and response body are the one expected.\n if status := rr.Code; status != http.StatusOK {\n t.Errorf(\"handler returned wrong status code: got %v want %v\",\n status, http.StatusOK)\n }\n expected := `{\"alive\": true}`\n if rr.Body.String() != expected {\n t.Errorf(\"handler returned unexpected body: got %v want %v\",\n rr.Body.String(), expected)\n }\n}", "title": "" }, { "docid": "317b2fe66b8f0b5f1cd39cb8d5f4c8e5", "score": "0.5197563", "text": "func TestProbeHTTPSProxy(t *testing.T) {\n\tserver, certPEM, _, caFile, teardown, err := test.SetupHTTPSServer()\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tdefer teardown()\n\n\tproxyServer, err := test.SetupHTTPProxyServer()\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tserver.StartTLS()\n\tdefer server.Close()\n\n\tproxyServer.Start()\n\tdefer proxyServer.Close()\n\n\tproxyURL, err := url.Parse(proxyServer.URL)\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\n\tbadProxyURL, err := url.Parse(\"http://localhost:6666\")\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\n\tmodule := config.Module{\n\t\tTLSConfig: config.TLSConfig{\n\t\t\tCAFile: caFile,\n\t\t\tInsecureSkipVerify: false,\n\t\t},\n\t\tHTTPS: config.HTTPSProbe{\n\t\t\t// Test with a bad proxy url first\n\t\t\tProxyURL: config.URL{URL: badProxyURL},\n\t\t},\n\t}\n\n\tregistry := prometheus.NewRegistry()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), server.URL, module, registry); err == nil {\n\t\tt.Fatalf(\"expected error but err was nil\")\n\t}\n\n\t// Test with the proxy url, this shouldn't return an error\n\tmodule.HTTPS.ProxyURL = config.URL{URL: proxyURL}\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), server.URL, module, registry); err != nil {\n\t\tt.Fatalf(\"error: %s\", err)\n\t}\n\n\tcert, err := newCertificate(certPEM)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tcheckCertificateMetrics(cert, registry, t)\n\tcheckOCSPMetrics([]byte{}, registry, t)\n\tcheckTLSVersionMetrics(\"TLS 1.3\", registry, t)\n}", "title": "" }, { "docid": "73624cba33f9f1e8a01cc0c6265c66e0", "score": "0.5179317", "text": "func TestHandle(t *testing.T) {\n\tconst backendResponse = \"I am the backend\"\n\tconst backendStatus = 404\n\tbackend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"GET\" && r.FormValue(\"mode\") == \"hangup\" {\n\t\t\tc, _, _ := w.(http.Hijacker).Hijack()\n\t\t\tc.Close()\n\t\t\treturn\n\t\t}\n\t\tif len(r.TransferEncoding) > 0 {\n\t\t\tt.Errorf(\"backend got unexpected TransferEncoding: %v\", r.TransferEncoding)\n\t\t}\n\t\tif r.Header.Get(\"X-Forwarded-For\") == \"\" {\n\t\t\tt.Errorf(\"didn't get X-Forwarded-For header\")\n\t\t}\n\t\t// if r.Header.Get(\"X-MyReverseProxy\") == \"\" {\n\t\t// \tt.Errorf(\"didn't get X-MyReverseProxy header\")\n\t\t// }\n\t\tif !strings.Contains(runtime.Version(), \"1.5\") {\n\t\t\tif c := r.Header.Get(\"Proxy-Connection\"); c != \"\" {\n\t\t\t\tt.Errorf(\"handler got Proxy-Connection header value %q\", c)\n\t\t\t}\n\t\t}\n\t\tif g, e := r.Host, \"some-name\"; g != e {\n\t\t\tt.Errorf(\"backend got Host header %q, want %q\", g, e)\n\t\t}\n\t\tw.Header().Set(\"X-Foo\", \"bar\")\n\t\tw.WriteHeader(backendStatus)\n\t\tw.Write([]byte(backendResponse))\n\t}))\n\tdefer backend.Close()\n\tbackendURL, err := url.Parse(backend.URL)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// setup Frontend using admin proxy\n\tmux := http.NewServeMux()\n\treverseProxy := &Prox{}\n\treverseProxy = New(backendURL.String())\n\tmux.HandleFunc(\"/\", reverseProxy.Handle)\n\n\tfrontend := httptest.NewServer(mux)\n\tdefer frontend.Close()\n\n\tgetReq, _ := http.NewRequest(\"GET\", frontend.URL, nil)\n\tgetReq.Host = \"some-name\"\n\tgetReq.Header.Set(\"Proxy-Connection\", \"should be deleted\")\n\tgetReq.Close = true\n\tres, err := http.DefaultClient.Do(getReq)\n\tif err != nil {\n\t\tt.Fatalf(\"Get: %v\", err)\n\t}\n\tif g, e := res.StatusCode, backendStatus; g != e {\n\t\tt.Errorf(\"got res.StatusCode %d; expected %d\", g, e)\n\t}\n\tif g, e := res.Header.Get(\"X-Foo\"), \"bar\"; g != e {\n\t\tt.Errorf(\"got X-Foo %q; expected %q\", g, e)\n\t}\n}", "title": "" }, { "docid": "596eb32038144e9a65b834d4a8fc5926", "score": "0.51765597", "text": "func Test_DockerHubSource(t *testing.T) {\n\tvar called bool\n\tdownstream := newDownstream(t, expectedDockerhub, &called)\n\tdefer downstream.Close()\n\n\tendpoint := Endpoint{Source: DockerHub, KeyPath: \"dockerhub_key\"}\n\tfp, handler, err := HandlerFromEndpoint(\"test/fixtures\", downstream.URL, endpoint)\n\tassert.NoError(t, err)\n\n\thookServer := httptest.NewTLSServer(handler)\n\tdefer hookServer.Close()\n\n\tc := hookServer.Client()\n\treq, err := http.NewRequest(\"POST\", hookServer.URL+\"/hook/\"+fp, bytes.NewReader(loadFixture(t, \"dockerhub_payload\")))\n\tassert.NoError(t, err)\n\n\tres, err := c.Do(req)\n\tassert.NoError(t, err)\n\tassert.True(t, called)\n\tassert.Equal(t, 200, res.StatusCode)\n}", "title": "" }, { "docid": "aabc457f17f4f20c8a32284647f34e04", "score": "0.5173625", "text": "func TestIntegration(t *testing.T) {\n\tstatus := statusHandler(404) // always returns 404\n\tts := httptest.NewServer(&status) // fake server (third-party)\n\tdefer ts.Close()\n\n\t// override with my own `sleep` implementation\n\tsleep := make(chan bool)\n\tpollSleep = func(time.Duration) {\n\t\tsleep <- true // notify that I'm start sleeping.\n\t\tsleep <- true // notify that I can leave.\n\t}\n\tdone := make(chan bool)\n\tpollDone = func() {\n\t\tdone <- true\n\t}\n\n\t// this is known as defer-closure.\n\t// consider other test might access, and causing dead-lock, it's good virtue\n\t// to put back where it was after used\n\tdefer func() {\n\t\tpollSleep = time.Sleep\n\t\tpollDone = func() {}\n\t}()\n\n\ts := NewServer(\"1.x\", ts.URL, 1*time.Millisecond) // polls from fake server\n\n\t<-sleep // goto nextline only after I've received a notification that my Poll has make the first isTagged()\n\tr, _ := http.NewRequest(\"GET\", \"/\", nil) // fake client with GET requests\n\tw := httptest.NewRecorder()\n\n\ts.ServeHTTP(w, r) // triggers handler with a recorder\n\n\tif b := w.Body.String(); !strings.Contains(b, \"No.\") {\n\t\tt.Errorf(\"body = %q, wanted no\", b)\n\t}\n\n\tstatus = 200 //update status of faked third party server (there's a race)\n\n\t<-sleep // allow my own server to exit and goto next loop and call isTagged() again to receive the 200.\n\n\t// now, we no longer needs to sleep in testing, we got channel to synchronize\n\t//time.Sleep(20 * time.Millisecond) // otherwise no time for server to poll again.\n\n\t<-done // make sure only my client only request after the state is updated to YES.\n\tw = httptest.NewRecorder()\n\ts.ServeHTTP(w, r)\n\n\tif b := w.Body.String(); !strings.Contains(b, \"YES!\") {\n\t\tt.Errorf(\"body = %q, wanted yes!\", b)\n\t}\n\n}", "title": "" }, { "docid": "8e2484dfedec60c7ea9e1c3d9edf35de", "score": "0.51650596", "text": "func createMockedHTTPServer(statusCode int, body string) *httptest.Server {\n\ttestServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {\n\t\tres.WriteHeader(statusCode)\n\n\t\tif _, err := res.Write([]byte(body)); err != nil {\n\t\t\tlog.Fatalln(\"Failed to write body.\", err)\n\t\t}\n\t}))\n\n\t// Give enough time to start, and be ready.\n\ttime.Sleep(1 * time.Second)\n\n\treturn testServer\n}", "title": "" }, { "docid": "c9fc6d0897b91c697ff8a75b36cbef94", "score": "0.51626056", "text": "func TestListener(t *testing.T) {\n\tlistener := &fakeListener{}\n\tdoh, _ := NewTransport(testURL, ips, nil, nil, listener)\n\ttransport := doh.(*transport)\n\trt := makeTestRoundTripper()\n\ttransport.client.Transport = rt\n\n\tgo func() {\n\t\treq := <-rt.req\n\t\ttrace := httptrace.ContextClientTrace(req.Context())\n\t\ttrace.GotConn(httptrace.GotConnInfo{\n\t\t\tConn: &fakeConn{\n\t\t\t\tremoteAddr: &net.TCPAddr{\n\t\t\t\t\tIP: net.ParseIP(\"192.0.2.2\"),\n\t\t\t\t\tPort: 443,\n\t\t\t\t}}})\n\n\t\tr, w := io.Pipe()\n\t\trt.resp <- &http.Response{\n\t\t\tStatusCode: 200,\n\t\t\tBody: r,\n\t\t\tRequest: &http.Request{URL: parsedURL},\n\t\t}\n\t\tw.Write([]byte{0, 0, 8, 9, 10})\n\t\tw.Close()\n\t}()\n\n\tdoh.Query(simpleQueryBytes)\n\ts := listener.summary\n\tif s.Latency < 0 {\n\t\tt.Errorf(\"Negative latency: %f\", s.Latency)\n\t}\n\tif !bytes.Equal(s.Query, simpleQueryBytes) {\n\t\tt.Errorf(\"Wrong query: %v\", s.Query)\n\t}\n\tif !bytes.Equal(s.Response, []byte{0xbe, 0xef, 8, 9, 10}) {\n\t\tt.Errorf(\"Wrong response: %v\", s.Response)\n\t}\n\tif s.Server != \"192.0.2.2\" {\n\t\tt.Errorf(\"Wrong server IP string: %s\", s.Server)\n\t}\n\tif s.Status != Complete {\n\t\tt.Errorf(\"Wrong status: %d\", s.Status)\n\t}\n}", "title": "" }, { "docid": "6c57e4be538af1d2d77cfa373e8ef172", "score": "0.51582384", "text": "func TestHttpTestSuite(t *testing.T) {\n\tsuite.Run(t, new(HTTPTestSuite))\n}", "title": "" }, { "docid": "d02d5c25f6cc116b0505d67e79ed04bf", "score": "0.51459265", "text": "func (s *ServerSuite) TestTwoHosts(c *C) {\n\te := testutils.NewResponder(\"Hi, I'm endpoint 1\")\n\tdefer e.Close()\n\n\te2 := testutils.NewResponder(\"Hi, I'm endpoint 2\")\n\tdefer e2.Close()\n\n\tc.Assert(s.mux.Start(), IsNil)\n\n\tb := MakeBatch(Batch{Addr: \"localhost:41000\", Route: `Host(\"localhost\") && Path(\"/\")`, URL: e.URL})\n\tb2 := MakeBatch(Batch{Addr: \"localhost:41000\", Route: `Host(\"otherhost\") && Path(\"/\")`, URL: e2.URL})\n\n\tc.Assert(s.mux.UpsertServer(b.BK, b.S), IsNil)\n\tc.Assert(s.mux.UpsertServer(b2.BK, b2.S), IsNil)\n\n\tc.Assert(s.mux.UpsertFrontend(b.F), IsNil)\n\tc.Assert(s.mux.UpsertFrontend(b2.F), IsNil)\n\n\tc.Assert(s.mux.UpsertListener(b.L), IsNil)\n\n\tc.Assert(GETResponse(c, b.FrontendURL(\"/\"), testutils.Host(\"localhost\")), Equals, \"Hi, I'm endpoint 1\")\n\tc.Assert(GETResponse(c, b.FrontendURL(\"/\"), testutils.Host(\"otherhost\")), Equals, \"Hi, I'm endpoint 2\")\n}", "title": "" }, { "docid": "5a03ea4ed19f8622018d5dda43f3da61", "score": "0.5116722", "text": "func (ts *IntegrationTestSuite) TestHandleUplinkEvent() {\n\tassert := require.New(ts.T())\n\tassert.NoError(ts.integration.HandleUplinkEvent(context.Background(), nil, pb.UplinkEvent{\n\t\tApplicationId: 1,\n\t\tDevEui: []byte{1, 2, 3, 4, 5, 6, 7, 8},\n\t}))\n\n\treq := <-ts.httpRequests\n\tassert.Equal(\"/rx\", req.URL.Path)\n}", "title": "" }, { "docid": "2ed572577d7a3703b6e4b617eca7da58", "score": "0.510522", "text": "func TestTwoserver(t *testing.T){\r\n\tserver_1, sCloseChan_1 :=YourServer(ServerAddr_1)\r\n\tserver_2, sCloseChan_2 := YourServer(ServerAddr_2)\r\n\tvar value int64\r\n\tserver_1.AddHandlerFunc(\"/add\", wrapYourAddFunc(&value))\r\n\tserver_1.AddHandlerFunc(\"/value\", wrapYourValueFunc(&value))\r\n\tserver_2.AddHandlerFunc(\"/add\", wrapYourAddFunc(&value))\r\n\tserver_2.AddHandlerFunc(\"/value\", wrapYourValueFunc(&value))\r\n\tc:=NewClientSize(5)\r\n\tfmt.Printf(\"Test: Connect to two different server...\\n\")\r\n\tincrReqNum, decrReqNum := 10, 20\r\n\ttype Status struct {\r\n\t\tflag bool\r\n\t\turl string\r\n\t\terr error\r\n\t}\t\r\n\twaitComplete_1 := make(chan Status, incrReqNum+decrReqNum)\r\n\twaitComplete_2 := make(chan Status, incrReqNum+decrReqNum)\r\n\tgo func() {\r\n\t\tfor i := 0; i < incrReqNum; i++ {\r\n\t\t\tgo func(ii int) {\r\n\t\t\t\treqBodyData := []byte(\"1\")\r\n\t\t\t\tif resp, err := c.Post(HTTPHost_1+\"/add\", int64(len(reqBodyData)),\r\n\t\t\t\t\tbytes.NewReader(reqBodyData)); err != nil || resp == nil {\r\n\t\t\t\t\twaitComplete_1 <- Status{flag: false, url: \"/add\", err: err}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresp.Body.Close()\r\n\t\t\t\t\twaitComplete_1 <- Status{flag: true}\r\n\t\t\t\t}\r\n\t\t\t}(i)\r\n\t\t}\r\n\t}()\r\n\r\n\tgo func() {\r\n\t\tfor i := 0; i < decrReqNum; i++ {\r\n\t\t\tgo func(ii int) {\r\n\t\t\t\treqBodyData := []byte(\"-1\")\r\n\t\t\t\tif resp, err := c.Post(HTTPHost_1+\"/add\", int64(len(reqBodyData)),\r\n\t\t\t\t\tbytes.NewReader(reqBodyData)); err != nil || resp == nil {\r\n\t\t\t\t\twaitComplete_1 <- Status{flag: false, url: \"/add\", err: err}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresp.Body.Close()\r\n\t\t\t\t\twaitComplete_1 <- Status{flag: true}\r\n\t\t\t\t}\r\n\t\t\t}(i)\r\n\t\t}\r\n\t}()\r\n\tgo func() {\r\n\t\ttime.Sleep(1*time.Second)\r\n\t\tfor i := 0; i < incrReqNum; i++ {\r\n\t\t\tgo func(ii int) {\r\n\t\t\t\treqBodyData := []byte(\"1\")\r\n\t\t\t\tif resp, err := c.Post(HTTPHost_2+\"/add\", int64(len(reqBodyData)),\r\n\t\t\t\t\tbytes.NewReader(reqBodyData)); err != nil || resp == nil {\r\n\t\t\t\t\twaitComplete_2 <- Status{flag: false, url: \"/add\", err: err}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresp.Body.Close()\r\n\t\t\t\t\twaitComplete_2 <- Status{flag: true}\r\n\t\t\t\t}\r\n\t\t\t}(i)\r\n\t\t}\r\n\t}()\r\n\r\n\tgo func() {\r\n\t\ttime.Sleep(1*time.Second)\r\n\t\tfor i := 0; i < decrReqNum; i++ {\r\n\t\t\tgo func(ii int) {\r\n\t\t\t\treqBodyData := []byte(\"-1\")\r\n\t\t\t\tif resp, err := c.Post(HTTPHost_2+\"/add\", int64(len(reqBodyData)),\r\n\t\t\t\t\tbytes.NewReader(reqBodyData)); err != nil || resp == nil {\r\n\t\t\t\t\twaitComplete_2 <- Status{flag: false, url: \"/add\", err: err}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresp.Body.Close()\r\n\t\t\t\t\twaitComplete_2 <- Status{flag: true}\r\n\t\t\t\t}\r\n\t\t\t}(i)\r\n\t\t}\r\n\t}()\r\n\tfor i := 0; i < cap(waitComplete_1); i++ {\r\n\t\tselect {\r\n\t\tcase status := <-waitComplete_1:\r\n\t\t\tif !status.flag {\r\n\t\t\t\tt.Fatalf(\"Get(%v) failed, error:%v\", status.url, status.err)\r\n\t\t\t}\r\n\t\tcase <-time.After(time.Millisecond * 500):\r\n\t\t\tt.Fatalf(\"wait reply timeout\")\r\n\t\t}\r\n\t}\r\n\ttime.Sleep(1*time.Second)\r\n\tfor i := 0; i < cap(waitComplete_2); i++ {\r\n\t\tselect {\r\n\t\tcase status := <-waitComplete_2:\r\n\t\t\tif !status.flag {\r\n\t\t\t\tt.Fatalf(\"Get(%v) failed, error:%v\", status.url, status.err)\r\n\t\t\t}\r\n\t\tcase <-time.After(time.Millisecond * 500):\r\n\t\t\tt.Fatalf(\"wait reply timeout\")\r\n\t\t}\r\n\t}\r\n\r\n\texpectedValue := int64(2*(incrReqNum - decrReqNum))\r\n\tif value != expectedValue {\r\n\t\tt.Fatalf(\"value=%v, expected=%v\", value, expectedValue)\r\n\t}\r\n\tcheckClient(t, c, HTTPHost_1, \"/value\", MethodGet, []byte{}, StatusOK, []byte(strconv.Itoa(int(value))))\r\n\tcheckClient(t, c, HTTPHost_2, \"/value\", MethodGet, []byte{}, StatusOK, []byte(strconv.Itoa(int(value))))\r\n\r\n\tserver_1.Close()\r\n\tif err := <-sCloseChan_1; err == nil {\r\n\t\tfmt.Printf(\"Server1 closed\\n\")\r\n\t} else {\r\n\t\tt.Fatalf(\"%v\", err)\r\n\t}\r\n\tserver_2.Close()\r\n\tif err := <-sCloseChan_2; err == nil {\r\n\t\tfmt.Printf(\"Server2 closed\\n\")\r\n\t} else {\r\n\t\tt.Fatalf(\"%v\", err)\r\n\t}\r\n\tfmt.Printf(\" ... Passed\\n\")\r\n}", "title": "" }, { "docid": "bd75fed3c46a2ba90487ae4252d88cbb", "score": "0.5099863", "text": "func init() {\n\tserverDown = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write([]byte(`hello`))\n\t\t\t},\n\t\t),\n\t)\n\tdefer func() { serverDown.Close() }()\n\n\tserverBadBody = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write([]byte(`<!# SOME BAD--XML_/__.*__\\\\fhji(*&^%^%<Boo<HA/>/>$%^&Y*(J)OPKL:/>`))\n\t\t\t},\n\t\t),\n\t)\n\n\t// init test servers...\n\tserverPNRDetails = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write(samplePNRRes)\n\t\t\t},\n\t\t),\n\t)\n\t//defer func() { serverPNRDetails.Close() }()\n\n\tserverBizLogic = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write(samplePNRResWarnBizLogic)\n\t\t\t},\n\t\t),\n\t)\n\t//defer func() { serverBizLogic.Close() }()\n\n\tserverEndTBizLogic = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write(sampleEndTBizLogic)\n\t\t\t},\n\t\t),\n\t)\n\n\tserverEndT = httptest.NewServer(\n\t\thttp.HandlerFunc(\n\t\t\tfunc(rs http.ResponseWriter, rq *http.Request) {\n\t\t\t\t_, _ = rs.Write(sampleEndTRS)\n\t\t\t},\n\t\t),\n\t)\n\t//defer func() { serverEndT.Close() }()\n}", "title": "" }, { "docid": "8eaed913b13da4351dd4e0b3f2f054db", "score": "0.50930464", "text": "func GetTestHTTPServer(route string, bindPort string, response string) *http.Server {\n\tserver := &http.Server{Addr: \":\" + bindPort}\n\thandler := CreateHTTPHandlerWithResponse(response)\n\thttp.HandleFunc(route, handler)\n\treturn server\n}", "title": "" }, { "docid": "12f6da6c3dc14abe9ebe4c8eebe88c0e", "score": "0.5081556", "text": "func testHandler(t *testing.T, f keylightexporter.Fetcher, target string) *http.Response {\n\tt.Helper()\n\n\tsrv := httptest.NewServer(keylightexporter.NewHandler(prometheus.NewPedanticRegistry(), f))\n\tdefer srv.Close()\n\n\tu, err := url.Parse(srv.URL)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to parse URL: %v\", err)\n\t}\n\n\tq := u.Query()\n\tq.Set(\"target\", target)\n\tu.RawQuery = q.Encode()\n\n\tc := &http.Client{Timeout: 1 * time.Second}\n\tres, err := c.Get(u.String())\n\tif err != nil {\n\t\tt.Fatalf(\"failed to perform HTTP request: %v\", err)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "3c2cb411a95833a4af34d30d0ea1f2dc", "score": "0.50722456", "text": "func (c *Check) probeHTTP() error {\n\tclient := http.Client{\n\t\tTimeout: c.Timeout,\n\t}\n\n\tres, err := client.Get(c.URL.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"request returned %d expected code 200: %s\", res.StatusCode, res.Status)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2d34c429b59f478361136770c0567085", "score": "0.5065136", "text": "func (h *helloHandler) Sink(ctx context.Context, snk *sink.SinkRequest) error {\n\tlog.Println(\"received message:\", snk.Message)\n\treturn nil\n}", "title": "" }, { "docid": "c95391a91726f9c1a13c4324c4b07484", "score": "0.5062519", "text": "func (s) TestHandlerTransport_HandleStreams_MultiWriteStatus(t *testing.T) {\n\ttestHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) {\n\t\tif want := \"/service/foo.bar\"; s.method != want {\n\t\t\tt.Errorf(\"stream method = %q; want %q\", s.method, want)\n\t\t}\n\t\tst.bodyw.Close() // no body\n\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(5)\n\t\tfor i := 0; i < 5; i++ {\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tst.ht.WriteStatus(s, status.New(codes.OK, \"\"))\n\t\t\t}()\n\t\t}\n\t\twg.Wait()\n\t})\n}", "title": "" }, { "docid": "e329d4ad61ec1347b41fdb8ce2e250ad", "score": "0.5060642", "text": "func testingHTTPClient(handler http.Handler) (*http.Client, func()) {\n\tserver := httptest.NewServer(handler)\n\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(_ context.Context, network, _ string) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, server.Listener.Addr().String())\n\t\t\t},\n\t\t},\n\t}\n\n\treturn client, server.Close\n}", "title": "" }, { "docid": "e2d44c468cdab06ab978451b8cb60d86", "score": "0.50551057", "text": "func TestServerWithHandler(url *regexp.Regexp, handler http.HandlerFunc) *httptest.Server {\n\treturn TestServerWithHandlerWithGeoPolling(url, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.URL.Path == geoProxyEndpointPath {\n\t\t\treturn\n\t\t}\n\n\t\thandler(w, r)\n\t}))\n}", "title": "" }, { "docid": "bc554e997144cb148060f068ee1c2e8d", "score": "0.5053446", "text": "func (s) TestHandlerTransport_Drain(t *testing.T) {\n\tdefer func() { recover() }()\n\tst := newHandleStreamTest(t)\n\tst.ht.Drain(\"whatever\")\n\tt.Errorf(\"serverHandlerTransport.Drain() should have panicked\")\n}", "title": "" }, { "docid": "234e06cc6d4f77b38302943354e44f68", "score": "0.5051859", "text": "func newWSTester(serverHandle func(*WSConn)) *wsTester {\n\t// Define a handler to upgrade the connection to a websocket.\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n\t\tupgrader := websocket.Upgrader{\n\t\t\tReadBufferSize: 1024,\n\t\t\tWriteBufferSize: 1024,\n\t\t}\n\t\tconn, err := upgrader.Upgrade(w, req, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tserverHandle(newWSConn(conn))\n\t})\n\t// Get a listener.\n\tl, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Declare a server and run it.\n\tserver := &http.Server{\n\t\tAddr: l.Addr().String(),\n\t\tHandler: mux,\n\t}\n\t// Create the tester.\n\ttester := &wsTester{\n\t\tserver: server,\n\t\turl: fmt.Sprintf(\"ws://%v\", l.Addr().String()),\n\t}\n\ttester.wg.Add(1)\n\tgo func() {\n\t\tdefer tester.wg.Done()\n\t\t_ = server.Serve(l)\n\t}()\n\treturn tester\n}", "title": "" }, { "docid": "b5fa4abd0b4c31067aec0f063e852799", "score": "0.5051106", "text": "func (m *MockedNextHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tm.hasBeenCalled = true\n\tm.request = r\n\tw.Write([]byte(\"Next handler has been called\"))\n\tw.WriteHeader(200)\n}", "title": "" }, { "docid": "4961fec16f1312eca2fbfbb3bcfd63b9", "score": "0.5046498", "text": "func emit(final bool) error {\n\tif !enabled {\n\t\treturn fmt.Errorf(\"telemetry not enabled\")\n\t}\n\n\t// some metrics are updated/set at time of emission\n\tsetEmitTimeMetrics()\n\n\t// ensure only one update happens at a time;\n\t// skip update if previous one still in progress\n\tupdateMu.Lock()\n\tif updating {\n\t\tupdateMu.Unlock()\n\t\tlog.Println(\"[NOTICE] Skipping this telemetry update because previous one is still working\")\n\t\treturn nil\n\t}\n\tupdating = true\n\tupdateMu.Unlock()\n\tdefer func() {\n\t\tupdateMu.Lock()\n\t\tupdating = false\n\t\tupdateMu.Unlock()\n\t}()\n\n\t// terminate any pending update if this is the last one\n\tif final {\n\t\tstopUpdateTimer()\n\t}\n\n\tpayloadBytes, err := makePayloadAndResetBuffer()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// this will hold the server's reply\n\tvar reply Response\n\n\t// transmit the payload - use a loop to retry in case of failure\n\tfor i := 0; i < 4; i++ {\n\t\tif i > 0 && err != nil {\n\t\t\t// don't hammer the server; first failure might have been\n\t\t\t// a fluke, but back off more after that\n\t\t\tlog.Printf(\"[WARNING] Sending telemetry (attempt %d): %v - backing off and retrying\", i, err)\n\t\t\ttime.Sleep(time.Duration((i+1)*(i+1)*(i+1)) * time.Second)\n\t\t}\n\n\t\t// send it\n\t\tvar resp *http.Response\n\t\tresp, err = httpClient.Post(endpoint+instanceUUID.String(), \"application/json\", bytes.NewReader(payloadBytes))\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// check for any special-case response codes\n\t\tif resp.StatusCode == http.StatusGone {\n\t\t\t// the endpoint has been deprecated and is no longer servicing clients\n\t\t\terr = fmt.Errorf(\"telemetry server replied with HTTP %d; upgrade required\", resp.StatusCode)\n\t\t\tif clen := resp.Header.Get(\"Content-Length\"); clen != \"0\" && clen != \"\" {\n\t\t\t\tbodyBytes, readErr := ioutil.ReadAll(resp.Body)\n\t\t\t\tif readErr != nil {\n\t\t\t\t\tlog.Printf(\"[ERROR] Reading response body from server: %v\", readErr)\n\t\t\t\t}\n\t\t\t\terr = fmt.Errorf(\"%v - %s\", err, bodyBytes)\n\t\t\t}\n\t\t\tresp.Body.Close()\n\t\t\treply.Stop = true\n\t\t\tbreak\n\t\t}\n\t\tif resp.StatusCode == http.StatusUnavailableForLegalReasons {\n\t\t\t// the endpoint is unavailable, at least to this client, for legal reasons (!)\n\t\t\terr = fmt.Errorf(\"telemetry server replied with HTTP %d %s: please consult the project website and developers for guidance\", resp.StatusCode, resp.Status)\n\t\t\tif clen := resp.Header.Get(\"Content-Length\"); clen != \"0\" && clen != \"\" {\n\t\t\t\tbodyBytes, readErr := ioutil.ReadAll(resp.Body)\n\t\t\t\tif readErr != nil {\n\t\t\t\t\tlog.Printf(\"[ERROR] Reading response body from server: %v\", readErr)\n\t\t\t\t}\n\t\t\t\terr = fmt.Errorf(\"%v - %s\", err, bodyBytes)\n\t\t\t}\n\t\t\tresp.Body.Close()\n\t\t\treply.Stop = true\n\t\t\tbreak\n\t\t}\n\n\t\t// okay, ensure we can interpret the response\n\t\tif ct := resp.Header.Get(\"Content-Type\"); (resp.StatusCode < 300 || resp.StatusCode >= 400) &&\n\t\t\t!strings.Contains(ct, \"json\") {\n\t\t\terr = fmt.Errorf(\"telemetry server replied with unknown content-type: '%s' and HTTP %s\", ct, resp.Status)\n\t\t\tresp.Body.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\t// read the response body\n\t\terr = json.NewDecoder(resp.Body).Decode(&reply)\n\t\tresp.Body.Close() // close response body as soon as we're done with it\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// update the list of enabled/disabled keys, if any\n\t\tfor _, key := range reply.EnableKeys {\n\t\t\tdisabledMetricsMu.Lock()\n\t\t\t// only re-enable this metric if it is temporarily disabled\n\t\t\tif temp, ok := disabledMetrics[key]; ok && temp {\n\t\t\t\tdelete(disabledMetrics, key)\n\t\t\t}\n\t\t\tdisabledMetricsMu.Unlock()\n\t\t}\n\t\tfor _, key := range reply.DisableKeys {\n\t\t\tdisabledMetricsMu.Lock()\n\t\t\tdisabledMetrics[key] = true // all remotely-disabled keys are \"temporarily\" disabled\n\t\t\tdisabledMetricsMu.Unlock()\n\t\t}\n\n\t\t// make sure we didn't send the update too soon; if so,\n\t\t// just wait and try again -- this is a special case of\n\t\t// error that we handle differently, as you can see\n\t\tif resp.StatusCode == http.StatusTooManyRequests {\n\t\t\tif reply.NextUpdate <= 0 {\n\t\t\t\traStr := resp.Header.Get(\"Retry-After\")\n\t\t\t\tif ra, err := strconv.Atoi(raStr); err == nil {\n\t\t\t\t\treply.NextUpdate = time.Duration(ra) * time.Second\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !final {\n\t\t\t\tlog.Printf(\"[NOTICE] Sending telemetry: we were too early; waiting %s before trying again\", reply.NextUpdate)\n\t\t\t\ttime.Sleep(reply.NextUpdate)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if resp.StatusCode >= 400 {\n\t\t\terr = fmt.Errorf(\"telemetry server returned status code %d\", resp.StatusCode)\n\t\t\tcontinue\n\t\t}\n\n\t\tbreak\n\t}\n\tif err == nil && !final {\n\t\t// (remember, if there was an error, we return it\n\t\t// below, so it WILL get logged if it's supposed to)\n\t\tlog.Println(\"[INFO] Sending telemetry: success\")\n\t}\n\n\t// even if there was an error after all retries, we should\n\t// schedule the next update using our default update\n\t// interval because the server might be healthy later\n\n\t// ensure we won't slam the telemetry server; add a little variance\n\tif reply.NextUpdate < 1*time.Second {\n\t\treply.NextUpdate = defaultUpdateInterval + time.Duration(rand.Int63n(int64(1*time.Minute)))\n\t}\n\n\t// schedule the next update (if this wasn't the last one and\n\t// if the remote server didn't tell us to stop sending)\n\tif !final && !reply.Stop {\n\t\tupdateTimerMu.Lock()\n\t\tupdateTimer = time.AfterFunc(reply.NextUpdate, func() {\n\t\t\tlogEmit(false)\n\t\t})\n\t\tupdateTimerMu.Unlock()\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "f18ef77950750df70e4e924f75da24de", "score": "0.50439835", "text": "func testingHTTPClient(handler http.Handler) (*http.Client, func()) {\n\ts := httptest.NewServer(handler)\n\n\tcli := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(_ context.Context, network, _ string) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, s.Listener.Addr().String())\n\t\t\t},\n\t\t},\n\t}\n\n\treturn cli, s.Close\n}", "title": "" }, { "docid": "b4a0b1634ce71eb0c2fdac12ae3efbba", "score": "0.5027382", "text": "func (m *mockEndpoint) start() (*url.URL, *url.URL, *url.URL) {\n\taddrC := make(chan net.Addr, 1)\n\n\tm.stopper.Add(1)\n\tgo func() {\n\t\tdefer m.stopper.Done()\n\n\t\tlistener, err := net.Listen(\"tcp\", \":\")\n\t\trequire.NoError(m.t, err)\n\n\t\taddrC <- listener.Addr()\n\n\t\t_ = m.collectorServer.Serve(listener)\n\t}()\n\n\tcollectorAddr := <-addrC\n\n\tm.stopper.Add(1)\n\tgo func() {\n\t\tdefer m.stopper.Done()\n\n\t\tlistener, err := net.Listen(\"tcp\", \":\")\n\t\trequire.NoError(m.t, err)\n\n\t\taddrC <- listener.Addr()\n\n\t\t_ = m.eventsServer.Serve(listener)\n\t}()\n\n\teventsAddr := <-addrC\n\n\tm.stopper.Add(1)\n\tgo func() {\n\t\tdefer m.stopper.Done()\n\n\t\tlistener, err := net.Listen(\"tcp\", \":\")\n\t\trequire.NoError(m.t, err)\n\n\t\taddrC <- listener.Addr()\n\n\t\t_ = m.orchestratorServer.Serve(listener)\n\t}()\n\n\torchestratorAddr := <-addrC\n\n\tclose(addrC)\n\n\tcollectorEndpoint, err := url.Parse(fmt.Sprintf(\"http://%s\", collectorAddr.String()))\n\trequire.NoError(m.t, err)\n\n\teventsEndpoint, err := url.Parse(fmt.Sprintf(\"http://%s\", eventsAddr.String()))\n\trequire.NoError(m.t, err)\n\n\torchestratorEndpoint, err := url.Parse(fmt.Sprintf(\"http://%s\", orchestratorAddr.String()))\n\trequire.NoError(m.t, err)\n\n\treturn collectorEndpoint, eventsEndpoint, orchestratorEndpoint\n}", "title": "" }, { "docid": "3949f60476fb441e0fa16cda43d0b9bd", "score": "0.50223255", "text": "func TestRealServerIsStartedAndShutsDown(t *testing.T) {\n\tconst testEndpoint = \"127.0.0.1:8087\"\n\tvar handlerRespBody = []byte(\"hello world!\")\n\thttp.Handle(\"/hello-world\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write(handlerRespBody)\n\t}))\n\tshutdown := make(chan os.Signal)\n\tgo func() {\n\t\t// give the server some time to start up\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\tresp, err := http.Get(\"http://\" + testEndpoint + \"/hello-world\")\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"got error when sending request: %v\", err))\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tsut, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"got error when reading response: %v\", err))\n\t\t}\n\t\tif got, want := string(sut), string(handlerRespBody); got != want {\n\t\t\tt.Errorf(\"got response body %q, wanted %q\", got, want)\n\t\t}\n\t\tshutdown <- os.Interrupt\n\t}()\n\tsrv := &http.Server{Addr: testEndpoint, Handler: http.DefaultServeMux}\n\tif err := httpshutdown.ListenAndServe(srv, 0, shutdown); err != nil {\n\t\tpanic(fmt.Sprintf(\"server shutdown unexpectedly: %v\", err))\n\t}\n}", "title": "" }, { "docid": "3b0ce9c4a9144afff32ab0b2a84dfb34", "score": "0.50195724", "text": "func setupMockBroker(auth bool) *httptest.Server {\n\tmux := http.NewServeMux()\n\tvar authFunc func(inner http.HandlerFunc) http.HandlerFunc\n\n\tif auth {\n\t\t// Use the foo/bar basic authentication middleware in publish_test.go\n\t\tauthFunc = func(inner http.HandlerFunc) http.HandlerFunc {\n\t\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tif checkAuth(w, r) {\n\t\t\t\t\tlog.Println(\"[DEBUG] broker - authenticated!\")\n\t\t\t\t\tinner.ServeHTTP(w, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Broker Authentication Required\"`)\n\t\t\t\tw.WriteHeader(401)\n\t\t\t\tw.Write([]byte(\"401 Unauthorized\\n\"))\n\t\t\t})\n\t\t}\n\t} else {\n\t\t// Create a do-nothing authentication middleware\n\t\tauthFunc = func(inner http.HandlerFunc) http.HandlerFunc {\n\t\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tlog.Println(\"[DEBUG] broker - no authentication\")\n\t\t\t\tinner.ServeHTTP(w, r)\n\t\t\t})\n\t\t}\n\t}\n\n\tserver := httptest.NewServer(mux)\n\n\t// Find latest 'bobby' consumers (no tag)\n\t// curl --user pactuser:pact -H \"accept: application/hal+json\" \"http://pact.onegeek.com.au/pacts/provider/bobby/latest\"\n\tmux.HandleFunc(\"/pacts/provider/bobby/latest\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] get pacts for provider 'bobby'\")\n\t\tfmt.Fprintf(w, `{\"_links\":{\"self\":{\"href\":\"%s/pacts/provider/bobby/latest\",\"title\":\"Latest pact versions for the provider bobby\"},\"provider\":{\"href\":\"%s/pacticipants/bobby\",\"title\":\"bobby\"},\"pb:pacts\":[{\"href\":\"%s/pacts/provider/bobby/consumer/jessica/version/2.0.0\",\"title\":\"Pact between jessica (v2.0.0) and bobby\",\"name\":\"jessica\"},{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\",\"title\":\"Pact between billy (v1.0.0) and bobby\",\"name\":\"billy\"}],\"pacts\":[{\"href\":\"%s/pacts/provider/bobby/consumer/jessica/version/2.0.0\",\"title\":\"OLD Pact between jessica (v2.0.0) and bobby\",\"name\":\"jessica\"},{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\",\"title\":\"OLD Pact between billy (v1.0.0) and bobby\",\"name\":\"billy\"}]}}`, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL)\n\t\tw.Header().Add(\"Content-Type\", \"application/hal+json\")\n\t}))\n\n\t// Find 'bobby' consumers for tag 'prod'\n\t// curl --user pactuser:pact -H \"accept: application/hal+json\" \"http://pact.onegeek.com.au/pacts/provider/bobby/latest/sit4\"\n\tmux.Handle(\"/pacts/provider/bobby/latest/prod\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] get all pacts for provider 'bobby' where the tag 'prod' exists\")\n\t\tfmt.Fprintf(w, `{\"_links\":{\"self\":{\"href\":\"%s/pacts/provider/bobby/latest/dev\",\"title\":\"Latest pact versions for the provider bobby with tag 'dev'\"},\"provider\":{\"href\":\"%s/pacticipants/bobby\",\"title\":\"bobby\"},\"pb:pacts\":[{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\",\"title\":\"Pact between billy (v1.0.0) and bobby\",\"name\":\"billy\"}],\"pacts\":[{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\",\"title\":\"OLD Pact between billy (v1.0.0) and bobby\",\"name\":\"billy\"}]}}`, server.URL, server.URL, server.URL, server.URL)\n\t\tw.Header().Add(\"Content-Type\", \"application/hal+json\")\n\t}))\n\n\t// Broken response\n\tmux.Handle(\"/pacts/provider/bobby/latest/broken\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] broken broker\")\n\t\tfmt.Fprintf(w, `broken response`)\n\t\tw.Header().Add(\"Content-Type\", \"application/hal+json\")\n\t}))\n\n\t// 50x response\n\t// curl --user pactuser:pact -H \"accept: application/hal+json\" \"http://pact.onegeek.com.au/pacts/provider/bobby/latest/sit4\"\n\tmux.Handle(\"/pacts/provider/broken/latest/dev\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] broker broker response\")\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"500 Server Error\\n\"))\n\t}))\n\n\t// Find 'bobby' consumers for tag 'dev'\n\t// curl --user pactuser:pact -H \"accept: application/hal+json\" \"http://pact.onegeek.com.au/pacts/provider/bobby/latest/sit4\"\n\tmux.Handle(\"/pacts/provider/bobby/latest/dev\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] get all pacts for provider 'bobby' where the tag 'dev' exists\")\n\t\tfmt.Fprintf(w, `{\"_links\":{\"self\":{\"href\":\"%s/pacts/provider/bobby/latest/dev\",\"title\":\"Latest pact versions for the provider bobby with tag 'dev'\"},\"provider\":{\"href\":\"%s/pacticipants/bobby\",\"title\":\"bobby\"},\"pb:pacts\":[{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.1\",\"title\":\"Pact between billy (v1.0.1) and bobby\",\"name\":\"billy\"}],\"pacts\":[{\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.1\",\"title\":\"OLD Pact between billy (v1.0.1) and bobby\",\"name\":\"billy\"}]}}`, server.URL, server.URL, server.URL, server.URL)\n\t\tw.Header().Add(\"Content-Type\", \"application/hal+json\")\n\t}))\n\n\t// Actual Consumer Pact\n\t// curl -v --user pactuser:pact -H \"accept: application/json\" http://pact.onegeek.com.au/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\n\tmux.Handle(\"/pacts/provider/loginprovider/consumer/jmarie/version/\", authFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Println(\"[DEBUG] get all pacts for provider 'bobby' where any tag exists\")\n\t\tfmt.Fprintf(w, `{\"consumer\":{\"name\":\"billy\"},\"provider\":{\"name\":\"bobby\"},\"interactions\":[{\"description\":\"Some name for the test\",\"provider_state\":\"Some state\",\"request\":{\"method\":\"GET\",\"path\":\"/foobar\"},\"response\":{\"status\":200,\"headers\":{\"Content-Type\":\"application/json\"}}},{\"description\":\"Some name for the test\",\"provider_state\":\"Some state2\",\"request\":{\"method\":\"GET\",\"path\":\"/bazbat\"},\"response\":{\"status\":200,\"headers\":{},\"body\":[[{\"colour\":\"red\",\"size\":10,\"tag\":[[\"jumper\",\"shirt\"],[\"jumper\",\"shirt\"]]}]],\"matchingRules\":{\"$.body\":{\"min\":1},\"$.body[*].*\":{\"match\":\"type\"},\"$.body[*]\":{\"min\":1},\"$.body[*][*].*\":{\"match\":\"type\"},\"$.body[*][*].colour\":{\"match\":\"regex\",\"regex\":\"red|green|blue\"},\"$.body[*][*].size\":{\"match\":\"type\"},\"$.body[*][*].tag\":{\"min\":2},\"$.body[*][*].tag[*].*\":{\"match\":\"type\"},\"$.body[*][*].tag[*][0]\":{\"match\":\"type\"},\"$.body[*][*].tag[*][1]\":{\"match\":\"type\"}}}}],\"metadata\":{\"pactSpecificationVersion\":\"2.0.0\"},\"updatedAt\":\"2016-06-11T13:11:33+00:00\",\"createdAt\":\"2016-06-09T12:46:42+00:00\",\"_links\":{\"self\":{\"title\":\"Pact\",\"name\":\"Pact between billy (v1.0.0) and bobby\",\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0\"},\"pb:consumer\":{\"title\":\"Consumer\",\"name\":\"billy\",\"href\":\"%s/pacticipants/billy\"},\"pb:provider\":{\"title\":\"Provider\",\"name\":\"bobby\",\"href\":\"%s/pacticipants/bobby\"},\"pb:latest-pact-version\":{\"title\":\"Pact\",\"name\":\"Latest version of this pact\",\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/latest\"},\"pb:previous-distinct\":{\"title\":\"Pact\",\"name\":\"Previous distinct version of this pact\",\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0/previous-distinct\"},\"pb:diff-previous-distinct\":{\"title\":\"Diff\",\"name\":\"Diff with previous distinct version of this pact\",\"href\":\"%s/pacts/provider/loginprovider/consumer/jmarie/version/1.0.0/diff/previous-distinct\"},\"pb:pact-webhooks\":{\"title\":\"Webhooks for the pact between billy and bobby\",\"href\":\"%s/webhooks/provider/bobby/consumer/billy\"},\"pb:tag-prod-version\":{\"title\":\"Tag this version as 'production'\",\"href\":\"%s/pacticipants/billy/versions/1.0.0/tags/prod\"},\"pb:tag-version\":{\"title\":\"Tag version\",\"href\":\"%s/pacticipants/billy/versions/1.0.0/tags/{tag}\"},\"curies\":[{\"name\":\"pb\",\"href\":\"%s/doc/{rel}\",\"templated\":true}]}}`, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL, server.URL)\n\t\tw.Header().Add(\"Content-Type\", \"application/hal+json\")\n\t}))\n\n\treturn server\n}", "title": "" }, { "docid": "242879e4184812b4fc5ecf3633cc65a7", "score": "0.50157225", "text": "func noSink(src *v1alpha1.AWSSNSSource) {\n\tsrc.Status.SinkURI = nil\n}", "title": "" }, { "docid": "a082d119dfe387dbd3652b948ad0e1c0", "score": "0.500429", "text": "func TestHandleConnection(t *testing.T) {\n\ts := SetUpSuite(t)\n\ts.checkHTTPResponse(t, s.clientCertificate, func(resp *http.Response) {\n\t\trequire.Equal(t, resp.StatusCode, http.StatusOK)\n\t\tbuf, err := io.ReadAll(resp.Body)\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, strings.TrimSpace(string(buf)), s.message)\n\t})\n}", "title": "" }, { "docid": "0d32c66872a65db522cda903d75b9aa5", "score": "0.49970886", "text": "func handlerTest(f func(ctx context.Context, t *testing.T, handler httpHandler, req *testRequest)) func(t *testing.T) {\n\ttestReq := &testRequest{}\n\treturn func(t *testing.T) {\n\t\tserver := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\t\tassert.Equal(t, request.URL.String(), testReq.url.String())\n\n\t\t\tvar err error\n\t\t\tif testReq.err != nil {\n\t\t\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\t\t\t_, err = writer.Write(testReq.err)\n\t\t\t} else {\n\t\t\t\twriter.WriteHeader(http.StatusOK)\n\t\t\t\t_, err = writer.Write(testReq.res)\n\t\t\t}\n\t\t\tassert.NoError(t, err)\n\t\t}))\n\t\tdefer server.Close()\n\n\t\th := httpHandler{\n\t\t\tclient: server.Client(),\n\t\t\tbase: server.URL,\n\t\t\tdebug: false,\n\t\t}\n\n\t\tf(context.Background(), t, h, testReq)\n\t}\n}", "title": "" }, { "docid": "b1f421cda97532a7ef3772245df05ce2", "score": "0.4995774", "text": "func testHttpClient() *http.Client {\n\treturn &http.Client{\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ac17fa24e5c91d4cb8d2db910596e42f", "score": "0.49905813", "text": "func init() {\n\tvar currentResp *http.Response\n\trequestHeaders := make(http.Header)\n\n\tRegisterSteps(func(c *Context) {\n\n\t\tc.Then(`^I should get an HTTP response code (\\d+) on path \"(.+?)\" through the tunnel \"(.+?)\"$`, func(expectedResponseCode int, path string, tunnelName string) {\n\t\t\ttunnel := c.GetTunnel(tunnelName)\n\t\t\tif tunnel == nil {\n\t\t\t\tc.Fail(\"Could not find a tunnel named '%s'\", tunnelName)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\turl := fmt.Sprintf(\"http://%s:%v%s\", \"localhost\", tunnel.LocalPort, path)\n\t\t\tresp, err := c.execHttpGetRequest(url, requestHeaders)\n\t\t\tcurrentResp = resp\n\t\t\tif err != nil {\n\t\t\t\tc.Fail(\"HTTP request on %s failed: %v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert.Equal(c.T, expectedResponseCode, resp.StatusCode)\n\t\t\tresp.Body.Close()\n\t\t})\n\n\t\tc.Then(`^This response has header \"(.+?)\" equals to \"(.+?)\"$`, func(name, expectedValue string) {\n\t\t\tassert.Equal(c.T, expectedValue, currentResp.Header.Get(name))\n\t\t})\n\n\t\tc.Then(`^This response has no header \"(.+?)\"$`, func(name string) {\n\t\t\tassert.NotContains(c.T, name, currentResp.Header)\n\t\t})\n\n\t\tc.Then(`^I should have the text \"(.+?)\" on path \"(.+?)\" through the tunnel \"(.+?)\"$`, func(expectedContentText string, path string, tunnelName string) {\n\t\t\ttunnel := c.GetTunnel(tunnelName)\n\t\t\tif tunnel == nil {\n\t\t\t\tc.Fail(\"Could not find a tunnel named '%s'\", tunnelName)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\turl := fmt.Sprintf(\"http://%s:%v%s\", \"localhost\", tunnel.LocalPort, path)\n\t\t\tresp, err := c.execHttpGetRequest(url, requestHeaders)\n\t\t\tif err != nil {\n\t\t\t\tc.Fail(\"HTTP request on %s failed: %v\", url, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdata, err := ioutil.ReadAll(resp.Body)\n\n\t\t\tassert.Contains(c.T, string(data), expectedContentText)\n\t\t\tresp.Body.Close()\n\t\t})\n\n\t\tc.Given(`^Using request header \"(.+?)\": \"(.+?)\"$`, func(name, value string) {\n\t\t\tfor _, v := range strings.Split(value, \";\") {\n\t\t\t\trequestHeaders.Add(name, v)\n\t\t\t}\n\t\t})\n\n\t})\n}", "title": "" }, { "docid": "b1d785e378c8e711c33ead13c62d517c", "score": "0.49859476", "text": "func (ep *MockEndPoint) Stub() *httptest.Server {\r\n\treturn httptest.NewServer(http.HandlerFunc(\r\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\r\n\t\t\tif r.RequestURI != ep.URL {\r\n\t\t\t\thttp.Error(w, \"not found\", http.StatusNotFound)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\t\t\tw.Write(ep.Message)\r\n\t\t}))\r\n}", "title": "" }, { "docid": "e0f1564491ff72674515da474c3234e6", "score": "0.4984404", "text": "func makeHTTPTestServerWithWriter(t testing.TB, w io.Writer, fnmc func(mc *config.MayaConfig)) *TestServer {\n\tdir, maya := makeMayaServer(t, fnmc)\n\tif w == nil {\n\t\tw = maya.logOutput\n\t}\n\tsrv, err := NewHTTPServer(maya, maya.config, w)\n\tif err != nil {\n\t\tt.Fatalf(\"err: %v\", err)\n\t}\n\ts := &TestServer{\n\t\tT: t,\n\t\tDir: dir,\n\t\tMaya: maya,\n\t\tServer: srv,\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f7de23abb5bb4ddfbe0425dea1f44581", "score": "0.49812472", "text": "func newWebSocketTestProxy(backendAddr string, insecure bool) *Proxy {\n\treturn &Proxy{\n\t\tNext: httpserver.EmptyNext, // prevents panic in some cases when test fails\n\t\tUpstreams: []Upstream{&fakeWsUpstream{\n\t\t\tname: backendAddr,\n\t\t\twithout: \"\",\n\t\t\tinsecure: insecure,\n\t\t}},\n\t}\n}", "title": "" }, { "docid": "02f2619874abf4b6c1627a9256c3dc96", "score": "0.4967064", "text": "func (c *MockConn) serve() {\n\tif tlsConn, ok := c.rwc.(*tls.Conn); ok {\n\t\tif err := tlsConn.Handshake(); err != nil {\n\t\t\treturn\n\t\t}\n\t\ttlsState := tlsConn.ConnectionState()\n\t\tproto := tlsState.NegotiatedProtocol\n\t\tif fn := c.server.Config.TLSNextProto[proto]; fn != nil {\n\t\t\th := c.server.Config.Handler\n\t\t\tfn(c.server.Config, tlsConn, h)\n\t\t}\n\t} else {\n\t\tfn := c.server.Handler\n\t\tfn(c.rwc)\n\t}\n}", "title": "" }, { "docid": "6d459cbb712623fa217d644e3228ddbd", "score": "0.49655235", "text": "func TestMessageHandler(t *testing.T) {\n log.SetOutput(ioutil.Discard)\n payload := Payload{\n Originator: \"Diogo\",\n Recipient: \"5531988174420\",\n Message: \"Test message\",\n }\n testRequest(payload, 200, 1, t)\n\n payload = Payload{\n Originator: \"\",\n Recipient: \"5531988174420\",\n Message: \"Test message\",\n }\n testRequest(payload, 400, 0, t)\n\n payload = Payload{\n Originator: \"Diogo\",\n Recipient: \"5531988174420\",\n Message: strings.Repeat(\"a\", 170),\n }\n testRequest(payload, 200, 2, t)\n}", "title": "" }, { "docid": "eefeb7afc21c0cb41561e8dd3edb2bd9", "score": "0.49643523", "text": "func TestInvalidEvents(t *testing.T) {\n\tassert := assert.New(t)\n\n\tw := webhook.W{\n\t\tUntil: time.Now().Add(60 * time.Second),\n\t}\n\tw.Config.URL = \"http://localhost:9999/foo\"\n\tw.Config.ContentType = \"application/json\"\n\n\tobs, err := OutboundSenderFactory{\n\t\tListener: w,\n\t\tClient: &http.Client{},\n\t\tCutOffPeriod: time.Second,\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tProfilerFactory: testServerProfilerFactory,\n\t\tLogger: getLogger(),\n\t}.New()\n\tassert.Nil(obs)\n\tassert.NotNil(err)\n\n\tw2 := webhook.W{\n\t\tUntil: time.Now().Add(60 * time.Second),\n\t\tEvents: []string{\"iot(.*\"},\n\t}\n\tw2.Config.URL = \"http://localhost:9999/foo\"\n\tw2.Config.ContentType = \"application/json\"\n\n\tobs, err = OutboundSenderFactory{\n\t\tListener: w2,\n\t\tClient: &http.Client{},\n\t\tCutOffPeriod: time.Second,\n\t\tNumWorkers: 10,\n\t\tQueueSize: 10,\n\t\tLogger: getLogger(),\n\t\tProfilerFactory: testServerProfilerFactory,\n\t}.New()\n\n\tassert.Nil(obs)\n\tassert.NotNil(err)\n}", "title": "" }, { "docid": "c71db26772bce9289b1544c08feba93b", "score": "0.49608016", "text": "func TestReturns200IfThereAreNoChecks(t *testing.T) {\n\trecorder := httptest.NewRecorder()\n\n\treq, err := http.NewRequest(\"GET\", \"https://fakeurl.com/debug/health\", nil)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to create request.\")\n\t}\n\n\tStatusHandler(recorder, req)\n\n\tif recorder.Code != 200 {\n\t\tt.Errorf(\"Did not get a 200.\")\n\t}\n}", "title": "" }, { "docid": "96fd25256dd2200f6028baba580db78f", "score": "0.49466357", "text": "func TestPreservesTLS(t *testing.T) {\n\tsrv := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"ok\"))\n\t})\n\tdefer srv.Close()\n\n\t// forwarder will proxy the request to whatever destination\n\tfwd, err := forward.New()\n\trequire.NoError(t, err)\n\n\tvar cs *tls.ConnectionState\n\t// this is our redirect to server\n\trdr := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tcs = req.TLS\n\t\treq.URL = testutils.ParseURI(srv.URL)\n\t\tfwd.ServeHTTP(w, req)\n\t})\n\n\t// stream handler will forward requests to redirect\n\tst, err := New(rdr)\n\trequire.NoError(t, err)\n\n\tproxy := httptest.NewUnstartedServer(st)\n\tproxy.StartTLS()\n\tdefer proxy.Close()\n\n\tre, _, err := testutils.Get(proxy.URL)\n\trequire.NoError(t, err)\n\tassert.Equal(t, http.StatusOK, re.StatusCode)\n\tassert.NotNil(t, cs)\n}", "title": "" }, { "docid": "acd0f7aa42fe68df6da26b45defc2fb6", "score": "0.49391246", "text": "func RegisterTestSink(ctx context.Context, t testing.T) context.Context {\n\tlogger, loggerOptions := newSink(t)\n\n\tctx = logging.SetSink(ctx, logger)\n\tctx = logging.SetSinkOptions(ctx, loggerOptions)\n\n\treturn ctx\n}", "title": "" }, { "docid": "d722164389a853825ed238f7ce9768ad", "score": "0.49279404", "text": "func targetEndpoint(srv *httptest.Server) string {\n\tu, _ := url.Parse(srv.URL)\n\treturn serverHostname + \":\" + u.Port()\n}", "title": "" }, { "docid": "9bd0b2269ef62bde244eb4b17a6e20fd", "score": "0.4922111", "text": "func TestHTTPSServer(t *testing.T) {\n\n\tcaCert := path.Join(assetsDir, \"rootCA.crt\")\n\tserverCert := path.Join(assetsDir, \"server.crt\")\n\tserverKey := path.Join(assetsDir, \"server.key\")\n\tclientCert := path.Join(assetsDir, \"client.crt\")\n\tclientKey := path.Join(assetsDir, \"client.key\")\n\tuntrustedClientCert := path.Join(assetsDir, \"other_client.crt\")\n\tuntrustedClientKey := path.Join(assetsDir, \"other_client.key\")\n\n\tauthServer := AuthServer{\n\t\tAddr: \":3457\",\n\t\tSpiffeID: \"spiffe://example.com/service\",\n\t\tCertFile: serverCert,\n\t\tKeyFile: serverKey,\n\t\tCaCert: caCert,\n\t\tCertValidator: validator.SvidValidator{},\n\t}\n\n\t// Run the HTTPS server\n\tgo func() {\n\t\tauthServer.Start()\n\t}()\n\n\t// Create a client with a trusted SpiffeID\n\tclient := createClient(clientCert, clientKey, caCert)\n\n\t// Perform a the authentication request\n\tres, err := client.Get(\"https://localhost:3457/auth\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\tt.Errorf(\"Response code was %v; want 200\", res.StatusCode)\n\t}\n\n\t// Create a client with an untrusted SpiffeID\n\tclient = createClient(untrustedClientCert, untrustedClientKey, caCert)\n\n\t// Perform a the authentication request\n\tres2, err := client.Get(\"https://localhost:3457/auth\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer res2.Body.Close()\n\n\tif res2.StatusCode != 401 {\n\t\tt.Errorf(\"Response code was %v; want 401\", res.StatusCode)\n\t}\n\n\t// Send signal to shutdown the server\n\tshutdown <- 1\n}", "title": "" }, { "docid": "4be5ff1a0c0314eb5a1e2a3a49ce1e1b", "score": "0.49211124", "text": "func CheckIfEndpointIsResponding(t *testing.T, endpoint string) bool {\r\n\t// we ignore certificates at this point\r\n\ttlsConfig := tls.Config{}\r\n\ttlsConfig.InsecureSkipVerify = true\r\n\r\n\terr := http_helper.HttpGetWithRetryWithCustomValidationE(\r\n\t\tt,\r\n\t\tfmt.Sprintf(\"https://%s\", endpoint),\r\n\t\t&tlsConfig,\r\n\t\t1,\r\n\t\t10*time.Second,\r\n\t\tfunc(statusCode int, body string) bool {\r\n\t\t\tif statusCode == 200 {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t\tif statusCode == 404 {\r\n\t\t\t\tt.Log(\"Warning: 404 response from endpoint. Test will still PASS.\")\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t\treturn false\r\n\t\t},\r\n\t)\r\n\treturn err == nil\r\n}", "title": "" }, { "docid": "57146442cb39b33c7ae58c946d107f82", "score": "0.4919395", "text": "func TestGetWrite(t *testing.T) {\n\t// set up test server and mocked LogStore\n\tmockLogStore := new(MockedLogStore)\n\tserver := newTestServer(mockLogStore)\n\ttestServer := httptest.NewServer(server.server.Handler)\n\tdefer testServer.Close()\n\tclient := testServer.Client()\n\n\t//\n\t// set up mock expectations\n\t//\n\n\t// LogStore.Ready() should succeed.\n\tmockLogStore.On(\"Ready\").Return(true, nil)\n\n\t//\n\t// make call\n\t//\n\tresp, _ := client.Get(testServer.URL + \"/write\")\n\t// should return 200\n\tassert.Equalf(t, http.StatusOK, resp.StatusCode, \"unexpected response code\")\n\tassert.Equalf(t, []string{\"application/json\"}, resp.Header[\"Content-Type\"], \"unexpected Content-Type\")\n\tassert.Equalf(t, `{\"healthy\":true,\"detail\":\"\"}`, readBody(t, resp), \"unexpected json response\")\n\n\t// verify that expected calls were made\n\tmockLogStore.AssertExpectations(t)\n}", "title": "" }, { "docid": "9d9628069b8beb1f9fd40e053793b93c", "score": "0.49187407", "text": "func NewTestHTTPServer() TestHTTPServer {\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(healthPath, healthFunc)\n\treturn &testHTTPServerImpl{\n\t\trouter: router,\n\t\tcallCounter: make(map[string]int),\n\t}\n}", "title": "" }, { "docid": "f1502837e5fc051f74965552b7c49c2c", "score": "0.4913538", "text": "func TestDirectOK(t *testing.T) {\n\treqTempl := \"GET /%s HTTP/1.1\\r\\nHost: %s\\r\\n\\r\\n\"\n\n\ttestOk := func(conn net.Conn, originURL *url.URL) {\n\t\treq := fmt.Sprintf(reqTempl, originURL.Path, originURL.Host)\n\t\tt.Log(\"\\n\" + req)\n\t\t_, err := conn.Write([]byte(req))\n\t\tif !assert.NoError(t, err, \"should write GET request\") {\n\t\t\tt.FailNow()\n\t\t}\n\n\t\tresp, _ := http.ReadResponse(bufio.NewReader(conn), nil)\n\t\tbuf, _ := ioutil.ReadAll(resp.Body)\n\t\tassert.Contains(t, string(buf[:]), originResponse, \"should read tunneled response\")\n\n\t}\n\n\ttestFail := func(conn net.Conn, originURL *url.URL) {\n\t\treq := fmt.Sprintf(reqTempl, originURL.Path, originURL.Host)\n\t\tt.Log(\"\\n\" + req)\n\t\t_, err := conn.Write([]byte(req))\n\t\tif !assert.NoError(t, err, \"should write GET request\") {\n\t\t\tt.FailNow()\n\t\t}\n\n\t\tresp, _ := http.ReadResponse(bufio.NewReader(conn), nil)\n\t\tassert.Equal(t, http.StatusBadRequest, resp.StatusCode, \"should fail\")\n\t\tdefer resp.Body.Close()\n\t}\n\n\ttestRoundTrip(t, httpProxyAddr, false, httpOriginServer, testOk)\n\ttestRoundTrip(t, tlsProxyAddr, true, httpOriginServer, testOk)\n\n\t// HTTPS can't be tunneled using Direct Proxying, as redirections\n\t// require a TLS handshake between the proxy and the origin\n\ttestRoundTrip(t, httpProxyAddr, false, tlsOriginServer, testFail)\n\ttestRoundTrip(t, tlsProxyAddr, true, tlsOriginServer, testFail)\n}", "title": "" }, { "docid": "19a3a002d7a8f030569e6e530b472924", "score": "0.4905701", "text": "func Test_GitHubSource(t *testing.T) {\n\tvar called bool\n\tdownstream := newDownstream(t, expectedGithub, &called)\n\tdefer downstream.Close()\n\n\t// NB key created with\n\t// ruby -rsecurerandom -e 'puts SecureRandom.hex(20)' > test/fixtures/github_key\n\t// as suggested in the GitHub docs.\n\tendpoint := Endpoint{Source: GitHub, KeyPath: \"github_key\"}\n\tfp, handler, err := HandlerFromEndpoint(\"test/fixtures\", downstream.URL, endpoint)\n\tassert.NoError(t, err)\n\n\thookServer := httptest.NewTLSServer(handler)\n\tdefer hookServer.Close()\n\n\tpayload := loadFixture(t, \"github_payload\")\n\n\tc := hookServer.Client()\n\n\t// First using application/json\n\treq, err := http.NewRequest(\"POST\", hookServer.URL+\"/hook/\"+fp, bytes.NewReader(payload))\n\tassert.NoError(t, err)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"X-GitHub-Event\", \"push\")\n\treq.Header.Add(\"X-Hub-Signature\", xHubSignature(payload, loadFixture(t, \"github_key\"))) // <-- same as in the endpoint\n\n\tres, err := c.Do(req)\n\tassert.NoError(t, err)\n\tassert.True(t, called)\n\tassert.Equal(t, 200, res.StatusCode)\n\n\tcalled = false\n\t// Now using form encoded\n\tform := url.Values{}\n\tform.Add(\"payload\", string(payload))\n\treq, err = http.NewRequest(\"POST\", hookServer.URL+\"/hook/\"+fp, strings.NewReader(form.Encode()))\n\tassert.NoError(t, err)\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Set(\"X-Github-Event\", \"push\")\n\treq.Header.Add(\"X-Hub-Signature\", xHubSignature([]byte(form.Encode()), loadFixture(t, \"github_key\"))) // <-- same as in the endpoint\n\n\tres, err = c.Do(req)\n\tassert.NoError(t, err)\n\tassert.True(t, called)\n\tassert.Equal(t, 200, res.StatusCode)\n\n\t// check that a bogus signature is rejected\n\tcalled = false\n\treq, err = http.NewRequest(\"POST\", hookServer.URL+\"/hook/\"+fp, bytes.NewReader(payload))\n\tassert.NoError(t, err)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"X-GitHub-Event\", \"push\")\n\treq.Header.Add(\"X-Hub-Signature\", xHubSignature(payload[1:] /* <-- i.e., not the same */, loadFixture(t, \"github_key\")))\n\tres, err = c.Do(req)\n\tassert.NoError(t, err)\n\tassert.False(t, called)\n\tassert.Equal(t, 401, res.StatusCode)\n}", "title": "" }, { "docid": "16bee4de623304c18ccf4c5fdf00d85e", "score": "0.49024943", "text": "func NewSink(config *config.Network) *Sink {\n\t// TODO: Make channel sizes configurable?\n\tret := &Sink{\n\t\tendpoints: make(map[string]*Endpoint),\n\t\tconfig: config,\n\t\teventChan: make(chan transports.Event, 10),\n\t\ttimeoutTimer: time.NewTimer(1 * time.Second),\n\t}\n\n\tret.timeoutTimer.Stop()\n\n\treturn ret\n}", "title": "" }, { "docid": "a2265a21b6584e3f1f1b43cc5f799faf", "score": "0.48925832", "text": "func TestSimpleWrpWithMatchers(t *testing.T) {\n\n\tassert := assert.New(t)\n\n\tm := []string{\"mac:112233445566\", \"mac:112233445565\"}\n\n\ttrans := &transport{}\n\tobs, err := simpleSetup(trans, time.Second, m)\n\tassert.Nil(err)\n\n\treq := simpleWrpRequest()\n\n\treq.PayloadAsWrp.TransactionUUID = \"1234\"\n\n\treq.PayloadAsWrp.Source = \"mac:112233445566\"\n\treq.PayloadAsWrp.Destination = \"iot\"\n\tobs.QueueWrp(req)\n\n\treq.PayloadAsWrp.Source = \"mac:112233445565\"\n\treq.PayloadAsWrp.Destination = \"test\"\n\tobs.QueueWrp(req)\n\n\treq.PayloadAsWrp.Source = \"mac:112233445560\"\n\treq.PayloadAsWrp.Destination = \"iot\"\n\tobs.QueueWrp(req)\n\n\treq.PayloadAsWrp.Source = \"mac:112233445560\"\n\treq.PayloadAsWrp.Destination = \"test\"\n\tobs.QueueWrp(req)\n\n\tobs.Shutdown(true)\n\n\tassert.Equal(int32(2), trans.i)\n}", "title": "" }, { "docid": "6cb7f79adf2e30f6b727123e12f301cb", "score": "0.48857194", "text": "func setupServer() (addr string) {\n\taddr = \"localhost:28087\"\n\n\tlog.Printf(\"Setting up test http server on %s\", addr)\n\n\ttestHandler := func(w http.ResponseWriter, req *http.Request) {\n\t\t//log.Println(req)\n\n\t\t_, ok := req.Header[\"X-Test\"]\n\t\tif !ok {\n\t\t\tw.WriteHeader(400)\n\t\t\tio.WriteString(w, \"Missing X-Test request header\")\n\t\t\tresponseC_ <- errOk_\n\t\t\tresponseC_ <- fmt.Errorf(\"Missing X-Test request header\")\n\t\t\treturn\n\t\t}\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\tw.WriteHeader(200)\n\t\t\tio.WriteString(w, GET_RESPONSE)\n\t\t\tresponseC_ <- errOk_\n\t\tcase \"POST\":\n\t\t\tw.WriteHeader(200)\n\t\t\t_, err := uio.Copy(w, req.Body)\n\t\t\treq.Body.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tresponseC_ <- err\n\t\t\t} else {\n\t\t\t\tresponseC_ <- errOk_\n\t\t\t}\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"Unknown request method: %s\", req.Method)\n\t\t\tlog.Println(err)\n\t\t\tresponseC_ <- err\n\t\t}\n\t}\n\thttp.HandleFunc(\"/test\", testHandler)\n\n\tgo func() {\n\t\tresponseC_ <- http.ListenAndServe(addr, nil)\n\t}()\n\ttime.Sleep(10 * time.Millisecond)\n\treturn\n}", "title": "" }, { "docid": "975b30f3635135f08cddb5b18018110a", "score": "0.48752517", "text": "func MakeTestsEndpoint(log slog.Instance, vm *vaultManager.VaultManager, dbHandler HealthCheckHandler) *TestsEndpoint {\n\tif log == nil {\n\t\tlog = slog.Scope(\"Tests\")\n\t} else {\n\t\tlog = log.SubScope(\"Tests\")\n\t}\n\n\treturn &TestsEndpoint{\n\t\tlog: log,\n\t\tvm: vm,\n\t\tdb: dbHandler,\n\t}\n}", "title": "" }, { "docid": "e72fa1d037d6bcf4dde0a78d4bfc5757", "score": "0.48707533", "text": "func new(config map[string]any, endpoint *fd.FD) (seccheck.Sink, error) {\n\tif endpoint == nil {\n\t\treturn nil, fmt.Errorf(\"remote sink requires an endpoint\")\n\t}\n\tr := &remote{\n\t\tendpoint: endpoint,\n\t\tinitialBackoff: 25 * time.Microsecond,\n\t\tmaxBackoff: 10 * time.Millisecond,\n\t}\n\tif retriesOpaque, ok := config[\"retries\"]; ok {\n\t\tretries, ok := retriesOpaque.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"retries %q is not an int\", retriesOpaque)\n\t\t}\n\t\tr.retries = int(retries)\n\t\tif float64(r.retries) != retries {\n\t\t\treturn nil, fmt.Errorf(\"retries %q is not an int\", retriesOpaque)\n\t\t}\n\t}\n\tif ok, backoff, err := parseDuration(config, \"backoff\"); err != nil {\n\t\treturn nil, err\n\t} else if ok {\n\t\tr.initialBackoff = backoff\n\t}\n\tif ok, backoff, err := parseDuration(config, \"backoff_max\"); err != nil {\n\t\treturn nil, err\n\t} else if ok {\n\t\tr.maxBackoff = backoff\n\t}\n\tif r.initialBackoff > r.maxBackoff {\n\t\treturn nil, fmt.Errorf(\"initial backoff (%v) cannot be larger than max backoff (%v)\", r.initialBackoff, r.maxBackoff)\n\t}\n\n\tlog.Debugf(\"Remote sink created, endpoint FD: %d, %+v\", r.endpoint.FD(), r)\n\treturn r, nil\n}", "title": "" }, { "docid": "c0e5256c416f0b9ea9a3d76de6f6e808", "score": "0.48697615", "text": "func GetTestWebsocketServer(route string, bindPort string, response string) *http.Server {\n\tserver := &http.Server{Addr: \":\" + bindPort}\n\n\thandler := CreateWebsocketHandlerWithResponse(response)\n\n\thttp.Handle(route, websocket.Handler(handler))\n\treturn server\n}", "title": "" }, { "docid": "fe77b12afc19cb74362776f8e78c112b", "score": "0.48690128", "text": "func connStream(t *testing.T) {\n}", "title": "" }, { "docid": "f52029e1cc65aa1486f14516b3b65a52", "score": "0.48638186", "text": "func (h *Handler) ExampletGetEndpoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Test GET endpoint is being hit now!\")\n\n\t// Call to some function to do some work.\n\t// If you get an error back from a function you can respond with a header\n\t// of some error to inform the user, e.g.\n\t// w.WriteHeader(http.StatusInternalServerError)\n\n\t// Build response if it was not received fom function.\n\tm := make(map[string]string)\n\tm[\"endpoint\"] = \"/v1/test\"\n\tm[\"result\"] = \"You have hit the GET test endpoint and it has answered!\"\n\n\t// Marshal response and write it back.\n\tw.WriteHeader(http.StatusOK)\n\trespondJSON, _ := json.Marshal(m)\n\tw.Write(respondJSON)\n}", "title": "" }, { "docid": "c0f9122e271d6e21f533d380562f631f", "score": "0.48615274", "text": "func SetupHTTP() {\n\tMux = http.NewServeMux()\n\tServer = httptest.NewServer(Mux)\n}", "title": "" }, { "docid": "5cec6d1266968cf7ff151e3faa3d76b1", "score": "0.48599768", "text": "func TestForwardHopHeaders(t *testing.T) {\n\tcalled := false\n\tvar outHeaders http.Header\n\tvar outHost, expectedHost string\n\tsrv := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {\n\t\tcalled = true\n\t\toutHeaders = req.Header\n\t\toutHost = req.Host\n\t\tw.Write([]byte(\"hello\"))\n\t})\n\tdefer srv.Close()\n\n\tf, err := New()\n\trequire.NoError(t, err)\n\n\tproxy := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {\n\t\treq.URL = testutils.ParseURI(srv.URL)\n\t\texpectedHost = req.URL.Host\n\t\tf.ServeHTTP(w, req)\n\t})\n\tdefer proxy.Close()\n\n\theaders := http.Header{\n\t\tConnection: []string{\"close\"},\n\t\tKeepAlive: []string{\"timeout=600\"},\n\t}\n\n\tre, body, err := testutils.Get(proxy.URL, testutils.Headers(headers))\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"hello\", string(body))\n\tassert.Equal(t, http.StatusOK, re.StatusCode)\n\tassert.Equal(t, true, called)\n\tassert.Equal(t, \"\", outHeaders.Get(Connection))\n\tassert.Equal(t, \"\", outHeaders.Get(KeepAlive))\n\tassert.Equal(t, expectedHost, outHost)\n}", "title": "" }, { "docid": "c83fc248ca5d5e1445cdffebd533d898", "score": "0.48588207", "text": "func RunTestReadWrite(t *testing.T, e1, e2 streams.StreamProvider) {\n\tserver := func(provider streams.StreamProvider) error {\n\t\tstream, err := provider.Listen(nil).Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor i := 1; ; i++ {\n\t\t\tb := make([]byte, i)\n\t\t\tn, err := stream.Read(b)\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tif n, err := stream.Write([]byte(\"goodbye\")); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t} else if n != 7 {\n\t\t\t\t\t\treturn fmt.Errorf(\"Unexpected number of bytes written: %d, expected 7\", n)\n\t\t\t\t\t}\n\t\t\t\t\treturn stream.Close()\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif n != i {\n\t\t\t\treturn fmt.Errorf(\"Unexpected number of bytes read: %d, expected %d\", n, i)\n\t\t\t}\n\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\tif b[j] != byte(j) {\n\t\t\t\t\treturn fmt.Errorf(\"Unexpected byte value: %x, expected %x\", b[j], j)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tclient := func(provider streams.StreamProvider) error {\n\t\tstream, err := provider.NewStream(nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i := 1; i < 254; i++ {\n\t\t\tb := make([]byte, i)\n\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\tb[j] = byte(j)\n\t\t\t}\n\t\t\tn, err := stream.Write(b)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif n != i {\n\t\t\t\treturn fmt.Errorf(\"Unexpected number of bytes written: %d, expected %d\", n, i)\n\t\t\t}\n\t\t}\n\t\t// Half close\n\t\tif err := stream.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tb := make([]byte, 7)\n\t\tn, err := stream.Read(b)\n\t\tif n != 7 {\n\t\t\treturn fmt.Errorf(\"Unexpected number of bytes read: %d, expected %d\", n, 7)\n\t\t}\n\t\tif expected := \"goodbye\"; string(b) != expected {\n\t\t\treturn fmt.Errorf(\"Unexpected value read: %s, expected %s\", b, expected)\n\t\t}\n\t\treturn nil\n\t}\n\trunTest(t, e1, e2, client, server)\n}", "title": "" }, { "docid": "4cda7f578f28efce04065b6090f8e2e7", "score": "0.4856268", "text": "func TestEchoHandler(t *testing.T) {\n\tmsg := \"42\"\n\tr := strings.NewReader(msg)\n\treq, err := http.NewRequest(\"POST\", \"/echo\", r)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response.\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(EchoHandler)\n\n\t// Our handlers satisfy http.Handler, so we can call their ServeHTTP method\n\t// directly and pass in our Request and ResponseRecorder.\n\thandler.ServeHTTP(rr, req)\n\n\t// Check the status code is what we expect.\n\tif status := rr.Code; status != http.StatusOK {\n\t\tt.Errorf(\"handler returned wrong status code: got %v want %v\",\n\t\t\tstatus, http.StatusOK)\n\t}\n\n\t// Check the response body is what we expect.\n\tif rr.Body.String() != msg {\n\t\tt.Errorf(\"handler returned unexpected body: got %v want %v\",\n\t\t\trr.Body.String(), msg)\n\t}\n}", "title": "" }, { "docid": "bfa9b056561e5e7b8d304494e2e66ede", "score": "0.48498726", "text": "func HttpTest() {\n\tStartHttpServer()\n}", "title": "" }, { "docid": "a2dd30f80c4e954665b5d972ff6d653d", "score": "0.48488313", "text": "func TestProbeHTTPSNoScheme(t *testing.T) {\n\tserver, certPEM, _, caFile, teardown, err := test.SetupHTTPSServer()\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tdefer teardown()\n\n\tserver.StartTLS()\n\tdefer server.Close()\n\n\tmodule := config.Module{\n\t\tTLSConfig: config.TLSConfig{\n\t\t\tCAFile: caFile,\n\t\t\tInsecureSkipVerify: false,\n\t\t},\n\t}\n\n\tu, err := url.Parse(server.URL)\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\n\tregistry := prometheus.NewRegistry()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), u.Host, module, registry); err != nil {\n\t\tt.Fatalf(\"error: %s\", err)\n\t}\n\n\tcert, err := newCertificate(certPEM)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tcheckCertificateMetrics(cert, registry, t)\n\tcheckOCSPMetrics([]byte{}, registry, t)\n\tcheckTLSVersionMetrics(\"TLS 1.3\", registry, t)\n}", "title": "" }, { "docid": "ede5494451f2392f498aabda7b738c87", "score": "0.4845806", "text": "func TestStream(handler Handler) Dialer {\n\ts1, s2 := sockPair()\n\treturn func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error) {\n\t\tgo func() {\n\t\t\terr := handler(context.TODO(), s1, meta)\n\t\t\tif err != nil {\n\t\t\t\tbklog.G(ctx).Error(err)\n\t\t\t}\n\t\t\ts1.Close()\n\t\t}()\n\t\treturn s2, nil\n\t}\n}", "title": "" }, { "docid": "1a07cf2240250d74008b5d70459e8814", "score": "0.4842791", "text": "func TestProbeHTTPS(t *testing.T) {\n\tserver, certPEM, _, caFile, teardown, err := test.SetupHTTPSServer()\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tdefer teardown()\n\n\tserver.StartTLS()\n\tdefer server.Close()\n\n\tmodule := config.Module{\n\t\tTLSConfig: config.TLSConfig{\n\t\t\tCAFile: caFile,\n\t\t\tInsecureSkipVerify: false,\n\t\t},\n\t}\n\n\tregistry := prometheus.NewRegistry()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tif err := ProbeHTTPS(ctx, newTestLogger(), server.URL, module, registry); err != nil {\n\t\tt.Fatalf(\"error: %s\", err)\n\t}\n\n\tcert, err := newCertificate(certPEM)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tcheckCertificateMetrics(cert, registry, t)\n\tcheckOCSPMetrics([]byte{}, registry, t)\n\tcheckTLSVersionMetrics(\"TLS 1.3\", registry, t)\n}", "title": "" } ]
1d8e0e0731190f38e9cc4b2a94ca40af
typeOrNil typechecks the type expression (or nil value) e and returns the typ of e, or nil. If e is neither a type nor nil, typOrNil returns Typ[Invalid].
[ { "docid": "e5c81fecbb149b0f6bf1336856e48088", "score": "0.84093815", "text": "func (check *Checker) typOrNil(e ast.Expr) Type {\n\tvar x operand\n\tcheck.rawExpr(&x, e, nil)\n\tswitch x.mode {\n\tcase invalid:\n\t\t// ignore - error reported before\n\tcase novalue:\n\t\tcheck.errorf(x.pos(), \"%s used as type\", &x)\n\tcase typexpr:\n\t\treturn x.typ\n\tcase value:\n\t\tif x.isNil() {\n\t\t\treturn nil\n\t\t}\n\t\tfallthrough\n\tdefault:\n\t\tcheck.errorf(x.pos(), \"%s is not a type\", &x)\n\t}\n\treturn Typ[Invalid]\n}", "title": "" } ]
[ { "docid": "90ad64d0fe1209db501974e8f27acdbc", "score": "0.64724255", "text": "func (check *Checker) exprOrType(x *operand, e ast.Expr, allowGeneric bool) {\n\tcheck.rawExpr(x, e, nil, allowGeneric)\n\tcheck.exclude(x, 1<<novalue)\n\tcheck.singleValue(x)\n}", "title": "" }, { "docid": "af3363ca18a5af10710ee48f7bc1e8a0", "score": "0.563605", "text": "func (e MenuEdges) TypeOrErr() (*Menutype, error) {\n\tif e.loadedTypes[1] {\n\t\tif e.Type == nil {\n\t\t\t// The edge type was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: menutype.Label}\n\t\t}\n\t\treturn e.Type, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"type\"}\n}", "title": "" }, { "docid": "9caa680f21f73b291e2f68028d0da589", "score": "0.5532006", "text": "func (t Type) Type() (Type, bool) {\n\tvar isnil = t.Is(Nil)\n\tif isnil {\n\t\tt ^= Nil // Remove nil from t\n\t}\n\t// Deal with nil case\n\tif t == 0 {\n\t\treturn Nil, isnil\n\t}\n\t// Deal with singular case\n\tif t.Is(Other) {\n\t\treturn t, isnil\n\t}\n\tif t.FlagString() != \"other\" {\n\t\treturn t, isnil\n\t}\n\t// Numerical cases, float,int,uint\n\tif t|NumberTypes == NumberTypes {\n\t\tswitch {\n\t\tcase t.Is(Float):\n\t\t\treturn Float, isnil\n\t\tcase t.Is(Int):\n\t\t\treturn Int, isnil\n\t\tdefault:\n\t\t\treturn Uint, isnil\n\t\t}\n\t}\n\t// Otherwise, string needs to be used to represent\n\treturn String, isnil\n}", "title": "" }, { "docid": "dd2f78b0b09a03eff873fb8c77cb92ef", "score": "0.55269045", "text": "func (check *Checker) typExprInternal(e ast.Expr, def *Named, path []*TypeName) Type {\n\tswitch e := e.(type) {\n\tcase *ast.BadExpr:\n\t\t// ignore - error reported before\n\n\tcase *ast.Ident:\n\t\tvar x operand\n\t\tcheck.ident(&x, e, def, path)\n\n\t\tswitch x.mode {\n\t\tcase typexpr:\n\t\t\ttyp := x.typ\n\t\t\tdef.setUnderlying(typ)\n\t\t\treturn typ\n\t\tcase invalid:\n\t\t\t// ignore - error reported before\n\t\tcase novalue:\n\t\t\tcheck.errorf(x.pos(), \"%s used as type\", &x)\n\t\tdefault:\n\t\t\tcheck.errorf(x.pos(), \"%s is not a type\", &x)\n\t\t}\n\n\tcase *ast.SelectorExpr:\n\t\tvar x operand\n\t\tcheck.selector(&x, e)\n\n\t\tswitch x.mode {\n\t\tcase typexpr:\n\t\t\ttyp := x.typ\n\t\t\tdef.setUnderlying(typ)\n\t\t\treturn typ\n\t\tcase invalid:\n\t\t\t// ignore - error reported before\n\t\tcase novalue:\n\t\t\tcheck.errorf(x.pos(), \"%s used as type\", &x)\n\t\tdefault:\n\t\t\tcheck.errorf(x.pos(), \"%s is not a type\", &x)\n\t\t}\n\n\tcase *ast.ParenExpr:\n\t\treturn check.typExpr(e.X, def, path)\n\n\tcase *ast.ArrayType:\n\t\tif e.Len != nil {\n\t\t\ttyp := new(Array)\n\t\t\tdef.setUnderlying(typ)\n\t\t\ttyp.len = check.arrayLength(e.Len)\n\t\t\ttyp.elem = check.typExpr(e.Elt, nil, path)\n\t\t\treturn typ\n\n\t\t} else {\n\t\t\ttyp := new(Slice)\n\t\t\tdef.setUnderlying(typ)\n\t\t\ttyp.elem = check.typ(e.Elt)\n\t\t\treturn typ\n\t\t}\n\n\tcase *ast.StructType:\n\t\ttyp := new(Struct)\n\t\tdef.setUnderlying(typ)\n\t\tcheck.structType(typ, e, path)\n\t\treturn typ\n\n\tcase *ast.StarExpr:\n\t\ttyp := new(Pointer)\n\t\tdef.setUnderlying(typ)\n\t\ttyp.base = check.typ(e.X)\n\t\treturn typ\n\n\tcase *ast.FuncType:\n\t\ttyp := new(Signature)\n\t\tdef.setUnderlying(typ)\n\t\tcheck.funcType(typ, nil, e)\n\t\treturn typ\n\n\tcase *ast.InterfaceType:\n\t\ttyp := new(Interface)\n\t\tdef.setUnderlying(typ)\n\t\tcheck.interfaceType(typ, e, def, path)\n\t\treturn typ\n\n\tcase *ast.MapType:\n\t\ttyp := new(Map)\n\t\tdef.setUnderlying(typ)\n\n\t\ttyp.key = check.typ(e.Key)\n\t\ttyp.elem = check.typ(e.Value)\n\n\t\t// spec: \"The comparison operators == and != must be fully defined\n\t\t// for operands of the key type; thus the key type must not be a\n\t\t// function, map, or slice.\"\n\t\t//\n\t\t// Delay this check because it requires fully setup types;\n\t\t// it is safe to continue in any case (was issue 6667).\n\t\tcheck.delay(func() {\n\t\t\tif !Comparable(typ.key) {\n\t\t\t\tcheck.errorf(e.Key.Pos(), \"invalid map key type %s\", typ.key)\n\t\t\t}\n\t\t})\n\n\t\treturn typ\n\n\tcase *ast.ChanType:\n\t\ttyp := new(Chan)\n\t\tdef.setUnderlying(typ)\n\n\t\tdir := SendRecv\n\t\tswitch e.Dir {\n\t\tcase ast.SEND | ast.RECV:\n\t\t\t// nothing to do\n\t\tcase ast.SEND:\n\t\t\tdir = SendOnly\n\t\tcase ast.RECV:\n\t\t\tdir = RecvOnly\n\t\tdefault:\n\t\t\tcheck.invalidAST(e.Pos(), \"unknown channel direction %d\", e.Dir)\n\t\t\t// ok to continue\n\t\t}\n\n\t\ttyp.dir = dir\n\t\ttyp.elem = check.typ(e.Value)\n\t\treturn typ\n\n\tdefault:\n\t\tcheck.errorf(e.Pos(), \"%s is not a type\", e)\n\t}\n\n\ttyp := Typ[Invalid]\n\tdef.setUnderlying(typ)\n\treturn typ\n}", "title": "" }, { "docid": "2dbf188098094d6cdabd49994069c032", "score": "0.54958165", "text": "func (n *Null) Type() Type { return NullType }", "title": "" }, { "docid": "8afda3f3eb8f06ccf8393ae1d0861e2a", "score": "0.5442838", "text": "func decodeTypeOrValue(decoder ValueDecoder, dc DecodeContext, vr bsonrw.ValueReader, t reflect.Type) (reflect.Value, error) {\n\ttd, _ := decoder.(typeDecoder)\n\treturn decodeTypeOrValueWithInfo(decoder, td, dc, vr, t, true)\n}", "title": "" }, { "docid": "d5fd89a83e231028b1de6f6a5fe7effb", "score": "0.54373103", "text": "func (b *exprFuncBuilder) varOrValueType(e Expr) (isVar bool, t eeType) {\r\n\tif va, ok := e.(Var); ok {\r\n\t\tt, ok := b.vartypes[va]\r\n\t\tif !ok {\r\n\t\t\tpanic(fmt.Errorf(\r\n\t\t\t\t\"all vars should be accounted for \"+\r\n\t\t\t\t\t\"before %T.%v is called\",\r\n\t\t\t\tb, errutil.Caller(1).FuncName,\r\n\t\t\t))\r\n\t\t}\r\n\t\treturn true, t\r\n\t}\r\n\treturn false, eeTypeOf(e)\r\n}", "title": "" }, { "docid": "8609d3f4f105eb83d183f31788871b40", "score": "0.5436958", "text": "func (check *Checker) typExpr(e ast.Expr, def *Named, path []*TypeName) (T Type) {\n\tif trace {\n\t\tcheck.trace(e.Pos(), \"%s\", e)\n\t\tcheck.indent++\n\t\tdefer func() {\n\t\t\tcheck.indent--\n\t\t\tcheck.trace(e.Pos(), \"=> %s\", T)\n\t\t}()\n\t}\n\n\tT = check.typExprInternal(e, def, path)\n\tassert(isTyped(T))\n\tcheck.recordTypeAndValue(e, typexpr, T, nil)\n\n\treturn\n}", "title": "" }, { "docid": "ede4968c331f47f1f3950f373befd21b", "score": "0.5416924", "text": "func TypeOf(v Node) (Type, error) {\n\tif v == nil {\n\t\treturn VoidType, nil\n\t}\n\tswitch e := v.(type) {\n\tcase Type:\n\t\treturn e, nil\n\tcase *Field:\n\t\treturn e.Type, nil\n\tcase Expression:\n\t\treturn e.ExpressionType(), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Type \\\"%T\\\" is not an expression\", v)\n\t}\n}", "title": "" }, { "docid": "00897c15f6595aac4a310ecb1371e914", "score": "0.5384701", "text": "func (n *Null) Type() string { return NULL }", "title": "" }, { "docid": "e196969b8ad4e0f699d0ee9606d29c63", "score": "0.5326929", "text": "func (p *parser) checkExprOrType(x ast.Expr) ast.Expr {\n\tswitch t := unparen(x).(type) {\n\tcase *ast.ArrayType:\n\t\tif len, isEllipsis := t.Len.(*ast.Ellipsis); isEllipsis {\n\t\t\tp.error(len.Pos(), \"expected array length, found '...'\")\n\t\t\tx = &ast.BadExpr{From: x.Pos(), To: p.safePos(x.End())}\n\t\t}\n\t}\n\t// all other nodes are expressions or types\n\treturn x\n}", "title": "" }, { "docid": "657c7608cd1294f645570943dda834c3", "score": "0.5309357", "text": "func (p *parser) tryIdentOrType(state int, len ast.Expr) (ast.Expr, int) {\n\tswitch p.tok {\n\tcase token.IDENT:\n\t\ttyp := p.parseTypeName(nil)\n\t\tif p.tok == token.LBRACK {\n\t\t\ttyp = p.parseTypeInstance(typ)\n\t\t}\n\t\treturn typ, resultIdent\n\tcase token.LBRACK:\n\t\treturn p.parseArrayTypeOrSliceLit(state, len)\n\tcase token.STRUCT:\n\t\treturn p.parseStructType(), resultType\n\tcase token.MUL:\n\t\treturn p.parsePointerType(), resultType\n\tcase token.FUNC:\n\t\ttyp, _ := p.parseFuncType()\n\t\treturn typ, resultType\n\tcase token.INTERFACE:\n\t\treturn p.parseInterfaceType(), resultType\n\tcase token.MAP:\n\t\treturn p.parseMapType(), resultType\n\tcase token.CHAN, token.ARROW:\n\t\treturn p.parseChanType(), resultType\n\tcase token.LPAREN:\n\t\tlparen := p.pos\n\t\tp.next()\n\t\ttyp := p.parseType()\n\t\trparen := p.expect(token.RPAREN)\n\t\treturn &ast.ParenExpr{Lparen: lparen, X: typ, Rparen: rparen}, resultParenType\n\t}\n\n\t// no type found\n\treturn nil, resultNone\n}", "title": "" }, { "docid": "269be45f46dd20afec343b018cf7c2bd", "score": "0.5277982", "text": "func (a *ASTNode) findExprType() VarType {\n\tswitch a.Type {\n\tcase NumeralType:\n\t\treturn InfNumeral\n\n\tcase AtomType:\n\t\treturn InfAtom\n\n\tcase VariableType:\n\t\treturn InfUnknown\n\n\tcase PrimaryExprType, UnaryExprType, MultiplicativeExprType, AdditiveExprType:\n\t\t// Arithmetic applies only to numerals.\n\t\tif len(a.Children) == 1 {\n\t\t\t// Trivial wrapper for an underlying expression: Ask\n\t\t\t// they underlying expression for its type.\n\t\t\treturn a.Children[0].findExprType()\n\t\t}\n\t\treturn InfNumeral\n\n\tcase TermType:\n\t\treturn a.Children[0].findExprType()\n\n\tcase RelationType:\n\t\t// Relations are either numeric or unknown, depending on the\n\t\t// specific relation.\n\t\top := a.Children[1].Value.(string)\n\t\tif op == \"=\" || op == \"\\\\=\" {\n\t\t\t// Equality and inequality are polymorphic. See if we\n\t\t\t// can determine the type from our arguments.\n\t\t\tt1 := a.Children[0].findExprType()\n\t\t\tt2 := a.Children[2].findExprType()\n\t\t\tswitch {\n\t\t\tcase t1 == t2:\n\t\t\t\treturn t1\n\t\t\tcase t1 == InfUnknown:\n\t\t\t\treturn t2\n\t\t\tcase t2 == InfUnknown:\n\t\t\t\treturn t1\n\t\t\tdefault:\n\t\t\t\tnotify.Fatalf(\"Can't apply %q to mixed types (%v and %v)\", op, t1, t2)\n\t\t\t}\n\t\t} else {\n\t\t\t// All other relations apply only to numerals.\n\t\t\treturn InfNumeral\n\t\t}\n\n\tdefault:\n\t\tnotify.Fatalf(\"Internal error: findExprType doesn't recognize %v\", a.Type)\n\t}\n\treturn InfUnknown // Will never get here.\n}", "title": "" }, { "docid": "43241dda0fc6f764889e25c96be0160f", "score": "0.5234057", "text": "func (n Nil) Type() Type {\n\treturn nilType\n}", "title": "" }, { "docid": "df3781b2991ebb5bdb0de8d3624df1c2", "score": "0.52293503", "text": "func OrNil(err error) error {\n\tif !IsError(err) {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "336f068f7db9940104ab3c0cfa348ad7", "score": "0.52053463", "text": "func parseType(lexer *Lexer) (Type, error) {\n var typeRet Type\n var err error\n\n // NamedType & ListType\n switch lexer.LookAhead() {\n case TOKEN_IDENTIFIER: // NamedType\n if typeRet, err = parseNamedType(lexer); err != nil {\n return nil, err\n }\n case TOKEN_LEFT_BRACKET: // ListType, start with \"[\"\n if typeRet, err = parseListType(lexer); err != nil {\n return nil, err\n }\n }\n // NonNullType\n if lexer.LookAhead() == TOKEN_NOT_NULL {\n if typeRet, err = parseNonNullType(lexer, typeRet); err != nil {\n return nil, err\n } \n }\n return typeRet, nil\n}", "title": "" }, { "docid": "d41274e91bd8675e39f173ec5bbfbab3", "score": "0.51976067", "text": "func (c *Null) Type() types.Type {\n\treturn c.Typ\n}", "title": "" }, { "docid": "df8668735e4a264c5211ea3b4c579ea3", "score": "0.51215327", "text": "func (e *Error) Type() *Type {\n\tcause := e\n\tfor cause != nil {\n\t\tif !cause.transparent {\n\t\t\treturn cause.errorType\n\t\t}\n\n\t\tcause = Cast(cause.Cause())\n\t}\n\n\treturn foreignType\n}", "title": "" }, { "docid": "50e5128e618a6e1038024f894140c50b", "score": "0.5116589", "text": "func ErrType(err error) error {\n\treturn errCheck{err}\n}", "title": "" }, { "docid": "260060c3ac2ebbe5441943578b4f3702", "score": "0.5097223", "text": "func (maybeSelf MaybeDef) Type() reflect.Type {\n\tif maybeSelf.IsNil() {\n\t\treturn reflect.TypeOf(nil)\n\t}\n\treturn reflect.TypeOf(maybeSelf.ref)\n}", "title": "" }, { "docid": "cdf41cb85a0556eea70d5e157a91968f", "score": "0.50887084", "text": "func (t TupleExpr) typeof(*ExpressionEnv, []*querypb.Field) (sqltypes.Type, typeFlag) {\n\treturn sqltypes.Tuple, flagNullable\n}", "title": "" }, { "docid": "1e7ffb67d769d4824a84a0b78dcc5e0e", "score": "0.50268346", "text": "func (en *exprNode) GetType() *types.FieldType {\n\treturn &en.Type\n}", "title": "" }, { "docid": "2d2c4de125eee2f081c1a5c55a937255", "score": "0.5014041", "text": "func (e OrderonlineEdges) TypeproductOrErr() (*Typeproduct, error) {\n\tif e.loadedTypes[2] {\n\t\tif e.Typeproduct == nil {\n\t\t\t// The edge Typeproduct was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: typeproduct.Label}\n\t\t}\n\t\treturn e.Typeproduct, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"Typeproduct\"}\n}", "title": "" }, { "docid": "f7f9923019fc6fc28ecec484ae2f7f68", "score": "0.50121105", "text": "func (r *RootExpr) UserType(name string) UserType {\n\tfor _, t := range r.Types {\n\t\tif t.Name() == name {\n\t\t\treturn t\n\t\t}\n\t}\n\tfor _, t := range r.ResultTypes {\n\t\tif t.Name() == name {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a036ac618b095d8665679a37cbaf619", "score": "0.50079864", "text": "func (o *ConsumptionEntry) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "0478656cbbd1a5f40cbc7d291b09311b", "score": "0.49918517", "text": "func (e *Env) Type(id string) *T {\n\tsym := e.sym(id)\n\tif sym == nil {\n\t\treturn nil\n\t}\n\treturn sym.Value\n}", "title": "" }, { "docid": "ab1b408f078fdcc0b66441f9fb7483ef", "score": "0.49903598", "text": "func (u *UserEmail) GetType() string {\n\tif u == nil || u.Type == nil {\n\t\treturn \"\"\n\t}\n\treturn *u.Type\n}", "title": "" }, { "docid": "4f5747e52767ae37f11aff33d1559593", "score": "0.4977826", "text": "func GetExprType(context *ProgramContext, expr Expr) *Type {\n\tswitch v := expr.(type) {\n\tcase IntImmidiateExpr:\n\t\treturn &Type{\n\t\t\tGCPtr: false,\n\t\t\tName: \"i64\",\n\t\t\tOptional: false,\n\t\t\tPtr: 0,\n\t\t\tRef: false,\n\t\t}\n\tcase StringImmidateExpr:\n\t\treturn &Type{\n\t\t\tGCPtr: false,\n\t\t\tName: \"string\",\n\t\t\tOptional: false,\n\t\t\tPtr: 0,\n\t\t\tRef: false,\n\t\t}\n\tcase IdentImmidiateExpr:\n\t\treturn &context.SearchForVariableInCurrentOrGlobal(v.Identifier).Type\n\tcase MemberAccessExpr:\n\t\t/// will need to make this much better, member access is going to be annoying...\n\t\t/// for now we assume that global must be\n\t\tident, ok := v.AccessFrom.(IdentImmidiateExpr)\n\t\tif ok {\n\t\t\tva := context.SearchForVariableInModule(v.MemberName, ident.Identifier)\n\t\t\tif va.Export || va.Module == context.CurrentModule {\n\t\t\t\treturn &va.Type\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\t/// will need to change these, so it will return depends on the object\n\t/// since we want to have operator overloading in the future\n\tcase LHSOperatorExpr:\n\t\treturn GetExprType(context, v.On)\n\tcase LROperatorExpr:\n\t\treturn GetExprType(context, v.Left)\n\n\tcase AssignExpr:\n\t\treturn GetExprType(context, v.Target)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "664dd3c47ac77e6f63dfa056009a9e8e", "score": "0.49657902", "text": "func (v *Value) Type() (actual Type, fundamental Type) {\n\tif v == nil || C._g_is_value(v.GValue) == 0 {\n\t\treturn TypeInvalid, TypeInvalid\n\t}\n\tcActual := C._g_value_type(v.GValue)\n\tcFundamental := C._g_value_fundamental(cActual)\n\treturn Type(cActual), Type(cFundamental)\n}", "title": "" }, { "docid": "786114e9e5115462d3d745a23de84365", "score": "0.49647194", "text": "func (e *Match) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "4a79bf6d6b5c2e3a7d24652cd331c2a2", "score": "0.49638948", "text": "func (b *Event) Type() EventType {\n\tif b.kv.Key != nil {\n\t\treturn KVEvent\n\t}\n\tif b.resolved != nil {\n\t\treturn ResolvedEvent\n\t}\n\tlog.Fatalf(context.TODO(), \"found event with unknown type: %+v\", *b)\n\treturn 0 // unreachable\n}", "title": "" }, { "docid": "519ff9b818e60213635096a8c803f43e", "score": "0.4959953", "text": "func (e Entry) GetByKindOrNil(k reflect.Kind) interface{} {\n\tswitch k {\n\tcase reflect.String:\n\t\tv := e.StringDefault(\"__$nf\")\n\t\tif v == \"__$nf\" {\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\tcase reflect.Int:\n\t\tv, err := e.IntDefault(-1)\n\t\tif err != nil || v == -1 {\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\tcase reflect.Int64:\n\t\tv, err := e.Int64Default(-1)\n\t\tif err != nil || v == -1 {\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\tcase reflect.Bool:\n\t\tv, err := e.BoolDefault(false)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\tdefault:\n\t\treturn e.ValueRaw\n\t}\n}", "title": "" }, { "docid": "2db942cbd8a21c5c9f342cd45f1e63c6", "score": "0.49576363", "text": "func (o *FullWebRequestRule) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "title": "" }, { "docid": "cbf32bc9df0d7d7a9a45e6cece4cf05a", "score": "0.49512836", "text": "func (left *Resource) checkType(t Value_Type) Value_Type {\n\tif left != nil && left.GetType() != t {\n\t\tpanic(fmt.Sprintf(\"expected type %v instead of %v\", t, left.GetType()))\n\t}\n\treturn t\n}", "title": "" }, { "docid": "c3afd0de4f7c765e46656cb3a1161d8c", "score": "0.4945555", "text": "func (o *LeaseEvent) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "f73e078370c85c115ac58fd2612b53fd", "score": "0.49384937", "text": "func GetType(err error) ErrorType {\n\tif customErr, ok := err.(customError); ok {\n\t\treturn customErr.errorType\n\t}\n\n\treturn NoType\n}", "title": "" }, { "docid": "3abef1b4f885ac0ad6fb37127a70bb5c", "score": "0.4924079", "text": "func (it *Optional) Type() graph.Type { return graph.Optional }", "title": "" }, { "docid": "68b2d8130508b659dad2bd6f04fe4c99", "score": "0.4921432", "text": "func (o *ViewReaction) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "bf052c0a8b9b779a41e30fb9f0c66333", "score": "0.4908483", "text": "func (ty NullType) Fuse(other ExprType) ExprType {\n\tif _, ok := other.(NullType); ok {\n\t\treturn ty\n\t}\n\treturn AnyType{}\n}", "title": "" }, { "docid": "b4ca0266c127d392182c768eaa6e1f8b", "score": "0.4904532", "text": "func (o *MicrosoftGraphRecurrenceRange) GetTypeOk() (AnyOfmicrosoftGraphRecurrenceRangeType, bool) {\n\tif o == nil || o.Type == nil {\n\t\tvar ret AnyOfmicrosoftGraphRecurrenceRangeType\n\t\treturn ret, false\n\t}\n\treturn *o.Type, true\n}", "title": "" }, { "docid": "6a28901b60a58ff56dc27b7d36c4367a", "score": "0.49018863", "text": "func (t Type) ReflowType() *types.T {\n\tswitch t {\n\tcase typeError:\n\t\treturn types.Errorf(\"unknown type error\")\n\tcase typeString:\n\t\treturn types.String\n\tcase typeTemplate:\n\t\t// Not supported.\n\t\treturn nil\n\tcase typeVoid:\n\t\treturn types.Unit\n\tcase typeNum:\n\t\treturn types.Int\n\tcase typeFlow:\n\t\treturn types.Fileset\n\tcase typeFlowList:\n\t\treturn types.List(types.Fileset)\n\tcase typeImage:\n\t\t// Not Supported.\n\t\treturn nil\n\tcase typeStringList:\n\t\treturn types.List(types.String)\n\t}\n\t// Functions not supported:\n\treturn nil\n}", "title": "" }, { "docid": "f47005c0ddf4f6ffd85130374a564c20", "score": "0.48855937", "text": "func (Error) Type() Type { return TypeError }", "title": "" }, { "docid": "e667738839cff43609748097c0c7cc0e", "score": "0.48813683", "text": "func (expr *ExprFCmp) Type() types.Type {\n\treturn expr.Typ\n}", "title": "" }, { "docid": "1f49560c8b530b6221a93897e2fadc2a", "score": "0.4855622", "text": "func (x *ErrorExpression) Type() Type {\n\treturn x.exprType\n}", "title": "" }, { "docid": "0a36512b900ee4d9f49d3af9dd78b59f", "score": "0.48478654", "text": "func (v Value) Type() DataType {\n\tif len(v) > 1 && v[0] == ascESC {\n\t\tswitch v[1] {\n\t\tcase 'i':\n\t\t\treturn Integer\n\t\tcase 'n':\n\t\t\treturn Number\n\t\tcase 'd':\n\t\t\treturn Date\n\t\tcase 't':\n\t\t\treturn Time\n\t\tcase '$':\n\t\t\treturn Currency\n\t\tdefault:\n\t\t\tlog.Printf(\"Unrecognised value type '%c'\\n\", v[1])\n\t\t\treturn NotSet\n\t\t}\n\t}\n\treturn Neutral\n}", "title": "" }, { "docid": "c02b07f92d3cfd749d5cb28d1b8d24bf", "score": "0.4841885", "text": "func (this *Mysql) detetcType(sqlType string, nullable bool) GoType {\n\n\tt := sqlTypeMatch.FindStringSubmatch(sqlType)\n\tsize := int64(-1)\n\tif len(t) > 0 {\n\t\tsqlType = t[1]\n\t\tsize, _ = strconv.ParseInt(t[2], 10, 32)\n\t}\n\n\tswitch sqlType {\n\tcase \"int\", \"smallint\", \"tinyint\", \"bool\":\n\t\tif size == 1 || sqlType == \"bool\" {\n\t\t\tif nullable {\n\t\t\t\treturn GoNullBool\n\t\t\t}\n\t\t\treturn GoBool\n\t\t}\n\t\tif nullable {\n\t\t\treturn GoNullInt\n\t\t}\n\t\treturn GoInt\n\tcase \"timestamp\":\n\t\tif nullable {\n\t\t\treturn GoNullInt\n\t\t}\n\t\treturn GoInt\n\tcase \"float\", \"double\", \"decimal\":\n\t\tif nullable {\n\t\t\treturn GoNullFloat64\n\t\t}\n\t\treturn GoFloat64\n\tcase \"text\", \"enum\", \"set\":\n\t\tif nullable {\n\t\t\treturn GoNullString\n\t\t}\n\t\treturn GoString\n\tcase \"datetime\", \"time\", \"date\":\n\t\tif nullable {\n\t\t\tpanic(\"Nuulable datetime not implemented yet\")\n\t\t}\n\t\treturn GoTime\n\t}\n\n\t// default to string\n\treturn GoString\n}", "title": "" }, { "docid": "804e245a3f5897903222a00e9498bbc8", "score": "0.48404703", "text": "func (e *Func) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "55913b6245a11a9a9f12c7a95ab433da", "score": "0.4835498", "text": "func GetType(anything interface{}) interface{} {\n\tswitch v := anything.(type) {\n\tcase string:\n\t\tfmt.Println(\"value is a string:\", v)\n\t\treturn v\n\tcase int32, int64:\n\t\tfmt.Println(\"value is an int32:\", v)\n\t\treturn v\n\tcase []uint8:\n\t\tf, err := strconv.ParseFloat(string(v), 64)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\treturn f\n\tcase float64:\n\t\tfmt.Println(\"value is float64\")\n\tdefault:\n\t\tfmt.Println(\"unknown\")\n\t\treturn v\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9d79b8e95cc6cf2433a986139139692", "score": "0.48326865", "text": "func (o *MicrosoftGraphRecurrenceRange) GetType() AnyOfmicrosoftGraphRecurrenceRangeType {\n\tif o == nil || o.Type == nil {\n\t\tvar ret AnyOfmicrosoftGraphRecurrenceRangeType\n\t\treturn ret\n\t}\n\treturn *o.Type\n}", "title": "" }, { "docid": "2bb1336c1ff1f37958fea8baf03f6278", "score": "0.48271117", "text": "func (t *typeEnv) Type(ident string) (Type, bool) {\n\ttt := t\n\tfor tt != nil {\n\t\tif tt.ident == ident {\n\t\t\treturn tt.typ, true\n\t\t}\n\t\ttt = tt.next\n\t}\n\treturn typeError, false\n}", "title": "" }, { "docid": "c5d7455c2dcf7e5f758d852ffc8800b4", "score": "0.48103335", "text": "func (e *Func) RetType() types.Type { return types.RealType(e.inferred.Return) }", "title": "" }, { "docid": "c64c9f7037c67b51419f14e097bbf0f2", "score": "0.47975785", "text": "func (e *ExprTrunc) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "c64c9f7037c67b51419f14e097bbf0f2", "score": "0.47975785", "text": "func (e *ExprTrunc) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "7951006d39843c321b0dacea41900fd6", "score": "0.47931206", "text": "func (e *Literal) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "7549f376b78501332483e85b96a9e0c7", "score": "0.47906864", "text": "func RecursiveTypeOf(expr ast.Expr) ast.Expr {\n\tswitch e := expr.(type) {\n\tcase *ast.StarExpr:\n\t\treturn e.X\n\tcase *ast.ChanType:\n\t\treturn e.Value\n\tcase *ast.MapType:\n\t\t//TODO: Better system for breaking up map types\n\t\treturn e.Value\n\tcase *ast.ArrayType:\n\t\treturn e.Elt\n\tcase *ast.Ellipsis:\n\t\treturn e.Elt\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2cf66bbbbaab01e954e0733563518db6", "score": "0.4785879", "text": "func (e *RecordEmpty) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "4d8d23c2647fe0e6323ac92192f2e30b", "score": "0.47820425", "text": "func (e *EnumEntry) ExpressionType() Type {\n\tt, _ := e.Owner().(Type)\n\treturn t\n}", "title": "" }, { "docid": "f6529c7928f38111a261b58901fc9fb5", "score": "0.4780706", "text": "func wrapType(d *dwarf.Data, off dwarf.Offset) (dt dwarf.Type, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif false {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"bad offset: %d\\n\", off)\n\t\t\t}\n\t\t\tdt = nil\n\t\t\terr = r.(error)\n\t\t}\n\t}()\n\tdt, err = d.Type(off)\n\treturn\n}", "title": "" }, { "docid": "1fcad9b92890985b4c1181568319a44c", "score": "0.47795245", "text": "func getFieldValueOrNil(valField reflect.Value) interface{} {\n\tval := valField.Interface()\n\tswitch valField.Kind() {\n\tcase reflect.Slice, reflect.Chan, reflect.Map, reflect.Array, reflect.String:\n\t\tif 0 == valField.Len() {\n\t\t\treturn nil\n\t\t}\n\tdefault:\n\t\tif nil == val {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "866b82231ea62c6aa55b19a0b24cf5f9", "score": "0.4778881", "text": "func (n *Node) Type() NodeType {\n\tif n == nil {\n\t\treturn Null\n\t}\n\treturn n._type\n}", "title": "" }, { "docid": "c5a8644a857e05e6d14d77b44182e8d4", "score": "0.47787598", "text": "func getElemTyperType(rv reflect.Value, t reflect.Type) reflect.Type {\n\tvar elemType reflect.Type\n\tisElemTyper := false\n\n\tif t != nil && t.Implements(elemTyper) {\n\t\tisElemTyper = true\n\t\tif t.Kind() == reflect.Ptr {\n\t\t\t// If ElemType() has a value receiver we would get a panic if we call it\n\t\t\t// on a nil pointer.\n\t\t\tif !rv.IsValid() || rv.IsNil() {\n\t\t\t\trv = reflect.New(t.Elem())\n\t\t\t}\n\t\t} else if !rv.IsValid() {\n\t\t\trv = reflect.Zero(t)\n\t\t}\n\t}\n\tif !isElemTyper && rv.CanAddr() {\n\t\trv = rv.Addr()\n\t\tif rv.Type().Implements(elemTyper) {\n\t\t\tisElemTyper = true\n\t\t}\n\t}\n\tif !isElemTyper && t != nil {\n\t\tpt := reflect.PtrTo(t)\n\t\tif pt.Implements(elemTyper) {\n\t\t\tisElemTyper = true\n\t\t\trv = reflect.Zero(pt)\n\t\t}\n\t}\n\tif isElemTyper {\n\t\telemType = rv.Interface().(ElemTyper).ElemType()\n\t}\n\n\treturn elemType\n}", "title": "" }, { "docid": "23fb579ae682edc52b2f351c7da6c273", "score": "0.47681928", "text": "func ValidateType(f Option, arg string) error {\n\tswitch f.ExpectedType {\n\tcase reflect.Invalid, reflect.String:\n\t\treturn nil\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tif _, err := strconv.Atoi(arg); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tif _, err := strconv.ParseUint(arg, 10, 0); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float32:\n\t\tif _, err := strconv.ParseFloat(arg, 32); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float64:\n\t\tif _, err := strconv.ParseFloat(arg, 64); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Bool:\n\t\tif _, err := strconv.ParseBool(arg); err == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn InvalidTypeErr{f, arg}\n}", "title": "" }, { "docid": "848a07af1addab74847935cdeaa2ae9d", "score": "0.47657073", "text": "func getAstFieldType(binder *config.Binder, schema *ast.Schema, cfg *config.Config, field *ast.FieldDefinition) (\n\ttypes.Type, error) {\n\tvar typ types.Type\n\tvar err error\n\n\tfieldDef := schema.Types[field.Type.Name()]\n\tif cfg.Models.UserDefined(field.Type.Name()) {\n\t\ttyp, err = binder.FindTypeFromName(cfg.Models[field.Type.Name()].Model[0])\n\t\tif err != nil {\n\t\t\treturn typ, err\n\t\t}\n\t} else {\n\t\tswitch fieldDef.Kind {\n\t\tcase ast.Scalar:\n\t\t\t// no user defined model, referencing a default scalar\n\t\t\ttyp = types.NewNamed(\n\t\t\t\ttypes.NewTypeName(0, cfg.Model.Pkg(), \"string\", nil),\n\t\t\t\tnil,\n\t\t\t\tnil,\n\t\t\t)\n\n\t\tcase ast.Interface, ast.Union:\n\t\t\t// no user defined model, referencing a generated interface type\n\t\t\ttyp = types.NewNamed(\n\t\t\t\ttypes.NewTypeName(0, cfg.Model.Pkg(), gqlgenTemplates.ToGo(field.Type.Name()), nil),\n\t\t\t\ttypes.NewInterfaceType([]*types.Func{}, []types.Type{}),\n\t\t\t\tnil,\n\t\t\t)\n\n\t\tcase ast.Enum:\n\t\t\t// no user defined model, must reference a generated enum\n\t\t\ttyp = types.NewNamed(\n\t\t\t\ttypes.NewTypeName(0, cfg.Model.Pkg(), gqlgenTemplates.ToGo(field.Type.Name()), nil),\n\t\t\t\tnil,\n\t\t\t\tnil,\n\t\t\t)\n\n\t\tcase ast.Object, ast.InputObject:\n\t\t\t// no user defined model, must reference a generated struct\n\t\t\ttyp = types.NewNamed(\n\t\t\t\ttypes.NewTypeName(0, cfg.Model.Pkg(), gqlgenTemplates.ToGo(field.Type.Name()), nil),\n\t\t\t\ttypes.NewStruct(nil, nil),\n\t\t\t\tnil,\n\t\t\t)\n\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unknown ast type %s\", fieldDef.Kind))\n\t\t}\n\t}\n\n\treturn typ, err\n}", "title": "" }, { "docid": "70cdba2b2c3e4adfa26e0d517c799b2a", "score": "0.47651505", "text": "func (o *ColumnDefinition) GetTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Type, true\n}", "title": "" }, { "docid": "da7b18194b798a3299ee9e0f2a49f02c", "score": "0.47582075", "text": "func (e *Deref) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "55743d0c33f7380fb2e505ddb97d49de", "score": "0.4746249", "text": "func (e *ExprFPTrunc) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "55743d0c33f7380fb2e505ddb97d49de", "score": "0.4746249", "text": "func (e *ExprFPTrunc) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "666c6c8bf4c811c94d4f32e285dde0ab", "score": "0.4742628", "text": "func (u *User) GetType() string {\n\tif u == nil || u.Type == nil {\n\t\treturn \"\"\n\t}\n\treturn *u.Type\n}", "title": "" }, { "docid": "22a9304dd5c06e42f5f1f7fe0f2978c0", "score": "0.4742438", "text": "func mimicNilValue(tt *vdl.Type, base *vdl.Value) *vdl.Value {\n\tswitch {\n\tcase tt == vdl.AnyType:\n\t\t// We can convert from any(nil) to all nil base values.\n\t\treturn vdl.ZeroValue(vdl.AnyType)\n\tcase tt.Kind() != vdl.Optional:\n\t\t// Can't convert from a non-any non-optional type to a nil value.\n\t\treturn nil\n\t}\n\t// Now we know that tt is optional, and base is either any(nil) or\n\t// optional(nil).\n\tswitch {\n\tcase base.Type() == vdl.AnyType:\n\t\t// Can't convert from optional(nil) to any(nil).\n\t\treturn nil\n\tcase !vdl.Compatible(tt, base.Type()):\n\t\t// Can't convert incompatible optional types.\n\t\treturn nil\n\t}\n\t// Now we know that tt and base are both optional and compatible.\n\treturn vdl.ZeroValue(tt)\n}", "title": "" }, { "docid": "b75af2751e710cf98b1289cac7655415", "score": "0.47424006", "text": "func (o *FullWebRequestRule) GetType() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Type\n}", "title": "" }, { "docid": "88f2c585ae5f2dce1b83c849129e07bd", "score": "0.47419852", "text": "func (o *DeviceParameterValueWeb) GetTypeOk() (*string, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "c91877e40e2ecbb5e73260e80cfb3eb1", "score": "0.47364634", "text": "func (e *Call) Type() types.Type { return types.RealType(e.inferred) }", "title": "" }, { "docid": "486d36b67d6c85d11510181c2aecef1c", "score": "0.4732655", "text": "func (o *CalendareventsIdJsonEvent) GetTypeOk() (*CalendareventsIdJsonEventType, bool) {\n\tif o == nil || o.Type == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Type, true\n}", "title": "" }, { "docid": "276c43bb686d3cb6ddb7ec23f425a373", "score": "0.4732562", "text": "func (l *Loader) SymElfType(i Sym) elf.SymType {\n\tif et, ok := l.elfType[i]; ok {\n\t\treturn et\n\t}\n\treturn elf.STT_NOTYPE\n}", "title": "" }, { "docid": "3ef9ada9daa97c582b9670f7bc3b5fa5", "score": "0.47304946", "text": "func (n *Null) Type() Type {\n\treturn NULL_OBJ\n}", "title": "" }, { "docid": "3ef9ada9daa97c582b9670f7bc3b5fa5", "score": "0.47304946", "text": "func (n *Null) Type() Type {\n\treturn NULL_OBJ\n}", "title": "" }, { "docid": "96d1ea7b4e4a61764e541637f8e4b295", "score": "0.47226048", "text": "func GetType(err error) ErrorType {\n\tif customErr, ok := err.(customError); ok {\n\t\treturn customErr.typ\n\t}\n\n\treturn Unknown\n}", "title": "" }, { "docid": "af21dc14792f3527de25895283a556b6", "score": "0.47174847", "text": "func RTypeOfEface(v any) *RType {\n\treturn unpackEface(&v).typ\n}", "title": "" }, { "docid": "42ea690a9d8fe5c2933acf79696864e4", "score": "0.47076353", "text": "func (e *ExprUIToFP) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "42ea690a9d8fe5c2933acf79696864e4", "score": "0.47076353", "text": "func (e *ExprUIToFP) Type() types.Type {\n\treturn e.To\n}", "title": "" }, { "docid": "8f1d7ce872a58fe295932d40b48963aa", "score": "0.47061905", "text": "func (e PatientrightsEdges) PatientrightsPatientrightstypeOrErr() (*Patientrightstype, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.PatientrightsPatientrightstype == nil {\n\t\t\t// The edge PatientrightsPatientrightstype was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: patientrightstype.Label}\n\t\t}\n\t\treturn e.PatientrightsPatientrightstype, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"PatientrightsPatientrightstype\"}\n}", "title": "" }, { "docid": "42ca965d2822e5a6d6d81bbfe6eb9364", "score": "0.4691353", "text": "func (n *NoneParser) Type() string {\n\treturn \"None\"\n}", "title": "" }, { "docid": "6f363f2f766ae264ef695bdedacd4bb1", "score": "0.46845978", "text": "func (o *ConsumptionEntry) GetType() string {\n\tif o == nil || o.Type == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Type\n}", "title": "" }, { "docid": "fc06a2fc88d906b8dd87edb8e6b287ef", "score": "0.466908", "text": "func (o *Evidence) GetEvidenceTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.EvidenceType, true\n}", "title": "" }, { "docid": "c882aef8d0490c6b5b9b7517f30b5091", "score": "0.46679777", "text": "func (s LINQ) FirstOrNil() T {\n\treturn s.FirstOrDefault(nil)\n}", "title": "" }, { "docid": "f5bf6ab89f47346e08cae590c64c1d52", "score": "0.46628323", "text": "func (Config) elemValueOrNil(v interface{}) interface{} {\n\tif t := reflect.TypeOf(v); t.Kind() == reflect.Ptr {\n\t\tif reflect.ValueOf(v).IsNil() {\n\t\t\treturn reflect.Zero(t.Elem()).Interface()\n\t\t} else {\n\t\t\treturn reflect.ValueOf(v).Interface()\n\t\t}\n\t} else if v == nil {\n\t\treturn reflect.Zero(t).Interface()\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "133e5af90193c495e0d28ad6e28cc6db", "score": "0.46628305", "text": "func ActionTypeNotNil() predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldActionType)))\n\t})\n}", "title": "" }, { "docid": "09339ace14e15fc0536b6c48967690e7", "score": "0.46571162", "text": "func (x *UnaryOpExpression) Type() Type {\n\treturn x.exprType\n}", "title": "" }, { "docid": "70be9fa519fa1390ddbb74c8acbdec52", "score": "0.46558216", "text": "func (bv *BindVariable) typeof(env *ExpressionEnv, _ []*querypb.Field) (sqltypes.Type, typeFlag) {\n\tvar tt sqltypes.Type\n\tif bv.typed() {\n\t\ttt = bv.Type\n\t} else {\n\t\tif bvar, err := env.lookupBindVar(bv.Key); err == nil {\n\t\t\ttt = bvar.Type\n\t\t}\n\t}\n\tswitch tt {\n\tcase sqltypes.Null:\n\t\treturn sqltypes.Null, flagNull | flagNullable\n\tcase sqltypes.HexNum, sqltypes.HexVal:\n\t\treturn sqltypes.VarBinary, flagHex\n\tdefault:\n\t\treturn tt, 0\n\t}\n}", "title": "" }, { "docid": "9b357bce6efaf86b1641ce16a51c1670", "score": "0.46525106", "text": "func TriggerTypeNotNil() predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldTriggerType)))\n\t})\n}", "title": "" }, { "docid": "c6c95b62b46302e51fe8e5b3a0990936", "score": "0.46432996", "text": "func (s LINQ) LastOrNil() T {\n\treturn s.LastOrDefault(nil)\n}", "title": "" }, { "docid": "582cdbc729fe873ee2fe600cfc9e3a55", "score": "0.46425503", "text": "func (e EquipmentrentalEdges) EquipmenttypeOrErr() (*Equipmenttype, error) {\n\tif e.loadedTypes[3] {\n\t\tif e.Equipmenttype == nil {\n\t\t\t// The edge equipmenttype was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: equipmenttype.Label}\n\t\t}\n\t\treturn e.Equipmenttype, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"equipmenttype\"}\n}", "title": "" }, { "docid": "2a11933fda90eff8534fa7efa2e3c320", "score": "0.4631325", "text": "func (e TypeExpr) TypeName(pkgOverride string) string {\n\tpkgName := FirstNonEmpty(pkgOverride, e.PkgName)\n\tif pkgName == \"\" {\n\t\treturn e.Expr\n\t}\n\treturn e.Expr[:e.pkgIndex] + pkgName + \".\" + e.Expr[e.pkgIndex:]\n}", "title": "" }, { "docid": "2a11933fda90eff8534fa7efa2e3c320", "score": "0.4631325", "text": "func (e TypeExpr) TypeName(pkgOverride string) string {\n\tpkgName := FirstNonEmpty(pkgOverride, e.PkgName)\n\tif pkgName == \"\" {\n\t\treturn e.Expr\n\t}\n\treturn e.Expr[:e.pkgIndex] + pkgName + \".\" + e.Expr[e.pkgIndex:]\n}", "title": "" }, { "docid": "cd84de7d6105873d5936da59e407e4e2", "score": "0.46306223", "text": "func (i *InputAppEvent) GetType() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Type\n}", "title": "" }, { "docid": "ef3e63e03a17243475c525739e8c4f9d", "score": "0.4628418", "text": "func (t *GQLtype) isType() TypeFlag_ {\n\t//\n\t// Object types have nested types i.e. each field has a *Type attribute\n\t// the *Type.AST can itself be another object or a scalar (system or user defined)\n\t// Scalars do not have a *Type attribute as they represent the leaf node in a tree of types.\n\t//\n\n\tswitch t.Name.String() {\n\t//\n\t// system scalar types\n\t//\n\tcase token.ID:\n\t\treturn ID\n\tcase token.INT:\n\t\treturn INT\n\tcase token.FLOAT:\n\t\treturn FLOAT\n\tcase token.STRING, token.RAWSTRING:\n\t\treturn STRING\n\tcase token.BOOLEAN:\n\t\treturn BOOLEAN\n\tcase token.NULL:\n\t\treturn NULL\n\t// case token.ID:\n\t// \treturn ID\n\t// case token.Time: // could implement new scalar time at this level or embedded in Scalar_ like user defined scales would be.\n\t// return TIME\n\tdefault:\n\t\t//\n\t\t// application defined types\n\t\t//\n\t\tif t.AST != nil {\n\t\t\tswitch t.AST.(type) {\n\t\t\tcase *Object_:\n\t\t\t\treturn OBJECT\n\t\t\tcase *Interface_:\n\t\t\t\treturn INTERFACE\n\t\t\tcase *Enum_:\n\t\t\t\treturn ENUM\n\t\t\tcase *EnumValue_:\n\t\t\t\treturn ENUMVALUE\n\t\t\tcase *Input_:\n\t\t\t\treturn INPUT\n\t\t\tcase *Union_:\n\t\t\t\treturn UNION\n\t\t\tcase *Scalar_:\n\t\t\t\treturn SCALAR\n\t\t\t\t// case *List_: // []InputValue_, is not a GQLType, nor is InputValue_\n\t\t\t\t// \treturn LIST\n\t\t\t}\n\t\t\t//\n\t\t\treturn ILLEGAL\n\t\t}\n\t}\n\treturn ILLEGAL\n}", "title": "" }, { "docid": "a6b90e3cde4ff0108b14f522482fa235", "score": "0.4623889", "text": "func (d *Decoder) decodeNullableTypeValue(visited *cadenceTypeByCCFTypeID) (cadence.Type, error) {\n\tcborType, err := d.dec.NextType()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif cborType == cbor.NilType {\n\t\terr = d.dec.DecodeNil()\n\t\treturn nil, err\n\t}\n\treturn d.decodeTypeValue(visited)\n}", "title": "" }, { "docid": "110658b6b749f3da2a005040b9bf4f26", "score": "0.462356", "text": "func (m *Cast) Type() value.ValueType { return value.UnknownType }", "title": "" }, { "docid": "d9d9b48b9fb6660ea6878c378fee1d1c", "score": "0.4623188", "text": "func (f *comparisonExpr) Type() Type {\n\treturn f.funcType\n}", "title": "" }, { "docid": "8475d3e035ede46355aa71d9c61e71c9", "score": "0.46181366", "text": "func runtimeTypeToDIE(_type *Variable, dataAddr uint64) (typ godwarf.Type, kind int64, err error) {\n\tbi := _type.bi\n\n\t_type = _type.maybeDereference()\n\n\t// go 1.11 implementation: use extended attribute in debug_info\n\n\tmds, err := loadModuleData(bi, _type.mem)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"error loading module data: %v\", err)\n\t}\n\n\tmd := findModuleDataForType(bi, mds, _type.Addr, _type.mem)\n\tif md != nil {\n\t\tso := bi.moduleDataToImage(md)\n\t\tif so != nil {\n\t\t\tif rtdie, ok := so.runtimeTypeToDIE[uint64(_type.Addr-md.types)]; ok {\n\t\t\t\ttyp, err := godwarf.ReadType(so.dwarf, so.index, rtdie.offset, so.typeCache)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, 0, fmt.Errorf(\"invalid interface type: %v\", err)\n\t\t\t\t}\n\t\t\t\tif rtdie.kind == -1 {\n\t\t\t\t\tif kindField := _type.loadFieldNamed(\"kind\"); kindField != nil && kindField.Value != nil {\n\t\t\t\t\t\trtdie.kind, _ = constant.Int64Val(kindField.Value)\n\t\t\t\t\t} else if kindField := _type.loadFieldNamed(\"Kind_\"); kindField != nil && kindField.Value != nil {\n\t\t\t\t\t\trtdie.kind, _ = constant.Int64Val(kindField.Value)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn typ, rtdie.kind, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, 0, fmt.Errorf(\"could not resolve interface type\")\n}", "title": "" } ]
dacb5b2d82de628fbfc76bf88d57e8ef
Add handler to map
[ { "docid": "ab4c5728022aaa4b387199a98f7de051", "score": "0.55886227", "text": "func RegisterHandler(relativePath string, p interface{}) {\n\tResSlice = append(ResSlice, &PathHandler{relativePath, p})\n}", "title": "" } ]
[ { "docid": "41d2ea631323396067c76ecf3ac446f8", "score": "0.6654678", "text": "func (hr *HandlerRegister) Add(key int, h Handler, name string) error {\n\thr.mu.Lock()\n\tdefer hr.mu.Unlock()\n\tfor _, v := range hr.hmap {\n\t\tfor _, handle := range v {\n\t\t\tif handle.getName() == name {\n\t\t\t\treturn fmt.Errorf(\"handler name %s has been registered\", name)\n\t\t\t}\n\t\t}\n\t}\n\thr.hmap[key] = append(hr.hmap[key], &HandlerWrapper{handle: h, enabled: false, name: name})\n\treturn nil\n}", "title": "" }, { "docid": "c9f6e7de16fafe03c055593069e9dbd2", "score": "0.6556201", "text": "func (s *Server) bindHandlerByMap(m map[string]*handlerItem) {\n\tfor p, h := range m {\n\t\ts.setHandler(p, h)\n\t}\n}", "title": "" }, { "docid": "38ee9c6afab39240d9bb4d7a5bbf15e4", "score": "0.64411706", "text": "func (e *Endpoint) AddHandler(name string, h Handler) {\n\te.handler[name] = h\n}", "title": "" }, { "docid": "94e5887c049b5096cd929b2ec63fe18b", "score": "0.6436802", "text": "func (a *API) AddHandler(f func(http.ResponseWriter, *http.Request)) {\n\ta.handlers = append(a.handlers, f)\n}", "title": "" }, { "docid": "a4598f862f8623419b993e0c8bf7e515", "score": "0.6332551", "text": "func (i *idoink) AddHandler(cmd string, h H) (int, error) {\n\ti.m.Lock()\n\tdefer i.m.Unlock()\n\n\t// note: cmd duplicates are allowed currently.\n\t// add a filter here if they should be unique\n\ti.hc++\n\tid := i.hc\n\ti.handlers[id] = &hm{\n\t\tid: id,\n\t\th: h,\n\t\tcmd: cmd,\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "37c826d7d52e13aef12689e273341011", "score": "0.6240747", "text": "func (m *Manager) AddHandler(e Event, h Handler) {\n\tm.handlers[e] = append(m.handlers[e], h)\n}", "title": "" }, { "docid": "bc3ccfc658bd04491f6e46369926fda9", "score": "0.62276703", "text": "func (t TokenEndpointHandlers) Add(key string, h TokenEndpointHandler) {\n\tt[key] = h\n}", "title": "" }, { "docid": "087abd76e61beb73f8a8bcd270ea5d16", "score": "0.6226504", "text": "func addToPageMap(pageMap pageHandlerMap, path string, hFunc PageHandler){\n\tifExistsPanic(pageMap, path)\n\n\tpageMap[path] = hFunc\n\t\n}", "title": "" }, { "docid": "8478548ae52eb07f2bb414082a6934c1", "score": "0.61628324", "text": "func (s *Server) On(t string, messageHandler MessageHandler) {\n\tif s.handlers == nil {\n\t\ts.handlers = make(map[string]MessageHandler)\n\t}\n\n\ts.handlers[t] = messageHandler\n}", "title": "" }, { "docid": "deff0c838d0112e8fcb369439b8206bf", "score": "0.6158359", "text": "func (s *Server) AddHandler(h func(incoming BroadcastMessage)) {\n\ts.handlers = append(s.handlers, h)\n}", "title": "" }, { "docid": "ffe2000345fcbf8735b7126ecb0e7836", "score": "0.61504257", "text": "func (srv *Server) AddHandler(pattern string, handler Handler) {\n\tif pattern == \"\" {\n\t\tpanic(\"http: invalid pattern \" + pattern)\n\t}\n\tif handler == nil {\n\t\tpanic(\"http: nil handler\")\n\t}\n\n\t// TODO\n\tsrv.handlers[pattern] = handler\n\t// fmt.Println(\"Add handler: \" + pattern)\n}", "title": "" }, { "docid": "fd83717237c9b8a807a02fc09fe2cb41", "score": "0.6136076", "text": "func (s *Server) addHandler(path string, fn HandlerFunc) {\n\ts.mux.HandleFunc(path, s.wrapHandler(fn))\n}", "title": "" }, { "docid": "409c48a45b4c55a5d3625b8a59e4e978", "score": "0.6133397", "text": "func (r *Router) addHandler(method, p string, h HttpHandler) {\n\t// t\n\tt := r.treeByMethod(method)\n\tif t == nil {\n\t\tpanic(\"Router: method not support yet\")\n\t}\n\n\t// add\n\tif err := t.Add(p, h); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "563034c6e72474e72a65e05b67432f7f", "score": "0.61298996", "text": "func (a AuthorizeEndpointHandlers) Add(key string, h AuthorizeEndpointHandler) {\n\ta[key] = h\n}", "title": "" }, { "docid": "8d604b9c2c2760074ae9aed3824d3ac9", "score": "0.6125612", "text": "func RegistFilterHandler(name string, handler FilterHandler) {\n\tmapFilterHandler[name] = handler\n}", "title": "" }, { "docid": "fefb71b892636a9cb09ff33297860d7d", "score": "0.61001086", "text": "func (s *Server) Handler(route string, method string, httpHandler http.Handler) {\n s.addRoute(route, method, httpHandler)\n}", "title": "" }, { "docid": "49cd6ce8e10a2b2d419eb913cb0afdbc", "score": "0.6079531", "text": "func Add(r *gin.Engine, h ...gin.HandlerFunc) {\n\tfor _, v := range h {\n\t\tr.Use(v)\n\t}\n}", "title": "" }, { "docid": "0e242f0dc824e41a5c40613becb39560", "score": "0.60665953", "text": "func (h Handler) AddHandler(src client.Getter) Handler {\n\th[len(h)] = src\n\treturn h\n}", "title": "" }, { "docid": "e28e6245631397e8ba709207136f888c", "score": "0.6062085", "text": "func (srv *Server) AddHandler(pattern string, handler Handler) {\n\tif pattern == \"\" {\n\t\tpanic(\"http: invalid pattern \" + pattern)\n\t}\n\tif handler == nil {\n\t\tpanic(\"http: nil handler\")\n\t}\n\n\t// TODO\n\tsrv.handlers[pattern] = handler\n\n}", "title": "" }, { "docid": "3a7553e5402967a8dc3e24319b5cad86", "score": "0.6047541", "text": "func addHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"add handler\")\n\tr.ParseForm()\n\tvar key string\n\tvar val string\n\n\tkey = r.FormValue(\"key\")\n\tval = r.FormValue(\"val\")\n\n\tfmt.Printf(\"%s: %s\", key, val)\n\n\tmtx.Lock()\n\titems[key] = val\n\tmtx.Unlock()\n\n\tb, err := json.Marshal([]*update{\n\t\t&update{\n\t\t\tAction: \"add\",\n\t\t\tData: map[string]string{\n\t\t\t\tkey: val,\n\t\t\t},\n\t\t},\n\t})\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tbroadcasts.QueueBroadcast(&broadcast{\n\t\tmsg: append([]byte(\"d\"), b...),\n\t\tnotify: nil,\n\t})\n\n\tfmt.Fprintln(w, \"Done\")\n}", "title": "" }, { "docid": "a061cafd26af19e4c0be9124553cb463", "score": "0.60414004", "text": "func (m *Manager) AddHandler(handler interface{}) {\n\tm.Lock()\n\tdefer m.Unlock()\n\tm.eventHandlers = append(m.eventHandlers, handler)\n\n\tif len(m.Sessions) > 0 {\n\t\tfor _, v := range m.Sessions {\n\t\t\tv.AddHandler(handler)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4e48ea1c3d55236caee87c21a770605a", "score": "0.60383856", "text": "func (b *bot) AddHandler(name string, h Handler) {\n\tb.plugins[name] = h\n\tb.pluginOrdering = append(b.pluginOrdering, name)\n\tif entry := h.RegisterWeb(); entry != nil {\n\t\tb.httpEndPoints[name] = *entry\n\t}\n}", "title": "" }, { "docid": "66049eea23bf37b9a7ff4b170defb46d", "score": "0.5946277", "text": "func RegisterHandler(h interface{}) {\n\tregistry = append(registry, h)\n}", "title": "" }, { "docid": "801bfe4c27ad7909cae71ed6e15d01f7", "score": "0.5928222", "text": "func (s *Server) AddHandler(h Handler) {\n\ts.handlers = append(s.handlers, h)\n}", "title": "" }, { "docid": "65c210bea4618da83983a59e9db84942", "score": "0.59101826", "text": "func (e *GobEndpoint) AddHandleFunc(name string, f GobHandleFunc) {\n\te.m.Lock()\n\te.handler[name] = f\n\te.m.Unlock()\n}", "title": "" }, { "docid": "8606692ee6c9f309fd61c6f44ed01fee", "score": "0.58781207", "text": "func (s *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc) {\n\tfor path, fun := range hdlrs {\n\t\tif _, ok := s.registeredHanders[path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\ts.mux.Handle(path, httpHandlerCustom{ctx, fun})\n\t\ts.registeredHanders[path] = true\n\t}\n}", "title": "" }, { "docid": "fb42d22c2cd6bbef501e13492390f1f6", "score": "0.58559936", "text": "func (s *Server) AddHandlers(action protocol.Action, handlers ...Handler) {\n\ts.mutex.Lock()\n\tvar actualHandlers []Handler\n\n\tif handlersInMap, exist := s.handlers[action]; !exist {\n\t\tactualHandlers = make([]Handler, 0, len(handlers))\n\t} else {\n\t\tactualHandlers = *handlersInMap\n\t}\n\n\tnewHandlers := append(actualHandlers, handlers...)\n\n\ts.handlers[action] = &newHandlers\n\ts.mutex.Unlock()\n}", "title": "" }, { "docid": "ccbb8128b94883b0ab618267169cfb80", "score": "0.57890964", "text": "func (d DiscordContainer) AddHandler(handler interface{}) {\n\trmHandler := d.DiscordSession.AddHandler(handler)\n\td.eventHandlers = append(d.eventHandlers, rmHandler)\n}", "title": "" }, { "docid": "6e3b0eeb1890db9887b425518977a533", "score": "0.5784097", "text": "func (ts *TcpServer) AddHandler(th TcpHandler) {\n\tts.handler = th\n}", "title": "" }, { "docid": "a2b18ca8cddabbd524f21d11d42d5f48", "score": "0.57783765", "text": "func (ss *Server) RegisterHandler(cmd string, f HandleFunc) {\n\tss.handlers[cmd] = f\n}", "title": "" }, { "docid": "26c5c6245c5eea1c13f785ecb3a7c0cf", "score": "0.5760632", "text": "func (o *Ober) Add(path string, handler http.HandlerFunc) {\n\to.router.HandleFunc(path, handler)\n}", "title": "" }, { "docid": "08eba3dae9fc07d1aa1d492091f6d378", "score": "0.5747448", "text": "func (h *HLAEServer) RegisterHandler(handler func(string)) {\n\tif h.handlers == nil {\n\t\th.handlers = make([]func(string), 0)\n\t}\n\th.handlers = append(h.handlers, handler)\n\tfmt.Printf(\"Registered handler. Currently %d handlers are active\\n\", len(h.handlers))\n}", "title": "" }, { "docid": "da7c3c654cba2b20464a4518a1a737c6", "score": "0.5712199", "text": "func (w *watcher) AddMeshHandler(h func()) {\n\tw.mutex.Lock()\n\tdefer w.mutex.Unlock()\n\tw.handlers = append(w.handlers, h)\n}", "title": "" }, { "docid": "a7f4f7723871da4d5708bfe3955a939e", "score": "0.5705433", "text": "func (a *RestAPI) AddHandler(name string, method string, path string, description interface{}, callback http.HandlerFunc) error {\n\tif name == \"\" || method == \"\" || path == \"\" || callback == nil {\n\t\treturn fmt.Errorf(\"name, method, path or callback function not set\")\n\t}\n\n\ta.Routes = append(a.Routes, Route{\n\t\tname,\n\t\tmethod,\n\t\tpath,\n\t\tdescription,\n\t\tcallback,\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "aec979cd5bbde225b2ef1dc50d946217", "score": "0.5701115", "text": "func (d *Dispatcher) On(event string, handler http.HandlerFunc) {\n\td.handlers[event] = handler\n}", "title": "" }, { "docid": "cba9d0b62ebdd212bface216b125741c", "score": "0.5673456", "text": "func (c *Converter) Register(handler interface{}) error {\n\tinType := reflect.TypeOf(handler).In(0)\n\toutType := reflect.TypeOf(handler).Out(0)\n\thandlerValue := reflect.ValueOf(handler)\n\tif err := c.verifyHandler(handlerValue.Type()); err != nil {\n\t\treturn err\n\t}\n\n\toutMap, ok := c.registry[inType]\n\tif !ok {\n\t\toutMap = make(map[reflect.Type]reflect.Value)\n\t\tc.registry[inType] = outMap\n\t}\n\t//if !set.Override {\n\t//\tif _, ok := outMap[outType]; ok {\n\t//\t\treturn fmt.Errorf(\"%s already exist\", handlerValue.Type().Name())\n\t//\t}\n\t//}\n\toutMap[outType] = handlerValue\n\treturn nil\n}", "title": "" }, { "docid": "ef8d80966d7c4eeffec0dc31a596d927", "score": "0.5670271", "text": "func mapHandler(s *discordgo.Session, m *discordgo.MessageCreate, command commandWithArgs) {\n\n\tmCommand := parseMapCommand(command)\n\tmCommand.author = m.Author.Username\n\n\turl := fmt.Sprintf(\"%s/map?secret=%s\", backendURL, backendSecret)\n\tif len(mCommand.args) > 0 {\n\t\turl = fmt.Sprintf(\"%s&coords=%s\", url, strings.Join(mCommand.args, \",\"))\n\t}\n\n\tresp, err := http.Get(url)\n\tif err != nil || resp.StatusCode != http.StatusOK {\n\t\tfmt.Printf(\"Failed to get map - got %s. Error was: %v\\n\", resp.Status, err)\n\t\ts.ChannelMessageSend(m.ChannelID, fmt.Sprintf(\":flushed: Failed to get map - %s\", resp.Status))\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\terr = sendDiscordResponse(s, m, resp, mCommand)\n\tif err != nil {\n\t\tfmt.Println(\"Something went wrong while sending Discord response\", err)\n\t\treturn\n\t}\n\n\terr = s.ChannelMessageDelete(m.ChannelID, m.ID)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to delete trigger message\", err)\n\t}\n}", "title": "" }, { "docid": "2d5941d500001e9e8a8cb1fc8043a55e", "score": "0.56629723", "text": "func (k *Kite) addHandle(method string, handler Handler) *Method {\n\tauthenticate := true\n\tif k.Config.DisableAuthentication {\n\t\tauthenticate = false\n\t}\n\n\tm := &Method{\n\t\tname: method,\n\t\thandler: handler,\n\t\tpreHandlers: make([]Handler, 0),\n\t\tpostHandlers: make([]Handler, 0),\n\t\tauthenticate: authenticate,\n\t\thandling: k.MethodHandling,\n\t}\n\n\tk.handlers[method] = m\n\treturn m\n}", "title": "" }, { "docid": "9686b18012bea2b49b280e4c5fb492b4", "score": "0.5656316", "text": "func (r *Role) AddHandler(t Task) *Role {\n\n\tif _, ok := t[\"name\"]; !ok {\n\t\tlog.Panic(\"missing 'name' in task\")\n\t}\n\tr.handlers = append(r.handlers, t)\n\treturn r\n}", "title": "" }, { "docid": "238d8f40baec3167f519e53fcb595958", "score": "0.5656256", "text": "func AddHandler(c *cli.Context) error {\n\tresources, err := resource.LoadHandler()\n\n\tif err != nil {\n\t\tlog.Fatal(\"Error occured during adding resource.\")\n\t\treturn nil\n\t}\n\n\tswitch c.Command.Name {\n\tcase \"file\":\n\t\terr = AddFileHandler(c.Args().Get(0), resources)\n\tcase \"folder\":\n\t\terr = AddFolderHandler(c.Args().Get(0), resources)\n\tdefault:\n\t\tcommandError := new(resource.UnknownCommand)\n\t\tcommandError.SetName(c.Command.Name)\n\t\terr = commandError\n\t}\n\n\treturn resource.SaveHandler(resources)\n}", "title": "" }, { "docid": "de01e13b29e7a0bffe6615d125613a70", "score": "0.56501067", "text": "func (s *GameServer) RegisterHandler(handler ginterface.IGameHandler) {\n\ts.Handlers[handler.Code()] = handler\n}", "title": "" }, { "docid": "2fc8a1b2f4ff618d76b2523732990909", "score": "0.5643642", "text": "func (p *defaultWatcher) AddHandler(handler DefaultHandler) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tp.handlers = append(p.handlers, handler)\n}", "title": "" }, { "docid": "c6bad61a68b56d93acf15507493f3334", "score": "0.5642559", "text": "func (w *FileContentWatcher) AddHandler(filePath string, contentChan chan string, errChan chan error) {\n\tif item, ok := w.items[filePath]; ok {\n\t\tw.items[filePath].contentHandlers = append(item.contentHandlers, contentChan)\n\t\tw.items[filePath].errorHandlers = append(item.errorHandlers, errChan)\n\t} else {\n\t\tw.items[filePath] = &fileContentItem{\n\t\t\tcontent: \"\",\n\t\t\terr: nil,\n\t\t\tlock: sync.RWMutex{},\n\t\t\tcontentHandlers: []chan string{contentChan},\n\t\t\terrorHandlers: []chan error{errChan},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8747e271302e494cd187bf6f6743cee0", "score": "0.56374836", "text": "func (m mapping) Add(httpmethod string, names ...string) Mapping {\n\n\t// check if http method exists\n\tif !stringListContains(AVAILABLE_METHODS, httpmethod) {\n\t\tloggerError(m.isDebug(), \"http method %v not in available methods %v\", httpmethod, AVAILABLE_METHODS)\n\t\treturn m\n\t}\n\n\tif _, ok := m.dispatcher[httpmethod]; !ok {\n\t\tm.dispatcher[httpmethod] = []string{}\n\t}\n\n\tm.dispatcher[httpmethod] = append(m.dispatcher[httpmethod], names...)\n\n\treturn m\n}", "title": "" }, { "docid": "e08330d6619c17df2e365e075c70efa8", "score": "0.56318486", "text": "func (r *Radio) AddHandlerOnly(key Key, handler Handler) {\n\tr.handlers[key] = handler\n}", "title": "" }, { "docid": "56baf536306c51e48503f5848705f517", "score": "0.5613968", "text": "func (seh *sharedEventHandler) addHandler(iw *informerWrapper, handler cache.ResourceEventHandler, resyncPeriod time.Duration) {\n\tseh.mutex.Lock()\n\tdefer seh.mutex.Unlock()\n\n\teh := &eventHandler{ResourceEventHandler: handler, sharedEventHandler: seh}\n\tseh.handlers[iw] = append(seh.handlers[iw], eh)\n\n\t// Do an initial resync to pick up anything that already exists.\n\t// Usually the shared informer does this when a new handler is added.\n\t// Since we aren't actually adding this handler to the shared informer,\n\t// we need to do it ourselves.\n\teh.resync()\n\n\t// If the requested resync period is more frequent than the underlying relist,\n\t// start a timer just for this handler.\n\tif resyncPeriod < seh.relistPeriod {\n\t\teh.start(resyncPeriod)\n\t}\n}", "title": "" }, { "docid": "83e42fba4bdd69a3ffc9a093c0232294", "score": "0.56138486", "text": "func (s *Session) AddHandler(i interface{}) {\n\tswitch t := i.(type) {\n\n\t// ChannelCreate\n\tcase func(*Session, *discordgo.ChannelCreate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.ChannelCreate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// ChannelDelete\n\tcase func(*Session, *discordgo.ChannelDelete):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.ChannelDelete) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// ChannelPinsUpdate\n\tcase func(*Session, *discordgo.ChannelPinsUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.ChannelPinsUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// ChannelUpdate\n\tcase func(*Session, *discordgo.ChannelUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.ChannelUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildBanAdd\n\tcase func(*Session, *discordgo.GuildBanAdd):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildBanAdd) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildBanRemove\n\tcase func(*Session, *discordgo.GuildBanRemove):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildBanRemove) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildCreate\n\tcase func(*Session, *discordgo.GuildCreate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildCreate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildDelete\n\tcase func(*Session, *discordgo.GuildDelete):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildDelete) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildEmojisUpdate\n\tcase func(*Session, *discordgo.GuildEmojisUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildEmojisUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildIntegrationsUpdate\n\tcase func(*Session, *discordgo.GuildIntegrationsUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildIntegrationsUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildMemberAdd\n\tcase func(*Session, *discordgo.GuildMemberAdd):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildMemberAdd) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildMemberRemove\n\tcase func(*Session, *discordgo.GuildMemberRemove):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildMemberRemove) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildMemberUpdate\n\tcase func(*Session, *discordgo.GuildMemberUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildMemberUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildMembersChunk\n\tcase func(*Session, *discordgo.GuildMembersChunk):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildMembersChunk) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildRoleCreate\n\tcase func(*Session, *discordgo.GuildRoleCreate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildRoleCreate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildRoleDelete\n\tcase func(*Session, *discordgo.GuildRoleDelete):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildRoleDelete) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildRoleUpdate\n\tcase func(*Session, *discordgo.GuildRoleUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildRoleUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// GuildUpdate\n\tcase func(*Session, *discordgo.GuildUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.GuildUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageAck\n\tcase func(*Session, *discordgo.MessageAck):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageAck) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageCreate\n\tcase func(*Session, *discordgo.MessageCreate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageCreate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageDelete\n\tcase func(*Session, *discordgo.MessageDelete):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageDelete) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageDeleteBulk\n\tcase func(*Session, *discordgo.MessageDeleteBulk):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageDeleteBulk) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageReactionAdd\n\tcase func(*Session, *discordgo.MessageReactionAdd):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageReactionAdd) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageReactionRemove\n\tcase func(*Session, *discordgo.MessageReactionRemove):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageReactionRemove) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageReactionRemoveAll\n\tcase func(*Session, *discordgo.MessageReactionRemoveAll):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageReactionRemoveAll) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// MessageUpdate\n\tcase func(*Session, *discordgo.MessageUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.MessageUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// PresenceUpdate\n\tcase func(*Session, *discordgo.PresenceUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.PresenceUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// PresencesReplace\n\tcase func(*Session, *discordgo.PresencesReplace):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.PresencesReplace) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// Ready\n\tcase func(*Session, *discordgo.Ready):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.Ready) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// RelationshipAdd\n\tcase func(*Session, *discordgo.RelationshipAdd):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.RelationshipAdd) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// RelationshipRemove\n\tcase func(*Session, *discordgo.RelationshipRemove):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.RelationshipRemove) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// Resumed\n\tcase func(*Session, *discordgo.Resumed):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.Resumed) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// TypingStart\n\tcase func(*Session, *discordgo.TypingStart):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.TypingStart) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// UserGuildSettingsUpdate\n\tcase func(*Session, *discordgo.UserGuildSettingsUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.UserGuildSettingsUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// UserNoteUpdate\n\tcase func(*Session, *discordgo.UserNoteUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.UserNoteUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// UserSettingsUpdate\n\tcase func(*Session, *discordgo.UserSettingsUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.UserSettingsUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// UserUpdate\n\tcase func(*Session, *discordgo.UserUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.UserUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// VoiceServerUpdate\n\tcase func(*Session, *discordgo.VoiceServerUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.VoiceServerUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t// VoiceStateUpdate\n\tcase func(*Session, *discordgo.VoiceStateUpdate):\n\t\ts.DG.AddHandler(func(_ *discordgo.Session, data *discordgo.VoiceStateUpdate) {\n\t\t\tt(s, data)\n\t\t})\n\n\t}\n}", "title": "" }, { "docid": "cf5f10ac50da618071c31a0e9c2cae78", "score": "0.5586198", "text": "func (group *handlerGroup) AddHandler(handler TaskHandler, handlers ...TaskHandler) {\n\tgroup.handlers = append(group.handlers, handler)\n\tif len(handlers) > 0 {\n\t\tgroup.handlers = append(group.handlers, handlers...)\n\t}\n}", "title": "" }, { "docid": "a603a6773a888f4ae152605547abb298", "score": "0.5586194", "text": "func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) {\n\ts.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h})\n}", "title": "" }, { "docid": "3b6afc01b2605422997c8c183292b208", "score": "0.5581569", "text": "func AddFuncMap(key string, fn interface{}) error {\n\treturn web.AddFuncMap(key, fn)\n}", "title": "" }, { "docid": "0e654b0e83c68f085bbbcf79b68a67b2", "score": "0.5561856", "text": "func (self *server) register(pattern string, handler interface{}, methods ...string) {\n\tvar name = strings.Join(methods, \"|\") + \":\" + pattern\n\t// finds the full function name (with package) as its mappings.\n\t//var name = runtime.FuncForPC(reflect.ValueOf(handler).Pointer()).Name()\n\n\tswitch H := handler.(type) {\n\tcase http.Handler:\n\t\tself.mux.Handle(pattern, H).Methods(methods...).Name(name)\n\n\tcase func(http.ResponseWriter, *http.Request):\n\t\tself.mux.HandleFunc(pattern, H).Methods(methods...).Name(name)\n\n\tdefault:\n\t\tpanic(\"Unsupported handler: \" + name)\n\t}\n}", "title": "" }, { "docid": "68a1a917005f318bd0cd960387201b73", "score": "0.55584115", "text": "func AddHandler(version int, method, path string, handle httprouter.Handle) {\n\t// Strip away first / if there is one present\n\tpath = strings.TrimLeft(path, \"/\")\n\tif version > 0 {\n\t\t// If the path has a version associated with it, we prepend the version to the route: /v1/entries\n\t\tpath = fmt.Sprintf(\"/v%d/%s\", version, path)\n\t} else {\n\t\tpath = \"/\" + path\n\t}\n\n\t// Append the new route to the slice with the correct version\n\troutes[version] = append(routes[version], Route{Method: method, Path: path, Handle: handle})\n}", "title": "" }, { "docid": "e2dbeac565209b0dcbb60420f85ca9c8", "score": "0.55430907", "text": "func (this *TemplateRegistor) AddFuncMap(key string, funname interface{}) error {\n\tif _, ok := this.tplFuncMap[key]; ok {\n\t\treturn errors.New(\"funcmap already has the key\")\n\t}\n\tthis.tplFuncMap[key] = funname\n\treturn nil\n}", "title": "" }, { "docid": "d358597ec041e1d6c84dc1b432ba2195", "score": "0.55360234", "text": "func (a *app) registerHandlers() {\n\ta.types = strings.Split(a.strTypes, \",\")\n\tfor _, t := range a.types {\n\t\ta.views[t] = make(map[int]int)\n\t\thttp.HandleFunc(\"/\"+t+\"/\", a.handleView(t))\n\t}\n\n\thttp.HandleFunc(\"/pop\", a.handlePop())\n}", "title": "" }, { "docid": "91e22e466c03fbd1d4e686eb488ed18c", "score": "0.55351573", "text": "func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc {\n\t//fmt.Printf(\"good going\")\n\treturn func (w http.ResponseWriter , r *http.Request){\n\t\ttoUrl, present := pathsToUrls[r.URL.Path]\n\t\tif present {\n\t\t\thttp.Redirect (w, r ,toUrl,301)\n\t\t}else {\n\t\t\tfallback.ServeHTTP(w,r) }\n\t}\n\t//\tTODO: Implement this...\n}", "title": "" }, { "docid": "8524a49a681aa86def637ee9c2ff31c8", "score": "0.55317366", "text": "func (r ResourceEventHandlerFuncs) OnAdd(obj interface{}) {\n\tif r.AddFunc != nil && r.ShouldProcess() {\n\t\tr.AddFunc(obj)\n\t}\n}", "title": "" }, { "docid": "bfbd73fb2c1e504f822b81d88547d362", "score": "0.5530809", "text": "func addHandler(w http.ResponseWriter, req *http.Request) {\n\tif err := req.ParseForm(); err != nil {\n\t\tfmt.Fprintf(w, \"ParseForm() err: %v\", err)\n\t\treturn\n\t}\n\tauthor := req.Form.Get(\"author\")\n\tentry := req.Form.Get(\"entry\")\n\tfmt.Fprintf(w, \"%v:%v\", author, entry)\n\tsaveData(entry, author)\n\n}", "title": "" }, { "docid": "575b8532cc005da96b53f1a188217bcf", "score": "0.5520687", "text": "func AddHandler(s *discordgo.Session, m *discordgo.MessageCreate, args string) {\n\terr := config.ServerList.Add(args)\n\n\tif err != nil {\n\t\ts.ChannelMessageSend(m.ChannelID, err.Error())\n\t\treturn\n\t}\n\ts.ChannelMessageSend(m.ChannelID, \"Added.\")\n}", "title": "" }, { "docid": "e37719f444e9e2c4de8d42383f5b819f", "score": "0.5511024", "text": "func (h *Handler) OnAdd(obj interface{}) {\n\t// assert the type to an object to pull out relevant data\n\tswitch obj := obj.(type) {\n\tcase *corev1.Service:\n\t\tif h.ignored.IsIgnored(obj.ObjectMeta) {\n\t\t\treturn\n\t\t}\n\n\t\tif err := h.createMeshServiceFunc(obj); err != nil {\n\t\t\tlog.Errorf(\"Could not create mesh service: %v\", err)\n\t\t}\n\tcase *corev1.Endpoints:\n\t\treturn\n\tcase *corev1.Pod:\n\t\tif !isMeshPod(obj) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Trigger a configuration rebuild.\n\th.configRefreshChan <- k8s.ConfigMessageChanRebuild\n}", "title": "" }, { "docid": "b1cf50c7793b94d0346cdd0771cac6c9", "score": "0.5510391", "text": "func (s *BaseGolangListener) EnterMapType(ctx *MapTypeContext) {}", "title": "" }, { "docid": "1465e0b4ea41c3eba35e3fd80837c17d", "score": "0.55047303", "text": "func (p *MockBaseplateProcessor) AddToProcessorMap(name string, processorFunc thrift.TProcessorFunction) {\n\tp.processorMap[name] = processorFunc\n}", "title": "" }, { "docid": "6ce5077085634846a94af08f05ea3969", "score": "0.5504272", "text": "func (iproxy *InterceptingProxy) AddHTTPHandler(host string, handler ProxyWebUIHandler) {\n\tiproxy.mtx.Lock()\n\tdefer iproxy.mtx.Unlock()\n\tiproxy.httpHandlers[host] = handler\n}", "title": "" }, { "docid": "4e4e2dc4b8f5e86c24ca9fc1c16726b0", "score": "0.55003065", "text": "func SetupRouter(router *mux.Router, m map[string]func(http.ResponseWriter,*http.Request)) {\n for key, value := range m {\n router.HandleFunc(key,value)\n }\n}", "title": "" }, { "docid": "ba5b9db725e5f4457c8938ce32c54bda", "score": "0.5499355", "text": "func (h *hub) SetHandler(method string, handler Handler) {\n\th.handlers[method] = handler\n}", "title": "" }, { "docid": "bafa355f629c151543484513d42db6a5", "score": "0.54852253", "text": "func (sm *SecretManagerStore) AddRotationHandler(ctx context.Context, name string, cb RotationHandler) error {\n\tswitch name, err := sm.normalizeName(name); {\n\tcase err != nil:\n\t\treturn err\n\n\tcase !strings.HasPrefix(name, \"sm://\"):\n\t\treturn nil // no updates for static secrets\n\n\tdefault:\n\t\tsm.rwm.Lock()\n\t\tdefer sm.rwm.Unlock()\n\t\tif sm.handlers == nil {\n\t\t\tsm.handlers = make(map[string][]RotationHandler, 1)\n\t\t}\n\t\tsm.handlers[name] = append(sm.handlers[name], cb)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "fbf2dd02b4cb7b482edbd8b61c3d46df", "score": "0.54850215", "text": "func AddContextHandler(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// map[GroupPolicyID int64](Value int64)\n\t\tctx := context.WithValue(r.Context(), \"groupPolicyHitValue\", &sync.Map{})\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "ea81c8252ae2257c2582b17b197059f9", "score": "0.54823875", "text": "func (hm *HandlerManager) AddHandler(h *Handler) {\n\thms := hm.hms\n\n\t// if we finish first\n\t// no deadlock can occur here despite taking the locks in the\n\t// opposite order because hm -> h in Get has no reference\n\t// in the handler list\n\tif hms.maxRunners != 0 && h.runners == hms.maxRunners-1 {\n\t\thm.mutex.Lock()\n\t\thm.hElements[h] = hm.handlers.PushFront(h)\n\t\thm.maxHandlers = max(hm.maxHandlers, hm.handlers.Len())\n\t\thm.mutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "10978368022dc11573995c8d6f94ac99", "score": "0.5479471", "text": "func (server *Server) On(handler HandleFunc, flag int) {\n\tswitch flag {\n\tcase NoticeHandler:\n\t\tserver.noticeHandler = handler\n\t\tbreak\n\tcase RequestHandler:\n\t\tserver.requestHandler = handler\n\t\tbreak\n\tdefault:\n\t\tserver.SendLog(Error, \"参数错误\")\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "61012dd08bb4fabb168a610d5e9c105a", "score": "0.54719883", "text": "func (wf *WatchFactory) AddServiceHandler(handler cache.ResourceEventHandler, processExisting func([]interface{})) {\n\twf.addHandler(typeServices, handler, processExisting)\n}", "title": "" }, { "docid": "1471ef3161e53cdfdc78055acfe8d334", "score": "0.54502684", "text": "func (c *Collection) AddPostHandler(r fasthttp.RequestHandler) {\n\tc.Handlers.Wrapper.AddPostHandler(r)\n}", "title": "" }, { "docid": "34470a8320ce6e49093318706b4886df", "score": "0.5446038", "text": "func (server *SimpleServer) SetHandler(methodName string, handler RequestHandler) {\n\tserver.requestHandlers[methodName] = handler\n}", "title": "" }, { "docid": "85e048c78cc002db0d64b4bebed440c6", "score": "0.5417383", "text": "func GetHandler(app *context.App) context.HandlerMap { return app.Handlers }", "title": "" }, { "docid": "06f29c5ee7f048505acc9b87534e6972", "score": "0.54160625", "text": "func (r ResourceEventHandlerFuncs) OnAdd(obj Resource) {\n\tif r.AddFunc != nil {\n\t\tr.AddFunc(obj)\n\t}\n}", "title": "" }, { "docid": "8023ed9c98c7d4edbece0124d6c7507b", "score": "0.5412753", "text": "func (router *Router) AddHandler(args RouterArguments) {\n\tpath := fmt.Sprintf(\"/%s\", strings.Trim(args.Path, \"/\"))\n\trouter.r.\n\t\tMethods(args.Method).\n\t\tPath(fmt.Sprintf(\"%s\", path)).\n\t\tHandlerFunc(JSONHandler(args.Handler))\n}", "title": "" }, { "docid": "0405e0d6010a3ec31791278e20f0a64a", "score": "0.54099333", "text": "func (h *metaHandler) setHandler(f HealthFunc) {\n\th.healthFn = f\n}", "title": "" }, { "docid": "9e5eaf44b621a2e1df796fac62235900", "score": "0.54057324", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []Handler{\n\t\tsupport.NewHTTPHandler(verifyVPPath, http.MethodPost, c.verifyVP),\n\t\tsupport.NewHTTPHandler(oauth2GetRequestPath, http.MethodGet, c.createOIDCRequest),\n\t\tsupport.NewHTTPHandler(oauth2CallbackPath, http.MethodGet, c.handleOIDCCallback),\n\t}\n}", "title": "" }, { "docid": "4417bae852b73a24c17ea5d15446f8e6", "score": "0.5404817", "text": "func (r *trieRouter) RegisteredHandler(method string, pattern string, handler func(ctx *base.Context)) error {\n\tparts := strings.Split(pattern, \"/\")\n\tif len(parts) <= 1 {\n\t\treturn fmt.Errorf(\"error pattern format: %s\", pattern)\n\t}\n\n\tr.root.insertNode(pattern, parts)\n\trouterKey := method + \"-\" + pattern\n\tr.handlerMap[routerKey] = handler\n\treturn nil\n}", "title": "" }, { "docid": "05d05be4b1ef330de21c2e076f82e950", "score": "0.539772", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []Handler{\n\t\tsupport.NewHTTPHandler(createCredentialEndpoint, http.MethodPost, c.createCredentialHandler),\n\t\tsupport.NewHTTPHandler(createProfileEndpoint, http.MethodPost, c.createProfileHandler),\n\t\tsupport.NewHTTPHandler(getProfileEndpoint, http.MethodGet, c.getProfileHandler),\n\t\tsupport.NewHTTPHandler(verifyCredentialEndpoint, http.MethodPost, c.verifyCredentialHandler),\n\t}\n}", "title": "" }, { "docid": "02a319307fcbe0746f1e92f2083102a7", "score": "0.5397458", "text": "func (err *Error) registerHandlers() {\n\tm := map[string]func(http.ResponseWriter, *http.Request){\n\t\t\"404\": err.notFound,\n\t\t\"500\": err.serverInternalError,\n\t}\n\tfor e, h := range m {\n\t\tif _, ok := err.ErrMaps[e]; !ok {\n\t\t\terr.ErrHandler(e, h)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d8b92e8164c6e039907a16d9df29ab02", "score": "0.53938055", "text": "func (km KeyMap) Add(key string, f func(), name string) {\n\tkm[key] = Action{f, name}\n}", "title": "" }, { "docid": "72a6869826a957adc07e156b1a3c814e", "score": "0.539369", "text": "func (el *eventLoop) registerHandler(msgType string, handler eventHandler) eventHandler {\n\toldHandler := el.handlers[msgType]\n\tel.handlers[msgType] = handler\n\n\treturn oldHandler\n}", "title": "" }, { "docid": "66e15455047f195af936c36c40bb76f3", "score": "0.53903544", "text": "func (c *Client) AddRequestHandler(h RequestHandler) error {\n\tc.requestHandlers = append([]RequestHandler{h}, c.requestHandlers...)\n\treturn nil\n}", "title": "" }, { "docid": "26f0cc54d7fe3b56f41ecbc127c700bf", "score": "0.5388239", "text": "func (handler *Handler) Put(handleFunc func(*Context)) {\n\thandler.OnPut = handleFunc\n}", "title": "" }, { "docid": "f83e3b36987999e75ef97de171cb9b61", "score": "0.53868765", "text": "func (h MappingHandlerFunc) HandleMapping(k, v digest.Digest, kind Kind, taskType string, labels []string) {\n\th(k, v, kind, taskType, labels)\n}", "title": "" }, { "docid": "39f4240f571ede289d5b3caaa952328c", "score": "0.53761685", "text": "func (server *HTTPAPIServer) SetHandler(method *MethodValue, path string, fn Handler) error {\n\tvar wrapper = &HandlerWrapper{\n\t\thandler: fn,\n\t\tserver: server,\n\t}\n\n\tswitch method.Value {\n\tcase APIMethod.GET.Value:\n\t\tserver.Echo.GET(path, wrapper.processCore)\n\tcase APIMethod.POST.Value:\n\t\tserver.Echo.POST(path, wrapper.processCore)\n\tcase APIMethod.PUT.Value:\n\t\tserver.Echo.PUT(path, wrapper.processCore)\n\tcase APIMethod.DELETE.Value:\n\t\tserver.Echo.DELETE(path, wrapper.processCore)\n\tcase APIMethod.OPTIONS.Value:\n\t\tserver.Echo.OPTIONS(path, wrapper.processCore)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4bacabd50ead126d8dbe4d718533706f", "score": "0.53583276", "text": "func (ch *Chi) AddHandler(method, path string, handlers context.Handlers) {\n\turl := path\n\treg1 := regexp.MustCompile(\":(.*?)/\")\n\treg2 := regexp.MustCompile(\":(.*?)$\")\n\turl = reg1.ReplaceAllString(url, \"{$1}/\")\n\turl = reg2.ReplaceAllString(url, \"{$1}\")\n\n\tif len(url) > 1 && url[0] == '/' && url[1] == '/' {\n\t\turl = url[1:]\n\t}\n\n\tgetHandleFunc(ch.app, strings.ToUpper(method))(url, func(w http.ResponseWriter, r *http.Request) {\n\n\t\tif r.URL.Path[len(r.URL.Path)-1] == '/' {\n\t\t\tr.URL.Path = r.URL.Path[:len(r.URL.Path)-1]\n\t\t}\n\n\t\tctx := context.NewContext(r)\n\n\t\tparams := chi.RouteContext(r.Context()).URLParams\n\n\t\tfor i := 0; i < len(params.Values); i++ {\n\t\t\tif r.URL.RawQuery == \"\" {\n\t\t\t\tr.URL.RawQuery += strings.ReplaceAll(params.Keys[i], \":\", \"\") + \"=\" + params.Values[i]\n\t\t\t} else {\n\t\t\t\tr.URL.RawQuery += \"&\" + strings.ReplaceAll(params.Keys[i], \":\", \"\") + \"=\" + params.Values[i]\n\t\t\t}\n\t\t}\n\n\t\tctx.SetHandlers(handlers).Next()\n\t\tfor key, head := range ctx.Response.Header {\n\t\t\tw.Header().Set(key, head[0])\n\t\t}\n\t\tif ctx.Response.Body != nil {\n\t\t\tbuf := new(bytes.Buffer)\n\t\t\t_, _ = buf.ReadFrom(ctx.Response.Body)\n\t\t\tw.WriteHeader(ctx.Response.StatusCode)\n\t\t\t_, _ = w.Write(buf.Bytes())\n\t\t} else {\n\t\t\tw.WriteHeader(ctx.Response.StatusCode)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "0808492f39864e012b436a0e086c0b92", "score": "0.5353049", "text": "func (r ResourceEventHandlerFuncs) OnAdd(obj interface{}, isInInitialList bool) {\n\tif r.AddFunc != nil {\n\t\tr.AddFunc(obj)\n\t}\n}", "title": "" }, { "docid": "802aa754cda9cd876d6f4e18b1586fa2", "score": "0.5349542", "text": "func (d *OSCDispatcher) AddMsgHandler(addr string, handler HandlerFunc) error {\n\tfor _, chr := range \"*?,[]{}# \" {\n\t\tif strings.Contains(addr, fmt.Sprintf(\"%c\", chr)) {\n\t\t\treturn fmt.Errorf(\"OSC Address string may not contain any characters in %q\\n\", chr)\n\t\t}\n\t}\n\n\tif addressExists(addr, d.handlers) {\n\t\treturn fmt.Errorf(\"OSC address %q exists already\", addr)\n\t}\n\n\td.handlers[addr] = handler\n\treturn nil\n}", "title": "" }, { "docid": "e7861fb981416319c6175148fcbb6bbf", "score": "0.53470767", "text": "func (t *TemplateFuncsNamespace) AddMethodMapping(m any, aliases []string, examples [][2]string) {\n\tif t.MethodMappings == nil {\n\t\tt.MethodMappings = make(map[string]TemplateFuncMethodMapping)\n\t}\n\n\tname := methodToName(m)\n\n\t// Rewrite §§ to ` in example commands.\n\tfor i, e := range examples {\n\t\texamples[i][0] = strings.ReplaceAll(e[0], \"§§\", \"`\")\n\t}\n\n\t// sanity check\n\tfor _, e := range examples {\n\t\tif e[0] == \"\" {\n\t\t\tpanic(t.Name + \": Empty example for \" + name)\n\t\t}\n\t}\n\tfor _, a := range aliases {\n\t\tif a == \"\" {\n\t\t\tpanic(t.Name + \": Empty alias for \" + name)\n\t\t}\n\t}\n\n\tt.MethodMappings[name] = TemplateFuncMethodMapping{\n\t\tMethod: m,\n\t\tAliases: aliases,\n\t\tExamples: examples,\n\t}\n}", "title": "" }, { "docid": "683fa3621cb4e6455c4e52fda41ebb7e", "score": "0.5346646", "text": "func (_m *Cache) OnAdd(_a0 func(string, string)) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "5a5824cdd9a7852cb2f843c7f8a7f666", "score": "0.5343729", "text": "func (am *HandlerFuncAtomicMap) Set(key string, value HandlerFunc) {\n\tam.mu.Lock()\n\tdefer am.mu.Unlock()\n\n\tm1 := am.val.Load().(_HandlerFuncMap)\n\tm2 := make(_HandlerFuncMap, len(m1)+1)\n\tfor k, v := range m1 {\n\t\tm2[k] = v\n\t}\n\n\tm2[key] = value\n\tam.val.Store(m2)\n\treturn\n}", "title": "" }, { "docid": "b8e2454935e0d6b6e2e0c0f02f2e3a9f", "score": "0.5327078", "text": "func (p *Pipeline) Add(handler Handler) {\n\tp.Handlers = append(p.Handlers, handler)\n}", "title": "" }, { "docid": "76e09cbac5e09261f4b06b88e7cea44e", "score": "0.5323271", "text": "func (hs *HookSink) Add(path string, handler interface{}) {\n\tmatch := false\n\n\t/* Check if this is a PushHandler */\n\tpusher, ok := handler.(PushHandler)\n\t/* If this is a PushHander, setup a Martini handler for it */\n\tif ok {\n\t\tmatch = true\n\t\t// TODO: Need to add logic here to make sure this is actually a `push` event\n\t\t// Use X-GitHub-Event header for this.\n\t\t// see https://developer.github.com/v3/repos/hooks/#webhook-headers\n\t\t// TODO: Test what happens if we end up with multiple handlers at a given path\n\t\ths.martini.Post(path, func(res http.ResponseWriter, params martini.Params, req *http.Request) {\n\t\t\t/* Create an empty message */\n\t\t\tfoobar := PushMessage{}\n\n\t\t\t/* Grab the payload from the request body */\n\t\t\tpayload, err := ioutil.ReadAll(req.Body)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error reading request body: %s\", err.Error())\n\t\t\t\tres.WriteHeader(500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t/* If this HookSink specified a secret, check the signature */\n\t\t\tif hs.secret != \"\" {\n\t\t\t\tif !checkGitHubSignature(payload, hs.secret, req) {\n\t\t\t\t\tlog.Printf(\"GitHub signature was not valid\")\n\t\t\t\t\tres.WriteHeader(401)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Unmarshal the payload into our PushMessage struct */\n\t\t\terr = json.Unmarshal(payload, &foobar)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error reading JSON data: %s\", err.Error())\n\t\t\t\tres.WriteHeader(500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t/* Looks like we have a valid PushMessage, let the handler know. */\n\t\t\tgo pusher.Push(foobar, map[string][]string(req.URL.Query()))\n\n\t\t\t/* Reply with \"OK\" status */\n\t\t\tres.WriteHeader(200)\n\t\t})\n\t}\n\n\t/* If the handler didn't match any known interface, throw a fatal error */\n\tif !match {\n\t\tlog.Fatalf(\"Handler didn't match any known handler interface: %v\", handler)\n\t}\n}", "title": "" }, { "docid": "e4238a49382f34fa9f525363499f3a0d", "score": "0.53210646", "text": "func Handle(actionName string, h ActionHandler) {\n\tactionHandlers[actionName] = h\n}", "title": "" }, { "docid": "310cac0a84b275cb2a7b39304941d316", "score": "0.53185695", "text": "func (s *Server) doBindHandler(\n\tpattern string, handler HandlerFunc,\n\tmiddleware []HandlerFunc, source string,\n) {\n\ts.setHandler(pattern, &handlerItem{\n\t\titemName: gdebug.FuncPath(handler),\n\t\titemType: handlerTypeHandler,\n\t\titemFunc: handler,\n\t\tmiddleware: middleware,\n\t\tsource: source,\n\t})\n}", "title": "" }, { "docid": "7c7597552fddcc20ae24b2b79d56be1d", "score": "0.5315253", "text": "func (r HandlerMap) RegisterService(desc *grpc.ServiceDesc, h interface{}) {\n\tht := reflect.TypeOf(desc.HandlerType).Elem()\n\tst := reflect.TypeOf(h)\n\tif !st.Implements(ht) {\n\t\tpanic(fmt.Sprintf(\"service %s: handler of type %v does not satisfy %v\", desc.ServiceName, st, ht))\n\t}\n\tif _, ok := r[desc.ServiceName]; ok {\n\t\tpanic(fmt.Sprintf(\"service %s: handler already registered\", desc.ServiceName))\n\t}\n\tr[desc.ServiceName] = service{desc: desc, handler: h}\n}", "title": "" }, { "docid": "6854879395f4a5ccadfbef538c89cefc", "score": "0.531362", "text": "func (plugin *Backup) AddHandler(method string, path string, handler func(echo.Context) error, authLevel ...plugins.AuthLevel) {\n\tpluginHandler := &plugins.PluginHandler{\n\t\tPath: path,\n\t\tHandler: handler,\n\t\tMethod: method,\n\t\tAuthLevel: plugins.AuthLevelAdmin,\n\t}\n\tif len(authLevel) > 0 {\n\t\tpluginHandler.AuthLevel = authLevel[0]\n\t}\n\tplugin.handlers = append(plugin.handlers, pluginHandler)\n}", "title": "" }, { "docid": "48dbc51a40d1011ccbb5c79f6b2ef214", "score": "0.53114253", "text": "func (e *EventEngine) Register(topic EventTopic, handlerID HandlerID, handler EventHandler) {\n\ths := &sync.Map{}\n\tactual, _ := e.topic2hs.LoadOrStore(topic, hs)\n\tactual.(*sync.Map).Store(handlerID, handler)\n\n\te.logger.Info(\"register handler\",\n\t\tzap.String(\"topic\", topic.String()),\n\t\tzap.String(\"handler\", handlerID.String()))\n}", "title": "" }, { "docid": "c264bf561127e13f9de665c705a71648", "score": "0.53046566", "text": "func (o *ShapparAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) {\n\tum := strings.ToUpper(method)\n\tif path == \"/\" {\n\t\tpath = \"\"\n\t}\n\to.Init()\n\tif h, ok := o.handlers[um][path]; ok {\n\t\to.handlers[method][path] = builder(h)\n\t}\n}", "title": "" }, { "docid": "1f30bf51a4df72aff3af2fac60d7c40f", "score": "0.5293352", "text": "func (s *App) Register(name string, fn reflect.Value) {\n\n\tif _, exist := s.handlerMap[name]; exist {\n\t\tpanic(fmt.Sprintf(\"method :%s already exist\", name))\n\t}\n\ts.handlerMap[name] = fn\n}", "title": "" } ]
6860b323f3bdf24240375085cf8b9c0d
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
[ { "docid": "41b57f25ebdf4aac6e3b16818770de06", "score": "0.0", "text": "func (v *AttPosMocap) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll186(l, v)\n}", "title": "" } ]
[ { "docid": "7cae2bfed2346986b6375fc557ba433d", "score": "0.7462536", "text": "func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer) {\n easyjson9f2eff5fDecodeMypackage(l, v)\n}", "title": "" }, { "docid": "83fd4fd784af4f21eb41fc1ca10e5bf4", "score": "0.73763055", "text": "func (v *RepayInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson9f2eff5fDecodeCh07Json09jsonBenchmark(l, v)\n}", "title": "" }, { "docid": "4294a13dfa1607bd4f233ce7b087d7e9", "score": "0.73650813", "text": "func (v *Article) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6601e8cdDecodeNewsapiGolang1(l, v)\n}", "title": "" }, { "docid": "c2dc134c9c3f639aa563564b225ba064", "score": "0.7352436", "text": "func (v *extend) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson17a47f2aDecodeGithubComKexirongMsgSenderWechat(l, v)\n}", "title": "" }, { "docid": "a6c12e7b5965f7a3157d31db773e03a3", "score": "0.7344678", "text": "func (v *Payload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE4425964DecodeGithubComCodexTeamHawkGo1(l, v)\n}", "title": "" }, { "docid": "a9b456f11c9a9822f1d30627310986e5", "score": "0.72476846", "text": "func (v *CBPerson) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest6(l, v)\n}", "title": "" }, { "docid": "e9edcf6fae5c154412685506a20235f1", "score": "0.723899", "text": "func (v *Entity) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson461f4b12DecodeMonzoTransactionsMonzo2(l, v)\n}", "title": "" }, { "docid": "2be04df4f5aa84687ec2f055b88441d1", "score": "0.72297704", "text": "func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson794297d0DecodeLocalApi(l, v)\n}", "title": "" }, { "docid": "4320b4e09a9488d4ad96a28f473c0072", "score": "0.72292924", "text": "func (v *API) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat7(l, v)\n}", "title": "" }, { "docid": "7113b10ac9463aa47b241fb7afc82f72", "score": "0.7225766", "text": "func (v *DSTopic) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest5(l, v)\n}", "title": "" }, { "docid": "8f223e135076848355f2f39038ea501d", "score": "0.7217069", "text": "func (v *Field) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat5(l, v)\n}", "title": "" }, { "docid": "9a484be158af562090e11bf57c24eeb5", "score": "0.7216474", "text": "func (v *jsonResult) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonBd1621b8DecodeGithubComTsenartVegetaLib(l, v)\n}", "title": "" }, { "docid": "c774f510337ec7f90c5646de98c2cedc", "score": "0.7212497", "text": "func (v *ETFData) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi27(l, v)\n}", "title": "" }, { "docid": "217004913cc9275bbb19109774be6645", "score": "0.72120386", "text": "func (v *Func) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat4(l, v)\n}", "title": "" }, { "docid": "6b65be151d4bb2973cd0fcf3dfc59fa3", "score": "0.71890414", "text": "func (v *Package) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat2(l, v)\n}", "title": "" }, { "docid": "7236647caac89778e8ade885f5cb6024", "score": "0.717782", "text": "func (v *Person) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6a975c40DecodeGoEasyjsonExampleExample2(l, v)\n}", "title": "" }, { "docid": "01a1bdc5f3767d25e752756a8abe80d1", "score": "0.7159773", "text": "func (v *Partie) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6b0c9e88DecodeGithubComXenaexClientGoXenaXmsg4(l, v)\n}", "title": "" }, { "docid": "5f634608dd403f99ba49932e880f8467", "score": "0.71572983", "text": "func (v *SmallPayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson794297d0DecodeGithubComTahiaKhanGoJsonBenchmarkSuite(l, v)\n}", "title": "" }, { "docid": "e63ce25054a16e329dfd69ba662af873", "score": "0.7154933", "text": "func (v *Source) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6601e8cdDecodeNewsapiGolang(l, v)\n}", "title": "" }, { "docid": "bd277f6c415a4e18509dea9396d893f8", "score": "0.7148733", "text": "func (v *Object) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat3(l, v)\n}", "title": "" }, { "docid": "66029b948037ff1fe78cbc6179a4cd6f", "score": "0.71367735", "text": "func (v *MetaData) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonBa0ee0e3DecodeTrafficDataProcessingModel(l, v)\n}", "title": "" }, { "docid": "fe006c90d47325700060e4f776550985", "score": "0.7134659", "text": "func (v *EarningsInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi24(l, v)\n}", "title": "" }, { "docid": "ae1f02ee3467198afd52841d879749ce", "score": "0.7134202", "text": "func (v *Technicals) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi5(l, v)\n}", "title": "" }, { "docid": "ea9d2e4bddda97f2e9334847c5923e56", "score": "0.71331507", "text": "func (v *MediumPayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest1(l, v)\n}", "title": "" }, { "docid": "e771d69a731d27534126efc6487dd4d5", "score": "0.713267", "text": "func (v *APIResponseArticles) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6601e8cdDecodeNewsapiGolang3(l, v)\n}", "title": "" }, { "docid": "0e0b2a4327d5b5f51877c6890b649a0c", "score": "0.71239626", "text": "func (v *Article) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle3(l, v)\n}", "title": "" }, { "docid": "7c354aa65b383d44a91f6970ad154724", "score": "0.7120538", "text": "func (v *Earnings) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi26(l, v)\n}", "title": "" }, { "docid": "540e714b49d7d453da1d8f7ea243419b", "score": "0.71181005", "text": "func (v *Tense) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeGithubComNoisyscannerGoflyGofly2(l, v)\n}", "title": "" }, { "docid": "0ad6fb68a67a72126315fa3627ed6160", "score": "0.7102717", "text": "func (v *FederatedIdentityRepresentation) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson84c0690eDecodeGithubComAzukaKeycloakAdminGoKeycloak4(l, v)\n}", "title": "" }, { "docid": "843c1de740c67c941e343342834ef4f3", "score": "0.7092787", "text": "func (v *LargePayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson794297d0DecodeGithubComTahiaKhanGoJsonBenchmarkSuite1(l, v)\n}", "title": "" }, { "docid": "c0e7b377f9cd64748145c1e39afe6be1", "score": "0.7090068", "text": "func (v *SmallPayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest(l, v)\n}", "title": "" }, { "docid": "e3dc77b114218c0673c9b24da831ee52", "score": "0.7086353", "text": "func (v *V2Extension) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll7(l, v)\n}", "title": "" }, { "docid": "71e9c9f065cd1e699ee05fdc63bcd87d", "score": "0.7058119", "text": "func (v *V2Extension) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAutoquad6(l, v)\n}", "title": "" }, { "docid": "e94d7b4a1c69f6f5e214af5e7e1e3030", "score": "0.7057771", "text": "func (v *JsonMsg) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson17a47f2aDecodeGithubComKexirongMsgSenderWechat1(l, v)\n}", "title": "" }, { "docid": "9f91207d393ebc47d43d39afd4aabf03", "score": "0.7049668", "text": "func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v)\n}", "title": "" }, { "docid": "8562efad8398f5b9f99176a67d287fb4", "score": "0.7047398", "text": "func (v *Definition) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat6(l, v)\n}", "title": "" }, { "docid": "9b36a0e4b46686978f8bedfc02b83666", "score": "0.70467263", "text": "func (v *JSONEventV2) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3b0ebf6aDecodeGithubComSignalfxMetricproxyProtocolSignalfxFormat(l, v)\n}", "title": "" }, { "docid": "cb5649b07755189a1ff69f5754d5e1d2", "score": "0.70456874", "text": "func (v *Node) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson9f2eff5fDecodeLocalGlobal1(l, v)\n}", "title": "" }, { "docid": "e1d2acfe43d8350af89457625cfca5be", "score": "0.7045512", "text": "func (v *Form) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle1(l, v)\n}", "title": "" }, { "docid": "540e631e1a395ffbbae34fde09b04fa4", "score": "0.70419014", "text": "func (v *Info) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget4(l, v)\n}", "title": "" }, { "docid": "af9919bbc6f1ba6d8be0fb7c63d8a714", "score": "0.7039601", "text": "func (v *Handler) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3d6050f6DecodeGithubCom8tomat8SlotMachineApiHTTP3(l, v)\n}", "title": "" }, { "docid": "750580289529386fbe982656aa2c678b", "score": "0.7038681", "text": "func (v *Generic) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson692db02bDecodeGithubComMailgunMailgunGoV3Events11(l, v)\n}", "title": "" }, { "docid": "d96a4ce023c9affa051205163c51cef4", "score": "0.70370674", "text": "func (v *Ad) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson63cbde9bDecodeGithubComSaskamegaprogrammistLostiesBackendModels1(l, v)\n}", "title": "" }, { "docid": "d3f719cc76faea5613efd117484fe62c", "score": "0.7031772", "text": "func (out *DataResult) UnmarshalEasyJSON(in *jlexer.Lexer) {\n\tisTopLevel := in.IsStart()\n\tif in.IsNull() {\n\t\tif isTopLevel {\n\t\t\tin.Consumed()\n\t\t}\n\t\tin.Skip()\n\t\treturn\n\t}\n\tin.Delim('{')\n\tfor !in.IsDelim('}') {\n\t\tkey := in.UnsafeString()\n\t\tin.WantColon()\n\t\tif in.IsNull() {\n\t\t\tin.Skip()\n\t\t\tin.WantComma()\n\t\t\tcontinue\n\t\t}\n\t\tswitch key {\n\t\tcase \"status\":\n\t\t\tout.Status = promhttputil.Status(in.String())\n\t\tcase \"data\":\n\t\t\tin.AddError(out.Data.UnmarshalJSON(in.Raw()))\n\t\tcase \"errorType\":\n\t\t\tout.ErrorType = promhttputil.ErrorType(in.String())\n\t\tcase \"error\":\n\t\t\tout.Error = string(in.String())\n\t\tdefault:\n\t\t\tin.SkipRecursive()\n\t\t}\n\t\tin.WantComma()\n\t}\n\tin.Delim('}')\n\tif isTopLevel {\n\t\tin.Consumed()\n\t}\n}", "title": "" }, { "docid": "87d2a9819d304962eb1168ffa81c5d9a", "score": "0.70298845", "text": "func (v *LargePayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest2(l, v)\n}", "title": "" }, { "docid": "8d4deb829933d898c5fbd60b3ac2027b", "score": "0.70159525", "text": "func (v *RunnerMetadata) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson8e2f8dd8DecodeGithubComTarbBfapi9(l, v)\n}", "title": "" }, { "docid": "ef25f7ef4bd79c2a3182cb4a221e10dd", "score": "0.70157164", "text": "func (v *Backtrace) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE4425964DecodeGithubComCodexTeamHawkGo3(l, v)\n}", "title": "" }, { "docid": "a23b3ac6850adaa64f8cf05c9745fe97", "score": "0.70129347", "text": "func (v *GeoDataPayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson794297d0DecodeGithubComTahiaKhanGoJsonBenchmarkSuite2(l, v)\n}", "title": "" }, { "docid": "5b33193cb74ab27886aed5fd5e50df41", "score": "0.7005878", "text": "func (v *General) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi21(l, v)\n}", "title": "" }, { "docid": "d5b682385ca7fd5b3cf7bf1c878d5d60", "score": "0.7002641", "text": "func (v *Feature) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox2(l, v)\n}", "title": "" }, { "docid": "e6c633c88f733ba834bf0efab272db74", "score": "0.7000987", "text": "func (v *Info) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson5a72dc82DecodeGithubComZorinArsenijTechDbForumInternalAppDomainPost4(l, v)\n}", "title": "" }, { "docid": "5376808997fac8f55074bed07a311c00", "score": "0.6994361", "text": "func (v *Runner) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson8e2f8dd8DecodeGithubComTarbBfapi11(l, v)\n}", "title": "" }, { "docid": "4940065b4af3978b23d118909597f4cb", "score": "0.69824684", "text": "func (v *Financials) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi23(l, v)\n}", "title": "" }, { "docid": "0344228cfe1072a6897657587f3eeb87", "score": "0.69811904", "text": "func (v *RawMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\t*v = RawMessage(l.Raw())\n}", "title": "" }, { "docid": "cf80d7814e4c519ae5d83f5831596586", "score": "0.6973203", "text": "func (v *NewArticle) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle(l, v)\n}", "title": "" }, { "docid": "49a50ccbea71c37d95386a58c38068fe", "score": "0.69731873", "text": "func (v *Weight) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi1(l, v)\n}", "title": "" }, { "docid": "b2d11cfbd90f057048a720a103c4ad1e", "score": "0.69654316", "text": "func (v *ArbLangInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson5edff16dDecodeGithubComEmpirefoxProtocGenDartExtPkgArb2(l, v)\n}", "title": "" }, { "docid": "e4dc052d4534a64d6b3166bcd3dcafed", "score": "0.69616705", "text": "func (v *Merchant) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson461f4b12DecodeMonzoTransactionsMonzo1(l, v)\n}", "title": "" }, { "docid": "d4b855b56ce6a213db4f32d9f2e20b0a", "score": "0.6953918", "text": "func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE34310f8DecodeMainModels1(l, v)\n}", "title": "" }, { "docid": "4a80b06a21c7222f74644423a9b2f738", "score": "0.69361913", "text": "func (v *BidRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(l, v)\n}", "title": "" }, { "docid": "07365fc5930fc88723741f786e87165b", "score": "0.69356513", "text": "func (v *UserModel) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson5371cc0DecodeMevericcoreMccommon1(l, v)\n}", "title": "" }, { "docid": "cb5f87ce34e788eddbfb4ff8f624b13d", "score": "0.69342244", "text": "func (v *ArbLangInfos) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson5edff16dDecodeGithubComEmpirefoxProtocGenDartExtPkgArb1(l, v)\n}", "title": "" }, { "docid": "2ff21dd6e0d08baeccf425224fb1f162", "score": "0.693266", "text": "func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeContactsListApi1(l, v)\n}", "title": "" }, { "docid": "8c64eaeacb4b597c50e05d4b7890fab1", "score": "0.6932464", "text": "func (v *Conjugation) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeGithubComNoisyscannerGoflyGofly6(l, v)\n}", "title": "" }, { "docid": "3bc0005d6aefd07672472adb2d32f222", "score": "0.6930749", "text": "func (v *Deepstall) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll156(l, v)\n}", "title": "" }, { "docid": "1f204dfd178a851219ace10896fcf568", "score": "0.69232166", "text": "func (v *Technique) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3054bb90DecodeGithubComSturfeeincGlTF(l, v)\n}", "title": "" }, { "docid": "e1a15b05eae71a7e12d67b912a131239", "score": "0.6915993", "text": "func (v *Info) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonDdc53814DecodeGithubComGoOpenapiSpec3(l, v)\n}", "title": "" }, { "docid": "25bdc6f1ec87a5bd8e51325fc430a91d", "score": "0.691549", "text": "func (v *Language) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeGithubComNoisyscannerGoflyGofly4(l, v)\n}", "title": "" }, { "docid": "d0908540dc68a96d1008dce593ae2d51", "score": "0.6895985", "text": "func (v *Articles) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle2(l, v)\n}", "title": "" }, { "docid": "503b7b41760d14681a20b30d62a399e1", "score": "0.68952084", "text": "func (v *ActivitiesInvolvement) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi36(l, v)\n}", "title": "" }, { "docid": "82d8bf8f9fd88e57cb68bb9227450df3", "score": "0.68895423", "text": "func (v *Teacher) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6a975c40DecodeGoEasyjsonExampleExample(l, v)\n}", "title": "" }, { "docid": "4b3fa6513d3aef268f5e70aba9315a09", "score": "0.6887041", "text": "func (v *MutualFundData) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi14(l, v)\n}", "title": "" }, { "docid": "4e0e6e05512d7b3cc153e9013ae46e28", "score": "0.6885948", "text": "func (v *RunnerCatalogue) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson8e2f8dd8DecodeGithubComTarbBfapi10(l, v)\n}", "title": "" }, { "docid": "11d1e8d07c5098d0aba58aab5617087f", "score": "0.6879001", "text": "func (v *BidResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson10eb023eDecodeGithubComVungleVungoOpenrtb(l, v)\n}", "title": "" }, { "docid": "6d0dfcd5324f551146b5f9144b59dd8e", "score": "0.6875775", "text": "func (v *Bid) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson31527abDecodeGithubComKrecuYahb(l, v)\n}", "title": "" }, { "docid": "05b42ab793d78a14f20a6997a2c01d03", "score": "0.68743944", "text": "func (v *Request) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonC1cedd36DecodeContactsListApi2(l, v)\n}", "title": "" }, { "docid": "b0556f78b3ab0397fd9458f0e6ba2c5a", "score": "0.6872916", "text": "func (v *EncapsulatedData) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll150(l, v)\n}", "title": "" }, { "docid": "cee15957e219bffc916b72972a44deeb", "score": "0.6859192", "text": "func (v *JWTProxy) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonAbf2d450DecodeLocalMiddlewareJwtProxy(l, v)\n}", "title": "" }, { "docid": "71ef3d7fc2cb954853deaf60c49fc3a1", "score": "0.6857942", "text": "func (v *Event) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson8e2f8dd8DecodeGithubComTarbBfapi49(l, v)\n}", "title": "" }, { "docid": "df3aa61a6b7221a12475574e1b2e1a16", "score": "0.6856772", "text": "func (v *PlantainersList) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6b0df247DecodeMevericcoreMcplantainer(l, v)\n}", "title": "" }, { "docid": "4c3bcaabb38ebf8b7e646acbfa9343b2", "score": "0.68483776", "text": "func (v *PostCharactersAffiliation200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson2003668DecodeGithubComAntihaxGoesiEsi1(l, v)\n}", "title": "" }, { "docid": "8a4ef1e034f9ed8f67789625d1b74a22", "score": "0.6841975", "text": "func (v *LargePayload) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD519278DecodeGithubComSapphiRedJsonConstantiaterBenchmarks(l, v)\n}", "title": "" }, { "docid": "344f4c62a742738881efe6368d51731d", "score": "0.68400294", "text": "func (v *APIResponseSources) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6601e8cdDecodeNewsapiGolang2(l, v)\n}", "title": "" }, { "docid": "b4fb2ef53232b63b379e9e15de8968ec", "score": "0.6828143", "text": "func (v *UserRepresentation) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson84c0690eDecodeGithubComAzukaKeycloakAdminGoKeycloak1(l, v)\n}", "title": "" }, { "docid": "da9a0f578fd02693605d27f4b3d648cb", "score": "0.6827274", "text": "func (v *DSTopicsList) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest4(l, v)\n}", "title": "" }, { "docid": "07ec2e9b2a4e92480aa650413abd44ed", "score": "0.6827177", "text": "func (v *Component) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi29(l, v)\n}", "title": "" }, { "docid": "99f502d71809a193babf27b6b070b09b", "score": "0.6824703", "text": "func (v *ParamRequestRead) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll62(l, v)\n}", "title": "" }, { "docid": "693a2c3b4632f86b5205df8483b126e3", "score": "0.6822331", "text": "func (v *ValueGrowth) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi2(l, v)\n}", "title": "" }, { "docid": "0bec8ca78ed339df169c581f57d01562", "score": "0.6822207", "text": "func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson692db02bDecodeGithubComMailgunMailgunGoV3Events2(l, v)\n}", "title": "" }, { "docid": "c15d264a5e8949193e3c0798bc042f06", "score": "0.6807755", "text": "func (v *ResourceArgs) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson1688e6a4DecodeGithubComSchumacherFMCaddyesiBackend(l, v)\n}", "title": "" }, { "docid": "5ced0547ec73969f4248b8a1b7ab4c7c", "score": "0.68067294", "text": "func (v *Field) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson6615c02eDecodeGithubComGoParkMailRu20191EscapadeInternalPkgConfig11(l, v)\n}", "title": "" }, { "docid": "7a5d4fd5cf8d24a39d507febc52706c8", "score": "0.6805982", "text": "func (v *SampleEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE453ad8fDecodeGithubComSignalfxOndiskencoding2(l, v)\n}", "title": "" }, { "docid": "4b284de90650b03272f4c1ff7f6ff5b5", "score": "0.6802599", "text": "func (v *CBName) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest7(l, v)\n}", "title": "" }, { "docid": "5bcda3023c86c0f3126018466b048b58", "score": "0.6799705", "text": "func (v *VerbContainer) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonD2b7633eDecodeGithubComNoisyscannerGoflyGofly(l, v)\n}", "title": "" }, { "docid": "a7d91376ea6be13388c7b340c5b35a7f", "score": "0.6797453", "text": "func (v *Fundamentals) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE48f2accDecodeGithubComConfinaleEodhdapi22(l, v)\n}", "title": "" }, { "docid": "cc739ef89844934656bb3d1b045b2bdb", "score": "0.6793914", "text": "func (out *User) UnmarshalEasyJSON(in *jlexer.Lexer) {\n\tisTopLevel := in.IsStart()\n\tif in.IsNull() {\n\t\tif isTopLevel {\n\t\t\tin.Consumed()\n\t\t}\n\t\tin.Skip()\n\t\treturn\n\t}\n\tin.Delim('{')\n\tfor !in.IsDelim('}') {\n\t\tkey := in.UnsafeString()\n\t\tin.WantColon()\n\t\tif in.IsNull() {\n\t\t\tin.Skip()\n\t\t\tin.WantComma()\n\t\t\tcontinue\n\t\t}\n\t\tswitch key {\n\t\tcase \"browsers\":\n\t\t\tif in.IsNull() {\n\t\t\t\tin.Skip()\n\t\t\t\tout.Browsers = (out.Browsers)[:0]\n\t\t\t} else {\n\t\t\t\tin.Delim('[')\n\t\t\t\tif out.Browsers == nil {\n\t\t\t\t\tout.Browsers = make([][]byte, 0, 4)\n\t\t\t\t} else {\n\t\t\t\t\tout.Browsers = (out.Browsers)[:0]\n\t\t\t\t}\n\t\t\t\tfor !in.IsDelim(']') {\n\t\t\t\t\tout.Browsers = append(out.Browsers, in.UnsafeBytes())\n\t\t\t\t\tin.WantComma()\n\t\t\t\t}\n\t\t\t\tin.Delim(']')\n\t\t\t}\n\t\tcase \"email\":\n\t\t\tout.Email = in.UnsafeString()\n\t\tcase \"name\":\n\t\t\tout.Name = in.UnsafeString()\n\t\tdefault:\n\t\t\tin.SkipRecursive()\n\t\t}\n\t\tin.WantComma()\n\t}\n\tin.Delim('}')\n\tif isTopLevel {\n\t\tin.Consumed()\n\t}\n}", "title": "" }, { "docid": "4f225e8bc0dcc0ec42116caa044f8f7f", "score": "0.6792243", "text": "func (v *GetSearchOk) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonE70f86d0DecodeGithubComAntihaxGoesiEsi1(l, v)\n}", "title": "" }, { "docid": "e41e4e3be14335403a44b34346239b86", "score": "0.6791535", "text": "func (v *FileTransferProtocol) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll144(l, v)\n}", "title": "" }, { "docid": "712bc3e71565248dce5fc8cb05950ed4", "score": "0.6782409", "text": "func (v *User) UnmarshalJSON(data []byte) error {\n r := jlexer.Lexer{Data: data}\n easyjson9f2eff5fDecodeMypackage(&r, v)\n return r.Error()\n}", "title": "" }, { "docid": "a0d472a0f393c269d372d889b9435d1c", "score": "0.677839", "text": "func (v *versionRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson8e52a332DecodeGithubComSomniSomGoRedmine2(l, v)\n}", "title": "" }, { "docid": "6f764b73ca23c96a15f96101fc6b862d", "score": "0.6778313", "text": "func (v *CBGithub) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonEeca4a30DecodeGithubComGoFishGojsonBenchmarkTest9(l, v)\n}", "title": "" } ]
6f1b4e6a6e18239d38e86dc013c3c715
Resolve a new promise
[ { "docid": "fa150c02d181506f6789eb5d7a4410ce", "score": "0.61886376", "text": "func Resolve(data interface{}) Promise {\n\tout := newTypeA(nil)\n\tgo func() { out.packets <- NewDataPacket(data) }()\n\treturn out\n}", "title": "" } ]
[ { "docid": "3e61fca39e7b55a2e852875fbfe1b89f", "score": "0.6528622", "text": "func (p *Promise) Resolve(res error) {\n\tp.mutex.Lock()\n\tdefer runtime.Gosched()\n\tdefer p.mutex.Unlock()\n\tif p.resolved {\n\t\treturn\n\t}\n\tp.resolved = true\n\tp.response = res\n\tfor i := 0; i < p.count; i++ {\n\t\tp.Chan <- res\n\t}\n}", "title": "" }, { "docid": "7733a5a81feae1bf3ed2e8cf22028e9a", "score": "0.6431939", "text": "func Resolve(value interface{}) *Promise {\n\tpromise := new(Promise)\n\tpromise.value = value\n\tpromise.resolved = true\n\tpromise.failed = false\n\treturn promise\n}", "title": "" }, { "docid": "565c39c57da90feb596846ba20637ba6", "score": "0.62586445", "text": "func (this *Promise) Resolve(v interface{}) (e error) {\n\treturn this.setResult(&PromiseResult{v, RESULT_SUCCESS})\n}", "title": "" }, { "docid": "bea1c63f51ae8a9dd8dea809e1163932", "score": "0.6135701", "text": "func Resolve(r Resolver, from string) Promise {\n\tfrom = strings.TrimSpace(from)\n\n\tif deeplink.IsDeeplinkLike(from) {\n\t\treturn ResolveDeeplink(r, from)\n\t}\n\tif isPhoneNumber(from) {\n\t\treturn ResolvePhone(r, from)\n\t}\n\n\treturn ResolveDomain(r, from)\n}", "title": "" }, { "docid": "7837d947c3b7d10ae7c695868ec8e9a3", "score": "0.59733963", "text": "func (p *Promise) then(then_func func(val interface{}) interface{}) *Promise {\n\tvar result *Promise\n\tresult = NewPromise(func(resolve func(interface{}), reject func(error)) {\n\t\tselect {\n\t\tcase val := <- p.resolveValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\tresponse := then_func(val)\n\t\t\t\terr, _ := response.(error)\n\t\t\t\tif (err != nil) {\n\t\t\t\t\treject(err)\n\t\t\t\t} else {\n\t\t\t\t\tresolve(response.(string))\n\t\t\t\t}\n\t\t\t} ()\n\t\tcase val := <- p.rejectValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\treject(val)\n\t\t\t} ()\n\t\t}\t\n\t})\n\tp.last = false;\n\treturn result\n}", "title": "" }, { "docid": "c5a5a8dd4b250d4918a4e49993d1f62d", "score": "0.59459674", "text": "func (f *FutureImpl) Resolve(env Envelope) {\n\tif f.resolved() {\n\t\treturn\n\t}\n\n\tvar ok bool\n\tvar err error\n\tvar rejected bool\n\n\tf.cw.Lock()\n\tif err, ok = env.Data.(error); ok {\n\t\trejected = true\n\t\tf.err = err\n\t}\n\n\tf.result = &env\n\tf.cw.Unlock()\n\tf.w.Done()\n\n\tif rejected {\n\t\tf.events.Publish(FutureRejected{Err: err, ID: f.id.String()})\n\t\treturn\n\t}\n\tf.events.Publish(FutureResolved{Data: env, ID: f.id.String()})\n}", "title": "" }, { "docid": "09e64f59883eeaedd1311d73b4d439a4", "score": "0.58998173", "text": "func (p *Promise) Resolve(r Ptr, e error) {\n\tvar shutdownPromises []*ClientPromise\n\tsyncutil.With(&p.mu, func() {\n\t\tif e != nil {\n\t\t\tp.requireUnresolved(\"Reject\")\n\t\t} else {\n\t\t\tp.requireUnresolved(\"Fulfill\")\n\t\t}\n\t\tp.caller = nil\n\n\t\tif len(p.clients) > 0 || p.ongoingCalls > 0 {\n\t\t\t// Pending resolution state: wait for clients to be fulfilled\n\t\t\t// and calls to have answers. p.clients cannot be touched in the\n\t\t\t// pending resolution state, so we have exclusive access to the\n\t\t\t// variable.\n\t\t\tif p.ongoingCalls > 0 {\n\t\t\t\tp.callsStopped = make(chan struct{})\n\t\t\t}\n\t\t\tsyncutil.Without(&p.mu, func() {\n\t\t\t\tres := resolution{p.method, r, e}\n\t\t\t\tfor path, cp := range p.clients {\n\t\t\t\t\tt := path.transform()\n\t\t\t\t\tcp.promise.fulfill(res.client(t))\n\t\t\t\t\tshutdownPromises = append(shutdownPromises, cp.promise)\n\t\t\t\t\tcp.promise = nil\n\t\t\t\t}\n\t\t\t\tif p.callsStopped != nil {\n\t\t\t\t\t<-p.callsStopped\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// Move p into resolved state.\n\t\tp.callsStopped = nil\n\t\tp.result, p.err = r, e\n\t\tfor _, f := range p.signals {\n\t\t\tf()\n\t\t}\n\t\tp.signals = nil\n\t})\n\tfor _, promise := range shutdownPromises {\n\t\tpromise.shutdown()\n\t}\n}", "title": "" }, { "docid": "28591568c430e32078e9b6f3bdf6fecc", "score": "0.58168113", "text": "func New() *Promise {\n\treturn &Promise{}\n}", "title": "" }, { "docid": "cfa983d6b3efd08f0e8d06ce9d44773a", "score": "0.5804472", "text": "func Promise(funct func(res Resolver), then func(res Resolver), catch func(res Resolver)) {\n\tsynchronizer.Add(1)\n\tgo func() {\n\t\tres := Resolver{make(chan bool, 1), \"Promise Init\", 1}\n\t\tresThen := Resolver{make(chan bool, 1), \"Promise Then\", 1}\n\t\tresCatch := Resolver{make(chan bool, 1), \"Promise Catch\", 1}\n\t\tgo funct(res)\n\t\tif status := <-res.Done; status {\n\t\t\tgo then(resThen)\n\t\t\tmanageSynchro(resThen)\n\t\t} else {\n\t\t\tgo catch(resCatch)\n\t\t\tmanageSynchro(resCatch)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "c62ce0120c90ba9fff709e5ccf191680", "score": "0.57734513", "text": "func NewPromise(m Method, pc PipelineCaller) *Promise {\n\tif pc == nil {\n\t\tpanic(\"NewPromise(nil)\")\n\t}\n\tresolved := make(chan struct{})\n\tp := &Promise{\n\t\tmethod: m,\n\t\tresolved: resolved,\n\t\tsignals: []func(){func() { close(resolved) }},\n\t\tcaller: pc,\n\t}\n\tp.ans.f.promise = p\n\tp.ans.metadata = *NewMetadata()\n\treturn p\n}", "title": "" }, { "docid": "0901564a5c61046160ea3c298d72ca64", "score": "0.57097286", "text": "func (p *Promise) Fulfill(result Ptr) {\n\tp.Resolve(result, nil)\n}", "title": "" }, { "docid": "583be934a68c28aacbb96c436f483f1a", "score": "0.56621027", "text": "func promisify(fn func() (interface{}, error)) *js.Object {\n\tp := Defer()\n\n\tgo func() {\n\t\tif results, err := fn(); err == nil {\n\t\t\tcore.Info(\"Resolving the promise with results: %s\", results)\n\t\t\tp.Resolve(results)\n\t\t} else {\n\t\t\tp.Reject(err.Error())\n\t\t}\n\t}()\n\n\treturn p.Promise()\n}", "title": "" }, { "docid": "3bae9ac282b66eeb577158d086e97a15", "score": "0.5618538", "text": "func (r *racer) resolve(guid hvsock.GUID) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\tif r.result == hvsock.GUIDZero {\n\t\tr.result = guid\n\t}\n\tr.count = 0\n\tr.cond.Signal()\n}", "title": "" }, { "docid": "ad4961a8a3e6a6b47db566bff897b485", "score": "0.5594117", "text": "func (r *resolve) ResolveNow(resolver.ResolveNowOptions) {}", "title": "" }, { "docid": "2478227d4081b42083f43c43d7caf1d8", "score": "0.55600095", "text": "func NewPromise() *Promise {\n\treturn &Promise{\n\t\tChan: make(chan error),\n\t\tcount: 0,\n\t\tresolved: false,\n\t\tresponse: nil,\n\t\tmutex: sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "150019615e38adc3a8ed69555c034a66", "score": "0.5539212", "text": "func NewPromise() *Promise {\n\tval := &futureVal{\n\t\tdones: make([]func(v interface{}), 0, 8),\n\t\tfails: make([]func(v interface{}), 0, 8),\n\t\talways: make([]func(v interface{}), 0, 4),\n\t\tcancels: make([]func(), 0, 2),\n\t\tpipes: make([]*pipe, 0, 4),\n\t\tr: nil,\n\t}\n\tf := &Promise{\n\t\t&Future{\n\t\t\tId: rand.Int(),\n\t\t\tfinal: make(chan struct{}),\n\t\t\tval: unsafe.Pointer(val),\n\t\t},\n\t}\n\treturn f\n}", "title": "" }, { "docid": "bb831769e62f7c2ef12cf0dbd2db7749", "score": "0.5521107", "text": "func (o *AsyncOperation) Resolve(err error) {\n\to.err = err\n\tclose(o.doneCh)\n}", "title": "" }, { "docid": "ec3a57b92f7d8cecd37d21ce35f122b5", "score": "0.5511448", "text": "func (p *Promise) catch(catch_func func(err error) interface{}) *Promise {\n\tvar result *Promise\n\tresult = NewPromise(func(resolve func(interface{}), reject func(error)) {\n\t\tselect {\n\t\tcase val := <- p.rejectValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\tresponse := catch_func(val)\n\t\t\t\terr, _ := response.(error)\n\t\t\t\tif (err != nil) {\n\t\t\t\t\treject(err)\n\t\t\t\t} else {\n\t\t\t\t\tresolve(response)\n\t\t\t\t}\n\t\t\t} ()\n\t\tcase val := <- p.resolveValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\tresolve(val)\n\t\t\t} ()\n\t\t}\n\t})\n\tp.last = false;\n\treturn result\n\t\n}", "title": "" }, { "docid": "1885df4b438de98b98e0ba9235b30544", "score": "0.55091095", "text": "func (p *Promise) resolution() resolution {\n\treturn resolution{p.method, p.result, p.err}\n}", "title": "" }, { "docid": "32791d809c4834fc8cb359a136ddc0b7", "score": "0.5358241", "text": "func (r *Resolver) ResolveNow(_ resolver.ResolveNowOptions) {\n\t// do a non-blocking write to the reresolve channel\n\tselect {\n\tcase r.reresolve <- struct{}{}:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "874d8bd6733b4e5e724c432bbc55b4a0", "score": "0.5356668", "text": "func (p *Promise) finally(final_func func(interface{}) interface{}) *Promise {\n\tvar result *Promise\n\tresult = NewPromise(func(resolve func(interface{}), reject func(error)) {\n\t\tselect {\n\t\tcase val := <- p.rejectValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\tresult.result = val\n\t\t\t\tfinal_func(val)\n\t\t\t} ()\n\t\tcase val := <- p.resolveValue:\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp.done <- true\n\t\t\t\t} ()\n\t\t\t\tp.chain = result\n\t\t\t\tresult.result = val\n\t\t\t\tfinal_func(val)\n\t\t\t} ()\n\t\t}\n\t})\n\tp.last = false;\n\treturn result\n\t\n}", "title": "" }, { "docid": "27a4b901e524aee716c06297cbd78a5d", "score": "0.53550285", "text": "func (d *memory) resolveLocked(ctx context.Context, id id.ID) (interface{}, error) {\n\t// Look up the record with the provided identifier.\n\tr, got := d.records[id]\n\tif !got {\n\t\t// Database doesn't recognise this identifier.\n\t\treturn nil, fmt.Errorf(\"Resource '%v' not found\", id)\n\t}\n\n\trs := r.resolveState\n\tbuild := rs == nil\n\tif build {\n\t\t// First request for this resolvable.\n\n\t\t// Grab the resolve chain from the caller's context.\n\t\trc := &resolveChain{r, getResolveChain(ctx)}\n\n\t\t// Build a cancellable context for the resolve from database's resolve\n\t\t// context. We use this as we don't to cancel the resolve if a single\n\t\t// caller cancel's their context.\n\t\tresolveCtx, cancel := task.WithCancel(d.resolveCtx)\n\n\t\trs = &resolveState{\n\t\t\tctx: rc.bind(resolveCtx),\n\t\t\tfinished: make(chan struct{}),\n\t\t\tcancel: cancel,\n\t\t}\n\t\tr.resolveState = rs\n\n\t\t// Build the resolvable on a separate go-routine.\n\t\tctx := ctx // Don't let changes to ctx leak into this go-routine.\n\t\tcrash.Go(func() {\n\t\t\t// Propagate the status, so that resolve tasks appear under the\n\t\t\t// context that first triggered the resolve.\n\t\t\tctx := status.PutTask(rs.ctx, status.GetTask(ctx))\n\n\t\t\tdefer d.resolvePanicHandler(ctx)\n\t\t\terr := r.resolve(ctx)\n\n\t\t\t// Signal that the resolvable has finished.\n\t\t\td.mutex.Lock()\n\t\t\tclose(rs.finished)\n\t\t\trs.err, rs.finished = err, nil\n\t\t\td.mutex.Unlock()\n\t\t})\n\t}\n\n\tif finished := rs.finished; finished != nil {\n\t\tif !build {\n\t\t\tctx = status.StartBackground(ctx, \"Wait DB Resolve<%T> %p\", r.object, rs)\n\t\t\tdefer status.Finish(ctx)\n\t\t\tstatus.Block(ctx)\n\t\t\tdefer status.Unblock(ctx)\n\t\t}\n\n\t\t// Buildable has not yet finished.\n\t\t// Increment the waiting go-routine counter.\n\t\trs.waiting++\n\t\trs.callstacks = append(rs.callstacks, getCallstack(4))\n\t\t// Wait for either the resolve to finish or ctx to be cancelled.\n\t\td.mutex.Unlock()\n\t\tselect {\n\t\tcase <-finished:\n\t\tcase <-task.ShouldStop(ctx):\n\t\t}\n\t\td.mutex.Lock()\n\n\t\t// Decrement the waiting go-routine counter.\n\t\trs.waiting--\n\t\tif rs.waiting == 0 && rs.finished != nil {\n\t\t\t// There's no more go-routines waiting for this resolvable and it\n\t\t\t// hasn't finished yet. Cancel it and remove the resolve state from\n\t\t\t// the record.\n\t\t\trs.cancel()\n\t\t\tr.resolveState = nil\n\t\t\td.records[id] = r\n\t\t}\n\t}\n\n\tif err := task.StopReason(ctx); err != nil {\n\t\treturn nil, err // Context was cancelled.\n\t}\n\tif rs.err != nil {\n\t\treturn nil, rs.err // Resolve errored.\n\t}\n\n\tif r.ty == blobFunc {\n\t\tif x, ok := r.object.(func() ([]byte, error)); ok {\n\t\t\treturn func() ([]byte, error) {\n\t\t\t\td.mutex.Unlock()\n\t\t\t\tdefer d.mutex.Lock()\n\t\t\t\treturn x()\n\t\t\t}()\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Resource '%v' of incorrect type\", id)\n\t}\n\treturn r.object, nil // Done.\n}", "title": "" }, { "docid": "45683e80cfde041db5346a8129681095", "score": "0.5338234", "text": "func (f *Future) Ptr() (Ptr, error) {\n\tp := f.promise\n\t<-p.resolved\n\tp.mu.Lock()\n\tr := p.resolution()\n\tp.mu.Unlock()\n\treturn r.ptr(f.transform())\n}", "title": "" }, { "docid": "89644536e12618b6fb2986ba826b9a6f", "score": "0.53199965", "text": "func resolve(p Package, r Resolver, locks Lockfile) error {\n\t// get the commit\n\tcommit, err := r.Commit(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Commit = commit\n\n\t// get the dependencies\n\tdeps, err := r.Deps(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttransient := make(Lockfile)\n\tfor _, d := range deps.Deps {\n\t\tif err := resolve(d, r, transient); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tp.Deps = transient\n\n\tlocks[p.String()] = p\n\treturn nil\n}", "title": "" }, { "docid": "b91d2c6cfe18ad4cb7982691f0b6fcba", "score": "0.5306382", "text": "func (store *Store) Promise(key interface{}, function Function) (*Promise, func()) {\n\tstore.promisesMu.Lock()\n\tp, ok := store.promises[key]\n\tif !ok {\n\t\tp = NewPromise(reflect.TypeOf(key).String(), function)\n\t\tif store.promises == nil {\n\t\t\tstore.promises = map[interface{}]*Promise{}\n\t\t}\n\t\tstore.promises[key] = p\n\t}\n\tp.refcount++\n\tstore.promisesMu.Unlock()\n\n\tvar released int32\n\trelease := func() {\n\t\tif !atomic.CompareAndSwapInt32(&released, 0, 1) {\n\t\t\tpanic(\"release called more than once\")\n\t\t}\n\t\tstore.promisesMu.Lock()\n\n\t\tp.refcount--\n\t\tif p.refcount == 0 && store.evictionPolicy != NeverEvict {\n\t\t\t// Inv: if p.refcount > 0, then store.promises[key] == p.\n\t\t\tdelete(store.promises, key)\n\t\t}\n\t\tstore.promisesMu.Unlock()\n\t}\n\n\treturn p, release\n}", "title": "" }, { "docid": "9e9e7e7f62a4739d38f83c76b7e20481", "score": "0.5269205", "text": "func (r *BaseResolver) ResolveNow(o resolver.ResolveNowOptions) {\n}", "title": "" }, { "docid": "f34b761d0f96d07f6f2de3d43ff65e1f", "score": "0.52624005", "text": "func Create(action func(resolve Callback, reject Callback)) *Promise {\n\tpromise := new(Promise)\n\tpromise.value = nil\n\tpromise.resolved = false\n\tpromise.valueWaitLock.Add(1)\n\n\tgo action(func(data interface{}) (interface{}, error) {\n\t\tpromise.valueLock.Lock()\n\t\tif promise.resolved == false {\n\n\t\t\tpromise.value = data\n\t\t\tpromise.resolved = true\n\t\t\tpromise.failed = false\n\t\t\tpromise.valueWaitLock.Done()\n\t\t}\n\t\tpromise.valueLock.Unlock()\n\n\t\treturn promise.value, nil\n\n\t}, func(err interface{}) (interface{}, error) {\n\t\tpromise.valueLock.Lock()\n\t\tif promise.resolved == false {\n\t\t\tpromise.value = err\n\t\t\tpromise.resolved = true\n\t\t\tpromise.failed = true\n\t\t\tpromise.valueWaitLock.Done()\n\t\t}\n\t\tpromise.valueLock.Unlock()\n\t\tv, _ := promise.value.(string)\n\t\treturn promise.value, fmt.Errorf(v)\n\t})\n\n\treturn promise\n}", "title": "" }, { "docid": "faee8def975b66612773391af8b61396", "score": "0.5240892", "text": "func NewDeferred(gen Generator) *Promise {\n\tvar startOnce sync.Once\n\n\tp := Promise{\n\t\tsignalC: make(chan struct{}),\n\t}\n\tp.onGet = func(c context.Context) {\n\t\tstartOnce.Do(func() { p.runGen(c, gen) })\n\t}\n\treturn &p\n}", "title": "" }, { "docid": "23a8dd2cb1a934687deef79362ff0548", "score": "0.5222616", "text": "func (c Client) Resolve(ctx context.Context) error {\n\tfor {\n\t\th, released, resolved := c.peek()\n\t\tif released {\n\t\t\treturn errorf(\"cannot resolve released client\")\n\t\t}\n\n\t\tif resolved {\n\t\t\treturn nil\n\t\t}\n\n\t\tselect {\n\t\tcase <-h.resolved:\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6bc379f9ad2d876269ed19256e7f20d3", "score": "0.5221115", "text": "func (c *Client) Resolve(ctx context.Context, name string) (net.IP, error) {\n\tif c.conn4 == nil || c.conn6 == nil {\n\t\treturn nil, fmt.Errorf(\"mDNS client not connected\")\n\t}\n\n\tif !isEphemeralLocalDomain(name) {\n\t\treturn nil, fmt.Errorf(\"invalid ephemeral domain: %s\", name)\n\t}\n\tuuid := name[:len(name)-6] // strip \".local\" suffix\n\n\tc.Lock()\n\tr := c.cache[uuid]\n\tif r == nil {\n\t\t// Construct a new unresolved record.\n\t\tr = &record{\n\t\t\tname: dnsmessage.MustNewName(name + \".\"),\n\t\t\texpires: time.Now().Add(2 * time.Minute),\n\t\t\tready: new(uint32),\n\t\t\treadyCh: make(chan struct{}),\n\t\t}\n\t\tc.cache[uuid] = r\n\t}\n\tc.Unlock()\n\n\tc.maybePruneCache()\n\n\treturn c.waitUntilResolved(ctx, r)\n}", "title": "" }, { "docid": "cee1d5d7ee57ff36ddc1aebf874395eb", "score": "0.5220795", "text": "func NewPromise(fnc func() ([]interface{}, error)) Value {\n\tvar initFunc Func\n\tinitFunc = AsyncCallbackOf(func(args []Value) {\n\t\tinitFunc.Release()\n\t\tresolve, reject := args[0], args[1]\n\t\tres, err := fnc()\n\t\tif err != nil {\n\t\t\tif w, ok := err.(Wrapper); ok {\n\t\t\t\treject.Invoke(w)\n\t\t\t} else {\n\t\t\t\treject.Invoke(err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tresolve.Invoke(res...)\n\t\t}\n\t})\n\treturn New(\"Promise\", initFunc)\n}", "title": "" }, { "docid": "f15c440fb37ed463df3658e6c94ffb80", "score": "0.5212157", "text": "func (v Value) Promised() *Promise {\n\tdone := make(chan struct{})\n\tp := &Promise{\n\t\tv: v, done: done,\n\t}\n\tvar then, catch Func\n\tthen = CallbackOf(func(v []Value) {\n\t\tthen.Release()\n\t\tcatch.Release()\n\t\tp.res = v\n\t\tclose(done)\n\t})\n\tcatch = CallbackOf(func(v []Value) {\n\t\tthen.Release()\n\t\tcatch.Release()\n\t\tvar e Value\n\t\tif len(v) != 0 {\n\t\t\te = v[0]\n\t\t}\n\t\tif e.Ref == undefined {\n\t\t\te = NewObject()\n\t\t}\n\t\tp.err = NewError(e)\n\t\tclose(done)\n\t})\n\tv.Call(\"then\", then).Call(\"catch\", catch)\n\treturn p\n}", "title": "" }, { "docid": "6786727aeaf85545c34fd96bbad7aa8e", "score": "0.52028793", "text": "func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions) {}", "title": "" }, { "docid": "5688dd3eadab7e6318c0343eb878629c", "score": "0.5167431", "text": "func (p *Promise) Wait() error {\n\tp.mutex.Lock()\n\tif p.resolved {\n\t\tp.mutex.Unlock()\n\t\truntime.Gosched()\n\t\treturn p.response\n\t}\n\tp.count++\n\tp.mutex.Unlock()\n\truntime.Gosched()\n\treturn <-p.Chan\n}", "title": "" }, { "docid": "1902a6e801b16f1d603e300e396d84cd", "score": "0.50877726", "text": "func newResolver() *resolver {\n\treturn &resolver{\n\t\tconnsL: new(sync.Mutex),\n\t\tbufpool: newBufPool(buflen),\n\t\tupool: newBufPool(2),\n\t\tqto: TIMEOUT,\n\t\trint: RETRYINTERVAL,\n\t}\n}", "title": "" }, { "docid": "a2a114c56f8822d769783655f15e7e78", "score": "0.50864893", "text": "func (d *DoHClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {\n\t// Packing a message is not always a read-only operation, make a copy\n\tq = q.Copy()\n\n\tlogger(d.id, q, ci).WithFields(logrus.Fields{\n\t\t\"resolver\": d.endpoint,\n\t\t\"protocol\": \"doh\",\n\t\t\"method\": d.opt.Method,\n\t}).Debug(\"querying upstream resolver\")\n\n\t// Add padding before sending the query over HTTPS\n\tpadQuery(q)\n\n\td.metrics.query.Add(1)\n\tswitch d.opt.Method {\n\tcase \"POST\":\n\t\treturn d.ResolvePOST(q)\n\tcase \"GET\":\n\t\treturn d.ResolveGET(q)\n\t}\n\treturn nil, errors.New(\"unsupported method\")\n}", "title": "" }, { "docid": "b265277f85b3ce28629bed5dc5068340", "score": "0.50750935", "text": "func (m *message) resolve() (interface{}, error) {\n\tvar d interface{}\n\tswitch m.Event {\n\tcase \"subscribe\":\n\t\td = new(subscribe)\n\t}\n\n\terr := json.Unmarshal([]byte(m.Data), &d)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "84ef706b2c29f65383b0a2bbba4f02b2", "score": "0.50563425", "text": "func (r *routingResolver) resolveOnce(ctx context.Context, name string, options *opts.ResolveOpts) (path.Path, error) {\n\tlog.Debugf(\"RoutingResolver resolving %s\", name)\n\tcached, ok := r.cacheGet(name)\n\tif ok {\n\t\treturn cached, nil\n\t}\n\n\tif options.DhtTimeout != 0 {\n\t\t// Resolution must complete within the timeout\n\t\tvar cancel context.CancelFunc\n\t\tctx, cancel = context.WithTimeout(ctx, options.DhtTimeout)\n\t\tdefer cancel()\n\t}\n\n\tname = strings.TrimPrefix(name, \"/ipns/\")\n\thash, err := mh.FromB58String(name)\n\tif err != nil {\n\t\t// name should be a multihash. if it isn't, error out here.\n\t\tlog.Debugf(\"RoutingResolver: bad input hash: [%s]\\n\", name)\n\t\treturn \"\", err\n\t}\n\n\t// Name should be the hash of a public key retrievable from ipfs.\n\t// We retrieve the public key here to make certain that it's in the peer\n\t// store before calling GetValue() on the DHT - the DHT will call the\n\t// ipns validator, which in turn will get the public key from the peer\n\t// store to verify the record signature\n\t_, err = routing.GetPublicKey(r.routing, ctx, hash)\n\tif err != nil {\n\t\tlog.Debugf(\"RoutingResolver: could not retrieve public key %s: %s\\n\", name, err)\n\t\treturn \"\", err\n\t}\n\n\tpid, err := peer.IDFromBytes(hash)\n\tif err != nil {\n\t\tlog.Debugf(\"RoutingResolver: could not convert public key hash %s to peer ID: %s\\n\", name, err)\n\t\treturn \"\", err\n\t}\n\n\t// Use the routing system to get the name.\n\t// Note that the DHT will call the ipns validator when retrieving\n\t// the value, which in turn verifies the ipns record signature\n\t_, ipnsKey := IpnsKeysForID(pid)\n\tval, err := r.getValue(ctx, ipnsKey, options)\n\tif err != nil {\n\t\tlog.Debugf(\"RoutingResolver: dht get for name %s failed: %s\", name, err)\n\t\treturn \"\", err\n\t}\n\n\tentry := new(pb.IpnsEntry)\n\terr = proto.Unmarshal(val, entry)\n\tif err != nil {\n\t\tlog.Debugf(\"RoutingResolver: could not unmarshal value for name %s: %s\", name, err)\n\t\treturn \"\", err\n\t}\n\n\t// check for old style record:\n\tvalh, err := mh.Cast(entry.GetValue())\n\tif err != nil {\n\t\t// Not a multihash, probably a new record\n\t\tp, err := path.ParsePath(string(entry.GetValue()))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tr.cacheSet(name, p, entry)\n\t\treturn p, nil\n\t} else {\n\t\t// Its an old style multihash record\n\t\tlog.Debugf(\"encountered CIDv0 ipns entry: %s\", valh)\n\t\tp := path.FromCid(cid.NewCidV0(valh))\n\t\tr.cacheSet(name, p, entry)\n\t\treturn p, nil\n\t}\n}", "title": "" }, { "docid": "9af9f34ae61ba8027ebefe38ddecd210", "score": "0.50184566", "text": "func (fn ResolverFunc) Resolve(req *http.Request, code int, err error) Error {\n\treturn fn(req, code, err)\n}", "title": "" }, { "docid": "26e48b961f78c8b9457e77b375a7ce77", "score": "0.499533", "text": "func main() {\n\tflag.Parse()\n\n\targs := flag.Args()\n\n\tif len(args) != 1 {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\n\traw := args[0]\n\n\tp := promise.New(func(resolve promise.ResolveFunc, reject promise.RejectFunc) {\n\t\tnum, err := strconv.ParseUint(raw, 10, 64)\n\t\tif err != nil {\n\t\t\treject(err)\n\t\t\treturn\n\t\t}\n\n\t\tresolve(num)\n\t}).Catch(func(err error) promise.Value {\n\t\treturn promise.Reject(err).Catch(func(err error) promise.Value {\n\t\t\tnum, err := strconv.ParseInt(raw, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn num\n\t\t}).Catch(func(err error) promise.Value {\n\t\t\treturn parseBigInt(raw).Catch(func(err error) promise.Value {\n\t\t\t\tb, err := strconv.ParseBool(raw)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\treturn b\n\t\t\t})\n\t\t})\n\t}).Catch(func(err error) promise.Value {\n\t\treturn parseFloat(raw)\n\t}).Catch(func(err error) promise.Value {\n\t\treturn promise.Resolve(raw)\n\t}).Then(func(val promise.Value) promise.Value {\n\t\treturn fmt.Sprintf(\"%T: %v\", val, val)\n\t})\n\n\tval, err := p.Await()\n\n\tfmt.Printf(\"Promise value: %v, error: %v\\n\", val, err)\n}", "title": "" }, { "docid": "2d56786928a5b3f7d486d6e55f3ec0ee", "score": "0.4973028", "text": "func (p *Port) resolve() {\n\tif p.resolved {\n\t\treturn\n\t}\n\tif p.Num > 0 {\n\t\tp.servName = ServName(p.Proto, p.Num)\n\t}\n\tp.resolved = true\n}", "title": "" }, { "docid": "a80dac8a64d5743c32f084d126584b7b", "score": "0.4947997", "text": "func (state *visitState) resolveOne(ctx context.Context) (err error) {\n\t// Mark this worker as busy for the duration of this function.\n\tstate.busyResolvers++\n\tdefer state.update(func() { state.busyResolvers-- })\n\n\t// Extract the node to resolve.\n\tvar ni *nodeInfo\n\tstate.update(func() {\n\t\tl := len(state.toResolve)\n\t\tni = state.toResolve[l-1]\n\t\tstate.toResolve = state.toResolve[:l-1]\n\t})\n\n\t// Unlock while resolving.\n\tstate.mu.Unlock()\n\tdeps, err := state.dr.FindDependencies(ctx, ni.node)\n\tstate.mu.Lock()\n\n\t// Did we encounter an error in the unlocked region above?\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Perform state updates.\n\tstate.update(func() {\n\t\t// Ensure that we have a record for every dependency.\n\t\tstate.addNodes(deps)\n\n\t\t// Add this node to the list of dependants for each dependency that hasn't\n\t\t// yet been visited. Count them as we go.\n\t\tfor _, dep := range deps {\n\t\t\tdepNi := state.nodes[dep]\n\t\t\tif depNi.state == state_Visited {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tni.depsUnsatisfied++\n\t\t\tdepNi.dependants = append(depNi.dependants, ni)\n\t\t}\n\n\t\t// Update and reinsert the node itself.\n\t\tif ni.depsUnsatisfied > 0 {\n\t\t\tni.state = state_DependenciesUnsatisfied\n\t\t} else {\n\t\t\tni.state = state_Unvisited\n\t\t}\n\n\t\tstate.reinsert(ni)\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "2edf40b87896e18d526f12bb187a7679", "score": "0.49391422", "text": "func (ar *arpResolver) resolve(req *arpRequest) {\n\tvif := ar.getArpVIF(req.vif)\n\tif vif == nil {\n\t\tlog.Err(\"ARP requested on unknown VIF %d (target: %v)\", req.vif, req.target)\n\t\treturn\n\t}\n\n\tgo vif.doARPRequest(req)\n}", "title": "" }, { "docid": "c004a3d21ac915cb72245b39dde203a6", "score": "0.49377444", "text": "func resolveWorker() {\n\tpending := make(map[string][]resolveRequest)\n\tdatabaseResponse := make(chan *Container)\n\n\tfor {\n\t\tselect {\n\n\t\tcase request := <-resolveRequests:\n\t\t\tid := request.id\n\t\t\tcontainer := getCachedContainer(id)\n\t\t\tif container != nil {\n\t\t\t\t// Cache had valid data, respond immediately\n\t\t\t\trequest.response <- container\n\t\t\t} else {\n\t\t\t\t// Handle new incoming resolve request: If there are pending requests for the\n\t\t\t\t// same ID, join to wait. Otherwise fetch from database.\n\t\t\t\treqs, found := pending[id]\n\t\t\t\tif found {\n\t\t\t\t\tpending[id] = append(reqs, request)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Printf(\"Resolving container '%v'\", id)\n\t\t\t\t\tpending[id] = []resolveRequest{request}\n\t\t\t\t\tdatabaseRequests <- resolveRequest{\n\t\t\t\t\t\tid: id,\n\t\t\t\t\t\tresponse: databaseResponse,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase container := <-databaseResponse:\n\t\t\t// Handle incoming database response: Insert into cache and resolve all\n\t\t\t// pending requests for the ID.\n\t\t\tid := container.Subdomain\n\n\t\t\tif container.err != nil {\n\t\t\t\tlog.Printf(\"Failed to resolve container '%v': %v\", id, container.err)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Resolved container '%v' -> %v\", id, container.TargetURL.String())\n\t\t\t}\n\n\t\t\tcontainerCache.Add(id, container)\n\n\t\t\treqs, found := pending[id]\n\t\t\tif found {\n\t\t\t\tfor _, req := range reqs {\n\t\t\t\t\treq.response <- container\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Assertion error: No pending requests for DB query?\")\n\t\t\t}\n\t\t\tdelete(pending, id)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "556a494c7eaece50aca8e4c7124366da", "score": "0.49332646", "text": "func (r *GlobalStateResolvable) Resolve(ctx context.Context) (interface{}, error) {\n\tctx = capture.Put(ctx, r.Path.After.Capture)\n\tcmdIdx := r.Path.After.Indices[0]\n\tallCmds, err := Cmds(ctx, r.Path.After.Capture)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmds, err := sync.MutationCmdsFor(ctx, r.Path.After.Capture, allCmds, api.CmdID(cmdIdx), r.Path.After.Indices[1:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts, err := capture.NewState(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = api.ForeachCmd(ctx, cmds, func(ctx context.Context, id api.CmdID, cmd api.Cmd) error {\n\t\tcmd.Mutate(ctx, s, nil)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "a98201e168c0878f87ea8b20148c907b", "score": "0.49323636", "text": "func (*Privilege) Resolve(ctx context.Context) {\n\tcmd := sayori.CmdFromContext(ctx)\n\n\tif cmd.Err != nil {\n\t\t_, _ = cmd.Ses.ChannelMessageSend(cmd.Msg.ChannelID, cmd.Err.Error())\n\t}\n}", "title": "" }, { "docid": "05f876762c10a8f183759fecfeb91e1c", "score": "0.4932318", "text": "func (c *Client) waitUntilResolved(ctx context.Context, r *record) (net.IP, error) {\n\tif r.ip != nil {\n\t\treturn r.ip, nil\n\t}\n\n\t// Re-send the query repeatedly until we either get an answer or time out.\n\twait := initialQueryInterval\n\ttimer := time.NewTimer(wait)\n\tdefer timer.Stop()\n\n\tfor {\n\t\tif err := c.sendQuery(r); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Wait for pending query to resolve.\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\twait *= 2 // exponential backoff\n\t\t\ttimer.Reset(wait)\n\t\t\tcontinue\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, fmt.Errorf(\"failed to resolve %s: %w\", r.name, ctx.Err())\n\t\tcase <-r.readyCh:\n\t\t\tlog.Debug(\"resolved %s to %s\", r.name, r.ip)\n\t\t\treturn r.ip, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "898c3824d6bc67608e89d2a4c846ff84", "score": "0.4913635", "text": "func NewPromise(debug string, function Function) *Promise {\n\tif function == nil {\n\t\tpanic(\"nil function\")\n\t}\n\treturn &Promise{\n\t\tdebug: debug,\n\t\tfunction: function,\n\t}\n}", "title": "" }, { "docid": "79e0d75de79c4bf7cbeed55f019ae43a", "score": "0.4911695", "text": "func (p *Processor) Promise(handler MsgProcessor) *Processor {\n\tp.handle[Promise] = handler\n\treturn p\n}", "title": "" }, { "docid": "cc8781bf690679b6fb022b3e2b8dd99f", "score": "0.4896602", "text": "func (r *mockResolver) Resolve(ctx context.Context, repoURL, ref string) (string, error) {\n\tif len(r.calls) < 1 {\n\t\treturn \"\", skerr.Fmt(\"no mocked calls\")\n\t}\n\texpectRepoURL := r.calls[0][0]\n\texpectRef := r.calls[0][1]\n\treturnVal := r.calls[0][2]\n\tif repoURL != expectRepoURL || ref != expectRef {\n\t\treturn \"\", skerr.Fmt(\"have mocked call for (%s, %s) but got (%s, %s)\", expectRepoURL, expectRef, repoURL, ref)\n\t}\n\tr.calls = r.calls[1:]\n\treturn returnVal, nil\n}", "title": "" }, { "docid": "ef902e6287eee989f1e819c0c647c3ed", "score": "0.48887616", "text": "func (rde *DefinedEntity) Resolve() error {\n\tclient := rde.client\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointRdeEntitiesResolve\n\tapiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turlRef, err := client.OpenApiBuildEndpoint(fmt.Sprintf(endpoint, rde.DefinedEntity.ID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theaders, err := client.OpenApiPostItemAndGetHeaders(apiVersion, urlRef, nil, nil, rde.DefinedEntity, nil)\n\tif err != nil {\n\t\treturn amendRdeApiError(client, err)\n\t}\n\trde.Etag = headers.Get(\"Etag\")\n\n\treturn nil\n}", "title": "" }, { "docid": "4798658da427327f5bcff35fb6aa64fe", "score": "0.48705113", "text": "func (w *WorklogClient) Resolve(ctx context.Context, orgID *identity.ID, ident *apitypes.WorklogID) error {\n\treturn w.singleItemWorker(ctx, \"POST\", orgID, ident, nil)\n}", "title": "" }, { "docid": "9ff1dd19fc988ff2b7122ef556994a0a", "score": "0.48666856", "text": "func Get() *Resolver { return single }", "title": "" }, { "docid": "2aedf42b4c0aa340c25c206625653e6b", "score": "0.4866632", "text": "func (r *DNSResolver) Resolve(d *domain.Domain, challenge *acme.Challenge) (*domain.Domain, error) {\n\tvalue, err := r.acmeClient.DNS01ChallengeRecord(challenge.Token)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error getting the DNS challenge record for %s\", d.Name)\n\t}\n\n\tzone, err := r.getHostedZone(d.Name)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error getting the hosted zone for domain: %s\", d.Name)\n\t}\n\n\trecord := r.newTxtRecord(zone, d.Name, value)\n\t_, err = r.ns1Client.Records.Create(record)\n\tif err != nil && err != rest.ErrRecordExists {\n\t\treturn nil, errors.Wrapf(err, \"error creating DNS record for domain challenge: %s\", d.Name)\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "90ef736fb3f63d1464e716d4e0259cdd", "score": "0.48628166", "text": "func Resolve(subdomain string, cookies []*http.Cookie) (*Container, error) {\n\tcontainer := getCachedContainer(subdomain)\n\n\tif container == nil {\n\t\tresponse := make(chan *Container)\n\t\tresolveRequests <- resolveRequest{\n\t\t\tid: subdomain,\n\t\t\tresponse: response,\n\t\t}\n\t\tcontainer = <-response\n\t}\n\n\tif container.err != nil {\n\t\treturn nil, container.err\n\t}\n\n\terr := authenticate(container, cookies)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn container, nil\n}", "title": "" }, { "docid": "ab21bef0111b0c0ec6cffa4cac36e860", "score": "0.4862792", "text": "func NewResolveParams() *ResolveParams {\n\tvar ()\n\treturn &ResolveParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "b2f377c4829edb6f8e4c94b66ee39a96", "score": "0.4842786", "text": "func (r *APIStateResolvable) Resolve(ctx context.Context) (interface{}, error) {\n\tctx = capture.Put(ctx, r.Path.After.Capture)\n\tcmdIdx := r.Path.After.Indices[0]\n\tif len(r.Path.After.Indices) > 1 {\n\t\treturn nil, fmt.Errorf(\"Subcommands currently not supported for api state\") // TODO: Subcommands\n\t}\n\tcmds, err := NCmds(ctx, r.Path.After.Capture, cmdIdx+1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn apiState(ctx, cmds, r.Path)\n}", "title": "" }, { "docid": "6b99e8bdaf9f6104df03db657be11f70", "score": "0.48402202", "text": "func (r TaskRef) Resolve() (Task, error) {\n\tvalidationErrors := ErrorOnInvalid(r)\n\tif validationErrors.HasErrors() {\n\t\treturn Task{}, validationErrors\n\t}\n\n\ttask := r.env.Tasks[r.ref]\n\treturn Task{\n\t\tName: task.Name,\n\t\tlocation: task.location,\n\t\tComponent: task.Component,\n\t\tPlaybook: task.Playbook,\n\t\tCron: task.Cron,\n\t\tHooks: task.Hooks,\n\t\tParameters: r.parameters.inherits(task.Parameters),\n\t\tEnvVars: r.envVars.inherits(task.EnvVars)}, nil\n}", "title": "" }, { "docid": "9160e7a59f05c9196813e2703b997028", "score": "0.48280352", "text": "func (r *PoolResolver) Resolve(target string) (naming.Watcher, error) {\n\tif r.dialOpt.Endpoint == \"\" {\n\t\treturn nil, errors.New(\"No endpoint configured\")\n\t}\n\taddrs := make([]*naming.Update, 0, r.poolSize)\n\tfor i := 0; i < r.poolSize; i++ {\n\t\taddrs = append(addrs, &naming.Update{Op: naming.Add, Addr: r.dialOpt.Endpoint, Metadata: i})\n\t}\n\tr.ch = make(chan []*naming.Update, 1)\n\tr.ch <- addrs\n\treturn r, nil\n}", "title": "" }, { "docid": "dc260ccb10285b228f151f998479a658", "score": "0.48235887", "text": "func newFuture() *Future {\n\treturn &Future{make(chan *ResultSet, 1)}\n}", "title": "" }, { "docid": "ae8db61e51c793f32605718a9983ecf4", "score": "0.48189318", "text": "func ResolveDeeplink(r Resolver, u string) Promise {\n\treturn func(ctx context.Context) (tg.InputPeerClass, error) {\n\t\tlink, err := deeplink.Expect(u, deeplink.Resolve)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdomain := link.Args.Get(\"domain\")\n\n\t\tif err := validateDomain(domain); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"validate domain\")\n\t\t}\n\n\t\treturn r.ResolveDomain(ctx, domain)\n\t}\n}", "title": "" }, { "docid": "6861c98c7ed5cda2c66a0c36e684390d", "score": "0.48010516", "text": "func Race(promises []*Promise) *Promise {\n\n\treturn Create(func(resolve Callback, reject Callback) {\n\n\t\terrList := make([]interface{}, len(promises))\n\n\t\tresolvedStateR, resolvedStateW, _ := getSyncStateBool(false)\n\n\t\tvar wait sync.WaitGroup\n\t\twait.Add(len(promises))\n\t\tfor i, promise := range promises {\n\t\t\tindex := i\n\t\t\tif promise == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpromise.Then(func(value interface{}) (interface{}, error) {\n\n\t\t\t\tresolve(value)\n\t\t\t\t// if !resolvedRW(true) {\n\t\t\t\t// \tmessage <- value\n\t\t\t\t// }\n\t\t\t\twait.Done()\n\t\t\t\tresolvedStateW(true)\n\t\t\t\treturn nil, nil\n\t\t\t}).Catch(func(value interface{}) (interface{}, error) {\n\t\t\t\t// if !resolvedR() {\n\t\t\t\t// \terrs <- value\n\t\t\t\twait.Done()\n\t\t\t\terrList[index] = value\n\t\t\t\t// }\n\t\t\t\treturn nil, nil\n\t\t\t})\n\n\t\t\t// this avoids launching extra go routings using then and catch\n\t\t\tif resolvedStateR() {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\twait.Wait()\n\t\tif resolvedStateR() {\n\t\t\treturn\n\t\t}\n\t\treject(errList)\n\n\t})\n}", "title": "" }, { "docid": "46daad69a1ea44302f3478e17a410248", "score": "0.47999325", "text": "func NewResolveResolveContext(ctx context.Context, r *http.Request, service *goa.Service) (*ResolveResolveContext, error) {\n\tvar err error\n\tresp := goa.ContextResponse(ctx)\n\tresp.Service = service\n\treq := goa.ContextRequest(ctx)\n\treq.Request = r\n\trctx := ResolveResolveContext{Context: ctx, ResponseData: resp, RequestData: req}\n\tparamHostname := req.Params[\"hostname\"]\n\tif len(paramHostname) > 0 {\n\t\trawHostname := paramHostname[0]\n\t\trctx.Hostname = rawHostname\n\t}\n\treturn &rctx, err\n}", "title": "" }, { "docid": "bc2783cb49cf3bad04b8ad1e541a7b80", "score": "0.47950462", "text": "func (m *Manager) Resolve(ctx context.Context, from string) (Peer, error) {\n\tfrom = strings.TrimSpace(from)\n\n\tif deeplink.IsDeeplinkLike(from) {\n\t\treturn m.ResolveDeeplink(ctx, from)\n\t}\n\tif isPhoneNumber(from) {\n\t\treturn m.ResolvePhone(ctx, from)\n\t}\n\treturn m.ResolveDomain(ctx, from)\n}", "title": "" }, { "docid": "3086267c00020c7e3443a7d9043c9123", "score": "0.47941607", "text": "func (this *Container) Resolve(abstract string) interface{} {\n\tabstract = this.GetAlias(abstract)\n\n\t// If an instance of the type is currently being managed as a singleton we'll\n\t// just return an existing instance instead of instantiating new instances\n\t// so the developer can keep using the same objects instance every time.\n\tif instance, ok := this.instances[abstract]; ok {\n\t\treturn instance\n\t}\n\n\tobject := this.getConcrete(abstract)\n\n\tif object == nil {\n\t\treturn nil\n\t}\n\n\t// We're ready to instantiate an instance of the concrete type registered for\n\t// the binding. This will instantiate the types, as well as resolve any of\n\t// its \"nested\" dependencies recursively until all have gotten resolved.\n\tobject = this.Build(object, abstract)\n\n\t// If we defined any extenders for this type, we'll need to spin through them\n\t// and apply them to the object being built. This allows for the extension\n\t// of services, such as changing configuration or decorating the object.\n\tfor _, extender := range this.getExtenders(abstract) {\n\t\tobject = extender(object, this)\n\t}\n\t// If the requested type is registered as a singleton we'll want to cache off\n\t// the instances in \"memory\" so we can return it later without creating an\n\t// entirely new instance of an object on each subsequent request for it.\n\tif this.IsShared(abstract) {\n\t\tthis.instances[abstract] = object\n\t}\n\n\tthis.resolved[abstract] = true\n\n\treturn object\n}", "title": "" }, { "docid": "37d5c9cf786ccf064ddd682f1f7a84e2", "score": "0.4792958", "text": "func (r *ParallelBestResolver) Resolve(request *model.Request) (*model.Response, error) {\n\tlogger := log.WithPrefix(request.Log, parallelResolverType)\n\n\tvar resolvers []*upstreamResolverStatus\n\tfor _, r := range r.resolversPerClient {\n\t\tresolvers = r\n\n\t\tbreak\n\t}\n\n\tif len(resolvers) == 1 {\n\t\tlogger.WithField(\"resolver\", resolvers[0].resolver).Debug(\"delegating to resolver\")\n\n\t\treturn resolvers[0].resolver.Resolve(request)\n\t}\n\n\tr1, r2 := pickRandom(resolvers)\n\tlogger.Debugf(\"using %s and %s as resolver\", r1.resolver, r2.resolver)\n\n\tch := make(chan requestResponse, resolverCount)\n\n\tvar collectedErrors []error\n\n\tlogger.WithField(\"resolver\", r1.resolver).Debug(\"delegating to resolver\")\n\n\tgo r1.resolve(request, ch)\n\n\tlogger.WithField(\"resolver\", r2.resolver).Debug(\"delegating to resolver\")\n\n\tgo r2.resolve(request, ch)\n\n\tfor len(collectedErrors) < resolverCount {\n\t\tresult := <-ch\n\n\t\tif result.err != nil {\n\t\t\tlogger.Debug(\"resolution failed from resolver, cause: \", result.err)\n\t\t\tcollectedErrors = append(collectedErrors, result.err)\n\t\t} else {\n\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\"resolver\": *result.resolver,\n\t\t\t\t\"answer\": util.AnswerToString(result.response.Res.Answer),\n\t\t\t}).Debug(\"using response from resolver\")\n\n\t\t\treturn result.response, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"resolution was not successful, used resolvers: '%s' and '%s' errors: %v\",\n\t\tr1.resolver, r2.resolver, collectedErrors)\n}", "title": "" }, { "docid": "b32dc32731f09b8439e09bb8a530860c", "score": "0.47777218", "text": "func (s *manifestStore) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {\n\tref, err := s.repo.ParseReference(reference)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\tctx = registryutil.WithScopeHint(ctx, ref, auth.ActionPull)\n\turl := buildRepositoryManifestURL(s.repo.PlainHTTP, ref)\n\treq, err := http.NewRequestWithContext(ctx, http.MethodHead, url, nil)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\treq.Header.Set(\"Accept\", manifestAcceptHeader(s.repo.ManifestMediaTypes))\n\n\tresp, err := s.repo.client().Do(req)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\treturn s.generateDescriptor(resp, ref, req.Method)\n\tcase http.StatusNotFound:\n\t\treturn ocispec.Descriptor{}, fmt.Errorf(\"%s: %w\", ref, errdef.ErrNotFound)\n\tdefault:\n\t\treturn ocispec.Descriptor{}, errutil.ParseErrorResponse(resp)\n\t}\n}", "title": "" }, { "docid": "65ef66df3472cf3b53d5d311fb667de6", "score": "0.47775847", "text": "func Resolve(ip net.IP) (*Response, error) {\n\treturn DefaultClient().Resolve(ip)\n}", "title": "" }, { "docid": "b7efea7269dab20f360efee080d1224c", "score": "0.47751623", "text": "func (r *Range) resolve(repo *git.Repository) (*revisionRange, error) {\n\tolder, err := resolveOlderTree(repo, r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Invalid older revision\")\n\t}\n\tnewer, err := resolveNewerTree(repo, r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Invalid newer revision\")\n\t}\n\treturn &revisionRange{ref: r, older: older, newer: newer}, nil\n}", "title": "" }, { "docid": "4940ad9f7536e18c05d7755238cbe3fc", "score": "0.47707075", "text": "func Resolve(ctx context.Context) error {\n\ttransaction, err := getTransaction(ctx)\n\tif err != nil {\n\t\tglog.Errorf(\"%v\", err)\n\t\treturn err\n\t}\n\n\tif transaction.rollback {\n\t\tif err := rollback(ctx); err != nil {\n\t\t\tglog.Errorf(\"Could not rollback transaction: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\tglog.Info(\"Rolled back transaction\")\n\t} else {\n\t\tif err := commit(ctx); err != nil {\n\t\t\tglog.Errorf(\"Could not commit transaction: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "134fe7e425ba72ac6cc8e87a00c6d4de", "score": "0.47687614", "text": "func (NoopRepositoryProvider) Resolve(ctx context.Context, repo *v1.Repository) error {\n\treturn errNotSupported\n}", "title": "" }, { "docid": "68c401e363779764e38db3e9beb1020a", "score": "0.47447753", "text": "func MyPromiseConstructor(i int) Open {\n\treturn func() Promise {\n\t\tp := &MyPromise{\n\t\t\tident: i,\n\t\t\tdata: make(map[string]interface{}),\n\t\t}\n\t\tp.Super()\n\t\treturn p\n\t}\n}", "title": "" }, { "docid": "7683084745256bcb6c0d09d8a31e645c", "score": "0.474006", "text": "func NewPromise_resolve_Results_List(s *capnp.Segment, sz int32) (Promise_resolve_Results_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)\n\treturn Promise_resolve_Results_List{l}, err\n}", "title": "" }, { "docid": "305f30a184ee51c2a5e8bac765c6f79f", "score": "0.47316065", "text": "func (m *AISBackendProvider) resolve(uuid string) (*remAis, string, error) {\n\tremAis, ok := m.remote[uuid]\n\tif ok {\n\t\treturn remAis, uuid, nil\n\t}\n\talias := uuid\n\tif uuid, ok = m.alias[alias]; !ok {\n\t\treturn nil, \"\", cos.NewErrNotFound(\"%s: remote cluster %q\", m.t, alias)\n\t}\n\tremAis, ok = m.remote[uuid]\n\tdebug.Assertf(ok, \"%q vs %q\", alias, uuid)\n\treturn remAis, uuid, nil\n}", "title": "" }, { "docid": "5308b7a80b1118b598a0e1715aa7d04a", "score": "0.47271067", "text": "func (obj *Promise) Catch(callback Callback) *Promise {\n\treturn Create(func(resolve Callback, reject Callback) {\n\n\t\tobj.valueWaitLock.Wait()\n\t\tif obj.resolved && obj.failed {\n\t\t\tvalue, err := callback(obj.value)\n\n\t\t\t/**\n\t\t\t* When return value is a Promise.Resolve statement or a new *Promise\n\t\t\t*\n\t\t\t***/\n\t\t\tvp, ok := value.(*Promise)\n\t\t\tif ok {\n\t\t\t\tvp.valueWaitLock.Wait()\n\t\t\t\tif vp.resolved && !vp.failed {\n\t\t\t\t\tresolve(vp.value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif vp.resolved && vp.failed {\n\t\t\t\t\treject(vp.value)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\tresolve(value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\treject(err)\n\t\t\treturn\n\t\t} else if obj.resolved && !obj.failed {\n\t\t\tresolve(obj.value)\n\t\t\treturn\n\t\t}\n\n\t})\n}", "title": "" }, { "docid": "22d1e92b99375279870fed7b49a94331", "score": "0.47245276", "text": "func (r *Replace) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {\n\tif len(q.Question) < 1 {\n\t\treturn nil, errors.New(\"no question in query\")\n\t}\n\toldName := q.Question[0].Name\n\tnewName := r.exp.apply(oldName)\n\tlog := logger(r.id, q, ci)\n\n\t// if nothing needs modifying, we can stop here and use the original query\n\tif newName == oldName {\n\t\tlog.Debug(\"forwarding unmodified query to resolver\")\n\t\treturn r.resolver.Resolve(q, ci)\n\t}\n\n\t// Modify the query string\n\tq.Question[0].Name = newName\n\n\t// Send the query upstream\n\tlog.WithField(\"new-qname\", newName).WithField(\"resolver\", r.resolver).Debug(\"forwarding modified query to resolver\")\n\ta, err := r.resolver.Resolve(q, ci)\n\tif err != nil || a == nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the question back to the original name\n\ta.Question[0].Name = oldName\n\n\t// Now put the original name in all answer records that have the\n\t// new name\n\tfor _, answer := range a.Answer {\n\t\tif answer.Header().Name == newName {\n\t\t\tanswer.Header().Name = oldName\n\t\t}\n\t}\n\treturn a, nil\n}", "title": "" }, { "docid": "0a088eb0e9cda8f4b603b0421827fb88", "score": "0.47174153", "text": "func (base *BaseComponent) RequestFuture(message interface{}, timeout time.Duration, tip string) *actor.Future {\n\tif base.pid == nil {\n\t\tlogger.Warn().Str(\"to\", base.GetName()).Str(\"from\", tip).Interface(\"msg\", message).Msg(\"PID is empty\")\n\t\tretFuture := actor.NewFuturePrefix(\"NilPID\", timeout)\n\t\tretFuture.PID().Tell(ErrHubUnregistered)\n\n\t\treturn retFuture\n\t}\n\n\treturn base.pid.RequestFuturePrefix(message, tip, timeout)\n}", "title": "" }, { "docid": "e4820aa2960f3a5f24aa78ad9aab01a4", "score": "0.47167304", "text": "func (obj *Promise) Then(callback Callback) *Promise {\n\treturn Create(func(resolve Callback, reject Callback) {\n\n\t\tobj.valueWaitLock.Wait()\n\t\tif obj.resolved && !obj.failed {\n\t\t\tvalue, err := callback(obj.value)\n\n\t\t\t/**\n\t\t\t* When return value is a Promise.Resolve statement or a new *Promise\n\t\t\t*\n\t\t\t***/\n\t\t\tvp, ok := value.(*Promise)\n\t\t\tif ok {\n\t\t\t\tvp.valueWaitLock.Wait()\n\t\t\t\tif vp.resolved && !vp.failed {\n\t\t\t\t\tresolve(vp.value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif vp.resolved && vp.failed {\n\t\t\t\t\treject(vp.value)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\tresolve(value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\treject(err)\n\t\t\treturn\n\n\t\t} else if obj.resolved && obj.failed {\n\t\t\treject(obj.value)\n\t\t\treturn\n\t\t}\n\n\t})\n}", "title": "" }, { "docid": "ff9b9bac6a1aef3f73a4099e80a0a7a6", "score": "0.47082445", "text": "func (store *SessionStore) Resolve(id string) Session {\n\tstore.Lock()\n\tdefer store.Unlock()\n\n\tpeer, ok := store.tokens[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\tdelete(store.tokens, id)\n\n\treturn store.sessions[peer]\n}", "title": "" }, { "docid": "27243d26be6073aeeda0dde80f1aca46", "score": "0.47003722", "text": "func (f *Future) Client() Client {\n\tp := f.promise\n\tp.mu.Lock()\n\tswitch {\n\tcase p.isUnresolved():\n\t\tft := f.transform()\n\t\tcpath := clientPathFromTransform(ft)\n\t\tif cp := p.clients[cpath]; cp != nil {\n\t\t\treturn cp.client\n\t\t}\n\t\tc, pr := NewPromisedClient(PipelineClient{\n\t\t\tp: p,\n\t\t\ttransform: ft,\n\t\t})\n\t\tif p.clients == nil {\n\t\t\tp.clients = make(map[clientPath]*clientAndPromise)\n\t\t}\n\t\tp.clients[cpath] = &clientAndPromise{c, pr}\n\t\tp.mu.Unlock()\n\t\treturn c\n\tcase p.isPendingResolution():\n\t\tsyncutil.Without(&p.mu, func() {\n\t\t\t<-p.resolved\n\t\t})\n\t\tfallthrough\n\tcase p.isResolved():\n\t\tr := p.resolution()\n\t\tp.mu.Unlock()\n\t\treturn r.client(f.transform())\n\tdefault:\n\t\tpanic(\"unreachable\")\n\t}\n}", "title": "" }, { "docid": "853676dd578ead107b77f985a0e7b19a", "score": "0.46887773", "text": "func (cp *ClientPromise) fulfill(c Client) {\n\t// Obtain next client hook.\n\tvar rh *clientHook\n\tif (c != Client{}) {\n\t\tc.mu.Lock()\n\t\tif c.released {\n\t\t\tc.mu.Unlock()\n\t\t\tpanic(\"ClientPromise.Fulfill with a released client\")\n\t\t}\n\t\t// TODO(maybe): c.h = resolveHook(c.h)\n\t\trh = c.h\n\t\tc.mu.Unlock()\n\t}\n\n\t// Mark hook as resolved.\n\tcp.h.mu.Lock()\n\tif cp.h.isResolved() {\n\t\tcp.h.mu.Unlock()\n\t\tpanic(\"ClientPromise.Fulfill called more than once\")\n\t}\n\tcp.h.resolvedHook = rh\n\tclose(cp.h.resolved)\n\trefs := cp.h.refs\n\tcp.h.refs = 0\n\tif refs == 0 {\n\t\tcp.h.mu.Unlock()\n\t\treturn\n\t}\n\n\t// Client still had references, so we're responsible for shutting it down.\n\tif cp.h.calls == 0 {\n\t\tclose(cp.h.done)\n\t}\n\trh = resolveHook(cp.h) // swaps mutex on cp.h for mutex on rh\n\tif rh != nil {\n\t\trh.refs += refs\n\t\trh.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "26d6b6953634959c2b39e409bb741f48", "score": "0.4671011", "text": "func (httpAPI *API) Resolve(params martini.Params, r render.Render, req *http.Request) {\n\tinstanceKey, err := httpAPI.getInstanceKey(params[\"host\"], params[\"port\"])\n\n\tif err != nil {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: err.Error()})\n\t\treturn\n\t}\n\n\tif conn, err := net.Dial(\"tcp\", instanceKey.DisplayString()); err == nil {\n\t\tconn.Close()\n\t} else {\n\t\tRespond(r, &APIResponse{Code: ERROR, Message: err.Error()})\n\t\treturn\n\t}\n\n\tRespond(r, &APIResponse{Code: OK, Message: \"Instance resolved\", Details: instanceKey})\n}", "title": "" }, { "docid": "2b0b27fb90d1fd7642a0f1eedeb44fc4", "score": "0.4670616", "text": "func (gs GopherService) ResolveGopher(p graphql.ResolveParams) (interface{}, error) {\n\t// show them if cast to int instead how error ir returned in message\n\tid, ok := p.Args[\"id\"].(string)\n\tif !ok {\n\t\treturn nil, errors.New(\"id has to be a string\")\n\t}\n\t// Call the Repository for the ID\n\tgopher, err := gs.gophers.GetGopher(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gopher, nil\n}", "title": "" }, { "docid": "01395fe6fc1940233d916fcc1ae53f49", "score": "0.46698233", "text": "func (p *Proposer) DeliverPromise(prm Promise) {\n\t//TODO(student): Task 3 - distributed implementation\n\tp.promiseChan <- prm\n}", "title": "" }, { "docid": "ce9c2b1907222cfc1732b7a7bf642742", "score": "0.46609136", "text": "func (m *Manager) resolve(name string) (repo contracts.CacheRepository, err error) {\n\tconf := m.getConfig(name)\n\tif conf == nil {\n\t\treturn nil, fmt.Errorf(\"cache store %s is not defined\", name)\n\t}\n\tdriver := conf.String(\"driver\")\n\tswitch driver {\n\tcase DvrFile:\n\t\trepo = m.createFileDriver(conf)\n\t\tbreak\n\tcase DvrRedis:\n\t\trepo = m.createRedisDriver(conf)\n\t\tbreak\n\t}\n\treturn repo, nil\n}", "title": "" }, { "docid": "eed6f05e45943ecf42428b932be10f9a", "score": "0.46557793", "text": "func (s *blobStore) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {\n\tref, err := s.repo.ParseReference(reference)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\trefDigest, err := ref.Digest()\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\tctx = registryutil.WithScopeHint(ctx, ref, auth.ActionPull)\n\turl := buildRepositoryBlobURL(s.repo.PlainHTTP, ref)\n\treq, err := http.NewRequestWithContext(ctx, http.MethodHead, url, nil)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\n\tresp, err := s.repo.client().Do(req)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\treturn generateBlobDescriptor(resp, refDigest)\n\tcase http.StatusNotFound:\n\t\treturn ocispec.Descriptor{}, fmt.Errorf(\"%s: %w\", ref, errdef.ErrNotFound)\n\tdefault:\n\t\treturn ocispec.Descriptor{}, errutil.ParseErrorResponse(resp)\n\t}\n}", "title": "" }, { "docid": "8b60af3423b47ccbbea64a4764404cc9", "score": "0.46553573", "text": "func NewImageResolveRef(ref unsafe.Pointer) *ImageResolve {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageResolve)\n\tobj.ref7bda856d = (*C.VkImageResolve)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "8b60af3423b47ccbbea64a4764404cc9", "score": "0.46553573", "text": "func NewImageResolveRef(ref unsafe.Pointer) *ImageResolve {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageResolve)\n\tobj.ref7bda856d = (*C.VkImageResolve)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "8b7a4338f0201ce5d97d70d7275d5cf6", "score": "0.4653893", "text": "func Init(v interface{}, e error) *Promise {\n\treturn &Promise{\n\t\tv: v,\n\t\te: e,\n\t}\n}", "title": "" }, { "docid": "e4df1b6c0a03306232ef166aa4528483", "score": "0.46526533", "text": "func (p *Promise) Reject(e error) {\n\tif e == nil {\n\t\tpanic(\"Promise.Reject(nil)\")\n\t}\n\tp.Resolve(Ptr{}, e)\n}", "title": "" }, { "docid": "85a2b46f0195f28732ca93482cdc3b67", "score": "0.4648816", "text": "func NewPromise_resolve_Params_List(s *capnp.Segment, sz int32) (Promise_resolve_Params_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)\n\treturn Promise_resolve_Params_List{l}, err\n}", "title": "" }, { "docid": "985e15332691f9a22dfb64fc3283e349", "score": "0.4646953", "text": "func New(c context.Context, gen Generator) *Promise {\n\tp := Promise{\n\t\tsignalC: make(chan struct{}),\n\t}\n\n\t// Execute our generator function in a separate goroutine.\n\tgo p.runGen(c, gen)\n\treturn &p\n}", "title": "" }, { "docid": "5a69f8b9298a793f142bb8b848d0b3ce", "score": "0.4631942", "text": "func Await(promise js.Value) (res js.Value, err error) {\n\tch := make(chan bool)\n\tpromise.Call(\"then\",\n\t\tCallback1(func(arg js.Value) interface{} {\n\t\t\tres = arg\n\t\t\tclose(ch)\n\t\t\treturn nil\n\t\t}),\n\t).Call(\"catch\",\n\t\tCallback1(func(arg js.Value) interface{} {\n\t\t\terr = wrappedError(arg)\n\t\t\tclose(ch)\n\t\t\treturn nil\n\t\t}),\n\t)\n\t<-ch\n\treturn\n}", "title": "" }, { "docid": "d7b74e672ea1eb92a1be8b85620bbb09", "score": "0.4622341", "text": "func (p *Promise) requireUnresolved(callerMethod string) {\n\tif !p.isUnresolved() {\n\t\tvar prevMethod string\n\t\tif p.err == nil {\n\t\t\tprevMethod = \"Fulfill\"\n\t\t} else {\n\t\t\tprevMethod = fmt.Sprintf(\"Reject (error = %q)\", p.err)\n\t\t}\n\n\t\tpanic(\"Promise.\" + callerMethod +\n\t\t\t\" called after previous call to \" + prevMethod)\n\t}\n}", "title": "" }, { "docid": "610917d89b68214e744fdba66d3a3d81", "score": "0.4618462", "text": "func (r *Repository) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {\n\treturn r.Manifests().Resolve(ctx, reference)\n}", "title": "" }, { "docid": "deca1c5d6f2a65fc0b320299bedc0087", "score": "0.46166676", "text": "func (s PerResource) ResolveCreate(candidates []*endpoint.Endpoint) *endpoint.Endpoint {\n\tvar min *endpoint.Endpoint\n\tfor _, ep := range candidates {\n\t\tif min == nil || s.less(ep, min) {\n\t\t\tmin = ep\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "f0883c2cf28f508c3b48ca8d75294ec8", "score": "0.46069175", "text": "func (r *Resolver) Resolve(target string) (naming.Watcher, error) {\n\treturn r, nil\n}", "title": "" }, { "docid": "c2b4280da1599117de23c61f34ebcf05", "score": "0.46030405", "text": "func (p *Proposer) DeliverPromise(prm Promise) {\n\t//TODO(student): Task 3 - distributed implementation\n\tp.PromiseIn <- prm\n}", "title": "" }, { "docid": "6f3fbe4f76707c453bbc4f543fd9ab7f", "score": "0.45966113", "text": "func (cp *ClientPromise) Fulfill(c Client) {\n\tcp.fulfill(c)\n\tcp.shutdown()\n}", "title": "" }, { "docid": "335fb0bd21f14fea84fc61c07e48b725", "score": "0.45948225", "text": "func (s *ScannerBase) Resolve(res interface{}, _ uint64) {\n\tvar keys []string\n\ts.Iter, keys, s.Err = ScanResponse(res)\n\tcb := s.cb\n\ts.cb = nil\n\tif s.Err != nil {\n\t\tcb.Resolve(s.Err, 0)\n\t} else {\n\t\tcb.Resolve(keys, 0)\n\t}\n}", "title": "" } ]
26afab25a5ec9665075d0df57706d8fe
FoldInt32F on okInt32 receiver applies its second function arguments on hold value and returns an int32
[ { "docid": "daba58678dd0ad48787050c547ecedda", "score": "0.77283627", "text": "func (s okInt32) FoldInt32F(a func(error) int32, f func(int32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" } ]
[ { "docid": "37bfc71d173562b6586c0aa3e030a506", "score": "0.80313486", "text": "func (e errUInt64) FoldInt32(a int32, f func(v uint64) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "f6968d9631f5b7b2523e9c9333646fde", "score": "0.7977821", "text": "func (s okUInt8) FoldInt32F(a func(error) int32, f func(uint8) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "ce10fff0b663e4022cd044c54104a538", "score": "0.79767156", "text": "func (s okUInt) FoldInt32F(a func(error) int32, f func(uint) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "23bf0caa78a01a16f1c3bc42efdffc87", "score": "0.79700017", "text": "func (e errUInt8) FoldInt32(a int32, f func(v uint8) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "2edc0f6ba6440c3fd0149ecc3e111b58", "score": "0.79697067", "text": "func (s okUInt32) FoldInt32F(a func(error) int32, f func(uint32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "186faa5129abb9993656d4d629e68948", "score": "0.7952639", "text": "func (e errUInt32) FoldInt32(a int32, f func(v uint32) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "2a1374e7b34ec7a4c9c2005778606922", "score": "0.79285884", "text": "func (e errUInt16) FoldInt32(a int32, f func(v uint16) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "6b85b27d7144ef3a02e2f93ad1e42e9c", "score": "0.7923846", "text": "func (s okUInt64) FoldInt32F(a func(error) int32, f func(uint64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "4a2d952baf4a15481437f8a1992d3b40", "score": "0.79176605", "text": "func (s okUInt8) FoldInt32(a int32, f func(uint8) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "4283ef950e4fcba0bfcf1490f5d7a061", "score": "0.7889899", "text": "func (s okUInt) FoldInt32(a int32, f func(uint) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "b5bd89d23e127c0a90564f5735aca396", "score": "0.78893125", "text": "func (s okUInt32) FoldInt32(a int32, f func(uint32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "92db647cffd73cd736a7d888938c20d4", "score": "0.78821653", "text": "func (s okUInt16) FoldInt32F(a func(error) int32, f func(uint16) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "08bed57f91653ac9b2a631d64b897dad", "score": "0.78702515", "text": "func (e errUInt) FoldInt32(a int32, f func(v uint) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "ab199a5fb3bc81a27f194e1101f8b38c", "score": "0.78681", "text": "func (e errUInt64) FoldInt32F(a func(error) int32, f func(uint64) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "1be9ca9dff260906c5f293a24be38d52", "score": "0.7859365", "text": "func (e errUInt32) FoldInt32F(a func(error) int32, f func(uint32) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "d876f25e47db966052f8472292c115d5", "score": "0.7856942", "text": "func (e errUInt8) FoldInt32F(a func(error) int32, f func(uint8) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "2a620015c892caf130001e47b576d5c1", "score": "0.78527474", "text": "func (e errInt16) FoldInt32(a int32, f func(v int16) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "9c7d99fa2ef95e40d419b15e474b25fa", "score": "0.78521484", "text": "func (s okInt) FoldInt32F(a func(error) int32, f func(int) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "83ea8c25dc297c109ee070ee7e077d9f", "score": "0.7844284", "text": "func (s okByte) FoldInt32F(a func(error) int32, f func(byte) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "c3d56b6b6333528dc92fcb5ef46755fd", "score": "0.7834782", "text": "func (e errUInt) FoldInt32F(a func(error) int32, f func(uint) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "274301eda97886e71261064823ac0556", "score": "0.78249043", "text": "func (e errUInt16) FoldInt32F(a func(error) int32, f func(uint16) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "69ef0fd7832e6ceb0127ecd257b51b26", "score": "0.7816568", "text": "func (s okUInt64) FoldInt32(a int32, f func(uint64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "3240ee2570def81d9b3ad92f35dd3f3c", "score": "0.78060263", "text": "func (s okUInt16) FoldInt32(a int32, f func(uint16) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "a949f188ebb82b354d17557d9a241313", "score": "0.77863556", "text": "func (e errInt64) FoldInt32(a int32, f func(v int64) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "8f9e8dd12c86ae2699b7e0f2e8476489", "score": "0.7760278", "text": "func (s okInt8) FoldInt32F(a func(error) int32, f func(int8) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "a470c641a1024523f93d9357bab2fa1b", "score": "0.775112", "text": "func (s okInt16) FoldInt32F(a func(error) int32, f func(int16) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "d6aa693b883244c83a054f2ef9cb2b7a", "score": "0.77464336", "text": "func (s okInt) FoldInt32(a int32, f func(int) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "42aafbda2fd7aec0be18e48352f866df", "score": "0.77428573", "text": "func (s okByte) FoldInt32(a int32, f func(byte) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "7a077d95aec70646c0ecdff9bfa1d1f1", "score": "0.7737681", "text": "func (e errFloat64) FoldInt32(a int32, f func(v float64) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "211f0f72a4442f52051137d36a550978", "score": "0.7730941", "text": "func (e errUintPtr) FoldInt32(a int32, f func(v uintptr) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "300cdd1fae4292fa8af94075d7745286", "score": "0.77289027", "text": "func (e errInt32) FoldInt32(a int32, f func(v int32) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "ddff6a2f85edd96956fa48a58bd19608", "score": "0.7711051", "text": "func (e errInt8) FoldInt32(a int32, f func(v int8) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "f6dd3d6cd60ba245736c747d682fa79e", "score": "0.77081585", "text": "func (s okInt16) FoldInt32(a int32, f func(int16) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "9f8158487dee76b3acc5e1b9df57c2f1", "score": "0.77054834", "text": "func (s okInt64) FoldInt32F(a func(error) int32, f func(int64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "d1c879dd7c61a38614366603543da722", "score": "0.770453", "text": "func (s okUintPtr) FoldInt32F(a func(error) int32, f func(uintptr) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "c54b10db5837f2e9c21fc0154055f58c", "score": "0.7695711", "text": "func (e errByte) FoldInt32(a int32, f func(v byte) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "71201878c7668fc9b543432ad8844ff0", "score": "0.7694019", "text": "func (e errByte) FoldInt32F(a func(error) int32, f func(byte) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "205fae3e7a884ed35400e49a35baee63", "score": "0.76927894", "text": "func (s okInt8) FoldInt32(a int32, f func(int8) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "d9955249fcfe393d144dfe9dae0469c8", "score": "0.767982", "text": "func (e errInt) FoldInt32(a int32, f func(v int) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "f1f7e582d4713bf2c62cda3a6e481da8", "score": "0.76773936", "text": "func (s okBool) FoldInt32F(a func(error) int32, f func(bool) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "50509cdef2423d2eedfa715b7bb126c6", "score": "0.76712656", "text": "func (e errInt16) FoldInt32F(a func(error) int32, f func(int16) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "519358dbdbb81b6e47dee02b004d768e", "score": "0.76577854", "text": "func (e errFloat32) FoldInt32(a int32, f func(v float32) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "75c20b6164fc70694ec59f241bb31ec2", "score": "0.7655497", "text": "func (s okInt32) FoldInt32(a int32, f func(int32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "0fd9431e4cfeabbe6ea260dac623fc17", "score": "0.7643708", "text": "func (s okFloat32) FoldInt32(a int32, f func(float32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "b66cc5c191e5b9727f40aae70712ccbe", "score": "0.76385355", "text": "func (s okComplex128) FoldInt32F(a func(error) int32, f func(complex128) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "3798a1f0d262b7589bb1814dc43e504c", "score": "0.76283795", "text": "func (e errBool) FoldInt32(a int32, f func(v bool) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "44d584b96dfce68e302aa2dfe74058e2", "score": "0.76210797", "text": "func (e errInt64) FoldInt32F(a func(error) int32, f func(int64) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "424373975dc776233c8f64a3f9142f76", "score": "0.7612044", "text": "func (e errInt) FoldInt32F(a func(error) int32, f func(int) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "b90dce13a3094bbde63b9aa43fea4640", "score": "0.76054734", "text": "func (e errInt32) FoldInt32F(a func(error) int32, f func(int32) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "bbaf27103ea1b8b8ce87bcb15cbbc388", "score": "0.7602939", "text": "func (s okInt64) FoldInt32(a int32, f func(int64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "4ade6013530d422cc4544b970dd51f0c", "score": "0.7595629", "text": "func (s okComplex64) FoldInt32F(a func(error) int32, f func(complex64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "dddc8e69927195f79e4b920fc79f43e1", "score": "0.7591632", "text": "func (s okFloat64) FoldInt32F(a func(error) int32, f func(float64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "8e618c398e04f74e962e266feb2034ba", "score": "0.7590873", "text": "func (e errInt8) FoldInt32F(a func(error) int32, f func(int8) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "d2937722039f0c08ef0ec99fdd5d08e9", "score": "0.75880253", "text": "func (s okFloat64) FoldInt32(a int32, f func(float64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "a6ee0baa481426b4a39daa5ecb68e2eb", "score": "0.7586844", "text": "func (s okBool) FoldInt32(a int32, f func(bool) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "a296700b8516a792dd6c3681039fa41f", "score": "0.75827533", "text": "func (e errBool) FoldInt32F(a func(error) int32, f func(bool) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "41fb98f9db67d847c76e7e315dcdfe09", "score": "0.75813985", "text": "func (e errUintPtr) FoldInt32F(a func(error) int32, f func(uintptr) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "75d67dfa3e390da764c3570a45f9e421", "score": "0.7576711", "text": "func (s okFloat32) FoldInt32F(a func(error) int32, f func(float32) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "906f237ec68fb4fed4836f382a972de6", "score": "0.7554919", "text": "func (s okUintPtr) FoldInt32(a int32, f func(uintptr) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "223a72545466ccaeeb2ea26d3132bb1a", "score": "0.75336295", "text": "func (e errFloat64) FoldInt32F(a func(error) int32, f func(float64) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "9953d759031440ae82c5bd754ba741c2", "score": "0.7532231", "text": "func (e errComplex128) FoldInt32F(a func(error) int32, f func(complex128) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "9ff543c7f7650ccb25c639ac9dce1fa1", "score": "0.7525845", "text": "func (e errComplex64) FoldInt32F(a func(error) int32, f func(complex64) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "5f55ae131b8a25aeeb0173f4bac0eafb", "score": "0.75123143", "text": "func (e errComplex64) FoldInt32(a int32, f func(v complex64) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "a3cca6fcd94d6adb6e1d125e94db078a", "score": "0.750577", "text": "func (e errComplex128) FoldInt32(a int32, f func(v complex128) int32) int32 {\n\treturn a\n}", "title": "" }, { "docid": "a6d60ad4cbae7a23e7eef45fd9da0465", "score": "0.74734026", "text": "func (s okComplex128) FoldInt32(a int32, f func(complex128) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "442d3bfefdcf8610d1e8d8d57df7969d", "score": "0.7457632", "text": "func (s okComplex64) FoldInt32(a int32, f func(complex64) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "d835f118d323a315765bb74d86e90384", "score": "0.74548525", "text": "func (s okUInt32) FoldIntF(a func(error) int, f func(uint32) int) int {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "613af559fed86c5b4370423d75afe86e", "score": "0.745396", "text": "func (e errFloat32) FoldInt32F(a func(error) int32, f func(float32) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "7cc8e45f12c7dfb566c6408171b285ae", "score": "0.74326813", "text": "func (s okInt) FoldFloat32(a float32, f func(int) float32) float32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "e080291f0b57f569bb52707e2258097a", "score": "0.73894125", "text": "func (s okRune) FoldInt32F(a func(error) int32, f func(rune) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "10f47fc20368482e3e75eb909704fc86", "score": "0.7388081", "text": "func (s okInt) FoldUInt32F(a func(error) uint32, f func(int) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "37e3fb89477b79f689b5c1427bc6c5ea", "score": "0.7383544", "text": "func (s okInt32) FoldIntF(a func(error) int, f func(int32) int) int {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "96051d4e8e828274e6b3a635cc643e6d", "score": "0.7341644", "text": "func (s okInt32) FoldUInt32F(a func(error) uint32, f func(int32) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "48a91d975568c5a84a00ad1e6043056b", "score": "0.7340356", "text": "func (e errUInt32) FoldInt(a int, f func(v uint32) int) int {\n\treturn a\n}", "title": "" }, { "docid": "82dbe8355596340ebc33f60fab43f8b0", "score": "0.7335203", "text": "func (s okInt8) FoldUInt32F(a func(error) uint32, f func(int8) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "d01bf87c78d62fe8882023f6fd0fbd37", "score": "0.7302", "text": "func (s okInt64) FoldUInt32F(a func(error) uint32, f func(int64) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "f3bd67547a699e0bce5c29ff2f1958a4", "score": "0.729763", "text": "func (e errUInt32) FoldIntF(a func(error) int, f func(uint32) int) int {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "a3313c05bf2cb068d04473195e457f72", "score": "0.7293811", "text": "func (s okUInt32) FoldInt(a int, f func(uint32) int) int {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "e635943e723b1b638a92881933fb42f6", "score": "0.7284969", "text": "func (e errInt32) FoldUInt32F(a func(error) uint32, f func(int32) uint32) uint32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "bbff28ef17fec648c3481d6d8172821f", "score": "0.7279099", "text": "func (e errInt64) FoldUInt32(a uint32, f func(v int64) uint32) uint32 {\n\treturn a\n}", "title": "" }, { "docid": "07ce2915b68a0a25e1745e78530c9352", "score": "0.727337", "text": "func (e errInt64) FoldUInt32F(a func(error) uint32, f func(int64) uint32) uint32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "596377c5b72fb96494935c4e3ab2edff", "score": "0.7261771", "text": "func (s okInt) FoldUInt32(a uint32, f func(int) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "52b6555c4883d243f6177a54d33d722f", "score": "0.72495466", "text": "func (s okUInt8) FoldUInt32F(a func(error) uint32, f func(uint8) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "7e5fa25b65014db97992d52f2cc00ce5", "score": "0.7249173", "text": "func (e errUInt64) FoldUInt32(a uint32, f func(v uint64) uint32) uint32 {\n\treturn a\n}", "title": "" }, { "docid": "df780fa42f70c5d5b3f82d60d8a5a052", "score": "0.7233118", "text": "func (e errRune) FoldInt32F(a func(error) int32, f func(rune) int32) int32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "3f0b33db09993a80538378c8e31d9359", "score": "0.7232804", "text": "func (s okInt8) FoldUInt32(a uint32, f func(int8) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "ab05823b3c4de2cce4288ce7ea9c6a2b", "score": "0.72275674", "text": "func (s okInt32) FoldUInt32(a uint32, f func(int32) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "72aa8af98bed1ddad88f6f645c105b11", "score": "0.7221179", "text": "func (e errInt8) FoldUInt32F(a func(error) uint32, f func(int8) uint32) uint32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "2bc30d7af2f341e1174a411d811a122a", "score": "0.7215726", "text": "func (e errInt32) FoldUInt32(a uint32, f func(v int32) uint32) uint32 {\n\treturn a\n}", "title": "" }, { "docid": "e196fb5b3165d1858076c1701503728a", "score": "0.7213695", "text": "func (e errUInt8) FoldUInt32(a uint32, f func(v uint8) uint32) uint32 {\n\treturn a\n}", "title": "" }, { "docid": "e5e0481f7bc0209373505d5d591ded8e", "score": "0.7212829", "text": "func (e errInt8) FoldUInt32(a uint32, f func(v int8) uint32) uint32 {\n\treturn a\n}", "title": "" }, { "docid": "7a429560b18588acd12e3a77ca1ff305", "score": "0.7208294", "text": "func (s okRune) FoldInt32(a int32, f func(rune) int32) int32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "fa37e4c50d939f1b1423fc19c9466802", "score": "0.72047126", "text": "func (s okInt16) FoldUInt32F(a func(error) uint32, f func(int16) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "7cc46c59b6171633d072826c988e8856", "score": "0.7204373", "text": "func (e errInt32) FoldInt(a int, f func(v int32) int) int {\n\treturn a\n}", "title": "" }, { "docid": "4dd2a3413c661e3b6cfa4fe54f85e9f8", "score": "0.7197833", "text": "func (s okUInt64) FoldUInt32F(a func(error) uint32, f func(uint64) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "02e562ea2f61f8249d95b8a6c42b6a27", "score": "0.71967286", "text": "func (s okInt64) FoldUInt32(a uint32, f func(int64) uint32) uint32 {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "65d8b190658eb0016be8989c06e3adaf", "score": "0.71957076", "text": "func (e errInt) FoldUInt32F(a func(error) uint32, f func(int) uint32) uint32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "c260a26a96968e50eff722832c49729a", "score": "0.71851695", "text": "func (s okInt32) FoldInt(a int, f func(int32) int) int {\n\treturn f(s.right)\n}", "title": "" }, { "docid": "f382c9d7c4cf9d1daf159da325b1c562", "score": "0.7180719", "text": "func (e errInt16) FoldUInt32F(a func(error) uint32, f func(int16) uint32) uint32 {\n\treturn a(e.left)\n}", "title": "" }, { "docid": "820f9b30ef2b8759ff0a4f1459872cb2", "score": "0.71777487", "text": "func (s okInt32) FoldFloat32(a float32, f func(int32) float32) float32 {\n\treturn f(s.right)\n}", "title": "" } ]
39fa3b67770ed5f00e3e2f4061146d6e
MarshalFields encodes the AWS API shape using the passed in protocol encoder.
[ { "docid": "fb07060330d162e05b06ececf9b32457", "score": "0.0", "text": "func (s ListSpeechSynthesisTasksInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.MaxResults != nil {\n\t\tv := *s.MaxResults\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"MaxResults\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"NextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"Status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "cf0bbd4e5d7530613da98393ba992f2d", "score": "0.6273693", "text": "func (s Input) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AttachedChannels != nil {\n\t\tv := s.AttachedChannels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"attachedChannels\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Destinations != nil {\n\t\tv := s.Destinations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"destinations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.InputClass) > 0 {\n\t\tv := s.InputClass\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"inputClass\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.InputDevices != nil {\n\t\tv := s.InputDevices\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"inputDevices\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.InputSourceType) > 0 {\n\t\tv := s.InputSourceType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"inputSourceType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.MediaConnectFlows != nil {\n\t\tv := s.MediaConnectFlows\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"mediaConnectFlows\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecurityGroups != nil {\n\t\tv := s.SecurityGroups\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"securityGroups\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Sources != nil {\n\t\tv := s.Sources\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"sources\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ca67229a03096738ef46bc179bfe84c", "score": "0.61802745", "text": "func (s UpdateEncryption) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Algorithm) > 0 {\n\t\tv := s.Algorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"algorithm\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ConstantInitializationVector != nil {\n\t\tv := *s.ConstantInitializationVector\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"constantInitializationVector\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.KeyType) > 0 {\n\t\tv := s.KeyType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"keyType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecretArn != nil {\n\t\tv := *s.SecretArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"secretArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Url != nil {\n\t\tv := *s.Url\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"url\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37c796545217e3040dbe57f5d02cf737", "score": "0.61282897", "text": "func (s Encryption) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Algorithm) > 0 {\n\t\tv := s.Algorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"algorithm\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ConstantInitializationVector != nil {\n\t\tv := *s.ConstantInitializationVector\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"constantInitializationVector\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeviceId != nil {\n\t\tv := *s.DeviceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.KeyType) > 0 {\n\t\tv := s.KeyType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"keyType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Region != nil {\n\t\tv := *s.Region\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"region\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecretArn != nil {\n\t\tv := *s.SecretArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"secretArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Url != nil {\n\t\tv := *s.Url\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"url\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ca752d7e6986082d0d605d6c095fa98", "score": "0.61249685", "text": "func (s GetDataEndpointInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif len(s.APIName) > 0 {\n\t\tv := s.APIName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"APIName\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StreamARN != nil {\n\t\tv := *s.StreamARN\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamARN\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StreamName != nil {\n\t\tv := *s.StreamName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c1152aaa8b78f397ec02938f3b59d04", "score": "0.60893106", "text": "func (s PutSlotTypeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Checksum != nil {\n\t\tv := *s.Checksum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"checksum\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreateVersion != nil {\n\t\tv := *s.CreateVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createVersion\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnumerationValues != nil {\n\t\tv := s.EnumerationValues\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"enumerationValues\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.ParentSlotTypeSignature != nil {\n\t\tv := *s.ParentSlotTypeSignature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentSlotTypeSignature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SlotTypeConfigurations != nil {\n\t\tv := s.SlotTypeConfigurations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"slotTypeConfigurations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.ValueSelectionStrategy) > 0 {\n\t\tv := s.ValueSelectionStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"valueSelectionStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d6e11653ac147d16485a6731e5466ff", "score": "0.6083665", "text": "func (s CreateNetworkInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientRequestToken string\n\tif s.ClientRequestToken != nil {\n\t\tClientRequestToken = *s.ClientRequestToken\n\t} else {\n\t\tClientRequestToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientRequestToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ClientRequestToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Framework) > 0 {\n\t\tv := s.Framework\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Framework\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.FrameworkConfiguration != nil {\n\t\tv := s.FrameworkConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"FrameworkConfiguration\", v, metadata)\n\t}\n\tif s.FrameworkVersion != nil {\n\t\tv := *s.FrameworkVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FrameworkVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MemberConfiguration != nil {\n\t\tv := s.MemberConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"MemberConfiguration\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VotingPolicy != nil {\n\t\tv := s.VotingPolicy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VotingPolicy\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eac65aebe98b87a0f22ab19f790eb3be", "score": "0.60361314", "text": "func (s PutSlotTypeOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Checksum != nil {\n\t\tv := *s.Checksum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"checksum\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreateVersion != nil {\n\t\tv := *s.CreateVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createVersion\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnumerationValues != nil {\n\t\tv := s.EnumerationValues\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"enumerationValues\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ParentSlotTypeSignature != nil {\n\t\tv := *s.ParentSlotTypeSignature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentSlotTypeSignature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SlotTypeConfigurations != nil {\n\t\tv := s.SlotTypeConfigurations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"slotTypeConfigurations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.ValueSelectionStrategy) > 0 {\n\t\tv := s.ValueSelectionStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"valueSelectionStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b8738ac1386f287f88a99594e0ed060", "score": "0.5989671", "text": "func (s CreateChannelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4769996bd984b752dcd8e3adee6491b", "score": "0.5980652", "text": "func (s StartSchemaCreationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Definition != nil {\n\t\tv := s.Definition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"definition\", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d17b7b121a246c6e397b882060e0509", "score": "0.5977247", "text": "func (s UpdatePlacementInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Attributes != nil {\n\t\tv := s.Attributes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"attributes\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.PlacementName != nil {\n\t\tv := *s.PlacementName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"placementName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectName != nil {\n\t\tv := *s.ProjectName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"projectName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "015f5f400abf212ba4b89814d297cf75", "score": "0.59523964", "text": "func (s UpdateThingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.AttributePayload != nil {\n\t\tv := s.AttributePayload\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"attributePayload\", v, metadata)\n\t}\n\tif s.ExpectedVersion != nil {\n\t\tv := *s.ExpectedVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"expectedVersion\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.RemoveThingType != nil {\n\t\tv := *s.RemoveThingType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"removeThingType\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ThingTypeName != nil {\n\t\tv := *s.ThingTypeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"thingTypeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThingName != nil {\n\t\tv := *s.ThingName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"thingName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b06a7ca4e922342df7a054cf4ed36ce", "score": "0.59391063", "text": "func (s CreateImageRecipeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.BlockDeviceMappings != nil {\n\t\tv := s.BlockDeviceMappings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"blockDeviceMappings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Components != nil {\n\t\tv := s.Components\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"components\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ParentImage != nil {\n\t\tv := *s.ParentImage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentImage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SemanticVersion != nil {\n\t\tv := *s.SemanticVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"semanticVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.WorkingDirectory != nil {\n\t\tv := *s.WorkingDirectory\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"workingDirectory\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1503317eea3ed42f342485925974cef4", "score": "0.5926898", "text": "func (s InputSpecification) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Codec) > 0 {\n\t\tv := s.Codec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"codec\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.MaximumBitrate) > 0 {\n\t\tv := s.MaximumBitrate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maximumBitrate\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.Resolution) > 0 {\n\t\tv := s.Resolution\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resolution\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "723b2e7ac425b7a1b6318a37c75bd440", "score": "0.58844393", "text": "func (s UpdateRouteInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.AuthorizationScopes != nil {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestModels != nil {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RequestParameters != nil {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f59a25ba0a4d54763795ba902450ebc2", "score": "0.58779365", "text": "func (s UploadPartInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.ContentLength != nil {\n\t\tv := *s.ContentLength\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-Length\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ContentMD5 != nil {\n\t\tv := *s.ContentMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestPayer) > 0 {\n\t\tv := s.RequestPayer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-payer\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKey != nil {\n\t\tv := *s.SSECustomerKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Body != nil {\n\t\tv := s.Body\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetStream(protocol.PayloadTarget, \"Body\", protocol.ReadSeekerStream{V: v}, metadata)\n\t}\n\tif s.PartNumber != nil {\n\t\tv := *s.PartNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"partNumber\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.UploadId != nil {\n\t\tv := *s.UploadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"uploadId\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aba93e116675924507fb71ffb2da797e", "score": "0.58603334", "text": "func (s UpdateRouteOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiGatewayManaged != nil {\n\t\tv := *s.ApiGatewayManaged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiGatewayManaged\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.AuthorizationScopes != nil {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestModels != nil {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RequestParameters != nil {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "097201e73e3b5d4be2b60a020906fd45", "score": "0.58582294", "text": "func (s Multiplex) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AvailabilityZones != nil {\n\t\tv := s.AvailabilityZones\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"availabilityZones\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Destinations != nil {\n\t\tv := s.Destinations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"destinations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MultiplexSettings != nil {\n\t\tv := s.MultiplexSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"multiplexSettings\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PipelinesRunningCount != nil {\n\t\tv := *s.PipelinesRunningCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pipelinesRunningCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ProgramCount != nil {\n\t\tv := *s.ProgramCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"programCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fdb42d7e24709313f661691d88e4af5", "score": "0.5824575", "text": "func (s CreateChannelOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.HlsIngest != nil {\n\t\tv := s.HlsIngest\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"hlsIngest\", v, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd9ac07dca94535ec42bec3229afe75e", "score": "0.58160573", "text": "func (s Channel) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ChannelClass) > 0 {\n\t\tv := s.ChannelClass\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"channelClass\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Destinations != nil {\n\t\tv := s.Destinations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"destinations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.EgressEndpoints != nil {\n\t\tv := s.EgressEndpoints\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"egressEndpoints\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.EncoderSettings != nil {\n\t\tv := s.EncoderSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"encoderSettings\", v, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InputAttachments != nil {\n\t\tv := s.InputAttachments\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"inputAttachments\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.InputSpecification != nil {\n\t\tv := s.InputSpecification\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"inputSpecification\", v, metadata)\n\t}\n\tif len(s.LogLevel) > 0 {\n\t\tv := s.LogLevel\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"logLevel\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PipelineDetails != nil {\n\t\tv := s.PipelineDetails\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"pipelineDetails\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.PipelinesRunningCount != nil {\n\t\tv := *s.PipelinesRunningCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pipelinesRunningCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f538234740827bdec2249cede66f9211", "score": "0.5796869", "text": "func (s SubscribeInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ClientRequestToken != nil {\n\t\tv := *s.ClientRequestToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ClientRequestToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Target\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40da9b6b6c18f762428a61955130f065", "score": "0.57890576", "text": "func (s RegisterThingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Parameters != nil {\n\t\tv := s.Parameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"parameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateBody != nil {\n\t\tv := *s.TemplateBody\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateBody\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c7650d4479ca1ece1834b3cbe2ecf67", "score": "0.5775528", "text": "func (s VpcInterface) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.NetworkInterfaceIds != nil {\n\t\tv := s.NetworkInterfaceIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"networkInterfaceIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecurityGroupIds != nil {\n\t\tv := s.SecurityGroupIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"securityGroupIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.SubnetId != nil {\n\t\tv := *s.SubnetId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"subnetId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d4a8eb7692c35f9ac9c5aa7304e7b0a", "score": "0.57572657", "text": "func (s InputSecurityGroup) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Inputs != nil {\n\t\tv := s.Inputs\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"inputs\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.WhitelistRules != nil {\n\t\tv := s.WhitelistRules\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"whitelistRules\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "828aaed1c983ec665049f4352b06d325", "score": "0.57569444", "text": "func (s BatchGetStreamKeyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Arns != nil {\n\t\tv := s.Arns\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"arns\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68c9428ffa017f25337ddcba379b7ccb", "score": "0.5753343", "text": "func (s SynthesizeSpeechInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif len(s.Engine) > 0 {\n\t\tv := s.Engine\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Engine\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.LanguageCode) > 0 {\n\t\tv := s.LanguageCode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LanguageCode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.LexiconNames != nil {\n\t\tv := s.LexiconNames\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"LexiconNames\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.OutputFormat) > 0 {\n\t\tv := s.OutputFormat\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"OutputFormat\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.SampleRate != nil {\n\t\tv := *s.SampleRate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SampleRate\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SpeechMarkTypes != nil {\n\t\tv := s.SpeechMarkTypes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"SpeechMarkTypes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Text != nil {\n\t\tv := *s.Text\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Text\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.TextType) > 0 {\n\t\tv := s.TextType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"TextType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.VoiceId) > 0 {\n\t\tv := s.VoiceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"VoiceId\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84e60453156481e696603319be800d19", "score": "0.57522494", "text": "func (s GetRepositoryEndpointInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Domain != nil {\n\t\tv := *s.Domain\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"domain\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainOwner != nil {\n\t\tv := *s.DomainOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"domain-owner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Format) > 0 {\n\t\tv := s.Format\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"format\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Repository != nil {\n\t\tv := *s.Repository\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"repository\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d6335829757d492deae7235c1a2c9c0", "score": "0.5740858", "text": "func (s UpdateApiMappingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingId != nil {\n\t\tv := *s.ApiMappingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiMappingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainName != nil {\n\t\tv := *s.DomainName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"domainName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d420d3737002472aae2885e1d03aab2", "score": "0.573484", "text": "func (s PutIntentInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Checksum != nil {\n\t\tv := *s.Checksum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"checksum\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ConclusionStatement != nil {\n\t\tv := s.ConclusionStatement\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"conclusionStatement\", v, metadata)\n\t}\n\tif s.ConfirmationPrompt != nil {\n\t\tv := s.ConfirmationPrompt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"confirmationPrompt\", v, metadata)\n\t}\n\tif s.CreateVersion != nil {\n\t\tv := *s.CreateVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createVersion\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DialogCodeHook != nil {\n\t\tv := s.DialogCodeHook\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"dialogCodeHook\", v, metadata)\n\t}\n\tif s.FollowUpPrompt != nil {\n\t\tv := s.FollowUpPrompt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"followUpPrompt\", v, metadata)\n\t}\n\tif s.FulfillmentActivity != nil {\n\t\tv := s.FulfillmentActivity\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"fulfillmentActivity\", v, metadata)\n\t}\n\tif s.KendraConfiguration != nil {\n\t\tv := s.KendraConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"kendraConfiguration\", v, metadata)\n\t}\n\tif s.ParentIntentSignature != nil {\n\t\tv := *s.ParentIntentSignature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentIntentSignature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RejectionStatement != nil {\n\t\tv := s.RejectionStatement\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"rejectionStatement\", v, metadata)\n\t}\n\tif s.SampleUtterances != nil {\n\t\tv := s.SampleUtterances\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"sampleUtterances\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Slots != nil {\n\t\tv := s.Slots\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"slots\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f96296ad786d4073fd5ec454c4722724", "score": "0.572809", "text": "func (s VpcInterfaceRequest) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecurityGroupIds != nil {\n\t\tv := s.SecurityGroupIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"securityGroupIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.SubnetId != nil {\n\t\tv := *s.SubnetId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"subnetId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86bafc4cd17cdd03ae6f7d4fa56a7a89", "score": "0.5716568", "text": "func (s Flow) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AvailabilityZone != nil {\n\t\tv := *s.AvailabilityZone\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"availabilityZone\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EgressIp != nil {\n\t\tv := *s.EgressIp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"egressIp\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Entitlements != nil {\n\t\tv := s.Entitlements\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"entitlements\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.FlowArn != nil {\n\t\tv := *s.FlowArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"flowArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Outputs != nil {\n\t\tv := s.Outputs\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"outputs\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Source != nil {\n\t\tv := s.Source\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"source\", v, metadata)\n\t}\n\tif s.SourceFailoverConfig != nil {\n\t\tv := s.SourceFailoverConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"sourceFailoverConfig\", v, metadata)\n\t}\n\tif s.Sources != nil {\n\t\tv := s.Sources\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"sources\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.VpcInterfaces != nil {\n\t\tv := s.VpcInterfaces\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"vpcInterfaces\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45a4a445d4444adb2aa91c2a6c6cd022", "score": "0.571288", "text": "func (s UpdateUsageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PatchOperations != nil {\n\t\tv := s.PatchOperations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"patchOperations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.KeyId != nil {\n\t\tv := *s.KeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"keyId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.UsagePlanId != nil {\n\t\tv := *s.UsagePlanId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"usageplanId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b28a888c2eb22f59208aee8c7749c9dc", "score": "0.57065743", "text": "func (s CreateConfigurationSetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ConfigurationSetName != nil {\n\t\tv := *s.ConfigurationSetName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ConfigurationSetName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DeliveryOptions != nil {\n\t\tv := s.DeliveryOptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"DeliveryOptions\", v, metadata)\n\t}\n\tif s.ReputationOptions != nil {\n\t\tv := s.ReputationOptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"ReputationOptions\", v, metadata)\n\t}\n\tif s.SendingOptions != nil {\n\t\tv := s.SendingOptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SendingOptions\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.TrackingOptions != nil {\n\t\tv := s.TrackingOptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"TrackingOptions\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70ec6368a47ba7eefd845acda6196f9d", "score": "0.5697117", "text": "func (s SigningImageFormat) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.DefaultFormat) > 0 {\n\t\tv := s.DefaultFormat\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"defaultFormat\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.SupportedFormats != nil {\n\t\tv := s.SupportedFormats\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"supportedFormats\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3e94bc7b0827fffc97ba633b7f10b237", "score": "0.56891423", "text": "func (s UpgradeAppliedSchemaInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DirectoryArn != nil {\n\t\tv := *s.DirectoryArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DirectoryArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DryRun != nil {\n\t\tv := *s.DryRun\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DryRun\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.PublishedSchemaArn != nil {\n\t\tv := *s.PublishedSchemaArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PublishedSchemaArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "49d500d5f541106717e2ef962e91d98f", "score": "0.56865346", "text": "func (s UpdateMultiplexInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.MultiplexSettings != nil {\n\t\tv := s.MultiplexSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"multiplexSettings\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MultiplexId != nil {\n\t\tv := *s.MultiplexId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"multiplexId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e019f2483d2c5de321c7b9959aa8b8db", "score": "0.5685609", "text": "func (s UpdateDimensionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.StringValues != nil {\n\t\tv := s.StringValues\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"stringValues\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79138536419bc9c57f42e0ab8c73ad1b", "score": "0.56797254", "text": "func (s PutIntentOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Checksum != nil {\n\t\tv := *s.Checksum\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"checksum\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ConclusionStatement != nil {\n\t\tv := s.ConclusionStatement\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"conclusionStatement\", v, metadata)\n\t}\n\tif s.ConfirmationPrompt != nil {\n\t\tv := s.ConfirmationPrompt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"confirmationPrompt\", v, metadata)\n\t}\n\tif s.CreateVersion != nil {\n\t\tv := *s.CreateVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createVersion\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DialogCodeHook != nil {\n\t\tv := s.DialogCodeHook\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"dialogCodeHook\", v, metadata)\n\t}\n\tif s.FollowUpPrompt != nil {\n\t\tv := s.FollowUpPrompt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"followUpPrompt\", v, metadata)\n\t}\n\tif s.FulfillmentActivity != nil {\n\t\tv := s.FulfillmentActivity\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"fulfillmentActivity\", v, metadata)\n\t}\n\tif s.KendraConfiguration != nil {\n\t\tv := s.KendraConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"kendraConfiguration\", v, metadata)\n\t}\n\tif s.LastUpdatedDate != nil {\n\t\tv := *s.LastUpdatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ParentIntentSignature != nil {\n\t\tv := *s.ParentIntentSignature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"parentIntentSignature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RejectionStatement != nil {\n\t\tv := s.RejectionStatement\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"rejectionStatement\", v, metadata)\n\t}\n\tif s.SampleUtterances != nil {\n\t\tv := s.SampleUtterances\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"sampleUtterances\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Slots != nil {\n\t\tv := s.Slots\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"slots\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1c12cdcd041f1ae1f23b7b1f581cc22", "score": "0.56791675", "text": "func (s Output) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.DataTransferSubscriberFeePercent != nil {\n\t\tv := *s.DataTransferSubscriberFeePercent\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"dataTransferSubscriberFeePercent\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Destination != nil {\n\t\tv := *s.Destination\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"destination\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Encryption != nil {\n\t\tv := s.Encryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"encryption\", v, metadata)\n\t}\n\tif s.EntitlementArn != nil {\n\t\tv := *s.EntitlementArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"entitlementArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MediaLiveInputArn != nil {\n\t\tv := *s.MediaLiveInputArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"mediaLiveInputArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OutputArn != nil {\n\t\tv := *s.OutputArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"outputArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Port != nil {\n\t\tv := *s.Port\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"port\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Transport != nil {\n\t\tv := s.Transport\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"transport\", v, metadata)\n\t}\n\tif s.VpcInterfaceAttachment != nil {\n\t\tv := s.VpcInterfaceAttachment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"vpcInterfaceAttachment\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f995d19e75a269f8fdbb0540ca7f38b", "score": "0.5673152", "text": "func (s RegisterDeviceInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif len(s.Platform) > 0 {\n\t\tv := s.Platform\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Platform\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Token != nil {\n\t\tv := *s.Token\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Token\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IdentityId != nil {\n\t\tv := *s.IdentityId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"IdentityId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IdentityPoolId != nil {\n\t\tv := *s.IdentityPoolId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"IdentityPoolId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59b5f8001bb5e02a46ac69696188a92c", "score": "0.5672546", "text": "func (s CreateDatastoreInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DatastoreName != nil {\n\t\tv := *s.DatastoreName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"datastoreName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DatastoreStorage != nil {\n\t\tv := s.DatastoreStorage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"datastoreStorage\", v, metadata)\n\t}\n\tif s.RetentionPeriod != nil {\n\t\tv := s.RetentionPeriod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"retentionPeriod\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f344de78f913ad1baac82eea129aa62", "score": "0.56709206", "text": "func (s AddOutputRequest) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CidrAllowList != nil {\n\t\tv := s.CidrAllowList\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"cidrAllowList\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Destination != nil {\n\t\tv := *s.Destination\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"destination\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Encryption != nil {\n\t\tv := s.Encryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"encryption\", v, metadata)\n\t}\n\tif s.MaxLatency != nil {\n\t\tv := *s.MaxLatency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxLatency\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Port != nil {\n\t\tv := *s.Port\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"port\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.Protocol) > 0 {\n\t\tv := s.Protocol\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocol\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RemoteId != nil {\n\t\tv := *s.RemoteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"remoteId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SmoothingLatency != nil {\n\t\tv := *s.SmoothingLatency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"smoothingLatency\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.StreamId != nil {\n\t\tv := *s.StreamId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"streamId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VpcInterfaceAttachment != nil {\n\t\tv := s.VpcInterfaceAttachment\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"vpcInterfaceAttachment\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b12781a7bf0b3d0b8f32e8cf93df5c0", "score": "0.5655035", "text": "func (s CreateCommentInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.NotifyCollaborators != nil {\n\t\tv := *s.NotifyCollaborators\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NotifyCollaborators\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ParentId != nil {\n\t\tv := *s.ParentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ParentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Text != nil {\n\t\tv := *s.Text\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Text\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThreadId != nil {\n\t\tv := *s.ThreadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ThreadId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Visibility) > 0 {\n\t\tv := s.Visibility\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Visibility\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DocumentId != nil {\n\t\tv := *s.DocumentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"DocumentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VersionId != nil {\n\t\tv := *s.VersionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"VersionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "641637d8feabd052a2aa53b60ac334b8", "score": "0.56549996", "text": "func (s UpdateApiMappingOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingId != nil {\n\t\tv := *s.ApiMappingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "35f1eabad1528369d60a5d4f182881bc", "score": "0.56540513", "text": "func (s ClusterOperationInfo) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ClientRequestId != nil {\n\t\tv := *s.ClientRequestId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientRequestId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ClusterArn != nil {\n\t\tv := *s.ClusterArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clusterArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreationTime != nil {\n\t\tv := *s.CreationTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"creationTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.EndTime != nil {\n\t\tv := *s.EndTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"endTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.ErrorInfo != nil {\n\t\tv := s.ErrorInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"errorInfo\", v, metadata)\n\t}\n\tif s.OperationArn != nil {\n\t\tv := *s.OperationArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationState != nil {\n\t\tv := *s.OperationState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationState\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationType != nil {\n\t\tv := *s.OperationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SourceClusterInfo != nil {\n\t\tv := s.SourceClusterInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"sourceClusterInfo\", v, metadata)\n\t}\n\tif s.TargetClusterInfo != nil {\n\t\tv := s.TargetClusterInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"targetClusterInfo\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bb75b14050b6ae649f893b968cb6d316", "score": "0.5652776", "text": "func (s GetVoiceConnectorInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.VoiceConnectorId != nil {\n\t\tv := *s.VoiceConnectorId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"voiceConnectorId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78b924b3fd275096c2b744b6ea98d461", "score": "0.564734", "text": "func (s UpdateDimensionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreationDate != nil {\n\t\tv := *s.CreationDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"creationDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastModifiedDate != nil {\n\t\tv := *s.LastModifiedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastModifiedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StringValues != nil {\n\t\tv := s.StringValues\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"stringValues\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "22866ad30653b45b617c82e8d32ddbb9", "score": "0.56472975", "text": "func (s MultiplexSummary) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AvailabilityZones != nil {\n\t\tv := s.AvailabilityZones\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"availabilityZones\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MultiplexSettings != nil {\n\t\tv := s.MultiplexSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"multiplexSettings\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PipelinesRunningCount != nil {\n\t\tv := *s.PipelinesRunningCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pipelinesRunningCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ProgramCount != nil {\n\t\tv := *s.ProgramCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"programCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27973c2e866a4bb7a5eed8fa6be4e3fa", "score": "0.5647288", "text": "func (s ChannelSummary) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ChannelClass) > 0 {\n\t\tv := s.ChannelClass\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"channelClass\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Destinations != nil {\n\t\tv := s.Destinations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"destinations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.EgressEndpoints != nil {\n\t\tv := s.EgressEndpoints\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"egressEndpoints\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InputAttachments != nil {\n\t\tv := s.InputAttachments\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"inputAttachments\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.InputSpecification != nil {\n\t\tv := s.InputSpecification\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"inputSpecification\", v, metadata)\n\t}\n\tif len(s.LogLevel) > 0 {\n\t\tv := s.LogLevel\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"logLevel\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PipelinesRunningCount != nil {\n\t\tv := *s.PipelinesRunningCount\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pipelinesRunningCount\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"state\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "89606888167a0ea5fb62baa003ebf757", "score": "0.5645803", "text": "func (s PutVoiceConnectorStreamingConfigurationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.StreamingConfiguration != nil {\n\t\tv := s.StreamingConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"StreamingConfiguration\", v, metadata)\n\t}\n\tif s.VoiceConnectorId != nil {\n\t\tv := *s.VoiceConnectorId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"voiceConnectorId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "197def985bb8f425f4d7381058d60bb0", "score": "0.56438106", "text": "func (s VideoDescription) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CodecSettings != nil {\n\t\tv := s.CodecSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"codecSettings\", v, metadata)\n\t}\n\tif s.Height != nil {\n\t\tv := *s.Height\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"height\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RespondToAfd) > 0 {\n\t\tv := s.RespondToAfd\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"respondToAfd\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ScalingBehavior) > 0 {\n\t\tv := s.ScalingBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"scalingBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Sharpness != nil {\n\t\tv := *s.Sharpness\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"sharpness\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Width != nil {\n\t\tv := *s.Width\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"width\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0be4990691bea8a869676f4f4d46043c", "score": "0.5640605", "text": "func (s SynthesizeSpeechOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestCharacters != nil {\n\t\tv := *s.RequestCharacters\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amzn-RequestCharacters\", protocol.Int64Value(v), metadata)\n\t}\n\t// Skipping AudioStream Output type's body not valid.\n\treturn nil\n}", "title": "" }, { "docid": "51178a1c9b6305e35ff016293223897d", "score": "0.56340075", "text": "func (s PutBucketEncryptionInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ServerSideEncryptionConfiguration != nil {\n\t\tv := s.ServerSideEncryptionConfiguration\n\n\t\tmetadata := protocol.Metadata{XMLNamespaceURI: \"http://s3.amazonaws.com/doc/2006-03-01/\"}\n\t\te.SetFields(protocol.PayloadTarget, \"ServerSideEncryptionConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "706ccf2d158b9c6bf38ca4f294171ca5", "score": "0.5633462", "text": "func (s CreateMultipartUploadOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Key != nil {\n\t\tv := *s.Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Key\", protocol.StringValue(v), metadata)\n\t}\n\tif s.UploadId != nil {\n\t\tv := *s.UploadId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"UploadId\", protocol.StringValue(v), metadata)\n\t}\n\tif s.AbortDate != nil {\n\t\tv := *s.AbortDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-abort-date\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.RFC822TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.AbortRuleId != nil {\n\t\tv := *s.AbortRuleId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-abort-rule-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestCharged) > 0 {\n\t\tv := s.RequestCharged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-charged\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSEKMSEncryptionContext != nil {\n\t\tv := *s.SSEKMSEncryptionContext\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-context\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSEKMSKeyId != nil {\n\t\tv := *s.SSEKMSKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-aws-kms-key-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.ServerSideEncryption) > 0 {\n\t\tv := s.ServerSideEncryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ae721974f8fd28fc7282ddae6a07721", "score": "0.56291497", "text": "func (s UpdateUserInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.GivenName != nil {\n\t\tv := *s.GivenName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GivenName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.GrantPoweruserPrivileges) > 0 {\n\t\tv := s.GrantPoweruserPrivileges\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GrantPoweruserPrivileges\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.Locale) > 0 {\n\t\tv := s.Locale\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Locale\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StorageRule != nil {\n\t\tv := s.StorageRule\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"StorageRule\", v, metadata)\n\t}\n\tif s.Surname != nil {\n\t\tv := *s.Surname\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Surname\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeZoneId != nil {\n\t\tv := *s.TimeZoneId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"TimeZoneId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.UserId != nil {\n\t\tv := *s.UserId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"UserId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c537ccadc7ad0a5662c9d8729dfb5dd8", "score": "0.5626131", "text": "func (s UpdateParam) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Value != nil {\n\t\tv := *s.Value\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"value\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abb32a46da448f1f4b5c4c638d796094", "score": "0.5615765", "text": "func (s CreateGroupInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceQuery != nil {\n\t\tv := s.ResourceQuery\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"ResourceQuery\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"Tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb8c4baf8302c44be27b044a9848d6f7", "score": "0.5609891", "text": "func (s UploadPartOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ETag != nil {\n\t\tv := *s.ETag\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"ETag\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.RequestCharged) > 0 {\n\t\tv := s.RequestCharged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-request-charged\", v, metadata)\n\t}\n\tif s.SSECustomerAlgorithm != nil {\n\t\tv := *s.SSECustomerAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-algorithm\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSECustomerKeyMD5 != nil {\n\t\tv := *s.SSECustomerKeyMD5\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-customer-key-MD5\", protocol.StringValue(v), metadata)\n\t}\n\tif s.SSEKMSKeyId != nil {\n\t\tv := *s.SSEKMSKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption-aws-kms-key-id\", protocol.StringValue(v), metadata)\n\t}\n\tif len(s.ServerSideEncryption) > 0 {\n\t\tv := s.ServerSideEncryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-server-side-encryption\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17af4a460d7427470e90ca87ff7575b6", "score": "0.5606837", "text": "func (s StartOutboundVoiceContactInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif len(s.Attributes) > 0 {\n\t\tv := s.Attributes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"Attributes\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ClientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ContactFlowId != nil {\n\t\tv := *s.ContactFlowId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ContactFlowId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DestinationPhoneNumber != nil {\n\t\tv := *s.DestinationPhoneNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DestinationPhoneNumber\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InstanceId != nil {\n\t\tv := *s.InstanceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"InstanceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.QueueId != nil {\n\t\tv := *s.QueueId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"QueueId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SourcePhoneNumber != nil {\n\t\tv := *s.SourcePhoneNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SourcePhoneNumber\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0353b27c448557a29aa3b970f2c69640", "score": "0.5606062", "text": "func (s UpdateCoreDefinitionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CoreDefinitionId != nil {\n\t\tv := *s.CoreDefinitionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"CoreDefinitionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98922ce60761b50d6fc6c445df69af4e", "score": "0.56040657", "text": "func (s BatchGetChannelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Arns != nil {\n\t\tv := s.Arns\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"arns\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fa26610f93784dbae2c63064b6be1a4", "score": "0.5597571", "text": "func (s DescribeEndpointsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.MaxResults != nil {\n\t\tv := *s.MaxResults\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxResults\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.Mode) > 0 {\n\t\tv := s.Mode\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"mode\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"nextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9354993a358f7bd4eaf3836b8c951edc", "score": "0.5596719", "text": "func (s UpdateDynamicThingGroupInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ExpectedVersion != nil {\n\t\tv := *s.ExpectedVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"expectedVersion\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.IndexName != nil {\n\t\tv := *s.IndexName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"indexName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.QueryString != nil {\n\t\tv := *s.QueryString\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"queryString\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.QueryVersion != nil {\n\t\tv := *s.QueryVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"queryVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThingGroupProperties != nil {\n\t\tv := s.ThingGroupProperties\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"thingGroupProperties\", v, metadata)\n\t}\n\tif s.ThingGroupName != nil {\n\t\tv := *s.ThingGroupName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"thingGroupName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d1a4754014ee7409d2bf6d9d4c9597e", "score": "0.5591312", "text": "func (s CreateLabelsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif len(s.Labels) > 0 {\n\t\tv := s.Labels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Labels\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ResourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79e0d6108d87f5031e3ba8edb1da38f9", "score": "0.5579636", "text": "func (s UpdateThingOutput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "6856b9524a9f8fd003a80b78297c7cec", "score": "0.5577738", "text": "func (s GetPlaybackConfigurationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "15ffa68cef943bb2886aec7fdaed7f49", "score": "0.5576509", "text": "func (s UpdateDatastoreInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DatastoreStorage != nil {\n\t\tv := s.DatastoreStorage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"datastoreStorage\", v, metadata)\n\t}\n\tif s.RetentionPeriod != nil {\n\t\tv := s.RetentionPeriod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"retentionPeriod\", v, metadata)\n\t}\n\tif s.DatastoreName != nil {\n\t\tv := *s.DatastoreName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"datastoreName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbc20730374ddfe64f2f3267636fb47a", "score": "0.5573564", "text": "func (s CreateUserInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.EmailAddress != nil {\n\t\tv := *s.EmailAddress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"EmailAddress\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.GivenName != nil {\n\t\tv := *s.GivenName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GivenName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OrganizationId != nil {\n\t\tv := *s.OrganizationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"OrganizationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Password != nil {\n\t\tv := *s.Password\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Password\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StorageRule != nil {\n\t\tv := s.StorageRule\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"StorageRule\", v, metadata)\n\t}\n\tif s.Surname != nil {\n\t\tv := *s.Surname\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Surname\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeZoneId != nil {\n\t\tv := *s.TimeZoneId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"TimeZoneId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Username != nil {\n\t\tv := *s.Username\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Username\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8adbeee7025d89ecc2eb60ca8edf3cb9", "score": "0.55715185", "text": "func (s PutLexiconInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Content != nil {\n\t\tv := *s.Content\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Content\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"LexiconName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "185b7a890b24af37334adfee94a87020", "score": "0.5567862", "text": "func (s InputLocation) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.PasswordParam != nil {\n\t\tv := *s.PasswordParam\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passwordParam\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Uri != nil {\n\t\tv := *s.Uri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"uri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Username != nil {\n\t\tv := *s.Username\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"username\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0cefcd009c25951b034ce4a7586b4f40", "score": "0.5564727", "text": "func (s EncoderSettings) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AudioDescriptions != nil {\n\t\tv := s.AudioDescriptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"audioDescriptions\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.AvailBlanking != nil {\n\t\tv := s.AvailBlanking\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"availBlanking\", v, metadata)\n\t}\n\tif s.AvailConfiguration != nil {\n\t\tv := s.AvailConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"availConfiguration\", v, metadata)\n\t}\n\tif s.BlackoutSlate != nil {\n\t\tv := s.BlackoutSlate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"blackoutSlate\", v, metadata)\n\t}\n\tif s.CaptionDescriptions != nil {\n\t\tv := s.CaptionDescriptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"captionDescriptions\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.FeatureActivations != nil {\n\t\tv := s.FeatureActivations\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"featureActivations\", v, metadata)\n\t}\n\tif s.GlobalConfiguration != nil {\n\t\tv := s.GlobalConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"globalConfiguration\", v, metadata)\n\t}\n\tif s.NielsenConfiguration != nil {\n\t\tv := s.NielsenConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"nielsenConfiguration\", v, metadata)\n\t}\n\tif s.OutputGroups != nil {\n\t\tv := s.OutputGroups\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"outputGroups\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.TimecodeConfig != nil {\n\t\tv := s.TimecodeConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"timecodeConfig\", v, metadata)\n\t}\n\tif s.VideoDescriptions != nil {\n\t\tv := s.VideoDescriptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"videoDescriptions\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7e241f190c047dc90f99050d62ba760", "score": "0.55588233", "text": "func (s RegisterThingOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CertificatePem != nil {\n\t\tv := *s.CertificatePem\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"certificatePem\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceArns != nil {\n\t\tv := s.ResourceArns\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"resourceArns\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "13ae4e52f39dce3cebda5ee3910e276b", "score": "0.5558094", "text": "func (s GetExportInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Accepts != nil {\n\t\tv := *s.Accepts\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Accept\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ExportType != nil {\n\t\tv := *s.ExportType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"export_type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"stage_name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Parameters != nil {\n\t\tv := s.Parameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.QueryTarget, \"parameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "124d4544466e9c3d33aa18093c82ff08", "score": "0.5557746", "text": "func (s CreateNotificationSubscriptionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.Endpoint != nil {\n\t\tv := *s.Endpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Endpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Protocol) > 0 {\n\t\tv := s.Protocol\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Protocol\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.SubscriptionType) > 0 {\n\t\tv := s.SubscriptionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SubscriptionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.OrganizationId != nil {\n\t\tv := *s.OrganizationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"OrganizationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "479730f86b21c059f05c21fb23445393", "score": "0.55576295", "text": "func (s StreamInfo) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CreationTime != nil {\n\t\tv := *s.CreationTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreationTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.DataRetentionInHours != nil {\n\t\tv := *s.DataRetentionInHours\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DataRetentionInHours\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.DeviceName != nil {\n\t\tv := *s.DeviceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DeviceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KmsKeyId != nil {\n\t\tv := *s.KmsKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"KmsKeyId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MediaType != nil {\n\t\tv := *s.MediaType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MediaType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StreamARN != nil {\n\t\tv := *s.StreamARN\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamARN\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StreamName != nil {\n\t\tv := *s.StreamName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "834004aa2f3c28650e20c892e63ff16f", "score": "0.5557259", "text": "func (s UpdatePlacementOutput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "75957fb6aa44b52878b055c4504e1caa", "score": "0.5546449", "text": "func (s CancelPipelineReprocessingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PipelineName != nil {\n\t\tv := *s.PipelineName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"pipelineName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ReprocessingId != nil {\n\t\tv := *s.ReprocessingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"reprocessingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54774a97fa5e6c477fe72b58bbaeae11", "score": "0.55446696", "text": "func (s MsSmoothOutputSettings) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.H265PackagingType) > 0 {\n\t\tv := s.H265PackagingType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"h265PackagingType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.NameModifier != nil {\n\t\tv := *s.NameModifier\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"nameModifier\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e3fb84ce3d2cfe2dcbc0739614f6d4b5", "score": "0.5539007", "text": "func (s InputDeviceSummary) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionState) > 0 {\n\t\tv := s.ConnectionState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionState\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.DeviceSettingsSyncState) > 0 {\n\t\tv := s.DeviceSettingsSyncState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceSettingsSyncState\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.HdDeviceSettings != nil {\n\t\tv := s.HdDeviceSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"hdDeviceSettings\", v, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MacAddress != nil {\n\t\tv := *s.MacAddress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"macAddress\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.NetworkSettings != nil {\n\t\tv := s.NetworkSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"networkSettings\", v, metadata)\n\t}\n\tif s.SerialNumber != nil {\n\t\tv := *s.SerialNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"serialNumber\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5fdfd4d050a1565e8828355ba1d50c6f", "score": "0.55360687", "text": "func (s ListTagsForStreamInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StreamARN != nil {\n\t\tv := *s.StreamARN\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamARN\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StreamName != nil {\n\t\tv := *s.StreamName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StreamName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac0b0b13896ff76211a82632d2ac2279", "score": "0.55354875", "text": "func (s UpdatePresetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Category != nil {\n\t\tv := *s.Category\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"category\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Settings != nil {\n\t\tv := s.Settings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"settings\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5304029753b17a13fdc724f1db10549", "score": "0.5525703", "text": "func (s InitiateDocumentVersionUploadOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Metadata != nil {\n\t\tv := s.Metadata\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Metadata\", v, metadata)\n\t}\n\tif s.UploadMetadata != nil {\n\t\tv := s.UploadMetadata\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"UploadMetadata\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f03240764ab1bf1798560e3c5648d5a0", "score": "0.5524648", "text": "func (s AcceptInvitationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.GraphArn != nil {\n\t\tv := *s.GraphArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GraphArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b684a4f59dbc7519740618476451420b", "score": "0.55186915", "text": "func (s InitiateDocumentVersionUploadInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ContentCreatedTimestamp != nil {\n\t\tv := *s.ContentCreatedTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ContentCreatedTimestamp\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.ContentModifiedTimestamp != nil {\n\t\tv := *s.ContentModifiedTimestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ContentModifiedTimestamp\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ContentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DocumentSizeInBytes != nil {\n\t\tv := *s.DocumentSizeInBytes\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DocumentSizeInBytes\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ParentFolderId != nil {\n\t\tv := *s.ParentFolderId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ParentFolderId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e55ac606bd49e294a8987879a143592", "score": "0.5517254", "text": "func (s UploadMetadata) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.SignedHeaders) > 0 {\n\t\tv := s.SignedHeaders\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"SignedHeaders\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.UploadUrl != nil {\n\t\tv := *s.UploadUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"UploadUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6f45ada2372f3a0b06178e63a94f0756", "score": "0.55168", "text": "func (s DeleteGraphInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.GraphArn != nil {\n\t\tv := *s.GraphArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GraphArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9f721badaa1070f612b65cf98f615ba", "score": "0.55159706", "text": "func (s UpdateMultiplexOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Multiplex != nil {\n\t\tv := s.Multiplex\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"multiplex\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "698c51fee3b4265cd63dc5310b70446e", "score": "0.55102676", "text": "func (s UploadMetadata) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.SignedHeaders != nil {\n\t\tv := s.SignedHeaders\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"SignedHeaders\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.UploadUrl != nil {\n\t\tv := *s.UploadUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"UploadUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d17add14ab90317ba9f72dd718ea7c38", "score": "0.55085975", "text": "func (s StartSchemaCreationOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aaa92092e27d3dd0d302ccef9b0c55a3", "score": "0.5503743", "text": "func (s InputVpcRequest) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.SecurityGroupIds != nil {\n\t\tv := s.SecurityGroupIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"securityGroupIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.SubnetIds != nil {\n\t\tv := s.SubnetIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"subnetIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "373fb2f984376073d68b25fea6159806", "score": "0.5497772", "text": "func (s UpdateUserInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ConsoleAccess != nil {\n\t\tv := *s.ConsoleAccess\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"consoleAccess\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Groups != nil {\n\t\tv := s.Groups\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"groups\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Password != nil {\n\t\tv := *s.Password\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"password\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BrokerId != nil {\n\t\tv := *s.BrokerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"broker-id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Username != nil {\n\t\tv := *s.Username\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"username\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "950e19d8f3bca77febdd4bd2b99d8688", "score": "0.54974806", "text": "func (s CreateUserInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.DirectoryUserId != nil {\n\t\tv := *s.DirectoryUserId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"DirectoryUserId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.HierarchyGroupId != nil {\n\t\tv := *s.HierarchyGroupId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"HierarchyGroupId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IdentityInfo != nil {\n\t\tv := s.IdentityInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"IdentityInfo\", v, metadata)\n\t}\n\tif s.Password != nil {\n\t\tv := *s.Password\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Password\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PhoneConfig != nil {\n\t\tv := s.PhoneConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"PhoneConfig\", v, metadata)\n\t}\n\tif s.RoutingProfileId != nil {\n\t\tv := *s.RoutingProfileId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RoutingProfileId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.SecurityProfileIds) > 0 {\n\t\tv := s.SecurityProfileIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"SecurityProfileIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Username != nil {\n\t\tv := *s.Username\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Username\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InstanceId != nil {\n\t\tv := *s.InstanceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"InstanceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c02648331f8fab2e01938c9a2f0f3dc", "score": "0.5495708", "text": "func (s GetComponentPolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ComponentArn != nil {\n\t\tv := *s.ComponentArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"componentArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f973542abd521986f50a89813c83fa2c", "score": "0.54954594", "text": "func (s UpdateRequestValidatorInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PatchOperations != nil {\n\t\tv := s.PatchOperations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"patchOperations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.RequestValidatorId != nil {\n\t\tv := *s.RequestValidatorId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"requestvalidator_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RestApiId != nil {\n\t\tv := *s.RestApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"restapi_id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0397890c5045203d0b55d36b394f4539", "score": "0.5491651", "text": "func (e *jsonEncoder) EncodeSchema(seqno uint64) ([]byte, error) {\n\treturn e.Row(types.Schema, nil, seqno)\n}", "title": "" }, { "docid": "05de0fb399e20c9e2568774bde81de6b", "score": "0.5491206", "text": "func (s PutResourcePolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Policy != nil {\n\t\tv := s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Policy\", protocol.JSONValue{V: v, EscapeMode: protocol.QuotedEscape}, metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RegistryName != nil {\n\t\tv := *s.RegistryName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"registryName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "488c5ef4559f797d54ba03ff2aaf321c", "score": "0.5490475", "text": "func (s SetSourceRequest) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Decryption != nil {\n\t\tv := s.Decryption\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"decryption\", v, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EntitlementArn != nil {\n\t\tv := *s.EntitlementArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"entitlementArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IngestPort != nil {\n\t\tv := *s.IngestPort\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ingestPort\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.MaxBitrate != nil {\n\t\tv := *s.MaxBitrate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxBitrate\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.MaxLatency != nil {\n\t\tv := *s.MaxLatency\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxLatency\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Protocol) > 0 {\n\t\tv := s.Protocol\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocol\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StreamId != nil {\n\t\tv := *s.StreamId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"streamId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.VpcInterfaceName != nil {\n\t\tv := *s.VpcInterfaceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"vpcInterfaceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.WhitelistCidr != nil {\n\t\tv := *s.WhitelistCidr\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"whitelistCidr\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8d21d5ed590de5074ffb1144a5ad5ae", "score": "0.54872614", "text": "func (s *JSONPBSerialization) Marshal(body interface{}) ([]byte, error) {\n\tinput, ok := body.(proto.Message)\n\tif !ok {\n\t\treturn JSONAPI.Marshal(body)\n\t}\n\tvar buf []byte\n\tw := bytes.NewBuffer(buf)\n\terr := Marshaler.Marshal(w, input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn w.Bytes(), nil\n}", "title": "" }, { "docid": "fd1b5f7347ada37ebe562db1f24216ac", "score": "0.54834056", "text": "func (s UpdateInsightInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Filters != nil {\n\t\tv := s.Filters\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Filters\", v, metadata)\n\t}\n\tif s.GroupByAttribute != nil {\n\t\tv := *s.GroupByAttribute\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GroupByAttribute\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.InsightArn != nil {\n\t\tv := *s.InsightArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"InsightArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d7840fb209895e135c5aace9028eeb4", "score": "0.54712063", "text": "func (s SigningPlatform) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Category) > 0 {\n\t\tv := s.Category\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"category\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.DisplayName != nil {\n\t\tv := *s.DisplayName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"displayName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MaxSizeInMB != nil {\n\t\tv := *s.MaxSizeInMB\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxSizeInMB\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Partner != nil {\n\t\tv := *s.Partner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"partner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlatformId != nil {\n\t\tv := *s.PlatformId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"platformId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SigningConfiguration != nil {\n\t\tv := s.SigningConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"signingConfiguration\", v, metadata)\n\t}\n\tif s.SigningImageFormat != nil {\n\t\tv := s.SigningImageFormat\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"signingImageFormat\", v, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1de3933405422f78dda5104b1f8b2ff2", "score": "0.5469752", "text": "func (s PutBucketEncryptionOutput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "05b7314bfaa39fca009e114556a8eb99", "score": "0.54696906", "text": "func (s FrameCaptureOutputSettings) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.NameModifier != nil {\n\t\tv := *s.NameModifier\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"nameModifier\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
adfba024780a124b3d3970bf99e4708b
SetTxTimeoutForWorkload updates workload transaction timeouts. Used in tests only.
[ { "docid": "3c549af5a1d0027444d44ecd66dd4046", "score": "0.84875125", "text": "func (c *TabletConfig) SetTxTimeoutForWorkload(val time.Duration, workload querypb.ExecuteOptions_Workload) {\n\tswitch workload {\n\tcase querypb.ExecuteOptions_OLAP:\n\t\t_ = c.Olap.TxTimeoutSeconds.Set(val.String())\n\tcase querypb.ExecuteOptions_OLTP:\n\t\t_ = c.Oltp.TxTimeoutSeconds.Set(val.String())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported workload type: %v\", workload))\n\t}\n}", "title": "" } ]
[ { "docid": "d68ed8ccb26c49bc6feed5e22a703dcb", "score": "0.7139366", "text": "func (c *TabletConfig) TxTimeoutForWorkload(workload querypb.ExecuteOptions_Workload) time.Duration {\n\tswitch workload {\n\tcase querypb.ExecuteOptions_DBA:\n\t\treturn 0\n\tcase querypb.ExecuteOptions_OLAP:\n\t\treturn c.Olap.TxTimeoutSeconds.Get()\n\tdefault:\n\t\treturn c.Oltp.TxTimeoutSeconds.Get()\n\t}\n}", "title": "" }, { "docid": "b04b6d4ecac53d6dc318e9937e010813", "score": "0.6231117", "text": "func (axp *TxPool) SetTimeout(timeout time.Duration) {\n\taxp.timeout.Set(timeout)\n\taxp.ticks.SetInterval(timeout / 10)\n}", "title": "" }, { "docid": "f12965a703710fa5deb616a95a23f9f4", "score": "0.60410786", "text": "func (w *BenchmarkWorkload) SetTimeout(d time.Duration) *BenchmarkWorkload {\n\tw.WorkloadTimeout = &d\n\treturn w\n}", "title": "" }, { "docid": "f3b83da807a93e4b33e4ff5a60c5c15f", "score": "0.5663607", "text": "func WithTransactionTimeout(value time.Duration) Option {\n\treturn func(opts *options) {\n\t\topts.transactionTimeout = value\n\t}\n}", "title": "" }, { "docid": "27db1c0fba2d30b30763cae33577c03c", "score": "0.55859447", "text": "func (o *UploadStoreSystemPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f71a160333c1a99bc278d57c8a27570b", "score": "0.5525375", "text": "func (m *TeamworkSystemConfiguration) SetDeviceLockTimeout(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"deviceLockTimeout\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2dac26fce90361721c4f17c491f84a71", "score": "0.5410781", "text": "func (o *PostLTENetworkIDEnodebsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a31ea0ff7c3d98c8463a3cb30082333d", "score": "0.53301936", "text": "func SetSetupTimeout(t time.Duration) Configurator {\n\treturn func(c *confStore.Config) error {\n\t\tif t == 0 {\n\t\t\treturn errorx.IllegalArgument.New(\"Timeout can't be 0.\")\n\t\t}\n\t\tc.SetupTimeout = t\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a31ea0ff7c3d98c8463a3cb30082333d", "score": "0.53301936", "text": "func SetSetupTimeout(t time.Duration) Configurator {\n\treturn func(c *confStore.Config) error {\n\t\tif t == 0 {\n\t\t\treturn errorx.IllegalArgument.New(\"Timeout can't be 0.\")\n\t\t}\n\t\tc.SetupTimeout = t\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1d5a7c97cf345b3ce12ce4e92c846b66", "score": "0.53290796", "text": "func (w *CmdWorker) SetTimeout(t time.Duration) {\n\tw.timeout = t\n}", "title": "" }, { "docid": "2e9d3090996570fd460b237edc5e2496", "score": "0.53079116", "text": "func (m *OcrSettings) SetTimeout(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"timeout\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9bcb520af94f1a18be437383eeb48d30", "score": "0.5292222", "text": "func (o *PatchAPI24SoftwareInstallationsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ba6f53f4bf355c48fbcb5522a829cbd8", "score": "0.5276219", "text": "func (o *GetTestsE2eEnodebdTestPkParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "43ec7a39151b3e2e8cbb493b8d714805", "score": "0.5257376", "text": "func (o *CommitOutputPortTransactionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e34275bf86b49eaec092d8163e2414da", "score": "0.52256685", "text": "func (o *TestDatasourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3e00a3d162efd81478018914d24e1121", "score": "0.5210915", "text": "func (o *UpdateNodePoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1d9600d76e33c151a368ec9b64216a6b", "score": "0.5197656", "text": "func (o *UpdateIntegrationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9c07880169a8d1a957c6b1360c1eb7b", "score": "0.51798654", "text": "func (o *UpdateCustomPropertyForGatewayParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "45530a999d410f8b13a53ed650a8e381", "score": "0.51670593", "text": "func (o *ServiceBrokerTestTimeoutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9c35ab38bb5ba829f3588a410a74253b", "score": "0.51418537", "text": "func (o *UpdatePartSupportConfigurationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "12cdaba983641d0fe92bd5f4ba886982", "score": "0.51080185", "text": "func (o *GetWorkflowTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c40f9e3ca5adf686acfefae7ada690bc", "score": "0.5088689", "text": "func (o *FindConfigBatchSizeFailThresholdInKbParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5139d44642dc8c557823cad39b5622f1", "score": "0.5086216", "text": "func (o *GetWalletParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5c9edde268f75cd8124d52e18aa6fce9", "score": "0.50840443", "text": "func (connection *Connection) SetTimeout(timeout uint16) error {\n\tif connection.conn != nil {\n\t\tcommand := cmd.XsCommand{}\n\t\tcommand.Cmd = cmd.XS_CMD_TIMEOUT\n\t\tcommand.SetArg(timeout)\n\t\t_, err := connection.ExecOK(&command, cmd.XS_CMD_OK_TIMEOUT_SET)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn errors.New(\"do not connect to server yet, please connect to server first\")\n}", "title": "" }, { "docid": "1e67c8ca5854e87f2abd2c65cb5a28b1", "score": "0.50652146", "text": "func (o *PatchConnectionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "097754a88b2e51b52be14eb302a908b3", "score": "0.50570905", "text": "func (o *GetNetworksNetworkIDTiersTierIDVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0849f7283e49daba0c606a08929bae89", "score": "0.5054856", "text": "func (o *UpdateLegacyFeatureParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f90934e81ccb0b5800b401469654e93c", "score": "0.5046224", "text": "func (this *Chained) SetTimeout(d time.Duration) *Chained {\n\tif nil == this.Error && 0 != d {\n\t\tctx, cancel := context.WithTimeout(context.Background(), d)\n\t\tthis.cancel = cancel\n\t\tthis.Request = this.Request.WithContext(ctx)\n\t}\n\treturn this\n}", "title": "" }, { "docid": "a9d547ebcd91f3220770363880be9eef", "score": "0.50425583", "text": "func (o *RunTransactionCategorizationRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7b94869b92d69ef71f42b776f2a57ead", "score": "0.50287616", "text": "func (o *TestPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6a2f77835b182ba55a333121b1215f89", "score": "0.5025807", "text": "func (o *PutLTENetworkIDSubscribersSubscriberIDLTESubProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "36110c14624a97a56ac6d06d3dc5003d", "score": "0.50165117", "text": "func (iw *Worker) SetTimeout(duration time.Duration) *Worker {\n\tiw.Lock()\n\tdefer iw.Unlock()\n\tiw.timeout = duration\n\treturn iw\n}", "title": "" }, { "docid": "8860681e6bdbf7ed99827382fbb56b7c", "score": "0.5010096", "text": "func (o *UpdateFilepoolDefaultPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8227a335f34560d39dcaed9aa06513d1", "score": "0.5008222", "text": "func (o *AddCPUExtensionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c4d1cf0ec2a5dadc220df829ae78ed94", "score": "0.50022125", "text": "func (o *GetExtensionRepoVersionExtensionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d00e85b0f584e64a010a0efd943e097c", "score": "0.5001159", "text": "func (o *UpdateRuleSetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "71efceb657a5a5aab8665295b65df053", "score": "0.49974793", "text": "func (f *File) SetTimeout(x time.Duration) {\n\tif x == 0 {\n\t\tf.timeout = 0\n\t\treturn\n\t}\n\tt := uint32(x / time.Millisecond)\n\tif t <= 0 {\n\t\tt = 1\n\t}\n\tf.timeout = t\n}", "title": "" }, { "docid": "8e9c15b34695f532228e12a9a48d947d", "score": "0.49922594", "text": "func (o *ImageCommitParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1dc651cf117a72a6963b0f9066e19911", "score": "0.49876642", "text": "func (o *GetNetworkSsidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e90c53f77ecd8055f2c20ca3b861c8cd", "score": "0.49776724", "text": "func TestBatchTxTimeout(t *testing.T) {\n\tinput, ctx := keeper.SetupFiveValChain(t)\n\tgravityKeeper := input.GravityKeeper\n\tparams := gravityKeeper.GetParams(ctx)\n\tvar (\n\t\tnow = time.Now().UTC()\n\t\tmySender, _ = sdk.AccAddressFromBech32(\"cosmos1ahx7f8wyertuus9r20284ej0asrs085case3kn\")\n\t\tmyReceiver = common.HexToAddress(\"0xd041c41EA1bf0F006ADBb6d2c9ef9D425dE5eaD7\")\n\t\tmyTokenContractAddr = common.HexToAddress(\"0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5\") // Pickle\n\t\tallVouchers = sdk.NewCoins(types.NewERC20Token(99999, myTokenContractAddr.Hex()).GravityCoin())\n\t)\n\n\trequire.Greater(t, params.AverageBlockTime, uint64(0))\n\trequire.Greater(t, params.AverageEthereumBlockTime, uint64(0))\n\n\t// mint some vouchers first\n\trequire.NoError(t, input.BankKeeper.MintCoins(ctx, types.ModuleName, allVouchers))\n\t// set senders balance\n\tinput.AccountKeeper.NewAccountWithAddress(ctx, mySender)\n\trequire.NoError(t, fundAccount(ctx, input.BankKeeper, mySender, allVouchers))\n\n\t// add some TX to the pool\n\tinput.AddSendToEthTxsToPool(t, ctx, myTokenContractAddr, mySender, myReceiver, 2, 3, 2, 1, 5, 6)\n\n\t// when\n\tctx = ctx.WithBlockTime(now).WithBlockHeight(250)\n\n\t// check that we can make a batch without first setting an ethereum block height\n\tb1 := gravityKeeper.BuildBatchTx(ctx, myTokenContractAddr, 2)\n\trequire.Equal(t, b1.Timeout, uint64(0))\n\n\tgravityKeeper.SetLastObservedEthereumBlockHeight(ctx, 500)\n\n\tb2 := gravityKeeper.BuildBatchTx(ctx, myTokenContractAddr, 2)\n\t// this is exactly block 500 plus twelve hours\n\trequire.Equal(t, b2.Timeout, uint64(504))\n\n\t// make sure the batches got stored in the first place\n\tgotFirstBatch := input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b1.TokenContract), b1.BatchNonce))\n\trequire.NotNil(t, gotFirstBatch)\n\tgotSecondBatch := input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b2.TokenContract), b2.BatchNonce))\n\trequire.NotNil(t, gotSecondBatch)\n\n\t// when, way into the future\n\tctx = ctx.WithBlockTime(now).WithBlockHeight(9)\n\n\tb3 := gravityKeeper.BuildBatchTx(ctx, myTokenContractAddr, 2)\n\n\tgravity.BeginBlocker(ctx, gravityKeeper)\n\n\t// this had a timeout of zero should be deleted.\n\tgotFirstBatch = input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b1.TokenContract), b1.BatchNonce))\n\trequire.Nil(t, gotFirstBatch)\n\t// make sure the end blocker does not delete these, as the block height has not officially\n\t// been updated by a relay event\n\tgotSecondBatch = input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b2.TokenContract), b2.BatchNonce))\n\trequire.NotNil(t, gotSecondBatch)\n\tgotThirdBatch := input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b3.TokenContract), b3.BatchNonce))\n\trequire.NotNil(t, gotThirdBatch)\n\n\tgravityKeeper.SetLastObservedEthereumBlockHeight(ctx, 5000)\n\tgravity.BeginBlocker(ctx, gravityKeeper)\n\n\t// make sure the end blocker does delete these, as we've got a new Ethereum block height\n\tgotFirstBatch = input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b1.TokenContract), b1.BatchNonce))\n\trequire.Nil(t, gotFirstBatch)\n\tgotSecondBatch = input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b2.TokenContract), b2.BatchNonce))\n\trequire.Nil(t, gotSecondBatch)\n\tgotThirdBatch = input.GravityKeeper.GetOutgoingTx(ctx, types.MakeBatchTxKey(common.HexToAddress(b3.TokenContract), b3.BatchNonce))\n\trequire.NotNil(t, gotThirdBatch)\n}", "title": "" }, { "docid": "82caffb2f825b12f05fb6e276f2850b2", "score": "0.49768564", "text": "func (o *UpdateFirmwareParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f42969568b48fe4a464f58b79ef3c083", "score": "0.4975615", "text": "func (o *ScheduleCheckingForChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0dacef215fe5c8724bf128c1b2a6be5f", "score": "0.49640092", "text": "func (r *Repo) SetTimeout(v int64) {\n\t// return if Repo type is nil\n\tif r == nil {\n\t\treturn\n\t}\n\n\tr.Timeout = &v\n}", "title": "" }, { "docid": "f2740bd1e1da6e40f3f746d101495be7", "score": "0.49627325", "text": "func (obj *Sys) TarsSetTimeout(t int) {\n\tobj.s.TarsSetTimeout(t)\n}", "title": "" }, { "docid": "4df40fcd4ea6988a63acf5b4c59d6925", "score": "0.49584374", "text": "func _cgoexp_ebd397278953_proxyholochain_SendOptions_Timeout_Set(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_ebd397278953_proxyholochain_SendOptions_Timeout_Set\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "94e23fc73dfcec7868fe034e18c8c911", "score": "0.49517092", "text": "func (o *GetSyncPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f857ada31f64ead4c62e82ceecca7c75", "score": "0.49401256", "text": "func (o *UploadHardwareProfileJposEntriesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8f2a9d407b1c5b981c79c915621cae27", "score": "0.49185503", "text": "func (o *WorkflowsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4c68c71c7582afac160be2e7d5480bb5", "score": "0.49123475", "text": "func (o *SetAllInstancesSettingsOverridesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c8caefcf2f314b4e0e891f2a58aba49d", "score": "0.4906932", "text": "func SetTimeout(timeout int) {\n\tsendCommand(fmt.Sprintf(\"SEND TIMEOUT %d\", timeout))\n}", "title": "" }, { "docid": "0b0fb47551c94e98d61f7472899594e1", "score": "0.48996323", "text": "func (o *GetKubernetesConfigInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e2c638ea07881174f84e710213040a9a", "score": "0.48812523", "text": "func (o *GetStockParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "92b68bb65422b1a1762ed6e8d4c728ec", "score": "0.4880102", "text": "func (o *UpdatePolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "432366006ebf7196c2bc0979ff31a9e5", "score": "0.48772377", "text": "func (o *V1UpdateLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b1ac854bcd606ee5dc4a164f169efc65", "score": "0.48707637", "text": "func (o *UpdateNetworkSsidTrafficShapingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9fe042a23fd90f791ae18ab65ef3ff7e", "score": "0.48686203", "text": "func (o *CreateImageStoreParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "58f81cce8af5d6d40d5d82ab04cc27c0", "score": "0.48669478", "text": "func (o *PutLTENetworkIDAPNSAPNNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c7303b84378ce5f54d7337c206e9f40f", "score": "0.48632628", "text": "func (o *UpdateItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "85a8f9174e35a743d557343ccfd9cfb0", "score": "0.4862239", "text": "func (o *UpdateBuildScriptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "edcebd41cb849c41ae8eac36dce1a5f9", "score": "0.485965", "text": "func (c *Ctx) SetTimeout(t time.Duration) time.Duration {\n\tprev := C.X_SSL_CTX_set_timeout(c.ctx, C.long(t/time.Second))\n\treturn time.Duration(prev) * time.Second\n}", "title": "" }, { "docid": "70f39175e97babd8d0ccebd3bb9a42e2", "score": "0.4852968", "text": "func (o *UpdateNtpSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bbca6834132881f3eabe9ad4d0516ab1", "score": "0.48525771", "text": "func (o *PutNetworksNetworkIDTiersTierIDNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8b6b96dbcead2f3f05fe089d9734657b", "score": "0.48499107", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDCellularDNSRecordsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ac9546aaa149582d25d277c2c132a65c", "score": "0.48470896", "text": "func (o *CreateWidgetTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6c9d4f09163fa212f4e07279b74bd9df", "score": "0.4843978", "text": "func (o *AddTaskParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8d22f2b34161e5e6c6c02fc8d89a4897", "score": "0.48419717", "text": "func (o *OptionsDatasetUploadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "da82f17514181d4198222c1a377dcd7a", "score": "0.48418698", "text": "func (o *UpdateAntivirusSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "344391fa2f1696282bb54d0f7f2e56fa", "score": "0.4838671", "text": "func SetTimeout(timeout time.Duration) Option {\n\treturn optionFunc(func(config *Config) {\n\t\tconfig.Timeout = timeout\n\t})\n}", "title": "" }, { "docid": "96fa97dfa4dacd45003c5161cbe00b06", "score": "0.4832183", "text": "func (o *AddExternalSystemCallsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b34793969c1ca53c8f4ee651399cc18a", "score": "0.48275712", "text": "func (o *ListMaintenanceWindowsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5c68b231aec5d937e9b6189ed19e951c", "score": "0.48257774", "text": "func (b *Bridge) SetNetflowTimeout(timeout int) error {\n\tbridgeLock.Lock()\n\tdefer bridgeLock.Unlock()\n\n\tif b.nf == nil {\n\t\treturn fmt.Errorf(\"bridge has no netflow object\")\n\t}\n\n\targs := []string{\n\t\t\"set\",\n\t\t\"NetFlow\",\n\t\tb.Name,\n\t\tfmt.Sprintf(\"active_timeout=%v\", timeout),\n\t}\n\tif _, sErr, err := ovsCmdWrapper(args); err != nil {\n\t\treturn fmt.Errorf(\"set netflow timeout failed: %v %v\", err, sErr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "388d9aa2073ec45fc6aaebd0be960517", "score": "0.48235795", "text": "func (o *PatchServiceAccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "63b8f7818bf24c36a7a7b184ac87956c", "score": "0.4823015", "text": "func (o *GetRecycleBinPackageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e9bc582d02ec0253882954cd2b5f3889", "score": "0.48117942", "text": "func (o *GetTransactionCategorizationRulesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3ccca7828deaa9cb02554bc80f6a23b7", "score": "0.4808832", "text": "func (o *GetSpecialPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ba8815879821e98b9035481d06797fdd", "score": "0.48056248", "text": "func (adlc *ActivityDumpLoadConfig) SetTimeout(duration time.Duration) {\n\tadlc.Timeout = duration\n\tadlc.EndTimestampRaw = adlc.StartTimestampRaw + uint64(duration)\n}", "title": "" }, { "docid": "c6aec931b489e5ace72404dbb39469f7", "score": "0.48049656", "text": "func (o *SystemPingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c016ab62785fefb12d688f168c72e65a", "score": "0.47946802", "text": "func (o *DoBootImageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "95c631f062a07c8fbb2b25c453475fe8", "score": "0.47933412", "text": "func (o *PatchAttributesAttributeCodeOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fc78da36f623da8a6da2412bc4ee686e", "score": "0.47931415", "text": "func SetCommandTimeout(timeout int64) {\n\tatomic.StoreInt64(&cmdTimeout, timeout)\n}", "title": "" }, { "docid": "0d707b3233cd81e38f1f965829609f11", "score": "0.479209", "text": "func (o *GetLTENetworkIDNetworkProbeDestinationsDestinationIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8ad5518998bdac07abbc42166b4f8e65", "score": "0.47895554", "text": "func (w *BenchmarkWorkload) Timeout() time.Duration {\n\tif w.WorkloadTimeout == nil {\n\t\treturn -1\n\t}\n\n\treturn *w.WorkloadTimeout\n}", "title": "" }, { "docid": "3dc71bd5c58197a2e7a822aa1bc55060", "score": "0.47882888", "text": "func (o *GetIntelRuleFileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f55313964acd68d11d5520d22eaaf6ec", "score": "0.47831255", "text": "func (o *GetTestCaseParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0c65426979418f3604be0b81a7637888", "score": "0.47802663", "text": "func (p *Pool) SetTaskTimeout(t int) {\n\tp.quitTimeout = time.Duration(t) * time.Second\n\tp.useTimeout = true\n}", "title": "" }, { "docid": "bb88ccc341b5a9c874d4c5c1d6757bb0", "score": "0.4779245", "text": "func (o *WeaviateActionsPatchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fe02da6a123caf425da4359e61049236", "score": "0.47789267", "text": "func (o *SetSubscriptionAddonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7786b3d50c6e74bfc3c533293be3df87", "score": "0.47746643", "text": "func (o *GetSystemLogParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "df5fd8a492a434a13dd726a6c172f0d7", "score": "0.47734892", "text": "func (s *Consul) setTimeout(time time.Duration) {\n\ts.config.WaitTime = time\n}", "title": "" }, { "docid": "f69723c419dc2905e1f3e42da9683c66", "score": "0.477333", "text": "func (o *UpdateCryptoConfigSelectorSchemeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "499a4ae35353d9fcffa8c052b7489325", "score": "0.47621033", "text": "func (o *StoredTracesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ff9e6b34b0e1e784ca47a654b10b9412", "score": "0.476079", "text": "func (o *StartUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a5a7d86283d26dd3af367969c1fb43ca", "score": "0.4759429", "text": "func (o *AddEventLoopParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "38966bb794ffe735f65f13a27caa7f3b", "score": "0.47560355", "text": "func (o *Orchestra) SetTimeout(t time.Duration) {\n\to.timeout = t\n\tfor i := range o.conns {\n\t\to.conns[i].Timeout = o.timeout\n\t}\n}", "title": "" }, { "docid": "33ce0171f589a6f20609f01f6011e616", "score": "0.47557545", "text": "func (o *UpdateCatalogEntryPackageAttributesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8ba9fb91b50a54ffad7b9ffd77477876", "score": "0.47525546", "text": "func (o *GetInstallationsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8ca3f347d8dadf984de48bf7873699f2", "score": "0.4746374", "text": "func SetWriteTimeout(timeout time.Duration) Option {\n\treturn func(t *Transport) {\n\t\tt.writeTimeout = timeout\n\t}\n}", "title": "" }, { "docid": "f8f6fb45bcdc5a60e88b94697d9cdd70", "score": "0.47403145", "text": "func SetTimeout(d time.Duration) {\n\tdefaultClient.Timeout = d\n}", "title": "" }, { "docid": "d36b10b161df24d3d9ba7dd591bb5e9b", "score": "0.47378078", "text": "func (o *UpdateJobJobParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7ee4454611f38e9e683401f961d585a5", "score": "0.47360107", "text": "func (o *GetSdxByEnvCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
16b02edc1e13971ed3fde20b502f2e9b
SetProductID sets the product edge to Product by id.
[ { "docid": "dbe0e2adacb2490a2aead6cb96d1600f", "score": "0.7703086", "text": "func (ipu *ImagePathUpdate) SetProductID(id int) *ImagePathUpdate {\n\tipu.mutation.SetProductID(id)\n\treturn ipu\n}", "title": "" } ]
[ { "docid": "9f6756987bf204b4854931d4f355e14c", "score": "0.7870499", "text": "func (ru *RatingUpdate) SetProductID(id int) *RatingUpdate {\n\tru.mutation.SetProductID(id)\n\treturn ru\n}", "title": "" }, { "docid": "5db00f609ad65e8672b77b3b263b0c38", "score": "0.7854718", "text": "func (m *AccountMutation) SetProductID(id int) {\n\tm.product = &id\n}", "title": "" }, { "docid": "92b40e791e170be48777b091dd348a0c", "score": "0.7846581", "text": "func (ruo *RatingUpdateOne) SetProductID(id int) *RatingUpdateOne {\n\truo.mutation.SetProductID(id)\n\treturn ruo\n}", "title": "" }, { "docid": "f0fb8538abd3bf468e5926f7108d49d9", "score": "0.77414536", "text": "func (ipuo *ImagePathUpdateOne) SetProductID(id int) *ImagePathUpdateOne {\n\tipuo.mutation.SetProductID(id)\n\treturn ipuo\n}", "title": "" }, { "docid": "43e333f9fe7910046f6345302bafaa8c", "score": "0.74352145", "text": "func (o *AddroductDataSourcesUsingPOSTParams) SetProductID(productID string) {\n\to.ProductID = productID\n}", "title": "" }, { "docid": "e6b20a8e3acb33aa4b8be0d3659accd0", "score": "0.72307193", "text": "func (o *GetProductStocksParams) SetProductID(productID string) {\n\to.ProductID = productID\n}", "title": "" }, { "docid": "adbd91e649d6c0d580880579cfbcb0a1", "score": "0.6981053", "text": "func (o *PutCatalogsByIDCategoriesByIDProductsByIDParams) SetProductID(productID string) {\n\to.ProductID = productID\n}", "title": "" }, { "docid": "9d8fe46fe4067e358aab52f7301ab10f", "score": "0.69606644", "text": "func (k Keeper) SetProduct(ctx sdk.Context, Product types.Product) {\n\tProductKey := Product.Application_ID\n\tstore := ctx.KVStore(k.storeKey)\n\tbz := k.cdc.MustMarshalBinaryLengthPrefixed(Product)\n\tkey := []byte(types.ProductPrefix + ProductKey)\n\tstore.Set(key, bz)\n}", "title": "" }, { "docid": "6d65cfd1fbd335ddd09b983f02738ae7", "score": "0.6372253", "text": "func (options *CreateLicenseEntitlementOptions) SetLicenseProductID(licenseProductID string) *CreateLicenseEntitlementOptions {\n\toptions.LicenseProductID = core.StringPtr(licenseProductID)\n\treturn options\n}", "title": "" }, { "docid": "519db5c6f9631372ee7cdb55810ffe2e", "score": "0.634356", "text": "func (o *SaleItem) SetProduct(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Product) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"sale_item\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"product_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, saleItemPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, updateQuery)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.ProductID = related.ID\n\tif o.R == nil {\n\t\to.R = &saleItemR{\n\t\t\tProduct: related,\n\t\t}\n\t} else {\n\t\to.R.Product = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &productR{\n\t\t\tSaleItems: SaleItemSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.SaleItems = append(related.R.SaleItems, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e39a145d7dc682d3971161f33cff0b1", "score": "0.63302845", "text": "func (o *SharedCatalogProductManagementV1AssignProductsPostParams) SetID(id int64) {\n\to.ID = id\n}", "title": "" }, { "docid": "93694ddbe0648fdbcf1c8c4fe5eb0a8d", "score": "0.632969", "text": "func (options *ListLicenseEntitlementsOptions) SetLicenseProductID(licenseProductID string) *ListLicenseEntitlementsOptions {\n\toptions.LicenseProductID = core.StringPtr(licenseProductID)\n\treturn options\n}", "title": "" }, { "docid": "f11458b3843ae4749eb5be4456f0d069", "score": "0.6293814", "text": "func (m *ProductMutation) SetID(id int64) {\n\tm.id = &id\n}", "title": "" }, { "docid": "d5948b9b441fde7eee3f226ecb8fd564", "score": "0.6268929", "text": "func withProductID(id int64) productOption {\n\treturn func(m *ProductMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Product\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Product, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Product.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "1ccdc171e6e54485d974ee39d800d40e", "score": "0.62504387", "text": "func withProductID(id int) productOption {\n\treturn func(m *ProductMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Product\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Product, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Product.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "855ae884535b741fade3c707f80f3b7e", "score": "0.6244059", "text": "func (options *GetLicensesOptions) SetLicenseProductID(licenseProductID string) *GetLicensesOptions {\n\toptions.LicenseProductID = core.StringPtr(licenseProductID)\n\treturn options\n}", "title": "" }, { "docid": "16dcc0f04020df31000b591badaa68aa", "score": "0.6183709", "text": "func (options *GetLicenseEntitlementsOptions) SetLicenseProductID(licenseProductID string) *GetLicenseEntitlementsOptions {\n\toptions.LicenseProductID = core.StringPtr(licenseProductID)\n\treturn options\n}", "title": "" }, { "docid": "6f3490f2f51eefb6cce96d47dfa473aa", "score": "0.6167045", "text": "func (o *SetMetadataForProductParams) WithProductID(ProductID string) *SetMetadataForProductParams {\n\to.ProductID = ProductID\n\treturn o\n}", "title": "" }, { "docid": "8586ceb6fc712d9a5be171ea288e2164", "score": "0.6052019", "text": "func (o *SharedCatalogProductManagementV1GetProductsGetParams) SetID(id int64) {\n\to.ID = id\n}", "title": "" }, { "docid": "c12a68c4d6778ea1bd0b0df1bbb44c99", "score": "0.5995248", "text": "func (o ProjectServiceCatalogProvisioningDetailsPtrOutput) ProductId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ProjectServiceCatalogProvisioningDetails) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ProductId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1c414882fcd17113dd49a6d0d18195e3", "score": "0.5964224", "text": "func (s *DatastoreSegment) SetProduct(v string) *DatastoreSegment {\n\ts.ds.Product = newrelic.DatastoreProduct(v)\n\treturn s\n}", "title": "" }, { "docid": "55da3a75920f067c49ef856ffb0918c9", "score": "0.59538585", "text": "func (m *EditionUpgradeConfiguration) SetProductKey(value *string)() {\n m.productKey = value\n}", "title": "" }, { "docid": "11c0609d687c7db5f525f7d01321a155", "score": "0.5947897", "text": "func (ru *RatingUpdate) SetNillableProductID(id *int) *RatingUpdate {\n\tif id != nil {\n\t\tru = ru.SetProductID(*id)\n\t}\n\treturn ru\n}", "title": "" }, { "docid": "5fbc3dee40f47d67a1e0f7a96b4fd02b", "score": "0.59395015", "text": "func (ruo *RatingUpdateOne) SetNillableProductID(id *int) *RatingUpdateOne {\n\tif id != nil {\n\t\truo = ruo.SetProductID(*id)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "256f40c9cee3a5d379429dddbad36069", "score": "0.5882952", "text": "func (e *Edge) SetID(i string) {\n\te.ID = graph.Identifier(i)\n}", "title": "" }, { "docid": "fc51b57888ee6d05308f20a8fedc30ea", "score": "0.5845369", "text": "func (ipu *ImagePathUpdate) SetNillableProductID(id *int) *ImagePathUpdate {\n\tif id != nil {\n\t\tipu = ipu.SetProductID(*id)\n\t}\n\treturn ipu\n}", "title": "" }, { "docid": "2b537d1fa8a4d9bc83d518f66ed42749", "score": "0.58133775", "text": "func (ipu *ImagePathUpdate) SetProduct(p *Product) *ImagePathUpdate {\n\treturn ipu.SetProductID(p.ID)\n}", "title": "" }, { "docid": "3499a81ed08a36f838e24198a5c1ef4d", "score": "0.5794021", "text": "func (ruo *RatingUpdateOne) SetProduct(p *Product) *RatingUpdateOne {\n\treturn ruo.SetProductID(p.ID)\n}", "title": "" }, { "docid": "4ca29040acec7da5cfdd7a2d3d869798", "score": "0.5793149", "text": "func (e *BaseExchange) SetID(id ExchangeID) {\n\te.Lock()\n\tdefer e.Unlock()\n\n\te.id = id\n}", "title": "" }, { "docid": "ce4b91a9f882c499a8a45b8dacf185a9", "score": "0.5776436", "text": "func (o ProjectServiceCatalogProvisioningDetailsOutput) ProductId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ProjectServiceCatalogProvisioningDetails) string { return v.ProductId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "231edc6647c94fc12fa5ca5804b4cd47", "score": "0.57636726", "text": "func (n *Node) SetID(id []byte) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.ID = id\n}", "title": "" }, { "docid": "3d0b7aa0ec764f50b3f9ba7820fbfcab", "score": "0.57609004", "text": "func UpdateProduct(product *model.Product, id string) (err error) {\r\n\tfmt.Println(product)\r\n\tconfig.DB.Save(product)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "06a57c8a04553d497c3691b0f947320d", "score": "0.5758642", "text": "func (pmf PrivateMachineFacade) SetId(smRecord *SMRecord, id string) {\n\tsmRecord.PID = id\n}", "title": "" }, { "docid": "42df707e51fcf2c11a4899b753bcf5db", "score": "0.57510656", "text": "func (ipuo *ImagePathUpdateOne) SetProduct(p *Product) *ImagePathUpdateOne {\n\treturn ipuo.SetProductID(p.ID)\n}", "title": "" }, { "docid": "6ab6e404759ebf408daaaa4a4281a90f", "score": "0.5744624", "text": "func (o *GetProductsProductIDRelatedParams) WithProductID(ProductID string) *GetProductsProductIDRelatedParams {\n\to.ProductID = ProductID\n\treturn o\n}", "title": "" }, { "docid": "5e8b6619668ce5bd32d2857a2a67c40a", "score": "0.57369095", "text": "func (n *Node) SetID(i string) {\n\tn.ID = graph.Identifier(i)\n}", "title": "" }, { "docid": "8c1eb0c53b57a6b104d4c3fae2d02795", "score": "0.5735478", "text": "func (n *Node) SetID(id string) error {\n\t// Node id must be between 101 and 4000\n\tidN, err := strconv.Atoi(id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid node id: %s\", id)\n\t}\n\tif idN < 101 || idN > 4000 {\n\t\treturn fmt.Errorf(\"invalid node id: %s\", id)\n\t}\n\tn.id = id\n\treturn nil\n}", "title": "" }, { "docid": "92c78a80ccff50d1f018cc6e35115af0", "score": "0.57330245", "text": "func (m *AccountMutation) ProductID() (id int, exists bool) {\n\tif m.product != nil {\n\t\treturn *m.product, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "e49ce3cd92245a6a0bb191aa3ad718a9", "score": "0.56833565", "text": "func (ipuo *ImagePathUpdateOne) SetNillableProductID(id *int) *ImagePathUpdateOne {\n\tif id != nil {\n\t\tipuo = ipuo.SetProductID(*id)\n\t}\n\treturn ipuo\n}", "title": "" }, { "docid": "27de1c4cf7f861e52cc38060df3b6dbd", "score": "0.56476", "text": "func (element *ContextElement) SetEntityID() {\n\tif element.ID != \"\" {\n\t\telement.Entity.ID = element.ID\n\t\telement.ID = \"\"\n\t}\n\n\tif element.Type != \"\" {\n\t\telement.Entity.Type = element.Type\n\t\telement.Type = \"\"\n\t}\n\n\tif element.IsPattern != \"\" {\n\t\tif element.IsPattern == \"true\" {\n\t\t\telement.Entity.IsPattern = true\n\t\t} else {\n\t\t\telement.Entity.IsPattern = false\n\t\t}\n\t\telement.IsPattern = \"\"\n\t}\n}", "title": "" }, { "docid": "5d17bc10050fb3f6d966dc39bc051893", "score": "0.5645548", "text": "func (o *GetProductsByIDVariationGroupsByIDParams) SetID(id string) {\n\to.ID = id\n}", "title": "" }, { "docid": "bca4e5423cde8a7a23195adc3833742e", "score": "0.5643539", "text": "func (ru *RatingUpdate) SetProduct(p *Product) *RatingUpdate {\n\treturn ru.SetProductID(p.ID)\n}", "title": "" }, { "docid": "48d4e94727842c15eb456809d3d9c0c1", "score": "0.5633744", "text": "func setID(entity interface{}, ID int64) {\n\treflect.ValueOf(entity).Elem().FieldByName(\"ID\").SetInt(ID)\n}", "title": "" }, { "docid": "7bd111d33266065edd979c6b787f4079", "score": "0.5627956", "text": "func (p *Products) UpdateProduct(rw http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\thttp.Error(rw, \"Unable to parse ID, is that an integer?\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tp.l.Println(\"Handle PUT Product\", id)\n\t\n\tprod := r.Context().Value(KeyProduct{}).(data.Product)\n\tp.l.Printf(\"got prod from context %v\", prod)\n\n\tp.l.Printf(\"Prod: %#v\", prod)\n\terr = data.UpdateProduct(prod)\n\tif err == data.ErrProductNotFound {\n\t\thttp.Error(rw, \"Product not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif err != nil {\n\t\thttp.Error(rw, \"Product not found\", http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1617d67425f7edfbe03848e6a5bf13da", "score": "0.5617246", "text": "func UpdateProduct(id int, p *Product) error {\n\t_, pos, err := findProduct(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.ID = id\n\tproductList[pos] = p\n\n\treturn nil\n}", "title": "" }, { "docid": "fa17d24b13d3747b4bb52428cd6a645e", "score": "0.5603682", "text": "func (m *WindowsPhone81AppX) SetPhoneProductIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"phoneProductIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "de5cdf0d5bf078b28a598bb5b77ffb55", "score": "0.5582296", "text": "func (e *Ecu) SetID(id string) {\n\te.mux.Lock()\n\tdefer e.mux.Unlock()\n\n\te.ID = id\n}", "title": "" }, { "docid": "ae0a8241b7bf0d8daf9d731f5164badd", "score": "0.5575393", "text": "func (o ProvisioningArtifactOutput) ProductId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ProvisioningArtifact) pulumi.StringOutput { return v.ProductId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c421cc7eb5366f811d58c8d1e77d76cb", "score": "0.5569561", "text": "func (a *App) updateProduct(w http.ResponseWriter, r *http.Request) {\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\tvar p product\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&p); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tp.ID = id\n\n\tif err := p.updateProduct(a.DB); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, p)\n}", "title": "" }, { "docid": "bb275bf3d9543fb0d12240447c039190", "score": "0.55604684", "text": "func (o *AddroductDataSourcesUsingPOSTParams) WithProductID(productID string) *AddroductDataSourcesUsingPOSTParams {\n\to.SetProductID(productID)\n\treturn o\n}", "title": "" }, { "docid": "0dbeb38c086298fbd741b8d7be80abbe", "score": "0.54716015", "text": "func (this *Link) SetID(id uint64) {\n\tthis.id = id\n}", "title": "" }, { "docid": "ca76ba12c19f698b0764393d17c9e594", "score": "0.54702455", "text": "func (this *XmultYeqZ) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "title": "" }, { "docid": "851791f12a63325d445d32e9140b2eff", "score": "0.54678845", "text": "func (c *ProjectsLocationsCatalogsBranchesProductsCreateCall) ProductId(productId string) *ProjectsLocationsCatalogsBranchesProductsCreateCall {\n\tc.urlParams_.Set(\"productId\", productId)\n\treturn c\n}", "title": "" }, { "docid": "c54c37ea7e6a0d0bdc51a0d1429262e9", "score": "0.5446363", "text": "func NewProductId(awsid string, supportid string) *ProductId {\n\tthis := ProductId{}\n\tthis.Awsid = awsid\n\tthis.Supportid = supportid\n\treturn &this\n}", "title": "" }, { "docid": "2bb204e746923037999f082a08186cb5", "score": "0.54454726", "text": "func (r *Record) setID(id int64) *Record {\n\n\t// set the record ID\n\tr.Fields()[IDFieldKey] = id\n\n\tr.invalidateDatastoreKey()\n\n\t// chain\n\treturn r\n}", "title": "" }, { "docid": "1ee2a5c13325820bccb07660da203867", "score": "0.54089063", "text": "func (k Keeper) SetSubscriptionID(ctx sdk.Context, subscriptionID uint64) {\n\tstore := ctx.KVStore(k.storeKey)\n\tstore.Set(types.SubscriptionIDKey, types.GetSubscriptionIDBytes(subscriptionID))\n}", "title": "" }, { "docid": "c89f2000301c53c2fefb84fa9f3d85c9", "score": "0.5389496", "text": "func (b *Base) SetID(id influxdb.ID) {\n\tb.ID = id\n}", "title": "" }, { "docid": "848fc62bca3e752d9e51f320a9c624b0", "score": "0.53729886", "text": "func (r *AliexpressSolutionProductInfoGetAPIRequest) SetProductId(_productId int64) error {\n\tr._productId = _productId\n\tr.Set(\"product_id\", _productId)\n\treturn nil\n}", "title": "" }, { "docid": "aa49495ee47e3c01a32222dce2dbce4c", "score": "0.53724223", "text": "func (this *BootNotificationLog) SetId(id *bson.ObjectId) {\n\tthis.Id = *id\n}", "title": "" }, { "docid": "501dc3e18815879ceff613f3cf4c51a3", "score": "0.53699964", "text": "func (m *HardwareInformation) SetProductName(value *string)() {\n err := m.GetBackingStore().Set(\"productName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3562ee7aeef9b731069022f7073ae244", "score": "0.5366762", "text": "func (s *QuickFindSet) SetID(element, id int) {\n\ts.ids[element] = id\n}", "title": "" }, { "docid": "8b952850d969d48ebadd8de4a25fcdaa", "score": "0.5356066", "text": "func (s *MarketplaceInformation) SetProductId(v string) *MarketplaceInformation {\n\ts.ProductId = &v\n\treturn s\n}", "title": "" }, { "docid": "1c3339d4e1e5a0403501c0af8d8941fa", "score": "0.5355136", "text": "func (s *ProductCode) SetProductCodeId(v string) *ProductCode {\n\ts.ProductCodeId = &v\n\treturn s\n}", "title": "" }, { "docid": "19679120fc9e71d9a95a2832da97b2a1", "score": "0.5342127", "text": "func (b *RelatedResourceBuilder) Product(value string) *RelatedResourceBuilder {\n\tb.product = value\n\tb.bitmap_ |= 32\n\treturn b\n}", "title": "" }, { "docid": "7fd6b44f795955204f84bc4f75b28da2", "score": "0.5336444", "text": "func (d *DocumentBase) SetId(id bson.ObjectId) {\n\td.Id = id\n}", "title": "" }, { "docid": "e6aeed21ce0d975cc288a50bb9805bc4", "score": "0.53125775", "text": "func (be *BaseEntity) setID(eid uint) { be.id = eid }", "title": "" }, { "docid": "b8a47939123ccbaa3a28d7df6a74d3f3", "score": "0.5301934", "text": "func (key *KMS) SetID(newID string) {\n\tkey.ID = newID\n}", "title": "" }, { "docid": "932a9cd84428ff2d78b7a98b721cffb9", "score": "0.5295511", "text": "func (u RatingUpdater) SetID(ID int64) RatingUpdater {\n\tu.fields[string(RatingDBSchema.ID)] = ID\n\treturn u\n}", "title": "" }, { "docid": "a0bbffeb54d127cc90c0c6fcb71b5995", "score": "0.52915883", "text": "func SetResourceID(resource interface{}, newID string) {\n\treflect.ValueOf(resource).Elem().FieldByName(\"Id\").SetString(newID)\n}", "title": "" }, { "docid": "2e0d7084c108ddb5e5eaae9f6024bc18", "score": "0.52832454", "text": "func (m *SalesInvoice) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c367eeaf7e119a18e98283a4d7f18311", "score": "0.5281749", "text": "func withProduct(node *Product) productOption {\n\treturn func(m *ProductMutation) {\n\t\tm.oldValue = func(context.Context) (*Product, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "c367eeaf7e119a18e98283a4d7f18311", "score": "0.5281749", "text": "func withProduct(node *Product) productOption {\n\treturn func(m *ProductMutation) {\n\t\tm.oldValue = func(context.Context) (*Product, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "1059106aa0f802d526a43612452a70cb", "score": "0.5268371", "text": "func (this *Alldifferent) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "title": "" }, { "docid": "7154d24093c82a2d9bee4b313ca8ad24", "score": "0.52544034", "text": "func GetProduct(product *model.Product, id string) (err error) {\r\n\tif err := config.DB.Where(\"id = ?\", id).First(product).Error; err != nil {\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "4621ae9810d6f63ee4717ef7d1f39a68", "score": "0.52434087", "text": "func (proxy *XdgToplevel) SetAppID(connection Connection, aAppID string) (err error) {\n\trequest := XdgToplevelSetAppIDRequest{\n\t\tAppID: aAppID,\n\t}\n\terr = connection.SendRequest(proxy.id, &request)\n\treturn\n}", "title": "" }, { "docid": "8216dcd088283db4d84e44f61c149935", "score": "0.5231412", "text": "func (nc *NoteCreate) SetID(si schema.NoteID) *NoteCreate {\n\tnc.mutation.SetID(si)\n\treturn nc\n}", "title": "" }, { "docid": "cdf8eca9d4370edc9aacaa7a1b6b8c19", "score": "0.52235526", "text": "func (d DemoJSONBase) SetID(id string) {\n\t*d.ID = id\n}", "title": "" }, { "docid": "53948f311c3377a2a5ff1d6b8b5e4d4e", "score": "0.52210987", "text": "func (repository *Repository) UpdateProductDataByID(ID string, newData string) error {\n\tstmt, err := repository.database.Prepare(\"UPDATE products SET data = $2 WHERE ID LIKE $1;\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = stmt.Exec(ID, newData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1fbd326b7d28981cd0a9a1fc7a9f022", "score": "0.5212457", "text": "func (o *PutCatalogsByIDCategoriesByIDProductsByIDParams) WithProductID(productID string) *PutCatalogsByIDCategoriesByIDProductsByIDParams {\n\to.SetProductID(productID)\n\treturn o\n}", "title": "" }, { "docid": "eafa690a642d26c7178e7c6b6095fc29", "score": "0.52093244", "text": "func (o *Brand) SetProducts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Product) error {\n\tquery := \"update \\\"product\\\" set \\\"brand_id\\\" = null where \\\"brand_id\\\" = $1\"\n\tvalues := []interface{}{o.ID}\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.Products {\n\t\t\tqueries.SetScanner(&rel.BrandID, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.Brand = nil\n\t\t}\n\n\t\to.R.Products = nil\n\t}\n\treturn o.AddProducts(ctx, exec, insert, related...)\n}", "title": "" }, { "docid": "1ef4e19c01e5e86be2caeb13c620c48b", "score": "0.52085286", "text": "func (o *SharedCatalogProductManagementV1AssignProductsPostParams) WithID(id int64) *SharedCatalogProductManagementV1AssignProductsPostParams {\n\to.SetID(id)\n\treturn o\n}", "title": "" }, { "docid": "ed2e573624eb18aa46ed7a77f0db5035", "score": "0.51799214", "text": "func SetBundleID(ctx context.Context, id string) context.Context {\n\t// Checking for *beamCtx is an optimization, so we don't dig deeply\n\t// for ids if not necessary.\n\tif bctx, ok := ctx.(*beamCtx); ok {\n\t\treturn &beamCtx{Context: bctx.Context, bundleID: id, ptransformID: bctx.ptransformID}\n\t}\n\treturn &beamCtx{Context: ctx, bundleID: id}\n}", "title": "" }, { "docid": "bb9187210cbe0e677525e557c12167f6", "score": "0.5174239", "text": "func (this *XplusYneqZ) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "title": "" }, { "docid": "1b8d6e3fcbe0333f89d97609b5ffa8c5", "score": "0.51732063", "text": "func (options *ReplaceCatalogOptions) SetID(id string) *ReplaceCatalogOptions {\n\toptions.ID = core.StringPtr(id)\n\treturn options\n}", "title": "" }, { "docid": "2e49a4ef318406207fb183760a500b52", "score": "0.51643527", "text": "func (bundle *Bundle) setBundleID(id string) {\n\tbundle.BundleID = id\n\tbundle.BundleDescriptor.ID = id\n}", "title": "" }, { "docid": "94f94125967cffdb9e1573a81bba8078", "score": "0.5158395", "text": "func PatchProduct(app *app.App) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tid, _ := strconv.Atoi(vars[\"id\"])\n\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tWriteErrors(w, FieldErrors{{\"read body\", ErrFormatInvalid}})\n\t\t\treturn\n\t\t}\n\n\t\tvar params model.Product\n\t\tif err := json.Unmarshal(body, &params); err != nil {\n\t\t\tWriteErrors(w, FieldErrors{{\"unmarshal body\", ErrFormatInvalid}})\n\t\t\treturn\n\t\t}\n\n\t\tstore := app.Store\n\n\t\t// check existing of product\n\t\tproduct, err := store.GetProductByID(id)\n\t\tif err != nil {\n\t\t\tWriteErrors(w, FieldErrors{{\"retrieve product\", ErrNotFound}})\n\t\t\treturn\n\t\t}\n\n\t\t// update\n\t\tproduct.Name = params.Name\n\t\tif err := store.UpdateProduct(product); err != nil {\n\t\t\tWriteErrors(w, FieldErrors{{\"update product\", ErrNotFound}})\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "title": "" }, { "docid": "022a48e00b018bf532365713fd374f5e", "score": "0.51576555", "text": "func DeleteProduct(product *model.Product, id string) (err error) {\r\n\tconfig.DB.Where(\"id = ?\", id).Delete(product)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "b3f03e06c9d745fde152e17299221a66", "score": "0.5153976", "text": "func (tx *Transaction) SetID() {\n\tvar buffer bytes.Buffer\n\tvar hash [32]byte\n\n\t// create encoder on res bytes buffer\n\tencoder := gob.NewEncoder(&buffer)\n\n\t// use encoder to encode transaction into byte slice\n\terr := encoder.Encode(tx)\n\tif err != nil {\n\t\tlog.Panicf(\"Unable to encode block structure into byte slice: %s\", err.Error())\n\t}\n\n\t// convert byte slice from buffer into a hash\n\thash = sha256.Sum256(buffer.Bytes())\n\n\t// update transaction with generated hash\n\ttx.ID = hash[:]\n}", "title": "" }, { "docid": "dfffbfaae675ab820d55f7316339e1f3", "score": "0.51448166", "text": "func (k Keeper) SetPlanID(ctx sdk.Context, planID uint64) {\n\tstore := ctx.KVStore(k.storeKey)\n\tstore.Set(types.PlanIDKey, types.GetPlanIDBytes(planID))\n}", "title": "" }, { "docid": "c5163edc9a21116ff91aa9a5f63bdd6e", "score": "0.5132666", "text": "func (o *GetDevicesEroutersIDNetflowParams) SetID(id string) {\n\to.ID = id\n}", "title": "" }, { "docid": "6043eb3886b13fc0e4af73e93e593bd8", "score": "0.5129923", "text": "func (o *PriceInformationDto) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "83f2595b69394d3d0fa4d3b147980f4a", "score": "0.5123114", "text": "func (dc *DeliveryCreate) SetOrderID(id int) *DeliveryCreate {\n\tdc.mutation.SetOrderID(id)\n\treturn dc\n}", "title": "" }, { "docid": "4ed8e535882c5fbeac0169f0f7b1e56a", "score": "0.5117739", "text": "func (c *RedisClient) ChangeProductPrice(productID int, price float32, gateWayClient *GateWayClient) {\n\n\tpositions := *c.FindProducts(productID)\n\tfor _, position := range positions {\n\n\t\telement, _ := c.GetCartElement(position.CustomerID, position.ElementID)\n\t\telement.UnitPrice = price\n\t\tc.ModifyCartElement(position.CustomerID, position.ElementID, element, gateWayClient)\n\n\t}\n\n}", "title": "" }, { "docid": "a3c9abf61c7abc89c83219efab88428a", "score": "0.5117483", "text": "func (g *Category) SetProducts(db dbr.SessionRunner, items ...*Product) (sql.Result, error) {\n\tif res, err := g.UnlinkAllProducts(db); err != nil {\n\t\treturn res, err\n\t}\n\treturn g.LinkWithProducts(db, items...)\n}", "title": "" }, { "docid": "64cfbdf419a1f53e298dac1bab876005", "score": "0.511685", "text": "func (p *Products) UpdateProduct(w http.ResponseWriter, r *http.Request) {\n\tp.l.Println(\"Handle PUT Product\")\n\n\t// fetch the product from the context\n\tprod := r.Context().Value(KeyProduct{}).(data.Product)\n\tp.l.Println(\"[DEBUG] updating record id\", prod.ID)\n\n\terr := data.UpdateProduct(prod)\n\tif err == data.ErrProductNotFound {\n\t\tp.l.Println(\"[ERROR] product not found\", err)\n\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tdata.ToJSON(&GenericError{Message: \"Product not found in the DB\"}, w)\n\t\treturn\n\t}\n\n\t// write the no content success header\n\tp.l.Printf(\"[DEBUG] Updated product: %#v\\n\", prod)\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "1f1038916692114d10e27e3d75edf082", "score": "0.5113656", "text": "func (this *Sum) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "title": "" }, { "docid": "dfc1315fa940ca59f1ef52f6bf704037", "score": "0.51123965", "text": "func (u *Apply) SetID(id string) error {\n\tu.ID = id\n\treturn nil\n}", "title": "" }, { "docid": "208b973ba35ca0498aa3a980198e706d", "score": "0.5109293", "text": "func (r *ProductRepository) ProductByID(id string) (*product.Product, error) {\n\tvar pb productBuilder\n\trow := r.db.QueryRow(\"SELECT id, store_id, category_id, name, price, description, quantity FROM products WHERE id = ?\", id)\n\treturn pb.build(row)\n}", "title": "" }, { "docid": "b59925cb8fa9c48a299326357b38d135", "score": "0.5092559", "text": "func (m *Company) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "bb5183177c1fc2c70397a5a973d48521", "score": "0.5089485", "text": "func (pc *ProductCreate) SetNameProduct(s string) *ProductCreate {\n\tpc.mutation.SetNameProduct(s)\n\treturn pc\n}", "title": "" } ]
9ceab82178dfcb75263dde8ef63da538
P2min dimension p2min in according to table 3.3 EN199318
[ { "docid": "c27de7b7099096ed10afdb36ba4b725d", "score": "0.7607446", "text": "func (d Distance) P2min() Dimension {\n\treturn Dimension(float64(d.b.Do().Value()) * 2.4)\n}", "title": "" } ]
[ { "docid": "4c5dd42057e434f5b4459e1052f5a736", "score": "0.64237887", "text": "func (d Distance) E2min() Dimension {\n\treturn Dimension(float64(d.b.Do().Value()) * 1.2)\n}", "title": "" }, { "docid": "7b532c98526891167e33b9f0beed96d0", "score": "0.63107216", "text": "func (d Distance) P1min() Dimension {\n\treturn Dimension(float64(d.b.Do().Value()) * 2.2)\n}", "title": "" }, { "docid": "df129f8f6c2d131cbb94144bd263538b", "score": "0.5871955", "text": "func main() {\n\tgrid := [][]int{\n\t\t[]int{1, 3, 1},\n\t\t[]int{1, 5, 1},\n\t\t[]int{4, 2, 1},\n\t}\n\tutil.Print2DArray(grid)\n\tfmt.Println(mldp2(grid))\n\tfmt.Println(minPathSum(grid))\n}", "title": "" }, { "docid": "68a1d21cafb91965f37183dc3bb06162", "score": "0.5861435", "text": "func GetStartP2_1() *[19][19]uint8 {\n\tvar b [19][19]uint8\n\n\t// set P1 on the board\n\tb[9][10] = 1\n\n\t// set P2 on the board\n\tb[9][9] = 2\n\tb[9][8] = 2\n\n\treturn &b\n}", "title": "" }, { "docid": "069e1130566b1c10eda824a3f20a43ed", "score": "0.5814099", "text": "func (d Distance) P2max() Dimension {\n\treturn Dimension(math.Min(14.0*float64(d.thk), 200.0e-3))\n}", "title": "" }, { "docid": "2fb9c1e2bac0e442fb1991cb908096db", "score": "0.5812673", "text": "func GetStartP2_2() *[19][19]uint8 {\n\tvar b [19][19]uint8\n\n\t// set P1 on the board\n\tb[8][7] = 1\n\tb[10][7] = 1\n\tb[9][9] = 1\n\n\t// set P2 on the board\n\tb[10][9] = 2\n\tb[9][8] = 2\n\n\treturn &b\n}", "title": "" }, { "docid": "77f69d1ed2cdb2dbd76ae51e70b54203", "score": "0.57170665", "text": "func Min2(v1 Vector, v2 Vector) Vector {\n\treturn Vector{Min(v1.X, v2.X), Min(v1.Y, v2.Y)}\n}", "title": "" }, { "docid": "220aa6a8b82905bd698fa234ce2faec6", "score": "0.5508558", "text": "func Min(x, y float64) float64", "title": "" }, { "docid": "fcf8bcbfb00c6130e74b23e910389334", "score": "0.5491631", "text": "func Min2(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "3c4f986dd6b656bbd889e5700d1006f6", "score": "0.5461515", "text": "func (d Distance) P1imax() Dimension {\n\treturn Dimension(math.Min(28.0*float64(d.thk), 400.0e-3))\n}", "title": "" }, { "docid": "9abede57b90b862f9083a9e7c920a265", "score": "0.5454069", "text": "func (p path) Min() (float64, float64, float64) {\n\treturn p.minXYZ.X, p.minXYZ.Y, p.minXYZ.Z\n}", "title": "" }, { "docid": "ec936edebefc0bd4dffd95daeabf7fe2", "score": "0.5403983", "text": "func (s *Solution2) Min() int {\n\treturn s.min\n}", "title": "" }, { "docid": "cdf93f99e0233f975e782d163524d80e", "score": "0.5393315", "text": "func (d Distance) P1max() Dimension {\n\treturn Dimension(math.Min(14.0*float64(d.thk), 200.0e-3))\n}", "title": "" }, { "docid": "978e2a07f4477fc7f67fac49012f392b", "score": "0.5389314", "text": "func (n *Component_OpticalChannel_SecondOrderPolarizationModeDispersion) Min() *Component_OpticalChannel_SecondOrderPolarizationModeDispersion_Min {\n\treturn &Component_OpticalChannel_SecondOrderPolarizationModeDispersion_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "978e2a07f4477fc7f67fac49012f392b", "score": "0.5389223", "text": "func (n *Component_OpticalChannel_SecondOrderPolarizationModeDispersion) Min() *Component_OpticalChannel_SecondOrderPolarizationModeDispersion_Min {\n\treturn &Component_OpticalChannel_SecondOrderPolarizationModeDispersion_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cf530564c7a2f9ea992d6db720fd3759", "score": "0.53849024", "text": "func Part2(m *FloorMap) uint64 {\n\tlows := m.LowPoints()\n\tbasins := make([]uint64, len(lows))\n\n\tfor i, j := range lows {\n\t\tbasins[i] = m.FindBasin(j)\n\t}\n\n\tsort.Slice(basins, func(i, j int) bool { return basins[i] > basins[j] })\n\n\treturn basins[0] * basins[1] * basins[2]\n}", "title": "" }, { "docid": "a04239e004b519e4484642ccfc8eb88d", "score": "0.53817403", "text": "func minM(min int) int {\n\tm1, m2 := sqrt(min/2), sqrt(min-1)\n\treturn minimum(m1, m2)\n}", "title": "" }, { "docid": "8db9dd37e376476abb6a827ccbe108db", "score": "0.5373568", "text": "func min(p1, p2 int) int {\n\tif p1 > p2 {\n\t\tp1 = p2\n\t}\n\treturn p1\n}", "title": "" }, { "docid": "bbfb273c6c9986658e403c83288cd191", "score": "0.5349908", "text": "func minMulti(price *[5][5]optimal, array []matrix, start int, end int, calc *int) int {\n\n\tcount := 0\n min := MaxInt\n\n if start == end {\n return 0\n }\n\n\tfor i := start; i < end; i++ {\n\t\tcount = minMulti(price, array, start, i, calc) +\n minMulti(price, array, i+1, end, calc) +\n array[start].row * array[i].column * array[end].column\n\n\t\t*calc++\n\t\tif count < min {\n\t\t\tmin = count\n price[start][end].start = start+1\n price[start][end].k = i+1\n price[start][end].end = end+1\n\t\t\tprice[start][end].val = count\n\t\t}\n\t}\n\n\treturn min\n}", "title": "" }, { "docid": "ad0f065136a59c86fbca76872cb38dea", "score": "0.53369457", "text": "func (d Distance) E1min() Dimension {\n\treturn Dimension(float64(d.b.Do().Value()) * 1.2)\n}", "title": "" }, { "docid": "442ebb398301c8f49558d14455e514e1", "score": "0.5313658", "text": "func (s RectangleSection) Jmin() float64 {\n\treturn s.convert().Jmin()\n}", "title": "" }, { "docid": "66542422337ee6ab74904420ccafe1c0", "score": "0.5285963", "text": "func (v *Vector2) Min(src *Vector2) *Vector2 {\n\tv.p.Call(\"min\", src.p)\n\treturn v\n}", "title": "" }, { "docid": "2f5b5d0cef4fe4b48aec9f2e0fc5f180", "score": "0.526003", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower) Min() *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2f5b5d0cef4fe4b48aec9f2e0fc5f180", "score": "0.5257575", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower) Min() *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1e21aa756c0ec6e4e2cdab13d7cb3876", "score": "0.51678103", "text": "func Min(p, c int64) int64 {\n\tif c < p {\n\t\treturn c\n\t}\n\treturn p\n}", "title": "" }, { "docid": "ac2d1dff424922a89ae297baa6f76f36", "score": "0.515831", "text": "func (h *hrxHHrxTab) sMinMax() (float64, float64, float64, float64) {\n\tvar (\n\t\tsums [4]float64\n\n\t\tnums = make(engine.Nums, 0, h.m)\n\t\tkombinaciaMin = make([]int, h.n)\n\t\tkombinaciaMax = make([]int, h.n)\n\n\t\tzS2min = make(map[int]bool, h.m)\n\t\tzS2max = make(map[int]bool, h.m)\n\t\tzS1min = make(map[int]bool, h.m)\n\t\tzS1max = make(map[int]bool, h.m)\n\t)\n\n\tfor _, t := range h.Xcisla {\n\t\tnums = append(nums, h.HrxNums[t.Sk]...)\n\t}\n\tnums.Sort()\n\tfor i := 0; i < h.n; i++ {\n\t\tkombinaciaMin[i] = nums[i].Cislo()\n\t\tkombinaciaMax[h.n-1-i] = nums[len(nums)-1-i].Cislo()\n\t}\n\n\tfor i := 0; i < h.n; i++ {\n\t\tvar (\n\t\t\tz [4]int\n\t\t\ts1Min float64 = 1\n\t\t\ts1Max float64\n\t\t\ts2Min float64 = 1\n\t\t\ts2Max float64\n\t\t)\n\t\tfor _, n2 := range nums {\n\t\t\tif !n2.HasSTL(i) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif n2.Cislo() >= kombinaciaMin[i] && n2.Cislo() <= kombinaciaMax[i] {\n\t\t\t\t// STL OD-DO\n\t\t\t\tif n2.SNext(i+1) < s2Min && !zS2min[n2.Cislo()] {\n\t\t\t\t\ts2Min = n2.SNext(i + 1)\n\t\t\t\t\tz[2] = n2.Cislo()\n\t\t\t\t}\n\t\t\t\tif n2.SNext(i+1) > s2Max && !zS2max[n2.Cislo()] {\n\t\t\t\t\ts2Max = n2.SNext(i + 1)\n\t\t\t\t\tz[3] = n2.Cislo()\n\t\t\t\t}\n\n\t\t\t\tn1 := h.HHrx.GetNum(n2.Cislo())\n\t\t\t\tif n1.SNext(i+1) < s1Min && !zS1min[n2.Cislo()] {\n\t\t\t\t\ts1Min = n1.SNext(i + 1)\n\t\t\t\t\tz[0] = n2.Cislo()\n\t\t\t\t}\n\t\t\t\tif n1.SNext(i+1) > s1Max && !zS1max[n2.Cislo()] {\n\t\t\t\t\ts1Max = n1.SNext(i + 1)\n\t\t\t\t\tz[1] = n2.Cislo()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tzS1min[z[0]] = true\n\t\tzS1max[z[1]] = true\n\t\tzS2min[z[2]] = true\n\t\tzS2max[z[3]] = true\n\n\t\tsums[0] += s1Min\n\t\tsums[1] += s1Max\n\t\tsums[2] += s2Min\n\t\tsums[3] += s2Max\n\t}\n\treturn sums[0], sums[1], sums[2], sums[3]\n}", "title": "" }, { "docid": "8558409e8d91252da592dc897c28b002", "score": "0.5155148", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower) Min() *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8558409e8d91252da592dc897c28b002", "score": "0.51549494", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower) Min() *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c07f9da11dba8da8f13a6cd323525adb", "score": "0.51518965", "text": "func (h *Grid) ColMin() int { return -h.horizontalIndexOffset() }", "title": "" }, { "docid": "48ec948aa4a05385bc52e2b1a293482c", "score": "0.51450914", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerCBand) Min() *OpticalAmplifier_Amplifier_InputPowerCBand_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerCBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "48ec948aa4a05385bc52e2b1a293482c", "score": "0.5144722", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerCBand) Min() *OpticalAmplifier_Amplifier_InputPowerCBand_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerCBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7fbb7ce1df3c0f738f1038a640bee88e", "score": "0.5118161", "text": "func minCostToMoveChips(position []int) int {\n\todd, even := 0, 0\n\tfor _, point := range position {\n\t\tif point%2 == 0 {\n\t\t\teven++\n\t\t} else {\n\t\t\todd++\n\t\t}\n\t}\n\treturn utils.Min(odd, even)\n}", "title": "" }, { "docid": "388d056a5000ed4feffd78e6ced9a898", "score": "0.51051056", "text": "func (n *Aps_ApsModule_Ports_CommonIn_OpticalPower) Min() *Aps_ApsModule_Ports_CommonIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_CommonIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "388d056a5000ed4feffd78e6ced9a898", "score": "0.51051056", "text": "func (n *Aps_ApsModule_Ports_CommonIn_OpticalPower) Min() *Aps_ApsModule_Ports_CommonIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_CommonIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3abdb97582cd6980511ef5924e243e1d", "score": "0.50938565", "text": "func minMaxDist(x, y, z float64, r d3rectT) float64 {\n\n\tp := [3]float64{x, y, z}\n\trp := [3]float64{\n\t\tfloat64(r.min[0]), float64(r.min[1]), float64(r.min[2]),\n\t}\n\trq := [3]float64{\n\t\tfloat64(r.max[0]), float64(r.max[1]), float64(r.max[2]),\n\t}\n\n\t// by definition, MinMaxDist(p, r) =\n\t// min{1<=k<=n}(|pk - rmk|^2 + sum{1<=i<=n, i != k}(|pi - rMi|^2))\n\t// where rmk and rMk are defined as follows:\n\n\trm := func(k int) float64 {\n\t\tif p[k] <= (rp[k]+rq[k])/2 {\n\t\t\treturn rp[k]\n\t\t}\n\t\treturn rq[k]\n\t}\n\n\trM := func(k int) float64 {\n\t\tif p[k] >= (rp[k]+rq[k])/2 {\n\t\t\treturn rp[k]\n\t\t}\n\t\treturn rq[k]\n\t}\n\n\t// This formula can be computed in linear time by precomputing\n\t// S = sum{1<=i<=n}(|pi - rMi|^2).\n\n\tS := 0.0\n\tfor i := range p {\n\t\td := p[i] - rM(i)\n\t\tS += d * d\n\t}\n\n\t// Compute MinMaxDist using the precomputed S.\n\tmin := math.MaxFloat64\n\tfor k := range p {\n\t\td1 := p[k] - rM(k)\n\t\td2 := p[k] - rm(k)\n\t\td := S - d1*d1 + d2*d2\n\t\tif d < min {\n\t\t\tmin = d\n\t\t}\n\t}\n\n\treturn min\n}", "title": "" }, { "docid": "2125d36c578e094cd56b5c03158de8ef", "score": "0.5090329", "text": "func (n *Component_Port_OpticalPort_InputPower) Min() *Component_Port_OpticalPort_InputPower_Min {\n\treturn &Component_Port_OpticalPort_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2125d36c578e094cd56b5c03158de8ef", "score": "0.50890046", "text": "func (n *Component_Port_OpticalPort_InputPower) Min() *Component_Port_OpticalPort_InputPower_Min {\n\treturn &Component_Port_OpticalPort_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "80625d1fc614fcf7812f1feb7d27024a", "score": "0.50731915", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerLBand) Min() *OpticalAmplifier_Amplifier_InputPowerLBand_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerLBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6e07bb1bff246461716027b5f4bce6c3", "score": "0.50724316", "text": "func rboMin(a, b rankings.SERP, p float64, depth int) float64 {\n\tif depth == 0 {\n\t\tdepth = min(a.Length(), b.Length())\n\t}\n\n\txk := overlap(a, b, depth)\n\tlogTerm := xk * math.Log(1-p)\n\tvar sumTerm float64\n\tfor d := 1.0; d < float64(depth)+1.0; d++ {\n\t\to := overlap(a, b, int(d)) - xk\n\t\tval := math.Pow(p, d) / d * o\n\t\tsumTerm += val\n\t}\n\n\treturn (1 - p) / p * (sumTerm - logTerm)\n}", "title": "" }, { "docid": "80625d1fc614fcf7812f1feb7d27024a", "score": "0.50718296", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerLBand) Min() *OpticalAmplifier_Amplifier_InputPowerLBand_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerLBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "06ca88230e2cc601388ac26049bccb21", "score": "0.506272", "text": "func GetSimpleP2() *[19][19]uint8 {\n\tvar b [19][19]uint8\n\n\t// set P1 on the board\n\tb[9][7] = 1\n\tb[9][8] = 1\n\n\t// set P2 on the board\n\tb[9][9] = 2\n\tb[10][8] = 2\n\tb[8][10] = 2\n\treturn &b\n}", "title": "" }, { "docid": "d64d890c4c74963dabe917a94eade0ea", "score": "0.50617254", "text": "func (n *OpticalAmplifier_Amplifier_OutputPowerCBand) Min() *OpticalAmplifier_Amplifier_OutputPowerCBand_Min {\n\treturn &OpticalAmplifier_Amplifier_OutputPowerCBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d64d890c4c74963dabe917a94eade0ea", "score": "0.5061703", "text": "func (n *OpticalAmplifier_Amplifier_OutputPowerCBand) Min() *OpticalAmplifier_Amplifier_OutputPowerCBand_Min {\n\treturn &OpticalAmplifier_Amplifier_OutputPowerCBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6b2d9dfdeb9c878921bf52d49a524426", "score": "0.5061134", "text": "func (h *hrxHHrxTab) minimum(n, smax, ssize int) int {\n\tmin := ssize - n - smax\n\tif min >= 0 {\n\t\tmin = 0\n\t} else {\n\t\tmin = -min\n\t}\n\treturn min\n}", "title": "" }, { "docid": "4f62af229778f6e09439edd7d2ff55ff", "score": "0.5049888", "text": "func nextStep(grid [][]int, y, x int) (minY, minX int) {\n\tmin := grid[y][x]\n\tif min == 1 {\n\t\treturn y, x\n\t}\n\t// Look to the right\n\tif x < len(grid[y])-1 {\n\t\tif grid[y][x+1] > 0 && grid[y][x+1] < min {\n\t\t\tmin, minY, minX = grid[y][x+1], y, x+1\n\t\t}\n\t}\n\t// Look below\n\tif y < len(grid)-1 {\n\t\tif grid[y+1][x] > 0 && grid[y+1][x] < min {\n\t\t\tmin, minY, minX = grid[y+1][x], y+1, x\n\t\t}\n\t}\n\t// Look to the left\n\tif x > 0 {\n\t\tif grid[y][x-1] > 0 && grid[y][x-1] < min {\n\t\t\tmin, minY, minX = grid[y][x-1], y, x-1\n\t\t}\n\t}\n\t// Look up\n\tif y > 0 {\n\t\tif grid[y-1][x] != 0 && grid[y-1][x] < min {\n\t\t\tmin, minY, minX = grid[y-1][x], y-1, x\n\t\t}\n\t}\n\treturn minY, minX\n}", "title": "" }, { "docid": "9dda202d0172736489570fbec88adb86", "score": "0.5048529", "text": "func MinOffset(d1, d2 Diagonal) Diagonal {\n if d1 < d2 { return d1 } else { return d2 }\n}", "title": "" }, { "docid": "94fe8b8de9338caec6a1a3ac5ecd1aba", "score": "0.5045949", "text": "func (v Vec2) Min(v1 Vec2) Vec2 {\n\tvar res Vec2\n\tfor i, a := range v {\n\t\tb := v1[i]\n\t\tres[i] = math.Min(a, b)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "60e6ccfeaa3fdf460a9078e9637b718a", "score": "0.5038896", "text": "func minEatingSpeed2(piles []int, h int) int {\n\tl, r := 1, max(piles)\n\tres := r\n\n\tfor l <= r {\n\t\tmid := l + (r-l)/2\n\t\tcurr := 0\n\t\tfor _, el := range piles {\n\t\t\tcurr += int(math.Ceil(float64(el) / float64(mid)))\n\t\t\tif curr > h {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif curr > h {\n\t\t\tl = mid + 1\n\t\t} else {\n\t\t\tif mid < res {\n\t\t\t\tres = mid\n\t\t\t}\n\t\t\tr = mid - 1\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9bbe306885763bfbed18ede3388b2e3a", "score": "0.5021485", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPowerAny) Min() *Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_MinAny {\n\treturn &Aps_ApsModule_Ports_LineSecondaryIn_OpticalPower_MinAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f287806e73ae8794327001d7aa571ff0", "score": "0.50197303", "text": "func (pv Parameter) Min() (float64, bool) {\n\treturn pv.min, pv.wmin\n}", "title": "" }, { "docid": "3a7c9f82e12213d72fac58c03cc0d3a4", "score": "0.50197095", "text": "func Prim(g *AMGraph, closedge []element, v int) {\n\tk := locateVex(g, v)\n\tfor i := 0; i < g.vexnum; i++ {\n\t\tif i != k {\n\t\t\tclosedge[i] = element{v, g.arcs[k][i]}\n\t\t}\n\t}\n\tclosedge[k].lowcost = 0\n\tfor i := 1; i < g.vexnum; i++ {\n\t\tk = minimumCost(closedge)\n\t\t// println(k)\n\t\tu0, v0 := closedge[k].adjvex, g.vexs[k]\n\t\t// fmt.Println(closedge)\n\t\tfmt.Printf(\"%d<->%d\\n\", u0, v0)\n\t\tclosedge[k].lowcost = 0\n\t\tfor j := 0; j < g.vexnum; j++ {\n\t\t\tif g.arcs[k][j] == -1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif g.arcs[k][j] < closedge[j].lowcost || closedge[j].lowcost == -1 {\n\t\t\t\t// fmt.Println(g.arcs[k][j], closedge[j].lowcost)\n\t\t\t\tclosedge[j] = element{g.vexs[k], g.arcs[k][j]}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5f077bcccfc94a45e2325044ac476e35", "score": "0.5019384", "text": "func findMinMax(nanobots []Nanobot) (min, max P) {\n\tmin = P{1 << 31, 1 << 31, 1 << 31}\n\tmax = P{-1 << 31, -1 << 31, -1 << 31}\n\tfor _, nano := range nanobots {\n\t\tif nano.C.X < min.X {\n\t\t\tmin.X = nano.C.X\n\t\t}\n\t\tif nano.C.Y < min.Y {\n\t\t\tmin.Y = nano.C.Y\n\t\t}\n\t\tif nano.C.Z < min.Z {\n\t\t\tmin.Z = nano.C.Z\n\t\t}\n\t\tif nano.C.X > max.X {\n\t\t\tmax.X = nano.C.X\n\t\t}\n\t\tif nano.C.Y > max.Y {\n\t\t\tmax.Y = nano.C.Y\n\t\t}\n\t\tif nano.C.Z > max.Z {\n\t\t\tmax.Z = nano.C.Z\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0831877b32d7b1a3497adff692c7f8c5", "score": "0.5004389", "text": "func (n *OpticalAmplifier_Amplifier_OutputPowerLBand) Min() *OpticalAmplifier_Amplifier_OutputPowerLBand_Min {\n\treturn &OpticalAmplifier_Amplifier_OutputPowerLBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0831877b32d7b1a3497adff692c7f8c5", "score": "0.50033224", "text": "func (n *OpticalAmplifier_Amplifier_OutputPowerLBand) Min() *OpticalAmplifier_Amplifier_OutputPowerLBand_Min {\n\treturn &OpticalAmplifier_Amplifier_OutputPowerLBand_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bce784c53f943659eae1797fa346f330", "score": "0.5002391", "text": "func Part2(field *Field, station Point, goalIndex int) int {\n\tvaporized := Vaporize(field, station)\n\n\tif len(vaporized)-1 < goalIndex {\n\t\tpanic(\"no asteroids vaporized?\")\n\t}\n\n\tgoal := vaporized[goalIndex]\n\treturn goal.X*100 + goal.Y\n}", "title": "" }, { "docid": "6a30abd79c89b6afc6dcdee43c07f9f1", "score": "0.49915895", "text": "func (n *Component_Port_OpticalPort_OutputPower) Min() *Component_Port_OpticalPort_OutputPower_Min {\n\treturn &Component_Port_OpticalPort_OutputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6a30abd79c89b6afc6dcdee43c07f9f1", "score": "0.49914938", "text": "func (n *Component_Port_OpticalPort_OutputPower) Min() *Component_Port_OpticalPort_OutputPower_Min {\n\treturn &Component_Port_OpticalPort_OutputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0fb8d791918bee71dc5f350d6f42dd04", "score": "0.49864504", "text": "func getMinimumCost(k int32, c []int32) int32 {\n\tsorting.QuickSortDesc(c) // sorting by ascending order\n\t// max each will get len(c) % k = bunch size\n\tbunches := (int32(len(c)) % k)\n\n\tvar price int32\n\n\t// calculate cost each bunch\n\tfor i, j := int32(0), int32(len(c)-1); i <= j; i++ { //todo\n\t\t// pick largest, pick smallest till bunch size.\n\t\tfmt.Printf(\"[%d,%d] = %v\\n\", i, j, c)\n\t\tprice += c[i]\n\t\tfmt.Println(price)\n\t\tfor k := int32(1); k <= bunches-1 && i < j; k, j = k+1, j-1 {\n\t\t\tprice += (k + 1) * c[j]\n\t\t\tfmt.Printf(\"[%d,%d] = %v\\n\", i, j, c)\n\t\t\tfmt.Println(price)\n\t\t}\n\t}\n\n\treturn price\n\n}", "title": "" }, { "docid": "0eae60edb343b0d8fe432557286a6551", "score": "0.49853244", "text": "func (n *Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower) Min() *Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0eae60edb343b0d8fe432557286a6551", "score": "0.49832302", "text": "func (n *Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower) Min() *Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LinePrimaryOut_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "777c320052ab716fa345c44dec352b76", "score": "0.49797732", "text": "func (n *Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower) Min() *Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "777c320052ab716fa345c44dec352b76", "score": "0.4979741", "text": "func (n *Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower) Min() *Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_LinePrimaryIn_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f195b5c652fddd347fd7c2f745a083fa", "score": "0.49637023", "text": "func Array_min_max_element_01(arr []int) string {\n\n\tminE, maxE := math.MaxInt32,math.MinInt32\n\n\tfor i := 0 ; i < len(arr); i++ {\n\t\tif arr[i] < minE {\n\t\t\tminE = arr[i]\n\t\t}\n\t\tif arr[i] > maxE {\n\t\t\tmaxE = arr[i]\n\t\t}\n\t}\n\n\treturn strconv.Itoa(minE) + \", \" + strconv.Itoa(maxE)\n}", "title": "" }, { "docid": "39c64f9337f57ce612eebf01233764f7", "score": "0.49626517", "text": "func minloc(x []float64) int {\n\n\ti := 0\n\tv := x[0]\n\n\tfor j := 1; j < len(x); j++ {\n\t\tif x[j] < v {\n\t\t\tv = x[j]\n\t\t\ti = j\n\t\t}\n\t}\n\n\treturn i\n}", "title": "" }, { "docid": "9385382d25f9837b3605065e4022458c", "score": "0.49591577", "text": "func RangeMin(arr []int, minTable [][]int, start, end int) int {\n\trangeLen := uint(end - start)\n\tif rangeLen == 0 {\n\t\treturn start\n\t}\n\tvar rangeLevel uint = 0\n\tvar rpower uint\n\tfor rpower = 1; rpower < rangeLen; rpower <<= 1 {\n\t\trangeLevel++\n\t}\n\tif (1 << rangeLevel) == rangeLen {\n\t\treturn minTable[rangeLevel][start]\n\t} else {\n\t\trangeLevel--\n\t\tindexA := minTable[rangeLevel][start]\n\t\tindexB := minTable[rangeLevel][end-(1<<rangeLevel)]\n\t\tif arr[indexA] <= arr[indexB] {\n\t\t\treturn indexA\n\t\t} else {\n\t\t\treturn indexB\n\t\t}\n\t}\n}", "title": "" }, { "docid": "434eecd569b6436921e4028e011b76bd", "score": "0.4953707", "text": "func (n *Component_OpticalChannel_ChromaticDispersion) Min() *Component_OpticalChannel_ChromaticDispersion_Min {\n\treturn &Component_OpticalChannel_ChromaticDispersion_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "434eecd569b6436921e4028e011b76bd", "score": "0.49536332", "text": "func (n *Component_OpticalChannel_ChromaticDispersion) Min() *Component_OpticalChannel_ChromaticDispersion_Min {\n\treturn &Component_OpticalChannel_ChromaticDispersion_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e67431a036fec3641607916fbc7b7c7f", "score": "0.4947306", "text": "func Smallest(dims []int) []int {\n\tsort.Ints(dims)\n\treturn dims[0:2]\n}", "title": "" }, { "docid": "5103e7d7049559e3bf310f05cdc70a55", "score": "0.49472782", "text": "func (n *Component_OpticalChannel_InputPower) Min() *Component_OpticalChannel_InputPower_Min {\n\treturn &Component_OpticalChannel_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5103e7d7049559e3bf310f05cdc70a55", "score": "0.4946656", "text": "func (n *Component_OpticalChannel_InputPower) Min() *Component_OpticalChannel_InputPower_Min {\n\treturn &Component_OpticalChannel_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eb6513d37a25ee564a3e05367e566e12", "score": "0.4943639", "text": "func minimumPasses(m int64, w int64, p int64, n int64) int64 {\n // naieve approach: recursive:\n return MinimumPasses(n, m, w, p)\n}", "title": "" }, { "docid": "5d3fc100dafef8a06d7b11c2cf889ce7", "score": "0.49405396", "text": "func (n *Aps_ApsModule_Ports_CommonOutput_OpticalPower) Min() *Aps_ApsModule_Ports_CommonOutput_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_CommonOutput_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d3fc100dafef8a06d7b11c2cf889ce7", "score": "0.49405396", "text": "func (n *Aps_ApsModule_Ports_CommonOutput_OpticalPower) Min() *Aps_ApsModule_Ports_CommonOutput_OpticalPower_Min {\n\treturn &Aps_ApsModule_Ports_CommonOutput_OpticalPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7a54f98618a3d38d2ae0435503734da8", "score": "0.49302107", "text": "func (wa WurfelClass) MinMax() [2]int64 {\n\tvar min, max int64\n\tfor _, v := range wa {\n\t\tmin += SubMult(v) * (v.Num + ModAdd(v))\n\t\tif v.Sub {\n\t\t\tmax--\n\t\t} else {\n\t\t\tmax += v.Num*v.Typ + ModAdd(v)\n\t\t}\n\t}\n\treturn [2]int64{min, max}\n}", "title": "" }, { "docid": "6f31d637a6ac54d4f77af81c6ce13cd8", "score": "0.4930198", "text": "func Vector3MinAxis(pSelf []Vector3) Int {\n\tcpSelf, _ := unpackArgSVector3(pSelf)\n\t__ret := C.godot_vector3_min_axis(cpSelf)\n\tpackSVector3(pSelf, cpSelf)\n\t__v := (Int)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f308a6754c7b3108d65ca665212907b7", "score": "0.49269262", "text": "func (array sparseDiagF64Matrix) Min() float64 {\n\treturn Min(&array)\n}", "title": "" }, { "docid": "b13aa2d7e77f4bbf6a48c2b9ea341c31", "score": "0.49261254", "text": "func (n *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPowerAny) Min() *Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_MinAny {\n\treturn &Aps_ApsModule_Ports_LineSecondaryOut_OpticalPower_MinAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a176ab318c97b2cadda5e7f1fe00dd7e", "score": "0.49125463", "text": "func minMax(v1 []*decimal.Big, v2 []*decimal.Big) (int, int, []*decimal.Big, int) {\n\tl1 := len(v1)\n\tl2 := len(v2)\n\n\tif l1 < l2 {\n\t\treturn l1, l2, v2, -1\n\t}\n\treturn l2, l1, v1, 1\n}", "title": "" }, { "docid": "4fd190d1399b72f315b0deb5f8426314", "score": "0.49104047", "text": "func Min(ix *etable.IdxView, colNm string) []float64 {\n\tcolIdx := ix.Table.ColIdx(colNm)\n\tif colIdx == -1 {\n\t\treturn nil\n\t}\n\treturn MinIdx(ix, colIdx)\n}", "title": "" }, { "docid": "315853dd1a125e47dff6283baac1cd86", "score": "0.4908844", "text": "func GetStartP1_1() *[19][19]uint8 {\n\tvar b [19][19]uint8\n\n\t// set P1 on the board\n\tb[9][8] = 1\n\n\t// set P2 on the board\n\tb[9][9] = 2\n\n\treturn &b\n}", "title": "" }, { "docid": "df54335a0097bcba44b2dda418b668ed", "score": "0.4906094", "text": "func minRes(dx, dy int) (rdx int, rdy int) {\n\trdx, rdy = dx, dy\n\n\tif rdx == 0 || rdy == 0 {\n\t\treturn\n\t}\n\tfor rdx&1 == 0 && rdy&1 == 0 {\n\t\trdx >>= 1\n\t\trdy >>= 1\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f93e4d9a96503942a76d225ac2005f4", "score": "0.4905934", "text": "func hardMin(clip, sprime float32) float32 {\n\tvar t float32\n\n\tif sprime < 0 {\n\t\tt = -sprime\n\t} else {\n\t\tt = sprime\n\t}\n\n\tif t > clip {\n\t\treturn clip\n\t}\n\n\treturn sprime\n}", "title": "" }, { "docid": "dcfe17b693659430259249368e9d1cdf", "score": "0.4899685", "text": "func minSideJumps(obstacles []int) int {\n\tconst max = int(1e9)\n\tdp := make([][4]int, len(obstacles))\n\tdp[0][1], dp[0][3] = 1, 1 // initial position is at dp[0][2], need one move to dp[0][1] and dp[0][3]\n\tfor i := 1; i < len(dp); i++ {\n\t\tfor j := 1; j <= 3; j++ {\n\t\t\tif obstacles[i] == j { // position[i][j] is obstacle\n\t\t\t\tdp[i][j] = max\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// position[i][j] empty\n\t\t\tif obstacles[i-1] == j { // position[i-1][j] is obstacle\n\t\t\t\tminv := int(1e10)\n\t\t\t\tfor k := 1; k <= 3; k++ {\n\t\t\t\t\t// if position[i][k] and position[i-1][k] both empty\n\t\t\t\t\t// dp[i][j] = dp[i-1][k]+1\n\t\t\t\t\tif obstacles[i-1] != k && obstacles[i] != k {\n\t\t\t\t\t\tminv = min(minv, dp[i-1][k]+1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdp[i][j] = minv\n\t\t\t} else { // position[i-1][j] is empty\n\t\t\t\tdp[i][j] = dp[i-1][j]\n\t\t\t}\n\t\t}\n\t}\n\treturn min(min(dp[len(dp)-1][1], dp[len(dp)-1][2]), dp[len(dp)-1][3])\n}", "title": "" }, { "docid": "e81b989ee6de6f7ec02186b5fb996d15", "score": "0.4886533", "text": "func Dgesc2(n int, a *mat.Matrix, rhs *mat.Vector, ipiv, jpiv *[]int) (scale float64) {\n\tvar bignum, eps, one, smlnum, temp, two float64\n\tvar i, j int\n\n\tone = 1.0\n\ttwo = 2.0\n\n\t// Set constant to control overflow\n\teps = Dlamch(Precision)\n\tsmlnum = Dlamch(SafeMinimum) / eps\n\tbignum = one / smlnum\n\tsmlnum, bignum = Dlabad(smlnum, bignum)\n\n\t// Apply permutations IPIV to RHS\n\tDlaswp(1, rhs.Matrix(a.Rows, opts), 1, n-1, *ipiv, 1)\n\n\t// Solve for L part\n\tfor i = 1; i <= n-1; i++ {\n\t\tfor j = i + 1; j <= n; j++ {\n\t\t\trhs.Set(j-1, rhs.Get(j-1)-a.Get(j-1, i-1)*rhs.Get(i-1))\n\t\t}\n\t}\n\n\t// Solve for U part\n\tscale = one\n\n\t// Check for scaling\n\ti = rhs.Iamax(n, 1)\n\tif two*smlnum*math.Abs(rhs.Get(i-1)) > math.Abs(a.Get(n-1, n-1)) {\n\t\ttemp = (one / two) / math.Abs(rhs.Get(i-1))\n\t\trhs.Scal(n, temp, 1)\n\t\tscale = scale * temp\n\t}\n\n\tfor i = n; i >= 1; i-- {\n\t\ttemp = one / a.Get(i-1, i-1)\n\t\trhs.Set(i-1, rhs.Get(i-1)*temp)\n\t\tfor j = i + 1; j <= n; j++ {\n\t\t\trhs.Set(i-1, rhs.Get(i-1)-rhs.Get(j-1)*(a.Get(i-1, j-1)*temp))\n\t\t}\n\t}\n\n\t// Apply permutations JPIV to the solution (RHS)\n\tDlaswp(1, rhs.Matrix(a.Rows, opts), 1, n-1, *jpiv, -1)\n\n\treturn\n}", "title": "" }, { "docid": "f85757b243fa4be1e8e17b82234b7fda", "score": "0.4880392", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerTotal) Min() *OpticalAmplifier_Amplifier_InputPowerTotal_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerTotal_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f85757b243fa4be1e8e17b82234b7fda", "score": "0.48797616", "text": "func (n *OpticalAmplifier_Amplifier_InputPowerTotal) Min() *OpticalAmplifier_Amplifier_InputPowerTotal_Min {\n\treturn &OpticalAmplifier_Amplifier_InputPowerTotal_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5b997183ca06028a55e3a369fe466a5a", "score": "0.48788983", "text": "func (n *Component_OpticalChannel_LaserBiasCurrent) Min() *Component_OpticalChannel_LaserBiasCurrent_Min {\n\treturn &Component_OpticalChannel_LaserBiasCurrent_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5b997183ca06028a55e3a369fe466a5a", "score": "0.4877951", "text": "func (n *Component_OpticalChannel_LaserBiasCurrent) Min() *Component_OpticalChannel_LaserBiasCurrent_Min {\n\treturn &Component_OpticalChannel_LaserBiasCurrent_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "617182aae22f008117bfc29e9e2f9467", "score": "0.48726797", "text": "func getMaxMinFromDimensionRef(ref string) (minx, miny, maxx, maxy int, err error) {\n\tvar parts []string\n\tparts = strings.Split(ref, \":\")\n\tminx, miny, err = getCoordsFromCellIDString(parts[0])\n\tif err != nil {\n\t\treturn -1, -1, -1, -1, err\n\t}\n\tif len(parts) == 1 {\n\t\tmaxx, maxy = minx, miny\n\t\treturn\n\t}\n\tmaxx, maxy, err = getCoordsFromCellIDString(parts[1])\n\tif err != nil {\n\t\treturn -1, -1, -1, -1, err\n\t}\n\treturn\n}", "title": "" }, { "docid": "ac1e8dac15eb1a1d958c153c1419e73a", "score": "0.48709112", "text": "func (n *OpticalAmplifier_SupervisoryChannel_InputPower) Min() *OpticalAmplifier_SupervisoryChannel_InputPower_Min {\n\treturn &OpticalAmplifier_SupervisoryChannel_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ac1e8dac15eb1a1d958c153c1419e73a", "score": "0.48707268", "text": "func (n *OpticalAmplifier_SupervisoryChannel_InputPower) Min() *OpticalAmplifier_SupervisoryChannel_InputPower_Min {\n\treturn &OpticalAmplifier_SupervisoryChannel_InputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "68a893962527641312a9a6be7d8b1425", "score": "0.48685664", "text": "func E2P(mp []float64, w int) {\n\tfor i := 0; i < len(mp); i++ {\n\t\tmp[i] = 1 - mp[i]*mp[i]/(2*float64(w))\n\t\t// caps pearson correlation to 1 in case there are floating point accumulated errors\n\t\tif mp[i] > 1 {\n\t\t\tmp[i] = 1\n\t\t}\n\t\tif mp[i] < 0 {\n\t\t\tmp[i] = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05957967bd5f0e649c56e834edcc3934", "score": "0.4864931", "text": "func sortWith2Stacks280II(nums []int) []int {\n\tif nums == nil || len(nums) == 0 {\n\t\treturn nums\n\t}\n\tinStack := make([]int, len(nums))\n\tcopy(inStack, nums)\n\tresStack := make([]int, 0)\n\n\tfor len(inStack) > 0 {\n\t\tmin := math.MaxInt64\n\t\tminCount := 0\n\t\t// move all the elements from in stack to result stack\n\t\t// find the min among them\n\t\tfor len(inStack) > 0 {\n\t\t\tnum := inStack[len(inStack)-1]\n\t\t\tinStack = inStack[:len(inStack)-1]\n\t\t\tif num < min {\n\t\t\t\tmin = num\n\t\t\t\tminCount = 1\n\t\t\t} else if num == min {\n\t\t\t\tminCount++\n\t\t\t}\n\t\t\tresStack = append(resStack, num)\n\t\t}\n\n\t\t// move the unsorted elements back to inStack\n\t\tfor len(resStack) > 0 && resStack[len(resStack)-1] >= min {\n\t\t\tnum := resStack[len(resStack)-1]\n\t\t\t// pop from buffer\n\t\t\tresStack = resStack[:len(resStack)-1]\n\t\t\tif num != min {\n\t\t\t\t// push to in\n\t\t\t\tinStack = append(inStack, num)\n\t\t\t}\n\t\t}\n\n\t\t// push the current round min to resStack\n\t\tfor i := 0; i < minCount; i++ {\n\t\t\tresStack = append(resStack, min)\n\t\t}\n\t}\n\n\treturn resStack\n}", "title": "" }, { "docid": "22dd95258addfbaf710f9f5df9a5fe73", "score": "0.48630694", "text": "func main() {\n\t// pp.Println(\"=========================================\")\n\t// fmt.Println(kClosest([][]int{{1, 3}, {-2, 2}}, 1))\n\t// fmt.Println([][]int{{-2, 2}})\n\t// pp.Println(\"=========================================\")\n\t// fmt.Println(kClosest([][]int{{3, 3}, {5, -1}, {-2, 4}}, 2))\n\t// fmt.Println([][]int{{3, 3}, {-2, 4}})\n\t// pp.Println(\"=========================================\")\n\n\t// min 5 つ\n\theapify([]int{412, 3, 4389, 4, 837, 61, 28, 546}, 5)\n}", "title": "" }, { "docid": "181ec8759c85fed58c5c6c86b1ab7f6a", "score": "0.48616135", "text": "func (n *Component_OpticalChannel_OutputPower) Min() *Component_OpticalChannel_OutputPower_Min {\n\treturn &Component_OpticalChannel_OutputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "181ec8759c85fed58c5c6c86b1ab7f6a", "score": "0.48614523", "text": "func (n *Component_OpticalChannel_OutputPower) Min() *Component_OpticalChannel_OutputPower_Min {\n\treturn &Component_OpticalChannel_OutputPower_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b0fe120960e02f373773997c82e144a6", "score": "0.4860901", "text": "func (s Tube) Jmin() float64 {\n\treturn s.Jx()\n}", "title": "" }, { "docid": "3c02b10eb33e5da6b38add793eae2cc8", "score": "0.4859218", "text": "func (n *OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent) Min() *OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent_Min {\n\treturn &OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cc833dcca60086aae83db80953a41045", "score": "0.48588765", "text": "func Dim(x, y float64) float64", "title": "" }, { "docid": "3c02b10eb33e5da6b38add793eae2cc8", "score": "0.48587525", "text": "func (n *OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent) Min() *OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent_Min {\n\treturn &OpticalAmplifier_SupervisoryChannel_LaserBiasCurrent_Min{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"min\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
d9a97e28a5cb6806c3160597fa98256e
GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise and a boolean to check if the value has been set.
[ { "docid": "ccb305fb690d1378e3d93b16dc4f743c", "score": "0.7851737", "text": "func (o *ContainerStatusTerminated) GetStartedAtOk() (*time.Time, bool) {\n\tif o == nil || o.StartedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartedAt, true\n}", "title": "" } ]
[ { "docid": "509cda103c91e195c881eb03e50c221e", "score": "0.7390418", "text": "func (o *ShinyAppUsage) GetStartedOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Started, true\n}", "title": "" }, { "docid": "4a1fbb968afd8be2ac3f92afaf60f43e", "score": "0.6704831", "text": "func (o *ContainerStatusTerminated) HasStartedAt() bool {\n\tif o != nil && o.StartedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bc7a8ad80e5a1964cc28f664fc28354e", "score": "0.6534909", "text": "func (o *UserSessionEvents) GetStartTimeOk() (*int64, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "0bc05f0aeb1b7b88792823f18c02dd4b", "score": "0.6415965", "text": "func (o *ViewTimelog) GetHasStartTimeOk() (*bool, bool) {\n\tif o == nil || o.HasStartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HasStartTime, true\n}", "title": "" }, { "docid": "2faca3e601e3e2fdeb96b06edaab4abe", "score": "0.6395393", "text": "func (o *ContainerStatusTerminated) GetStartedAt() time.Time {\n\tif o == nil || o.StartedAt == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartedAt\n}", "title": "" }, { "docid": "cd144ef188361e27408663ba40dacf06", "score": "0.6363782", "text": "func (o *DAGDetail) GetStartDateOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate.Get(), o.StartDate.IsSet()\n}", "title": "" }, { "docid": "509fc76c0d0f11b29b98ca7d10ff20e0", "score": "0.6337266", "text": "func (o *MicrosoftGraphScheduleItem) GetStartOk() (AnyOfmicrosoftGraphDateTimeTimeZone, bool) {\n\tif o == nil || o.Start == nil {\n\t\tvar ret AnyOfmicrosoftGraphDateTimeTimeZone\n\t\treturn ret, false\n\t}\n\treturn *o.Start, true\n}", "title": "" }, { "docid": "4e4c544a977b71f14ff8cea02e6d0c58", "score": "0.6336318", "text": "func (o *Event) GetStartTimeOk() (*int64, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "9ba56bc5dcec2bd1974b16145cb32873", "score": "0.63298416", "text": "func (o *DateRange) GetBeginningOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Beginning, true\n}", "title": "" }, { "docid": "d658c6660b58de369686ab8ddefcc4ce", "score": "0.63118374", "text": "func (s *GetDeploymentOutput) SetStartedAt(v time.Time) *GetDeploymentOutput {\n\ts.StartedAt = &v\n\treturn s\n}", "title": "" }, { "docid": "fef93ba1289e2dadcef3fb1291f2928f", "score": "0.6310375", "text": "func (o *RequestsPutBackupJobRequest) GetStartTimeOk() (*string, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "bffb6d5ffc939209a69a233c067523be", "score": "0.6287694", "text": "func (o *NewCampaign) GetStartTimeOk() (time.Time, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret, false\n\t}\n\treturn *o.StartTime, true\n}", "title": "" }, { "docid": "70246f7b8188af510dd8cedecb5a1110", "score": "0.62596816", "text": "func (o *CalendareventsJsonEvent) GetStartOk() (*string, bool) {\n\tif o == nil || o.Start == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Start, true\n}", "title": "" }, { "docid": "625c1e20559269094516441c5690e318", "score": "0.6233044", "text": "func (o *ShinyAppUsage) GetStarted() time.Time {\n\tif o == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\n\treturn o.Started\n}", "title": "" }, { "docid": "f8925182ff46ced979248a7b41b46e64", "score": "0.6170726", "text": "func (o *V0037Reservation) GetStartTimeOk() (*int32, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "26a2f40382719ad9dda9e59845f68ae1", "score": "0.6156008", "text": "func (o *PlannerTask) GetStartDateTimeOk() (time.Time, bool) {\n\tif o == nil || o.StartDateTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret, false\n\t}\n\treturn *o.StartDateTime, true\n}", "title": "" }, { "docid": "de66caa39bcdc461a4795637fdc1d0f4", "score": "0.6130425", "text": "func (o *CampaignCopy) GetStartTimeOk() (time.Time, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret, false\n\t}\n\treturn *o.StartTime, true\n}", "title": "" }, { "docid": "61bc1d1e1fd8a782ac7f95b75fb133e1", "score": "0.6119453", "text": "func (s *StartDeploymentOutput) SetStartedAt(v time.Time) *StartDeploymentOutput {\n\ts.StartedAt = &v\n\treturn s\n}", "title": "" }, { "docid": "2fb6c8837f79353696b7e156e9f80fb4", "score": "0.6104122", "text": "func (s *DeploymentSummary) SetStartedAt(v time.Time) *DeploymentSummary {\n\ts.StartedAt = &v\n\treturn s\n}", "title": "" }, { "docid": "960b5551726abdb054f074c31050671f", "score": "0.60600775", "text": "func (o *ContainerStatusTerminated) SetStartedAt(v time.Time) {\n\to.StartedAt = &v\n}", "title": "" }, { "docid": "ec58005cd35374362afb28d148e6352b", "score": "0.6039314", "text": "func (c *Container) GetStartedAt() time.Time {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\treturn c.startedAt\n}", "title": "" }, { "docid": "517c0fbe0efe30d705023fb2977752d1", "score": "0.60014105", "text": "func (o *WorkflowTaskNotification) GetStartTimeOk() (*string, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "ac5863113c09cae4e7d6667657da204c", "score": "0.59991837", "text": "func (s *StopDeploymentOutput) SetStartedAt(v time.Time) *StopDeploymentOutput {\n\ts.StartedAt = &v\n\treturn s\n}", "title": "" }, { "docid": "2b691045766bc5bd75ff2caec4dc3623", "score": "0.5981471", "text": "func (o *InlineResponse20030Timers) GetLastStartedAtOk() (*string, bool) {\n\tif o == nil || o.LastStartedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LastStartedAt, true\n}", "title": "" }, { "docid": "9c5ed4d98364f372844cf80d092472fb", "score": "0.5973665", "text": "func (o *TasksIdJsonTodoItem1) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "title": "" }, { "docid": "809fa382290cf5bfc7f55b6289822bed", "score": "0.59689265", "text": "func (o *InlineResponse2003Events) GetStartOk() (*string, bool) {\n\tif o == nil || o.Start == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Start, true\n}", "title": "" }, { "docid": "29a6683414fc5e5d58517f1ab250024f", "score": "0.59671134", "text": "func (s *MockScheduler) IsStarted() bool {\n\treturn s.isStarted\n}", "title": "" }, { "docid": "a520246ddfb17dd4f7539a59b40dd8e5", "score": "0.5947912", "text": "func (o *DowntimeChild) GetStartOk() (*int64, bool) {\n\tif o == nil || o.Start == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Start, true\n}", "title": "" }, { "docid": "d62e1cbd0d7abe535a80d386b74fa1fa", "score": "0.59226835", "text": "func (o *RequestsUpdateRestoreRequest) GetStartTimeOk() (*string, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "3388c134fbb121656228b9498ed24d5a", "score": "0.59018135", "text": "func (a *Agenda) IsStarted() bool {\n\treturn a.Status == \"started\"\n}", "title": "" }, { "docid": "57616ddb607a81d3a3d1b9a54061f894", "score": "0.5883415", "text": "func (o *UsageSpecifiedCustomReportsAttributes) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "title": "" }, { "docid": "e8dddc1fbf46516d058cf219d9149744", "score": "0.58235335", "text": "func (o *ApplianceCertRenewalPhase) GetStartTimeOk() (*time.Time, bool) {\n\tif o == nil || o.StartTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartTime, true\n}", "title": "" }, { "docid": "8d50f216a87170735d6daad93f0b187b", "score": "0.5814096", "text": "func Started(obj metav1.Object) bool {\n\tann := obj.GetAnnotations()\n\t// We only care that the annotation key is present.\n\t// An empty annotation value still triggers a drain.\n\t_, present := ann[StartedAnnotation]\n\treturn present\n}", "title": "" }, { "docid": "21b2de32d267ae8cae84157a0002773f", "score": "0.5784383", "text": "func (o *InlineResponse2001Items) GetStoppedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.StoppedAt, true\n}", "title": "" }, { "docid": "60b9079626961a29e37b208641ecff39", "score": "0.5781561", "text": "func (s accountServer) GetStarted(ctx context.Context, req *pb.GetStartedReq) (*wrapperspb.BoolValue, error) {\n\tvar (\n\t\ta = &model.Account{\n\t\t\tID: uid.New(model.AccountPrefix),\n\t\t\tEmail: req.Email,\n\t\t\tLastRequestAt: time.Now().Unix(),\n\t\t}\n\t\terr error\n\t\ttoken string\n\t)\n\tif err = a.Validate(); err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\tif a, err = s.store.SetAccount(ctx, a); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tif token, err = a.GenerateToken(time.Now().Unix(), req.IP); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tgo func() {\n\t\tpb.NewMailServiceClient(s.mailConn).SendToken(context.Background(), &pb.SendTokenReq{\n\t\t\tID: a.ID,\n\t\t\tReceiver: a.Email,\n\t\t\tToken: token,\n\t\t})\n\t}()\n\n\treturn &wrapperspb.BoolValue{\n\t\tValue: true,\n\t}, nil\n}", "title": "" }, { "docid": "96dc3d0730c479628b0de76d531661fc", "score": "0.57579774", "text": "func (in Repeating) Started(t time.Time) bool {\n\tstartsAt := in.StartsAt()\n\tif startsAt == nil {\n\t\treturn true\n\t}\n\treturn t.Equal(*startsAt) || t.After(*startsAt)\n}", "title": "" }, { "docid": "b975fb4d93c43dda41db739742d10ce9", "score": "0.5755733", "text": "func (o *Identity) GetStateChangedAtOk() (*time.Time, bool) {\n\tif o == nil || o.StateChangedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StateChangedAt, true\n}", "title": "" }, { "docid": "8ea89f7ace917eee3e8c8fcb71d8c8d1", "score": "0.57368374", "text": "func (o *TrialPlThreeYearsResponseTrialPlThreeYears) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "title": "" }, { "docid": "dba4f83c069212887b0b3dd579f57b43", "score": "0.5717691", "text": "func (o *InlineObject857) GetStartDateOk() (AnyOfobject, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.StartDate, true\n}", "title": "" }, { "docid": "1b464e361896d834e0c91c0f67b3b97b", "score": "0.5689128", "text": "func (o *RequestsPutBackupJobRequest) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "821663d9488e21744988994ba0ae63a2", "score": "0.56782264", "text": "func (s *Service) GetStarted() int64 {\n\t// return zero value if Service type or Started field is nil\n\tif s == nil || s.Started == nil {\n\t\treturn 0\n\t}\n\n\treturn *s.Started\n}", "title": "" }, { "docid": "74dd8463fb85e2a3dd1ddcbd159cc359", "score": "0.56725925", "text": "func (c *Telemetry) IsStarted() bool {\n\treturn c.started\n}", "title": "" }, { "docid": "1e3282a6e72dd547473b36812ec71642", "score": "0.5611435", "text": "func (c *Carbon) IsStartOfDay(checkMicroseconds bool) bool {\n\tif checkMicroseconds {\n\t\treturn c.Format(MicrosecondTimeFormat) == \"00:00:00.000000\"\n\t} else {\n\t\treturn c.Format(TimeFormat) == \"00:00:00\"\n\t}\n}", "title": "" }, { "docid": "3eeb41a284e30ea5e67763563cd291e2", "score": "0.5590992", "text": "func (s *Server) StartedAtString() (string) {\n return s.DeepTask.StartedAtString()\n}", "title": "" }, { "docid": "0e76bee44da7ec0f1683db9d48885e4d", "score": "0.5590825", "text": "func (v *PendingDecisionInfo) GetStartedTimestamp() (o int64) {\n\tif v != nil && v.StartedTimestamp != nil {\n\t\treturn *v.StartedTimestamp\n\t}\n\treturn\n}", "title": "" }, { "docid": "ce124a78b91fd46df1208a8def2e5f93", "score": "0.5564671", "text": "func (sched *StdScheduler) IsStarted() bool {\n\tsched.mtx.Lock()\n\tdefer sched.mtx.Unlock()\n\n\treturn sched.started\n}", "title": "" }, { "docid": "3db1af854182ba20661cfe479a6c45c3", "score": "0.5560923", "text": "func (o *ClippedMessage) GetClippedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ClippedAt, true\n}", "title": "" }, { "docid": "d85e64a3e3e8c2bb50d270544c1fe018", "score": "0.55480653", "text": "func (o *JsonKubernetesEnclave) GetStartupTimeOk() (*string, bool) {\n\tif o == nil || o.StartupTime == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartupTime, true\n}", "title": "" }, { "docid": "3dd6a0fe33eabfd8d4df199d30166276", "score": "0.5542169", "text": "func (db *InfluxDB) IsStarted() bool {\n\tdb.smutex.Lock()\n\tdefer db.smutex.Unlock()\n\treturn db.started\n}", "title": "" }, { "docid": "1086b94080b2d45e521c531331b2a0e0", "score": "0.55408067", "text": "func (m *RequestStatusMutation) CreatedAt() (r time.Time, exists bool) {\n\tv := m.created_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "cc2644ea1916a83b0f49024cc486dc2f", "score": "0.55269307", "text": "func (s *Scheduler) Started() bool {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.started\n}", "title": "" }, { "docid": "68afe43e10a66cb2b189863bdeb13004", "score": "0.55096114", "text": "func (o *CreditBankIncomeSummary) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "title": "" }, { "docid": "766ab8565c4f9ad5ab4009b0a3a0567e", "score": "0.5500539", "text": "func (v *PollForActivityTaskResponse) GetStartedTimestamp() (o int64) {\n\tif v != nil && v.StartedTimestamp != nil {\n\t\treturn *v.StartedTimestamp\n\t}\n\treturn\n}", "title": "" }, { "docid": "4371c5eadceb74048eadbe8d3ce1569c", "score": "0.549525", "text": "func (self *BisectInfo) Started() bool {\n\treturn self.started\n}", "title": "" }, { "docid": "7eca0443294a106802207ac91d3bf05b", "score": "0.54941434", "text": "func (v *PollForDecisionTaskResponse) GetStartedTimestamp() (o int64) {\n\tif v != nil && v.StartedTimestamp != nil {\n\t\treturn *v.StartedTimestamp\n\t}\n\treturn\n}", "title": "" }, { "docid": "93f764fe944c961cd1ac705c4265a935", "score": "0.5460357", "text": "func (db *InfluxDB) CheckAndSetStarted() bool {\n\tdb.smutex.Lock()\n\tdefer db.smutex.Unlock()\n\tretval := db.started\n\tdb.started = true\n\treturn retval\n}", "title": "" }, { "docid": "fa7d5f798b8b3ab1dd5713525d335fab", "score": "0.54483265", "text": "func (b *Bar) IsStarted() bool {\n\tif b == nil {\n\t\treturn false\n\t}\n\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\treturn b.started\n}", "title": "" }, { "docid": "6327e6e8ad1337733ed875cbd12cbd57", "score": "0.54395586", "text": "func (o *Rule) GetSportStartOk() (*int, bool) {\n\tif o == nil || o.SportStart == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SportStart, true\n}", "title": "" }, { "docid": "bc3739d1186c2b50ac1e87df73fd5efd", "score": "0.54349506", "text": "func (o *BoardsColumnsCardsIdJsonCard) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "title": "" }, { "docid": "a84a067780425ab4d8cb5dceb0fdef5e", "score": "0.5430715", "text": "func (o *projectBase) StartDateIsNull() bool {\n\treturn o.startDateIsNull\n}", "title": "" }, { "docid": "60540affc909d44919bd1ef55a77ecc9", "score": "0.5426492", "text": "func (s *DataQualityResultDescription) SetStartedOn(v time.Time) *DataQualityResultDescription {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "eccb3430e498b7bf9858449b4f50f669", "score": "0.54063976", "text": "func (s *DataQualityResult) SetStartedOn(v time.Time) *DataQualityResult {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "35f3c1966eda4440d1af946fef23bd6c", "score": "0.54048485", "text": "func (s *GetDataQualityRuleRecommendationRunOutput) SetStartedOn(v time.Time) *GetDataQualityRuleRecommendationRunOutput {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "3b2ac458444f0a009866c660955b88c7", "score": "0.5404794", "text": "func (o *Snapshot) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.CreatedAt, true\n}", "title": "" }, { "docid": "eaba495700c6769228b8f27a826ce97f", "score": "0.5396855", "text": "func (s *DataQualityRuleRecommendationRunDescription) SetStartedOn(v time.Time) *DataQualityRuleRecommendationRunDescription {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "3330381fe38557342395d3253176782a", "score": "0.53865075", "text": "func (m *Middleware) IsStarted() bool {\n\treturn m.Started\n}", "title": "" }, { "docid": "63e2451604cd50efbf57a751fa9cfe3d", "score": "0.5386356", "text": "func (a *Agenda) VotingStarted() bool {\n\treturn a.IsStarted() || a.IsActive() || a.IsFailed() || a.IsLockedIn()\n}", "title": "" }, { "docid": "8f7ade6774546cd11be88761d47d5ded", "score": "0.5381204", "text": "func (o *LoginFlow) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil || o.CreatedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedAt, true\n}", "title": "" }, { "docid": "1de22363b932943a28e22fc58114e778", "score": "0.5377234", "text": "func (o *PlannerTask) HasStartDateTime() bool {\n\tif o != nil && o.StartDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c91789fa18d1be61a96f7b4e3b0faa37", "score": "0.5363884", "text": "func (o *ViewTimelog) GetHasStartTime() bool {\n\tif o == nil || o.HasStartTime == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.HasStartTime\n}", "title": "" }, { "docid": "6abfc8d09d4574b5e90e2b5259a492c4", "score": "0.5359873", "text": "func (s *Statement) SetStartedOn(v int64) *Statement {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "4daee0fc19d63a5d20f776f64375dcc0", "score": "0.5357357", "text": "func (s *GetDataQualityResultOutput) SetStartedOn(v time.Time) *GetDataQualityResultOutput {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "44b272ff5001d32e7b171bb713c3bb25", "score": "0.5339538", "text": "func (s *DataQualityRulesetEvaluationRunDescription) SetStartedOn(v time.Time) *DataQualityRulesetEvaluationRunDescription {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "17f3cfc6dfb646691b22beb4350d67ef", "score": "0.5330745", "text": "func (s *GetDataQualityRulesetEvaluationRunOutput) SetStartedOn(v time.Time) *GetDataQualityRulesetEvaluationRunOutput {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "7849e900b11aee80184f3bd1f89d4309", "score": "0.53294486", "text": "func Started(t *swarming.SwarmingRpcsTaskRequestMetadata) (time.Time, error) {\n\treturn ParseTimestamp(t.TaskResult.StartedTs)\n}", "title": "" }, { "docid": "344e2fa30a6bde8c7337ba7b728e0340", "score": "0.5327276", "text": "func (v *ActivityLocalDispatchInfo) GetStartedTimestamp() (o int64) {\n\tif v != nil && v.StartedTimestamp != nil {\n\t\treturn *v.StartedTimestamp\n\t}\n\treturn\n}", "title": "" }, { "docid": "e082b42962d6d75b761a440d8267dd5e", "score": "0.5323499", "text": "func (o *StampPalette) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.CreatedAt, true\n}", "title": "" }, { "docid": "862e84f70b2223a8a04e163b0ba62c09", "score": "0.5320451", "text": "func (c *Command) IsStarted() bool {\n\treturn c.Started\n}", "title": "" }, { "docid": "3a38dcaef78d448beae3a189319019ad", "score": "0.53042156", "text": "func (a *ActivityInfo) GetStartedIdentity() (o string) {\n\tif a != nil {\n\t\treturn a.StartedIdentity\n\t}\n\treturn\n}", "title": "" }, { "docid": "8937a80c0e04bc90eba31c0bf2ddcd7a", "score": "0.52996975", "text": "func (o *ViewTimelog) GetCreatedAtOk() (*string, bool) {\n\tif o == nil || o.CreatedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedAt, true\n}", "title": "" }, { "docid": "ae0e8deed691716dac03236c8ad1520d", "score": "0.52958554", "text": "func (o *NetworkMetadata) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedAt.Get(), o.CreatedAt.IsSet()\n}", "title": "" }, { "docid": "47c4da7da0173881875ea2085aedce0b", "score": "0.5276656", "text": "func (o *Tenant) GetCreationTsOk() (*int64, bool) {\n\tif o == nil || o.CreationTs == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreationTs, true\n}", "title": "" }, { "docid": "d5a4e0dea181a6f99c88bcee20da3585", "score": "0.52718705", "text": "func (m *ProfileMutation) CreatedAt() (r time.Time, exists bool) {\n\tv := m.created_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "70993dcd6d40b52562dd9d0b4b64b994", "score": "0.52631444", "text": "func (s *DescribeJobRunOutput) SetStartedOn(v time.Time) *DescribeJobRunOutput {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "afd2066b3e5444e836633abc407369dd", "score": "0.525208", "text": "func (s *BlueprintRun) SetStartedOn(v time.Time) *BlueprintRun {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "1024c29f727786373a4437de9e6d1888", "score": "0.5236242", "text": "func (e *Experiment) Started() bool {\n\tc := e.Status.CompletedIterations\n\treturn c != nil && *c > 0\n}", "title": "" }, { "docid": "8c5db1a66f77744ac389c0146eba21f7", "score": "0.5230241", "text": "func (o *TrialPlThreeYearsResponseTrialPlThreeYears) GetCreatedAtOk() (*string, bool) {\n\tif o == nil || o.CreatedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedAt, true\n}", "title": "" }, { "docid": "b80a5d052b984ec79929585e9edf7b6d", "score": "0.5225938", "text": "func (wf WorkflowDefinition) StartAt() State {\n\treturn wf.StatesMap[wf.StartAtStr]\n}", "title": "" }, { "docid": "d8ca842d86dfa8a7df37493522fef8ba", "score": "0.5224938", "text": "func (a *ActivityInfo) GetStartedTimestamp() time.Time {\n\tif a != nil {\n\t\treturn a.StartedTimestamp\n\t}\n\treturn time.Unix(0, 0)\n}", "title": "" }, { "docid": "604e7e5f090f45684dcbfbb1aeaa2665", "score": "0.5224075", "text": "func (m *RequestMutation) CreatedAt() (r time.Time, exists bool) {\n\tv := m.created_at\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "911e5d70f794cf54949a8f6a21c3911e", "score": "0.5220303", "text": "func (o *KafkaRequest) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil || o.CreatedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedAt, true\n}", "title": "" }, { "docid": "cba7269af70f19a33f0bb97d6c5a717a", "score": "0.5215279", "text": "func (o *SchemadeliveryDeliveryDomain) GetValidatedAtOk() (*time.Time, bool) {\n\tif o == nil || o.ValidatedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ValidatedAt, true\n}", "title": "" }, { "docid": "41c80f01936eb78baa207e57842281b1", "score": "0.52151513", "text": "func (o *Timestamped) GetCreatedOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Created, true\n}", "title": "" }, { "docid": "b7a4a451dd75ec83fa04d59b4c1be6ae", "score": "0.52141875", "text": "func (o *RiskCheckEmail) GetFirstBreachedAtOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FirstBreachedAt.Get(), o.FirstBreachedAt.IsSet()\n}", "title": "" }, { "docid": "c5a8e57d6e3c04b6148b5f6bc51d1fa0", "score": "0.52046055", "text": "func (s *GetMLTaskRunOutput) SetStartedOn(v time.Time) *GetMLTaskRunOutput {\n\ts.StartedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "be3e40aee0b2309d3d5b8f56ee0d1652", "score": "0.52044314", "text": "func (sh *Snapshot) StartedTimestamp() int64 {\n\treturn sh.TimestampStarted\n}", "title": "" }, { "docid": "f09a29dd43cd677585aa586df4fa899d", "score": "0.51941395", "text": "func (o *WorkflowPropertiesAllOf) GetStartsWorkflowOk() (*bool, bool) {\n\tif o == nil || o.StartsWorkflow == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartsWorkflow, true\n}", "title": "" }, { "docid": "f81dcac9026833f1b8f4b97c484ce535", "score": "0.5193826", "text": "func (o *TagEntry) GetDetectedAtOk() (*time.Time, bool) {\n\tif o == nil || o.DetectedAt == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DetectedAt, true\n}", "title": "" }, { "docid": "a4360d263a31ce8da3cc8572cfbf8a85", "score": "0.51818645", "text": "func (o *RequestsUpdateRestoreRequest) HasStartTime() bool {\n\tif o != nil && o.StartTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dd38703018e67b8e0fb0a4c8c196aaac", "score": "0.51742184", "text": "func (o *ExportJob) GetCreatedAtOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.CreatedAt, true\n}", "title": "" } ]
21c405746b46ccd1ec6dd198bf38788c
MergeUint32Int takes two inputs: map[uint32]int and map[uint32]int and merge two maps and returns a new map[uint32]int.
[ { "docid": "031a621ab719d116476e21198fc12d67", "score": "0.8965975", "text": "func MergeUint32Int(map1, map2 map[uint32]int) map[uint32]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]int{}\n\t}\n\n\tnewMap := make(map[uint32]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" } ]
[ { "docid": "a03847434a74645dd2258428b093e2a7", "score": "0.9057779", "text": "func MergeUintInt32(map1, map2 map[uint]int32) map[uint]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]int32{}\n\t}\n\n\tnewMap := make(map[uint]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e814484e08dfdefb21b18a8021a53d92", "score": "0.89611775", "text": "func MergeIntUint32(map1, map2 map[int]uint32) map[int]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]uint32{}\n\t}\n\n\tnewMap := make(map[int]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7a37636e8054360939aea2f852632ca0", "score": "0.8952689", "text": "func MergeInt32Uint(map1, map2 map[int32]uint) map[int32]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]uint{}\n\t}\n\n\tnewMap := make(map[int32]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8de640dfeb5ec0374d771170855eeaff", "score": "0.8851032", "text": "func MergeUintUint32(map1, map2 map[uint]uint32) map[uint]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]uint32{}\n\t}\n\n\tnewMap := make(map[uint]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6e52cf77c1a33887684545a518080d47", "score": "0.88374", "text": "func MergeUint32(map1, map2 map[uint32]uint32) map[uint32]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]uint32{}\n\t}\n\n\tnewMap := make(map[uint32]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "4eb4e462cc3a9baf16cd5c1fa388b265", "score": "0.8757119", "text": "func MergeUint32Uint(map1, map2 map[uint32]uint) map[uint32]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]uint{}\n\t}\n\n\tnewMap := make(map[uint32]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "417fcbad5a702c564e2c2ec5b60c190f", "score": "0.87441236", "text": "func MergeUint32Int32(map1, map2 map[uint32]int32) map[uint32]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]int32{}\n\t}\n\n\tnewMap := make(map[uint32]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2e08d465b6cb0c0995846b032e68e82c", "score": "0.86915416", "text": "func MergeInt32Uint32(map1, map2 map[int32]uint32) map[int32]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]uint32{}\n\t}\n\n\tnewMap := make(map[int32]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "88c385b06dd2dd52848b796c91749954", "score": "0.85517454", "text": "func MergeUintInt(map1, map2 map[uint]int) map[uint]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]int{}\n\t}\n\n\tnewMap := make(map[uint]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5f8a79be71be0d58369a68ea249145b6", "score": "0.84969485", "text": "func MergeUint64Int32(map1, map2 map[uint64]int32) map[uint64]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]int32{}\n\t}\n\n\tnewMap := make(map[uint64]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "cad3c341947434c5562fca7c25efd562", "score": "0.8484381", "text": "func MergeIntUint(map1, map2 map[int]uint) map[int]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]uint{}\n\t}\n\n\tnewMap := make(map[int]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "270e2bdd3d5d5feb8728fe418f6c4594", "score": "0.84683377", "text": "func MergeUint32Int64(map1, map2 map[uint32]int64) map[uint32]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]int64{}\n\t}\n\n\tnewMap := make(map[uint32]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "212d8337d39342f612dd0d700d9faa29", "score": "0.84547377", "text": "func MergeInt64Uint32(map1, map2 map[int64]uint32) map[int64]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]uint32{}\n\t}\n\n\tnewMap := make(map[int64]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "092674b4d0738f39f5401f95b81e5c2d", "score": "0.84400165", "text": "func MergeUint64Uint32(map1, map2 map[uint64]uint32) map[uint64]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]uint32{}\n\t}\n\n\tnewMap := make(map[uint64]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2b9778c9c8f674476971b5f76da98b5d", "score": "0.83632046", "text": "func MergeInt32Uint64(map1, map2 map[int32]uint64) map[int32]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]uint64{}\n\t}\n\n\tnewMap := make(map[int32]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6e1f05314a7ff5f644f7a10dea03ed2e", "score": "0.82960635", "text": "func MergeUint16Int32(map1, map2 map[uint16]int32) map[uint16]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]int32{}\n\t}\n\n\tnewMap := make(map[uint16]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "dfe86ea827ae106e8b272d983ef1271b", "score": "0.8279801", "text": "func MergeUint32Uint64(map1, map2 map[uint32]uint64) map[uint32]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]uint64{}\n\t}\n\n\tnewMap := make(map[uint32]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "32fa32e5c9ec6841241f3c49db02c59b", "score": "0.81918615", "text": "func MergeUint32Int16(map1, map2 map[uint32]int16) map[uint32]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]int16{}\n\t}\n\n\tnewMap := make(map[uint32]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "07cf11e7a68b352eb9e1cd359a4bff00", "score": "0.81839883", "text": "func MergeInt32Uint16(map1, map2 map[int32]uint16) map[int32]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]uint16{}\n\t}\n\n\tnewMap := make(map[int32]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "debf233ec07491eef894845ea7ecf55a", "score": "0.8171796", "text": "func MergeInt16Uint32(map1, map2 map[int16]uint32) map[int16]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]uint32{}\n\t}\n\n\tnewMap := make(map[int16]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ea62d2f9f0c5e5377a2e8732a826a485", "score": "0.8142381", "text": "func MergeUint(map1, map2 map[uint]uint) map[uint]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]uint{}\n\t}\n\n\tnewMap := make(map[uint]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5fdcce3e1e766b75ef1a55bcc39d3f4e", "score": "0.810872", "text": "func MergeInt32(map1, map2 map[int32]int32) map[int32]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]int32{}\n\t}\n\n\tnewMap := make(map[int32]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2b50fb26612fec86d81a508ca3224a8a", "score": "0.81063133", "text": "func MergeUintInt64(map1, map2 map[uint]int64) map[uint]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]int64{}\n\t}\n\n\tnewMap := make(map[uint]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3db7950f59a81529e567b80dd950c4c5", "score": "0.80711335", "text": "func MergeIntUint64(map1, map2 map[int]uint64) map[int]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]uint64{}\n\t}\n\n\tnewMap := make(map[int]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "9f10d32fa06c795b7eac930459f50f46", "score": "0.80432826", "text": "func MergeInt32Uint8(map1, map2 map[int32]uint8) map[int32]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]uint8{}\n\t}\n\n\tnewMap := make(map[int32]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "dbf0c04dbce357364862c0744763f426", "score": "0.803653", "text": "func MergeUint8Int32(map1, map2 map[uint8]int32) map[uint8]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]int32{}\n\t}\n\n\tnewMap := make(map[uint8]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3a9c732c9ce8d7186bdc565481fd81e3", "score": "0.8032884", "text": "func MergeInt64Uint(map1, map2 map[int64]uint) map[int64]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]uint{}\n\t}\n\n\tnewMap := make(map[int64]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "62fce3f1c8915c5a99a99700aeb11427", "score": "0.8032198", "text": "func MergeUint64Int(map1, map2 map[uint64]int) map[uint64]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]int{}\n\t}\n\n\tnewMap := make(map[uint64]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a9dbf70ff0e134f2e8f69faa3ec8195d", "score": "0.80286586", "text": "func MergeIntInt32(map1, map2 map[int]int32) map[int]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]int32{}\n\t}\n\n\tnewMap := make(map[int]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e90e6e5ab77c3f85fe3acfff8b9e521d", "score": "0.8012488", "text": "func MergeInt32Int(map1, map2 map[int32]int) map[int32]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]int{}\n\t}\n\n\tnewMap := make(map[int32]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "754498089d9077b982d06f5aef6f4e68", "score": "0.7985654", "text": "func MergeUint32Int8(map1, map2 map[uint32]int8) map[uint32]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]int8{}\n\t}\n\n\tnewMap := make(map[uint32]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "278bbadafaedce7fa112f479bf82c499", "score": "0.79654115", "text": "func MergeUint16Uint32(map1, map2 map[uint16]uint32) map[uint16]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]uint32{}\n\t}\n\n\tnewMap := make(map[uint16]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2add53ac599353d84279e50a4c4495cb", "score": "0.79575396", "text": "func MergeUint32Uint16(map1, map2 map[uint32]uint16) map[uint32]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]uint16{}\n\t}\n\n\tnewMap := make(map[uint32]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f717c3f8e4e2a7ba9448877872f9e7cd", "score": "0.7930295", "text": "func MergeInt8Uint32(map1, map2 map[int8]uint32) map[int8]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]uint32{}\n\t}\n\n\tnewMap := make(map[int8]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "41116200ba1189a8e5c179ea2b116bbf", "score": "0.7920708", "text": "func MergeIntUint16(map1, map2 map[int]uint16) map[int]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]uint16{}\n\t}\n\n\tnewMap := make(map[int]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5168c716a64c7a7310052c0a3d341832", "score": "0.7901251", "text": "func MergeUintInt16(map1, map2 map[uint]int16) map[uint]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]int16{}\n\t}\n\n\tnewMap := make(map[uint]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1a6d619c83fdb9a282fe77bd4fb221b6", "score": "0.7807298", "text": "func MergeUint16Int(map1, map2 map[uint16]int) map[uint16]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]int{}\n\t}\n\n\tnewMap := make(map[uint16]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6683bed5e8d811bebea782f9fa3c102a", "score": "0.7782857", "text": "func MergeInt16Uint(map1, map2 map[int16]uint) map[int16]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]uint{}\n\t}\n\n\tnewMap := make(map[int16]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "4e94a81665736b5caea70364f93dbea6", "score": "0.7761886", "text": "func MergeStrUint32(map1, map2 map[string]uint32) map[string]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[string]uint32{}\n\t}\n\n\tnewMap := make(map[string]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "b19ffb61536dcf91d0c84a087dbc55de", "score": "0.77215964", "text": "func MergeUint32Uint8(map1, map2 map[uint32]uint8) map[uint32]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]uint8{}\n\t}\n\n\tnewMap := make(map[uint32]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "be3dfcd31d7677afc90ed81d27b017ec", "score": "0.7716053", "text": "func MergeInt16Int32(map1, map2 map[int16]int32) map[int16]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]int32{}\n\t}\n\n\tnewMap := make(map[int16]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2572d1fb4d44d616ee54d4ebc5f39d16", "score": "0.7679054", "text": "func MergeIntUint8(map1, map2 map[int]uint8) map[int]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]uint8{}\n\t}\n\n\tnewMap := make(map[int]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d46d3d1ada282f00b8e919b5f9f3da79", "score": "0.7655786", "text": "func MergeBoolUint32(map1, map2 map[bool]uint32) map[bool]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[bool]uint32{}\n\t}\n\n\tnewMap := make(map[bool]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6156459532cbbb86e795e37347970f3c", "score": "0.7653405", "text": "func MergeUintUint64(map1, map2 map[uint]uint64) map[uint]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]uint64{}\n\t}\n\n\tnewMap := make(map[uint]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7bea279551f035d21b8f90b6a536c76e", "score": "0.7652066", "text": "func MergeUint8Uint32(map1, map2 map[uint8]uint32) map[uint8]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]uint32{}\n\t}\n\n\tnewMap := make(map[uint8]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "b307f7a3d466e81eecaa333cdebbc840", "score": "0.7638597", "text": "func MergeUintInt8(map1, map2 map[uint]int8) map[uint]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]int8{}\n\t}\n\n\tnewMap := make(map[uint]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e2eef511654d978ca9d8f54aa3fdfd11", "score": "0.7631496", "text": "func MergeInt64Int32(map1, map2 map[int64]int32) map[int64]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]int32{}\n\t}\n\n\tnewMap := make(map[int64]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a9aaca2c6afa931d68968e94efb3597b", "score": "0.76199836", "text": "func MergeUint64Int16(map1, map2 map[uint64]int16) map[uint64]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]int16{}\n\t}\n\n\tnewMap := make(map[uint64]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c8d854be52a97acb6e019493be28f747", "score": "0.76183224", "text": "func MergeInt32Int16(map1, map2 map[int32]int16) map[int32]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]int16{}\n\t}\n\n\tnewMap := make(map[int32]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ccb1c00da23e46964c01bc81cd9cb300", "score": "0.75969905", "text": "func MergeUint64Uint(map1, map2 map[uint64]uint) map[uint64]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]uint{}\n\t}\n\n\tnewMap := make(map[uint64]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5fcbbb4351772ac062b33d66ef6a8991", "score": "0.75888604", "text": "func MergeInt64Uint16(map1, map2 map[int64]uint16) map[int64]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]uint16{}\n\t}\n\n\tnewMap := make(map[int64]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "988e6750dcccce6cc68b2ac7f4ba45b7", "score": "0.75749564", "text": "func MergeInt32Int64(map1, map2 map[int32]int64) map[int32]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]int64{}\n\t}\n\n\tnewMap := make(map[int32]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "060dce554bb99e7f753feab776ddd0f4", "score": "0.75564355", "text": "func MergeUint8Int(map1, map2 map[uint8]int) map[uint8]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]int{}\n\t}\n\n\tnewMap := make(map[uint8]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f38786e40014d7a78161183505bf2a5f", "score": "0.75464046", "text": "func MergeUint16Int64(map1, map2 map[uint16]int64) map[uint16]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]int64{}\n\t}\n\n\tnewMap := make(map[uint16]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "75a5eecf7dd865bedf6b72df2b51be0e", "score": "0.7546203", "text": "func MergeInt8Uint(map1, map2 map[int8]uint) map[int8]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]uint{}\n\t}\n\n\tnewMap := make(map[int8]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "18c8137550e70232c54e85988bf2249a", "score": "0.7530318", "text": "func MergeUint32Bool(map1, map2 map[uint32]bool) map[uint32]bool {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]bool{}\n\t}\n\n\tnewMap := make(map[uint32]bool)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "94fa57f429b2ea101ec71ff48d84e105", "score": "0.7499703", "text": "func MergeUint32Str(map1, map2 map[uint32]string) map[uint32]string {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]string{}\n\t}\n\n\tnewMap := make(map[uint32]string)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "73068c2e8b78f4e39fe1ccea8ba33069", "score": "0.7489904", "text": "func MergeIntInt16(map1, map2 map[int]int16) map[int]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]int16{}\n\t}\n\n\tnewMap := make(map[int]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3247b1ce1ca0c5f81b2dd49cb12ad8be", "score": "0.7479756", "text": "func MergeInt16Uint64(map1, map2 map[int16]uint64) map[int16]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]uint64{}\n\t}\n\n\tnewMap := make(map[int16]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2ee83a3b661ddd8a16716cf4699998a5", "score": "0.7468276", "text": "func MergeUintUint16(map1, map2 map[uint]uint16) map[uint]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]uint16{}\n\t}\n\n\tnewMap := make(map[uint]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f518f0202e753798ba56c2d5be3c63fb", "score": "0.74627525", "text": "func MergeStrInt32(map1, map2 map[string]int32) map[string]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[string]int32{}\n\t}\n\n\tnewMap := make(map[string]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8a71e74cbf8b11a6b8bc1ffb753ade74", "score": "0.7456954", "text": "func MergeInt(map1, map2 map[int]int) map[int]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]int{}\n\t}\n\n\tnewMap := make(map[int]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ce705dbaab6d32cc1447d218ef3c7d48", "score": "0.74378073", "text": "func MergeUint64(map1, map2 map[uint64]uint64) map[uint64]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]uint64{}\n\t}\n\n\tnewMap := make(map[uint64]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "252724a9d20dd17c66ac28e4c58dff0f", "score": "0.7409945", "text": "func MergeInt32Int8(map1, map2 map[int32]int8) map[int32]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]int8{}\n\t}\n\n\tnewMap := make(map[int32]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "705ce1b014dcd42fa378f86bbd53f2a0", "score": "0.7375901", "text": "func MergeInt8Int32(map1, map2 map[int8]int32) map[int8]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]int32{}\n\t}\n\n\tnewMap := make(map[int8]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5248e5e96742bda3da3c93416a8cb8b5", "score": "0.73438853", "text": "func MergeInt16Int(map1, map2 map[int16]int) map[int16]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]int{}\n\t}\n\n\tnewMap := make(map[int16]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7644f58246b0c3a5b511b5b25a64d68e", "score": "0.73350286", "text": "func MergeInt16(map1, map2 map[int16]int16) map[int16]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]int16{}\n\t}\n\n\tnewMap := make(map[int16]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "97a5f6e4fc1959bd71c214714f20780c", "score": "0.7309481", "text": "func MergeUint16(map1, map2 map[uint16]uint16) map[uint16]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]uint16{}\n\t}\n\n\tnewMap := make(map[uint16]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "cc9756cb5b147a92c8300cfa03c92f99", "score": "0.7305142", "text": "func MergeUint64Int64(map1, map2 map[uint64]int64) map[uint64]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]int64{}\n\t}\n\n\tnewMap := make(map[uint64]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e07ea9685d153f89c9cea12f9d5a8cb1", "score": "0.72894317", "text": "func MergeUint16Uint(map1, map2 map[uint16]uint) map[uint16]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]uint{}\n\t}\n\n\tnewMap := make(map[uint16]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "12b410095d3ed947250a1848249e1387", "score": "0.7278671", "text": "func MergeInt32Str(map1, map2 map[int32]string) map[int32]string {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]string{}\n\t}\n\n\tnewMap := make(map[int32]string)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7b6ed08a566c00f56fe55c4874ea215a", "score": "0.72674066", "text": "func MergeInt64Uint64(map1, map2 map[int64]uint64) map[int64]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]uint64{}\n\t}\n\n\tnewMap := make(map[int64]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5bc463fe4571a399be9152af859d8766", "score": "0.7266802", "text": "func MergeInt64Int16(map1, map2 map[int64]int16) map[int64]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]int16{}\n\t}\n\n\tnewMap := make(map[int64]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "cb3939e8a7c56ea02e99f2e6470a7bc9", "score": "0.722113", "text": "func MergeUint64Uint16(map1, map2 map[uint64]uint16) map[uint64]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]uint16{}\n\t}\n\n\tnewMap := make(map[uint64]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d5252788b99c933d18d26fdefec027f6", "score": "0.72167385", "text": "func MergeIntInt64(map1, map2 map[int]int64) map[int]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]int64{}\n\t}\n\n\tnewMap := make(map[int]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0b37741988027244e793f6400730cbf7", "score": "0.72142535", "text": "func MergeInt64Int(map1, map2 map[int64]int) map[int64]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]int{}\n\t}\n\n\tnewMap := make(map[int64]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0846b333493f68cd972eccebedc3d4b5", "score": "0.7212072", "text": "func MergeBoolInt32(map1, map2 map[bool]int32) map[bool]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[bool]int32{}\n\t}\n\n\tnewMap := make(map[bool]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "84ef3ea799c0248202225e47d241af97", "score": "0.7189404", "text": "func MergeInt16Int64(map1, map2 map[int16]int64) map[int16]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]int64{}\n\t}\n\n\tnewMap := make(map[int16]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "9145fedd4f9236de64d3e9b704f0f592", "score": "0.71475726", "text": "func MergeStrUint(map1, map2 map[string]uint) map[string]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[string]uint{}\n\t}\n\n\tnewMap := make(map[string]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "b52730fc41f377884f2335325e430b47", "score": "0.71457446", "text": "func MergeIntInt8(map1, map2 map[int]int8) map[int]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]int8{}\n\t}\n\n\tnewMap := make(map[int]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1e86fc7da175f5d45b680d8bb2f2dfc3", "score": "0.71123314", "text": "func MergeInt16Uint16(map1, map2 map[int16]uint16) map[int16]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]uint16{}\n\t}\n\n\tnewMap := make(map[int16]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d013d6e33b6a95a297962e8a79e421b4", "score": "0.70982176", "text": "func MergeInt8Uint16(map1, map2 map[int8]uint16) map[int8]uint16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]uint16{}\n\t}\n\n\tnewMap := make(map[int8]uint16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ab1a1b13a7e79b48d3d95d68ebaf3920", "score": "0.7088839", "text": "func MergeUint64Int8(map1, map2 map[uint64]int8) map[uint64]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]int8{}\n\t}\n\n\tnewMap := make(map[uint64]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "80cb858c81b481e29d3a69c78efc0a13", "score": "0.7082388", "text": "func MergeUintUint8(map1, map2 map[uint]uint8) map[uint]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]uint8{}\n\t}\n\n\tnewMap := make(map[uint]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c0a99239b613d751fbaa33bfa4f50643", "score": "0.70736635", "text": "func MergeUint16Uint64(map1, map2 map[uint16]uint64) map[uint16]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]uint64{}\n\t}\n\n\tnewMap := make(map[uint16]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "29b41fdeb4ef977150a67cc301bc9d24", "score": "0.7063316", "text": "func MergeUint16Int8(map1, map2 map[uint16]int8) map[uint16]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]int8{}\n\t}\n\n\tnewMap := make(map[uint16]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "412892b8c0ebdbd9effb0f0b0bf727ca", "score": "0.7062253", "text": "func MergeUint8Int64(map1, map2 map[uint8]int64) map[uint8]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]int64{}\n\t}\n\n\tnewMap := make(map[uint8]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1d90977bdff3270a51d7739467f3f549", "score": "0.7060708", "text": "func MergeInt8Uint64(map1, map2 map[int8]uint64) map[int8]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]uint64{}\n\t}\n\n\tnewMap := make(map[int8]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7135b3fb3260bc8dd0464718d762a645", "score": "0.7058623", "text": "func MergeUintStr(map1, map2 map[uint]string) map[uint]string {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]string{}\n\t}\n\n\tnewMap := make(map[uint]string)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "08ac45fffee7e05effc666e0461acb99", "score": "0.7058078", "text": "func MergeUint8Int16(map1, map2 map[uint8]int16) map[uint8]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]int16{}\n\t}\n\n\tnewMap := make(map[uint8]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6c06392ddfdb8002f3db9dee7a750775", "score": "0.70556307", "text": "func MergeBoolUint(map1, map2 map[bool]uint) map[bool]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[bool]uint{}\n\t}\n\n\tnewMap := make(map[bool]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1614cf011374d361dfb246dbbcaa417a", "score": "0.7053227", "text": "func MergeInt16Uint8(map1, map2 map[int16]uint8) map[int16]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int16]uint8{}\n\t}\n\n\tnewMap := make(map[int16]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0afb3d221819639b07e22e87da736982", "score": "0.7052784", "text": "func MergeUint16Int16(map1, map2 map[uint16]int16) map[uint16]int16 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint16]int16{}\n\t}\n\n\tnewMap := make(map[uint16]int16)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "719c523d80f372c188e8491b81458f6d", "score": "0.7044312", "text": "func MergeInt32Bool(map1, map2 map[int32]bool) map[int32]bool {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]bool{}\n\t}\n\n\tnewMap := make(map[int32]bool)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a72ac65dd27ddd75917a4e8619246379", "score": "0.7028707", "text": "func MergeInt64(map1, map2 map[int64]int64) map[int64]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]int64{}\n\t}\n\n\tnewMap := make(map[int64]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "226e2f1098181641c22e9d3438605991", "score": "0.70274276", "text": "func MergeInt64Uint8(map1, map2 map[int64]uint8) map[int64]uint8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]uint8{}\n\t}\n\n\tnewMap := make(map[int64]uint8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8e436b8ef8315ebcacec083bf31f420e", "score": "0.7021043", "text": "func MergeUintBool(map1, map2 map[uint]bool) map[uint]bool {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]bool{}\n\t}\n\n\tnewMap := make(map[uint]bool)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "214661a78dd08712a5531b5471a57ac5", "score": "0.69524646", "text": "func MergeUint8Uint(map1, map2 map[uint8]uint) map[uint8]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint8]uint{}\n\t}\n\n\tnewMap := make(map[uint8]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "84d14acdb7966c8ee8e531d70f77743d", "score": "0.69387954", "text": "func MergeInt8Int(map1, map2 map[int8]int) map[int8]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]int{}\n\t}\n\n\tnewMap := make(map[int8]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "80d40b158184ddf9f629e0ebea740eb8", "score": "0.69347906", "text": "func MergeInt8(map1, map2 map[int8]int8) map[int8]int8 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int8]int8{}\n\t}\n\n\tnewMap := make(map[int8]int8)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" } ]
5a59c983d16c4254145449b08c61cd13
setStaticFields sets static resource header and metadata fields.
[ { "docid": "85ae42c4555fe8bcbb2c6811bbc5c7d2", "score": "0.67530936", "text": "func (s *ServerV2) setStaticFields() {\n\ts.Version = V2\n}", "title": "" } ]
[ { "docid": "30d4173bb01aee50f1e5068c18280a2a", "score": "0.7833473", "text": "func (logger *Logger) SetStaticFields(fields map[string]interface{}) {\n\tfor key, val := range fields {\n\t\tlogger.staticFields.Store(key, val)\n\t}\n}", "title": "" }, { "docid": "2bb152320b3d55e1340f9f0093c10c68", "score": "0.75959307", "text": "func (c *StaticTokensV2) setStaticFields() {\n\tc.Kind = KindStaticTokens\n\tc.Version = V2\n\tc.Metadata.Name = MetaNameStaticTokens\n}", "title": "" }, { "docid": "cff72612178f71fff75701b21a82cd77", "score": "0.7355246", "text": "func (d *DatabaseV3) setStaticFields() {\n\td.Kind = KindDatabase\n\td.Version = V3\n}", "title": "" }, { "docid": "773c499d595fa499cc0705d5cc83942c", "score": "0.6952051", "text": "func (ca *CertAuthorityV2) setStaticFields() {\n\tca.Kind = KindCertAuthority\n\tca.Version = V2\n\t// ca.Metadata.Name and ca.Spec.ClusterName should always be equal.\n\tif ca.Metadata.Name == \"\" {\n\t\tca.Metadata.Name = ca.Spec.ClusterName\n\t} else {\n\t\tca.Spec.ClusterName = ca.Metadata.Name\n\t}\n}", "title": "" }, { "docid": "dc2aad062d386a1a22edb57fdd8da93a", "score": "0.65693265", "text": "func SetStaticFileHeaders(h http.Header) {\n\tSetSameOriginIFrame(h)\n\tSetNoSniff(h)\n}", "title": "" }, { "docid": "a6424835fe9af5192fedd80fd269345e", "score": "0.64469534", "text": "func (r *TunnelConnectionV2) setStaticFields() {\n\tr.Kind = KindTunnelConnection\n\tr.Version = V2\n}", "title": "" }, { "docid": "fe1fa6d311af5590d8ee5309e3236b68", "score": "0.642892", "text": "func staticFields() map[string]*framework.FieldSchema {\n\tfields := map[string]*framework.FieldSchema{\n\t\t\"username\": {\n\t\t\tType: framework.TypeString,\n\t\t\tDescription: `Name of the static user account for Vault to manage.\n\tRequires \"rotation_period\" to be specified`,\n\t\t},\n\t\t\"rotation_period\": {\n\t\t\tType: framework.TypeDurationSecond,\n\t\t\tDescription: `Period for automatic\n\tcredential rotation of the given username. Not valid unless used with\n\t\"username\".`,\n\t\t},\n\t\t\"rotation_statements\": {\n\t\t\tType: framework.TypeStringSlice,\n\t\t\tDescription: `Specifies the database statements to be executed to\n\trotate the accounts credentials. Not every plugin type will support\n\tthis functionality. See the plugin's API page for more information on\n\tsupport and formatting for this parameter.`,\n\t\t},\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1cc860f2e84ca7236477eb0ccd523ea5", "score": "0.59968513", "text": "func (a *App) SetStaticHeader(route, key, value string) error {\n\tmountedRoute := a.formatStaticMountRoute(route)\n\tif static, hasRoute := a.Statics[mountedRoute]; hasRoute {\n\t\tstatic.AddHeader(key, value)\n\t\treturn nil\n\t}\n\treturn ex.New(\"no static fileserver mounted at route\", ex.OptMessagef(\"route: %s\", mountedRoute))\n}", "title": "" }, { "docid": "7060e63c3bbf151171c51dc7c6dfbb63", "score": "0.5948149", "text": "func (d *DatabaseV3) SetStaticLabels(sl map[string]string) {\n\td.Metadata.Labels = sl\n}", "title": "" }, { "docid": "0005a1633c10c78598e2784f61862e5c", "score": "0.58110374", "text": "func StaticHeaders(rowser pproto.ToRowser, cols ...Column) pproto.ToRowser {\n\treturn &staticHeaderRowser{rowser, cols}\n}", "title": "" }, { "docid": "8835219fe454baaba329523ea9035548", "score": "0.5796049", "text": "func (global *GlobalSetting) SetStatic(dir string, nocompress bool, nocache bool, handlers ...HandlerWithoutPath) {\n\tif !strings.HasSuffix(dir, \"/\") {\n\t\tdir += \"/\"\n\t}\n\tglobal.static = PresetStatic{\n\t\troot: dir,\n\t\tnocompress: nocompress,\n\t\tnocache: nocache,\n\t\thandlers: handlers,\n\t}\n}", "title": "" }, { "docid": "e78ff1525b2c02116bb0606807d3fe4a", "score": "0.5739083", "text": "func (global *GlobalSetting) SetStatic(dir string) {\n\tif !strings.HasSuffix(dir, \"/\") {\n\t\tdir += \"/\"\n\t}\n\tglobal.staticDir = dir\n}", "title": "" }, { "docid": "7eea35abecb99415a3f7e4c56c7831ae", "score": "0.54975665", "text": "func (s *ServerV2) SetStaticLabels(sl map[string]string) {\n\ts.Metadata.Labels = sl\n}", "title": "" }, { "docid": "5d2ef07164143b0acdddaaec34e9b559", "score": "0.54522395", "text": "func (s *Struct) SetStatic(static bool) *Struct {\n\ts.TypeStatic = static\n\treturn s\n}", "title": "" }, { "docid": "fb4e2614decdd014f458fdb9fc20a3c9", "score": "0.54391867", "text": "func StaticField(name, content string) *Field {\n\tret := FieldWithType(name, formcommon.STATIC)\n\tret.SetText(content)\n\treturn ret\n}", "title": "" }, { "docid": "581d8e03d172f8c4dc18d1fa1240453b", "score": "0.53926057", "text": "func StaticSet(fqn FQN, property string, value interface{}) {\n\tclient := kernel.GetClient()\n\n\t_, err := client.SSet(kernel.StaticSetRequest{\n\t\tAPI: \"sset\",\n\t\tFQN: api.FQN(fqn),\n\t\tProperty: property,\n\t\tValue: value,\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "dc2c2cefb26939a41bc001e20b1e6a2b", "score": "0.52009755", "text": "func SetStaticPath (path string) {\n\tDefaultInstance.SetStaticPath (path)\n}", "title": "" }, { "docid": "356018e7dc236eb73f0434915414b8a8", "score": "0.51714945", "text": "func (in *Instance) SetStaticPath (path string) {\n\tin.staticPath = path\n}", "title": "" }, { "docid": "818bbd014da308f89f5a83cb8b6485f9", "score": "0.5155399", "text": "func JNIEnvSetStaticIntField(env *JNIEnv, clazz *Jclass, id JfieldID, val int32) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jint)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticIntField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "d4ec3910c024a570f88eca43d389ae94", "score": "0.5142336", "text": "func static(c *fiber.Ctx) error {\n\tpath := c.Params(\"*\")\n\tif path == \"\" {\n\t\treturn c.SendStatus(fiber.StatusNotFound)\n\t}\n\tpath = filepath.Join(\"template\", \"static\", path)\n\tfile, err := staticDirectoryFS.Open(path)\n\tif err != nil {\n\t\treturn c.SendStatus(fiber.StatusNotFound)\n\t}\n\tt := mime.TypeByExtension(filepath.Ext(path))\n\tif t == fiber.MIMEApplicationJavaScript { // add charset utf-8 for JS files, if it's not included\n\t\tt = fiber.MIMEApplicationJavaScriptCharsetUTF8\n\t}\n\tc.Set(fiber.HeaderContentType, t)\n\tc.Append(fiber.HeaderCacheControl, \"public, max-age=31536000\")\n\treturn c.SendStream(file)\n}", "title": "" }, { "docid": "bee677fe823770e14f7d6198ff09df9f", "score": "0.51053137", "text": "func SetupStatic(m *mux.Router) {\n\tmime.AddExtensionType(\".map\", \"text/plain\")\n\tmime.AddExtensionType(\".woff2\", \"font/woff2\")\n\tmime.AddExtensionType(\".woff\", \"font/woff\")\n\tmime.AddExtensionType(\".ttf\", \"font/ttf\")\n\n\tstaticFS := assets.StaticFiles()\n\tm.PathPrefix(staticPrefix).Handler(http.StripPrefix(staticPrefix, http.FileServer(staticFS.FS())))\n}", "title": "" }, { "docid": "467e38a94dc1c5ed0a232f5861eef545", "score": "0.50898635", "text": "func (logger *Logger) GetStaticFields() map[string]interface{} {\n\tstaticFieldsMap := make(map[string]interface{})\n\n\tvar wasErr error\n\tlogger.staticFields.Range(func(k, v interface{}) bool {\n\t\tkey, ok := k.(string)\n\t\tif !ok {\n\t\t\twasErr = fmt.Errorf(\"cannot cast log map key to string\")\n\t\t\t// false stops the iteration\n\t\t\treturn false\n\t\t}\n\t\tstaticFieldsMap[key] = v\n\t\treturn true\n\t})\n\tif wasErr != nil {\n\t\tpanic(wasErr) // call panic outside of logger.Range()\n\t}\n\n\treturn staticFieldsMap\n}", "title": "" }, { "docid": "9ff7ab395ce16ccb4f5a538d63e1bacf", "score": "0.50894547", "text": "func JNIEnvSetStaticObjectField(env *JNIEnv, clazz *Jclass, id JfieldID, val Jobject) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jobject)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticObjectField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "8fc89b16d59cf94c62207962326543d1", "score": "0.49906567", "text": "func (c *StaticTokensV2) SetStaticTokens(s []ProvisionToken) {\n\tc.Spec.StaticTokens = ProvisionTokensToV1(s)\n}", "title": "" }, { "docid": "8fc89b16d59cf94c62207962326543d1", "score": "0.49906567", "text": "func (c *StaticTokensV2) SetStaticTokens(s []ProvisionToken) {\n\tc.Spec.StaticTokens = ProvisionTokensToV1(s)\n}", "title": "" }, { "docid": "e6f82c60b2db04820a968adf163ca4e4", "score": "0.49690437", "text": "func (o *Artifact) SetStaticSiteDetails(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*StaticSiteDetail) error {\n\tquery := \"update `static_site_details` set `artifact_id` = null where `artifact_id` = ?\"\n\tvalues := []interface{}{o.ID}\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\t_, err := exec.ExecContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.StaticSiteDetails {\n\t\t\tqueries.SetScanner(&rel.ArtifactID, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.Artifact = nil\n\t\t}\n\n\t\to.R.StaticSiteDetails = nil\n\t}\n\treturn o.AddStaticSiteDetails(ctx, exec, insert, related...)\n}", "title": "" }, { "docid": "57d52d39d654cc07c2fb33bb3ddb923c", "score": "0.49488485", "text": "func SetSRC(key string, bytes []byte) {\n\tstaticResouces[key] = bytes\n}", "title": "" }, { "docid": "f61648e00d2ecce9226cb16e1d33c209", "score": "0.49250868", "text": "func NewStaticLoader(logger *zap.Logger) Loader {\n\treturn StaticLoader{logger: logger, modules: CWFModuleMap, filters: CWFFilterMap}\n}", "title": "" }, { "docid": "490f052ac639281d5487f25f60e575fa", "score": "0.4908965", "text": "func (l *Logger) WithFields(fields map[string]string) Modular {\n\tnewConfig := l.config\n\tnewConfig.StaticFields = fields\n\tfor k, v := range l.config.StaticFields {\n\t\tif _, exists := fields[k]; !exists {\n\t\t\tnewConfig.StaticFields[k] = v\n\t\t}\n\t}\n\n\tformatter, _ := getFormatter(newConfig)\n\tif formatter == nil {\n\t\tformatter = deprecatedFormatter(newConfig)\n\t}\n\n\treturn &Logger{\n\t\tstream: l.stream,\n\t\tconfig: newConfig,\n\t\tlevel: l.level,\n\t\tformatter: formatter,\n\t}\n}", "title": "" }, { "docid": "216a3878b29b0a33935100e09e7c743d", "score": "0.48897913", "text": "func (d *Dir) addStatic(s *StaticFile) {\n\td.static = append(d.static, s)\n}", "title": "" }, { "docid": "d5999f374803ef8576c1e3475ddac4cf", "score": "0.48861325", "text": "func (h *HTTPMux) Static(path string) {\n\tif path[len(path)-1:] != \"/\" {\n\t\tpath += \"/\"\n\t}\n\n\th.staticPrefix = path\n\th.HasStaticFiles = true\n}", "title": "" }, { "docid": "96e10184736d3c38067b3e6a46e35892", "score": "0.4880486", "text": "func (h *Higgs) PopulateStaticData() error {\n\n\tctx := context.TODO()\n\n\tif err := h.populateDogmaAttributes(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t//if err := h.populateDogmaEffects(ctx); err != nil {\n\t//\treturn err\n\t//}\n\n\tif err := h.populateUniverse(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t//if err := h.populateInventory(ctx); err != nil {\n\t//\treturn err\n\t//}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a31528dabcdbd8ab0e82a113c8a7282", "score": "0.48565882", "text": "func (this *Bootstrap) InitStaticFiles() {\n\tif this.Conf.Exists(\"http.static_files.route\") {\n\t\troute, ok := this.Conf.GetString(\"http.static_files.route\")\n\t\tif !ok {\n\t\t\tlog.Println(\"Error initing static files: http.static_files.route\")\n\t\t\treturn\n\t\t}\n\n\t\tpath, ok := this.Conf.GetString(\"http.static_files.directory\")\n\t\tif !ok {\n\t\t\tlog.Println(\"Error initing static files: http.static_files.directory\")\n\t\t\treturn\n\t\t}\n\t\tthis.Conf.Register([]string{\"GET\"}, NewStaticFileController(route, path))\n\t}\n}", "title": "" }, { "docid": "514a646de6fc9f913a38b5c51a62e06d", "score": "0.48554948", "text": "func createStaticInfo(path, selfpeerid string) (*staticinfo, error) {\n\t// fetch all values we'll need to store\n\tid, err := shared.NewIdentifier()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstat, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thash := \"\"\n\tif !stat.IsDir() {\n\t\thash, err = shared.ContentHash(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &staticinfo{\n\t\tIdentification: id,\n\t\tVersion: shared.CreateVersion(),\n\t\tDirectory: stat.IsDir(),\n\t\tContent: hash,\n\t\tModtime: stat.ModTime()}, nil\n}", "title": "" }, { "docid": "492fd5bb5cf7125dd5a2b7ecc44947c9", "score": "0.4852544", "text": "func setFields(base *BaseSupplier, algo Algorithm, config *Config) {\n\tbase.status = &status.Status{}\n\tbase.status.Type = status.PREPARED\n\tbase.status.Value = \"\"\n\tbase.status.Checksum = \"\"\n\tbase.Algorithm = algo\n\tbase.Key = *config.Key\n\tbase.File = &File{}\n\tbase.File.Reset()\n\tbase.File.Url = *config.File\n\tbase.File.Status = base.status\n\tbase.File.Proxy = *config.Proxy\n\tbase.File.StoragePath = *config.Dir\n\tbase.File.SkipVerify = *config.InsecureSkipVerify\n\n\tbase.TimeOut = *config.Timeout\n\tbase.IsConcurrent = *config.All\n}", "title": "" }, { "docid": "e5a586922126a3e8d743c4191740d442", "score": "0.48281443", "text": "func InitAuthServerStatic() {\n\t// Check parameters.\n\tif mysqlAuthServerStaticFile == \"\" && mysqlAuthServerStaticString == \"\" {\n\t\t// Not configured, nothing to do.\n\t\tlog.Infof(\"Not configuring AuthServerStatic, as mysql_auth_server_static_file and mysql_auth_server_static_string are empty\")\n\t\treturn\n\t}\n\tif mysqlAuthServerStaticFile != \"\" && mysqlAuthServerStaticString != \"\" {\n\t\t// Both parameters specified, can only use one.\n\t\tlog.Exitf(\"Both mysql_auth_server_static_file and mysql_auth_server_static_string specified, can only use one.\")\n\t}\n\n\t// Create and register auth server.\n\tRegisterAuthServerStaticFromParams(mysqlAuthServerStaticFile, mysqlAuthServerStaticString, mysqlAuthServerStaticReloadInterval)\n}", "title": "" }, { "docid": "41a1d8203f2f8e37777146ee7b359702", "score": "0.48117036", "text": "func (cm *controllerManager) SetFields(i interface{}) error {\n\tif err := cm.cluster.SetFields(i); err != nil {\n\t\treturn err\n\t}\n\tif _, err := inject.InjectorInto(cm.SetFields, i); err != nil {\n\t\treturn err\n\t}\n\tif _, err := inject.StopChannelInto(cm.internalProceduresStop, i); err != nil {\n\t\treturn err\n\t}\n\tif _, err := inject.LoggerInto(cm.logger, i); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "de32d434cadf3c64c6df9b4b89249bda", "score": "0.47999147", "text": "func (c *Core) Static(prefix, root string, config ...Static) *Core {\n\tc.regStatic(prefix, root, config...)\n\treturn c\n}", "title": "" }, { "docid": "8e2ee7fc1de4d7b10584db45ef361aae", "score": "0.47959852", "text": "func (s *Server) registerStaticHandlers() {\n\ts.Router.\n\t\tHandleFunc(\"/script/source\", script.RouterOsScriptSourceGenerationHandlerFunc(s.ServeSettings)).\n\t\tMethods(\"GET\").\n\t\tName(\"script_generator\")\n}", "title": "" }, { "docid": "09395ada33625116bdc2b2b8e34e6123", "score": "0.47946504", "text": "func RegisterStaticHandler(r *mux.Router, logger *zap.Logger, qOpts *QueryOptions) {\n\tstaticHandler, err := NewStaticAssetsHandler(qOpts.StaticAssets, StaticAssetsHandlerOptions{\n\t\tBasePath: qOpts.BasePath,\n\t\tUIConfigPath: qOpts.UIConfig,\n\t\tLogger: logger,\n\t})\n\n\tif err != nil {\n\t\tlogger.Panic(\"Could not create static assets handler\", zap.Error(err))\n\t}\n\n\tstaticHandler.RegisterRoutes(r)\n}", "title": "" }, { "docid": "b863dd23e25e2c05b7bd611372406227", "score": "0.47811306", "text": "func decodeStaticHeader(rdr io.Reader) (hdr *StaticHeader, length uint32, messageType uint8, err error) {\n\tb := make([]byte, 1)\n\tif _, err = io.ReadFull(rdr, b); err != nil {\n\t\treturn nil, 0, 0, err\n\t}\n\n\tfirstByte := b[0]\n\tmessageType = (firstByte & 0xf0) >> 4\n\n\t// Set the header depending on the message type\n\tswitch messageType {\n\tcase TypeOfPublish, TypeOfSubscribe, TypeOfUnsubscribe, TypeOfPubrel:\n\t\tDUP := firstByte&0x08 > 0\n\t\tQOS := firstByte & 0x06 >> 1\n\t\tretain := firstByte&0x01 > 0\n\n\t\thdr = &StaticHeader{\n\t\t\tDUP: DUP,\n\t\t\tQOS: QOS,\n\t\t\tRetain: retain,\n\t\t}\n\t}\n\n\tb[0] = 0x0 //b[0] ^= b[0]\n\tmultiplier := uint32(1)\n\tdigit := byte(0x80)\n\n\t// Read the length\n\tfor (digit & 0x80) != 0 {\n\t\tif _, err = io.ReadFull(rdr, b); err != nil {\n\t\t\treturn nil, 0, 0, err\n\t\t}\n\n\t\tdigit = b[0]\n\t\tlength += uint32(digit&0x7f) * multiplier\n\t\tmultiplier *= 128\n\t}\n\n\treturn hdr, uint32(length), messageType, nil\n}", "title": "" }, { "docid": "3d82a4ab07921230c2051d6956d001af", "score": "0.477687", "text": "func JNIEnvSetStaticByteField(env *JNIEnv, clazz *Jclass, id JfieldID, val byte) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jbyte)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticByteField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "ad4b0380559d2fec2950c5603a187bb1", "score": "0.47730643", "text": "func NewStaticReflector(services ...string) *Reflector {\n\tnamer := &staticNames{names: services}\n\treturn NewReflector(namer)\n}", "title": "" }, { "docid": "5e49312cbfdcab82175d1a47064f6755", "score": "0.47490495", "text": "func (s *Site) writeStatic() error {\n\n\tfor _, file := range s.files {\n\t\tfrom := filepath.Join(s.Src, file)\n\t\tto := filepath.Join(s.Dest, file)\n\t\tlogf(MsgCopyingFile, file)\n\t\tif err := copyTo(from, to); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "54a7823089204fbf192bebf7faf3685e", "score": "0.47389653", "text": "func NewStaticCredentialsFromCreds(creds AuthValue) *Credentials {\n\treturn NewCredentials(&StaticProvider{AuthValue: creds})\n}", "title": "" }, { "docid": "9e43de910bc1170c3dd17c19e98ad25b", "score": "0.47247627", "text": "func flattenVersionHandlersStaticFiles(c *Client, i interface{}) *VersionHandlersStaticFiles {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tr := &VersionHandlersStaticFiles{}\n\tr.Path = dcl.FlattenString(m[\"path\"])\n\tr.UploadPathRegex = dcl.FlattenString(m[\"uploadPathRegex\"])\n\tr.HttpHeaders = dcl.FlattenKeyValuePairs(m[\"httpHeaders\"])\n\tr.MimeType = dcl.FlattenString(m[\"mimeType\"])\n\tr.Expiration = dcl.FlattenString(m[\"expiration\"])\n\tr.RequireMatchingFile = dcl.FlattenBool(m[\"requireMatchingFile\"])\n\tr.ApplicationReadable = dcl.FlattenBool(m[\"applicationReadable\"])\n\n\treturn r\n}", "title": "" }, { "docid": "091004990842d17c908b74a15d0ec881", "score": "0.46912274", "text": "func WithStatic(mount string, searchPaths ...string) Option {\n\treturn func(o *options) {\n\t\to.staticMount, o.staticSearchPaths = mount, searchPaths\n\t}\n}", "title": "" }, { "docid": "51a6950fbff45e9f485533cfb30ac95b", "score": "0.4672244", "text": "func expandVersionHandlersStaticFiles(c *Client, f *VersionHandlersStaticFiles) (map[string]interface{}, error) {\n\tif dcl.IsEmptyValueIndirect(f) {\n\t\treturn nil, nil\n\t}\n\n\tm := make(map[string]interface{})\n\tif v := f.Path; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"path\"] = v\n\t}\n\tif v := f.UploadPathRegex; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"uploadPathRegex\"] = v\n\t}\n\tif v := f.HttpHeaders; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"httpHeaders\"] = v\n\t}\n\tif v := f.MimeType; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"mimeType\"] = v\n\t}\n\tif v := f.Expiration; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"expiration\"] = v\n\t}\n\tif v := f.RequireMatchingFile; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"requireMatchingFile\"] = v\n\t}\n\tif v := f.ApplicationReadable; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"applicationReadable\"] = v\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "9ad2ca9303c73d61191d781e0d205eb5", "score": "0.46667415", "text": "func NewStaticCredentialsFromCreds(creds Value) *Credentials {\n\treturn NewCredentials(&StaticProvider{Value: creds})\n}", "title": "" }, { "docid": "ad653451ea5e1df8b2d13c6c1c90403d", "score": "0.46613142", "text": "func (shr *SSHRunner) SetStaticDataRoot(root string) *SSHRunner {\n\tshr._static_data = root\n\treturn shr\n}", "title": "" }, { "docid": "d71619593a32f93f182d593c0fb11d58", "score": "0.46446678", "text": "func NewStaticSet(id int, members []string) DispatcherSet {\n\treturn &staticSet{\n\t\tid: id,\n\t\tMembers: members,\n\t}\n}", "title": "" }, { "docid": "0ca75adeaff572038d6d27094bdc64b7", "score": "0.464393", "text": "func JNIEnvSetStaticCharField(env *JNIEnv, clazz *Jclass, id JfieldID, val uint16) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jchar)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticCharField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "bc5d0fe23966794fafa3cc3117228cc0", "score": "0.46275362", "text": "func (s SourceFilesystems) ContentStaticAssetFs(lang string) afero.Fs {\n\tstaticFs := s.StaticFs(lang)\n\n\tbase := afero.NewCopyOnWriteFs(s.Assets.Fs, staticFs)\n\treturn afero.NewCopyOnWriteFs(base, s.Content.Fs)\n\n}", "title": "" }, { "docid": "18be4c82b25027969ec4f6b7d83deda8", "score": "0.46099135", "text": "func NewStaticRegistry() Registry {\n\treturn &staticRegistry{}\n}", "title": "" }, { "docid": "93a15ad2938129f95ff1cc16e0e77613", "score": "0.46031597", "text": "func StaticFieldFromInstance(val reflect.Value,t reflect.Type, fieldNo int, name string) *Field {\n\tret := StaticField(name, fmt.Sprintf(\"%s\", val.Field(fieldNo).Interface()))\n\treturn ret\n}", "title": "" }, { "docid": "4da40a94ea75c7f8cc0acdd1757dc42b", "score": "0.45879415", "text": "func (recv *FontDescription) SetFamilyStatic(family string) {\n\tc_family := C.CString(family)\n\tdefer C.free(unsafe.Pointer(c_family))\n\n\tC.pango_font_description_set_family_static((*C.PangoFontDescription)(recv.native), c_family)\n\n\treturn\n}", "title": "" }, { "docid": "3b7e8313d05989a69f1e7a5c00be7086", "score": "0.45849848", "text": "func (s *Settings) ModeStatic() {\n\ts.Mode = StubbingModeStatic\n}", "title": "" }, { "docid": "0a6d6035694ef0fd8e5006c8bbab78ec", "score": "0.45799014", "text": "func RegisterAuthServerStaticFromParams(file, jsonConfig string, reloadInterval time.Duration) {\n\tauthServerStatic := NewAuthServerStatic(file, jsonConfig, reloadInterval)\n\tif len(authServerStatic.entries) <= 0 {\n\t\tlog.Exitf(\"Failed to populate entries from file: %v\", file)\n\t}\n\tRegisterAuthServer(\"static\", authServerStatic)\n}", "title": "" }, { "docid": "20117fe83fcdae074f21f838e661bf06", "score": "0.45768768", "text": "func (s *Server) static(w http.ResponseWriter, req request) {\n\thttp.ServeFile(w, req.r, filepath.Clean(filepath.Join(s.basedir, req.r.URL.Path)))\n}", "title": "" }, { "docid": "3eddf43c0b224608b4bfc7b457657ecf", "score": "0.45678037", "text": "func JNIEnvSetStaticShortField(env *JNIEnv, clazz *Jclass, id JfieldID, val int16) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jshort)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticShortField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "c7dc1fec12c93e0e02381f71d6705324", "score": "0.45540535", "text": "func JNIEnvSetStaticFloatField(env *JNIEnv, clazz *Jclass, id JfieldID, val float32) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jfloat)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticFloatField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "639ae148dec7398ad98c185d96df4c21", "score": "0.45514148", "text": "func StaticSnapshots(packageName string, snapshots []string) (string, error) {\n\tvar entries []entry\n\n\tfor _, s := range snapshots {\n\t\tentries = append(entries, entry{Name: s, VarName: asSnapshotVarName(s)})\n\t}\n\tsort.Slice(entries, func(i, j int) bool {\n\t\treturn strings.Compare(entries[i].Name, entries[j].Name) < 0\n\t})\n\n\tcontext := struct {\n\t\tEntries []entry\n\t\tPackageName string\n\t}{Entries: entries, PackageName: packageName}\n\n\t// Calculate the Go packages that needs to be imported for the proto types to be registered.\n\treturn applyTemplate(staticSnapshotsTemplate, context)\n}", "title": "" }, { "docid": "21ec2e7b55402b620a8629c7bb0e500a", "score": "0.45489073", "text": "func (a *App) SetStaticRewriteRule(route, match string, action RewriteAction) error {\n\tmountedRoute := a.formatStaticMountRoute(route)\n\tif static, hasRoute := a.Statics[mountedRoute]; hasRoute {\n\t\treturn static.AddRewriteRule(match, action)\n\t}\n\treturn ex.New(\"no static fileserver mounted at route\", ex.OptMessagef(\"route: %s\", route))\n}", "title": "" }, { "docid": "0d11f190ba739f751a3d7fb14f84571d", "score": "0.45481953", "text": "func NewStatic() *Static{\n\treturn &Static{\n\t\tHome: views.NewView(\"bootstrap\", \"static/home\"),\n\t\tContact: views.NewView(\"bootstrap\", \"static/contact\"),\n\t}\n}", "title": "" }, { "docid": "8f2d39e48f09f17baf876dfdec978ee0", "score": "0.45476684", "text": "func init() {\n\tpermissionFields := schema.Permission{}.Fields()\n\t_ = permissionFields\n\t// permissionDescCreatedAt is the schema descriptor for created_at field.\n\tpermissionDescCreatedAt := permissionFields[3].Descriptor()\n\t// permission.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tpermission.DefaultCreatedAt = permissionDescCreatedAt.Default.(func() time.Time)\n\troleFields := schema.Role{}.Fields()\n\t_ = roleFields\n\t// roleDescCreatedAt is the schema descriptor for created_at field.\n\troleDescCreatedAt := roleFields[2].Descriptor()\n\t// role.DefaultCreatedAt holds the default value on creation for the created_at field.\n\trole.DefaultCreatedAt = roleDescCreatedAt.Default.(func() time.Time)\n}", "title": "" }, { "docid": "b1890b5eb996dcabeec78af75015b67d", "score": "0.45453447", "text": "func (m *Module) loadStaticValues() (err error) {\n\tm.CommonStaticConfig, err = utils.NewModuleConfig(m.Name).LoadFromValues(m.moduleManager.commonStaticValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\trlog.Debugf(\"module %s common static values: %s\", m.Name, utils.ValuesToString(m.CommonStaticConfig.Values))\n\n\tvaluesYamlPath := filepath.Join(m.Path, \"values.yaml\")\n\n\tif _, err := os.Stat(valuesYamlPath); os.IsNotExist(err) {\n\t\tm.StaticConfig = utils.NewModuleConfig(m.Name)\n\t\trlog.Debugf(\"module %s is static disabled: no values.yaml exists\", m.Name)\n\t\treturn nil\n\t}\n\n\tdata, err := ioutil.ReadFile(valuesYamlPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read '%s': %s\", m.Path, err)\n\t}\n\n\tm.StaticConfig, err = utils.NewModuleConfig(m.Name).FromYaml(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\trlog.Debugf(\"module %s static values: %s\", m.Name, utils.ValuesToString(m.StaticConfig.Values))\n\treturn nil\n}", "title": "" }, { "docid": "cfb4f1425a2eaf67822de36fa1c4b70d", "score": "0.454389", "text": "func NewStatic(signingKey jose.SigningKey, verificationKeys []jose.JSONWebKey) *StaticSigner {\n\treturn &StaticSigner{\n\t\tsigningKey: signingKey,\n\t\tverificationKeys: verificationKeys,\n\t}\n}", "title": "" }, { "docid": "4af3244f479d0e126ebcd66f7ecd7571", "score": "0.4539344", "text": "func (s SSES3) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "fc1d2e5a1f5f5dfef67b73e5aa76f25b", "score": "0.45347023", "text": "func AssetFields(r Resource) map[string]string {\n\tresource := r.(*Asset)\n\treturn map[string]string{\n\t\t\"asset.name\": resource.ObjectMeta.Name,\n\t\t\"asset.namespace\": resource.ObjectMeta.Namespace,\n\t\t\"asset.filters\": strings.Join(resource.Filters, \",\"),\n\t}\n}", "title": "" }, { "docid": "e9cb41d29f149e310da60d52e9eaf509", "score": "0.45346388", "text": "func (d *DatabaseV3) GetStaticLabels() map[string]string {\n\treturn d.Metadata.Labels\n}", "title": "" }, { "docid": "4d98f573f3b24e11dd3f6b883ee1b5fb", "score": "0.45191854", "text": "func (s *Server) setupStaticFiles(ctx context.Context, router chi.Router, path string, fs http.FileSystem) {\n\t//exclude path parameters\n\tif strings.ContainsAny(path, \"{}*\") {\n\t\tpanic(fmt.Sprintf(\"invalid static file path: %s\", path))\n\t}\n\n\t//prepare to serve the file\n\thdlr := http.StripPrefix(path, http.FileServer(fs))\n\tif path != \"/\" && path[len(path)-1] != '/' {\n\t\trouter.Get(path, http.RedirectHandler(path+\"/\", 301).ServeHTTP)\n\t\tpath += \"/\"\n\t}\n\tpath += \"*\"\n\n\t//attach the handler\n\trouter.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thdlr.ServeHTTP(w, r)\n\t}))\n}", "title": "" }, { "docid": "265147c62eedf2c6747d90c3feadb1a3", "score": "0.4500325", "text": "func CreateAllStaticResources(args *FactoryArgs) ([]client.Object, error) {\n\treturn createAllResources(staticFactoryFunctions, args)\n}", "title": "" }, { "docid": "0dd33f935e390ee3584ee60ffdbabbb5", "score": "0.4495403", "text": "func AssetBuildFieldsFieldsCommonYml() string {\n\treturn \"eJzsvW13GzeSMPo9vwJXOefa3oeiXiw7jp4zu9djO4nu2InWkic7u7Mjgt0gibgb6ABo0cw9978/B1UFNPqFFGWLHvus5sPEanYDhUKhqlCv37Jfn7/9+eznH/8v9lIzpR0TuXTMLaRlM1kIlksjMlesRkw6tuSWzYUShjuRs+mKuYVgr15csMro30TmRt98y6bcipxpBc+vhbFSK3Y0Phwfjr/5lp0XglvBrqWVji2cq+zpwcFcukU9HWe6PBAFt05mByKzzGlm6/lcWMeyBVdzAY/8sDMpityOv/lmn70Xq1MmMvsNY066Qpz6F75hLBc2M7JyUit4xH6gbxh9ffoNY/tM8VKcsgf/j5OlsI6X1YNvGGOsENeiOGWZNgL+NuL3WhqRnzJnanzkVpU4ZTl3+GdrvgcvuRMHfky2XAgFaBLXQjmmjZxL5dE3/ga+Y+zS41paeCmP34kPzvDMo3lmdNmMMPITy4wXxYoZURlhhXJSzWEiGrGZbnDDrK5NJuL8Z7PkA/yNLbhlSgdoCxbRM0LSuOZFLQDoCEylq7rw09CwNNlMGuvg+w5YRmRCXjdQVbIShVQNXG8J57hfbKYN40WBI9gx7pP4wMvKb/qD48Ojp/uHT/aPH18ePjs9fHL6+GT87Mnj/3yQbHPBp6KwgxuMu6mnnorhAf7zCp+/F6ulNvnARr+ordOlf+EAcVJxaWxcwwuu2FSw2h8JpxnPc1YKx5lUM21K7gfxz2lN7GKh6yKHY5hp5bhUTAnrtw7BAfL1/3teFLgHlnEjmHXaI4rbAGkE4FVA0CTX2XthJoyrnE3eP7MTQkcHk/Qdr6pCZhxXOdN6f8oN/STU9ak/8Hmd+Z8T/JbCWj4XGxDsxAc3gMUftGGFnhMegBxoLNp8wgb+5N+kn0dMV06W8o9Idp5MrqVY+iMhFePwtn8gTESKn846U2eu9mgr9NyypXQLXTvGVUP1LRhGTLuFMMQ9WIY7m2mVcSdUQvhOeyBKxtmiLrnaN4LnfFoIZuuy5GbFdHLg0lNY1oWTVRHXbpn4IK0/8QuxaiYsp1KJnEnlNNMqvt09ET+JotDsV22KPNkix+ebDkBK6HKutBFXfKqvxSk7Ojw+6e/ca2mdXw99ZyOlOz5ngmeLsMr2Yf2vvYZ+9kZsT6jr473/To8qnwuFlEJc/Xl8MDe6rk7Z8QAdXS4Efhl3iU4R8VbO+NRvMnLBmVv6w+P5p/PybRZoX608zrk/hEXhj92I5cLhP7RhemqFufbbg+SqPZkttN8pbZjj74VlpeC2NqL0L9Cw8bXu4bRMqqyoc8H+LLhnA7BWy0q+Yrywmpla+a9pXmPHINBgoeN/oaXSkHbheeRUNOwYKNvDz2VhA+0hkkytlD8nGhHkYUvWF877ciFMyrwXvKqEp0C/WDipcanA2D0CFFHjTGuntPN7HhZ7ys5wuswrAnqGi4Zz6w/iqIFv7EmBkSIyFdyNk/P7/PwNqCQkONsLoh3nVXXglyIzMWYNbaTMN9cioA64LugZTM6QWqRlXrwytzC6ni/Y77Wo/fh2ZZ0oLSvke8H+wmfv+Yi9FblE+qiMzoS1Us3DptDrts4Wnkm/1nPruF0wXAe7AHQTyvAgApEjCqO20pwOUS1EKQwvrmTgOnSexQcnVN7wot6pXnuuu2fpVZiDydwfkZkUBslHWkLkQzkDDgRsyj6KdB10Gi/JTAnaQVDgeGa09cLfOm78eZrWjk1wu2U+gf3wO0HISJjGM34ye3J4OGshorv8yM4+aenvlPzdqze3X3cUt55EkbDhuyXI9algQMYyX7u8vLU8//+7WCBpLXC+Uo7Q20HLOL6F7BBF0FxeC1BbuKLP8G36eSGKalYX/hD5Q00rjAO7pWY/0IFmUlnHVUZqTIcfWT8xMCVPJCROWSNORcUNJxWElm+ZEiLH+8dyIbNFf6p4sjNd+sm8ep2s+2zmFd/AeWCpyJLCIz1zQrFCzBwTZeVW/a2cad3aRb9Ru9jFy1W1YfsCt/MTMOv4yjJeLP1/Im69KmgXgTRxW0kbx2+9NB83qFGRZ0esNu8iidMUU9G8AiJMzlob3+xYlwBam1/ybOGvBH0Up+MEPNNlcweo/itdY9vI7sD01N9x9012nKgxWSE7esyL5skGReY5fekJLhczUPg47pxU0knuNDAlzpRwS23ee01HCVCo/KkLsKGCYsScmxwEl5dLWtlR8j4KranEm77UXvOdFXrpb2hep2upzZcvzmlUPBUNmD3Y/AP/egIZcBErVFRX/DsXf/uZVTx7L9xD+2gMs6CmXRntdKaL3lR4o/VipTVp0LMMXNeFvxQFTSBgyRmuLAdgxuxClyLK5tqijuOEKdleuKZrs9do9UbMhGmBojoLtKhm0M+kg+LOTkXUwUAHTRCAIDAPlpqHbW6mSOFHbZqIKEzgT05ta48QGrVR/qTy4P1WK9wA0AVRuwtGFDYwWoNgpV1vTM/VccP24ZCF62u89OJ4B2GiaKYAZo1ywt+ErSi5cjIDLV18cCRSxAdUFkbIwb+JrD0IFqfZtfTrlX+IRrP3KxUGtH0rXc1pP85mbKVrE+eY8aII1CdVkGtOzLVZjfyrgSNaJ4uCCeV1WyJctI14rpkL6zx9eJx6hM1kUUSli1eV0ZWR3IlidQutjue5EdbuSqEDckcVnoiLJiTmG/lMOZXzWte2WCE5wzeRYy89WqwuBdiEWOFvgFyxs/MR4yzXpd8AbRhntZIfmNWeTsaM/a3BLMkIMFo0asFCMMOXAaZA+JMxPZggytoiTvkbQCPB8hqNFngFnYxlNfGgTMYI1sRf4yqhctIxUEHQqgEC7hO0Y2FXpisn7A0ypdBR18erRfuz1j782f+A14po2aP98Pdmzw/wOtCVL0fPTlqA4aJ2IO3o/OL449acc6HHmXSrqx1ppi+kW8FUvdW/0coZwYs+OFo5qYRyu4Lp50RLjpP14PtZG7dgz0thZMYHgKyVM6srafVVpvOdoA6nYGcXvzA/RQ/CF8/XgrWr3SSQBjf0BVc872Oq0Fmq068DZy70VaVl5Ettq5RWc+nqHHl1wR380YPgwf/H9gqt9k7Z/nePx0+PTp49PhyxvYK7vVN28mT85PDJ90fP2P//oAdkH193x6bfWWH2Ay9OfkJ1L6BnxEj5RgmsZ2xuuKoLbqRbpUx1xTLP3EHnSJjni8Az49UGKVwalKaZUE4Y0rxmhdaGqbqcCjMCVX4hG73GxkERvIJVi5WV/h/BtJaFY20TEH7WLnEfgOFQKsZrp0tg4XOhw2r7F4Cptk6r/Tzr7Y0Rc6nVLk/aW5hh00Hb//cX6+Da0VEjmAZP2r/XYiraiJLVDTDEF9rEeXYeBXTgiCAsUspCK4BWwsveaNM+O78+8Q/Ozq+fNopHR9aWPNsBbt48f7EO6nRyVGlvIepbk5zj1x8l2I/bcGjjPhYIbdymJdZWmLEouSx2xL0882IwQcD4AACzuigGzsGdAvHAMj8NTAssi19zWfBp0T8ez4upMI69kso6QQpVC17Q2sc7s7T2rY0zsqzDxNEgArfEg6rgzuuYA3hFOHeI2FQTwsn6QCy4XexMNCKm/DzMz+PPVaaNEf5e2jLrz/AG4l/0MkVptUqdhKimJ0zrnRVkspzAKmSONwf4w69uEl1JmVYz3CtetOb0ukbGVXNjZsH12+FyNMMOON0vHaZbd0krMkCAoQ/VjqTTxcIzJlQzwM0jVR+Q5EhyOJItO5quccpoRgsP1lvRMOKDIXnkgQnDUAxMQzPDoxu4cXDhbRitw+FSBzZittahNWNvhDMyQ0OzTQ3ZXLFXL47RjO0pZCZcthAWtKxkdCadJR9iA6Snrrbru+XDlDYaSNsg0LimVuScNKLULppTma6dlblIZupChjBxRt6zsKCw6ar5lDTEtpceB20GAjchTR4EoR9W2gZUQtht7CUZ3F92x5kfXDYIwrnAPWrmXMk/8NDLPLq86ZStWC5nM2FSmwnowRIcvYzj8dx3QnHlmFDX0mhVtpWohrae/3oRJ5f5iP2o9bwQSP/sl7c/srMcndJgMu0d+L7m/PTp0+++++7Zs2fff/99G50oIWXh7/d/NGaRu8bq82Qe5ufxWEFbDNA0HJXmEPWYQ233Bbdu/6ij0pInYXfkcBY8SGcvA/cCWMMh7AIq94+OH588efrds+8P+TTLxexwGOIdiuwIc+rr60OdKODwsO+yujOI3gQ+kHivNqLRHY9Lkcu6bGvJRl/LPAYp7FLVQQ4QJhyHw5kGYPGlHTH+R23EiM2zahQPsjYsl3PpeKEzwVVf0i1ta1l4S9zRouiS+JHHLRXHyOgJ+0Ektx5ucG7FF9sODPIs9OLjkpCdSmRyJsMdMUKB5nnyQZGVXs/SQZJgS2FFmHchiipRIEFeYfhqHNqSJFQrjyAnS3ELAbUTHY+U4GbxMm+fYVny+U55Sno2YLJoGkWAltyyaS0L58X5AGiOz3cEWUNZBBeftwFIIkA3z55Egm6IBe0yW5iUwipb8+5wN5o1N8afyE2QZHfFTnB0VnLF5157A34S6aDHSTACNWEjiRctZSQvO483sJLk1c3uVtSek7fBmoomn4N2JObAmImH9SbfKnIf8q1+ib6/lutyKwdgo8Zi8PYdOQDjsOAI/J/tAEw3JRgLKUq/c4g+mxcwPQb3rsB7V+DdgHTvCtweZ/euwHtX4NfkCkyE2NfmD2yBznbsFLyFsN+JZ3DtYu/dg/fuwXv3ILt3D35t7kHM/+5kgG8yHLwRju+nuxNMi5RhjlNuc3G/KelgIHP809Kykqx60L0oolfDYixzeswmIrNjemmCSTwBjIbCwWPnibKsrcNUJjgMRS+em7Ff/U3791qYFUSoYw5XJCOpcpkJy/b36UZd8lUACJL4CzlfuGLIMZasBr6nugMetMILTqmcmBuKG+f5bx7UIDKzhSh5B/+slVxr+8oiFCJIKccY3bJiv4oPNueZNlbkDJKSKMQdB4RzxNWKvZeqsVi8wxSDEtOi8D2wXGNGpUdeIdAN69EcskuBR2XcCtukYoZlwd5LZ0Uxa7yvXOHotzA/7Ug9BmTC4OGKgGZCQQC2FdEdWssHpOcABGn++nowYg774GJDNnZKY9edHKBX11vmMuP+DnlJQjrDsKOk0EEJRIeKkVmLViJJPof0+HaSkSefwFM8QfktS9KHwfK3wH3kTTZwYNKvmzR+YCwhtRlya2Qp/GU1eJ/8Uz9QHKPJiNazZBE0XhiKhwxbBkmkIdCCwiealCjU3dlUYOYTqeA0Jg+mWqcZT1XiERovB/KqpsIthfAzhfwJlVOMRPRD4mSUkoQ50lmhvZBnz8NO3IxuvCzRkKU2wt+4wZxUwIiYrwJ/ponmANAwopPXaNgmVbuF9ZRaGpSXotRmxTyTg3wYGi5PEN8Q3HVdKGHQwy+bXHh62XolSOSYCX+bYI8tTEEfHeSBo7OMV1gSgrIg244BSoqNxg7KPmsOoEwqvYzZGbgkYfca7WLBFZvgCyHraNJkWMaN8Gd9AgjZ53k+GbEJkfw+kLyARzNZiP3MCE9oE0zVCXVZ4ogxATtQHK1M+nlKsOz0haRXuvYrbq1H5j5mY7XFBYG+i+14hYeBZugiPwq5hZwvKP1smAcChwQBOuvtShwTdgey3TqbgwQxGYU9tUJZSgNrDFU8ghnhakYO2hEPmYG/cuMPN9Q/mNUQcxZVHz3zqtCILQWrCg5mAYo3YDwOWVCxDZ5lonKQA00hCCjTguo0YhVWWaqtQK9Uxuth2xnsNPjvGtYQNxkp64Y9jgWQuvtIRI6D9KLYhqsjeZ4EBYPimo3gQLMh1RxzVVeY09crGUREggqkP6rSs/WMbC9NkaeY+Zc8araVYI1jRo46UJMp1orpsoozxUptXZKLCAZUT0RL3dRTsuhOm4oBLRmPdPgza7xUWbuqUMaLDFySZN0p+CrKKsATSToqBAUqPAmdJlClJTpgW+DTUE3FWBekrsiZ7KT8B0hKrWSTiMuSIR48AE027Jj/M4SAOc3eC1GxukJihY/SalRtrEIKOkDaxqNnmajmZbwYpTvb+AcHbts5d9yKm8xqH8XJUnsITdPJ0M+08kcZ7fkTemfCHnrOboVjBySOrXCPPD0HyzhWlvDKA7P1tAEfrj+lzutCWGB1rWOX8knUDPwO1sbTWrEKRaSkaiZNL/xIIs1POI3fVIIWXu6zGOu4a8c45bXZxq8z4FPtfClVVbur8KPiSluR6Sa7XNcufYHbN7Io5OA7lRGZtLBvR4Ob+ZKmbokTj6xk2nYZCeQIIK8Bdfi38DqjEey90kuVFlNrqNQNn/pwpGF2hXd3HD0JS4p3DrWNPXId825A7fHtLsuGQT0VxOde4F2nrifP1QvuZRcWFurEK+3QJPgTtwv2sBJmwSsL5YWg7M5MqrkwlZHKPfL7afiSZIbTfgNAtDodF5CLUivrjF8+3JfAKiHdasBgHwI+h/71/M8vXn62K+/ZS7+aGA2TqLMdmAcrz7yXWxHQRyvcfvzhQmgkw+fyGuKlu6rdklSwboRfQpKBZhvhFoq70VUwsfVt0BQ72jg8nTRjTjxjE14P5wU35eTLVPAAyLaRA/j2ruUdSQf0Dm8suIOFhtJbVOvNZLSu/NMmVtLqL7xc2d/bESJBVdvF0t/yJdiFYslAPQOPt4nU9I5UpA28ZI0Sq7SXM7n4IJDn5zq7SkKPc2k9peQo78HBAOqk4CZbiLwh2GntmIxFnIwX5OI66LKTK9S1Jn1MXoiKHX3PDp+dHj89PTrEgOEXr344Pfy/vz06PvnfFyKr/QLwL+YWXuXHO4XBZ0djevXokP7RnExtSmbrzCuWs7pANaSqRB4+wP9ak/3p6BCKyB6x3Lo/HY+PxsfjY1u5Px0dP267SXXtMr27qAzPvmiKdRysVVK1sRf4S0yGNqbmMNu2jG2NnBRKCkVrGlsNvkjciVBI5T1nXBa1EYM8KY64FW/anifFcbfnTQhza++MtO+vbHIo1x3TWaH5oBn2rbTvGYyAtfik9sTZVtseivF8zCwRLrO6ABDto8YU884KujyBYxWuL3TVQ31tIUw32jbCfqW0Kbegv7WLePAz2G3kHyKHYW9Y0Cia1rxGPouLOPR7eXR4OFDXreRSYawNeTZXuoY9KzEYkyuwQlJtIrgsc2vlXNkEINu+P/ohlhzzna3w1KOaZSDWyHfEiyJUXuoorlZciyRw6bZxDhf0ecdKF/cuDN+R9b8uMIaqUfnCJbz5gsi+FFwBE70WJrmsR/Xc4xC8NZ4hP2gMQnUV9I3E9gaXZv5eMLCq0lRShBREZaV1YGlGtAXHXOcgPfiug0N/K/hk9R/vFjdeAMggmV4BWkzLXwUaw86aO4C/weww5exBIlGbe1ZSIrW1pAcPbGNYSCuEMpLF5NEgmNtKamEEz1fEYXIx43Xh2MXKelnfWCsSRnOGthGAlBeYx7eUNrV6PG94b5wUpwRCOQVDpNIKHAJnL2nyvVe10ZU4eF5aJ0zOy71HyXGdTo24Rh9FeP3icu8ROD8U++mn07JsiFvyIry1f/jk9PBw71Hn2O6qxuFbgeQC0oaU6hodbHEtVFOeX2vIxoyZCE3dcIj08GroOK0xPJOkB5Nb7ofw98bCfFAVv+PCYVa4/n0EvGOWTT1XaBtTycvkfwXHe/CNgCUF2GJTdM9PR9W/g+7GrdWZbIr7gkYWqvK1SsXZkWfMB2SkCXwDfTuwoV4T0VZQPW/0D8CUZ0EvZW/QqOfR+l8/nL3571D72zYuKsrnhfJ94MNGxSZoEf1MDD6bCTSk+tc76wlUkxTNJ7vTbTzaWya+rOOBr3koWw8glsJxjIYFb0iHfeXCL39HzOslDL4mxw2Tr4uOJgJz98NS7o6fwi7HWbrqRUzzKPSSCW5XHkQngISmK0Ro/HggSKMi2R5jZncWXHduJJRkx1A6zzp/PHv5aD1iG5rbNSxpvm4fDql6ARt3mDKsc9HuLRGACN6wlE+xtm1hZ2nDHqgEHx4UnTledMpL9pSjk6OnbRjvljGQ8Qg0nFLncia7zEEv1c7SlFE6+AkegHXE9HMAK+52ZV49524RlNo+jVr5xzZ4XqfJw9L8GH6nIZmKPYw2Ee3vLjzPg+428WNBqBt4xSePOuolN3PhrnaIikuYAZANGoddlYVU7zvxzTtMqwd0gV0UvEcjlksDSgZB0sFIvTOWeklRm8BN3wE3Nc1VOwnEenjRYbVIyGnk1FzoVEH7kf7coJ/9KHQal5dx4y9pTdUU3lh/Q0ZJWiCGq1RHarfoSZJQWooeKWW5MDKa05zIFmCGb4r+e8jOzpMwGfRHmn1bV1Uho2NyK+Xmy8m7++Jz7r7AfLsvLNfui8+zu8+x+zJz7L7E/LovILeuf1kI8is+WC/BLmNiTxL2WwqyqjZx5vAOxY9D6wRRiGseDydpZYnH92MKlnxRSUyfO3Mpxido24re/in8vdFMFMrqtMxEVFefZbqsaoeRwlQDKvaEenGBobGhsdOwwTLt6dSYVbCDU1Pep50nEMKsQS0ENWUwPjiNDPZrBbzGUGAaccFNvuRGjNi1NK7mRSjfZEfsJdT5SGrogBGK/aWeCqOEgwY/ubhVdQyTLaQTWeK/utO8qCrExYVWDMl8vXP+4dnTq6ftIgz3tRDuayHcHqT7Wgjb4+xeT7uvhbD7Wghefu4Ikgc/0dhpzcM0ZMQlzfKCz3VJbmk2CZBNvO5Q+vNrhKsNFnjtlVB8sFGru9MmeajnpGWZntuIxxC+RB1fMN94BC5y8qZH/dWruFLNIRiBYs83lkZFTZmil9El6DE7gQZ7gKkuFj6uzgVoQLIarlewm/oUP9FWDs+5K/r8eSNtgjGNUtyBKhOKTCjxHZT8wsAOYpIQ1PV7zQswjccxqVAYFmDAjDsPAFnnmkQlSACHvbZekhiWi0zmkAvrdVcgo4axa/9+Z+O1Hc94KYvVjkTTLxcMx2cPg63PiHzB3YjlYiq5GrGZEWJq8xFbSpXrZeP+b2rjwZs9uOtiV6U4ejovlcIALT/4fEKieUjiHVZBeeZx8Eb/xq9FdwXvvcr/2daAs0Ww4c5l+JJZZ4ZKm56MT8aH+0dHx/uUAtaFfocKzRr8h0jlBPvrEP4fXWjDtflzQRzmI7r3upG2I1ZPa+XqTbTOzVL2aH2wkMLugN+WRo4Ox0cn46MWtLsKdgkNPTvs9wdtqN53qEFMXWXJ89Cqru6HgLbEk1g3eQLl4a/LUaIAQ5B1ouvGy/oobdqaVBZPPR6NrI4jDsnsgbIm98WF2tR1X1zovrjQfXGhL7u40MK5lhX/p8vLc/j7Np1H/EcxHHYcSsGwSW2KSQhMFRg4nbTFBCBNEeCltrbb2/PDB1Odr8YDdWxvCsi4sZbtRSs+ow0mg1m76H327Lv1IFIwzY7O8CVdR3AzNkL5kygKzZbaFPkwtDvA5aV2vOhEvHQw+tADC4d9IbjXA/rK1dHJ42EEl8It9M5y+looxak6uc5I5JgFAJVhpiJND3CaFXopDKR3exYayk2N2YWgnFid1WWI84pjW6rOsncWwuq9lvfqxcVe3zw2F27EKigTU9VuEE3Q5NnsLGDrLQ3fZM+kmOvtpuc99vTgYFro+ZiejjNdHnRgt5VWVnz2c47TbnvQUyA/70nfBOf6ox7g/dxnnaD9uMNOQFvHXW0HTL23isFrow/HHDbunhy2PWK7vc0BXOuux0fjtFVJqCJFwvs1/Xmj7EbzEm8V79GQsZkm4WwjhGHxu7gu/hKSmjxU0eFB9b96OYnYAqCV0rzkRk1GbAKl0Pw/5ED6pzCmtZxdptGG5LRWypZfTEir5d2SBHDKkzcS9XeGlZcK6dDT7lgNhV+ihlpx06pyeIYmTsObIoMTGjboaEgVqTEUGtaHsjB+xDT/LuwFjZKmfXayPmmxo96CQlpvHHPBr0VMM7J+UzHsOAtVEjGaEI0AQmUaux0YpsSSFVIJC+3grpMLib/KFIIryFFrg/ypWcnMako6fvAARL4X66kdeBqMXaAYfHJyMnjawCfxZkVnPxrOMTEm5QY/J49uKMUX0mraIR1oOinLWhH+MQJYXwsTOEgTP8JwF5L0HArJsGl7ovDGRwWAhNE7NTi6CUOh/M9tQjAqbK2xw6SS53hLm8troTAYN52VOFxltNOZLtoFiLiZSme4aaz8jNJVKXUMCg1aPBSlzIwOKUsjoEBeWA2TrfDkNy/b96tKNJYzmf0+YjOeianW70fMLaVz6KCQli3TOkOe1TTFn5rSnexaqDypkQTR0dgOMUYSexGbx8jhWAYBT8FB7nXss3MMl7YjKAtuRywZcylNyBD8ArVwLtut3O66wcoD1K5Qq3KGKws6N+zIVPtzI42gqmytnP0J1ZuCLymVPi2WHp6H8j0jNgmHlX5C2SWbnbB12UfA46fPWgggDuJWV7trZfkcrVZQwBOSx4BpJ5Xoz86xfiRRE7dsKYqCmFxcTzh+TWBCm/+NY4I5Z07rYp/PlbZOZl57VDk3rVaZcdhZoZfpZrwW3ChMRecu3oLm0i3qKdx/PIFAwbSDiLx9me97XW2g6O/p4pf/ZX8++el/vfnxyZu/HTxbnJn/OP89O/nPf//j8E+trYiksQP1Zu9lGDzoaYFdO8NnM5mN/67eCr8eLKrUiNPTvyv294icv7N/YVJNda3yvyvG/oXp2iV/SeWEUbzAvzwFNX/VCgj37+rv6teFUOmYJa+qpOwwNYD1wmsfe+KVTR4oVZ8dRYGUKDbpmJFz+WEeWAahSX7x11IsxwjDmokDarRhlTCyFE4YBKQF9HYwNYC0IPD/Ba8FTZaOHCcd73XJiXDfopuZNktucpFffUqcQdJTI6ak03FNfiIFuTL6w0AFqu+Px0fjo3G7JIrkil9hpNKOGMzZ85+fs/PAHX6GqdjDcHKXy+XYwzDWZn6Aghkq1h4EfrKPwPUfjD8sXFkk+fIXxEdAXoXqJOErS/yHF1CpAjgYaDw/C/dDoZdYNA3+RcbZOG6h5+HWV5N1dmhNPYS3swt37QFB5Wi6YhocmlBCXAfpa5totSCXutD+CAa6X+VMtsD+tDYnJHBpkI8SufTtgNBtfhkQu+HHRj8jATwseI/bRopANbu4yr7+LtwuGpkJ4RNMfBiDRBuxAijqN555TdIjzcveRsP98jS36AqJnvAA9S5QeOEJnttIywkTQ60dvKa8qfkg2F9wnvQYxpYADYYLvvLMqc6rEXNZNWKyun66L7OyGjHhsvGjLw/zLusgfkchCGcodH65OIOM6wKF6DINFQhk/dpjcexxd4IYTG5JlRXZiFWyBIR+eej0QCemASpK02oE8Uv6bFOqh4qf98uCVCKTvAgUPIp5sBjy1rtSYx2JWE43F05kbhTGh4+wkMjNI+635RspV0kJ13ZyawwG4SyrrdNlzPDAQaGHODi2aamd8iZazeS8bhqMOM1MrbZHALN65vx0SYWzdsbJTBqx5EVhR17DNTVE7yCGpFYHlYElwlAh/jDokImWaIWy2sS6VUsxbUGRTALx3oW2lg0N7RH5/PwNYcOmfVIDNaQGHI41ntfYb4hB4eAYMaJWo7T+G67TRlKwoawLkoNtFOYNKA7FVGhMKqnC3pBt9fda1Dgwe3X5GnKUtAKqCXc9KgDdbk5C5BQsTUaAaRBqV+UCqv4TPqCl66sXF7cwOt3n1dzn1dwepPu8mu1xdp9Xc59X81Xn1XTTaqL0bds/Ps4o0+9xOjz8Z+tT2lJU7xMc7hMc7hMc7hMc7j7BwQojebFbg3G4X9NkJO9vqpd1dy2/Qg+BlK3GVi2bytULQ3mN/mIYNKdgiG5GWlXCjoeiboKrwKTNBMLFE6Jwcgv/qSw1/vqwgn/oohAQpoOXWP+v5go6EBsRxmyhtOV9vkukxpXjDGl4+rgDweaOqXdAUgljacKW5lzJPxplP5h5us9viANJxwn3e6GMzBZIOHCxX9eRrKy4ClJaG9JXW0TXidRIA0OajqMLUVRQbJsbw9U8NOFxVOQ26eTDFQbpgMegHaAfwWjWc5uSHP+ElJQU1M9WGialj6geNFy9RUqRBV8AC76BnC7BztppArCGdHSHu28fffhVaoZfuVr4FeuEX5FC+BVrg1+8Kph4SGOLDuJy58mjrVtkr2VusZfvsKTLuGqkXZNuRzbndkc7CGyMrYFlfpDQMgWVtOJqgQGHvqrjCtLuZk4oZh1f2VDqOPTsxR7bPHbFAgWxkuiogaTEQk95kRSdD+A2BqXtSl3Nt0k2+LgYMGP4isIlAEnczMGRltrJ3kD3SNIncHmV0U5kDpwn0snrVr5jT++kP/eZjdmY+2y/iP+sbbxT7LPQ1KcdRSE+iKyGhgc7QsXzKfR8ERiuSzsYsNLM3jshB7U1B1OpDsLaPkeJSjpxJIXiRvmrBXSUYBkvCgHZ4XPDy5jraGUpCz7Q37cLfHVjQui6yI/zeNo6Rad7Q94q7yQMW3Go7tId/VP7m1yGPqfprlMfk77Z/vjw6On+4ZP948eXh89OD5+cPj4ZP3vy+D87DTAWRvB8u0ztdcu+hDHY2cu+0D4+aQd0ATPeNcHBJJ0wFI8ueD7C5AOkQHBfUrhGlZIre8EVRldPm6aW7jQOmRQbYJxNjV5aMAmEnA0CIhzRpZiyis9F0rZUY+v49m4stXkv1fwKw456narvNNGM5mJxrmBViJKty0QWuhQHvMCWEU3qVuOvJ1H7Nnm0UdQ2zW0ENh0P9UJnPJOFdF5mVvJaY+9fo2toXF9JkSXtoqA/SthssFvAC7bb2ISi1K0Q0PG85GrldaMMPPb+xvnqxUXoq3SZgkBDY2c6MK3gxa4c4Y0VAv6DiIIOUX6KUChKk78IxKqttPLaehDvmJWi2ISwOJ7ElTyHLrtGuGiH8RhqLPvCjpK0nqlgNZQZgp720agxojDMUUMEIUBtxLJCQg+u8CpXeYxZSuNCoQwHXNurChq4FgU7Ow/S3ukGellNRqjycNBCFCGNagtgEODZOXNGXkteFKsRU5qV3DnIOxGRe0sHk3Ej8hGbrmIsTTrVKR9Px9k4n9zm9r9NE4xhn8rzIqapnZ1b3GOtkq7P6QW7H5ZzsV1QDr03kK5DxEPVGWKMSKaVogCiWbSPUZSDEXNucgwfsRZ7eTfvW+xJLmOIo9cCMcI00ybpCvyDNuzyxXnszANMM4KJsGVC+r8JQVJJKPVw8befKbryoQ0l84O6/OI8gWUMk2DFlhgT252JqtAWqx4+wva1Q9OVDc0HgStQDAzjmauDLxUD7IQp2V4cbw8LFs+itpdCoTqA21DjC34m7T+4fPuJToGVULnWDBmb7UyRroMY0kVrAg7dpGAVNGIToYPlNn6rVdZcL/Ck09dDgzWobUpxNEP604vbuI9+9JBKSm++wOEPwhLanU3wNsRzz+VLrpzMQsw7JUuJD9iciPhZc1HxN6hZXfjXrqVfrvxDJFZHxTJh4H7W5CsFXmXiHDNeFIFXhfb5GXdirs0KmRXlqVkni4IJBS3t4LU1GSceYTPpVVcalleV0ZWR3IlidZs7E3LyXalDaMPHZne4MVF0YK5jYDDlVM5rXdtihdQM30RVBxr926i0g8eAezY+YjyUw8PSMVBET3s6GTP2twazVEYxrRCCp8rf6WN2ANL9ZEwPKHW1rcYpLxmavMK8xigxvO5NvPyBEjRjBGsyYrnwIgsySUN56aZdH8gZ2e3keNdpXX+GfC4oft5kxJGzhRo5w/npmzWetcO+cVE3QPZRpWYQGhy/0zjqPpLtPpLtPpLtPpLtPpLtq45k+8hAsgf9SLIQR9ZQFl4/O25adnZ+feIfnJ1fP20Uj46s/WwBaEPRb5+WPHZOWWMfI9jbNrEt8pDWAqGhcMfaJd4Xr7wvXnlfvJLdF6/82opXUmkReC+xoIVHNwQ7hcIkXXuMS3/TZqCfkNeFCLgltyzTRQENn28IaJpJlVORp0CdkJeNZBkrcYW5/ZshZmB7c4GoFqIUhhc7LLfxKsyRsidNCmAA/6GcgbiHHuD2UbfWksyTlhBg2bGMZ0Zby4wAdxVVr5nQgHD6cg0Nllxf9XvGT2ZPDg9nbYVmF8fpQZ81h+p2tVJoSEWI+0smqwSewCJ2DF21UEdp/iV/LyyTjlXaWjlFP1EknTg0kFCS+og0q0SPoIbaTASbvfH7VAkjhcrAN2VtLSzaBf1YRuR+AdTPqzHfoyM9jhs6w8scE/ebYAa4cgViR7uZVHPodEw9wno7mj/+TjwR05k45OJpdvL9d8f5VHw/Ozz67oQfPX383XT67Pjku9lNJQruvoFEoPAmlpbO/0A4bXqLih9CgC3RPkgj8HnE6g6FXlq4Ty11RE9znQpjQUOJwCpMQ3xBMfC/x8LpeONTLT+lbFWIoI4U8bSBeEsbnxRY7IzA89uYS+uMnNZ+5aHiFO6tqcHtESXOQltnh8kXrfTBKk2LZViUhZbSCQ2gLG5IodYz9qrg1smMfEgJmmEJlPsbxDTq27V1wrRuRei/+LPgzvaHkNZjJxczXhcOagJV0Q0a8eWgRzNw5DimnDGlWRgjdv8YKEOYrmE/TTpNogLcTowx1GMGxu/Q6T8nXP1Wpws+DK5NSixH/XhAzraYpJfowCUThSGsZA2nhEGapGA4dW3o2sQ46lBHHDRWHJi0Nn6oPmX6e2s7dhdo/uCvIUC0vSHRp9LSefq70vAwqHag3zPuTw0GbwuH7c07Os91MyWP5NcvLTY+HqeVDdD10lL/micbtD9862ZHXPDtAFRoCDhoVx5tj5R43G7wtaWeInK4fZEeIfJt3XuEvhCPEO4HGY7SQkI969FncwshSPduoXu30N2AdO8W2h5n926he7fQV+UWwnp4X5tbiKBmu3YLbS/dd+MbGljnvW/o3jd07xti976hr803VBvkWGQYePf2Nfy53irw7u3rcI+nTpTM1hWU1MSENz+RA3AqbmAv3719TdXy6M0Y7r4QbGoEx9QJvVRMKqeZzRbCMxe8LI0gP4u+1yyw+W0sAEO3ubs7NC/pck7oNsUoVuvfWy6XYzJKjTO91zbLQs5MxsFQAPgs+QqDpCmI12sEWNoP8IpB5cWqyZPl7aUxyrMBky80RLBiRNH1TTFp0E7nOrY1oVs8GQJ62mB7CS28zgyfl7vr3PTAS9vEslabgvGZo9Ick28nCaKdrvY6xs7Jt5PQnIR6saDCTUB3eMYO08zPZigqPf2DSUiWfj8pLQcCq2srmt1aJbYXLN8Q1yUVtAkECT8ZseVCQHi/a7VjMSLTyjpTg8HRUw9GjgfjT9vwlKoxA93G2tt/enLy+ADNq//2+59a5tZvnW6XpR1uDnSXwgqb3cAaqT8QkIiN+UhxtX1V+mftKCJdqoHioKO0FkweTycURQ2bOcL0Gm7T7eEZJLwVek4XPP+ptJRO/FttXRPKH0rDesa2trlOzN+Kn8VhOfg7l9xGQEctxjvo+f2ojfWjrfm5o+dbm+zkXe/5OQ0/2ASzgcHtSkE6h4Y+rbkTHkQI2hvfcNu4XfprcuPoTXly8rifHnryuDU/pHnt6gx6PgsTEL1GuwXAi79ggYHBNUSS9+jr0FWPnf8bsHPxAQoBJ20c0lkgVQWFaeyppbT/Fg5jYhjHqk0J7PCpCxWdOMw3rV18a5RMhovFUI04YuymVFaugQdAxzcn9HXHAdfyMLOpcEshGokOyVRLjXpCR2ahgrSrvb2A0deTOzCSvQ5LxTTYyemg6EV417Cknq684wtsGmmQ8JEUgpZGbG/ONLwkdbvnKhsu5AOvogiC/sDimke5TMpZ2332Q1IIg1+jHUiAFTi9k/gnUlg6CuEuhw103IIr+EzmIX01aO8x4ZaEIhwz8E0SlsrbhFX9E00gX5H14yswfPyzbR735o4bzR1fnKXjizVyWGGu+DzcfhLOzpqnW/B3HCNw+SYu09/nqbpQqF4RJQsBd+mvd1RaaKGX1IZ0KaYxbgTCZpJ6k1g+ghuvLdQR1KBfbM+SsZ/E5zrJNFt3S+T5IgQGfK4uSQmFIOp6QF3wGTfyc95d3yna0Ot27FBDXAM++j9kUfCDJ+ND9hDR+L/Zi/N3hFL2ywU7Or46wkaVoUbaI/a8qgrxq5j+RbqDp4dPxkfjoyeRnTz8y0+Xb16P8JsfRfZeP2IUzXRwdDw+ZG/0VBbi4OjJq6OTZ4Sng6eH3RKx90WnB6G+Lzp9X3T60yD+H1t0ereg/rXPddeIBs8Fv9n3k5yyqYAWPKQ1/Bn/ao37r/D5i2B4yHRZagXfxZDHcE0ANbKgqh9UIPqbNfGLAFmnbcLQ4jf2QqD1tUb2kI2dLMUfTbQeDswLGc2aFXeLU7qJdl4u5dxwnM+ZWrRHx7W0htXT30QWG2DDH1c3ruRfo7yKmIUdC32mAJ0UFdqGAHrZtwBoVKS1k7zyH3WKVUJFmTyXVNHHa+kQp0ox9TBPrO2V7iEbjghft4MbwGpAS0KuWxvZo47+JnoiSt/buH8w6CDZ9QcepNGNo0OYqwBDRchj2Ja0LyXmckjR5Nj4SxCd06zQdd4c1Bf+z2DlgGh0TglpA5h+Q7+i5p21PrWeBEQeUj94nl/BC1dhyFDkTZv0KLdWDR+MK6M96TcX/8hv6Jf9D5tpNFVs6RNPjz9qPS8Erpgo5Fv23G8WZjkVeXooY2CQcHwcAYOl3rDbgy9v3O1kjrBjTcLd5mlixlN8/9YzbUHAnbm2peJkNkoeukqO+ebJ6INx8sG2c5EYkYV0q6stmPfmr7adlSht243rUfm282A031ZztF7tjk/8INfZe6BSYggvw98Dhwt/g/SebtIG/eaPtl1o465Q/pyyGS+sRyVX2UKbMN9+ZAZrxHoEiw1Kp3VShCRSGuAyjKYEVcOfDG7HmqlKPu/Lrhtn81+lR+mWs3a+3G7Sj5+u4FNRWM8yL395+YvXoJbMaVbyyvNZK/6tB0tLnWGbVRq2WbSfeVwxBGEcKNfL04Zuf8K/BgY58/pIQq1k5PWfh5zGcUKg0Md9iDxJYrx6cZGm6MiYcyMyO16VxZjew7RtbijQWav95suOERdB30zp67emZWkNQ0y1LgRXW6J31mAEvHvNtvfn1XY8rWXRn7K/o1Fw7x09e3l0+P3eduD8csFghnZjFNr19/XUX7Ixz4X2/i/ps4GBm9+jgtPWVppBWbrzmzlZ89GN3KwF9OZ97qK70vnwUb/VAUowUGlq+jw4VT3ANz92pnOds3dnL/sTQTx+xbO7W1QzYn8ynffY7CdOFkxR/cmQRd3MCrebiHhuyav+TOD6wAqUdzVdMuTwnEZAqpsV7m4R2oy7Bq25qAq9gri0O524GXfNxJDJPKuLO19yMvCaqW+Q9B87cRz2xmmH1ZpPnxfHJXbetM3oNc0YGDeUW49cPF7Yhrhu2pLjNixXfNhWsQp1y3tdGNh6hfs3Xej3ku/z2ulc2kxfp+r3/4u/spf0y4ql77HkVnnj/XxgqFTmERxxyHUGNnpvjEaMtunxFtapYFXEXC5/PQ8AJLbF4TnlJpvmOjsVzxbkC1yAiTV6aNslzIUMFaA9EnKW19j83HHj6qplHgRVT5sS0+GifQ280RU3vBROQIGfqQCLmN83aEYuMHoKH/g/MVhK5gCaFddQ/abixlkMEDo7H7G04YLMR+CBBx9ICySuciz9D1avIRRSjbbK6LzO3O0ReUm5p3h2aRgmZyyubdO0H00urWkf2Gguf5jM/OiGqZP2fbecmRrzJam3uPyEFmyskdLNVA5whKSBW8/+7u1rtvDXK6h+ANMRtQIkm5Ce1abjAWhfBNbM+muMlA7rw7IMSOJ0aeK1WwjlQo98iqANbG0pVaHnDSPb+xXdL+wV2PBf63nsAVhK55AP/QofTQV3e8McjWK6oqe/N2iXa33LXnCVy5w7yH3jOQQRvnpx0banFHo+nslCjJNw2KFdMuL3WhqRN9r/DXuXOhX8BEmQ9RIcszwPBcCEStbPZCNd/EtNm4xiRVETio3FtfsAw3ZN+eB+SJJO72QtwG7wuixt2hGKPQz7gCs7e/loEKBOnIAXQksjnSCBeCMAhi/Zf7x53anuHtCLc+spnE3CKsGF1Y/iWDFaHKqFNF4mP1bHL2dD9k1wQdOIjWCJ5Pz8/Iw9fCMzo62euUiaf5XWXy+hs8VSmEfjTsR6GrFEcYR5qySQyllZWwfSSXk44efQ6GVC31x9KAvEY1MKhtueYNJVE6EFHS7ltcxrHlxr/hy0A4lvwrcE/9KsLpAyjK6nhbALDR1T4khVbSptBfUqCMXz8VDAiTbCI7nLBRo+V1Y8zewIaazJQB5QiA/mc6UtCMtpIcqulyvyJXYbN9fzogiQxrIyBEOfr6V1TBbCiK6rq393q2SiJzbnMjkVG2ALOxV3ECgRiheFoGlgM9QmQ5scdyFWfqM+MdyI1ph7S6lgzELP96KZrL9cP5s2bC+8O5eqeb81YvzGv+K/S2gtrKL3DvDJXFg5VyR4AghUNP748PBxa5jklePDw8P+mYacr9b5HCUUTUtoDSnVzHBMEqqNINYdgBqzXzrDQcQdB/UvzN0ajuAYbcAonqt8nJ4GqkiAdQpaA6IKZEmXhf3XkCbl8RXkR1yeHTDj8czJa+lWV1sZfIZlxw1E+pw6/RWrfnxkKO1Hf2NGBLWqirAB3baGpDYz8LE/dlU9LaRdUA9gFFTJJPBKGmLfvkmzZqahi3BZ1U6Yqy2v3x97jFWryAvOiQvEFilQWCg5yr96xaG2foO7siliiFEzJUrVkmggA+6K+RQoLSdtx/RkAAsw3FVSo5R9tH3/o2goMrr9yIeh+1Y3DaymDjuQAGPltQCCaA0F4cWwlMk4rVWZ8crhrQ9xB0JGq3DlsKwyUpvWUE4PsZN4CYRCUpMGdROYxyM0ZxN46yjpaA6wwdPjSZLAO2JTkXF/phtGn8wA5cEUjilVmwS4KWTT2xtCkYNitG6Hb8kFPkZSNecS5RGIoaSWYZSwTaG0fpJHYlNH8PrWzzukvDAHFWND4ZoV3Fo5W0E20xrgsgVXTdzhLnDaYhs4W7uyMKW6mjxePOjQBLy3ZaiKo4EtvblyER17MTIJbjSvFYYCmKm6OYAJhGG39EXrPHvZVlX9iUkVoJk0kF+KSDH+Fqq6xzrsKXzcoJCsVkd4PrFrGDUtw7MNv7f8cIxZ8XuNmQvFKuTPdQY0gmcLkn4l/yDLuqT9eXj8j8fH/2iNF1SyvsrkgTr+x9OTf2xW2x61mQ5stvjgOjBBrb2pYIeDuwllCK++RO0hwOS3MW3rhf/LtHJGF3AYoFPbTBhs2jsmGsICi6RhYB0AaCgIyWRu0TkwqZZhqX7VJEHLJOV3A17UKrmt3znuLqERPtzfw8Ukzfces0tu3yMp41vgpm5XxHJ6aL1oOw7VscKovMIaiHDVJOuG6dg+WqN5nVvkA3gJ1uir+XaeyM9DWjE+Dn5E4HtHaZ0sSPpm9xaU5DV/0mbTHFcyJn9Thzy6M72tFbTxPe+0EB9A/I7V3QHhnjBq9rBLTtokNWO5G6CihK0+GliY4/b9Ls+ZH//LPmVozKMGhDgt+YD6kuShVqwyoq3etjWF7u36kZeTJE5RhQua+YbD0G0CzbY9Er0Ro1b/T76gsE+/oCQ3hgHUUapkYFSfRNNNdtf+0f6T/eOj/cdPTo5OHh9+f/xs//jwydF3R0fHR4f7R4+/P3r87OTx0+/3jw4Pj7ZHSaAfcEl4oZxw2IcXZy8fRT9WBqVAGbdWZ1BFvo8YoKjAXlu/nM061kOlvTpjdXGNB+Pi7CWodZTeAgIdtNom13TUvyU2tXv96cVHrqnJbqOOpMmXEbXl2Je3BaO/akYfbgJwA60/TxdnL+2IGXEtxZIYwDxpsYv/y9B2Z1HLoVKcZPukIizraKdTDWkHvJAqMbsA15rNTTYU481KQU7hdaBvmR3w8UycasbfDPAAhG0nJ/tE4X6Z5L01zvJIWw+oTbOk+xaFsAsbVf8kkJ18c8FS23jnXnXk7g25Ok1QAWdt109yx1oTP7BFxDfa6MeNWXxjLHT/7nHTuL0PNo4/ZPi7YYahTzbO0TG63DB85+2NI3fMIjeM3Hl748iFnt8GJS0LyA3B7eBVvOonJA0kWvl3xvTFNoOT/QFP0nagd00WN4y/7kZ84yzrPtw4X+vieMMUrXc3jjp07bph8KFPbpqD7ihbT9C5N20cHi8Wt6DQoRvP5qSs5iZxw9DJm5tHBC341hjpKs8b5xhWG9fNFKYa/urmiVo6xg3L6X9w8/jbS5Pu6xvHHopTWjty++WN434oi5sY2lCkRHfM/xMAAP//bGwu0w==\"\n}", "title": "" }, { "docid": "cd225587ff582c4c1612913823fb578f", "score": "0.44910225", "text": "func (c *WmClient) SetRequestedStaticCapabilities(CapsList []string) {\n\n\tif CapsList == nil {\n\t\tc.requestedStaticCaps = nil\n\t\tc.clearCache()\n\t\treturn\n\t}\n\n\tvar capNames = make([]string, 0, 16)\n\tfor _, name := range CapsList {\n\n\t\tif c.HasStaticCapability(name) {\n\t\t\tcapNames = append(capNames, name)\n\t\t}\n\t}\n\n\tif capNames != nil && len(capNames) > 0 {\n\t\tc.requestedStaticCaps = capNames\n\t\tc.clearCache()\n\t}\n}", "title": "" }, { "docid": "d266ce9bf12e8be6b710388486e4e330", "score": "0.44882885", "text": "func (rg *RouterGroup) Static(pattern, nativePath string) {\n\tcheckExistence(nativePath)\n\thandler := rg.makeStaticHandler(pattern, http.Dir(nativePath))\n\turlPattern := path.Join(pattern, \"/*files\")\n\trg.GET(urlPattern, handler)\n}", "title": "" }, { "docid": "3417f99aa8d2c4bc029f22fa46be2df9", "score": "0.44868472", "text": "func (s *Definitions) InitializeFields(d *Definition) {\n\tfor fieldName, property := range d.schema.Properties {\n\t\tdes := strings.Replace(property.Description, \"\\n\", \" \", -1)\n\t\tf := &Field{\n\t\t\tName: fieldName,\n\t\t\tType: GetTypeName(property),\n\t\t\tDescription: EscapeAsterisks(des),\n\t\t}\n\t\tif len(property.Extensions) > 0 {\n\t\t\tif ps, ok := property.Extensions.GetString(patchStrategyKey); ok {\n\t\t\t\tf.PatchStrategy = ps\n\t\t\t}\n\t\t\tif pmk, ok := property.Extensions.GetString(patchMergeKeyKey); ok {\n\t\t\t\tf.PatchMergeKey = pmk\n\t\t\t}\n\t\t}\n\n\t\tif fd, ok := s.GetForSchema(property); ok {\n\t\t\tf.Definition = fd\n\t\t}\n\t\td.Fields = append(d.Fields, f)\n\t}\n}", "title": "" }, { "docid": "679c5ede215a805d7f15bcee1f707abc", "score": "0.44867522", "text": "func patchAWSClusterStaticIdentities(provider string, crd *v1.CustomResourceDefinition) {\n\tpatchCAPAWebhook(provider, crd)\n\tversion := crd.Spec.Versions[0]\n\tschema := version.Schema.OpenAPIV3Schema\n\tsecretRef := schema.Properties[\"spec\"].Properties[\"secretRef\"]\n\tsecretRef.Description = \"Reference to a secret containing the credentials. The secret should contain the following data keys: AccessKeyID: <access key id> SecretAccessKey: <secret access key> SessionToken: Optional\"\n\tschema.Properties[\"spec\"].Properties[\"secretRef\"] = secretRef\n\tcrd.Spec.Versions[0] = version\n}", "title": "" }, { "docid": "9d4b9c0c9b507082f7b273b06f54540a", "score": "0.4474606", "text": "func NewStatic() *Static {\n\treturn &Static{\n\t\tHome: views.NewView(\"bootstrap\", \"static/home\"),\n\t\tContact: views.NewView(\"bootstrap\", \"static/contact\"),\n\t}\n}", "title": "" }, { "docid": "9e7ed387f4849fdc47570b92e6530b3f", "score": "0.44734097", "text": "func (s Resource) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceDataContainer != nil {\n\t\tv := s.ResourceDataContainer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"ResourceDataContainer\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10e87efdd2d2c0f8a1d8f865d0091d7c", "score": "0.4462418", "text": "func (i *Instance) RegStatic(path, filePath string) {\n\tif strings.HasPrefix(filePath, \"/\") {\n\t\ti.router.PathPrefix(path).Handler(http.StripPrefix(path, http.FileServer(http.Dir(filePath))))\n\t} else {\n\t\ti.router.PathPrefix(path).Handler(http.StripPrefix(path, http.FileServer(http.Dir(i.AssetsDir+\"/\"+filePath))))\n\t}\n}", "title": "" }, { "docid": "8127de1f947f79ffda2d429b46d1773e", "score": "0.44618666", "text": "func (c *inventoryController) UpdateStatic(rw http.ResponseWriter, r *http.Request) (error, int) {\n\tstatic_id, _ := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\treturn err, http.StatusBadRequest\n\t}\n\n\tvar static models.StaticInventory\n\terr = json.Unmarshal(body, &static)\n\tif err != nil {\n\t\treturn err, http.StatusBadRequest\n\t} else if static_id != static.Id {\n\t\treturn errors.New(\"Identifier does not match request body for si_id\"), http.StatusBadRequest\n\t}\n\n\t// also decode to a dict so that update statements can be handled\n\tdict, err := jsonToDict(body)\n\tif err != nil {\n\t\treturn err, http.StatusBadRequest\n\t}\n\n\t// pass the decoded model to the dao to update the DB\n\terr = c.dao.UpdateStatic(static, dict)\n\n\tif err != nil {\n\t\treturn err, c.sqlErrorToStatusCodeAndLog(err)\n\t}\n\n\treturn nil, http.StatusNoContent\n}", "title": "" }, { "docid": "ddf5a0cd97f906b8cdef146cf4620a83", "score": "0.44606712", "text": "func (p *PermissionCtrl) populateStaticNodesToContract() error {\n\tnodes := p.node.Server().Config.StaticNodes\n\tfor _, node := range nodes {\n\t\turl := pcore.GetNodeUrl(node.EnodeID(), node.IP().String(), uint16(node.TCP()), uint16(node.RaftPort()), p.isRaft)\n\t\t_, err := p.contract.AddAdminNode(url)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"Failed to propose node\", \"err\", err, \"enode\", node.EnodeID())\n\t\t\treturn err\n\t\t}\n\t\tpcore.NodeInfoMap.UpsertNode(p.permConfig.NwAdminOrg, url, 2)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0f80a10042456a7647b8ca2aa6ead1c", "score": "0.445503", "text": "func (prog *prog) static(start map[string]bool, filemap map[string]string) {\n\tfor _, sym := range prog.symlist {\n\t\tdfile := filemap[sym.Span.Start.File]\n\t\tstatic := true\n\t\tfor file, syms := range prog.filetab {\n\t\t\tif filemap[file] == dfile {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := syms[sym]; ok {\n\t\t\t\tstatic = false\n\t\t\t}\n\t\t}\n\t\tif static && !start[sym.Name] {\n\t\t\tsym.Storage = cc.Static\n\t\t}\n\t}\n}", "title": "" }, { "docid": "924197176032f497837ee158b4ec809d", "score": "0.44408247", "text": "func (s *BaseJava8ParserListener) EnterStaticInitializer(ctx *StaticInitializerContext) {}", "title": "" }, { "docid": "24429ec72c70abb074b5bda1ba00354a", "score": "0.44403526", "text": "func JNIEnvSetStaticLongField(env *JNIEnv, clazz *Jclass, id JfieldID, val int64) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jlong)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticLongField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "7f9ecd0996b54e8eec5443dd2541bf5b", "score": "0.44395307", "text": "func newStorageAccountStaticWebsite(env *azure.Environment, accountsClient *storage.AccountsClient) *CustomResource {\n\tr := staticWebsite{\n\t\tenv: env,\n\t\taccountsClient: accountsClient,\n\t}\n\treturn &CustomResource{\n\t\tpath: staticWebsitePath,\n\t\ttok: \"azure-native:storage:StorageAccountStaticWebsite\",\n\t\tCreate: r.createOrUpdate,\n\t\tUpdate: r.createOrUpdate,\n\t\tRead: r.read,\n\t\tDelete: r.delete,\n\t\tSchema: &schema.ResourceSpec{\n\t\t\tObjectTypeSpec: schema.ObjectTypeSpec{\n\t\t\t\tDescription: \"Enables the static website feature of a storage account.\",\n\t\t\t\tType: \"object\",\n\t\t\t\tProperties: map[string]schema.PropertySpec{\n\t\t\t\t\tcontainerName: {\n\t\t\t\t\t\tDescription: \"The name of the container to upload blobs to.\",\n\t\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t\t},\n\t\t\t\t\tindexDocument: {\n\t\t\t\t\t\tDescription: \"The webpage that Azure Storage serves for requests to the root of a website or any sub-folder. For example, 'index.html'. The value is case-sensitive.\",\n\t\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t\t},\n\t\t\t\t\terror404Document: {\n\t\t\t\t\t\tDescription: \"The absolute path to a custom webpage that should be used when a request is made which does not correspond to an existing file.\",\n\t\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tRequired: []string{containerName},\n\t\t\t},\n\t\t\tInputProperties: map[string]schema.PropertySpec{\n\t\t\t\tresourceGroupName: {\n\t\t\t\t\tDescription: \"The name of the resource group within the user's subscription. The name is case insensitive.\",\n\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t},\n\t\t\t\taccountName: {\n\t\t\t\t\tDescription: \"The name of the storage account within the specified resource group.\",\n\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t},\n\t\t\t\tindexDocument: {\n\t\t\t\t\tDescription: \"The webpage that Azure Storage serves for requests to the root of a website or any sub-folder. For example, 'index.html'. The value is case-sensitive.\",\n\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t},\n\t\t\t\terror404Document: {\n\t\t\t\t\tDescription: \"The absolute path to a custom webpage that should be used when a request is made which does not correspond to an existing file.\",\n\t\t\t\t\tTypeSpec: schema.TypeSpec{Type: \"string\"},\n\t\t\t\t},\n\t\t\t},\n\t\t\tRequiredInputs: []string{resourceGroupName, accountName},\n\t\t},\n\t\tMeta: &AzureAPIResource{\n\t\t\tPath: staticWebsitePath,\n\t\t\tPutParameters: []AzureAPIParameter{\n\t\t\t\t{Name: subscriptionId, Location: \"path\", IsRequired: true, Value: &AzureAPIProperty{Type: \"string\"}},\n\t\t\t\t{Name: resourceGroupName, Location: \"path\", IsRequired: true, Value: &AzureAPIProperty{Type: \"string\"}},\n\t\t\t\t{Name: accountName, Location: \"path\", IsRequired: true, Value: &AzureAPIProperty{Type: \"string\"}},\n\t\t\t\t{\n\t\t\t\t\tName: \"properties\",\n\t\t\t\t\tLocation: \"body\",\n\t\t\t\t\tBody: &AzureAPIType{\n\t\t\t\t\t\tProperties: map[string]AzureAPIProperty{\n\t\t\t\t\t\t\tindexDocument: {Type: \"string\"},\n\t\t\t\t\t\t\terror404Document: {Type: \"string\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "f812c63a4f807309397619381d4be97b", "score": "0.44341952", "text": "func WithStaticClients(s Storage, staticClients []Client) Storage {\n\tclientsByID := make(map[string]Client, len(staticClients))\n\tfor _, client := range staticClients {\n\t\tclientsByID[client.ID] = client\n\t}\n\treturn staticClientsStorage{s, staticClients, clientsByID}\n}", "title": "" }, { "docid": "1afda7d87a91462c24e0e161db8cabb5", "score": "0.44338268", "text": "func (s DescribeAssetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbc19197476b49a75be45b7f2ea4e555", "score": "0.44182938", "text": "func (app *App) SetStaticPath(url string, path string) *App {\n\tapp.StaticDirs[url] = path\n\treturn app\n}", "title": "" }, { "docid": "0ce6041a114d05fd0eddb107445d7c0e", "score": "0.44166458", "text": "func init() {\n\tpolicy.Register(PolicyName, PolicyDescription, NewStaticPolicy)\n}", "title": "" }, { "docid": "e27a13dcb7b44a6c2aa426226a62507f", "score": "0.44162035", "text": "func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string, options *FileRequestOptions) (http.Header, error) {\n\tif err := f.checkForStorageEmulator(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tparams := mergeParams(getURLInitValues(comp, res), prepareOptions(options))\n\turi := f.client.getEndpoint(fileServiceName, path, params)\n\textraHeaders = f.client.protectUserAgent(extraHeaders)\n\theaders := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)\n\n\tresp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer drainRespBody(resp)\n\n\treturn resp.Header, checkRespCode(resp, []int{http.StatusOK})\n}", "title": "" }, { "docid": "76402f9364b94c666f3939ee5c053b2e", "score": "0.44024482", "text": "func NewStaticCredentials(cs, ct, at, ah string) *Credentials {\n\treturn NewCredentials(&StaticProvider{AuthValue: AuthValue{\n\t\tClientSecret: cs,\n\t\tClientToken: ct,\n\t\tAccessToken: at,\n\t\tHost: ah,\n\t}})\n}", "title": "" }, { "docid": "87dcd555f269ed489ebaa267c2f7452a", "score": "0.4398045", "text": "func Static(c *gin.Context) {\n\tpath := c.Params.ByName(\"name\")\n\tdata, err := Asset(\"asset\" + path)\n\tif err != nil {\n\t\tc.AbortWithStatus(404)\n\t}\n\tif strings.HasSuffix(path, \".css\") {\n\t\tc.Writer.Header().Set(\"Content-Type\", \"text/css\")\n\t}\n\tif strings.HasSuffix(path, \".js\") {\n\t\tc.Writer.Header().Set(\"Content-Type\", \"text/javascript\")\n\t}\n\tsize := int64(len(data))\n\tc.Writer.Header().Set(\"Content-Length\", strconv.FormatInt(size, 10))\n\tio.Copy(c.Writer, bytes.NewReader(data))\n}", "title": "" }, { "docid": "a350d8e38791c18318e05b7b21b033b2", "score": "0.43971813", "text": "func (s ResourceDataContainer) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.LocalDeviceResourceData != nil {\n\t\tv := s.LocalDeviceResourceData\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"LocalDeviceResourceData\", v, metadata)\n\t}\n\tif s.LocalVolumeResourceData != nil {\n\t\tv := s.LocalVolumeResourceData\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"LocalVolumeResourceData\", v, metadata)\n\t}\n\tif s.S3MachineLearningModelResourceData != nil {\n\t\tv := s.S3MachineLearningModelResourceData\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"S3MachineLearningModelResourceData\", v, metadata)\n\t}\n\tif s.SageMakerMachineLearningModelResourceData != nil {\n\t\tv := s.SageMakerMachineLearningModelResourceData\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SageMakerMachineLearningModelResourceData\", v, metadata)\n\t}\n\tif s.SecretsManagerSecretResourceData != nil {\n\t\tv := s.SecretsManagerSecretResourceData\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SecretsManagerSecretResourceData\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64c57a62fc3ff8ea4ef2a878513f2018", "score": "0.439153", "text": "func JNIEnvSetStaticDoubleField(env *JNIEnv, clazz *Jclass, id JfieldID, val float64) {\n\tcenv, _ := (*C.JNIEnv)(unsafe.Pointer(env)), cgoAllocsUnknown\n\tcclazz, _ := (C.jclass)(unsafe.Pointer(clazz)), cgoAllocsUnknown\n\tcid, _ := *(*C.jfieldID)(unsafe.Pointer(&id)), cgoAllocsUnknown\n\tcval, _ := (C.jdouble)(val), cgoAllocsUnknown\n\tC.JNIEnv_SetStaticDoubleField(cenv, cclazz, cid, cval)\n}", "title": "" }, { "docid": "d7e8dd907311e0e08fa3abd93ec3ae8f", "score": "0.43860808", "text": "func NewGatewayRouter_StaticResource_List(s *capnp.Segment, sz int32) (GatewayRouter_StaticResource_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 4}, sz)\n\treturn capnp.StructList[GatewayRouter_StaticResource](l), err\n}", "title": "" }, { "docid": "34fca25864f17233e7d61df95f2cbcbf", "score": "0.43853518", "text": "func (s UpdateResourceShareInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.AllowExternalPrincipals != nil {\n\t\tv := *s.AllowExternalPrincipals\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"allowExternalPrincipals\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ClientToken != nil {\n\t\tv := *s.ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceShareArn != nil {\n\t\tv := *s.ResourceShareArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceShareArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92e728641d973c5a84530217c6e4d963", "score": "0.43848854", "text": "func setStaticMode(mode string) {\n if mode == \"self\" {\n fs := http.Dir(\"static\")\n fileHandler := http.FileServer(fs)\n http.Handle(\"/static/\", http.StripPrefix(\"/static/\", fileHandler))\n } else if mode == \"separate\" {\n // do nothing (static files are served by Nginx)\n }\n}", "title": "" }, { "docid": "8a12e80df6d21961272d7af8fdd748f6", "score": "0.43814695", "text": "func (group *RouterGroup) Static(relativePath string, root string) {\n\thandler := group.createStaticHandler(relativePath, http.Dir(root))\n\turlPattern := path.Join(relativePath, \"/*filepath\")\n\tgroup.GET(urlPattern, handler)\n}", "title": "" }, { "docid": "0ca84635685ef5faaeaf9e43fc42e495", "score": "0.43811396", "text": "func ConstructStaticRoute(vppAgent string, l3sr *controller.L3VRFRoute) *KVType {\n\n\tsr := &l3.StaticRoutes_Route{\n\t\tVrfId: l3sr.VrfId,\n\t\tDescription: l3sr.Description,\n\t\tDstIpAddr: l3sr.DstIpAddr,\n\t\tNextHopAddr: StripSlashAndSubnetIPAddress(l3sr.NextHopAddr),\n\t\tWeight: l3sr.Weight,\n\t\tOutgoingInterface: l3sr.OutgoingInterface,\n\t\tPreference: l3sr.Preference,\n\t}\n\n\tdestIPAddr, _, _ := addrs.ParseIPWithPrefix(sr.DstIpAddr)\n\tkey := L3RouteKey(vppAgent, sr.VrfId, destIPAddr, sr.NextHopAddr)\n\n\tlog.Debugf(\"ConstructStaticRoute: key='%s', sr='%v\", key, sr)\n\n\tkv := &KVType{\n\t\tVppKey: key,\n\t\tVppEntryType: VppEntryTypeL3Route,\n\t\tL3Route: sr,\n\t}\n\treturn kv\n}", "title": "" } ]
5f01b39d9755bbb12ffb13ac004c0927
Deprecated: Use Column.ProtoReflect.Descriptor instead.
[ { "docid": "d7dc1362c2c7273c251d04c24dd02057", "score": "0.6877779", "text": "func (*Column) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_schemas_types_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
[ { "docid": "fbfd186f656d14608273c1e555809a98", "score": "0.6865256", "text": "func (*Column) Descriptor() ([]byte, []int) {\n\treturn file_odpf_meta_facets_Columns_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b78115b6199b0b03f0f92a565ec8b3a7", "score": "0.6638645", "text": "func (*Columns) Descriptor() ([]byte, []int) {\n\treturn file_odpf_meta_facets_Columns_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0bbf1f5bf8aade917349a6160fb2a33c", "score": "0.65511835", "text": "func (*Column) Descriptor() ([]byte, []int) {\n\treturn file_qsl_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "19444210d91e8052863a1d396a6b4562", "score": "0.6524401", "text": "func (*ModifyColumnRequest) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ab68d5abef9664a8cc72851b26a280d1", "score": "0.64978874", "text": "func (*Table) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "04d2fe3a6001c62ff9dbf98901138e7a", "score": "0.6495738", "text": "func (*MysqlColumn) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datastream_v1alpha1_datastream_resources_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "72ac851590638e1c4777261568bced98", "score": "0.6363845", "text": "func (*ColumnMetadata) Descriptor() ([]byte, []int) {\n\treturn file_typemd_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a058b63c06ca5feb7aba86191e3ad93c", "score": "0.6357262", "text": "func (*ColumnMetadata) Descriptor() ([]byte, []int) {\n\treturn file_User_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "5783663cc96f0efdfbf0edf461ad38db", "score": "0.633704", "text": "func (Column_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_qsl_proto_rawDescGZIP(), []int{17, 0}\n}", "title": "" }, { "docid": "a17b1a482fff0c9ef77995f676214868", "score": "0.63304126", "text": "func (*StoredInfoTypeVersion) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{126}\n}", "title": "" }, { "docid": "0a527e2d178eec56b82347b38519856c", "score": "0.6310359", "text": "func (*GetColumnsReq) Descriptor() ([]byte, []int) {\n\treturn file_User_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "398b789bf9edc3ea0bbc32536e363d4d", "score": "0.6303244", "text": "func (*ModifyColumnResponse) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f3356372dd356947779f768d52ffb1d6", "score": "0.6284901", "text": "func (x *fastReflection_TableModel) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_TableModel\n}", "title": "" }, { "docid": "bae980521fd6a9b976c1239eaf0a2846", "score": "0.62799627", "text": "func (*GetColumnsResp) Descriptor() ([]byte, []int) {\n\treturn file_User_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "a23d996fb9dadae983c087e003fab266", "score": "0.6278332", "text": "func (*SysColumn) Descriptor() ([]byte, []int) {\n\treturn file_api_sys_v1_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e957c80c2bbbe896b2e953acce5cc342", "score": "0.62572104", "text": "func (x *fastReflection_QueryHistoricalInfoRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryHistoricalInfoRequest\n}", "title": "" }, { "docid": "4fbc8f2bf9e2e18b5424a1afad3dfbb7", "score": "0.6254898", "text": "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "title": "" }, { "docid": "d2d2933a2842297feb76cd49ecbb4634", "score": "0.6234108", "text": "func (*ColumnFamily) Descriptor() ([]byte, []int) {\n\treturn file_google_bigtable_admin_v2_table_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a99180fa14eec4ce893b23686a3fa284", "score": "0.62236726", "text": "func (*ColumnEntity) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_clouddms_v1_conversionworkspace_resources_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "e31022a7a11ee486a04bb69cdcc8efb0", "score": "0.6221976", "text": "func (x *fastReflection_ModuleSchemaDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleSchemaDescriptor\n}", "title": "" }, { "docid": "0d907d0bdf20cee279ab1885d5058b3a", "score": "0.6220507", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v3_listener_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "77444d87d4001cb56b7ccfc62ea1a760", "score": "0.6203307", "text": "func (*MeasurementFieldChange) Descriptor() ([]byte, []int) {\n\treturn file_internal_fieldsindex_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "a1df1b8a02fd94a4a742a96b27e0269a", "score": "0.619929", "text": "func (*FieldTransformation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{71}\n}", "title": "" }, { "docid": "1c07f8b629f4c437d4c057c8e7bca35d", "score": "0.6198323", "text": "func (*RemoteGrpcPort) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_fn_execution_v1_beam_fn_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "0c851651a84f85d8d178637a24294177", "score": "0.6194722", "text": "func (fd *FieldDescription) Descriptor() protoreflect.FieldDescriptor {\n\treturn fd.desc\n}", "title": "" }, { "docid": "23bddcb59aa2eedf51bb6b81035af4d2", "score": "0.619005", "text": "func (*ColumnKey) Descriptor() ([]byte, []int) {\n\treturn file_typemd_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f62e02ec7b785b54cd39b1da1b083b83", "score": "0.61898845", "text": "func (x *fastReflection_MsgData) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgData\n}", "title": "" }, { "docid": "4b241cc985eb0521b22d066af5ba8ee0", "score": "0.6175416", "text": "func (*StoredInfoType) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{127}\n}", "title": "" }, { "docid": "96c03cb204c79c7d0ef9200bcb65581e", "score": "0.6170172", "text": "func (*TableLocation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "f00e12439e37eebd6cc361332c76df0f", "score": "0.61679107", "text": "func (fs fields) Descriptor() (protoreflect.MessageDescriptor, error) {\n\tfd, err := protodesc.NewFile(&descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(\"dump.proto\"),\n\t\tSyntax: proto.String(\"proto2\"),\n\t\tMessageType: []*descriptorpb.DescriptorProto{fs.messageDescriptor(\"X\")},\n\t}, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fd.Messages().Get(0), nil\n}", "title": "" }, { "docid": "a896cbcad8662b722fa69f96311a2720", "score": "0.6164228", "text": "func (*TestDeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_internal_testprotos_test_test_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "fb9626500ceec9c8d537f34a0abd43cf", "score": "0.6158488", "text": "func (*Table_Row) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "f9f9877b91a1eb7c1940fa5cf551abf2", "score": "0.6151928", "text": "func (*StatisticalTable) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{42}\n}", "title": "" }, { "docid": "8c510715bbbb202f7a56fc97d43d180a", "score": "0.61506575", "text": "func (*EmbedLintedField) Descriptor() ([]byte, []int) {\n\treturn file_tests_lint_lint_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cab5078b9432a536c1c167969b8c7cfd", "score": "0.6133214", "text": "func (*FieldChangeSet) Descriptor() ([]byte, []int) {\n\treturn file_internal_fieldsindex_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "36fb7edf79e22a237c52dfaa7ff832ae", "score": "0.6131797", "text": "func (x *fastReflection_MsgTripCircuitBreaker) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgTripCircuitBreaker\n}", "title": "" }, { "docid": "a911dd605e2d0cdc8bb29f60360f2f6e", "score": "0.6129423", "text": "func (*AddColumnRequest) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ecdff7b1dc64e6d558cbeab1b4486862", "score": "0.6122818", "text": "func (*Proto) Descriptor() ([]byte, []int) {\n\treturn file_api_comet_grpc_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1ccc86b5d1ace66afc089782ad4fefe1", "score": "0.6114714", "text": "func (*DeleteColumnRequest) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "208ae244eb7060d428237b516481b2d0", "score": "0.6112595", "text": "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_v2_refs_grpc_types_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f4438de2d45cc2c8e37301b6132b0ba2", "score": "0.61065215", "text": "func (*ServiceChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_service_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "ec882029b5b43156b4615044a15212bf", "score": "0.6104807", "text": "func (*ValueProvider_TypedValueProvider) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{3, 2}\n}", "title": "" }, { "docid": "d2d057e98e152b70e972390624892f25", "score": "0.6095716", "text": "func (*StoredInfoTypeStats) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{125}\n}", "title": "" }, { "docid": "6d070cd95475a78141bb2cf94240fb37", "score": "0.60948503", "text": "func (ColumnUpdatability) EnumDescriptor() ([]byte, []int) {\n\treturn file_User_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "20739bff073d9c3c5c30132f7f128378", "score": "0.6090546", "text": "func (*ValueProvider_Provider) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{3, 3}\n}", "title": "" }, { "docid": "8b3bdcb792b6ef6aca60c58c0ca9f910", "score": "0.6086686", "text": "func (*CloudMigrate) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{341}\n}", "title": "" }, { "docid": "f5788a7eab7cc0c33ef907c0a7bbee9b", "score": "0.60827607", "text": "func (*ValueProvider) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b1e7259d5c9b03af041df0007d0661d1", "score": "0.6080869", "text": "func (x *fastReflection_TestNullableFields) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_TestNullableFields\n}", "title": "" }, { "docid": "7f2a5fa500c258373f79b9815c690ac9", "score": "0.60789454", "text": "func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {\n\t// Fast-path: check if a MessageDescriptor is cached for this concrete type.\n\tif mi, ok := legacyMessageDescCache.Load(t); ok {\n\t\treturn mi.(pref.MessageDescriptor)\n\t}\n\n\t// Slow-path: initialize MessageDescriptor from the raw descriptor.\n\tmv := reflect.New(t.Elem()).Interface()\n\tif _, ok := mv.(pref.ProtoMessage); ok {\n\t\tpanic(fmt.Sprintf(\"%v already implements proto.Message\", t))\n\t}\n\tmdV1, ok := mv.(messageV1)\n\tif !ok {\n\t\treturn aberrantLoadMessageDesc(t)\n\t}\n\tb, idxs := mdV1.Descriptor()\n\n\tmd := legacyLoadFileDesc(b).Messages().Get(idxs[0])\n\tfor _, i := range idxs[1:] {\n\t\tmd = md.Messages().Get(i)\n\t}\n\tif md, ok := legacyMessageDescCache.LoadOrStore(t, md); ok {\n\t\treturn md.(protoreflect.MessageDescriptor)\n\t}\n\treturn md\n}", "title": "" }, { "docid": "4a167b79ae55401191798823f8e4e6ee", "score": "0.6076635", "text": "func (*ForeignKey) Descriptor() ([]byte, []int) {\n\treturn file_typemd_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "5011ecbce1bb29a2d662cba6b361367a", "score": "0.60687834", "text": "func (x *fastReflection_Data) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Data\n}", "title": "" }, { "docid": "5fff4a4fd76fe5cc600b3843b0eca04e", "score": "0.6067669", "text": "func (*Executor_Remote_RemoteSchemaRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{23, 1, 1}\n}", "title": "" }, { "docid": "f3ab1ba4c6f21062559c44c85ca4c037", "score": "0.6062318", "text": "func (*DeviceChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_device_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "4926c973a5c17c51a286210bc5639652", "score": "0.6061708", "text": "func (*UpdateStoredInfoTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{129}\n}", "title": "" }, { "docid": "fc393fcfa11d8a804778a5254c404751", "score": "0.60516834", "text": "func (x *fastReflection_Market) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Market\n}", "title": "" }, { "docid": "3167e66c93bad41f0108131c27572d11", "score": "0.60507065", "text": "func (*GrpcDescriptorRegistry) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "f27abe6e6025f5e0dba0b96f4a5170ed", "score": "0.6048419", "text": "func (*GrpcResolver) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "bf2def1bebf4ea839758bf1ef06326cd", "score": "0.6040507", "text": "func (x *fastReflection_Attribute) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Attribute\n}", "title": "" }, { "docid": "79537371a15e253c0c0968f978568155", "score": "0.60387826", "text": "func (*VersionDescription) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "9daf5c7ecc9b8f8e990f3f8b35c1484a", "score": "0.6030094", "text": "func (*NotificationChannel) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_ydb_v1_database_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d37cc1d88b2079afd4aebebf2eee7512", "score": "0.6025386", "text": "func (*InspectResult) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "10098cdf0c737af61cd74744132db44f", "score": "0.60198146", "text": "func (*OracleColumn) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datastream_v1alpha1_datastream_resources_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "746642bc0a501a09ebc464393121c2e7", "score": "0.6016469", "text": "func (*PrivacyMetric) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "b2e4d529dd818eb91f1f55acb32f097a", "score": "0.60156864", "text": "func (fd *FieldDescriptor) AsProto() proto.Message {\n\treturn fd.proto\n}", "title": "" }, { "docid": "20ba8cd931bdadeb5d84566446ea6add", "score": "0.60134053", "text": "func (*DeleteColumnResponse) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "86a8e2bc3d0cbd3ae38d9edb484642d1", "score": "0.60127884", "text": "func (*PrimitiveTransformation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{52}\n}", "title": "" }, { "docid": "306ff5a012c3b2e92c13c2cf468cee8c", "score": "0.60111374", "text": "func (Compatibility) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_data_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1181959da3669adf20d4b3835a652107", "score": "0.60015905", "text": "func (*ResultColumnMetadata) Descriptor() ([]byte, []int) {\n\treturn file_User_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "d9a2e8d869708951236ff22ac6d1fe70", "score": "0.59993213", "text": "func (*FieldConstraint) Descriptor() ([]byte, []int) {\n\treturn file_furo_meta_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f68975168cabaa0c9d462b6260f9c374", "score": "0.5998693", "text": "func (*Value) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "ab418483b166281319bb7de8da865f52", "score": "0.599548", "text": "func (MetadataType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "4b7738ccd9d254e89e76a3a0c1b6305d", "score": "0.59922975", "text": "func (*DimensionCompatibility) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_data_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "f8307e8e0514236d3f17380b2eaf92c2", "score": "0.5992246", "text": "func (*UpdateDatabaseMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_ydb_v1_database_service_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "4014c74da02ad72e8ec9d981eb67b9c0", "score": "0.59863126", "text": "func (*ColumnsRequest) Descriptor() ([]byte, []int) {\n\treturn file_requests_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6a6217e9296d294466670ccc82d7097d", "score": "0.59839076", "text": "func (*CollateralByPosition) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{182}\n}", "title": "" }, { "docid": "6258fe4ac431f06ce93a6a1173e079ef", "score": "0.5978033", "text": "func (*AcceptedPlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_accepted_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "title": "" }, { "docid": "b4e1a22b81003b34afda96191d9dfe52", "score": "0.5966046", "text": "func (x *fastReflection_QueryValidatorRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryValidatorRequest\n}", "title": "" }, { "docid": "eba6bbf805e4d66a8a2dbbf2f5a22c42", "score": "0.5959757", "text": "func (*AddColumnResponse) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ef1a00cf1046119193fc35e4a18f1d2c", "score": "0.59587896", "text": "func (*ServiceChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_service_change_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "6aa6e5203616f55b80eb701718fad691", "score": "0.5955531", "text": "func (x *fastReflection_MsgRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgRequest\n}", "title": "" }, { "docid": "92999ced3264947280b44ce6ab5abfcb", "score": "0.5954994", "text": "func (*Pivot) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_data_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "173b20b50c1ac875c5f26c5ecfbe900f", "score": "0.59542364", "text": "func (*Member) Descriptor() ([]byte, []int) {\n\treturn file_proto_podium_api_v1_podium_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "386b6b25a97240fd954065d5da9a7ebe", "score": "0.5946352", "text": "func (Table_View) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_bigtable_admin_v2_table_proto_rawDescGZIP(), []int{2, 1}\n}", "title": "" }, { "docid": "ac7d6b4be8b2ac69e183dd66f92d1148", "score": "0.59417707", "text": "func (*TableDataProfile) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{141}\n}", "title": "" }, { "docid": "0a4e769246698aadfab46fa2de735c18", "score": "0.5937148", "text": "func (MessageType) EnumDescriptor() ([]byte, []int) {\n\treturn file_pkg_database_database_entries_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "335c3bdc1b43a788763af8fe5cb017d8", "score": "0.5936479", "text": "func (*RelationTupleDelta) Descriptor() ([]byte, []int) {\n\treturn file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "7c3c7fce7375a4133e5f9dbd119a207c", "score": "0.5933974", "text": "func (*ServiceChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_meta_proto_v1alpha2_service_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cd00f28d164ace32b9e526cd0dd3bac3", "score": "0.5930812", "text": "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_grpc_version_version_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "bb3dc5c0928df138d98a5a39a91465cc", "score": "0.5928096", "text": "func (*DeviceChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_device_change_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "0b3a2e6508eece73292d443546c4ab91", "score": "0.5927409", "text": "func (x *fastReflection_ExtendedCommit) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ExtendedCommit\n}", "title": "" }, { "docid": "3e93dd73159459b1b7f793c13c8e1691", "score": "0.5923709", "text": "func (*Executor) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_extensions_graphql_graphql_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "cbeb2ffdf15333e2c61c0f29cbd9284a", "score": "0.5923449", "text": "func (*EntityProto) Descriptor() ([]byte, []int) {\n\treturn file_datastore_v3_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "cccb487dabcd02b6b62da19882e15fd5", "score": "0.59169596", "text": "func (*InspectDataSourceDetails) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "482b870f458d8d4e9e292fa123f45650", "score": "0.5916821", "text": "func storageSchemaToDescriptorInternal(inSchema *storagepb.TableSchema, scope string, cache *dependencyCache, allowWrapperTypes bool) (protoreflect.Descriptor, error) {\n\tif inSchema == nil {\n\t\treturn nil, newConversionError(scope, fmt.Errorf(\"no input schema was provided\"))\n\t}\n\n\tvar fields []*descriptorpb.FieldDescriptorProto\n\tvar deps []protoreflect.FileDescriptor\n\tvar fNumber int32\n\n\tfor _, f := range inSchema.GetFields() {\n\t\tfNumber = fNumber + 1\n\t\tcurrentScope := fmt.Sprintf(\"%s__%s\", scope, f.GetName())\n\t\t// If we're dealing with a STRUCT type, we must deal with sub messages.\n\t\t// As multiple submessages may share the same type definition, we use a dependency cache\n\t\t// and interrogate it / populate it as we're going.\n\t\tif f.Type == storagepb.TableFieldSchema_STRUCT {\n\t\t\tfoundDesc := cache.get(&storagepb.TableSchema{Fields: f.GetFields()})\n\t\t\tif foundDesc != nil {\n\t\t\t\t// check to see if we already have this in current dependency list\n\t\t\t\thaveDep := false\n\t\t\t\tfor _, curDep := range deps {\n\t\t\t\t\tif foundDesc.ParentFile().FullName() == curDep.FullName() {\n\t\t\t\t\t\thaveDep = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// if dep is missing, add to current dependencies\n\t\t\t\tif !haveDep {\n\t\t\t\t\tdeps = append(deps, foundDesc.ParentFile())\n\t\t\t\t}\n\t\t\t\t// construct field descriptor for the message\n\t\t\t\tfdp, err := tableFieldSchemaToFieldDescriptorProto(f, fNumber, string(foundDesc.FullName()), allowWrapperTypes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, newConversionError(scope, fmt.Errorf(\"couldn't convert field to FieldDescriptorProto: %v\", err))\n\t\t\t\t}\n\t\t\t\tfields = append(fields, fdp)\n\t\t\t} else {\n\t\t\t\t// Wrap the current struct's fields in a TableSchema outer message, and then build the submessage.\n\t\t\t\tts := &storagepb.TableSchema{\n\t\t\t\t\tFields: f.GetFields(),\n\t\t\t\t}\n\t\t\t\tdesc, err := storageSchemaToDescriptorInternal(ts, currentScope, cache, allowWrapperTypes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, newConversionError(currentScope, fmt.Errorf(\"couldn't convert message: %v\", err))\n\t\t\t\t}\n\t\t\t\t// Now that we have the submessage definition, we append it both to the local dependencies, as well\n\t\t\t\t// as inserting it into the cache for possible reuse elsewhere.\n\t\t\t\tdeps = append(deps, desc.ParentFile())\n\t\t\t\terr = cache.add(ts, desc)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, newConversionError(currentScope, fmt.Errorf(\"failed to add descriptor to dependency cache: %v\", err))\n\t\t\t\t}\n\t\t\t\tfdp, err := tableFieldSchemaToFieldDescriptorProto(f, fNumber, currentScope, allowWrapperTypes)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, newConversionError(currentScope, fmt.Errorf(\"couldn't compute field schema : %v\", err))\n\t\t\t\t}\n\t\t\t\tfields = append(fields, fdp)\n\t\t\t}\n\t\t} else {\n\t\t\tfd, err := tableFieldSchemaToFieldDescriptorProto(f, fNumber, currentScope, allowWrapperTypes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, newConversionError(currentScope, err)\n\t\t\t}\n\t\t\tfields = append(fields, fd)\n\t\t}\n\t}\n\t// Start constructing a DescriptorProto.\n\tdp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(scope),\n\t\tField: fields,\n\t}\n\n\t// Use the local dependencies to generate a list of filenames.\n\tdepNames := []string{\n\t\twellKnownTypesWrapperName,\n\t}\n\tfor _, d := range deps {\n\t\tdepNames = append(depNames, d.ParentFile().Path())\n\t}\n\n\t// Now, construct a FileDescriptorProto.\n\tfdp := &descriptorpb.FileDescriptorProto{\n\t\tMessageType: []*descriptorpb.DescriptorProto{dp},\n\t\tName: proto.String(fmt.Sprintf(\"%s.proto\", scope)),\n\t\tSyntax: proto.String(\"proto3\"),\n\t\tDependency: depNames,\n\t}\n\n\t// We'll need a FileDescriptorSet as we have a FileDescriptorProto for the current\n\t// descriptor we're building, but we need to include all the referenced dependencies.\n\tfds := &descriptorpb.FileDescriptorSet{\n\t\tFile: []*descriptorpb.FileDescriptorProto{\n\t\t\tfdp,\n\t\t\tprotodesc.ToFileDescriptorProto(wrapperspb.File_google_protobuf_wrappers_proto),\n\t\t},\n\t}\n\tfor _, d := range deps {\n\t\tfds.File = append(fds.File, protodesc.ToFileDescriptorProto(d))\n\t}\n\n\t// Load the set into a registry, then interrogate it for the descriptor corresponding to the top level message.\n\tfiles, err := protodesc.NewFiles(fds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn files.FindDescriptorByName(protoreflect.FullName(scope))\n}", "title": "" }, { "docid": "e69a42ec6a7274339cee16d12f39d5da", "score": "0.5916143", "text": "func (*IPFIX_Collector) Descriptor() ([]byte, []int) {\n\treturn file_ligato_vpp_ipfix_ipfix_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "9877e7fd13c87b0497d34731d652145e", "score": "0.5915071", "text": "func (*MetricCompatibility) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_data_v1beta_data_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "f1298c4c7967f1232638d16e76adb0e1", "score": "0.59103554", "text": "func (x *fastReflection_Permissions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Permissions\n}", "title": "" }, { "docid": "4aa3d356c93a8aab9987e783774b2dbf", "score": "0.5910113", "text": "func (x *fastReflection_LightBlock) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightBlock\n}", "title": "" }, { "docid": "d66273cb3b95a81513046a1b8e155935", "score": "0.5909272", "text": "func (x *fastReflection_Cat) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Cat\n}", "title": "" }, { "docid": "d2f2dfebc5688b7bd89de4c2beb32494", "score": "0.59065455", "text": "func (*RecordTransformation) Descriptor() ([]byte, []int) {\n\treturn file_google_privacy_dlp_v2_dlp_proto_rawDescGZIP(), []int{80}\n}", "title": "" } ]
f1fa321c39f8c080b7210b8cba5790a6
ServiceValueIDs returns the service_value ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use ServiceValueID instead. It exists only for internal usage by the builders.
[ { "docid": "d86c0caac14052dfc1021395b008fcea", "score": "0.8476048", "text": "func (m *PropertyMutation) ServiceValueIDs() (ids []int) {\n\tif id := m.service_value; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "ab26699460036f592be94c4ef80485ce", "score": "0.71097416", "text": "func (m *PropertyMutation) ServiceIDs() (ids []int) {\n\tif id := m.service; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "31fc08675de8e0d0df7fad58d2aa9b06", "score": "0.7048069", "text": "func (m *ServiceEndpointMutation) ServiceIDs() (ids []int) {\n\tif id := m.service; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3efcb8388d89a6ee41f16773326f14c0", "score": "0.6535066", "text": "func (m *LinkMutation) ServiceIDs() (ids []int) {\n\tfor id := range m.service {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "de67dc06264d6fce9397db37d8409335", "score": "0.6492905", "text": "func (m *PropertyMutation) SetServiceValueID(id int) {\n\tm.service_value = &id\n}", "title": "" }, { "docid": "26790d7e615cd82a0b7ebd0c8349fb6f", "score": "0.6435991", "text": "func (m *ServiceTypeMutation) ServicesIDs() (ids []int) {\n\tfor id := range m.services {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "051e3edc35c7662f0278280e7c1e348b", "score": "0.6355817", "text": "func (m *PropertyMutation) ServiceValueID() (id int, exists bool) {\n\tif m.service_value != nil {\n\t\treturn *m.service_value, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "626b4fbbb46485b640602ef70f8a690d", "score": "0.61837316", "text": "func (m *CustomerMutation) ServicesIDs() (ids []int) {\n\tfor id := range m.services {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8877ec97039b0d90427647486c857f9", "score": "0.6076838", "text": "func (m *PropertyTypeMutation) ServiceTypeIDs() (ids []int) {\n\tif id := m.service_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a4e64a92237df28c5400cae80d6840a2", "score": "0.6003841", "text": "func (ServiceStatus) Values() []ServiceStatus {\n\treturn []ServiceStatus{\n\t\t\"CREATE_IN_PROGRESS\",\n\t\t\"CREATE_FAILED_CLEANUP_IN_PROGRESS\",\n\t\t\"CREATE_FAILED_CLEANUP_COMPLETE\",\n\t\t\"CREATE_FAILED_CLEANUP_FAILED\",\n\t\t\"CREATE_FAILED\",\n\t\t\"ACTIVE\",\n\t\t\"DELETE_IN_PROGRESS\",\n\t\t\"DELETE_FAILED\",\n\t\t\"UPDATE_IN_PROGRESS\",\n\t\t\"UPDATE_FAILED_CLEANUP_IN_PROGRESS\",\n\t\t\"UPDATE_FAILED_CLEANUP_COMPLETE\",\n\t\t\"UPDATE_FAILED_CLEANUP_FAILED\",\n\t\t\"UPDATE_FAILED\",\n\t\t\"UPDATE_COMPLETE_CLEANUP_FAILED\",\n\t}\n}", "title": "" }, { "docid": "2dde12efcd3a91332ccf923b214e3b5e", "score": "0.59401804", "text": "func (ServiceNamespace) Values() []ServiceNamespace {\n\treturn []ServiceNamespace{\n\t\t\"autoscaling\",\n\t\t\"ecs\",\n\t\t\"ec2\",\n\t\t\"rds\",\n\t\t\"dynamodb\",\n\t}\n}", "title": "" }, { "docid": "27f4ff65368fcd4dda67c18c3e89e6fc", "score": "0.58547485", "text": "func (m *ServiceEndpointDefinitionMutation) ServiceTypeIDs() (ids []int) {\n\tif id := m.service_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a85b0b51e7f33eff159aa0ff5a6cad8", "score": "0.5794175", "text": "func (m *PropertyMutation) UserValueIDs() (ids []int) {\n\tif id := m.user_value; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f48e5496977b473437be3f5a6db4e2f0", "score": "0.5713413", "text": "func (m *ServiceTypeMutation) AddServiceIDs(ids ...int) {\n\tif m.services == nil {\n\t\tm.services = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.services[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "3704a1466d288299b4708c19ee9764d7", "score": "0.5678737", "text": "func (o GetVpcEndpointServiceFilterOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetVpcEndpointServiceFilter) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "ef735ef98559b424ea72f735a675cea0", "score": "0.5661157", "text": "func (m *CustomerMutation) AddServiceIDs(ids ...int) {\n\tif m.services == nil {\n\t\tm.services = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.services[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "bd8e7a8eedb76d6c8cd607aec7e6a82a", "score": "0.56465715", "text": "func (m *ServiceTypeMutation) RemovedServicesIDs() (ids []int) {\n\tfor id := range m.removedservices {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e0b915b9b5b8112a256213eaef9dcb94", "score": "0.55756766", "text": "func (m *LinkMutation) RemovedServiceIDs() (ids []int) {\n\tfor id := range m.removedservice {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5dd32b7582012d4669f90751939ca044", "score": "0.5564194", "text": "func (page DicomServiceCollectionPage) Values() []DicomService {\n\tif page.dsc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dsc.Value\n}", "title": "" }, { "docid": "f1cdd377fe918662e885fec9900ba0b6", "score": "0.5551983", "text": "func (m *EquipmentTypeMutation) ServiceEndpointDefinitionsIDs() (ids []int) {\n\tfor id := range m.service_endpoint_definitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0df6ae5a3e9de32e4aa538246ddb18ae", "score": "0.5546763", "text": "func (m *ServiceMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase service.EdgeType:\n\t\tif id := m._type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase service.EdgeDownstream:\n\t\tids := make([]ent.Value, 0, len(m.downstream))\n\t\tfor id := range m.downstream {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeUpstream:\n\t\tids := make([]ent.Value, 0, len(m.upstream))\n\t\tfor id := range m.upstream {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeProperties:\n\t\tids := make([]ent.Value, 0, len(m.properties))\n\t\tfor id := range m.properties {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeLinks:\n\t\tids := make([]ent.Value, 0, len(m.links))\n\t\tfor id := range m.links {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeCustomer:\n\t\tids := make([]ent.Value, 0, len(m.customer))\n\t\tfor id := range m.customer {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeEndpoints:\n\t\tids := make([]ent.Value, 0, len(m.endpoints))\n\t\tfor id := range m.endpoints {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79fa8d8055081102224400743879f357", "score": "0.5508272", "text": "func (m *CustomerMutation) RemoveServiceIDs(ids ...int) {\n\tif m.removedservices == nil {\n\t\tm.removedservices = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedservices[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "7368d649f9638f927c6a4c23fac91aa3", "score": "0.5501777", "text": "func (m *CustomerMutation) RemovedServicesIDs() (ids []int) {\n\tfor id := range m.removedservices {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "48153520dfc43abd39306c5d41bbe35c", "score": "0.5491909", "text": "func (m *ServiceTypeMutation) RemoveServiceIDs(ids ...int) {\n\tif m.removedservices == nil {\n\t\tm.removedservices = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedservices[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "2a07e7984275589f90f0f91f5585af4e", "score": "0.54481864", "text": "func (page DataServiceListPage) Values() []DataService {\n\tif page.dsl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.dsl.Value\n}", "title": "" }, { "docid": "01b475b679d61e9c7c222c9ec33c2b2c", "score": "0.54033136", "text": "func (o GetSubnetIdsFilterOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetSubnetIdsFilter) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "a3adb8f5e0520efbd887a3991fe1ed8e", "score": "0.53517294", "text": "func (m *PropertyMutation) EquipmentValueIDs() (ids []int) {\n\tif id := m.equipment_value; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c1940004657d98f539ef20014b2ee27", "score": "0.5281604", "text": "func (m *PropertyMutation) WorkOrderValueIDs() (ids []int) {\n\tif id := m.work_order_value; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb2eb76531beae04b6eb7fa860b3c6f7", "score": "0.52663445", "text": "func GetIdsFieldFormValue(r *http.Request, key string) []dbutil.IdField {\n\tvaluesStr := strings.Split(r.FormValue(key), \",\")\n\tids := make([]dbutil.IdField, 0)\n\n\tfor _, valueStr := range valuesStr {\n\t\tid, err := strconv.Atoi(valueStr)\n\t\tif err == nil {\n\t\t\tids = append(ids, dbutil.IdField(id))\n\t\t}\n\t}\n\n\treturn ids\n}", "title": "" }, { "docid": "7815962ff9ccf2231e0fb13e29a23941", "score": "0.5263665", "text": "func (m *ServiceMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase service.EdgeDownstream:\n\t\tids := make([]ent.Value, 0, len(m.removeddownstream))\n\t\tfor id := range m.removeddownstream {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeUpstream:\n\t\tids := make([]ent.Value, 0, len(m.removedupstream))\n\t\tfor id := range m.removedupstream {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeProperties:\n\t\tids := make([]ent.Value, 0, len(m.removedproperties))\n\t\tfor id := range m.removedproperties {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeLinks:\n\t\tids := make([]ent.Value, 0, len(m.removedlinks))\n\t\tfor id := range m.removedlinks {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeCustomer:\n\t\tids := make([]ent.Value, 0, len(m.removedcustomer))\n\t\tfor id := range m.removedcustomer {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase service.EdgeEndpoints:\n\t\tids := make([]ent.Value, 0, len(m.removedendpoints))\n\t\tfor id := range m.removedendpoints {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "09e765d1804e9fa272b16e54cb1ccdf3", "score": "0.52589947", "text": "func (m *LinkMutation) AddServiceIDs(ids ...int) {\n\tif m.service == nil {\n\t\tm.service = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.service[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "1431446d4770112d83cd742e9ff49145", "score": "0.5235273", "text": "func (iamIdentity *IamIdentityV1) ListServiceIds(listServiceIdsOptions *ListServiceIdsOptions) (result *ServiceIDList, response *core.DetailedResponse, err error) {\n\treturn iamIdentity.ListServiceIdsWithContext(context.Background(), listServiceIdsOptions)\n}", "title": "" }, { "docid": "cdb8b813019de13ae22527e150244651", "score": "0.5193458", "text": "func (m *EquipmentTypeMutation) RemovedServiceEndpointDefinitionsIDs() (ids []int) {\n\tfor id := range m.removedservice_endpoint_definitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bd49e4aab4b8108b9ce93c2a61983c92", "score": "0.5192562", "text": "func (m *PropertyMutation) LocationValueIDs() (ids []int) {\n\tif id := m.location_value; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "45783d4f27180fe1e215efb9b9c33dfe", "score": "0.5178649", "text": "func (ListServiceInstancesFilterBy) Values() []ListServiceInstancesFilterBy {\n\treturn []ListServiceInstancesFilterBy{\n\t\t\"name\",\n\t\t\"deploymentStatus\",\n\t\t\"templateName\",\n\t\t\"serviceName\",\n\t\t\"deployedTemplateVersionStatus\",\n\t\t\"environmentName\",\n\t\t\"lastDeploymentAttemptedAtBefore\",\n\t\t\"lastDeploymentAttemptedAtAfter\",\n\t\t\"createdAtBefore\",\n\t\t\"createdAtAfter\",\n\t}\n}", "title": "" }, { "docid": "1da72d4543a078ade9eccad67aedbc74", "score": "0.5175972", "text": "func (page FhirServiceCollectionPage) Values() []FhirService {\n\tif page.fsc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.fsc.Value\n}", "title": "" }, { "docid": "3ff7536e1b55fd37b0362180dcc44241", "score": "0.51654685", "text": "func (c *client) ListServiceIdentitiesForService(svc service.MeshService) []identity.ServiceIdentity {\n\tserviceAccounts, err := c.kubeController.ListServiceIdentitiesForService(svc)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msgf(\"Error getting ServiceAccounts for Service %s\", svc)\n\t\treturn nil\n\t}\n\n\tvar serviceIdentities []identity.ServiceIdentity\n\tfor _, svcAccount := range serviceAccounts {\n\t\tserviceIdentity := svcAccount.ToServiceIdentity()\n\t\tserviceIdentities = append(serviceIdentities, serviceIdentity)\n\t}\n\n\treturn serviceIdentities\n}", "title": "" }, { "docid": "fe63d6fd39c24a0888784d250bbd4516", "score": "0.5142479", "text": "func GetVirtualCircuitServiceTypeEnumValues() []VirtualCircuitServiceTypeEnum {\n\tvalues := make([]VirtualCircuitServiceTypeEnum, 0)\n\tfor _, v := range mappingVirtualCircuitServiceTypeEnum {\n\t\tvalues = append(values, v)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "dae3241fd81e00a184538b8d61400878", "score": "0.5100418", "text": "func (page ServicesDescriptionListResultPage) Values() []ServicesDescription {\n\tif page.sdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sdlr.Value\n}", "title": "" }, { "docid": "dae3241fd81e00a184538b8d61400878", "score": "0.5100418", "text": "func (page ServicesDescriptionListResultPage) Values() []ServicesDescription {\n\tif page.sdlr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.sdlr.Value\n}", "title": "" }, { "docid": "cd249e9b85b569b5eb2657ce978b73c3", "score": "0.509767", "text": "func (page ServiceResourceListPage) Values() []ServiceResource {\n\tif page.srl.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.srl.Value\n}", "title": "" }, { "docid": "191dd4c301a90411e04cffb94e83cd11", "score": "0.5096153", "text": "func (ChangeTokenStatus) Values() []ChangeTokenStatus {\n\treturn []ChangeTokenStatus{\n\t\t\"PROVISIONED\",\n\t\t\"PENDING\",\n\t\t\"INSYNC\",\n\t}\n}", "title": "" }, { "docid": "fba374baf8a36b98cef8a8489a5f5ebe", "score": "0.50862634", "text": "func (m *ServiceTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase servicetype.EdgeServices:\n\t\tids := make([]ent.Value, 0, len(m.services))\n\t\tfor id := range m.services {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase servicetype.EdgePropertyTypes:\n\t\tids := make([]ent.Value, 0, len(m.property_types))\n\t\tfor id := range m.property_types {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase servicetype.EdgeEndpointDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.endpoint_definitions))\n\t\tfor id := range m.endpoint_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd9aefa714d7c5be8ab91f9ab92f0bc5", "score": "0.50846136", "text": "func (m *LinkMutation) RemoveServiceIDs(ids ...int) {\n\tif m.removedservice == nil {\n\t\tm.removedservice = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedservice[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "20f4ccfb282d7b0d04c986b87ca414ea", "score": "0.5079412", "text": "func (page BuildServiceCollectionPage) Values() []BuildService {\n\tif page.bsc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.bsc.Value\n}", "title": "" }, { "docid": "ce06bb46e36a1f2b2a599da1ea1b4ea9", "score": "0.5079109", "text": "func (vals *int64Values) Values() []interface{} {\n\tv := *vals\n\tret := make([]interface{}, len(v))\n\tfor i := 0; i < len(v); i++ {\n\t\tret[i] = v[i].v\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "6692a72a279ed274447772676713cedc", "score": "0.5063825", "text": "func (m *ServiceUpdateMessage) GetServices()([]string) {\n return m.services\n}", "title": "" }, { "docid": "252c495baf95c6e653d93c0acabea7be", "score": "0.50129455", "text": "func (m *PropertyMutation) SetServiceID(id int) {\n\tm.service = &id\n}", "title": "" }, { "docid": "6b5b471a3382c668ab5ed4b18e38e904", "score": "0.4999215", "text": "func (TargetIdType) Values() []TargetIdType {\n\treturn []TargetIdType{\n\t\t\"ACCOUNT\",\n\t\t\"OU\",\n\t\t\"ROOT\",\n\t}\n}", "title": "" }, { "docid": "def0a17f7e854c7633006046c47adf35", "score": "0.49927637", "text": "func (m *ServiceUpdateMessage) SetServices(value []string)() {\n m.services = value\n}", "title": "" }, { "docid": "363ea0a57b46600090a4181a718bd0af", "score": "0.49913594", "text": "func (s *ValueWithServiceIds) SetServiceIds(v []*ServiceId) *ValueWithServiceIds {\n\ts.ServiceIds = v\n\treturn s\n}", "title": "" }, { "docid": "ac3576acf071d4296d564f9f441b0c62", "score": "0.4978289", "text": "func (page ListResultPage) Values() []ContainerService {\n\tif page.lr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.lr.Value\n}", "title": "" }, { "docid": "11658b397d54204390c1178c759818e1", "score": "0.4970053", "text": "func PossibleServicesValues() []Services {\n\treturn []Services{\n\t\tServicesB,\n\t\tServicesF,\n\t\tServicesQ,\n\t\tServicesT,\n\t}\n}", "title": "" }, { "docid": "5167684e4b6ecdea1d708f75eeaca544", "score": "0.4967225", "text": "func (m *ServiceTypeMutation) RemovedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase servicetype.EdgeServices:\n\t\tids := make([]ent.Value, 0, len(m.removedservices))\n\t\tfor id := range m.removedservices {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase servicetype.EdgePropertyTypes:\n\t\tids := make([]ent.Value, 0, len(m.removedproperty_types))\n\t\tfor id := range m.removedproperty_types {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase servicetype.EdgeEndpointDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.removedendpoint_definitions))\n\t\tfor id := range m.removedendpoint_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "189bab414c6989bce951fd2c7dd8ae31", "score": "0.49668092", "text": "func (v *ValueRing) GetIds() (*SortedArrayBigInts) {\n\treturn v.ids\n}", "title": "" }, { "docid": "669a6eac984bbf8f633f3c20bb6b665b", "score": "0.49607268", "text": "func (m *ServiceMutation) EndpointsIDs() (ids []int) {\n\tfor id := range m.endpoints {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1730d5350c09ea65d55e4b5bdbd52b5e", "score": "0.49603617", "text": "func (m *EquipmentTypeMutation) AddServiceEndpointDefinitionIDs(ids ...int) {\n\tif m.service_endpoint_definitions == nil {\n\t\tm.service_endpoint_definitions = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.service_endpoint_definitions[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "41e6013e69c4e3cb9a4194eabf9f10d5", "score": "0.49597868", "text": "func (m *PropertyMutation) ServiceValueCleared() bool {\n\treturn m.clearedservice_value\n}", "title": "" }, { "docid": "e3d5c07c231194599432d58f11371620", "score": "0.49490973", "text": "func (jbobject *ServicesEc2ModelConversionTaskState) Values() []*ServicesEc2ModelConversionTaskState {\n\tjret, err := javabind.GetEnv().CallStaticMethod(\"com/amazonaws/services/ec2/model/ConversionTaskState\", \"values\", javabind.ObjectArrayType(\"com/amazonaws/services/ec2/model/ConversionTaskState\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tretconv := javabind.NewJavaToGoObjectArray(javabind.NewJavaToGoCallable(), \"com/amazonaws/services/ec2/model/ConversionTaskState\")\n\tdst := new([]*ServicesEc2ModelConversionTaskState)\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\treturn *dst\n}", "title": "" }, { "docid": "9541e0ebbedbec359b73645e5d179918", "score": "0.4931903", "text": "func (m *TaskMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Task.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "8d95d3e7ca5e3fef06a8e36fb47422bb", "score": "0.49203616", "text": "func (FindingStatusUpdate) Values() []FindingStatusUpdate {\n\treturn []FindingStatusUpdate{\n\t\t\"ACTIVE\",\n\t\t\"ARCHIVED\",\n\t}\n}", "title": "" }, { "docid": "b71d0dd636a3ccd93152c83212aba382", "score": "0.49180856", "text": "func (tree *ById) Values() []multi_index.PeerBlockState {\n\tvalues := make([]multi_index.PeerBlockState, tree.size)\n\tit := tree.Iterator()\n\tfor i := 0; it.Next(); i++ {\n\t\tvalues[i] = it.Value()\n\t}\n\treturn values\n}", "title": "" }, { "docid": "17d8c6c9aa09ecbafd5da6c37b2478c1", "score": "0.490414", "text": "func (StopStatus) Values() []StopStatus {\n\treturn []StopStatus{\n\t\t\"Pending\",\n\t\t\"Succeeded\",\n\t}\n}", "title": "" }, { "docid": "aba02689ceddc1e75311df7c2ea7213d", "score": "0.4896666", "text": "func (m *ServiceMutation) PropertiesIDs() (ids []int) {\n\tfor id := range m.properties {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f86c53d35307790de5432440d3318624", "score": "0.48901814", "text": "func (m *PropertyMutation) ClearServiceValue() {\n\tm.clearedservice_value = true\n}", "title": "" }, { "docid": "e631e318e52fafa08fd6f1b1de86dbde", "score": "0.4873924", "text": "func (m *EquipmentTypeMutation) RemoveServiceEndpointDefinitionIDs(ids ...int) {\n\tif m.removedservice_endpoint_definitions == nil {\n\t\tm.removedservice_endpoint_definitions = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedservice_endpoint_definitions[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "e8f9d4c2d1ec813ea5eca40bd1dbcdd3", "score": "0.48591295", "text": "func (VpcEndpointStatus) Values() []VpcEndpointStatus {\n\treturn []VpcEndpointStatus{\n\t\t\"PENDING\",\n\t\t\"DELETING\",\n\t\t\"ACTIVE\",\n\t\t\"FAILED\",\n\t}\n}", "title": "" }, { "docid": "e011a2d2c8a6ca31c6e3e5ff4a89aedc", "score": "0.4840684", "text": "func (jbobject *ServicesEc2ModelVpcPeeringConnectionStateReasonCode) Values() []*ServicesEc2ModelVpcPeeringConnectionStateReasonCode {\n\tjret, err := javabind.GetEnv().CallStaticMethod(\"com/amazonaws/services/ec2/model/VpcPeeringConnectionStateReasonCode\", \"values\", javabind.ObjectArrayType(\"com/amazonaws/services/ec2/model/VpcPeeringConnectionStateReasonCode\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tretconv := javabind.NewJavaToGoObjectArray(javabind.NewJavaToGoCallable(), \"com/amazonaws/services/ec2/model/VpcPeeringConnectionStateReasonCode\")\n\tdst := new([]*ServicesEc2ModelVpcPeeringConnectionStateReasonCode)\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\treturn *dst\n}", "title": "" }, { "docid": "f02d22381520ca4e2778a3e619a8cd48", "score": "0.4833333", "text": "func UnmarshalServiceIDList(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ServiceIDList)\n\terr = core.UnmarshalModel(m, \"context\", &obj.Context, UnmarshalResponseContext)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"offset\", &obj.Offset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"limit\", &obj.Limit)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"first\", &obj.First)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"previous\", &obj.Previous)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"next\", &obj.Next)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"serviceids\", &obj.Serviceids, UnmarshalServiceID)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "28e95cd7b9761297fff8f833bacff2ce", "score": "0.48292208", "text": "func (m *HogeMutation) IDs(ctx context.Context) ([]string, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []string{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Hoge.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "cf12356a7bd432b78f0105c063b06d82", "score": "0.4828978", "text": "func PossibleOrchestrationServiceStateValues() []OrchestrationServiceState {\n\treturn []OrchestrationServiceState{NotRunning, Running, Suspended}\n}", "title": "" }, { "docid": "6bf1c576abfa3f3a568244b1512bfdee", "score": "0.48254028", "text": "func (m *ServiceEndpointMutation) SetServiceID(id int) {\n\tm.service = &id\n}", "title": "" }, { "docid": "8a7c8c30eae2b0e2bd3033bfaa6569b4", "score": "0.4822878", "text": "func (m *TagMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Tag.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "e4b87f5a59d6523d28a69aa5a2e79a78", "score": "0.48180154", "text": "func (m *ServiceTypeMutation) EndpointDefinitionsIDs() (ids []int) {\n\tfor id := range m.endpoint_definitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "864e0debfac225342922a9455250b271", "score": "0.48164517", "text": "func (m *ServiceEndpointMutation) DefinitionIDs() (ids []int) {\n\tif id := m.definition; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2e044966160bd37ab3829fc88b9e5c94", "score": "0.481488", "text": "func (m *ServiceEndpointMutation) PortIDs() (ids []int) {\n\tif id := m.port; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5ac4c5879056c082b2e6c8ef3f641a77", "score": "0.48102248", "text": "func (m *FriendshipMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Friendship.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "4f89b8ed1de76195f2fc9d8a83c473b2", "score": "0.48095468", "text": "func (m *FooMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Foo.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "8cb7bb51d86359e4abb73430278e269c", "score": "0.48054135", "text": "func (s ValueWithServiceIds) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b50edbf89ca4787661c59138e5a1c965", "score": "0.47880805", "text": "func (m *GroupTagMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().GroupTag.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "a3199c2c97b8c4bc1ef7c38e74ee6e13", "score": "0.47846022", "text": "func (m *UserMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().User.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "a3199c2c97b8c4bc1ef7c38e74ee6e13", "score": "0.47846022", "text": "func (m *UserMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().User.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "a3199c2c97b8c4bc1ef7c38e74ee6e13", "score": "0.47846022", "text": "func (m *UserMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().User.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "c2e3bda4cb9739d0df2a2db90f77e3c8", "score": "0.4772605", "text": "func MessageFormatValue_Values() []string {\n\treturn []string{\n\t\tMessageFormatValueJson,\n\t\tMessageFormatValueJsonUnformatted,\n\t}\n}", "title": "" }, { "docid": "0b4bde97b47c55854d95d014c38568f4", "score": "0.47716427", "text": "func (FragmentSelectorType) Values() []FragmentSelectorType {\n\treturn []FragmentSelectorType{\n\t\t\"PRODUCER_TIMESTAMP\",\n\t\t\"SERVER_TIMESTAMP\",\n\t}\n}", "title": "" }, { "docid": "1237183e41a7076c7953dac7738a8538", "score": "0.47702658", "text": "func DatastoreStatus_Values() []string {\n\treturn []string{\n\t\tDatastoreStatusCreating,\n\t\tDatastoreStatusCreateFailed,\n\t\tDatastoreStatusActive,\n\t\tDatastoreStatusDeleting,\n\t\tDatastoreStatusDeleted,\n\t}\n}", "title": "" }, { "docid": "cf5666fe4ffacd41d736279c6c2024ed", "score": "0.4762238", "text": "func (m *ServiceEndpointMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase serviceendpoint.EdgePort:\n\t\tif id := m.port; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase serviceendpoint.EdgeEquipment:\n\t\tif id := m.equipment; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase serviceendpoint.EdgeService:\n\t\tif id := m.service; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase serviceendpoint.EdgeDefinition:\n\t\tif id := m.definition; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f8051ea7666628d6dffc55619a5f499", "score": "0.47586662", "text": "func (ServerCriteria) Values() []ServerCriteria {\n\treturn []ServerCriteria{\n\t\t\"NOT_DEFINED\",\n\t\t\"OS_NAME\",\n\t\t\"STRATEGY\",\n\t\t\"DESTINATION\",\n\t\t\"SERVER_ID\",\n\t}\n}", "title": "" }, { "docid": "0b339fcc2f3aa71739949df3357ad0ae", "score": "0.47552598", "text": "func (EntityStatusCode) Values() []EntityStatusCode {\n\treturn []EntityStatusCode{\n\t\t\"IMPAIRED\",\n\t\t\"UNIMPAIRED\",\n\t\t\"UNKNOWN\",\n\t\t\"PENDING\",\n\t\t\"RESOLVED\",\n\t}\n}", "title": "" }, { "docid": "bc83255691c0f4861d8ca6732dc8c42f", "score": "0.47519854", "text": "func (DatasourcePackageIngestState) Values() []DatasourcePackageIngestState {\n\treturn []DatasourcePackageIngestState{\n\t\t\"STARTED\",\n\t\t\"STOPPED\",\n\t\t\"DISABLED\",\n\t}\n}", "title": "" }, { "docid": "147d841f8b75983891132bdf2fe4f5d4", "score": "0.47513562", "text": "func (o *TelemetryDruidFragmentSearchSpecAllOf) GetValues() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Values\n}", "title": "" }, { "docid": "d1a2ca054135ffe06bcc56df685b63ff", "score": "0.47455817", "text": "func (UpdateDataRetentionOperation) Values() []UpdateDataRetentionOperation {\n\treturn []UpdateDataRetentionOperation{\n\t\t\"INCREASE_DATA_RETENTION\",\n\t\t\"DECREASE_DATA_RETENTION\",\n\t}\n}", "title": "" }, { "docid": "cb568db282d57b450f8d38e82281867d", "score": "0.47449753", "text": "func (LifecycleEventStatus) Values() []LifecycleEventStatus {\n\treturn []LifecycleEventStatus{\n\t\t\"Pending\",\n\t\t\"InProgress\",\n\t\t\"Succeeded\",\n\t\t\"Failed\",\n\t\t\"Skipped\",\n\t\t\"Unknown\",\n\t}\n}", "title": "" }, { "docid": "778adbb1d3c4dc54e2dc1a94063ceaea", "score": "0.47435015", "text": "func (tru *TcpRuleUpdate) SetServiceID(i int64) *TcpRuleUpdate {\n\ttru.mutation.ResetServiceID()\n\ttru.mutation.SetServiceID(i)\n\treturn tru\n}", "title": "" }, { "docid": "29351e497d9c376cb57b07797b12c513", "score": "0.47424752", "text": "func (m *BookMutation) VocasIDs() (ids []uuid.UUID) {\n\tfor id := range m.vocas {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1ba7d87e7a37e3a39a60a652c6779459", "score": "0.47409707", "text": "func (ListServiceInstancesSortBy) Values() []ListServiceInstancesSortBy {\n\treturn []ListServiceInstancesSortBy{\n\t\t\"name\",\n\t\t\"deploymentStatus\",\n\t\t\"templateName\",\n\t\t\"serviceName\",\n\t\t\"environmentName\",\n\t\t\"lastDeploymentAttemptedAt\",\n\t\t\"createdAt\",\n\t}\n}", "title": "" }, { "docid": "643ce3face6e7e96f49ac3fe1e3bfdfa", "score": "0.4740282", "text": "func (m *GetByIdsPostRequestBody) GetIds()([]string) {\n return m.ids\n}", "title": "" }, { "docid": "bbd2bd567bd296470a4cb87b788603b5", "score": "0.47367817", "text": "func (VirtualInterfaceState) Values() []VirtualInterfaceState {\n\treturn []VirtualInterfaceState{\n\t\t\"confirming\",\n\t\t\"verifying\",\n\t\t\"pending\",\n\t\t\"available\",\n\t\t\"down\",\n\t\t\"deleting\",\n\t\t\"deleted\",\n\t\t\"rejected\",\n\t\t\"unknown\",\n\t}\n}", "title": "" }, { "docid": "76f13063440662aa48df330b5f30f4bf", "score": "0.47293118", "text": "func (m *CarMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Car.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "522ca1ca66251d6eae9bbc7e90ce44d4", "score": "0.47284764", "text": "func (ParticipantState) Values() []ParticipantState {\n\treturn []ParticipantState{\n\t\t\"CONNECTED\",\n\t\t\"DISCONNECTED\",\n\t}\n}", "title": "" }, { "docid": "d00632821795f4339148d92fca551caa", "score": "0.47268915", "text": "func (m *UserGroupMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().UserGroup.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" } ]
7b6042f7481619590ef695cb449e6f8e
Run fetches a record from Neptune and updates the configured writer
[ { "docid": "71d71dc8e2b5b387d551168f7c832108", "score": "0.41863817", "text": "func (r *TouchAction) Run(message *message.Message) error {\n\tlog.Printf(\"Received a message with %v entities\", len(message.Entities))\n\tresourceList, err := r.recordToResourceList(message)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = r.registry.Writer.Add(resourceList)\n\treturn err\n}", "title": "" } ]
[ { "docid": "7c9f942b6513b18aa38f0b0cb829e1c2", "score": "0.5183092", "text": "func (ds *dataSource) Observe(ctx context.Context) (ocrtypes.Observation, error) {\n\tvar observation ocrtypes.Observation\n\tstart := time.Now()\n\tmd, err := models.MarshalBridgeMetaData(ds.currentBridgeMetadata.LatestAnswer, ds.currentBridgeMetadata.UpdatedAt)\n\tif err != nil {\n\t\tlogger.Warnw(\"unable to attach metadata for run\", \"err\", err)\n\t}\n\ttrrs, err := ds.pipelineRunner.ExecuteRun(ctx, ds.spec, pipeline.JSONSerializable{\n\t\tVal: md,\n\t}, ds.ocrLogger)\n\tif err != nil {\n\t\treturn observation, errors.Wrapf(err, \"error executing run for spec ID %v\", ds.spec.ID)\n\t}\n\tend := time.Now()\n\n\tvar run pipeline.Run\n\trun.PipelineSpecID = ds.spec.ID\n\trun.CreatedAt = start\n\trun.FinishedAt = &end\n\n\tfinalResult := trrs.FinalResult()\n\trun.Outputs = finalResult.OutputsDB()\n\trun.Errors = finalResult.ErrorsDB()\n\n\t// Do the database write in a non-blocking fashion\n\t// so we can return the observation results immediately.\n\t// This is helpful in the case of a blocking API call, where\n\t// we reach the passed in context deadline and we want to\n\t// immediately return any result we have and do not want to have\n\t// a db write block that.\n\tselect {\n\tcase ds.runResults <- pipeline.RunWithResults{\n\t\tRun: run,\n\t\tTaskRunResults: trrs,\n\t}:\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unable to enqueue run save for job ID %v, buffer full\", ds.spec.JobID)\n\t}\n\n\tresult, err := finalResult.SingularResult()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error getting singular result for job ID %v\", ds.spec.JobID)\n\t}\n\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\n\tasDecimal, err := utils.ToDecimal(result.Value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tds.currentBridgeMetadata = models.BridgeMetaData{\n\t\tLatestAnswer: asDecimal.BigInt(),\n\t\tUpdatedAt: big.NewInt(time.Now().Unix()),\n\t}\n\treturn asDecimal.BigInt(), nil\n}", "title": "" }, { "docid": "91e5eecdd2c8339995c0d099cfa0e84f", "score": "0.51546925", "text": "func (co *Query) Run(api AlchemyAPIer) error {\n\tco.AddParam(\"outputMode\", \"json\")\n\tif err := api.Required(co.endpoint, co.params); err != nil {\n\t\treturn err\n\t}\n\tres, err := http.PostForm(co.Endpoint(), co.params)\n\tif err != nil {\n\t\treturn err\n\t}\n\tco.lastRead, err = ioutil.ReadAll(res.Body)\n\tres.Body.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = api.Decode(co.lastRead)\n\treturn err\n}", "title": "" }, { "docid": "08cb5de0fb4d314c24f2997e0202143c", "score": "0.506204", "text": "func (convert *Convert) Run() {\n\terr := convert.Driver.Connect()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, tableRealName := range convert.getGenTables() {\n\t\tprefix, ok := convert.TablePrefix[tableRealName]\n\t\tif ok {\n\t\t\ttableRealName = tableRealName[len(prefix):]\n\t\t}\n\t\ttableName := tableRealName\n\n\t\tif len(tableName) < 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttableName = CamelCase(tableName, prefix, true)\n\n\t\tcolumns := convert.Driver.ReadTablesColumns(tableRealName)\n\t\tcontent := convert.build(tableName, tableRealName, prefix, columns)\n\t\tconvert.writeModel(tableRealName, content) //写文件\n\t}\n\tconvert.writeInit()\n}", "title": "" }, { "docid": "d37b03bd6c7414dc7b8bbc33f08bb9ff", "score": "0.50365007", "text": "func (nw *clusterNodeWriter) Run(stop <-chan struct{}) {\n\tfor {\n\t\tselect {\n\t\tcase <-stop:\n\t\t\treturn\n\t\tcase msg := <-nw.writer:\n\t\t\t_, err := setNodeAnnotations(msg.client, msg.lister, msg.node, msg.annos)\n\t\t\tmsg.responseChannel <- err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0f1d83aa7c248816be7fce9b2180995d", "score": "0.49967903", "text": "func (eo Elasticsearch) Run() {\n\tgo eo.pushToBuffer()\n\tconn := eo.createESClient()\n\tcreateIndex(conn)\n\tfor {\n\t\tlog := <-eo.buffer\n\t\tindexLog(conn, log)\n\t}\n}", "title": "" }, { "docid": "e0eb12163956a4e4a9226edec4ccf8e4", "score": "0.4965234", "text": "func Run(controller Controller, executor Executor) error {\n\tif err := controller.Open(); err != nil {\n\t\tlog.Errorf(\"failed to open data sourcer: %v\", err)\n\t\treturn err\n\t}\n\tdefer controller.Close()\n\tsqls, err := controller.Read()\n\tif err != nil {\n\t\tlog.Errorf(\"failed to read data from data sourcer: %v\", err)\n\t\tcontroller.OnReadFail(err)\n\t\treturn err\n\t}\n\n\tcontroller.OnReadSuccess()\n\tkeyspace := controller.GetKeyspace()\n\tif err := executor.Open(keyspace); err != nil {\n\t\tlog.Errorf(\"failed to open executor: %v\", err)\n\t\treturn err\n\t}\n\tdefer executor.Close()\n\tif err := executor.Validate(sqls); err != nil {\n\t\tlog.Errorf(\"validation fail: %v\", err)\n\t\tcontroller.OnValidationFail(err)\n\t\treturn err\n\t}\n\tcontroller.OnValidationSuccess()\n\tresult := executor.Execute(sqls)\n\tcontroller.OnExecutorComplete(result)\n\tif result.ExecutorErr != \"\" || len(result.FailedShards) > 0 {\n\t\tout, _ := json.MarshalIndent(result, \"\", \" \")\n\t\treturn fmt.Errorf(\"Schema change failed, ExecuteResult: %v\\n\", string(out))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afd96d56830348d3e1b0c5ff5bc67028", "score": "0.49252117", "text": "func main(){\n\tmodel.ModelInit()\n\tdefer model.ModelClose()\n\tmodelData,_:=model.SelectAll()\n\tes.EsInit(modelData)\n\t//es.WriteData(modelData)\n\t//es.AnalyzeData()\n}", "title": "" }, { "docid": "ad02bd0d090de44e3d530e1972996dce", "score": "0.48692098", "text": "func Run(id int) error {\n\tdb, err := bolt.Open(viper.GetString(\"database_file\"), 0600, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\treturn db.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(\"watchers\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc := b.Cursor()\n\t\tk, v := c.Seek(itob(id))\n\n\t\tif k == nil || !bytes.Equal(k, itob(id)) {\n\t\t\treturn fmt.Errorf(\"key not found\")\n\t\t}\n\n\t\tclient := &http.Client{}\n\t\treturn addToQueue(client, v)\n\t})\n}", "title": "" }, { "docid": "ee0825e5387d995d292d2c52093a8f41", "score": "0.48500973", "text": "func (m *Main) Run() error {\n\tif m.Seed == -1 {\n\t\tm.Seed = time.Now().UnixNano()\n\t}\n\n\tschema := gopilosa.NewSchema()\n\tidx := schema.Index(m.Index)\n\tidx.Field(m.Field, gopilosa.OptFieldTypeSet(gopilosa.CacheTypeRanked, 50000))\n\tindexer, err := pdk.SetupPilosa(m.PilosaHosts, m.Index, schema, m.BatchSize)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"setting up Pilosa\")\n\t}\n\n\tug := newUserGetter(m.Seed)\n\n\tfor i := uint64(0); i < m.Num; i++ {\n\t\tindexer.AddColumn(m.Field, i, ug.ID())\n\t}\n\n\treturn errors.Wrap(indexer.Close(), \"closing indexer\")\n}", "title": "" }, { "docid": "c7bc6504815cacaa5d7eb3cc280adb88", "score": "0.48476553", "text": "func Run(source string, output string) {\n\tif output == \"\" {\n\t\toutput = \"output.tf\"\n\t}\n\n\tfmt.Println(\"source: \", source)\n\tfmt.Println(\"output: \", output)\n\n\tvar data JsonSource\n\tfile, _ := ioutil.ReadFile(source)\n\n\terr := json.Unmarshal([]byte(file), &data)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tf, err := os.Create(output)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tf.Close()\n\t}\n\n\tfor _, item := range data.ResourceRecordSets {\n\n\t\tif item.Type == \"NS\" || item.Type == \"SOA\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceName := strings.TrimRight(item.Name, \".\")\n\t\tresourceName = strings.ReplaceAll(resourceName, \".\", \"_\")\n\t\tif item.Type == \"MX\" || item.Type == \"SPF\" || item.Type == \"TXT\" {\n\t\t\tresourceName = resourceName + \"_\" + strings.ToLower(item.Type)\n\t\t}\n\n\t\tfmt.Fprintf(f, \"resource \\\"aws_route53_record\\\" \\\"%s\\\" {\\n\", resourceName)\n\t\tfmt.Fprintf(f, \" zone_id = \\\"ZONEID\\\"\\n\")\n\t\tfmt.Fprintf(f, \" name = \\\"%s\\\"\\n\", item.Name)\n\t\tfmt.Fprintf(f, \" type = \\\"%s\\\"\\n\", item.Type)\n\n\t\tif item.AliasTarget.HostedZoneID != \"\" {\n\t\t\tfmt.Fprintf(f, \"\\n\")\n\t\t\tfmt.Fprintf(f, \" alias {\\n\")\n\t\t\tfmt.Fprintf(f, \" name = \\\"%s\\\"\\n\", item.AliasTarget.DNSName)\n\t\t\tfmt.Fprintf(f, \" zone_id = \\\"%s\\\"\\n\", item.AliasTarget.HostedZoneID)\n\t\t\tfmt.Fprintf(f, \" evaluate_target_health = \\\"%t\\\"\\n\", item.AliasTarget.EvaluateTargetHealth)\n\t\t\tfmt.Fprintf(f, \" }\\n\")\n\t\t} else {\n\t\t\tfmt.Fprintf(f, \" ttl = \\\"%d\\\"\\n\", item.TTL)\n\t\t\tfmt.Fprintf(f, \" records = [\\n\")\n\n\t\t\tlength := len(item.ResourceRecords)\n\n\t\t\tfor index, record := range item.ResourceRecords {\n\n\t\t\t\tvalue := strings.ReplaceAll(record.Value, \"\\\"\", \"\")\n\n\t\t\t\tif (index + 1) == length {\n\t\t\t\t\tfmt.Fprintf(f, \" \\\"%s\\\"\\n\", value)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(f, \" \\\"%s\\\",\\n\", value)\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfmt.Fprintf(f, \" ]\\n\")\n\t\t}\n\n\t\tfmt.Fprintf(f, \"}\\n\\n\")\n\t}\n\n\tfmt.Println(\"generated successfully:\", output)\n}", "title": "" }, { "docid": "1921b82f5b9b9fa28548664386e47ef9", "score": "0.47905385", "text": "func (r PutTrainedModel) Perform(ctx context.Context) (*http.Response, error) {\n\treq, err := r.HttpRequest(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := r.transport.Perform(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"an error happened during the PutTrainedModel query execution: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "790243b8e9505bef2fdc85881dd325e8", "score": "0.47200793", "text": "func (t *Trial) Run() {\n\tt.startTime = time.Now()\n\n\t// Seed the random number generator with current nanoseconds.\n\trand.Seed(t.startTime.UTC().UnixNano())\n\n\t// Create the results output file.\n\tresults, err := os.Create(t.resultFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer results.Close()\n\n\t// Write data column names to the file.\n\tresults.WriteString(\"order replicate index name seconds\\n\")\n\n\t// Run all the repetitions of the experiment.\n\tt.order = 1\n\tfor i := 1; i <= t.repetitions; i++ {\n\t\tt.runReplicate(i, results)\n\t}\n}", "title": "" }, { "docid": "102cb2bf4d3d0bae8b41548229200fa8", "score": "0.47132015", "text": "func (tc ExtractorTestCase) Run(t *testing.T) {\n\t// Go through the Rows and update the Extractor\n\terr := Run(tc.stream, tc.extractor, nil, 0)\n\n\t// Check the error\n\tif err == nil {\n\t\tif tc.isErr == true {\n\t\t\tt.Error(\"expected an error, got nil\")\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif tc.isErr == false {\n\t\t\tt.Errorf(\"expected no error, got %v\", err)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t}\n\n\t// Collect and check the output\n\tb := &strings.Builder{}\n\tsink := NewCSVSink(b)\n\tsink.Write(tc.extractor.Collect())\n\toutput := b.String()\n\tif output != tc.output {\n\t\tt.Errorf(\"got:\\n%swant:\\n%s\", output, tc.output)\n\t}\n\n\t// Check the size\n\tsize := tc.extractor.Size()\n\tif size != tc.size {\n\t\tt.Errorf(\"got: %d, want: %d\\n\", size, tc.size)\n\t}\n}", "title": "" }, { "docid": "4ebe5ef138b3e151723f1d7089ce0bd3", "score": "0.47034484", "text": "func (i *Index) Run() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase q := <-i.QueryChan:\n\t\t\t\tq.ReturnChan <- i.Query(q.Term)\n\t\t\tcase n := <-i.RebuildChan:\n\t\t\t\ti.RebuildWith(n)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "0f2bf3cbfce7a73adfadd638df7596f6", "score": "0.4692468", "text": "func (b *Bulk) Run(ctx context.Context) (*BulkResult, error) {\n\topts := options.BulkWriteOptions{\n\t\tOrdered: b.ordered,\n\t}\n\tresult, err := b.coll.collection.BulkWrite(ctx, b.queue, &opts)\n\tif err != nil {\n\t\t// In original mgo, queue is not reset in case of error.\n\t\treturn nil, err\n\t}\n\n\t// Empty the queue for possible reuse, as per mgo's behavior.\n\tb.queue = nil\n\n\treturn &BulkResult{\n\t\tInsertedCount: result.InsertedCount,\n\t\tMatchedCount: result.MatchedCount,\n\t\tModifiedCount: result.ModifiedCount,\n\t\tDeletedCount: result.DeletedCount,\n\t\tUpsertedCount: result.UpsertedCount,\n\t\tUpsertedIDs: result.UpsertedIDs,\n\t}, nil\n}", "title": "" }, { "docid": "2883fc16c70ae2c506d8ba7b5087c26b", "score": "0.46790186", "text": "func Run(ctx context.Context, rd stream.EntryReader, db keyvalue.DB, opts *Options) error {\n\tif opts == nil {\n\t\topts = new(Options)\n\t}\n\n\tlog.Println(\"Starting serving pipeline\")\n\n\tout := &servingOutput{\n\t\txs: table.ProtoBatchParallel{&table.KVProto{DB: db}},\n\t\tidx: &table.KVInverted{DB: db},\n\t}\n\trd = filterReverses(rd)\n\n\tvar cErr error\n\tvar wg sync.WaitGroup\n\tvar sortedEdges disksort.Interface\n\twg.Add(1)\n\tgo func() {\n\t\tsortedEdges, cErr = combineNodesAndEdges(ctx, opts, out, rd)\n\t\tif cErr != nil {\n\t\t\tcErr = fmt.Errorf(\"error combining nodes and edges: %v\", cErr)\n\t\t}\n\t\twg.Done()\n\t}()\n\n\twg.Wait()\n\tif cErr != nil {\n\t\treturn cErr\n\t}\n\n\tpesIn, dIn := make(chan *srvpb.Edge, chBuf), make(chan *srvpb.Edge, chBuf)\n\tvar pErr, fErr error\n\twg.Add(2)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif err := writePagedEdges(ctx, pesIn, out.xs, opts); err != nil {\n\t\t\tpErr = fmt.Errorf(\"error writing paged edge sets: %v\", err)\n\t\t}\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif err := writeDecorAndRefs(ctx, opts, dIn, out); err != nil {\n\t\t\tfErr = fmt.Errorf(\"error writing file decorations: %v\", err)\n\t\t}\n\t}()\n\n\terr := sortedEdges.Read(func(x interface{}) error {\n\t\te := x.(*srvpb.Edge)\n\t\tpesIn <- e\n\t\tdIn <- e\n\t\treturn nil\n\t})\n\tclose(pesIn)\n\tclose(dIn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading edges table: %v\", err)\n\t}\n\n\twg.Wait()\n\tif pErr != nil {\n\t\treturn pErr\n\t}\n\treturn fErr\n}", "title": "" }, { "docid": "57e462f83ade7dc2c2f448d5965171c1", "score": "0.46751252", "text": "func (settings *Controller) Run() {\n\t// import datasets\n\tfmt.Println(\"Importing CSVs...\")\n\ttopics := util.ImportTopics(settings.TopicsFilename)\n\tcountyListings := util.ImportCountyListings(settings.CountyListingsFilename)\n\n\t// add topics X counties to mongodb if they don't already exist\n\tfmt.Println(\"Adding county/topic pairs to DB if they do not exist...\")\n\tmodel.InsertTopicCountyPairsToDB(topics, countyListings)\n\n\t// start timer so that we don't hit the Twitter throttle\n\ttick := time.Tick(time.Duration(15/float64(settings.TwitterMaxPer15Min)*60) * time.Second)\n\n\t// start off the process!\n\tfmt.Println(\"Starting tweet extraction...\")\n\tfor {\n\t\tstart := time.Now()\n\n\t\t// look up one topic/county to run (based on last run date)\n\t\tcountyTopicToRun := model.FindStaleTopicCounty()\n\t\tif countyTopicToRun == nil {\n\t\t\tfmt.Println(\"Something didn't work. Trying again.\")\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(\"Running:\", countyTopicToRun, \"at\", start)\n\n\t\t// spawn go routine to fetch the data and insert into the db\n\t\tcountyListingToRun := countyListings[countyTopicToRun.GeoID]\n\t\tgo twitter.FetchCountyTopicAndInsertToDB(&countyListingToRun, countyTopicToRun)\n\n\t\t// sleep until tick\n\t\t<-tick\n\n\t\t// print time diagnostics\n\t\tloop_time := time.Since(start)\n\t\truns_per_15m := 15 * 60 / float64(loop_time/time.Second)\n\t\tfmt.Println(\"Loop time:\", loop_time)\n\t\tfmt.Println(\"Runs per 15m: about\", runs_per_15m)\n\t}\n}", "title": "" }, { "docid": "3e96c170cbcec59a1b1cfbd718f6bd7b", "score": "0.46667033", "text": "func (n *Node) Run() {\n\tstarted := time.Now()\n\n\tlch := n.raft.LeaderCh()\n\n\t// Let the cluster know how we're doing in two second intervals.\n\ttickChannel := time.NewTicker(time.Second * 2).C\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase leader := <-lch:\n\t\t\t\tn.leaderChange(leader)\n\t\t\tcase <-tickChannel:\n\t\t\t\t// Only try to save if we have a leader\n\t\t\t\tif n.raft.Leader() == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tvar ni nodeInfo\n\t\t\t\tni.Started = started\n\t\t\t\tni.Updated = time.Now()\n\t\t\t\tni.Name = n.self\n\t\t\t\tni.Raft = n.raft.Stats()\n\n\t\t\t\terr := n.Save(&ni)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Info(\"node\", \"Error from cluster save: %s\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "76580b9b366d64be3c41db423a792d54", "score": "0.46471244", "text": "func (i *Indexer) Run() error {\n\tvar (\n\t\twg sync.WaitGroup\n\t\twriteErr error\n\t)\n\n\tlog.Info(\"running\")\n\n\tfor n := 0; n < i.numIndexGoroutines; n++ {\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\n\t\t\tif err := i.work(); err != nil {\n\t\t\t\twriteErr = err\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n\n\tif writeErr != nil {\n\t\treturn writeErr\n\t}\n\treturn i.Source.Error()\n}", "title": "" }, { "docid": "f81698b5d325650b8f863cda457b2617", "score": "0.46458563", "text": "func (cmd *TrainCmd) Run(d *Dict) {\n\tdefer close(cmd.Done)\n\tr := bufio.NewReader(cmd.Reader)\n\tfor {\n\t\tline, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t\tline = strings.ToLower(line)\n\t\twords := strings.Split(line, \" \")\n\t\tfor _, word := range words {\n\t\t\tword = strings.Trim(word, cmd.Delimiters)\n\t\t\tif _, found := d.Dict[word]; !found {\n\t\t\t\td.Dict[word] = 1\n\t\t\t} else {\n\t\t\t\td.Dict[word]++\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f54f610f29743514d5585c391469e705", "score": "0.4613251", "text": "func (e LocalIAExtractor) Run() {\n\tfor c := range e.ConfigUpdatesRead {\n\t\tif !e.notified {\n\t\t\te.LocalIA <- c.LocalIA\n\t\t\te.notified = true\n\t\t}\n\t\te.ConfigUpdateWrite <- c\n\t}\n}", "title": "" }, { "docid": "e2aab16198196706d3b564ec289955f1", "score": "0.4607266", "text": "func (aw *AlgoliaWriter) StoreRecord(ctx context.Context, record *Record) report.Span {\n\tctx, cancel := context.WithTimeout(ctx, aw.Timeout)\n\tdefer cancel()\n\n\tuuid := record.Section.UUID\n\ts := record.Section\n\tl := record.Level\n\n\tspan := report.StartSpan(\"algolia.store\").Field(\"uuid\", s.UUID)\n\tobject := algoliasearch.Object{\n\t\t\"objectID\": uuid,\n\t\t\"slug\": s.Slug,\n\t\t\"section\": s.SectionName,\n\t\t\"river\": s.RiverName,\n\t\t\"grade\": s.Grade.Human,\n\t\t\"grade_numeric\": s.Grade.Average,\n\t\t\"desc\": s.Description,\n\t\t\"km\": s.KM,\n\t\t\"_geoloc\": map[string]float32{\n\t\t\t\"lat\": s.Putin.Lat,\n\t\t\t\"lng\": s.Putin.Lng,\n\t\t},\n\t\t\"level_label\": l.Label,\n\t\t\"level_reason\": l.Reason,\n\t\t\"level_timestamp\": l.EventTime,\n\t}\n\t_, err := aw.RiverIndex.UpdateObject(object)\n\tif err != nil {\n\t\treturn span.End(err)\n\t}\n\n\treturn span.End()\n}", "title": "" }, { "docid": "9f934cfd451aa653385ab350c6e949cc", "score": "0.460466", "text": "func (c *Controller) Run(filePath, addr string) {\n\tc.wg.Add(1)\n\tgo c.errorReader()\n\n\tc.wg.Add(1)\n\tgo c.readCsv(filePath)\n\n\tc.wg.Add(1)\n\tgo c.windowRunner()\n\n\tc.wg.Add(1)\n\tgo c.writeCsv(fmt.Sprintf(\"out/%v_out.csv\", time.Now().Unix()))\n\tc.wg.Add(2)\n\tc.registerHandlers()\n\tc.server.Run()\n\tc.wg.Wait()\n\n}", "title": "" }, { "docid": "a5b5faccd0fa6f954088082c36f2799e", "score": "0.4596804", "text": "func (r *Result) run() error {\n\tres := &pb.LogReadResponse{}\n\tif err := internal.Call(r.context, \"logservice\", \"Read\", r.request, res); err != nil {\n\t\treturn err\n\t}\n\n\tr.logs = make([]*Record, len(res.Log))\n\tr.request.Offset = res.Offset\n\tr.resultsSeen = true\n\n\tfor i, log := range res.Log {\n\t\tr.logs[i] = protoToRecord(log)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4a8f28350e0043ae5704809549f6eaec", "score": "0.45898786", "text": "func (n *Ingester) Run() error {\n\tpwg := sync.WaitGroup{}\n\tfor i := 0; i < n.ParseConcurrency; i++ {\n\t\tpwg.Add(1)\n\t\tgo func() {\n\t\t\tdefer pwg.Done()\n\t\t\tvar recordErr error\n\t\t\tfor {\n\t\t\t\t// Source\n\t\t\t\tvar rec interface{}\n\t\t\t\trec, recordErr = n.src.Record()\n\t\t\t\tif recordErr != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tn.Stats.Count(\"ingest.Record\", 1, 1)\n\n\t\t\t\t// Parse\n\t\t\t\tval, err := n.parser.Parse(rec)\n\t\t\t\tif err != nil {\n\t\t\t\t\tn.Log.Printf(\"couldn't parse record %s, err: %v\", rec, err)\n\t\t\t\t\tn.Stats.Count(\"ingest.ParseError\", 1, 1)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tn.Stats.Count(\"ingest.Parse\", 1, 1)\n\n\t\t\t\t// Transform\n\t\t\t\tfor _, tr := range n.Transformers {\n\t\t\t\t\terr := tr.Transform(val)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tn.Log.Printf(\"Problem with transformer %#v: %v\", tr, err)\n\t\t\t\t\t\tn.Stats.Count(\"ingest.TransformError\", 1, 1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tn.Stats.Count(\"ingest.Transform\", 1, 1)\n\n\t\t\t\t// Map\n\t\t\t\tpr, err := n.mapper.Map(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\tn.Log.Printf(\"couldn't map val: %s, err: %v\", val, err)\n\t\t\t\t\tn.Stats.Count(\"ingest.MapError\", 1, 1)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Index\n\t\t\t\tn.Stats.Count(\"ingest.Map\", 1, 1)\n\t\t\t\tfor _, row := range pr.Rows {\n\t\t\t\t\tif n.AllowedFields == nil || n.AllowedFields[row.Field] {\n\t\t\t\t\t\tn.indexer.AddColumn(row.Field, pr.Col, row.ID)\n\t\t\t\t\t\tn.Stats.Count(\"ingest.AddBit\", 1, 1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, val := range pr.Vals {\n\t\t\t\t\tif n.AllowedFields == nil || n.AllowedFields[val.Field] {\n\t\t\t\t\t\tn.indexer.AddValue(val.Field, pr.Col, val.Value)\n\t\t\t\t\t\tn.Stats.Count(\"ingest.AddValue\", 1, 1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif recordErr != io.EOF && recordErr != nil {\n\t\t\t\tn.Log.Printf(\"error in ingest run loop: %v\", recordErr)\n\t\t\t}\n\t\t}()\n\t}\n\tpwg.Wait()\n\treturn n.indexer.Close()\n}", "title": "" }, { "docid": "4ecf3879d59e16b9c206cf20e801431f", "score": "0.4571756", "text": "func (r *ElasticRepositoryImpl) StoreReadmodel(article database.Article) error {\n\tctx := context.Background()\n\n\t_, err := ElasticClient.Index().\n\t\tIndex(indexReadModel).\n\t\tId(article.ID).\n\t\tBodyJson(article).\n\t\tRefresh(\"wait_for\").\n\t\tDo(ctx)\n\treturn err\n}", "title": "" }, { "docid": "8df8ca81294d2a40cc4484f10c033b84", "score": "0.45427594", "text": "func runModel(\n\tfs afero.Fs,\n\tfilePath string,\n\tqueue chan struct{},\n\twg *sync.WaitGroup,\n\tverbose bool,\n\tdebug bool,\n) {\n\tdefer wg.Done()\n\tqueue <- struct{}{}\n\tif verbose {\n\t\tlog.Printf(\"run %s running on worker!\", filePath)\n\t}\n\tif debug {\n\t\tviper.Debug()\n\t}\n\trunner.EstimateModel(\n\t\tfs,\n\t\tfilePath,\n\t\trunner.RunSettings{\n\t\t\tGit: viper.GetBool(\"git\"),\n\t\t\tSaveExe: saveExe,\n\t\t\tVerbose: verbose,\n\t\t\tDebug: debug,\n\t\t\tCleanLvl: cleanLvl,\n\t\t\tCopyLvl: copyLvl,\n\t\t\tCacheDir: viper.GetString(\"cacheDir\"),\n\t\t\tExeNameInCache: viper.GetString(\"cacheExe\"),\n\t\t\tNmExecutableOrPath: viper.GetString(\"nmExecutable\"),\n\t\t},\n\t)\n\tif verbose {\n\t\tlog.Printf(\"completed run %s releasing worker back to queue \\n\", filePath)\n\t}\n\t<-queue\n}", "title": "" }, { "docid": "e429e7e7ac16d040ae76dda10b91092c", "score": "0.45160383", "text": "func (r *JsonImporter) RunImport() error {\n\n\tif err := r.createRealLocations(); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, l := range r.locations {\n\t\terr := r.dbService.AddLocation(l)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8e14d0aa4e05d2b90a4daaf55c4410b1", "score": "0.45088536", "text": "func runReport(reportID int, name string, logger log.Logger) {\n\tdefer wg.Done()\n\tresp, err := client.Report(reportID)\n\tif err != nil {\n\t\tlevel.Info(logger).Log(\"err\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlevel.Info(logger).Log(\"err\", err)\n\t\treturn\n\t}\n\tlevel.Debug(logger).Log(\"msg\", \"saving axiom report\", \"report\", name, \"id\", reportID)\n\t//save report\n\terr = saveReport(body, name)\n\tif err != nil {\n\t\tlevel.Info(logger).Log(\"err\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "2a754a96670fe868cf035378d819a94b", "score": "0.45047674", "text": "func (s *Service) Run(tID model.TaskID, rID model.RunID) (*model.Run, error) {\n\treturn s.db.Run(tID, rID)\n}", "title": "" }, { "docid": "74555f005b7236c70114461e2e836e3f", "score": "0.44987246", "text": "func RunUpdate(w http.ResponseWriter, r *http.Request) {\n\terr := Run()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"error: %s\\n\", err))\n\t}\n\tfmt.Fprintf(w, \"Done\")\n}", "title": "" }, { "docid": "e3d5502b181a2b49452de677312477e6", "score": "0.44852415", "text": "func Run(settings *config.Settings) (err error) {\n\n\tdb, err := newDatabase(settings)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreateEffectiveTags(settings)\n\n\tfmt.Printf(\"running for %q...\\r\\n\", settings.DbType)\n\n\ttables, err := db.GetTables()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get tables: %v\", err)\n\t}\n\n\tif settings.Verbose {\n\t\tfmt.Printf(\"> number of tables: %v\\r\\n\", len(tables))\n\t}\n\n\tif err = db.PrepareGetColumnsOfTableStmt(); err != nil {\n\t\treturn fmt.Errorf(\"could not prepare the get-column-statement: %v\", err)\n\t}\n\n\tfor _, table := range tables {\n\n\t\tif settings.Verbose {\n\t\t\tfmt.Printf(\"> processing table %q\\r\\n\", table.Name)\n\t\t}\n\n\t\tif err = db.GetColumnsOfTable(table); err != nil {\n\t\t\treturn fmt.Errorf(\"could not get columns of table %s: %v\", table.Name, err)\n\t\t}\n\n\t\tif settings.Verbose {\n\t\t\tfmt.Printf(\"\\t> number of columns: %v\\r\\n\", len(table.Columns))\n\t\t}\n\n\t\ttableName, content := createTableStructString(settings, db, table)\n\n\t\tif err = createStructFile(settings.OutputFilePath, tableName, content); err != nil {\n\t\t\treturn fmt.Errorf(\"could not create struct file for table %s: %v\", table.Name, err)\n\t\t}\n\t}\n\n\tfmt.Println(\"done!\")\n\n\treturn err\n}", "title": "" }, { "docid": "2a33368b89c3e5c0eebeff98824b6d90", "score": "0.4479041", "text": "func (idxer *Indexer) Run() {\n\tfmt.Println(\"building index ...\")\n\tvalPageId := uint32(0)\n\tvalOffset := uint32(0)\n\n\tvalPage, _ := NewValPage(defaultValPageSize)\n\tidxPage, _ := NewIdxPage(defaultIdxPageSize)\n\n\tvalPageWriter, _ := NewValPageWriter(valFilePath)\n\tidxPageWriter, _ := NewIdxPageWriter(idxFilePath)\n\n\tfor {\n\t\tkeySize, err := idxer.r.ReadKeySize()\n\t\tif err != nil {\n\t\t\t_, _, _ = valPageWriter.Write(valPage)\n\t\t\t_, _, _ = idxPageWriter.Write(idxPage)\n\t\t\tbreak\n\t\t}\n\t\tkey, _ := idxer.r.ReadKey(keySize)\n\t\tvalSize, _ := idxer.r.ReadValueSize()\n\t\t//offset := idxer.r.GetOffset()\n\t\tvalue, _ := idxer.r.ReadValue(valSize)\n\n\t\t// write value page\n\t\terr = valPage.Append(valSize, value)\n\t\tif err != nil {\n\t\t\t_, _, _ = valPageWriter.Write(valPage)\n\t\t\t// current page is full, add a new one\n\t\t\tvalPage, _ = NewValPage(defaultValPageSize)\n\t\t\t// @todo\n\t\t\t_ = valPage.Append(valSize, value)\n\t\t\tvalPageId++\n\t\t\tvalOffset = uint32(0)\n\t\t} else {\n\t\t\tvalOffset++\n\t\t}\n\n\t\t// write index page\n\t\terr = idxPage.Append(keySize, valPageId, valOffset, key)\n\t\tif err != nil {\n\t\t\t_, _, _ = idxPageWriter.Write(idxPage)\n\t\t\t// current page is full, add a new one\n\t\t\tidxPage, _ = NewIdxPage(defaultIdxPageSize)\n\t\t\t// @todo\n\t\t\t_ = idxPage.Append(keySize, valPageId, valOffset, key)\n\t\t}\n\t}\n\tfmt.Println(\"build index success\")\n}", "title": "" }, { "docid": "5423977c1217caa816d00442a567a560", "score": "0.4474804", "text": "func (tr *tableReader) Run(wg *sync.WaitGroup) {\n\tif wg != nil {\n\t\tdefer wg.Done()\n\t}\n\n\tctx, span := tracing.ChildSpan(tr.ctx, \"table reader\")\n\tdefer tracing.FinishSpan(span)\n\n\ttxn := tr.flowCtx.setupTxn(ctx)\n\n\tlog.VEventf(ctx, 1, \"starting\")\n\tif log.V(1) {\n\t\tdefer log.Infof(ctx, \"exiting\")\n\t}\n\n\tif err := tr.fetcher.StartScan(\n\t\ttxn, tr.spans, true /* limit batches */, tr.getLimitHint(),\n\t); err != nil {\n\t\tlog.Errorf(ctx, \"scan error: %s\", err)\n\t\ttr.out.close(err)\n\t\treturn\n\t}\n\n\tfor {\n\t\tfetcherRow, err := tr.fetcher.NextRow()\n\t\tif err != nil || fetcherRow == nil {\n\t\t\ttr.out.close(err)\n\t\t\treturn\n\t\t}\n\t\t// Emit the row; stop if no more rows are needed.\n\t\tif !tr.out.emitRow(ctx, fetcherRow) {\n\t\t\ttr.out.close(nil)\n\t\t\treturn\n\t\t}\n\t\t/*\n\t\t\t * TODO(radu): support limit in procOutputHelper\n\t\t\trowIdx++\n\t\t\tif tr.hardLimit != 0 && rowIdx == tr.hardLimit {\n\t\t\t\t// We sent tr.hardLimit rows.\n\t\t\t\ttr.output.Close(nil)\n\t\t\t\treturn\n\t\t\t}\n\t\t*/\n\t}\n}", "title": "" }, { "docid": "f10212c2a0896839e4623b86f7d11e75", "score": "0.4468379", "text": "func (a *WordsApiService) UpdateRun(ctx context.Context, data *models.UpdateRunRequest) (models.RunResponse, *http.Response, error) {\n var (\n successPayload models.RunResponse\n )\n\n requestData, err := data.CreateRequestData();\n if err != nil {\n return successPayload, nil, err\n }\n\n requestData.Path = a.client.cfg.BaseUrl + requestData.Path;\n\n r, err := a.client.prepareRequest(ctx, requestData)\n if err != nil {\n return successPayload, nil, err\n }\n\n response, err := a.client.callAPI(r)\n\n if err != nil || response == nil {\n return successPayload, nil, err\n }\n\n defer response.Body.Close()\n \n\n if response.StatusCode == 401 {\n return successPayload, nil, errors.New(\"Access is denied\")\n }\n if response.StatusCode >= 300 {\n var apiError models.WordsApiErrorResponse;\n\n if err = json.NewDecoder(response.Body).Decode(&apiError); err != nil {\n return successPayload, nil, err\n }\n\n return successPayload, response, &apiError\n }\n if err = json.NewDecoder(response.Body).Decode(&successPayload); err != nil {\n return successPayload, response, err\n }\n\n return successPayload, response, err\n}", "title": "" }, { "docid": "600cdef8a3305032c17b17dd79978037", "score": "0.445954", "text": "func (this *LDA) Infer(dat *corpus.Corpus, iter int) {\n\tif dat == nil {\n\t\tlog.Fatal(\"corpus is nil\")\n\t}\n\tif this.Wt == nil || this.Wts == nil {\n\t\tlog.Fatal(\"Wt or Wts is not initialized, maybe model is not loaded\")\n\t}\n\t// Wt, Wts should be initialized when model was loaded\n\tthis.Dt = sstable.NewUint32Matrix(dat.DocNum, this.TopicNum)\n\tthis.Dwt = make(map[sstable.DocWord]uint32)\n\tthis.Data = dat\n\n\t// randomly init sstables\n\tthis.Init()\n\n\tthis.ResampleTopics(iter)\n}", "title": "" }, { "docid": "a42d0d8ab0c8a38dc22555de05b3b112", "score": "0.44554964", "text": "func (r *TaskRunner) Run() error {\n\tfinalErr := &models.Error{\n\t\tType: \"RUNNER_ERR\",\n\t\tModel: r.j.Prefix(),\n\t\tKey: r.j.Key(),\n\t}\n\tjKey := r.j.Key()\n\t// Arrange to log everything to the job log and stderr at the same time.\n\t// Due to how io.Pipe works, this should wind up being fairly synchronous.\n\treader, writer, err := os.Pipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.in = io.MultiWriter(writer, r.logger)\n\tr.pipeWriter = writer\n\thelperWritten := false\n\n\t// If SetReadDeadLine is not supported, use the old way. It is\n\t// supported, use the more friendly way.\n\tif err := reader.SetReadDeadline(time.Now().Add(1 * time.Second)); err != nil {\n\t\tgo func() {\n\t\t\tdefer reader.Close()\n\t\t\tscanner := bufio.NewScanner(reader)\n\t\t\tfor scanner.Scan() {\n\t\t\t\tif scanner.Err() != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tline := scanner.Text() + \"\\n\"\n\t\t\t\tif r.c.Req().Put([]byte(line)).UrlFor(\"jobs\", jKey, \"log\").Do(nil) != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t} else {\n\t\tgo func() {\n\t\t\tdefer reader.Close()\n\t\t\tbuf := make([]byte, 2<<16)\n\t\t\tfor {\n\t\t\t\treader.SetReadDeadline(time.Now().Add(1 * time.Second))\n\t\t\t\tcount, err := reader.Read(buf)\n\t\t\t\tif count > 0 {\n\t\t\t\t\tif r.c.Req().Put(buf[:count]).UrlFor(\"jobs\", jKey, \"log\").Do(nil) != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\tif os.IsTimeout(err) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\t// We are responsible for going from created to running.\n\t// If this patch fails, we cannot do it\n\tpatch := jsonpatch2.Patch{\n\t\t{Op: \"test\", Path: \"/State\", Value: r.j.State},\n\t\t{Op: \"replace\", Path: \"/State\", Value: \"running\"},\n\t}\n\tfinalState := \"incomplete\"\n\ttaskDir, err := ioutil.TempDir(r.agentDir, r.j.Task+\"-\")\n\tif err != nil {\n\t\tr.Log(\"Failed to create local tmpdir: %v\", err)\n\t\tfinalErr.AddError(err)\n\t\treturn finalErr\n\t}\n\t// No matter how the function exits, we will try to patch the Job\n\t// to an appropriate final state.\n\tdefer os.RemoveAll(taskDir)\n\tdefer func() {\n\t\tif r.failed || r.reboot || r.stop || r.poweroff || r.incomplete {\n\t\t\tnewM := models.Clone(r.m).(*models.Machine)\n\t\t\tnewM.Runnable = false\n\t\t\tif err := r.c.Req().PatchTo(r.m, newM).Do(&newM); err == nil {\n\t\t\t\tr.Log(\"Marked machine %s as not runnable\", r.m.Key())\n\t\t\t\tr.m = newM\n\t\t\t} else {\n\t\t\t\tr.Log(\"Failed to mark machine %s as not runnable: %v\", r.m.Key(), err)\n\t\t\t}\n\t\t}\n\t\texitState := \"complete\"\n\t\tif finalState == \"failed\" {\n\t\t\texitState = \"failed\"\n\t\t}\n\t\tif r.reboot {\n\t\t\texitState = \"reboot\"\n\t\t} else if r.poweroff {\n\t\t\texitState = \"poweroff\"\n\t\t} else if r.stop {\n\t\t\texitState = \"stop\"\n\t\t}\n\t\tfinalPatch := jsonpatch2.Patch{\n\t\t\t{Op: \"test\", Path: \"/State\", Value: \"running\"},\n\t\t\t{Op: \"replace\", Path: \"/State\", Value: finalState},\n\t\t\t{Op: \"replace\", Path: \"/ExitState\", Value: exitState},\n\t\t}\n\t\tif err := r.c.Req().Patch(finalPatch).UrlForM(r.j).Do(&r.j); err != nil {\n\t\t\tr.Log(\"Failed to update job %s to its final state %s\", r.j.Key(), finalState)\n\t\t} else {\n\t\t\tr.Log(\"Updated job %s to %s\", r.j.Key(), finalState)\n\t\t}\n\t}()\n\tobj, err := r.c.PatchModel(r.j.Prefix(), r.j.Key(), patch)\n\tif err != nil {\n\t\tfinalErr.AddError(err)\n\t\treturn finalErr\n\t}\n\tr.j = obj.(*models.Job)\n\tr.Log(\"Starting task %s on %s\", r.j.Task, r.m.Uuid)\n\t// At this point, we are running.\n\tactions, err := r.c.JobActions(r.j)\n\tif err != nil {\n\t\tr.Log(\"Failed to render actions: %v\", err)\n\t\tfinalErr.AddError(err)\n\t\treturn finalErr\n\t}\n\tfor i, action := range actions {\n\t\tfinal := len(actions)-1 == i\n\t\tr.failed = false\n\t\tr.incomplete = false\n\t\tr.poweroff = false\n\t\tr.reboot = false\n\t\tr.stop = false\n\t\tvar err error\n\t\tif action.Path != \"\" {\n\t\t\terr = r.Expand(action, taskDir)\n\t\t} else {\n\t\t\tif !helperWritten {\n\t\t\t\terr = ioutil.WriteFile(path.Join(taskDir, \"helper\"), cmdHelper, 0600)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfinalErr.AddError(err)\n\t\t\t\t\treturn finalErr\n\t\t\t\t}\n\t\t\t\thelperWritten = true\n\t\t\t}\n\t\t\terr = r.Perform(action, taskDir)\n\t\t\t// Contents is a script to run, run it.\n\t\t}\n\t\tif err != nil {\n\t\t\tr.failed = true\n\t\t\tfinalState = \"failed\"\n\t\t\tfinalErr.AddError(err)\n\t\t\tr.Log(\"Task %s %s\", r.j.Task, finalState)\n\t\t\treturn finalErr\n\t\t}\n\t\tr.Log(\"Action %s finished\", action.Name)\n\t\t// If a non-final action sets the incomplete flag, it actually\n\t\t// means early success and stop processing actions for this task.\n\t\t// This allows actions to be structured in an \"early exit\"\n\t\t// fashion.\n\t\t//\n\t\t// Only the final action can actually set things as incomplete.\n\t\tif !final && r.incomplete {\n\t\t\tr.incomplete = !r.incomplete\n\t\t\tbreak\n\t\t}\n\t\tif r.failed {\n\t\t\tfinalState = \"failed\"\n\t\t\tbreak\n\t\t}\n\t\tif r.reboot || r.poweroff || r.stop {\n\t\t\tr.incomplete = !final\n\t\t\tbreak\n\t\t}\n\t}\n\tif !r.failed && !r.incomplete {\n\t\tfinalState = \"finished\"\n\t}\n\tr.Log(\"Task %s %s\", r.j.Task, finalState)\n\treturn nil\n}", "title": "" }, { "docid": "cbd27cb1bb1a15027cec15bc3172f6ce", "score": "0.44503197", "text": "func Run(driver driver.Driver, logger logs.TaggedLogger) error {\n\tpachClient := driver.PachClient()\n\tpipelineInfo := driver.PipelineInfo()\n\treturn forEachJob(pachClient, pipelineInfo, logger, func(ctx context.Context, jobInfo *pps.JobInfo) (retErr error) {\n\t\tdriver := driver.WithContext(ctx)\n\t\tif err := driver.UpdateJobState(jobInfo.Job, pps.JobState_JOB_RUNNING, \"\"); err != nil {\n\t\t\treturn errors.EnsureStack(err)\n\t\t}\n\t\t// TODO: Add cache?\n\t\ttaskDoer := driver.NewTaskDoer(jobInfo.Job.Id, nil)\n\t\tdi, err := datum.NewIterator(pachClient, taskDoer, ppsutil.JobInput(pipelineInfo, jobInfo.OutputCommit))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar meta *datum.Meta\n\t\tif err := di.Iterate(func(m *datum.Meta) error {\n\t\t\tif meta != nil {\n\t\t\t\treturn errors.New(\"services must have a single datum\")\n\t\t\t}\n\t\t\tmeta = m\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn errors.EnsureStack(err)\n\t\t}\n\t\tif meta == nil {\n\t\t\treturn errors.New(\"services must have a single datum\")\n\t\t}\n\t\tmeta.Job = jobInfo.Job\n\t\tdefer func() {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tretErr = ppsutil.FinishJob(pachClient, jobInfo, pps.JobState_JOB_FINISHING, \"\")\n\t\t\tdefault:\n\t\t\t}\n\t\t}()\n\t\t// now that we're actually running the datum, use a pachClient which is bound to the job-scoped context\n\t\tpachClient := pachClient.WithCtx(ctx)\n\t\tstorageRoot := filepath.Join(driver.InputDir(), client.PPSScratchSpace, uuid.NewWithoutDashes())\n\t\treturn pachClient.WithRenewer(func(ctx context.Context, renewer *renew.StringSet) error {\n\t\t\tpachClient := pachClient.WithCtx(ctx)\n\t\t\tcacheClient := pfssync.NewCacheClient(pachClient, renewer)\n\t\t\treturn datum.WithSet(cacheClient, storageRoot, func(s *datum.Set) error {\n\t\t\t\tinputs := meta.Inputs\n\t\t\t\tlogger = logger.WithData(inputs)\n\t\t\t\tenv := driver.UserCodeEnv(logger.JobID(), jobInfo.OutputCommit, inputs, jobInfo.GetAuthToken())\n\t\t\t\treturn s.WithDatum(meta, func(d *datum.Datum) error {\n\t\t\t\t\terr := driver.WithActiveData(inputs, d.PFSStorageRoot(), func() error {\n\t\t\t\t\t\treturn d.Run(ctx, func(runCtx context.Context) error {\n\t\t\t\t\t\t\treturn errors.EnsureStack(driver.RunUserCode(runCtx, logger, env))\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\treturn errors.EnsureStack(err)\n\t\t\t\t})\n\n\t\t\t})\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a7716b189b2d0c65dd57d38be19dfb26", "score": "0.44382927", "text": "func (s *GeddisStore) Run() {\n\ts.loadFromDisk()\n\ts.runCleaner()\n\ts.runFileStore()\n}", "title": "" }, { "docid": "fe3b380634911009b78cb3705ffa2ee1", "score": "0.44338122", "text": "func (isc *IngestSvcContext) Run(port int) error {\n\tisc.userDB.Wait()\n\tisc.costDB.Wait()\n\terr := isc.costDB.CreateDatabase()\n\tif err != nil {\n\t\treturn err\n\t}\n\tisc.updateCh = make(chan bool, 64)\n\tgo isc.poller()\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/v1/refresh\", reportMonitorHandler(isc)).Methods(\"POST\")\n\thandler := handlers.LoggingHandler(os.Stdout, r)\n\tlog.Println(fmt.Sprintf(\"Starting server on port %d\", port))\n\terr = http.ListenAndServe(fmt.Sprintf(\":%d\", port), handler)\n\treturn err\n}", "title": "" }, { "docid": "dc4da9b770912ac874377be015e3607e", "score": "0.44261461", "text": "func run() error {\n\n\tsrv := newServer()\n\tsrv.store = &dbStore{}\n\terr := srv.store.Open()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t/*\n\t\tcode de test\n\t\tmovies, err := srv.store.GetMovies()\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"movies=%v\\n\", movies)\n\t*/\n\n\tdefer srv.store.Close()\n\n\t// On delegue l'ensemble des routes a mon routeur\n\thttp.HandleFunc(\"/\", srv.serveHTTP)\n\n\tlog.Printf(\"Serving HTTP on port 9000\")\n\n\terr = http.ListenAndServe(\":9000\", nil)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "478d6fc9652aa4efe597cab3bf71c35e", "score": "0.44216", "text": "func (r *Record) Load() bool {\n\tdoc, err := r.indexer.bleve.Document(r.path)\n\tif err != nil || doc == nil {\n\t\tr.loaded = true\n\t\treturn false\n\t}\n\n\tresult := make(map[string]interface{})\n\n\tfor _, field := range doc.Fields {\n\t\tname := field.Name()\n\t\tvalue := field.Value()\n\t\tresult[name] = value\n\t}\n\n\tstrModified := string(result[\"Modified\"].([]byte))\n\tmodified, err := strconv.Atoi(strModified)\n\n\tr.modified = time.Unix(int64(modified), 0)\n\n\tstrIndexed := string(result[\"Indexed\"].([]byte))\n\tindexed, err := strconv.Atoi(strIndexed)\n\n\tr.indexed = time.Unix(int64(indexed), 0)\n\n\tr.document = result\n\n\tif len(r.body) == 0 {\n\t\tr.Write(result[\"Body\"].([]byte))\n\t}\n\n\tr.title = string(result[\"Title\"].([]byte))\n\n\tr.loaded = true\n\n\treturn true\n}", "title": "" }, { "docid": "0e1ae077149a15c42d60e108c54e2a1e", "score": "0.44164306", "text": "func (proxyJob *proxyResponseJob) Run() {\n\terr := (*proxyJob.xdsServer).sendResponse(proxyJob.typeurls, proxyJob.proxy, proxyJob.adsStream, proxyJob.request, proxyJob.cfg)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msgf(\"Failed to create and send %v update to Envoy with xDS Certificate SerialNumber=%s for PodUUID=%s\",\n\t\t\tproxyJob.typeurls, proxyJob.proxy.GetCertificateSerialNumber(), proxyJob.proxy.GetPodUID())\n\t}\n\tclose(proxyJob.done)\n}", "title": "" }, { "docid": "e89f8ed84730611a6f7314f99c4da7dd", "score": "0.44015366", "text": "func (f *Fetcher) run(batch *batch) {\n\tbatch.runOnce.Do(func() {\n\t\t// If this batch is still the current batch, start a new one.\n\t\tf.muBatch.Lock()\n\t\tif f.batch == batch {\n\t\t\tf.batch = newBatch(f.fetchFn.keyType, f.fetchFn.valType)\n\t\t}\n\t\tf.muBatch.Unlock()\n\n\t\t// Reassemble the id set into a slice of ids.\n\t\tids := newKeySet(f.fetchFn.keyType, batch.ids.Len())\n\n\t\titer := batch.ids.Range()\n\t\tfor iter.Next() {\n\t\t\tids.Add(iter.Key())\n\t\t}\n\n\t\t// Perform the fetch.\n\t\tresults, err := f.fetch(ids)\n\n\t\t// Populate the batch results.\n\t\tbatch.err = err\n\t\tif err == nil {\n\t\t\titer := results.Range()\n\t\t\tfor iter.Next() {\n\t\t\t\tbatch.results.Set(iter.Key(), iter.Value())\n\t\t\t}\n\n\t\t\t// Save this batch to cache.\n\t\t\tf.saveToCache(batch.results)\n\t\t}\n\n\t\t// Signal to all waiting callers that the batch is complete.\n\t\tclose(batch.done)\n\t})\n}", "title": "" }, { "docid": "1d91ba9b3d8d90c910f93ce195ef3eb3", "score": "0.43997094", "text": "func (r PutTrainedModel) Do(ctx context.Context) (*Response, error) {\n\n\tresponse := NewResponse()\n\n\tres, err := r.Perform(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode < 299 {\n\t\terr = json.NewDecoder(res.Body).Decode(response)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn response, nil\n\t}\n\n\terrorResponse := types.NewElasticsearchError()\n\terr = json.NewDecoder(res.Body).Decode(errorResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif errorResponse.Status == 0 {\n\t\terrorResponse.Status = res.StatusCode\n\t}\n\n\treturn nil, errorResponse\n}", "title": "" }, { "docid": "a668186da0e4401e7d51110341fbdfe9", "score": "0.43968663", "text": "func (hw *reshardingWorkflowGen) Run(ctx context.Context, manager *workflow.Manager, wi *topo.WorkflowInfo) error {\n\thw.ctx = ctx\n\thw.wi = wi\n\thw.checkpointWriter = workflow.NewCheckpointWriter(hw.topoServer, hw.checkpoint, hw.wi)\n\thw.rootUINode.Display = workflow.NodeDisplayDeterminate\n\thw.rootUINode.BroadcastChanges(true /* updateChildren */)\n\n\tif err := hw.runWorkflow(); err != nil {\n\t\thw.setUIMessage(hw.rootUINode, fmt.Sprintf(\"Keyspace resharding failed to create workflows\")) //nolint\n\t\treturn err\n\t}\n\thw.setUIMessage(hw.rootUINode, fmt.Sprintf(\"Keyspace resharding is finished successfully.\")) //nolint\n\treturn nil\n}", "title": "" }, { "docid": "78117694ee54021e5f65a9debc18cfc4", "score": "0.43875805", "text": "func Run(config *configurator.Config) error {\n\tdb, err := newDB(config.DatabaseURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tstore := sqlstore.New(db)\n\n\tlogs, err := newServer(config, store)\n\tif err != nil {\n\t\tlogs.Fatalf(\"failed: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b0f9f7b9c7eb406187612482910a62fa", "score": "0.4386429", "text": "func (m *Main) Run() error {\n\tgo func() {\n\t\tlog.Println(http.ListenAndServe(\"localhost:6060\", nil))\n\t}()\n\n\terr := m.readURLs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tschema := gopilosa.NewSchema()\n\tindex := schema.Index(m.Index, gopilosa.OptIndexTrackExistence(false))\n\n\tpdk.NewRankedField(index, \"cab_type\", 10)\n\tpdk.NewRankedField(index, \"passenger_count\", 1000)\n\tpdk.NewRankedField(index, \"total_amount_dollars\", 10000)\n\tpdk.NewRankedField(index, \"pickup_time\", 10000)\n\tpdk.NewRankedField(index, \"pickup_day\", 10000)\n\tpdk.NewRankedField(index, \"pickup_mday\", 10000)\n\tpdk.NewRankedField(index, \"pickup_month\", 13)\n\tpdk.NewRankedField(index, \"pickup_year\", 100)\n\tpdk.NewRankedField(index, \"drop_time\", 10000)\n\tpdk.NewRankedField(index, \"drop_day\", 10000)\n\tpdk.NewRankedField(index, \"drop_mday\", 10000)\n\tpdk.NewRankedField(index, \"drop_month\", 13)\n\tpdk.NewRankedField(index, \"drop_year\", 1000)\n\tpdk.NewRankedField(index, \"dist_miles\", 1000)\n\tpdk.NewRankedField(index, \"duration_minutes\", 10000)\n\tpdk.NewRankedField(index, \"speed_mph\", 10000)\n\tpdk.NewRankedField(index, \"pickup_grid_id\", 10000)\n\tpdk.NewRankedField(index, \"drop_grid_id\", 10000)\n\tpdk.NewRankedField(index, \"pickup_elevation\", 10000)\n\tpdk.NewRankedField(index, \"drop_elevation\", 10000)\n\n\tpdk.NewRankedField(index, \"user_id\", 100000)\n\tpdk.NewIntField(index, \"cost_cents\", 0, 524000)\n\n\tm.indexer, err = pdk.SetupPilosa([]string{m.PilosaHost}, m.Index, schema, uint(m.BufferSize))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"setting up indexer\")\n\t}\n\n\tticker := m.printStats()\n\n\turls := make(chan string, 100)\n\trecords := make(chan record, 10000)\n\n\tgo func() {\n\t\tfor _, url := range m.urls {\n\t\t\turls <- url\n\t\t}\n\t\tclose(urls)\n\t}()\n\n\tm.greenBms = getBitMappers(greenFields)\n\tm.yellowBms = getBitMappers(yellowFields)\n\tm.ams = getAttrMappers()\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func() {\n\t\tfor range c {\n\t\t\tlog.Printf(\"Rides: %d, Bytes: %s\", m.nexter.Last(), pdk.Bytes(m.bytesProcessed()))\n\t\t\tos.Exit(0)\n\t\t}\n\t}()\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < m.FetchConcurrency; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tm.fetch(urls, records)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\tvar wg2 sync.WaitGroup\n\tfor i := 0; i < m.Concurrency; i++ {\n\t\twg2.Add(1)\n\t\tgo func(i int) {\n\t\t\tm.parseMapAndPost(records, i)\n\t\t\twg2.Done()\n\t\t}(i)\n\t}\n\twg.Wait()\n\tclose(records)\n\twg2.Wait()\n\terr = m.indexer.Close()\n\tticker.Stop()\n\t// print stats one last time\n\tbytes := m.bytesProcessed()\n\tlog.Printf(\"Rides: %d, Bytes: %s, Records: %v\", m.nexter.Last(), pdk.Bytes(bytes), m.totalRecs.Get())\n\tlog.Printf(\"Skipped: %v, badLocs: %v, nullLocs: %v, badSpeeds: %v, badTotalAmnts: %v, badDurations: %v, badUnknowns: %v, badPassCounts: %v, badDist: %v\", m.skippedRecs.Get(), m.badLocs.Get(), m.nullLocs.Get(), m.badSpeeds.Get(), m.badTotalAmnts.Get(), m.badDurations.Get(), m.badUnknowns.Get(), m.badPassCounts.Get(), m.badDist.Get())\n\treturn errors.Wrap(err, \"closing indexer\")\n}", "title": "" }, { "docid": "7b1c15ffda8a16437f8904f5d7100ad3", "score": "0.43855372", "text": "func (e *SimpleEngine) Run(seeds ...Request) {\n\tvar requests []Request\n\tfor _, r := range seeds {\n\t\trequests = append(requests, r)\n\t}\n\ttime.Sleep(time.Minute)\n\tfor len(requests) > 0 {\n\t\tr := requests[0]\n\t\trequests = requests[1:]\n\t\tlog.Printf(\"Fetching %s\", r.URL)\n\n\t\tparserResult, err := worker(r)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Worker: error handling request %v : %v\", r, err)\n\t\t\tcontinue\n\t\t}\n\t\trequests = append(requests, parserResult.Requests...)\n\n\t\tfor _, item := range parserResult.Items {\n\t\t\tlog.Printf(\"Got item %s\\n\", item)\n\t\t}\n\t\tlog.Printf(\"len(requests) = %v\", len(requests))\n\t}\n\tlog.Println(\"Run finish\")\n}", "title": "" }, { "docid": "7cc6c100355466bd7ba05bb31756989a", "score": "0.43816575", "text": "func (b *Bulk) Run() (*mgo.BulkResult, error) {\n\tvar result *mgo.BulkResult\n\tvar err error\n\n\tdatabase := b.collection.Database.Name\n\tcollection := b.collection.FullName\n\targs := \"\"\n\n\toperationName, tags := buildTracingParams(database, collection, \"bulkRun\", args)\n\n\ttracing.Trace(b.ctx, operationName, tags, func() {\n\t\tresult, err = b.bulk.Run()\n\t})\n\n\treturn result, err\n}", "title": "" }, { "docid": "b12f43e8187d9c81836026f102120281", "score": "0.4373473", "text": "func (r *Record) Set(data ...interface{}) {\n\tr.Version++\n\n\t// R|U|name|version|data\n\tgo r.ds.Emit(message.New(topics.Record, actions.Update, r.Name, r.Version, data))\n}", "title": "" }, { "docid": "31dc1bea2edd6eea2cb68b42872d7dff", "score": "0.43716913", "text": "func (s *StorkServer) Run() {\n\t// Connect to MongoDB\n\tsession, err := mgo.Dial(s.Config.DatabaseHost)\n\tif err != nil {\n\t\tlogger.Error(\"Failed to connect to MongoDB at \" + s.Config.DatabaseHost)\n\t\tlogger.Error(err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// Clone the session to protect the connection\n\tdefer session.Close()\n\ts.Session = session.Clone()\n\tlogger.Info(\"Connected to MongoDB at \" + s.Config.DatabaseHost)\n\n\t// Register middleware (CORS, etc.)\n\tRegisterMiddleware(s.Engine)\n\n\t// Create a new Data Access Layer\n\tdal := db.NewDataAccessLayer(s.Session, s.Config.DatabaseName)\n\n\t// Create a new AWSClient\n\tawsClient := awsutil.NewAWSClient(s.Config)\n\n\t// Register API routes and setup controllers\n\tapi.RegisterRoutes(s.Engine, dal, awsClient)\n\n\t// Start Stork\n\tlogger.Info(\"Starting Stork on port \" + strings.TrimPrefix(s.Config.ServerPort, \":\"))\n\tprintStork()\n\n\ts.Engine.Run(\":\" + s.Config.ServerPort)\n}", "title": "" }, { "docid": "29e9a7ad578693b8fc7d4a9eb425ce97", "score": "0.43701822", "text": "func (d *dataset) Do(ctx context.Context, runner *Runner) {\n\t// First check if the dataset already exists.\n\tif url := d.IfNotExist; url != \"\" {\n\t\tif stat, err := file.Stat(ctx, url); err == nil {\n\t\t\tLogger.Printf(\"dataset %s: found %s, with modtime %v\", d.Name, url, stat.ModTime())\n\t\t\td.setStatus(statusOk)\n\t\t\treturn\n\t\t} else if !errors.Is(errors.NotExist, err) {\n\t\t\td.error(errors.E(\"dataset: ifnotexist\", url, err))\n\t\t\treturn\n\t\t}\n\t}\n\tLogger.Printf(\"dataset %s: %s not found, start data generation\", d.Name, d.IfNotExist)\n\tw, err := runner.allocate(ctx, d.Systems)\n\tif err != nil {\n\t\td.error(errors.E(\"dataset: allocate\", d.Systems, err))\n\t\treturn\n\t}\n\tdefer w.Return()\n\td.setStatus(statusRunning)\n\t// First clean up the workspace.\n\tif err := w.Reset(ctx); err != nil {\n\t\td.error(err)\n\t\treturn\n\t}\n\tif err := w.CopyFiles(ctx, d.LocalFiles); err != nil {\n\t\td.error(errors.E(fmt.Sprintf(\"dataset copyfiles %+v: %v\", d.LocalFiles, err)))\n\t\treturn\n\t}\n\tout, err := w.Run(ctx, d.Script, nil)\n\tif err != nil {\n\t\td.error(errors.E(fmt.Sprintf(\"dataset: failed to start script '%s'\", d.Script), err))\n\t\treturn\n\t}\n\tvar writer io.Writer = ioutil.Discard\n\tpath := fmt.Sprintf(\"dataset.%s.log\", d.Name)\n\tpath = strings.Replace(path, \"/\", \"_\", -1)\n\tif f, err := os.Create(path); err == nil {\n\t\twriter = f\n\t\tdefer f.Close()\n\t} else {\n\t\tlog.Error.Printf(\"dataset: create %s: %v\", path, err)\n\t}\n\t_, err = io.Copy(writer, out)\n\tif e := out.Close(); e != nil && err == nil {\n\t\terr = e\n\t}\n\tif err == nil {\n\t\td.setStatus(statusOk)\n\t} else {\n\t\td.error(err)\n\t}\n}", "title": "" }, { "docid": "2172c209238f0a170f1bcc737bc81f50", "score": "0.43614942", "text": "func seedData(client *elastic.Client) error {\n\t// Open our jsonFile\n\tjsonFile, err := os.Open(seedDataFile)\n\t// if we os.Open returns an error then handle it\n\tif err != nil {\n\t\treturn err\n\t}\n\t// defer the closing of our jsonFile so that we can parse it later on\n\tdefer jsonFile.Close()\n\n\tjsonScanner := bufio.NewScanner(jsonFile)\n\n\tcount := 0\n\tindex := Index{}\n\tfor jsonScanner.Scan() {\n\t\tif count%2 == 0 {\n\t\t\t//index = Index{}\n\t\t\terr := json.Unmarshal([]byte(jsonScanner.Text()), &index)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treview := Review{}\n\t\t\terr := json.Unmarshal([]byte(jsonScanner.Text()), &review)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Debugf(\"Beer: %+v, Reviewer: %+v, Index: %+v\\n\", review.Beer, review.Reviewer, index.Index)\n\t\t\tindexReq := elastic.NewBulkIndexRequest().Index(index.Index.Name).Type(index.Index.Type).Id(index.Index.Id).Doc(review)\n\t\t\tbulkRequest := client.Bulk()\n\t\t\tbulkRequest = bulkRequest.Add(indexReq)\n\n\t\t\t// Do sends the bulk requests to Elasticsearch\n\t\t\tbulkResponse, err := bulkRequest.Do(context.Background())\n\t\t\tif err != nil {\n\t\t\t\t// ...\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\t// Failed() returns information about failed bulk requests\n\t\t\t// (those with a HTTP status code outside [200,299].\n\t\t\tfailedResults := bulkResponse.Failed()\n\t\t\tif failedResults != nil {\n\t\t\t\t// ...\n\t\t\t\tpanic(failedResults)\n\t\t\t}\n\t\t}\n\t\tcount++\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e3374e699ff58326fa7d9bb1d0788009", "score": "0.43514138", "text": "func (e *sEngine) Run(writer io.Writer, rc []*report.Report) error {\n\tif err := e.init(rc); err != nil {\n\t\treturn err\n\t}\n\n\ttable := struct {\n\t\tReportHeader []basicReportHeaderCell\n\t\tInstanceFile []basicInstanceFileCell\n\t\tResults [][]sResultCell // [row index][report index]. the first report is Base\n\t\tCounting []basicCountingCell\n\t}{\n\t\tReportHeader: e.makeReportHeader(),\n\t}\n\tvar err error\n\n\tif e.sRenameFile != \"\" {\n\t\tvar rename Replacer\n\t\tif err = rename.LoadFromDisk(e.sRenameFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttable.InstanceFile = e.makeInstanceFile(func(old string) string { return rename.Replace(old) })\n\t} else {\n\t\ttable.InstanceFile = e.makeInstanceFile(nil)\n\t}\n\n\ttable.Results, table.Counting, err = e.makeReportsAndCounting()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn e.theTemplate.Execute(writer, table)\n}", "title": "" }, { "docid": "c0f684dd76643291dae436762cc23d9d", "score": "0.4351073", "text": "func (e Updater) Run(key, value string) error {\n\tctx, cancel := context.WithTimeout(context.Background(), e.Timeout)\n\tdefer cancel()\n\n\ttxn := e.KV.Txn(ctx).\n\t\tIf(\n\t\t\tclientv3.Compare(clientv3.Value(key), \"=\", value),\n\t\t).\n\t\tElse(\n\t\t\tclientv3.OpPut(key, value),\n\t\t)\n\n\t_, err := txn.Commit()\n\treturn err\n}", "title": "" }, { "docid": "59b2729c455f92a04b9f7cebbedc58aa", "score": "0.43387288", "text": "func (y *Youless) Run(influx *storage.Influx) {\n\tresp, err := http.Get(y.addr)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\treturn\n\t}\n\n\t/*\n\t\tdecoder := json.NewDecoder(resp.Body)\n\t\terr = decoder.Decode(&y.data)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\t\treturn\n\t\t}\n\t*/\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error: %v\\n\", err.Error())\n\t\treturn\n\t}\n\n\terr = y.data.Parse(body)\n\n\tresp.Body.Close()\n\tif err == nil {\n\t\tfmt.Fprintf(&buf, \"current_watt,source=youless value=%v\\n\"+\n\t\t\t\"total_kwh,source=youless value=%v\",\n\t\t\ty.data.Power, y.data.Counter)\n\t\tif err = influx.Send(&buf); err != nil {\n\t\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\t}\n\t\tbuf.Reset()\n\t}\n}", "title": "" }, { "docid": "90710eadb58ed95f254449435235fd5f", "score": "0.43374962", "text": "func (d *definition) Run(ctx context.Context, args ...string) error {\n\tif len(args) != 1 {\n\t\treturn tool.CommandLineErrorf(\"definition expects 1 argument\")\n\t}\n\tclient := &baseClient{}\n\tserver, err := d.query.app.connect(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfrom := span.Parse(args[0])\n\tm, err := client.AddFile(ctx, from.URI())\n\tif err != nil {\n\t\treturn err\n\t}\n\tloc, err := m.Location(from)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp := protocol.TextDocumentPositionParams{\n\t\tTextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},\n\t\tPosition: loc.Range.Start,\n\t}\n\tlocs, err := server.Definition(ctx, &p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v: %v\", from, err)\n\t}\n\n\tif len(locs) == 0 {\n\t\treturn fmt.Errorf(\"%v: not an identifier\", from)\n\t}\n\thover, err := server.Hover(ctx, &p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v: %v\", from, err)\n\t}\n\tif hover == nil {\n\t\treturn fmt.Errorf(\"%v: not an identifier\", from)\n\t}\n\tm, err = client.AddFile(ctx, span.NewURI(locs[0].URI))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v: %v\", from, err)\n\t}\n\tdefinition, err := m.Span(locs[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v: %v\", from, err)\n\t}\n\tdescription := strings.TrimSpace(hover.Contents.Value)\n\tvar result interface{}\n\tswitch d.query.Emulate {\n\tcase \"\":\n\t\tresult = &Definition{\n\t\t\tSpan: definition,\n\t\t\tDescription: description,\n\t\t}\n\tcase emulateGuru:\n\t\tpos := span.New(definition.URI(), definition.Start(), definition.Start())\n\t\tresult = &guru.Definition{\n\t\t\tObjPos: fmt.Sprint(pos),\n\t\t\tDesc: description,\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown emulation for definition: %s\", d.query.Emulate)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif d.query.JSON {\n\t\tenc := json.NewEncoder(os.Stdout)\n\t\tenc.SetIndent(\"\", \"\\t\")\n\t\treturn enc.Encode(result)\n\t}\n\tswitch d := result.(type) {\n\tcase *Definition:\n\t\tfmt.Printf(\"%v: defined here as %s\", d.Span, d.Description)\n\tcase *guru.Definition:\n\t\tfmt.Printf(\"%s: defined here as %s\", d.ObjPos, d.Desc)\n\tdefault:\n\t\treturn fmt.Errorf(\"no printer for type %T\", result)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ae12b6558ed819cce9d64fa3a276c7c", "score": "0.43341565", "text": "func Handle(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\tvar ctx = context.Background()\n\tvar query Query\n\tvar results models.RentOffer\n\tvar DB = dbservice.Db\n\tapi.OPENFAASGetBody(r, &query)\n\tif goscrappy.Debug {\n\t\tfmt.Printf(\"Query : %+v\\n\", query)\n\t}\n\tvar qtemplate = `\n\tLET ro = DOCUMENT(\"rentoffers\", \"%s\")\n\tLET a = (\n\t\t\tFOR x IN ro.title\n\t\t\t\t\tFOR lb IN labels FILTER x == lb._key \n\t\t\t\t\tRETURN lb\n\t)\n\tLET b = (\n\t\t\tFOR src IN sources FILTER ro.source == src._key\n\t\t\tRETURN src\n\t)\n\tLET c = (\n\t\t\tFOR x IN ro.description\n\t\t\t\t\tFOR des IN labels FILTER x == des._key \n\t\t\t\t\tRETURN des\n\t)\n\tLET d = (\n\t\t\tFOR x IN ro.price\n\t\t\t\t\tFOR pr IN prices FILTER x == pr._key\n\t\t\t\t\tRETURN pr\n\t)\n\tLET e = (\n\t\t\tFOR x IN ro.assets\n\t\t\t\t\tFOR ass IN assets FILTER x == ass._key \n\t\t\t\t\tRETURN ass\n\t)\n\tLET f = (\n\t\t\tFOR loc IN locations FILTER loc._key == ro.location \n\t\t\tRETURN loc\n\t)\n\tLET g = (\n\t\t\tFOR off IN offerors FILTER off._key == ro.offeror \n\t\t\tRETURN off\n\t)\n\tRETURN merge(ro, { \n\t\t title: a,\n\t\t source: FIRST(b),\n\t\t description: c,\n\t\t price: d,\n\t\t assets: e,\n\t\t location: FIRST(f),\n\t\t offeror: FIRST(g)\n\t\t}\n\t)\n\t`\n\tq := fmt.Sprintf(qtemplate, query.ID)\n\tfmt.Printf(\"query : %s\\n\", q)\n\tcursor, err := DB.Query(ctx, q, nil)\n\tif err != nil {\n\t\tapi.OPENFAASErrorResponse(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer cursor.Close()\n\tif _, err = cursor.ReadDocument(ctx, &results); err != nil {\n\t\tapi.OPENFAASErrorResponse(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tapi.OPENFAASJsonResponse(w, http.StatusOK, results)\n}", "title": "" }, { "docid": "ffe76f25375c56f2d636191ef7156f47", "score": "0.433107", "text": "func (e *Exporter) Run() {\n\tregistry := prometheus.NewRegistry()\n\n\tfor _, collector := range e.collectors {\n\t\tregistry.MustRegister(collector)\n\t}\n\n\tgatherers := prometheus.Gatherers{}\n\tgatherers = append(gatherers, prometheus.DefaultGatherer)\n\tgatherers = append(gatherers, registry)\n\n\t// Delegate http serving to Prometheus client library, which will call collector.Collect.\n\thandler := promhttp.HandlerFor(gatherers, promhttp.HandlerOpts{\n\t\tErrorHandling: promhttp.ContinueOnError,\n\t\tErrorLog: e.logger,\n\t})\n\n\taddr := fmt.Sprintf(\":%d\", e.port)\n\texporter_shared.RunServer(\"MongoDB\", addr, e.path, handler)\n}", "title": "" }, { "docid": "96d0942dbfbe47929220ce57a83d7a50", "score": "0.4313491", "text": "func (c *citTLController) syncToStdout(key string) error {\n obj, exists, err := c.indexer.GetByKey(key)\n if err != nil {\n glog.Errorf(\"Fetching object with key %s from store failed with %v\", key, err)\n return err\n }\n\n if !exists {\n // Below we will warm up our cache with a Pod, so that we will see a delete for one pod\n fmt.Printf(\"Pod %s does not exist anymore\\n\", key)\n } else {\n // Note that you also have to check the uid if you have a local controlled resource, which\n // is dependent on the actual instance, to detect that a Pod was recreated with the same name\n //fmt.Printf(\"Sync/Add/Update for Pod %s\\n\", obj.(*v1.Pod).GetName())\n fmt.Printf(\"Sync/Add/Update for Pod %#v \\n\", obj)\n }\n return nil\n}", "title": "" }, { "docid": "26369d621e14b1588305d912e336ea31", "score": "0.43047374", "text": "func Run() {\n\tvar server = controller.Server{}\n\tserver.Init(\"sqlite3\", \"mltrack.db\")\n\n\tvar port uint = 8000\n\tserver.Run(port)\n}", "title": "" }, { "docid": "186dd24f786fd43b633431fc783b84d7", "score": "0.43019342", "text": "func RecordRunDetails(db *sql.DB, id int, runType string, programName string, count int, cmt string) (int, error) {\r\n\tinsertedID := 0\r\n\tif runType == INSERT {\r\n\t\tinsertString := \"INSERT INTO SchedulerRunDetails(StartTime,ProgramName,RecordCount,comment) values(?,?,?,?) \"\r\n\t\tinsertRes, inserterr := db.Exec(insertString, time.Now(), programName, count, cmt)\r\n\r\n\t\tif inserterr != nil {\r\n\t\t\treturn insertedID, fmt.Errorf(\"Error while inserting SchedulerRunDetails: \", inserterr.Error())\r\n\t\t\t//LogError(Panic, inserterr.Error())\r\n\t\t} else {\r\n\t\t\treturnId, _ := insertRes.LastInsertId()\r\n\t\t\tinsertedID = int(returnId)\r\n\t\t}\r\n\t} else if runType == UPDATE {\r\n\t\tinsertedID = id\r\n\t\tupdateString := \"UPDATE SchedulerRunDetails SET EndTime=?,RecordCount=?,comment=? where id=? \"\r\n\r\n\t\t_, updateerr := db.Exec(updateString, time.Now(), count, cmt, insertedID)\r\n\t\tif updateerr != nil {\r\n\t\t\t//log.Println(updateerr.Error())\r\n\t\t\treturn insertedID, fmt.Errorf(\"Error while updating SchedulerRunDetails: \", updateerr.Error())\r\n\r\n\t\t}\r\n\t}\r\n\treturn insertedID, nil\r\n\r\n}", "title": "" }, { "docid": "36f88b9ff8664d867aacf171c01496b8", "score": "0.42931223", "text": "func (h *Harvester) Run() (HarvestStats, error) {\n\tstats := HarvestStats{}\n\tfor {\n\t\trecords, err := h.fetch()\n\t\tif err != nil {\n\t\t\treturn stats, err\n\t\t}\n\t\tif len(records) == 0 {\n\t\t\treturn stats, nil\n\t\t}\n\t\tfor _, rec := range records {\n\t\t\tstatus, err := h.Process(rec)\n\t\t\tif err != nil {\n\t\t\t\treturn stats, err\n\t\t\t}\n\t\t\tswitch status {\n\t\t\tcase StatusNew:\n\t\t\t\tstats.NumAdded++\n\t\t\tcase StatusDeleted:\n\t\t\t\tstats.NumDeleted++\n\t\t\tcase StatusUpdated:\n\t\t\t\tstats.NumUpdated++\n\t\t\tcase StatusFailed:\n\t\t\t\tstats.NumProcessFailed++\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"unknown ProcessStatus %v\", status))\n\t\t\t}\n\t\t}\n\n\t\tif h.Token == \"\" {\n\t\t\t// ResumptionToken is empty, which means we have harvested all records.\n\t\t\treturn stats, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e5889d7e2e3b5ddf9dc17ab57def088e", "score": "0.42853093", "text": "func (w *Put) Run(database store.FileStore) error {\n\tvar value store.Value\n\talgo, err := algorithms.New(*w.algo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvalue.Algorithm = algo.Label()\n\n\tvar envelopeKey keymanager.EnvelopeKey\n\tif algo.NeedsKey() {\n\t\tkeyManager, err := keymanager.New(*w.keyManager)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.KeyManager = keyManager.Label()\n\n\t\tif err := w.chooseKeyID(database); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.KeyID = *w.keyID\n\n\t\tenvelopeKey, err = keyManager.GenerateEnvelopeKey(*w.keyID, *w.name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue.KeyCiphertext = base64.StdEncoding.EncodeToString(envelopeKey.Ciphertext)\n\t}\n\n\tplaintext, err := w.choosePlaintext()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tciphertext, err := algo.Encrypt(envelopeKey.GetPlaintext32(), plaintext)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvalue.Ciphertext = base64.StdEncoding.EncodeToString(ciphertext)\n\n\treturn database.Put(*w.name, value)\n}", "title": "" }, { "docid": "e8845894390067c2081e38d86baace42", "score": "0.42832568", "text": "func (s *WriterSubscriber) Run() error {\n\ts.isRunning = true\n\treturn nil\n}", "title": "" }, { "docid": "f136564243a8484adb0b99862f2cc1db", "score": "0.42787644", "text": "func (t *migrateTracker) run() {\n\tfor r := range t.results {\n\t\tif r.found {\n\t\t\tt.found++\n\t\t}\n\t\tif r.retry {\n\t\t\tt.report(\"retry:\", r.data.info, r.data.err)\n\t\t\tcontinue // retry attempts do not have results to process\n\t\t}\n\n\t\tswitch r.result {\n\t\tcase attemptResultError:\n\t\t\tt.report(\"error:\", r.data.info, r.data.err)\n\t\t\tt.errors++\n\t\t\tgroupResource := r.data.info.Mapping.Resource.GroupResource()\n\t\t\tt.resourcesWithErrors.Insert((&groupResource).String())\n\t\tcase attemptResultIgnore:\n\t\t\tt.ignored++\n\t\t\tif klog.V(2).Enabled() {\n\t\t\t\tt.report(\"ignored:\", r.data.info, nil)\n\t\t\t}\n\t\tcase attemptResultUnchanged:\n\t\t\tt.unchanged++\n\t\t\tif klog.V(2).Enabled() {\n\t\t\t\tt.report(\"unchanged:\", r.data.info, nil)\n\t\t\t}\n\t\tcase attemptResultSuccess:\n\t\t\tif klog.V(1).Enabled() {\n\t\t\t\tif t.dryRun {\n\t\t\t\t\tt.report(\"migrated (dry run):\", r.data.info, nil)\n\t\t\t\t} else {\n\t\t\t\t\tt.report(\"migrated:\", r.data.info, nil)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dc2d7a8fdb16b068ee438091b058fc27", "score": "0.42688572", "text": "func (h *perfGetByTaskIdHandler) Run(ctx context.Context) gimlet.Responder {\n\tperfResults, err := h.sc.FindPerformanceResultsByTaskId(h.taskId, h.interval, h.tags...)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Error getting performance results by task_id '%s'\", h.taskId))\n\t}\n\treturn gimlet.NewJSONResponse(perfResults)\n}", "title": "" }, { "docid": "85efc8d71c56abbe0ce83ff427df7158", "score": "0.42650682", "text": "func (h *perfGetByIdHandler) Run(ctx context.Context) gimlet.Responder {\n\tperfResult, err := h.sc.FindPerformanceResultById(h.id)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Error getting performance result by id '%s'\", h.id))\n\t}\n\treturn gimlet.NewJSONResponse(perfResult)\n}", "title": "" }, { "docid": "f590c149ed6263663ce446fa95d3c9c4", "score": "0.42618003", "text": "func Run(\n\tctx context.Context,\n\tinit Init,\n\tupdate Update,\n\tview View,\n\tproducer Producer,\n\tconsumer Consumer,\n) error {\n\treturn RunWithOptions(\n\t\tctx,\n\t\tRunOptions(\n\t\t\tinit,\n\t\t\tupdate,\n\t\t\tview,\n\t\t\tproducer,\n\t\t\tconsumer,\n\t\t)...,\n\t)\n}", "title": "" }, { "docid": "29956ac2d4ac67a6ab0094d8fd38c855", "score": "0.42583048", "text": "func (forwarder *DomainInformationForwarder) run() {\n\tdbDeleagte , error := persistence.NewDomainInformationStorage()\n\tif error != nil {\n\t\tfmt.Println(\"Cannot connect to Database. STopping Forwarder.\")\n\t\treturn\n\t}\n\tforwarder.dbDelegate = dbDeleagte\n\tgo forwarder.listenOnForwardSignal()\n\tgo forwarder.startForwardTicker()\n\tforwarder.forwarderStarted.Done()\n}", "title": "" }, { "docid": "7904a1eea6531b765af00242fa8794d1", "score": "0.42582142", "text": "func (stmt updateStmt) Run(tx *Tx, args []driver.NamedValue) (Result, error) {\n\tvar res Result\n\n\tif stmt.tableName == \"\" {\n\t\treturn res, errors.New(\"missing table name\")\n\t}\n\n\tif len(stmt.pairs) == 0 {\n\t\treturn res, errors.New(\"Set method not called\")\n\t}\n\n\tstack := evalStack{\n\t\tTx: tx,\n\t\tParams: args,\n\t}\n\n\tt, err := tx.GetTable(stmt.tableName)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tst := record.NewStream(t)\n\tst = st.Filter(whereClause(stmt.whereExpr, stack))\n\n\terr = st.Iterate(func(r record.Record) error {\n\t\trk, ok := r.(record.Keyer)\n\t\tif !ok {\n\t\t\treturn errors.New(\"attempt to update record without key\")\n\t\t}\n\n\t\tvar fb record.FieldBuffer\n\t\terr := fb.ScanRecord(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor fname, e := range stmt.pairs {\n\t\t\tf, err := fb.GetField(fname)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tv, err := e.Eval(evalStack{\n\t\t\t\tTx: tx,\n\t\t\t\tRecord: r,\n\t\t\t\tParams: args,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif v.IsList {\n\t\t\t\treturn fmt.Errorf(\"expected value got list\")\n\t\t\t}\n\n\t\t\tf.Type = v.Value.Type\n\t\t\tf.Data = v.Value.Data\n\t\t\terr = fb.Replace(f.Name, f)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\terr = t.Replace(rk.Key(), &fb)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn res, err\n}", "title": "" }, { "docid": "a9f41e6e178ceb52c7253a0d45cfe663", "score": "0.42539522", "text": "func (tr *TweetRepository) Save(conf tweet.Config) (tweet.Tweet, error) {\n\tuser, err := tr.ReadViewClient.GetUserByUserID(context.TODO(), &readviewpb.UserID{UserID: conf.UserID})\n\tif err != nil {\n\t\treturn tweet.Tweet{}, err\n\t}\n\n\tinsertID, err := tr.DatabaseAccessClient.SaveTweet(\n\t\tcontext.TODO(),\n\t\t&dbaccesspb.TweetConfig{\n\t\t\tUserID: conf.UserID,\n\t\t\tUsername: user.Username,\n\t\t\tText: conf.Text,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn tweet.Tweet{}, err\n\t}\n\n\t_, err = tr.ReadViewClient.AddTweet(\n\t\tcontext.TODO(),\n\t\t&readviewpb.Tweet{\n\t\t\tID: insertID.InsertID,\n\t\t\tUserID: conf.UserID,\n\t\t\tUsername: user.Username,\n\t\t\tText: conf.Text,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn tweet.Tweet{}, err\n\t}\n\n\treturn tweet.Tweet{\n\t\tID: insertID.InsertID,\n\t\tUserID: conf.UserID,\n\t\tUsername: user.Username,\n\t\tText: conf.Text,\n\t}, nil\n}", "title": "" }, { "docid": "faa126111e190ba64b712137cced5e7a", "score": "0.4250778", "text": "func Run(provider, id, region string, m interface{}) (err error) {\n\tlog.Debugf(\"extraction provider:%s id:%s region:%s\", provider, id, region)\n\t// retrieve the query for the provider\n\tquery, err := buildQuery(provider, id, region)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tlog.Debugf(\"query is %s\", query)\n\t// compile the query\n\tprogram, err := ferret.Compile(query)\n\tif err != nil {\n\t\tlog.Errorf(\"error compiling query: %v\", err)\n\t\treturn\n\t}\n\t// execute the query\n\tout, err := program.Run(ctx)\n\tif err != nil {\n\t\tlog.Errorf(\"error executing query: %v\", err)\n\t\treturn\n\t}\n\t// unmarshal result\n\terr = json.Unmarshal(out, &m)\n\tif err != nil {\n\t\tlog.Errorf(\"error unmarshal result: %v\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ebb0e6c1c836669af89cc25b926d9b1", "score": "0.42506143", "text": "func (s *SemVerUpdate) Run(ctx context.Context) error {\n\tif s.Mock != nil {\n\t\treturn s.Mock.Run(ctx)\n\t}\n\n\tfilename, err := s.writeVersion(false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"SemVerUpdate.Run: %s\", err)\n\t}\n\n\ts.Result.Filename = filename\n\n\treturn nil\n}", "title": "" }, { "docid": "3edce6870f18bb162b19da1eeb3e201a", "score": "0.42439854", "text": "func (m *Mongo) Run(cmd interface{}, result interface{}) error {\n\tvar err error\n\n\tsession := m.session.Copy()\n\tdefer session.Close()\n\n\tdatabase := m.db.Name\n\targs := formatArgs(cmd)\n\n\toperationName, tags := buildTracingParams(database, database, \"runCommand\", args)\n\n\ttracing.Trace(m.ctx, operationName, tags, func() {\n\t\tm.db.With(session).Run(cmd, result)\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "c555271c32ec52f1d93de7b82276c6f2", "score": "0.42387834", "text": "func (j *job) Run() {\n\tif j.entryID == noEnt {\n\t\tj.entryID = <-j.idChan\n\t}\n\tj.sdb.runTask(j.taskID, j.schedule, j.limit, j.expireAt, j.runCount, j.entryID)\n\tj.runCount++\n}", "title": "" }, { "docid": "6ec16491b54fc794fc69d9414278a1e6", "score": "0.4236601", "text": "func (recorder *recorder) worker() {\n\t// make timer that is only activated in some ways\n\tvar (\n\t\tmdnsDuration time.Duration\n\t\tmdnsQueryTimer *time.Timer\n\t)\n\n\t// create reverse lookup cache with given ttl and given reap interval\n\tif *recorder.conf.QueryLog.ReverseLookup && *recorder.conf.QueryLog.MdnsLookup {\n\t\tmdnsDuration = 1 * time.Second\n\t\tmdnsQueryTimer = time.NewTimer(mdnsDuration)\n\t} else {\n\t\tmdnsQueryTimer = &time.Timer{}\n\t}\n\n\t// start ticker to persist data and update periodic metrics\n\tmetricsDuration, _ := util.ParseDuration(recorder.conf.Metrics.Interval)\n\tmetricsTicker := time.NewTicker(metricsDuration)\n\tdefer metricsTicker.Stop()\n\tif !(*recorder.conf.Metrics.Enabled) {\n\t\tmetricsTicker.Stop()\n\t}\n\n\t// flush every duration\n\tflushTimer := time.NewTimer(recorder.flushInterval)\n\tdefer flushTimer.Stop()\n\n\t// prune every hour (also prunes on startup)\n\tpruneTimer := time.NewTimer(1 * time.Hour)\n\tdefer pruneTimer.Stop()\n\n\t// can't do these things if there is no db\n\tif recorder.db == nil {\n\t\tflushTimer.Stop()\n\t\tpruneTimer.Stop()\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-metricsTicker.C:\n\t\t\t// update metrics if not nil\n\t\t\tif recorder.metrics != nil {\n\t\t\t\t// update periodic metrics\n\t\t\t\trecorder.metrics.update()\n\n\t\t\t\t// only insert/prune if a db exists\n\t\t\t\tif recorder.db != nil {\n\t\t\t\t\t// insert new metrics inside transaction\n\t\t\t\t\trecorder.doWithIsolatedTransaction(func(tx *sql.Tx) {\n\t\t\t\t\t\tnow := time.Now()\n\t\t\t\t\t\trecorder.metrics.insert(tx, now)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\tcase info := <-recorder.infoQueue:\n\t\t\t// ensure record has information required\n\t\t\trecorder.condition(info)\n\n\t\t\t// buffer into database\n\t\t\tif nil != recorder.db {\n\t\t\t\trecorder.buffer(info)\n\t\t\t}\n\n\t\t\t// write to actual log (file or stdout)\n\t\t\tif recorder.qlog != nil {\n\t\t\t\trecorder.qlog.log(info)\n\t\t\t}\n\n\t\t\t// record metrics for single entry\n\t\t\tif recorder.metrics != nil {\n\t\t\t\trecorder.metrics.record(info)\n\t\t\t}\n\n\t\t\t// return to pool\n\t\t\trecorder.recordPool.Put(info)\n\t\tcase <-mdnsQueryTimer.C:\n\t\t\t// make query\n\t\t\tMulticastMdnsQuery()\n\n\t\t\t// extend timer, should be exponential backoff but this is close enough\n\t\t\tmdnsDuration = mdnsDuration * 2\n\t\t\tif mdnsDuration > (30 * time.Minute) {\n\t\t\t\tmdnsDuration = 30 * time.Minute\n\t\t\t}\n\t\t\tmdnsQueryTimer.Reset(mdnsDuration)\n\t\tcase <-flushTimer.C:\n\t\t\tlog.Tracef(\"Flush timer triggered\")\n\t\t\trecorder.flush()\n\t\t\tflushTimer.Reset(recorder.flushInterval)\n\t\tcase <-pruneTimer.C:\n\t\t\tlog.Tracef(\"Prune timer triggered\")\n\t\t\trecorder.prune()\n\t\t\tpruneTimer.Reset(1 * time.Hour)\n\t\tcase <-recorder.doneChan:\n\t\t\t// when the function is over the shutdown method waits for\n\t\t\t// a message back on the doneChan to know that we are done\n\t\t\t// shutting down\n\t\t\tmetricsTicker.Stop()\n\t\t\tflushTimer.Stop()\n\t\t\tpruneTimer.Stop()\n\t\t\tdefer func() { recorder.doneChan <- true }()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3494b577abd810441fd4e36039a08fe8", "score": "0.4234909", "text": "func (s *Seeder) Run() error {\n\tlog.Println(\"Generating reviews...\")\n\t// TODO: Generate and Insert Variation Options\n\n\tlog.Println(\"Inserting reviews...\")\n\tlog.Println(\"Reviews... \", len(defaults.Reviews))\n\n\tfor _, r := range defaults.Reviews {\n\t\tif err := s.DB.Create(&r).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a6ff4f5867a3a90978dee5db31d116d0", "score": "0.42324087", "text": "func Run(indyBaseUrl, datasetRepoUrl, buildId, promoteTargetStore, metaCheckRepo string, clearCache, dryRun, keepPod, sidecar bool) {\n\tif sidecar {\n\t\tfmt.Println(\"Enable sidecar\")\n\t\tindyBaseUrl = \"http://localhost:8080\"\n\t}\n\n\t//a. Clone dataset repo\n\tdatasetRepoDir := cloneRepo(datasetRepoUrl)\n\tfmt.Printf(\"Clone SUCCESS, dir: %s\\n\", datasetRepoDir)\n\n\t//Load the info.json\n\tvar info dataset.Info\n\tinfoFileLoc := getInfoFileLoc(datasetRepoDir, buildId)\n\tjson.Unmarshal(common.ReadByteFromFile(infoFileLoc), &info)\n\n\t//Load the additional-repos.json\n\tadditionalReposFileLoc := path.Join(datasetRepoDir, buildId, dataset.ADDITIONAL_REPOS)\n\tadditionalRepos := getAdditionalRepos(additionalReposFileLoc)\n\n\tstart := time.Now()\n\n\t//b. Retrieve the metadata files in da.json\n\tretrieveAlignmentMetadata(indyBaseUrl, datasetRepoDir, buildId, info)\n\tt := time.Now()\n\tfmt.Printf(\"Retrieve metadata SUCCESS, elapsed(s): %f\\n\", t.Sub(start).Seconds())\n\n\t//c/d/e. Create a mock build group, download files, rename to-be-uploaded files\n\tpackageType := getPackageType(info)\n\tfoloFileLoc := path.Join(datasetRepoDir, buildId, dataset.TRACKING_JSON)\n\tfoloTrackContent := common.GetFoloRecordFromFile(foloFileLoc)\n\toriginalIndy := getOriginalIndyBaseUrl(foloTrackContent.Uploads[0].LocalUrl)\n\tbuildName := common.GenerateRandomBuildName()\n\tprev := t\n\tbuildSuccess := buildtest.DoRun(originalIndy, \"\", indyBaseUrl, packageType, buildName, foloTrackContent, additionalRepos, DEFAULT_ROUTINES, clearCache, dryRun)\n\tt = time.Now()\n\tfmt.Printf(\"Create mock group(%s) and download/upload SUCCESS, elapsed(s): %f\\n\", buildName, t.Sub(prev).Seconds())\n\n\t//k. Delete the temp group and the hosted repo, and folo record\n\tdefer cleanUp(indyBaseUrl, packageType, buildName, dryRun)\n\n\t// Advanced checks\n\tif buildSuccess && !dryRun {\n\t\tif !verifyFoloRecord(indyBaseUrl, buildName, foloTrackContent) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t//f. Retrieve the metadata files which will be affected by promotion\n\tmetaFiles := calculateMetadataFiles(foloTrackContent)\n\tmetaFilesLoc := path.Join(TMP_METADATA_DIR, \"before-promote\")\n\tnewVersionNum := buildName[len(common.BUILD_TEST_):]\n\texists := true\n\tpassed, e := retrieveMetadataAndValidate(indyBaseUrl, packageType, metaCheckRepo, metaFiles, metaFilesLoc, newVersionNum, !exists)\n\tif !passed {\n\t\tlogger.Infof(\"Metadata check failed (before). Errors: %s\", e.Error())\n\t\treturn\n\t}\n\tfmt.Printf(\"Metadata validate (before) SUCCESS\\n\")\n\n\t//g. Promote the files in hosted repo A to hosted repo pnc-builds\n\tfoloTrackId := buildName\n\tsourceStore, targetStore := getPromotionSrcTargetStores(packageType, buildName, promoteTargetStore, foloTrackContent)\n\tresp, _, success := promotetest.DoRun(indyBaseUrl, foloTrackId, sourceStore, targetStore, newVersionNum, foloTrackContent, dryRun)\n\tif !success {\n\t\tfmt.Printf(\"Promote failed, %s\\n\", resp)\n\t\treturn\n\t}\n\n\t//h. Retrieve the metadata files again, check the new version\n\tfmt.Printf(\"Waiting 30s...\\n\")\n\ttime.Sleep(30 * time.Second) // wait for Indy event handled\n\n\tmetaFilesLoc = path.Join(TMP_METADATA_DIR, \"after-promote\")\n\tpassed, e = retrieveMetadataAndValidate(indyBaseUrl, packageType, metaCheckRepo, metaFiles, metaFilesLoc, newVersionNum, exists)\n\tif !passed {\n\t\tlogger.Infof(\"Metadata check failed (after promotion). Errors: %s\", e.Error())\n\t\treturn\n\t}\n\tfmt.Printf(\"Metadata validate (after promotion) SUCCESS\\n\")\n\n\t//i. Rollback the promotion\n\tpromotetest.Rollback(indyBaseUrl, resp, dryRun)\n\n\t//h. Retrieve the metadata files again, check the new version is GONE\n\tfmt.Printf(\"Waiting 30s...\\n\")\n\ttime.Sleep(30 * time.Second)\n\n\tmetaFilesLoc = path.Join(TMP_METADATA_DIR, \"rollback\")\n\tpassed, e = retrieveMetadataAndValidate(indyBaseUrl, packageType, metaCheckRepo, metaFiles, metaFilesLoc, newVersionNum, !exists)\n\tif !passed {\n\t\tlogger.Infof(\"Metadata check failed (rollback). Errors: %s\", e.Error())\n\t\treturn\n\t}\n\tfmt.Printf(\"Metadata validate (rollback) SUCCESS\\n\")\n\n\t// Pause and keep pod for debugging\n\tif keepPod {\n\t\tfmt.Printf(\"Waiting 30m...\\n\")\n\t\ttime.Sleep(30 * time.Minute)\n\t}\n}", "title": "" }, { "docid": "a72819b12cd18f104e668f9e585f0d5c", "score": "0.42315692", "text": "func Run(w http.ResponseWriter, req *http.Request) {\n\tlog.Println(\">>>\", req.URL)\n\tlog.Println(\">>>\", theContext)\n\n\tswitch theContext.State {\n\tcase INIT:\n\t\t//wrong state, show experiment page\n\t\ttheContext.Message = messageRunI[theContext.Lang]\n\t\ttheContext.AlertLevel = DANGER\n\t\ttheContext.Title = titleExperiment[theContext.Lang]\n\t\trender(w, \"experiment\", theContext)\n\tcase RUNNING:\n\t\t// we already are in this State\n\t\t// only put a message, but don't touch the running process\n\t\ttheContext.Message = messageRunR[theContext.Lang]\n\t\ttheContext.AlertLevel = WARNING\n\t\ttheContext.Title = titleRun[theContext.Lang]\n\t\trender(w, \"run\", theContext)\n\tcase CONFIGURED, STOPPED:\n\t\t//correct states, do the running process\n\n\t\tdataFileName := filepath.Join(StaticRoot, DataFilePath, theContext.ConfigurationName+DataFileExtension)\n\t\t//detect if file exists\n\t\t_, err := os.Stat(dataFileName)\n\t\t//create datafile is not exists\n\t\tif os.IsNotExist(err) {\n\t\t\t//create file to write\n\t\t\tlog.Println(\"Creating \", dataFileName)\n\t\t\ttheContext.DataFile, err = os.Create(dataFileName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t\tstatusLine := fmt.Sprintf(\"### %v Data Acquisition: %s \\n\\n\", time.Now(), theContext.ConfigurationName)\n\t\t\ttheContext.DataFile.WriteString(statusLine)\n\t\t\t//formatLine := fmt.Sprintf(\"### [Ard], localTime(us), trackerTime(us), sensorTime(us), distance(mm), accX(g), accY(g), accZ(g), gyrX(gr/s), gyrY(gr/s), gyrZ(gr/s) \\n\\n\")\n\t\t\tformatLine := fmt.Sprintf(\"### [Ard]; localTime(us); sensorTime(us)\")\n\t\t\tif theContext.SetTrackerM == ON {\n\t\t\t\tformatLine += fmt.Sprintf(\"; trackerTime(us)\")\n\t\t\t}\n\t\t\tif theContext.SetDistance == ON {\n\t\t\t\tformatLine += fmt.Sprintf(\"; distance(mm)\")\n\t\t\t}\n\t\t\tif theContext.SetAccelerometer == ON {\n\t\t\t\tformatLine += fmt.Sprintf(\"; accX(g)\")\n\t\t\t\tformatLine += fmt.Sprintf(\"; accY(g)\")\n\t\t\t\tformatLine += fmt.Sprintf(\"; accZ(g)\")\n\t\t\t}\n\t\t\tif theContext.SetGyroscope == ON {\n\t\t\t\tformatLine += fmt.Sprintf(\"; gyrX(gr/s)\")\n\t\t\t\tformatLine += fmt.Sprintf(\"; gyrY(gr/s)\")\n\t\t\t\tformatLine += fmt.Sprintf(\"; gyrZ(gr/s)\")\n\t\t\t}\n\t\t\tformatLine += fmt.Sprintf(\"\\n\\n\")\n\t\t\ttheContext.DataFile.WriteString(formatLine)\n\t\t\t// sets the new time0 only with a new scenery\n\t\t\ttheContext.setTime0()\n\t\t} else {\n\t\t\t//open fle to append\n\t\t\tlog.Println(\"Openning \", dataFileName)\n\t\t\ttheContext.DataFile, err = os.OpenFile(dataFileName, os.O_RDWR|os.O_APPEND, 0644)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t}\n\t\t}\n\n\t\t// running process instruction here!\n\t\t// running process instruction here!\n\n\t\t//waitTillButtonPushed(buttonA)\n\t\thwio.DigitalWrite(theOshi.statusLed, hwio.HIGH)\n\t\tlog.Println(\"Beginning.....\")\n\n\t\t//activate arduino\n\t\tsetArduinoStateON()\n\n\t\t// launch the trackers\n\n\t\tlog.Printf(\"There are %v goroutines\", runtime.NumGoroutine())\n\t\tlog.Printf(\"Launching the Gourutines\")\n\n\t\ttheContext.State = RUNNING\n\n\t\tgo theContext.readFromArduino()\n\t\tlog.Println(\"Started Arduino\")\n\t\tif theContext.SetTrackerA == ON {\n\t\t\tgo readTracker(\"A\", theOshi.trackerA)\n\t\t\tlog.Println(\"Started Tracker A\")\n\t\t}\n\t\tif theContext.SetTrackerB == ON {\n\t\t\tgo readTracker(\"B\", theOshi.trackerB)\n\t\t\tlog.Println(\"Started Tracker B\")\n\t\t}\n\t\tif theContext.SetTrackerC == ON {\n\t\t\tgo readTracker(\"C\", theOshi.trackerC)\n\t\t\tlog.Println(\"Started Tracker C\")\n\t\t}\n\t\tif theContext.SetTrackerD == ON {\n\t\t\tgo readTracker(\"D\", theOshi.trackerD)\n\t\t\tlog.Println(\"Started Tracker D\")\n\t\t}\n\t\tlog.Printf(\"There are %v goroutines\", runtime.NumGoroutine())\n\t\t//defer close the file to STOP\n\n\t\ttheContext.Message = messageRunCS[theContext.Lang]\n\t\ttheContext.AlertLevel = SUCCESS\n\t\ttheContext.Title = titleRun[theContext.Lang]\n\t\t//theContext.State = RUNNING\n\t\trender(w, \"run\", theContext)\n\t}\n}", "title": "" }, { "docid": "d7be0d1fdb08facfd2cc3abf64004c0b", "score": "0.42220798", "text": "func (r *Get) Run(database store.FileStore) error {\n\tvalue, err := database.Get(*r.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\talgo, err := algorithms.New(value.Algorithm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar decryptionKeyArray [32]byte\n\tif algo.NeedsKey() {\n\t\tkeyManager, err := keymanager.New(value.KeyManager)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tkeyCiphertext, err2 := value.GetKeyCiphertext()\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tkeyPlaintext, err2 := keyManager.Decrypt(keyCiphertext, *r.name)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tcopy(decryptionKeyArray[:], keyPlaintext)\n\t}\n\tdecoded, err := value.GetCiphertext()\n\tif err != nil {\n\t\treturn err\n\t}\n\tplaintext, err := algo.Decrypt(&decryptionKeyArray, decoded)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(*r.writeTo) > 0 {\n\t\treturn ioutil.WriteFile(*r.writeTo, plaintext, 0644)\n\t}\n\n\tfmt.Printf(\"%s\", plaintext)\n\tif !bytes.HasSuffix(plaintext, []byte{'\\n'}) {\n\t\tfmt.Printf(\"\\n\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5388903631befdbfbe0a77c9b0de27fd", "score": "0.42172036", "text": "func (h *perfGetByTaskNameHandler) Run(ctx context.Context) gimlet.Responder {\n\tperfResults, err := h.sc.FindPerformanceResultsByTaskName(h.taskName, h.interval, h.tags...)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Error getting performance results by task_id '%s'\", h.taskName))\n\t}\n\treturn gimlet.NewJSONResponse(perfResults)\n}", "title": "" }, { "docid": "6ba1c8c91d7a39460766820f06e3e1df", "score": "0.42131704", "text": "func Run(t *testing.T, db TestableDB) {\n\tdbtest.Test(t, db)\n\trun(t, db)\n}", "title": "" }, { "docid": "477b3565d8924edd6762ade75ffde02f", "score": "0.42130408", "text": "func (c *Controller) runWorker() {\n\tc.Log.Info(\"Telemetry-Controller: running...\")\n\n\t// invoke processNextItem to fetch and consume the next change\n\t// to a watched or listed resource\n\tfor c.processNextItem() {\n\t\tc.Log.Info(\"Telemetry-Controller-runWorker: processing next item...\")\n\t}\n\n\tc.Log.Info(\"Telemetry-Controller-runWorker: Completed\")\n}", "title": "" }, { "docid": "32a1bc6fae9d26ced99d2ecdccf53cda", "score": "0.42107144", "text": "func (c *Client) updateTxtRecord(ctx context.Context, endpoint *url.URL) error {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.String(), http.NoBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create request: %w\", err)\n\t}\n\n\tresp, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn errutils.NewHTTPDoError(req, err)\n\t}\n\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn errutils.NewUnexpectedResponseStatusCodeError(req, resp)\n\t}\n\n\traw, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errutils.NewReadResponseError(req, resp.StatusCode, err)\n\t}\n\n\tvar response apiResponse\n\terr = json.Unmarshal(raw, &response)\n\tif err != nil {\n\t\treturn errutils.NewUnmarshalError(req, resp.StatusCode, raw, err)\n\t}\n\n\tif response.Result == \"error\" {\n\t\treturn fmt.Errorf(\"add TXT record failed: %s\", response.Data)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "62bc1bcaa2084075acef0ec5d7229e27", "score": "0.4208072", "text": "func (c *Client) Run(ctx context.Context) error {\n\t// Connect the client to the server and create the database\n\tc.connect(ctx)\n\n\t// Suscribe to the Store to receive the metrics\n\tc.store.AddNotifiee(c.addPoints)\n\n\t// Initialize a ticker of 10 seconds\n\tticker := time.NewTicker(10 * time.Second)\n\tdefer ticker.Stop()\n\n\tfor ctx.Err() == nil {\n\t\tfor c.lenGloutonPendingPoints() > 0 {\n\t\t\t// Convert the BleemeoPendingPoints in InfluxDBPendingPoints\n\t\t\tc.convertPendingPoints()\n\n\t\t\t// Send the point to the server\n\t\t\t// If sendPoints fail we retry after a tick\n\t\t\tc.sendPoints()\n\n\t\t\tbreakstate := c.sendCheck()\n\t\t\tif breakstate {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Wait the ticker or the and of the programm\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\tcase <-ctx.Done():\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "645d3650ed26a0e6e9c8404079166086", "score": "0.41989574", "text": "func (tm *TargetManager) Run() {\n\tlog.Info(\"Starting target manager...\")\n\n\ttm.mtx.Lock()\n\n\ttm.ctx, tm.cancel = context.WithCancel(context.Background())\n\ttm.reload()\n\n\ttm.mtx.Unlock()\n\n\ttm.wg.Wait()\n}", "title": "" }, { "docid": "6969e99eccddfe1f8111d6ae4147e147", "score": "0.41987416", "text": "func (a *WordsApiService) InsertRun(ctx context.Context, data *models.InsertRunRequest) (models.RunResponse, *http.Response, error) {\n var (\n successPayload models.RunResponse\n )\n\n requestData, err := data.CreateRequestData();\n if err != nil {\n return successPayload, nil, err\n }\n\n requestData.Path = a.client.cfg.BaseUrl + requestData.Path;\n\n r, err := a.client.prepareRequest(ctx, requestData)\n if err != nil {\n return successPayload, nil, err\n }\n\n response, err := a.client.callAPI(r)\n\n if err != nil || response == nil {\n return successPayload, nil, err\n }\n\n defer response.Body.Close()\n \n\n if response.StatusCode == 401 {\n return successPayload, nil, errors.New(\"Access is denied\")\n }\n if response.StatusCode >= 300 {\n var apiError models.WordsApiErrorResponse;\n\n if err = json.NewDecoder(response.Body).Decode(&apiError); err != nil {\n return successPayload, nil, err\n }\n\n return successPayload, response, &apiError\n }\n if err = json.NewDecoder(response.Body).Decode(&successPayload); err != nil {\n return successPayload, response, err\n }\n\n return successPayload, response, err\n}", "title": "" }, { "docid": "dd5a83c71da3422550c74d5c4b26d951", "score": "0.41939005", "text": "func (h *Handler) serveWrite(w http.ResponseWriter, r *http.Request, user *influxdb.User) {\n\tvar bp influxdb.BatchPoints\n\tvar dec *json.Decoder\n\n\tif h.WriteTrace {\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\th.Logger.Print(\"write handler failed to read bytes from request body\")\n\t\t} else {\n\t\t\th.Logger.Printf(\"write body received by handler: %s\", string(b))\n\t\t}\n\t\tdec = json.NewDecoder(strings.NewReader(string(b)))\n\t} else {\n\t\tdec = json.NewDecoder(r.Body)\n\t}\n\n\tvar writeError = func(result influxdb.Result, statusCode int) {\n\t\tw.WriteHeader(statusCode)\n\t\tw.Header().Add(\"content-type\", \"application/json\")\n\t\t_ = json.NewEncoder(w).Encode(&result)\n\t\treturn\n\t}\n\n\tif err := dec.Decode(&bp); err != nil {\n\t\tif err.Error() == \"EOF\" {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\t\twriteError(influxdb.Result{Err: err}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif bp.Database == \"\" {\n\t\twriteError(influxdb.Result{Err: fmt.Errorf(\"database is required\")}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif !h.server.DatabaseExists(bp.Database) {\n\t\twriteError(influxdb.Result{Err: fmt.Errorf(\"database not found: %q\", bp.Database)}, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tif h.requireAuthentication && user == nil {\n\t\twriteError(influxdb.Result{Err: fmt.Errorf(\"user is required to write to database %q\", bp.Database)}, http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tif h.requireAuthentication && !user.Authorize(influxql.WritePrivilege, bp.Database) {\n\t\twriteError(influxdb.Result{Err: fmt.Errorf(\"%q user is not authorized to write to database %q\", user.Name, bp.Database)}, http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tpoints, err := influxdb.NormalizeBatchPoints(bp)\n\tif err != nil {\n\t\twriteError(influxdb.Result{Err: err}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif index, err := h.server.WriteSeries(bp.Database, bp.RetentionPolicy, points); err != nil {\n\t\twriteError(influxdb.Result{Err: err}, http.StatusInternalServerError)\n\t\treturn\n\t} else {\n\t\tw.Header().Add(\"X-InfluxDB-Index\", fmt.Sprintf(\"%d\", index))\n\t}\n}", "title": "" }, { "docid": "2c7c2600ad7b55114d5ef27caa908181", "score": "0.41912925", "text": "func Run(apiTLSConfig *api.TLSConfig) error {\n\tdbType, err := New()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tplugins.Serve(dbType.(dbplugin.Database), apiTLSConfig)\n\n\treturn nil\n}", "title": "" }, { "docid": "909a11415d0a2fb950be24808bce5b5b", "score": "0.41788274", "text": "func (i *ProxyIndex) Run(id RunID) (shared.TestRun, error) {\n\treturn i.delegate.Run(id)\n}", "title": "" }, { "docid": "06039160cbbb8d5d33a277be6206a873", "score": "0.41663635", "text": "func transformRecord(ctx context.Context, s BatchesStore, job *btypes.BatchSpecWorkspaceExecutionJob, accessToken string) (apiclient.Job, error) {\n\t// MAYBE: We could create a view in which batch_spec and repo are joined\n\t// against the batch_spec_workspace_job so we don't have to load them\n\t// separately.\n\tworkspace, err := s.GetBatchSpecWorkspace(ctx, store.GetBatchSpecWorkspaceOpts{ID: job.BatchSpecWorkspaceID})\n\tif err != nil {\n\t\treturn apiclient.Job{}, errors.Wrapf(err, \"fetching workspace %d\", job.BatchSpecWorkspaceID)\n\t}\n\n\tbatchSpec, err := s.GetBatchSpec(ctx, store.GetBatchSpecOpts{ID: workspace.BatchSpecID})\n\tif err != nil {\n\t\treturn apiclient.Job{}, errors.Wrap(err, \"fetching batch spec\")\n\t}\n\n\t// 🚨 SECURITY: Set the actor on the context so we check for permissions\n\t// when loading the repository.\n\tctx = actor.WithActor(ctx, actor.FromUser(batchSpec.UserID))\n\n\trepo, err := s.DatabaseDB().Repos().Get(ctx, workspace.RepoID)\n\tif err != nil {\n\t\treturn apiclient.Job{}, errors.Wrap(err, \"fetching repo\")\n\t}\n\n\t// Create an internal access token that will get cleaned up when the job\n\t// finishes.\n\ttoken, err := createAndAttachInternalAccessToken(ctx, s, job.ID, batchSpec.UserID)\n\tif err != nil {\n\t\treturn apiclient.Job{}, errors.Wrap(err, \"creating internal access token\")\n\t}\n\n\texecutionInput := batcheslib.WorkspacesExecutionInput{\n\t\tRepository: batcheslib.WorkspaceRepo{\n\t\t\tID: string(graphqlbackend.MarshalRepositoryID(repo.ID)),\n\t\t\tName: string(repo.Name),\n\t\t},\n\t\tBranch: batcheslib.WorkspaceBranch{\n\t\t\tName: workspace.Branch,\n\t\t\tTarget: batcheslib.Commit{OID: workspace.Commit},\n\t\t},\n\t\tPath: workspace.Path,\n\t\tOnlyFetchWorkspace: workspace.OnlyFetchWorkspace,\n\t\t// TODO: We can further optimize here later and tell src-cli to\n\t\t// not run those steps so there is no discrepancy between the backend\n\t\t// and src-cli calculating the if conditions.\n\t\tSteps: batchSpec.Spec.Steps,\n\t\tSearchResultPaths: workspace.FileMatches,\n\t\tBatchChangeAttributes: template.BatchChangeAttributes{\n\t\t\tName: batchSpec.Spec.Name,\n\t\t\tDescription: batchSpec.Spec.Description,\n\t\t},\n\t}\n\n\tfrontendURL := conf.Get().ExternalURL\n\n\tsrcEndpoint, err := makeURL(frontendURL, accessToken)\n\tif err != nil {\n\t\treturn apiclient.Job{}, err\n\t}\n\n\tredactedSrcEndpoint, err := makeURL(frontendURL, \"PASSWORD_REMOVED\")\n\tif err != nil {\n\t\treturn apiclient.Job{}, err\n\t}\n\n\tcliEnv := []string{\n\t\tfmt.Sprintf(\"SRC_ENDPOINT=%s\", srcEndpoint),\n\t\tfmt.Sprintf(\"SRC_ACCESS_TOKEN=%s\", token),\n\t}\n\n\tmarshaledInput, err := json.Marshal(executionInput)\n\tif err != nil {\n\t\treturn apiclient.Job{}, err\n\t}\n\n\tfiles := map[string]string{\"input.json\": string(marshaledInput)}\n\n\tif !batchSpec.NoCache {\n\t\t// Find the cache entry for the _last_ step. src-cli only needs the most\n\t\t// recent cache entry to do its work.\n\t\tlatestIndex := -1\n\t\tfor idx := range workspace.StepCacheResults {\n\t\t\tif idx > latestIndex {\n\t\t\t\tlatestIndex = idx\n\t\t\t}\n\t\t}\n\t\tif latestIndex != -1 {\n\t\t\tcacheEntry, _ := workspace.StepCacheResult(latestIndex)\n\t\t\tserializedCacheEntry, err := json.Marshal(cacheEntry.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn apiclient.Job{}, errors.Wrap(err, \"serializing cache entry\")\n\t\t\t}\n\t\t\t// Add file to virtualMachineFiles.\n\t\t\tfiles[cacheEntry.Key+`.json`] = string(serializedCacheEntry)\n\t\t}\n\t}\n\n\treturn apiclient.Job{\n\t\tID: int(job.ID),\n\t\tVirtualMachineFiles: files,\n\t\tCliSteps: []apiclient.CliStep{\n\t\t\t{\n\t\t\t\tCommands: []string{\"batch\", \"exec\", \"-f\", \"input.json\"},\n\t\t\t\tDir: \".\",\n\t\t\t\tEnv: cliEnv,\n\t\t\t},\n\t\t},\n\t\tRedactedValues: map[string]string{\n\t\t\t// 🚨 SECURITY: Catch leak of upload endpoint. This is necessary in addition\n\t\t\t// to the below in case the username or password contains illegal URL characters,\n\t\t\t// which are then urlencoded and are not replaceable via byte comparison.\n\t\t\tsrcEndpoint: redactedSrcEndpoint,\n\n\t\t\t// 🚨 SECURITY: Catch uses of fragments pulled from URL to construct another target\n\t\t\t// (in src-cli). We only pass the constructed URL to src-cli, which we trust not to\n\t\t\t// ship the values to a third party, but not to trust to ensure the values are absent\n\t\t\t// from the command's stdout or stderr streams.\n\t\t\taccessToken: \"PASSWORD_REMOVED\",\n\n\t\t\t// 🚨 SECURITY: Redact the access token used for src-cli to talk to\n\t\t\t// Sourcegraph instance.\n\t\t\ttoken: \"SRC_ACCESS_TOKEN_REMOVED\",\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "303420984be1107a3326001d8af1d488", "score": "0.41650513", "text": "func (a *Api) Run() {\n\tdefer a.DB.Close()\n\ta.listen(9000)\n}", "title": "" }, { "docid": "55748ce1e714be3ff6e229705a461b09", "score": "0.41628963", "text": "func serve(c *cli.Context) (err error) {\n\tif c.Bool(\"profile\") {\n\t\tgo func() {\n\t\t\tfmt.Println(\"==== PROFILING ENABLED ==========\")\n\t\t\truntime.SetBlockProfileRate(5000)\n\t\t\terr := http.ListenAndServe(\"0.0.0.0:6060\", nil)\n\t\t\tpanic(err)\n\t\t}()\n\t}\n\n\tif name := c.String(\"name\"); name != \"\" {\n\t\tconfig.Name = name\n\t}\n\n\tif seed := c.Int64(\"seed\"); seed > 0 {\n\t\tconfig.Seed = seed\n\t}\n\n\tif replica, err = raft.New(config); err != nil {\n\t\treturn cli.NewExitError(err.Error(), 1)\n\t}\n\n\t// TODO: uptime is only for benchmarking, remove when stable\n\tif uptime := c.Duration(\"uptime\"); uptime > 0 {\n\t\ttime.AfterFunc(uptime, func() {\n\t\t\tif path := c.String(\"outpath\"); path != \"\" {\n\t\t\t\textra := make(map[string]interface{})\n\t\t\t\textra[\"replica\"] = replica.Name\n\t\t\t\textra[\"version\"] = raft.PackageVersion\n\n\t\t\t\tquorum := make([]string, 0, len(config.Peers))\n\t\t\t\tfor _, peer := range config.Peers {\n\t\t\t\t\tquorum = append(quorum, peer.Name)\n\t\t\t\t}\n\t\t\t\textra[\"quorum\"] = quorum\n\n\t\t\t\tif err = replica.Metrics.Dump(path, extra); err != nil {\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tos.Exit(0)\n\t\t})\n\t}\n\n\tif err = replica.Listen(); err != nil {\n\t\treturn cli.NewExitError(err.Error(), 1)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e5f8dee6bc5cd861c131edaf51051bb6", "score": "0.4162374", "text": "func (w Worker) Run() {\n\tcreds := &gomatrix.ReqLogin{\n\t\tType: \"m.login.password\",\n\t\tUser: w.opts.User,\n\t\tPassword: w.opts.Password,\n\t}\n\n\tcli, _ := gomatrix.NewClient(w.opts.HomeServer, \"\", \"\")\n\tcli.Login(creds, true)\n\n\tsyncer := cli.Syncer.(*gomatrix.DefaultSyncer)\n\tsyncer.OnEventType(\"m.room.message\", func(ev *gomatrix.Event) {\n\t\tif ev.Sender != cli.UserID {\n\t\t\tfmt.Printf(\"[Matrix]: %s: %s\\n\", ev.Sender, ev.Content[\"body\"])\n\t\t\tsplit := strings.Split(ev.Content[\"body\"].(string), \":\")\n\t\t\tname, value := split[0], split[1]\n\t\t\tw.Put(\n\t\t\t\tevent.Event{\n\t\t\t\t\tName: name,\n\t\t\t\t\tValue: value,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t})\n\n\tvar roomID string\n\tif resp, err := cli.JoinRoom(w.opts.Room, \"\", nil); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\troomID = resp.RoomID\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tevent := w.Get()\n\t\t\tmsg := fmt.Sprintf(\"%s:%s\", event.Name, event.Value)\n\t\t\tcli.SendText(roomID, msg)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor {\n\t\t\tif err := cli.Sync(); err != nil {\n\t\t\t\tfmt.Println(\"Sync() returned \", err)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "62556dea8703070f783cdefecaf280b5", "score": "0.41606793", "text": "func (k *EKF) Run(x, u, z mat.Vector) (filter.Estimate, error) {\n\tpred, err := k.Predict(x, u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\test, err := k.Update(pred.Val(), u, z)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn est, nil\n}", "title": "" }, { "docid": "e00da907131ab8ec97de2124271dda41", "score": "0.41602778", "text": "func (r *ReadCommand) Run() error {\n\tres, err := MediaDbClient.Read(r.ID, r.MediaType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, media := range res {\n\t\tStdoutLogger.Println(media)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "af8cd9c664230555cb26c41a0fbf51fe", "score": "0.4158215", "text": "func (opt Opts) RunWatch() {\n\t// check if contest id is present\n\tif opt.contest == \"\" {\n\t\tpkg.Log.Error(\"No contest id found\")\n\t\treturn\n\t}\n\t// header formatting for table\n\theaderfmt := pkg.Blue.Add(color.Underline).SprintfFunc()\n\n\tif opt.SubCnt == 0 {\n\t\t// submissions aren't specified to be parsed\n\t\t// parse contest solve status instead\n\n\t\t// fetch contest solve status\n\t\tdata, err := cln.WatchContest(opt.contest, opt.link)\n\t\tpkg.PrintError(err, \"Failed to extract contest solve status\")\n\n\t\t// init table with header + color\n\t\ttbl := uitable.New()\n\t\ttbl.AddRow(headerfmt(\"#\"), headerfmt(\"Name\"),\n\t\t\theaderfmt(\" \"), headerfmt(\"Count\"))\n\t\ttbl.MaxColWidth = 40\n\t\ttbl.Separator = \" | \"\n\n\t\t// iterate over each row of data\n\t\tfor _, prob := range data {\n\t\t\tif prob.ID != strings.ToUpper(opt.problem) && opt.problem != \"\" {\n\t\t\t\t// skip row, if doesn't match query\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.Index(prob.Count, \"x\") != -1 {\n\t\t\t\t//remove rune char from solve count text\n\t\t\t\tprob.Count = prob.Count[strings.Index(prob.Count, \"x\"):]\n\t\t\t} else {\n\t\t\t\tprob.Count = \"\"\n\t\t\t}\n\t\t\t// set color to be printed based on solved status\n\t\t\tclean := func(status string) string {\n\t\t\t\tswitch status {\n\t\t\t\tcase \"accepted-problem\":\n\t\t\t\t\treturn pkg.Green.Sprint(\"AC\")\n\t\t\t\tcase \"rejected-problem\":\n\t\t\t\t\treturn pkg.Red.Sprint(\"RE\")\n\t\t\t\tdefault:\n\t\t\t\t\treturn \"NA\"\n\t\t\t\t}\n\t\t\t}\n\t\t\t// insert row to table\n\t\t\ttbl.AddRow(prob.ID, prob.Name, clean(prob.Status), prob.Count)\n\t\t}\n\t\tfmt.Println(tbl)\n\n\t} else {\n\t\t// infinite loop till verdicts declared\n\t\tpkg.LiveUI.Start()\n\t\tfor {\n\t\t\t// timer to fetch data in interval of 1 second\n\t\t\tstart := time.Now()\n\t\t\t// fetch contest submission status\n\t\t\tdata, err := cln.WatchSubmissions(opt.contest, opt.problem, opt.link)\n\t\t\tpkg.PrintError(err, \"Failed to extract submissions in contest\")\n\n\t\t\t// create new table\n\t\t\ttbl := uitable.New()\n\t\t\ttbl.MaxColWidth = 20\n\t\t\ttbl.Separator = \" | \"\n\t\t\ttbl.AddRow(headerfmt(\"#\"), headerfmt(\"When\"), headerfmt(\"Name\"), headerfmt(\"Lang\"),\n\t\t\t\theaderfmt(\"Verdict\"), headerfmt(\"Time\"), headerfmt(\"Memory\"))\n\n\t\t\t// do there exist submissions with pending verdicts?\n\t\t\tisPending := false\n\t\t\tfor i, sub := range data {\n\t\t\t\t// break if exceeds reqd capacity\n\t\t\t\tif i >= opt.SubCnt {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// insert row into table\n\t\t\t\tsub.Verdict = prettyVerdict(sub.Verdict)\n\t\t\t\ttbl.AddRow(sub.ID, sub.When, sub.Name, sub.Lang, sub.Verdict, sub.Time, sub.Memory)\n\t\t\t\t// update pending status\n\t\t\t\tif sub.Waiting == \"true\" {\n\t\t\t\t\tisPending = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tpkg.LiveUI.Print(tbl.String())\n\n\t\t\tif isPending == false {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttime.Sleep(time.Second - time.Since(start))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "232956ac70ba9a91f1edde2ede37fec2", "score": "0.415591", "text": "func (h *perfGetByVersionHandler) Run(ctx context.Context) gimlet.Responder {\n\tperfResults, err := h.sc.FindPerformanceResultsByVersion(h.version, h.interval, h.tags...)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Error getting performance results by version '%s'\", h.version))\n\t}\n\treturn gimlet.NewJSONResponse(perfResults)\n}", "title": "" } ]
ae8b4847680815deea0a32f51e466482
IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of InNoneMatch.
[ { "docid": "dd1143756976b249d8d1ad34e87082f7", "score": "0.0", "text": "func (c *PurchasesVoidedpurchasesListCall) IfNoneMatch(entityTag string) *PurchasesVoidedpurchasesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" } ]
[ { "docid": "d9f3336f892addb901cfe73e98b6bba5", "score": "0.7739107", "text": "func (c *DevicesUpdateOwnerCall) IfNoneMatch(entityTag string) *DevicesUpdateOwnerCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "33508bfc082f14abd7cf4287b4fc01ef", "score": "0.7653256", "text": "func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "aaa3a164afc02cf9b86e68dfb36142bb", "score": "0.76442957", "text": "func (c *InspectOperationsGetCall) IfNoneMatch(entityTag string) *InspectOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "fe1e5efd3143c7bfd6e30be2f73861eb", "score": "0.76235616", "text": "func (c *SpacesFindDirectMessageCall) IfNoneMatch(entityTag string) *SpacesFindDirectMessageCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0dcda6766a2b917de5db43fd8fda5720", "score": "0.7601711", "text": "func (c *ProjectsLocationsModelsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "45626cff1b9cd21ddb7c66b63b4bea84", "score": "0.7597449", "text": "func (c *ProjectsLocationsOsPolicyAssignmentsListRevisionsCall) IfNoneMatch(entityTag string) *ProjectsLocationsOsPolicyAssignmentsListRevisionsCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "779acf62fe554feaddef6f95d6344ef6", "score": "0.7595638", "text": "func (c *ProjectsLocationsModelsListVersionsCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsListVersionsCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "9e1fe9b57e0e1e329a71233ec5865f8b", "score": "0.75580835", "text": "func (c *RollingUpdatesGetCall) IfNoneMatch(entityTag string) *RollingUpdatesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2cf82878ab8ad89edf4cc477f1dd7507", "score": "0.7552073", "text": "func (c *SpacesGetCall) IfNoneMatch(entityTag string) *SpacesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "065589b1018ae9311ec731e83c751142", "score": "0.7534782", "text": "func (c *PeopleGetCall) IfNoneMatch(entityTag string) *PeopleGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "9f6b329fed1be3a452ff0f367500f341", "score": "0.75194615", "text": "func (c *EditsListingsGetCall) IfNoneMatch(entityTag string) *EditsListingsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2b76efc779f4b13ee50fe3974c5c3e6f", "score": "0.7518166", "text": "func (c *EditsGetCall) IfNoneMatch(entityTag string) *EditsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "7e21074993997a1bd743ec52866d4eeb", "score": "0.7494999", "text": "func (c *PhotoGetCall) IfNoneMatch(entityTag string) *PhotoGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b441276f39267672b170f66cd02c0fe1", "score": "0.7489348", "text": "func (c *RmasGetCall) IfNoneMatch(entityTag string) *RmasGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "801381a39ecd1f3a1034e1d0aa5ef5ed", "score": "0.74838984", "text": "func (c *RollingUpdatesListInstanceUpdatesCall) IfNoneMatch(entityTag string) *RollingUpdatesListInstanceUpdatesCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2418e3c0f27e78082ccbcc350f48c06b", "score": "0.7483455", "text": "func (c *EditsDetailsGetCall) IfNoneMatch(entityTag string) *EditsDetailsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "035a916aed5fb67f1865aae855986b36", "score": "0.74813575", "text": "func (c *DataGetCall) IfNoneMatch(entityTag string) *DataGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "d5913abc754f7333a2e649fde775c845", "score": "0.74766976", "text": "func (c *AttributesGetCall) IfNoneMatch(entityTag string) *AttributesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ff54730016002d4bf6ca19e8989ec10a", "score": "0.74763966", "text": "func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ff54730016002d4bf6ca19e8989ec10a", "score": "0.74763966", "text": "func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ff54730016002d4bf6ca19e8989ec10a", "score": "0.74763966", "text": "func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "870288f24792470770634df7727e7636", "score": "0.744835", "text": "func (c *InspectResultsFindingsListCall) IfNoneMatch(entityTag string) *InspectResultsFindingsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "be978962802e409e8746601d45f4d8d4", "score": "0.744747", "text": "func (c *DetectionsListCall) IfNoneMatch(entityTag string) *DetectionsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "529c1275070fd58bbaf5bfacb1964706", "score": "0.74294674", "text": "func (c *ProjectsLocationsModelsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8ec1aea4b09a71eccf5d554f56611002", "score": "0.74166167", "text": "func (c *EditsExpansionfilesGetCall) IfNoneMatch(entityTag string) *EditsExpansionfilesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "000dc1a8511f7c63960b02c79b0a07f4", "score": "0.7410654", "text": "func (c *AccountsGetCall) IfNoneMatch(entityTag string) *AccountsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "bc0b58236310eaa8a83f689679e8e3c6", "score": "0.7408149", "text": "func (c *EditsApksListCall) IfNoneMatch(entityTag string) *EditsApksListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "bea3158082a8f3a6151702852b56ff4f", "score": "0.74075794", "text": "func (c *ProjectsVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsVersionsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "4dd280d14eedf01293d4e72b72a81c91", "score": "0.7405871", "text": "func (c *RmasListCall) IfNoneMatch(entityTag string) *RmasListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "02f5bd57ae5e751b250cb9765e0d4f7f", "score": "0.74033296", "text": "func (c *EditsTestersGetCall) IfNoneMatch(entityTag string) *EditsTestersGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7401622", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d5d64c4c5d90f45d93a04ced5c04d49", "score": "0.7401622", "text": "func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "cf7bc744be7a137df2e77f3a02d0f9eb", "score": "0.7394602", "text": "func (c *ResellernotifyGetwatchdetailsCall) IfNoneMatch(entityTag string) *ResellernotifyGetwatchdetailsCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "6c75477f85ebaa73a23c7acf5083c59f", "score": "0.7382213", "text": "func (c *InspectOperationsListCall) IfNoneMatch(entityTag string) *InspectOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "7ae25c5f21a2d76cca025f238ba2434a", "score": "0.7379819", "text": "func (c *PeopleGetBatchGetCall) IfNoneMatch(entityTag string) *PeopleGetBatchGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "98dd0f04ae0c4ea2fbe8cbc317babf41", "score": "0.7379757", "text": "func (c *PublishersModelsGetCall) IfNoneMatch(entityTag string) *PublishersModelsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "25c71131db3f906dcfe25944ab64918f", "score": "0.7366714", "text": "func (c *PhotosBatchGetCall) IfNoneMatch(entityTag string) *PhotosBatchGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "04d87b37280a5c39723a4b4d59790ac5", "score": "0.73667103", "text": "func (c *ReviewsGetCall) IfNoneMatch(entityTag string) *ReviewsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "709faefb735a2e96c3659b442c8e4dfd", "score": "0.736523", "text": "func (c *GetConfigCall) IfNoneMatch(entityTag string) *GetConfigCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c07a285ef2d175d1f82c531adfb2cb77", "score": "0.7361061", "text": "func (c *UrlNotificationsGetMetadataCall) IfNoneMatch(entityTag string) *UrlNotificationsGetMetadataCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c998ca261fb9a7646c010fb13c72a2f8", "score": "0.7353039", "text": "func (c *ProjectsLocationsReplaysOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsReplaysOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "2108860e2f89acf1925521d2d50a0aff", "score": "0.7350168", "text": "func (c *JwksGetCall) IfNoneMatch(entityTag string) *JwksGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b2769d7dfb761aa9290633048f5faed8", "score": "0.734795", "text": "func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c60afb5871e17c5085bb1e4fedd9dda4", "score": "0.73334354", "text": "func (c *AccountsAdunitsGetCall) IfNoneMatch(entityTag string) *AccountsAdunitsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8c6dede50088836f6e089ef73850bb97", "score": "0.73318046", "text": "func (c *OrganizationsLocationsReplaysOperationsGetCall) IfNoneMatch(entityTag string) *OrganizationsLocationsReplaysOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "667ec79e681b0ee603b04f50bb15f5b6", "score": "0.7328697", "text": "func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "d8153c62dbd63eeb489577ab6ee09ee4", "score": "0.7327748", "text": "func (c *GetRefsCall) IfNoneMatch(entityTag string) *GetRefsCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "331ec7dfb3817fbfce4eed6e6d2c91f6", "score": "0.7324574", "text": "func (c *DebuggerDebuggeesListCall) IfNoneMatch(entityTag string) *DebuggerDebuggeesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a997c136f9276629c4054fade7a40a59", "score": "0.732214", "text": "func (c *RollingUpdatesListCall) IfNoneMatch(entityTag string) *RollingUpdatesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "73e9a8527b92bbfcbe28f8a61f58da1b", "score": "0.7320339", "text": "func (c *SystemapksVariantsDownloadCall) IfNoneMatch(entityTag string) *SystemapksVariantsDownloadCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "99e2a91e3779221ffbd404fbff2842d9", "score": "0.7313945", "text": "func (c *ManagementWebpropertiesListCall) IfNoneMatch(entityTag string) *ManagementWebpropertiesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "528154dc5ae26b9a9e1d87f59ef97840", "score": "0.7313466", "text": "func (c *ExternaltransactionsGetexternaltransactionCall) IfNoneMatch(entityTag string) *ExternaltransactionsGetexternaltransactionCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "5e7158086d0485bcba3163c04cd279c2", "score": "0.73077905", "text": "func (c *PhotosListCall) IfNoneMatch(entityTag string) *PhotosListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "20525a9d27b85c6eed28a8e04a40a65f", "score": "0.73020905", "text": "func (c *ProjectsServicesGetCall) IfNoneMatch(entityTag string) *ProjectsServicesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a14af19b6cc9de3b52acd043b6f5d89a", "score": "0.72966576", "text": "func (c *ProjectsLocationsModelsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "1fd97e624ddaac45e2a9dae162c484f4", "score": "0.7290294", "text": "func (c *OrganizationsOperationsGetCall) IfNoneMatch(entityTag string) *OrganizationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f64654df24b1da67106ab3c37ea742ec", "score": "0.7282351", "text": "func (c *OrganizationsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *OrganizationsLocationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a67483601190ac32f94bf0b9eb5e7955", "score": "0.7280784", "text": "func (c *RiskAnalysisOperationsGetCall) IfNoneMatch(entityTag string) *RiskAnalysisOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a1659162b6ab2f02f747d78398299a12", "score": "0.7280668", "text": "func (c *RolloutGetCall) IfNoneMatch(entityTag string) *RolloutGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "6e1af57d207fd45e4719c7599e05fb6e", "score": "0.7270388", "text": "func (c *SpacesListCall) IfNoneMatch(entityTag string) *SpacesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "a19227cd145beb13e34b6e14c8a31e4e", "score": "0.72608674", "text": "func (c *FoldersLocationsReplaysOperationsGetCall) IfNoneMatch(entityTag string) *FoldersLocationsReplaysOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b4a00d8602515a87c2d713b4b43ff813", "score": "0.7259218", "text": "func (c *ProcessesListScriptProcessesCall) IfNoneMatch(entityTag string) *ProcessesListScriptProcessesCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "df9f795b4cc7342ef97dac85f8220c4a", "score": "0.7251503", "text": "func (c *SpacesMembersGetCall) IfNoneMatch(entityTag string) *SpacesMembersGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "cc02c63fa3cea06574a8a36210a1abb3", "score": "0.72512585", "text": "func (c *AdclientsGetCall) IfNoneMatch(entityTag string) *AdclientsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f8b5af4010425a89860d4d39391f3f0d", "score": "0.724518", "text": "func (c *EditsListingsListCall) IfNoneMatch(entityTag string) *EditsListingsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f8f544ad3c956de36ac5b7659c1eee67", "score": "0.72419703", "text": "func (c *TranslationsListCall) IfNoneMatch(entityTag string) *TranslationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "94ffcd3315f729f382947a82e47855dc", "score": "0.7241245", "text": "func (c *ManagementAccountsListCall) IfNoneMatch(entityTag string) *ManagementAccountsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b6d12c675671a82545e69546651c11cf", "score": "0.72396886", "text": "func (c *ProjectsLocationsModelsEvaluationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsEvaluationsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "282114a4c14b67db9cefb15d4b414100", "score": "0.72343254", "text": "func (c *ProjectsAgentSearchCall) IfNoneMatch(entityTag string) *ProjectsAgentSearchCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0563fc452b820d68c7b0872022e8d41e", "score": "0.7232472", "text": "func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0563fc452b820d68c7b0872022e8d41e", "score": "0.7232472", "text": "func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "fedb10930c93fa5480715829d8739100", "score": "0.7226871", "text": "func (c *ProductsGetCall) IfNoneMatch(entityTag string) *ProductsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f695d724d7c3b6a84ca11d0c47ccd4e9", "score": "0.72210693", "text": "func (c *ProjectsLocationsEndpointsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsEndpointsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "dd3890a93f40b8ee94007b76a25a1360", "score": "0.72187024", "text": "func (c *CasesSuggestNoteHeadersCall) IfNoneMatch(entityTag string) *CasesSuggestNoteHeadersCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d406e66868c1ad5fa2b54992a90b29c", "score": "0.7217263", "text": "func (c *ProjectsRegionsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsRegionsOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "c484c476de3c3e09aacf4074b5720a01", "score": "0.7212397", "text": "func (c *ProjectsVersionsListCall) IfNoneMatch(entityTag string) *ProjectsVersionsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "89b9ee62859dafd7241e29bccee9df07", "score": "0.72111934", "text": "func (c *ProjectsLocationsInstancesInventoriesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesInventoriesListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "190f9a6cec8c635ff13880ae47eb04de", "score": "0.72106993", "text": "func (c *SpacesMessagesGetCall) IfNoneMatch(entityTag string) *SpacesMessagesGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8fb1f7494d2afbe34b0559a9c28b471a", "score": "0.7206548", "text": "func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "da8940d62e6e450e8651af4e3ff8a4f2", "score": "0.7205182", "text": "func (c *AccountsClientsGetCall) IfNoneMatch(entityTag string) *AccountsClientsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "573c423a5a5e26a518beffa8c3bd8ad0", "score": "0.7202685", "text": "func (c *AccountsListCall) IfNoneMatch(entityTag string) *AccountsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "b640fc1e5ee57f49b4903843418f8e2a", "score": "0.7194155", "text": "func (c *AgentSettingsGetCall) IfNoneMatch(entityTag string) *AgentSettingsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "ef5a780f857b34967dd2fbaf5b69336f", "score": "0.71925473", "text": "func (c *SystemapksVariantsGetCall) IfNoneMatch(entityTag string) *SystemapksVariantsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "e46ac7b43f04247f8b6a908f1873c633", "score": "0.71898717", "text": "func (c *ReviewsListCall) IfNoneMatch(entityTag string) *ReviewsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "d4728ce1d8426d54086a90bb28c1bbbb", "score": "0.71890515", "text": "func (c *ProjectsLocationsMigratableResourcesOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsMigratableResourcesOperationsGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "f11c6e40ed71a38677322371aba34896", "score": "0.71769273", "text": "func (c *GetConfigByHashCall) IfNoneMatch(entityTag string) *GetConfigByHashCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "0684e46fe52b1a9570603f19ffc39522", "score": "0.7173497", "text": "func (c *ProjectsLocationsReplaysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsReplaysGetCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8fb1bdcdcd718994a6f4147651dcf85f", "score": "0.7169258", "text": "func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8fb1bdcdcd718994a6f4147651dcf85f", "score": "0.7169258", "text": "func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "8fb1bdcdcd718994a6f4147651dcf85f", "score": "0.7169258", "text": "func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" }, { "docid": "3d8c544c56a9008d69565cb1cfa10e48", "score": "0.71668416", "text": "func (c *ProjectsRegionsOperationsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsRegionsOperationsGetIamPolicyCall {\n\tc.ifNoneMatch_ = entityTag\n\treturn c\n}", "title": "" } ]
1b1b67f3a9fcdd0ba4d1ab0694fec5bd
New creates a new runner that plays until numWins games have been won
[ { "docid": "df52964d1b2586009cc652f1acd33417", "score": "0.76832014", "text": "func New(numWins uint64) runners.Runner {\n\treturn func(gg runners.GameGen, play players.Player) {\n\t\tvar totalGamesToWin uint64\n\t\tvar totalMovesToWin uint64\n\t\tvar totalWinningScore uint64\n\n\t\tfor i := uint64(0); i < numWins; i++ {\n\t\t\tg := &game.Game{}\n\t\t\tvar numGames uint64\n\t\t\tvar numMoves uint64\n\t\t\tstart := time.Now()\n\n\t\t\tfor g.State() != game.StateWon {\n\t\t\t\tg = gg()\n\t\t\t\tplay(g)\n\n\t\t\t\tnumGames++\n\t\t\t\tnumMoves += g.TotalMoves()\n\n\t\t\t\tif numGames%1000 == 0 {\n\t\t\t\t\telapsed := time.Since(start)\n\t\t\t\t\tfmt.Printf(\"Played %v games in %v with an average %v moves to failure\\n\", numGames, elapsed, numMoves/numGames)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//fmt.Printf(\"\\nWinning took %v games\\n\", numGames)\n\t\t\t//fmt.Printf(\"\\nScore: %v\\tMoves: %v\\n\\n\", g.Score(), g.TotalMoves())\n\t\t\t//fmt.Println(g)\n\n\t\t\ttotalGamesToWin += numGames\n\t\t\ttotalMovesToWin += g.TotalMoves()\n\t\t\ttotalWinningScore += g.Score()\n\t\t}\n\n\t\tfmt.Printf(\"\\nAverage %v games to win\\n\", float64(totalGamesToWin)/float64(numWins))\n\t\tfmt.Printf(\"\\nAverage %v moves in winning games\\n\", float64(totalMovesToWin)/float64(numWins))\n\t\tfmt.Printf(\"\\nAverage %v score in winning games\\n\", float64(totalWinningScore)/float64(numWins))\n\t}\n}", "title": "" } ]
[ { "docid": "33222ca88a7b262375750319630c73dd", "score": "0.62371415", "text": "func newRound(c net.Conn) {\n\n\tif len(playerList) <= 2 { //Hvis det kun er to igjen, er dette finale.\n\t\tfinale(c)\n\t} else {\n\t\tclientcommunication.ClientPrintln(c, \"\\nDet er \"+strconv.Itoa(len(playerList)/2)+\" turneringsrunder igjen.\")\n\t\tclientcommunication.ClientPrintln(c, \"\\nTrykk enter for å starte neste turneringsrunde.\")\n\t\tproceed = clientcommunication.ClientRead(c)\n\t\tplayOffs(c, playerList)\n\t}\n}", "title": "" }, { "docid": "586033b38f0af634aa943a0a6f54e315", "score": "0.5949129", "text": "func NewGame() {\n\tprintGameIntro()\n\tfmt.Print(\"Enter number of players > \")\n\tvar numerOfPlayers int\n\tfmt.Scan(&numerOfPlayers)\n\tfmt.Println()\n\tplayers := createPlayers(&numerOfPlayers)\n\tplayingDeck := createDeck(&numerOfPlayers)\n\tofferChips(&players)\n\tdeal(&players, &playingDeck)\n\tstart(&players, &playingDeck)\n\treplay(&players, &playingDeck)\n}", "title": "" }, { "docid": "b59740723dcc64f2a9a32594accff447", "score": "0.59083825", "text": "func NewWinningStrategy(seed int64) Strategy {\n\treturn &WinningStrategy{\n\t\trandom: rand.New(rand.NewSource(seed)),\n\t\twon: false,\n\t}\n}", "title": "" }, { "docid": "685a08eaf14e1bb7282f86f0a3dd2879", "score": "0.5871849", "text": "func NewRunner(n int) *Runner {\n\tif n == 0 {\n\t\tn = runtime.NumCPU()\n\t}\n\treturn &Runner{\n\t\twidth: n,\n\t\tch: make(chan struct{}, n),\n\t}\n}", "title": "" }, { "docid": "b5a41b3348495547408fad18b2e4f0b3", "score": "0.5830417", "text": "func TestTournament_generateWinnerNum(t *testing.T) {\n\ttcNum := 5\n\tsameCount := 0\n\tprev := 0\n\n\ttour := Tournament{\n\t\tID: 123,\n\t\tDeposit: 123,\n\t\tParticipants: make([]*Player, 5),\n\t}\n\n\tfor i := 0; i < tcNum; i++ {\n\t\tgot := tour.generateWinnerNum()\n\t\tfmt.Println(got)\n\t\tif got == prev {\n\t\t\tsameCount++\n\t\t}\n\n\t\tif got < 0 || got > len(tour.Participants) {\n\t\t\tt.Fatalf(\"generated winner is out of range: got %d, limit %d\", got, len(tour.Participants))\n\t\t}\n\t\tprev = got\n\t}\n\n\tif sameCount == tcNum-1 {\n\t\tt.Errorf(\"get the same winners during all tests: test number %d\", len(tour.Participants))\n\t}\n}", "title": "" }, { "docid": "d963b535659b1c49fbfe0cc881893735", "score": "0.56950533", "text": "func NewGame(numberOfPlayers int) *CrazyEights {\n\tstandardDeck := deck.NewDeck()\n\tshuffledCards := standardDeck.ShuffleCards()\n\tplayers := make([]*player.Player, numberOfPlayers)\n\tfor i := 0; i < numberOfPlayers; i++ {\n\t\tplayers[i] = player.NewPlayer(i)\n\t}\n\n\treturn &CrazyEights{Players: players, DrawPile: shuffledCards, DiscardPile: make([]card.Card, 0)}\n}", "title": "" }, { "docid": "51906a18bcadffb41829882ecd1e78a1", "score": "0.5688297", "text": "func New(d time.Duration, numberOfWorker int) *Runner {\n\treturn &Runner{\n\t\tinterrupt: make(chan os.Signal, 1),\n\t\tcomplete: make(chan error),\n\t\ttimeout: time.After(d),\n\t\tcompleteMain: make(chan error),\n\t\tnumberOfWorker: numberOfWorker,\n\t}\n}", "title": "" }, { "docid": "181904fae208b05d211f3b851d401d0a", "score": "0.5651307", "text": "func (p *Player) Win() {\n\tp.strategy.study(true)\n\tp.wincount++\n\tp.gamecount++\n}", "title": "" }, { "docid": "3101e16c51585aef8cbba9be41397497", "score": "0.564462", "text": "func NewRunner() *Runner {\n\treturn &Runner{\n\t\ttimeout: 5 * time.Second,\n\t}\n}", "title": "" }, { "docid": "2f21000395d2c5bc2a088e906caf91bc", "score": "0.5642721", "text": "func newGame(player1 *WsConnection, player2 *WsConnection, questions []*models.Question) *Game {\n\tg := &Game{\n\t\tActive: false,\n\t\tPlayers: []*WsConnection{player1, player2},\n\t\tQuestions: questions,\n\t\tCursor: 0,\n\t\tRoundTimes: make([]time.Time, len(questions)),\n\t}\n\treturn g\n}", "title": "" }, { "docid": "573334978ca6634de32be1f9edba5e8c", "score": "0.5623105", "text": "func NewTurn(b Board, playerID int, rolls []int) (*Turn, int) {\n\tdoublesP := false\n\tif rolls[0] == rolls[1] {\n\t\t//TODO\n\t\t//IF ALL NOT ON STARTING SPOT\n\t\t//ROLLS = []int{14,14}\n\t\tdoublesP = true\n\t\treturn &Turn{rolls: rolls, doublesP: doublesP, board: b, playerID: playerID}, DOUBLESCODE\n\t}\n\treturn &Turn{rolls: rolls, doublesP: doublesP, board: b, playerID: playerID}, FINE\n}", "title": "" }, { "docid": "cf95fc026a90679d3a561efcaaa950d6", "score": "0.5588793", "text": "func New() *Runner {\n\treturn &Runner{\n\t\tsync.Mutex{},\n\t\tfalse,\n\t\tReasonInvalid,\n\t\tmake(<-chan time.Time),\n\t\tmake(chan error),\n\t\tmake(map[string]*runFuncInfo),\n\t}\n}", "title": "" }, { "docid": "338e5badb4af7d833c7eb74057b6950a", "score": "0.54559964", "text": "func (s *server) newGame(gameID string) *game {\n\treturn &game{\n\t\tgameID: gameID,\n\t\tin: make(chan userInput),\n\t\tout: s.out,\n\t\tplayers: make(map[string]*player),\n\t\twNotifyDur: 10 * time.Second,\n\t\twAreaDur: 30 * time.Second,\n\t\twMinPlayer: 3,\n\t\tbAreaDur: 5 * time.Second,\n\t\tmgRoundLeft: 5,\n\t\tmgNumRound: 5,\n\t\tmgAreaDur: 10 * time.Second,\n\t}\n}", "title": "" }, { "docid": "581fd093f5747b7374acce3d82269797", "score": "0.5319526", "text": "func NewWinner(name string) *Contender {\n\treturn &Contender{\n\t\tName: name,\n\t\tisLoser: false,\n\t}\n}", "title": "" }, { "docid": "85b1a48076e7a2037e8ae6a92936a7fd", "score": "0.5309728", "text": "func NewRunner() *Runner {\n\tnumWorkers := config.Datadog.GetInt(\"check_runners\")\n\n\tr := &Runner{\n\t\t// initialize the channel\n\t\tpending: make(chan check.Check),\n\t\trunningChecks: make(map[check.ID]check.Check),\n\t\trunning: 1,\n\t\tstaticNumWorkers: numWorkers != 0,\n\t}\n\n\tif !r.staticNumWorkers {\n\t\tnumWorkers = config.DefaultNumWorkers\n\t}\n\n\t// start the workers\n\tfor i := 0; i < numWorkers; i++ {\n\t\tr.AddWorker()\n\t}\n\n\tlog.Infof(\"Runner started with %d workers.\", numWorkers)\n\treturn r\n}", "title": "" }, { "docid": "abe9eb4ed95ecca894fe15d3e41039e0", "score": "0.5282844", "text": "func NewRunner() *Runner {\n\treturn &Runner{true, true, false}\n}", "title": "" }, { "docid": "7b86d2fd2c5240d884fc487c796d93fc", "score": "0.5281493", "text": "func NewGame(nPlayers int) *GameState {\n\tresult := &GameState{\n\t\tnPlayers: nPlayers,\n\t\tcurPlayer: 0,\n\t\tlastPlayer: -1,\n\t\tplayerNames: make([]string, nPlayers),\n\n\t\thints: 8,\n\t\tfails: 0,\n\n\t\tdeck: randomDeck(),\n\t\tdiscard: nil,\n\t\tplayerHands: make([][]Card, nPlayers),\n\n\t\tfieldStatus: [5]int{0, 0, 0, 0, 0},\n\t}\n\n\tfor i := range result.playerHands {\n\t\tresult.playerHands[i] = []Card{\n\t\t\tresult.drawCard(),\n\t\t\tresult.drawCard(),\n\t\t\tresult.drawCard(),\n\t\t\tresult.drawCard(),\n\t\t}\n\t\tif nPlayers <= 3 {\n\t\t\tresult.playerHands[i] = append(result.playerHands[i], result.drawCard())\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "3915ccef9b80949a0f13fd6fb6b8187f", "score": "0.52491975", "text": "func New(num int64, handler func(doc interface{})) *Runner {\n\tctx, cancel := context.WithCancel(context.Background())\n\tinterval := 1000 / num\n\to := &Runner{\n\t\tQueue: newQueue(),\n\t\tmaxNum: num,\n\t\tcurNum: 0,\n\t\tinterval: time.Duration(interval) * time.Millisecond,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\thandler: handler,\n\t}\n\treturn o\n}", "title": "" }, { "docid": "df897759f78546cd13c9e169f4ed407f", "score": "0.52461946", "text": "func Runner(a, b string) (winner string, erro error) {\n\treturn Config(a, b, limitOfTenSecond)\n}", "title": "" }, { "docid": "c79b4ed62953b58827266fa10cf3eb36", "score": "0.5245193", "text": "func NewRunner(opts ... RunnerOption) *Runner {\n\tr := &Runner{\n\t\twg: sync.WaitGroup{},\n\t\tdata: []func() (interface{}, error){},\n\t\tworkers: 100,\n\t\tticketPerSec: 1000,\n\t}\n\tfor _, opt := range opts {\n\t\topt(r)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "56207802f1fc7b42f75e8a097c25b12e", "score": "0.5241456", "text": "func New(count int, interval time.Duration, callback func() error) *Runner {\n\tjobs := make([]*job, count)\n\tfor i := 0; i < count; i++ {\n\t\tjob := newJob(i, interval, callback)\n\t\tjobs[i] = job\n\t}\n\treturn &Runner{\n\t\tjobs: jobs,\n\t\tquit: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "b8104b5897fde1e55482621f1d8de267", "score": "0.5189069", "text": "func (g *GameImpl) NewRound(player string, clear bool) bool {\n\tif clear && g.Round.IsPlaying(player) {\n\t\tif len(g.Round.PlayersReady(round.SeenResultStatus)) < g.NumPlayers() {\n\t\t\treturn false\n\t\t}\n\t\tg.Round = round.NewRound(g)\n\t}\n\tif player != \"\" {\n\t\tg.lastSeen[player] = time.Now()\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f511bbe5b3b22c82b63f9c4711b83e50", "score": "0.51829517", "text": "func NewGame(p1 Box) (*Game, error) {\n\tif p1 == Blank {\n\t\treturn nil, ErrInvalidPick\n\t}\n\n\treturn &Game{\n\t\tPlayer1: p1,\n\t\tPlayer2: Box(-int(p1)),\n\t\tCurrentTurn: p1,\n\t\tGrid: NewGrid(),\n\t\twon: false,\n\t}, nil\n}", "title": "" }, { "docid": "36ccd4ffc20e3b78595d6c73a3562d54", "score": "0.51682824", "text": "func (m *match) run() (wins, errs []int) {\n\t//setup results\n\tpc := len(m.players)\n\twins = make([]int, pc)\n\terrs = make([]int, pc)\n\n\t// notify all players match begin\n\tfor i, p := range m.players {\n\t\terr := p.MatchStart(m.matchID, 6, m.targetScore, m.gamesInMatch, i, m.playerNames)\n\t\tif err != nil {\n\t\t\tdebug(\"Error on match start: %v\\n\", err)\n\t\t\terrs[i]++\n\t\t}\n\t}\n\n\tfor i := 0; i < m.gamesInMatch; i++ {\n\t\t// make a new game\n\t\tm.nextGameNumber++\n\t\tm.startingPlayerIndex++\n\t\tif m.startingPlayerIndex >= len(m.players) {\n\t\t\tm.startingPlayerIndex = 0\n\t\t}\n\t\tg := NewGame(m.players, m.targetScore, m.matchID, strconv.Itoa(m.nextGameNumber), m.startingPlayerIndex)\n\n\t\tdebug(\"Game %v/%v: Start\", m.matchID, g.gameID)\n\t\tres, err := g.Run()\n\t\tif err != nil {\n\t\t\tdebug(\"Game %v/%v: End with Error by player %v:%v\", m.matchID, g.gameID, res.ErrIndex, err)\n\t\t\terrs[res.ErrIndex]++\n\t\t} else {\n\t\t\tdebug(\"Game %v/%v: End with Win by player %v\", m.matchID, g.gameID, res.WinnerIndex)\n\t\t\twins[res.WinnerIndex]++\n\t\t}\n\t}\n\n\t// notify players match end\n\tfor _, p := range m.players {\n\t\tp.MatchEnd(m.matchID, wins)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3a802eaa49ee33b237de22f759761570", "score": "0.51596504", "text": "func New(d time.Duration) *Runner {\n\treturn &Runner{\n\t\tinterrupt: make(chan os.Signal, 1), //必须有缓冲,否则接受不到操作系统的中断信号\n\t\tcomplete: make(chan error),\n\t\ttimeout: time.After(d),\n\t}\n}", "title": "" }, { "docid": "ecae82f5c57e44ecfcaafd255d3104bc", "score": "0.51346", "text": "func StartNewRound(roomCode string, selectedPlayer string) []byte {\n\troom := roomToPlayersMap[roomCode]\n\n\tevt := event.CreateNewRoundEvent(selectedPlayer)\n\n\tfor playerName := range room.Players {\n\t\troom.Players[playerName].ClientSession.Write(evt)\n\t}\n\n\treturn evt\n}", "title": "" }, { "docid": "28505a1df5a94f40b53caedbdc849000", "score": "0.5133784", "text": "func newPlayer(name string) *player {\n\tAllUsers.mu.Lock()\n\tdefer AllUsers.mu.Unlock()\n\tAllUsers.Users[name].mu.Lock()\n\tdefer AllUsers.Users[name].mu.Unlock()\n\tAllUsers.Users[name].plr = player{}\n\tAllUsers.Users[name].plr.mu.Lock()\n\tdefer AllUsers.Users[name].plr.mu.Unlock()\n\tAllUsers.Users[name].plr.name = name\n\tAllUsers.Users[name].plr.inputCh = make(chan int)\n\tAllUsers.Users[name].plr.jokerChan = make(chan int)\n\tAllUsers.Users[name].plr.newMsg = make(chan struct{})\n\tAllUsers.Users[name].plr.sendScore = make(chan struct{})\n\tAllUsers.Users[name].plr.sendEnd = make(chan struct{})\n\tAllUsers.Users[name].plr.err = nil\n\treturn &AllUsers.Users[name].plr\n}", "title": "" }, { "docid": "f435bfb3b9abd607a7bfb899f143e856", "score": "0.5133419", "text": "func newRunner(t *testing.T, m testmatrix.Matrix) runner {\n\treturn runner{Runner: sup.NewRunner(t, m)}\n}", "title": "" }, { "docid": "e81afc70eac888e1d81fbeb968f6c7a1", "score": "0.5100606", "text": "func CreateGame(userID int64, newGame NewGame) *Errors {\n\tif newGame.Label == \"\" {\n\t\tlog.Debugf(\"Failed to create game due to lack of label.\")\n\t\treturn &Errors{NewGame: &NewGameError{\n\t\t\tLabel: []string{\"A label is required to start a game.\"},\n\t\t}}\n\t}\n\n\tif len(newGame.Players) <= 0 {\n\t\tlog.Debugf(\"Failed to create game due to lack of players.\")\n\t\treturn &Errors{NewGame: &NewGameError{\n\t\t\tPlayers: []string{\"At least one other player is required.\"},\n\t\t}}\n\t}\n\n\tgenericError := []string{\"Unable to create a new game at this time.\"}\n\tvar errors *Errors\n\tdb.WithTx(func(tx *sql.Tx) error {\n\t\tres, _ := tx.Exec(\n\t\t\t`INSERT INTO Games (completed_at_id , next_expiration)\n\t\t\t VALUES (NULL, NOW() + INTERVAL 2 DAY)`)\n\n\t\tgameID, err := res.LastInsertId()\n\t\tif err != nil {\n\t\t\terrors = &Errors{App: genericError}\n\t\t\treturn err\n\t\t}\n\n\t\t// Insert the first turn into the database. This turn will correspond to\n\t\t// the label in the new game request and will be logged as being performed\n\t\t// by the user that is creating the game.\n\t\t_, err = tx.Exec(\n\t\t\t`INSERT INTO Turns\n\t\t\t\t (account_id, game_id, is_complete, is_drawing, label, drawing)\n\t\t\t\t VALUES (?, ?, 1, 0, ?, '')`,\n\t\t\tuserID, gameID, newGame.Label)\n\t\tif err != nil {\n\t\t\terrors = &Errors{App: genericError}\n\t\t\treturn err\n\t\t}\n\n\t\t// Create a turn entry for each player (in a random order) in the Players\n\t\t// list of newGame, alternating drawing and label turns.\n\t\torder := rand.Perm(len(newGame.Players))\n\t\tfor i, v := range order {\n\t\t\tplayerID := newGame.Players[v]\n\t\t\tisDrawing := i%2 == 0\n\t\t\t_, err := tx.Exec(\n\t\t\t\t`INSERT INTO Turns\n\t\t\t\t ( account_id\n\t\t\t\t , game_id\n\t\t\t\t , is_complete\n\t\t\t\t , is_drawing\n\t\t\t\t , label\n\t\t\t\t , drawing\n\t\t\t\t ) VALUES (?, ?, 0, ?, '', '')`,\n\t\t\t\tplayerID, gameID, isDrawing)\n\t\t\tif err != nil {\n\t\t\t\terrors = &Errors{NewGame: &NewGameError{\n\t\t\t\t\tPlayers: []string{\"No such player id \" + playerID + \".\"},\n\t\t\t\t}}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn errors\n}", "title": "" }, { "docid": "dad3248f3894542c57896c91bccf93be", "score": "0.5093205", "text": "func TestNewGame(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\twant *Hangman\n\t}{\n\t\t// TODO: Add test cases.\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := NewGame(); !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"NewGame() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "66f0d5de29509e16402b52edfbe352d5", "score": "0.5074669", "text": "func New(ipAddress string) (*Game, error) {\n\t_, err := newGameRateDelay.Attempt(ipAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trand.Seed(time.Now().UnixNano())\n\tcode := generateCode(4)\n\tmanager.Lock()\n\tdefer manager.Unlock()\n\n\tg := &Game{\n\t\tgameState: gameState{\n\t\t\tCode: code,\n\t\t\tNamesPerPlayer: 3,\n\t\t\tStage: stagePregame,\n\t\t},\n\t}\n\treset(g, \"\")\n\n\ttime.AfterFunc(pollStatus, func() { cleanGame(g) })\n\n\tmanager.games = append(manager.games, g)\n\n\tlog.Printf(\"Game %s created\", g.Code)\n\treturn g, nil\n}", "title": "" }, { "docid": "a5ca31fa7c916e819aa253d29af221ea", "score": "0.50659883", "text": "func (match *Connect4Match) playGame(p1 AnyPlayer, p2 LearnedPlayer) {\n // create 2 board objects to protect the official board from player classes\n officialBoard := newBoard()\n scrapBoard := officialBoard.copy()\n //officialBoard.display()\n\n // while there are still moves left, and no one has won\n for (officialBoard.gameOver() == false) {\n scrapBoard = officialBoard.copy()\n //print(\"\\nPlayer \"); print(officialBoard.whosMove); print(\"'s turn\")\n\n // allow current player to make a move, based on their chooseMove function\n if (officialBoard.whosMove == 1) {match.move = p1.chooseMove(scrapBoard)\n } else {match.move = p2.chooseMove(scrapBoard)}\n //print(\"\\nPlayer \"); print(officialBoard.whosMove); print(\" plays in column \"); print(match.move);\n *match.moveSequence = *match.moveSequence + \" \" + strconv.Itoa(match.move)\n //fmt.Printf(\"\\nOfficial move sequence: %s\",*match.moveSequence)\n\n //update board and present it in console\n officialBoard.makeMove(match.move)\n\n //officialBoard.display()\n //time.Sleep(2 * time.Second)\n //time.Sleep(0)\n //print(\"\\n\\n\")\n }\n//fmt.Printf(\"\\nFinal match sequence: %s\",*match.moveSequence)\n // once the game is over, determine who (if any) the winner was and display it\n if (officialBoard.victory == true && officialBoard.whosMove == 2) {\n // player 1 won\n print(\"\\nPlayer 1 wins!\\n\")\n p2.updateLossData()\n }\n if (officialBoard.victory == true && officialBoard.whosMove == 1) {\n // player 2 won\n print(\"\\nPlayer 2 wins!\\n\")\n }\n if (officialBoard.victory == false) {\n // no more avilable moves, but no winner\n print(\"\\nNobody wins :(\\n\")\n // a draw isn't good enough, learn to improve from it as well\n p2.updateLossData()\n }\n\n\n}", "title": "" }, { "docid": "7974f00267941cc1b72479d5c8095669", "score": "0.506449", "text": "func (room *Room) Winners() (winners []int) {\n\tif room.done() {\n\t\treturn nil\n\t}\n\troom.wGroup.Add(1)\n\tdefer func() {\n\t\troom.wGroup.Done()\n\t}()\n\n\tmax := 0.\n\n\tplayers := room.Players.RPlayers()\n\tfor _, player := range players {\n\t\tif player.Points > max && !player.Died {\n\t\t\tmax = player.Points\n\t\t}\n\t}\n\n\twinners = make([]int, 0)\n\tfor index, player := range players {\n\t\tif player.Points == max && !player.Died {\n\t\t\tmax = player.Points\n\t\t\twinners = append(winners, index)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "92d4cfe01db08290864fd75306e0e36c", "score": "0.5057915", "text": "func playOffs(c net.Conn, remainingPlayers []tictactoe.Player) {\n\n\tvar games []string\n\tvar winners []tictactoe.Player\n\n\tfor i := 0; i < len(remainingPlayers)/2; i++ { //Printer ut de ulike matchuppene.\n\t\topponents := remainingPlayers[i].Name + \" vs \" + remainingPlayers[(len(remainingPlayers)-i)-1].Name\n\t\tgames = append(games, opponents)\n\t\tclientcommunication.ClientPrintln(c, strconv.Itoa(i+1)+\". match\"+\": \"+opponents)\n\t}\n\n\tfor i := 0; i < len(games); i++ { //Spiller ut turneringsrundens matcher\n\n\t\tclientcommunication.ClientPrintln(c, \"\\nNeste match:\")\n\t\tclientcommunication.ClientPrintln(c, \"\\n-- \"+games[i]+\" --\")\n\t\tclientcommunication.ClientPrintln(c, \"\\nTrykk enter for å starte matchen.\")\n\t\tproceed = clientcommunication.ClientRead(c)\n\n\t\t//Starter match. Den beste mot den dårligste, nest beste mot nest dårligste osv.\n\t\tmatchWinner := tictactoe.PlayGame(c, remainingPlayers[i], remainingPlayers[(len(remainingPlayers)-i)-1], simulation)\n\t\tclientcommunication.ClientPrintln(c, \"\\n##################################\")\n\t\tclientcommunication.ClientPrintln(c, \"Vinner av matchen: \"+matchWinner.Name)\n\t\tclientcommunication.ClientPrintln(c, \"##################################\")\n\n\t\t//legger til vinnerne i en egen slice\n\t\twinners = append(winners, matchWinner)\n\t}\n\n\tplayerList = winners //Oppdaterer listen med spillere som vant runden.\n\n\tnewRound(c) //Starter en ny runde hvis det ikke er kåret en vinner.\n\n}", "title": "" }, { "docid": "73bd7dc195eacf7c10def9def3327603", "score": "0.5031851", "text": "func (p *Player) create(arena *Arena) {\nRetry:\n\tfor {\n\t\tx, y := rand.Intn(arenaWidth), rand.Intn(arenaHeight)\n\t\tif arena[x][y] == SpaceType {\n\t\t\tp.pos = Coordinate{x, y}\n\t\t\tarena[x][y] = PlayerType + p.nr\n\t\t\tbreak Retry\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1b07a236c2796fdd6170043d186f51e", "score": "0.5029461", "text": "func newBoard(tiles TileMap, workers WorkerSet) board {\n\treturn board{\n\t\ttiles: tiles,\n\t\tworkers: workers,\n\t}\n}", "title": "" }, { "docid": "d651264f3d56218e25fca629f47f40b5", "score": "0.5019134", "text": "func NewGame(name string, url string, times ...string) Game {\n\tg := Game{Name: name, URL: url}\n\tif len(times) >= 1 {\n\t\tg.set(\"Main\", times[0])\n\t}\n\tif len(times) >= 2 {\n\t\tg.set(\"Extra\", times[1])\n\t}\n\tif len(times) >= 3 {\n\t\tg.set(\"Complete\", times[2])\n\t}\n\tif len(times) >= 4 {\n\t\tg.set(\"Average\", times[3])\n\t}\n\treturn g\n}", "title": "" }, { "docid": "8faa9591fd913feb8a7eac4801f4f8a1", "score": "0.500159", "text": "func NewRunner(config *structs.Config) (*Runner, error) {\n\trunner := &Runner{\n\t\tdoneChan: make(chan struct{}),\n\t\tconfig: config,\n\t}\n\treturn runner, nil\n}", "title": "" }, { "docid": "53f1596f1fbc866efb0f9ba815476975", "score": "0.49969673", "text": "func tournamentRunner(pop []Individual, c chan *Individual, signal chan bool) {\n\tdead := false\n\tfor dead != true {\n\t\tselect {\n\t\tcase dead = <-signal:\n\t\tdefault:\n\t\t\tbest := pop[rand.Intn(len(pop))]\n\t\t\tfor i := 0; i < Selection; i++ {\n\t\t\t\tcompetitor := pop[rand.Intn(len(pop))]\n\t\t\t\tif competitor.distance < best.distance {\n\t\t\t\t\tbest = competitor\n\t\t\t\t}\n\t\t\t}\n\t\t\tc <- &best\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bca86ed9c785f5aefa1ed32cb675ad5b", "score": "0.49929848", "text": "func (player *Player) takeTurn(roundIndex int) {\n\n\t//loop could be removed to allow for each player to take a turn in round, instead of each player exhausting their rolls\n\tfor !player.hasFinishedTurn() {\n\t\tfmt.Printf(\"\\n%s's turn\", player.playerName)\n\n\t\t//roll current round dice left\n\t\tplayer.populateRoundDice()\n\n\t\t//display to player kept dice & dice pool to choose from\n\t\tplayer.displayCurrentRoundDice()\n\n\t\t//allow the player to keep 1 - n amount of dice, where n is remaining pool to choose from\n\t\tplayer.chooseKeptDice()\n\t}\n\n\t//when all have been chosen, tally total and store it in roundScores\n\tplayer.tallyRoundScore(roundIndex)\n\tplayer.clearRound()\n}", "title": "" }, { "docid": "db4b1dfcb71b5f8b8e85277b33f41e8a", "score": "0.4975347", "text": "func (r *Round) winners() []*Card {\n\twinners := make([]*Card, 0, len(r.cards))\n\tfor _, card := range r.cards {\n\t\tif r.pattern.isWinner(card) {\n\t\t\twinners = append(winners, card)\n\t\t}\n\t}\n\treturn winners\n}", "title": "" }, { "docid": "66ae7e956dcfb05bd2abccfc0d2f33fc", "score": "0.49707896", "text": "func New(args ...string) *Runner {\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\tname := args[0]\n\targs = args[1:]\n\treturn NewWithName(name, args...)\n}", "title": "" }, { "docid": "f66ed1f7c73b3d04bd3b3d05a0afd7b1", "score": "0.49659553", "text": "func New(driver Driver) *Runner {\n\treturn &Runner{driver}\n}", "title": "" }, { "docid": "1fc58d54ad5bb426aea66542e4d9ca4d", "score": "0.49458724", "text": "func (s *Minesweeper) CreateGame(ctx context.Context, game *model.Game) (bool, string, error) {\n\tuserExist, err := s.cache.Get(ctx, game.UserName)\n\tcount := 0\n\tif err != nil || userExist == nil {\n\t\tfmt.Println(\"Username not exists: \" + game.UserName)\n\t\treturn false, \"\", dmmw.ErrUserNotFound\n\t}\n\n\tlastGame, err := s.cache.Get(ctx, game.UserName+\"_LastGame\")\n\tif err != nil {\n\t\tfmt.Println(\"Error getting last game\")\n\t\treturn false, \"\", dmmw.ErrInternalError\n\t}\n\tif lastGame == nil {\n\t\tcount = 1\n\t} else {\n\t\tbyteToInt, _ := strconv.Atoi(string(lastGame))\n\t\tcount = byteToInt + 1\n\t}\n\tgame.Name = fmt.Sprint(game.UserName+\"Game\", count)\n\tgame.Status = \"NEW\"\n\n\tif game.Rows == 0 {\n\t\tgame.Rows = model.DefaultRows\n\t}\n\n\tif game.Cols == 0 {\n\t\tgame.Cols = model.DefaultCols\n\t}\n\n\tif game.Mines == 0 {\n\t\tgame.Mines = model.DefaultMines\n\t}\n\n\tif game.Mines > model.MaxMines {\n\t\tgame.Mines = model.MaxMines\n\t}\n\n\tif game.Rows > model.MaxRows {\n\t\tgame.Rows = model.MaxRows\n\t}\n\tif game.Cols > model.MaxCols {\n\t\tgame.Cols = model.MaxCols\n\t}\n\n\tif game.Mines > (game.Cols * game.Rows) {\n\t\tgame.Mines = (game.Cols * game.Rows)\n\t}\n\n\tgameBytes := new(bytes.Buffer)\n\tjson.NewEncoder(gameBytes).Encode(game)\n\tGameToSave := []byte(gameBytes.Bytes())\n\n\tif err := s.cache.Set(ctx, game.Name, GameToSave, uint64(0)); err != nil {\n\t\tlog.Fatal(\"error saving in redis\")\n\t\treturn false, \"\", dmmw.ErrInternalError\n\t}\n\n\tif err := s.cache.Set(ctx, game.UserName+\"_LastGame\", []byte(strconv.Itoa(count)), uint64(0)); err != nil {\n\t\tlog.Fatal(\"error saving lastgame in redis\")\n\t}\n\n\tfmt.Println(\"Game saved sucessfully\")\n\treturn true, game.Name, nil\n}", "title": "" }, { "docid": "e5778de7ac54860b53aed4cbbadc4a72", "score": "0.49284962", "text": "func (cli *CLI) Run(factory *game.PlayerFactory, p1, p2 game.DescribedPlayer) {\n\tfmt.Fprintf(cli.rw, clear)\n\tfmt.Fprintf(cli.rw, title)\n\tfmt.Fprintln(cli.rw)\n\tcli.writeFunc()\n\tif p1 == nil {\n\t\tp1 = cli.choosePlayer(factory, game.Player1)\n\t}\n\tif p2 == nil {\n\t\tp2 = cli.choosePlayer(factory, game.Player2)\n\t}\n\ts := game.NewState(game.StandardRules, p1, p2)\n\tfor s.Winner() == game.NoPlayer {\n\t\tprintStateAndPrompt(cli.rw, s)\n\t\tcli.writeFunc()\n\t\tisHuman := false\n\t\tif s.CurrentPlayer() == game.Player1 && p1.Name() == \"human\" {\n\t\t\tplay := cli.promptPlay(s)\n\t\t\tp1 = factory.SpecialPlayer(\"human\", play)\n\t\t\tisHuman = true\n\t\t}\n\t\tif s.CurrentPlayer() == game.Player2 && p2.Name() == \"human\" {\n\t\t\tplay := cli.promptPlay(s)\n\t\t\tp2 = factory.SpecialPlayer(\"human\", play)\n\t\t\tisHuman = true\n\t\t}\n\t\ts = game.NewStateFromInfo(\n\t\t\ts.Rules(),\n\t\t\ts.CurrentPlayer(),\n\t\t\tp1, p2,\n\t\t\tpieces(s),\n\t\t)\n\t\ts = game.NextState(s)\n\t\tif cli.shouldWait && !isHuman {\n\t\t\tcli.waitForEnter()\n\t\t}\n\t}\n\tprintState(cli.rw, s)\n\tcli.writeFunc()\n}", "title": "" }, { "docid": "ee1d482691d35838469f2d2dded475c5", "score": "0.49275628", "text": "func loadGame(reader reader.Reader) model.Game {\n\tdata, _ := processInputData(reader)\n\tgame := model.NewGame()\n\tfor player, knockedDownPinsArr := range data {\n\t\tfor _, knockedDownPins := range knockedDownPinsArr {\n\t\t\tok := game.AddTryToPlayer(player, knockedDownPins)\n\t\t\tif !ok {\n\t\t\t\tlog.Panicf(\"Error processing: %v - %v\", player, knockedDownPins)\n\t\t\t}\n\t\t}\n\t}\n\treturn game\n}", "title": "" }, { "docid": "dc0594b9d61c8f0f8842a420cd1403f3", "score": "0.49095166", "text": "func NewGame(w http.ResponseWriter, r *http.Request) {\n\tsetupCorsResponse(&w, r)\n\n\tlevelStr := getParamString(\"level\", \"easy\", r)\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"level\": levelStr,\n\t\t\"client\": r.Header.Get(\"User-Agent\"),\n\t}).Debug(\"new game\")\n\n\tlevel := sudoku.StringToComplexity(levelStr)\n\n\tif level == sudoku.InvalidLevel {\n\t\tpreconditionFailedf(&w, \"the level \\\"%s\\\" is not valid\", levelStr)\n\t\treturn\n\t}\n\n\tgame = sudoku.NewGame(level)\n\tgameBin, err := json.Marshal(game)\n\tif err != nil {\n\t\tinternalErrorf(&w, \"error creating the game: %v\", err)\n\t\treturn\n\t}\n\n\tok(&w, gameBin)\n}", "title": "" }, { "docid": "5e031e0423df55df29351f865c7daba0", "score": "0.4904111", "text": "func NewRunner() *Runner {\n\treturn &Runner{\n\t\tPhases: []Phase{},\n\t}\n}", "title": "" }, { "docid": "0098de9ef265ce9b2a9801aaf56aa715", "score": "0.48990923", "text": "func NewRunner() *Runner {\n\treturn &Runner{\n\t\trunning: false,\n\t\tstart: make(chan string),\n\t\tdone: make(chan struct{}),\n\t\tmu: &sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "f7d4ef24e286e107ac6eee9ef175c7f8", "score": "0.48987702", "text": "func (r Runner) New(opts ...RunnerOptFn) Runner {\n\tnewRunner := r\n\tfor _, o := range opts {\n\t\tnewRunner = o(newRunner)\n\t}\n\treturn newRunner\n}", "title": "" }, { "docid": "59884b1c3947d19d702409b35e9bf139", "score": "0.48943034", "text": "func NewGame(l config.LevelConfig, username string) Game {\n\tnumLetters := l.NumLetters\n\tnumVowels := l.NumVowels\n\tls := NewLetterSet(numLetters, numVowels)\n\n\treturn Game{\n\t\tEnded: false,\n\t\tLetterset: ls.Letters,\n\t\tLettersetBonus: ls.Score(),\n\t\tStartTime: time.Now(),\n\t\tUsername: username,\n\t\tGameTime: l.GameTime,\n\t\tNumWords: l.NumWords,\n\t}\n}", "title": "" }, { "docid": "e1b6d389b10a564f4181e67865cc515f", "score": "0.48814315", "text": "func NewRunner(maxParallel int, capacity uint, failFast bool) *runner {\n\tconsumers := maxParallel\n\tif consumers < 1 {\n\t\tconsumers = 1\n\t}\n\tif capacity < 1 {\n\t\tcapacity = 1\n\t}\n\tr := &runner{\n\t\ttasks: make(chan *task, capacity),\n\t\tcancel: make(chan struct{}),\n\t\tmaxParallel: consumers,\n\t\tfailFast: failFast,\n\t}\n\tr.errors = make(map[int]error)\n\treturn r\n}", "title": "" }, { "docid": "b60c435d742f7683fb50181b5fff6a7e", "score": "0.48790607", "text": "func CreateGame(players []Player, deck Deck) Game {\n\tgame := Game{}\n\tburn1 := Card{}\n\tburn2 := Card{}\n\tburn3 := Card{}\n\tdeck.shuffle()\n\tmatch := Distribute(players, &deck, len(players))\n\tburn1 = deck.Burn()\n\tflop := deck.createFlop()\n\tburn2 = deck.Burn()\n\tturn := deck.createTurnOrRiver()\n\tburn3 = deck.Burn()\n\triver := deck.createTurnOrRiver()\n\tgame.flop = flop\n\tgame.match = match\n\tgame.turn = turn\n\tgame.river = river\n\tgame.currentDeck = deck\n\tgame.Burn1 = burn1\n\tgame.Burn2 = burn2\n\tgame.Burn3 = burn3\n\treturn game\n}", "title": "" }, { "docid": "fd5c2197979d7f3cc889883683dd9678", "score": "0.4876254", "text": "func NewRunner(newBuilder builder.Builder, mode string) (Runner, error) {\n\tnewRunner := Runner{\n\t\tLogger: Logger.New(),\n\t\tBuilder: newBuilder,\n\t\tSlacker: slack.NewSlackClient(newBuilder.Config.SlackOff),\n\t}\n\n\tif checkBuilderConfigurationNeeded(mode) {\n\t\tnewRunner.Collector = collector.NewCollector(newBuilder.MetricConfig, newBuilder.Config.AssumeRole)\n\t}\n\n\tnewRunner.FuncMapper = map[string]func() error{\n\t\t\"deploy\": newRunner.Deploy,\n\t\t\"delete\": newRunner.Delete,\n\t\t\"status\": newRunner.Status,\n\t\t\"update\": newRunner.Update,\n\t\t\"refresh\": newRunner.Refresh,\n\t}\n\n\treturn newRunner, nil\n}", "title": "" }, { "docid": "7ed1ee4d1a3d45a63a9065da21250368", "score": "0.4867014", "text": "func newscore(score int, whoo string, whyded int, winner bool) {\n\tif !readboard() {\n\t\treturn /* do the scoreboard\t */\n\t}\n\t/* if a winner then delete all non-winning scores */\n\tif cheat {\n\t\twinner = false /* if he cheated, don't let him win */\n\t}\n\tif winner {\n\t\tfor i := 0; i < SCORESIZE; i++ {\n\t\t\tif sco[i].Username == loginname {\n\t\t\t\tsco[i].Score = 0\n\t\t\t}\n\t\t}\n\t\ttaxes := int(float64(score) * TAXRATE)\n\t\tscore += 100000 * c[HARDGAME] /* bonus for winning */\n\t\t/*\n\t\t * if he has a slot on the winning scoreboard update it if\n\t\t * greater score\n\t\t */\n\t\tfor i := 0; i < SCORESIZE; i++ {\n\t\t\tif winr[i].Username == loginname {\n\t\t\t\tnew1sub(score, i, whoo, taxes)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * he had no entry. look for last entry and see if he has a\n\t\t * greater score\n\t\t */\n\t\tfor i := 0; i < SCORESIZE; i++ {\n\t\t\tif winr[i].Order == SCORESIZE-1 {\n\t\t\t\tnew1sub(score, i, whoo, taxes)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} else if !cheat { /* for not winning scoreboard */\n\t\t/*\n\t\t * if he has a slot on the scoreboard update it if greater\n\t\t * score\n\t\t */\n\t\tfor i := 0; i < SCORESIZE; i++ {\n\t\t\tif sco[i].Username == loginname {\n\t\t\t\tnew2sub(score, i, whoo, whyded)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * he had no entry. look for last entry and see if he has a\n\t\t * greater score\n\t\t */\n\t\tfor i := 0; i < SCORESIZE; i++ {\n\t\t\tif sco[i].Order == SCORESIZE-1 {\n\t\t\t\tnew2sub(score, i, whoo, whyded)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4190d267ba2c0cbbf66cc4e8421506b8", "score": "0.48636428", "text": "func GenerateGame(lines int, cols int, playerCount int) *Game {\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\tif lines <= 0 || cols <= 0 {\n\t\treturn nil\n\t}\n\n\tif playerCount < 1 {\n\t\treturn nil\n\t}\n\n\tworldMap := make([][]*TileInfo, lines)\n\tfor i := 0; i < lines; i++ {\n\t\tworldMap[i] = make([]*TileInfo, cols)\n\t}\n\taddResources(worldMap)\n\n\tplayers := make([]*Player, playerCount)\n\tgame := Game{worldMap, players}\n\tfor i := 0; i < playerCount; i++ {\n\t\tplayers[i] = new(Player)\n\t\tplayers[i].tiles = make([]*TileInfo, 0)\n\t\tplayers[i].game = &game\n\t\tplayers[i].notification = make(chan struct{})\n\n\t\tplayers[i].funds = 0.\n\t\tplayers[i].debt = 0.\n\t\tplayers[i].water = 0.\n\t\tplayers[i].carbon = 0.\n\t\tplayers[i].metal = 0.\n\t\tplayers[i].energy = 0.\n\t\tplayers[i].fuel = 0.\n\t\tplayers[i].oxygen = 0.\n\t\tplayers[i].chemicals = 0.\n\t}\n\n\treturn &game\n}", "title": "" }, { "docid": "e37701656b9b1b4de869732725b7522a", "score": "0.48628804", "text": "func newGame() *Game {\n\tgologger.SLogger.Println(\"Init NewGame\")\n\tgmOnce.Do(func() {\n\t\tgm = &Game{}\n\t})\n\treturn gm\n}", "title": "" }, { "docid": "a824e07327e73f340bc5503332e33cbd", "score": "0.48494643", "text": "func NewRunner() Runner {\n\treturn &defaultRunner{}\n}", "title": "" }, { "docid": "103c1c95847266950ad87d48eb57fcee", "score": "0.4832985", "text": "func (h *Handler) NewGame(w http.ResponseWriter, r *http.Request) {\n\tg := NewGame(h.pick())\n\n\tbuff, err := json.Marshal(g)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusExpectationFailed)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tif _, err := w.Write(buff); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusExpectationFailed)\n\t}\n}", "title": "" }, { "docid": "ebc63b6b2d321ba7c77e02feac4e1479", "score": "0.4830698", "text": "func (ss *Sim) NewRun() {\n\tss.InitRndSeed()\n\tss.Time.Reset()\n\tss.OpenTrainedWts(ss.Net.Net)\n\tss.InitStats()\n\tss.TrnTrlLog.SetNumRows(0)\n\tss.TrnEpcLog.SetNumRows(0)\n\tss.TstTrlLog.SetNumRows(0)\n\tss.TstEpcLog.SetNumRows(0)\n\tss.TstEpcTidyLog.SetNumRows(0)\n\tss.NeedsNewRun = false\n}", "title": "" }, { "docid": "8526e7b6ed6b35abaeb864e16dd7769b", "score": "0.48292285", "text": "func NewBot() string {\n\treturn botDB[rand.Intn(botDBSize)]\n}", "title": "" }, { "docid": "6a2401456f246d760dc86505b2f5be76", "score": "0.4820776", "text": "func NewRunner(options ...RunnerOption) Runner {\n\treturn newRunner(options...)\n}", "title": "" }, { "docid": "7e6e9fada5324a9d081b71ceafdb8088", "score": "0.48108387", "text": "func NewBoard(tileLanded chan tile.Tile,\n\ttopReached chan tile.Tile,\n\ttilePicked chan tile.Tile,\n\ttileMoved chan rune,\n\trefreshRequested chan string,\n\tclockTicked chan int) *Board {\n\tb := &Board{\n\t\ttileRow: 0,\n\t\ttileCol: width / 2,\n\t\ttileLanded: tileLanded,\n\t\ttopReached: topReached,\n\t\ttilePicked: tilePicked,\n\t\ttileMoved: tileMoved,\n\t\trefreshRequested: refreshRequested,\n\t\tclockTicked: clockTicked,\n\t\tsquares: initBoard(),\n\t}\n\tb.handleEvents(tilePicked, tileMoved, clockTicked)\n\treturn b\n}", "title": "" }, { "docid": "17dbbebe8bc291f1942b8374e705d6c0", "score": "0.48007092", "text": "func Tally(r io.Reader, w io.Writer) error {\n\n\tscanner := bufio.NewScanner(r)\n\tresults := make(games)\n\tformatHeader := \"%-31s|%4s|%4s|%4s|%4s|%3s\\n\"\n\tformatBody := \"%-31s|%3d |%3d |%3d |%3d |%3d\\n\"\n\n\tfmt.Fprintf(w, formatHeader, \"Team\", \"MP \", \"W \", \"D \", \"L \", \"P\")\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif len(line) <= 1 || line[0] == '#' {\n\t\t\tcontinue\n\t\t}\n\t\tresult := strings.Split(line, \";\")\n\t\tif len(result) != 3 {\n\t\t\treturn errors.New(\"incorrect commands\")\n\t\t}\n\n\t\tp1 := results[result[player1]]\n\t\tp2 := results[result[player2]]\n\n\t\tswitch result[played] {\n\t\tcase \"win\":\n\t\t\tp1.win++\n\t\t\tp2.loss++\n\t\tcase \"draw\":\n\t\t\tp1.draw++\n\t\t\tp2.draw++\n\t\tcase \"loss\":\n\t\t\tp1.loss++\n\t\t\tp2.win++\n\t\tdefault:\n\t\t\treturn errors.New(\"incorrect result\")\n\t\t}\n\n\t\tp1.player = result[player1]\n\t\tp2.player = result[player2]\n\t\tp1.points = p1.win*3 + p1.draw\n\t\tp2.points = p2.win*3 + p2.draw\n\n\t\tresults[result[player1]] = p1\n\t\tresults[result[player2]] = p2\n\t}\n\n\tbp := make([]team, len(results))\n\ti := 0\n\tfor k, v := range results {\n\t\tbp[i].player = k\n\t\tbp[i].points = v.points\n\t\ti++\n\t}\n\tsort.Slice(bp, func(i, j int) bool {\n\t\tif bp[i].points == bp[j].points {\n\t\t\treturn bp[i].player < bp[j].player\n\t\t}\n\t\treturn bp[i].points > bp[j].points\n\t})\n\n\tfor _, v := range bp {\n\t\tfmt.Fprintf(w, formatBody, v.player,\n\t\t\tresults[v.player].win+results[v.player].draw+results[v.player].loss,\n\t\t\tresults[v.player].win, results[v.player].draw, results[v.player].loss, v.points)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ede4f0b41cdaf26b9bed441921372adf", "score": "0.4790145", "text": "func newGame() *game {\n\tgameLog.Info(\"initializing new game...\")\n\n\tmapWidth, mapHeight := 70, 40\n\tg := game{\n\t\tinput: newInput(),\n\t\tmapW: mapWidth,\n\t\tmapH: mapHeight,\n\t\tcurr: newBlobMap(mapWidth, mapHeight),\n\t\tnext: newBlobMap(mapWidth, mapHeight),\n\t}\n\tg.addPlayer(\"david\", 'D', termbox.ColorBlue, 0, 0)\n\tg.addPlayer(\"enemy\", 'E', termbox.ColorRed, 20, 20)\n\n\t// Start players with random blob seeds\n\tblobsPerPlayer := 1\n\tfor _, pl := range g.players {\n\t\t// TODO: Random walk generate the blobs\n\t\tfor i := 0; i < blobsPerPlayer; i++ {\n\t\t\tx := rand.Intn(g.mapW)\n\t\t\ty := rand.Intn(g.mapH)\n\t\t\t// curr and next start the same\n\t\t\tg.curr[x][y] = pl\n\t\t\tg.next[x][y] = pl\n\t\t}\n\t}\n\n\treturn &g\n}", "title": "" }, { "docid": "923b34d9b5b4e0007a21ab66f4473526", "score": "0.47827387", "text": "func NewGame(height, width int, players []Player, nbFoodOnMap int) (*Game, error) {\n\tif height < 5 || width < 5 {\n\t\treturn nil, errors.New(\"size too small\")\n\t}\n\n\tg := &Game{\n\t\tboard: newBoard(height, width),\n\t\tPlayers: make(map[ID]playerInfo, len(players)),\n\t}\n\n\t// Init players\n\tfor i, p := range players {\n\t\tp.SetID(ID(i + 2))\n\t\tg.Players[ID(i+2)] = playerInfo{\n\t\t\tPlayer: p,\n\t\t\tsnake: newSnake(g.board, ID(i+2)),\n\t\t\tlife: 1,\n\t\t}\n\t}\n\n\t// Generate food\n\tfor i := 0; i <= nbFoodOnMap; i++ {\n\t\tg.newFood()\n\t}\n\treturn g, nil\n}", "title": "" }, { "docid": "af29e9d7d11afba5e3f4505025cd5d27", "score": "0.47810763", "text": "func HandlerNewGame(w http.ResponseWriter, r *http.Request) {\n\tvalues := r.URL.Query()\n\t// Print the query parameters for the logs.\n\tfmt.Println(values)\n\t// Extract the rows count from query parameter.\n\trows := net.ParamInt(values, \"rows\", DefaultRows)\n\t// Extract the columns count from query parameter.\n\tcols := net.ParamInt(values, \"columns\", DefaultColumns)\n\t// Extract the mines count from query parameter.\n\tmins := net.ParamInt(values, \"mines\", DefaultMines)\n\t// Generate a new board with the row, column and mine count.\n\tboard := mines.GenerateBoard(rows, cols, mins)\n\t// Print the board for the logs.\n\tPrint2D(board)\n\t// Returns the board as a json response.\n\tjson.NewEncoder(w).Encode(board)\n}", "title": "" }, { "docid": "5c6bcddf816f91f935a86d86b020e3be", "score": "0.47769558", "text": "func pickWinner() {\n\ttime.Sleep(30 * time.Second)\n\tmutex.Lock()\n\ttemp := tempBlocks\n\tmutex.Unlock()\n\n\tlotteryPool := []string{}\n\tif len(temp) > 0 {\n\n\t\t// slightly modified traditional proof of stake algorithm\n\t\t// from all validators who submitted a block, weight them by the number of staked tokens\n\t\t// in traditional proof of stake, validators can participate without submitting a block to be forged\n\t\n\t\tfor _, block := range temp {\n\t\t\t\n\t\t\t\t\tlotteryPool = append(lotteryPool, block.Validator)\n\t\n\t\t}\n\t\t// var m map[string]float64\n\t\t// m= make(map[string]float64)\n\t\t// var n int\n\t\t// n=1\n\t\tvar maxAcc float64\n\t\tmaxAcc =0\n\t\tvar lotteryWinner string\n\t\talgos := [3]string{\"euclidean\", \"manhattan\", \"cosine\"}\n\t\tdistances := [2]string{\"linear\", \"kdtree\"}\n\t\tfor _, miner := range lotteryPool {\n\t\t\tacc, err := getAccuracy(algos[rand.Intn(len(algos))],distances[rand.Intn(len(distances))], rand.Intn(4) + 1)\n\t\t\tfmt.Println(miner,acc)\n\t\t\tif err == nil {\n\t\t\t\tif acc>maxAcc {\n\t\t\t\t\tmaxAcc = acc\n\t\t\t\t\tlotteryWinner = miner\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t\n\t\t// randomly pick winner from lottery pool\n\t\t// s := rand.NewSource(time.Now().Unix())\n\t\t// r := rand.New(s)\n\t\t// lotteryWinner := lotteryPool[r.Intn(len(lotteryPool))]\n\t\t\n\t\t// add block of winner to blockchain and let all the other nodes know\n\t\ttransactionsSelected := getBestTransactions()\n\t\tblockCount++\n\t\tvalue, ok := countBlock[lotteryWinner]\n\t\tif ok {\n\t\t\tcountBlock[lotteryWinner] = value + 1\n\t\t} else {\n\t\t\tcountBlock[lotteryWinner] = 1\n\t\t}\n\t\tfmt.Println(\"The number of blocks mined by each of the validator is \",countBlock)\n\t\tfor _, block := range temp {\n\t\t\tif block.Validator == lotteryWinner {\n\t\t\t\tmutex.Lock()\n\t\t\t\tblock.Transactions = transactionsSelected\n\t\t\t\tBlockchain = append(Blockchain, block)\n\t\t\t\tmutex.Unlock()\n\t\t\t\tfor _ = range validators {\n\t\t\t\t\tannouncements <- \"\\nwinning validator: \" + lotteryWinner + \"\\n\"\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\telapsed := time.Since(start)\n\t\tif blockCount%5 == 0{\t\t\n\t\tlog.Printf(\"It took %s to mine the block\", elapsed)\n\t\t }\n\t}\n\tmutex.Lock()\n\ttempBlocks = []Block{}\n\tmutex.Unlock()\n}", "title": "" }, { "docid": "e65339332162047cf15ea96d2bdb9ecc", "score": "0.47675052", "text": "func New(opts ...RunnerOptFn) Runner {\n\tr := Runner{\n\t\tinitDur: defaultInitialBackoff,\n\t\tmaxDur: defaultMaxBackoff,\n\t\tmaxCalls: defaultMaxCalls,\n\t}\n\n\tfor _, o := range opts {\n\t\tr = o(r)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "d3f5e05ae6b91061cbc1f746365e0ef6", "score": "0.4760836", "text": "func New(p1, p2 string) Match {\n\treturn Match{\n\t\tPlayerOne: Player{\n\t\t\tName: p1,\n\t\t\tScore: 0,\n\t\t},\n\t\tPlayerTwo: Player{\n\t\t\tName: p2,\n\t\t\tScore: 0,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2ee4a1e273b647c1d09d59eec1f53017", "score": "0.47599655", "text": "func (r *Routine) NewRun(c *Crew) *RoutineRun {\n\treturn &RoutineRun{\n\t\tRoutine: r,\n\t\tCrew: c,\n\t}\n}", "title": "" }, { "docid": "8b72f034ec6309c30806a8142db32b59", "score": "0.47539857", "text": "func NewGame(gt GameType, player, token string) (g *Game, err error) {\n\tg = &Game{\n\t\tseed: time.Now().UnixNano(),\n\t\tGameType: gt,\n\t\tAgentDeck: AgentDeck(),\n\t\tPlayers: []*PlayerInfo{{}, {}},\n\t}\n\tg.Seed = fmt.Sprintf(\"%d\", g.seed)\n\trand.Seed(g.seed)\n\tswitch gt {\n\tcase BasicGame:\n\t\tg.IntelDeck = BasicDeck(false)\n\tcase MoleGame:\n\t\tg.IntelDeck = MoleDeck(false)\n\tcase WalrusGame:\n\t\tg.IntelDeck = BasicDeck(true)\n\tcase MoleWalrusGame:\n\t\tg.IntelDeck = MoleDeck(true)\n\tdefault:\n\t\treturn nil, fmt.Errorf(gt.String())\n\t}\n\n\tg.IntelDeck.Shuffle()\n\tg.AgentDeck.Shuffle()\n\n\tda := g.AgentDeckDraw()\n\tg.DoubleAgent = da\n\tif g.GameType != WalrusGame {\n\t\tg.Players[0].DoubleAgent = da\n\t\tg.Players[1].DoubleAgent = da\n\t}\n\n\tg.Players[0].Identity = g.AgentDeckDraw()\n\tg.Players[1].Identity = g.AgentDeckDraw()\n\tg.Players[0].Spy = g.AgentDeckDraw()\n\tg.Players[1].Spy = g.AgentDeckDraw()\n\n\tg.PlayerIds = append(g.PlayerIds, player)\n\tg.PlayerTokens = append(g.PlayerTokens, token)\n\tg.State = GameJoining\n\n\tg.StartHand(0)\n\treturn g, nil\n}", "title": "" }, { "docid": "b28afccd5eca2f60dbc68d908fb09904", "score": "0.4753253", "text": "func newBoard(m, n int) board {\n\tif m < 3 || n < 3 {\n\t\tpanic(\"newBoard: diminsions cannot be less than three\")\n\t}\n\n\tbrd := make(board, 0, m)\n\n\t// Add black pawns to top row\n\tbrd = append(brd, make([]pawn, 0, n))\n\tfor i := 0; i < n; i++ {\n\t\tbrd[0] = append(brd[0], blackPawn)\n\t}\n\n\t// Add spaces to middle rows\n\tfor i := 1; i < m-1; i++ {\n\t\tbrd = append(brd, make([]pawn, 0, n))\n\t\tfor j := 0; j < n; j++ {\n\t\t\tbrd[i] = append(brd[i], space)\n\t\t}\n\t}\n\n\t// Add white pawns to bottom row\n\tbrd = append(brd, make([]pawn, 0, n))\n\tfor i := 0; i < n; i++ {\n\t\tbrd[m-1] = append(brd[m-1], whitePawn)\n\t}\n\n\treturn brd\n}", "title": "" }, { "docid": "9e90072cf7a4aaee94c3d40fcbb8ee7d", "score": "0.47505382", "text": "func (g *GameManager) newGame(id, secretSalt string) *Game {\n\tif g == nil {\n\t\treturn nil\n\t}\n\n\tif id == \"\" {\n\t\tid = randomString(gameIDLength, nil)\n\t}\n\n\tif secretSalt == \"\" {\n\t\tsecretSalt = randomString(gameIDLength, nil)\n\t}\n\n\treturn &Game{\n\t\tmanager: g,\n\t\t//TODO: set the size of chan based on something more reasonable.\n\t\t//Note: this is also set similarly in manager.ModifiableGame\n\t\tproposedMoves: make(chan *proposedMoveItem, 20),\n\t\tfixUpTriggered: make(chan DelayedError, 10),\n\t\tid: id,\n\t\tsecretSalt: secretSalt,\n\t\tmodifiable: true,\n\t}\n}", "title": "" }, { "docid": "bdcbdc8c296e98a9d90e08d47ad47720", "score": "0.47405106", "text": "func NewGame() *Game {\n\tfmt.Printf(\"Starting a new game of Farkle.\\nRolling Dice...\\n\\n\")\n\tdice := make(Dice, 6)\n\tdice.Roll()\n\n\treturn &Game{\n\t\tScore: 0,\n\t\tTable: dice,\n\t\tHand: nil,\n\t}\n}", "title": "" }, { "docid": "aee0acaef3a44ee34a3cd3eb4e3f9932", "score": "0.4739714", "text": "func NewGame(width, height int, seeder seeder.Seeder) (Game, error) {\n\t// refactor me\n\tret := game{\n\t\tgrid: grid.Grid{Width: width, Height: height}}\n\tdata, err := seeder.Seed(width, height)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret.grid = *data\n\treturn &ret, nil\n}", "title": "" }, { "docid": "c553fa30e4ad45d496c13333af972c42", "score": "0.47295582", "text": "func (gm *GameManager) NewGame(gameName string, demoGame bool, isReplay bool) error {\n\tgm.mux.Lock()\n\tdefer gm.mux.Unlock()\n\tif _, exists := gm.games[gameName]; exists {\n\t\treturn fmt.Errorf(\"ERR game already exists\")\n\t}\n\n\tt := time.Now()\n\tgw := NewGameWrapper(demoGame, isReplay, \"dbinterface/replays/\", t.Format(\"Jan_2-150405-\")+gameName)\n\tif !demoGame && !isReplay { // not a demo game, let's save it to the DB\n\t\tgm.db.AddGame(t.Format(\"Jan_2-150405-\")+gameName, gameName) // dbinterface will appent the dash itself\n\t}\n\n\tgm.games[gameName] = gw\n\n\tgo func() {\n\t\ttime.AfterFunc(time.Second*60, func() {\n\t\t\tif gw.Status() != game.RUNNING && gw.Status() != game.DONE {\n\t\t\t\tlog.Printf(\"game: %s timed out.\", gameName)\n\t\t\t\tgw.Quit()\n\t\t\t}\n\t\t})\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "7fbfd9d64332e3c97b5943f305a38914", "score": "0.4720676", "text": "func createNewRunner(ctx context.Context, out io.Writer, opts config.SkaffoldOptions) (runner.Runner, []util.VersionedConfig, *runcontext.RunContext, error) {\n\trunCtx, configs, err := runContext(ctx, out, opts)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\tvar v2Configs []*latest.SkaffoldConfig\n\tfor _, c := range configs {\n\t\tv2Configs = append(v2Configs, c.(*latest.SkaffoldConfig))\n\t}\n\tinstrumentation.Init(v2Configs, opts.User, runCtx.GetKubeContext())\n\thooks.SetupStaticEnvOptions(runCtx)\n\trunner, err := runner.NewForConfig(ctx, runCtx)\n\tif err != nil {\n\t\tevent.InititializationFailed(err)\n\t\treturn nil, nil, nil, fmt.Errorf(\"creating runner: %w\", err)\n\t}\n\treturn runner, configs, runCtx, nil\n}", "title": "" }, { "docid": "e2f1f8d14d6c339ab8a9d7f3e1299ba6", "score": "0.47138178", "text": "func New(workernumber, min, max int, seed int64) *Generator {\n\trandnumchan := make(chan int, workernumber*10)\n\tgen := Generator{\n\t\trandnum: randnumchan,\n\t}\n\n\tfor i := 0; i < workernumber; i++ {\n\t\tr := rand.New(rand.NewSource(seed))\n\t\tw := RandWorker{\n\t\t\trandchan: randnumchan,\n\t\t\trandgen: r,\n\t\t\tseed: seed,\n\t\t\tmin: min,\n\t\t\tmax: max,\n\t\t}\n\t\tw.Work()\n\t\tgen.woker = append(gen.woker, w)\n\t}\n\treturn &gen\n}", "title": "" }, { "docid": "ad80c4c35111a621b9225c4ef4791afb", "score": "0.4709799", "text": "func New(cardCount int) Game {\n\treturn &_Game{\n\t\tcardCount: cardCount,\n\t\tcurrentPlayer: 0,\n\t\tplayers: []*Player{\n\t\t\tNewPlayer(cardCount),\n\t\t\tNewPlayer(cardCount),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "18252527d86b850edd5e5cee1e984c5e", "score": "0.47096333", "text": "func NewBoard(height, width, matches_to_win int) *Board {\n\tboard := new(Board)\n\tboard.Cells = make([]*Cell, height*width)\n\tfor i := range board.Cells {\n\t\tboard.Cells[i] = new(Cell)\n\t}\n\tboard.Height = height\n\tboard.Width = width\n\tboard.MatchesToWin = matches_to_win\n\n\treturn board\n}", "title": "" }, { "docid": "79527725f274daad5e5ae364de23166a", "score": "0.4708651", "text": "func CreateRedTen5GameState(myRole int, inHands [][]int, preHand []int, preRole int) RedTen5GameState {\n\tstate := RedTen5GameState{myRole: myRole, inHands: inHands, preHand: preHand, preRole: preRole, nextToMove: 1}\n\treturn state\n}", "title": "" }, { "docid": "f28936f10db2f30ae5004eb5448232db", "score": "0.4708445", "text": "func New(options ...Option) *Runner {\n\trunner := &Runner{\n\t\tendSignal: os.Interrupt,\n\t}\n\tfor _, apply := range options {\n\t\tapply(runner)\n\t}\n\treturn runner\n}", "title": "" }, { "docid": "75e3eba472b0cf53230e17baf9ed694a", "score": "0.46956947", "text": "func NewRunner(c *ssh.ClientConfig) *Runner {\n\trunner := &Runner{\n\t\tSSHClientConfig: c,\n\t}\n\treturn runner\n}", "title": "" }, { "docid": "688b5b31fdf7602e1510cdfd5d7fbb96", "score": "0.46950597", "text": "func NewRunner(inventory Inventory, playbook, user, privKeyFile, extraVars string, ctxt context.Context) *Runner {\n\treturn &Runner{\n\t\tinventory: inventory,\n\t\tplaybook: playbook,\n\t\tuser: user,\n\t\tprivKeyFile: privKeyFile,\n\t\textraVars: extraVars,\n\t\tctxt: ctxt,\n\t}\n}", "title": "" }, { "docid": "91ea581b25d55a422228820c23bdb4a4", "score": "0.46919012", "text": "func NewGame() *Game {\n\tb := make([]Player, dimension*dimension)\n\tfor i := range b {\n\t\tb[i] = Nobody\n\t}\n\treturn &Game{board: b}\n}", "title": "" }, { "docid": "f6b7513d5f2447d99e5829e44e8d0fad", "score": "0.46871284", "text": "func StartGame(filename string, connection net.Conn, attemptsPerRound int, lengthOfPasswords int, numberOfPasswords int) {\n\tdefer connection.Close()\n\twordList := loadStringsFromDisctionaryFile(filename)\n\n\tplayer := player{0} // Setup new player\n\n\tfor {\n\t\tround := buildRound(attemptsPerRound, lengthOfPasswords, numberOfPasswords, wordList)\n\t\tplayRound(&player, round, connection)\n\t\tplayer.writeScoreTo(connection)\n\t\tconnection.Write([]byte(\"PLAY AGAIN? (Y/N): \"))\n\t\tinput := readUserInputFrom(connection)\n\t\tif input != \"Y\" {\n\t\t\tconnection.Write([]byte(\"\\nTHANKS FOR PLAYING!\"))\n\t\t\tplayer.writeScoreTo(connection)\n\t\t\tbreak\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "320629de0ac3485a34a89c28d4c1d23c", "score": "0.46845672", "text": "func NewMove(face int, turns int) Move {\n\tif turns == 1 {\n\t\treturn Move(face - 1)\n\t} else if turns == -1 {\n\t\treturn Move(face + 5)\n\t} else {\n\t\treturn Move(face + 11)\n\t}\n}", "title": "" }, { "docid": "7d89fe8a061334e6388c8edad0679d9a", "score": "0.46811593", "text": "func playTournament(input []Round) int {\n\ttotalScore := 0\n\n\troundScore := 0\n\tfor _, round := range input {\n\t\tswitch round.OpponentMove {\n\t\tcase OpponentRock:\n\t\t\tswitch round.MyMove {\n\t\t\tcase MeRock:\n\t\t\t\troundScore = ScoreRock + ScoreDraw\n\t\t\tcase MePaper:\n\t\t\t\troundScore = ScorePaper + ScoreWin\n\t\t\tcase MeScissors:\n\t\t\t\troundScore = ScoreScissors + ScoreLoss\n\t\t\t}\n\t\tcase OpponentPaper:\n\t\t\tswitch round.MyMove {\n\t\t\tcase MeRock:\n\t\t\t\troundScore = ScoreRock + ScoreLoss\n\t\t\tcase MePaper:\n\t\t\t\troundScore = ScorePaper + ScoreDraw\n\t\t\tcase MeScissors:\n\t\t\t\troundScore = ScoreScissors + ScoreWin\n\t\t\t}\n\t\tcase OpponentScissors:\n\t\t\tswitch round.MyMove {\n\t\t\tcase MeRock:\n\t\t\t\troundScore = ScoreRock + ScoreWin\n\t\t\tcase MePaper:\n\t\t\t\troundScore = ScorePaper + ScoreLoss\n\t\t\tcase MeScissors:\n\t\t\t\troundScore = ScoreScissors + ScoreDraw\n\t\t\t}\n\t\t}\n\n\t\ttotalScore += roundScore\n\t\troundScore = 0\n\t}\n\n\treturn totalScore\n}", "title": "" }, { "docid": "fd9317f93547ca41553e1fbbdf57ea9b", "score": "0.46783316", "text": "func New(config pb.ConfigRules) *Game {\n\tgame := &Game{\n\t\tboard: &board.Board{},\n\t\tplayers: make(player.Players),\n\t}\n\tgame.players[1] = &player.Player{\n\t\tIndex: 1,\n\t\tRules: rules.New(1, 2, config),\n\t}\n\tgame.players[2] = &player.Player{\n\t\tIndex: 2,\n\t\tRules: rules.New(2, 1, config),\n\t}\n\tif config.PlayerIndexIA != 0 {\n\t\tgame.IA = solver.New(config, int(config.PlayerIndexIA))\n\t} else {\n\t\tgame.IA = nil\n\t}\n\treturn game\n}", "title": "" }, { "docid": "f5419ad59bb76203656dfc41a9070a7c", "score": "0.46759963", "text": "func NewUntilNewestRunningWaitingStrategy(delay time.Duration) WaitingStrategy {\n\treturn &untilNewestRunning{\n\t\toriginalDelay: delay,\n\t\tinitialDelay: time.Now().Add(delay),\n\t\tpodInfoPrinter: &PodInfoPrinter{\n\t\t\tLastWarning: time.Now().Add(delay),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "f9de7fc4a34e561125c253b6553d8c17", "score": "0.46756777", "text": "func winner(length_to_win int, board[][]int) int {\n \n currentC := global_column\n currentR := global_row\n win := -1\n \n // Check if there is a tie. Returns 2\n win = check_tie(board)\n if win != -1 {\n\treturn 2\n }\n \n // Check if row win\n win = check_row_win(currentR, currentC, length_to_win, board)\n if win != -1 {\n\treturn win\n }\n \n // Check if column win\n win = check_column_win(currentR, currentC, length_to_win, board)\n if win != -1 {\n\treturn win\n }\n \n // Check if a forward diaginal win \n win = check_forward_diaginal_win(currentR, currentC, length_to_win, board)\n if win != -1 {\n\treturn win\n }\n \n // Check if a backward diaginal win\n win = check_backward_diaginal_win(currentR, currentC, length_to_win, board)\n if win != -1 {\n\treturn win\n }\n \n // if no win\n return -1\n}", "title": "" }, { "docid": "aa4a6d6166c762bf4b4ebb2ddfbb08e7", "score": "0.4675573", "text": "func (e *UCIEngine) NewGame() error {\n\te.input <- []byte(\"ucinewgame\")\n\te.isReady()\n\treturn nil\n}", "title": "" }, { "docid": "eb01ef4cf4255e53b8cf9a20956ebfb1", "score": "0.46736398", "text": "func StartRound(gameStore *ClientsGameCollection) {\n\tcurrentRound++\n\tupdateRoundState(RoundStateStarted)\n\tfmt.Println(\"Start a round\")\n\ttime.Sleep(time.Second * 5)\n\t//time.Sleep(time.Second * (10 + time.Duration(rand.Intn(5))))\n\tfmt.Println(\"Sleep end\")\n\n\tvar ids []string\n\n\tfor id, item := range *gameStore {\n\t\tfmt.Printf(\"start game for %s %d\\n\", id, item.Card.Number)\n\t\tids = append(ids, id)\n\t}\n\n\tcardsLen := len(ids)\n\tif cardsLen < 2 {\n\t\tupdateRoundState(RoundStateFinished)\n\t\tTriggerUpdateDashboardState()\n\t\treturn\n\t}\n\n\trand.Shuffle(len(ids), func(i, j int) {\n\t\tids[i], ids[j] = ids[j], ids[i]\n\t})\n\n\tfor _, i := range []string{\"1\", \"2\", \"2.5\", \"2.9\", \"🤪\", \"2.999\", \"3\"} {\n\t\tfmt.Println(\"_COUNTER:\", i)\n\t\tfor id := range ids {\n\t\t\titem := (*gameStore)[ids[id]]\n\t\t\titem.sendMessage(Message{\n\t\t\t\tType: MessageTypeCounter,\n\t\t\t\tPayload: MessageCounterPayload{\n\t\t\t\t\tCounter: i,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tTriggerUpdateDashboardState(i)\n\t\ttime.Sleep(2 * time.Second)\n\t}\n\n\tmaxFailedIdx := cardsLen / 2\n\tfor i := range ids {\n\t\titem := (*gameStore)[ids[i]]\n\t\tfmt.Println(\"Close card:\", item.Card.ID)\n\n\t\tfmt.Println(\"Send message card:\", item.Card.ID)\n\n\t\tif i <= maxFailedIdx {\n\t\t\titem.Card.IsClosed = true\n\t\t\titem.Card.IsWin = false\n\t\t} else {\n\t\t\titem.Card.IsClosed = false\n\t\t\titem.Card.IsWin = true\n\t\t}\n\n\t\titem.sendMessage(Message{\n\t\t\tType: MessageTypeCardState,\n\t\t\tPayload: MessageCardStatePayload{\n\t\t\t\tCard: *item.Card,\n\t\t\t\tRoundState: roundState,\n\t\t\t\tCurrentRound: currentRound,\n\t\t\t},\n\t\t})\n\t}\n\tupdateRoundState(RoundStateFinished)\n\n\tTriggerUpdateDashboardState()\n\ttime.Sleep(5 * time.Second)\n\n\tRemoveFailedCardsAndEmptyWins()\n\n\tupdateRoundState(RoundStateStarted)\n}", "title": "" }, { "docid": "07dc5e94a4e1803921a58f03ae334507", "score": "0.46669176", "text": "func NewRunner(program []*Instruction, size int, main int, trace bool) *Runner {\n\treturn &Runner{\n\t\tip: main,\n\t\tstack: NewStack(size),\n\t\tglobals: NewStack(512),\n\t\tprogram: program,\n\t\ttrace: trace,\n\t\tpanic: false,\n\t}\n}", "title": "" }, { "docid": "03d1e8234f34bbae6510564a30616947", "score": "0.46657792", "text": "func CreateSingleplayer(app *tview.Application) error {\n\ttext, err := game.ChooseText()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstate := game.NewState(text)\n\n\tstatsWis := [...]*tview.TextView{\n\t\ttview.NewTextView().SetText(\"wpm: 0\"),\n\t\ttview.NewTextView().SetText(\"time: 0s\"),\n\t}\n\n\tpages := tview.NewPages().\n\t\tAddPage(\"modal\", tview.NewModal().\n\t\t\tSetText(\"Play again?\").\n\t\t\tSetBackgroundColor(tcell.ColorDefault).\n\t\t\tAddButtons([]string{\"yes\", \"exit\"}).\n\t\t\tSetDoneFunc(func(index int, label string) {\n\t\t\t\tswitch index {\n\t\t\t\tcase 0:\n\t\t\t\t\tutils.Check(CreateSingleplayer(app))\n\t\t\t\tcase 1:\n\t\t\t\t\tutils.Check(CreateWelcome(app))\n\t\t\t\t}\n\t\t\t}), false, false)\n\n\tvar textWis []*tview.TextView\n\tfor _, word := range state.Words {\n\t\ttextWis = append(textWis, tview.NewTextView().SetText(word).SetDynamicColors(true))\n\t}\n\n\tcurrInput := \"\"\n\tinputWi := tview.NewInputField().\n\t\tSetFieldBackgroundColor(tcell.ColorDefault)\n\tinputWi.\n\t\tSetChangedFunc(func(text string) {\n\t\t\tif state.StartTime.IsZero() {\n\t\t\t\tstate.Start()\n\t\t\t\tgo func() {\n\t\t\t\t\tticker := time.NewTicker(100 * time.Millisecond)\n\t\t\t\t\tfor range ticker.C {\n\t\t\t\t\t\tif state.CurrWord == len(state.Words) {\n\t\t\t\t\t\t\tticker.Stop()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapp.QueueUpdateDraw(func() {\n\t\t\t\t\t\t\tstatsWis[0].SetText(fmt.Sprintf(\"wpm: %.0f\", state.Wpm()))\n\t\t\t\t\t\t\tstatsWis[1].SetText(fmt.Sprintf(\"time: %.02fs\", time.Since(state.StartTime).Seconds()))\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t}\n\n\t\t\tif len(currInput) < len(text) {\n\t\t\t\tif len(text) > len(state.Words[state.CurrWord]) || state.Words[state.CurrWord][len(text)-1] != text[len(text)-1] {\n\t\t\t\t\tstate.IncError()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tapp.QueueUpdateDraw(func(i int) func() {\n\t\t\t\treturn func() {\n\t\t\t\t\ttextWis[i].SetText(paintDiff(state.Words[i], text))\n\t\t\t\t}\n\t\t\t}(state.CurrWord))\n\n\t\t\tif text == state.Words[state.CurrWord] {\n\t\t\t\tstate.NextWord()\n\t\t\t\tif state.CurrWord == len(state.Words) {\n\t\t\t\t\tstate.End()\n\t\t\t\t\tpages.ShowPage(\"modal\")\n\t\t\t\t} else {\n\t\t\t\t\tinputWi.SetText(\"\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurrInput = text\n\t\t})\n\n\tlayout := tview.NewFlex()\n\tstatsFrame := tview.NewFlex().SetDirection(tview.FlexRow)\n\tstatsFrame.SetBorder(true).SetBorderPadding(1, 1, 1, 1).SetTitle(\"STATS\")\n\tfor _, statsWi := range statsWis {\n\t\tstatsFrame.AddItem(statsWi, 1, 1, false)\n\t}\n\tlayout.AddItem(statsFrame, 0, 1, false)\n\n\tsecondColumn := tview.NewFlex().SetDirection(tview.FlexRow)\n\ttextsLayout := tview.NewFlex()\n\tfor _, textWi := range textWis {\n\t\ttextsLayout.AddItem(textWi, len(textWi.GetText(true)), 1, false)\n\t}\n\ttextsLayout.SetBorder(true)\n\tsecondColumn.AddItem(textsLayout, 0, 3, false)\n\tinputWi.SetBorder(true)\n\tsecondColumn.AddItem(inputWi, 0, 1, true)\n\tlayout.AddItem(secondColumn, 0, 3, true)\n\n\tpages.AddPage(\"game\", layout, true, true).SendToBack(\"game\")\n\tapp.SetRoot(pages, true)\n\n\tkeybindings(app, CreateWelcome)\n\treturn nil\n}", "title": "" }, { "docid": "889e6903254833b129de611299851ec3", "score": "0.46631673", "text": "func Runner(track chan int) {\n // Wait to receive the baton \n baton := <-track\n const maxExchanges = 4\n var exchange int\n fmt.Printf(\"Runner %d Running with Baton\\n\", baton)\n\n // New runner to the line.\n if baton < maxExchanges {\n exchange = baton + 1\n fmt.Printf(\" Runner %d To The Line\\n\", exchange)\n go Runner(track)\n }\n\n // Running around the track\n time.Sleep(100 * time.Millisecond)\n // Is the race over \n if baton == maxExchanges {\n fmt.Printf(\"Runner %d Finished, Race Over\\n\", baton)\n wg.Done()\n return\n }\n\n // Exchange the baton for the next Runner.\n fmt.Printf(\"Runner %d Exchane with Runner %d\\n\",baton, exchange)\n track <- exchange \n}", "title": "" }, { "docid": "4491378c3c1c273c39454edd260465fb", "score": "0.46593428", "text": "func NewGame(p0 Player, p1 Player) *Game {\n\tg := Game{\n\t\tPlayers: [2]Player{p0, p1},\n\t\tBoard: NewBoard(),\n\t\tTurn: 0,\n\t}\n\n\treturn &g\n}", "title": "" }, { "docid": "311ab387aa9d658cff87cddb12363d48", "score": "0.46567178", "text": "func winshou() int {\n\tj, count := 0, 0\n\tfor i := 0; i < SCORESIZE; i++ { /* is there anyone on * the scoreboard? */\n\t\tif winr[i].Score != 0 {\n\t\t\tj++\n\t\t\tbreak\n\t\t}\n\t}\n\tif j != 0 {\n\t\tlprcat(\"\\n Score Difficulty Time Needed Larn Winners List\\n\")\n\n\t\tfor i := 0; i < SCORESIZE; i++ { /* this loop is needed to print out the */\n\t\t\tfor j = 0; j < SCORESIZE; j++ { /* winners in order */\n\t\t\t\tp := &winr[j] /* pointer to the scoreboard entry */\n\t\t\t\tif p.Order == i {\n\t\t\t\t\tif p.Score != 0 {\n\t\t\t\t\t\tcount++\n\t\t\t\t\t\tlprintf(\"%10d %2d %5d Mobuls %s \\n\",\n\t\t\t\t\t\t\tp.Score, p.HardLev, p.TimeUsed, p.Who)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn count /* return number of people on scoreboard */\n}", "title": "" }, { "docid": "e6ffb31a3672481cb92bcc9a37325f50", "score": "0.4655925", "text": "func New(name string, maxEntries int, dupePushAbove bool, alwaysReplace bool) (*Leaderboard, int) {\n\tleaderboardsMux.Lock()\n\tif leaderboards[name] != nil {\n\t\tleaderboardsMux.Unlock()\n\t\treturn nil, helpers.ErrorLeaderboardExists\n\t}\n\tlb := &Leaderboard{maxEntries: maxEntries, dupePushAbove: dupePushAbove, alwaysReplace: alwaysReplace, entries: make([]*LeaderboardEntry, 0)}\n\tleaderboards[name] = lb\n\tleaderboardsMux.Unlock()\n\n\treturn lb, 0\n}", "title": "" } ]
bcd48e0bb934a12b3663589e80fec8dc
Put registers a route for PUT methods that replaces all current representations of the target resource with the request payload.
[ { "docid": "14d86621310700f261b6f819b1584527", "score": "0.6829255", "text": "func (app *App) Put(path string, handlers ...Handler) Router {\n\treturn app.Add(MethodPut, path, handlers...)\n}", "title": "" } ]
[ { "docid": "e8ba0bf72c4eb1df76fc6f94f7c728eb", "score": "0.7786506", "text": "func (router *Router) PUT(pattern string, handler http.Handler) {\n\trouter.register(\"PUT\", pattern, handler)\n}", "title": "" }, { "docid": "4b20a3ecf12b2c4e96ade673488abd49", "score": "0.77755344", "text": "func (r *Router) PUT(path string, handler DoraHandler) {\n\tr.Register(MethodPut, path, handler)\n}", "title": "" }, { "docid": "678e68fc3f57dd28b3a340e0f34b508c", "score": "0.7676003", "text": "func (r *Router) PUT(path string, handler HandlerFunc, middleware ...HandlerFunc) *Route {\n\treturn r.Add(path, handler, PUT).Use(middleware...)\n}", "title": "" }, { "docid": "71af684e535fbd8f23b88cdc19d97b12", "score": "0.7651289", "text": "func Put(pattern string, handler http.HandlerFunc) *Route {\n\treturn Do(\"PUT\", pattern, handler)\n}", "title": "" }, { "docid": "a6bebd674d2199e04dabd956ff945956", "score": "0.76401764", "text": "func (app *Application) Put(pattern string, handler HandlerFunc) {\n\tapp.router.AddRoute(\"PUT\", pattern, handler)\n}", "title": "" }, { "docid": "5d334dbbc9ad37393a0c3b8befcc8ce0", "score": "0.7520098", "text": "func (r *Router) Put(path, controllerWithActionString string) {\n\tmapping := r.mappingRequestMethodWithControllerAndActions(PUTMethod, path, controllerWithActionString)\n\tr.registeredPathAndController[path] = mapping\n}", "title": "" }, { "docid": "2bb1529a707d12f69e593545fffd499f", "score": "0.7487722", "text": "func (m *Mux) PUT(pattern string, hs ...HandleFunc) {\n\tm.AddRoute(\"PUT\", pattern, hs)\n}", "title": "" }, { "docid": "ac5030934aa89ac9c87c6d733f54ed0e", "score": "0.74827355", "text": "func (g *RouteGroup) PUT(path string, h Handler, opts ...RouteOption) {\n\tg.addRoute(http.MethodPut, path, h, opts)\n}", "title": "" }, { "docid": "33c040c2d960f3b9785716c7718fd90d", "score": "0.74687976", "text": "func (g *RouteGroup) PUT(path string, handler HandlerFunc) {\n\tg.addRouteHandler(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "b280ba41f980fdc90af828c49ef5dae4", "score": "0.7455578", "text": "func (r *Router) PUT(route string, handler HandlerFunc) {\n\tr.mux.HandleFunc(route, handler).Methods(\"PUT\")\n}", "title": "" }, { "docid": "2f33437543f04d1e7c0c28da47b7c4f7", "score": "0.7421466", "text": "func (r *router) PUT(endpoint string, fn http.HandlerFunc) {\n\tr.register(http.MethodPut, endpoint, fn)\n}", "title": "" }, { "docid": "98cc91c1afdc312de13f5074155a3351", "score": "0.740301", "text": "func (r *Router) Put(pattern string, h ...Handler) *Route {\n\treturn r.Handle(\"PUT\", pattern, h)\n}", "title": "" }, { "docid": "a52775a10eda09263ab201226e36e0e7", "score": "0.7377889", "text": "func (r *SubRouter) PUT(route string, handler interface{}) *SubRouter {\n\troute = r.prefixedRoute(route)\n\tif r.parent != nil {\n\t\tr.parent.handleReg(MethodPUT, route, handler, r.prefixes)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "61dd1d2f2d7ff86f665d749ceaa86124", "score": "0.7375354", "text": "func (r *Router) PUT(path string) *middleware.App {\n\treturn r.Handle(\"PUT\", path)\n}", "title": "" }, { "docid": "572e76435afc885120624bd7ef2e9c21", "score": "0.73437536", "text": "func (r *Router) Put(path string, handler HandlerFunc) *Route {\n\treturn r.HandleFunc(HTTPMethods.PUT, path, handler)\n}", "title": "" }, { "docid": "eb300299bf36a1fe98cfd117bfb0c870", "score": "0.7321577", "text": "func (wok *Wok) PUT(path string, mws ...noodle.Middleware) RouteClosure {\n\treturn wok.Handle(\"PUT\", path, mws...)\n}", "title": "" }, { "docid": "d93977d51c8f3524198059b237fe8e53", "score": "0.7314741", "text": "func (r *Route) Put(pattern string, h HandlerFunc) {\n\tr.addHandlerFuncAndNextRoute(http.MethodPut, pattern, fullMatch, h, nil)\n}", "title": "" }, { "docid": "c9c08ecfb37097d50518ecfa45a38ed5", "score": "0.7309302", "text": "func (a *App) Put(path string, f func(w http.ResponseWriter, r *http.Request)) {\n\ta.Router.HandleFunc(path, f).Methods(\"PUT\")\n}", "title": "" }, { "docid": "c9c08ecfb37097d50518ecfa45a38ed5", "score": "0.7309302", "text": "func (a *App) Put(path string, f func(w http.ResponseWriter, r *http.Request)) {\n\ta.Router.HandleFunc(path, f).Methods(\"PUT\")\n}", "title": "" }, { "docid": "c9c08ecfb37097d50518ecfa45a38ed5", "score": "0.7309302", "text": "func (a *App) Put(path string, f func(w http.ResponseWriter, r *http.Request)) {\n\ta.Router.HandleFunc(path, f).Methods(\"PUT\")\n}", "title": "" }, { "docid": "b749d6e2b199f1e756289caee159bc42", "score": "0.7308879", "text": "func (a *App) PUT(pattern string, handler Handler) {\n\ta.add(\"PUT\", pattern, handler)\n}", "title": "" }, { "docid": "9a0a9f950c59eef59ab79e999a0b22db", "score": "0.73088723", "text": "func (r *Router) PUT(path string, handle RouteHandler) {\n\tr.AddRouteHandler(http.MethodPut, path, handle)\n}", "title": "" }, { "docid": "e12e61f0ad0171de2cc052d63d4e4701", "score": "0.7305088", "text": "func (r *Router) PUT(path string, handlers ...HandlerFunc) {\n\tr.Handle(\"PUT\", path, handlers)\n}", "title": "" }, { "docid": "0fd0d6f3d3fb3d3954e3241f8cbc517c", "score": "0.7303062", "text": "func Put(route string, handler interface{}) {\n\tmainServer.addRoute(route, \"PUT\", handler)\n}", "title": "" }, { "docid": "0fd0d6f3d3fb3d3954e3241f8cbc517c", "score": "0.7303062", "text": "func Put(route string, handler interface{}) {\n\tmainServer.addRoute(route, \"PUT\", handler)\n}", "title": "" }, { "docid": "7ab6c32f7b5257217ad0576dc09b679e", "score": "0.7295583", "text": "func (r *Router) Put(pattern string, handler http.Handler) {\n\tr.Routes = append(r.Routes, NewRoute(pattern, \"PUT\", handler))\n}", "title": "" }, { "docid": "126c90bfce69043e81b993df2a4fa435", "score": "0.72906435", "text": "func (mux *Mux) Put(path string, handler http.Handler) *Route {\n\treturn mux.register(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "3e2f36d098cd0daf69d2a5e7cbe32116", "score": "0.7255174", "text": "func (m *RouteMux) Put(pattern string, handler http.HandlerFunc) {\n\tm.AddRoute(PUT, pattern, handler)\n}", "title": "" }, { "docid": "ebfa3467e28a713897142d8aafc056d7", "score": "0.72538924", "text": "func (a *App) Put(path string, f func(w http.ResponseWriter, r *http.Request)) {\r\n\ta.Router.HandleFunc(path, f).Methods(\"PUT\")\r\n}", "title": "" }, { "docid": "103d62dd5a058ac9101a5530e8912ad3", "score": "0.724471", "text": "func (r *RouterGroup) PUT(path string, handlers ...Handler) *Route {\n\treturn newRoute(path, r).PUT(handlers...)\n}", "title": "" }, { "docid": "0493606a145944065ba82dc013d347c2", "score": "0.72369146", "text": "func (s *Server) PUT(path string, h HandlerContext) {\n\tnewRoute := route{http.MethodPut, path, h}\n\ts.routes = append(s.routes, newRoute)\n}", "title": "" }, { "docid": "c08a0897e2ba93946fa4e4b787d60b3e", "score": "0.7225774", "text": "func Put(path string, handlersFn ...HandlerFunc) RouteNameFunc {\n\treturn DefaultIris.Put(path, handlersFn...)\n}", "title": "" }, { "docid": "86352d0a6e1866b693498ba3b73d2b8a", "score": "0.7216263", "text": "func (e *Enlight) PUT(path string, handle HandleFunc, m ...MiddlewareFunc) {\n\te.Add(fasthttp.MethodPut, path, handle, m...)\n}", "title": "" }, { "docid": "9507772cc68d071283f1eb55d689c3dd", "score": "0.720733", "text": "func (r *Wrapper) Put(pattern string, handlerFn http.HandlerFunc) {\n\tr.Method(http.MethodPut, pattern, handlerFn)\n}", "title": "" }, { "docid": "b8f26f00c2829c518f064552c10f632f", "score": "0.7140238", "text": "func (s *Server) Put(pattern string, handler HandlerFunc) {\n\ts.Route(PUT, pattern, handler)\n}", "title": "" }, { "docid": "146b710eecb298c456dac8c7adde4129", "score": "0.71364576", "text": "func (m *MyMux) PUT(path string, h http.HandlerFunc) {\n\tm.RegisterHandler(http.MethodPut, path, h)\n}", "title": "" }, { "docid": "9a286a8b5380fa129fde46b115eac7da", "score": "0.71281934", "text": "func (composer *Composer) Put(pattern string, handler http.Handler) {\n\tcomposer.Handle(\"PUT\", pattern, handler)\n}", "title": "" }, { "docid": "35114f9c2f1ef584030ab9f0e37f6c2d", "score": "0.7119384", "text": "func (r *Router) Put(path string, handler http.Handler) {\n\tr.Handle(\"PUT\", path, handler)\n}", "title": "" }, { "docid": "6f9b66a0215aacbe4e75844525f20413", "score": "0.71116495", "text": "func (r *Router) PUT(path string, handle func(http.ResponseWriter, *http.Request)) {\n\tr.HandlerFunc(http.MethodPut, path, handle)\n}", "title": "" }, { "docid": "5483b7fc17506c3297fe533620616e34", "score": "0.7103635", "text": "func (yoyo *ApplicationBuilder) PUT(path string, handler func(ctx *Context.HttpContext)) {\n\tyoyo.Map(Std.PUT, path, handler)\n}", "title": "" }, { "docid": "a2db87d1f7d75d90863a407c152b0b2c", "score": "0.7099567", "text": "func (s *Service) PUT(relativePath string, handlers ...handler.HandlerFunc) {\n\ts.router.PUT(relativePath, s.factory.BuildMany(handlers...)...)\n}", "title": "" }, { "docid": "2757750ddb134cfc5a902368c2500374", "score": "0.7099313", "text": "func (r *Router) Put(path string, handler http.HandlerFunc) {\n\tr.addHandler(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "b9cf7842f9ad511a68cd4fed4c40d3f2", "score": "0.70962095", "text": "func (z *Zion) Put(pattern string, handler HandlerFunc) {\n\tz.router.addRoute(pattern, http.MethodPut, handler)\n}", "title": "" }, { "docid": "ec854b166e82fe459baa74768ad6ff06", "score": "0.70830834", "text": "func (r *Router) Put(path string, h http.HandlerFunc) {\n\n\tr.handle(path, http.MethodPut, h)\n}", "title": "" }, { "docid": "c70b3ecbd4dd2a96dd9617cb4f836714", "score": "0.70705605", "text": "func (a *Server) Put(path string, f func(w http.ResponseWriter, r *http.Request)) {\n\ta.Router.HandleFunc(path, f).Methods(\"PUT\")\n}", "title": "" }, { "docid": "fd50fd9841b98fcfa47a253a47f35992", "score": "0.7067017", "text": "func (r *Router) PUT(path string, handle Handle) {\n\tr.Handle(http.MethodPut, path, handle)\n}", "title": "" }, { "docid": "fd50fd9841b98fcfa47a253a47f35992", "score": "0.7067017", "text": "func (r *Router) PUT(path string, handle Handle) {\n\tr.Handle(http.MethodPut, path, handle)\n}", "title": "" }, { "docid": "78e9d75879adedb33da0c7fd268ed144", "score": "0.7063481", "text": "func (c *BaseController) PUT(pattern string, handlers ...HandlerFunc) {\n\tfor _, handler := range handlers {\n\t\tc.Route(pattern, \"PUT\", handler)\n\t}\n}", "title": "" }, { "docid": "32c94f26ac109cd708d02b7d56f2d6fa", "score": "0.7049834", "text": "func (s *Server) Put(route string, handler interface{}) {\n\ts.addRoute(route, \"PUT\", handler)\n}", "title": "" }, { "docid": "8ef61497e2795e0fc0fab802f9cee704", "score": "0.70402974", "text": "func (rc *RouteConstraint) Put() *RouteConstraint {\n\treturn rc.methodConstraint(\"PUT\")\n}", "title": "" }, { "docid": "ef75e116a167da6cad356787c3f54056", "score": "0.70215046", "text": "func (r *server) PUT(path string, handle Handle) {\n\tr.router.Handle(\"PUT\", path, r.warpFunc(handle))\n}", "title": "" }, { "docid": "677419b575d45a3d78c691e0659db484", "score": "0.69853187", "text": "func (rt *Router) Put(path string, handler http.Handler) {\n\trt.Handle(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "8da791fb9939b531646e03c486d53106", "score": "0.6973874", "text": "func (r *Router) Put(path string, handlers ...gin.HandlerFunc) *Router {\n\tr.Routes = append(r.Routes, Route{\n\t\tMethod: \"put\",\n\t\tPath: path,\n\t\tHandlers: handlers,\n\t})\n\n\treturn r\n}", "title": "" }, { "docid": "d418d1a7f2be838db4eee19fb6d3195f", "score": "0.69468415", "text": "func (s *Server) Put(path string, handler HTTPHandler) *Route {\n\treturn s.router.Handle(path, handler, HTTPMethods.PUT)\n}", "title": "" }, { "docid": "3c7375425547618c80b2720570b49eae", "score": "0.69407237", "text": "func (this *Application) Put(path string, fn ...func(*Request, *Response, func())) {\n\tthis.Verb(\"put\", path, fn...)\n}", "title": "" }, { "docid": "43ebf66945579ae340beb57abd9f5637", "score": "0.68971336", "text": "func (s *GenericRestController) Put(rw http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(rw, \"update\", s.reqVarsFunc(r)[\"id\"])\n}", "title": "" }, { "docid": "6112497aea7e433d216912692587742b", "score": "0.68966967", "text": "func (s *HTTPServer) PUT(path string, handle httprouter.Handle) {\n\ts.Router.PUT(path, handle)\n}", "title": "" }, { "docid": "8cdb146954d2768aa4bb698d1b79e967", "score": "0.6889792", "text": "func (a Agent) PUT(targetURL string) Agent {\n\ta.Method = \"PUT\"\n\t_, err := url.Parse(targetURL)\n\tif err != nil {\n\t\ta.err = err\n\t}\n\ta.URL = targetURL\n\treturn a\n}", "title": "" }, { "docid": "a7fc80ed8487c6bbe449a6535d73f488", "score": "0.6878052", "text": "func (r *chiWrapper) Put(pattern string, fn APIHandler) {\n\tr.chi.Put(pattern, r.traceRequest(http.MethodPut, pattern, fn))\n}", "title": "" }, { "docid": "12ac86542a5de8db4733a2f7b747e16a", "score": "0.6841058", "text": "func (mt *Mint) PUT(path string, handler HandlerFunc) *HandlerContext {\n\treturn mt.SimpleHandler(path, http.MethodPut, handler)\n}", "title": "" }, { "docid": "3caf0de266ba73834a70046cbb59e135", "score": "0.6834533", "text": "func (r *Router) Put(path string, handler http.Handler) {\n\tr.PUT(path, wrapHandler(handler))\n}", "title": "" }, { "docid": "3caf0de266ba73834a70046cbb59e135", "score": "0.6834533", "text": "func (r *Router) Put(path string, handler http.Handler) {\n\tr.PUT(path, wrapHandler(handler))\n}", "title": "" }, { "docid": "a8adabbf884019b9a9d587fc6362ef61", "score": "0.68304545", "text": "func (g *Group) Put(path string, callback routeCallbackFunc) {\n\troutes.build(splitPath(path, \"PUT\"), callback, g)\n}", "title": "" }, { "docid": "a4a07c4b88ddb66d6d1aaa82f7fff15c", "score": "0.6821822", "text": "func (m *SREST) Put(uri string, hf http.Handler, mws ...func(http.Handler) http.Handler) {\n\ts := path.Clean(uri)\n\tcheckDuplicate(m, \"PUT\", s)\n\th := chainHandler(hf, mws...)\n\tm.handlers = append(m.handlers, tmpHandler{\"PUT\", s, h})\n\tif s != \"/\" {\n\t\tm.handlers = append(m.handlers, tmpHandler{\"PUT\", s + \"/\", h})\n\t}\n}", "title": "" }, { "docid": "f0f00bbd3854908fe2718643738198ce", "score": "0.677451", "text": "func apiPut[O any](\n\tctx context.Context,\n\tq *Client,\n\trelUrl string,\n\treqBody interface{},\n) (*O, error) {\n\treturn apiObject[O](ctx, q, \"PUT\", relUrl, reqBody)\n}", "title": "" }, { "docid": "c1358f6aa0c9e64655794c36f787f400", "score": "0.67695785", "text": "func (r *router) Put(route string, f func(Response, Request)) {\n\tff := func(res http.ResponseWriter, req *http.Request) {\n\n\t\t//Custom Response Fields\n\t\teres := Response{Res: res, ReqMethod: \"PUT\"}\n\n\t\t//Csutom Request Fields\n\t\tereq := Request{Req: req, Uid: uid.New(7)}\n\t\tereq.requestBody()\n\n\t\t//Call Registered Middleware\n\t\tf(eres, ereq)\n\t}\n\tr.put[route] = ff\n}", "title": "" }, { "docid": "af7b9546b4bcdf4de63816afac78a743", "score": "0.6700537", "text": "func NewPutRoute(p string, pr sync.ProcessorFunc, trace bool) Route {\n\treturn NewRoute(p, http.MethodPut, pr, trace, nil)\n}", "title": "" }, { "docid": "599f950f538f882699b596e2beee540b", "score": "0.6674729", "text": "func (e *Engine) PUT(relativePath string, doc APIDoc, handlers ...HandlerFunc) error {\n\treturn e.handle(PUT, relativePath, doc, handlers)\n}", "title": "" }, { "docid": "22b9cbadeec9db4cee6acf02cea2dfef", "score": "0.6673134", "text": "func (node *Node) PUT(functions ...interface{}) *Handler {\n\n\thandler := node.newHandler(\"PUT\")\n\n\tif len(functions) > 0 { handler.Function = functions[0].(func(http.Request) *http.Status) }\n\n\tnode.addHandler(\"PUT\", handler)\n\n\treturn handler\n}", "title": "" }, { "docid": "49218a7e04b4e650cf4f4b49373588de", "score": "0.66617346", "text": "func (r *Rattle) Put(pathURL string) *Rattle {\n r.method = PUT\n return r.setPath(pathURL)\n}", "title": "" }, { "docid": "ef9f7cb74c3794efe5f1103535c65d95", "score": "0.66501284", "text": "func (ms MethodSetter) Put() PatternSetter {\n\treturn ms.Method(PUT)\n}", "title": "" }, { "docid": "80c691ec405480a9eda10f99c14157fc", "score": "0.6633678", "text": "func (s *Service) Put(v interface{}, path string, body interface{}) error {\n\treturn s.Do(v, \"PUT\", path, body, nil, nil)\n}", "title": "" }, { "docid": "326d9db594c8ffdd9621a743a055deaf", "score": "0.6623575", "text": "func (api *API) Put(pattern string, fn interface{}) {\n\tapi.Do(\"PUT\", pattern, fn)\n}", "title": "" }, { "docid": "f62ecacc6ff7756bd7c9aee31ab58ffa", "score": "0.6593482", "text": "func (forceApi *ForceApi) Put(path string, params url.Values, payload, out interface{}) error {\n\treturn forceApi.request(\"PUT\", path, params, payload, out)\n}", "title": "" }, { "docid": "76633ce40b2b7473a73a62566e1e3c9d", "score": "0.657813", "text": "func (p *BaseHandler) Put(r *http.Request) resputl.SrvcRes {\n\treturn resputl.ResponseNotImplemented(nil)\n}", "title": "" }, { "docid": "c7fd85479b56ecdc3ffbd616b30be4fe", "score": "0.65670246", "text": "func (this *router)Put(paraList ...interface{}) Router {\n var mountpoint string\n var processor Tout\n mountpoint, processor=extractParameters(paraList...)\n return this.UseSpecified(mountpoint, \"PUT\", processor, true)\n}", "title": "" }, { "docid": "b79011a7f9a00961abb7b97976efe568", "score": "0.6566059", "text": "func (m *Middleware) PUT(path string, fn http.HandlerFunc) {\n\tm.hosts[nohost].PUT(path, fn)\n}", "title": "" }, { "docid": "74e95dab644220ae5bcd90f18c8fd1d4", "score": "0.6560593", "text": "func (r *Request) Put(url string) (context.CancelFunc, *resty.Response, error) {\n\treturn r.Execute(resty.MethodPut, url)\n}", "title": "" }, { "docid": "8eeb84680ba6079073ba492663f51d01", "score": "0.65360874", "text": "func (c *Default) Put(path string, data []byte) (*http.Response, []byte, error) {\n\treturn c.request(path, \"PUT\", data)\n}", "title": "" }, { "docid": "911791265d21e2b140cbda36355ab445", "score": "0.65170527", "text": "func (a *App) Put(path string, handlers ...func(w http.ResponseWriter, req *http.Request, stop func(message string))) {\n\tif a.routes == nil {\n\t\ta.routes = make(map[string]map[string][]func(w http.ResponseWriter, req *http.Request, stop func(message string)))\n\t}\n\tif a.routes[path] == nil {\n\t\ta.routes[path] = make(map[string][]func(w http.ResponseWriter, req *http.Request, stop func(message string)))\n\n\t}\n\tif a.routes[path][\"PUT\"] == nil {\n\t\ta.routes[path][\"PUT\"] = make([]func(w http.ResponseWriter, req *http.Request, stop func(message string)), 5)\n\t}\n\ta.routes[path][\"PUT\"] = handlers\n}", "title": "" }, { "docid": "70f2b5517be06ff979ead17ffaae421a", "score": "0.6503938", "text": "func PUT(url, data string, header map[string]string) http.Response {\n\treturn request(\"PUT\", url, data, header)\n}", "title": "" }, { "docid": "baf62acb9af81385727de526025a03f9", "score": "0.64879936", "text": "func (c *caller) Put(resource, resourceID string, params *Parameters) (Response, error) {\n\treturn c.request(\"PUT\", resource, resourceID, params)\n}", "title": "" }, { "docid": "65705b1eacb5a4fffc8a6f2d72d536b9", "score": "0.6474073", "text": "func (m *Mux) Put(pattern string, h func(context.Context, http.ResponseWriter, *http.Request) error) {\n\tm.HandleFuncC(pat.Put(pattern), wrap(h))\n}", "title": "" }, { "docid": "840713d4480631b86df7665d328f8eff", "score": "0.6468823", "text": "func (e *EndpointHandler) PUT(w http.ResponseWriter, req *http.Request) {\n\thttpError(http.StatusMethodNotAllowed, fmt.Sprintf(\"%s not allowed on %s\", req.Method, req.URL.Path), w)\n}", "title": "" }, { "docid": "344c7fa4c5ac5d5c4af21f052b8adf7b", "score": "0.64619666", "text": "func (remote *Remote) PUT(config Options) (*http.Response, error) {\n\treturn remote.do(http.MethodPut, contentJSON, config)\n}", "title": "" }, { "docid": "bd23cbb1fce3648145beb3131d4c9bfb", "score": "0.6423075", "text": "func (mux *Mux) PutFunc(path string, handler http.HandlerFunc) *Route {\n\treturn mux.register(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "2e9b088b72aa755b24988170e7ba8813", "score": "0.6396126", "text": "func Put(path string, handlers ...context.Handler) {\n\tapp.Put(path, handlers...)\n}", "title": "" }, { "docid": "30e10886e0de4f19578d275d175766f1", "score": "0.6384839", "text": "func (gr *GDMResource) Put(_ *restful.RouteMap, _ http.ResponseWriter, req *http.Request, _ httprouter.Params) restful.Exchanger {\n\treturn &PUTGDMHandler{\n\t\tRequest: req,\n\t\tLogSink: gr.context.LogSink,\n\t\tGDM: gr.context.liveState(),\n\t\tStateManager: gr.context.StateManager,\n\t\tUser: gr.GetUser(req),\n\t}\n}", "title": "" }, { "docid": "57ef5640ea00f5e4211afa9e60505eb1", "score": "0.63557154", "text": "func put(resource string, body []byte) ([]byte, *Links, error) {\n\treq, _ := http.NewRequest(\"PUT\", BaseURL+resource, bytes.NewBuffer(body))\n\treturn processRequest(req)\n}", "title": "" }, { "docid": "fe0b20ee15af07b2549fc5bc6df4a61a", "score": "0.6347878", "text": "func (s *Server) Put(path string, handle Handler) {\n\ts.HandleJson(\"PUT\", path, handle)\n}", "title": "" }, { "docid": "c433fd964a712ac32cde95f80be4b26e", "score": "0.6332723", "text": "func (client *RequestClient) Put(urlpath, contentType string, data ...interface{}) {\n\tclient.Invoke(\"PUT\", urlpath, contentType, data...)\n}", "title": "" }, { "docid": "38c186b60cfa30569a543674d2c853cf", "score": "0.6323688", "text": "func (h *HTTP) Put(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error) {\n\treturn h.Request(ctx, HTTP_METHOD_PUT, url, args...)\n}", "title": "" }, { "docid": "d39d5647a97ee031c5d3e41eaf7223df", "score": "0.63019943", "text": "func (c *Client) put(url string, payload interface{}, target interface{}) error {\n\treturn c.save(http.MethodPut, url, payload, target)\n}", "title": "" }, { "docid": "26fdc0c1f85badd4dc0cc9cbc88abbc0", "score": "0.6286342", "text": "func NewPutRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {\n\treturn NewRoute(http.MethodPut, path, handler, opts...)\n}", "title": "" }, { "docid": "a17b8c7d0ca60130e0c378b403e2b863", "score": "0.6265099", "text": "func (r *RESTClient) Put(uri string, data string) (string, error) {\n return r.callAPI(http.MethodPut, uri, data)\n}", "title": "" }, { "docid": "63fa49b61fb01292e1f4ceeaf69c854f", "score": "0.6238699", "text": "func (srv *Server) HandlePUT(path string, handler http.HandlerFunc) {\n\tsrv.handleFunc(path, handler, http.MethodPut)\n}", "title": "" }, { "docid": "a7dbd0760cd8397dfb40d4491c9e3cd8", "score": "0.6237476", "text": "func (s *Server) Put(path string, handler Handler) {\n\ts.Handle(http.MethodPut, path, handler)\n}", "title": "" }, { "docid": "88354af775a489c40ae7ed08c92ef0f6", "score": "0.6237112", "text": "func (c *Client) Put(path string) *Request {\n\treq := c.Request()\n\treq.Method(\"PUT\")\n\treq.Path(path)\n\treturn req\n}", "title": "" }, { "docid": "8a7296e46f85788aea9036f879ca382f", "score": "0.62348425", "text": "func (m *Module) PUT(path string, h Handle) {\n\tm.HTTPRouter.PUT(path, m.wrap(h))\n}", "title": "" }, { "docid": "d09f813312a54d91e0289b53d0edfb20", "score": "0.6234676", "text": "func (c *Client) Put(URI string, data interface{}, decoded interface{}) (*http.Response, error) {\n\treq, err := c.NewJSONRequest(\"PUT\", URI, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.DoRest(req, decoded)\n}", "title": "" } ]
7167ce1684879ea2165b101fd2ed1e0b
MacroIP contains definition for IP Parameter
[ { "docid": "8e090857c9982675a969bf5599cde559", "score": "0.7626985", "text": "func (tag *BidderMacro) MacroIP(key string) string {\n\tif nil != tag.Request && nil != tag.Request.Device {\n\t\tif len(tag.Request.Device.IP) > 0 {\n\t\t\treturn tag.Request.Device.IP\n\t\t} else if len(tag.Request.Device.IPv6) > 0 {\n\t\t\treturn tag.Request.Device.IPv6\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" } ]
[ { "docid": "92849b53326e756155821f6b15414d36", "score": "0.72514945", "text": "func IP(assignmentVar *net.IP, shortName string, longName string, description string) error {\n\treturn mainParser.add(assignmentVar, shortName, longName, description)\n}", "title": "" }, { "docid": "7a7a24960bf1994cf3faf1c2e4be515a", "score": "0.72319114", "text": "func ConfigureIP(ippref string)(string, string, icmp.Type, int){\n var protocol string\n var proto int\n var source string\n var typ icmp.Type\n if ippref == \"ip4\" {\n protocol = ipv4Config[\"ip\"]\n source = ipv4Config[\"source\"]\n typ = ipv4.ICMPTypeEcho\n proto = ProtocolICMP\n\t} else if ippref==\"ip6\" {\n protocol = ipv6Config[\"ip\"]\n source = ipv6Config[\"source\"]\n typ = ipv6.ICMPTypeEchoRequest\n proto = ProtocolIPv6ICMP\n } else {\n return protocol, source, nil, 0\n }\n return protocol, source, typ, proto\n}", "title": "" }, { "docid": "304843ae7af38b98e8a5abd8d76fdb62", "score": "0.6309527", "text": "func (input *Input) IP() string {\n\tips := input.Proxy()\n\tif len(ips) > 0 && ips[0] != \"\" {\n\t\treturn ips[0]\n\t}\n\tip := strings.Split(input.Request.RemoteAddr, \":\")\n\tif len(ip) > 0 {\n\t\tif ip[0] != \"[\" {\n\t\t\treturn ip[0]\n\t\t}\n\t}\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "96a2f0336a8be3c3ba2eddb04066389d", "score": "0.61886233", "text": "func (r *loadBalancerIngressResolver) IP(ctx context.Context) string {\n\treturn r.loadBalancerIngress.Ip\n}", "title": "" }, { "docid": "5d8740a78eeba5370ab96b3743b3ea0e", "score": "0.6089041", "text": "func (ctx *Context) IP() string {\n\tips := ctx.Proxy()\n\tif len(ips) > 0 && ips[0] != \"\" {\n\t\trip := strings.Split(ips[0], \":\")\n\t\treturn rip[0]\n\t}\n\tip := strings.Split(ctx.Request.RemoteAddr, \":\")\n\tif len(ip) > 0 {\n\t\tif ip[0] != \"[\" {\n\t\t\treturn ip[0]\n\t\t}\n\t}\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "ff4d0f10dd7c6e96c2c322f31c1f543d", "score": "0.6015222", "text": "func IP(r *_http.Request) string {\n\taddress := r.Header.Get(\"X-Real-IP\")\n\tif address != \"\" && address != \"unknown\" {\n\t\treturn address\n\t}\n\taddress = r.Header.Get(\"X-Forwarded-For\")\n\tif address != \"\" && address != \"unknown\" {\n\t\treturn address\n\t}\n\taddress = r.Header.Get(\"Proxy-Client-IP\")\n\tif address != \"\" && address != \"unknown\" {\n\t\treturn address\n\t}\n\taddress = r.Header.Get(\"WL-Proxy-Client-IP\")\n\tif address != \"\" && address != \"unknown\" {\n\t\treturn address\n\t}\n\taddress = r.RemoteAddr\n\treturn address[:strings.Index(address, \":\")]\n}", "title": "" }, { "docid": "4e2f01702c0670bc93d7d01ed084d3b2", "score": "0.600352", "text": "func (o PodIPOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PodIP) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "92b98606f706200eee6350fa9e865091", "score": "0.5954302", "text": "func cfgIP(cfg *conf.ConfigFile, section, option string) (net.IP, error) {\n\tipStr := cfgOpt(cfg, section, option)\n\tif ipStr == \"\" {\n\t\treturn nil, nil\n\t}\n\tip := net.ParseIP(ipStr)\n\tif ip == nil {\n\t\treturn nil, fmt.Errorf(\"%s: %q is not a valid IP address\", option, ipStr)\n\t}\n\treturn ip, nil\n}", "title": "" }, { "docid": "aa38ba29784afe2024c8b8369254efa7", "score": "0.59045607", "text": "func MyIP(token ...string) (*IPInfo, error) {\n\treturn getInfo(fmt.Sprintf(\"%s/json\", ipinfoURI), token)\n}", "title": "" }, { "docid": "2f9da716028b269f338a0fb5f24d7215", "score": "0.588229", "text": "func (do DriverOpts) IP(key, env string) (net.IP, bool) {\n\tif value, ok := do.String(key, env); ok {\n\t\treturn net.ParseIP(value), true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "a4584565a3c612fca1fe834d6030b30b", "score": "0.58790165", "text": "func IP(r *http.Request) string {\n\tip, _, _ := net.SplitHostPort(r.RemoteAddr)\n\tif xff := r.Header.Get(\"X-Forwarded-For\"); xff != \"\" {\n\t\tif i := strings.IndexAny(xff, \",;\"); i != -1 {\n\t\t\txff = xff[:i]\n\t\t}\n\t\tip += \",\" + xff\n\t}\n\tif xrip := r.Header.Get(\"X-Real-IP\"); xrip != \"\" {\n\t\tip += \",\" + xrip\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "34442f85e084ec57798557e32c66cc59", "score": "0.58731496", "text": "func (m *FieldTypeMutation) SetIP(n net.IP) {\n\tm.ip = &n\n}", "title": "" }, { "docid": "2f559face082d8fa1c7b3141660a8a74", "score": "0.5841323", "text": "func (c *Client) IP(ip net.IP, header http.Header, queryString url.Values) (*protocol.IPNetwork, http.Header, error) {\n\tif ip == nil {\n\t\treturn nil, nil, fmt.Errorf(\"undefined IP\")\n\t}\n\n\tresp, err := c.Transport.Fetch(c.URIs, QueryTypeIP, ip.String(), header, queryString)\n\tdefer func() {\n\t\tif resp != nil && resp.Body != nil {\n\t\t\tresp.Body.Close()\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tif resp != nil {\n\t\t\treturn nil, resp.Header, err\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\tipNetwork := &protocol.IPNetwork{}\n\tif err = json.NewDecoder(resp.Body).Decode(ipNetwork); err != nil {\n\t\treturn nil, resp.Header, err\n\t}\n\n\treturn ipNetwork, resp.Header, nil\n}", "title": "" }, { "docid": "c693d4bba6731a16156c765a562a37ee", "score": "0.58362037", "text": "func (mp UIDBuilder) RegisterIP(ip, tag string, tout *uint) (mpB UIDBuilder) {\n\tif mp.err != nil {\n\t\tmpB = UIDBuilder{err: mp.err}\n\t\treturn\n\t}\n\tmpB = mp.Register([]IPTag{{IP: ip, Tag: tag, Tout: tout}})\n\treturn\n}", "title": "" }, { "docid": "ef1964f64f4e9c435a41502cd0d2ae6c", "score": "0.5823724", "text": "func InitVCIP(vc *VsphereConfig) string {\n\tvar ip string\n\tif vc.IP != \"\" {\n\t\tip = vc.IP\n\t} else {\n\t\tre := regexp.MustCompile(`([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})`)\n\t\tmatch := re.FindAllStringSubmatch(vc.Addr, -1)\n\t\tif match != nil {\n\t\t\tip = match[0][1]\n\t\t}\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "d4a45c08132eaa0a569cd7b43a3298ac", "score": "0.5791515", "text": "func IPTokenExtractor(c *gin.Context) string { return c.ClientIP() }", "title": "" }, { "docid": "8c0c8638790f39f85fc4b3d6d7900290", "score": "0.57903236", "text": "func (msg MsgSetIPAddress) Type() string { return \"set_ip_address\" }", "title": "" }, { "docid": "61773e747b81ed3e241576e381da50f2", "score": "0.57749116", "text": "func (rk Destination) IP() net.IP {\n\treturn net.IP(rk[2 : 2+rk[1]])\n}", "title": "" }, { "docid": "dcf39d7789f6d2978f54978220e2305f", "score": "0.57400733", "text": "func (o LoadBalancerIngressOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LoadBalancerIngress) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d720340e5320035465337200c041630d", "score": "0.5730393", "text": "func (ctrl *Controller) IP() string {\n\treturn ctrl.bridgeIP\n}", "title": "" }, { "docid": "5fbfce8c374b6206d04e23506d8d5321", "score": "0.5711107", "text": "func (o EndpointAddressOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EndpointAddress) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "85d5f151a0a8464b20040105874a59d9", "score": "0.57019925", "text": "func (i Uint128) IP(bits int) net.IP {\n\tif bits == 32 {\n\t\tb := make([]byte, 4)\n\t\tbinary.BigEndian.PutUint32(b, uint32(i.low))\n\n\t\treturn net.IP(b)\n\t}\n\n\tb := make([]byte, 16)\n\n\tbinary.BigEndian.PutUint64(b[:8], i.high)\n\tbinary.BigEndian.PutUint64(b[8:], i.low)\n\n\treturn net.IP(b)\n}", "title": "" }, { "docid": "e50023deb06d18b829f0a9f9220d548e", "score": "0.5700212", "text": "func (c *Config) IP(key string) (val net.IP, err error) {\n\tstr, err := c.String(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tval = net.ParseIP(str)\n\tif val == nil {\n\t\treturn nil, ErrParseValue\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "efcd6db04b9d3235b4c1a77847d5b277", "score": "0.56997675", "text": "func IPVersion(ip net.IP) int {\n\tif ip.To4() != nil {\n\t\treturn 4\n\t}\n\treturn 6\n}", "title": "" }, { "docid": "303c06f6ec781af898ec31701b8fa34a", "score": "0.56959045", "text": "func (o *GetIPIPFirewallIPOnFirewallRuleSequenceParams) SetIP(ip string) {\n\to.IP = ip\n}", "title": "" }, { "docid": "a10e519c177ea1fb641ac2249e52bd55", "score": "0.56930625", "text": "func (o *SIMOp) AssignIP(ctx context.Context, zone string, id types.ID, param *sacloud.SIMAssignIPRequest) error {\n\t// TODO not implemented\n\terr := errors.New(\"not implements\")\n\treturn err\n}", "title": "" }, { "docid": "5dcdbbc04becb0c185a1281fc5c8615c", "score": "0.56853926", "text": "func (c *Check) IP() string {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\tbody, err := getResponseBody(c.Client, c.Req)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\terr = json.Unmarshal(body, &c.Res)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn c.Res.ResponseIP\n}", "title": "" }, { "docid": "8535f8e118ce4e4e5c233953cd26a187", "score": "0.56847996", "text": "func (sc *ServerCreate) SetIP(s string) *ServerCreate {\n\tsc.mutation.SetIP(s)\n\treturn sc\n}", "title": "" }, { "docid": "3f74f7dd1cacaf2571fbf4893c3fa107", "score": "0.56740427", "text": "func IP(flags []cli.Flag) *cli.Command {\n\n\t// declare a command variable to return a pointer to it\n\tcommand := cli.Command{\n\t\tName: \"ip\",\n\t\tUsage: \"Looks up the IPs for a particular host\",\n\t\tFlags: flags,\n\t\tAction: func(c *cli.Context) error {\n\t\t\tip, err := net.LookupIP(c.String(\"host\"))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, i := range ip {\n\t\t\t\tfmt.Println(i.String())\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\t// return the address of command\n\treturn &command\n}", "title": "" }, { "docid": "9779df098b36b58c340a18054d9cabe2", "score": "0.5669098", "text": "func IPAddressOfRequest(headers http.Header, defAddr string) (addr string) {\n\taddr = headers.Get(HeaderXRealIp)\n\tif len(addr) == 0 {\n\t\taddr, _ = ParseXForwardedFor(headers.Get(HeaderXForwardedFor))\n\t\tif len(addr) == 0 {\n\t\t\taddr = defAddr\n\t\t}\n\t}\n\taddr, _, _ = libnet.ParseIPPort(addr, 0)\n\treturn addr\n}", "title": "" }, { "docid": "f9a5995255c39d37cdf47c491c52b66c", "score": "0.5657684", "text": "func (s State) IP() string {\n\tip, _, err := net.SplitHostPort(s.W.RemoteAddr().String())\n\tif err != nil {\n\t\treturn s.W.RemoteAddr().String()\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "39d7250b9f8cf9c76e742b4181e229ad", "score": "0.5649359", "text": "func (s *Slave) IP() string {\n\t// PID format: Host@IP:Port\n\ts1 := strings.Split(s.PID, \"@\")\n\ts2 := strings.Split(s1[1], \":\")\n\treturn s2[0]\n}", "title": "" }, { "docid": "c43ebd94260f27e8f57e1aff488fe325", "score": "0.5647598", "text": "func (p *parserMixin) IPList() (target *[]net.IP) {\n\ttarget = new([]net.IP)\n\tp.IPListVar(target)\n\treturn\n}", "title": "" }, { "docid": "6687a798ff15f71dd6580639e9b03b77", "score": "0.5636597", "text": "func (m *FieldTypeMutation) IP() (r net.IP, exists bool) {\n\tv := m.ip\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "796eeaf7d0605c9cc9bc64085e8847c2", "score": "0.5631396", "text": "func MustIP(i interface{}) IP {\n\tip, err := ParseIP(i)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ip\n}", "title": "" }, { "docid": "cda49f5d7ab7c4a4e58b449872c4cc7b", "score": "0.5613511", "text": "func (o BasicThresholdOutput) InternetIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *BasicThreshold) pulumi.StringOutput { return v.InternetIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7b392763cbc59dac59ff4561e74a78fe", "score": "0.5606461", "text": "func TestHttpIp(t *testing.T) {\n\thandlerFunc := http.HandlerFunc(handleRequest)\n\tt.Run(\"Fail to getIp\", func(t *testing.T) {\n\t\tapitest.New().\n\t\t\t//Report(apitest.SequenceDiagram()).\n\t\t\tHandler(handlerFunc).\n\t\t\tGet(\"/getIp\").\n\t\t\tExpect(t).\n\t\t\tStatus(http.StatusBadRequest).\n\t\t\tEnd()\n\t})\n\n\tt.Run(\"Success to getIp using X-REAL-IP\", func(t *testing.T) {\n\t\tapitest.New().\n\t\t\t//Report(apitest.SequenceDiagram()).\n\t\t\tHandler(handlerFunc).\n\t\t\tGet(\"/getIp\").\n\t\t\tHeader(\"X-REAL-IP\", \"172.17.0.2\").\n\t\t\tExpect(t).\n\t\t\tBody(`172.17.0.2`).\n\t\t\tStatus(http.StatusOK).\n\t\t\tEnd()\n\t})\n\n\tt.Run(\"Success to getIp using X-FORWARDED-FOR\", func(t *testing.T) {\n\t\tapitest.New().\n\t\t\t//Report(apitest.SequenceDiagram()).\n\t\t\tHandler(handlerFunc).\n\t\t\tGet(\"/getIp\").\n\t\t\tHeader(\"X-FORWARDED-FOR\", \"172.17.0.2\").\n\t\t\tExpect(t).\n\t\t\tBody(`172.17.0.2`).\n\t\t\tStatus(http.StatusOK).\n\t\t\tEnd()\n\t})\n}", "title": "" }, { "docid": "7190302593c242da850adce949639bb9", "score": "0.5595013", "text": "func (o HostAliasOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HostAlias) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8b457a9ab52a9dcbb26cbf3232021ae5", "score": "0.55707157", "text": "func (s *Sifchain) IP() net.IP {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\treturn s.appDesc.IP\n}", "title": "" }, { "docid": "86b8510e58aaa50bbf0635044a20ce6f", "score": "0.5570223", "text": "func (uluo *UserLogUpdateOne) SetIP(s string) *UserLogUpdateOne {\n\tuluo.mutation.SetIP(s)\n\treturn uluo\n}", "title": "" }, { "docid": "7a817fa59232b22249510b7dbb392e0c", "score": "0.5560841", "text": "func NetIP(arg net.IP, err error) net.IP {\n\tOK(err)\n\treturn arg\n}", "title": "" }, { "docid": "a506f1b2203af41587cf33f3becf9418", "score": "0.5560152", "text": "func ValidateIP(input string) error {\n\t// Allow empty IP to support free IP assignment\n\tif input != \"\" {\n\t\t// check if IP address has correct format\n\t\tvar regex = regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`)\n\t\tvar regexDomain = regexp.MustCompile(`^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$`)\n\n\t\tif !regex.Match([]byte(input)) && !regexDomain.Match([]byte(input)) {\n\t\t\treturn errors.New(\"IP address or domain is not valid! \")\n\t\t}\n\t\t// check, that ip address was not already used\n\t\tfor _, ipConfig := range configuration.GetConfiguration().K8SManagement.IPConfig.Deployments {\n\t\t\tif strings.ToLower(ipConfig.IPAddress) == strings.ToLower(input) {\n\t\t\t\treturn errors.New(\"IP address or domain already in use! \")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ea0f79e68902e78bcfe53559db6bc32", "score": "0.55596614", "text": "func (o GetForwardEntriesEntryOutput) InternalIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetForwardEntriesEntry) string { return v.InternalIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7d1e518cbff00be119f112ae4a877a8e", "score": "0.5558369", "text": "func main() {\n\ts := defangIPaddr(\"1.2.3.4\")\n\tlog.Println(s)\n\n}", "title": "" }, { "docid": "30f47c734c2b3f1b36f3f48ac40a4f18", "score": "0.5548287", "text": "func MyIP() string {\n\tip, _ := Metadata(\"public-ipv4\")\n\treturn ip\n}", "title": "" }, { "docid": "72b6fa23325cf0065b415baf9173fea4", "score": "0.55395716", "text": "func (ulu *UserLogUpdate) SetIP(s string) *UserLogUpdate {\n\tulu.mutation.SetIP(s)\n\treturn ulu\n}", "title": "" }, { "docid": "e3f42f63bd4b4dbaa35c6ed193be7aa2", "score": "0.553733", "text": "func internalIP(node corev1.Node) string {\n\tfor _, address := range node.Status.Addresses {\n\t\tif address.Type == \"InternalIP\" {\n\t\t\treturn address.Address\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bb925412dc8f7936b0cf58ef4da6b6be", "score": "0.55345726", "text": "func (i4 I4) IP() net.IP {\n\treturn IntToIP(i4.ip)\n}", "title": "" }, { "docid": "f8f9c95d28d8631233a4f0369f6e66ee", "score": "0.5532092", "text": "func (api *SqrlSspAPI) RemoteIP(r *http.Request) string {\n\tipAddress := r.Header.Get(\"X-Forwarded-For\")\n\tif ipAddress == \"\" {\n\t\tipAddress = r.RemoteAddr\n\t}\n\treturn ipAddress\n}", "title": "" }, { "docid": "f0aa14c3006b0a872b2130acb332bb22", "score": "0.5506391", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecHostAliasesOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecHostAliases) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a35f79490e4d04f2613f78e3791f2974", "score": "0.5485602", "text": "func ExtractIP(r *http.Request) string {\n\tif DefaultIPExtractor == nil {\n\t\tDefaultIPExtractor = &firstForwardFor{}\n\t}\n\treturn DefaultIPExtractor.Get(r)\n}", "title": "" }, { "docid": "81a6879257677cebd8530812946a3299", "score": "0.54476494", "text": "func ParseIP(r *http.Request) string {\n\treturn r.RemoteAddr\n}", "title": "" }, { "docid": "664135ce1bceb07216e14901291c8e8d", "score": "0.5441586", "text": "func HasIP(claims jwt.MapClaims, remoteAddrs []string) bool {\n\n\t// split address into ip and port\n\t//remoteAddrs[index], _, _ = net.SplitHostPort(ip)\n\n\t//ip = \"192.1.1.1\"\n\t//check with ip specified in token is present in the caller ip url\n\tipToken := claims[\"ips\"].([]interface{})\n\tipString := make([]string, len(ipToken))\n\tfor _, remoteAddr := range remoteAddrs {\n\t\tfor i, v := range ipToken {\n\t\t\tipString[i] = v.(string)\n\t\t\tif strings.Contains(remoteAddr, ipString[i]) == true {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b7d77c15be29f85c005dfece3b2c30ce", "score": "0.54299563", "text": "func (o ProjectIpWhiteListOutput) IpList() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ProjectIpWhiteList) *string { return v.IpList }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2028458ed93acdb6df4d4e9098a4d606", "score": "0.5426407", "text": "func (d *BP35C2) SetIP(ip string) {\n\td.localIP = ip\n}", "title": "" }, { "docid": "42eb8ed90871841794371707cec56fcd", "score": "0.5425511", "text": "func (a *Allocator) IP(service string) net.IP {\n\treturn a.svcToIP[service]\n}", "title": "" }, { "docid": "260483703b2fd167fa04561d62d63500", "score": "0.54232", "text": "func (id ID) IP() net.IP {\n\tswitch id.mIDType {\n\tcase IPv4:\n\t\tvar ip [net.IPv4len]byte\n\t\tcopy(ip[:], id.machineID[:net.IPv4len])\n\t\treturn ip[:]\n\tcase IPv6:\n\t\tvar ip [net.IPv6len]byte\n\t\tcopy(ip[:], id.machineID[:net.IPv6len])\n\t\treturn ip[:]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31552b5ee4db57412770e6083d2a1604", "score": "0.5419471", "text": "func (*Afts_NextHop_IpInIp) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_gribi_aft_gribi_aft_proto_rawDescGZIP(), []int{1, 8, 1}\n}", "title": "" }, { "docid": "5a5e62bc2968939d2057e90416d40d41", "score": "0.54085726", "text": "func (b *Bucket) IPAddress(longName, usage string) *core.IPAddressFlag {\n\tf := core.NewIPAddress(longName, usage)\n\tb.flags = append(b.flags, f)\n\treturn f\n}", "title": "" }, { "docid": "dea351d032abe01de8fafdbee91d0b35", "score": "0.5402231", "text": "func (e *TSVEvent) IPAddr(ip net.IP) *TSVEvent {\n\tif ip4 := ip.To4(); ip4 != nil {\n\t\te.buf = strconv.AppendInt(e.buf, int64(ip4[0]), 10)\n\t\te.buf = append(e.buf, '.')\n\t\te.buf = strconv.AppendInt(e.buf, int64(ip4[1]), 10)\n\t\te.buf = append(e.buf, '.')\n\t\te.buf = strconv.AppendInt(e.buf, int64(ip4[2]), 10)\n\t\te.buf = append(e.buf, '.')\n\t\te.buf = strconv.AppendInt(e.buf, int64(ip4[3]), 10)\n\t} else {\n\t\te.buf = append(e.buf, ip.String()...)\n\t}\n\te.buf = append(e.buf, e.sep)\n\treturn e\n}", "title": "" }, { "docid": "5988d537008c9d254ce3523779d2b484", "score": "0.5386148", "text": "func (r *RTorrent) IP() (string, error) {\n\tresult, err := r.xmlrpcClient.Call(\"get_ip\")\n\treturn result.(string), err\n}", "title": "" }, { "docid": "d3d859a8b35d73157485f05053ce9dd1", "score": "0.53830284", "text": "func (g GetIP) Name() string {\n\treturn \"getip\"\n}", "title": "" }, { "docid": "1171eae79c7d83d2e4630e4e7c5397b7", "score": "0.53734297", "text": "func GetUserIP(r *http.Request) string {\n\treturn r.Header.Get(ConstUserIPHeaderKey)\n}", "title": "" }, { "docid": "b89aec9e12ff7011e02a0ee3b8048b8e", "score": "0.535053", "text": "func ParseIP(r *http.Request) (ip string) {\n\tlog.Printf(\"Visitor Remote Addr: %s\", r.RemoteAddr)\n\tlog.Printf(\"Visitor Forwarded Addr: %s\", r.Header.Get(\"X-Forwarded-For\"))\n\n\tif r.Header.Get(\"X-Forwarded-For\") != \"\" {\n\t\t// this could actually be several IPs, we're just gonna play simple and grab the first one\n\t\tips := strings.Split(r.Header.Get(\"X-Forwarded-For\"), \", \")\n\t\tif len(ips) > 0 {\n\t\t\t//ip = ips[len(ips)-1]\n\t\t\tip = ips[0]\n\t\t}\n\n\t} else {\n\t\tparts := strings.Split(r.RemoteAddr, \":\")\n\t\tif len(parts) > 0 {\n\t\t\tip = parts[0]\n\t\t}\n\t}\n\n\treturn ip\n}", "title": "" }, { "docid": "69cbdc0524da6952954fbc3fb06f0f6b", "score": "0.5342315", "text": "func defangIP(ip string) string {\n\tip = strings.Replace(ip, \"[\", \"\", 1)\n\tip = strings.Replace(ip, \"]\", \"\", 1)\n\tss := strings.Split(ip, \":\")\n\tip = strings.Join(ss[:len(ss)-1], \":\")\n\treturn ip\n}", "title": "" }, { "docid": "51f0be6851f8acadbf6c109d473d8228", "score": "0.53419346", "text": "func (dl *DomainList) SetIP(ip string) {\n\tdl.IP = ip\n}", "title": "" }, { "docid": "b6ca8f6f98ef149163ce4c625da3f835", "score": "0.53413224", "text": "func callIPAMWithIP(ip net.IP, conf types.NetConf, args *skel.CmdArgs, logger *logrus.Entry) (*current.Result, error) {\n\n\t// Save the original value of the CNI_ARGS ENV var for backup.\n\toriginalArgs := os.Getenv(\"CNI_ARGS\")\n\tlogger.Debugf(\"Original CNI_ARGS=%s\", originalArgs)\n\n\tipamArgs := struct {\n\t\tcnitypes.CommonArgs\n\t\tIP net.IP `json:\"ip,omitempty\"`\n\t}{}\n\n\tif err := cnitypes.LoadArgs(args.Args, &ipamArgs); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif ipamArgs.IP != nil {\n\t\tlogger.Errorf(\"'IP' variable already set in CNI_ARGS environment variable.\")\n\t}\n\n\t// Request the provided IP address using the IP CNI_ARG.\n\t// See: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#cni_args for more info.\n\tnewArgs := originalArgs + \";IP=\" + ip.String()\n\tlogger.Debugf(\"New CNI_ARGS=%s\", newArgs)\n\n\t// Set CNI_ARGS to the new value.\n\terr := os.Setenv(\"CNI_ARGS\", newArgs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error setting CNI_ARGS environment variable: %v\", err)\n\t}\n\n\t// Run the IPAM plugin.\n\tlogger.Debugf(\"Calling IPAM plugin %s\", conf.IPAM.Type)\n\tr, err := ipam.ExecAdd(conf.IPAM.Type, args.StdinData)\n\tif err != nil {\n\t\t// Restore the CNI_ARGS ENV var to it's original value,\n\t\t// so the subsequent calls don't get polluted by the old IP value.\n\t\tif err := os.Setenv(\"CNI_ARGS\", originalArgs); err != nil {\n\t\t\tlogger.Errorf(\"Error setting CNI_ARGS environment variable: %v\", err)\n\t\t}\n\t\treturn nil, err\n\t}\n\tlogger.Debugf(\"IPAM plugin returned: %+v\", r)\n\n\t// Restore the CNI_ARGS ENV var to it's original value,\n\t// so the subsequent calls don't get polluted by the old IP value.\n\tif err := os.Setenv(\"CNI_ARGS\", originalArgs); err != nil {\n\t\t// Need to clean up IP allocation if this step doesn't succeed.\n\t\tutils.ReleaseIPAllocation(logger, conf, args)\n\t\tlogger.Errorf(\"Error setting CNI_ARGS environment variable: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// Convert IPAM result into current Result.\n\t// IPAM result has a bunch of fields that are optional for an IPAM plugin\n\t// but required for a CNI plugin, so this is to populate those fields.\n\t// See CNI Spec doc for more details.\n\tipamResult, err := current.NewResultFromResult(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ipamResult.IPs) == 0 {\n\t\treturn nil, errors.New(\"IPAM plugin returned missing IP config\")\n\t}\n\n\treturn ipamResult, nil\n}", "title": "" }, { "docid": "a925017197e274c36ae4de1982fad671", "score": "0.5332418", "text": "func (f *JsonDB) UpdateIP(project string, ip models.IP) error {\n\treturn errors.New(\"Not implemented yet\")\n}", "title": "" }, { "docid": "5ef69050debd43fb5de50ae0cfe7eade", "score": "0.5330911", "text": "func (ctlr *Controller) requestIP(ipamLabel string, host string, key string) (string, int) {\n\tipamCR := ctlr.getIPAMCR()\n\tvar ip string\n\tvar ipReleased bool\n\tif ipamCR == nil {\n\t\treturn \"\", NotEnabled\n\t}\n\n\tif ipamLabel == \"\" {\n\t\treturn \"\", InvalidInput\n\t}\n\n\tif host != \"\" {\n\t\t//For VS server\n\t\tfor _, ipst := range ipamCR.Status.IPStatus {\n\t\t\tif ipst.IPAMLabel == ipamLabel && ipst.Host == host {\n\t\t\t\t// IP will be returned later when availability of corresponding spec is confirmed\n\t\t\t\tip = ipst.IP\n\t\t\t}\n\t\t}\n\n\t\tfor _, hst := range ipamCR.Spec.HostSpecs {\n\t\t\tif hst.Host == host {\n\t\t\t\tif hst.IPAMLabel == ipamLabel {\n\t\t\t\t\tif ip != \"\" {\n\t\t\t\t\t\t// IP extracted from the corresponding status of the spec\n\t\t\t\t\t\treturn ip, Allocated\n\t\t\t\t\t}\n\n\t\t\t\t\t// HostSpec is already updated with IPAMLabel and Host but IP not got allocated yet\n\t\t\t\t\treturn \"\", Requested\n\t\t\t\t} else {\n\t\t\t\t\t// Different Label for same host, this indicates Label is updated\n\t\t\t\t\t// Release the old IP, so that new IP can be requested\n\t\t\t\t\tctlr.releaseIP(hst.IPAMLabel, hst.Host, \"\")\n\t\t\t\t\tipReleased = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ip != \"\" && !ipReleased {\n\t\t\t// Status is available for non-existing Spec\n\t\t\t// Let the resource get cleaned up and re request later\n\t\t\treturn \"\", NotRequested\n\t\t}\n\n\t\tipamCR.SetResourceVersion(ipamCR.ResourceVersion)\n\t\tipamCR.Spec.HostSpecs = append(ipamCR.Spec.HostSpecs, &ficV1.HostSpec{\n\t\t\tHost: host,\n\t\t\tIPAMLabel: ipamLabel,\n\t\t})\n\t} else if key != \"\" {\n\t\t//For Transport Server\n\t\tfor _, ipst := range ipamCR.Status.IPStatus {\n\t\t\tif ipst.IPAMLabel == ipamLabel && ipst.Key == key {\n\t\t\t\t// IP will be returned later when availability of corresponding spec is confirmed\n\t\t\t\tip = ipst.IP\n\t\t\t}\n\t\t}\n\n\t\tfor _, hst := range ipamCR.Spec.HostSpecs {\n\t\t\tif hst.Key == key {\n\t\t\t\tif hst.IPAMLabel == ipamLabel {\n\t\t\t\t\tif ip != \"\" {\n\t\t\t\t\t\t// IP extracted from the corresponding status of the spec\n\t\t\t\t\t\treturn ip, Allocated\n\t\t\t\t\t}\n\n\t\t\t\t\t// HostSpec is already updated with IPAMLabel and Host but IP not got allocated yet\n\t\t\t\t\treturn \"\", Requested\n\t\t\t\t} else {\n\t\t\t\t\t// Different Label for same key, this indicates Label is updated\n\t\t\t\t\t// Release the old IP, so that new IP can be requested\n\t\t\t\t\tctlr.releaseIP(hst.IPAMLabel, \"\", hst.Key)\n\t\t\t\t\tipReleased = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ip != \"\" && !ipReleased {\n\t\t\t// Status is available for non-existing Spec\n\t\t\t// Let the resource get cleaned up and re request later\n\t\t\treturn \"\", NotRequested\n\t\t}\n\n\t\tipamCR.SetResourceVersion(ipamCR.ResourceVersion)\n\t\tipamCR.Spec.HostSpecs = append(ipamCR.Spec.HostSpecs, &ficV1.HostSpec{\n\t\t\tKey: key,\n\t\t\tIPAMLabel: ipamLabel,\n\t\t})\n\t} else {\n\t\tlog.Debugf(\"[IPAM] Invalid host and key.\")\n\t\treturn \"\", InvalidInput\n\t}\n\n\t_, err := ctlr.ipamCli.Update(ipamCR)\n\tif err != nil {\n\t\tlog.Errorf(\"[ipam] Error updating IPAM CR : %v\", err)\n\t\treturn \"\", NotRequested\n\t}\n\n\tlog.Debugf(\"[ipam] Updated IPAM CR.\")\n\treturn \"\", Requested\n\n}", "title": "" }, { "docid": "eaa1befe1a9de6eed63e64e997841d03", "score": "0.53280884", "text": "func IPAddress(v string) predicate.Operation {\n\treturn predicate.Operation(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIPAddress), v))\n\t})\n}", "title": "" }, { "docid": "57c18e1e4c9cf82996ccdac134ccac74", "score": "0.53261214", "text": "func (wl Stub) Add(ip net.IP) {\n\tlog.Printf(\"WARNING: IP %s added to whitelist but whitelisting is stubbed\", ip)\n}", "title": "" }, { "docid": "9ce1c411fb0e435410a865a75371ff74", "score": "0.53205353", "text": "func NewIPTokenExtractor(header string) TokenExtractor {\n\treturn func(c *gin.Context) string {\n\t\tif clientIP := strings.TrimSpace(strings.Split(c.Request.Header.Get(header), \",\")[0]); clientIP != \"\" {\n\t\t\tip := strings.Split(clientIP, \":\")[0]\n\t\t\tif parsedIP := net.ParseIP(ip); parsedIP != nil {\n\t\t\t\treturn ip\n\t\t\t}\n\t\t}\n\t\treturn IPTokenExtractor(c)\n\t}\n}", "title": "" }, { "docid": "85acb030f1667ffa903320c434523933", "score": "0.5311631", "text": "func (evt *Event) IP() string {\n\treturn evt.RequestContext.Identity.SourceIP\n}", "title": "" }, { "docid": "52231eb63b12c10a85a594b8bd294ec5", "score": "0.53109866", "text": "func Init(ipKey string) {\n\tIpKey = ipKey\n}", "title": "" }, { "docid": "4c74996485cf731769fc64e8a737e218", "score": "0.53088903", "text": "func (h *Host) IP() string {\n\treturn h.ip\n}", "title": "" }, { "docid": "f66620d9861204d12bd419add41877e9", "score": "0.53065187", "text": "func (o *KubernetesIpV4ConfigAllOf) SetIp(v string) {\n\to.Ip = &v\n}", "title": "" }, { "docid": "4d50163a89e2194aa75b5e87f90b7d00", "score": "0.53061426", "text": "func (m *Mechanism) SrcIP() net.IP {\n\treturn net.ParseIP(m.GetParameters()[SrcIP])\n}", "title": "" }, { "docid": "575858af112ea15af3ee87dd9aeeb260", "score": "0.5305014", "text": "func DefangIP(ip string) string {\n\tip = strings.Replace(ip, \"[\", \"\", 1)\n\tip = strings.Replace(ip, \"]\", \"\", 1)\n\tss := strings.Split(ip, \":\")\n\tip = strings.Join(ss[:len(ss)-1], \":\")\n\treturn ip\n}", "title": "" }, { "docid": "4a1174c68967df0a8d8af8291a4eca86", "score": "0.5299437", "text": "func NewIPRule(fieldExpr string) Rule {\n\treturn ipRule{\n\t\tfieldExpr: fieldExpr,\n\t\tname: \"ipRule\",\n\t}\n}", "title": "" }, { "docid": "769d8a06800850682bdda50169ab56cc", "score": "0.52931434", "text": "func (o *ProfilesGetParams) SetIP(ip *string) {\n\to.IP = ip\n}", "title": "" }, { "docid": "3c3256dcdf733a08d963361223abec40", "score": "0.528795", "text": "func (options *CreateALBOptions) SetIp(ip string) *CreateALBOptions {\n\toptions.Ip = core.StringPtr(ip)\n\treturn options\n}", "title": "" }, { "docid": "f9957d39800427fc54d83820bdcedb4f", "score": "0.5285911", "text": "func PrintIP() error {\n\tcurrent, err := Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tip, err := getIP(current)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(ip)\n\n\treturn nil\n}", "title": "" }, { "docid": "bd327a94ec4917ab0bbf7aed0af042aa", "score": "0.52846795", "text": "func (k *Key) IP() net.IP {\n\treturn byteorder.NtohIP(k.Address[:])\n}", "title": "" }, { "docid": "e49f58768576f0cae3f1cb2cd782b71d", "score": "0.5276677", "text": "func ipAllowedInternal(ip netaddr.IP, appToAccess string, rules []ipRule) (bool, string) {\n\tif matchingRule := ruleForIp(ip, rules); matchingRule != nil {\n\t\tif matchingRule.AllowsApp(appToAccess) {\n\t\t\treturn true, \"\"\n\t\t} else {\n\t\t\treturn false, fmt.Sprintf(\"your IP (%s) is not allowed (explicit deny)\", ip.String())\n\t\t}\n\t}\n\n\t// no matching rule found => implicit deny\n\treturn false, fmt.Sprintf(\"your IP (%s) is not allowed (implicit deny)\", ip.String())\n}", "title": "" }, { "docid": "f28208c911c9fc84e7a4110a0823c8c3", "score": "0.5262539", "text": "func validIP(val string, patt string) (result bool) {\n\n\tif IP := net.ParseIP(val); IP != nil {\n\t\tswitch patt {\n\t\tcase \"IP\":\n\t\t\tresult = true\n\t\tcase \"IPv4\":\n\t\t\tif IP.To4() != nil {\n\t\t\t\tresult = true\n\t\t\t}\n\t\tcase \"IPv6\":\n\t\t\tif IP.To4() == nil {\n\t\t\t\tresult = true\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "77442a1033458d260eae8fd5e8b63e83", "score": "0.5261376", "text": "func (h *APIface) subnetIP(suffix byte) net.IP {\n\treturn net.IPv4(192, 168, h.subnetIdx, suffix)\n}", "title": "" }, { "docid": "4d8604dea71aa7cb75127fd782cda393", "score": "0.525022", "text": "func IpFormat(ip string) string {\n\tipObj := net.ParseIP(ip)\n\t// Return the ip/host as is if it's either a hostname or an IPv4 address.\n\tif ipObj == nil || ipObj.To4() != nil {\n\t\treturn ip\n\t}\n\n\treturn fmt.Sprintf(\"[%s]\", ip)\n}", "title": "" }, { "docid": "6ab4fc14fc742c85d19fbb3fe1ddc5d5", "score": "0.5235388", "text": "func parseIP(ip string) net.IP {\n\tif goip := net.ParseIP(ip); goip != nil {\n\t\treturn goip\n\t}\n\tif goip := net.ParseIP(expandIP(ip)); goip != nil {\n\t\treturn goip\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4a27e6ddeccc64f1cf6d2a9b0e81c74", "score": "0.5234797", "text": "func MyIP() (*IPInfo, error) {\n\treturn getInfo(fmt.Sprintf(\"%s/json\", ipstackURI))\n}", "title": "" }, { "docid": "dca53a23213bc224b3a9385ad7ca6d8c", "score": "0.52339494", "text": "func ExternalIP() (string, error) {\n\tresp, err := http.Get(\"https://ifconfig.me/\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(body)), nil\n}", "title": "" }, { "docid": "34d0276f7261e2f78986be292115d95d", "score": "0.5233079", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecPortsOutput) HostIP() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsExplainerContainerSpecPorts) *string { return v.HostIP }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "33f85df2ef05911e9aaa21d55757e43f", "score": "0.5227848", "text": "func (detector *valueDetector) isIP(str string) bool {\n\treturn net.ParseIP(str) != nil\n}", "title": "" }, { "docid": "6ab34d39f442b01f1476c16892a0bb35", "score": "0.5225398", "text": "func formatIP(ip net.IP) string {\n\tif ip == nil {\n\t\treturn \"\"\n\t}\n\treturn ip.String()\n}", "title": "" }, { "docid": "40addf39aa616ca770fd6a8dac7e3f9d", "score": "0.52248186", "text": "func (f *JsonDB) CreateIP(project string, ip models.IP) error {\n\treturn errors.New(\"Not implemented yet\")\n}", "title": "" }, { "docid": "a6a122c4c0bb6ed2295b5f4b3f2de011", "score": "0.52243125", "text": "func (o ContainerPortOutput) HostIP() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ContainerPort) *string { return v.HostIP }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f082933a851896a9ccb71cb1c4e7c723", "score": "0.5216999", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersPortsOutput) HostIP() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersPorts) *string { return v.HostIP }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cc853f5615b7d9c2133bda4dbfbe1050", "score": "0.52168316", "text": "func RemoteIP(r *http.Request) string {\n\taddr := RemoteAddr(r)\n\n\t// Try parsing it as \"IP:port\"\n\tif ip, _, err := net.SplitHostPort(addr); err == nil {\n\t\treturn ip\n\t}\n\n\treturn addr\n}", "title": "" }, { "docid": "c92556de3f83fb02b72f7fd7692bd01f", "score": "0.5216782", "text": "func CaptureIp() captureIp {\n\treturn std.CaptureIp()\n}", "title": "" }, { "docid": "d910e6e98f7273bdd7a6dd7a89623ca1", "score": "0.5202926", "text": "func ForeignIP(ip string, token ...string) (*IPInfo, error) {\n\treturn getInfo(fmt.Sprintf(\"%s/%s/json\", ipinfoURI, ip), token)\n}", "title": "" }, { "docid": "826a8d4098fe3741d31090f86b09fc94", "score": "0.5201744", "text": "func (o GatewayOutput) InternetIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.InternetIp }).(pulumi.StringOutput)\n}", "title": "" } ]
50d0225ebbbd0fda7296753d7866a8a8
tests marshal and unmarshal.
[ { "docid": "5d16157e8fd2ec3ca1cdeebbbd941154", "score": "0.0", "text": "func testKerberosAuthenticationYAML(t *testing.T, expectedAuthStr string, expectedMethod KerberosAuthenticationMethod) {\n\texpectedConfigStr := fmt.Sprintf(`CurrentContext: %s\nContexts:\n %s:\n Host: %s\n Timeout: %s\n Insecure: %v\n Debug: %v\n %s:\n %s: %s%s`,\n\t\ttestCurrentContextField,\n\t\ttestCurrentContextField,\n\t\ttestHostField,\n\t\ttestTimeoutField,\n\t\ttestInsecureField,\n\t\ttestDebugField,\n\t\tkerberosAuthenticationKeyYAML,\n\t\tkerberosConfFileKeyYAML,\n\t\ttestKerberosConfFileField,\n\t\texpectedAuthStr,\n\t)\n\n\texpectedConfig := Config{\n\t\tCurrentContext: testCurrentContextField,\n\t\tContexts: map[string]*ClientConfig{\n\t\t\ttestCurrentContextField: {\n\t\t\t\tHost: testHostField,\n\t\t\t\tAuthentication: KerberosAuthentication{ConfFile: testKerberosConfFileField, Method: expectedMethod},\n\t\t\t\tTimeout: testTimeoutField,\n\t\t\t\tInsecure: testInsecureField,\n\t\t\t\tDebug: testDebugField,\n\t\t\t},\n\t\t},\n\t}\n\n\tgotConfig, err := ConfigMarshalYAML(expectedConfig)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif expected, got := expectedConfigStr, string(gotConfig); expected != got {\n\t\tt.Fatalf(\"expected raw yaml configuration to be:\\n'%s'\\nbut got:\\n'%s'\", expected, got)\n\t}\n\n\tvar gotUnmarshaledConfig Config\n\tif err := ConfigUnmarshalYAML([]byte(expectedConfigStr), &gotUnmarshaledConfig); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif !reflect.DeepEqual(expectedConfig, gotUnmarshaledConfig) {\n\t\tonlyAuthExpected := expectedConfig.Contexts[testCurrentContextField].Authentication\n\t\tif _, hasContext := gotUnmarshaledConfig.Contexts[testCurrentContextField]; !hasContext {\n\t\t\tt.Fatalf(\"expected configuration has a context with key '%s' but gotten unmarshaled has none, more:\\n%#+v\\nvs\\n%#+v\", testCurrentContextField, expectedConfig, gotUnmarshaledConfig)\n\t\t}\n\t\tonlyAuthGot := gotUnmarshaledConfig.Contexts[testCurrentContextField].Authentication\n\t\tt.Fatalf(\"expected configuration structure after unmarshal the succeed marshaled:\\n%#+v\\nbut got:\\n%#+v\", onlyAuthExpected, onlyAuthGot)\n\t}\n}", "title": "" } ]
[ { "docid": "7e62bc569db7c4b44dceaebfea493c18", "score": "0.64358836", "text": "func TestDealBinaryMarshalling(t *testing.T) {\n\n\t// Tests BinaryMarshal, BinaryUnmarshal, and MarshalSize\n\tencodedP, err := basicDeal.MarshalBinary()\n\tif err != nil || len(encodedP) != basicDeal.MarshalSize() {\n\t\tt.Fatal(\"Marshalling failed: \", err)\n\t}\n\n\tdecodedP := new(Deal).UnmarshalInit(pt, r, numInsurers, suite)\n\terr = decodedP.UnmarshalBinary(encodedP)\n\tif err != nil {\n\t\tt.Fatal(\"UnMarshalling failed: \", err)\n\t}\n\tif !basicDeal.Equal(decodedP) {\n\t\tt.Error(\"Decoded dealnot equal to original\")\n\t}\n\n\t// Tests MarshlTo and UnmarshalFrom\n\tbufWriter := new(bytes.Buffer)\n\tbytesWritter, errs := basicDeal.MarshalTo(bufWriter)\n\n\tif bytesWritter != basicDeal.MarshalSize() || errs != nil {\n\t\tt.Fatal(\"MarshalTo failed: \", bytesWritter, err)\n\t}\n\n\tdecodedP2 := new(Deal).UnmarshalInit(pt, r, numInsurers, suite)\n\tbufReader := bytes.NewReader(bufWriter.Bytes())\n\tbytesRead, errs2 := decodedP2.UnmarshalFrom(bufReader)\n\tif bytesRead != decodedP2.MarshalSize() ||\n\t\tbasicDeal.MarshalSize() != decodedP2.MarshalSize() ||\n\t\terrs2 != nil {\n\t\tt.Fatal(\"UnmarshalFrom failed: \", bytesRead, errs2)\n\t}\n\tif basicDeal.MarshalSize() != decodedP2.MarshalSize() {\n\t\tt.Error(\"MarshalSize's differ: \", basicDeal.MarshalSize(),\n\t\t\tdecodedP2.MarshalSize())\n\t}\n\tif !basicDeal.Equal(decodedP2) {\n\t\tt.Error(\"dealread does not equal original\")\n\t}\n\n\t// Verify that unmarshalling fails if the dealcreated is invalid.\n\t// In this case, the unmarshalling defaults are invalid.\n\tdeal := new(Deal).ConstructDeal(secretKey, DealerKey, pt,\n\t\tr, insurerList)\n\tencodedP, err = deal.MarshalBinary()\n\tif err != nil || len(encodedP) != basicDeal.MarshalSize() {\n\t\tt.Fatal(\"Marshalling failed: \", err)\n\t}\n\n\tdecodedP = new(Deal).UnmarshalInit(pt, 1, numInsurers, suite)\n\terr = decodedP.UnmarshalBinary(encodedP)\n\tif err == nil {\n\t\tt.Fatal(\"UnMarshalling should have failed: \", err)\n\t}\n}", "title": "" }, { "docid": "ce0e6b350126f102c433be320549eb75", "score": "0.6434021", "text": "func TestMarshalUnmarshal(t *testing.T) {\n\tvar emptyStructs = []interface{}{&test0{}, &test1{}, &test2{}, &test3{}, &test4{}, &test5{}, &test6{}, &test7{}}\n\tfor i := range testStructs {\n\t\tb := Marshal(testStructs[i])\n\t\terr := Unmarshal(b, emptyStructs[i])\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b6638d166e7f2ee5be07bd0114e9995f", "score": "0.6287298", "text": "func TestUnmarshalAll(t *testing.T) {\n\tb := MarshalAll(testStructs...)\n\n\tvar emptyStructs = []interface{}{&test0{}, &test1{}, &test2{}, &test3{}, &test4{}, &test5{}, &test6{}, &test7{}}\n\terr := UnmarshalAll(b, emptyStructs...)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tempty1 := *emptyStructs[1].(*test1)\n\tif !reflect.DeepEqual(empty1, testStructs[1]) {\n\t\tt.Error(\"deep equal:\", empty1, testStructs[1])\n\t}\n\tempty5 := *emptyStructs[5].(*test5)\n\tif !reflect.DeepEqual(empty5, testStructs[5]) {\n\t\tt.Error(\"deep equal:\", empty5, testStructs[5])\n\t}\n\n\t// hardcoded check\n\tb = []byte{1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 'f', 'o', 'o', 1}\n\tvar (\n\t\tone, two uint64\n\t\tfoo string\n\t\ttru bool\n\t)\n\terr = UnmarshalAll(b, &one, &two, &foo, &tru)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t} else if one != 1 || two != 2 || foo != \"foo\" || tru != true {\n\t\tt.Error(\"values were not decoded correctly:\", one, two, foo, tru)\n\t}\n}", "title": "" }, { "docid": "5c5419c9cd82874a70207a6743c2867d", "score": "0.60019404", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %v\", v)\n\t}\n\n\tw := new(bytes.Buffer)\n\terr = json.Compact(w, []byte(want))\n\tif err != nil {\n\t\tt.Errorf(\"String is not valid json: %s\", want)\n\t}\n\n\tif w.String() != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n\n\t// now go the other direction and make sure things unmarshal as expected\n\tu := reflect.ValueOf(v).Interface()\n\tif err := json.Unmarshal([]byte(want), u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v\", want)\n\t}\n\n\tif !cmp.Equal(v, u) {\n\t\tt.Errorf(\"json.Unmarshal(%q) returned %s, want %s\", want, u, v)\n\t}\n}", "title": "" }, { "docid": "daca78c7f6d5d36ada7436297a815e75", "score": "0.58830506", "text": "func AssertMarshaledEquals(t testing.TB, one interface{}, two interface{}) {\n\tt.Helper()\n\toneJSON, err := json.Marshal(one)\n\tAssertNotError(t, err, \"Could not marshal 1st argument\")\n\ttwoJSON, err := json.Marshal(two)\n\tAssertNotError(t, err, \"Could not marshal 2nd argument\")\n\n\tif !bytes.Equal(oneJSON, twoJSON) {\n\t\tt.Fatalf(\"%s [%s] !(json)= [%s]\", caller(), oneJSON, twoJSON)\n\t}\n}", "title": "" }, { "docid": "f996ae169f12aef68bf720c41b96698b", "score": "0.5851663", "text": "func TestUnmarshal_unknown(t *testing.T) {\n\t// Test for nil (no value, pointer, or empty error)\n\tvar unk interface{}\n\tres, err := Marshal(unk)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tvar v interface{}\n\t_ = Unmarshal(res, &v)\n\tif v != \"<nil>\" {\n\t\tt.Error(\"non-nil returned\")\n\t}\n\n\t// Need a test for non-supported type\n}", "title": "" }, { "docid": "845b11989b46f3b17c24e50fda5de41c", "score": "0.58331317", "text": "func TestResponseBinaryMarshalling(t *testing.T) {\n\n\t// Verify a signature response can be encoded properly\n\tsig := basicDeal.sign(0, insurerKeys[0], sigMsg)\n\tresponse := new(Response).constructSignatureResponse(sig)\n\tresponseMarshallingHelper(t, response)\n\n\t// Verify a proof response can be encoded properly\n\tproof, _ := basicDeal.blame(0, insurerKeys[0])\n\tresponse = new(Response).constructBlameProofResponse(proof)\n\tresponseMarshallingHelper(t, response)\n}", "title": "" }, { "docid": "9471a3cd575fc218be14d986f53bf909", "score": "0.5818472", "text": "func TestReductionUnMarshal(t *testing.T) {\n\t// Mock a Reduction event\n\tev := newReductionEvent(1, 1)\n\n\t// Marshal it\n\tbuf := new(bytes.Buffer)\n\tassert.NoError(t, reduction.Marshal(buf, ev))\n\n\t// Now Unmarshal it\n\tev2 := reduction.New()\n\tassert.NoError(t, reduction.Unmarshal(buf, ev2))\n\n\t// The two events should be the exact same\n\tassert.Equal(t, ev, *ev2)\n}", "title": "" }, { "docid": "a68cd28b156666e254dfc7b25abcdf20", "score": "0.5801834", "text": "func TestSingleMarshal(t *testing.T) {\n\tvar err error\n\to := opr.NewOraclePriceRecord()\n\tfor _, asset := range common.AssetsV2 {\n\t\to.Assets.SetValue(asset, rand.Float64())\n\t}\n\n\tcommon.SetTestingVersion(2)\n\t//c := config.NewConfig([]config.Provider{common.NewUnitTestConfigProvider()})\n\to.CoinbaseAddress = common.ConvertRawToFCT(common.RandomByteSliceOfLen(32))\n\to.FactomDigitalID = \"random\"\n\to.Network = common.UnitTestNetwork\n\to.Version = common.OPRVersion(o.Network, int64(o.Dbht))\n\to.WinPreviousOPR = []string{}\n\n\tfor i, asset := range common.AssetsV2 {\n\t\to.Assets.SetValue(asset, rand.Float64()*1000)\n\n\t\t// Test truncate does not affect json\n\t\tif i%3 == 0 {\n\t\t\to.Assets.SetValue(asset, polling.TruncateTo4(o.Assets.Value(asset)))\n\t\t} else if i%3 == 1 {\n\t\t\to.Assets.SetValue(asset, polling.TruncateTo8(o.Assets.Value(asset)))\n\t\t}\n\t}\n\n\tdata, err := o.SafeMarshal()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\to2 := opr.NewOraclePriceRecord()\n\t// These two not set by json\n\to2.Network = common.UnitTestNetwork\n\to2.Version = common.OPRVersion(o.Network, int64(o.Dbht))\n\terr = o2.SafeUnmarshal(data)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tdata2, err := o2.SafeMarshal()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif bytes.Compare(data, data2) != 0 {\n\t\tt.Error(\"Json different after remarshal\")\n\t}\n\n\tif !reflect.DeepEqual(o, o2) {\n\t\tt.Errorf(\"did not marshal into the same\")\n\t}\n\n\to2.Assets.SetValue(\"PEG\", 0.123)\n\t// Ensure not just a deep equal oddity\n\tif reflect.DeepEqual(o, o2) {\n\t\tt.Errorf(\"I changed it, they should not be different\")\n\t}\n\n}", "title": "" }, { "docid": "2bd950d91d1cd522a53b197cdde2a09e", "score": "0.5760971", "text": "func TestDealUnMarshalInit(t *testing.T) {\n\tp := new(Deal).UnmarshalInit(pt, r, numInsurers, suite)\n\tif p.t != pt {\n\t\tt.Error(\"t not properly initialized.\")\n\t}\n\tif p.r != r {\n\t\tt.Error(\"r not properly initialized.\")\n\t}\n\tif p.n != numInsurers {\n\t\tt.Error(\"n not properly initialized.\")\n\t}\n\tif p.suite != suite {\n\t\tt.Error(\"Suite not properly initialized.\")\n\t}\n}", "title": "" }, { "docid": "f4ce6aba4e4031232d699e340fd6ada4", "score": "0.5702019", "text": "func TestDealSignatureBinaryMarshalling(t *testing.T) {\n\t// Tests BinaryMarshal, BinaryUnmarshal, and MarshalSize\n\tsig := basicDeal.sign(numInsurers-1, insurerKeys[numInsurers-1], sigMsg)\n\tencodedSig, err := sig.MarshalBinary()\n\tif err != nil || len(encodedSig) != sig.MarshalSize() {\n\t\tt.Fatal(\"Marshalling failed: \", err,\n\t\t\tlen(encodedSig) != sig.MarshalSize())\n\t}\n\n\tdecodedSig := new(signature).UnmarshalInit(suite)\n\terr = decodedSig.UnmarshalBinary(encodedSig)\n\tif err != nil {\n\t\tt.Fatal(\"UnMarshalling failed: \", err)\n\t}\n\tif !sig.Equal(decodedSig) {\n\t\tt.Error(\"Decoded signature not equal to original\")\n\t}\n\tif basicDeal.verifySignature(numInsurers-1, decodedSig, sigMsg) != nil {\n\t\tt.Error(\"Decoded signature failed to be verified.\")\n\t}\n\n\t// Tests MarshlTo and UnmarshalFrom\n\tsig2 := basicDeal.sign(1, insurerKeys[1], sigMsg)\n\tbufWriter := new(bytes.Buffer)\n\tbytesWritter, errs := sig2.MarshalTo(bufWriter)\n\tif bytesWritter != sig2.MarshalSize() || errs != nil {\n\t\tt.Fatal(\"MarshalTo failed: \", bytesWritter, err)\n\t}\n\n\tdecodedSig2 := new(signature).UnmarshalInit(suite)\n\tbufReader := bytes.NewReader(bufWriter.Bytes())\n\tbytesRead, errs2 := decodedSig2.UnmarshalFrom(bufReader)\n\tif bytesRead != sig2.MarshalSize() || errs2 != nil {\n\t\tt.Fatal(\"UnmarshalFrom failed: \", bytesRead, errs2)\n\t}\n\tif sig2.MarshalSize() != decodedSig2.MarshalSize() {\n\t\tt.Error(\"MarshalSize of decoded and original differ: \",\n\t\t\tsig2.MarshalSize(), decodedSig2.MarshalSize())\n\t}\n\tif !sig2.Equal(decodedSig2) {\n\t\tt.Error(\"signature read does not equal original\")\n\t}\n\tif basicDeal.verifySignature(1, decodedSig2, sigMsg) != nil {\n\t\tt.Error(\"Read signature failed to be verified.\")\n\t}\n\n}", "title": "" }, { "docid": "5b0434fb31b6ba2944d102d6fd45b2c8", "score": "0.56706434", "text": "func TestMarshalBinary(t *testing.T) {\n\tvar got []byte\n\tvar err error\n\n\tfor _, test := range Tests {\n\n\t\t// Test that MarshalBinary succeeds\n\t\tif got, err = test.atom.MarshalBinary(); err != nil {\n\t\t\tt.Errorf(\"MarshalBinary(%s): expect no error, got %s\", test.Name(), err.Error())\n\t\t}\n\n\t\t// Some binary inputs may contain extra garbage bytes that are discarded\n\t\t// during round trip. These must skip the checks for identical original.\n\t\tif strings.Contains(test.Name(), \"noroundtrip\") {\n\t\t\tcontinue\n\t\t}\n\t\t// Verify that resulting bytes match original length\n\t\tif len(got) != len(test.binBytes) {\n\t\t\tt.Errorf(\"MarshalBinary: want %d bytes, got %d bytes for %s\", len(test.binBytes), len(got), test.Name())\n\t\t}\n\n\t\t// Verify that resulting bytes are binary-identical\n\t\tgotSum := sha1.Sum(got)\n\t\twantSum := sha1.Sum(test.binBytes)\n\t\tif gotSum != wantSum {\n\t\t\tt.Errorf(\"MarshalBinary: binary output differs from original: %s\", test.Name())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7c62d0b90bce9dd323e99581ca5127a5", "score": "0.56552374", "text": "func TestEncodeDecodeOldToNew(t *testing.T) {\n\tmin := group_with_data.NewSbeGoMarshaller()\n\tmout := NewSbeGoMarshaller()\n\n\tvar buf = new(bytes.Buffer)\n\tin := makeTestMessage3Original()\n\n\tif err := in.Encode(min, buf, true); err != nil {\n\t\tt.Log(\"Encoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tvar out TestMessage3 = *new(TestMessage3)\n\tif err := out.Decode(mout, buf, in.SbeSchemaVersion(), in.SbeBlockLength(), true); err != nil {\n\t\tt.Log(\"Decoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tif in.Tag1 != out.Tag1 {\n\t\tt.Logf(\"in.Tag1 != out.Tag1\")\n\t\tt.Fail()\n\t}\n\n\tfor i := 0; i < len(in.Entries); i++ {\n\t\tif in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1 {\n\t\t\tt.Logf(\"in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\t\tif !bytes.Equal(in.Entries[i].VarDataField, out.Entries[i].VarDataField) {\n\t\t\tt.Logf(\"in.Entries[%d].VarDataField (%v) != out.Entries[%d].VarDataField (%v)\", i, i, in.Entries[i].VarDataField, out.Entries[i].VarDataField)\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2 {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif math.MinInt64 != out.Entries[0].NestedEntries[0].InnerExtension {\n\t\t\tt.Logf(\"0 != out.Entries[0].NestedEntries[0].InnerExtension (%v)\", out.Entries[0].NestedEntries[0].InnerExtension)\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\t\tif !bytes.Equal(in.Entries[0].NestedEntries[0].VarDataFieldNested, out.Entries[0].NestedEntries[0].VarDataFieldNested) {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].VarDataFieldNested != out.Entries[0].NestedEntries[0].VarDataFieldNested\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t}\n\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\treturn\n}", "title": "" }, { "docid": "a43161fd0e7120981fe1872f6324134e", "score": "0.562908", "text": "func (s *userTestSuite) testUserUnMarshal(t *testing.T) {\n\n\tis := is.New(t)\n\n\tdata := []byte(`{\"username\": \"alice\"}`)\n\n\tvar userReg userRegistrationRequest\n\terr := json.Unmarshal(data, &userReg)\n\n\tis.NoErr(err)\n\tis.Equal(userReg.Username, \"alice\")\n\n}", "title": "" }, { "docid": "dfe1aa29b78220e9fdbdaef00745acc7", "score": "0.56190526", "text": "func testJSONMarshal(t *testing.T, v interface{}, want string) {\n\tt.Helper()\n\t// Unmarshal the wanted JSON, to verify its correctness, and marshal it back\n\t// to sort the keys.\n\tu := reflect.New(reflect.TypeOf(v)).Interface()\n\tif err := json.Unmarshal([]byte(want), &u); err != nil {\n\t\tt.Errorf(\"Unable to unmarshal JSON for %v: %v\", want, err)\n\t}\n\tw, err := json.Marshal(u)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", u)\n\t}\n\n\t// Marshal the target value.\n\tj, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to marshal JSON for %#v\", v)\n\t}\n\n\tif string(w) != string(j) {\n\t\tt.Errorf(\"json.Marshal(%q) returned %s, want %s\", v, j, w)\n\t}\n}", "title": "" }, { "docid": "791ca3fa30a941631af2439b57f70ea7", "score": "0.56159693", "text": "func TestUnmarshableMessageTypes(t *testing.T) {\n\tp := NewPHYPayload(JoinAccept)\n\n\tif _, err := p.MarshalBinary(); err == nil {\n\t\tt.Fatal(\"Expected JoinAccept message to raise error\")\n\t}\n\n\tp.MHDR.MType = JoinRequest\n\tif _, err := p.MarshalBinary(); err == nil {\n\t\tt.Fatal(\"Expected JoinRequest message to raise error\")\n\t}\n\n\tp.MHDR.MType = Proprietary\n\tif _, err := p.MarshalBinary(); err == nil {\n\t\tt.Fatal(\"Expected Proprietary message to raise error\")\n\t}\n}", "title": "" }, { "docid": "4c11a7eaebd92caf5be20077e9360556", "score": "0.55788624", "text": "func TestCoverAddressMarshaling(t *testing.T) {\n\tcs, r := noClustering(NullLogger)\n\tdefer cs.Terminate()\n\tdefer r.Terminate()\n\n\ta := &Address{}\n\ta.connectionServer = cs\n\n\tb, err := a.MarshalBinary()\n\tif b != nil || err != ErrIllegalAddressFormat {\n\t\tt.Fatalf(\"Wrong error from marshaling binary of empty address #%v, #%v\", b, err)\n\t}\n\n\ta = &Address{}\n\terr = a.UnmarshalBinary([]byte(\"<\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"Wrong error from unmarshaling illegal binary mailbox\")\n\t}\n\n\ta, m1 := connections.NewMailbox()\n\tdefer m1.Close()\n\n\ta2, m2 := connections.NewMailbox()\n\tdefer m2.Close()\n\n\ta2.UnmarshalFromID(a.mailboxID)\n\ta2.connectionServer = connections\n\terr = a2.Send(\"test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmsg, ok := m1.ReceiveAsync()\n\tif !ok {\n\t\tt.Fatal(\"Mailbox received nothing\")\n\t}\n\tif !reflect.DeepEqual(msg, \"test\") {\n\t\tt.Fatal(\"Can't unmarshal a local address from an ID correctly.\")\n\t}\n\n\terr = a.UnmarshalText([]byte(\"<23456789012345678901234\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"fails the length check on normal mailboxes\")\n\t}\n\terr = a.UnmarshalText([]byte(\"\\\"moo\"))\n\tif err != ErrIllegalAddressFormat {\n\t\tt.Fatal(\"fails to properly check registry mailboxes in text for quotes\")\n\t}\n\n\ta = &Address{}\n\t_, err = a.MarshalText()\n\tif err == nil {\n\t\tt.Fatal(\"can marshal nonexistant address to Text\")\n\t}\n}", "title": "" }, { "docid": "a30e3d44753cb1f363e056f7fc0fb4ef", "score": "0.5571606", "text": "func TestEncodeDecodeNewtoNew(t *testing.T) {\n\tm := NewSbeGoMarshaller()\n\n\tvar buf = new(bytes.Buffer)\n\tin := makeTestMessage3Extension()\n\n\tif err := in.Encode(m, buf, true); err != nil {\n\t\tt.Log(\"Encoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tvar out TestMessage3 = *new(TestMessage3)\n\tif err := out.Decode(m, buf, in.SbeSchemaVersion(), in.SbeBlockLength(), true); err != nil {\n\t\tt.Log(\"Decoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tif in.Tag1 != out.Tag1 {\n\t\tt.Logf(\"in.Tag1 != out.Tag1\")\n\t\tt.Fail()\n\t}\n\n\tfor i := 0; i < len(in.Entries); i++ {\n\t\tif in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1 {\n\t\t\tt.Logf(\"in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1\")\n\t\t\tfmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\t\tif !bytes.Equal(in.Entries[i].VarDataField, out.Entries[i].VarDataField) {\n\t\t\tt.Logf(\"in.Entries[%d].VarDataField (%v) != out.Entries[%d].VarDataField (%v)\", i, i, in.Entries[i].VarDataField, out.Entries[i].VarDataField)\n\t\t\tfmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2 {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2\")\n\t\t\tfmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\t\tif in.Entries[0].NestedEntries[0].InnerExtension != out.Entries[0].NestedEntries[0].InnerExtension {\n\t\t\tt.Logf(\"n.Entries[0].NestedEntries[0].InnerExtension != out.Entries[0].NestedEntries[0].InnerExtension\")\n\t\t\tfmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif !bytes.Equal(in.Entries[0].NestedEntries[0].VarDataFieldNested, out.Entries[0].NestedEntries[0].VarDataFieldNested) {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].VarDataFieldNested != out.Entries[0].NestedEntries[0].VarDataFieldNested\")\n\t\t\tfmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "84119097c35573c1235dc6c185d2b70e", "score": "0.55612326", "text": "func TestImplementations(t *testing.T) {\n\tapp, err := NewApplication()\n\tif err != nil {\n\t\tt.Fatalf(ERROR_FORMAT, \"main\", \"configuring app\", err)\n\t\treturn\n\t}\n\tdefer app.Finalize()\n\n\tfor name, imp := range app.Implementations {\n\t\timp.Del()\n\t\tsrcObject := &implementations.SerializationObject{\n\t\t\tString1: \"String1\", String2: \"String2\", String3: \"String3\", String4: \"String4\", String5: \"String5\",\n\t\t\tFieldX: \"FieldX\",\n\t\t}\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\terr = imp.Set(srcObject)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"setting object\", err)\n\t\t\t}\n\n\t\t\tobject1, err := imp.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"getting object\", err)\n\t\t\t}\n\n\t\t\tisEqual := reflect.DeepEqual(srcObject, object1)\n\t\t\tif !isEqual {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"comparing src srcObject and object1\", \"they aren't equal\")\n\t\t\t}\n\n\t\t\tsrcObject.FieldX = \"FieldX-changed\"\n\t\t\terr = imp.SetOneField(\"FieldX\", srcObject.FieldX)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"setting one field\", err)\n\t\t\t}\n\n\t\t\tfield, err := imp.GetOneField(\"FieldX\")\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"getting one field\", err)\n\t\t\t}\n\n\t\t\tif field != srcObject.FieldX {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"comparing src field and actual field\", \"they aren't equal\")\n\t\t\t}\n\n\t\t\tobject2, err := imp.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"getting object\", err)\n\t\t\t}\n\n\t\t\tisEqual = reflect.DeepEqual(srcObject, object2)\n\t\t\tif !isEqual {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"comparing src srcObject and object2\", \"they aren't equal\")\n\t\t\t}\n\n\t\t\terr = imp.Del()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(ERROR_FORMAT, name, \"deleting object\", err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c08203b34296807112f6b67b248f2012", "score": "0.5554304", "text": "func TestTypeMismatch(t *testing.T) {\n\tpb1 := initGoTest(true)\n\n\t// Marshal\n\to := old()\n\to.Marshal(pb1)\n\n\t// Now Unmarshal it to the wrong type.\n\tpb2 := initGoTestField()\n\terr := o.Unmarshal(pb2)\n\tif err == nil {\n\t\tt.Error(\"expected error, got no error\")\n\t} else if !strings.Contains(err.Error(), \"bad wiretype\") {\n\t\tt.Error(\"expected bad wiretype error, got\", err)\n\t}\n}", "title": "" }, { "docid": "d8e718c2d6ae961e7ef0ef4554bb4b49", "score": "0.5551511", "text": "func TestMarshalUnmarshal(t *testing.T) {\n\t// so, this is gonna seem stupid as hell, but the marshaling of time in\n\t// proto messages is weird. To make this test pass, we're going first\n\t// create timestamps as proto types\n\tc := gogotypes.TimestampNow()\n\tu := gogotypes.TimestampNow()\n\n\t// we know this conversion will succeed, so throw away the error result\n\tct, _ := gogotypes.TimestampFromProto(c)\n\tut, _ := gogotypes.TimestampFromProto(u)\n\n\t// we don't have to fully fill this in -- we're testing proto marshalling,\n\t// not JSON marshalling. just add some canned data\n\tstack := &types.Stack{\n\t\tID: \"someID\",\n\t\tMeta: swarm.Meta{\n\t\t\tCreatedAt: ct,\n\t\t\tUpdatedAt: ut,\n\t\t\tVersion: swarm.Version{\n\t\t\t\tIndex: 1,\n\t\t\t},\n\t\t},\n\t\tSpec: types.StackSpec{\n\t\t\tAnnotations: swarm.Annotations{\n\t\t\t\tName: \"someName\",\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"key\": \"value\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tServices: []swarm.ServiceSpec{\n\t\t\t\t{\n\t\t\t\t\tAnnotations: swarm.Annotations{Name: \"bar\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tmsg, err := MarshalStackSpec(&stack.Spec)\n\trequire.NoError(t, err, \"error marshalling stacks\")\n\n\tunstackSpec, err := UnmarshalStackSpec(msg)\n\trequire.NoError(t, err, \"error unmarshalling stacks\")\n\tassert.Equal(t, stack.Spec, *unstackSpec)\n\n\t// now pack the message into a Resource object\n\tresource := &api.Resource{\n\t\tID: \"someID\",\n\t\tMeta: api.Meta{\n\t\t\tVersion: api.Version{\n\t\t\t\tIndex: 1,\n\t\t\t},\n\t\t\tCreatedAt: c,\n\t\t\tUpdatedAt: u,\n\t\t},\n\t\tPayload: msg,\n\t}\n\n\t// NOTE(dperny): because of the way marshaling json works (or perhaps\n\t// doesn't work), we should only have 1 ServiceConfig or ServiceSpec in the\n\t// stacks, else the order may get scrambled up and make this comparison\n\t// difficult.\n\tunstack, err := ConstructStack(resource)\n\trequire.NoError(t, err, \"error constructing stacks\")\n\tassert.Equal(t, *stack, *unstack)\n}", "title": "" }, { "docid": "b669eb02b2b54e27607c109d090d0985", "score": "0.55499977", "text": "func TestDecode(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t// use Unmarshal for convenience\n\tvar emptyStructs = []interface{}{&test0{}, &test1{}, &test2{}, &test3{}, &test4{}, &test5{}, &test6{}, &test7{}}\n\tfor i := range testEncodings {\n\t\terr := Unmarshal(testEncodings[i], emptyStructs[i])\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n\n\t// bad boolean\n\terr := Unmarshal([]byte{3}, new(bool))\n\tif err == nil || err.Error() != \"could not decode type bool: boolean value was not 0 or 1\" {\n\t\tt.Error(\"expected bool error, got\", err)\n\t}\n\n\t// non-pointer\n\terr = Unmarshal([]byte{1, 2, 3}, \"foo\")\n\tif err != errBadPointer {\n\t\tt.Error(\"expected errBadPointer, got\", err)\n\t}\n\n\t// unknown type\n\terr = Unmarshal([]byte{1, 2, 3}, new(map[int]int))\n\tif err == nil || err.Error() != \"could not decode type map[int]int: unknown type\" {\n\t\tt.Error(\"expected unknown type error, got\", err)\n\t}\n\n\t// big slice (larger than MaxSliceSize)\n\terr = Unmarshal(EncUint64(MaxSliceSize+1), new([]byte))\n\tif err == nil || !strings.Contains(err.Error(), \"exceeds size limit\") {\n\t\tt.Error(\"expected large slice error, got\", err)\n\t}\n\n\t// massive slice (larger than MaxInt32)\n\terr = Unmarshal(EncUint64(1<<32), new([]byte))\n\tif err == nil || !strings.Contains(err.Error(), \"exceeds size limit\") {\n\t\tt.Error(\"expected large slice error, got\", err)\n\t}\n\n\t// many small slices (total larger than maxDecodeLen)\n\tbigSlice := strings.Split(strings.Repeat(\"0123456789abcdefghijklmnopqrstuvwxyz\", (MaxSliceSize/16)-1), \"0\")\n\terr = Unmarshal(Marshal(bigSlice), new([]string))\n\tif err == nil || !strings.Contains(err.Error(), \"exceeds size limit\") {\n\t\tt.Error(\"expected size limit error, got\", err)\n\t}\n\n\t// badReader should fail on every decode\n\tdec := NewDecoder(new(badReader))\n\tfor i := range testEncodings {\n\t\terr := dec.Decode(emptyStructs[i])\n\t\tif err == nil {\n\t\t\tt.Error(\"expected error, got nil\")\n\t\t}\n\t}\n\t// special case, not covered by testStructs\n\terr = dec.Decode(new([3]byte))\n\tif err == nil || err.Error() != \"could not decode type [3]uint8: EOF\" {\n\t\tt.Error(\"expected EOF error, got\", err)\n\t}\n}", "title": "" }, { "docid": "77631689e3a9808f97b9b46650318952", "score": "0.5545054", "text": "func TestEncodeDecode(t *testing.T) {\n\tvar emptyStructs = []interface{}{&test0{}, &test1{}, &test2{}, &test3{}, &test4{}, &test5{}, &test6{}, &test7{}}\n\tb := new(bytes.Buffer)\n\tenc := NewEncoder(b)\n\tdec := NewDecoder(b)\n\tfor i := range testStructs {\n\t\tenc.Encode(testStructs[i])\n\t\terr := dec.Decode(emptyStructs[i])\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d7d0d7af69ec8f4af50ac66bebccead0", "score": "0.55432713", "text": "func TestMarshalAll(t *testing.T) {\n\t// MarshalAll should produce the same result as individually marshalling\n\t// each object\n\tvar expected []byte\n\tfor i := range testStructs {\n\t\texpected = append(expected, Marshal(testStructs[i])...)\n\t}\n\n\tb := MarshalAll(testStructs...)\n\tif !bytes.Equal(b, expected) {\n\t\tt.Errorf(\"expected %v, got %v\", expected, b)\n\t}\n\n\t// hardcoded check\n\texp := []byte{1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 'f', 'o', 'o', 1}\n\tb = MarshalAll(1, 2, \"foo\", true)\n\tif !bytes.Equal(b, exp) {\n\t\tt.Errorf(\"expected %v, got %v\", exp, b)\n\t}\n}", "title": "" }, { "docid": "5777a0a25073a5971b7081eaf4a06acc", "score": "0.5540947", "text": "func Test(t *testing.T) {\n\ttype Movie struct {\n\t\tTitle, Subtitle string\n\t\tYear int\n\t\tActor map[string]string\n\t\tOscars []string\n\t\tSequel *string\n\t}\n\tstrangelove := Movie{\n\t\tTitle: \"Dr. Strangelove\",\n\t\tSubtitle: \"How I Learned to Stop Worrying and Love the Bomb\",\n\t\tYear: 1964,\n\t\tActor: map[string]string{\n\t\t\t\"Dr. Strangelove\": \"Peter Sellers\",\n\t\t\t\"Grp. Capt. Lionel Mandrake\": \"Peter Sellers\",\n\t\t\t\"Pres. Merkin Muffley\": \"Peter Sellers\",\n\t\t\t\"Gen. Buck Turgidson\": \"George C. Scott\",\n\t\t\t\"Brig. Gen. Jack D. Ripper\": \"Sterling Hayden\",\n\t\t\t`Maj. T.J. \"King\" Kong`: \"Slim Pickens\",\n\t\t},\n\t\tOscars: []string{\n\t\t\t\"Best Actor (Nomin.)\",\n\t\t\t\"Best Adapted Screenplay (Nomin.)\",\n\t\t\t\"Best Director (Nomin.)\",\n\t\t\t\"Best Picture (Nomin.)\",\n\t\t},\n\t}\n\n\t// Encode it\n\tdata, err := Marshal(strangelove)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t}\n\tt.Logf(\"Marshal() = \\n%s\\n\", data)\n\n\t// Decode it\n\tvar movie Movie\n\tif err := Unmarshal(data, &movie); err != nil {\n\t\tt.Fatalf(\"Unmarshal failed: %v\", err)\n\t}\n\tt.Logf(\"Unmarshal() = %+v\\n\", movie)\n\n\t// Check equality.\n\tif !reflect.DeepEqual(movie, strangelove) {\n\t\tt.Fatal(\"not equal\")\n\t}\n}", "title": "" }, { "docid": "dcce24f272cb738979d1fd5de6448482", "score": "0.5506326", "text": "func TestEncodeDecodeNewToOld(t *testing.T) {\n\tmin := NewSbeGoMarshaller()\n\tmout := group_with_data.NewSbeGoMarshaller()\n\n\tvar buf = new(bytes.Buffer)\n\tin := makeTestMessage3Extension()\n\n\tif err := in.Encode(min, buf, true); err != nil {\n\t\tt.Log(\"Encoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tvar out group_with_data.TestMessage3 = *new(group_with_data.TestMessage3)\n\tif err := out.Decode(mout, buf, in.SbeSchemaVersion(), in.SbeBlockLength(), true); err != nil {\n\t\tt.Log(\"Decoding Error\", err)\n\t\tt.Fail()\n\t}\n\n\tif in.Tag1 != out.Tag1 {\n\t\tt.Logf(\"in.Tag1 != out.Tag1\")\n\t\tt.Fail()\n\t}\n\n\tfor i := 0; i < len(in.Entries); i++ {\n\t\tif in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1 {\n\t\t\tt.Logf(\"in.Entries[0].TagGroup1 != out.Entries[0].TagGroup1\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\t\tif !bytes.Equal(in.Entries[i].VarDataField, out.Entries[i].VarDataField) {\n\t\t\tt.Logf(\"in.Entries[%d].VarDataField (%v) != out.Entries[%d].VarDataField (%v)\", i, i, in.Entries[i].VarDataField, out.Entries[i].VarDataField)\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2 {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].TagGroup2 != out.Entries[0].NestedEntries[0].TagGroup2\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t\tif !bytes.Equal(in.Entries[0].NestedEntries[0].VarDataFieldNested, out.Entries[0].NestedEntries[0].VarDataFieldNested) {\n\t\t\tt.Logf(\"in.Entries[0].NestedEntries[0].VarDataFieldNested != out.Entries[0].NestedEntries[0].VarDataFieldNested\")\n\t\t\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\t\t\tt.Fail()\n\t\t}\n\n\t}\n\t// fmt.Printf(\"%+v\\n%+v\\n\", in, out)\n\treturn\n}", "title": "" }, { "docid": "dd6d0754d88da062f9af0ebaa89bba92", "score": "0.5492635", "text": "func testUnmarshalFileValues(assert *assert.Assertions, config *testStruct, err error, from string) {\n\tfrom += \" \"\n\n\tassert.Nil(err, \"there should not be an error reading the test file\")\n\t// PointerSlice\n\tassert.Equal(1, len(config.PointerSlice), from+\"pointerslice is too short\")\n\tassert.EqualValues(true, config.PointerSlice[0].Bool, from+\"the boolean was true\")\n\tassert.EqualValues(123.4567, *config.PointerSlice[0].FloatP, from+\"the float64 was set to 123.4567\")\n\tassert.EqualValues(0, config.PointerSlice[0].Int, from+\"int was not set so should be zero\")\n\tassert.Nil(config.PointerSlice[0].StringP, from+\"the string pointer was not set so should remain nil\")\n\n\t// StructSlice\n\tassert.Equal(1, len(config.StructSlice), from+\"pointerslice is too short\")\n\tassert.EqualValues(false, config.StructSlice[0].Bool, from+\"the boolean was missing and should be false\")\n\tassert.Nil(config.StructSlice[0].FloatP, from+\"the float64 was missing and should be nil\")\n\tassert.EqualValues(123, config.StructSlice[0].Int, from+\"int was set to 123\")\n\tassert.EqualValues(\"foo\", *config.StructSlice[0].StringP, from+\"the string was set to foo\")\n\n\t// Struct\n\tassert.EqualValues(false, config.Struct.Bool, from+\"the boolean was false and should be false\")\n\tassert.Nil(config.Struct.FloatP, from+\"the float64 was missing and should be nil\")\n\tassert.EqualValues(0, config.Struct.Int, from+\"int was not set and must be 0\")\n\tassert.Nil(config.Struct.StringP, from+\"the string was missing and should be nil\")\n\n\t// PointerStruct\n\tassert.NotNil(config.PointerStruct, from+\"the pointer struct has values and must not be nil\")\n\tassert.EqualValues(false, config.PointerStruct.Bool, from+\"the boolean was missing and should be false\")\n\tassert.Nil(config.PointerStruct.FloatP, from+\"the float64 was missing and should be nil\")\n\tassert.EqualValues(0, config.PointerStruct.Int, from+\"int was not set and must be 0\")\n\tassert.EqualValues(\"foo2\", *config.PointerStruct.StringP, from+\"the string was set to foo2\")\n\n\t// PointerSlice2\n\tassert.Equal(0, len(config.PointerSlice2), from+\"pointerslice2 is too long\")\n\t// StructSlice2\n\tassert.Equal(0, len(config.StructSlice2), from+\"structslice2 is too long\")\n\t// Struct2\n\tassert.EqualValues(false, config.Struct2.Bool, from+\"this must be zero value\")\n\tassert.Nil(config.Struct2.FloatP, from+\"this must be zero value\")\n\tassert.EqualValues(0, config.Struct2.Int, from+\"this must be zero value\")\n\tassert.Nil(config.Struct2.StringP, from+\"this must be zero value\")\n\t// PointerStruct2\n\tassert.Nil(config.PointerStruct2, from+\"pointer struct 2 must be nil\")\n}", "title": "" }, { "docid": "47343c83187c0bc8e36bc957890845ee", "score": "0.548808", "text": "func TestMarshalTimesheet(t *testing.T) {\n\n\tv := nine2five.Timesheet{\n\t\tID: 1,\n\t\tCustomerID: 2,\n\t\tMonth: 3,\n\t\tYear: 2017,\n\t\tLocked: true,\n\t\tEntries: []nine2five.EntryID{1, 2, 3, 4},\n\t\tCreated: time.Now().UTC(),\n\t\tUpdated: time.Now().UTC(),\n\t}\n\n\tvar other nine2five.Timesheet\n\n\tif buf, err := internal.MarshalTimesheet(&v); err != nil {\n\t\tt.Fatal(err)\n\t} else if err := internal.UnMarshalTimesheet(buf, &other); err != nil {\n\t\tt.Fatal(err)\n\t} else if !reflect.DeepEqual(v, other) {\n\t\tt.Fatalf(\"unexpected copy: %#v - %#v\", v, other)\n\t}\n}", "title": "" }, { "docid": "83310672245c653d3b2949c564c35b2e", "score": "0.54872155", "text": "func TestBadMarshal(t *testing.T) {\n\tc := make(chan bool)\n\t_, err := marshal(c)\n\tif err == nil {\n\t\tt.Fatal(\"succeed to marshal channel\")\n\t}\n}", "title": "" }, { "docid": "b6294a62152e0858c73341d395459634", "score": "0.54868984", "text": "func TestUnmarshalFeed(t *testing.T) {\n\tvar f Feed\n\tif err := Unmarshal([]byte(atomFeedString), &f); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %s\", err)\n\t}\n\tif !reflect.DeepEqual(f, atomFeed) {\n\t\tt.Fatalf(\"have %#v\\nwant %#v\", f, atomFeed)\n\t}\n}", "title": "" }, { "docid": "336bda7d40c91441ff211e2cbd7bf16a", "score": "0.5485042", "text": "func Test(t *testing.T) {\n\ttype Movie struct {\n\t\tTitle, Subtitle string\n\t\tYear int\n\t\tActor map[string]string\n\t\tOscars []string\n\t\tSequel *string\n\t}\n\tstrangelove := Movie{\n\t\tTitle: \"Dr. Strangelove\",\n\t\tSubtitle: \"How I Learned to Stop Worrying and Love the Bomb\",\n\t\tYear: 1964,\n\t\tActor: map[string]string{\n\t\t\t\"Dr. Strangelove\": \"Peter Sellers\",\n\t\t\t\"Grp. Capt. Lionel Mandrake\": \"Peter Sellers\",\n\t\t\t\"Pres. Merkin Muffley\": \"Peter Sellers\",\n\t\t\t\"Gen. Buck Turgidson\": \"George C. Scott\",\n\t\t\t\"Brig. Gen. Jack D. Ripper\": \"Sterling Hayden\",\n\t\t\t`Maj. T.J. \"King\" Kong`: \"Slim Pickens\",\n\t\t},\n\t\tOscars: []string{\n\t\t\t\"Best Actor (Nomin.)\",\n\t\t\t\"Best Adapted Screenplay (Nomin.)\",\n\t\t\t\"Best Director (Nomin.)\",\n\t\t\t\"Best Picture (Nomin.)\",\n\t\t},\n\t}\n\n\t// Encode it\n\tdata, err := Marshal(strangelove)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal failed: %v\", err)\n\t}\n\tt.Logf(\"Marshal() = %s\\n\", data)\n\n\t// Decode it\n\tvar movie Movie\n\tif err := Unmarshal(data, &movie); err != nil {\n\t\tt.Fatalf(\"Unmarshal failed: %v\", err)\n\t}\n\tt.Logf(\"Unmarshal() = %+v\\n\", movie)\n\n\t// Check equality.\n\tif !reflect.DeepEqual(movie, strangelove) {\n\t\tt.Fatal(\"not equal\")\n\t}\n\n\t// Pretty-print it:\n\tdata, err = MarshalIndent(strangelove)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Logf(\"MarshalIdent() = %s\\n\", data)\n}", "title": "" }, { "docid": "282d26682703a7f34a3c8ead665e734b", "score": "0.5482298", "text": "func TestMarshalerEncoding(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tm Message\n\t\twant []byte\n\t\twantErr error\n\t}{\n\t\t{\n\t\t\tname: \"Marshaler that fails\",\n\t\t\tm: fakeMarshaler{\n\t\t\t\terr: errors.New(\"some marshal err\"),\n\t\t\t\tb: []byte{5, 6, 7},\n\t\t\t},\n\t\t\t// Since there's an error, nothing should be written to buffer.\n\t\t\twant: nil,\n\t\t\twantErr: errors.New(\"some marshal err\"),\n\t\t},\n\t\t{\n\t\t\tname: \"Marshaler that succeeds\",\n\t\t\tm: fakeMarshaler{\n\t\t\t\tb: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t\t},\n\t\t\twant: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t\twantErr: nil,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tb := NewBuffer(nil)\n\t\terr := b.Marshal(test.m)\n\t\tif !reflect.DeepEqual(test.wantErr, err) {\n\t\t\tt.Errorf(\"%s: got err %v wanted %v\", test.name, err, test.wantErr)\n\t\t}\n\t\tif !reflect.DeepEqual(test.want, b.Bytes()) {\n\t\t\tt.Errorf(\"%s: got bytes %v wanted %v\", test.name, b.Bytes(), test.want)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "876682154e5fa72720a7fa67fb69c60c", "score": "0.5472244", "text": "func TestBlameProofUnMarshalInit(t *testing.T) {\n\tbp := new(blameProof).UnmarshalInit(suite)\n\tif bp.suite != suite {\n\t\tt.Error(\"blameProof not properly initialized.\")\n\t}\n}", "title": "" }, { "docid": "8b9ea86f318034a0fe42f6d50046a422", "score": "0.5471435", "text": "func TestDecodeAll(t *testing.T) {\n\tb := new(bytes.Buffer)\n\tNewEncoder(b).EncodeAll(testStructs...)\n\n\tvar emptyStructs = []interface{}{&test0{}, &test1{}, &test2{}, &test3{}, &test4{}, &test5{}, &test6{}, &test7{}}\n\terr := NewDecoder(b).DecodeAll(emptyStructs...)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tempty0 := *emptyStructs[0].(*test0)\n\tif !reflect.DeepEqual(empty0, testStructs[0]) {\n\t\tt.Error(\"deep equal:\", empty0, testStructs[0])\n\t}\n\tempty6 := emptyStructs[6].(*test6)\n\tif !reflect.DeepEqual(empty6, testStructs[6]) {\n\t\tt.Error(\"deep equal:\", empty6, testStructs[6])\n\t}\n\n\t// hardcoded check\n\tb.Reset()\n\tb.Write([]byte{1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 'f', 'o', 'o', 1})\n\n\tvar (\n\t\tone, two uint64\n\t\tfoo string\n\t\ttru bool\n\t)\n\terr = NewDecoder(b).DecodeAll(&one, &two, &foo, &tru)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t} else if one != 1 || two != 2 || foo != \"foo\" || tru != true {\n\t\tt.Error(\"values were not decoded correctly:\", one, two, foo, tru)\n\t}\n}", "title": "" }, { "docid": "2098544038f23b3e759c9e888cfbcb87", "score": "0.544721", "text": "func TestAlllocal(t *testing.T) {\n\ta := &Tt{}\n\tb := &WTt{}\n\tc := &Region{}\n\td := &Style{}\n\te := &Subtitle{}\n\tf := &Wregion{}\n\tg := &Wsubtitle{}\n\th := &Wstyle{}\n\n\tif cmp.Equal(convertstruct(a), b) {\n\t\t//t.Errorf(\"convertstruct test function failed\")\n\t}\n\tif convertregion(c) != *f {\n\t\tt.Errorf(\"convertregion test function failed\")\n\t}\n\tif convertsub(e) != *g {\n\t\tt.Errorf(\"convertsub test function failed\")\n\t}\n\tif convertstyle(d) != *h {\n\t\tt.Errorf(\"convertstyle test function failed\")\n\t}\n\t// Output: matches\n}", "title": "" }, { "docid": "2e98a239f9d31083440e18a712e6fa2b", "score": "0.54393494", "text": "func TestBlameProofBinaryMarshalling(t *testing.T) {\n\t// Create a bad dealobject. That a blame proof would succeed.\n\tdeal := new(Deal).ConstructDeal(secretKey, DealerKey, pt, r, insurerList)\n\tbadKey := insurerKeys[numInsurers-1]\n\tdiffieBase := deal.suite.Point().Mul(DealerKey.Public, badKey.Secret)\n\tdiffieSecret := deal.diffieHellmanSecret(diffieBase)\n\tbadShare := deal.suite.Scalar().Add(badKey.Secret, diffieSecret)\n\tdeal.secrets[0] = badShare\n\n\t// Tests BinaryMarshal, BinaryUnmarshal, and MarshalSize\n\tbp, _ := deal.blame(0, insurerKeys[0])\n\tencodedBp, err := bp.MarshalBinary()\n\tif err != nil || len(encodedBp) != bp.MarshalSize() {\n\t\tt.Fatal(\"Marshalling failed: \", err)\n\t}\n\n\tdecodedBp := new(blameProof).UnmarshalInit(suite)\n\terr = decodedBp.UnmarshalBinary(encodedBp)\n\tif err != nil {\n\t\tt.Fatal(\"UnMarshalling failed: \", err)\n\t}\n\tif !bp.Equal(decodedBp) {\n\t\tt.Error(\"Decoded blameProof not equal to original\")\n\t}\n\tif bp.MarshalSize() != decodedBp.MarshalSize() {\n\t\tt.Error(\"MarshalSize of decoded and original differ: \",\n\t\t\tbp.MarshalSize(), decodedBp.MarshalSize())\n\t}\n\tif deal.verifyBlame(0, decodedBp) != nil {\n\t\tt.Error(\"Decoded blameProof failed to be verified.\")\n\t}\n\n\t// Tests MarshlTo and UnmarshalFrom\n\tbp2, _ := basicDeal.blame(0, insurerKeys[0])\n\tbufWriter := new(bytes.Buffer)\n\tbytesWritter, errs := bp2.MarshalTo(bufWriter)\n\tif bytesWritter != bp2.MarshalSize() || errs != nil {\n\t\tt.Fatal(\"MarshalTo failed: \", bytesWritter, err)\n\t}\n\n\tdecodedBp2 := new(blameProof).UnmarshalInit(suite)\n\tbufReader := bytes.NewReader(bufWriter.Bytes())\n\tbytesRead, errs2 := decodedBp2.UnmarshalFrom(bufReader)\n\tif bytesRead != bp2.MarshalSize() || errs2 != nil {\n\t\tt.Fatal(\"UnmarshalFrom failed: \", bytesRead, errs2)\n\t}\n\tif bp2.MarshalSize() != decodedBp2.MarshalSize() {\n\t\tt.Error(\"MarshalSize of decoded and original differ: \",\n\t\t\tbp2.MarshalSize(), decodedBp2.MarshalSize())\n\t}\n\tif !bp2.Equal(decodedBp2) {\n\t\tt.Error(\"blameProof read does not equal original\")\n\t}\n\tif deal.verifyBlame(0, decodedBp2) != nil {\n\t\tt.Error(\"Decoded blameProof failed to be verified.\")\n\t}\n\n}", "title": "" }, { "docid": "80c6d3dbe42d14c6b52b45f0ecb26a29", "score": "0.5431681", "text": "func TestBytesPrimitives(t *testing.T) {\n\to := old()\n\tbytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'}\n\tif o.EncodeRawBytes(bytes) != nil {\n\t\tt.Error(\"EncodeRawBytes\")\n\t}\n\tdecb, e := o.DecodeRawBytes(false)\n\tif e != nil {\n\t\tt.Error(\"DecodeRawBytes\")\n\t}\n\tequalbytes(bytes, decb, t)\n}", "title": "" }, { "docid": "455d2b1b86d823f8a3f441fe7bfd0789", "score": "0.5423988", "text": "func TestResponseUnMarshalInit(t *testing.T) {\n\tresponse := new(Response).UnmarshalInit(suite)\n\tif response.suite != suite {\n\t\tt.Error(\"Response not properly initialized.\")\n\t}\n}", "title": "" }, { "docid": "ec6c36e6a18bcefee5460feddbcd8920", "score": "0.5382118", "text": "func TestPackageDropIn(t *testing.T) {\n\t// Verify encoding/json types exists\n\tvar (\n\t\t_ = jsoncolor.Decoder{}\n\t\t_ = jsoncolor.Delim(0)\n\t\t_ = jsoncolor.Encoder{}\n\t\t_ = jsoncolor.InvalidUTF8Error{}\n\t\t_ = jsoncolor.InvalidUnmarshalError{}\n\t\t_ = jsoncolor.Marshaler(nil)\n\t\t_ = jsoncolor.MarshalerError{}\n\t\t_ = jsoncolor.Number(\"0\")\n\t\t_ = jsoncolor.RawMessage{}\n\t\t_ = jsoncolor.SyntaxError{}\n\t\t_ = jsoncolor.Token(nil)\n\t\t_ = jsoncolor.UnmarshalFieldError{}\n\t\t_ = jsoncolor.UnmarshalTypeError{}\n\t\t_ = jsoncolor.Unmarshaler(nil)\n\t\t_ = jsoncolor.UnsupportedTypeError{}\n\t\t_ = jsoncolor.UnsupportedValueError{}\n\t)\n\n\tconst prefix, indent = \"\", \" \"\n\n\ttestCases := []string{\"testdata/sakila_actor.json\", \"testdata/sakila_payment.json\"}\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tt.Run(tc, func(t *testing.T) {\n\t\t\tb, readErr := ioutil.ReadFile(tc)\n\t\t\trequire.NoError(t, readErr)\n\n\t\t\t// Test json.Valid equivalence\n\t\t\tvar fv1, fv2 = json.Valid, jsoncolor.Valid\n\t\t\trequire.Equal(t, fv1(b), fv2(b))\n\n\t\t\t// Test json.Unmarshal equivalence\n\t\t\tvar fu1, fu2 = json.Unmarshal, jsoncolor.Unmarshal\n\t\t\tvar m1, m2 interface{}\n\t\t\terr1, err2 := fu1(b, &m1), fu2(b, &m2)\n\t\t\trequire.NoError(t, err1)\n\t\t\trequire.NoError(t, err2)\n\t\t\trequire.EqualValues(t, m1, m2)\n\n\t\t\t// Test json.Marshal equivalence\n\t\t\tvar fm1, fm2 = json.Marshal, jsoncolor.Marshal\n\t\t\tgotMarshalB1, err1 := fm1(m1)\n\t\t\trequire.NoError(t, err1)\n\t\t\tgotMarshalB2, err2 := fm2(m1)\n\t\t\trequire.NoError(t, err2)\n\t\t\trequire.Equal(t, gotMarshalB1, gotMarshalB2)\n\n\t\t\t// Test json.MarshalIndent equivalence\n\t\t\tvar fmi1, fmi2 = json.MarshalIndent, jsoncolor.MarshalIndent\n\t\t\tgotMarshallIndentB1, err1 := fmi1(m1, prefix, indent)\n\t\t\trequire.NoError(t, err1)\n\t\t\tgotMarshalIndentB2, err2 := fmi2(m1, prefix, indent)\n\t\t\trequire.NoError(t, err2)\n\t\t\trequire.Equal(t, gotMarshallIndentB1, gotMarshalIndentB2)\n\n\t\t\t// Test json.Compact equivalence\n\t\t\tvar fc1, fc2 = json.Compact, jsoncolor.Compact\n\t\t\tvar buf1, buf2 = &bytes.Buffer{}, &bytes.Buffer{}\n\t\t\terr1 = fc1(buf1, gotMarshallIndentB1)\n\t\t\trequire.NoError(t, err1)\n\t\t\terr2 = fc2(buf2, gotMarshalIndentB2)\n\t\t\trequire.NoError(t, err2)\n\t\t\trequire.Equal(t, buf1.Bytes(), buf2.Bytes())\n\t\t\t// Double-check\n\t\t\trequire.Equal(t, buf1.Bytes(), gotMarshalB1)\n\t\t\trequire.Equal(t, buf2.Bytes(), gotMarshalB2)\n\t\t\tbuf1.Reset()\n\t\t\tbuf2.Reset()\n\n\t\t\t// Test json.Indent equivalence\n\t\t\tvar fi1, fi2 = json.Indent, jsoncolor.Indent\n\t\t\terr1 = fi1(buf1, gotMarshalB1, prefix, indent)\n\t\t\trequire.NoError(t, err1)\n\t\t\terr2 = fi2(buf2, gotMarshalB2, prefix, indent)\n\t\t\trequire.NoError(t, err2)\n\t\t\trequire.Equal(t, buf1.Bytes(), buf2.Bytes())\n\t\t\tbuf1.Reset()\n\t\t\tbuf2.Reset()\n\n\t\t\t// Test json.HTMLEscape equivalence\n\t\t\tvar fh1, fh2 = json.HTMLEscape, jsoncolor.HTMLEscape\n\t\t\tfh1(buf1, gotMarshalB1)\n\t\t\tfh2(buf2, gotMarshalB2)\n\t\t\trequire.Equal(t, buf1.Bytes(), buf2.Bytes())\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6ec39e8ea8a4918b2c983431cd626831", "score": "0.53272945", "text": "func (s *Assert) XMLMarshalingP(t *testing.T, v, want interface{}) {\n\tt.Helper()\n\n\tvar buf bytes.Buffer\n\terr := s.XMLEncoderFunc(&buf).Encode(v)\n\trequire.NoErrorf(t, err, \"failed to XML marshal %T: %+v\", v, v)\n\n\tmarshaled := buf.Bytes()\n\tif s.NormalizeLineBreaks {\n\t\tmarshaled = normalizeLineBreaks(marshaled)\n\t}\n\n\tif s.Golden.Update() {\n\t\ts.Golden.SetP(t, \"goldsert_xml\", marshaled)\n\t}\n\n\tgold := s.Golden.GetP(t, \"goldsert_xml\")\n\tif s.NormalizeLineBreaks {\n\t\tgold = normalizeLineBreaks(gold)\n\t}\n\tassert.Equal(t, string(gold), string(marshaled))\n\n\tif reflect.ValueOf(want).Kind() != reflect.Ptr {\n\t\trequire.FailNowf(t,\n\t\t\t\"only pointer types can be asserted\",\n\t\t\t\"%T is not a pointer type\", want,\n\t\t)\n\t}\n\n\tgot := reflect.New(reflect.TypeOf(want).Elem()).Interface()\n\terr = s.XMLDecoderFunc(bytes.NewBuffer(gold)).Decode(got)\n\trequire.NoErrorf(t, err,\n\t\t\"failed to XML unmarshal %T from %s\",\n\t\tgot, s.Golden.FileP(t, \"goldsert_xml\"),\n\t)\n\tassert.Equal(t, want, got,\n\t\t\"unmarshaling from golden file does not match expected object\",\n\t)\n}", "title": "" }, { "docid": "ae8ce70e8885138600017cebbfb514fd", "score": "0.5322167", "text": "func TestVoteSetUnMarshal(t *testing.T) {\n\t// Mock a slice of Reduction events\n\tvar evs []reduction.Reduction\n\tfor i := 0; i < 5; i++ {\n\t\tev := newReductionEvent(1, 1)\n\t\tevs = append(evs, ev)\n\t}\n\n\t// Marshal it\n\tbuf := new(bytes.Buffer)\n\tassert.NoError(t, reduction.MarshalVoteSet(buf, evs))\n\n\t// Now Unmarshal it\n\tevs2, err := reduction.UnmarshalVoteSet(buf)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tassert.Equal(t, evs, evs2)\n}", "title": "" }, { "docid": "5abaab3fac7fc60c8ce06eff377ef653", "score": "0.53169376", "text": "func TestSerialize(t *testing.T) {\n\ttestCodec(t, vomCodec)\n}", "title": "" }, { "docid": "7b51c69f093dccd72ac2c59a3a3eb51a", "score": "0.5296914", "text": "func TestUserinfoSerialization(t *testing.T) {\n\tatl := atlas.MustBuild(FormulaUserinfo_AtlasEntry)\n\tt.Run(\"zero userinfo should roundtrip\", func(t *testing.T) {\n\t\tobj := FormulaUserinfo{}\n\t\tcanon := `{}`\n\n\t\tt.Run(\"marshal\", func(t *testing.T) {\n\t\t\tbs, err := refmt.MarshalAtlased(json.EncodeOptions{}, obj, atl)\n\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\tWish(t, string(bs), ShouldEqual, canon)\n\t\t})\n\t\tt.Run(\"unmarshal\", func(t *testing.T) {\n\t\t\ttarg := FormulaUserinfo{}\n\t\t\terr := refmt.UnmarshalAtlased(json.DecodeOptions{}, bytes.NewBufferString(canon).Bytes(), &targ, atl)\n\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\tWish(t, targ, ShouldEqual, obj)\n\t\t})\n\t})\n\tt.Run(\"userinfo with set zero uid should roundtrip\", func(t *testing.T) {\n\t\ti0 := 0\n\t\tobj := FormulaUserinfo{Uid: &i0}\n\t\tcanon := `{\"uid\":0}`\n\n\t\tt.Run(\"marshal\", func(t *testing.T) {\n\t\t\tbs, err := refmt.MarshalAtlased(json.EncodeOptions{}, obj, atl)\n\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\tWish(t, string(bs), ShouldEqual, canon)\n\t\t})\n\t\tt.Run(\"unmarshal\", func(t *testing.T) {\n\t\t\ttarg := FormulaUserinfo{}\n\t\t\terr := refmt.UnmarshalAtlased(json.DecodeOptions{}, bytes.NewBufferString(canon).Bytes(), &targ, atl)\n\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\tWish(t, targ, ShouldEqual, obj)\n\t\t})\n\t})\n}", "title": "" }, { "docid": "ce33c6abf955444981de534ce4294482", "score": "0.52799", "text": "func TestEncode(t *testing.T) {\n\t// use Marshal for convenience\n\tfor i := range testStructs {\n\t\tb := Marshal(testStructs[i])\n\t\tif !bytes.Equal(b, testEncodings[i]) {\n\t\t\tt.Errorf(\"bad encoding of testStructs[%d]: \\nexp:\\t%v\\ngot:\\t%v\", i, testEncodings[i], b)\n\t\t}\n\t}\n\n\t// bad type\n\tdefer func() {\n\t\tif recover() == nil {\n\t\t\tt.Error(\"expected panic, got nil\")\n\t\t}\n\t}()\n\tNewEncoder(ioutil.Discard).Encode(map[int]int{})\n}", "title": "" }, { "docid": "be3a7d8052205c708e3f4714026fe114", "score": "0.52783823", "text": "func TestMarshal(t *testing.T) {\n\tprepare := func(t *testing.T, models ...mapping.Model) *Codec {\n\t\tt.Helper()\n\t\tc := core.NewDefault()\n\t\trequire.NoError(t, c.RegisterModels(models...))\n\t\treturn &Codec{c: c}\n\t}\n\n\tprepareBlogs := func(t *testing.T) *Codec {\n\t\treturn prepare(t, &Blog{}, &Post{}, &Comment{})\n\t}\n\n\ttests := map[string]func(*testing.T){\n\t\t\"single\": func(t *testing.T) {\n\t\t\tcd := prepareBlogs(t)\n\t\t\tvalue := &Blog{ID: 5, Title: \"My title\", ViewCount: 14}\n\t\t\tdata, err := cd.MarshalModels([]mapping.Model{value})\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.Contains(t, string(data), `\"title\":\"My title\"`)\n\t\t\t\tassert.Contains(t, string(data), `\"view_count\":14`)\n\t\t\t\tassert.Contains(t, string(data), `\"id\":\"5\"`)\n\t\t\t}\n\t\t},\n\t\t\"Time\": func(t *testing.T) {\n\n\t\t\tt.Run(\"NoPtr\", func(t *testing.T) {\n\t\t\t\tcd := prepare(t, &ModelTime{})\n\t\t\t\tnow := time.Now()\n\t\t\t\tvalue := &ModelTime{ID: 5, Time: now}\n\n\t\t\t\tmarshaled, err := cd.MarshalModels([]mapping.Model{value})\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Contains(t, string(marshaled), \"time\")\n\t\t\t\t\tassert.Contains(t, string(marshaled), `\"id\":\"5\"`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tt.Run(\"Ptr\", func(t *testing.T) {\n\t\t\t\tcd := prepare(t, &ModelPtrTime{})\n\t\t\t\tnow := time.Now()\n\t\t\t\tvalue := &ModelPtrTime{ID: 5, Time: &now}\n\t\t\t\tmarshaled, err := cd.MarshalModels([]mapping.Model{value})\n\t\t\t\tif assert.NoError(t, err) {\n\t\t\t\t\tassert.Contains(t, string(marshaled), \"time\")\n\t\t\t\t\tassert.Contains(t, string(marshaled), `\"id\":\"5\"`)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t// \"singleWithMap\": func(t *testing.T) {\n\t\t// \tt.Run(\"PtrString\", func(t *testing.T) {\n\t\t// \t\ttype MpString struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*string `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpString{})\n\t\t//\n\t\t// \t\tkv := \"some\"\n\t\t// \t\tvalue := &MpString{ID: 5, Map: map[string]*string{\"key\": &kv}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":\"some\"}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t//\n\t\t// \tt.Run(\"NilString\", func(t *testing.T) {\n\t\t// \t\ttype MpString struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*string `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpString{})\n\t\t// \t\tvalue := &MpString{ID: 5, Map: map[string]*string{\"key\": nil}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":null}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t//\n\t\t// \tt.Run(\"PtrInt\", func(t *testing.T) {\n\t\t// \t\ttype MpInt struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*int `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpInt{})\n\t\t//\n\t\t// \t\tkv := 5\n\t\t// \t\tvalue := &MpInt{ID: 5, Map: map[string]*int{\"key\": &kv}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":5}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t// \tt.Run(\"NilPtrInt\", func(t *testing.T) {\n\t\t// \t\ttype MpInt struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*int `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpInt{})\n\t\t//\n\t\t// \t\tvalue := &MpInt{ID: 5, Map: map[string]*int{\"key\": nil}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":null}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t// \tt.Run(\"PtrFloat\", func(t *testing.T) {\n\t\t// \t\ttype MpFloat struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*float64 `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpFloat{})\n\t\t//\n\t\t// \t\tfv := 1.214\n\t\t// \t\tvalue := &MpFloat{ID: 5, Map: map[string]*float64{\"key\": &fv}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":1.214}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t// \tt.Run(\"NilPtrFloat\", func(t *testing.T) {\n\t\t// \t\ttype MpFloat struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string]*float64 `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpFloat{})\n\t\t//\n\t\t// \t\tvalue := &MpFloat{ID: 5, Map: map[string]*float64{\"key\": nil}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":null}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t//\n\t\t// \tt.Run(\"SliceInt\", func(t *testing.T) {\n\t\t// \t\ttype MpSliceInt struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tMap map[string][]int `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t// \t\tc := prepare(t, &MpSliceInt{})\n\t\t//\n\t\t// \t\tvalue := &MpSliceInt{ID: 5, Map: map[string][]int{\"key\": {1, 5}}}\n\t\t// \t\tif assert.NoError(t, MarshalC(c, &buf, value)) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"map\":{\"key\":[1,5]}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t// },\n\t\t\"many\": func(t *testing.T) {\n\t\t\tcd := prepareBlogs(t)\n\n\t\t\tvalues := []mapping.Model{&Blog{ID: 5, Title: \"First\"}, &Blog{ID: 2, Title: \"Second\"}}\n\t\t\tmarshaled, err := cd.MarshalModels(values)\n\t\t\tif assert.NoError(t, err) {\n\t\t\t\tassert.Contains(t, string(marshaled), `\"title\":\"First\"`)\n\t\t\t\tassert.Contains(t, string(marshaled), `\"title\":\"Second\"`)\n\t\t\t\tassert.Contains(t, string(marshaled), `\"id\":\"5\"`)\n\t\t\t\tassert.Contains(t, string(marshaled), `\"id\":\"2\"`)\n\t\t\t}\n\t\t},\n\t\t// \"Nested\": func(t *testing.T) {\n\t\t// \tt.Run(\"Simple\", func(t *testing.T) {\n\t\t// \t\ttype NestedSub struct {\n\t\t// \t\t\tFirst int\n\t\t// \t\t}\n\t\t//\n\t\t// \t\ttype Simple struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tNested *NestedSub `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t//\n\t\t// \t\tc := prepare(t, &Simple{})\n\t\t//\n\t\t// \t\terr := MarshalC(c, &buf, &Simple{ID: 2, Nested: &NestedSub{First: 1}})\n\t\t// \t\tif assert.NoError(t, err) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"nested\":{\"first\":1}`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t//\n\t\t// \tt.Run(\"DoubleNested\", func(t *testing.T) {\n\t\t//\n\t\t// \t\ttype NestedSub struct {\n\t\t// \t\t\tFirst int\n\t\t// \t\t}\n\t\t//\n\t\t// \t\ttype DoubleNested struct {\n\t\t// \t\t\tNested *NestedSub\n\t\t// \t\t}\n\t\t//\n\t\t// \t\ttype Simple struct {\n\t\t// \t\t\tID int `neuron:\"type=primary\"`\n\t\t// \t\t\tDouble *DoubleNested `neuron:\"type=attr\"`\n\t\t// \t\t}\n\t\t//\n\t\t// \t\tc := prepare(t, &Simple{})\n\t\t//\n\t\t// \t\terr := MarshalC(c, &buf, &Simple{ID: 2, Double: &DoubleNested{Nested: &NestedSub{First: 1}}})\n\t\t// \t\tif assert.NoError(t, err) {\n\t\t// \t\t\tmarshaled := buf.String()\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"nested\":{\"first\":1}`)\n\t\t// \t\t\tassert.Contains(t, marshaled, `\"double\":{\"nested\"`)\n\t\t// \t\t}\n\t\t// \t})\n\t\t//\n\t\t// },\n\t}\n\n\tfor name, testFunc := range tests {\n\t\tt.Run(name, testFunc)\n\t}\n\n}", "title": "" }, { "docid": "971f9024b89605aaf9e454d327d3afac", "score": "0.52668595", "text": "func TestAction_Marshal( t *testing.T ) {\n var a *Action\n\n // null Action\n test_marshall( t, a, \"null\" )\n\n // empty Action\n a = &Action{}\n test_marshall( t, a, \"null\" )\n\n // empty Action\n a = NewAction()\n test_marshall( t, a, \"null\" )\n\n // Single element Action\n a = NewAction( \"s3:*\" )\n test_marshall( t, a, \"\\\"s3:*\\\"\" )\n\n // multiple element Action\n a = NewAction( \"s3:*\", \"*\" )\n test_marshall( t, a, \"[\\\"s3:*\\\",\\\"*\\\"]\" )\n\n a = NewAction( \"s3:*\", \"*\", \"cloudformation:*\" )\n test_marshall( t, a, \"[\\\"s3:*\\\",\\\"*\\\",\\\"cloudformation:*\\\"]\" )\n}", "title": "" }, { "docid": "96bb9ad727237e8d113340a78d231f17", "score": "0.5256375", "text": "func (s *Assert) XMLMarshaling(t *testing.T, v interface{}) {\n\tt.Helper()\n\n\ts.XMLMarshalingP(t, v, v)\n}", "title": "" }, { "docid": "ca01124e59485ef8f65758a1881a88a1", "score": "0.5247223", "text": "func marshalUnmarshal(i interface{}) (interface{}, error) {\n\tb, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar val interface{}\n\tif err := json.Unmarshal(b, &val); err != nil {\n\t\treturn nil, err\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "648d81cc0ddbf03d8fefb781dba1098b", "score": "0.52274764", "text": "func TestEncodeDecodeBytes1(t *testing.T) {\n\tpb := initGoTest(false)\n\n\t// Create our bytes\n\tpb.F_BytesRequired = []byte{}\n\tpb.F_BytesRepeated = [][]byte{{}}\n\tpb.F_BytesOptional = []byte{}\n\n\td, err := Marshal(pb)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tpbd := new(GoTest)\n\tif err := Unmarshal(d, pbd); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {\n\t\tt.Error(\"required empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {\n\t\tt.Error(\"repeated empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {\n\t\tt.Error(\"optional empty bytes field is incorrect\")\n\t}\n}", "title": "" }, { "docid": "875d079256822b4f2bf8ffaaed7f9291", "score": "0.51928425", "text": "func TestMsgpackStrategy_SerializeInterface2(t *testing.T) {\n\n\tf := &testStuffAdData{\"asdf\", 1, 123123, []byte(\"4983h4tsdof\"), \"56.77867342\"}\n\tfb, err := ms.Serialize(f)\n\tassert.Nil(t, err)\n\n\teb, err := msgpack.Marshal(f)\n\tassert.Nil(t, err)\n\tassert.Equal(t, eb, fb)\n\n\tvar fn interface{}\n\terr = ms.Deserialize(fb, &fn)\n\tassert.Nil(t, err)\n\n\tfnn, ok := fn.(*testStuffAdData)\n\tassert.False(t, ok)\n\n\tassert.NotEqual(t, fnn, f)\n}", "title": "" }, { "docid": "c4f501828ff54162270fbbd622130ff1", "score": "0.5186654", "text": "func TestJsoniterUnmarshalForSample(t *testing.T) {\n\ttestUnmarshalling(t, jsoniter.Unmarshal, \"test sample\")\n}", "title": "" }, { "docid": "07032a078c22b34b867c3fe4c56989fc", "score": "0.5162516", "text": "func TestRenderTest(t *testing.T) {\n\tsuts := []interface {\n\t\tfmt.Stringer\n\t\tutils.Serializable\n\t}{\n\t\t&DefaultArrayInfo{},\n\t\t&DefaultPlcBrowseItem{},\n\t\t&DefaultPlcBrowseRequest{},\n\t\t&DefaultPlcBrowseRequestResult{},\n\t\t&DefaultPlcBrowseResponse{},\n\t\t&DefaultPlcBrowseResponseItem{},\n\t\t&DefaultPlcConsumerRegistration{},\n\t\t&DefaultPlcDiscoveryItem{},\n\t\t&DefaultPlcReadRequest{DefaultPlcTagRequest: NewDefaultPlcTagRequest(nil, nil)},\n\t\t&DefaultPlcReadRequestResult{},\n\t\t&DefaultPlcReadResponse{},\n\t\t&DefaultPlcSubscriptionEvent{},\n\t\t&DefaultPlcSubscriptionEventItem{},\n\t\t&DefaultPlcSubscriptionHandle{},\n\t\t&DefaultPlcSubscriptionRequest{DefaultPlcTagRequest: NewDefaultPlcTagRequest(nil, nil)},\n\t\t&DefaultPlcSubscriptionRequestResult{},\n\t\t&DefaultPlcSubscriptionResponse{},\n\t\t&DefaultPlcSubscriptionResponseItem{},\n\t\t&DefaultPlcTagRequest{},\n\t\t//&DefaultPlcUnsubscriptionRequest{}, //TODO: empty file\n\t\t&DefaultPlcUnsubscriptionRequestResult{},\n\t\t//&DefaultPlcUnsubscriptionResponse{}, //TODO: empty file\n\t\t&DefaultPlcWriteRequest{DefaultPlcTagRequest: NewDefaultPlcTagRequest(nil, nil)},\n\t\t&DefaultPlcWriteRequestResult{},\n\t\t&DefaultPlcWriteResponse{},\n\t}\n\tfor _, sut := range suts {\n\t\tt.Run(fmt.Sprintf(\"%T\", sut), func(t *testing.T) {\n\t\t\tt.Run(\"String\", func(t *testing.T) {\n\t\t\t\tassert.NotEmptyf(t, sut.String(), \"string should at least return type informations\")\n\t\t\t})\n\t\t\tt.Run(\"Get*/IsÜ*\", func(t *testing.T) {\n\t\t\t\tvalueOf := reflect.ValueOf(sut)\n\t\t\t\tfor i := 0; i < valueOf.NumMethod(); i++ {\n\t\t\t\t\tmethod := valueOf.Method(i)\n\t\t\t\t\tmethodName := valueOf.Type().Method(i).Name\n\t\t\t\t\tif strings.HasPrefix(methodName, \"Get\") || strings.HasPrefix(methodName, \"Is\") {\n\t\t\t\t\t\tt.Run(methodName, func(t *testing.T) {\n\t\t\t\t\t\t\tif na := method.Type().NumIn(); na != 0 {\n\t\t\t\t\t\t\t\tt.Skipf(\"skipping because to many argument: %d\", na)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmethod.Call(nil)\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\tt.Run(\"Serialize\", func(t *testing.T) {\n\t\t\t\tserialize, err := sut.Serialize()\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\t_ = serialize\n\t\t\t})\n\t\t})\n\t}\n}", "title": "" }, { "docid": "bd85ae485974a8108b2137e7e4650b1a", "score": "0.5152403", "text": "func TestDealSignatureUnMarshalInit(t *testing.T) {\n\tp := new(signature).UnmarshalInit(suite)\n\tif p.suite != suite {\n\t\tt.Error(\"Suite not properly initialized.\")\n\t}\n}", "title": "" }, { "docid": "72fb45dcce8814d810b5059bfc1d6f8d", "score": "0.51453215", "text": "func (m *MockisIPAddressObj_Formats) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "df7a49422c2dc7fdefcc01c3fa483195", "score": "0.51337457", "text": "func TestDateTimeUnmarshalBinaryError(t *testing.T) {\n\tassert := assert.New(t)\n\tdata := []byte(\"xxxx\")\n\tvar d DateTime\n\terr := d.UnmarshalBinary(data)\n\tassert.Error(err)\n}", "title": "" }, { "docid": "189c2b074aae392019fc3edda39af47f", "score": "0.5131783", "text": "func AssertGotAndWantBytes(t *testing.T, got interface{}, want []byte) {\n\tt.Helper()\n\n\t// normalize\n\tvar wantString, gotString string\n\t{\n\t\tb, err := json.Marshal(got)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"marshal for got, %+v, %+v\", got, err)\n\t\t}\n\t\tvar v interface{}\n\t\tif err := json.Unmarshal(b, &v); err != nil {\n\t\t\tt.Fatalf(\"marshal,unmarshal for got, %+v, %+v\", got, err)\n\t\t}\n\t\tb2, err := json.MarshalIndent(v, \"\", \" \")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"marshal,unmarshal,marshal for got, %+v, %+v\", got, err)\n\t\t}\n\t\tgotString = strings.TrimSpace(*(*string)(unsafe.Pointer(&b2)))\n\t}\n\t{\n\t\tvar v interface{}\n\t\tif err := json.Unmarshal(want, &v); err != nil {\n\t\t\tt.Fatalf(\"unmarshal for want, %+v, %+v\", string(want), err)\n\t\t}\n\t\tb2, err := json.MarshalIndent(v, \"\", \" \")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unmarshal,marshal for want, %+v, %+v\", string(want), err)\n\t\t}\n\t\twantString = strings.TrimSpace(*(*string)(unsafe.Pointer(&b2)))\n\t}\n\n\tdiff := cdiff.Diff(gotString, wantString, cdiff.WordByWord)\n\toutput := diff.UnifiedWithGooKitColor(\"got\", \"want\", 3, cdiff.GooKitColorTheme)\n\n\t// first 4lines is header\n\tif len(strings.SplitAfterN(output, \"\\n\", 5)) >= 5 {\n\t\tt.Errorf(color.Sprintf(output))\n\t}\n}", "title": "" }, { "docid": "4618ab01e9eed4f8b2458ad145858564", "score": "0.51112264", "text": "func TestJsoniterMarshalForSample(t *testing.T) {\n\ttestMarshalling(t, jsoniter.Marshal, \"test sample\")\n}", "title": "" }, { "docid": "cc3de53e44750a292a7ea56e9d4ab6e6", "score": "0.50887704", "text": "func TestArchiveConsistentSerialization(t *testing.T) {\n\t// Create two entries, one of which is a deep copy of the other. We could\n\t// also just serialize the same entry twice, but this is more rigorous.\n\tfirstEntry := tDM\n\tsecondEntry := firstEntry.Copy(true)\n\n\t// Configure Protocol Buffers marshaling to be deterministic.\n\tmarshaling := proto.MarshalOptions{Deterministic: true}\n\n\t// Serialize the first entry.\n\tfirstBytes, err := marshaling.Marshal(&Archive{Content: firstEntry})\n\tif err != nil {\n\t\tt.Fatal(\"unable to marshal first entry:\", err)\n\t}\n\n\t// Serialize the second entry.\n\tsecondBytes, err := marshaling.Marshal(&Archive{Content: secondEntry})\n\tif err != nil {\n\t\tt.Fatal(\"unable to marshal second entry:\", err)\n\t}\n\n\t// Ensure that they're equal.\n\tif !bytes.Equal(firstBytes, secondBytes) {\n\t\tt.Error(\"marshalling is not consistent\")\n\t}\n}", "title": "" }, { "docid": "5d53035ac414f5eb0b6282b01b43a2bd", "score": "0.50870657", "text": "func (s *CalendarSuite) TestMarshal(c *C) {\n\tenc, err := icalendar.Marshal(s.calendar)\n\tc.Assert(err, IsNil)\n\tc.Assert(enc, Equals, \"BEGIN:VCALENDAR\\r\\nVERSION:2.0\\r\\nPRODID:-//taviti/caldav-go//NONSGML v1.0.0//EN\\r\\nEND:VCALENDAR\")\n}", "title": "" }, { "docid": "5c481e5b942577802f1419ff0e02b4d8", "score": "0.50620824", "text": "func TestDecodeMsgObject(t *testing.T) {\n\texpires := time.Now().Add(300 * time.Minute)\n\n\ttests := []struct {\n\t\tinput []byte // The input to the function.\n\t\terrExpected bool // Whether an error is expected.\n\t}{\n\t\t{ // Error case: nil input.\n\t\t\tnil,\n\t\t\ttrue,\n\t\t},\n\t\t{ // Error case. Incomplete header.\n\t\t\t[]byte{},\n\t\t\ttrue,\n\t\t},\n\t\t{ // Error case. Incomplete body.\n\t\t\t[]byte{\n\t\t\t\t0, 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, 85, 75, 111, 20,\n\t\t\t\t0, 0, 0, 0, 4, 1, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,\n\t\t\t\t108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,\n\t\t\t\t124, 125, 126},\n\t\t\ttrue,\n\t\t},\n\t\t{ // Valid case: GetPubKey object.\n\t\t\t[]byte{\n\t\t\t\t0, 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, 85, 75, 111, 20,\n\t\t\t\t0, 0, 0, 0, 4, 1, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,\n\t\t\t\t108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,\n\t\t\t\t124, 125, 126, 127, 128, 129},\n\t\t\tfalse,\n\t\t},\n\t\t{ // Valid case: PubKey object.\n\t\t\twire.EncodeMessage(wire.NewMsgPubKey(543, expires, 4, 1, 2, &pubkey[0], &pubkey[1], 3, 5,\n\t\t\t\t[]byte{4, 5, 6, 7, 8, 9, 10}, &shahash, []byte{11, 12, 13, 14, 15, 16, 17, 18})),\n\t\t\tfalse,\n\t\t},\n\t\t{ // Valid case: Msg object.\n\t\t\twire.EncodeMessage(wire.NewMsgMsg(765, expires, 1, 1,\n\t\t\t\t[]byte{90, 87, 66, 45, 3, 2, 120, 101, 78, 78, 78, 7, 85, 55, 2, 23},\n\t\t\t\t1, 1, 2, &pubkey[0], &pubkey[1], 3, 5, &ripehash, 1,\n\t\t\t\t[]byte{21, 22, 23, 24, 25, 26, 27, 28},\n\t\t\t\t[]byte{20, 21, 22, 23, 24, 25, 26, 27},\n\t\t\t\t[]byte{19, 20, 21, 22, 23, 24, 25, 26})),\n\t\t\tfalse,\n\t\t},\n\t\t{ // Valid case: Broadcast object.\n\t\t\twire.EncodeMessage(wire.NewMsgBroadcast(876, expires, 1, 1, &shahash,\n\t\t\t\t[]byte{90, 87, 66, 45, 3, 2, 120, 101, 78, 78, 78, 7, 85, 55, 2, 23},\n\t\t\t\t1, 1, 2, &pubkey[0], &pubkey[1], 3, 5, 1,\n\t\t\t\t[]byte{27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41},\n\t\t\t\t[]byte{42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56})),\n\t\t\tfalse,\n\t\t},\n\t\t{ // Valid case: unknown object.\n\t\t\twire.EncodeMessage(wire.NewMsgUnknownObject(345, expires, wire.ObjectType(4), 1, 1, []byte{77, 82, 53, 48, 96, 1})),\n\t\t\tfalse,\n\t\t},\n\t}\n\n\tfor i, test := range tests {\n\t\tif _, err := wire.DecodeMsgObject(test.input); (err != nil) != test.errExpected {\n\t\t\tt.Errorf(\"failed test case %d.\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86c3f4e03a31bb1cc956504435b243b2", "score": "0.5048329", "text": "func (s *Assert) JSONMarshaling(t *testing.T, v interface{}) {\n\tt.Helper()\n\n\ts.JSONMarshalingP(t, v, v)\n}", "title": "" }, { "docid": "720848a887e2f41fb43f6885c1607ba3", "score": "0.5047777", "text": "func assertUnmarshalUntrustedSigstorePayloadFails(t *testing.T, input []byte) {\n\tvar s UntrustedSigstorePayload\n\terr := json.Unmarshal(input, &s)\n\tassert.Error(t, err, string(input))\n}", "title": "" }, { "docid": "a83370c9795626b81ca4b6216facbfa0", "score": "0.5038491", "text": "func TestRoundTrip_UUID(t *testing.T) {\n\tassert := assert.New(t)\n\n\tstringVal := \"\"\n\n\ttestCases := []*TestCaseRoundTrip{\n\t\t{\n\t\t\tName: \"NotNil\",\n\t\t\tValue: cereal.MustUUIDRandom(),\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"blob(16)\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tencoded := testCase.Value.(*cereal.UUID)\n\t\t\t\tdecoded := testCase.Decoded.(*cereal.UUID)\n\n\t\t\t\tassert.Equal(\n\t\t\t\t\tencoded.MustGoogle().String(),\n\t\t\t\t\tdecoded.MustGoogle().String(),\n\t\t\t\t\t\"UUIDs equal\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"Nil\",\n\t\t\tValue: nil,\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"blob(16)\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tdecoded := testCase.Decoded.(*cereal.UUID)\n\t\t\t\tassert.Nil(decoded.Bin)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"HexMarshaller\",\n\t\t\tValue: protosql.UUIDHexMarshaller{UUID: cereal.MustUUIDRandom()},\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"string\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tencoded := testCase.Value.(protosql.UUIDHexMarshaller)\n\t\t\t\tdecoded := testCase.Decoded.(*cereal.UUID)\n\n\t\t\t\tassert.Equal(\n\t\t\t\t\tencoded.MustGoogle().String(),\n\t\t\t\t\tdecoded.MustGoogle().String(),\n\t\t\t\t\t\"UUIDs equal\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"HexMarshaller_Nil\",\n\t\t\tValue: protosql.UUIDHexMarshaller{UUID: nil},\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"string\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tdecoded := testCase.Decoded.(*cereal.UUID)\n\n\t\t\t\tassert.Nil(\n\t\t\t\t\tdecoded.Bin,\n\t\t\t\t\t\"UUID nil\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"HexMarshaller_RoundTrip\",\n\t\t\tValue: protosql.UUIDHexMarshaller{UUID: cereal.MustUUIDRandom()},\n\t\t\tDecoded: new(protosql.UUIDHexMarshaller),\n\t\t\tSQLFieldType: \"string\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tencoded := testCase.Value.(protosql.UUIDHexMarshaller)\n\t\t\t\tdecoded := testCase.Decoded.(*protosql.UUIDHexMarshaller)\n\n\t\t\t\tassert.Equal(\n\t\t\t\t\tencoded.MustGoogle().String(),\n\t\t\t\t\tdecoded.MustGoogle().String(),\n\t\t\t\t\t\"UUIDs equal\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"HexMarshaller_RoundTrip_Nil\",\n\t\t\tValue: protosql.UUIDHex(nil),\n\t\t\tDecoded: new(protosql.UUIDHexMarshaller),\n\t\t\tSQLFieldType: \"string\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tdecoded := testCase.Decoded.(*protosql.UUIDHexMarshaller)\n\n\t\t\t\tassert.Nil(\n\t\t\t\t\tdecoded.UUID,\n\t\t\t\t\t\"UUID nil\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t// Test that the hex string is actually being stored and not the blob.\n\t\t{\n\t\t\tName: \"HexMarshaller_StringVal\",\n\t\t\tValue: protosql.UUIDHex(cereal.MustUUIDRandom()),\n\t\t\tDecoded: &stringVal,\n\t\t\tSQLFieldType: \"string\",\n\t\t\tSubTest: func(t *testing.T, testCase *TestCaseRoundTrip) {\n\t\t\t\tencoded := testCase.Value.(protosql.UUIDHexMarshaller)\n\n\t\t\t\tassert.Equal(\n\t\t\t\t\tencoded.MustGoogle().String(),\n\t\t\t\t\tstringVal,\n\t\t\t\t\t\"UUIDs equal\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t// Test that the hex string is actually being stored and not the blob.\n\t\t{\n\t\t\tName: \"HexMarshaller_ErrBadEncode\",\n\t\t\tValue: protosql.UUIDHexMarshaller{\n\t\t\t\tUUID: &cereal.UUID{Bin: []byte(\"not a uuid\")},\n\t\t\t},\n\t\t\tDecoded: &stringVal,\n\t\t\tSQLFieldType: \"string\",\n\t\t\tExpectedEncodeErr: errors.New(\n\t\t\t\t\"sql: converting argument $1 type: error converting uuid bytes: \" +\n\t\t\t\t\t\"proto uuid message must be 16 bytes: 10 bytes found\",\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tName: \"ScanErr_BadBytes\",\n\t\t\tValue: []byte(\"not a uuid\"),\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"blob(16)\",\n\t\t\tExpectedDecodeErr: errors.New(\n\t\t\t\t\"sql: Scan error on column index 0, name \\\"value\\\": proto uuid\" +\n\t\t\t\t\t\" message must be 16 bytes: 10 bytes found\",\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tName: \"ScanErr_BadString\",\n\t\t\tValue: \"not a uuid\",\n\t\t\tDecoded: new(cereal.UUID),\n\t\t\tSQLFieldType: \"string\",\n\t\t\tExpectedDecodeErr: errors.New(\n\t\t\t\t\"sql: Scan error on column index 0, name \\\"value\\\": error \" +\n\t\t\t\t\t\"parsing uuid string: invalid UUID length: 10\",\n\t\t\t),\n\t\t},\n\t}\n\n\tfor _, testCase := range testCases {\n\t\tRunTestRoundTrip(t, testCase)\n\t}\n}", "title": "" }, { "docid": "c7342582171ee51f60368670991df780", "score": "0.5036654", "text": "func testChunkEncoding(t *testing.T, encoding Encoding, samples int) {\n\tchunk := mkChunk(t, encoding, samples)\n\n\tvar buf bytes.Buffer\n\terr := chunk.Marshal(&buf)\n\trequire.NoError(t, err)\n\n\tbs1 := buf.Bytes()\n\tchunk, err = NewForEncoding(encoding)\n\trequire.NoError(t, err)\n\n\terr = chunk.UnmarshalFromBuf(bs1)\n\trequire.NoError(t, err)\n\n\t// Check all the samples are in there.\n\titer := chunk.NewIterator(nil)\n\tfor i := 0; i < samples; i++ {\n\t\trequire.True(t, iter.Scan())\n\t\tsample := iter.Value()\n\t\trequire.EqualValues(t, model.Time(i*step), sample.Timestamp)\n\t\trequire.EqualValues(t, model.SampleValue(i), sample.Value)\n\t}\n\trequire.False(t, iter.Scan())\n\trequire.NoError(t, iter.Err())\n\n\t// Check seek works after unmarshal\n\titer = chunk.NewIterator(iter)\n\tfor i := 0; i < samples; i += samples / 10 {\n\t\trequire.True(t, iter.FindAtOrAfter(model.Time(i*step)))\n\t}\n\n\t// Check the byte representation after another Marshall is the same.\n\tbuf = bytes.Buffer{}\n\terr = chunk.Marshal(&buf)\n\trequire.NoError(t, err)\n\tbs2 := buf.Bytes()\n\n\trequire.Equal(t, bs1, bs2)\n}", "title": "" }, { "docid": "eb1484a6995efa97112d90a3fe0e0c7d", "score": "0.5031135", "text": "func TestBadUnmarshal(t *testing.T) {\n\tval := LuaNumber(5)\n\tvar str string\n\terr := val.Unmarshal(&str)\n\tif err == nil {\n\t\tt.Error(\"Expected error when unmarshalling lua number into a Go string\")\n\t}\n}", "title": "" }, { "docid": "b391d202a9f0f79a93d027fa768f794f", "score": "0.5024006", "text": "func (m *MockisRuleMatch_AppMatch_App) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d5fe68fbcc3a5a053e4236dcc05b491c", "score": "0.5022474", "text": "func TestDumpJSON(t *testing.T) {\n\ttestTime := time.Now()\n\tsod := OptionalDate(testTime)\n\tf := float64(16.2)\n\tsof := OptionalFloat64{value: &f}\n\ts := Sample{SampleString: \"Test\", SampleInt: 5, SampleOptionalDate: &sod, SampleOptionalFloat: &sof}\n\ts2 := TransformSample{SampleString: \"Test\", SampleInt: 5, SampleOptionalDate: &testTime, SampleOptionalFloat: 16.2}\n\n\tfo, err := ioutil.TempFile(\"\", \"dumptest.*.json\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdefer os.Remove(fo.Name())\n\n\tDumpJSON(fo, s)\n\n\tfo.Close()\n\n\tdata, err := ioutil.ReadFile(fo.Name())\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tt.Logf(\"%s\", string(data))\n\n\tv := TransformSample{}\n\terr = json.Unmarshal(data, &v)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif diff := cmp.Diff(v, s2); diff != \"\" {\n\t\tt.Errorf(\"TransformCompanyOverview hasn't saved properly to disk, \\n%s\", cmp.Diff(v, s2))\n\t}\n\n}", "title": "" }, { "docid": "c5df646da5936fcf60c8396c46518584", "score": "0.5014389", "text": "func TestNilMarshaler(t *testing.T) {\n\t// Try a struct with a Marshaler field that is nil.\n\t// It should be directly marshable.\n\tnmm := new(NMMessage)\n\tif _, err := Marshal(nmm); err != nil {\n\t\tt.Error(\"unexpected error marshaling nmm: \", err)\n\t}\n\n\t// Try a struct with a Marshaler field that is not nillable.\n\tnnim := new(NNIMessage)\n\tnnim.nni = 7\n\tvar _ Marshaler = nnim.nni // verify it is truly a Marshaler\n\tif _, err := Marshal(nnim); err != nil {\n\t\tt.Error(\"unexpected error marshaling nnim: \", err)\n\t}\n}", "title": "" }, { "docid": "27a6e40b81687e97fd79bfd9b3736a1a", "score": "0.5004135", "text": "func (s *userTestSuite) testUserMarshal(t *testing.T) {\n\n\tis := is.New(t)\n\n\talice := &userRegistrationRequest{\"alice\"}\n\n\tdata, err := json.Marshal(alice)\n\n\tis.NoErr(err)\n\tis.Equal(data, []byte(`{\"username\":\"alice\"}`))\n\n}", "title": "" }, { "docid": "2d127424d8571f916fc4c77dbabab8d0", "score": "0.49933064", "text": "func (s *Assert) JSONMarshalingP(t *testing.T, v, want interface{}) {\n\tt.Helper()\n\n\tvar buf bytes.Buffer\n\terr := s.JSONEncoderFunc(&buf).Encode(v)\n\trequire.NoErrorf(t, err, \"failed to JSON marshal %T: %+v\", v, v)\n\n\tmarshaled := buf.Bytes()\n\tif s.NormalizeLineBreaks {\n\t\tmarshaled = normalizeLineBreaks(marshaled)\n\t}\n\n\tif s.Golden.Update() {\n\t\ts.Golden.SetP(t, \"goldsert_json\", marshaled)\n\t}\n\n\tgold := s.Golden.GetP(t, \"goldsert_json\")\n\tif s.NormalizeLineBreaks {\n\t\tgold = normalizeLineBreaks(gold)\n\t}\n\tassert.JSONEq(t, string(gold), string(marshaled))\n\n\tif reflect.ValueOf(want).Kind() != reflect.Ptr {\n\t\trequire.FailNowf(t,\n\t\t\t\"only pointer types can be asserted\",\n\t\t\t\"%T is not a pointer type\", want,\n\t\t)\n\t}\n\n\tgot := reflect.New(reflect.TypeOf(want).Elem()).Interface()\n\terr = s.JSONDecoderFunc(bytes.NewBuffer(gold)).Decode(got)\n\trequire.NoErrorf(t, err,\n\t\t\"failed to JSON unmarshal %T from %s\",\n\t\tgot, s.Golden.FileP(t, \"goldsert_json\"),\n\t)\n\tassert.Equal(t, want, got,\n\t\t\"unmarshaling from golden file does not match expected object\",\n\t)\n}", "title": "" }, { "docid": "3b261c81818f5d0133151563d65c0f03", "score": "0.49926025", "text": "func TestSerialization(t *testing.T) {\n\n\t// initialize server with fresh random key\n\tserver, err := NewServer(DefaultServerConfig())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tbuf, err := json.Marshal(server.Config())\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tvar cfg ServerConfig\n\terr = json.Unmarshal(buf, &cfg)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tserver2, err := NewServer(cfg)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif server.version != server2.version {\n\t\tt.Error(\"serialization failed: version not equal\")\n\t}\n\n\tciphertextA, err := server.EncryptBucketEntry(\"testuser\", \"testpassword\", MetadataSimilarPassword, []byte(\"helloworld\"))\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tciphertextB, err := server2.EncryptBucketEntry(\"testuser\", \"testpassword\", MetadataSimilarPassword, []byte(\"helloworld\"))\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif !bytes.Equal(ciphertextA, ciphertextB) {\n\t\tt.Error(\"serialization test failed\")\n\t}\n}", "title": "" }, { "docid": "15b80aa5bb101367633a616a404b229e", "score": "0.4977488", "text": "func Unmarshal(ct string, b []byte, d interface{}) (err error) {\n\tif IsJSONType(ct) {\n\t\terr = json.Unmarshal(b, d)\n\t} else if IsXMLType(ct) {\n\t\terr = xml.Unmarshal(b, d)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a88fac26e6ded24a63f225807e28edb0", "score": "0.49741817", "text": "func (m *MockisIPAddress_V4OrV6) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3ba0ec51cc54c866bddabb4b0671c7b1", "score": "0.4971048", "text": "func Test_BaseRepository_DecodeSuccess(t *testing.T) {\n\trep := BaseRepository{}\n\tm := models.Device{}\n\tbytes, err := rep.Encode(m)\n\tassert.NoError(t, err)\n\n\terr = rep.Decode(bytes, &m)\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "c17537c745870b3721b3f35da69813e7", "score": "0.49677804", "text": "func TestCompatibility(\n\tt *testing.T,\n\tversion schema.GroupVersion,\n\tinput []byte,\n\tvalidator func(obj runtime.Object) field.ErrorList,\n\texpectedKeys map[string]string,\n\tabsentKeys []string,\n) {\n\n\t// Decode\n\tcodec := legacyscheme.Codecs.LegacyCodec(version)\n\tobj, err := runtime.Decode(codec, input)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t}\n\n\t// Validate\n\terrs := validator(obj)\n\tif len(errs) != 0 {\n\t\tt.Fatalf(\"Unexpected validation errors: %v\", errs)\n\t}\n\n\t// Encode\n\toutput, err := runtime.Encode(codec, obj)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t}\n\n\t// Validate old and new fields are encoded\n\tgeneric := map[string]interface{}{}\n\tif err := json.Unmarshal(output, &generic); err != nil {\n\t\tt.Fatalf(\"Unexpected error: %v\", err)\n\t}\n\n\tfor k, expectedValue := range expectedKeys {\n\t\tkeys := strings.Split(k, \".\")\n\t\tif actualValue, ok, err := getJSONValue(generic, keys...); err != nil || !ok {\n\t\t\tt.Errorf(\"Unexpected error for %s: %v\", k, err)\n\t\t} else if !reflect.DeepEqual(expectedValue, fmt.Sprintf(\"%v\", actualValue)) {\n\t\t\tt.Errorf(\"Unexpected value for %v: expected %v, got %v\", k, expectedValue, actualValue)\n\t\t}\n\t}\n\n\tfor _, absentKey := range absentKeys {\n\t\tkeys := strings.Split(absentKey, \".\")\n\t\tactualValue, ok, err := getJSONValue(generic, keys...)\n\t\tif err == nil || ok {\n\t\t\tt.Errorf(\"Unexpected value found for key %s: %v\", absentKey, actualValue)\n\t\t}\n\t}\n\n\tif t.Failed() {\n\t\tdata, err := json.MarshalIndent(obj, \"\", \" \")\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t} else {\n\t\t\tt.Log(string(data))\n\t\t}\n\t\tt.Logf(\"2: Encoded value: %v\", string(output))\n\t}\n}", "title": "" }, { "docid": "7eddbde1539823ec4d7a46957be4cf3f", "score": "0.49664345", "text": "func TestStringPrimitives(t *testing.T) {\n\to := old()\n\ts := \"now is the time\"\n\tif o.EncodeStringBytes(s) != nil {\n\t\tt.Error(\"enc_string\")\n\t}\n\tdecs, e := o.DecodeStringBytes()\n\tif e != nil {\n\t\tt.Error(\"dec_string\")\n\t}\n\tif s != decs {\n\t\tt.Error(\"string encode/decode fail:\", s, decs)\n\t}\n}", "title": "" }, { "docid": "f0eb0ca10011eaaea2421845fdf9eb82", "score": "0.49623317", "text": "func TestReadFromFileSkipeUnmarshall(t *testing.T) {\n\tinput := \"not_unmarshall.txt\"\n\tcustomers := []Customer{Customer{User_id: 1, Name: \"Alice Cahill\", Latitude: \"51.92893\", Longitude: \"-10.27699\"}}\n\n\terrors := []Error{Error{2, errors.New(\"customer: missing at least one field\")}}\n\n\tgot, err := ReadFromFile(input)\n\tif !reflect.DeepEqual(got, customers) && reflect.DeepEqual(err, errors) {\n\t\tt.Errorf(\"ReadFromFile(%v) = %v %v, want errors %v\", input, got, err, errors)\n\t}\n}", "title": "" }, { "docid": "f055a9ba85289d9abf1f218901ec42ac", "score": "0.49588385", "text": "func TestEncodeDecode(t *testing.T) {\n\tfOpts := NewMACCommandSet(UnconfirmedDataUp, MaxFOptsLen)\n\tfOpts.Add(NewUplinkMACCommand(DevStatusAns))\n\tfOpts.Add(NewUplinkMACCommand(LinkADRAns))\n\tinput := NewPHYPayload(UnconfirmedDataUp)\n\tinput.MACPayload.FHDR.DevAddr = DevAddr{NwkID: 1, NwkAddr: 2}\n\tinput.MACPayload.FHDR.FCtrl = FCtrl{\n\t\tADR: true,\n\t\tACK: true,\n\t\tADRACKReq: false,\n\t\tFPending: true,\n\t\tClassB: true,\n\t\tFOptsLen: 0,\n\t}\n\tinput.MACPayload.FHDR.FCnt = 12\n\tinput.MACPayload.FHDR.FOpts = fOpts\n\tinput.MACPayload.FPort = 12\n\tinput.MACPayload.FRMPayload = []byte{1, 2, 3, 4, 5, 6}\n\n\tbuffer, err := input.MarshalBinary()\n\tif err != nil {\n\t\tt.Fatal(\"Got error marshalling binary: \", err)\n\t}\n\n\toutput := NewPHYPayload(Proprietary)\n\tif err = output.UnmarshalBinary(buffer); err != nil {\n\t\tt.Fatal(\"Got error unmarshaling binary: \", err)\n\t}\n\n\tcomparePHYPayload(&input, &output, t)\n}", "title": "" }, { "docid": "c2e8fb772fc525543fc7e57753e81f2b", "score": "0.49468288", "text": "func AssertUnmarshalText(t testing.TB, s string, v encoding.TextUnmarshaler) (ok bool) {\n\tt.Helper()\n\n\t// Create the expected value.\n\twant := newGenericCodecChecker(v)\n\tassignGenericCodecChecker(want, v)\n\n\t// Create the checker value.\n\tgot := newGenericCodecChecker(v)\n\n\t// Marshal the expected data.\n\tstrChecker := newStringCodecChecker(s)\n\tb, err := json.Marshal(strChecker)\n\trequire.NoErrorf(t, err, \"marshaling checker value\")\n\n\t// Unmarshal into the checker value and compare.\n\terr = json.Unmarshal(b, got.Interface())\n\trequire.NoErrorf(t, err, \"unmarshaling value\")\n\n\treturn assert.Equal(t, want.Interface(), got.Interface())\n}", "title": "" }, { "docid": "32b13d0a66b2ba1dfed49f9c16d58963", "score": "0.49421698", "text": "func TestTx(t *testing.T) {\n\tvar testRound = 100\n\n\tfor i := 0; i < testRound; i++ {\n\t\ttx := mockTx()\n\t\tbuf, err := proto.Marshal(tx)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tt.FailNow()\n\t\t}\n\n\t\tnewTx := new(Tx)\n\t\terr = proto.Unmarshal(buf, newTx)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tt.FailNow()\n\t\t}\n\n\t\t// compare tx and newTx\n\t\tif !proto.Equal(tx, newTx) {\n\t\t\tt.Error(\"tx and newTx is not equal\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5450fa9b624df0d12ef1ffc2297c83b1", "score": "0.49382067", "text": "func (m mockBlockMarshaler) Marshal(interface{}) []byte {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "59a68231df45a02a8805fa191e4e3bad", "score": "0.49248964", "text": "func testAppendToMarshal(t *testing.T, x appendMarshaler) {\n\tt.Helper()\n\tm, err := x.MarshalText()\n\tif err != nil {\n\t\tt.Fatalf(\"(%v).MarshalText: %v\", x, err)\n\t}\n\ta := make([]byte, 0, len(m))\n\ta = x.AppendTo(a)\n\tif !bytes.Equal(m, a) {\n\t\tt.Errorf(\"(%v).MarshalText = %q, (%v).AppendTo = %q\", x, m, x, a)\n\t}\n}", "title": "" }, { "docid": "a4fe5fa13e0e123d4376e43dc8f6ec1a", "score": "0.4921731", "text": "func TestLoadAndWrite(t *testing.T) {\n\ttest, err2 := ParseTtml(\"../testfiles/sample.ttml\")\n\tif err2 != nil {\n\t\tt.Errorf(\"WriteTtml returned an unexpected error\")\n\t}\n\n\ta := convertstruct(test)\n\tWriteTtml(a, \"../testfiles/sample2.ttml\")\n\ttest2, err := ParseTtml(\"../testfiles/sample2.ttml\")\n\tif err != nil {\n\t\tt.Errorf(\"WriteTtml returned an unexpected error\")\n\t}\n\tif cmp.Equal(test, test2) == false {\n\t\tdiff := cmp.Diff(test, test2)\n\t\tt.Errorf(\"Read structs of input and output do not match\" + diff)\n\t}\n}", "title": "" }, { "docid": "861afd7c423b6956744502d1e18e7c61", "score": "0.49186933", "text": "func TestDecodeGood(t *testing.T) {\n\tfor _, s := range good {\n\t\tfmt.Println(\"TEST CASE:\", s.name)\n\t\tl, err := Decode(s.payload)\n\t\tif err != nil {\n\t\t\tt.Fatal(s.name, \"failed:\", err)\n\t\t}\n\n\t\tfor _, p := range l {\n\t\t\tfn, ok := checkers[p.Type]\n\t\t\tif !ok {\n\t\t\t\tt.Fatal(s.name, \"unknown type:\", p.Type)\n\t\t\t}\n\t\t\tfn(t, p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba08e6d89ce9c25daa877b25d51562bd", "score": "0.4907662", "text": "func TestTranscodeVDLValueToEncoder(t *testing.T) {\n\tfor _, test := range vomtest.AllPass() {\n\t\tvar buf bytes.Buffer\n\t\tenc := vom.NewEncoder(&buf)\n\t\tif err := vdl.Write(enc.Encoder(), test.Value.Interface()); err != nil {\n\t\t\tt.Errorf(\"%s: vdl.Write failed: %v\", test.Name(), err)\n\t\t\tcontinue\n\t\t}\n\t\tif got, want := buf.Bytes(), test.Bytes(); !bytes.Equal(got, want) {\n\t\t\tt.Errorf(\"%s\\nGOT %x\\nWANT %x\", test.Name(), got, want)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32e6273ddb421c3bd4dfa9d79a0e6dea", "score": "0.4901006", "text": "func TestVolumeDirectoryBlockMarshalRoundtrip(t *testing.T) {\n\tb1 := randomBlock()\n\tvdb := &VolumeDirectoryBlock{}\n\terr := vdb.FromBlock(b1)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tb2, err := vdb.ToBlock()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif b1 != b2 {\n\t\tt.Fatalf(\"Blocks differ: %s\", strings.Join(pretty.Diff(b1[:], b2[:]), \"; \"))\n\t}\n\tvdb2 := &VolumeDirectoryBlock{}\n\terr = vdb2.FromBlock(b2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif *vdb != *vdb2 {\n\t\tt.Errorf(\"Structs differ: %v != %v\", vdb, vdb2)\n\t}\n}", "title": "" }, { "docid": "2a9c8d9d66fd1a349c85575578f1c074", "score": "0.48958325", "text": "func SafeUnmarshal(data []byte, dest interface{}) error {\n\tr := bytes.NewReader(data)\n\tn, err := Unmarshal(r, dest)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n != len(data) {\n\t\treturn fmt.Errorf(\"input not fully consumed. expected to read: %d, actual: %d\", len(data), n)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df03461a5650b21e875527a521d8254c", "score": "0.48937574", "text": "func Unmarshal(data string, v interface{}) bool {\n jsonErr := json.Unmarshal([]byte(data), &v)\n\n // if there was an error, log it\n if jsonErr != nil {\n fmt.Printf(\"====jsonErr: %s\\n\", jsonErr.Error())\n return false\n }\n\n return true\n}", "title": "" }, { "docid": "fb33a39725274f45259ecb1383aef11d", "score": "0.48840985", "text": "func TestSubdirectoryBlockMarshalRoundtrip(t *testing.T) {\n\tb1 := randomBlock()\n\tsb := &SubdirectoryBlock{}\n\terr := sb.FromBlock(b1)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tb2, err := sb.ToBlock()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif b1 != b2 {\n\t\tt.Fatalf(\"Blocks differ: %s\", strings.Join(pretty.Diff(b1[:], b2[:]), \"; \"))\n\t}\n\tsb2 := &SubdirectoryBlock{}\n\terr = sb2.FromBlock(b2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif *sb != *sb2 {\n\t\tt.Errorf(\"Structs differ: %v != %v\", sb, sb2)\n\t}\n}", "title": "" }, { "docid": "c26d95ff9ccd198a68ad9871d64bf016", "score": "0.48827493", "text": "func TestJSONAndJSONBTranscode(t *testing.T) {\n\tt.Parallel()\n\n\tctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)\n\tdefer cancel()\n\n\tpgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {\n\t\tfor _, typename := range []string{\"json\", \"jsonb\"} {\n\t\t\tif _, ok := conn.TypeMap().TypeForName(typename); !ok {\n\t\t\t\tcontinue // No JSON/JSONB type -- must be running against old PostgreSQL\n\t\t\t}\n\n\t\t\ttestJSONString(t, conn, typename)\n\t\t\ttestJSONStringPointer(t, conn, typename)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "77cb4f8c81193bbfc33ce8e79187003a", "score": "0.48821282", "text": "func TestMarshalXML(t *testing.T) {\n\tfn := \"MarshalXML\"\n\ta := TestAtomGINF\n\tvar buf []byte\n\tvar e error\n\tif buf, e = AtomToXMLDocumentText(a); e != nil {\n\t\tt.Errorf(\"%s(%s): expect no error, got %s\", fn, \"GINF\", e.Error())\n\t\treturn\n\t} else {\n\t\tgot := strings.TrimSpace(string(buf))\n\t\twant := strings.TrimSpace(xmlGINF)\n\t\tif got != want {\n\t\t\tt.Errorf(\"%s(%s): xml result does not match expected.\\nGot:\\n<<<%s>>>\\nWant:\\n<<<%s>>>\", fn, \"GINF\", got, want)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77cd7d9c49f1aa70391e8755fd032af0", "score": "0.48816088", "text": "func TestServerResponseSerialization(t *testing.T) {\n\tsizes, err := oprf.GetSizes(DefaultOPRFSuite)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tr1 := ServerResponse{\n\t\t123,\n\t\tmake([]byte, sizes.SerializedElementLength),\n\t\t[]byte{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t}\n\tif _, err := rand.Read(r1.EvaluatedElement); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdata, err := r1.MarshalBinary()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\texpectedLen := 4 + len(r1.EvaluatedElement) + len(r1.BucketContents)\n\tif len(data) != expectedLen {\n\t\tt.Fatalf(\"want %d, got %d\", expectedLen, len(data))\n\t}\n\n\tr2 := ServerResponse{}\n\n\tif err = r2.UnmarshalBinary(data); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif r1.Version != r2.Version || !bytes.Equal(r1.EvaluatedElement, r2.EvaluatedElement) || !bytes.Equal(r1.BucketContents, r2.BucketContents) {\n\t\tt.Fatal(\"mismatch\")\n\t}\n}", "title": "" }, { "docid": "b56e50990b0db3707fbab4536c8f9b93", "score": "0.48795804", "text": "func TestTooLargeUnmarshal(codec GeneralCodec, t testing.TB) {\n\trequire := require.New(t)\n\n\ttype inner struct {\n\t\tB uint16 `serialize:\"true\"`\n\t}\n\tbytes := []byte{0, 0, 0, 0}\n\n\tmanager := NewManager(3)\n\trequire.NoError(manager.RegisterCodec(0, codec))\n\n\ts := inner{}\n\t_, err := manager.Unmarshal(bytes, &s)\n\trequire.ErrorIs(err, ErrUnmarshalTooBig)\n}", "title": "" }, { "docid": "4fa74b0398a6b7007620b47a958cc336", "score": "0.48779264", "text": "func unmarshal(data []byte, v interface{}, dataFormat string) (err error) {\n\n\ttype parseFunc func([]byte, interface{}) error\n\n\tparsers := map[string]parseFunc{\n\t\t\"json\": json.Unmarshal,\n\t\t\"yaml\": yaml.Unmarshal,\n\t\t\"toml\": toml.Unmarshal,\n\t}\n\n\tif dataFormat == \"\" {\n\t\t// try all known format\n\t\tfor _, parse := range parsers {\n\t\t\terr = parse(data, v)\n\t\t\tif err == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"Unknown format\")\n\t}\n\n\t// normalize format\n\tif dataFormat == \"yml\" {\n\t\tdataFormat = \"yaml\"\n\t}\n\n\tparse := parsers[dataFormat]\n\tif parse == nil {\n\t\treturn fmt.Errorf(\"Unsupported format %q\", dataFormat)\n\t}\n\n\terr = parse(data, v)\n\n\treturn\n}", "title": "" }, { "docid": "b6233f9afb6b0e276b4db8d6a1ee8e4c", "score": "0.48775718", "text": "func TestAddSubnetValidatorMarshal(t *testing.T) {\n\tvm, _ := defaultVM()\n\tvm.Ctx.Lock.Lock()\n\tdefer func() {\n\t\tvm.Shutdown()\n\t\tvm.Ctx.Lock.Unlock()\n\t}()\n\n\tvar unmarshaledTx Tx\n\n\t// valid tx\n\ttx, err := vm.newAddSubnetValidatorTx(\n\t\tdefaultWeight,\n\t\tuint64(defaultValidateStartTime.Unix()),\n\t\tuint64(defaultValidateEndTime.Unix()),\n\t\tkeys[0].PublicKey().Address(),\n\t\ttestSubnet1.ID(),\n\t\t[]*crypto.PrivateKeySECP256K1R{testSubnet1ControlKeys[0], testSubnet1ControlKeys[1]},\n\t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t} else if txBytes, err := Codec.Marshal(tx); err != nil {\n\t\tt.Fatal(err)\n\t} else if err := Codec.Unmarshal(txBytes, &unmarshaledTx); err != nil {\n\t\tt.Fatal(err)\n\t} else if err := unmarshaledTx.Sign(vm.codec, nil); err != nil {\n\t\tt.Fatal(err)\n\t} else if err := unmarshaledTx.UnsignedTx.(*UnsignedAddSubnetValidatorTx).Verify(vm.Ctx, vm.codec, vm.txFee, vm.Ctx.AVAXAssetID); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif tx.UnsignedTx.(*UnsignedAddSubnetValidatorTx).Memo == nil { // reflect.DeepEqual considers []byte{} and nil to be different so change nil to []byte{}\n\t\ttx.UnsignedTx.(*UnsignedAddSubnetValidatorTx).Memo = []byte{}\n\t}\n\tif !reflect.DeepEqual(*tx, unmarshaledTx) {\n\t\tt.Fatal(\"should be equal\")\n\t}\n}", "title": "" }, { "docid": "49b0c207398a3b84175e242ad4f5e790", "score": "0.4868081", "text": "func verifyCorrectArchiver(nsKeyedArchiverData map[string]interface{}) error {\n\tif val, ok := nsKeyedArchiverData[\"$archiver\"]; !ok {\n\t\treturn fmt.Errorf(\"Invalid NSKeyedAchiverObject, missing key '%s'\", \"$archiver\")\n\t} else if stringValue := val.(string); stringValue != \"NSKeyedArchiver\" {\n\t\treturn fmt.Errorf(\"Invalid value: %s for key '%s', expected: '%s'\", stringValue, \"$archiver\", \"NSKeyedArchiver\")\n\t}\n\n\tif _, ok := nsKeyedArchiverData[\"$top\"]; !ok {\n\t\treturn fmt.Errorf(\"Invalid NSKeyedAchiverObject, missing key '%s'\", \"$top\")\n\t}\n\n\tif _, ok := nsKeyedArchiverData[\"$objects\"]; !ok {\n\t\treturn fmt.Errorf(\"Invalid NSKeyedAchiverObject, missing key '%s'\", \"$objects\")\n\t}\n\n\tif val, ok := nsKeyedArchiverData[\"$version\"]; !ok {\n\t\treturn fmt.Errorf(\"Invalid NSKeyedAchiverObject, missing key '%s'\", \"$version\")\n\t} else if stringValue := val.(uint64); stringValue != 100000 {\n\t\treturn fmt.Errorf(\"Invalid value: %d for key '%s', expected: '%d'\", stringValue, \"$version\", 100000)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "205c5b26401b30d3595a0064756ec50c", "score": "0.4866058", "text": "func TestNegativeInt32(t *testing.T) {\n\tom := &OldMessage{\n\t\tNum: Int32(-1),\n\t}\n\tb, err := Marshal(om)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of OldMessage: %v\", err)\n\t}\n\n\t// Check the size. It should be 11 bytes;\n\t// 1 for the field/wire type, and 10 for the negative number.\n\tif len(b) != 11 {\n\t\tt.Errorf(\"%v marshaled as %q, wanted 11 bytes\", om, b)\n\t}\n\n\t// Unmarshal into a NewMessage.\n\tnm := new(NewMessage)\n\tif err := Unmarshal(b, nm); err != nil {\n\t\tt.Fatalf(\"Unmarshal to NewMessage: %v\", err)\n\t}\n\twant := &NewMessage{\n\t\tNum: Int64(-1),\n\t}\n\tif !Equal(nm, want) {\n\t\tt.Errorf(\"nm = %v, want %v\", nm, want)\n\t}\n}", "title": "" }, { "docid": "8dc451b9ab4a4bb124c6c4094090501c", "score": "0.48636487", "text": "func TestSendETHrpcMarshal(t *testing.T) {\n\tis := is.New(t)\n\tgsprc, ok := new(big.Int).SetString(\"10000000000000\", 10)\n\tif !ok {\n\t\tt.Error(\"set string error:\")\n\t}\n\tval, ok := new(big.Int).SetString(\"2441406250\", 10)\n\tif !ok {\n\t\tt.Error(\"set string error\")\n\t}\n\texpected := `{\"from\":\"0xb60E8dD61C5d32be8058BB8eb970870F07233155\",\"to\":\"0xd46E8dD67C5d32be8058Bb8Eb970870F07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\"}`\n\tv1 := sendETHrpc{\n\t\tFrom: common.HexToAddress(\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\"),\n\t\tTo: common.HexToAddress(\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\"),\n\t\tGas: 30400,\n\t\tGasPrice: gsprc,\n\t\tValue: val,\n\t}\n\tresult, err := v1.MarshalJSON()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tis.Equal(string(result), expected)\n}", "title": "" }, { "docid": "3671fe49da4206008dc77b52096717a1", "score": "0.48586425", "text": "func (m *MockisIPSubnet_Subnet) MarshalTo(arg0 []byte) (int, error) {\n\tret := m.ctrl.Call(m, \"MarshalTo\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "61fbd86a5d9a404fffa3a9c6de90cdc4", "score": "0.48572093", "text": "func TestEndianBuffer(t *testing.T) {\n\tfor cIdx, c := range cases {\n\t\ttypes := make([]interface{}, len(c.data))\n\n\t\ttempfile, err := ioutil.TempFile(\"\", \"endibuf_\")\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Tempfile Create Error case: %d / %s\", cIdx, err)\n\t\t}\n\t\tw := NewWriter(tempfile)\n\t\tw.Endian = c.endian\n\t\tfor i := range c.data {\n\t\t\ttypes[i] = c.data[i]\n\t\t\tw.WriteData(c.data[i])\n\t\t}\n\t\terr = tempfile.Close()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Tempfile Close Error case: %d / %s\", cIdx, err)\n\t\t}\n\n\t\treadbuf, err := os.Open(tempfile.Name())\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Tempfile Read Error case: %d / %s\", cIdx, err)\n\t\t}\n\t\tdefer readbuf.Close()\n\n\t\tb, err := ioutil.ReadAll(readbuf)\n\t\tif !reflect.DeepEqual(b, c.middle) {\n\t\t\tt.Errorf(\"Not Matched Middle case: %d / %s\", cIdx, err)\n\t\t}\n\t\treadbuf.Seek(0, 0)\n\t\tr := NewReader(readbuf)\n\t\tr.Endian = c.endian\n\t\tfor i := range types {\n\t\t\tswitch data := types[i].(type) {\n\t\t\tdefault:\n\t\t\t\terr = r.ReadData(&data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"Read Error case: %d / %s\", cIdx, err)\n\t\t\t\t}\n\t\t\t\tif !reflect.DeepEqual(data, c.data[i]) {\n\t\t\t\t\tt.Errorf(\"Read Data Not Matched case: %d / %s\", cIdx, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdefer os.Remove(tempfile.Name())\n\t}\n}", "title": "" }, { "docid": "9463db7677ed91c44b471c0678bd8a04", "score": "0.4855104", "text": "func TestUnmarshalFileEmpty(t *testing.T) {\n\ttype Test struct {\n\t\tA string\n\t}\n\ttest := &Test{}\n\terr := UnmarshalFile(\"foo.json\", test)\n\trequire.Error(t, err)\n}", "title": "" } ]
c408f4bfcf15c44c8aa95802520f9b46
Find the set of end states states reachable through transitions from the given start state. Experimental.
[ { "docid": "6fac781bad83dea3987e16f84e5e0f95", "score": "0.590064", "text": "func DynamoDeleteItem_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoDeleteItem\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
[ { "docid": "1a6b0ec7ea35e69c170ac0a4db50aaa8", "score": "0.71022403", "text": "func CodeBuildStartBuild_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.CodeBuildStartBuild\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e0d61df362519e7dbfa33a03d1f975c4", "score": "0.7066198", "text": "func SnsPublish_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SnsPublish\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2341dba05f03f15923b34911267e829c", "score": "0.6994087", "text": "func DynamoGetItem_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoGetItem\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "04b8d0670a5188e0d4cbd32881d82293", "score": "0.68707186", "text": "func SageMakerUpdateEndpoint_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerUpdateEndpoint\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6dc0f9de36a3e4378cbc7f67b522a8d5", "score": "0.6833601", "text": "func LambdaInvoke_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.LambdaInvoke\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c9b71bb88e1750554be1c5417d144b0d", "score": "0.68209624", "text": "func StepFunctionsStartExecution_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.StepFunctionsStartExecution\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6702f86fa5e8481593c838329502ba8d", "score": "0.67275524", "text": "func SageMakerCreateModel_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateModel\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "73b601da8effe67e9c2a80b7af53b96b", "score": "0.67158157", "text": "func SageMakerCreateEndpoint_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateEndpoint\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ce13dd6973b0755166d84d42b25d97be", "score": "0.67153317", "text": "func SageMakerCreateTransformJob_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateTransformJob\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "461ea56d9412c503d86211506191b57b", "score": "0.6700428", "text": "func EvaluateExpression_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EvaluateExpression\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e28e54ba6d34e975038a72f5b09eff86", "score": "0.6689766", "text": "func EksCall_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EksCall\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "922f121c00de9903d3f14f41d2e52856", "score": "0.6672675", "text": "func GlueStartJobRun_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.GlueStartJobRun\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4d4dea116823f8d6d54e7870e61d524b", "score": "0.6665327", "text": "func AthenaStartQueryExecution_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaStartQueryExecution\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f2b05efd066000f3b5eaf78a96b581a1", "score": "0.665528", "text": "func SageMakerCreateEndpointConfig_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateEndpointConfig\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3f263c522a7fb273a8345cf80b4e23d9", "score": "0.6590707", "text": "func EcsRunTask_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EcsRunTask\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "74d326280bc1dacbdc25681238f5999a", "score": "0.6557071", "text": "func SageMakerCreateTrainingJob_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateTrainingJob\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9a9f2aae02a384e98116b37b145ab2be", "score": "0.64874935", "text": "func StepFunctionsInvokeActivity_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.StepFunctionsInvokeActivity\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "806b5d28d5f5a480acef278869d102d4", "score": "0.6421316", "text": "func DynamoUpdateItem_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoUpdateItem\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "48737c897d3598df6c7b938c89896391", "score": "0.63687783", "text": "func EventBridgePutEvents_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EventBridgePutEvents\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "31ca5596c1bb21dcc804adc98c7057a3", "score": "0.6363941", "text": "func DynamoPutItem_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoPutItem\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "50824371d605f226164dc50543933481", "score": "0.63087285", "text": "func EmrCancelStep_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrCancelStep\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f3baf2b12c544875e538f690815eb180", "score": "0.63077235", "text": "func GlueDataBrewStartJobRun_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.GlueDataBrewStartJobRun\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "700dce8f63a663be1958e95c75b3e0be", "score": "0.6277873", "text": "func AthenaGetQueryExecution_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaGetQueryExecution\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1494d2090670c6a25b25a6c66d7dfd16", "score": "0.62292594", "text": "func SqsSendMessage_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SqsSendMessage\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8cbd59aed1758e567dbad54a19bad5a1", "score": "0.6181136", "text": "func CallApiGatewayRestApiEndpoint_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.CallApiGatewayRestApiEndpoint\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7c62da298c4fede029ef04634d9294d9", "score": "0.60996175", "text": "func EmrAddStep_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrAddStep\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "b852536ded1871156085ad39875d8f3d", "score": "0.6073318", "text": "func AthenaGetQueryResults_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaGetQueryResults\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e30d17b13f61862c3b6c49082b2ed7c3", "score": "0.6064869", "text": "func AthenaStopQueryExecution_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaStopQueryExecution\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0462b155aba204491abc220e3378eedf", "score": "0.5994868", "text": "func EmrSetClusterTerminationProtection_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrSetClusterTerminationProtection\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "044c781e8b8ffabbedad7ad6bdbd30b1", "score": "0.5970578", "text": "func CallApiGatewayHttpApiEndpoint_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.CallApiGatewayHttpApiEndpoint\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "70aca5039732f5704c20c633d997d6bb", "score": "0.5958469", "text": "func EmrTerminateCluster_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrTerminateCluster\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e59673f1f991fb5a43db56f60a0a30c6", "score": "0.57242787", "text": "func EmrCreateCluster_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrCreateCluster\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1535704eeecd0c3c56974bbc4fd71c79", "score": "0.55785197", "text": "func SageMakerUpdateEndpoint_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerUpdateEndpoint\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2aed9193764bc36bd9cab6ad21db2b86", "score": "0.5557037", "text": "func (nfa *NFA) allStates() mapset.Set {\n\tstates := mapset.NewSet()\n\tfor key := range nfa.Rules {\n\t\tstates.Add(key.From)\n\t}\n\treturn states\n}", "title": "" }, { "docid": "a2cc344d7395a4b5ef89814d6f06a058", "score": "0.55073047", "text": "func SnsPublish_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SnsPublish\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "cf60517bbcb7ba1c03c21784a8c23f67", "score": "0.5451639", "text": "func BatchSubmitJob_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.BatchSubmitJob\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "54d0f950ee8b615cef8d11e5eb56af9c", "score": "0.537929", "text": "func (n *NFA) GetStartStates() Set {\n\treturn n.start\n}", "title": "" }, { "docid": "483d81e699914f59866db65ddd886ce4", "score": "0.5332688", "text": "func SageMakerCreateEndpoint_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateEndpoint\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c0553ce6ad9c8681bf423e5e66bbe9b4", "score": "0.5315177", "text": "func (n *NFA) GetAllEnds() (set Set) {\n\tfor _, b := range n.rules {\n\t\tfor _, j := range b {\n\t\t\tset.AddSet(j)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bcbdefc8432c62b7898da621bcf80f3a", "score": "0.5314998", "text": "func buildStateHierarchy(states JsonStates, actions ActionMap) (start *StateInfo, list depStates, err *FsmError) {\n\tcount := len(states)\n\n\t// map state indexes to names\n\tnames := make([]string, count)\n\tindexes := make(map[string]int)\n\tvar idx int\n\tfor k, _ := range states {\n\t\tnames[idx] = k\n\t\tindexes[k] = idx\n\t\tidx++\n\t}\n\n\t// build dependency graph\n\t// graph[i][j] == true means i depends on j (i is a child of j)\n\tgraph := make(depGraph, count)\n\tfor i, _ := range graph {\n\t\tgraph[i] = make([]bool, count)\n\t}\n\tfor name, state := range states {\n\t\tif len(state.Parent) > 0 {\n\t\t\ti := indexes[name]\n\t\t\tj := indexes[state.Parent]\n\t\t\tgraph[i][j] = true\n\t\t}\n\t\tif len(state.StartSubState) > 0 {\n\t\t\ti := indexes[state.StartSubState]\n\t\t\tj := indexes[name]\n\t\t\tgraph[i][j] = true\n\t\t}\n\t}\n\n\t// satisfy dependencies of every state\n\tlist = make(depStates)\n\tmarkers := make(depMarkers, count)\n\n\tfor _, idx := range indexes {\n\t\terr = satisfyDependencies(idx, graph, markers, names, states, actions, &start, list)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "84a35383428400a0ebf068feb1d8e232", "score": "0.52724797", "text": "func EmrModifyInstanceGroupByName_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrModifyInstanceGroupByName\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "26d0304df2649ee71894d0f86c726c47", "score": "0.5254574", "text": "func (n *NFA) GetAllTransitionsFor(from, with string) (set Set) {\n\tif tran, ok := n.rules[from]; ok != false {\n\t\tif to, okk := tran[with]; okk != false {\n\t\t\tset.AddSet(to)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5eefbce363139f04c4c64a1b80b252a0", "score": "0.52508515", "text": "func CodeBuildStartBuild_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.CodeBuildStartBuild\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "438217c9b08f067ee3a0e9e17923ff9a", "score": "0.52290523", "text": "func EmrModifyInstanceFleetByName_FindReachableEndStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrModifyInstanceFleetByName\",\n\t\t\"findReachableEndStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5c588fdcaca38c6b5ef0bbe917f6d033", "score": "0.5204541", "text": "func DynamoGetItem_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoGetItem\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ca5822f88032f8701c1f6c790adc1fea", "score": "0.52044797", "text": "func (cls *ChaincodePrivateLedgerShim) GetStateRange(prefix string) (map[string][]byte, error) {\n\titr, err := cls.Stub.GetPrivateDataByRange(cls.Collection, prefix, prefix+\"\\x7f\")\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not get state iterator\")\n\t}\n\treturn StateIteratorToMap(&ChaincodeResultIteratorShim{ResultsIterator: itr})\n}", "title": "" }, { "docid": "6888413d1e2eb423748e7ed7b19b3645", "score": "0.5199389", "text": "func (tb *TrieBuilder) transitions(s int64) []int64 {\n\tcs := make([]int64, 0)\n\n\tfor c := int64(0); c < AlphabetSize+1; c++ {\n\t\tt := tb.base[s] + (c + 1)\n\t\tif t < int64(len(tb.check)) && tb.check[t] == s {\n\t\t\tcs = append(cs, c+1)\n\t\t}\n\t}\n\treturn cs\n}", "title": "" }, { "docid": "f1932946c09376b7ee397160ae13fe05", "score": "0.5193104", "text": "func EmrCancelStep_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrCancelStep\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7da7766b444a6e5d52c5c9267955b4e2", "score": "0.5171543", "text": "func findEnd(start *node) *node {\n\tcurrent := start\n\tfor current.next != nil {\n\t\tcurrent = current.next\n\t}\n\treturn current\n}", "title": "" }, { "docid": "d559ddd979afe2dd91eb6d3b0dad327a", "score": "0.51715106", "text": "func (cls *ChaincodePublicLedgerShim) GetStateRange(prefix string) (map[string][]byte, error) {\n\titr, err := cls.GetStateByRange(prefix, prefix+\"\\x7f\")\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not get state iterator\")\n\t}\n\treturn StateIteratorToMap(&ChaincodeResultIteratorShim{ResultsIterator: itr})\n}", "title": "" }, { "docid": "d6c548544588fe8f24935a9f54260ff4", "score": "0.5165504", "text": "func (rt Edges) Search(start string) (Vertices, error) {\n\t// Resulting table constains vertex name to Vertex struct mapping.\n\t// Use v.From predecessor to trace the path back.\n\ttb := make(Vertices)\n\tfor _, p := range rt {\n\t\ttb[p.From] = &Vertex{inf, \" \"}\n\t\ttb[p.To] = &Vertex{inf, \" \"}\n\t}\n\ttb[start].Distance = 0\n\n\t// As many iterations as there are nodes.\n\tfor i := 0; i < len(tb); i++ {\n\t\tvar changed bool\n\n\t\t// Iterate over pairs.\n\t\tfor _, pair := range rt {\n\t\t\tn := tb[pair.From]\n\t\t\tif n.Distance != inf {\n\t\t\t\tif tb[pair.To].Distance > n.Distance+pair.Distance {\n\t\t\t\t\ttb[pair.To].Distance = n.Distance + pair.Distance\n\t\t\t\t\ttb[pair.To].From = pair.From\n\t\t\t\t\tchanged = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif !changed {\n\t\t\t// No more changes made. We done.\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, pair := range rt {\n\t\tif tb[pair.From].Distance != inf &&\n\t\t\ttb[pair.To].Distance != inf &&\n\t\t\ttb[pair.From].Distance+pair.Distance < tb[pair.To].Distance {\n\t\t\treturn nil, ErrNegativeCycle\n\t\t}\n\t}\n\treturn tb, nil\n}", "title": "" }, { "docid": "43db01d42396ed338cbd5adea1008909", "score": "0.5163856", "text": "func (cc CommonChaincode) GetStateRange(collection, prefix string) shim.StateQueryIteratorInterface {\n\treturn cc.GetPrivateDataByRange(collection, prefix, prefix+\"\\x7f\")\n}", "title": "" }, { "docid": "990b2d84f5cc5c5bc0a56936b9fdf8ce", "score": "0.5153662", "text": "func LambdaInvoke_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.LambdaInvoke\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8198b8140ea21b45163f777bba7f5839", "score": "0.51283354", "text": "func SageMakerCreateEndpointConfig_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateEndpointConfig\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2e34f1ea6b86da3c390b58736ce90742", "score": "0.5120497", "text": "func EvaluateExpression_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EvaluateExpression\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e793fcabbbfc34847bda7aa6e9790708", "score": "0.5118363", "text": "func (m heightMap) getValidSteps(n node) []node {\n\tcurrentHeight := m._map[n.x][n.y]\n\tsteps := make([]node, 0)\n\n\t// Up neighbour\n\tif n.x > 0 && m._map[n.x-1][n.y] <= currentHeight+1 {\n\t\tsteps = append(steps, node{n.x - 1, n.y})\n\t}\n\t// Down neighbour\n\tif n.x < len(m._map)-1 && m._map[n.x+1][n.y] <= currentHeight+1 {\n\t\tsteps = append(steps, node{n.x + 1, n.y})\n\t}\n\t// Left neighbour\n\tif n.y > 0 && m._map[n.x][n.y-1] <= currentHeight+1 {\n\t\tsteps = append(steps, node{n.x, n.y - 1})\n\t}\n\t// Right neighbour\n\tif n.y < len(m._map[0])-1 && m._map[n.x][n.y+1] <= currentHeight+1 {\n\t\tsteps = append(steps, node{n.x, n.y + 1})\n\t}\n\treturn steps\n}", "title": "" }, { "docid": "a0f2f28a8bfef9655f567a35487c8c4f", "score": "0.51116264", "text": "func EcsRunTask_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EcsRunTask\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4ce0f38cad5340732c056e7db0260b61", "score": "0.5111331", "text": "func EmrSetClusterTerminationProtection_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrSetClusterTerminationProtection\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9c8c528305f90d8d64f00a2be7ea51a1", "score": "0.5107535", "text": "func (d DRuleBook) GetRuleEnd(from, with string) Set {\n\tset := NewSet()\n\tif tran, ok := d[from]; ok != false {\n\t\tif end, okk := tran[with]; okk != false {\n\t\t\tset.Add(end)\n\t\t}\n\t}\n\treturn set\n}", "title": "" }, { "docid": "3f4913f9c98de80392eebe8b76958dcb", "score": "0.5069742", "text": "func StepFunctionsStartExecution_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.StepFunctionsStartExecution\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8659928c64b63a0bdc75ad1526a56499", "score": "0.50453484", "text": "func (board *Board) findNewStates(state State) {\n\n\tstateMatrix := state.getMatrix()\n\n\tfor pieceIdx, piece := range state.Pieces {\n\n\t\tstartingBlock, _ := state.getPieceStartingBlock(piece)\n\n\t\tfor _, move := range getMoves() {\n\t\t\tcanMove := state.canMove(piece, stateMatrix, startingBlock, move)\n\n\t\t\tif canMove {\n\t\t\t\tnewState, err := board.movePiece(state, pieceIdx, piece, move)\n\t\t\t\tif err == nil {\n\t\t\t\t\t_, visited := board.VisitedStatesHashes[newState.Hash]\n\t\t\t\t\tif visited == false {\n\t\t\t\t\t\tboard.VisitedStatesHashes[newState.Hash] = true\n\t\t\t\t\t\tboard.States = append(board.States, newState)\n\n\t\t\t\t\t\tnewStateMatrix := newState.getMatrix()\n\t\t\t\t\t\tstartingBlockOnNewState, _ := newState.getPieceStartingBlock(piece)\n\t\t\t\t\t\tpieceInNewState := newState.Pieces[pieceIdx]\n\t\t\t\t\t\tcanMoveAgain := newState.canMove(pieceInNewState, newStateMatrix, startingBlockOnNewState, move)\n\n\t\t\t\t\t\tif canMoveAgain {\n\t\t\t\t\t\t\tnewState2, err2 := board.movePiece(newState, pieceIdx, pieceInNewState, move)\n\n\t\t\t\t\t\t\tif err2 == nil {\n\t\t\t\t\t\t\t\t_, visited := board.VisitedStatesHashes[newState2.Hash]\n\n\t\t\t\t\t\t\t\tif visited == false {\n\t\t\t\t\t\t\t\t\tboard.VisitedStatesHashes[newState2.Hash] = true\n\t\t\t\t\t\t\t\t\tnewState2.Step--\n\t\t\t\t\t\t\t\t\tboard.States = append(board.States, newState2)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c37b6a8cb409191df1d98a0bf68944c", "score": "0.5022307", "text": "func EventBridgePutEvents_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EventBridgePutEvents\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4c5d7a3f33afd9dad7e73419c91e33a2", "score": "0.50222814", "text": "func (n *NFA) Reverse() (out *NFA) {\n\tout = NewNFA()\n\ta := make([]*State, n.Len())\n\tfor i := range a {\n\t\ta[i] = out.NewState()\n\t}\n\n\tvar acceptingIds []int\n\tfor idFrom := 0; idFrom < n.Len(); idFrom++ {\n\t\tstate := n.State(idFrom)\n\t\tif state.IsAccepting {\n\t\t\tacceptingIds = append(acceptingIds, idFrom)\n\t\t}\n\t\tfor sym, tos := range n.State(idFrom).edges {\n\t\t\tfor to := range tos {\n\t\t\t\ta[to.Id()].NewEdge(sym, a[idFrom])\n\t\t\t}\n\t\t}\n\t}\n\n\ta[n.start.Id()].IsAccepting = true\n\tswitch len(acceptingIds) {\n\tcase 1:\n\t\tout.start = a[acceptingIds[0]]\n\tdefault:\n\t\tout.start = out.NewState()\n\t\tfor _, id := range acceptingIds {\n\t\t\tout.start.NewEdge(Epsilon, a[id])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0a95e55f23cc6e338c9524ba6f636ffe", "score": "0.5015541", "text": "func EksCall_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EksCall\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3a91adf6ec186a4d0dadbb144454db6a", "score": "0.50072926", "text": "func AthenaStopQueryExecution_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaStopQueryExecution\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "518e43483714ae03fb76f5072d23a635", "score": "0.5002164", "text": "func (d DRuleBook) GetFromTransition(from, with string) Set {\n\tif tran, ok := d[from]; ok != false {\n\t\tif end, okk := tran[with]; okk != false {\n\t\t\tset := NewSet()\n\t\t\tset.Add(end)\n\t\t\treturn set\n\t\t}\n\t}\n\treturn NewSet()\n}", "title": "" }, { "docid": "13c7986caaae0e0ad117396865044ea8", "score": "0.49922746", "text": "func (d *goodDisease) FindNodesInState(state int) map[int]Void {\n\ts := uint8(state)\n\tnodes := make(map[int]Void)\n\tfor node, st := range d.nodeState {\n\t\tif s == st {\n\t\t\tnodes[node] = Void{}\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "ed0fcee53b1ee2cfdea90c1771677eb3", "score": "0.49611512", "text": "func getMatchSessionsToEnd(tx *sqlx.Tx) ([]MatchSession, map[util.UUIDAsBlob][]Match, error) {\n\tquery := `\n SELECT MatchSession.* FROM MatchSession\n WHERE DATETIME(MatchSession.StartDate) < DATETIME(?)\n AND MatchSession.Status != ?`\n\tvar sessions []MatchSession\n\tif err := tx.Select(\n\t\t&sessions, query,\n\t\tutil.TimeAsDateTimeTZ(time.Now()),\n\t\tMatchSessionStatusClosed,\n\t); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar ret []MatchSession\n\tsessMatches := map[util.UUIDAsBlob][]Match{}\n\nloop:\n\tfor k := range sessions {\n\t\tmatches, err := getMatchesBySessionID(tx, sessions[k].ID)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// A stale session with no match should only happen in dev.\n\t\tif len(matches) == 0 {\n\t\t\tlog.Printf(\"warning: closing stale session with no match: %s\", sessions[k].ID)\n\t\t\tret = append(ret, sessions[k])\n\t\t\tcontinue\n\t\t}\n\n\t\tfor j := range matches {\n\t\t\tif !matches[j].HasEnded() {\n\t\t\t\tcontinue loop\n\t\t\t}\n\t\t}\n\n\t\tret = append(ret, sessions[k])\n\t\tsessMatches[sessions[k].ID] = matches\n\t}\n\n\treturn ret, sessMatches, nil\n}", "title": "" }, { "docid": "ea0565d8f3d2feaf9768fd1e489f6d30", "score": "0.49466255", "text": "func EmrTerminateCluster_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.EmrTerminateCluster\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9ddcb00628a192d637598113c50ad909", "score": "0.49412024", "text": "func (d *DatabaseTransaction) GetStateDeltas(\n\tctx context.Context, device *userapi.Device,\n\tr types.Range, userID string,\n\tstateFilter *synctypes.StateFilter, rsAPI api.SyncRoomserverAPI,\n) (deltas []types.StateDelta, joinedRoomsIDs []string, err error) {\n\t// Implement membership change algorithm: https://github.com/matrix-org/synapse/blob/v0.19.3/synapse/handlers/sync.py#L821\n\t// - Get membership list changes for this user in this sync response\n\t// - For each room which has membership list changes:\n\t// * Check if the room is 'newly joined' (insufficient to just check for a join event because we allow dupe joins TODO).\n\t// If it is, then we need to send the full room state down (and 'limited' is always true).\n\t// * Check if user is still CURRENTLY invited to the room. If so, add room to 'invited' block.\n\t// * Check if the user is CURRENTLY (TODO) left/banned. If so, add room to 'archived' block.\n\t// - Get all CURRENTLY joined rooms, and add them to 'joined' block.\n\n\t// Look up all memberships for the user. We only care about rooms that a\n\t// user has ever interacted with — joined to, kicked/banned from, left.\n\tmemberships, err := d.CurrentRoomState.SelectRoomIDsWithAnyMembership(ctx, d.txn, userID)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil, nil\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\tallRoomIDs := make([]string, 0, len(memberships))\n\tjoinedRoomIDs := make([]string, 0, len(memberships))\n\tfor roomID, membership := range memberships {\n\t\tallRoomIDs = append(allRoomIDs, roomID)\n\t\tif membership == spec.Join {\n\t\t\tjoinedRoomIDs = append(joinedRoomIDs, roomID)\n\t\t}\n\t}\n\n\t// get all the state events ever (i.e. for all available rooms) between these two positions\n\tstateNeeded, eventMap, err := d.OutputEvents.SelectStateInRange(ctx, d.txn, r, nil, allRoomIDs)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil, nil\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\tstate, err := d.fetchStateEvents(ctx, d.txn, stateNeeded, eventMap)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil, nil\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\t// get all the state events ever (i.e. for all available rooms) between these two positions\n\tstateFiltered := state\n\t// avoid hitting the database if the result would be the same as above\n\tif !isStatefilterEmpty(stateFilter) {\n\t\tvar stateNeededFiltered map[string]map[string]bool\n\t\tvar eventMapFiltered map[string]types.StreamEvent\n\t\tstateNeededFiltered, eventMapFiltered, err = d.OutputEvents.SelectStateInRange(ctx, d.txn, r, stateFilter, allRoomIDs)\n\t\tif err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\treturn nil, nil, nil\n\t\t\t}\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tstateFiltered, err = d.fetchStateEvents(ctx, d.txn, stateNeededFiltered, eventMapFiltered)\n\t\tif err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\treturn nil, nil, nil\n\t\t\t}\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\t// find out which rooms this user is peeking, if any.\n\t// We do this before joins so any peeks get overwritten\n\tpeeks, err := d.Peeks.SelectPeeksInRange(ctx, d.txn, userID, device.ID, r)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn nil, nil, err\n\t}\n\n\t// add peek blocks\n\tfor _, peek := range peeks {\n\t\tif peek.New {\n\t\t\t// send full room state down instead of a delta\n\t\t\tvar s []types.StreamEvent\n\t\t\ts, err = d.currentStateStreamEventsForRoom(ctx, peek.RoomID, stateFilter)\n\t\t\tif err != nil {\n\t\t\t\tif err == sql.ErrNoRows {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tstate[peek.RoomID] = s\n\t\t}\n\t\tif !peek.Deleted {\n\t\t\tdeltas = append(deltas, types.StateDelta{\n\t\t\t\tMembership: spec.Peek,\n\t\t\t\tStateEvents: d.StreamEventsToEvents(ctx, device, state[peek.RoomID], rsAPI),\n\t\t\t\tRoomID: peek.RoomID,\n\t\t\t})\n\t\t}\n\t}\n\n\t// handle newly joined rooms and non-joined rooms\n\tnewlyJoinedRooms := make(map[string]bool, len(state))\n\tfor roomID, stateStreamEvents := range state {\n\t\tfor _, ev := range stateStreamEvents {\n\t\t\t// Look for our membership in the state events and skip over any\n\t\t\t// membership events that are not related to us.\n\t\t\tmembership, prevMembership := getMembershipFromEvent(ctx, ev.PDU, userID, rsAPI)\n\t\t\tif membership == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif membership == spec.Join {\n\t\t\t\t// If our membership is now join but the previous membership wasn't\n\t\t\t\t// then this is a \"join transition\", so we'll insert this room.\n\t\t\t\tif prevMembership != membership {\n\t\t\t\t\tnewlyJoinedRooms[roomID] = true\n\t\t\t\t\t// Get the full room state, as we'll send that down for a newly\n\t\t\t\t\t// joined room instead of a delta.\n\t\t\t\t\tvar s []types.StreamEvent\n\t\t\t\t\tif s, err = d.currentStateStreamEventsForRoom(ctx, roomID, stateFilter); err != nil {\n\t\t\t\t\t\tif err == sql.ErrNoRows {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn nil, nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add the information for this room into the state so that\n\t\t\t\t\t// it will get added with all of the rest of the joined rooms.\n\t\t\t\t\tstateFiltered[roomID] = s\n\t\t\t\t}\n\n\t\t\t\t// We won't add joined rooms into the delta at this point as they\n\t\t\t\t// are added later on.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdeltas = append(deltas, types.StateDelta{\n\t\t\t\tMembership: membership,\n\t\t\t\tMembershipPos: ev.StreamPosition,\n\t\t\t\tStateEvents: d.StreamEventsToEvents(ctx, device, stateFiltered[roomID], rsAPI),\n\t\t\t\tRoomID: roomID,\n\t\t\t})\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Finally, add in currently joined rooms, including those from the\n\t// join transitions above.\n\tfor _, joinedRoomID := range joinedRoomIDs {\n\t\tdeltas = append(deltas, types.StateDelta{\n\t\t\tMembership: spec.Join,\n\t\t\tStateEvents: d.StreamEventsToEvents(ctx, device, stateFiltered[joinedRoomID], rsAPI),\n\t\t\tRoomID: joinedRoomID,\n\t\t\tNewlyJoined: newlyJoinedRooms[joinedRoomID],\n\t\t})\n\t}\n\n\treturn deltas, joinedRoomIDs, nil\n}", "title": "" }, { "docid": "18f36064707f1d8ee51022e0600d576b", "score": "0.49131614", "text": "func (a *agent) possibleNextStates(b board) ([]*state, []action) {\n\tposStates := []*state{}\n\tposActions := []action{}\n\tvar posBoard board\n\t// Look for empty cases on the board\n\tfor i, l := range b {\n\t\tfor j, c := range l {\n\t\t\tif c == e {\n\t\t\t\t// When a case is empty, add the associated state to posStates\n\t\t\t\tposBoard = b.copy()\n\t\t\t\tposBoard[i][j] = a.sign\n\t\t\t\tposStates = append(posStates, a.getState(posBoard))\n\t\t\t\tposActions = append(posActions, action{i, j})\n\t\t\t}\n\t\t}\n\t}\n\treturn posStates, posActions\n}", "title": "" }, { "docid": "a7bd085e0fc782aae9fb5e07dd7a7c20", "score": "0.490513", "text": "func getStateIPs() (map[string]bool, error) {\n\tret := make(map[string]bool)\n\n\tcmd := exec.Command(pfctlCmd, \"-s\", \"states\")\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tscanner := bufio.NewScanner(strings.NewReader(string(out)))\n\tfor scanner.Scan() {\n\t\tfields := strings.Fields(scanner.Text())\n\t\tif len(fields) < 6 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// right side\n\t\tip := fields[4]\n\t\tif strings.Contains(ip, \":\") {\n\t\t\tip = strings.Split(ip, \":\")[0]\n\t\t}\n\t\tret[ip] = true\n\n\t\t// left side\n\t\tip = fields[2]\n\t\tif strings.Contains(ip, \":\") {\n\t\t\tip = strings.Split(ip, \":\")[0]\n\t\t}\n\t\tret[ip] = true\n\n\t}\n\n\tlog.Tracef(\"Found IPs in state table: %v\", len(ret))\n\treturn ret, nil\n}", "title": "" }, { "docid": "ec2e778137179d9160f9cd1aceeaccdc", "score": "0.48892173", "text": "func SageMakerCreateTransformJob_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateTransformJob\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "43c34a230e8e57434ea2e97535a2f8bd", "score": "0.4883372", "text": "func (tnb *thennable) End() ([]interface{}, error) {\n\tend := make([]interface{}, 0)\n\tfor _, state := range tnb.state {\n\t\tend = append(end, state.Interface())\n\t}\n\treturn end, tnb.throw\n}", "title": "" }, { "docid": "61f988144cc111a7ad48711270d2d845", "score": "0.48464918", "text": "func StepFunctionsInvokeActivity_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.StepFunctionsInvokeActivity\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e17c3eae9cd65f5a20b304e000c80c4b", "score": "0.48458725", "text": "func GlueStartJobRun_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.GlueStartJobRun\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "495411a1402726c2f9feefa9e336d52d", "score": "0.48259956", "text": "func (f *FSM) AvailableTransitions() []string {\n\tf.stateMu.RLock()\n\tdefer f.stateMu.RUnlock()\n\tvar transitions []string\n\tfor key := range f.transitions {\n\t\tif key.src == f.current {\n\t\t\ttransitions = append(transitions, key.event)\n\t\t}\n\t}\n\treturn transitions\n}", "title": "" }, { "docid": "60325e5de8514c68f2ef17bdd7e101a3", "score": "0.4806661", "text": "func SageMakerCreateModel_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SageMakerCreateModel\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4c2ba792c64b3f0d61fac6ba30e246d5", "score": "0.4804393", "text": "func solve(ctx context.Context, maze Maze, start Point, end Point) (string, error) {\n\tsq := NewStateQueue()\n\tseen := make(map[Point]bool)\n\n\tstartingState := State{start, \"\"}\n\tsq.Add(startingState)\n\tseen[start] = true\n\n\tfor sq.Available() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn \"\", fmt.Errorf(\"Premature cancellation: %s\", ctx.Err())\n\t\tdefault:\n\t\t\tstate := sq.Pop()\n\t\t\tfor dName, d := range directions {\n\t\t\t\tp := Point{state.Position.X + d.X, state.Position.Y + d.Y}\n\n\t\t\t\tnewState := State{p, state.Path + dName}\n\n\t\t\t\tif seen[p] {\n\t\t\t\t\t// Already seen this point\n\t\t\t\t\tcontinue\n\t\t\t\t} else if maze.Values[p] == \"X\" {\n\t\t\t\t\t// This is a wall\n\t\t\t\t\tcontinue\n\t\t\t\t} else if p.X >= maze.XSize || p.X < 0 {\n\t\t\t\t\t// Out of bounds in X\n\t\t\t\t\tcontinue\n\t\t\t\t} else if p.Y >= maze.YSize || p.Y < 0 {\n\t\t\t\t\t// Out of bounds in Y\n\t\t\t\t\tcontinue\n\t\t\t\t} else if p == end {\n\t\t\t\t\t// This is the goal\n\t\t\t\t\treturn newState.Path, nil\n\t\t\t\t} else {\n\t\t\t\t\tsq.Add(newState)\n\t\t\t\t\tseen[p] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"Solution not found\")\n}", "title": "" }, { "docid": "daa81b7422a741f3262ea20bbe835d66", "score": "0.4792749", "text": "func (board *Board) Solve() ([]State, error) {\n\n\tresults := make([]State, 0)\n\n\tfor idx := 0; idx < len(board.States); idx++ {\n\n\t\tcurrentState := board.States[idx]\n\n\t\tboard.VisitedStatesHashes[currentState.Hash] = true\n\n\t\tif currentState.isFinal() {\n\n\t\t\tend := false\n\t\t\tnewState := currentState\n\n\t\t\tuniqueStates := make(map[int]State, 0)\n\n\t\t\tidx2 := 1\n\n\t\t\tfor end == false {\n\n\t\t\t\tif newState.Parent != nil || newState.Step > 0 {\n\t\t\t\t\tuniqueStates[newState.Step] = newState\n\n\t\t\t\t\tidx2++\n\n\t\t\t\t\tif newState.MovePiece.Label == newState.Parent.MovePiece.Label && newState.MoveDirection == newState.Parent.MoveDirection {\n\t\t\t\t\t\tnewState = *newState.Parent\n\t\t\t\t\t}\n\n\t\t\t\t\tnewState = *newState.Parent\n\t\t\t\t} else {\n\t\t\t\t\tend = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar steps []int\n\n\t\t\tfor step := range uniqueStates {\n\t\t\t\tsteps = append(steps, step)\n\t\t\t}\n\n\t\t\tsort.Ints(steps)\n\n\t\t\tfor _, step := range steps {\n\t\t\t\tresults = append(results, uniqueStates[step])\n\t\t\t}\n\n\t\t\treturn results, nil\n\t\t}\n\n\t\tboard.findNewStates(currentState)\n\t}\n\n\treturn results, errors.New(\"Cannot solve\")\n}", "title": "" }, { "docid": "62c1e5bc65b386a8069b3512572e16c4", "score": "0.47729102", "text": "func (n *NFA) GetAllStates() Set {\n\treturn n.states\n}", "title": "" }, { "docid": "641c877cfcf8234c0c1b6739fa951673", "score": "0.47683436", "text": "func AthenaStartQueryExecution_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaStartQueryExecution\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6cf23a966887e47f165569047ec55c50", "score": "0.47645736", "text": "func (ctx *peerPolicyContext) searchAhead(start gdp.Hash, terminals []gdp.Hash) ([]gdp.Hash, []gdp.Hash) {\n\tactualMap := ctx.graph.GetActualPtrMap()\n\tterminalMap := initSet(terminals)\n\n\tvisited := make([]gdp.Hash, 0)\n\tlocalEnds := make([]gdp.Hash, 0)\n\n\tcurrent := start\n\tprev, found := actualMap[current]\n\tfor found {\n\t\tif _, terminate := terminalMap[current]; terminate {\n\t\t\t// early termination because reaching terminal\n\t\t\treturn visited, localEnds\n\t\t}\n\n\t\tcurrent = prev\n\t\tprev, found = actualMap[current]\n\n\t\t// Do not store the last pointer on the map\n\t\tif found {\n\t\t\tvisited = append(visited, current)\n\t\t}\n\t}\n\n\tlocalEnds = append(localEnds, current)\n\treturn visited, localEnds\n}", "title": "" }, { "docid": "af8e30fd16a1da1710cded850a9c44f3", "score": "0.4756575", "text": "func WalkReverse(g *Graph, start []Node, fn WalkFunc) error {\n\tvar (\n\t\tvisited = make(nodeSet)\n\t\tunchecked = make([]Node, 0, len(start))\n\t)\n\n\t// Prefill the set of unchecked nodes with our start set.\n\tunchecked = append(unchecked, start...)\n\n\t// Iterate through unchecked nodes, visiting each in turn and adding incoming\n\t// edges to the unchecked list until all reachable nodes have been processed.\n\tfor len(unchecked) > 0 {\n\t\tcheck := unchecked[len(unchecked)-1]\n\t\tunchecked = unchecked[:len(unchecked)-1]\n\n\t\tif visited.Has(check) {\n\t\t\tcontinue\n\t\t}\n\t\tvisited.Add(check)\n\n\t\tif err := fn(check); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor n := range g.inEdges[check] {\n\t\t\tunchecked = append(unchecked, n)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c4c7d1bd9c1c67efd0ea11861b04d81", "score": "0.47423914", "text": "func PathSearch(start *Node, isEnd func(*Node) bool) []*Edge {\n\tstack := make([]*Edge, 0, 32)\n\tseen := make(map[*Node]bool)\n\tvar search func(n *Node) []*Edge\n\tsearch = func(n *Node) []*Edge {\n\t\tif !seen[n] {\n\t\t\tseen[n] = true\n\t\t\tif isEnd(n) {\n\t\t\t\treturn stack\n\t\t\t}\n\t\t\tfor _, e := range n.Out {\n\t\t\t\tstack = append(stack, e) // push\n\t\t\t\tif found := search(e.Callee); found != nil {\n\t\t\t\t\treturn found\n\t\t\t\t}\n\t\t\t\tstack = stack[:len(stack)-1] // pop\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn search(start)\n}", "title": "" }, { "docid": "69ad8994ee446b768f60da01f4e6836e", "score": "0.47321942", "text": "func CallApiGatewayRestApiEndpoint_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.CallApiGatewayRestApiEndpoint\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "564cf571364200c782c9ccbfd58a058d", "score": "0.47209623", "text": "func (d DRuleBook) GetFromState(from string) [][2]string {\n\ttran := make([][2]string, 0, 16)\n\tif transitons, ok := d[from]; ok != false {\n\t\tfor with, to := range transitons {\n\t\t\ttran = append(tran, [2]string{with, to})\n\t\t}\n\t}\n\treturn tran\n}", "title": "" }, { "docid": "89eca269d1c2be684024be36700d7e7d", "score": "0.4712505", "text": "func Solve(start search.State, goal [][]int) (*search.State, int) {\n\tvar frontier, expanded int\n\tstates := make(map[string]search.State)\n\tpq := make(priorityQueue.PriorityQueue, 0)\n\tkey := utils.BoardStringer(start.Board)\n\tstates[key] = start\n\theap.Push(&pq, &priorityQueue.Item{Value: key, Priority: 0, Index: 0})\n\n\tfor pq.Len() != 0 {\n\n\t\tcurrentItem := heap.Pop(&pq).(*priorityQueue.Item)\n\t\tcurrent := states[currentItem.Value]\n\t\texpanded++\n\n\t\tif current.IsGoal(goal) {\n\t\t\treturn &current, expanded\n\t\t}\n\t\tfor _, next := range current.PossibleMoves(goal) {\n\t\t\tkey := utils.BoardStringer(next.Board)\n\t\t\tif old, exists := states[key]; !exists || next.Distance < old.Distance {\n\t\t\t\tstates[key] = next\n\t\t\t\theap.Push(&pq, &priorityQueue.Item{Value: key, Priority: next.Distance + next.NumMoves, Index: 0})\n\t\t\t\tfrontier++\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, expanded\n}", "title": "" }, { "docid": "ee6115171d45e4353463052479d27f2f", "score": "0.47044066", "text": "func (tx *TXRWSet) GetChainCodeStateByRange(chaincodeAddr string, startKey string, endKey string, committed bool) (map[string][]byte, error) {\n\ttx.chainCodeRW.RLock()\n\tdefer tx.chainCodeRW.RUnlock()\n\tchaincodePrefix := ConstructCompositeKey(chaincodeAddr, \"\")\n\tckeyStart := ConstructCompositeKey(chaincodeAddr, startKey)\n\tckeyEnd := ConstructCompositeKey(chaincodeAddr, endKey)\n\tret, err := tx.block.GetChainCodeStateByRange(chaincodeAddr, startKey, endKey, committed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !committed {\n\t\tcache := treap.NewImmutable()\n\t\tfor ckey, kvr := range tx.chainCodeSet.Reads {\n\t\t\tif strings.HasPrefix(ckey, chaincodePrefix) {\n\t\t\t\tcache.Put([]byte(ckey), kvr.Value)\n\t\t\t}\n\t\t}\n\t\tfor ckey, kvw := range tx.chainCodeSet.Writes {\n\t\t\tif strings.HasPrefix(ckey, chaincodePrefix) {\n\t\t\t\tcache.Put([]byte(ckey), kvw.Value)\n\t\t\t}\n\t\t}\n\n\t\tif len(endKey) > 0 {\n\t\t\tfor iter := cache.Iterator([]byte(ckeyStart), []byte(ckeyEnd)); iter.Next(); {\n\t\t\t\tif val := iter.Value(); val != nil {\n\t\t\t\t\tret[string(iter.Key())] = val\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor iter := cache.Iterator([]byte(startKey), nil); iter.Next(); {\n\t\t\t\tif !bytes.HasPrefix(iter.Key(), []byte(startKey)) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif val := iter.Value(); val != nil {\n\t\t\t\t\tret[string(iter.Key())] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "f3e7cd0b0e67eae5b8e97f31a13ea6cf", "score": "0.4701554", "text": "func (ctx *peerPolicyContext) compareBeginsEnds(\n\tpeerBegins,\n\tpeerEnds []gdp.Hash,\n) ([]gdp.Hash, []gdp.Hash, []gdp.Hash, []gdp.Hash) {\n\tlocalBegins := ctx.graph.GetLogicalBegins()\n\tlocalEnds := ctx.graph.GetLogicalEnds()\n\tlocalBeginsRet, peerBeginsRet := findDifferences(localBegins, peerBegins)\n\tlocalEndsRet, peerEndsRet := findDifferences(localEnds, peerEnds)\n\treturn localBeginsRet, localEndsRet, peerBeginsRet, peerEndsRet\n}", "title": "" }, { "docid": "1c2f5c0567ca2aa036cbbc950c0093fe", "score": "0.47001183", "text": "func (m *Migrataur) getAllMigrationsForRange(start, end string, direction dir) ([]*Migration, error) {\n\tif start == \"\" {\n\t\treturn []*Migration{}, nil\n\t}\n\n\tmigrations, err := m.getAllMigrations(direction)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidxStart, idxEnd := -1, -1\n\n\tfor i, mig := range migrations {\n\t\tif idxStart == -1 {\n\t\t\tif strings.Contains(mig.Name, start) {\n\t\t\t\tidxStart = i\n\n\t\t\t\t// Break early if no end migration has been set or if the end is the same\n\t\t\t\tif end == \"\" || start == end {\n\t\t\t\t\tidxEnd = idxStart + 1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// If we reach the end, break\n\t\t\tif strings.Contains(mig.Name, end) {\n\t\t\t\tidxEnd = i + 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif idxStart == -1 {\n\t\terr := fmt.Errorf(\"\\tCould not find the lower bound %s\", start)\n\t\tm.Printf(err.Error())\n\t\treturn nil, err\n\t}\n\n\tif idxEnd == -1 {\n\t\terr := fmt.Errorf(\"\\tCould not find the upper bound %s\", end)\n\t\tm.Printf(err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn migrations[idxStart:idxEnd], nil\n}", "title": "" }, { "docid": "bb6436bb0f4996086233d1516a3ec4ba", "score": "0.46940234", "text": "func AthenaGetQueryExecution_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.AthenaGetQueryExecution\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e8e16667665f8f0cc16050563b49704a", "score": "0.46851686", "text": "func bfs() {\n\ttype state [3]int\n\ttype key [2]int\n\tinitState := state{0, 0, 0}\n\tvalid := func(s state) bool {\n\t\treturn s[0]+s[1] < 5 && s[0]-s[1] < 5 && -s[0]+s[1] < 5 && -s[0]-s[1] < 5\n\t}\n\tkeyOf := func(s state) key {\n\t\treturn key{s[0], s[1]}\n\t}\n\tisEnd := func(s state) bool {\n\t\treturn false\n\t}\n\tonState := func(s state) {\n\t\t// do something for each state\n\t}\n\tnext := func(s state, f func(state)) {\n\t\tf(state{s[0] + 1, s[1], s[2] + 1})\n\t\tf(state{s[0], s[1] + 1, s[2] + 1})\n\t\tf(state{s[0] - 1, s[1], s[2] + 1})\n\t\tf(state{s[0], s[1] - 1, s[2] + 1})\n\t}\n\n\tqueue := []state{initState}\n\tseen := map[key]bool{}\n\tvar res state\n\tvar found bool\n\tfor len(queue) > 0 {\n\t\ts := queue[0]\n\t\tqueue = queue[1:]\n\t\tk := keyOf(s)\n\t\tif seen[k] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[k] = true\n\n\t\tonState(s)\n\t\tif isEnd(s) {\n\t\t\tres = s\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\n\t\tnext(s, func(n state) {\n\t\t\tif !valid(n) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tqueue = append(queue, n)\n\t\t})\n\t}\n\n\t_, _ = res, found\n}", "title": "" }, { "docid": "5cee8cd2ef8ef92787b54bad6591c877", "score": "0.46334898", "text": "func getMigrationsToReverse(name string, state []MigrationRecord, allMigrations []Migration) ([]Migration, error) {\n\t// get name of most recent migration\n\tlatest := state[len(state)-1].Name\n\t// trim allMigrations to ignore anything newer than latest in state.\n\treversableMigrations, err := trimMigrationsTail(latest, allMigrations)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// reversableMigrations and state should now be the same length\n\tif le, lh := len(reversableMigrations), len(state); le != lh {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"state in DB has %d migrations, but we have source for %d migrations up to and including %s\",\n\t\t\tlh, le, latest,\n\t\t)\n\t}\n\t// loop backward over state and allmigrations, asserting that names match,\n\t// and building list of migrations that need running, until we get to the name\n\t// we're looking for.\n\t// If we fall off the end, error.\n\ttoRun := []Migration{}\n\tfor i := len(state) - 1; i >= 0; i-- {\n\t\tif state[i].Name != reversableMigrations[i].Name {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"migration %d from state (%s) does not match name from static list (%s)\",\n\t\t\t\ti+1, state[i].Name, reversableMigrations[i].Name,\n\t\t\t)\n\t\t}\n\t\ttoRun = append(toRun, reversableMigrations[i])\n\t\tif state[i].Name == name {\n\t\t\treturn toRun, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"migration %s not in state\", name)\n}", "title": "" }, { "docid": "d6b03c8be1e4b64991c22d0b74e0e7b9", "score": "0.46205375", "text": "func (d *goodDisease) updateStates() {\n\tinfectedNodes := d.FindNodesInState(StateI)\n\trecoveredNodes := d.FindNodesInState(StateR)\n\tfor node := range infectedNodes {\n\t\tif d.TimeInState(node) == d.timeToR {\n\t\t\td.SetState(node, StateR)\n\t\t}\n\t}\n\tfor node := range recoveredNodes {\n\t\tif d.TimeInState(node) == d.timeToS {\n\t\t\td.SetState(node, StateS)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8199dc3bb6824cda23963835b09927e6", "score": "0.46107057", "text": "func SqsSendMessage_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.SqsSendMessage\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0a69d17ed491249785d08977a92b012e", "score": "0.4607227", "text": "func WalkTopological(g *Graph, start []Node, fn WalkFunc) error {\n\t// NOTE(rfratto): WalkTopological is an implementation of Kahn's algorithm\n\t// which leaves g unmodified.\n\n\tvar (\n\t\tvisited = make(nodeSet)\n\t\tunchecked = make([]Node, 0, len(start))\n\n\t\tremainingDeps = make(map[Node]int)\n\t)\n\n\t// Pre-fill the set of nodes to check from the start list.\n\tunchecked = append(unchecked, start...)\n\n\tfor len(unchecked) > 0 {\n\t\tcheck := unchecked[len(unchecked)-1]\n\t\tunchecked = unchecked[:len(unchecked)-1]\n\n\t\tif visited.Has(check) {\n\t\t\tcontinue\n\t\t}\n\t\tvisited.Add(check)\n\n\t\tif err := fn(check); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Iterate through the incoming edges to check and queue nodes if we're the\n\t\t// last edge to be walked.\n\t\tfor n := range g.inEdges[check] {\n\t\t\t// remainingDeps starts with the number of edges, and we subtract one for\n\t\t\t// each outgoing edge that's visited.\n\t\t\tif _, ok := remainingDeps[n]; !ok {\n\t\t\t\tremainingDeps[n] = len(g.outEdges[n])\n\t\t\t}\n\t\t\tremainingDeps[n]--\n\n\t\t\t// Only enqueue the incoming edge once all of its outgoing edges have\n\t\t\t// been consumed. This prevents it from being visited before its\n\t\t\t// dependencies.\n\t\t\tif remainingDeps[n] == 0 {\n\t\t\t\tunchecked = append(unchecked, n)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8227a6d9160b85522440b16718a61f83", "score": "0.46065024", "text": "func DynamoUpdateItem_FindReachableStates(start awsstepfunctions.State, options *awsstepfunctions.FindStateOptions) *[]awsstepfunctions.State {\n\t_init_.Initialize()\n\n\tvar returns *[]awsstepfunctions.State\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_stepfunctions_tasks.DynamoUpdateItem\",\n\t\t\"findReachableStates\",\n\t\t[]interface{}{start, options},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0d4dbffb48cc6896343381a29232debd", "score": "0.4605488", "text": "func (t *STree) canonize(s *state, start, end Pos) (*state, Pos) {\n\tif s == t.auxState {\n\t\ts, start = t.root, start+1\n\t}\n\tif start > end {\n\t\treturn s, start\n\t}\n\n\tvar tr *tran\n\tfor {\n\t\tif start <= end {\n\t\t\ttr = s.findTran(t.data[start])\n\t\t\tif tr == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"there should be some transition for '%d' at %d\",\n\t\t\t\t\tt.data[start].Val(), start))\n\t\t\t}\n\t\t}\n\t\tif tr.end-tr.start > end-start {\n\t\t\tbreak\n\t\t}\n\t\tstart += tr.end - tr.start + 1\n\t\ts = tr.state\n\t}\n\tif s == nil {\n\t\tpanic(\"there should always be some suffix link resolution\")\n\t}\n\treturn s, start\n}", "title": "" }, { "docid": "3b482025d1a3e300ed60ceb3ae8f87ca", "score": "0.46040776", "text": "func (original_nfa *NFA) ToDFA() dfa.DFA {\n\tnfa := Copy(*original_nfa)\n\tn := &nfa\n\t// first follow along λ-transitions to make them obsolete\n\tis_final := make([]bool, n.NumStates+1)\n\tfor _, node := range n.FinalStates {\n\t\tis_final[node] = true\n\t}\n\tfor i := 1; i <= n.NumStates; i++ {\n\t\tq := queue.New(n.NumStates)\n\t\tadded := make([]bool, n.NumStates+1)\n\t\tfor _, node := range n.Graph[i]['λ'] {\n\t\t\tq.Push(node)\n\t\t}\n\t\tfor !q.Empty() {\n\t\t\tnode, _ := q.Pop()\n\t\t\tif is_final[node] && !is_final[i] {\n\t\t\t\tis_final[i] = true\n\t\t\t\tn.FinalStates = append(n.FinalStates, i)\n\t\t\t}\n\t\t\tfor character, neighbours := range n.Graph[node] {\n\t\t\t\tfor _, neighbour := range neighbours {\n\t\t\t\t\tif character == 'λ' && !added[neighbour] {\n\t\t\t\t\t\tq.Push(neighbour)\n\t\t\t\t\t\tadded[neighbour] = true\n\t\t\t\t\t}\n\t\t\t\t\tn.Graph[i][character] = append(n.Graph[i][character], neighbour)\n\t\t\t\t\tn.NumTransitions++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// then remove λ-transitions\n\tfor i := 1; i <= n.NumStates; i++ {\n\t\t_, ok := n.Graph[i]['λ']\n\t\tif ok {\n\t\t\tn.NumTransitions -= len(n.Graph[i]['λ'])\n\t\t\tdelete(n.Graph[i], 'λ')\n\t\t}\n\t}\n\n\t// then turn that into a DFA\n\tvisited := make([]bool, 1<<uint(n.NumStates+1))\n\tdfa := make(map[int]map[rune]int)\n\tq := queue.New(1 << uint(n.NumStates))\n\tq.Push(1 << uint(n.EntryState-1))\n\tfinal_states := make([]int, 0)\n\tfor !q.Empty() {\n\t\tnode_code, _ := q.Pop()\n\t\tis_final_node := false\n\t\tfor node := 1; node < (1 << uint(n.NumStates)); node++ {\n\t\t\tif 1<<uint(node-1) > node_code {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ((1 << uint(node-1)) & node_code) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif is_final[node] {\n\t\t\t\tis_final_node = true\n\t\t\t}\n\t\t\tif _, ok := dfa[node_code]; !ok {\n\t\t\t\tdfa[node_code] = make(map[rune]int)\n\t\t\t}\n\t\t\tfor character, neighbours := range n.Graph[node] {\n\t\t\t\tfor _, neighbour := range neighbours {\n\t\t\t\t\tdfa[node_code][character] = dfa[node_code][character] | (1 << uint(neighbour-1))\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, neighbour := range dfa[node_code] {\n\t\t\t\tif !visited[neighbour] {\n\t\t\t\t\tq.Push(neighbour)\n\t\t\t\t\tvisited[neighbour] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif is_final_node {\n\t\t\tfinal_states = append(final_states, node_code)\n\t\t}\n\t}\n\n\t// encode the newly created DFA into our standard form\n\tfor node, _ := range n.Graph {\n\t\tdelete(n.Graph, node)\n\t}\n\tnr := n.NumStates\n\tn.NumStates = 0\n\tn.NumTransitions = 0\n\tn.EntryState = 1 << uint(n.EntryState-1)\n\n\tmapping := make(map[int]int)\n\tcurrent_node := 0\n\tfor i := 1; i < (1 << uint(nr)); i++ {\n\t\tif _, ok := dfa[i]; !ok || len(dfa[i]) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := mapping[i]; !ok {\n\t\t\tcurrent_node++\n\t\t\tmapping[i] = current_node\n\t\t}\n\t\tn.Graph[mapping[i]] = make(map[rune][]int)\n\t\tn.NumTransitions += len(dfa[i])\n\t\tfor character, node := range dfa[i] {\n\t\t\tif _, ok := mapping[node]; !ok {\n\t\t\t\tcurrent_node++\n\t\t\t\tmapping[node] = current_node\n\t\t\t}\n\t\t\tn.Graph[mapping[i]][character] = []int{mapping[node]}\n\t\t}\n\t}\n\tif _, ok := mapping[n.EntryState]; ok {\n\t\tn.EntryState = mapping[n.EntryState]\n\t} else {\n\t\tcurrent_node++\n\t\tmapping[n.EntryState] = current_node\n\t\tn.EntryState = current_node\n\t}\n\tn.NumStates = current_node\n\tn.FinalStates = make([]int, 0)\n\n\tfor _, node := range final_states {\n\t\tif _, ok := mapping[node]; ok {\n\t\t\tn.FinalStates = append(n.FinalStates, mapping[node])\n\t\t}\n\t}\n\n\treturn n.DFA\n}", "title": "" } ]
1e24da3973cd5868b7334fb603cb52b5
WaitForControlRelation waits to create control relation for a given target
[ { "docid": "ba5341d3578046c8d1043260601c5ec4", "score": "0.71530765", "text": "func WaitForControlRelation(ctx context.Context, t *testing.T, predicate func(*topo.Relation, topo.Event) bool, timeout time.Duration) bool {\n\tcl, err := NewTopoClient()\n\tassert.NoError(t, err)\n\tstream := make(chan topo.Event)\n\terr = cl.Watch(ctx, stream, toposdk.WithWatchFilters(getControlRelationFilter()))\n\tassert.NoError(t, err)\n\tfor event := range stream {\n\t\tif predicate(event.Object.GetRelation(), event) {\n\t\t\treturn true\n\t\t} // Otherwise, loop and wait for the next topo event\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "a05320e1f9edc0b489869d43e2a44403", "score": "0.68583226", "text": "func (s *Suite) WaitForControlRelation(predicate func(*topo.Relation, topo.Event) bool) bool {\n\tcl, err := s.NewTopoClient()\n\ts.NoError(err)\n\tstream := make(chan topo.Event)\n\terr = cl.Watch(s.Context(), stream, toposdk.WithWatchFilters(s.getControlRelationFilter()))\n\ts.NoError(err)\n\tfor event := range stream {\n\t\tif predicate(event.Object.GetRelation(), event) {\n\t\t\treturn true\n\t\t} // Otherwise, loop and wait for the next topo event\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ec42dde5c66c9c6bab71c3fa5dc6663d", "score": "0.5902217", "text": "func WaitForTargetAvailable(ctx context.Context, t *testing.T, objectID topo.ID, timeout time.Duration) bool {\n\treturn WaitForControlRelation(ctx, t, func(rel *topo.Relation, event topo.Event) bool {\n\t\tif rel.TgtEntityID != objectID {\n\t\t\tt.Logf(\"Topo %v event from %s (expected %s). Discarding\\n\", event.Type, rel.TgtEntityID, objectID)\n\t\t\treturn false\n\t\t}\n\n\t\tif event.Type == topo.EventType_ADDED || event.Type == topo.EventType_UPDATED || event.Type == topo.EventType_NONE {\n\t\t\tcl, err := NewTopoClient()\n\t\t\tassert.NoError(t, err)\n\t\t\t_, err = cl.Get(ctx, event.Object.ID)\n\t\t\tif err == nil {\n\t\t\t\tt.Logf(\"Target %s is available\", objectID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}, timeout)\n}", "title": "" }, { "docid": "3776f3b70b1f5b49c9fd85f73ba52aae", "score": "0.54384416", "text": "func WaitFor(k8sClient client.Client, createdResource mdbv1.AtlasCustomResource, expectedCondition status.Condition, check ...func(mdbv1.AtlasCustomResource)) func() bool {\n\treturn func() bool {\n\t\tif ok := ReadAtlasResource(k8sClient, createdResource); !ok {\n\t\t\treturn false\n\t\t}\n\t\t// Atlas Operator hasn't started working yet\n\t\tif createdResource.GetGeneration() != createdResource.GetStatus().GetObservedGeneration() {\n\t\t\treturn false\n\t\t}\n\n\t\tmatch, err := gomega.ContainElement(MatchCondition(expectedCondition)).Match(createdResource.GetStatus().GetConditions())\n\t\tif err != nil || !match {\n\t\t\tif len(check) > 0 {\n\t\t\t\tfor _, f := range check {\n\t\t\t\t\tf(createdResource)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "c1f9a1f2c527adb7975d0673f958ee7a", "score": "0.5385892", "text": "func WaitForTargetUnavailable(ctx context.Context, t *testing.T, objectID topo.ID, timeout time.Duration) bool {\n\treturn WaitForControlRelation(ctx, t, func(rel *topo.Relation, event topo.Event) bool {\n\t\tif rel.TgtEntityID != objectID {\n\t\t\tt.Logf(\"Topo %v event from %s (expected %s). Discarding\\n\", event, rel.TgtEntityID, objectID)\n\t\t\treturn false\n\t\t}\n\n\t\tif event.Type == topo.EventType_REMOVED || event.Type == topo.EventType_NONE {\n\t\t\tcl, err := NewTopoClient()\n\t\t\tassert.NoError(t, err)\n\t\t\t_, err = cl.Get(ctx, event.Object.ID)\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Target %s is unavailable\", objectID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}, timeout)\n}", "title": "" }, { "docid": "d7b8414730019a8bd676a023769ff2bb", "score": "0.52671856", "text": "func (s *Suite) WaitForTargetAvailable(objectID topo.ID) bool {\n\treturn s.WaitForControlRelation(func(rel *topo.Relation, event topo.Event) bool {\n\t\tif rel.TgtEntityID != objectID {\n\t\t\ts.T().Logf(\"Topo %v event from %s (expected %s). Discarding\\n\", event.Type, rel.TgtEntityID, objectID)\n\t\t\treturn false\n\t\t}\n\n\t\tif event.Type == topo.EventType_ADDED || event.Type == topo.EventType_UPDATED || event.Type == topo.EventType_NONE {\n\t\t\tcl, err := s.NewTopoClient()\n\t\t\ts.NoError(err)\n\t\t\t_, err = cl.Get(s.Context(), event.Object.ID)\n\t\t\tif err == nil {\n\t\t\t\ts.T().Logf(\"Target %s is available\", objectID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "71cea4b0121a8a90ae90b231c69acba6", "score": "0.515666", "text": "func waitForConnection(connectionId *string, targetState databasetools.LifecycleStateEnum, cfg config) error {\n\tclient := cfg.DBToolsClient\n\tfor {\n\t\tconnection, err := client.GetDatabaseToolsConnection(cfg.Ctx,\n\t\t\tdatabasetools.GetDatabaseToolsConnectionRequest{\n\t\t\t\tDatabaseToolsConnectionId: connectionId,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"waitForConnection: lifecycle state = %v\\n\", connection.GetLifecycleState())\n\n\t\tif connection.GetLifecycleState() == targetState {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(10 * time.Second)\n\t}\n}", "title": "" }, { "docid": "3a74282fcbf4dcfc8186bcaa7ee28228", "score": "0.51161987", "text": "func (network *P2p) Wait() {}", "title": "" }, { "docid": "460092e3bdec0e75986270a4729f3ccf", "score": "0.5101274", "text": "func (graph *BuildGraph) WaitForTarget(label BuildLabel) *BuildTarget {\n\tt, tch := graph.targets.Get(label)\n\tif t != nil {\n\t\treturn t\n\t}\n\tp, pch := graph.packages.Get(packageKey{Name: label.PackageName, Subrepo: label.Subrepo})\n\tif p != nil {\n\t\t// Check target again to avoid race conditions\n\t\treturn graph.Target(label)\n\t}\n\t// Now we need to wait for either (hopefully) the target or its package to exist.\n\t// Either the target will, which is fine, or if the package appears but the target doesn't\n\t// we will conclude it doesn't exist.\n\tselect {\n\tcase <-tch:\n\tcase <-pch:\n\t}\n\treturn graph.Target(label)\n}", "title": "" }, { "docid": "469eaac59eb800866e0719e0f44076e2", "score": "0.50608534", "text": "func WaitConditionToBe(ctx context.Context, c clientset.Interface, name string, conditionType v1.NodeConditionType, wantTrue bool, timeout time.Duration) bool {\n\tframework.Logf(\"Waiting up to %v for node %s condition %s to be %t\", timeout, name, conditionType, wantTrue)\n\tfor start := time.Now(); time.Since(start) < timeout; time.Sleep(poll) {\n\t\tnode, err := c.CoreV1().Nodes().Get(ctx, name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"Couldn't get node %s\", name)\n\t\t\tcontinue\n\t\t}\n\n\t\tif IsConditionSetAsExpected(node, conditionType, wantTrue) {\n\t\t\treturn true\n\t\t}\n\t}\n\tframework.Logf(\"Node %s didn't reach desired %s condition status (%t) within %v\", name, conditionType, wantTrue, timeout)\n\treturn false\n}", "title": "" }, { "docid": "ae07f35ddee44edaeea4f4b8bdfa660c", "score": "0.50016284", "text": "func (c *Route53RecoveryControlConfig) WaitUntilRoutingControlCreated(input *DescribeRoutingControlInput) error {\n\treturn c.WaitUntilRoutingControlCreatedWithContext(aws.BackgroundContext(), input)\n}", "title": "" }, { "docid": "e20c30e9f44c5e0596698f483dd86073", "score": "0.4952315", "text": "func (s *Suite) WaitForTargetUnavailable(objectID topo.ID) bool {\n\treturn s.WaitForControlRelation(func(rel *topo.Relation, event topo.Event) bool {\n\t\tif rel.TgtEntityID != objectID {\n\t\t\ts.T().Logf(\"Topo %v event from %s (expected %s). Discarding\\n\", event, rel.TgtEntityID, objectID)\n\t\t\treturn false\n\t\t}\n\n\t\tif event.Type == topo.EventType_REMOVED || event.Type == topo.EventType_NONE {\n\t\t\tcl, err := s.NewTopoClient()\n\t\t\ts.NoError(err)\n\t\t\t_, err = cl.Get(s.Context(), event.Object.ID)\n\t\t\tif errors.IsNotFound(err) {\n\t\t\t\ts.T().Logf(\"Target %s is unavailable\", objectID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "50d7796ba883238c817ce551f9a009c8", "score": "0.4918565", "text": "func (clt *PubSubClient) AwaitCounterTargetReached() {\n\tclt.targetReached.Wait()\n}", "title": "" }, { "docid": "d04d49b487cbe6223500607a85cc6206", "score": "0.49035183", "text": "func waitForCP(restConfig *rest.Config, clustername string) (bool, error) {\n\tlog.Info(\"Waiting for the Control Plane to appear\")\n\t// Set the vars we need\n\tcpname := clustername + \"-control-plane\"\n\tvar expectedCPReplicas int32 = 3\n\n\t// We need to load the scheme since it's not part of the core API\n\tscheme := runtime.NewScheme()\n\t_ = kcpv1.AddToScheme(scheme)\n\n\tc, err := client.New(restConfig, client.Options{\n\t\tScheme: scheme,\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// wait up until 20 minutes\n\tcounter := 0\n\tfor runs := 20; counter <= runs; counter++ {\n\t\tif counter > runs {\n\t\t\treturn false, errors.New(\"control-plane did not come up after 10 minutes\")\n\t\t}\n\t\t// get the current status, wait for 3 CP nodes\n\t\tkcp := &kcpv1.KubeadmControlPlane{}\n\t\tif err := c.Get(context.TODO(), client.ObjectKey{Namespace: \"default\", Name: cpname}, kcp); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif kcp.Status.Replicas == expectedCPReplicas {\n\t\t\tbreak\n\t\t}\n\n\t\ttime.Sleep(time.Minute)\n\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "1ddf9b1b818dedce458a32c0a287a19d", "score": "0.48400334", "text": "func awaitableCreate(m K8sModel) (err error) {\n\t// Here use DCL to prevent multiple thread from calling `wg.Done`.\n\tisDone := false\n\tlock := sync.Mutex{}\n\twg := sync.WaitGroup{}\n\n\twg.Add(1)\n\tdone := func() {\n\t\t// check if `wg.Done` is called.\n\t\t// this line is not necessary, but can improve checking efficiency.\n\t\tif !isDone {\n\t\t\t// ensure that only one thread executes in the following areas.\n\t\t\tlock.Lock()\n\t\t\t// check if multiple threads that pass the first check at the same time have executed `wg.Done`.\n\t\t\tif !isDone {\n\t\t\t\twg.Done()\n\t\t\t\tisDone = true\n\t\t\t}\n\t\t\tlock.Unlock()\n\t\t}\n\t}\n\n\tcb := list.New()\n\tcb.PushBack(func(old apiv1.PodPhase, new apiv1.PodPhase) bool {\n\t\tif new == apiv1.PodRunning {\n\t\t\tdone()\n\t\t\treturn true\n\t\t} else if new == apiv1.PodFailed || new == apiv1.PodUnknown {\n\t\t\terr = fmt.Errorf(\"error occurred when %s creating\", m.GetName())\n\t\t\tdone()\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\twatch(m, &callback{ onPodPhaseUpdateOnce: cb })\n\n\tm.Create()\n\twg.Wait()\n\n\treturn err\n}", "title": "" }, { "docid": "8d00956269ca38a361291ac2afa558f6", "score": "0.4818288", "text": "func poolWaitForExists(virConn *libvirt.Libvirt, uuid string) error {\n\tlog.Printf(\"Waiting for pool %s to be active...\", uuid)\n\tstateConf := &resource.StateChangeConf{\n\t\tPending: []string{poolNotExistsID},\n\t\tTarget: []string{poolExistsID},\n\t\tRefresh: poolExists(virConn, uuid),\n\t\tTimeout: 1 * time.Minute,\n\t\tDelay: 5 * time.Second,\n\t\tMinTimeout: 3 * time.Second,\n\t}\n\n\tif _, err := stateConf.WaitForState(); err != nil {\n\t\tlog.Printf(\"%s\", err)\n\t\treturn fmt.Errorf(\"unexpected error during pool creation operation. The operation did not complete successfully\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e4828624498669ef8a34ff18473e5e6", "score": "0.48097077", "text": "func (cf *AWSCloudFormationAPI) WaitUntilChangeSetCreateComplete(input *cloudformation.DescribeChangeSetInput) error {\n\treturn cf.api.WaitUntilChangeSetCreateComplete(input)\n}", "title": "" }, { "docid": "b729bc083cc6bf75b7c37e3b3c2842a4", "score": "0.48051116", "text": "func waitUntilVaultPolicyBindingIsReady(c policycs.PolicyV1alpha1Interface, vpb *policyapi.VaultPolicyBinding, stopCh <-chan struct{}) error {\n\tvar err error\n\tattempt := 0\n\terr = wait.PollUntil(2*time.Second, func() (done bool, err error) {\n\t\tattempt++\n\t\tvar err2 error\n\t\tvpb, err2 = c.VaultPolicyBindings(vpb.Namespace).Get(context.TODO(), vpb.Name, metav1.GetOptions{})\n\t\tif err2 != nil {\n\t\t\treturn false, err2\n\t\t}\n\n\t\tif vpb.Status.Phase == policyapi.PolicyBindingSuccess {\n\t\t\treturn true, nil\n\t\t}\n\n\t\tglog.Infof(\"auth method controller: attempt %d: VaultPolicyBinding %s/%s is not succeeded\", attempt, vpb.Namespace, vpb.Name)\n\t\treturn false, nil\n\t}, stopCh)\n\treturn err\n}", "title": "" }, { "docid": "61c8bfeac970c2d4128d1128130d36bf", "score": "0.4782571", "text": "func TestWait(t *testing.T) {\n\n\tvar err error\n\n\tcreate := func() (interface{}, error) {\n\t\treturn resourceNew()\n\t}\n\n\tdestroy := func(r interface{}) {\n\t\tdb := r.(*resource_symulator)\n\t\tdb.resourceDel()\n\t}\n\n\ttest := func(r interface{}) error {\n\t\treturn nil\n\t}\n\n\tp, _ := NewPool(2, 5, create, destroy, test, nil)\n\tdefer p.Close()\n\n\t_, err = p.Get()\n\t_, err = p.Get()\n\t_, err = p.Get()\n\t_, err = p.Get()\n\tmsg, err := p.Get()\n\n\tcalled := false\n\tgo func() {\n\t\tmsg.Close()\n\t\tcalled = true\n\t}()\n\n\t//this waits till msg.Close() is called in the go thread\n\tmsg, err = p.Get()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif !called {\n\t\tt.Fatal(\"Expected close of resource to block execution\")\n\t}\n\n}", "title": "" }, { "docid": "9ab3f2d3d637f7b4fb8c389d2d1cd590", "score": "0.47664404", "text": "func (t *Target) Wait() (err error) {\n\tt.start = time.Now()\n\n\tdefer func() {\n\t\tt.elapsed = time.Now().Sub(t.start)\n\t}()\n\n\terr = t.init()\n\tif err != nil {\n\t\treturn\n\t}\n\n\terrCh := make(chan error)\n\tsuccessCh := make(chan bool)\n\n\trun := func() {\n\t\terr = t.waiter.connect()\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\n\t\terr = t.waiter.runTest()\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\tsuccessCh <- true\n\t}\n\n\tfor {\n\t\tstart := time.Now()\n\t\tgo run()\n\n\t\tselect {\n\t\tcase err = <-errCh:\n\t\t\tlog.Warn(err)\n\t\t\tcerr := t.waiter.cancel()\n\t\t\tif cerr != nil {\n\t\t\t\tlog.Fatal(cerr)\n\t\t\t}\n\t\t\tbreak\n\t\tcase <-successCh:\n\t\t\treturn nil\n\t\tcase <-time.After(t.Timeout):\n\t\t\tcerr := t.waiter.cancel()\n\t\t\tif cerr != nil {\n\t\t\t\tlog.Fatal(cerr)\n\t\t\t} else {\n\t\t\t\terr = ErrTimeout\n\t\t\t}\n\t\t}\n\n\t\tt.Retries--\n\n\t\tif t.Retries < 0 {\n\t\t\tlog.Errorf(\"Last error: %v\", err)\n\t\t\treturn ErrMaxRetries\n\t\t}\n\n\t\ttime.Sleep(t.RetryDelay - time.Now().Sub(start))\n\t}\n}", "title": "" }, { "docid": "af65567efdb6836417f0dfcc9f88e1c5", "score": "0.47612315", "text": "func WaitCreate(rc *RoutesClient, tableid string, route *ecs.CreateRouteEntryArgs) error {\n\terr := rc.client.CreateRouteEntry(route)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"WaitCreate: ceate route for table %s error, %s\", tableid, err.Error())\n\t}\n\treturn WaitForRouteEntryAvailable(rc.client, rc.vpc.vrouterid, tableid)\n}", "title": "" }, { "docid": "807297f48693be10ecdc878a5c14c69e", "score": "0.47585508", "text": "func (w *waitForSql) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) {\n\tif w.startupTimeout == 0 {\n\t\tw.startupTimeout = time.Second * 10\n\t}\n\tctx, cancel := context.WithTimeout(ctx, w.startupTimeout)\n\tdefer cancel()\n\n\tticker := time.NewTicker(time.Millisecond * 100)\n\tdefer ticker.Stop()\n\n\tport, err := target.MappedPort(ctx, w.Port)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"target.MappedPort: %v\", err)\n\t}\n\n\tdb, err := sql.Open(w.Driver, w.URL(port))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sql.Open: %v\", err)\n\t}\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-ticker.C:\n\n\t\t\tif _, err := db.ExecContext(ctx, \"SELECT 1\"); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f398feae70012ca3e5fd7a96cc86091d", "score": "0.47375336", "text": "func (resp *ActionVpsCreateResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "title": "" }, { "docid": "6345c8f1ef2998bc6ac757a3a67475d3", "score": "0.4719488", "text": "func (op *DatastoreOperation) Wait(ctx context.Context, c *dcl.Config, _, _ string) error {\n\tc.Logger.Infof(\"Waiting on operation: %v\", op)\n\top.config = c\n\terr := dcl.Do(ctx, op.operate, c.RetryProvider)\n\tc.Logger.Infof(\"Completed operation: %v\", op)\n\treturn err\n}", "title": "" }, { "docid": "45109ea5b60a407121bb9974d27c49fa", "score": "0.46767318", "text": "func (agent *ecsAgent) pollUntilTargetLifecyclePresent(pollWaitDuration time.Duration, pollMaxTimes int, maxRetries int) (string, error) {\n\tvar err error\n\tvar targetState string\n\tfor i := 0; i < pollMaxTimes; i++ {\n\t\ttargetState, err = agent.getTargetLifecycle(maxRetries)\n\t\tif targetState != \"\" ||\n\t\t\t(err != nil && utils.GetRequestFailureStatusCode(err) != 404) {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(pollWaitDuration)\n\t}\n\treturn targetState, err\n}", "title": "" }, { "docid": "9327d9b887401896e61422b699e3f0a0", "score": "0.46659023", "text": "func waitUntilVaultPolicyIsReady(c policycs.PolicyV1alpha1Interface, vp *policyapi.VaultPolicy, stopCh <-chan struct{}) error {\n\tvar err error\n\tattempt := 0\n\terr = wait.PollUntil(2*time.Second, func() (done bool, err error) {\n\t\tattempt++\n\t\tvar err2 error\n\t\tvp, err2 = c.VaultPolicies(vp.Namespace).Get(context.TODO(), vp.Name, metav1.GetOptions{})\n\t\tif err2 != nil {\n\t\t\treturn false, err2\n\t\t}\n\n\t\tif vp.Status.Phase == policyapi.PolicySuccess {\n\t\t\treturn true, nil\n\t\t}\n\n\t\tglog.Infof(\"auth method controller: attempt %d: VaultPolicy %s/%s is not succeeded\", attempt, vp.Namespace, vp.Name)\n\t\treturn false, nil\n\t}, stopCh)\n\treturn err\n}", "title": "" }, { "docid": "5ee42da26002dbc0a392736de6454e66", "score": "0.466171", "text": "func waitForEstablishedCRD(client clientset.Interface, name string) error {\n\treturn wait.PollImmediate(500*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tcrd, err := client.ApiextensionsV1beta1().CustomResourceDefinitions().Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tfor _, cond := range crd.Status.Conditions {\n\t\t\tswitch cond.Type {\n\t\t\tcase apiextensionsv1beta1.Established:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionTrue {\n\t\t\t\t\treturn true, err\n\t\t\t\t}\n\t\t\tcase apiextensionsv1beta1.NamesAccepted:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionFalse {\n\t\t\t\t\tglog.Infof(\"Name conflict: %v\\n\", cond.Reason)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n}", "title": "" }, { "docid": "6565e3c5081a785d3fc9d5fb18dc8f44", "score": "0.465844", "text": "func WaitCRDReady(kind string, clientset apiextensionsclient.Interface) error {\n\tname := fmt.Sprintf(\"%ss.%s\", strings.ToLower(kind), api.SchemeGroupVersion.Group)\n\tnotFountWait := 0\n\terr := retry.Retry(20, 5*time.Second, func() (bool, error) {\n\t\tcrd, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tnotFountWait++\n\t\t\t\tif notFountWait > 5 {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, cond := range crd.Status.Conditions {\n\t\t\tswitch cond.Type {\n\t\t\tcase apiextensionsv1beta1.Established:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionTrue {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\tcase apiextensionsv1beta1.NamesAccepted:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionFalse {\n\t\t\t\t\treturn false, fmt.Errorf(\"Name conflict: %v\", cond.Reason)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false, nil\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wait CRD created failed: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0afc965d567935ddbbaeafc8b9700e77", "score": "0.46539703", "text": "func AsyncNewTarget(targetAddress string, ports netUtil.Ports, ch chan *Target, scanLock *semaphore.Weighted, privileged bool) {\n\t// TODO Add writeMutex\n\th := &Target{InitialTarget: targetAddress, Ports: ports, Status: Unknown}\n\tscanLock.Acquire(context.TODO(), 1)\n\th.Resolve()\n\tscanLock.Release(1)\n\tif h.IPAddr != nil {\n\t\tscanLock.Acquire(context.TODO(), 1)\n\t\tstats, _ := h.Ping(3, privileged)\n\t\tscanLock.Release(1)\n\t\tif stats.PacketsRecv > 0 {\n\t\t\th.Status = Online\n\t\t}\n\t\tscanLock.Acquire(context.TODO(), 1)\n\t\th.QueryMac()\n\t\tscanLock.Release(1)\n\t\tscanLock.Acquire(context.TODO(), 1)\n\t\th.LookUpVendor()\n\t\tscanLock.Release(1)\n\t} else {\n\t\th.MACAddr = nil\n\t\th.Location = UnknownLoc\n\t}\n\tch <- h\n}", "title": "" }, { "docid": "d77e987ad4a996ecaf43fea94aa4a32f", "score": "0.46514133", "text": "func waitForEstablishedCRD(client clientset.Interface, name string) error {\n\treturn wait.PollImmediate(500*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {\n\t\tcrd, err := client.ApiextensionsV1beta1().CustomResourceDefinitions().Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tfor _, cond := range crd.Status.Conditions {\n\t\t\tswitch cond.Type {\n\t\t\tcase apiextensionsv1beta1.Established:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionTrue {\n\t\t\t\t\treturn true, err\n\t\t\t\t}\n\t\t\tcase apiextensionsv1beta1.NamesAccepted:\n\t\t\t\tif cond.Status == apiextensionsv1beta1.ConditionFalse {\n\t\t\t\t\tfmt.Printf(\"Name conflict: %v\\n\", cond.Reason)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n}", "title": "" }, { "docid": "8949ad7779ce348ed375cc995c8066c8", "score": "0.46447572", "text": "func (m *ObjectDescriptorMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "24064a1b1201530df2d6c2dd6d51bc13", "score": "0.46384177", "text": "func (resp *ActionVpsMountCreateResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "title": "" }, { "docid": "bcaa73e7373ce474b2708dbace16993f", "score": "0.463664", "text": "func (c *Runner) WaitUntilReady(ctx context.Context, createdCsl workloadsv1alpha1.Console, waitForAuthorisation bool) (*workloadsv1alpha1.Console, error) {\n\tcsl, err := c.waitForConsole(ctx, createdCsl, waitForAuthorisation)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := c.waitForRoleBinding(ctx, csl); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn csl, nil\n}", "title": "" }, { "docid": "59dbb17ccd15cdea92330c9c8feb7950", "score": "0.46160656", "text": "func (cmgr clientMgr) WaitForResource(timeoutSecs int, ns, name string, gvr schema.GroupVersionResource) (bool, error) {\n\tvar condFunc ConditionFunction = func(event watch.Event, obj *unstructured.Unstructured) (bool, error) {\n\t\tif event.Type == watch.Deleted {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}\n\treturn cmgr.WatchEventsForCondition(timeoutSecs, ns, name, gvr, condFunc)\n\n}", "title": "" }, { "docid": "b01bba8df08c6c03bae35fec8b3aa2d5", "score": "0.4592391", "text": "func waitForWebhook(ctx context.Context, log *zap.SugaredLogger, client ctrlruntimeclient.Client, kubermaticNamespace string) error {\n\t// wait for the webhook to be ready\n\ttimeout := 30 * time.Second\n\tendpoint := types.NamespacedName{Namespace: kubermaticNamespace, Name: \"seed-webhook\"}\n\n\tlog.Infow(\"waiting for webhook to be ready...\", \"webhook\", endpoint, \"timeout\", timeout)\n\tif err := wait.Poll(500*time.Millisecond, timeout, func() (bool, error) {\n\t\tendpoints := &corev1.Endpoints{}\n\t\tif err := client.Get(ctx, endpoint, endpoints); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn len(endpoints.Subsets) > 0, nil\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to wait for webhook: %v\", err)\n\t}\n\tlog.Info(\"webhook is ready\")\n\n\treturn nil\n}", "title": "" }, { "docid": "f6afa09db12e8d2aa21437eb6de20344", "score": "0.4590592", "text": "func (agent *Agent) WaitUntilReady(deadline time.Time, opts WaitUntilReadyOptions, cb WaitUntilReadyCallback) (PendingOp, error) {\n\treturn agent.diagnostics.WaitUntilReady(deadline, opts, cb)\n}", "title": "" }, { "docid": "0b22843a62d764f03705aec88434bce8", "score": "0.4577171", "text": "func (ne *NoopElection) WaitForMastership(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "2fcb19c454c8c4996791e155acb7a1f4", "score": "0.4575511", "text": "func (t *Tmux) Wait() {\n\tt.attachCommand.Wait()\n}", "title": "" }, { "docid": "4448c2ee3fbbc79654d4ecbfe930e30c", "score": "0.45585728", "text": "func (cycle *Cycle) TriggerWait() {\n\tdone := make(chan struct{})\n\n\tcycle.sendControl(cycleTrigger{done})\n\tselect {\n\tcase <-done:\n\tcase <-cycle.stopped:\n\t}\n}", "title": "" }, { "docid": "db819f1d1cf10821b45599f619a32430", "score": "0.4553835", "text": "func (m *MockCloudFormationAPI) WaitUntilChangeSetCreateComplete(input *cloudformation.DescribeChangeSetInput) error {\n\tret := m.ctrl.Call(m, \"WaitUntilChangeSetCreateComplete\", input)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "cc148d958efbbccb5b8ebaec4b275822", "score": "0.4551204", "text": "func (m *RPCClientWrapperFactoryMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "cb69bb43991c83d668270d5968d6a852", "score": "0.4550485", "text": "func (op *CreateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*alloydbpb.Instance, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp alloydbpb.Instance\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "cfa8969479a18ac6f6510af29177b2f9", "score": "0.4541815", "text": "func (a *MachineAgent) waitOn(m *models.Machine, cond TestFunc) {\n\tfound, err := a.events.WaitFor(m, AndItems(EqualItem(\"Available\", true), cond), a.waitTimeout)\n\tif err != nil {\n\t\ta.err = err\n\t\ta.initOrExit()\n\t\treturn\n\t}\n\ta.Logf(\"Wait: finished with %s\\n\", found)\n\tswitch found {\n\tcase \"timeout\":\n\t\tif a.exitOnNotRunnable {\n\t\t\ta.state = AGENT_EXIT\n\t\t\treturn\n\t\t}\n\tcase \"interrupt\":\n\t\ta.state = AGENT_EXIT\n\tcase \"complete\":\n\t\tif m.BootEnv != a.machine.BootEnv {\n\t\t\ta.rebootOrExit()\n\t\t} else if m.Runnable {\n\t\t\ta.state = AGENT_RUN_TASK\n\t\t} else {\n\t\t\ta.state = AGENT_WAIT_FOR_RUNNABLE\n\t\t}\n\tdefault:\n\t\terr := &models.Error{\n\t\t\tType: \"AGENT_WAIT\",\n\t\t\tModel: m.Prefix(),\n\t\t\tKey: m.Key(),\n\t\t}\n\t\terr.Errorf(\"Unexpected return from WaitFor: %s\", found)\n\t\ta.err = err\n\t\ta.initOrExit()\n\t}\n\ta.machine = m\n}", "title": "" }, { "docid": "a513055b51a0f41ba2913afc1eca649e", "score": "0.45389178", "text": "func (noopPrevAlloc) Wait(context.Context) error { return nil }", "title": "" }, { "docid": "22b62afbc26d4be6012eb953746f687c", "score": "0.45389077", "text": "func Target009DepCreate(dryRun bool) error {\n\tif err := Target006Create(dryRun); err != nil { // ref_calon_hmti\n\t\treturn err\n\t}\n\tif err := Target005Create(dryRun); err != nil { // ref_calon_himatro\n\t\treturn err\n\t}\n\tif err := Target003Create(dryRun); err != nil { // ref_calon_dpm\n\t\treturn err\n\t}\n\tif err := Target004Create(dryRun); err != nil { // ref_calon_gubernur\n\t\treturn err\n\t}\n\tif err := Target007Create(dryRun); err != nil { // ref_dapil\n\t\treturn err\n\t}\n\tif err := Target002Create(dryRun); err != nil { // daftar_pilihan\n\t\treturn err\n\t}\n\tif err := Target001Create(dryRun); err != nil { // daftar_pemilih\n\t\treturn err\n\t}\n\tif err := Target011Create(dryRun); err != nil { // vw_pilihan\n\t\treturn err\n\t}\n\tif err := Target009Create(dryRun); err != nil { // vw_hasil_gubernur\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "189dd5130d40f6cf22205e114bfb1a37", "score": "0.45266214", "text": "func poolWaitDeleted(virConn *libvirt.Libvirt, uuid string) error {\n\tlog.Printf(\"Waiting for pool %s to be deleted...\", uuid)\n\tstateConf := &resource.StateChangeConf{\n\t\tPending: []string{poolExistsID},\n\t\tTarget: []string{poolNotExistsID},\n\t\tRefresh: poolExists(virConn, uuid),\n\t\tTimeout: 1 * time.Minute,\n\t\tDelay: 5 * time.Second,\n\t\tMinTimeout: 3 * time.Second,\n\t}\n\n\tif _, err := stateConf.WaitForState(); err != nil {\n\t\tlog.Printf(\"%s\", err)\n\t\treturn fmt.Errorf(\"unexpected error during pool destroy operation. The pool was not deleted\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b609017ada78f3fc4b17f57daadecd0", "score": "0.4500799", "text": "func (c *Route53RecoveryControlConfig) WaitUntilControlPanelCreated(input *DescribeControlPanelInput) error {\n\treturn c.WaitUntilControlPanelCreatedWithContext(aws.BackgroundContext(), input)\n}", "title": "" }, { "docid": "af0f239845582e7f05c1d338872e430f", "score": "0.45003125", "text": "func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.Model, error) {\n\tvar resp retailpb.Model\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "18d5bff7a4c238202a7ef6f367b171b6", "score": "0.44792852", "text": "func waitForLeadership(r *raft, timeout time.Duration) bool {\n\tstart := time.Now()\n\tfor {\n\t\t_, role, _ := r.Status()\n\t\tif role == RoleLeader {\n\t\t\treturn true\n\t\t}\n\t\tif time.Since(start) > timeout {\n\t\t\treturn false\n\t\t}\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "6deb8147dad6c150008c5fa879505f72", "score": "0.44651294", "text": "func (m *RecordModifierMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "847363fea21275e4707ce10b9a4a65c3", "score": "0.4463147", "text": "func (c *Cloud) ensureTargetGroup(targetGroup *elbv2.TargetGroup, serviceName types.NamespacedName, mapping nlbPortMapping, instances []string, vpcID string, tags map[string]string) (*elbv2.TargetGroup, error) {\n\tdirty := false\n\texpectedTargets := c.computeTargetGroupExpectedTargets(instances, mapping.TrafficPort)\n\tif targetGroup == nil {\n\t\ttargetType := \"instance\"\n\t\tname := c.buildTargetGroupName(serviceName, mapping.FrontendPort, mapping.TrafficPort, mapping.TrafficProtocol, targetType, mapping)\n\t\tklog.Infof(\"Creating load balancer target group for %v with name: %s\", serviceName, name)\n\t\tinput := &elbv2.CreateTargetGroupInput{\n\t\t\tVpcId: aws.String(vpcID),\n\t\t\tName: aws.String(name),\n\t\t\tPort: aws.Int64(mapping.TrafficPort),\n\t\t\tProtocol: aws.String(mapping.TrafficProtocol),\n\t\t\tTargetType: aws.String(targetType),\n\t\t\tHealthCheckIntervalSeconds: aws.Int64(mapping.HealthCheckConfig.Interval),\n\t\t\tHealthCheckPort: aws.String(mapping.HealthCheckConfig.Port),\n\t\t\tHealthCheckProtocol: aws.String(mapping.HealthCheckConfig.Protocol),\n\t\t\tHealthyThresholdCount: aws.Int64(mapping.HealthCheckConfig.HealthyThreshold),\n\t\t\tUnhealthyThresholdCount: aws.Int64(mapping.HealthCheckConfig.UnhealthyThreshold),\n\t\t\t// HealthCheckTimeoutSeconds: Currently not configurable, 6 seconds for HTTP, 10 for TCP/HTTPS\n\t\t}\n\n\t\tif mapping.HealthCheckConfig.Protocol != elbv2.ProtocolEnumTcp {\n\t\t\tinput.HealthCheckPath = aws.String(mapping.HealthCheckConfig.Path)\n\t\t}\n\n\t\tif len(tags) != 0 {\n\t\t\ttargetGroupTags := make([]*elbv2.Tag, 0, len(tags))\n\t\t\tfor k, v := range tags {\n\t\t\t\ttargetGroupTags = append(targetGroupTags, &elbv2.Tag{\n\t\t\t\t\tKey: aws.String(k), Value: aws.String(v),\n\t\t\t\t})\n\t\t\t}\n\t\t\tinput.Tags = targetGroupTags\n\t\t}\n\t\tresult, err := c.elbv2.CreateTargetGroup(input)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating load balancer target group: %q\", err)\n\t\t}\n\t\tif len(result.TargetGroups) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected only one target group on CreateTargetGroup, got %d groups\", len(result.TargetGroups))\n\t\t}\n\n\t\ttg := result.TargetGroups[0]\n\t\ttgARN := aws.StringValue(tg.TargetGroupArn)\n\t\tif err := c.ensureTargetGroupTargets(tgARN, expectedTargets, nil); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn tg, nil\n\t}\n\n\t// handle instances in service\n\t{\n\t\ttgARN := aws.StringValue(targetGroup.TargetGroupArn)\n\t\tactualTargets, err := c.obtainTargetGroupActualTargets(tgARN)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := c.ensureTargetGroupTargets(tgARN, expectedTargets, actualTargets); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// ensure the health check is correct\n\t{\n\t\tdirtyHealthCheck := false\n\n\t\tinput := &elbv2.ModifyTargetGroupInput{\n\t\t\tTargetGroupArn: targetGroup.TargetGroupArn,\n\t\t}\n\t\tif mapping.HealthCheckConfig.Port != aws.StringValue(targetGroup.HealthCheckPort) {\n\t\t\tinput.HealthCheckPort = aws.String(mapping.HealthCheckConfig.Port)\n\t\t\tdirtyHealthCheck = true\n\t\t}\n\t\tif mapping.HealthCheckConfig.HealthyThreshold != aws.Int64Value(targetGroup.HealthyThresholdCount) {\n\t\t\tdirtyHealthCheck = true\n\t\t\tinput.HealthyThresholdCount = aws.Int64(mapping.HealthCheckConfig.HealthyThreshold)\n\t\t\tinput.UnhealthyThresholdCount = aws.Int64(mapping.HealthCheckConfig.UnhealthyThreshold)\n\t\t}\n\t\tif !strings.EqualFold(mapping.HealthCheckConfig.Protocol, elbv2.ProtocolEnumTcp) {\n\t\t\tif mapping.HealthCheckConfig.Path != aws.StringValue(input.HealthCheckPath) {\n\t\t\t\tinput.HealthCheckPath = aws.String(mapping.HealthCheckConfig.Path)\n\t\t\t\tdirtyHealthCheck = true\n\t\t\t}\n\t\t}\n\n\t\tif dirtyHealthCheck {\n\t\t\t_, err := c.elbv2.ModifyTargetGroup(input)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error modifying target group health check: %q\", err)\n\t\t\t}\n\n\t\t\tdirty = true\n\t\t}\n\t}\n\n\tif dirty {\n\t\tresult, err := c.elbv2.DescribeTargetGroups(&elbv2.DescribeTargetGroupsInput{\n\t\t\tTargetGroupArns: []*string{targetGroup.TargetGroupArn},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error retrieving target group after creation/update: %q\", err)\n\t\t}\n\t\ttargetGroup = result.TargetGroups[0]\n\t}\n\n\treturn targetGroup, nil\n}", "title": "" }, { "docid": "b1e67c2b30a03038edb0cf4ce2f7e323", "score": "0.44619608", "text": "func waitUntilTpmManagerReady(ctx context.Context, tpmManagerUtil *hwsec.UtilityTpmManagerBinary) error {\n\treturn testing.Poll(ctx, func(context.Context) error {\n\t\tstatus, err := tpmManagerUtil.Status(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"can't get TPM status\")\n\t\t}\n\t\tif !strings.Contains(status, notOwned) {\n\t\t\treturn errors.New(\"TPM isn't ready to be owned\")\n\t\t}\n\t\treturn nil\n\t}, &testing.PollOptions{\n\t\tTimeout: 10 * time.Second,\n\t\tInterval: time.Second,\n\t})\n}", "title": "" }, { "docid": "50c3181effc1723b768cc7fcc489c0f7", "score": "0.44579005", "text": "func (d *Target) TargetCreated(ctx context.Context) (cdpevent.TargetCreatedClient, error) {\n\ts, err := rpcc.NewStream(ctx, cdpevent.TargetCreated.String(), d.conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TargetCreatedClient{Stream: s}, nil\n}", "title": "" }, { "docid": "233c29f0bc6767738f3aa88c27753a70", "score": "0.4456145", "text": "func (op *CreatePhraseSetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*speechpb.PhraseSet, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp speechpb.PhraseSet\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "8bf69d4c9ce4ebaffe60b8e305fd882e", "score": "0.44505513", "text": "func waitForReplicaSetTargetSpecReplicas(ctx context.Context, c clientset.Interface, replicaSet *appsv1.ReplicaSet, targetReplicaNum int32) error {\n\tdesiredGeneration := replicaSet.Generation\n\terr := wait.PollImmediateWithContext(ctx, framework.Poll, framework.PollShortTimeout, func(ctx context.Context) (bool, error) {\n\t\trs, err := c.AppsV1().ReplicaSets(replicaSet.Namespace).Get(ctx, replicaSet.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn rs.Status.ObservedGeneration >= desiredGeneration && *rs.Spec.Replicas == targetReplicaNum, nil\n\t})\n\tif err == wait.ErrWaitTimeout {\n\t\terr = fmt.Errorf(\"replicaset %q never had desired number of .spec.replicas\", replicaSet.Name)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "3cd6d0943a433f6101139fb9ccf8798d", "score": "0.44300544", "text": "func (w *IdentityExistsWaiter) Wait(ctx context.Context, params *GetIdentityVerificationAttributesInput, maxWaitDur time.Duration, optFns ...func(*IdentityExistsWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "title": "" }, { "docid": "81b1e14a2e3cf0048d88a8e92630e1d3", "score": "0.44236848", "text": "func (m *MeshReconciler) waitForCRD(name string, client runtimeclient.Client) error {\n\tm.logger.WithField(\"name\", name).Debug(\"waiting for CRD\")\n\n\tvar backoffConfig = backoff.ConstantBackoffConfig{\n\t\tDelay: time.Duration(backoffDelaySeconds) * time.Second,\n\t\tMaxRetries: backoffMaxretries,\n\t}\n\tvar backoffPolicy = backoff.NewConstantBackoffPolicy(backoffConfig)\n\n\tvar crd apiextensionsv1beta1.CustomResourceDefinition\n\terr := backoff.Retry(func() error {\n\t\terr := client.Get(context.Background(), types.NamespacedName{\n\t\t\tName: name,\n\t\t}, &crd)\n\t\tif err != nil {\n\t\t\treturn errors.WrapIf(err, \"could not get CRD\")\n\t\t}\n\n\t\treturn nil\n\t}, backoffPolicy)\n\n\treturn err\n}", "title": "" }, { "docid": "8135f024eeaedf91bbc8d7533ed97ba2", "score": "0.4415422", "text": "func WaitForReady(until time.Time) bool {\n\treturn tryUntil(until, func() bool {\n\t\tcmd := exec.Command(\n\t\t\t\"kubectl\",\n\t\t\t\"--kubeconfig=/etc/kubernetes/admin.conf\",\n\t\t\t\"get\",\n\t\t\t\"nodes\",\n\t\t\t\"--selector=node-role.kubernetes.io/master\",\n\t\t\t// When the node reaches status ready, the status field will be set\n\t\t\t// to true.\n\t\t\t\"-o=jsonpath='{.items..status.conditions[-1:].status}'\",\n\t\t)\n\t\tlines, err := exec.CombinedOutputLines(cmd)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\t// 'lines' will return the status of all nodes labeled as master. For\n\t\t// example, if we have three control plane nodes, and all are ready,\n\t\t// then the status will have the following format: `True True True'.\n\t\tstatus := strings.Fields(lines[0])\n\t\tfor _, s := range status {\n\t\t\t// Check node status. If node is ready then this wil be 'True',\n\t\t\t// 'False' or 'Unkown' otherwise.\n\t\t\tif !strings.Contains(s, \"True\") {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "6705a9ab3229f93c35a7bc8d7221149f", "score": "0.44149786", "text": "func (p *remotePrevAlloc) Wait(ctx context.Context) error {\n\tp.waitingLock.Lock()\n\tp.waiting = true\n\tp.waitingLock.Unlock()\n\tdefer func() {\n\t\tp.waitingLock.Lock()\n\t\tp.waiting = false\n\t\tp.waitingLock.Unlock()\n\t}()\n\n\tp.logger.Printf(\"[DEBUG] client: alloc %q waiting for remote previous alloc %q to terminate\", p.allocID, p.prevAllocID)\n\treq := structs.AllocSpecificRequest{\n\t\tAllocID: p.prevAllocID,\n\t\tQueryOptions: structs.QueryOptions{\n\t\t\tRegion: p.config.Region,\n\t\t\tAllowStale: true,\n\t\t\tAuthToken: p.config.Node.SecretID,\n\t\t},\n\t}\n\n\tdone := func() bool {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\n\tfor !done() {\n\t\tresp := structs.SingleAllocResponse{}\n\t\terr := p.rpc.RPC(\"Alloc.GetAlloc\", &req, &resp)\n\t\tif err != nil {\n\t\t\tp.logger.Printf(\"[ERR] client: failed to query previous alloc %q: %v\", p.prevAllocID, err)\n\t\t\tretry := getAllocRetryIntv + lib.RandomStagger(getAllocRetryIntv)\n\t\t\tselect {\n\t\t\tcase <-time.After(retry):\n\t\t\t\tcontinue\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\t\t}\n\t\tif resp.Alloc == nil {\n\t\t\tp.logger.Printf(\"[DEBUG] client: blocking alloc %q has been GC'd\", p.prevAllocID)\n\t\t\treturn nil\n\t\t}\n\t\tif resp.Alloc.Terminated() {\n\t\t\t// Terminated!\n\t\t\tp.nodeID = resp.Alloc.NodeID\n\t\t\treturn nil\n\t\t}\n\n\t\t// Update the query index and requery.\n\t\tif resp.Index > req.MinQueryIndex {\n\t\t\treq.MinQueryIndex = resp.Index\n\t\t}\n\t}\n\n\treturn ctx.Err()\n}", "title": "" }, { "docid": "3f433698f287a9f64e11cedbeddb38c7", "score": "0.44128427", "text": "func waitOnPVandPVC(c clientset.Interface, ns string, pv *v1.PersistentVolume, pvc *v1.PersistentVolumeClaim) {\n\n\t// Wait for newly created PVC to bind to the PV\n\tframework.Logf(\"Waiting for PV %v to bind to PVC %v\", pv.Name, pvc.Name)\n\terr := framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, pvc.Name, 3*time.Second, 300*time.Second)\n\tExpect(err).NotTo(HaveOccurred())\n\n\t// Wait for PersistentVolume.Status.Phase to be Bound, which it should be\n\t// since the PVC is already bound.\n\terr = framework.WaitForPersistentVolumePhase(v1.VolumeBound, c, pv.Name, 3*time.Second, 300*time.Second)\n\tExpect(err).NotTo(HaveOccurred())\n\n\t// Re-get the pv and pvc objects\n\tpv, err = c.Core().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})\n\tExpect(err).NotTo(HaveOccurred())\n\n\t// Re-get the pvc and\n\tpvc, err = c.Core().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})\n\tExpect(err).NotTo(HaveOccurred())\n\n\t// The pv and pvc are both bound, but to each other?\n\t// Check that the PersistentVolume.ClaimRef matches the PVC\n\tExpect(pv.Spec.ClaimRef).NotTo(BeNil())\n\tExpect(pv.Spec.ClaimRef.Name).To(Equal(pvc.Name))\n\tExpect(pvc.Spec.VolumeName).To(Equal(pv.Name))\n\tExpect(pv.Spec.ClaimRef.UID).To(Equal(pvc.UID))\n}", "title": "" }, { "docid": "8908a938da6df69a6eab10e02d50a004", "score": "0.44125524", "text": "func (m *MockCloudFormationAPI) WaitUntilChangeSetCreateComplete(arg0 *cloudformation.DescribeChangeSetInput) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WaitUntilChangeSetCreateComplete\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8ed9be7487149cdce5772f46b1bee1b4", "score": "0.44114935", "text": "func waitUntilSyncMasterCountReached(cli client.API, expectedSyncMasters int) error {\n\tctx := context.Background()\n\n\top := func() error {\n\t\tif list, err := cli.Master().Masters(ctx); err != nil {\n\t\t\treturn maskAny(err)\n\t\t} else if len(list) != expectedSyncMasters {\n\t\t\treturn maskAny(fmt.Errorf(\"Expected %d syncmasters, got %d\", expectedSyncMasters, len(list)))\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := retry.Retry(op, deploymentReadyTimeout); err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "688d6b1d1eadb8178d4fe123bfb54ab2", "score": "0.44077224", "text": "func (c *Client) WaitForOperation(operationID int64) (bool, error) {\n\tif c == nil {\n\t\treturn false, fmt.Errorf(\"client is nil\")\n\t}\n\tparams := operations.NewGetOperationsIDParams().WithID(operationID)\n\top, err := c.Client.Operations.GetOperationsID(params, c.Token)\n\tif err != nil {\n\t\terrStruct := err.(*operations.GetOperationsIDDefault)\n\t\tswitch errStruct.Code() {\n\t\tcase 404:\n\t\t\t// If deleted, then the resource needs to be removed from Terraform.\n\t\t\treturn true, nil\n\t\tdefault:\n\t\t\te := fmt.Errorf(\"there was an error when getting the operation for op id: %d \\n[ERROR] -%s\", operationID, err)\n\t\t\treturn false, e\n\t\t}\n\t}\n\tstatus := *op.Payload.Status\n\n\tfor status != \"succeeded\" {\n\t\tif status == \"failed\" {\n\t\t\treturn false, fmt.Errorf(\"[ERROR] - operation failed for op id: %d\", operationID)\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t\top, err = c.Client.Operations.GetOperationsID(params, c.Token)\n\t\tif err != nil {\n\t\t\terrStruct := err.(*operations.GetOperationsIDDefault)\n\t\t\tswitch errStruct.Code() {\n\t\t\tcase 404:\n\t\t\t\t// If deleted, then the resource needs to be removed from Terraform.\n\t\t\t\treturn true, nil\n\t\t\tdefault:\n\t\t\t\te := fmt.Errorf(\"there was an error when getting the operation for op id: %d \\n[ERROR] -%s\", operationID, err)\n\t\t\t\treturn false, e\n\t\t\t}\n\t\t}\n\t\tstatus = *op.Payload.Status\n\t\tfmt.Println(\"Still creating...\")\n\t}\n\tfmt.Println(\"Done!\")\n\n\treturn false, nil\n}", "title": "" }, { "docid": "c24ad269a78b534768a0049e665c00a2", "score": "0.44074956", "text": "func (op *CreateRecognizerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*speechpb.Recognizer, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp speechpb.Recognizer\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "6c6b3aae2cdf4bb9d114d415398365e6", "score": "0.4395392", "text": "func (c *Cmd) Wait() error {\n\tif c.done == nil {\n\t\treturn errors.New(\"vuln: start must be called before wait\")\n\t}\n\t<-c.done\n\treturn c.err\n}", "title": "" }, { "docid": "5da104d73f18768337f8c8977f8c45fe", "score": "0.43910968", "text": "func Target010DepCreate(dryRun bool) error {\n\tif err := Target006Create(dryRun); err != nil { // ref_calon_hmti\n\t\treturn err\n\t}\n\tif err := Target005Create(dryRun); err != nil { // ref_calon_himatro\n\t\treturn err\n\t}\n\tif err := Target003Create(dryRun); err != nil { // ref_calon_dpm\n\t\treturn err\n\t}\n\tif err := Target004Create(dryRun); err != nil { // ref_calon_gubernur\n\t\treturn err\n\t}\n\tif err := Target007Create(dryRun); err != nil { // ref_dapil\n\t\treturn err\n\t}\n\tif err := Target002Create(dryRun); err != nil { // daftar_pilihan\n\t\treturn err\n\t}\n\tif err := Target001Create(dryRun); err != nil { // daftar_pemilih\n\t\treturn err\n\t}\n\tif err := Target011Create(dryRun); err != nil { // vw_pilihan\n\t\treturn err\n\t}\n\tif err := Target010Create(dryRun); err != nil { // vw_hasil_hmp\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b46778bf142de2ad00aba04d2a2eaa86", "score": "0.4389784", "text": "func TestResourceContainerProgression(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\tctrl, client, mockTime, taskEngine, _, imageManager, _, serviceConnectManager := mocks(t, ctx, &defaultConfig)\n\tdefer ctrl.Finish()\n\n\tsleepTask := testdata.LoadTask(\"sleep5\")\n\tsleepContainer := sleepTask.Containers[0]\n\n\tsleepContainer.TransitionDependenciesMap = make(map[apicontainerstatus.ContainerStatus]apicontainer.TransitionDependencySet)\n\tsleepContainer.BuildResourceDependency(\"cgroup\", resourcestatus.ResourceCreated, apicontainerstatus.ContainerPulled)\n\n\tmockControl := mock_control.NewMockControl(ctrl)\n\tmockIO := mock_ioutilwrapper.NewMockIOUtil(ctrl)\n\ttaskID := sleepTask.GetID()\n\tcgroupRoot := fmt.Sprintf(\"/ecs/%s\", taskID)\n\tif config.CgroupV2 {\n\t\tcgroupRoot = fmt.Sprintf(\"ecstasks-%s.slice\", taskID)\n\t}\n\tcgroupResource := cgroup.NewCgroupResource(sleepTask.Arn, mockControl, mockIO, cgroupRoot, cgroupMountPath, specs.LinuxResources{})\n\n\tsleepTask.ResourcesMapUnsafe = make(map[string][]taskresource.TaskResource)\n\tsleepTask.AddResource(\"cgroup\", cgroupResource)\n\teventStream := make(chan dockerapi.DockerContainerChangeEvent)\n\n\t// containerEventsWG is used to force the test to wait until the container created and started\n\t// events are processed\n\tcontainerEventsWG := sync.WaitGroup{}\n\tclient.EXPECT().ContainerEvents(gomock.Any()).Return(eventStream, nil)\n\tserviceConnectManager.EXPECT().GetAppnetContainerTarballDir().AnyTimes()\n\n\t// Hierarchical memory accounting is always enabled in CgroupV2 and no controller file exists to configure it\n\tif config.CgroupV2 {\n\t\tgomock.InOrder(\n\t\t\t// Ensure that the resource is created first\n\t\t\tmockControl.EXPECT().Exists(gomock.Any()).Return(false),\n\t\t\tmockControl.EXPECT().Create(gomock.Any()).Return(nil),\n\t\t\timageManager.EXPECT().AddAllImageStates(gomock.Any()).AnyTimes(),\n\t\t\tclient.EXPECT().PullImage(gomock.Any(), sleepContainer.Image, nil, gomock.Any()).Return(dockerapi.DockerContainerMetadata{}),\n\t\t\timageManager.EXPECT().RecordContainerReference(sleepContainer).Return(nil),\n\t\t\timageManager.EXPECT().GetImageStateFromImageName(sleepContainer.Image).Return(nil, false),\n\t\t\tclient.EXPECT().APIVersion().Return(defaultDockerClientAPIVersion, nil),\n\t\t\tclient.EXPECT().CreateContainer(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Do(\n\t\t\t\tfunc(ctx interface{}, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, containerName string, z time.Duration) {\n\t\t\t\t\tassert.True(t, strings.Contains(containerName, sleepContainer.Name))\n\t\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerCreated)\n\t\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t\t}()\n\t\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t\t\t// Next, the sleep container is started\n\t\t\tclient.EXPECT().StartContainer(gomock.Any(), containerID+\":\"+sleepContainer.Name, defaultConfig.ContainerStartTimeout).Do(\n\t\t\t\tfunc(ctx interface{}, id string, timeout time.Duration) {\n\t\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerRunning)\n\t\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t\t}()\n\t\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t\t)\n\t} else {\n\t\tcgroupMemoryPath := fmt.Sprintf(\"/sys/fs/cgroup/memory/ecs/%s/memory.use_hierarchy\", taskID)\n\t\tgomock.InOrder(\n\t\t\t// Ensure that the resource is created first\n\t\t\tmockControl.EXPECT().Exists(gomock.Any()).Return(false),\n\t\t\tmockControl.EXPECT().Create(gomock.Any()).Return(nil),\n\t\t\tmockIO.EXPECT().WriteFile(cgroupMemoryPath, gomock.Any(), gomock.Any()).Return(nil),\n\t\t\timageManager.EXPECT().AddAllImageStates(gomock.Any()).AnyTimes(),\n\t\t\tclient.EXPECT().PullImage(gomock.Any(), sleepContainer.Image, nil, gomock.Any()).Return(dockerapi.DockerContainerMetadata{}),\n\t\t\timageManager.EXPECT().RecordContainerReference(sleepContainer).Return(nil),\n\t\t\timageManager.EXPECT().GetImageStateFromImageName(sleepContainer.Image).Return(nil, false),\n\t\t\tclient.EXPECT().APIVersion().Return(defaultDockerClientAPIVersion, nil),\n\t\t\tclient.EXPECT().CreateContainer(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Do(\n\t\t\t\tfunc(ctx interface{}, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, containerName string, z time.Duration) {\n\t\t\t\t\tassert.True(t, strings.Contains(containerName, sleepContainer.Name))\n\t\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerCreated)\n\t\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t\t}()\n\t\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t\t\t// Next, the sleep container is started\n\t\t\tclient.EXPECT().StartContainer(gomock.Any(), containerID+\":\"+sleepContainer.Name, defaultConfig.ContainerStartTimeout).Do(\n\t\t\t\tfunc(ctx interface{}, id string, timeout time.Duration) {\n\t\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerRunning)\n\t\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t\t}()\n\t\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t\t)\n\t}\n\taddTaskToEngine(t, ctx, taskEngine, sleepTask, mockTime, &containerEventsWG)\n\n\tcleanup := make(chan time.Time, 1)\n\tmockTime.EXPECT().After(gomock.Any()).Return(cleanup).AnyTimes()\n\n\t// Simulate a container stop event from docker\n\teventStream <- dockerapi.DockerContainerChangeEvent{\n\t\tStatus: apicontainerstatus.ContainerStopped,\n\t\tDockerContainerMetadata: dockerapi.DockerContainerMetadata{\n\t\t\tDockerID: containerID + \":\" + sleepContainer.Name,\n\t\t\tExitCode: aws.Int(exitCode),\n\t\t},\n\t}\n\twaitForStopEvents(t, taskEngine.StateChangeEvents(), true, false)\n}", "title": "" }, { "docid": "b8fa25cc5c4a4a8ecf3e19dbe1eac66b", "score": "0.4383549", "text": "func Target011DepCreate(dryRun bool) error {\n\tif err := Target006Create(dryRun); err != nil { // ref_calon_hmti\n\t\treturn err\n\t}\n\tif err := Target005Create(dryRun); err != nil { // ref_calon_himatro\n\t\treturn err\n\t}\n\tif err := Target003Create(dryRun); err != nil { // ref_calon_dpm\n\t\treturn err\n\t}\n\tif err := Target004Create(dryRun); err != nil { // ref_calon_gubernur\n\t\treturn err\n\t}\n\tif err := Target007Create(dryRun); err != nil { // ref_dapil\n\t\treturn err\n\t}\n\tif err := Target002Create(dryRun); err != nil { // daftar_pilihan\n\t\treturn err\n\t}\n\tif err := Target001Create(dryRun); err != nil { // daftar_pemilih\n\t\treturn err\n\t}\n\tif err := Target011Create(dryRun); err != nil { // vw_pilihan\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "013fb7ae1aedda5d5b70bc3d12d3b0a2", "score": "0.43830708", "text": "func (d *CSIDriver) waitAction(ctx context.Context, volumeId string, actionId int) error {\n\tll := d.log.WithFields(logrus.Fields{\n\t\t\"volume_id\": volumeId,\n\t\t\"action_id\": actionId,\n\t})\n\n\tll.Info(\"waitaction called\")\n\tctx, cancel := context.WithTimeout(ctx, time.Minute)\n\tdefer cancel()\n\n\treturn nil\n}", "title": "" }, { "docid": "149c227111ccfd3c337f92d9cfca159c", "score": "0.4375418", "text": "func (tw *TriggerWriter) Wait(deadline time.Duration) error {\n\tif err := chans.Wait(tw.doneCh, deadline); err != nil {\n\t\treturn fmt.Errorf(\"exceeded wait deadline in trigger writer wait: %w\", err)\n\t}\n\tif tw.state == triggerStateNotFound {\n\t\treturn TriggerNotFoundErr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cb9112775c5d8ca671f708dd17bef3f", "score": "0.43663883", "text": "func waitForAgreement(sm *ShardMaster, seq int) interface{} {\n\tto := 10 * time.Millisecond\n\tvar agreed interface{}\n\tvar decided bool\n\tfor true {\n\t\tdecided, agreed = sm.px.Status(seq)\n\t\tif decided {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(to)\n\t\tif to < 10*time.Second {\n\t\t\tto *= 2\n\t\t}\n\t}\n\treturn agreed\n}", "title": "" }, { "docid": "bf03183b382cd0d82141b52fc5a0f651", "score": "0.43628338", "text": "func Target004DepCreate(dryRun bool) error {\n\tif err := Target004Create(dryRun); err != nil { // ref_calon_gubernur\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb3b7abf121237d5a74b0e4681094e73", "score": "0.4357882", "text": "func waitForSecret(secretId *string, targetState vault.SecretLifecycleStateEnum, cfg config) error {\n\tclient := cfg.VaultsClient\n\tfor {\n\t\tsecret, err := client.GetSecret(cfg.Ctx, vault.GetSecretRequest{\n\t\t\tSecretId: secretId,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"waitForSecret: lifecycle state = %v\\n\", secret.LifecycleState)\n\n\t\tif secret.LifecycleState == targetState {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "title": "" }, { "docid": "be764be17f732ab669e665392b33a181", "score": "0.43549773", "text": "func (a *Ability) RequiresTarget() bool {\n\treturn a.Trigger == \"enterPlay\" && a.Target == \"target\"\n}", "title": "" }, { "docid": "9dd47b6d141835b19943d11bd5a40eea", "score": "0.43525496", "text": "func (c *controller) Wait() {\n\tc.waitgroup.Wait()\n}", "title": "" }, { "docid": "a6bae9d296bd19aa85fbf8ce6de32a92", "score": "0.43478966", "text": "func (c *myClient) waitForEngineReady(p int, t int) error {\n\n\tlogger.Infof(\"Waiting up to %v seconds for the DDDP to be ready\", t)\n\ttimeOut := 0\n\tfor timeOut < t {\n\t\tlogger.Info(\"Waiting for Delphix DDP\")\n\t\ttime.Sleep(time.Duration(p) * time.Second)\n\t\ttimeOut = timeOut + p\n\t\tif _, err := c.LoadAndValidate(); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f43a2ce4d240d82b0cc797741d8ce6ef", "score": "0.4347149", "text": "func (pbc *PipeBridgeController) Wait() fail.Error {\n\tif pbc == nil {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif pbc.displayTask == nil {\n\t\treturn fail.InvalidInstanceContentError(\"pbc.displayTask\", \"cannot be nil\")\n\t}\n\tif pbc.readersGroup == nil {\n\t\treturn fail.InvalidInstanceContentError(\"pbc.readersGroup\", \"cannot be nil\")\n\t}\n\n\txerr := fail.ConvertError(pbc.readersGroup.Wait())\n\tclose(pbc.displayCh)\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\txerr = fail.ConvertError(pbc.displayTask.Wait())\n\treturn xerr\n}", "title": "" }, { "docid": "f641ac151cec6a92673ffe5bf417b815", "score": "0.43456894", "text": "func (o *OffchainAggregatorRoundConfirmer) Wait() error {\n\tdefer func() { o.complete = true }()\n\tfor {\n\t\tselect {\n\t\tcase <-o.doneChan:\n\t\t\to.cancel()\n\t\t\tclose(o.doneChan)\n\t\t\treturn nil\n\t\tcase <-o.context.Done():\n\t\t\treturn fmt.Errorf(\"timeout waiting for OCR round to confirm: %d\", o.roundID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "964609ff3482c9c46f333826076e952c", "score": "0.43434423", "text": "func (p *APIProxy) Wait() {\n\tp.listenerWg.Wait()\n}", "title": "" }, { "docid": "82ad1375975afab161c357e9718c048f", "score": "0.434313", "text": "func WaitForCRDEstablished(clientset apiextensions.Interface, crdName string) error {\n\treturn wait.Poll(250*time.Millisecond, 30*time.Second, func() (bool, error) {\n\t\tcrd, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crdName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, cond := range crd.Status.Conditions {\n\t\t\tswitch cond.Type {\n\t\t\tcase apiextensionsv1.Established:\n\t\t\t\tif cond.Status == apiextensionsv1.ConditionTrue {\n\t\t\t\t\treturn true, err\n\t\t\t\t}\n\t\t\tcase apiextensionsv1.NamesAccepted:\n\t\t\t\tif cond.Status == apiextensionsv1.ConditionFalse {\n\t\t\t\t\tlogrus.WithField(\"reason\", cond.Reason).Warn(\"Name conflict\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false, err\n\t})\n}", "title": "" }, { "docid": "b94be00a5c3b4dee3ae744d51b1aa5f1", "score": "0.4340857", "text": "func assignRequiredBy(tg *TestGroup) {\n\tfor _, test := range tg.Tests {\n\t\tif len(test.TargetName) > 0 {\n\t\t\tassignTestRequiredBy(test, test.TargetName)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2dc82e15054149a34e686f257e62d875", "score": "0.43283975", "text": "func Target008DepCreate(dryRun bool) error {\n\tif err := Target006Create(dryRun); err != nil { // ref_calon_hmti\n\t\treturn err\n\t}\n\tif err := Target005Create(dryRun); err != nil { // ref_calon_himatro\n\t\treturn err\n\t}\n\tif err := Target003Create(dryRun); err != nil { // ref_calon_dpm\n\t\treturn err\n\t}\n\tif err := Target004Create(dryRun); err != nil { // ref_calon_gubernur\n\t\treturn err\n\t}\n\tif err := Target007Create(dryRun); err != nil { // ref_dapil\n\t\treturn err\n\t}\n\tif err := Target002Create(dryRun); err != nil { // daftar_pilihan\n\t\treturn err\n\t}\n\tif err := Target001Create(dryRun); err != nil { // daftar_pemilih\n\t\treturn err\n\t}\n\tif err := Target011Create(dryRun); err != nil { // vw_pilihan\n\t\treturn err\n\t}\n\tif err := Target008Create(dryRun); err != nil { // vw_hasil_dpm\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "34301c3ad8a5152d383863777cce5356", "score": "0.4322819", "text": "func (img *SLImages) WaitReady(id int, d time.Duration) error {\n\ttimeout := time.After(d)\n\tparent, err := img.Parent(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif parent != nil && parent.ID != 0 {\n\t\tid = parent.ID\n\t}\n\n\tchildren, err := img.Children(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tids := make([]int, len(children))\n\tfor i, child := range children {\n\t\tids[i] = child.ID\n\t}\n\tids = append(ids, id)\n\n\tfor {\n\t\tselect {\n\t\tcase <-timeout:\n\t\t\treturn fmt.Errorf(\"waiting for %d to be ready timed out after %s\", id, d)\n\t\tdefault:\n\t\t\tvar ongoing bool\n\n\t\t\tfor _, id := range ids {\n\t\t\t\tt, err := img.Transaction(id)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif t != nil && t.ID != 0 {\n\t\t\t\t\tongoing = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !ongoing {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15b56b2fd08838899bfd00162bf64b4e", "score": "0.43202242", "text": "func waitFor(ctx context.Context, eventName string) error {\n\t// TODO: timeout setting\n\tch := make(chan struct{})\n\tcctx, cancel := context.WithCancel(ctx)\n\tdebugf(`Wait for \"%s\"`, eventName)\n\tchromedp.ListenTarget(cctx, func(ev interface{}) {\n\t\tswitch e := ev.(type) {\n\t\tcase *page.EventLifecycleEvent:\n\t\t\tdebugf(\"Received lifecycle event: %s\", e.Name)\n\t\t\tif e.Name == eventName {\n\t\t\t\tcancel()\n\t\t\t\tclose(ch)\n\t\t\t}\n\t\t}\n\t})\n\tselect {\n\tcase <-ch:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n}", "title": "" }, { "docid": "f21af1d3f64bb5f4a33ad982a3399de2", "score": "0.4317536", "text": "func (pbc *PipeBridgeController) Wait() error {\n\tif pbc == nil {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif pbc.displayTask == nil {\n\t\treturn fail.InvalidInstanceContentError(\"pbc.displayTask\", \"cannot be nil\")\n\t}\n\tif pbc.readersGroup == nil {\n\t\treturn fail.InvalidInstanceContentError(\"pbc.readersGroup\", \"cannot be nil\")\n\t}\n\n\tvar errors []error\n\t_, err := pbc.readersGroup.WaitGroup()\n\tif err != nil {\n\t\terrors = append(errors, err)\n\t\terr = pbc.displayTask.Abort()\n\t\tif err != nil {\n\t\t\terrors = append(errors, err)\n\t\t}\n\t} else {\n\t\tclose(pbc.displayCh)\n\t}\n\t_, _, err = pbc.displayTask.WaitFor(temporal.GetConnectionTimeout())\n\tif err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn fail.ErrListError(errors)\n}", "title": "" }, { "docid": "99b4e91a287a425808a6e03b363feeb7", "score": "0.43102843", "text": "func waitForPrivateEndpoint(endpointId *string, targetState databasetools.LifecycleStateEnum, cfg config) error {\n\tclient := cfg.DBToolsClient\n\tfor {\n\t\tpe, err := client.GetDatabaseToolsPrivateEndpoint(cfg.Ctx,\n\t\t\tdatabasetools.GetDatabaseToolsPrivateEndpointRequest{\n\t\t\t\tDatabaseToolsPrivateEndpointId: endpointId,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"waitForPrivateEndpoint: lifecycle state = %v\\n\", pe.LifecycleState)\n\n\t\tif pe.LifecycleState == targetState {\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(10 * time.Second)\n\t}\n}", "title": "" }, { "docid": "a3c1b0dcceca857540507d079f214bdc", "score": "0.43081215", "text": "func (c *myClient) waitForMaskingEngineReady(p int, t int) error {\n\tlogger := logger.WithFields(log.Fields{\n\t\t\"url\": c.url,\n\t\t\"username\": c.username,\n\t})\n\tlogger.Infof(\"Waiting up to %v seconds for the DDDP to be ready\", t)\n\ttimeOut := 0\n\tfor timeOut < t {\n\t\tlogger.Info(\"Waiting for Delphix DDP Masking Engine\")\n\t\ttime.Sleep(time.Duration(p) * time.Second)\n\t\ttimeOut = timeOut + p\n\t\tif _, err := c.MaskingLoadAndValidate(); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90b178625bacfe5dc850f6d8d5332877", "score": "0.43068606", "text": "func TestTaskWithSteadyStateResourcesProvisioned(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\tctrl, client, mockTime, taskEngine, _, imageManager, _, serviceConnectManager := mocks(t, ctx, &defaultConfig)\n\tdefer ctrl.Finish()\n\n\tmockCNIClient := mock_ecscni.NewMockCNIClient(ctrl)\n\ttaskEngine.(*DockerTaskEngine).cniClient = mockCNIClient\n\t// sleep5 contains a single 'sleep' container, with DesiredStatus == RUNNING\n\tsleepTask := testdata.LoadTask(\"sleep5\")\n\tsleepContainer := sleepTask.Containers[0]\n\tsleepContainer.TransitionDependenciesMap = make(map[apicontainerstatus.ContainerStatus]apicontainer.TransitionDependencySet)\n\tsleepContainer.BuildContainerDependency(\"pause\", apicontainerstatus.ContainerResourcesProvisioned, apicontainerstatus.ContainerPulled)\n\t// Add a second container with DesiredStatus == RESOURCES_PROVISIONED and\n\t// steadyState == RESOURCES_PROVISIONED\n\tpauseContainer := apicontainer.NewContainerWithSteadyState(apicontainerstatus.ContainerResourcesProvisioned)\n\tpauseContainer.Name = \"pause\"\n\tpauseContainer.Image = \"pause\"\n\tpauseContainer.CPU = 10\n\tpauseContainer.Memory = 10\n\tpauseContainer.Essential = true\n\tpauseContainer.Type = apicontainer.ContainerCNIPause\n\tsleepTask.Containers = append(sleepTask.Containers, pauseContainer)\n\teventStream := make(chan dockerapi.DockerContainerChangeEvent)\n\t// containerEventsWG is used to force the test to wait until the container created and started\n\t// events are processed\n\tcontainerEventsWG := sync.WaitGroup{}\n\n\tclient.EXPECT().ContainerEvents(gomock.Any()).Return(eventStream, nil)\n\tserviceConnectManager.EXPECT().GetAppnetContainerTarballDir().AnyTimes()\n\t// We cannot rely on the order of pulls between images as they can still be downloaded in\n\t// parallel. The dependency graph enforcement comes into effect for CREATED transitions.\n\t// Hence, do not enforce the order of invocation of these calls\n\timageManager.EXPECT().AddAllImageStates(gomock.Any()).AnyTimes()\n\tclient.EXPECT().PullImage(gomock.Any(), sleepContainer.Image, nil, gomock.Any()).Return(dockerapi.DockerContainerMetadata{})\n\timageManager.EXPECT().RecordContainerReference(sleepContainer).Return(nil)\n\timageManager.EXPECT().GetImageStateFromImageName(sleepContainer.Image).Return(nil, false)\n\n\tgomock.InOrder(\n\t\t// Ensure that the pause container is created first\n\t\tclient.EXPECT().APIVersion().Return(defaultDockerClientAPIVersion, nil),\n\t\tclient.EXPECT().CreateContainer(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Do(\n\t\t\tfunc(ctx interface{}, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, containerName string, z time.Duration) {\n\t\t\t\tsleepTask.AddTaskENI(mockENI)\n\t\t\t\tsleepTask.NetworkMode = apitask.AWSVPCNetworkMode\n\t\t\t\tsleepTask.SetAppMesh(&appmesh.AppMesh{\n\t\t\t\t\tIgnoredUID: ignoredUID,\n\t\t\t\t\tProxyIngressPort: proxyIngressPort,\n\t\t\t\t\tProxyEgressPort: proxyEgressPort,\n\t\t\t\t\tAppPorts: []string{\n\t\t\t\t\t\tappPort,\n\t\t\t\t\t},\n\t\t\t\t\tEgressIgnoredIPs: []string{\n\t\t\t\t\t\tegressIgnoredIP,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tassert.Equal(t, \"none\", string(hostConfig.NetworkMode))\n\t\t\t\tassert.True(t, strings.Contains(containerName, pauseContainer.Name))\n\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerCreated)\n\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t}()\n\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + pauseContainer.Name}),\n\t\t// Ensure that the pause container is started after it's created\n\t\tclient.EXPECT().StartContainer(gomock.Any(), containerID+\":\"+pauseContainer.Name, defaultConfig.ContainerStartTimeout).Do(\n\t\t\tfunc(ctx interface{}, id string, timeout time.Duration) {\n\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerRunning)\n\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t}()\n\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + pauseContainer.Name}),\n\t\tclient.EXPECT().InspectContainer(gomock.Any(), gomock.Any(), gomock.Any()).Return(&types.ContainerJSON{\n\t\t\tContainerJSONBase: &types.ContainerJSONBase{\n\t\t\t\tID: containerID,\n\t\t\t\tState: &types.ContainerState{Pid: 23},\n\t\t\t\tHostConfig: &dockercontainer.HostConfig{\n\t\t\t\t\tNetworkMode: containerNetNS,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil),\n\t\t// Then setting up the pause container network namespace\n\t\tmockCNIClient.EXPECT().SetupNS(gomock.Any(), gomock.Any(), gomock.Any()).Return(nsResult, nil),\n\n\t\t// Once the pause container is started, sleep container will be created\n\t\tclient.EXPECT().APIVersion().Return(defaultDockerClientAPIVersion, nil),\n\t\tclient.EXPECT().CreateContainer(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Do(\n\t\t\tfunc(ctx interface{}, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, containerName string, z time.Duration) {\n\t\t\t\tassert.True(t, strings.Contains(containerName, sleepContainer.Name))\n\t\t\t\tassert.Equal(t, \"container:\"+containerID+\":\"+pauseContainer.Name, string(hostConfig.NetworkMode))\n\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerCreated)\n\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t}()\n\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t\t// Next, the sleep container is started\n\t\tclient.EXPECT().StartContainer(gomock.Any(), containerID+\":\"+sleepContainer.Name, defaultConfig.ContainerStartTimeout).Do(\n\t\t\tfunc(ctx interface{}, id string, timeout time.Duration) {\n\t\t\t\tcontainerEventsWG.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\teventStream <- createDockerEvent(apicontainerstatus.ContainerRunning)\n\t\t\t\t\tcontainerEventsWG.Done()\n\t\t\t\t}()\n\t\t\t}).Return(dockerapi.DockerContainerMetadata{DockerID: containerID + \":\" + sleepContainer.Name}),\n\t)\n\n\taddTaskToEngine(t, ctx, taskEngine, sleepTask, mockTime, &containerEventsWG)\n\ttaskARNByIP, ok := taskEngine.(*DockerTaskEngine).state.GetTaskByIPAddress(taskIP)\n\tassert.True(t, ok)\n\tassert.Equal(t, sleepTask.Arn, taskARNByIP)\n\tcleanup := make(chan time.Time, 1)\n\tmockTime.EXPECT().After(gomock.Any()).Return(cleanup).AnyTimes()\n\tclient.EXPECT().InspectContainer(gomock.Any(), gomock.Any(), gomock.Any()).Return(\n\t\t&types.ContainerJSON{\n\t\t\tContainerJSONBase: &types.ContainerJSONBase{\n\t\t\t\tID: containerID,\n\t\t\t\tState: &types.ContainerState{Pid: 23},\n\t\t\t\tHostConfig: &dockercontainer.HostConfig{\n\t\t\t\t\tNetworkMode: containerNetNS,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil)\n\tmockCNIClient.EXPECT().CleanupNS(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)\n\tclient.EXPECT().StopContainer(gomock.Any(), containerID+\":\"+pauseContainer.Name, gomock.Any()).MinTimes(1)\n\tmockCNIClient.EXPECT().ReleaseIPResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).MaxTimes(1)\n\n\t// Simulate a container stop event from docker\n\teventStream <- dockerapi.DockerContainerChangeEvent{\n\t\tStatus: apicontainerstatus.ContainerStopped,\n\t\tDockerContainerMetadata: dockerapi.DockerContainerMetadata{\n\t\t\tDockerID: containerID + \":\" + sleepContainer.Name,\n\t\t\tExitCode: aws.Int(exitCode),\n\t\t},\n\t}\n\twaitForStopEvents(t, taskEngine.StateChangeEvents(), true, false)\n}", "title": "" }, { "docid": "4487566cb34b0ccb81917cd308db713f", "score": "0.43063918", "text": "func WaitForReady() {\n\tinstance.WaitForReady()\n}", "title": "" }, { "docid": "5c2710e5903e9226ba766201c6261b19", "score": "0.43036383", "text": "func (cmgr clientMgr) WaitForResourceReplicas(timeoutSecs int, ns, name, replicas string, gvr schema.GroupVersionResource) (bool, error) {\n\tvar condFunc ConditionFunction = func(event watch.Event, obj *unstructured.Unstructured) (bool, error) {\n\t\treadyReplicas, found, err := unstructured.NestedString(obj.Object, \"status\", \"readyReplicas\")\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif !found {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn strings.EqualFold(readyReplicas, replicas), nil\n\t}\n\treturn cmgr.WatchEventsForCondition(timeoutSecs, ns, name, gvr, condFunc)\n}", "title": "" }, { "docid": "85ea1476e82eb5b095ccee2b17e53325", "score": "0.4303471", "text": "func (cloud GCECloud) waitForOp(op *compute.Operation, zone string) error {\n\top, err := cloud.service.ZoneOperations.Get(cloud.projectId, zone, op.Name).Do()\n\tfor op.Status != \"DONE\" {\n\t\ttime.Sleep(5 * time.Second)\n\t\top, err = cloud.service.ZoneOperations.Get(cloud.projectId, zone, op.Name).Do()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Got compute.Operation, err: %#v, %v\", op, err)\n\t\t}\n\t\tif op.Status != \"PENDING\" && op.Status != \"RUNNING\" && op.Status != \"DONE\" {\n\t\t\tlog.Printf(\"Error waiting for operation: %s\\n\", op)\n\t\t\treturn errors.New(fmt.Sprintf(\"Bad operation: %s\", op))\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "db76b056aea1ee0a5630ebcd1bea174c", "score": "0.43033475", "text": "func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error {\n\tp, err := c.Create(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Attempt to destroy the collector using the background context, as the\n\t// specified context may have timed out or have been cancelled.\n\tdefer p.Destroy(context.Background())\n\n\treq := types.CreateFilter{\n\t\tSpec: types.PropertyFilterSpec{\n\t\t\tObjectSet: []types.ObjectSpec{\n\t\t\t\t{\n\t\t\t\t\tObj: obj,\n\t\t\t\t},\n\t\t\t},\n\t\t\tPropSet: []types.PropertySpec{\n\t\t\t\t{\n\t\t\t\t\tPathSet: ps,\n\t\t\t\t\tType: obj.Type,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif len(ps) == 0 {\n\t\treq.Spec.PropSet[0].All = types.NewBool(true)\n\t}\n\n\terr = p.CreateFilter(ctx, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn waitLoop(ctx, p, func(_ types.ManagedObjectReference, pc []types.PropertyChange) bool {\n\t\treturn f(pc)\n\t})\n}", "title": "" }, { "docid": "db8a096a2c1b3d3509c3848d69d02f8d", "score": "0.4302003", "text": "func WaitForCondition(\n\tcs *testclient.ClientSet,\n\tmcp *mcov1.MachineConfigPool,\n\tconditionType mcov1.MachineConfigPoolConditionType,\n\tconditionStatus corev1.ConditionStatus,\n\ttimeout time.Duration,\n) error {\n\treturn wait.PollImmediate(3*time.Second, timeout, func() (bool, error) {\n\t\tmcpUpdated, err := cs.MachineConfigPools().Get(context.Background(), mcp.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tfor _, c := range mcpUpdated.Status.Conditions {\n\t\t\tif c.Type == conditionType && c.Status == conditionStatus {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n}", "title": "" }, { "docid": "fc5a5b2df46a2d58974b64cc46e1eb3a", "score": "0.43004796", "text": "func (o *OffchainAggregatorV2RoundConfirmer) Wait() error {\n\tdefer func() { o.complete = true }()\n\tfor {\n\t\tselect {\n\t\tcase <-o.doneChan:\n\t\t\to.cancel()\n\t\t\tclose(o.doneChan)\n\t\t\treturn nil\n\t\tcase <-o.context.Done():\n\t\t\treturn fmt.Errorf(\"timeout waiting for OCR round to confirm: %d\", o.roundID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c58c8d961e32d6fbf0a8c87c09fee7f2", "score": "0.4299738", "text": "func IsRelationshipOperationOnTargetNode(operationName string) bool {\n\top := strings.ToLower(operationName)\n\tif strings.Contains(op, \"pre_configure_target\") || strings.Contains(op, \"post_configure_target\") || strings.Contains(op, \"add_source\") {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4746dbe3173717a40549b9128805261c", "score": "0.42979515", "text": "func Wait(ctx context.Context, nameOrID string, condition *define.ContainerStatus) (int32, error) { // nolint\n\tvar exitCode int32\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn exitCode, err\n\t}\n\tparams := url.Values{}\n\tif condition != nil {\n\t\tparams.Set(\"condition\", condition.String())\n\t}\n\tresponse, err := conn.DoRequest(nil, http.MethodPost, \"/containers/%s/wait\", params, nameOrID)\n\tif err != nil {\n\t\treturn exitCode, err\n\t}\n\treturn exitCode, response.Process(&exitCode)\n}", "title": "" }, { "docid": "0b1f77186a2ba244096bc7b1719787a9", "score": "0.4281585", "text": "func (sr *ScheduledResource) Wait(checkInterval time.Duration, timeout time.Duration, stopChan <-chan struct{}) (bool, error) {\n\tch := make(chan error, 1)\n\tgo func(ch chan error) {\n\t\tlog.Printf(\"Waiting for %v to be created\", sr.Key())\n\t\tif isResourceFinished(sr, ch) {\n\t\t\treturn\n\t\t}\n\t\tticker := time.NewTicker(checkInterval)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-stopChan:\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tif isResourceFinished(sr, ch) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}(ch)\n\n\tselect {\n\tcase <-stopChan:\n\t\treturn true, nil\n\tcase err := <-ch:\n\t\treturn false, err\n\tcase <-time.After(timeout):\n\t\te := fmt.Errorf(\"timeout waiting for resource %s\", sr.Key())\n\t\tsr.Lock()\n\t\tdefer sr.Unlock()\n\t\tsr.Error = e\n\t\treturn false, e\n\t}\n}", "title": "" }, { "docid": "57316a6c71f155a61069afa7ea4546b3", "score": "0.4277868", "text": "func Target001DepCreate(dryRun bool) error {\n\tif err := Target007Create(dryRun); err != nil { // ref_dapil\n\t\treturn err\n\t}\n\tif err := Target001Create(dryRun); err != nil { // daftar_pemilih\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "02df4ca562b6961a3044389d913e63bf", "score": "0.4276195", "text": "func (l StorageTargetsClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageTargetsClientCreateOrUpdateResponse, error) {\n\trespType := StorageTargetsClientCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageTarget)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "title": "" }, { "docid": "f251672c7825eab0ed29817b6b51794b", "score": "0.42625993", "text": "func (m *RecordCleanerMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "title": "" }, { "docid": "05cc01bc6be0c7c1e93740de5ffc5843", "score": "0.4257128", "text": "func (p *Peer) WaitReady() {\n\t<-p.readyc\n}", "title": "" } ]
14b6332b63720eaace2be98577f4ee0b
SetTimeout adds the timeout to the post accounts account ID databases params
[ { "docid": "cd9f45282a2a44cd3cbf8f3be88bc41d", "score": "0.7785617", "text": "func (o *PostAccountsAccountIDDatabasesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
[ { "docid": "cd4deb682439e20a374c35dedfcc8eeb", "score": "0.7558005", "text": "func (o *ResellerAccountsPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cb58e695dc57b375e201b5899895694b", "score": "0.7173188", "text": "func (o *CreateAccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3b4eb54a3d3328596d8179427868d730", "score": "0.711639", "text": "func (o *AssignUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a4c1aef7737e95b5fb52e689c10f33ec", "score": "0.70623076", "text": "func (o *PostBackupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "92cc84002c5c051b3b591ca647aef674", "score": "0.70580685", "text": "func (o *PcloudTenantsSshkeysPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7cb60d11582a2cc77435fec68bd476a4", "score": "0.70270044", "text": "func (o *PostPostcardsSendPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f8ec1024466f3081f33aa0a7c354e7a9", "score": "0.70238453", "text": "func (o *SubmitDeploymentActionRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5197344741dc1fd208174d9abbff792d", "score": "0.6995856", "text": "func (o *BuilImportConfigsUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ea19ae8204e39b6d8942e2d6bc3369ab", "score": "0.6943634", "text": "func (o *PostWalletInitSeedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ee40bb48aa70af503fc7b265be2f8a7e", "score": "0.69303817", "text": "func (o *PostWebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e2a16b26512fa267887ee16708865ef7", "score": "0.69127756", "text": "func (o *GetMeDebtAccountDebtDebtIDOperationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "550f5bd7fb338b1c603ac4648f574c5c", "score": "0.69086105", "text": "func (o *PostIPAMDNSZonesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9e443a467ad92c1f69c2ff033d4fa95", "score": "0.688713", "text": "func (o *PostHardwaresParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1103e149adb27e36e237572c816e04e5", "score": "0.68644005", "text": "func (o *PostIPAMvlansParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ad401f93a66707b88c313e613e2845e5", "score": "0.68591684", "text": "func (o *PostTransactionSignParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "07a51874d6cc7e376317d0d373b90771", "score": "0.6855987", "text": "func (o *CreateDeviceUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f9e593dd2d2e49cebf472d09c9d6afdb", "score": "0.6826561", "text": "func (o *PostImportParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "658eca10354449e097c447dae39ffbdb", "score": "0.6823538", "text": "func (o *CompanyTeamRepositoryV1CreatePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6682c38e60de3d6125f900596514c06b", "score": "0.6813162", "text": "func (o *PostTokenParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f8892dcd94cfabec3fc7094f1125d924", "score": "0.6811092", "text": "func (o *CloneGerritTriggerUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3d87a3641e38553f5f187c43fd9aab81", "score": "0.6791566", "text": "func (o *PostNetworksNetworkIDTiersTierIDImagesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "edd77814e13a29739a307ab0ac377aee", "score": "0.6789199", "text": "func (o *PostTestcryptTokenApisParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bd8f5c0a2e1805ff2eab7a9ec00075e7", "score": "0.67858887", "text": "func (o *PostTrsrvSecdefParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "149517758fbfc10c095462ced3beb7cd", "score": "0.6764387", "text": "func (o *PostCheckParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2dac26fce90361721c4f17c491f84a71", "score": "0.6751562", "text": "func (o *PostLTENetworkIDEnodebsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "37bf081ec7b0a648bfbc1fdd1eead91f", "score": "0.6737416", "text": "func (o *PostAPIV3NicsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1d8473e02e00fb2d47c3a8436a82cb59", "score": "0.67302775", "text": "func (o *PostClaimsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2ecd8f46a2e3d24c4df982b54d613216", "score": "0.67218494", "text": "func (o *PostPaymentsIDRecallsRecallIDAdmissionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d76b7f7477778a12fc45d693f91d88d0", "score": "0.67076856", "text": "func (o *PostCustomersCustomerFidPaymentsPaymentFidChargebackParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cecb5aa7e20aa6df1fa003c624140335", "score": "0.6705346", "text": "func (o *ValidateImportVCentersUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "81915bb9bb5f130b1ba8defc136f38d5", "score": "0.6702433", "text": "func (o *PostDatasetUploadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e247f2c44dec9f4144be4a34000b423d", "score": "0.6701502", "text": "func (o *GetCloudAccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1b0762534e9d467ba14282c8df61af86", "score": "0.6685097", "text": "func (o *PostApplianceRestoresParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3afac7a3e23b6f34b767099f9c419d22", "score": "0.668501", "text": "func (o *MMSCampaignsSendPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0829814019b347776e524d21040b30ac", "score": "0.66817176", "text": "func (o *UpdateLcmWithAuthProviderHostUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a76cb344df383ffa58cbccfadd577951", "score": "0.6675912", "text": "func (o *CrossProductMonitervRAWithvROPSUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0ddb3d4d754a6e4302b06991ceaf380e", "score": "0.66734684", "text": "func (o *QuoteGuestCartItemRepositoryV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bf13a263d65d231ec587ecb7f7b93b72", "score": "0.66633856", "text": "func (o *ObmsPostLedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "493023511f538087cd954e2220608a2f", "score": "0.6655632", "text": "func (o *GetSwiftAccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4b4450da9c529fc3e15c004cdf848083", "score": "0.6655291", "text": "func (o *PostCustomersCustomerIDContactsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4c1c3f7d46c23f8f20cf4383e89aa35e", "score": "0.6651587", "text": "func (bc *UDPBroadcaster) SetTimeout(setting int) {\n\tbc.timeout = setting\n}", "title": "" }, { "docid": "63146391a4a2ad309288d5a978370f7b", "score": "0.66464454", "text": "func (o *LedgerPostingOpenPostOpenPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "46169b46a2103f946f56cf6f205b7eea", "score": "0.6633426", "text": "func (o *PostWorkflowBatchAPIExecutorsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b6f1839c1f04b747e3df3a41f6124e28", "score": "0.6631733", "text": "func (o *CreateAccountAccessConsentRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e1abcd403794c8c073a7c0fb5064a3ed", "score": "0.6629828", "text": "func (o *PostOauthTokenRegisterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cce74dc9e78dfb419378850b50c8afcd", "score": "0.6629275", "text": "func (o *PutLogDrainsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2aec2e2ecff4f9b2f5dafaa9fc3d6d2e", "score": "0.6620038", "text": "func (o *AddUseDomainParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "64563b56a45ef02bc345ac6acc993adf", "score": "0.6619761", "text": "func (o *StorageServiceTombstoneFailureThresholdPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b16fc6e9f4b6bbe0884314af2ca2ff5a", "score": "0.66149986", "text": "func (o *PostV1ModulesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0cf3798f0c8b1bf6d95c8bae966c7f82", "score": "0.66140854", "text": "func (o *PostSetMnemonicParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3900d2ea9395973e40f0dc0b17008e72", "score": "0.6610814", "text": "func (o *PostAPI24ProtectionGroupsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e2a4cd916b0bb8398584908661f5da17", "score": "0.6590733", "text": "func (o *InventoryStocktakingPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1df057cfc365df56b969f7a55a43fb34", "score": "0.65879554", "text": "func (o *PostContactsContactFidEmailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3b77b4b002de4efbcd0231a4f09c1838", "score": "0.658518", "text": "func (o *PostAPIV3MachinesRfqdnAliasesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c31a67de6911174d1169ccc16cbba281", "score": "0.6578884", "text": "func (o *PostImagesImageIDOperationsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "635d289012c900c1c2b7bab8db231cd1", "score": "0.65639853", "text": "func (o *PostDeviceOsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "63bba30be6878ca1f0914f71afe55108", "score": "0.65579194", "text": "func (o *PostIPAMvrfgroupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "36c2b5afb41e45fab1cea2db01506474", "score": "0.6555528", "text": "func (o *DepartmentsPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "00e44e17bc71ac78bd08cb6dc8699980", "score": "0.65554357", "text": "func (o *PostAPI24OffloadsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6979d6dab0bb77c97864e00f3f7132cf", "score": "0.65524215", "text": "func (o *PostAPIV3SwitchesFqdnPortsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9361fd15848fbbe70dfb9d00b20e42f2", "score": "0.65447724", "text": "func (o *IdentitiesUpdateAccountDetailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5214c3a345811e1e0406b8f0777b77fa", "score": "0.6536123", "text": "func (o *QuoteBillingAddressManagementV1AssignPostMineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "497a1b1a069cdfe9098a715e21319fbb", "score": "0.653244", "text": "func (o *PostV1PostMortemsReportsReportIDPublishParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1a5f310deb70ae0c1154da459892d2f1", "score": "0.65269244", "text": "func (o *DeleteCloudAccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3399242dc9e83d8da46f3a23692ba19d", "score": "0.651736", "text": "func (o *GetActivationByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c5bde0adaf2e74bba85f6ab9a9fd2733", "score": "0.64970726", "text": "func (o *PostStorageFlexFlashPhysicalDrivesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f0a7412f894c700598cf68bdeb406186", "score": "0.6482757", "text": "func (o *PostSystemFeedsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "665c3945bd26e272b1812d68b16a4ba9", "score": "0.6475722", "text": "func (o *SalesInvoiceOrderV1ExecutePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0d24874133a0b855dacd64b3e4da3456", "score": "0.6475024", "text": "func (o *PutDomainsDomainRecordsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7c55bac52f325356a7da083db973f9b5", "score": "0.6470926", "text": "func (o *PostStorageVdMemberEpsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d1cb3b04fa055c20f97f0a369df4d7e1", "score": "0.6465416", "text": "func (o *CreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a962d7db5cbca2c79244a846f11964cd", "score": "0.646442", "text": "func (o *PostOauthGenerateTokenParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8b6b96dbcead2f3f05fe089d9734657b", "score": "0.643348", "text": "func (o *PutLTENetworkIDGatewaysGatewayIDCellularDNSRecordsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6f52cf9a5ef46a31658f0f085e2c8716", "score": "0.64320177", "text": "func (o *PostCustomersCustomerFidNoteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c6da4e626d9461d95a6e19f935804fc6", "score": "0.6430007", "text": "func (o *CreateSensorTypeUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3d11f81143974f38d983e900bd119454", "score": "0.64239466", "text": "func (o *CheckoutShippingInformationManagementV1SaveAddressInformationPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bb7b9ee62f28e938e0b174ac429c503e", "score": "0.6422006", "text": "func (o *GetLhvAssociationIDMasterAccountsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b6561213cc8878c816187624962667b0", "score": "0.6420679", "text": "func (o *PostDistroXInternalV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c1354d09e38f840e1850f7bb5943eda1", "score": "0.641489", "text": "func (o *PostMeOvhAccountOvhAccountIDRetrieveMoneyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d5f54c3c8e7c70e8de830c34306725c3", "score": "0.6406994", "text": "func (o *PostLolReplaysV2MetadataByGameIDCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "789c8235e34686dfcdaf03311130b7a2", "score": "0.63996965", "text": "func (o *PostSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "107986472b5116b52fdf8a0925dbe215", "score": "0.63964677", "text": "func (o *PostLolStoreV1SkinsBySkinIDPurchaseParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6e7ba5faa40a9d75e61fe54332102f22", "score": "0.6372223", "text": "func (o *QueryUserExpGrantHistoryTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9ff4f5b00a7d513439f02ce3ca7c85cf", "score": "0.63683623", "text": "func (o *GetCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e79cefc1d5aab2d6d73a997008f39552", "score": "0.6366587", "text": "func (o *ListServiceAccountsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "85be92ff4486054167bfb8d5f0f29583", "score": "0.63646895", "text": "func (o *CreatePacketAnalyzerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e3d80386b8f20b8296d655a51d2e3367", "score": "0.636155", "text": "func (o *PostRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1b618a91163ec391434b62a53915ed6b", "score": "0.63523984", "text": "func (o *PostAPIRootDomainsUploadSubdomainsTargetNameRootDomainNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6a929f7bd0ae0f368efed8bda1ec9484", "score": "0.6343194", "text": "func (o *GetWebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9a766f1ca791af9297c8c1bcf4c6a040", "score": "0.63424593", "text": "func (o *PostAccountsAccountIDDatabasesParams) WithTimeout(timeout time.Duration) *PostAccountsAccountIDDatabasesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "0061e14d3e617d3045444587b653c891", "score": "0.63391155", "text": "func (o *CreateProvidersLdapItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b04b6d4ecac53d6dc318e9937e010813", "score": "0.63374656", "text": "func (axp *TxPool) SetTimeout(timeout time.Duration) {\n\taxp.timeout.Set(timeout)\n\taxp.ticks.SetInterval(timeout / 10)\n}", "title": "" }, { "docid": "f0c7b7f1a935c6a824a35ad77602334f", "score": "0.6336021", "text": "func (o *CreateInstanceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d069e92339a8aa769c8866cef30b0872", "score": "0.6323783", "text": "func (o *GetMeWithdrawalWithdrawalIDDetailsWithdrawalDetailIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "02ef772f69ef698cd46d45fe06a4aca7", "score": "0.6321311", "text": "func (o *PutMeAccessRestrictionTotpIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9be9251c120691ef6daa4d33fa673792", "score": "0.63191575", "text": "func (o *HintedHandoffPausePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1c205096c8f512016346d56ce8d6d896", "score": "0.63147694", "text": "func (o *CreateNsxVCloudAccountAsyncParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c8caefcf2f314b4e0e891f2a58aba49d", "score": "0.6309147", "text": "func SetTimeout(timeout int) {\n\tsendCommand(fmt.Sprintf(\"SEND TIMEOUT %d\", timeout))\n}", "title": "" }, { "docid": "fd56c649c61f3b36ad40b521500004b1", "score": "0.6305039", "text": "func (o *PostVnicFcIfsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f3c86a259177f62a51097b9bbf05a40f", "score": "0.6303497", "text": "func (o *PostUpdateCustomerContactsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
65a1f20ebe1b6b916ad58e5b2ef97273
JMESPath doesn't like json.Number so we walk the tree and replace them.
[ { "docid": "15d17734ed00355c2662c965b787d6c7", "score": "0.5298093", "text": "func clearNumbers(v interface{}) (interface{}, bool) {\n\tswitch t := v.(type) {\n\tcase map[string]interface{}:\n\t\tfor k, v := range t {\n\t\t\tif nv, ok := clearNumbers(v); ok {\n\t\t\t\tt[k] = nv\n\t\t\t}\n\t\t}\n\tcase []interface{}:\n\t\tfor i, v := range t {\n\t\t\tif nv, ok := clearNumbers(v); ok {\n\t\t\t\tt[i] = nv\n\t\t\t}\n\t\t}\n\tcase json.Number:\n\t\tf, err := t.Float64()\n\t\tif err != nil {\n\t\t\tif i, err := t.Int64(); err == nil {\n\t\t\t\treturn i, true\n\t\t\t}\n\t\t}\n\t\treturn f, true\n\t}\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "687a252ce3c69aa37daa00913bb1d04e", "score": "0.60075516", "text": "func TestModifyTreeTroughJSON(t *testing.T) {\n\tt.Run(\"modified node4 result to 100 int\", func(t *testing.T) {\n\t\tut := userTree()\n\t\tvalueBeforeModified, err := ResolveTree(ut, newUser(11, \"LUCIA\", \"SANTIAGO\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node4\", valueBeforeModified.(string))\n\t\tnewTree := []byte(`{\"nodes\":[{\"preProcessFnName\":\"CallStructMethod\",\"id\":0,\"parentId\":-1,\"preProcessFnArgs\":[{\"Value\":\"UnderAge\",\"Type\":\"string\"}]},{\"preProcessFnName\":\"CallStructMethod\",\"id\":1,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"FullName\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":true,\"Type\":\"bool\"}},{\"preProcessFnName\":\"GetStructAttribute\",\"id\":2,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"Age\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":false,\"Type\":\"bool\"}},{\"preProcessFnName\":\"\",\"id\":3,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"SANTIAGO LUCIA\",\"Type\":\"string\"},\"result\":{\"Value\":\"node3\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":4,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"LUCIA SANTIAGO\",\"Type\":\"string\"},\"result\":{\"Value\":100,\"Type\":\"int\"}},{\"preProcessFnName\":\"\",\"id\":5,\"parentId\":2,\"comparer\":{\"type\":\"lt\",\"equal\":true},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node5\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":6,\"parentId\":2,\"comparer\":{\"type\":\"gt\",\"equal\":false},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node6\",\"Type\":\"string\"}}],\"name\":\"userTree\"}`)\n\t\terr = json.Unmarshal(newTree, ut)\n\t\trequire.NoError(t, err)\n\t\tactualResult, err := ResolveTree(ut, newUser(11, \"LUCIA\", \"SANTIAGO\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, 100, actualResult.(int))\n\t})\n\tt.Run(\"modified under age node value to compare\", func(t *testing.T) {\n\t\tut := userTree()\n\t\tresultBeforeModified, err := ResolveTree(ut, newUser(33, \"SANTIAGO\", \"LUCIA\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node6\", resultBeforeModified.(string))\n\t\tnewTree := []byte(`{\"nodes\":[{\"preProcessFnName\":\"CallStructMethod\",\"id\":0,\"parentId\":-1,\"preProcessFnArgs\":[{\"Value\":\"UnderAge\",\"Type\":\"string\"}]},{\"preProcessFnName\":\"CallStructMethod\",\"id\":1,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"FullName\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":false,\"Type\":\"bool\"}},{\"preProcessFnName\":\"GetStructAttribute\",\"id\":2,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"Age\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":true,\"Type\":\"bool\"}},{\"preProcessFnName\":\"\",\"id\":3,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"SANTIAGO LUCIA\",\"Type\":\"string\"},\"result\":{\"Value\":\"node3\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":4,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"LUCIA SANTIAGO\",\"Type\":\"string\"},\"result\":{\"Value\":\"node4\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":5,\"parentId\":2,\"comparer\":{\"type\":\"lt\",\"equal\":true},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node5\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":6,\"parentId\":2,\"comparer\":{\"type\":\"gt\",\"equal\":false},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node6\",\"Type\":\"string\"}}],\"name\":\"userTree\"}`)\n\t\terr = json.Unmarshal(newTree, ut)\n\t\trequire.NoError(t, err)\n\t\tactualResult, err := ResolveTree(ut, newUser(33, \"SANTIAGO\", \"LUCIA\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node3\", actualResult.(string))\n\t})\n\tt.Run(\"modified age compare from gt to lt\", func(t *testing.T) {\n\t\tut := userTree()\n\t\tresultBeforeModified, err := ResolveTree(ut, newUser(55, \"SANTIAGO\", \"LUCIA\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node6\", resultBeforeModified.(string))\n\t\tnewTree := []byte(`{\"nodes\":[{\"preProcessFnName\":\"CallStructMethod\",\"id\":0,\"parentId\":-1,\"preProcessFnArgs\":[{\"Value\":\"UnderAge\",\"Type\":\"string\"}]},{\"preProcessFnName\":\"CallStructMethod\",\"id\":1,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"FullName\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":true,\"Type\":\"bool\"}},{\"preProcessFnName\":\"GetStructAttribute\",\"id\":2,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"Age\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":false,\"Type\":\"bool\"}},{\"preProcessFnName\":\"\",\"id\":3,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"SANTIAGO LUCIA\",\"Type\":\"string\"},\"result\":{\"Value\":\"node3\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":4,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"LUCIA SANTIAGO\",\"Type\":\"string\"},\"result\":{\"Value\":\"node4\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":5,\"parentId\":2,\"comparer\":{\"type\":\"gt\",\"equal\":false},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node5\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":6,\"parentId\":2,\"comparer\":{\"type\":\"lt\",\"equal\":true},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node6\",\"Type\":\"string\"}}],\"name\":\"userTree\"}`)\n\t\terr = json.Unmarshal(newTree, ut)\n\t\trequire.NoError(t, err)\n\t\tactualResult, err := ResolveTree(ut, newUser(55, \"SANTIAGO\", \"LUCIA\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node5\", actualResult.(string))\n\t})\n\tt.Run(\"modified Fullname pre process CallStructMethod fn to FirstName GetStructAttribute fn\", func(t *testing.T) {\n\t\tut := userTree()\n\t\tresultBeforeModified, err := ResolveTree(ut, newUser(11, \"SANTIAGO\", \"LUCIA\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node3\", resultBeforeModified.(string))\n\t\tresultBeforeModified, err = ResolveTree(ut, newUser(11, \"LUCIA\", \"SANTIAGO\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node4\", resultBeforeModified.(string))\n\t\tnewTree := []byte(`{\"nodes\":[{\"preProcessFnName\":\"CallStructMethod\",\"id\":0,\"parentId\":-1,\"preProcessFnArgs\":[{\"Value\":\"UnderAge\",\"Type\":\"string\"}]},{\"preProcessFnName\":\"GetStructAttribute\",\"id\":1,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"FirstName\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":true,\"Type\":\"bool\"}},{\"preProcessFnName\":\"GetStructAttribute\",\"id\":2,\"parentId\":0,\"preProcessFnArgs\":[{\"Value\":\"Age\",\"Type\":\"string\"}],\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":false,\"Type\":\"bool\"}},{\"preProcessFnName\":\"\",\"id\":3,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"SANTIAGO\",\"Type\":\"string\"},\"result\":{\"Value\":\"node3\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":4,\"parentId\":1,\"comparer\":{\"type\":\"eq\"},\"valueToCompare\":{\"Value\":\"LUCIA\",\"Type\":\"string\"},\"result\":{\"Value\":\"node4\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":5,\"parentId\":2,\"comparer\":{\"type\":\"lt\",\"equal\":true},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node5\",\"Type\":\"string\"}},{\"preProcessFnName\":\"\",\"id\":6,\"parentId\":2,\"comparer\":{\"type\":\"gt\",\"equal\":false},\"valueToCompare\":{\"Value\":30,\"Type\":\"int\"},\"result\":{\"Value\":\"node6\",\"Type\":\"string\"}}],\"name\":\"userTree\"}`)\n\t\terr = json.Unmarshal(newTree, ut)\n\t\trequire.NoError(t, err)\n\t\tactualResult, err := ResolveTree(ut, newUser(11, \"SANTIAGO\", \"xd\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node3\", actualResult.(string))\n\t\tactualResult, err = ResolveTree(ut, newUser(11, \"LUCIA\", \"xd\"))\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, \"node4\", actualResult.(string))\n\t})\n}", "title": "" }, { "docid": "59b7e4e972b7a531cd139bdad75a9dde", "score": "0.57912076", "text": "func fixJsonEncodingTypeConversion(point *Point) {\n\tfor i := range point.Dump {\n\t\tif point.Dump[i].Type == \"int\" {\n\t\t\t//fmt.Printf(\"type :%s\\t value: %s\\n\", reflect.TypeOf(point.Dump[i].Value).String(), point.Dump[i].value())\n\t\t\tpoint.Dump[i].Value = int(point.Dump[i].Value.(float64))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "51269ad725da7eae37a720a00c59b0d3", "score": "0.56260884", "text": "func normalizeJSONNumberType(n json.Number) int {\n\tif _, err := n.Float64(); err == nil {\n\t\treturn float64Type\n\t}\n\treturn int64Type\n}", "title": "" }, { "docid": "982b41a4eec45e8d976b48e06113e391", "score": "0.54007185", "text": "func FixUpValue(val interface{}) interface{} {\n\n\tret := val\n\tvar err error\n\n\tswitch t := val.(type) {\n\tcase json.Number:\n\t\tif strings.Index(t.String(), \".\") > -1 {\n\t\t\tret, err = t.Float64()\n\t\t} else {\n\t\t\tret, err = t.Int64()\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tret = val\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "fcab46e4776fa9ec62f983d0509e9c1f", "score": "0.5396317", "text": "func (x *Number) UnmarshalJSON(data []byte) error {\n\tstr := strings.TrimSpace(string(data))\n\tif strings.HasPrefix(str, \"{\") {\n\t\tbare := str[1 : len(str)-1]\n\t\tspl := strings.Split(bare, \":\")\n\t\tif len(spl) != 2 || strings.TrimSpace(spl[0]) != \"\\\"v\\\"\" {\n\t\t\treturn errors.New(\"wrong bn.number json format\")\n\t\t}\n\t\tstr = strings.TrimSpace(spl[1])\n\t}\n\tif x.V == nil {\n\t\tx.V = new(big.Int)\n\t}\n\tx.V.SetString(str, 10)\n\treturn nil\n}", "title": "" }, { "docid": "09832a5773136bf443fa3faa4acc5241", "score": "0.53208196", "text": "func replaceValueInTree(root *TreeNode) *TreeNode {\n firstLot := [](*TreeNode){}\n firstLot = append(firstLot, root)\n lot(firstLot)\n root.Val = 0\n return root\n}", "title": "" }, { "docid": "de2edce0faf25527e8adf7f1ab09afad", "score": "0.53067046", "text": "func (js *JSONSer) readJSONValue(collector *bytes.Buffer) error {\n\tt := js.getTerm()\n\tdefer js.putTerm(t)\n\tjs.s.Scan(t)\n\tswitch t.Term {\n\tcase erldeser.NewFloatExt:\n\t\t_, err := collector.WriteString(strconv.FormatFloat(t.FloatValue, 'g', -1, 64))\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.SmallIntegerExt:\n\t\t_, err := collector.WriteString(strconv.FormatInt(int64(t.IntegerValue), 10))\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.IntegerExt:\n\t\t_, err := collector.WriteString(strconv.FormatInt(int64(t.IntegerValue), 10))\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.AtomExt:\n\t\t_, err := collector.Write(t.Binary)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.SmallTupleExt:\n\t\tt := js.getTerm()\n\t\tdefer js.putTerm(t)\n\t\tjs.s.Scan(t)\n\t\tswitch t.Term {\n\t\tcase erldeser.ListExt:\n\t\t\t_, err := collector.WriteString(\"{\")\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// For each element in the list\n\t\t\tfor i := int64(0); i < t.IntegerValue; i++ {\n\t\t\t\terr := js.readJSONKeyValue(collector)\n\t\t\t\tif err != nil {\n\t\t\t\t\tslog.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif i < t.IntegerValue-1 {\n\t\t\t\t\t_, err = collector.WriteString(\",\")\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tslog.Error(err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// We have extra nil at the end of the list?\n\t\t\tt := js.getTerm()\n\t\t\tdefer js.putTerm(t)\n\t\t\tjs.s.Scan(t)\n\t\t\tif t.Term != erldeser.NilExt {\n\t\t\t\terr = fmt.Errorf(\"Erlang serialised list should end with extra nil, but ends with %v\", t.Term)\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = collector.WriteString(\"}\")\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\tcase erldeser.NilExt:\n\t\t\t_, err := collector.WriteString(\"{}\")\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\tslog.Debug(collector.String())\n\t\t\terr := fmt.Errorf(\"Erlang serialised JSON object should start as tuple containing list, we got %v\", t.Term)\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.NilExt:\n\t\t_, err := collector.WriteString(\"null\")\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.StringExt:\n\t\t// Actually array of small integers!!\n\t\t_, err := collector.WriteString(\"[\")\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\tl := len(t.Binary)\n\t\tfor i := 0; i < l; i++ {\n\t\t\t_, err = collector.WriteString(strconv.FormatInt(int64(t.Binary[i]), 10))\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif i < l-1 {\n\t\t\t\t_, err = collector.WriteString(\",\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tslog.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_, err = collector.WriteString(\"]\")\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.SmallBigExt:\n\t\t_, err := collector.WriteString(strconv.FormatInt(int64(t.IntegerValue), 10))\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.ListExt:\n\t\t_, err := collector.WriteString(\"[\")\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\tfor i := int64(0); i < t.IntegerValue; i++ {\n\t\t\terr = js.readJSONValue(collector)\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif i < t.IntegerValue-1 {\n\t\t\t\t_, err = collector.WriteString(\",\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tslog.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tt := js.getTerm()\n\t\tdefer js.putTerm(t)\n\t\tjs.s.Scan(t)\n\t\tif t.Term != erldeser.NilExt {\n\t\t\terr = fmt.Errorf(\"Erlang serialised list should end with extra nil, but ends with %v\", t.Term)\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\t_, err = collector.WriteString(\"]\")\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\tcase erldeser.BinaryExt:\n\t\tbin := string(t.Binary)\n\t\tquoted := strconv.Quote(bin)\n\t\tif !validate_str(quoted) {\n\t\t\tlog.Info(fmt.Sprintf(\"String contains invalid characters: %v.\", quoted))\n\t\t\tvar err error\n\t\t\tquoted, err = sanitize(quoted)\n\t\t\tif err != nil {\n\t\t\t\tslog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Info(fmt.Sprintf(\"Sanitization result: %v.\", quoted))\n\t\t}\n\n\t\t_, err := collector.WriteString(quoted)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\terr := fmt.Errorf(\"Don't know how to turn type %v into JSON value\", t.Term)\n\t\tslog.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "965c36e96c382a901e5302357eec2971", "score": "0.51532614", "text": "func marshalNumJson(r json.RawMessage) (NumJson, error) {\n\tvar i int\n\tvar s string\n\tvar arr []json.RawMessage\n\tvar obj map[string]json.RawMessage\n\tbadInputError := fmt.Errorf(\"non NumJson input\")\n\n\t// NumJson is a union type, so we try to unmarshal it to each subtype\n\tif err := json.Unmarshal(r, &i); err == nil {\n\t\treturn Num(i), nil\n\t} else if err = json.Unmarshal(r, &s); err == nil {\n\t\treturn String(s), nil\n\t} else if err = json.Unmarshal(r, &arr); err == nil {\n\t\tvar njArray []NumJson\n\t\tfor _, rawNumJson := range arr {\n\t\t\tmarshalledJson, err := marshalNumJson(rawNumJson)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\tnjArray = append(njArray, marshalledJson)\n\t\t\t}\n\t\t}\n\t\treturn Array(njArray), nil\n\t} else if err := json.Unmarshal(r, &obj); err == nil {\n\t\trawPayload := obj[\"payload\"]\n\t\tdelete(obj, \"payload\")\n\t\tif rawPayload == nil {\n\t\t\treturn nil, badInputError\n\t\t}\n\t\tmarshalledPayloadJson, err := marshalNumJson(rawPayload)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn Obj{\n\t\t\tPayload: marshalledPayloadJson,\n\t\t\tOther: obj,\n\t\t}, nil\n\t} else {\n\t\t// if we cannot unmarshal the json, it's not a valid numJson\n\t\treturn nil, badInputError\n\t}\n}", "title": "" }, { "docid": "16e91b6fe6a0e060464505fb04912701", "score": "0.5056828", "text": "func mxj2sjsonPath(p string) string {\n\treturn mxj2sjsonPathRe1.ReplaceAllString(\n\t\tmxj2sjsonPathRe2.ReplaceAllString(p, \".Value\"), \".$1\")\n}", "title": "" }, { "docid": "353b9cebcb6cb446997bc23e6c1f9e6c", "score": "0.5044002", "text": "func decodeRaw(jsVal *js.Object, refVal reflect.Value) error {\n\tswitch refVal.Kind() {\n\tcase reflect.Int:\n\t\trefVal.Set(reflect.ValueOf(jsVal.Int()))\n\tcase reflect.Int8:\n\t\trefVal.Set(reflect.ValueOf(int8(jsVal.Int())))\n\tcase reflect.Int16:\n\t\trefVal.Set(reflect.ValueOf(int16(jsVal.Int())))\n\tcase reflect.Int32:\n\t\trefVal.Set(reflect.ValueOf(int32(jsVal.Int())))\n\tcase reflect.Int64:\n\t\trefVal.Set(reflect.ValueOf(jsVal.Int64()))\n\tcase reflect.Uint:\n\t\trefVal.Set(reflect.ValueOf(uint(jsVal.Uint64())))\n\tcase reflect.Uint8:\n\t\trefVal.Set(reflect.ValueOf(uint8(jsVal.Uint64())))\n\tcase reflect.Uint16:\n\t\trefVal.Set(reflect.ValueOf(uint16(jsVal.Uint64())))\n\tcase reflect.Uint32:\n\t\trefVal.Set(reflect.ValueOf(uint32(jsVal.Uint64())))\n\tcase reflect.Uint64:\n\t\trefVal.Set(reflect.ValueOf(jsVal.Uint64()))\n\tcase reflect.Float32:\n\t\trefVal.Set(reflect.ValueOf(float32(jsVal.Float())))\n\tcase reflect.Float64:\n\t\trefVal.Set(reflect.ValueOf(jsVal.Float()))\n\tcase reflect.String:\n\t\trefVal.Set(reflect.ValueOf(jsVal.String()))\n\tcase reflect.Bool:\n\t\trefVal.Set(reflect.ValueOf(jsVal.Bool()))\n\tcase reflect.Interface:\n\t\tswitch refVal.Type() {\n\t\tcase typeOfElement:\n\t\t\trefVal.Set(reflect.ValueOf(WrapJSElement(jsVal)))\n\t\tdefault:\n\t\t\trefVal.Set(reflect.ValueOf(jsVal.Interface()))\n\t\t}\n\tcase reflect.Slice:\n\t\tlength := jsVal.Length()\n\t\tslice := reflect.MakeSlice(refVal.Type(), length, length)\n\t\tfor i := 0; i < length; i++ {\n\t\t\tdecodeRaw(jsVal.Index(i), slice.Index(i))\n\t\t}\n\n\t\trefVal.Set(slice)\n\tcase reflect.Struct:\n\t\tswitch refVal.Interface().(type) {\n\t\tcase time.Time:\n\t\t\ttimeMs := jsVal.Int64()\n\t\t\trefVal.Set(reflect.ValueOf(time.Unix(timeMs/1000, (timeMs%1000)*1000000)))\n\t\tdefault:\n\t\t\treturn decodeStruct(jsVal, refVal)\n\t\t}\n\tcase reflect.Ptr:\n\t\tswitch refVal.Interface().(type) {\n\t\tcase *js.Object:\n\t\t\trefVal.Set(reflect.ValueOf(jsVal))\n\t\tdefault:\n\t\t\trefVal.Set(reflect.New(refVal.Type().Elem()))\n\t\t\treturn decodeRaw(jsVal, refVal.Elem())\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"Do not know how to deal with kind %v while decoding data for field %v\", refVal.Kind(), refVal.Type().Name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd18230fda7ad2516b27f19564961e51", "score": "0.50412405", "text": "func unmarshalJSON(i *big.Int, bz []byte) error {\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err == nil {\n\t\treturn unmarshalText(i, text)\n\t}\n\n\t// backward compatibility for old big int.\n\tnum := big.NewInt(0)\n\terr = json.Unmarshal(bz, &num)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn unmarshalText(i, num.String())\n}", "title": "" }, { "docid": "f769130b28f89f9daaa776197fbeefd7", "score": "0.49904108", "text": "func (s *State) UseJSONNumber(b bool) {\n\ts.useJSONNumber = b\n}", "title": "" }, { "docid": "8e97bbf4ded09c3f30a83b48f14a866c", "score": "0.49873266", "text": "func TestGetNumberWrongType(t *testing.T) {\n\ttestData, _ := ezjson.DecodeString(testDataString)\n\t_, err := ezjson.GetNumber(testData, \"data\", \"subData\", \"array\", 0, \"str\")\n\tif err == nil {\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "6073b16ba3bf42448d4f9742d2ec81a7", "score": "0.49638084", "text": "func jsonSchemeTransformJSONPathToYamlPath(path string) string {\n\t// root -> $\n\tpath = strings.Replace(path, \"(root)\", \"$\", 1)\n\n\t// array index .1 -> [1]\n\tre := regexp.MustCompile(`\\.([0-9]+)(\\.|$)`)\n\tpath = re.ReplaceAllString(path, \"[${1}]${2}\")\n\n\treturn path\n}", "title": "" }, { "docid": "919c35f0a5c9ef015de0cc7dd2a2cbd5", "score": "0.49467984", "text": "func (jsn *JSON) IsNumber() bool {\n\tif !jsn.isPrimitive {\n\t\treturn false\n\t}\n\tswitch jsn.kind {\n\tcase reflect.Float64,\n\t\treflect.Float32,\n\t\treflect.Uint,\n\t\treflect.Uint8,\n\t\treflect.Uint16,\n\t\treflect.Uint32,\n\t\treflect.Uint64,\n\t\treflect.Int,\n\t\treflect.Int8,\n\t\treflect.Int16,\n\t\treflect.Int32,\n\t\treflect.Int64:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "523e1d4d71802aba174753e3ea03d34f", "score": "0.49238914", "text": "func RewriteJSONTag(file string, omitempty bool, convert func(old string) string) (string, error) {\n\tfset := token.NewFileSet()\n\troot, err := parser.ParseFile(fset, file, nil, parser.ParseComments)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"call ParseFile() error\")\n\t}\n\tre := regexp.MustCompile(`json:\"(.*?)\"`)\n\tastutil.Apply(root, func(cursor *astutil.Cursor) bool {\n\t\treturn true\n\t}, func(cursor *astutil.Cursor) bool {\n\t\tstructSpec, ok := cursor.Node().(*ast.StructType)\n\t\tif !ok {\n\t\t\treturn true\n\t\t}\n\t\tfor _, field := range structSpec.Fields.List {\n\t\t\tif field.Names == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfname := field.Names[0].Name\n\t\t\tif !isExport(fname) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttag := convert(field.Names[0].Name)\n\t\t\tif omitempty {\n\t\t\t\ttag += \",omitempty\"\n\t\t\t}\n\t\t\ttag = fmt.Sprintf(`json:\"%s\"`, tag)\n\t\t\tif field.Tag != nil {\n\t\t\t\tif re.MatchString(field.Tag.Value) {\n\t\t\t\t\tif extractJsonPropName(field.Tag.Value) != \"-\" {\n\t\t\t\t\t\tfield.Tag.Value = re.ReplaceAllLiteralString(field.Tag.Value, tag)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlastindex := strings.LastIndex(field.Tag.Value, \"`\")\n\t\t\t\t\tif lastindex < 0 {\n\t\t\t\t\t\tpanic(errors.New(\"call LastIndex() error\"))\n\t\t\t\t\t}\n\t\t\t\t\tfield.Tag.Value = field.Tag.Value[:lastindex] + fmt.Sprintf(\" %s`\", tag)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfield.Tag = &ast.BasicLit{\n\t\t\t\t\tKind: token.STRING,\n\t\t\t\t\tValue: fmt.Sprintf(\"`%s`\", tag),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\tbuf := &bytes.Buffer{}\n\terr = format.Node(buf, fset, root)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error formatting new code: %w\", err)\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "778d1c869b0954d3546351801867e6a1", "score": "0.49140128", "text": "func replaceRefs(jsonData interface{}, old, new string) interface{} {\n\tswitch jsonData.(type) {\n\tcase map[string]interface{}:\n\t\tres := make(map[string]interface{})\n\t\tfor k, v := range jsonData.(map[string]interface{}) {\n\t\t\tif k == \"$ref\" { // if schema has $ref\n\t\t\t\treturn map[string]interface{}{ // we do not need any other fields there\n\t\t\t\t\t\"$ref\": strings.Replace(v.(string), old, new, 1),\n\t\t\t\t}\n\t\t\t}\n\t\t\tres[k] = replaceRefs(v, old, new)\n\t\t}\n\t\treturn res\n\tcase []interface{}:\n\t\tres := make([]interface{}, 0)\n\t\tfor _, v := range jsonData.([]interface{}) {\n\t\t\tres = append(res, replaceRefs(v, old, new))\n\t\t}\n\t\treturn res\n\tdefault:\n\t}\n\treturn jsonData\n}", "title": "" }, { "docid": "d9ad136d216b056b6ec73b121f970467", "score": "0.48906228", "text": "func (dvd DefaultValueDecoders) JSONNumberDecodeValue(dc DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {\n\tif !val.CanSet() || val.Type() != tJSONNumber {\n\t\treturn ValueDecoderError{Name: \"JSONNumberDecodeValue\", Types: []reflect.Type{tJSONNumber}, Received: val}\n\t}\n\n\tswitch vrType := vr.Type(); vrType {\n\tcase bsontype.Double:\n\t\tf64, err := vr.ReadDouble()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval.Set(reflect.ValueOf(json.Number(strconv.FormatFloat(f64, 'f', -1, 64))))\n\tcase bsontype.Int32:\n\t\ti32, err := vr.ReadInt32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval.Set(reflect.ValueOf(json.Number(strconv.FormatInt(int64(i32), 10))))\n\tcase bsontype.Int64:\n\t\ti64, err := vr.ReadInt64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval.Set(reflect.ValueOf(json.Number(strconv.FormatInt(i64, 10))))\n\tcase bsontype.Null:\n\t\tif err := vr.ReadNull(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval.SetString(\"\")\n\tdefault:\n\t\treturn fmt.Errorf(\"cannot decode %v into a json.Number\", vrType)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1a8923d5be75db36ad116b2e2bb5cc2f", "score": "0.48497978", "text": "func unmarshalJSON(i *big.Int, bz []byte) error {\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn i.UnmarshalText([]byte(text))\n}", "title": "" }, { "docid": "28fda1fdcbca9b18b8523436e1cf943b", "score": "0.4849458", "text": "func (n *Number) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn &json.InvalidUnmarshalError{\n\t\t\tType: reflect.TypeOf(*n),\n\t\t}\n\t}\n\n\tvar f float64\n\tvar err error\n\tvar errVal string\n\tswitch data[0] {\n\tcase '\"': // Strings\n\t\tif f, err = strconv.ParseFloat(string(data[1:len(data)-1]), 64); err != nil {\n\t\t\terrVal = fmt.Sprintf(\"string %s\", data)\n\t\t}\n\tcase '[': // Arrays\n\t\terrVal = fmt.Sprintf(\"array %s\", data)\n\tcase 't', 'f': // Booleans\n\t\terrVal = fmt.Sprintf(\"boolean %s\", data)\n\tdefault: // Objects and numbers\n\t\tif err = json.Unmarshal(data, &f); err != nil {\n\t\t\terrVal = fmt.Sprintf(\"object %s\", data)\n\t\t}\n\t}\n\tif errVal != \"\" {\n\t\treturn &json.UnmarshalTypeError{\n\t\t\tValue: errVal,\n\t\t\tType: reflect.TypeOf(*n),\n\t\t}\n\t}\n\t*n = Number(f)\n\treturn nil\n}", "title": "" }, { "docid": "6e9ecd5c4753216c1fc694c2430e2fab", "score": "0.48482236", "text": "func (data JSONObject) SetNumber(key string, val float64) bool {\n\tif math.IsNaN(val) {\n\t\treturn false\n\t}\n\n\tdata[key] = val\n\treturn true\n}", "title": "" }, { "docid": "3ecc3689c8fafa1f1422f47b37a71457", "score": "0.48477456", "text": "func (l *jsonParser) parseValue(level int, parent *JsonNode) error {\n\tif l.parserOffset >= len(l.tokens) {\n\t\treturn parserError\n\t}\n\ttoken := l.tokens[l.parserOffset]\n\tswitch token.t {\n\tcase Boolean, NULL:\n\t\tchildNode := NewValueNode(token.v, level+1)\n\t\t_ = parent.Append(childNode)\n\t\tl.parserOffset++\n\tcase NUMBER, STRING:\n\t\tchildNode := newOriginalValueNode(token.originalValue, token.v, level+1)\n\t\t_ = parent.Append(childNode)\n\t\tl.parserOffset++\n\tcase StartObj:\n\t\tchildNode, err := l.parserObj(level + 1)\n\t\tif err != nil {\n\t\t\treturn parserError\n\t\t}\n\t\t_ = parent.Append(childNode)\n\tcase StartArray:\n\t\tchildNode, err := l.parserArray(level + 1)\n\t\tif err != nil {\n\t\t\treturn parserError\n\t\t}\n\t\t_ = parent.Append(childNode)\n\tdefault:\n\t\treturn parserError\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9e8937ba4c30c5803976674c39791a1", "score": "0.48327062", "text": "func JSONPatch(codec runtime.Codec, dst runtime.Object, fragment string) (runtime.Object, error) {\n\ttarget, err := runtime.Encode(codec, dst)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpatch, err := jsonpatch.DecodePatch([]byte(fragment))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpatched, err := patch.Apply(target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout, err := runtime.Decode(codec, patched)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "849924780eff811dd128de7475c1e915", "score": "0.48262414", "text": "func TestAJSONPatch(t *testing.T) {\n\n\toriginal := []byte(`{\"experiment\": {\"name\": \"John\", \"age\": 24, \"height\": 3.21}}`)\n\tpatchJSON := []byte(`[\n\t\t {\"op\": \"replace\", \"path\": \"/experiment/name\", \"value\": \"Jane\"},\n\t\t\t\t{\"op\": \"remove\", \"path\": \"/experiment/height\"}\n\t\t\t\t\t]`)\n\n\tpatch, errGo := jsonpatch.DecodePatch(patchJSON)\n\tif errGo != nil {\n\t\tt.Fatal(kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime()))\n\t}\n\n\tmodified, errGo := patch.Apply(original)\n\tif errGo != nil {\n\t\tt.Fatal(kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime()))\n\t}\n\n\texpected := `{\"experiment\":{\"age\":24,\"name\":\"Jane\"}}`\n\tif diff := deep.Equal(expected, string(modified)); diff != nil {\n\t\tt.Fatal(kv.NewError(\"JSON Patch RFC 6902 Test failed\").With(\"diff\", diff, \"stack\", stack.Trace().TrimRuntime()))\n\t}\n}", "title": "" }, { "docid": "20163b624cba2d1b96e24488c6620de8", "score": "0.4821934", "text": "func (s Data) Number(dotPath string) (Number, error) {\n\tvalue := s.Value(dotPath)\n\tif value == nil {\n\t\treturn 0, MissingFieldError(dotPath)\n\t}\n\n\tswitch val := value.(type) {\n\tcase float64:\n\t\treturn Number(val), nil\n\tcase string:\n\t\tf, err := strconv.ParseFloat(val, 64)\n\t\tif err != nil {\n\t\t\treturn 0, NewTypeError(dotPath, \"Number\", value)\n\t\t}\n\t\treturn Number(f), nil\n\tdefault:\n\t\treturn 0, NewTypeError(dotPath, \"Number\", value)\n\t}\n}", "title": "" }, { "docid": "4d3c100662ce653d52802c9561ced1e7", "score": "0.48163283", "text": "func readNumber(data *JsonValue) error {\n\tvar b [32]byte\n\tsl := b[:0]\n\tsimple := true\nL:\n\tfor {\n\t\tif data.buffer.err != nil {\n\t\t\tif data.buffer.err == io.EOF {\n\t\t\t\tbreak L\n\t\t\t}\n\t\t\tdata.Status = Incomplete\n\t\t\treturn data.buffer.err\n\t\t}\n\t\tswitch data.buffer.curr {\n\t\tcase '+', '.', 'e', 'E':\n\t\t\tsimple = false\n\t\t\tfallthrough\n\t\tcase '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\t\tsl = append(sl, data.buffer.curr)\n\t\t\t_ = feedq(data.buffer) && feed(data.buffer)\n\t\t\tnext(data.buffer)\n\t\tdefault:\n\t\t\tbreak L\n\t\t}\n\t}\n\tif simple && len(sl) < 19 {\n\t\treturn readInt(data, sl)\n\t}\n\t// strconv.ParseFloat takes a string, but we only have a []byte.\n\t// Converting to string requires a new alloc and a copy, plus an escape\n\t// to heap for the underlying array. This line does an unsafe cast and\n\t// sidesteps escape analysis, avoiding those expensive extra steps.\n\tf, err := strconv.ParseFloat(*(*string)(noescape(unsafe.Pointer(&sl))), 64)\n\tif err != nil {\n\t\tdata.Status = Incomplete\n\t\treturn err\n\t}\n\tdata.numval = f\n\tdata.Status = Complete\n\tdata.buffer.depth--\n\treturn nil\n}", "title": "" }, { "docid": "c4d29f158c30196d54b1372f0d18e27a", "score": "0.48060653", "text": "func (rustJSON JSON) ConvertToFastenJson(rawTypeHierarchy TypeHierarchy, stdTypeHierarchy MapTypeHierarchy, pkg string) (fasten.JSON, error) {\n\tvar jsons = make(map[string]*fasten.JSON)\n\tvar methods = make(map[int64]string)\n\tvar edgeMap = make(map[int64][]int64)\n\n\ttypeHierarchy := rawTypeHierarchy.ConvertToMap()\n\n\tfor _, node := range append(rustJSON.Functions, rustJSON.Macros...) {\n\t\tif _, ok := jsons[node.CrateName]; !ok {\n\t\t\tvar version string\n\t\t\tif node.PackageVersion == \"\" {\n\t\t\t\tversion = \"0.0.0\"\n\t\t\t} else {\n\t\t\t\tversion = node.PackageVersion\n\t\t\t}\n\t\t\tjsons[node.CrateName] = &fasten.JSON{\n\t\t\t\tProduct: node.CrateName,\n\t\t\t\tForge: \"cratesio\",\n\t\t\t\tGenerator: \"rust-callgraphs\",\n\t\t\t\tDepset: [][]fasten.Dependency{},\n\t\t\t\tVersion: version,\n\t\t\t\tCha: map[string]fasten.Type{},\n\t\t\t\tGraph: fasten.CallGraph{\n\t\t\t\t\tInternalCalls: make([][]int64, 0),\n\t\t\t\t\tExternalCalls: make([][]interface{}, 0),\n\t\t\t\t},\n\t\t\t\tTimestamp: -1,\n\t\t\t\tDuplicateCHA: make(map[string]int64),\n\t\t\t\tDuplicateInternalCall: make(map[int64]map[int64]struct{}),\n\t\t\t\tDuplicateExternalCall: make(map[int64]map[string]struct{}),\n\t\t\t}\n\t\t}\n\t\tid := addMethodToCHA(jsons, node, typeHierarchy)\n\t\tedgeMap[node.Id] = id\n\t\tmethods[node.Id] = node.CrateName\n\t}\n\n\tfor _, edge := range rustJSON.FunctionCalls {\n\t\trustJSON.addCallToGraph(jsons, methods, edge, typeHierarchy, stdTypeHierarchy, edgeMap)\n\t}\n\n\tpkgCrate := strings.Split(pkg, \"/\")[1]\n\tpkgCrate = strings.ReplaceAll(pkgCrate, \"-\", \"_\")\n\tresult := jsons[pkgCrate]\n\tif result != nil {\n\t\tresolveTimestamp(result)\n\t\treturn *result, nil\n\t}\n\n\treturn fasten.JSON{}, nil\n}", "title": "" }, { "docid": "e38e8d68d7381b049ca4ab71fda773a3", "score": "0.4799519", "text": "func convertNumber(n json.Number) (interface{}, error) {\n\t// Attempt to convert to an int64 first\n\tif i, err := n.Int64(); err == nil {\n\t\treturn i, nil\n\t}\n\t// Return a float64 (default json.Decode() behavior)\n\t// An overflow will return an error\n\treturn n.Float64()\n}", "title": "" }, { "docid": "c315efab6eabe814ee339a5fe7fe4e9f", "score": "0.47421345", "text": "func (j *Json) SetPath(branch []string, val interface{}) error {\n\tif len(branch) == 0 {\n\t\tj.data = val\n\t\treturn nil\n\t}\n\n\t// in order to insert our branch, we need map[string]interface{}\n\tif _, ok := (j.data).(map[string]interface{}); !ok {\n\t\t// have to replace with something suitable\n\t\tj.data = make(map[string]interface{})\n\t}\n\tcurr := j.data.(map[string]interface{})\n\n\tfor i := 0; i < len(branch)-1; i++ {\n\t\tb := branch[i]\n\t\t// key exists?\n\t\tif _, ok := curr[b]; !ok {\n\t\t\tn := make(map[string]interface{})\n\t\t\tcurr[b] = n\n\t\t\tcurr = n\n\t\t\tcontinue\n\t\t}\n\n\t\t// make sure the value is the right sort of thing\n\t\tif _, ok := curr[b].(map[string]interface{}); !ok {\n\t\t\t// have to replace with something suitable\n\t\t\tn := make(map[string]interface{})\n\t\t\tcurr[b] = n\n\t\t}\n\n\t\tcurr = curr[b].(map[string]interface{})\n\t}\n\n\t// add remaining k/v\n\tcurr[branch[len(branch)-1]] = val\n\treturn nil\n}", "title": "" }, { "docid": "0bfa2e70d933a6fb321138165263221b", "score": "0.4710016", "text": "func (suite *TestQuerySuite) TestPurifyNumberArrayOfJson(c *C) {\n\t// Asserts the nil value\n\tc.Assert(purifyNumberArrayOfJson(nil, utils.TypeOfUint8).([]uint8), DeepEquals, []uint8{})\n\n\ttestCases := []*struct {\n\t\tjsonSource string\n\t\ttargetType reflect.Type\n\t\texpectedResult interface{}\n\t}{\n\t\t{\n\t\t\t\"null\",\n\t\t\tutils.TypeOfInt8,\n\t\t\t[]int8{},\n\t\t},\n\t\t{\n\t\t\t`[ 38, 29, 40, 38, 29 ]`,\n\t\t\tutils.TypeOfInt8,\n\t\t\t[]int8{29, 38, 40},\n\t\t},\n\t\t{\n\t\t\t`[ 78781, 10981, 78781 ]`,\n\t\t\tutils.TypeOfUint64,\n\t\t\t[]uint64{10981, 78781},\n\t\t},\n\t}\n\n\tfor i, testCase := range testCases {\n\t\tcomment := Commentf(\"Test Case: %d\", i+1)\n\n\t\ttestedResult := purifyNumberArrayOfJson(\n\t\t\tojson.UnmarshalToJson(testCase.jsonSource),\n\t\t\ttestCase.targetType,\n\t\t)\n\t\tc.Assert(testedResult, DeepEquals, testCase.expectedResult, comment)\n\t}\n}", "title": "" }, { "docid": "aee6c29d6443747109a4a311a1ecb29d", "score": "0.47009876", "text": "func closeNumber(data *JsonValue) error {\n\tfor {\n\t\tif data.buffer.err != nil {\n\t\t\tif data.buffer.err == io.EOF {\n\t\t\t\tdata.Status = Incomplete\n\t\t\t\tdata.buffer.depth--\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdata.Status = Incomplete\n\t\t\treturn data.buffer.err\n\t\t}\n\t\ti := data.buffer.offs - 1\n\t\tfor i < data.buffer.erroffs {\n\t\t\tswitch data.buffer.data[i] {\n\t\t\tcase '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '+', '-', 'e', 'E':\n\t\t\t\ti++\n\t\t\tdefault:\n\t\t\t\tdata.buffer.offs = i\n\t\t\t\t_ = feedq(data.buffer) && feed(data.buffer)\n\t\t\t\tnext(data.buffer)\n\t\t\t\tdata.Status = Incomplete\n\t\t\t\tdata.buffer.depth--\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tdata.buffer.offs = data.buffer.erroffs\n\t\t_ = feedq(data.buffer) && feed(data.buffer)\n\t\tnext(data.buffer)\n\t}\n}", "title": "" }, { "docid": "f3df2372804a5bcc34b6ad2b471bccfb", "score": "0.46502888", "text": "func (n *MaybeNumber) UnmarshalJSON(d []byte) error {\n\td = bytes.Trim(d, `\"`)\n\tif string(d) == \"\" {\n\t\td = []byte(\"0\")\n\t}\n\tn.Number = json.Number(d)\n\treturn nil\n}", "title": "" }, { "docid": "a4cde40db25ce9eff3f15ef62ceed712", "score": "0.46267143", "text": "func (n nomadJsonEncodingExtensions) UpdateExt(_ interface{}, _ interface{}) {}", "title": "" }, { "docid": "25a018d9bd9b90e42460678b4346e915", "score": "0.46265027", "text": "func IsJSONNumber(b []byte) bool {\n\tb = trim(b)\n\tif len(b) == 0 {\n\t\treturn false\n\t}\n\n\tif b[0] == '-' {\n\t\treturn isPositiveNumber(b[1:])\n\t}\n\n\treturn isPositiveNumber(b[:])\n}", "title": "" }, { "docid": "d117d516e774bb7837fdd2200997f88a", "score": "0.45919016", "text": "func (s JSONValueClassArray) AsJSONNumber() (to JSONNumberArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*JSONNumber)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tto = append(to, *value)\n\t}\n\n\treturn to\n}", "title": "" }, { "docid": "13c461dacb4345ebd8665bbe57ab6f70", "score": "0.45912924", "text": "func setNestedValue(key string, value interface{}, document *bson.D) {\n\tindex := strings.Index(key, \".\")\n\tif index == -1 {\n\t\t*document = append(*document, bson.DocElem{Name: key, Value: value})\n\t\treturn\n\t}\n\n\tkeyName := key[0:index]\n\tsubDocument := &bson.D{}\n\telem, err := bsonutil.FindValueByKey(keyName, document)\n\tif err != nil { // no such key in the document\n\t\telem = nil\n\t}\n\tvar existingKey bool\n\tif elem != nil {\n\t\tswitch elem.(type) {\n\t\tcase *bson.D:\n\t\t\tsubDocument = elem.(*bson.D)\n\t\tcase []interface{}:\n\t\t\tsubDocument = &bson.D{{Name: keyName, Value: elem}}\n\t\t}\n\t\texistingKey = true\n\t}\n\n\tvar finalValue interface{}\n\tfinalValue = subDocument\n\tif elemIndex, err := strconv.Atoi(strings.Split(key, \".\")[1]); err == nil && elemIndex >= 0 {\n\t\t// if the next part of the key is a positive int, treat it like an array index\n\t\tsetNestedArrayValue(key, value, subDocument) // set our nested array value\n\t\tfinalValue, _ = bsonutil.FindValueByKey(keyName, subDocument) // extract nested array value\n\t\tif existingKey { // merge the previous incarnation of the document with our new one\n\t\t\tnewDocument := bson.D{}\n\t\t\tfor _, doc := range *document { // rebuild document to merge in new DocElem and remove old one\n\t\t\t\tif doc.Name == keyName { // if we found our key, update with the new doc\n\t\t\t\t\tnewDocument = append(newDocument, bson.DocElem{Name: keyName, Value: finalValue})\n\t\t\t\t} else { // else add back to our working document\n\t\t\t\t\tnewDocument = append(newDocument, doc)\n\t\t\t\t}\n\t\t\t}\n\t\t\t*document = newDocument\n\t\t}\n\t} else {\n\t\tsetNestedValue(key[index+1:], value, subDocument)\n\t}\n\tif !existingKey {\n\t\t*document = append(*document, bson.DocElem{Name: keyName, Value: finalValue})\n\t}\n}", "title": "" }, { "docid": "966ac1496cde75740423ad11d37f67d4", "score": "0.4590059", "text": "func (m *ItemItemsItemWorkbookFunctionsReplacePostRequestBody) SetStartNum(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"startNum\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "810f55cfbfe96d8d75895bc7bb7d7c41", "score": "0.45695627", "text": "func (gc *GarbageCollector) patch(item *node, smp []byte, jmp jsonMergePatchFunc) (*metav1.PartialObjectMetadata, error) {\n\tsmpResult, err := gc.patchObject(item.identity, smp, types.StrategicMergePatchType)\n\tif err == nil {\n\t\treturn smpResult, nil\n\t}\n\tif !errors.IsUnsupportedMediaType(err) {\n\t\treturn nil, err\n\t}\n\t// StrategicMergePatch is not supported, use JSON merge patch instead\n\tpatch, err := jmp(item)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gc.patchObject(item.identity, patch, types.MergePatchType)\n}", "title": "" }, { "docid": "3a0b0fb70c1426f2fd55fdd7e8d781fa", "score": "0.45650977", "text": "func copyJSON(node jd.JsonNode) jd.JsonNode {\n\tresult, _ := jd.ReadJsonString(node.Json())\n\n\treturn result\n}", "title": "" }, { "docid": "82f4c6a11ee2cf7e83294ff108142a7c", "score": "0.45492896", "text": "func numberToTime(v json.Number) (time.Time, error) {\n\t// Using floating point math to extract the nanoseconds leads to a time that doesn't exactly match the input\n\t// Instead, parse out the components from the string representation\n\n\tvar t time.Time\n\n\t// First make sure it is a number...\n\tflt, err := v.Float64()\n\tif err != nil {\n\t\treturn t, err\n\t}\n\n\ts := v.String()\n\n\tif strings.ContainsAny(s, \"eE\") {\n\t\t// input is in scientific notation. Convert to standard decimal notation\n\t\ts = strconv.FormatFloat(flt, 'f', -1, 64)\n\t}\n\n\t// extract the seconds and nanoseconds separately\n\tvar nanos, sec int64\n\n\tparts := strings.SplitN(s, \".\", 2)\n\tsec, err = strconv.ParseInt(parts[0], 10, 64)\n\tif err != nil {\n\t\treturn t, err\n\t}\n\n\tif len(parts) == 2 {\n\t\tnanosText := parts[1] + \"000000000\"\n\t\tnanosText = nanosText[:9]\n\t\tnanos, err = strconv.ParseInt(nanosText, 10, 64)\n\t\tif err != nil {\n\t\t\treturn t, err\n\t\t}\n\t}\n\n\tt = time.Unix(sec, nanos)\n\treturn t, nil\n}", "title": "" }, { "docid": "b03354dff345279d5c37df3b51564ec5", "score": "0.45245066", "text": "func toNumber(i interface{}) (float64, error) {\n\tres, err := strconv.ParseFloat(toString(i), 64)\n\tif err != nil {\n\t\tres = 0.0\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "06ac2987cbee86ea74de695b5563e429", "score": "0.4516131", "text": "func numberType(value interface{}) int {\n\tswitch value.(type) {\n\tcase json.Number:\n\t\treturn jsonNumberType\n\tcase float64:\n\t\treturn float64Type\n\tcase int64:\n\t\treturn int64Type\n\tcase float32:\n\t\treturn float32Type\n\tcase int:\n\t\treturn intType\n\tdefault:\n\t\treturn naNType\n\t}\n}", "title": "" }, { "docid": "ac2525b0ab8f057f07638acbfba48751", "score": "0.45145515", "text": "func normalizeNumber(e *encodeState, stringBytes []byte) {\n\ts := expNormalizer.ReplaceAllString(string(stringBytes), expNormalizerReplacement)\n\n\t// detect negative sign\n\tnegative := s[0] == '-'\n\tif negative {\n\t\ts = s[1:]\n\t}\n\n\t// detect exponent\n\texp := 0\n\texpPos := strings.LastIndexByte(s, 'E')\n\tif expPos == -1 {\n\t\texpPos = len(s)\n\t} else {\n\t\tvar err error\n\t\texp, err = strconv.Atoi(s[expPos+1:])\n\t\tif err != nil {\n\t\t\te.error(err)\n\t\t}\n\t}\n\n\t// characterize the significant digits, finishing early on zero\n\tsignificantRange := significantDigits.FindStringSubmatchIndex(s)\n\tif significantRange == nil {\n\t\te.error(fmt.Errorf(\"canonicaljson: no significand in %q\", s))\n\t}\n\tsignificantRange = significantRange[2:4]\n\tif s[significantRange[0]] == '0' {\n\t\te.WriteByte('0')\n\t\treturn\n\t}\n\tpointPos := strings.IndexByte(s, '.')\n\teffectivePointPos := pointPos\n\tif effectivePointPos == -1 {\n\t\teffectivePointPos = expPos\n\t}\n\tvar significand string\n\tif pointPos > significantRange[0] && pointPos < significantRange[1] {\n\t\tsignificand = s[significantRange[0]:pointPos] + s[pointPos+1:significantRange[1]]\n\t} else {\n\t\tsignificand = s[significantRange[0]:significantRange[1]]\n\t}\n\n\t// detect integers (i.e., significand fits within exponent)\n\tisInt := (exp <= 0 && (effectivePointPos+exp) >= significantRange[1]) ||\n\t\t(exp > 0 && (effectivePointPos+exp+1) >= significantRange[1])\n\n\t// effective exponent increases/decreases by excess/deficient significand magnitude\n\tif effectivePointPos > 1 {\n\t\texp += effectivePointPos - 1\n\t} else if significantRange[0] > 0 {\n\t\texp -= significantRange[0] - 1\n\t}\n\n\t// write result\n\tif negative {\n\t\te.WriteByte('-')\n\t}\n\tif isInt {\n\t\t// integer: render without exponent\n\t\te.WriteString(significand)\n\t\tif len(significand) < exp+1 {\n\t\t\te.WriteString(strings.Repeat(\"0\", exp+1-len(significand)))\n\t\t}\n\t} else {\n\t\t// non-integer: render minimal significand with decimal point and non-empty exponent\n\t\tif len(significand) == 1 {\n\t\t\tsignificand += \"0\"\n\t\t}\n\t\te.WriteString(significand[:1] + \".\" + significand[1:] + \"E\" + strconv.Itoa(exp))\n\t}\n}", "title": "" }, { "docid": "74c909d0714feefc64f8f0b2c59f9598", "score": "0.45128503", "text": "func (m *ItemItemsItemWorkbookFunctionsReplacePostRequestBody) SetNumChars(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"numChars\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6f0371bd358de5088249f047f833c33b", "score": "0.44990918", "text": "func changeJSONTags(j string) string {\n\treturn strings.Replace(j, `\"#text\":`, `\"Value\":`, -1)\n}", "title": "" }, { "docid": "20030ae2a8d63da4d32fc000b0fd1e22", "score": "0.4493458", "text": "func setTreeIndex(classes []jClass, nodes treeNodes, i int) int {\n\tfor _, node := range nodes {\n\t\tclasses[node.index].index = i\n\t\tif len(node.subs) > 0 {\n\t\t\ti = setTreeIndex(classes, node.subs, i+1)\n\t\t} else {\n\t\t\ti++\n\t\t}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "6db889a5cc8af37fcf8f5dfaf6fdd194", "score": "0.44915333", "text": "func toJson(n *jNode) string {\n\ttmp, err := json.Marshal(n)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(tmp)\n}", "title": "" }, { "docid": "838152ce811f90186895b409c35b8a7a", "score": "0.44693875", "text": "func (gtk GenericTypeKeeper[T]) setNum(ctx sdk.Context, _num uint64) {\n\tstore := ctx.KVStore(gtk.InternalKey)\n\tvar num = types.Num{Num: _num}\n\tstore.Set([]byte(gtk.name), gtk.cdc.MustMarshal(&num))\n}", "title": "" }, { "docid": "437ec4d9bf393dff9f4522ed3ee2ac8d", "score": "0.44630533", "text": "func IsNumber(data map[string]interface{}, keypath string) error {\n\tif v, ok := m.GetOK(data, keypath); ok {\n\t\tswitch v.(type) {\n\t\tcase int, int8, int16, int32, int64,\n\t\t\tuint, uint8, uint16, uint32, uint64,\n\t\t\tfloat32, float64, complex64, complex128:\n\t\t\treturn nil\n\t\t}\n\t\treturn errNotNumber\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ddc85ee11bd69f4d8e367073f9a72a4b", "score": "0.44611222", "text": "func fixJSONArrayToObject(body []byte) []byte {\n\tnewStr := string(body)\n\tnewStr = strings.Replace(newStr, `\"tags\":[]`, `\"tags\":{}`, -1)\n\tnewStr = strings.Replace(newStr, `\"videos\":[]`, `\"videos\":{}`, -1)\n\tnewStr = strings.Replace(newStr, `\"images\":[]`, `\"images\":{}`, -1)\n\tnewStr = strings.Replace(newStr, `\"authors\":[]`, `\"authors\":{}`, -1)\n\tnewStr = strings.Replace(newStr, `\"list\":[]`, `\"list\":{}`, -1)\n\treturn []byte(newStr)\n}", "title": "" }, { "docid": "d416ec32c6a86d4ddca23d5cd33eafe1", "score": "0.4437531", "text": "func marshalJSON(i *big.Int) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "d416ec32c6a86d4ddca23d5cd33eafe1", "score": "0.4437531", "text": "func marshalJSON(i *big.Int) ([]byte, error) {\n\ttext, err := i.MarshalText()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(text))\n}", "title": "" }, { "docid": "a73d679e68317096def2a91d0ea32cd5", "score": "0.44243833", "text": "func JSON(source, path string) (found []string, err error) {\n\tif path == \"$+\" {\n\t\treturn []string{source}, nil\n\t}\n\tfound = []string{}\n\tpaths, err := jsonpath.ParsePaths(path)\n\tif err != nil {\n\t\treturn\n\t}\n\teval, err := jsonpath.EvalPathsInBytes([]byte(source), paths)\n\tif err != nil {\n\t\treturn\n\t}\n\texcnt := 0\n\tfor {\n\t\tif extract, ok := eval.Next(); ok {\n\t\t\tif eval.Error != nil {\n\t\t\t\terr = fmt.Errorf(\"failed to extract jsonpath %#v on iteration %d due to error:\\n%s\", path, excnt, err)\n\t\t\t}\n\t\t\tfound = append(found, string(extract.Value))\n\t\t\texcnt++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(found) == 0 && !strings.Contains(path, \"*\") {\n\t\terr = errors.New(\"no value extracted\")\n\t}\n\treturn found, err\n}", "title": "" }, { "docid": "8f356c96f92ac3451ee03eb61e4611e9", "score": "0.44201958", "text": "func IsNumber(v interface{}) bool {\n\tswitch v.(type) {\n\tcase json.Number:\n\t\tif _, err := v.(json.Number).Float64(); err == nil {\n\t\t\treturn true\n\t\t}\n\t\tif _, err := v.(json.Number).Int64(); err == nil {\n\t\t\treturn true\n\t\t}\n\tcase float64:\n\t\treturn true\n\tcase float32:\n\t\treturn true\n\tcase int64:\n\t\treturn true\n\tcase int:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8ddd3cd092f44819a4c8477a822e6aff", "score": "0.44003972", "text": "func (_m *Options) SetJSON(_a0 interface{}) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "0c59f4e6649211da028f086e63eb72cf", "score": "0.43923184", "text": "func Unstringify(data map[string]interface{}, v interface{}) error {\n\tt := reflect.TypeOf(v).Elem()\n\n\tval := reflect.ValueOf(v).Elem()\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\n\t\tjsonName := f.Name\n\t\tjsonTag := strings.Split(f.Tag.Get(\"json\"), \",\")\n\t\tif len(jsonTag) > 0 && jsonTag[0] != \"\" {\n\t\t\tjsonName = jsonTag[0]\n\t\t}\n\n\t\tif value, ok := data[jsonName]; ok {\n\t\t\tnewValue, err := convertType(f.Type, value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tval.FieldByName(f.Name).Set(newValue)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d6688419ab64b1b124888a25474b3e8", "score": "0.43833494", "text": "func (v *nanBig) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson1a4aeb6dDecodeGithubComKakTusNanBench(l, v)\n}", "title": "" }, { "docid": "9a0e292bddf1ba3f1698b19b3f8631ad", "score": "0.4378904", "text": "func (v *nanBig) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson1a4aeb6dDecodeGithubComKakTusNanBench(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "d59f3816592f91419cb8d628f689478b", "score": "0.4375673", "text": "func (c *PooledClient) SetJSON(\n\tctx context.Context,\n\tpath string,\n\tobj interface{},\n\tversion int32,\n) (*szk.Stat, error) {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Set(ctx, path, data, version)\n}", "title": "" }, { "docid": "40468f78bc6d9126ba51203c555b16e3", "score": "0.43754837", "text": "func normalizeNumbers(v1, v2 interface{}) (interface{}, interface{}, int) {\n\tvar (\n\t\ta, b interface{}\n\t\taType, bType, nType int\n\t)\n\taType = numberType(v1)\n\tbType = numberType(v2)\n\t// NOTE: If type is jsonNumberType then convert to float64 or int64 before normalizing\n\tif aType == jsonNumberType {\n\t\taType = normalizeJSONNumberType(v1.(json.Number))\n\t}\n\tif bType == jsonNumberType {\n\t\tbType = normalizeJSONNumberType(v2.(json.Number))\n\t}\n\tswitch {\n\tcase aType == float64Type || bType == float64Type:\n\t\ta = toType(v1, float64Type)\n\t\tb = toType(v2, float64Type)\n\t\tnType = float64Type\n\tcase aType == float32Type || bType == float32Type:\n\t\ta = toType(v1, float32Type)\n\t\tb = toType(v2, float32Type)\n\t\tnType = float32Type\n\tcase aType == int64Type || bType == int64Type:\n\t\ta = toType(v1, int64Type)\n\t\tb = toType(v2, int64Type)\n\t\tnType = int64Type\n\tdefault:\n\t\ta = toType(v1, intType)\n\t\tb = toType(v2, intType)\n\t\tnType = intType\n\t}\n\treturn a, b, nType\n}", "title": "" }, { "docid": "7d0792a60b283f4589ecba2be934ee8b", "score": "0.4374784", "text": "func (wrapper *JSONWrapper) SetValueAtPath(path string, value interface{}) {\n\twrapper.ct.SetP(value, path)\n}", "title": "" }, { "docid": "1c25621dcf1b8b27dd8c283e50a713c1", "score": "0.43698043", "text": "func ParseNumJsonFromStream(d *json.Decoder) ([]NumJson, error) {\n\tvar njArray []NumJson\n\tvar err error\n\tfor {\n\t\tvar r json.RawMessage\n\t\tif err = d.Decode(&r); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn njArray, fmt.Errorf(\"JSON decode failed. Check that your input is valid\")\n\t\t\t}\n\t\t}\n\t\tmarshalledJson, err := marshalNumJson(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnjArray = append(njArray, marshalledJson)\n\t}\n\treturn njArray, nil\n}", "title": "" }, { "docid": "e6d2106ee4b38da162701a4b7ca72658", "score": "0.43629858", "text": "func dereference(schemaPath string, input []byte, isTop bool) ([]byte, error) {\n\tif !strings.Contains(string(input), \"$ref\") {\n\t\treturn input, nil\n\t}\n\n\tvar data interface{}\n\tjson.Unmarshal([]byte(input), &data)\n\trefs, err := walkInterface(data, []string{}, []jsonRef{})\n\tif err != nil {\n\t\treturn input, fmt.Errorf(\"unable to walk interface %s: %v\", schemaPath, err)\n\t}\n\n\tfor _, ref := range refs {\n\t\ttop := data\n\t\tfor i, item := range ref.Source {\n\t\t\tif isTop && (ref.Source[0] == \"allOf\" || ref.Source[0] == \"oneOf\") {\n\t\t\t\tcontinue // do not dereference top-level allOf and oneOf\n\t\t\t}\n\t\t\tif i < len(ref.Source)-1 { // iterate\n\t\t\t\tif intKey, err := strconv.Atoi(item); err == nil {\n\t\t\t\t\ttop = top.([]interface{})[intKey]\n\t\t\t\t} else {\n\t\t\t\t\ttop = top.(map[string]interface{})[item]\n\t\t\t\t}\n\t\t\t} else { // set reference\n\t\t\t\ttargetRef, err := buildReference(schemaPath, data, ref.Target)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn input, fmt.Errorf(\"unable to build reference from %s: %v\", ref.Target, err)\n\t\t\t\t}\n\t\t\t\ttargetKeys := reflect.ValueOf(targetRef).MapKeys()\n\t\t\t\tif len(targetKeys) > 1 {\n\t\t\t\t\t// assuming integer item is slice[index] instead of map[string]\n\t\t\t\t\tif intKey, err := strconv.Atoi(item); err == nil {\n\t\t\t\t\t\ttop.([]interface{})[intKey] = targetRef\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttop.(map[string]interface{})[item] = targetRef\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// when targetRef = single KV pair, set the value using the key instead of overwriting entire map\n\t\t\t\t\tkey := targetKeys[0].Interface().(string)\n\t\t\t\t\t// assuming integer item is slice[index] instead of map[string]\n\t\t\t\t\tif intKey, err := strconv.Atoi(item); err == nil {\n\t\t\t\t\t\ttop.([]interface{})[intKey].(map[string]interface{})[key] = targetRef.(map[string]interface{})[key]\n\t\t\t\t\t\tdelete(top.([]interface{})[intKey].(map[string]interface{}), \"$ref\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttop.(map[string]interface{})[item].(map[string]interface{})[key] = targetRef.(map[string]interface{})[key]\n\t\t\t\t\t\tdelete(top.(map[string]interface{})[item].(map[string]interface{}), \"$ref\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn json.Marshal(data)\n}", "title": "" }, { "docid": "f9ca1f7c2ebe5ecf8da7f7a3bc1f622a", "score": "0.43606666", "text": "func (root *mediaRoot) readeJSON(scriptBytes []byte) error {\n\n\terr := json.Unmarshal(scriptBytes, &root)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8928ad03d0ea2677b9848982358ec6c6", "score": "0.43605253", "text": "func (mo *MO) UnmarshalInternalJSON(gpath *gnmipb.Path, j []byte) error {\n\tvar jsonTree interface{}\n\tif err := json.Unmarshal(j, &jsonTree); err != nil {\n\t\treturn err\n\t}\n\tif s := mo.FindSchemaByGNMIPath(gpath); s == nil {\n\t\treturn fmt.Errorf(\"schema not found for %s\", xpath.ToXPath(gpath))\n\t}\n\treturn unmarshalInternalJSON(nil, jsonTree, mo, gpath)\n}", "title": "" }, { "docid": "69fec98e5a0e10843bd7c80dcfe947b3", "score": "0.4359523", "text": "func (j *JSONPath) evalRecursive(input []cty.Value, node *RecursiveNode) ([]cty.Value, error) {\n\tresult := []cty.Value{}\n\tfor _, value := range input {\n\t\tresults := []cty.Value{}\n\n\t\tunmarked, _ := value.Unmark()\n\t\tif !unmarked.CanIterateElements() {\n\t\t\tcontinue\n\t\t}\n\n\t\tit := unmarked.ElementIterator()\n\t\tfor it.Next() {\n\t\t\tres := getByIter(unmarked, it)\n\t\t\tif !res.IsKnown() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresults = append(results, res)\n\t\t}\n\n\t\tif len(results) != 0 {\n\t\t\tresult = append(result, value)\n\n\t\t\toutput, err := j.evalRecursive(results, node)\n\t\t\tif len(output) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tresult = append(result, output...)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "6479a7d70f4a31974e0cbc55ec8e8eb6", "score": "0.43577135", "text": "func (n *artNode) shrink() {\n\tswitch n.kind {\n\tcase Node4:\n\t\t// From the specification: If that node now has only one child, it is replaced by its child\n\t\t// and the compressed path is adjusted.\n\t\tn4 := n.node4()\n\t\tother := n4.children[0]\n\n\t\tif !other.isLeaf() {\n\t\t\tcurrentPrefixLen := n4.prefixLen\n\n\t\t\tif currentPrefixLen < maxPrefixLen {\n\t\t\t\tn4.prefix[currentPrefixLen] = n4.keys[0]\n\t\t\t\tcurrentPrefixLen++\n\t\t\t}\n\n\t\t\tif currentPrefixLen < maxPrefixLen {\n\t\t\t\tchildPrefixLen := min(other.node().prefixLen, maxPrefixLen-currentPrefixLen)\n\t\t\t\tmemcpy(n4.prefix[currentPrefixLen:], other.node().prefix[:], childPrefixLen)\n\t\t\t\tcurrentPrefixLen += childPrefixLen\n\t\t\t}\n\n\t\t\tmemcpy(other.node().prefix[:], n4.prefix[:], min(currentPrefixLen, maxPrefixLen))\n\t\t\tother.node().prefixLen += n4.prefixLen + 1\n\t\t}\n\n\t\tn.replaceWith(other)\n\n\tcase Node16:\n\t\tother := newNode4()\n\t\tother.copyMeta(n)\n\t\tother.node4().size = 0\n\n\t\tfor i := 0; i < len(other.node4().keys); i++ {\n\t\t\tother.node4().keys[i] = n.node16().keys[i]\n\t\t\tother.node4().children[i] = n.node16().children[i]\n\t\t\tother.node16().size++\n\t\t}\n\n\t\tn.replaceWith(other)\n\n\tcase Node48:\n\t\tother := newNode16()\n\t\tother.copyMeta(n)\n\t\tother.node16().size = 0\n\n\t\tfor i := 0; i < len(n.node48().keys); i++ {\n\t\t\tidx := n.node48().keys[byte(i)]\n\t\t\tif idx > 0 {\n\t\t\t\tchild := n.node48().children[idx-1]\n\t\t\t\tif child != nil {\n\t\t\t\t\tother.node16().children[other.node16().size] = child\n\t\t\t\t\tother.node16().keys[other.node16().size] = byte(i)\n\t\t\t\t\tother.node16().size++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tn.replaceWith(other)\n\n\tcase Node256:\n\t\tother := newNode48()\n\t\tother.copyMeta(n)\n\t\tother.node48().size = 0\n\n\t\tfor i := 0; i < len(n.node256().children); i++ {\n\t\t\tchild := n.node256().children[byte(i)]\n\t\t\tif child != nil {\n\t\t\t\tother.node48().children[other.node48().size] = child\n\t\t\t\tother.node48().keys[byte(i)] = byte(other.node48().size + 1)\n\t\t\t\tother.node48().size++\n\t\t\t}\n\t\t}\n\n\t\tn.replaceWith(other)\n\t}\n}", "title": "" }, { "docid": "b13933f83ad9a1e34c0ad29d4b9bae4c", "score": "0.435386", "text": "func NewJSONReplace(args ...sql.Expression) (sql.Expression, error) {\n\treturn nil, ErrUnsupportedJSONFunction.New(JSONReplace{}.FunctionName())\n}", "title": "" }, { "docid": "ef7cac0706ed01f3dbf74e9930fad546", "score": "0.43426245", "text": "func (i *vm) fromRegoJSON(addr int32, free bool) (interface{}, error) {\n\tserialized, err := i.jsonDump(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := i.memory.Data()[serialized.ToI32():]\n\tn := bytes.IndexByte(data, 0)\n\tif n < 0 {\n\t\tn = 0\n\t}\n\n\t// Parse the result into go types.\n\n\tdecoder := json.NewDecoder(bytes.NewReader(data[0:n]))\n\tdecoder.UseNumber()\n\n\tvar result interface{}\n\tif err := decoder.Decode(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif free {\n\t\tif _, err := i.free(serialized.ToI32()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "ac1a402b20af65d17c523c89f3e96a30", "score": "0.43369776", "text": "func TestObject_UnmarshalJSON(t *testing.T) {\n\tcases := []struct {\n\t\ts string\n\t\texpected Object\n\t}{\n\t\t{\n\t\t\ts: `{\"type\":\"Point\",\"coordinates\":[0,1]}`,\n\t\t\texpected: &Point{Coordinates: []float64{0, 1}},\n\t\t},\n\t\t{\n\t\t\ts: `{\"type\":\"MultiPoint\",\"coordinates\":[[100,0],[101,1]]}`,\n\t\t\texpected: &MultiPoint{\n\t\t\t\tCoordinates: [][]float64{\n\t\t\t\t\t{100, 0},\n\t\t\t\t\t{101, 1},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\"type\":\"LineString\",\"coordinates\":[[100,0],[101,1]]}`,\n\t\t\texpected: &LineString{\n\t\t\t\tCoordinates: [][]float64{\n\t\t\t\t\t{100, 0},\n\t\t\t\t\t{101, 1},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\"type\":\"MultiLineString\",\"coordinates\":[[[100,0],[101,1]],[[102,2],[103,3]]]}`,\n\t\t\texpected: &MultiLineString{\n\t\t\t\tCoordinates: [][][]float64{\n\t\t\t\t\t{\n\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t\t{101, 1},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t{102, 2},\n\t\t\t\t\t\t{103, 3},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[101,0],[101,1],[100,1],[100,0]],[[100.8,0.8],[100.8,0.2],[100.2,0.2],[100.2,0.8],[100.8,0.8]]]}`,\n\t\t\texpected: &Polygon{\n\t\t\t\tCoordinates: [][][]float64{\n\t\t\t\t\t{\n\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t\t{101, 0},\n\t\t\t\t\t\t{101, 1},\n\t\t\t\t\t\t{100, 1},\n\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t{100.8, 0.8},\n\t\t\t\t\t\t{100.8, 0.2},\n\t\t\t\t\t\t{100.2, 0.2},\n\t\t\t\t\t\t{100.2, 0.8},\n\t\t\t\t\t\t{100.8, 0.8},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\n \"type\": \"MultiPolygon\",\n \"coordinates\": [\n [\n [\n [102.0, 2.0],\n [103.0, 2.0],\n [103.0, 3.0],\n [102.0, 3.0],\n [102.0, 2.0]\n ]\n ],\n [\n [\n [100.0, 0.0],\n [101.0, 0.0],\n [101.0, 1.0],\n [100.0, 1.0],\n [100.0, 0.0]\n ],\n [\n [100.2, 0.2],\n [100.2, 0.8],\n [100.8, 0.8],\n [100.8, 0.2],\n [100.2, 0.2]\n ]\n ]\n ]\n}`,\n\t\t\texpected: &MultiPolygon{\n\t\t\t\tCoordinates: [][][][]float64{\n\t\t\t\t\t{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t{102, 2},\n\t\t\t\t\t\t\t{103, 2},\n\t\t\t\t\t\t\t{103, 3},\n\t\t\t\t\t\t\t{102, 3},\n\t\t\t\t\t\t\t{102, 2},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t\t\t{101, 0},\n\t\t\t\t\t\t\t{101, 1},\n\t\t\t\t\t\t\t{100, 1},\n\t\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t{100.2, 0.2},\n\t\t\t\t\t\t\t{100.2, 0.8},\n\t\t\t\t\t\t\t{100.8, 0.8},\n\t\t\t\t\t\t\t{100.8, 0.2},\n\t\t\t\t\t\t\t{100.2, 0.2},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\n \"type\": \"GeometryCollection\",\n \"geometries\": [\n {\n \"type\": \"Point\",\n \"coordinates\": [100.0, 0.0]\n },\n {\n \"type\": \"LineString\",\n \"coordinates\": [\n [101.0, 0.0],\n [102.0, 1.0]\n ]\n }\n ]\n}`,\n\t\t\texpected: &GeometryCollection{\n\t\t\t\tGeometries: []Geometry{\n\t\t\t\t\t&Point{Coordinates: []float64{100, 0}},\n\t\t\t\t\t&LineString{\n\t\t\t\t\t\tCoordinates: [][]float64{\n\t\t\t\t\t\t\t{101, 0},\n\t\t\t\t\t\t\t{102, 1},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\n \"type\": \"Feature\",\n \"bbox\": [-10.0, -10.0, 10.0, 10.0],\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [-10.0, -10.0],\n [10.0, -10.0],\n [10.0, 10.0],\n [-10.0, -10.0]\n ]\n ]\n }\n}`,\n\t\t\texpected: &Feature{\n\t\t\t\tBBox: []float64{-10, -10, 10, 10},\n\t\t\t\tGeometry: &Polygon{\n\t\t\t\t\tCoordinates: [][][]float64{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t{-10, -10},\n\t\t\t\t\t\t\t{10, -10},\n\t\t\t\t\t\t\t{10, 10},\n\t\t\t\t\t\t\t{-10, -10},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ts: `{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [102.0, 0.5]\n },\n \"properties\": {\n \"prop0\": \"value0\"\n }\n },\n {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [102.0, 0.0],\n [103.0, 1.0],\n [104.0, 0.0],\n [105.0, 1.0]\n ]\n },\n \"properties\": {\n \"prop0\": \"value0\",\n \"prop1\": 0.0\n }\n },\n {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [100.0, 0.0],\n [101.0, 0.0],\n [101.0, 1.0],\n [100.0, 1.0],\n [100.0, 0.0]\n ]\n ]\n },\n \"properties\": {\n \"prop0\": \"value0\",\n \"prop1\": {\n \"this\": \"that\"\n }\n }\n }\n ]\n}`,\n\t\t\texpected: &FeatureCollection{\n\t\t\t\tFeatures: []Feature{\n\t\t\t\t\t{\n\t\t\t\t\t\tGeometry: &Point{Coordinates: []float64{102, 0.5}},\n\t\t\t\t\t\tProperties: map[string]interface{}{\n\t\t\t\t\t\t\t\"prop0\": \"value0\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tGeometry: &LineString{\n\t\t\t\t\t\t\tCoordinates: [][]float64{\n\t\t\t\t\t\t\t\t{102, 0},\n\t\t\t\t\t\t\t\t{103, 1},\n\t\t\t\t\t\t\t\t{104, 0},\n\t\t\t\t\t\t\t\t{105, 1},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tProperties: map[string]interface{}{\n\t\t\t\t\t\t\t\"prop0\": \"value0\",\n\t\t\t\t\t\t\t\"prop1\": float64(0),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tGeometry: &Polygon{\n\t\t\t\t\t\t\tCoordinates: [][][]float64{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t{100, 0},\n\t\t\t\t\t\t\t\t\t{101, 0},\n\t\t\t\t\t\t\t\t\t{101, 1},\n\t\t\t\t\t\t\t\t\t{100, 1},\n\t\t\t\t\t\t\t\t\t{100, 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\tProperties: map[string]interface{}{\n\t\t\t\t\t\t\t\"prop0\": \"value0\",\n\t\t\t\t\t\t\t\"prop1\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"this\": \"that\",\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\tfor i, c := range cases {\n\t\tvar obj Wrapper\n\t\terr := json.Unmarshal([]byte(c.s), &obj)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"error unmarshaling case %d: %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tvalue := obj.Value\n\t\tif !reflect.DeepEqual(value, c.expected) {\n\t\t\tt.Errorf(\"for case %d expected %#v, got %#v\", i, c.expected, value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db83adc71db8877c36bbe44f3355f198", "score": "0.4330354", "text": "func (i *vm) toRegoJSON(v interface{}, free bool) (int32, error) {\n\traw, ok := v.([]byte)\n\tif !ok {\n\t\tvar err error\n\t\traw, err = json.Marshal(v)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tn := int32(len(raw))\n\tpos, err := i.malloc(n)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tp := pos.ToI32()\n\tcopy(i.memory.Data()[p:p+n], raw)\n\n\taddr, err := i.jsonParse(p, n)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif free {\n\t\tif _, err := i.free(p); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\treturn addr.ToI32(), nil\n}", "title": "" }, { "docid": "db5dfd4a2a43e1efd86dbd817cb7d944", "score": "0.4330219", "text": "func Int(json map[string]interface{}, path ...string) (int, bool) {\n\tv, ok := get(json, path...)\n\tif !ok {\n\t\treturn 0, false\n\t}\n\tflt, ok := v.(float64)\n\tif !ok {\n\t\treturn 0, false\n\t}\n\treturn int(flt), true\n}", "title": "" }, { "docid": "dbc275b5e34b2763d1ad6309f430e10a", "score": "0.43286464", "text": "func (m *Cache) SetJSON(key string, value interface{}, expiration time.Duration) error {\n\targs := m.Called(key, value, expiration)\n\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "61bf446d04bceb63391ce855511761f3", "score": "0.43275467", "text": "func (test *Client) PatchJSON(t *testing.T, path string, data interface{}) {\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttest.Invoke(t, \"PATCH\", path, \"application/json\", b)\n}", "title": "" }, { "docid": "eb87b45907983ede90e93587c9a06a9a", "score": "0.43000913", "text": "func splitJSONPath(path string) []string {\n\tvar tree []string\n\tfor _, split := range strings.Split(path, \".\") {\n\t\tif split == \"$\" {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(split, \"[*]\") {\n\t\t\tsplit = split[:len(split)-3]\n\t\t}\n\n\t\ttree = append(tree, split)\n\t}\n\n\treturn tree\n}", "title": "" }, { "docid": "2e20f248cafcbe2302eca16ba4130727", "score": "0.42981985", "text": "func (n NestedInteger) SetInteger(value int) {}", "title": "" }, { "docid": "cd7f87f3d4204b85c7b99eafd88312f7", "score": "0.42943138", "text": "func BuildTree(values []*change.ConfigValue, floatAsStr bool) ([]byte, error) {\n\n\troot := make(map[string]interface{})\n\trootif := interface{}(root)\n\tfor _, cv := range values {\n\t\terr := addPathToTree(cv.Path, &cv.TypedValue, &rootif, floatAsStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbuf, err := json.Marshal(root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "626edd1dc7efd783aecb28d571d69002", "score": "0.42942175", "text": "func (z *Element) UnmarshalJSON(data []byte) error {\n\ts := string(data)\n\tif len(s) > Bits*3 {\n\t\treturn errors.New(\"value too large (max = Element.Bits * 3)\")\n\t}\n\n\t// we accept numbers and strings, remove leading and trailing quotes if any\n\tif len(s) > 0 && s[0] == '\"' {\n\t\ts = s[1:]\n\t}\n\tif len(s) > 0 && s[len(s)-1] == '\"' {\n\t\ts = s[:len(s)-1]\n\t}\n\n\t// get temporary big int from the pool\n\tvv := bigIntPool.Get().(*big.Int)\n\n\tif _, ok := vv.SetString(s, 0); !ok {\n\t\treturn errors.New(\"can't parse into a big.Int: \" + s)\n\t}\n\n\tz.SetBigInt(vv)\n\n\t// release object into pool\n\tbigIntPool.Put(vv)\n\treturn nil\n}", "title": "" }, { "docid": "09f5e42a9c005f5e81d3b51cd1d4d3d2", "score": "0.42939335", "text": "func (m *ItemItemsItemWorkbookFunctionsFindBPostRequestBody) SetStartNum(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"startNum\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "917db03f77aa453cb7d7593dc9e571ff", "score": "0.42921764", "text": "func BeANum() JSONTypeMatcher {\n\treturn JSONTypeMatcher{\n\t\ttyp: nosj.JSONNum,\n\t}\n}", "title": "" }, { "docid": "75de3328a96798a8f02fc6580b9b6e41", "score": "0.4289751", "text": "func parseObject(f *ssd.ParsedBlock, path [][]byte, data []byte) (int, error) {\n\tif path == nil {\n\t\t// root\n\t\tif f.Count > 0 {\n\t\t\t// end of previous object\n\t\t\tf.Entity.WriteByte(ssd.SOH)\n\t\t\tf.Entity.WriteByte(ssd.EOO)\n\t\t}\n\n\t\tf.Count++\n\t}\n\n\t// eoo -> end of object, offset in json doc\n\teoo := 0\n\thandle := func(key []byte, value []byte, valueType jsonparser.ValueType, offset int) error {\n\t\teoo = offset\n\t\treturn parseObjectValue(f, valueType, append(path, replaceSlashWithUnderScore(key)), value)\n\t}\n\n\terr := jsonparser.ObjectEach(data, handle)\n\tif err != nil {\n\t\treturn eoo, err\n\t}\n\n\treturn eoo, nil\n}", "title": "" }, { "docid": "6e45c8aba9d489df9d518184c430023f", "score": "0.4288648", "text": "func editPrintJSON(modFile *modfile.File) {\n\tvar f fileJSON\n\tif modFile.Module != nil {\n\t\tf.Module = modFile.Module.Mod\n\t}\n\tif modFile.Go != nil {\n\t\tf.Go = modFile.Go.Version\n\t}\n\tfor _, r := range modFile.Require {\n\t\tf.Require = append(f.Require, requireJSON{Path: r.Mod.Path, Version: r.Mod.Version, Indirect: r.Indirect})\n\t}\n\tfor _, x := range modFile.Exclude {\n\t\tf.Exclude = append(f.Exclude, x.Mod)\n\t}\n\tfor _, r := range modFile.Replace {\n\t\tf.Replace = append(f.Replace, replaceJSON{r.Old, r.New})\n\t}\n\tdata, err := json.MarshalIndent(&f, \"\", \"\\t\")\n\tif err != nil {\n\t\tbase.Fatalf(\"go: internal error: %v\", err)\n\t}\n\tdata = append(data, '\\n')\n\tos.Stdout.Write(data)\n}", "title": "" }, { "docid": "ff6b164e6db5aa30aa9187d75c4b8c50", "score": "0.4282044", "text": "func Test_crcy_Currency_MarshalJSON_(t *testing.T) {\n\tTBegin(t)\n\t// (ob Currency) MarshalJSON() ([]byte, error)\n\t//\n\tvar test = func(input interface{}, expect string) {\n\t\ttype T struct {\n\t\t\tVal Currency\n\t\t}\n\t\tvar ty T\n\t\tty.Val = cur(input)\n\t\tvar jsn, _ = json.MarshalIndent(ty, \"\", \" \")\n\t\t// ^ calls the object's MarshalIndent() method\n\t\tvar got = string(jsn)\n\t\tgot = str.Replace(got, \"\\n\", \"\", -1)\n\t\tgot = str.Replace(got, \"{ \", \"{\", -1)\n\t\tTEqual(t, got, (expect))\n\t}\n\ttest(-1, `{\"Val\": -1}`)\n\ttest(0, `{\"Val\": 0}`)\n\ttest(0.1, `{\"Val\": 0.1}`)\n\ttest(0.01, `{\"Val\": 0.01}`)\n\ttest(0.001, `{\"Val\": 0.001}`)\n\ttest(0.0001, `{\"Val\": 0.0001}`)\n\ttest(1, `{\"Val\": 1}`)\n\t//\n\ttest(-100000, `{\"Val\": -100000}`) // -100 thousand\n\ttest(100000, `{\"Val\": 100000}`) // 100 thousand\n\ttest(-1000000, `{\"Val\": -1000000}`) // -1 million\n\ttest(1000000, `{\"Val\": 1000000}`) // 1 million\n\t//\n\ttest(math.MaxInt32, `{\"Val\": 2147483647}`)\n\ttest(math.MinInt32, `{\"Val\": -2147483648}`)\n\t//\n\ttest(123.456, `{\"Val\": 123.456}`)\n\ttest(\"2.0001\", `{\"Val\": 2.0001}`)\n\ttest(\"1,000,000,000,000.0001\", `{\"Val\": 1000000000000.0001}`)\n\t//\n\t// Tn Bn Millions\n\ttest(\"1,234,567,890,123.4321\", `{\"Val\": 1234567890123.4321}`)\n\ttest(\"9,999,999,999,999.9999\", `{\"Val\": 9999999999999.9999}`)\n\t//\n\t// overflow\n\tDisableErrors()\n\ttest(int64(922337203685477), `{\"Val\": 922337203685477.5807}`)\n\ttest(int64(-922337203685476), `{\"Val\": -922337203685476}`)\n\tEnableErrors()\n}", "title": "" }, { "docid": "a1244b869c462d695911a9ea99455e70", "score": "0.42803472", "text": "func (v *intVar) Type() JSONType {\n\treturn NumberType\n}", "title": "" }, { "docid": "995c6b5c9d1e49b98467a35322a24a5e", "score": "0.42789927", "text": "func (d *Decoder) peekNumber() ([]byte, bool, error) {\n\tvar isFloat bool\n\tvar terminated bool\n\n\tbuf, err := d.json.Peek(doublePeekWidth)\n\tif err != nil {\n\t\t// here, io.EOF is OK, since we're peeking and may hit end of\n\t\t// object within the peek width.\n\t\tif err != io.EOF {\n\t\t\treturn nil, false, newReadError(err)\n\t\t}\n\t}\n\n\t// Find where the number appears to ends and if it's a float. A\n\t// number ends at white space, a separator, or a terminator.\n\tvar i int\nLOOP:\n\tfor i = 0; i < len(buf); i++ {\n\t\tswitch buf[i] {\n\t\tcase 'e', 'E':\n\t\t\tisFloat = true\n\t\tcase '.':\n\t\t\tisFloat = true\n\t\t\tif i < len(buf)-1 && (buf[i+1] < '0' || buf[i+1] > '9') {\n\t\t\t\t_, _ = d.json.Discard(i)\n\t\t\t\treturn nil, false, d.parseError(nil, \"decimal must be followed by digit\")\n\t\t\t}\n\t\tcase ' ', '\\t', '\\n', '\\r', ',', ']', '}':\n\t\t\tterminated = true\n\t\t\tbreak LOOP\n\t\tcase '_':\n\t\t\t_, _ = d.json.Discard(i)\n\t\t\treturn nil, false, d.parseError(nil, \"invalid character in number\")\n\t\t}\n\t}\n\n\tif !terminated {\n\t\tif len(buf) < doublePeekWidth {\n\t\t\treturn nil, false, newReadError(io.ErrUnexpectedEOF)\n\t\t}\n\t\treturn nil, false, d.parseError(nil, \"number too long\")\n\t}\n\n\t// Do some validation before ParseInt/ParseFloat for basic sanity and for\n\t// things that ParseInt/ParseFloat are liberal about.\n\tnum := buf[0:i]\n\n\t// Check for optional leading minus; skip it for other validation\n\tif len(num) >= 1 && num[0] == '-' {\n\t\tnum = num[1:]\n\t}\n\n\t// Check for empty string\n\tif len(num) == 0 {\n\t\treturn nil, false, d.parseError(nil, \"number not found\")\n\t}\n\n\t// Check for number\n\tif num[0] < '0' || num[0] > '9' {\n\t\treturn nil, false, d.parseError(nil, \"invalid character in number\")\n\t}\n\n\tif num[0] == '0' && len(num) > 1 && num[1] != '.' && num[1] != 'e' && num[1] != 'E' {\n\t\treturn nil, false, d.parseError(nil, \"leading zeros not allowed\")\n\t}\n\n\t// Return the slice without the terminating character.\n\treturn buf[0:i], isFloat, nil\n}", "title": "" }, { "docid": "88b84c0cfa2f68893fb99f33e7e1ebea", "score": "0.42706525", "text": "func JSON(root *etcd.Node) ([]byte, error) {\n\tj, err := json.Marshal(Map(root))\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn j, nil\n}", "title": "" }, { "docid": "09f1cc28d4d31a001f05d2bc15a6f555", "score": "0.42695364", "text": "func (j *JSONPath) evalRecursive(input []reflect.Value, node *RecursiveNode) ([]reflect.Value, error) {\n\tresult := []reflect.Value{}\n\tfor _, value := range input {\n\t\tresults := []reflect.Value{}\n\t\tvalue, isNil := template.Indirect(value)\n\t\tif isNil {\n\t\t\tcontinue\n\t\t}\n\n\t\tkind := value.Kind()\n\t\tif kind == reflect.Struct {\n\t\t\tfor i := 0; i < value.NumField(); i++ {\n\t\t\t\tresults = append(results, value.Field(i))\n\t\t\t}\n\t\t} else if kind == reflect.Map {\n\t\t\tfor _, key := range value.MapKeys() {\n\t\t\t\tresults = append(results, value.MapIndex(key))\n\t\t\t}\n\t\t} else if kind == reflect.Array || kind == reflect.Slice || kind == reflect.String {\n\t\t\tfor i := 0; i < value.Len(); i++ {\n\t\t\t\tresults = append(results, value.Index(i))\n\t\t\t}\n\t\t}\n\t\tif len(results) != 0 {\n\t\t\tresult = append(result, value)\n\t\t\toutput, err := j.evalRecursive(results, node)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tresult = append(result, output...)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0c73ccc00b738b814c5d2a938924f9eb", "score": "0.42681998", "text": "func fill(v Value, x interface{}, path ...string) Value {\n\tctx := v.ctx()\n\troot := v.v.val()\n\tfor i := len(path) - 1; i >= 0; i-- {\n\t\tx = map[string]interface{}{path[i]: x}\n\t}\n\tvalue := convertVal(ctx, root, false, x)\n\teval := binOp(ctx, baseValue{}, opUnify, root, value)\n\treturn newValueRoot(ctx, eval)\n}", "title": "" }, { "docid": "c374bc46e9ffac570ad473cfdff481bd", "score": "0.4267792", "text": "func (j JO) Set(newValue []byte, path ...string) error {\n\tvar err error\n\tj, err = Set(j, newValue, path...)\n\treturn err\n}", "title": "" }, { "docid": "cd69283e4e0343eb94a79831f475580a", "score": "0.42658484", "text": "func ApplyJSON(base, rawPatch []byte) (result []byte, err error, loc int) {\n\tvar rawBase interface{}\n\terr = json.Unmarshal(base, &rawBase)\n\tif err != nil {\n\t\treturn nil, err, 0\n\t}\n\trawRes, err, loc := Apply(rawBase, rawPatch)\n\tif err != nil {\n\t\treturn nil, err, loc\n\t}\n\tresult, err = json.Marshal(rawRes)\n\treturn result, err, loc\n}", "title": "" }, { "docid": "6e2dee623ca981fc74ed4a3d79f3f0a0", "score": "0.4264249", "text": "func (enc *StxEncMgrMetrics) sanitizeJSON() {\n\tfor idx := range enc.Enclosures {\n\t\tenc.Enclosures[idx].Attributes.Model = strings.Replace(enc.Enclosures[idx].Attributes.Model, \"\\\"\", \"\", -1)\n\t}\n}", "title": "" }, { "docid": "f6b848a6013bf63f6f360b4a50fb52be", "score": "0.42640325", "text": "func (a *ArrayEncoder) Number(value float64) {\n\tif a.e.child > 0 {\n\t\ta.e.buf.WriteByte(charComma)\n\t}\n\n\ta.e.buf.WriteFloat64(value)\n\ta.e.child++\n}", "title": "" }, { "docid": "435d57a486bf8a8645d811520a729baf", "score": "0.4263827", "text": "func (s *Spec) Json(r io.Reader) (changed bool, err error) {\n changed = false\n // Decode the JSON.\n dec := json.NewDecoder(r)\n tmpSpec := s.copy()\n err = dec.Decode(tmpSpec)\n if err != nil {\n return\n }\n\n // Use reflection to compare the original spec to the new one. If data\n // has changed for a field, update the original spec.\n tmpValue := reflect.ValueOf(tmpSpec).Elem()\n specValue := reflect.ValueOf(s).Elem()\n specType := specValue.Type()\n\n for i := 0; i < specValue.NumField(); i++ {\n field := specValue.Field(i)\n fieldType := specType.Field(i)\n value := tmpValue.FieldByName(fieldType.Name)\n if value.Type().AssignableTo(fieldType.Type) && field.CanSet() &&\n value.Interface() != field.Interface() {\n field.Set(value)\n changed = true\n }\n }\n\n return\n}", "title": "" }, { "docid": "829bb24beefd815419c4870cb4c3c390", "score": "0.42618135", "text": "func (jsn *Json) Reset(data []byte) *Json {\n\tif data == nil {\n\t\tjsn.n = 0\n\t\treturn jsn\n\t}\n\tjsn.data, jsn.n = data, len(data)\n\treturn jsn\n}", "title": "" }, { "docid": "9cacec27728353c843e2a713b500adb7", "score": "0.42610514", "text": "func ConvertBSONValueToLegacyExtJSON(x interface{}) (interface{}, error) {\n\tswitch v := x.(type) {\n\tcase nil:\n\t\treturn nil, nil\n\tcase bool:\n\t\treturn v, nil\n\n\tcase *bson.M: // document\n\t\tdoc, err := convertKeys(*v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn doc, err\n\tcase bson.M: // document\n\t\treturn convertKeys(v)\n\tcase map[string]interface{}:\n\t\treturn convertKeys(v)\n\tcase bson.D:\n\t\tfor i, value := range v {\n\t\t\tjsonValue, err := ConvertBSONValueToLegacyExtJSON(value.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tv[i].Value = jsonValue\n\t\t}\n\t\treturn MarshalD(v), nil\n\tcase MarshalD:\n\t\treturn v, nil\n\tcase bson.A: // array\n\t\treturn convertArray(v)\n\tcase []interface{}: // array\n\t\treturn convertArray(v)\n\tcase string:\n\t\treturn v, nil // require no conversion\n\n\tcase int:\n\t\treturn json.NumberInt(v), nil\n\n\tcase primitive.ObjectID: // ObjectId\n\t\treturn json.ObjectId(v.Hex()), nil\n\n\tcase primitive.Decimal128:\n\t\treturn json.Decimal128{v}, nil\n\n\tcase primitive.DateTime: // Date\n\t\treturn json.Date(v), nil\n\n\tcase time.Time: // Date\n\t\treturn json.Date(v.Unix()*1000 + int64(v.Nanosecond()/1e6)), nil\n\n\tcase int64: // NumberLong\n\t\treturn json.NumberLong(v), nil\n\n\tcase int32: // NumberInt\n\t\treturn json.NumberInt(v), nil\n\n\tcase float64:\n\t\treturn json.NumberFloat(v), nil\n\n\tcase float32:\n\t\treturn json.NumberFloat(float64(v)), nil\n\n\tcase []byte: // BinData (with generic type)\n\t\tdata := base64.StdEncoding.EncodeToString(v)\n\t\treturn json.BinData{0x00, data}, nil\n\n\tcase primitive.Binary: // BinData\n\t\tdata := base64.StdEncoding.EncodeToString(v.Data)\n\t\treturn json.BinData{v.Subtype, data}, nil\n\n\tcase primitive.DBPointer: // DBPointer\n\t\treturn json.DBPointer{v.DB, v.Pointer}, nil\n\n\tcase primitive.Regex: // RegExp\n\t\treturn json.RegExp{v.Pattern, v.Options}, nil\n\n\tcase primitive.Timestamp: // Timestamp\n\t\treturn json.Timestamp{\n\t\t\tSeconds: v.T,\n\t\t\tIncrement: v.I,\n\t\t}, nil\n\n\tcase primitive.JavaScript: // JavaScript Code\n\t\treturn json.JavaScript{Code: string(v), Scope: nil}, nil\n\n\tcase primitive.CodeWithScope: // JavaScript Code w/ Scope\n\t\tvar scope interface{}\n\t\tvar err error\n\t\tif v.Scope != nil {\n\t\t\tscope, err = ConvertBSONValueToLegacyExtJSON(v.Scope)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn json.JavaScript{string(v.Code), scope}, nil\n\n\tcase primitive.MaxKey: // MaxKey\n\t\treturn json.MaxKey{}, nil\n\n\tcase primitive.MinKey: // MinKey\n\t\treturn json.MinKey{}, nil\n\n\tcase primitive.Undefined: // undefined\n\t\treturn json.Undefined{}, nil\n\n\tcase primitive.Null: // Null\n\t\treturn nil, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"conversion of BSON value '%v' of type '%T' not supported\", x, x)\n}", "title": "" }, { "docid": "1af4fe195126bd24f9fa45e8c78ae0f2", "score": "0.4258233", "text": "func (n *Node) update(_type NodeType, value interface{}) error {\n\t// validate\n\terr := n.validate(_type, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// update\n\tn.mark()\n\tn.clear()\n\n\tatomic.StoreInt32((*int32)(&n._type), int32(_type))\n\tn.value = atomic.Value{}\n\tif value != nil {\n\t\tswitch _type {\n\t\tcase Array:\n\t\t\tnodes := value.([]*Node)\n\t\t\tn.children = make(map[string]*Node, len(nodes))\n\t\t\tfor _, node := range nodes {\n\t\t\t\ttnode := node\n\t\t\t\tif err = n.appendNode(nil, tnode); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase Object:\n\t\t\tnodes := value.(map[string]*Node)\n\t\t\tn.children = make(map[string]*Node, len(nodes))\n\t\t\tfor key, node := range nodes {\n\t\t\t\ttkey := key\n\t\t\t\ttnode := node\n\t\t\t\tif err = n.appendNode(&tkey, tnode); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tn.value.Store(value)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20e7dcbc221aa2506474715184d791b3", "score": "0.42552444", "text": "func validMultipleOf(stack_id string, mem *JSONNode, schema *JSONNode, parent *JSONNode, errs *SchemaErrors) bool {\n\tTrace.Println(stack_id, \"validMultipleOf\")\n\tif mem.GetValueType() != V_NUMBER {\n\t\tTrace.Println(stack_id, \"validMultipleOf\", true)\n\t\treturn true\n\t}\n\n\tstrDocNum := mem.GetValue().(string)\n\tstrSchemaNum := schema.GetValue().(string)\n\n\tif strings.Index(strDocNum, \".\") > -1 || strings.Index(strSchemaNum, \".\") > -1 {\n\t\tTrace.Println(\" validMutlipleOf() - with float\")\n\t\t_, dErr := strconv.ParseFloat(strDocNum, 64)\n\t\tif dErr != nil {\n\t\t\terrs.Add(mem, \"Invalid number in document \" + strDocNum, JP_ERROR)\n\t\t}\n\t\t_, iErr := strconv.ParseFloat(strSchemaNum, 64)\n\t\tif iErr != nil {\n\t\t\terrs.Add(mem, \"Invalid number in schema \" + strSchemaNum, JP_WARNING)\n\t\t}\n\n\t\tdocLen := len(strDocNum) - strings.Index(strDocNum, \".\")\n\t\tschemaLen := len(strSchemaNum) - strings.Index(strSchemaNum, \".\")\n\n\t\tvar newDocNum\t\tstring\n\t\tvar newSchemaNum\tstring\n\n\t\tif schemaLen > docLen {\n\t\t\tnewDocNum = strings.Replace(strDocNum, \".\", \"\", 1) + strings.Repeat(\"0\", schemaLen-docLen)\n\t\t\tnewSchemaNum = strings.Replace(strDocNum, \".\", \"\", 1)\n\t\t} else {\n\t\t\tnewDocNum = strings.Replace(strDocNum, \".\", \"\", 1)\n\t\t\tnewSchemaNum = strings.Replace(strDocNum, \".\", \"\", 1) + strings.Repeat(\"0\", docLen-schemaLen)\n\t\t}\n\n\t\tiDocNum, _ := strconv.Atoi(newDocNum)\n\t\tiSchemaNum, _ := strconv.Atoi(newSchemaNum)\n\n\t\tif iDocNum == 0 {\n\t\t\tTrace.Println(stack_id, \"validMultipleOf\", true)\n\t\t\treturn true\n\t\t}\n\n\t\trem := iDocNum % iSchemaNum\n\t\tif rem != 0 {\n\t\t\tTrace.Println(\"Number\", strDocNum, \"is not multipleOf\", strSchemaNum, rem)\n\t\t\terrs.Add(mem, \"Number \" + strDocNum + \" is not multipleOf \" + strSchemaNum, JP_ERROR)\n\t\t\tTrace.Println(stack_id, \"validMultipleOf\", false)\n\t\t\treturn false\n\t\t}\n\t } else {\n\t\tTrace.Println(\" validMutlipleOf() - with int\")\n\t\tiDocNum, dErr := strconv.Atoi(strDocNum)\n\t\tif dErr != nil {\n\t\t\terrs.Add(mem, \"Invalid number in document \" + strDocNum, JP_ERROR)\n\t\t}\n\t\tiSchemaNum, iErr := strconv.Atoi(strSchemaNum)\n\t\tif iErr != nil {\n\t\t\terrs.Add(mem, \"Invalid number in schema \" + strSchemaNum, JP_WARNING)\n\t\t}\n\n\t\tif iDocNum == 0 {\n\t\t\tTrace.Println(stack_id, \"validMultipleOf\", true)\n\t\t\treturn true\n\t\t}\n\n\t\trem := iDocNum % iSchemaNum\n\n\t\tif rem != 0 {\n\t\t\terrs.Add(mem, \"Number \" + strDocNum + \" is not multipleOf \" + strSchemaNum, JP_ERROR)\n\t\t\tTrace.Println(stack_id, \"validMultipleOf\", false)\n\t\t\treturn false\n\t\t}\n\t}\n\n\tTrace.Println(stack_id, \"validMultipleOf\", true)\n\treturn true\n}", "title": "" }, { "docid": "81c113d32645f954c7417da9fde07c7c", "score": "0.42494214", "text": "func TestNumericPrimitives(t *testing.T) {\n\tfor i := uint64(0); i < 1e6; i += 111 {\n\t\to := old()\n\t\tif o.EncodeVarint(i) != nil {\n\t\t\tt.Error(\"EncodeVarint\")\n\t\t\tbreak\n\t\t}\n\t\tx, e := o.DecodeVarint()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeVarint\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"varint decode fail:\", i, x)\n\t\t}\n\n\t\to = old()\n\t\tif o.EncodeFixed32(i) != nil {\n\t\t\tt.Fatal(\"encFixed32\")\n\t\t}\n\t\tx, e = o.DecodeFixed32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"decFixed32\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"fixed32 decode fail:\", i, x)\n\t\t}\n\n\t\to = old()\n\t\tif o.EncodeFixed64(i*1234567) != nil {\n\t\t\tt.Error(\"encFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tx, e = o.DecodeFixed64()\n\t\tif e != nil {\n\t\t\tt.Error(\"decFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tif x != i*1234567 {\n\t\t\tt.Error(\"fixed64 decode fail:\", i*1234567, x)\n\t\t\tbreak\n\t\t}\n\n\t\to = old()\n\t\ti32 := int32(i - 12345)\n\t\tif o.EncodeZigzag32(uint64(i32)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag32\")\n\t\t}\n\t\tx, e = o.DecodeZigzag32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag32\")\n\t\t}\n\t\tif x != uint64(uint32(i32)) {\n\t\t\tt.Fatal(\"zigzag32 decode fail:\", i32, x)\n\t\t}\n\n\t\to = old()\n\t\ti64 := int64(i - 12345)\n\t\tif o.EncodeZigzag64(uint64(i64)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag64\")\n\t\t}\n\t\tx, e = o.DecodeZigzag64()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag64\")\n\t\t}\n\t\tif x != uint64(i64) {\n\t\t\tt.Fatal(\"zigzag64 decode fail:\", i64, x)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b2f369b99424abd5a5ca53d13d3db65", "score": "0.4243605", "text": "func toType(v interface{}, targetType int) interface{} {\n\tvar (\n\t\ta interface{}\n\t\tnType int\n\t)\n\n\t// normalize to either a float64, float32, int64 or int\n\tswitch v.(type) {\n\tcase json.Number:\n\t\ta = 0\n\t\tnType = int64Type\n\t\tif i, err := v.(json.Number).Int64(); err == nil {\n\t\t\ta = i\n\t\t\tnType = int64Type\n\t\t} else if f, err := v.(json.Number).Float64(); err == nil {\n\t\t\ta = f\n\t\t\tnType = float64Type\n\t\t}\n\tcase float64:\n\t\ta = v.(float64)\n\t\tnType = float64Type\n\tcase float32:\n\t\ta = v.(float32)\n\t\tnType = float32Type\n\tcase int64:\n\t\ta = v.(int64)\n\t\tnType = int64Type\n\tcase int:\n\t\ta = v.(int)\n\t\tnType = intType\n\tdefault:\n\t\t// NOTE: If it is not a supported type then treat value as zero\n\t\ta = int(0)\n\t\tnType = intType\n\t}\n\n\t// now convert to target type\n\tswitch targetType {\n\tcase float64Type:\n\t\tif nType == int64Type {\n\t\t\treturn float64(a.(int64))\n\t\t} else if nType == intType {\n\t\t\treturn float64(a.(int))\n\t\t} else if nType == float32Type {\n\t\t\treturn float64(a.(float32))\n\t\t}\n\t\treturn a.(float64)\n\tcase int64Type:\n\t\tif nType == int64Type {\n\t\t\treturn a.(int64)\n\t\t} else if nType == intType {\n\t\t\treturn int64(a.(int))\n\t\t} else if nType == float32Type {\n\t\t\treturn int64(a.(float32))\n\t\t}\n\t\treturn int64(a.(float64))\n\tcase float32Type:\n\t\tif nType == int64Type {\n\t\t\treturn float32(a.(int64))\n\t\t} else if nType == intType {\n\t\t\treturn float32(a.(int))\n\t\t} else if nType == float32Type {\n\t\t\treturn a.(float32)\n\t\t}\n\t\treturn float32(a.(float64))\n\tdefault:\n\t\t// intType is the default type\n\t\tif nType == int64Type {\n\t\t\treturn int(a.(int64))\n\t\t} else if nType == intType {\n\t\t\treturn a.(int)\n\t\t} else if nType == float32Type {\n\t\t\treturn int(a.(float32))\n\t\t}\n\t\treturn int(a.(float64))\n\t}\n}", "title": "" }, { "docid": "9108aab336ae3d77d616712df792b76b", "score": "0.42405185", "text": "func getNumberFromNotNumberValue(v *V) *V {\n\tif !v.IsString() {\n\t\treturn NewInt(0)\n\t}\n\tret, _ := newFromNumber(globalPool{}, bytes.TrimSpace([]byte(v.valueStr)))\n\terr := ret.parseNumber(globalPool{})\n\tif err != nil {\n\t\treturn NewInt64(0)\n\t}\n\treturn ret\n}", "title": "" } ]
d539a1235ccd1f118cb2d13ad12c5076
Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. Returns: `true` if the resource should be included or `false` is the resource should be omitted. Experimental.
[ { "docid": "a09a332855a6569e71e99e3912d65d99", "score": "0.0", "text": "func (c *jsiiProxy_CfnMatchmakingConfiguration) ShouldSynthesize() *bool {\n\tvar returns *bool\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"shouldSynthesize\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
[ { "docid": "44f6a0480b8875ec563e9b61e9792a3b", "score": "0.6314203", "text": "func (o *AccessPolicyDTO) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a808878fe230938214bb5529096f14bf", "score": "0.62948173", "text": "func (me TxsdSystemitemClass) IsResource() bool { return me == \"resource\" }", "title": "" }, { "docid": "a17fb93a92378146702b7c60707bf10e", "score": "0.6225451", "text": "func (o *MicrosoftGraphUsedInsight) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4234a18c50d2cddbe6c1b4fd0529a160", "score": "0.6018604", "text": "func (ConfigMap) IsKubernetesResource() {}", "title": "" }, { "docid": "d78c38e526543c00a1d11afa6ab8c40f", "score": "0.5990225", "text": "func (o *SelfResourceReviewRequest) HasResourceType() bool {\n\tif o != nil && o.ResourceType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "00b6316ce3447fec184b18b9e59fcb51", "score": "0.59660333", "text": "func (Secret) IsKubernetesResource() {}", "title": "" }, { "docid": "b744645c0c6839e1ac9fbeb5b0f667e6", "score": "0.59628654", "text": "func (u *UriT) IsResourceSet() bool {\n\treturn (u.Flag & ResourceBit) != 0\n}", "title": "" }, { "docid": "112956134b8315db88a38cdd0047e1ed", "score": "0.5900618", "text": "func CustomResource_IsResource(construct IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.CustomResource\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "20d058b858cdf1b97d47ec2d42008c6e", "score": "0.5825537", "text": "func (o *MicrosoftGraphUsedInsight) HasResourceVisualization() bool {\n\tif o != nil && o.ResourceVisualization != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0977569cc4237978e08d21e478ff07d7", "score": "0.5820299", "text": "func (o *StackPatchRequestResource) HasTemplateMetaName() bool {\n\tif o != nil && o.TemplateMetaName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b0d6a8317ec3ef2bdaf37bd538533235", "score": "0.57983273", "text": "func (o *PermissionAllOf) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6c7d3310b23ed7f88053fe9636e00a48", "score": "0.57883126", "text": "func (o *EventRestEntry) HasResourceName() bool {\n\tif o != nil && o.ResourceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f1b40ec0a58f3753ab144bd79bccce77", "score": "0.577973", "text": "func Resource_IsResource(construct IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.Resource\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "13415c9501fdf8dfdf056b959240acb5", "score": "0.57209694", "text": "func TxtRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.TxtRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "03d73d17175fe7f1a2255cd46d2656a6", "score": "0.5718507", "text": "func (o *CrdCustomResource) HasImage() bool {\n\tif o != nil && o.Image != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dcb9c6a018c51164f27a28051c496b6e", "score": "0.56969523", "text": "func (o *TechsupportmanagementTechSupportBundle) HasTargetResource() bool {\n\tif o != nil && o.TargetResource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6d7cf2c1e2f6262e21acca3d61081132", "score": "0.56762993", "text": "func VirtualGateway_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.VirtualGateway\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c478b24bf92c589c747296c1aaa70aeb", "score": "0.5665897", "text": "func (o *ApplianceAllOfConnectorAdvancedClients) HasAllowResources() bool {\n\tif o != nil && o.AllowResources != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bd2824ddbf0e7c05ad8cb46c44982ab0", "score": "0.56464946", "text": "func (o *TemplateExportOrgIDs) HasResourceFilters() bool {\n\tif o != nil && o.ResourceFilters != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "753a38f463d8964845bc62a5b4cb972e", "score": "0.5621306", "text": "func HasTemplate(name string) bool { return internal.Templates != nil && internal.Templates.Has(name) }", "title": "" }, { "docid": "42857008015322d2b6b2c35aab54a768", "score": "0.5619735", "text": "func IsResourceSupported(resources []gardencorev1alpha1.ControllerResource, resourceKind, resourceType string) bool {\n\tfor _, resource := range resources {\n\t\tif resource.Kind == resourceKind && strings.ToLower(resource.Type) == strings.ToLower(resourceType) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d1b67bd0b30dbb31a3ccad41dc2303ef", "score": "0.5617599", "text": "func VirtualNode_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.VirtualNode\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8b16e0f013edd8e9e8161f15be3ce247", "score": "0.5613157", "text": "func (o *ContentResources) HasResourceTypes() bool {\n\tif o != nil && o.ResourceTypes != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "944f9ceba6fc5c99e1b3d1a69998a484", "score": "0.55864334", "text": "func (o *AppRoleAssignment) HasResourceDisplayName() bool {\n\tif o != nil && o.ResourceDisplayName.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32a5a8071eae10d708244c71b1efece3", "score": "0.55863386", "text": "func (o *ApplianceAllOfConnectorAdvancedClients) HasSnatToResources() bool {\n\tif o != nil && o.SnatToResources != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9cb1d56a3bd3fd5da7928bfa8018d3ed", "score": "0.55863243", "text": "func isResourceAvailable(namespace, name string, gvr schema.GroupVersionResource, dynamicClient dynamic.Interface) (bool, error) {\n\t_, err := dynamicClient.Resource(gvr).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})\n\tif errors.IsNotFound(err) {\n\t\treturn false, nil\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "883717b8273654306bedbdd52520072e", "score": "0.5550838", "text": "func (o *TechsupportmanagementTechSupportBundleAllOf) HasTargetResource() bool {\n\tif o != nil && o.TargetResource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5615baa611395cb311bd33bfbdf688c7", "score": "0.5548039", "text": "func (s SkillDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5b067b18563c7e03247f4897c69a8f86", "score": "0.554658", "text": "func CnameRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.CnameRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "46ff32a1bbabecd2fdb011780a05b022", "score": "0.5541141", "text": "func Route_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.Route\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ed80444b2b3b601734442c971615d014", "score": "0.5536554", "text": "func (r *TemplatedEnforcingCRDReconciler) IsInitialized(instance *v1alpha1.TemplatedEnforcingCRD) bool {\n\tneedsUpdate := true\n\tfor i := range instance.Spec.Templates {\n\t\tcurrentSet := strset.New(instance.Spec.Templates[i].ExcludedPaths...)\n\t\tif !currentSet.IsEqual(strset.Union(lockedresource.DefaultExcludedPathsSet, currentSet)) {\n\t\t\tinstance.Spec.Templates[i].ExcludedPaths = strset.Union(lockedresource.DefaultExcludedPathsSet, currentSet).List()\n\t\t\tneedsUpdate = false\n\t\t}\n\t}\n\tif len(instance.Spec.Templates) > 0 && !util.HasFinalizer(instance, controllerName) {\n\t\tutil.AddFinalizer(instance, controllerName)\n\t\tneedsUpdate = false\n\t}\n\tif len(instance.Spec.Templates) == 0 && util.HasFinalizer(instance, controllerName) {\n\t\tutil.RemoveFinalizer(instance, controllerName)\n\t\tneedsUpdate = false\n\t}\n\treturn needsUpdate\n}", "title": "" }, { "docid": "27d7d2ab496abc11560e052681727402", "score": "0.553562", "text": "func GatewayRoute_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.GatewayRoute\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "08217dc8634ddf2446d1b479a017c024", "score": "0.5521565", "text": "func DsRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.DsRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "cd76d14b3261ae4d9bc3dadf7d7623aa", "score": "0.5513083", "text": "func (o *CrdCustomResource) HasTargetType() bool {\n\tif o != nil && o.TargetType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "09039ac971da66d9ebd3fa23e0f91724", "score": "0.55118924", "text": "func (o *TemplateDTO) HasSnippet() bool {\n\tif o != nil && o.Snippet != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b9a4ec7117d0ea1537d0b40ceacdc58", "score": "0.5499953", "text": "func CaaAmazonRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.CaaAmazonRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "238a2115cb332e1cab7eb43a6c2bd93c", "score": "0.54997915", "text": "func (r ExportableResource) HasKind(kind string) bool {\n\tkindProvider := r.CloudProvider\n\tif kindProvider == \"aws\" {\n\t\tkindProvider = \"ec2\"\n\t}\n\t// does it match ec2/cluster@v1\n\treturn strings.HasPrefix(kind, fmt.Sprintf(\"%s/%s@\", kindProvider, r.ResourceType))\n}", "title": "" }, { "docid": "5f21f295967bb4b7322c81c8ee04f53a", "score": "0.54971725", "text": "func (s ReferenceDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f1e9c8e8a64e06dd2a7c2481e8194acf", "score": "0.5488264", "text": "func VirtualService_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.VirtualService\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1234eaaf9e2964dab5b13937b0f5d6ba", "score": "0.54842347", "text": "func (o *SSHOptions) HasTemplate() bool {\n\treturn o != nil && (o.Template != \"\" || o.TemplateFile != \"\")\n}", "title": "" }, { "docid": "86cfdd0d162e48fc8c54c7251f6191ce", "score": "0.5481535", "text": "func (o *MicrosoftGraphUsedInsight) HasResourceReference() bool {\n\tif o != nil && o.ResourceReference != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d037e96fcd06bdffea71fcc204ead2dc", "score": "0.5478883", "text": "func RecordSet_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.RecordSet\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1222cfece7af37f37a3797b62ac35805", "score": "0.54778117", "text": "func ARecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.ARecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "505b2ca06fbd16335579a6cabfab1194", "score": "0.5472576", "text": "func HostedZone_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.HostedZone\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "46675c6b15f497fd1c42f6242a1ee426", "score": "0.5460377", "text": "func VirtualRouter_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.VirtualRouter\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "313659bed0196e0a6edba4172ab59db9", "score": "0.54564816", "text": "func (o ID) IsResourceBuilding() bool {\n\treturn o == MetalMineID ||\n\t\to == CrystalMineID ||\n\t\to == DeuteriumSynthesizerID ||\n\t\to == SolarPlantID ||\n\t\to == FusionReactorID ||\n\t\to == MetalStorageID ||\n\t\to == CrystalStorageID ||\n\t\to == DeuteriumTankID ||\n\t\to == ShieldedMetalDenID ||\n\t\to == UndergroundCrystalDenID ||\n\t\to == SeabedDeuteriumDenID\n}", "title": "" }, { "docid": "ac5cd63803167fbf6d9de19ad7379893", "score": "0.5455028", "text": "func (r *Resource) isContainsImageContent() bool {\n\treturn r.hasImage() || r.hasImageList()\n}", "title": "" }, { "docid": "b654ad020438548122b948b0ff5432ed", "score": "0.54501784", "text": "func (o *SummaryGear) HasResourceState() bool {\n\tif o != nil && o.ResourceState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aad7e234fc087e2188479f2fe4ac5976", "score": "0.54473567", "text": "func (r *ResourceRequest) HasResourceType(rType1 string) bool {\n\n\tfor _, rType2 := range r.ResourceTypes {\n\t\tif rType1 == rType2 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6fee7da86198a0082f5cbdf9c61a931e", "score": "0.5441682", "text": "func CaaRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.CaaRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1c376770b98588b13711cd500e32ea37", "score": "0.5441117", "text": "func (r *resource) isActive() bool {\n\treturn r.active\n}", "title": "" }, { "docid": "c0b5464e2a630c7af0d3dccade9ca151", "score": "0.5437953", "text": "func PublicHostedZone_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.PublicHostedZone\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "fe1fefa2fde56dfbfbd09a6f8d434658", "score": "0.54325736", "text": "func (c *jsiiProxy_CfnCustomResource) ShouldSynthesize() *bool {\n\tvar returns *bool\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"shouldSynthesize\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6b9f746508b2e6e43251eb9c0cb9a2f3", "score": "0.5423851", "text": "func (s Set) HasResource(want addrs.AbsResource) bool {\n\treturn s.exp.knowsResource(want)\n}", "title": "" }, { "docid": "f95c4ccd58259cd36d6c39ff849851d9", "score": "0.54238015", "text": "func (c *jsiiProxy_CfnResourceDefinition) ShouldSynthesize() *bool {\n\tvar returns *bool\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"shouldSynthesize\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5722509aa733f2317ed003cde958ca45", "score": "0.5420996", "text": "func CustomResource_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.CustomResource\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2f0502333d3c41f2bff2c8c411af16e4", "score": "0.541998", "text": "func Bucket_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_s3.Bucket\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5608a0b83e4674200f5dd256439efca4", "score": "0.54096484", "text": "func (s *Stencil) DoesDistOwnResource(r Resource, distName string) bool {\n\n\tfilterFunc, err := s.GetFilterFunc(distName)\n\tif err != nil {\n\t\tlog.Printf(\"Bug: GetFilterFunc complained: %s\", err)\n\t\treturn false\n\t}\n\treturn filterFunc(r)\n}", "title": "" }, { "docid": "23a312cb4970311a45684f1209c7e4bf", "score": "0.54056156", "text": "func SrvRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.SrvRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6a2002b39935d2afc518d415cd86b703", "score": "0.54016596", "text": "func IsLoaded() bool { return internal.Templates != nil }", "title": "" }, { "docid": "1b790237a46f6bddef58e115404fb50e", "score": "0.539763", "text": "func (s WorkDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "77d66ee3b865beac3d7b94c07f3f3080", "score": "0.5394704", "text": "func NsRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.NsRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e2ee884455e83475641b5070899a249b", "score": "0.5387855", "text": "func IsAPIResource(comments []string) bool {\n\tfor _, c := range comments {\n\t\tif strings.Contains(c, \"+resource\") || strings.Contains(c, \"+kubebuilder:resource\") {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2c3ee7788461dc39eb5d37db79260e32", "score": "0.53862125", "text": "func CfnVirtualGateway_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.CfnVirtualGateway\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ebb9e3d55afdb0d7ac4f909b68152d00", "score": "0.5381573", "text": "func (s ListDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1a22dfa0f5906b7d2d0e907f09e20a47", "score": "0.5375015", "text": "func (ts *EnvTestSuite) IsResourceExisting(ctx context.Context, obj client.Object) bool {\n\terr := ts.Client.Get(ctx, ts.MapToNamespacedName(obj), obj)\n\tif apierrors.IsNotFound(err) {\n\t\treturn false\n\t}\n\tts.Assert().NoError(err)\n\treturn obj.GetDeletionTimestamp() == nil\n}", "title": "" }, { "docid": "b2a5336ad5a478655916184c6e8a48c4", "score": "0.53702533", "text": "func (s ProjectDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "51e427af3970ecf6567e1c917c1335d8", "score": "0.5368699", "text": "func CfnScript_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_gamelift.CfnScript\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5b9eadd516eeebc95d7d71f6a801852b", "score": "0.53605247", "text": "func (s *Service) HasResource(r *Resource) bool {\n\tcount, err := DB.Where(\"service_id = ?\", s.ID).Count(&ServicesTags{})\n\tif err != nil {\n\t\tmlogger.Errorf(\"database error: %v\", err)\n\t\treturn false\n\t}\n\n\tquery := DB.Q().\n\t\tJoin(\"resources_tags\", \"resources_tags.resource_id = resources.id\").\n\t\tJoin(\"tags\", \"tags.id = resources_tags.tag_id\").\n\t\tJoin(\"services_tags\", \"services_tags.tag_id = tags.id\").\n\t\tWhere(\"services_tags.service_id = ?\", s.ID).\n\t\tWhere(\"resources.id = ?\", r.ID).\n\t\tGroupBy(\"resources.id\")\n\tif s.MatchAll {\n\t\tquery = query.Having(\"count(resources.name) = ?\", count)\n\t}\n\tresources := &Resources{}\n\tif err := query.All(resources); err != nil {\n\t\tmlogger.Errorf(\"could not get resources. error: %v\", err)\n\t}\n\tmlogger.Debugf(\"%v has %v tags and %v is matched\", s, count, *resources)\n\n\treturn len(*resources) == 1\n}", "title": "" }, { "docid": "a1d1d527abfc33a1761dbd0325bf89aa", "score": "0.5356682", "text": "func (c *jsiiProxy_CfnResource) ShouldSynthesize() *bool {\n\tvar returns *bool\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"shouldSynthesize\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c2f587ea403d13fdcbd3052e8220d7b5", "score": "0.53532666", "text": "func (t Template) IsRelease() bool {\n\n\tif t.Status == \"TEMPLATE\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4b6dd3ba9a6d6d11ecef54cc7f4d27a2", "score": "0.5341536", "text": "func CfnBuild_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_gamelift.CfnBuild\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "eb3894de0ea22955bc795af38d7f0922", "score": "0.5341517", "text": "func (s PublicationDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f5f2efd6abc5a97a23fd384944aba734", "score": "0.5340699", "text": "func (s EducationDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d565a6aafdd73a76251e0c209c1e9532", "score": "0.5336786", "text": "func CfnFleet_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_gamelift.CfnFleet\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "01a86497f61f57567c97ba628961df84", "score": "0.5323236", "text": "func (p *Pad) IsAcceptTemplate() bool {\n\treturn p.FlagIsSet(uint32(PAD_FLAG_ACCEPT_TEMPLATE))\n}", "title": "" }, { "docid": "87d53c9ac63b65db7a90eeb1b4f36231", "score": "0.5307958", "text": "func CfnCustomResource_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.CfnCustomResource\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5642264fd4803f49b5fb7e77b0047b43", "score": "0.53072685", "text": "func (trt *TriggerResourceTemplate) IsAllowedType() bool {\n\tapiVersion, kind := trt.getAPIVersionAndKind()\n\n\tif kinds, ok := allowedTemplateTypes[apiVersion]; ok {\n\t\tfor _, allowedKind := range kinds {\n\t\t\tif strings.ToLower(kind) == allowedKind {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4f0d5dac6bcb1b8d4de5cc420290b74d", "score": "0.53071547", "text": "func PrivateHostedZone_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.PrivateHostedZone\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8a898dc61d513a1d0b8dc679b0c86b5a", "score": "0.5304771", "text": "func (s InterestDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "51b08fae81a6fc46b5eea163d535719d", "score": "0.5303288", "text": "func isReservedResourceField(resourceName, s string) bool {\n\tswitch s {\n\tcase \"ID\", \"URN\", \"GetProvider\", \"ElementType\":\n\t\treturn true\n\tdefault:\n\t\tif resourceName != \"\" {\n\t\t\ttoOutput := \"To\" + resourceName + \"Output\"\n\t\t\treturn s == toOutput || s == toOutput+\"WithContext\"\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "9935359f13c1c55c09c24e84e65260d1", "score": "0.5301541", "text": "func (r *Resource) Validate() bool {\n\treturn r.source != \"\" && r.target != \"\"\n}", "title": "" }, { "docid": "62972b51d96f3b66a61d7d171d929fb4", "score": "0.5297173", "text": "func AaaaRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.AaaaRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "39bf61ca3982b43256b2fd9f437b6842", "score": "0.5291324", "text": "func (o *PlannerWorkloadPlannersResponse) HasIncluded() bool {\n\tif o != nil && o.Included != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "532eb3e31e8828275e10595f61b1f2d9", "score": "0.5288435", "text": "func CfnResourceDefinition_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_greengrass.CfnResourceDefinition\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "13b41b63b5de4f31b2b3e1707389bb43", "score": "0.5281422", "text": "func (o *TerraformExecutorAllOf) HasCloudResource() bool {\n\tif o != nil && o.CloudResource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6123e255236c981c0f98b1e8e126877a", "score": "0.52700216", "text": "func (r *Resource) IsCollection() bool {\n\treturn r.adapter.IsCollection()\n}", "title": "" }, { "docid": "c278ca3f4b18a458ac70dc9a4eb1d886", "score": "0.5258419", "text": "func (s AwardDetailSlice) HasRender() bool {\n\tfor _, sDetail := range s {\n\t\tif sDetail.Render {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "03ea8165b0d5586b24f3f362e3263c6b", "score": "0.5258278", "text": "func BucketPolicy_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_s3.BucketPolicy\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6056718a00324a4e9c4b49439a42de4e", "score": "0.5248352", "text": "func ZoneDelegationRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.ZoneDelegationRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "bbcc0e588937d785da289cdeaa7d3bb3", "score": "0.5245817", "text": "func (o *CreateNetAccessPointRequest) HasDryRun() bool {\n\tif o != nil && o.DryRun != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4c59f7cc82d9b91d7bac8ab7bfaa429b", "score": "0.523981", "text": "func (t *TemplateField) Rendered() bool {\n\treturn atomic.LoadInt64(&t.rendered) != 0\n}", "title": "" }, { "docid": "5a1a2b48910525f29341b226a416e18a", "score": "0.5238818", "text": "func CfnVirtualRouter_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_appmesh.CfnVirtualRouter\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "71ab1132efcf10d44e7b236d9c6db810", "score": "0.5232811", "text": "func (t Temporality) Includes(other Temporality) bool {\n\treturn t&other != 0\n}", "title": "" }, { "docid": "71a1c99c98ce66467def354744b5d187", "score": "0.5230674", "text": "func (r *ImageResource) RequiresStaging() bool {\n\treturn r.ResourcePool.NeedsStaging\n}", "title": "" }, { "docid": "a610e4fc022968df955dd79243c422dc", "score": "0.522769", "text": "func (r rendered) IsCurrent(fs http.FileSystem) bool {\n\tfileinfo, err := stat(fs, r.tmplPath)\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"filename\": r.tmplPath,\n\t\t\t\"err\": err,\n\t\t}).Errorf(\"cannot stat file %q\", r.tmplPath)\n\t\treturn false\n\t}\n\treturn fileinfo.ModTime().Before(r.modtime)\n}", "title": "" }, { "docid": "62d42b87b03300b82433f7352e9eccb6", "score": "0.5225351", "text": "func MxRecord_IsResource(construct awscdk.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_route53.MxRecord\",\n\t\t\"isResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f06a08899f09034354e9172877290cdb", "score": "0.5223176", "text": "func (o *EventRestEntry) HasResourceId() bool {\n\tif o != nil && o.ResourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "eb525cf78a6c3b0b52dd037ebccaeca3", "score": "0.5222876", "text": "func CfnCustomActionType_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_codepipeline.CfnCustomActionType\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1149c1f178f967136e3c7165f7dba660", "score": "0.520955", "text": "func HasSubresource(comments []string) bool {\n\tif !IsAPIResource(comments) {\n\t\treturn false\n\t}\n\tfor _, c := range comments {\n\t\tif strings.Contains(c, \"subresource\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a676edc31a2292f7f012ff7ea810e3e5", "score": "0.5200778", "text": "func CfnResource_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.CfnResource\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
ebb656ebeced0152ba4778e18691e9a9
AddSeatConcurrencyInUse adds the given delta to the gauge of seats in use by the currently executing requests of the given flowSchema and priorityLevel
[ { "docid": "0198a53b4d8abc6196df1b93c60b5b45", "score": "0.82674617", "text": "func AddSeatConcurrencyInUse(priorityLevel, flowSchema string, delta int) {\n\tapiserverCurrentExecutingSeats.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))\n\tapiserverRequestConcurrencyInUse.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))\n}", "title": "" } ]
[ { "docid": "3de3a5a7fd6590f85bbee72f9b688568", "score": "0.5081004", "text": "func AddSeatsInQueues(ctx context.Context, priorityLevel, flowSchema string, delta int) {\n\tapiserverCurrentInqueueSeats.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))\n}", "title": "" }, { "docid": "f1f0faf6aa748aa28e2d19563ade5cde", "score": "0.4556698", "text": "func (circ *Circuit) addGate(gateType GateType_t, constVal bool, inFrom []int) int {\n // Make sure the gate has the correct number of input wires\n if len(inFrom) < min_input_wires[gateType] || len(inFrom) > max_input_wires[gateType] {\n fmt.Printf(\"ERROR ADDING GATE, type = %d, input = %d, min = %d, max = %d\\n\", gateType, len(inFrom), min_input_wires[gateType], max_input_wires[gateType])\n return -1\n }\n \n newGate := Gate{gateType, constVal, inFrom}\n circ.Gates = append(circ.Gates, newGate)\n return len(circ.Gates) - 1\n}", "title": "" }, { "docid": "c92d0235060e0abd85d40e97f2aef5a9", "score": "0.4520248", "text": "func AddRequestsExecuting(ctx context.Context, priorityLevel, flowSchema string, delta int) {\n\tapiserverCurrentExecutingRequests.WithLabelValues(priorityLevel, flowSchema).Add(float64(delta))\n}", "title": "" }, { "docid": "ee0161479f27de204d3e8eb02b918089", "score": "0.44090953", "text": "func ObserveWorkEstimatedSeats(priorityLevel, flowSchema string, seats int) {\n\tapiserverWorkEstimatedSeats.WithLabelValues(priorityLevel, flowSchema).Observe(float64(seats))\n}", "title": "" }, { "docid": "1a40a2b43fe570bc37600f8ad138dd1c", "score": "0.4330489", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _DisputeCrowdsourcer.Contract.IncreaseApproval(&_DisputeCrowdsourcer.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "b5c133a159091a1685fbd29e8c20b8d4", "score": "0.43292058", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _DisputeCrowdsourcer.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "f3b5fbe11ecc9c7197290a4b570e6167", "score": "0.43048012", "text": "func (wg *CountWG) Add(delta int) {\n\td := int64(delta)\n\twg.wg.Add(delta)\n\tswapped := false\n\tfor !swapped {\n\t\tswapped = atomic.CompareAndSwapInt64(&wg.counter, atomic.LoadInt64(&wg.counter), atomic.LoadInt64(&wg.counter)+d)\n\t}\n}", "title": "" }, { "docid": "454bb02e36916538e03ac56da9606c0b", "score": "0.42812845", "text": "func (_SUSD *SUSDTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SUSD.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "26ede4c4060b68043185dafe15284b6e", "score": "0.4278063", "text": "func (_ERC20Pausable *ERC20PausableTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "9e53b839b82487c88f0b71634217ddbf", "score": "0.42435324", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _DisputeCrowdsourcer.Contract.IncreaseApproval(&_DisputeCrowdsourcer.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "57706ece9ad98565d13a8e2035058687", "score": "0.42230254", "text": "func (_ERC20Pausable *ERC20PausableTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.Contract.IncreaseAllowance(&_ERC20Pausable.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "e6a88452bb1502deea8103be865f75ff", "score": "0.41881666", "text": "func (m *PlanetMutation) AddShipFactoryLevel(i int) {\n\tif m.addship_factory_level != nil {\n\t\t*m.addship_factory_level += i\n\t} else {\n\t\tm.addship_factory_level = &i\n\t}\n}", "title": "" }, { "docid": "33e94e4ed454dd9335efd8bc5ad7b25a", "score": "0.41873473", "text": "func (_StandaloneERC20 *StandaloneERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandaloneERC20.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "83615274e1f0405e04c4502d72556dc5", "score": "0.4177978", "text": "func (_ERC20Pausable *ERC20PausableSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Pausable.Contract.IncreaseAllowance(&_ERC20Pausable.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "c4fd76fccd86d84c89596804cb33586e", "score": "0.41594183", "text": "func (_SUSD *SUSDTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SUSD.Contract.IncreaseAllowance(&_SUSD.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "d13427d976a458a79c1caf65b0dce148", "score": "0.41292745", "text": "func (t *CancelToken) Add(delta int) {\n\tt.wg.Add(delta)\n}", "title": "" }, { "docid": "cab38ab012710dde181bf7c998b96f5f", "score": "0.40861642", "text": "func (uuo *UserUpdateOne) AddRequestStatuIDs(ids ...uuid.UUID) *UserUpdateOne {\n\tuuo.mutation.AddRequestStatuIDs(ids...)\n\treturn uuo\n}", "title": "" }, { "docid": "ad77a26f7f9dac0be1af76ea08098986", "score": "0.40853935", "text": "func (_StandaloneERC20 *StandaloneERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandaloneERC20.Contract.IncreaseAllowance(&_StandaloneERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "a735a8a647fc4c036ede3318ac875787", "score": "0.4075957", "text": "func (_ERC20Mintable *ERC20MintableTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Mintable.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "a10ef7e669ff41e53f2d2dde30c8207b", "score": "0.40687674", "text": "func (_ERC20WithPermit *ERC20WithPermitTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithPermit.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "5736514872ab36e87f34bf4902cb1e0f", "score": "0.40613922", "text": "func (_SUSD *SUSDSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SUSD.Contract.IncreaseAllowance(&_SUSD.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "b3add61eb6747809b0cd2231fb9459a7", "score": "0.4042326", "text": "func (uu *UserUpdate) AddRequestStatuIDs(ids ...uuid.UUID) *UserUpdate {\n\tuu.mutation.AddRequestStatuIDs(ids...)\n\treturn uu\n}", "title": "" }, { "docid": "0ef3bec9785b6917d187eb951c28008d", "score": "0.40364516", "text": "func (_ERC20Mintable *ERC20MintableTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Mintable.Contract.IncreaseAllowance(&_ERC20Mintable.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "4d5ae027002090c9cedd96c6ab24485b", "score": "0.4025567", "text": "func (_ERC20 *ERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "4d5ae027002090c9cedd96c6ab24485b", "score": "0.4024377", "text": "func (_ERC20 *ERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "4d5ae027002090c9cedd96c6ab24485b", "score": "0.4024377", "text": "func (_ERC20 *ERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "7770b1989630bde4b0e096ac27ed3f6f", "score": "0.40208507", "text": "func (_AastraVault *AastraVaultTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _AastraVault.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "48cf023ae98af927926d61f566803939", "score": "0.4019322", "text": "func (ts *Time_slice) Inc_usr(\tusr *Fence, amt int64, cap int64 ) {\n\tif usr == nil {\n\t\treturn\n\t}\n\n\tf := ts.limits[*usr.Name]\n\tif f == nil {\n\t\tf = usr.Clone( cap )\n\t\tts.limits[*f.Name] = f\n\t}\n\n\tf.Inc_used( amt )\n}", "title": "" }, { "docid": "aa71e59092bbc1acaef6aacaf7d7866c", "score": "0.40115845", "text": "func (g *Gate) Inc_utilisation( commence, conclude, delta int64, qid *string, ulimits *Fence ) ( state bool, err error ){\n\tif g == nil || g.gsw == nil {\n\t\treturn false, fmt.Errorf( \"nil pointer\" )\n\t}\n\n\tif delta == 0 {\t\t\t\t\t// don't waste time doing nothing\n\t\treturn true, nil\n\t}\n\n\tstate = true\t\n\ti := 0\n\tfor lnk := g.gsw.Get_link( i ); state == true && lnk != nil; lnk = g.gsw.Get_link( i ) {\t\t// run all links\n\t\tif qid == nil {\n\t\t\tstate, err = lnk.Inc_queue( qid, commence, conclude, delta, ulimits )\n\t\t} else {\n\t\t\tstate = lnk.Inc_utilisation( commence, conclude, delta, ulimits )\n\t\t}\n\n\t\tif state {\t\t\t\t// don't bump on failure so we can knock down if needed\n\t\t\ti++\n\t\t}\n\t}\n\n\tif ! state && delta > 0 {\t\t// something failed, and we were increasing, must dec what we increased\n\t\tfor i--; i >= 0; i-- {\t\t// i points to the failed link, so back up first\n\t\t\tif qid == nil {\n\t\t\t\t g.gsw.Get_link( i ).Inc_queue( qid, commence, conclude, -delta, ulimits )\n\t\t\t} else {\n\t\t\t\t g.gsw.Get_link( i ).Inc_utilisation( commence, conclude, -delta, ulimits )\n\t\t\t}\n\t\t}\n\t} else {\n\t\tg.bandw += delta\t\t// all good, record the change\n\t\tif g.bandw < 0 {\n\t\t\tg.bandw = 0\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "13b289edcee605a1487797f8deab159d", "score": "0.4011363", "text": "func (c *Concentrator) Add(t processedTrace) {\n\tc.mu.Lock()\n\n\tfor _, s := range t.WeightedTrace {\n\t\t// We do not compute stats for non top level spans since this is not surfaced in the UI\n\t\tif !s.TopLevel {\n\t\t\tcontinue\n\t\t}\n\t\tbtime := s.End() - s.End()%c.bsize\n\t\tb, ok := c.buckets[btime]\n\t\tif !ok {\n\t\t\tb = model.NewStatsRawBucket(btime, c.bsize)\n\t\t\tc.buckets[btime] = b\n\t\t}\n\n\t\tsublayers, ok := t.Sublayers[s.Span]\n\t\tif ok {\n\t\t\tb.HandleSpan(s, t.Env, c.aggregators, &sublayers)\n\t\t} else {\n\t\t\tb.HandleSpan(s, t.Env, c.aggregators, nil)\n\t\t}\n\t}\n\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "8c00ca572fb5de020b85bbb07a77546e", "score": "0.40031162", "text": "func (m *ExportingClient) AddLatency(name string, value float64) {\n\tif m == nil {\n\t\treturn\n\t}\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tctx := context.Background()\n\tstats.Record(ctx, m.latencies[name].M(value))\n}", "title": "" }, { "docid": "7ce2e6cef2b8bc2e8de5348d45348e54", "score": "0.39888388", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"useless-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Useless\n\terr = c.Watch(&source.Kind{Type: &uselessv1alpha1.Useless{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Pods and requeue the owner Useless\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &uselessv1alpha1.Useless{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df11097445be66f1acd66b5eda5b7cc6", "score": "0.39812565", "text": "func (service *Service) AddSealer(nodeID string, weight int64) (int64, error) {\n\t//flag, err := service.isValidNodeID(nodeID)\n\t//if err != nil {\n\t//\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"AddSealer failed, err: %v\", err)\n\t//}\n\t//if !flag {\n\t//\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"the node is not reachable\")\n\t//}\n\n\tsealerRaw, err := service.client.GetSealerList(context.Background())\n\tif err != nil {\n\t\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"get the sealer list failed: %v\", err)\n\t}\n\n\tvar nodeIDs []nodeIdList\n\terr = json.Unmarshal(sealerRaw, &nodeIDs)\n\tif err != nil {\n\t\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"unmarshal the sealer list failed: %v\", err)\n\t}\n\n\tfor _, nID := range nodeIDs {\n\t\tif nID.nodeID == nodeID {\n\t\t\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"the node is already in the sealer list\")\n\t\t}\n\t}\n\n\ttx, receipt, err := service.consensus.AddSealer(service.consensusAuth, nodeID, big.NewInt(weight))\n\tif err != nil {\n\t\treturn precompiled.DefaultErrorCode, fmt.Errorf(\"ConsensusService addSealer failed: %+v\", err)\n\t}\n\t_ = tx\n\treturn parseReturnValue(receipt, \"addSealer\")\n}", "title": "" }, { "docid": "d1857bfc144e7278e7b21cce6afa52ce", "score": "0.39811167", "text": "func (f *featureGate) AddFlag(fs *flag.FlagSet) {\n\tf.lock.Lock()\n\t// TODO(mtaufen): Shouldn't we just close it on the first Set/SetFromMap instead?\n\t// Not all components expose a feature gates flag using this AddFlag method, and\n\t// in the future, all components will completely stop exposing a feature gates flag,\n\t// in favor of componentconfig.\n\tf.closed = true\n\tf.lock.Unlock()\n\n\tknown := f.KnownFeatures()\n\tfs.Var(f, flagName, \"\"+\n\t\t\"A set of key=value pairs that describe feature gates for alpha/experimental features. \"+\n\t\t\"Options are:\\n\"+strings.Join(known, \"\\n\"))\n}", "title": "" }, { "docid": "0580cc448f603a958b23907081456c09", "score": "0.39780748", "text": "func (_StandaloneERC20 *StandaloneERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandaloneERC20.Contract.IncreaseAllowance(&_StandaloneERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "3bebfbdf0f9e6b3a648e5c1e88a4481f", "score": "0.39545053", "text": "func (_Levtoken *LevtokenTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Levtoken.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "876a3b6b914a50d61a073d3596471178", "score": "0.39543375", "text": "func (_ERC20WithPermit *ERC20WithPermitTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithPermit.Contract.IncreaseAllowance(&_ERC20WithPermit.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "f65ed39160bf603f973e7247f19de28b", "score": "0.3950254", "text": "func (_ReserveDollarV2 *ReserveDollarV2Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ReserveDollarV2.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "5dcf9b6a5c664928199637fbaa698a2d", "score": "0.39426488", "text": "func (_WindMineToken *WindMineTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _WindMineToken.Contract.IncreaseApproval(&_WindMineToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "3f33bfb8690cd386f5d5ef61cacb3395", "score": "0.39412913", "text": "func (r *mockReporter) ReportStableRequestConcurrency(v float64) error {\n\treturn nil\n}", "title": "" }, { "docid": "aea0df63b013d5f55f8ace6b5ec329ad", "score": "0.39358243", "text": "func (o *V0037License) SetInUse(v int32) {\n\to.InUse = &v\n}", "title": "" }, { "docid": "e4ebc828dcb3029e36026d6a8de2dbd9", "score": "0.39341694", "text": "func (_QLCChain *QLCChainTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _QLCChain.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "87231277e0e8311e7cc2f25a6c5686ef", "score": "0.3934086", "text": "func (_ERC20Mintable *ERC20MintableSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Mintable.Contract.IncreaseAllowance(&_ERC20Mintable.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "c8278eff319445aeb258b600ec5d2eea", "score": "0.3925742", "text": "func (_ReserveDollarV2 *ReserveDollarV2TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ReserveDollarV2.Contract.IncreaseAllowance(&_ReserveDollarV2.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "8177e5a5b8819b2c1bf76ce5e5ee4548", "score": "0.39251077", "text": "func (_WindMineToken *WindMineTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _WindMineToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "9b032b954783662ad0769938ec2bccf1", "score": "0.39230925", "text": "func (_ERC20 *ERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "9b032b954783662ad0769938ec2bccf1", "score": "0.3922605", "text": "func (_ERC20 *ERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "9b032b954783662ad0769938ec2bccf1", "score": "0.3922605", "text": "func (_ERC20 *ERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "225128d9d1df2139dbd78187a47a44bf", "score": "0.39106494", "text": "func (_ERC20WithPermit *ERC20WithPermitSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithPermit.Contract.IncreaseAllowance(&_ERC20WithPermit.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "c6414aa07f129e8dfa4cfb68944ca423", "score": "0.39076954", "text": "func (_WETH *WETHTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _WETH.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "4a2606f1b001b1c0654e8761b51d47d0", "score": "0.3900893", "text": "func (rus *ResourceUses) Add(pos ast.Position) {\n\tif rus.Contains(pos) {\n\t\treturn\n\t}\n\tif rus.positions == nil {\n\t\trus.positions = NewAstPositionResourceUseOrderedMap()\n\t}\n\trus.positions.Set(pos, ResourceUse{})\n}", "title": "" }, { "docid": "8a74b0b3ceeb0a2042e2318425a5d7a6", "score": "0.38935816", "text": "func (_CappedToken *CappedTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _CappedToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "409a5d3a4994575861c199d26d671bc8", "score": "0.38913137", "text": "func (_SampleCrowdsaleToken *SampleCrowdsaleTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SampleCrowdsaleToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "22564e54ff068dff332ae07f5bec5aec", "score": "0.38869905", "text": "func (s *BasemodelicaListener) EnterAdd_op(ctx *Add_opContext) {}", "title": "" }, { "docid": "c07c16b0b3685dddb93a95d179a3fa0e", "score": "0.3883775", "text": "func (_ERC20WithRate *ERC20WithRateTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithRate.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "73a97bf118f0a1f949ff921e94079792", "score": "0.38834202", "text": "func (_OToken *OTokenTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _OToken.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "344b5cf9909720fad830f1737003dfb5", "score": "0.38805896", "text": "func (_SampleCrowdsaleToken *SampleCrowdsaleTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SampleCrowdsaleToken.Contract.IncreaseApproval(&_SampleCrowdsaleToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "3ec1e3696b3c4f2fa2fb05ea24dc00be", "score": "0.38794404", "text": "func (m *PlanetMutation) AddSolarProdLevel(i int) {\n\tif m.addsolar_prod_level != nil {\n\t\t*m.addsolar_prod_level += i\n\t} else {\n\t\tm.addsolar_prod_level = &i\n\t}\n}", "title": "" }, { "docid": "b334684c02369d1d6f75c0963060041f", "score": "0.38731337", "text": "func (_Contract *ContractTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "b8ed22ade4d807c2d7b1230c01036a58", "score": "0.38683158", "text": "func (wg *WaitGroup) Add(delta int) {\n\twg.mutex.Lock()\n\tdefer wg.mutex.Unlock()\n\twg.c += int64(delta)\n\tif wg.c < 0 {\n\t\tpanic(\"udp: negative WaitGroup counter\") // nolint\n\t}\n\twg.cond.Signal()\n}", "title": "" }, { "docid": "5960143427b21e82fed56c61e5c9a737", "score": "0.38529482", "text": "func (_WindMineToken *WindMineTokenSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _WindMineToken.Contract.IncreaseApproval(&_WindMineToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "159d3da93cfe5e0bd4a4579a73137737", "score": "0.38525656", "text": "func (_CappedToken *CappedTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _CappedToken.Contract.IncreaseApproval(&_CappedToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "3efbdfeec8047e569bce2e921641d7a5", "score": "0.38456547", "text": "func AddBonus(card *types.Card,persent int,dayslnMonth int,dayslnYear int) {\n\tbonus:=0\n\n\tif !card.Active{\n\t\treturn \n\t}\n\tif card.Balance<=0{\n\t\treturn\n\t}\n\tif card.MinBalance<10_000{\n\t\treturn\n\t}\n\tbonus=int(card.MinBalance)*persent/100*dayslnMonth/dayslnYear\n\t\n\tif bonus<=maxBonus{\n\t\tDeposit(card,types.Money(bonus))\n\t\treturn\n\t}\n\tbonus=0\n\tDeposit(card,types.Money(bonus))\n}", "title": "" }, { "docid": "3ed10fd9055b5594b8caa0ca4f83a730", "score": "0.38440368", "text": "func (m *WidgetMutation) AddPriority(i int) {\n\tif m.addpriority != nil {\n\t\t*m.addpriority += i\n\t} else {\n\t\tm.addpriority = &i\n\t}\n}", "title": "" }, { "docid": "0ca240d168942d00f945e0c02e5307bf", "score": "0.38374752", "text": "func (_SampleCrowdsaleToken *SampleCrowdsaleTokenSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SampleCrowdsaleToken.Contract.IncreaseApproval(&_SampleCrowdsaleToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "d0ee3c3820b3fba23e0ed4e25cac2228", "score": "0.38317493", "text": "func (_AastraVault *AastraVaultTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _AastraVault.Contract.IncreaseAllowance(&_AastraVault.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "e91337647e8b84d7d463353f9d981922", "score": "0.38291168", "text": "func (_ERC20 *ERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "e91337647e8b84d7d463353f9d981922", "score": "0.38291168", "text": "func (_ERC20 *ERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "e91337647e8b84d7d463353f9d981922", "score": "0.3827976", "text": "func (_ERC20 *ERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.Contract.IncreaseAllowance(&_ERC20.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "a99ee55c2d63b603ca7b5fe6477c91aa", "score": "0.38252988", "text": "func (_SushiStaking *SushiStakingTransactor) Add(opts *bind.TransactOpts, _allocPoint *big.Int, _lpToken common.Address, _withUpdate bool) (*types.Transaction, error) {\n\treturn _SushiStaking.contract.Transact(opts, \"add\", _allocPoint, _lpToken, _withUpdate)\n}", "title": "" }, { "docid": "46803620db37462c56a54a0be89b7462", "score": "0.38173774", "text": "func PNCounterAddEncodeRequest(name string, delta int64, getBeforeUpdate bool, replicaTimestamps []*Pair, targetReplica *Address) *ClientMessage {\n\t// Encode request into clientMessage\n\tclientMessage := NewClientMessage(nil, pncounterAddCalculateSize(name, delta, getBeforeUpdate, replicaTimestamps, targetReplica))\n\tclientMessage.SetMessageType(pncounterAdd)\n\tclientMessage.IsRetryable = false\n\tclientMessage.AppendString(name)\n\tclientMessage.AppendInt64(delta)\n\tclientMessage.AppendBool(getBeforeUpdate)\n\tclientMessage.AppendInt32(int32(len(replicaTimestamps)))\n\tfor _, replicaTimestampsItem := range replicaTimestamps {\n\t\tkey := replicaTimestampsItem.key.(string)\n\t\tval := replicaTimestampsItem.value.(int64)\n\t\tclientMessage.AppendString(key)\n\t\tclientMessage.AppendInt64(val)\n\t}\n\tAddressCodecEncode(clientMessage, targetReplica)\n\tclientMessage.UpdateFrameLength()\n\treturn clientMessage\n}", "title": "" }, { "docid": "992b44cafff418348411fd5dbf904158", "score": "0.38170078", "text": "func (_ERC20WithRate *ERC20WithRateTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ERC20WithRate.Contract.IncreaseAllowance(&_ERC20WithRate.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "ef1ba1de5932fd97bac8ceb1999fc65e", "score": "0.38141003", "text": "func (_PausableToken *PausableTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _PausableToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "8ac1ad3caadbba187952db51ab7e9843", "score": "0.3811379", "text": "func (_ReserveDollarV2 *ReserveDollarV2Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _ReserveDollarV2.Contract.IncreaseAllowance(&_ReserveDollarV2.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "8493aaf0929db8fc04f7edba3abe1acb", "score": "0.38091856", "text": "func AddFeatureGate(current, new string) string {\n\tif current == \"\" {\n\t\treturn new\n\t}\n\treturn current + \",\" + new\n}", "title": "" }, { "docid": "51697e9bbf575a4d01a405052ad4c607", "score": "0.3808666", "text": "func (_Levtoken *LevtokenTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Levtoken.Contract.IncreaseAllowance(&_Levtoken.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "7792b8285b84b3da02cef74a6141fcb3", "score": "0.3799468", "text": "func (_BCB *BCBTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _BCB.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "6b85e97125d3e659bf8d6d820592cac6", "score": "0.37906468", "text": "func (_SMTToken *SMTTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _SMTToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "7fbb29e128d71b39ea8ad44a3b1f0796", "score": "0.37899205", "text": "func (_PausableToken *PausableTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _PausableToken.Contract.IncreaseApproval(&_PausableToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "08db4738d36368dc4199e060f10dba2a", "score": "0.3789334", "text": "func AddDispatch(ctx context.Context, priorityLevel, flowSchema string) {\n\tapiserverDispatchedRequestsTotal.WithContext(ctx).WithLabelValues(priorityLevel, flowSchema).Add(1)\n}", "title": "" }, { "docid": "fc8fd2a80b2108c945a2abee688d693d", "score": "0.37864372", "text": "func (configStruct *ConfigStruct) AddConcurrency(item Concurrency) []Concurrency {\n\tconfigStruct.Concurrencies = append(configStruct.Concurrencies, item)\n\treturn configStruct.Concurrencies\n}", "title": "" }, { "docid": "a1d830832dcd128ac9606d2eb68eb0cc", "score": "0.37861642", "text": "func (_CappedToken *CappedTokenSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _CappedToken.Contract.IncreaseApproval(&_CappedToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "aa0c9560d7b812af88c801672e21695a", "score": "0.37849155", "text": "func (tc *coordinator) AddRequest(method string, header *proto.RequestHeader) {\n\t// Ignore non-transactional requests.\n\tif header.Txn == nil || !isTransactional(method) {\n\t\treturn\n\t}\n\n\ttc.Lock()\n\tdefer tc.Unlock()\n\ttxnMeta, ok := tc.txns[string(header.Txn.ID)]\n\tif !ok {\n\t\ttxnMeta = &txnMetadata{\n\t\t\ttxn: *header.Txn,\n\t\t\tkeys: util.NewIntervalCache(util.CacheConfig{Policy: util.CacheNone}),\n\t\t\tlastUpdateTS: tc.clock.Now(),\n\t\t\ttimeoutDuration: tc.clientTimeout,\n\t\t\tcloser: make(chan struct{}),\n\t\t}\n\t\ttc.txns[string(header.Txn.ID)] = txnMeta\n\n\t\t// TODO(jiajia): Reevaluate this logic of creating a goroutine\n\t\t// for each active transaction. Spencer suggests a heap\n\t\t// containing next heartbeat timeouts which is processed by a\n\t\t// single goroutine.\n\t\tgo tc.heartbeat(header.Txn, txnMeta.closer)\n\t}\n\ttxnMeta.lastUpdateTS = tc.clock.Now()\n\n\t// If read-only, exit now; otherwise, store the affected key range.\n\tif storage.IsReadOnly(method) {\n\t\treturn\n\t}\n\t// Otherwise, append a new key range to the set of affected keys.\n\ttxnMeta.addKeyRange(header.Key, header.EndKey)\n}", "title": "" }, { "docid": "03b5e4ae1dedb65a3559397d4eff0e62", "score": "0.3781255", "text": "func (w *Wallet) IncrementUsage(a wallet.Address) {\n\tlog.Trace(\"IncrementUsage \", a)\n}", "title": "" }, { "docid": "5e6ec3daeda926d89d7a7ee0cee426a8", "score": "0.3779437", "text": "func (_Cash *CashTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Cash.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" }, { "docid": "bfe7ce43a491c416b9e55a1f0b4edba4", "score": "0.37756157", "text": "func (_Cash *CashTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Cash.Contract.IncreaseApproval(&_Cash.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "83965bd6f2560d800ac88dfda3f289b9", "score": "0.37744063", "text": "func (_Contract *ContractTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Contract.Contract.IncreaseAllowance(&_Contract.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "1740e09cf8535fd6736d8f33d1c0cba8", "score": "0.37739852", "text": "func (mr *MockStatefulCmdableMockRecorder) ClusterAddSlotsRange(ctx, min, max interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ClusterAddSlotsRange\", reflect.TypeOf((*MockStatefulCmdable)(nil).ClusterAddSlotsRange), ctx, min, max)\n}", "title": "" }, { "docid": "44f6937e846a94b84ab12b66adab2e5b", "score": "0.3764501", "text": "func (_StandardToken *StandardTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.Contract.IncreaseApproval(&_StandardToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "44f6937e846a94b84ab12b66adab2e5b", "score": "0.3764501", "text": "func (_StandardToken *StandardTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.Contract.IncreaseApproval(&_StandardToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "44f6937e846a94b84ab12b66adab2e5b", "score": "0.3764501", "text": "func (_StandardToken *StandardTokenTransactorSession) IncreaseApproval(_spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.Contract.IncreaseApproval(&_StandardToken.TransactOpts, _spender, _addedValue)\n}", "title": "" }, { "docid": "6371e8fbef86a0575af0a6088a94f6fa", "score": "0.3764246", "text": "func (c *Feeder) AddQuantity(quantity int) {c.quantity = imin(c.quantity + quantity, c.capacity)}", "title": "" }, { "docid": "eed1146d82350f8307a0cee948ecd9ed", "score": "0.37642282", "text": "func (_WETH *WETHTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _WETH.Contract.IncreaseAllowance(&_WETH.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "289bc6c8881c7e0a384c7d130ec93f97", "score": "0.37619084", "text": "func (_RenERC20LogicV1 *RenERC20LogicV1Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _RenERC20LogicV1.contract.Transact(opts, \"increaseAllowance\", spender, addedValue)\n}", "title": "" }, { "docid": "61b008af05fdb3a04024cba0d48a75f9", "score": "0.3754943", "text": "func (st *State) Add(ctx context.Context, c api.Pin) (err error) {\n\t_, span := trace.StartSpan(ctx, \"state/dsstate/Add\")\n\tdefer span.End()\n\n\tps, err := st.serializePin(c)\n\tif err != nil {\n\t\treturn\n\t}\n\n\thas, _ := st.Has(ctx, c.Cid)\n\tdefer func() {\n\t\tif !has && err == nil {\n\t\t\ttotal := atomic.AddInt64(&st.totalPins, 1)\n\t\t\tstats.Record(ctx, observations.Pins.M(total))\n\t\t}\n\t}()\n\n\terr = st.dsWrite.Put(ctx, st.key(c.Cid), ps)\n\treturn\n}", "title": "" }, { "docid": "4d6d1f0b87d465b04ff10d0d7704b35b", "score": "0.3753787", "text": "func (r *PendingStorage) AddPendingRequest(ctx context.Context, obj, req core.RecordID) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tif _, ok := r.requests[obj]; !ok {\n\t\tr.requests[obj] = map[core.RecordID]struct{}{}\n\t}\n\tr.requests[obj][req] = struct{}{}\n\n\tctx = insmetrics.InsertTag(ctx, tagJet, r.jetID.DebugString())\n\tstats.Record(ctx, statRecentStoragePendingsAdded.M(1))\n}", "title": "" }, { "docid": "f9201b86be091cab2545e2ca0d004f11", "score": "0.37534812", "text": "func (s *Selectivity) Add(other Selectivity) {\n\ts.selectivity = selectivityInRange(s.selectivity + other.selectivity)\n}", "title": "" }, { "docid": "2e25d1b571c7bab108573fb2f0df7c1a", "score": "0.3753289", "text": "func (_RenERC20LogicV1 *RenERC20LogicV1TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _RenERC20LogicV1.Contract.IncreaseAllowance(&_RenERC20LogicV1.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "3bf157a4fd7450cfef6bcef72f16511c", "score": "0.3753092", "text": "func (_Levtoken *LevtokenSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) {\n\treturn _Levtoken.Contract.IncreaseAllowance(&_Levtoken.TransactOpts, spender, addedValue)\n}", "title": "" }, { "docid": "c13c80293959769e87c5cb6fe43122dd", "score": "0.37529194", "text": "func (_StandardToken *StandardTokenTransactor) IncreaseApproval(opts *bind.TransactOpts, _spender common.Address, _addedValue *big.Int) (*types.Transaction, error) {\n\treturn _StandardToken.contract.Transact(opts, \"increaseApproval\", _spender, _addedValue)\n}", "title": "" } ]
68db5cf8628b027a63b80c21c283ff62
main function used to be the entry pointof the go program Coded by Biswa Ranjan Behera
[ { "docid": "76273177389dc9c3a619d5ea383f3f8d", "score": "0.0", "text": "func main(){\n\tm = make(map[string]Employee)\n\n\tm[\"PoojaShetty\"] = Employee{\n\t\t25, \n\t\t560068,\n\t\t\"Banaglare\",\n\t}\n\tm[\"BanuPrakash\"] = Employee{\n\t\t28, 560089, \"Banashankari\",\n\t}\t\n\n\tfmt.Println(m)\n\n\tfmt.Println(m[\"BanuPrakash\"])\n\n\tdelete(m,\"BanuPrakash\")\n\t\n\n\tfmt.Println(m)\n\t\n\tfmt.Println(\"Check if Banu is presentor not\")\n\tfmt.Println(CheckIfKeyExists(\"PoojaShetty\", m))\n\t\n}", "title": "" } ]
[ { "docid": "198710d2ec32053f81d54f193c59ca7a", "score": "0.7961091", "text": "func main() {\n\tmain()\n}", "title": "" }, { "docid": "3844aedaba7e3c9b2974879ceb9fdb40", "score": "0.79103774", "text": "func main() {\n\n\t// TODO\n}", "title": "" }, { "docid": "b3dffb86e3d1d825a986728cf3bbabbb", "score": "0.78538656", "text": "func main() {\n\tif rc := main2(os.Args, afero.NewOsFs(), logrus.StandardLogger(), main3); rc != 0 {\n\t\tos.Exit(rc)\n\t}\n}", "title": "" }, { "docid": "b3dffb86e3d1d825a986728cf3bbabbb", "score": "0.78538656", "text": "func main() {\n\tif rc := main2(os.Args, afero.NewOsFs(), logrus.StandardLogger(), main3); rc != 0 {\n\t\tos.Exit(rc)\n\t}\n}", "title": "" }, { "docid": "e9c6c8d1453bf9826e3d61b49b384daf", "score": "0.7772051", "text": "func main() {\n\t\t\n\t\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7724616", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7724616", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7724616", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7724616", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bbe51c2a99d5266e77fa2ea1ffd8f55d", "score": "0.7724616", "text": "func main() {\n\tgimain.Main(func() {\n\t\tmainrun()\n\t})\n}", "title": "" }, { "docid": "bb9a51b8e78f24035cc090026088029f", "score": "0.7660514", "text": "func main() {\n\tctx := context.Background()\n\n\tif err := run(ctx); err != nil {\n\t\tklog.Fatalf(\"unexpected error: %v\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.76530397", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.76530397", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "22262302ea296ebbdd002525a773db59", "score": "0.76530397", "text": "func main() {\n\t\n}", "title": "" }, { "docid": "9e0c0117689d5421396623beffb4b95e", "score": "0.7652909", "text": "func main() {\n\tif err := Run(os.Stdin, os.Stdout, os.Args); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}", "title": "" }, { "docid": "4b892c720f2b24434d6f6d13b9112acf", "score": "0.76516813", "text": "func main() {\r\n\r\n}", "title": "" }, { "docid": "4b892c720f2b24434d6f6d13b9112acf", "score": "0.76516813", "text": "func main() {\r\n\r\n}", "title": "" }, { "docid": "35e90324a7f158694bffa33203fbe5fc", "score": "0.7640801", "text": "func main() {\n\tfmt.Println(\"main func\")\n}", "title": "" }, { "docid": "bbe68f7f79345c00d3847751a48383d4", "score": "0.76348203", "text": "func main() {\n\tcli.Run()\n}", "title": "" }, { "docid": "cac54b940922fe0b5df36a656936f669", "score": "0.7614001", "text": "func main() {\n\t// ?\n}", "title": "" }, { "docid": "cac54b940922fe0b5df36a656936f669", "score": "0.7614001", "text": "func main() {\n\t// ?\n}", "title": "" }, { "docid": "92000bf06c16c94f56959dbd3e95d1be", "score": "0.76020914", "text": "func main() {\n\terr := run()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"error:\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "4dbfcc9b7126bc149bb1724c26e4836e", "score": "0.75844294", "text": "func main() {\n\terr := run()\n\tif err != nil {\n\t\tlog.Fatalf(\"** %+v\", err)\n\t}\n}", "title": "" }, { "docid": "b95fda471a371f0e6ed4787e823de9f1", "score": "0.75824803", "text": "func main() {\n\n\tif err := run(); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "0f2feb1401a20a613d9662b42fd9b783", "score": "0.7540936", "text": "func main() {\n\tInit()\n}", "title": "" }, { "docid": "f51bf78a4a9e9e14a3804db3f0b48371", "score": "0.7510876", "text": "func main() {\n\tfmt.Println(\"main\")\n\n}", "title": "" }, { "docid": "5ce4f213d0c8a09fd3b9d213777e75fa", "score": "0.7505782", "text": "func main() {\n\tif err := run(os.Args, os.Stdout); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "4cd8417ea8ce2416a6ebe086a52cfea4", "score": "0.7499835", "text": "func main() {\n\tcmd.Run()\n}", "title": "" }, { "docid": "445b7da0c43dc0c4cebc44651e71d40c", "score": "0.7490636", "text": "func main() {\n\tif err := mainWithError(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t} else {\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "2c0cf8a87451702db328d18448743fed", "score": "0.7472697", "text": "func main() {\r\n}", "title": "" }, { "docid": "0eff4ce30bc0e067f6c5068d63efbd61", "score": "0.74588686", "text": "func main() {\n\tos.Exit(Main())\n}", "title": "" }, { "docid": "0e6113d06bc39dcf2f083e90454ce66f", "score": "0.74556553", "text": "func main() {\n\tapp := cli.CliApp()\n\terr := app.Run(os.Args)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "65eba7ade60cd3a4b2d5833119e8330e", "score": "0.7431965", "text": "func main() {\n\tif err := run(os.Args); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s: %v\\n\", os.Args[0], err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "3fa41fe8abc23325440091e61ef124b0", "score": "0.7429429", "text": "func main(){\n\tfmt.Println(\"Hola mundo!\")\n}", "title": "" }, { "docid": "65c105278bd20f31d5958245a6a78403", "score": "0.74286026", "text": "func main() {\n\tif len(os.Args) == 1 {\n\t\tb := newBoard()\n\t\tb.FillRandom()\n\t\tb.FindPartialSolution()\n\t\tb.PrintFull()\n\t\tb.PrintPartial()\n\t\tos.Exit(0)\n\t}\n\tif os.Args[1] == \"gen\" {\n\t\tgenerateToFile()\n\t\tos.Exit(0)\n\t}\n\tif os.Args[1] == \"read\" {\n\t\tprintFromFile()\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "6d9bdbc397381dea93087286374c8baa", "score": "0.7427624", "text": "func main() {\n\n\tbin.Main()\n\n}", "title": "" }, { "docid": "b273ae16345bdd64957f6a46bc1e3fb2", "score": "0.742388", "text": "func main(){\n\n\t// intro\n\tintro()\n\n\t// analyze\n\tanalyze()\n}", "title": "" }, { "docid": "f0e2e2207e54d7155057c82dc97bde59", "score": "0.74178886", "text": "func main() {\n\tbuild().Run()\n}", "title": "" }, { "docid": "3526ab70a07b13f97fac99c2bb1e45a5", "score": "0.7416718", "text": "func main() {\n\n\tsys.Run()\n\n}", "title": "" }, { "docid": "2b040c1939149a4eb0e5e8806d18314e", "score": "0.7410689", "text": "func main(){\n\n}", "title": "" }, { "docid": "a43945e2b05ee44d5b8748958a793bee", "score": "0.740267", "text": "func main() {\n \n}", "title": "" }, { "docid": "0c0c7ba07f0a5b9a182b439db584168c", "score": "0.7397621", "text": "func main() {\n\tlog.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)\n\n\tport := 8000\n\tif a := os.Getenv(\"PORT\"); a != \"\" {\n\t\tvar err error\n\t\tport, err = strconv.Atoi(a)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(\"wrong port number\", a)\n\t\t}\n\t}\n\n\t// app.Handler is a standard HTTP handler that serves the UI and its\n\t// resources to make it work in a web browser.\n\t//\n\t// It implements the http.Handler interface so it can seamlessly be used\n\t// with the Go HTTP standard library.\n\thttp.Handle(\"/\", internal.NewWebHandler())\n\n\terr := http.ListenAndServe(\":\"+strconv.Itoa(port), nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//todo\n\t//fmt.Println(\"hello world\")\n\t//\n\t//\n\t//// init git repo\n\t//\n\t//// get a new note\n\t//\n\t//// add and commit into git\n}", "title": "" }, { "docid": "98ee3b37dd6e2f110f49de7943b69140", "score": "0.73907936", "text": "func main(){\n\n\tfmt.Println()\n\n}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1ead116dc500053cba797b79a38bab47", "score": "0.73894054", "text": "func main() {}", "title": "" }, { "docid": "1e1f403040063d5876df32b8c754bbd1", "score": "0.73853415", "text": "func main() {\n\tsetConfig()\n\tsetDb()\n\tsetLog()\n\tsetRoute()\n\n\tbeego.Run()\n}", "title": "" }, { "docid": "cc6dcf27a78f85d1077e87e8894c63b9", "score": "0.73802656", "text": "func main() {\n\tlog.Fatalf(\"Running main is not supported.\")\n}", "title": "" }, { "docid": "27d27404942241caa6b52a98a6c0d07f", "score": "0.73758763", "text": "func main() { \n\n}", "title": "" }, { "docid": "0c28ac788f02f5d6a47d60154d56d18e", "score": "0.73693794", "text": "func main() {\n\tfmt.Println(\"Main!\")\n}", "title": "" }, { "docid": "7c714ff53006173ff185161823ef9c39", "score": "0.736527", "text": "func main() {\n\ta, err := newApp(caAddr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ta.Start()\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "fe37a56468760f9b7e2d909fa708e300", "score": "0.735362", "text": "func main() {\n\n}", "title": "" }, { "docid": "23557083e7288db1a69adbec41b4733a", "score": "0.735072", "text": "func main() {\n\tif err := app.Run(os.Args); err != nil {\n\t\tos.Exit(1)\n\t}\n}", "title": "" } ]
bd0526b4fe9549fbe8c17dd6d371a5c8
Render mounts/displays a welcome component in the terminal.
[ { "docid": "b440f51e4c749b57ba25d41ba7a30af4", "score": "0.6184439", "text": "func (w Welcome) Render(uiConfig *Config) {\n\twelcome := createWelcomePar(uiConfig)\n\n\ttui.Body.AddRows(tui.NewRow(\n\t\ttui.NewCol(6, 0, welcome),\n\t))\n\n\ttui.Body.Align()\n\ttui.Render(tui.Body)\n}", "title": "" } ]
[ { "docid": "8a51bed79a5fd8f020d260a0b56da04c", "score": "0.60436684", "text": "func welcome() {\n\tfmt.Println(\"\")\n\tfmt.Println(\"``````````````````````````````````````````````````\")\n\tfmt.Println(\"` GOT WebFramework (EARLY BUILD 4) `\")\n\tfmt.Println(\"` `\")\n\tfmt.Println(\"``````````````````````````````````````````````````\")\n\tPrintRegistry()\n}", "title": "" }, { "docid": "2cd20553560b025298f268b9b396965b", "score": "0.5974389", "text": "func NewWelcomeComponent() Welcome {\n\treturn Welcome{\n\t\tview: View{\n\t\t\tName: \"welcome\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3ecf15159b335b5a7c1ff13ef48f4e7d", "score": "0.56505907", "text": "func (r *StartRenderer) Render() string {\n\ts := \"\"\n\tc := r.Config\n\n\tif c.Root != \"\" {\n\t\ts += fmt.Sprintf(\"cd %s\\n\", c.Root)\n\t}\n\n\tname := \"\"\n\tif c.Name != \"\" {\n\t\tname = fmt.Sprintf(\"-s %s\", c.Name)\n\t}\n\ts += fmt.Sprintf(\"SESSION_NO=%s\\n\\n\", shell_helper.CommandSubstitution(fmt.Sprintf(\"tmux new-session -dP %s\", name)))\n\n\tfor i, w := range c.Windows {\n\t\ts += r.renderWindow(&w, i == 0)\n\t}\n\n\tif c.Attach == nil || *c.Attach {\n\t\ts += \"tmux attach-session -t $SESSION_NO\\n\"\n\t} else {\n\t\ts += \"echo $SESSION_NO\\n\"\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "1f52038904487ba41f79b4058ddde44c", "score": "0.550837", "text": "func serveHome(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"<h1>Welcome to API in Golang</h1>\"))\n}", "title": "" }, { "docid": "e6db9a0e5acc0bc562751c90308b4d8a", "score": "0.5353286", "text": "func displayWelcomeMessage(baseConf *viper.Viper) {\n\tif (baseConf.GetString(\"log.startup-phrase.title.value\") != \"\") &&\n\t\t(baseConf.GetString(\"log.startup-phrase.title.font\") != \"\") {\n\t\tascii_art.WelcomeTitle(\n\t\t\tbaseConf.GetString(\"log.startup-phrase.title.value\"),\n\t\t\tbaseConf.GetString(\"log.startup-phrase.title.font\"))\n\t}\n\tif (baseConf.GetString(\"log.startup-phrase.message.value\") != \"\") &&\n\t\t(baseConf.GetString(\"log.startup-phrase.message.font\") != \"\") {\n\t\tascii_art.WelcomeMessage(\n\t\t\tbaseConf.GetString(\"log.startup-phrase.message.value\"),\n\t\t\tbaseConf.GetString(\"log.startup-phrase.message.font\"))\n\t}\n}", "title": "" }, { "docid": "c991f0e569067570f80c8782ce80ef1f", "score": "0.52891177", "text": "func welcomeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"Welcome to EQ Works 😎\")\n}", "title": "" }, { "docid": "223cc996e9e08495ef97391fc776eb2e", "score": "0.52730095", "text": "func printWelcome() {\n\tfmt.Println(\"Welcome to the Internet Relay Chat!\")\n\tfmt.Println(\"For HELP, type \\\"/help\\\" at any time.\")\n\tfmt.Println(\"To terminate your session, type \\\"/quit\\\" at any time.\")\n}", "title": "" }, { "docid": "cc14f8aef1fd125e0b5b62c34ac1a61c", "score": "0.52583706", "text": "func (app *Syntappd) Home(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`Hello SynTouch`))\n}", "title": "" }, { "docid": "5ed0ae42903b76fd0b526d692441aa9c", "score": "0.514609", "text": "func root(w http.ResponseWriter, r *http.Request) {\n\tio.WriteString(w, \"Server is up and running\")\n}", "title": "" }, { "docid": "c479e1c33e502428b4f3f9d803acc394", "score": "0.51350796", "text": "func (h IndexHandler) Welcome(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Welcome!\"))\n}", "title": "" }, { "docid": "7d394b57760689d38a987a9c06c4da97", "score": "0.5117771", "text": "func homePage(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\twelcomeMessage := `\n\t\t<div style=\"display:grid;height:75vh\">\n\t\t\t<h1 style=\"text-align:center; margin:auto\"> Welcome to SQL ANGELES </h1>\n\t\t</div>`\n\n\tfmt.Fprintf(w, welcomeMessage)\n}", "title": "" }, { "docid": "d5049e17105ffbde4c47f8a1810052c1", "score": "0.51152474", "text": "func GetWelcome() string {\n\treturn \"Welcome to HexChess!\"\n}", "title": "" }, { "docid": "48c8eb67fc30101b9309ad209241f28c", "score": "0.5073961", "text": "func Welcome(name string) (string, error) {\n\tif name != \"\" {\n\t\treturn fmt.Sprintf(\"Welcome %s\", name), nil\n\t}\n\treturn \"\", errors.New(\"name cannot be empty\")\n}", "title": "" }, { "docid": "1472419e54693aa526275f0511701652", "score": "0.50536424", "text": "func home(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"[INFO] HomeLink joined\")\n\tfmt.Fprint(w, \"Status: running. This daemon exposes an API enabling you to interact with Laia\")\n}", "title": "" }, { "docid": "d3d8922147a45a65208f0d3ef63fde5f", "score": "0.50216585", "text": "func (controller *Home) Display() {\n\tcontroller.SetCustomTitle(\"Wisply - Subject\")\n\tcontroller.LoadTemplate(\"home\")\n}", "title": "" }, { "docid": "93e0223c65e08a4ade8d2fb61bfaf760", "score": "0.50207394", "text": "func (s *Server) handleWelcome(path string, w http.ResponseWriter, r *http.Request) {\n\t//1. head\n\thead, err := getHead(\"Welcome\", \"Introduction\")\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to generate html head.\")\n\t\thead = \"empty head\"\n\t}\n\n\t//2. body\n\tbody, err := genWelcomePage(path)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to generate html body.\")\n\t\tbody = \"empty body\"\n\t}\n\n\t//3. foot\n\tfoot := s.genPageFoot(r)\n\n\tif _, err := io.WriteString(w, head+body+foot); err != nil {\n\t\tglog.Errorf(\"Failed to send response: %v.\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "50717580d970ecc3122fadeeb75ea07c", "score": "0.5014284", "text": "func index(ctx *fasthttp.RequestCtx) {\n\tfmt.Fprint(ctx, \"Welcome!\\n\")\n}", "title": "" }, { "docid": "59f7188a7fbb749905967e1c5e0caf1e", "score": "0.50059307", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Welcome to the home page\")\n}", "title": "" }, { "docid": "a4b3675d1cda4f0367581cac7adc5b72", "score": "0.49923572", "text": "func (c *Console) Render(g *game.Game) {\n\tc.display.Clear(termbox.ColorDefault, termbox.ColorDefault)\n\tc.curscr.Render(g)\n\tc.display.Flush()\n}", "title": "" }, { "docid": "1a659aed5f33bcd3f89cfc26b9d013b7", "score": "0.4980815", "text": "func welcomeHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.ServeFile(w, r, \"welcome.html\")\n}", "title": "" }, { "docid": "b012afff7bc9a05543c4a2ef281e52b5", "score": "0.49734038", "text": "func (app *application) Home(w http.ResponseWriter, r *http.Request) {\n\tif err := app.renderTemplate(w, r, \"home\", nil); err != nil {\n\t\tapp.errorLog.Println(err)\n\t}\n}", "title": "" }, { "docid": "ed3b12eefebff0bcccdebafe76008a5a", "score": "0.49690726", "text": "func renderLogin(w http.ResponseWriter, r *http.Request) error {\n\tout, err := TMPLERRlogin(\"Hydrocarbon\", loggedIn(r))\n\tif err != nil {\n\t\treturn httputil.Wrap(err, http.StatusInternalServerError)\n\t}\n\n\t_, err = w.Write([]byte(out))\n\tif err != nil {\n\t\treturn httputil.Wrap(err, http.StatusInternalServerError)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14647597dc21c4b7372469b8ecb86841", "score": "0.49488378", "text": "func index(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Welcome!\\n\")\n}", "title": "" }, { "docid": "71b17f31a285e60720bfbcb38047f79f", "score": "0.49485192", "text": "func handleDashboard(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Hello, here is your dashboard\")\n}", "title": "" }, { "docid": "55b2487a8f00f6aec47fb5ecbe192da7", "score": "0.49429998", "text": "func Head(ctx randr.Context) string {\n\tprops := ctx.Props.(*randr.BasicProps)\n\t// Check that the context has been set\n\t// if not, we define it and we're done\n\tif ctx.Data[HelmetContext] == nil {\n\t\tctx.Data[HelmetContext] = props.Children\n\t\treturn \"\"\n\t}\n\n\tif val, ok := ctx.Data[HelmetContext].(string); ok {\n\t\tctx.Data[HelmetContext] = val + props.Children\n\t}\n\n\t// Never render anything\n\treturn \"\"\n}", "title": "" }, { "docid": "163046a0e14ddb9eb05a8e219474c6a5", "score": "0.49306443", "text": "func (h *Heading) Render() vecty.ComponentOrHTML {\n\treturn elem.Div(\n\t\telem.Heading1(\n\t\t\tvecty.Text(h.Text),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "c60c808915e4688268f15db0a6f647e7", "score": "0.4925477", "text": "func (h *Hello) Render() string {\n\treturn `\n<div class=\"Hello\">\n\t<div class=\"Menu\" onclick=\"OnMenuClick\" oncontextmenu=\"OnMenuClick\">☰</div>\n\n\t<main class=\"content\">\n\t\t<h1>\n\t\t\tHello\n\t\t\t{{if .Name}}\n\t\t\t\t{{.Name}}\n\t\t\t{{else}}\n\t\t\t\tworld\n\t\t\t{{end}}!\n\t\t</h1>\n\t\t<input value=\"{{.Name}}\" placeholder=\"What is your name?\" onchange=\"Name\" autofocus>\n\t</main>\n</div>\n\t`\n}", "title": "" }, { "docid": "fa6b5798fbecdd3c9e1bd8a6ca55e618", "score": "0.49035025", "text": "func Render(modInfo *utilities.ModuleInfo) ([]byte, error) {\n\n\tgoDownloader, err := utilities.DirectoryContainsFile(modInfo.FilePath(), \".godownloader.yml\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data = struct {\n\t\tGoDownloaderLink string\n\t\tModuleRemotePath string\n\t}{}\n\n\tif goDownloader {\n\t\tdata.GoDownloaderLink = fmt.Sprintf(\n\t\t\t\"https://raw.githubusercontent.com/%s/%s/master/godownloader.sh\",\n\t\t\tmodInfo.SubDomain(),\n\t\t\tmodInfo.Name())\n\t}\n\tdata.ModuleRemotePath = modInfo.RemotePath()\n\n\treturn utilities.ExecuteTemplate(\"install.md\", data)\n\n}", "title": "" }, { "docid": "bf506bc33f0da258e46f8ee18f036404", "score": "0.4900066", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"Welcome!\")\n}", "title": "" }, { "docid": "5ff2802f5cf35a45202e30f4828a2f26", "score": "0.48992237", "text": "func (h *Home) Render() string {\n\treturn `\n<div class=\"Home\">\n\t<div class=\"Example\">\n\t\t<h1>Copy/paste</h1>\n\t\t<ul oncontextmenu=\"OnContextMenu\">\n\t\t\t<li>Select me</li>\n\t\t\t<li>Right click</li>\n\t\t\t<li>Copy</li>\n\t\t</ul>\n\t\t<textarea placeholder=\"Right click/Paste or use meta + v\" oncontextmenu=\"OnContextMenu\"></textarea>\n\t</div>\n\n\t<div class=\"Example\">\n\t\t<h1>Custom menu</h1>\n\t\t<button onclick=\"OnButtonClick\">Show</button>\n\t</div>\n</div>\n\t`\n}", "title": "" }, { "docid": "b9cc472218eb85fdd3ed4f3ac3358fdd", "score": "0.48839387", "text": "func welcomeUser() {\n\tlogrus.Infoln(fmt.Sprintf(\"Welcome to the Planck's Cloud installer.\"))\n}", "title": "" }, { "docid": "d4cedfa7c430c3e1b7b9890bdb93f1ae", "score": "0.48830068", "text": "func renderRegister(w http.ResponseWriter, r *http.Request) error {\n\tout := TMPLregister(\"Hydrocarbon\", loggedIn(r))\n\t_, err := w.Write([]byte(out))\n\tif err != nil {\n\t\treturn httputil.Wrap(err, http.StatusInternalServerError)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2dcd2c93af0ed3a7942a9ad7105f597e", "score": "0.48738018", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"This is the Home Page\")\n}", "title": "" }, { "docid": "442c1c1aedbfbafa0296cb199156a5a8", "score": "0.48618364", "text": "func DisplayHelp(vi VersionInfo) {\n\tfmt.Printf(\"wgmesh %s (%s) - %s\", vi.Version, vi.Commit, vi.Date)\n\tfmt.Println()\n\tfmt.Println(\" bootstrap Starts a bootstrap node\")\n\tfmt.Println(\" join Joins a mesh network by connecting to a bootstrap node\")\n\tfmt.Println(\" info Print out information about the mesh and its nodes\")\n\tfmt.Println(\" tags Set or remove tags on nodes\")\n\tfmt.Println(\" rtt Query RTTs for all nodes\")\n\tfmt.Println(\" ui Starts the web user interface\")\n\tfmt.Println()\n}", "title": "" }, { "docid": "80afd3942d3ba524dc1c6e04f8d72e76", "score": "0.48482385", "text": "func rootHandler(w http.ResponseWriter, r *http.Request) {\n\n\tfmt.Fprintf(w, \"<h1>Yo! I made a server</h1>\")\n}", "title": "" }, { "docid": "6d1e3bcc21ae8e37a10eb2e7113c8861", "score": "0.4838448", "text": "func Welcome(name string) string {\n\treturn \"Welcome to my party, \"+name+\"!\"\n}", "title": "" }, { "docid": "6d7535717a85588af2938aee16c633dd", "score": "0.48181292", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\terr := renderPage(w, \"home.jet\", nil)\n\tif err != nil {\n\t\t_, _ = fmt.Fprint(w, \"Error executing template:\", err)\n\t}\n}", "title": "" }, { "docid": "f8c76869c1d582aa02f5ca9436dc05a8", "score": "0.48044014", "text": "func Welcome(_ http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\thd := r.Context().Value(\"hd\").(*handlerData)\n\thd.pageData.Message = \"Добро пожаловать в нашу Телемедецину!\"\n\thd.pageData.Title = \"Главная страница\"\n}", "title": "" }, { "docid": "68a06d28b5329f4092557179dd2316b9", "score": "0.48025268", "text": "func index(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Set(\"Content-type\", \"application/json\")\n\tjson.NewEncoder(res).Encode(\"Server is running\")\n}", "title": "" }, { "docid": "92e60805a23722f9ddd3d20c55e19361", "score": "0.47844797", "text": "func welcomeHandler(w http.ResponseWriter, req *http.Request) {\n\tif req.URL.Path != \"/\" {\n\t\thttp.NotFound(w, req)\n\t\treturn\n\t}\n\tif isAuthenticated(req) {\n\t\thttp.Redirect(w, req, \"/app\", http.StatusFound)\n\t\treturn\n\t}\n\tpage, _ := ioutil.ReadFile(\"index.html\")\n\tfmt.Fprintf(w, string(page))\n}", "title": "" }, { "docid": "b1588e5732841883c298203d91b57960", "score": "0.4769169", "text": "func Index(r render.Render){\n\tr.HTML(200, \"index\", \"\")\n}", "title": "" }, { "docid": "ebc77dcb53370ca7cdf4be35c8d257fe", "score": "0.47571352", "text": "func Home(ctx echo.Context) error {\n\tb, err := assets.Asset(\"static/index.html\")\n\tif err != nil {\n\t\t// w.Write([]byte(err.Error()))\n\t\treturn err\n\t}\n\treturn ctx.HTML(http.StatusOK, string(b))\n}", "title": "" }, { "docid": "786c4ad2cb4b8afdf816a1b3da22a4e6", "score": "0.47426754", "text": "func Show(w http.ResponseWriter, r *http.Request) {\n\n\tuser := utils.GetAuthenticatedUser(r)\n\n\trenderHomeTemplate(w, user)\n}", "title": "" }, { "docid": "cd37cce6012bc262a9d79214b7e8dbd6", "score": "0.47393563", "text": "func (o SecretV2Output) Mount() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SecretV2) pulumi.StringOutput { return v.Mount }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9aa3479856ba98727869b1e8459e9a68", "score": "0.47393498", "text": "func (w *Waka) mount() {\n\tExitOnErrorPreamble(w.diskman.Loop(), \"Remount failed -\")\n}", "title": "" }, { "docid": "4281c63cf4f5267b4ff0e52de3b7bf61", "score": "0.47368398", "text": "func (cmd WelcomeCmd) Execute() *viber.WelcomeResponse {\n\treturn &viber.WelcomeResponse{\n\t\tType: viber.TextType,\n\t\tText: \"Вітаю! Введіть повний номер або відправте фото автівки з номером, а я спробую вам допомогти\",\n\t}\n}", "title": "" }, { "docid": "d6afd5f5f5bdd6c09cc8d2614ab26e31", "score": "0.47361854", "text": "func (c Console) RenderHeader(w io.Writer, ast *blackfriday.Node) {\n}", "title": "" }, { "docid": "1b932014ceb98c9fb905f65a0f786ff9", "score": "0.4722685", "text": "func (h *Handler) ShowLogin(ctx *context.Context) {\n\n\ttmpl, name := template.GetComp(\"login\").GetTemplate()\n\tbuf := new(bytes.Buffer)\n\tif err := tmpl.ExecuteTemplate(buf, name, struct {\n\t\tUrlPrefix string\n\t\tTitle string\n\t\tLogo template2.HTML\n\t\tCdnUrl string\n\t\tSystem types.SystemInfo\n\t}{\n\t\tUrlPrefix: h.config.AssertPrefix(),\n\t\tTitle: h.config.LoginTitle,\n\t\tLogo: h.config.LoginLogo,\n\t\tSystem: types.SystemInfo{\n\t\t\tVersion: system.Version(),\n\t\t},\n\t\tCdnUrl: h.config.AssetUrl,\n\t}); err == nil {\n\t\tctx.HTML(http.StatusOK, buf.String())\n\t} else {\n\t\tlogger.Error(err)\n\t\tctx.HTML(http.StatusOK, \"parse template error (;′⌒`)\")\n\t}\n}", "title": "" }, { "docid": "e7e6fb2252e3fd59b59145869897a7e2", "score": "0.4707035", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Welcome to the Deathstar!\"))\n}", "title": "" }, { "docid": "0496db7454c034e014ba18652508be1f", "score": "0.47046423", "text": "func (controller *Home) Display() {\n\tcontroller.SetCustomTitle(\"Admin - Repositories\")\n\tcontroller.Data[\"repositories\"] = repository.GetAllRepositories()\n\tcontroller.Data[\"host\"] = controller.Ctx.Request.Host\n\tcontroller.LoadTemplate(\"home\")\n}", "title": "" }, { "docid": "08dc8b05a89e76a9a7cc9174538b20e0", "score": "0.47022423", "text": "func showLogin(c *gin.Context) {\n\trender(c, gin.H{}, \"login.html\")\n}", "title": "" }, { "docid": "d3bcf34031ce130b7daefa6bb0382bc6", "score": "0.46998605", "text": "func (r *HTMLRouter) Mount(pattern string, h *HTMLRouter) {\n\tr.Core.Mount(pattern, h)\n}", "title": "" }, { "docid": "585c1b80304adfc06c74c975197cdf7f", "score": "0.4696381", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\n\tfmt.Fprintln(w, \"Hello\")\n\n\tfmt.Fprintln(w, \"SIGN UP OR LOGIN\")\n}", "title": "" }, { "docid": "c14158d071d93a62870db6c9eed673b5", "score": "0.4695018", "text": "func DisplayInfoHeading(str string) {\n\tColorsGlobal.colorInfoHeading.Print(str)\n\tfmt.Println() // Because the newline keeps the background color, we need to do it separately\n}", "title": "" }, { "docid": "57eef7c8a94ea1ef7e26de1b538b37a3", "score": "0.46947625", "text": "func (r *chiRouter) Mount(pattern string, h http.Handler) {\n\tr.chi.Mount(pattern, h)\n}", "title": "" }, { "docid": "898ddf24b84595383f8a9ef25fce280a", "score": "0.46893427", "text": "func index(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tfmt.Fprintf(w, \"greetings, %s!\\n\", \"Autograder\")\n}", "title": "" }, { "docid": "3b51231d9d8486ef632d0e5a848b2df4", "score": "0.46889868", "text": "func (m Sarkar) Display() {\n\tfmt.Println(\"Hello \" + m.Name)\n}", "title": "" }, { "docid": "f0779c9737cd3afbea80cd8b9e7abc69", "score": "0.46887466", "text": "func ServerHelp(cmd *cobra.Command, _ []string) {\n\tfmt.Println(libs.Banner())\n\tfmt.Println(cmd.UsageString())\n\tfmt.Printf(\"Official Documentation can be found here: %s\\n\", color.GreenString(libs.DOCS))\n\n}", "title": "" }, { "docid": "70e0f1b3d0d3644ff508d22d1707a0fa", "score": "0.46879193", "text": "func (m *mainprompt) Render() (prompt string) {\n\n\t// Get term width: from this will depend some formatting\n\tsWidth := readline.GetTermWidth()\n\n\t// Other lengths that we might need to pass around\n\tvar bWidth int // base prompt width, after computing.\n\tvar mWidth int // Module prompt width, after computing.\n\tvar cWidth int // Context prompt width\n\n\t// Compute all prompts\n\tm.Base, bWidth = m.computeBase()\n\tm.Module, mWidth = m.computeModule(sWidth)\n\tm.ContextPrompt, cWidth = m.computeContext(mWidth, sWidth)\n\n\t// Here, we have a prompt too large for the screen, it should not.\n\t// Truncate module prompt with the exceding length, or context prompt.\n\tif bWidth+mWidth+cWidth > sWidth {\n\t\t// m.Module = truncate()\n\t}\n\n\t// Get the empty part and pad with it, before\n\tpad := m.getPromptPad(sWidth, bWidth, mWidth, cWidth)\n\n\t// Return the prompt\n\tprompt = m.Base + m.Module + pad + m.ContextPrompt\n\n\treturn\n}", "title": "" }, { "docid": "5c47f348ea598e90b73564d8a49cdeac", "score": "0.46800905", "text": "func home(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tif err := homeTemplate.Execute(w, nil); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f0e14665d0604c042113f3f20f1af241", "score": "0.4676682", "text": "func ShowHelloPath() string {\n\n\treturn fmt.Sprintf(\"/hello\")\n}", "title": "" }, { "docid": "d9b462260d860901c44d82cd9d6f6091", "score": "0.46754572", "text": "func Health(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\thostname, _ := os.Hostname()\n\tw.Write([]byte(fmt.Sprintf(\"Kubeshell is health!\\n\\nI am %s\", hostname)))\n}", "title": "" }, { "docid": "28e5008ddc6f93831130cb371cbe9b50", "score": "0.4663886", "text": "func (i *Intro) Render(delta float64) error {\n\toutput := string(introTxt[:i.cursor])\n\tib := engine.NewBoxFromString(output, termbox.ColorDefault, termbox.ColorDefault)\n\tib.W = width\n\tib.HCenter()\n\tib.VCenter()\n\n\tif i.cursor < len(introTxt) {\n\t\ti.cursor++\n\t} else {\n\t\tbutton := engine.NewBoxFromString(\"Press enter to continue\", termbox.ColorBlack, termbox.ColorGreen)\n\t\tbutton.Y = ib.Y + ib.H + 1\n\t\tbutton.X = ib.X + width - button.W\n\t\tbutton.Render()\n\t}\n\n\tib.Render()\n\n\treturn nil\n}", "title": "" }, { "docid": "10ab27fd71fd6526187ed7f1370fd3cf", "score": "0.4660948", "text": "func Mount(mux goahttp.Muxer, h *Server) {\n\tMountGetHandler(mux, h.Get)\n\tMountListHandler(mux, h.List)\n\tMountAddHandler(mux, h.Add)\n\tMountRemoveHandler(mux, h.Remove)\n\tMountGenHTTPOpenapiJSON(mux, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"./gen/http/openapi.json\")\n\t}))\n}", "title": "" }, { "docid": "11654846c99f7036d03370bac1cdff1d", "score": "0.4659931", "text": "func welcomeHandler(w http.ResponseWriter, _ *http.Request) {\n\n\t// adding response headers\n\tpaxos.EnableCors(&w)\n\tpaxos.AddContentTypeJson(&w)\n\n\t_, _ = fmt.Fprintf(w, \"{ \\\"message\\\": \\\"%s\\\" }\", \"GoLang implementation of the Paxos Algorithm.\")\n}", "title": "" }, { "docid": "8ba435b62ae74a3928dcea2551099477", "score": "0.46576616", "text": "func (disp *Sunding19OLED) Render() *Sunding19OLED {\n\tdisp.screen.ShowImage(disp.i)\n\treturn disp\n}", "title": "" }, { "docid": "cb639e34d271d8b389f23fb58a4e025c", "score": "0.4656237", "text": "func RenderTitle(title string) {\n\tfmt.Printf(\"_________________________________________________________________________________\\n\")\n\tfmt.Printf(\"BallClock Simulation 1.0 By:Johnathon Smith\\n\")\n\tfmt.Printf(title)\n\tfmt.Printf(\"\\n_________________________________________________________________________________\")\n\tfmt.Println()\n\tfmt.Println()\n}", "title": "" }, { "docid": "cdcd01af7e92d89eb97d6142470c08fd", "score": "0.46457002", "text": "func (controller *Repository) Display() {\n\trepository := controller.GetRepository()\n\tcontroller.Data[\"processes\"] = harvest.GetProcessesByRepository(repository.ID, 5)\n\tcontroller.Data[\"institution\"] = repository.GetInstitution()\n\tcontroller.Data[\"identification\"] = repository.GetIdentification()\n\tcontroller.LoadTemplate(\"home\")\n}", "title": "" }, { "docid": "becf30806bfb99ddaa4896e2b60e295e", "score": "0.46449935", "text": "func (ui *UI) DisplayHeader(text string) {\n\tui.terminalLock.Lock()\n\tdefer ui.terminalLock.Unlock()\n\n\tfmt.Fprintf(ui.Out, \"%s\\n\", ui.modifyColor(ui.TranslateText(text), color.New(color.Bold)))\n}", "title": "" }, { "docid": "9ef49b0fedddd800baf8554bffdd4c3d", "score": "0.46424255", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\thomeHTML.Execute(w, nil)\n}", "title": "" }, { "docid": "d458e7e5108b043e5c73dd15a05007db", "score": "0.4640564", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Read in the template with SSE JavaScript code.\n\tt, err := template.ParseFiles(\"templates/index.html\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error parsing your template.\")\n\n\t}\n\tdata := Data{\n\t\tbackend.TargetHost,\n\t}\n\t// Render the template, writing to `w`.\n\tt.Execute(w, data)\n}", "title": "" }, { "docid": "64d9a9b62e295aa9549b8d9e37443544", "score": "0.46387163", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tif err := view.TemplExe(view.TmplMap[\"home\"], w, nil); err != nil {\n\t\tutil.FailLog(err)\n\t\tfmt.Fprintf(w, \"html template failed to execute: %s\", err)\n\t\tfmt.Printf(\"html template failed to execute: %s\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "2f4ff1876ad3c1ada0fa0788f083f2ce", "score": "0.46375075", "text": "func (ui *GUI) homepage(w http.ResponseWriter, r *http.Request) {\n\tui.renderIndex(w, r, \"\")\n}", "title": "" }, { "docid": "5b0b09ef96445d957687de298a3ffab8", "score": "0.46334997", "text": "func homeLink(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Welcome to New Psql HTTP Sever 8080 for CRUD Users!!\")\n}", "title": "" }, { "docid": "ae694aae9cb656b1ac367275652081d6", "score": "0.46224537", "text": "func Home() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdata := &Index{\n\t\t\tTitle: \"Image Gallery\",\n\t\t\tBody: \"Welcome to the image gallery.\",\n\t\t}\n\t\tt := template.Must(template.ParseFiles(\"./template/welcome.tmpl\"))\n\t\tdata.Title = data.Title + strconv.Itoa(rand.Intn(9999))\n\t\tif err := t.Execute(w, data); err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "41faebd7e0df2f39ce8178d24e7b33ec", "score": "0.46199355", "text": "func Render(c *gin.Context, client MbtaService) {\n\tnorthStation := &DepartureBoard{\n\t\tTitle: \"North Station Information\",\n\t}\n\tsouthStation := &DepartureBoard{\n\t\tTitle: \"South Station Information\",\n\t}\n\tnorthStation.Departures, northStation.Error =\n\t\tclient.ListDepartures(\"place-north\")\n\tsouthStation.Departures, southStation.Error =\n\t\tclient.ListDepartures(\"place-sstat\")\n\tc.HTML(http.StatusOK, \"index.tmpl.html\", gin.H{\n\t\t\"northStation\": northStation,\n\t\t\"southStation\": southStation,\n\t})\n}", "title": "" }, { "docid": "678db2d0a8777a87a2796540373555df", "score": "0.46157518", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"TTTGameServer\")\n}", "title": "" }, { "docid": "f48bb3288d7eb1cb04c5a6d2f71519dc", "score": "0.4596628", "text": "func (m *Repository) Home(w http.ResponseWriter, r *http.Request) {\n\trender.RenderTemplates(w, \"home.page.html\", &models.TemplateData{})\n}", "title": "" }, { "docid": "5d107efe0ead81951ba855cf60ac805f", "score": "0.45925665", "text": "func Index(res http.ResponseWriter, req *http.Request) {\n\thttp.ServeFile(res, req, \"tmpl/home.html\")\n}", "title": "" }, { "docid": "715f331ddc976284c613838a632d1760", "score": "0.4583646", "text": "func WelcomePage(w http.ResponseWriter, r *http.Request) { \n tmpl, err := template.ParseFiles(\"templates/welcomePage.html\")\n if err != nil {\n fmt.Println(err)\n }\n\n var welcomeHomePage string\n welcomeHomePage = \"Login & Registration Forms\"\n \n tmpl.Execute(w, Response{WelcomeMessage: welcomeHomePage})\n}", "title": "" }, { "docid": "84ee07294a1db8f2160650bf23d53264", "score": "0.4582489", "text": "func (*Slash) Compose() composer.Spec {\n\treturn composer.Spec{\n\t\tName: \"slash_text\",\n\t\tGroup: \"printing\",\n\t\tDesc: \"Slash text: Separates words with left-leaning slashes '/'.\",\n\t}\n}", "title": "" }, { "docid": "f57bb52420f7f6594e227383bc6b0b41", "score": "0.4581089", "text": "func NewWelcomeCmd() *WelcomeCmd {\n\treturn &WelcomeCmd{}\n}", "title": "" }, { "docid": "de635d866702143113aa436fb243a503", "score": "0.45767972", "text": "func WelcomeHandler(w http.ResponseWriter, r *http.Request) {\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, \"welcomehandler\", \"base\", nil)\n}", "title": "" }, { "docid": "0a1e078f804c22083fece620d924efca", "score": "0.45719612", "text": "func HndlrHome(w http.ResponseWriter, r *http.Request) {\n\n\tfmt.Printf(\"HndlrHome(%s)\\n\", r.Method)\n\n\tif r.URL.Path != \"/\" {\n\t\tfmt.Printf(\"...end HndlrHome(Error 404) Not '/' URL\\n\")\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"\\tHndlrHome Serving File: ./html/App01sq.menu.html\\n\")\n\thndlrsApp01sq.MainDisplay(w, \"\")\n\t//http.ServeFile(w, r, baseDir+\"/html/App01sq.menu.html\")\n\n\tfmt.Printf(\"...end HndlrHome()\\n\")\n}", "title": "" }, { "docid": "8aef9314d56bb3dba34a9b1b74754f7e", "score": "0.4568565", "text": "func (d *Device) Display() error {\n\t// Reset the screen to 0x0\n\t// This works fine with I2C\n\t// In the 128x64 (SPI) screen resetting to 0x0 after 128 times corrupt the buffer\n\t// Since we're printing the whole buffer, avoid resetting it in this case\n\tif d.canReset {\n\t\td.Command(COLUMNADDR)\n\t\td.Command(0)\n\t\td.Command(uint8(d.width - 1))\n\t\td.Command(PAGEADDR)\n\t\td.Command(0)\n\t\td.Command(uint8(d.height/8) - 1)\n\t}\n\n\td.Tx(d.buffer, false)\n\treturn nil\n}", "title": "" }, { "docid": "ae405c6262d38aedb3205efa1044c9c8", "score": "0.45643878", "text": "func (env *StockEnv) Render() {\n\t//Render info here\n\tfmt.Println(\"Steps:\", env.steps)\n}", "title": "" }, { "docid": "9b17324e53a935bcc424f8f1ab03c078", "score": "0.45593798", "text": "func index(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"Welcome!\")\n\tfmt.Printf(\"key: %s\\n\", speak.GetKey())\n}", "title": "" }, { "docid": "2ca261361849be831bd88b4fb0378826", "score": "0.45539728", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Someone came here and couldnt access us\")\n\tfmt.Fprint(w, \"welcome to the movie guide bot challenge\")\n}", "title": "" }, { "docid": "49e96f9185d61a9fd96178dcb3a4b1ff", "score": "0.4550029", "text": "func dndStoreSplash() string {\n\treturn `\n Welcome to the Larn Thrift Shoppe. We stock many items explorers find useful\n in their adventures. Feel free to browse to your hearts content.\n Also be advised, if you break 'em, you pay for 'em.`\n}", "title": "" }, { "docid": "24857b4e1ea6ce6d646a06ddb70bd4df", "score": "0.45492825", "text": "func Start() {\n\twelcome()\n\n\t// processing modules\n\tfmt.Println(\"\\n!> GOT: Register Modules:\")\n\n\tvar startupModuleKey string\n\tvar startupModule *core.Module\n\tfor key, module := range register.Modules.Map() {\n\t\t// register startup module later.(the last one)\n\t\tif module.IsStartupModule {\n\t\t\tstartupModuleKey = key\n\t\t\tstartupModule = module\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Printf(\" [Module] %s\\n\", key)\n\t\tif module.Register != nil {\n\t\t\tmodule.Register()\n\t\t}\n\t}\n\t// register startup module\n\tfmt.Printf(\" [Module] %s (Startup)\\n\", startupModuleKey)\n\tif startupModule.Register != nil {\n\t\tstartupModule.Register()\n\t}\n\n\tfmt.Println(\"\\n!> GOT: Register static file paths:\")\n\n\t// mapping static paths.\n\tfor _, pair := range config.Config.StaticResources {\n\t\tfmt.Printf(\" [Static Path] %s -> %s (dir: %s)\\n\", pair[0], pair[1], http.Dir(pair[1]))\n\t\tpath := http.StripPrefix(pair[0], http.FileServer(http.Dir(pair[1])))\n\t\thttp.Handle(pair[0], path)\n\t}\n\n\t// Template initialize\n\ttemplates.FinalInitialize()\n\n\t// got url matcher\n\thttp.HandleFunc(\"/\", route.RouteHandler)\n\n\tfmt.Printf(\"\\n>> Server Started. Port:%d\\n\", Config.Port)\n\tfmt.Printf(\"%s ❯ \", startupModuleKey)\n\n\t// The second parameter is to clear gorilla/session to prevent memory leak\n\thttp.ListenAndServe(fmt.Sprintf(\":%v\", Config.Port), context.ClearHandler(http.DefaultServeMux))\n}", "title": "" }, { "docid": "4443605942a78023b47d792c6341f28b", "score": "0.45490932", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\tAuthInit(w, r)\n\tfmt.Println(\"homeHandler Executing...\")\n\tdata := map[string]interface{}{\n\t\t\"hello-user\": 103,\n\t\t\"thats-rught\": 104,\n\t}\n\tview.RenderTemplate(w, \"index\", data)\n}", "title": "" }, { "docid": "793cf8278d55365443c6d613b14c1979", "score": "0.4537333", "text": "func home(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Hello from Pastetext\"))\n}", "title": "" }, { "docid": "42d50c173879766809f3e949f2c9daa6", "score": "0.4534015", "text": "func ServiceLayerIndex(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n fmt.Fprintf(w, \"<h2>K/AI server</h2>\\n\\n<h3>service layer access points</h3>\\n\\n%s<br/><br/>\" +\n \"<small>Copyright Peter de Vocht, 2017. K/AI version %s</small>\", infoStr, versionStr)\n}", "title": "" }, { "docid": "ad235cc08c1d535f3f72a13e91281e49", "score": "0.45304435", "text": "func index(w http.ResponseWriter, r *http.Request) {\n log.Printf(\"Serving request: %s\", r.URL.Path)\n fmt.Fprint(w,\"\\n\")\n fmt.Fprint(w,\" ____ ____ _ ___\\n\")\n fmt.Fprint(w,\"| _ \\\\___ \\\\(_)/ _ \\\\\\n\")\n fmt.Fprint(w,\"| | | |__) | | | | |\\n\")\n fmt.Fprint(w,\"| |_| / __/| | |_| |\\n\")\n fmt.Fprint(w,\"|____/_____|_|\\\\__\\\\_\\\\\\n\")\n fmt.Fprint(w,\"\\n\")\n fmt.Fprintf(w, \"Hello!, from D2iQ Dispatch CI/CD GitOps!\\n\")\n fmt.Fprintf(w, \"Version: %s\\n\", Version)\n fmt.Fprintf(w, \"Build time: %s\\n\", Buildtime)\n fmt.Fprintf(w, \"App Version: 20200318-2\\n\")\n fmt.Fprint(w,\"\\n\")\n fmt.Fprint(w, \"Container hostname: \", Hostname, \"\\n\")\n dt := time.Now()\n fmt.Fprint(w, \"Time: \", dt.Format(\"2006-01-02 15:04:05.00\"), \"\\n\")\n}", "title": "" }, { "docid": "b2b7054fb1826d9c03ef950ae6181ac4", "score": "0.4527227", "text": "func contactSimpleServeHTTP(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"Content-type\", \"text/html\")\n\tfmt.Fprint(response, \"<h1>robot</h1>Hello! what is your name\")\n\tfmt.Fprint(response, \"what is your name!<br/>\")\n\tfmt.Fprint(response, \"send me a message!\")\n}", "title": "" }, { "docid": "9913f061062f0b5b33bccefdf8545f7d", "score": "0.4526425", "text": "func homePage(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Welcome to the Homepage!\")\n\tfmt.Println(\"Endpoint Hit: homepage\")\n}", "title": "" }, { "docid": "023f1e4288dfaec6e9b73971d95aaa34", "score": "0.4525496", "text": "func (driver *ServerDriver) WelcomeUser(cc server.ClientContext) (string, error) {\n\tcc.SetDebug(driver.Debug)\n\t// This will remain the official name for now\n\treturn \"TEST Server\", nil\n}", "title": "" }, { "docid": "706d12b0a88e4d746810a34ffca096b8", "score": "0.45241505", "text": "func PartOne() {\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"Hello 世界 from %q\", html.EscapeString(r.URL.Path))\n\t})\n\n\tlog.Println(\"PART ONE: Starting server of localhost:8081\")\n\tlog.Fatal(http.ListenAndServe(\":8081\", nil))\n}", "title": "" }, { "docid": "07b9751a72f0d88f05ff7114d7f17381", "score": "0.4523377", "text": "func StartSimpleServer() {\n\thttp.HandleFunc(\"/welcome\", messageHandler)\n\tlog.Println(\"Listening...\")\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "201775082ed3e33d96f23a6cbb159177", "score": "0.4522362", "text": "func (c *HomeController) Main() {\n\tc.Response.WriteHeader(200)\n\tc.Request.Header.Set(\"Content-Type\", \"application/json\")\n\n\t_, _ = c.Response.Write([]byte(`{\"message\":\"Welcome to Go-Web\"}`))\n}", "title": "" } ]
75b9328ac1906f80621db1f8f78fca7b
UpsertEnvoyFilter mocks base method
[ { "docid": "e797c4d0fea8c373811d2cb2aebf6cad", "score": "0.7837729", "text": "func (m *MockEnvoyFilterClient) UpsertEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, transitionFuncs ...v1alpha3.EnvoyFilterTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" } ]
[ { "docid": "764fa96c2b01ec24fb2cec2cf0af93f8", "score": "0.7917354", "text": "func (m *MockEnvoyFilterWriter) UpsertEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, transitionFuncs ...v1alpha3.EnvoyFilterTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6fd1b1baf94e98eca71a2a944f1f3e4c", "score": "0.67691725", "text": "func (m *MockEnvoyFilterWriter) UpdateEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "58bd0791b099686270fb155848a580bb", "score": "0.6676644", "text": "func (m *MockEnvoyFilterClient) UpdateEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c5d5f814266d6e98d9626f8ab5f6eb3e", "score": "0.6275224", "text": "func (m *MockEnvoyFilterStatusWriter) UpdateEnvoyFilterStatus(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateEnvoyFilterStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8c041ef7e9b9f875bf3d44a93f4c441f", "score": "0.62254816", "text": "func (m *MockEnvoyFilterWriter) PatchEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f59223a9b1280e53892500377039f61f", "score": "0.6187354", "text": "func (m *MockEnvoyFilterClient) PatchEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e983ea4a9237d7d38c488676cfcb247a", "score": "0.61485785", "text": "func (m *MockEnvoyFilterClient) UpdateEnvoyFilterStatus(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateEnvoyFilterStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "218ab9f60b17328f2bce75cc50b5b0f3", "score": "0.61272925", "text": "func (m *MockEnvoyFilterWriter) CreateEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b9c02d7eb6d41dcba798fdbb8c5f7200", "score": "0.61014694", "text": "func (m *MockEnvoyFilterClient) CreateEnvoyFilter(ctx context.Context, obj *v1alpha30.EnvoyFilter, opts ...client.CreateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CreateEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "986534f0ef2a828bf7cc1a6277a0ed45", "score": "0.60970473", "text": "func (m *MockClientset) EnvoyFilters() v1alpha3.EnvoyFilterClient {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EnvoyFilters\")\n\tret0, _ := ret[0].(v1alpha3.EnvoyFilterClient)\n\treturn ret0\n}", "title": "" }, { "docid": "eff567e534abae5e530b19f78f82ab24", "score": "0.60587364", "text": "func (mr *MockEnvoyFilterWriterMockRecorder) UpsertEnvoyFilter(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, obj}, transitionFuncs...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpsertEnvoyFilter\", reflect.TypeOf((*MockEnvoyFilterWriter)(nil).UpsertEnvoyFilter), varargs...)\n}", "title": "" }, { "docid": "f0a61076223ccbe91d8ba2a8b37a68a4", "score": "0.60457873", "text": "func (mr *MockEnvoyFilterClientMockRecorder) UpsertEnvoyFilter(ctx, obj interface{}, transitionFuncs ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, obj}, transitionFuncs...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpsertEnvoyFilter\", reflect.TypeOf((*MockEnvoyFilterClient)(nil).UpsertEnvoyFilter), varargs...)\n}", "title": "" }, { "docid": "a58d3067edabb21cc31eb5eaa211f9c0", "score": "0.58749664", "text": "func (m *MockEnvoyFilterStatusWriter) PatchEnvoyFilterStatus(ctx context.Context, obj *v1alpha30.EnvoyFilter, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchEnvoyFilterStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "51d38e574f9cfafe8b7631eb533092ce", "score": "0.57923293", "text": "func (m *MockEnvoyFilterClient) PatchEnvoyFilterStatus(ctx context.Context, obj *v1alpha30.EnvoyFilter, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchEnvoyFilterStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "71d569b58902d263babe4db891b0701f", "score": "0.5777471", "text": "func (m *MockTwoLayerTrie) Upsert(arg0, arg1, arg2 []byte) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upsert\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9bb74a109d2e871477107f78cb3fdb57", "score": "0.5741425", "text": "func (m *MockDBClient) UpdateOne(filter, update bson.D) (*mongo.UpdateResult, error) {\n m.ctrl.T.Helper()\n ret := m.ctrl.Call(m, \"UpdateOne\", filter, update)\n ret0, _ := ret[0].(*mongo.UpdateResult)\n ret1, _ := ret[1].(error)\n return ret0, ret1\n}", "title": "" }, { "docid": "cc450fee00528cb0f2b9177e7fc2df03", "score": "0.5614076", "text": "func (m *MockTrie) Upsert(arg0, arg1 []byte) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upsert\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "44ce09fc83258f37efb11286d294584d", "score": "0.5586894", "text": "func (m *MockEnvoyFilterWriter) DeleteEnvoyFilter(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, key}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "edd451307bd8a3d163479c7dc9155c28", "score": "0.55837333", "text": "func (m *MockEventConsumer) SubscribeUnfiltered(arg0 func(*rabbitevents.Event)) rabbitevents.Unsubscribe {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SubscribeUnfiltered\", arg0)\n\tret0, _ := ret[0].(rabbitevents.Unsubscribe)\n\treturn ret0\n}", "title": "" }, { "docid": "dfe4d3f99c4685332efa3805de8eef17", "score": "0.5547723", "text": "func (m *MockEnvoyFilterClient) DeleteEnvoyFilter(ctx context.Context, key client.ObjectKey, opts ...client.DeleteOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, key}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ffd181d1a49c660aaeebef8b5318c031", "score": "0.5428706", "text": "func (m *MockUpstreamWriter) UpdateUpstream(ctx context.Context, obj *v1.Upstream, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1911f3c5aa78814b2a6c40344cfebcc7", "score": "0.541095", "text": "func (m *MockTrafficPolicyClient) UpsertTrafficPolicySpec(arg0 context.Context, arg1 *v1alpha1.TrafficPolicy, arg2 ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertTrafficPolicySpec\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d9bb4e31e0b8dcb11aff8450536bb24d", "score": "0.539135", "text": "func (m *MockMarketStoreInterface) Upsert(ctx context.Context, market *models.Market) error {\n\tret := m.ctrl.Call(m, \"Upsert\", ctx, market)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "add796b601be013f567d99f586921aa4", "score": "0.5389639", "text": "func (m *MockEnvoyFilterClient) GetEnvoyFilter(ctx context.Context, key client.ObjectKey) (*v1alpha30.EnvoyFilter, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetEnvoyFilter\", ctx, key)\n\tret0, _ := ret[0].(*v1alpha30.EnvoyFilter)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "89ac74139fdf8d928d37a0f5257efde7", "score": "0.5377767", "text": "func (_m *SiteService) Upsert(_a0 context.Context, _a1 *dto.Site) error {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *dto.Site) error); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "c8d97893e4a4282811da37b612e87e50", "score": "0.53236294", "text": "func (m *MockPublisherRepository) Update(arg0 context.Context, arg1 *entity.Publisher) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3037f3866022fe6478087345e5c33269", "score": "0.53105545", "text": "func (m *MockTickStoreInterface) Upsert(ctx context.Context, chartID int, candle *charts.Candle) error {\n\tret := m.ctrl.Call(m, \"Upsert\", ctx, chartID, candle)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "eb4cad6dbce8cea6c9029e82f4ee3488", "score": "0.5307592", "text": "func (m *MockApplicationServiceClient) UpsertApplicationEquip(arg0 context.Context, arg1 *v1.UpsertApplicationEquipRequest, arg2 ...grpc.CallOption) (*v1.UpsertApplicationEquipResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertApplicationEquip\", varargs...)\n\tret0, _ := ret[0].(*v1.UpsertApplicationEquipResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5e29c6b99fd4c733af3aedc3870b6ca6", "score": "0.53065664", "text": "func (m *MockUpstreamClient) UpdateUpstream(ctx context.Context, obj *v1.Upstream, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4969734966a543e76f966f67a6a3866a", "score": "0.5300191", "text": "func (m *MockEnvoyFilterReader) ListEnvoyFilter(ctx context.Context, opts ...client.ListOption) (*v1alpha30.EnvoyFilterList, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(*v1alpha30.EnvoyFilterList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "94bf58a323bebaa0103c4bb48fa2f926", "score": "0.5300039", "text": "func (m *MockEnvoyFilterReader) GetEnvoyFilter(ctx context.Context, key client.ObjectKey) (*v1alpha30.EnvoyFilter, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetEnvoyFilter\", ctx, key)\n\tret0, _ := ret[0].(*v1alpha30.EnvoyFilter)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ed4458346a727a991bb9223ac522b003", "score": "0.5293054", "text": "func (m_2 *MockDatabase) InfluxStore(m *maps, batch []dnszeppelin.DNSResult) error {\n m_2.ctrl.T.Helper()\n ret := m_2.ctrl.Call(m_2, \"InfluxStore\", m, batch)\n ret0, _ := ret[0].(error)\n return ret0\n}", "title": "" }, { "docid": "495de895c40fc0df03a2ad4333c4d356", "score": "0.52778625", "text": "func (m *MockEnvoyFilterClient) ListEnvoyFilter(ctx context.Context, opts ...client.ListOption) (*v1alpha30.EnvoyFilterList, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(*v1alpha30.EnvoyFilterList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f20f25a4e03798de7ebced6fcd014933", "score": "0.5240054", "text": "func (m *MockCollectionInterface) UpdateOne(ctx context.Context, filter, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, filter, update}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateOne\", varargs...)\n\tret0, _ := ret[0].(*mongo.UpdateResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "77a3d2d392af96d1ca899d70efe9d759", "score": "0.52248186", "text": "func (m *MockMatcher) Filter(arg0 *claircore.IndexRecord) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Filter\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "bfad2f39dcf1d5f690a98472dadb00d3", "score": "0.5222701", "text": "func (m *MockUpstreamWriter) UpsertUpstream(ctx context.Context, obj *v1.Upstream, transitionFuncs ...v1.UpstreamTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a0f526b91f5590438976c65ef863e632", "score": "0.5218692", "text": "func (m *MockOperator) Upsert(arg0 string, arg1 interface{}, arg2 uint32) (gocb.Cas, error) {\n\tret := m.ctrl.Call(m, \"Upsert\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(gocb.Cas)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5c6e903e27a904da71d6ab687058c1a6", "score": "0.5210326", "text": "func (m *MockMgoCollection) Upsert(selector, update interface{}) (*mgo.ChangeInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upsert\", selector, update)\n\tret0, _ := ret[0].(*mgo.ChangeInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "170526c6e1a8830a3905ba8de375dfea", "score": "0.51979524", "text": "func (m *MockDynatraceClient) UpsertByName(a Api, name string, jsonEntity map[string]interface{}) (DynatraceEntity, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpsertByName\", a, name, jsonEntity)\n\tret0, _ := ret[0].(DynatraceEntity)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "24c40611df15ddcf914506d06b26516c", "score": "0.5194702", "text": "func (m *MockChartStoreInterface) Upsert(ctx context.Context, chart *models.Chart) error {\n\tret := m.ctrl.Call(m, \"Upsert\", ctx, chart)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2b993a2ea2a3852723a77ae6811fc8bd", "score": "0.5181674", "text": "func (m *MockUpstreamClient) UpsertUpstream(ctx context.Context, obj *v1.Upstream, transitionFuncs ...v1.UpstreamTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "feb8457c33cafed2692b8c095f3441c1", "score": "0.5147881", "text": "func useMockEnvoyBootstrapHook(tr *TaskRunner) {\n\tmock := new(mockEnvoyBootstrapHook)\n\tfor i, hook := range tr.runnerHooks {\n\t\tif _, ok := hook.(*envoyBootstrapHook); ok {\n\t\t\ttr.runnerHooks[i] = mock\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ac8bbce22459cd407bb1f8710317a48", "score": "0.51410145", "text": "func (m *MockOpenStorageVolumeServer) InspectWithFilters(arg0 context.Context, arg1 *api.SdkVolumeInspectWithFiltersRequest) (*api.SdkVolumeInspectWithFiltersResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InspectWithFilters\", arg0, arg1)\n\tret0, _ := ret[0].(*api.SdkVolumeInspectWithFiltersResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9f93f4f1d1ab37618800630b53a004ba", "score": "0.5130649", "text": "func (_m *DiscordAuthsStore) Upsert(_a0 types.DiscordAuth) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(types.DiscordAuth) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f0d3962ce8566257205ff59711f49fcc", "score": "0.51085114", "text": "func (_e *SiteService_Expecter) Upsert(_a0 interface{}, _a1 interface{}) *SiteService_Upsert_Call {\n\treturn &SiteService_Upsert_Call{Call: _e.mock.On(\"Upsert\", _a0, _a1)}\n}", "title": "" }, { "docid": "42ee3b85d7725a5c1bfdbe0fdf99cfd7", "score": "0.51061463", "text": "func (m *ProductRepository) Upsert(arg0 context.Context, arg1 *product.Product) (product.ID, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upsert\", arg0, arg1)\n\tret0, _ := ret[0].(product.ID)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "402ac87808d18faa088e8618ce086f83", "score": "0.51042986", "text": "func (_m *ChartUpserter) Upsert(c *chart.Chart) (bool, error) {\n\tret := _m.Called(c)\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func(*chart.Chart) bool); ok {\n\t\tr0 = rf(c)\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*chart.Chart) error); ok {\n\t\tr1 = rf(c)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "efbc943fb5832da372a753445784ef91", "score": "0.5090766", "text": "func (m *MockCollectionInterface) ReplaceOne(ctx context.Context, filter, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, filter, replacement}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ReplaceOne\", varargs...)\n\tret0, _ := ret[0].(*mongo.UpdateResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "31945c3b5a5186e97957271f45f0fc5d", "score": "0.5081725", "text": "func convertToEnvoyFilterWrapper(local *Config) *EnvoyFilterWrapper {\n\tlocalEnvoyFilter := local.Spec.(*networking.EnvoyFilter)\n\n\tout := &EnvoyFilterWrapper{}\n\tif localEnvoyFilter.WorkloadSelector != nil {\n\t\tout.workloadSelector = localEnvoyFilter.WorkloadSelector.Labels\n\t} else {\n\t\tout.workloadSelector = localEnvoyFilter.WorkloadLabels\n\t}\n\tout.DeprecatedFilters = localEnvoyFilter.Filters\n\tout.Patches = make(map[networking.EnvoyFilter_ApplyTo][]*EnvoyFilterConfigPatchWrapper)\n\tfor _, cp := range localEnvoyFilter.ConfigPatches {\n\t\tcpw := &EnvoyFilterConfigPatchWrapper{\n\t\t\tApplyTo: cp.ApplyTo,\n\t\t\tMatch: cp.Match,\n\t\t\tOperation: cp.Patch.Operation,\n\t\t}\n\t\t// there won't be an error here because validation catches mismatched types\n\t\tcpw.Value, _ = xds.BuildXDSObjectFromStruct(cp.ApplyTo, cp.Patch.Value)\n\t\tif cp.Match == nil {\n\t\t\t// create a match all object\n\t\t\tcpw.Match = &networking.EnvoyFilter_EnvoyConfigObjectMatch{Context: networking.EnvoyFilter_ANY}\n\t\t} else if cp.Match.Proxy != nil && cp.Match.Proxy.ProxyVersion != \"\" {\n\t\t\t// pre-compile the regex for proxy version if it exists\n\t\t\t// ignore the error because validation catches invalid regular expressions.\n\t\t\tcpw.ProxyVersionRegex, _ = regexp.Compile(cp.Match.Proxy.ProxyVersion)\n\t\t}\n\n\t\tif _, exists := out.Patches[cp.ApplyTo]; !exists {\n\t\t\tout.Patches[cp.ApplyTo] = make([]*EnvoyFilterConfigPatchWrapper, 0)\n\t\t}\n\t\tif cpw.Operation == networking.EnvoyFilter_Patch_INSERT_AFTER ||\n\t\t\tcpw.Operation == networking.EnvoyFilter_Patch_INSERT_BEFORE {\n\t\t\t// insert_before or after is applicable only for network filter and http filter\n\t\t\t// TODO: insert before/after is also applicable to http_routes\n\t\t\t// convert the rest to add\n\t\t\tif cpw.ApplyTo != networking.EnvoyFilter_HTTP_FILTER && cpw.ApplyTo != networking.EnvoyFilter_NETWORK_FILTER {\n\t\t\t\tcpw.Operation = networking.EnvoyFilter_Patch_ADD\n\t\t\t}\n\t\t}\n\t\tout.Patches[cp.ApplyTo] = append(out.Patches[cp.ApplyTo], cpw)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "0cce43501e1ce08ee37fddb515e78b29", "score": "0.5080516", "text": "func (m *MockBookKeeping) Update(ctx context.Context, requestId, status, failureReason, failureAction string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, requestId, status, failureReason, failureAction)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5c799c7e0e57e3ff9ce8c0e010eb3629", "score": "0.5078986", "text": "func (m *MockVirtualServiceWriter) UpsertVirtualService(ctx context.Context, obj *v1alpha30.VirtualService, transitionFuncs ...v1alpha3.VirtualServiceTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertVirtualService\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ec119735345f4c0caccaa7aeccd108d2", "score": "0.5074148", "text": "func TestVeniceEventsExporter(t *testing.T) {\n\tmockElasticServer, apiServer, mockCitadelQueryServer, evtsMgrServer, veniceExporter, elasticClient, _ := veniceExporterSetup(t)\n\tdefer apiServer.Stop()\n\tdefer mockElasticServer.Stop()\n\tdefer mockCitadelQueryServer.Stop()\n\tdefer evtsMgrServer.RPCServer.Stop()\n\n\t// create mock events channel; in the real case, it will come from the dispatcher\n\tmockEventsChan := &mockEventChanImpl{\n\t\tresult: make(chan events.Batch, veniceBufferLen),\n\t\tstopped: make(chan struct{}),\n\t}\n\n\tmockOffsetTracker := &mockOffsetTrackerImpl{}\n\n\t// start the exporter\n\tveniceExporter.Start(mockEventsChan, mockOffsetTracker)\n\tdefer veniceExporter.Stop()\n\n\t// send some events to the venice exporter\n\tfor i := 0; i < 10; i++ {\n\t\ttemp := *dummyEvt\n\t\ttemp.EventAttributes.Type = \"TEST-1\"\n\t\ttemp.ObjectMeta.UUID = uuid.New().String()\n\n\t\t// send events to mock exporter\n\t\tmockEventsChan.result <- newMockBatch([]*evtsapi.Event{&temp}, &events.Offset{})\n\t}\n\n\t// make sure the events reached elasticsearch through events manager\n\tAssertEventually(t,\n\t\tfunc() (bool, interface{}) {\n\t\t\tsearchStr := \"TEST-1\"\n\t\t\tresp, err := elasticClient.Search(context.Background(), elastic.GetIndex(globals.Events, dummyEvt.GetTenant()),\n\t\t\t\tes.NewRawStringQuery(fmt.Sprintf(\"{\\\"match_all\\\":\\\"%s\\\"}\", searchStr)), nil, 0, 10, sortByField, sortAsc)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Sprintf(\"failed to find events matching {%s}, err: %v\", searchStr, err)\n\t\t\t}\n\n\t\t\tif resp.TotalHits() != 10 {\n\t\t\t\treturn false, fmt.Sprintf(\"expected: %d number of events, got: %d\", 10, resp.TotalHits())\n\t\t\t}\n\n\t\t\treturn true, nil\n\t\t}, \"failed to perform search on mock elastic server\", \"20ms\", \"20s\")\n\n\t// send few more events and check\n\tfor i := 0; i < 15; i++ {\n\t\ttemp := *dummyEvt\n\t\ttemp.EventAttributes.Type = \"TEST-2\"\n\t\ttemp.ObjectMeta.UUID = uuid.New().String()\n\n\t\t// send events to mock exporter\n\t\tmockEventsChan.result <- newMockBatch([]*evtsapi.Event{&temp}, &events.Offset{})\n\t}\n\n\t// make sure the events reached elasticsearch through events manager\n\tAssertEventually(t,\n\t\tfunc() (bool, interface{}) {\n\t\t\tsearchStr := \"TEST-2\"\n\t\t\tresp, err := elasticClient.Search(context.Background(), elastic.GetIndex(globals.Events, dummyEvt.GetTenant()),\n\t\t\t\tes.NewRawStringQuery(fmt.Sprintf(\"{\\\"match_all\\\":\\\"%s\\\"}\", searchStr)), nil, 0, 10, sortByField, sortAsc)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Sprintf(\"failed to find events matching {%s}, err: %v\", searchStr, err)\n\t\t\t}\n\n\t\t\tif resp.TotalHits() != 15 {\n\t\t\t\treturn false, fmt.Sprintf(\"expected: %d number of events, got: %d\", 15, resp.TotalHits())\n\t\t\t}\n\n\t\t\treturn true, nil\n\t\t}, \"failed to perform search on mock elastic server\", \"20ms\", \"20s\")\n\n\t// try sending more than 1 event at a time\n\tvar evts []*evtsapi.Event\n\tfor i := 0; i < 10; i++ {\n\t\ttemp := *dummyEvt\n\t\ttemp.EventAttributes.Type = \"TEST-3\"\n\t\ttemp.ObjectMeta.UUID = uuid.New().String()\n\t\tevts = append(evts, &temp)\n\t}\n\tmockEventsChan.result <- newMockBatch(evts, &events.Offset{})\n\n\t// make sure the events reached elasticsearch through events manager\n\tAssertEventually(t,\n\t\tfunc() (bool, interface{}) {\n\t\t\tsearchStr := \"TEST-3\"\n\t\t\tresp, err := elasticClient.Search(context.Background(), elastic.GetIndex(globals.Events, dummyEvt.GetTenant()),\n\t\t\t\tes.NewRawStringQuery(fmt.Sprintf(\"{\\\"match_all\\\":\\\"%s\\\"}\", searchStr)), nil, 0, 10, sortByField, sortAsc)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Sprintf(\"failed to find events matching {%s}, err: %v\", searchStr, err)\n\t\t\t}\n\n\t\t\tif resp.TotalHits() != 10 {\n\t\t\t\treturn false, fmt.Sprintf(\"expected: %d number of events, got: %d\", 10, resp.TotalHits())\n\t\t\t}\n\n\t\t\treturn true, nil\n\t\t}, \"failed to perform search on mock elastic server\", \"20ms\", \"4s\")\n}", "title": "" }, { "docid": "98c2143d7e58288a64318f86e451c47d", "score": "0.5071207", "text": "func (m *MockTagStore) Update(arg0 *store.Tag) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e50584942a746576928af6666cef4ea3", "score": "0.50681275", "text": "func (m *MockPrimaryIPClient) Update(arg0 context.Context, arg1 *hcloud.PrimaryIP, arg2 hcloud.PrimaryIPUpdateOpts) (*hcloud.PrimaryIP, *hcloud.Response, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*hcloud.PrimaryIP)\n\tret1, _ := ret[1].(*hcloud.Response)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "6f85a3f1fe016a2eec0be76fe154ff8d", "score": "0.5064301", "text": "func (m *MockNopeRepository) Update(ctx context.Context, entity *model.Nope) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, entity)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8c75db9c91514044175df702aa997cde", "score": "0.50588727", "text": "func (m *MockCollectionInterface) FindOneAndUpdate(ctx context.Context, filter, update interface{}, opts ...*options.FindOneAndUpdateOptions) pmongo.SingleResultInterface {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, filter, update}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"FindOneAndUpdate\", varargs...)\n\tret0, _ := ret[0].(pmongo.SingleResultInterface)\n\treturn ret0\n}", "title": "" }, { "docid": "633afea239f395ceb669f41162dcdfaf", "score": "0.5056765", "text": "func (m *PriceRepository) Upsert(arg0 context.Context, arg1 *price.WithProduct) (price.ID, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upsert\", arg0, arg1)\n\tret0, _ := ret[0].(price.ID)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "dd6ec083773b5a4e3a273fcabc55547b", "score": "0.50556624", "text": "func (m *MockOpenStorageVolumeServer) Update(arg0 context.Context, arg1 *api.SdkVolumeUpdateRequest) (*api.SdkVolumeUpdateResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(*api.SdkVolumeUpdateResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2e091f766ddf63c3f414dfadd9fc220d", "score": "0.50338143", "text": "func (m *MockWriter) Update(e *entity.Template) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", e)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "948d18ad56e102238af3c4672805da04", "score": "0.5024959", "text": "func (m *MockVirtualServiceClient) UpsertVirtualService(ctx context.Context, obj *v1alpha30.VirtualService, transitionFuncs ...v1alpha3.VirtualServiceTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertVirtualService\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d2dfeebb3f3d297edd1d55cd49f94907", "score": "0.5019083", "text": "func (m *MockApplicationServiceClient) UpsertInstance(arg0 context.Context, arg1 *v1.UpsertInstanceRequest, arg2 ...grpc.CallOption) (*v1.UpsertInstanceResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertInstance\", varargs...)\n\tret0, _ := ret[0].(*v1.UpsertInstanceResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "89773d46a2ba3ac04c16cc0350625f3b", "score": "0.5018562", "text": "func (m *MockAccessRequester) Merge(arg0 fosite.Requester) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Merge\", arg0)\n}", "title": "" }, { "docid": "dbdba2192d48f48cb69d247d072db8aa", "score": "0.5016242", "text": "func (m *MockClusterEnricher) Enrich(arg0 context.Context, arg1 *logrus.Entry, arg2 *api.OpenShiftCluster, arg3 kubernetes.Interface, arg4 versioned.Interface, arg5 versioned0.Interface, arg6 versioned1.Interface) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Enrich\", arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e769cc20f0b542dadaabda8d16c98d40", "score": "0.50152814", "text": "func (m *MockUpstreamWriter) PatchUpstream(ctx context.Context, obj *v1.Upstream, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "916051e6796e435b64cfadcb7800ac58", "score": "0.50128025", "text": "func (m *MockEnvoyFilterWriter) DeleteAllOfEnvoyFilter(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9a4dcfb23c1d6014f7f9322c4454d003", "score": "0.50126624", "text": "func (m *FakeVirtualServiceInterface) Update(arg0 context.Context, arg1 *v1alpha3.VirtualService, arg2 v1.UpdateOptions) (*v1alpha3.VirtualService, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*v1alpha3.VirtualService)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c102ef538d4b8837d0401b21b5e87730", "score": "0.50011474", "text": "func (m *MockResourceRepository) Update(arg0 context.Context, arg1 *model.Resource) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a5b3ab5169dfc39a300e7c3f8dadfe09", "score": "0.49974072", "text": "func (m *MockUpstreamStatusWriter) UpdateUpstreamStatus(ctx context.Context, obj *v1.Upstream, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateUpstreamStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "51345a5e79d1f3558c15136aefd4f556", "score": "0.49849617", "text": "func (m *MockProductServiceClient) UpsertProduct(arg0 context.Context, arg1 *v1.UpsertProductRequest, arg2 ...grpc.CallOption) (*v1.UpsertProductResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertProduct\", varargs...)\n\tret0, _ := ret[0].(*v1.UpsertProductResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3cb764642b5f2581002540d34769482a", "score": "0.49726132", "text": "func (m *MockProxyWriter) UpsertProxy(ctx context.Context, obj *v1.Proxy, transitionFuncs ...v1.ProxyTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertProxy\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f928f25097e2f57e82d701a878f72fb8", "score": "0.49701354", "text": "func (m *MockUpstreamClient) PatchUpstream(ctx context.Context, obj *v1.Upstream, patch client.Patch, opts ...client.PatchOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, patch}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"PatchUpstream\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b6de831044e12f0a53b74fda0c02a0a3", "score": "0.49689233", "text": "func (m *MockConfigEmitter) Upstream() v1.UpstreamClient {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Upstream\")\n\tret0, _ := ret[0].(v1.UpstreamClient)\n\treturn ret0\n}", "title": "" }, { "docid": "51f4351fac1b3a5ab6be9c1589dfac81", "score": "0.49610808", "text": "func (m *MockLayerStore) Update(l *store.Layer) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", l)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fb77bb653ecd5d9be6ad88e4b1d09805", "score": "0.49607164", "text": "func TestIdempotency(t *testing.T) {\n\tcloser, mongoport, _, err := testHelper_getMongoDependency()\n\tdefer closer()\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tconfigLocation := flag.String(\"config\", \"../config.json\", \"configuration file\")\n\tflag.Parse()\n\n\terr = util.LoadConfig(*configLocation)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tutil.Config.MongoUrl = \"mongodb://localhost:\"+mongoport\n\n\thttpServer := httptest.NewServer(getRoutes())\n\tdefer httpServer.Close()\n\n\terr = updateKnownFilterPools(\"fp1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\terr = testHelper_putProcess(\"1\", \"f1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tresp, err := http.Get(httpServer.URL + \"/filter\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tfilter := []FilterDeployment{}\n\terr = json.NewDecoder(resp.Body).Decode(&filter)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tif len(filter) != 1 || filter[0].ProcessId != \"1\" || filter[0].FilterId != \"f1\" {\n\t\tt.Error(\"unexpected result:\", filter)\n\t\treturn\n\t}\n\n\terr = testHelper_putProcess(\"1\", \"f2\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tresp, err = http.Get(httpServer.URL + \"/filter\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tfilter = []FilterDeployment{}\n\terr = json.NewDecoder(resp.Body).Decode(&filter)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tif len(filter) != 1 || filter[0].ProcessId != \"1\" || filter[0].FilterId != \"f2\" {\n\t\tt.Error(\"unexpected result:\", filter)\n\t\treturn\n\t}\n\n\terr = testHelper_deleteProcess(\"1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\t//mock filterpool\n\t_, err = GetFilterPoolAssignments(\"fp1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tresp, err = http.Get(httpServer.URL + \"/filter\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tfilter = []FilterDeployment{}\n\terr = json.NewDecoder(resp.Body).Decode(&filter)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tif len(filter) != 0 {\n\t\tt.Error(\"unexpected result:\", filter)\n\t\treturn\n\t}\n\n\terr = testHelper_deleteProcess(\"1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tresp, err = http.Get(httpServer.URL + \"/filter\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tfilter = []FilterDeployment{}\n\terr = json.NewDecoder(resp.Body).Decode(&filter)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tif len(filter) != 0 {\n\t\tt.Error(\"unexpected result:\", filter)\n\t\treturn\n\t}\n\n\t//mock filterpool\n\t_, err = GetFilterPoolAssignments(\"fp1\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tresp, err = http.Get(httpServer.URL + \"/filter\")\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tfilter = []FilterDeployment{}\n\terr = json.NewDecoder(resp.Body).Decode(&filter)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tif len(filter) != 0 {\n\t\tt.Error(\"unexpected result:\", filter)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "dc7ea94780e87ccb2bbf79024460634b", "score": "0.49538976", "text": "func (m *MockOrmer) Update(arg0 interface{}, arg1 ...string) (int64, error) {\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cb45152fd58df8587150bb8c70f07bc8", "score": "0.4952315", "text": "func (m *MockRepo) Update(arg0 uuid.UUID, arg1 models.Boolean) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "536821bb5696a15fbc724a509f809438", "score": "0.49503538", "text": "func (m *MockEnvoyFilterClient) DeleteAllOfEnvoyFilter(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfEnvoyFilter\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b465f0d6a1cd53dae7e6a48161eabbf6", "score": "0.4947927", "text": "func (m *MockGormItf) Updates(values interface{}, ignoreProtectedAttrs ...bool) GormItf {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{values}\n\tfor _, a := range ignoreProtectedAttrs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Updates\", varargs...)\n\tret0, _ := ret[0].(GormItf)\n\treturn ret0\n}", "title": "" }, { "docid": "55e5f67a18db24083165596bf626fe3b", "score": "0.4946374", "text": "func (m *MockOrderStoreInterface) Upsert(ctx context.Context, order *models.Order) error {\n\tret := m.ctrl.Call(m, \"Upsert\", ctx, order)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a636fac75c553a7fc361c97454f8aa2c", "score": "0.4935559", "text": "func TestInsertFilter(t *testing.T) {\n\ttestName := \"TestInsertFilter\"\n\n\tmux := NewControllerRegister()\n\tmux.InsertFilter(\"*\", BeforeRouter, func(*context.Context) {}, WithReturnOnOutput(true))\n\tif !mux.filters[BeforeRouter][0].returnOnOutput {\n\t\tt.Errorf(\n\t\t\t\"%s: passing no variadic params should set returnOnOutput to true\",\n\t\t\ttestName)\n\t}\n\tif mux.filters[BeforeRouter][0].resetParams {\n\t\tt.Errorf(\n\t\t\t\"%s: passing no variadic params should set resetParams to false\",\n\t\t\ttestName)\n\t}\n\n\tmux = NewControllerRegister()\n\tmux.InsertFilter(\"*\", BeforeRouter, func(*context.Context) {}, WithReturnOnOutput(false))\n\tif mux.filters[BeforeRouter][0].returnOnOutput {\n\t\tt.Errorf(\n\t\t\t\"%s: passing false as 1st variadic param should set returnOnOutput to false\",\n\t\t\ttestName)\n\t}\n\n\tmux = NewControllerRegister()\n\tmux.InsertFilter(\"*\", BeforeRouter, func(*context.Context) {}, WithReturnOnOutput(true), WithResetParams(true))\n\tif !mux.filters[BeforeRouter][0].resetParams {\n\t\tt.Errorf(\n\t\t\t\"%s: passing true as 2nd variadic param should set resetParams to true\",\n\t\t\ttestName)\n\t}\n}", "title": "" }, { "docid": "4d90cd54aefa5d2099d599ad30f37c7e", "score": "0.49335304", "text": "func (m *MockUpstreamClient) UpdateUpstreamStatus(ctx context.Context, obj *v1.Upstream, opts ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpdateUpstreamStatus\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8a124da761b571d79df92605bdda1030", "score": "0.49279255", "text": "func (_m *AppliedSpecStorage) Upsert(bUsage *v1alpha1.ServiceBindingUsage, applied bool) error {\n\tret := _m.Called(bUsage, applied)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*v1alpha1.ServiceBindingUsage, bool) error); ok {\n\t\tr0 = rf(bUsage, applied)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e11580d1511077f21d76748caaeef7d0", "score": "0.49260172", "text": "func (m *MockBestEffortEnricher) Enrich(arg0 context.Context, arg1 *logrus.Entry, arg2 ...*api.OpenShiftCluster) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tm.ctrl.Call(m, \"Enrich\", varargs...)\n}", "title": "" }, { "docid": "8ee4aa35bf84826a7d844221cae626b4", "score": "0.4923009", "text": "func (m *MockProxyClient) UpsertProxy(ctx context.Context, obj *v1.Proxy, transitionFuncs ...v1.ProxyTransitionFunction) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj}\n\tfor _, a := range transitionFuncs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertProxy\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "619ef591bd57002468e35ac14d79b9ea", "score": "0.4922759", "text": "func (m *MockVirtualMeshClient) UpsertVirtualMeshSpec(arg0 context.Context, arg1 *v1alpha1.VirtualMesh, arg2 ...client.UpdateOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertVirtualMeshSpec\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f27d9d3c533f3100fddda3bc6c113ecb", "score": "0.49194053", "text": "func (m *MockembeddedClient) Update(ctx context.Context, namespace string, obj, result runtime.Object, opts v1.UpdateOptions) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, namespace, obj, result, opts)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "20652e9a2b108b77edd44cc7bf64abf1", "score": "0.49138355", "text": "func (_m *TenantMappingRepository) Upsert(ctx context.Context, item model.BusinessTenantMapping) error {\n\tret := _m.Called(ctx, item)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, model.BusinessTenantMapping) error); ok {\n\t\tr0 = rf(ctx, item)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f84d2e1a16b0aaef8f9f85612476ba36", "score": "0.4911994", "text": "func (m *MockServerActionsService) EnablePrivateNetworkingByTag(arg0 string) (bl.Actions, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EnablePrivateNetworkingByTag\", arg0)\n\tret0, _ := ret[0].(bl.Actions)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0865a5ff0b37264397ccbea02aee6809", "score": "0.4898974", "text": "func (mr *MockEnvoyFilterClientMockRecorder) UpdateEnvoyFilter(ctx, obj interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, obj}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateEnvoyFilter\", reflect.TypeOf((*MockEnvoyFilterClient)(nil).UpdateEnvoyFilter), varargs...)\n}", "title": "" }, { "docid": "31d21bdebeb87236deb881e153e753c9", "score": "0.4896898", "text": "func veniceExporterSetup(t *testing.T) (*mockes.ElasticServer, apiserver.Server, *query.Server, *evtsmgr.EventsManager,\n\tevents.Exporter, elastic.ESClient, log.Logger) {\n\tlogger := vLogger.WithContext(\"t_name\", t.Name())\n\t// create elastic mock server\n\tms := mockes.NewElasticServer(logger.WithContext(\"submodule\", \"elasticsearch-mock-server\"))\n\tms.Start()\n\n\t// start API server\n\tapiServer, apiServerURL, err := serviceutils.StartAPIServer(\"\", t.Name(), logger.WithContext(\"submodule\", globals.APIServer), []string{})\n\tAssertOk(t, err, \"failed to start API server\")\n\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tmockBroker := mock.NewMockInf(mockCtrl)\n\tmockCitadelQueryServer, err := query.NewQueryService(testServerURL, mockBroker)\n\tAssertOk(t, err, \"failed to create mock citadel query service\")\n\n\t// update resolver\n\taddMockService(mr, globals.ElasticSearch, ms.GetElasticURL())\n\taddMockService(mr, globals.APIServer, apiServerURL)\n\taddMockService(mr, globals.Citadel, mockCitadelQueryServer.GetListenURL())\n\n\t// create elastic client; this is used to confirm the events have reached elasticsearch through events manager\n\telasticClient, err := elastic.NewClient(ms.GetElasticURL(), nil, logger.WithContext(\"submodule\", \"elastic-client\"))\n\tAssertOk(t, err, \"failed to create elastic client\")\n\n\t// run gRPC events manager server\n\tevtsMgr, err := evtsmgr.NewEventsManager(globals.EvtsMgr, testServerURL, mr, logger.WithContext(\"submodule\", globals.EvtsMgr), evtsmgr.WithElasticClient(elasticClient))\n\tAssertOk(t, err, \"failed to run gRPC events manager server\")\n\n\t// create venice exporter\n\tveniceExporter, err := NewVeniceExporter(\"venice-exporter\", veniceBufferLen, evtsMgr.RPCServer.GetListenURL(), nil, logger.WithContext(\"submodule\", \"venice-exporter\"))\n\tAssertOk(t, err, \"failed to create venice events exporter\")\n\n\treturn ms, apiServer, mockCitadelQueryServer, evtsMgr, veniceExporter, elasticClient, logger\n}", "title": "" }, { "docid": "80d557c3808f501a280d7557ecf344e4", "score": "0.48926625", "text": "func TestAdmit(t *testing.T) {\n\ttestServer := webhooktesting.NewTestServer(t)\n\ttestServer.StartTLS()\n\tdefer testServer.Close()\n\tserverURL, err := url.ParseRequestURI(testServer.URL)\n\tif err != nil {\n\t\tt.Fatalf(\"this should never happen? %v\", err)\n\t}\n\n\tobjectInterfaces := webhooktesting.NewObjectInterfacesForTest()\n\n\tstopCh := make(chan struct{})\n\tdefer close(stopCh)\n\n\ttestCases := append(webhooktesting.NewMutatingTestCases(serverURL, \"test-webhooks\"),\n\t\twebhooktesting.ConvertToMutatingTestCases(webhooktesting.NewNonMutatingTestCases(serverURL), \"test-webhooks\")...)\n\n\tfor _, tt := range testCases {\n\t\tt.Run(tt.Name, func(t *testing.T) {\n\t\t\twh, err := NewMutatingWebhook(nil)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"failed to create mutating webhook: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tns := \"webhook-test\"\n\t\t\tclient, informer := webhooktesting.NewFakeMutatingDataSource(ns, tt.Webhooks, stopCh)\n\n\t\t\twh.SetAuthenticationInfoResolverWrapper(webhooktesting.Wrapper(webhooktesting.NewAuthenticationInfoResolver(new(int32))))\n\t\t\twh.SetServiceResolver(webhooktesting.NewServiceResolver(*serverURL))\n\t\t\twh.SetExternalKubeClientSet(client)\n\t\t\twh.SetExternalKubeInformerFactory(informer)\n\n\t\t\tinformer.Start(stopCh)\n\t\t\tinformer.WaitForCacheSync(stopCh)\n\n\t\t\tif err = wh.ValidateInitialization(); err != nil {\n\t\t\t\tt.Errorf(\"failed to validate initialization: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar attr admission.Attributes\n\t\t\tif tt.IsCRD {\n\t\t\t\tattr = webhooktesting.NewAttributeUnstructured(ns, tt.AdditionalLabels, tt.IsDryRun)\n\t\t\t} else {\n\t\t\t\tattr = webhooktesting.NewAttribute(ns, tt.AdditionalLabels, tt.IsDryRun)\n\t\t\t}\n\n\t\t\terr = wh.Admit(context.TODO(), attr, objectInterfaces)\n\t\t\tif tt.ExpectAllow != (err == nil) {\n\t\t\t\tt.Errorf(\"expected allowed=%v, but got err=%v\", tt.ExpectAllow, err)\n\t\t\t}\n\t\t\tif tt.ExpectLabels != nil {\n\t\t\t\tif !reflect.DeepEqual(tt.ExpectLabels, attr.GetObject().(metav1.Object).GetLabels()) {\n\t\t\t\t\tt.Errorf(\"expected labels '%v', but got '%v'\", tt.ExpectLabels, attr.GetObject().(metav1.Object).GetLabels())\n\t\t\t\t}\n\t\t\t}\n\t\t\t// ErrWebhookRejected is not an error for our purposes\n\t\t\tif tt.ErrorContains != \"\" {\n\t\t\t\tif err == nil || !strings.Contains(err.Error(), tt.ErrorContains) {\n\t\t\t\t\tt.Errorf(\"expected an error saying %q, but got: %v\", tt.ErrorContains, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif statusErr, isStatusErr := err.(*errors.StatusError); err != nil && !isStatusErr {\n\t\t\t\tt.Errorf(\"expected a StatusError, got %T\", err)\n\t\t\t} else if isStatusErr {\n\t\t\t\tif statusErr.ErrStatus.Code != tt.ExpectStatusCode {\n\t\t\t\t\tt.Errorf(\"expected status code %d, got %d\", tt.ExpectStatusCode, statusErr.ErrStatus.Code)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfakeAttr, ok := attr.(*webhooktesting.FakeAttributes)\n\t\t\tif !ok {\n\t\t\t\tt.Errorf(\"Unexpected error, failed to convert attr to webhooktesting.FakeAttributes\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(tt.ExpectAnnotations) == 0 {\n\t\t\t\tassert.Empty(t, fakeAttr.GetAnnotations(auditinternal.LevelMetadata), tt.Name+\": annotations not set as expected.\")\n\t\t\t} else {\n\t\t\t\tassert.Equal(t, tt.ExpectAnnotations, fakeAttr.GetAnnotations(auditinternal.LevelMetadata), tt.Name+\": annotations not set as expected.\")\n\t\t\t}\n\t\t\treinvocationCtx := fakeAttr.Attributes.GetReinvocationContext()\n\t\t\treinvocationCtx.SetIsReinvoke()\n\t\t\tfor webhook, expectReinvoke := range tt.ExpectReinvokeWebhooks {\n\t\t\t\tshouldReinvoke := reinvocationCtx.Value(PluginName).(*webhookReinvokeContext).ShouldReinvokeWebhook(fmt.Sprintf(\"test-webhooks/%s/0\", webhook))\n\t\t\t\tif expectReinvoke != shouldReinvoke {\n\t\t\t\t\tt.Errorf(\"expected reinvocationContext.ShouldReinvokeWebhook(%s)=%t, but got %t\", webhook, expectReinvoke, shouldReinvoke)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "503cf638e186344e4492e1d947c280c2", "score": "0.48889068", "text": "func Test_mutateRegistrationInfoExplicitEndpointCachesData(t *testing.T) {\n\tinitMetadata() // Used from metadata_test.go\n\n\tsvc := bridge.Service{\n\t\tAttrs: map[string]string{\n\t\t\t\"eureka_lookup_elbv2_endpoint\": \"false\",\n\t\t\t\"eureka_elbv2_hostname\": \"hostname-i-set\",\n\t\t\t\"eureka_elbv2_port\": \"65535\",\n\t\t\t\"eureka_elbv2_targetgroup\": \"arn:1234\",\n\t\t\t\"eureka_datacenterinfo_name\": \"AMAZON\",\n\t\t},\n\t\tName: \"app\",\n\t\tOrigin: bridge.ServicePort{\n\t\t\tContainerID: \"123123412\",\n\t\t},\n\t}\n\n\twantedLBDetails := &LoadBalancerRegistrationInfo{\n\t\tDNSName: \"hostname-i-set\",\n\t\tIpAddress: \"\",\n\t\tPort: 65535,\n\t\tTargetGroupArn: \"arn:1234\",\n\t\tELBEndpoint: \"hostname-i-set_65535\",\n\t}\n\n\tawsInfo := eureka.AmazonMetadataType{\n\t\tPublicHostname: \"i-should-be-changed\",\n\t\tHostName: \"i-should-be-changed\",\n\t\tInstanceID: \"i-should-be-changed\",\n\t}\n\n\tdcInfo := eureka.DataCenterInfo{\n\t\tName: eureka.Amazon,\n\t\tMetadata: awsInfo,\n\t}\n\n\treg := eureka.Instance{\n\t\tDataCenterInfo: dcInfo,\n\t\tPort: 5001,\n\t\tIPAddr: \"4.3.2.1\",\n\t\tApp: \"app\",\n\t\tVipAddress: \"4.3.2.1\",\n\t\tHostName: \"hostname_identifier\",\n\t\tStatus: eureka.UP,\n\t}\n\n\t// Init LB info cache\n\tport := \"80\"\n\thealthyTHDs := []*elbv2.TargetHealthDescription{\n\t\t{\n\t\t\tHealthCheckPort: &port,\n\t\t},\n\t}\n\ttgArn := \"arn:1234\"\n\tsetupTHDCache(tgArn, healthyTHDs)\n\n\n\tt.Run(\"Should return UP and find LB value in cache\", func(t *testing.T) {\n\n\t\t_ = mutateRegistrationInfo(&svc, &reg)\n\t\tentry, present := generalCache.Get(\"container_123123412\")\n\t\tif !present {\n\t\t\tt.Errorf(\"Value not in cache\")\n\t\t}\n\t\tif !reflect.DeepEqual(entry, wantedLBDetails) {\n\t\t\tt.Errorf(\"Should return %v status from cache. Returned %v\", wantedLBDetails, entry)\n\t\t}\n\n\t})\n\n}", "title": "" }, { "docid": "9cee4d980cfcb7bcc84ecf3d39593ead", "score": "0.48845872", "text": "func (m *MockRegistry) Update(arg0 *did.Doc, arg1 ...vdr.DIDMethodOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "80b128dde522fa475442b81ec0375a57", "score": "0.4881174", "text": "func (m *MockServerClient) AttachISO(arg0 context.Context, arg1 *hcloud.Server, arg2 *hcloud.ISO) (*hcloud.Action, *hcloud.Response, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AttachISO\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*hcloud.Action)\n\tret1, _ := ret[1].(*hcloud.Response)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "353fec20341ff529512a6e892feb2a2a", "score": "0.4879098", "text": "func (m *MockRepository) Update(e *entity.Template) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", e)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4b91ca2c2e6fd4d734f6330aeedfe357", "score": "0.48774976", "text": "func (m *MockDataStore) Update(ctx context.Context, kind, id string, factory Factory, updater Updater) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, kind, id, factory, updater)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8fd2896155e856ef3e64a05906dd0970", "score": "0.4872903", "text": "func (m *MockConnection) PipeAppend(arg0 string, arg1 ...interface{}) {\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tm.ctrl.Call(m, \"PipeAppend\", varargs...)\n}", "title": "" }, { "docid": "f03b497dd484702afa5534665722185a", "score": "0.48705366", "text": "func (m *MockApplicationServiceClient) UpsertApplication(arg0 context.Context, arg1 *v1.UpsertApplicationRequest, arg2 ...grpc.CallOption) (*v1.UpsertApplicationResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UpsertApplication\", varargs...)\n\tret0, _ := ret[0].(*v1.UpsertApplicationResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "dd214e4eedf96ad327b34645e929f35f", "score": "0.4869629", "text": "func (m *MockRedis) Set(key string, data interface{}) {\n m.ctrl.Call(m, \"Set\", key, data)\n}", "title": "" }, { "docid": "6a684119927d6418e2ae1a2825f57dbe", "score": "0.48633075", "text": "func (_m *IdbRepo) Upsert(_a0 context.Context, _a1 *entities.Book) (*entities.Book, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *entities.Book\n\tif rf, ok := ret.Get(0).(func(context.Context, *entities.Book) *entities.Book); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*entities.Book)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, *entities.Book) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" } ]
8a2a5d910f850255bbf9450c7bd5349f
DeepCopyInto copies the receiver into the given ValidateRQL.
[ { "docid": "094026fc53f2bbc882d2267d5ef82323", "score": "0.7283226", "text": "func (o *ValidateRQL) DeepCopyInto(out *ValidateRQL) {\n\n\ttarget, err := copystructure.Copy(o)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to deepcopy ValidateRQL: %s\", err))\n\t}\n\n\t*out = *target.(*ValidateRQL)\n}", "title": "" } ]
[ { "docid": "47572ffbc7537c0d58c4d705cba9bef3", "score": "0.75052625", "text": "func (o *ValidateRQL) DeepCopy() *ValidateRQL {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &ValidateRQL{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "title": "" }, { "docid": "870f4cacf690272acc6b0302ba32b3f2", "score": "0.6408501", "text": "func (o *SparseValidateRQL) DeepCopyInto(out *SparseValidateRQL) {\n\n\ttarget, err := copystructure.Copy(o)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to deepcopy SparseValidateRQL: %s\", err))\n\t}\n\n\t*out = *target.(*SparseValidateRQL)\n}", "title": "" }, { "docid": "5e178ef4c5cd649e6e0459739d34b3b1", "score": "0.5906256", "text": "func NewValidateRQL() *ValidateRQL {\n\n\treturn &ValidateRQL{\n\t\tModelVersion: 1,\n\t}\n}", "title": "" }, { "docid": "a4c71605f53432e479256b83255dae15", "score": "0.5745206", "text": "func (o *SparseValidateRQL) DeepCopy() *SparseValidateRQL {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &SparseValidateRQL{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "title": "" }, { "docid": "74d6ea6b15f676ed27edcf49cb6a8694", "score": "0.55218387", "text": "func (in *DownstreamValidation) DeepCopyInto(out *DownstreamValidation) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8e7a654ccb65f9f3bebbecba4a622b14", "score": "0.55016196", "text": "func (o ValidateRQLsList) Copy() elemental.Identifiables {\n\n\tcopy := append(ValidateRQLsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "0743e2a16b571dc5de9987969510d1c9", "score": "0.5444179", "text": "func (in *KanaryStatefulsetSpecValidationPromQL) DeepCopyInto(out *KanaryStatefulsetSpecValidationPromQL) {\n\t*out = *in\n\tif in.ValueInRange != nil {\n\t\tin, out := &in.ValueInRange, &out.ValueInRange\n\t\t*out = new(ValueInRange)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.DiscreteValueOutOfList != nil {\n\t\tin, out := &in.DiscreteValueOutOfList, &out.DiscreteValueOutOfList\n\t\t*out = new(DiscreteValueOutOfList)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.ContinuousValueDeviation != nil {\n\t\tin, out := &in.ContinuousValueDeviation, &out.ContinuousValueDeviation\n\t\t*out = new(ContinuousValueDeviation)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\treturn\n}", "title": "" }, { "docid": "74125cdf871d2507db6322bcfd6b74d8", "score": "0.54329896", "text": "func (in *LDAPQuery) DeepCopyInto(out *LDAPQuery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3e3bb0a3c9d1426a4d18a5a09e32d0f9", "score": "0.53355014", "text": "func (in *ManagedDatabaseError) DeepCopyInto(out *ManagedDatabaseError) {\n\t*out = *in\n}", "title": "" }, { "docid": "0092ae017377fbf46e2fe59345ebc2b5", "score": "0.5322347", "text": "func (in *Rule) DeepCopyInto(out *Rule) {\n\tp := proto.Clone(in).(*Rule)\n\t*out = *p\n}", "title": "" }, { "docid": "46a82b76573dd68dcae4f45e27cab99b", "score": "0.53199106", "text": "func (in *UpstreamValidation) DeepCopyInto(out *UpstreamValidation) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "828b2cd8befdd9e03eb209e78f3408ca", "score": "0.53134483", "text": "func (o *ReportsQuery) DeepCopyInto(out *ReportsQuery) {\n\n\ttarget, err := copystructure.Copy(o)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to deepcopy ReportsQuery: %s\", err))\n\t}\n\n\t*out = *target.(*ReportsQuery)\n}", "title": "" }, { "docid": "db2900d7d34984f95f2d512be6e506e5", "score": "0.53116405", "text": "func (in *QuerierSpec) DeepCopyInto(out *QuerierSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e8bf4c7007085b94f895965c262afdde", "score": "0.525053", "text": "func (in *Namespaces_Eventhubs_AuthorizationRule_STATUS_ARM) DeepCopyInto(out *Namespaces_Eventhubs_AuthorizationRule_STATUS_ARM) {\n\t*out = *in\n\tif in.Id != nil {\n\t\tin, out := &in.Id, &out.Id\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Location != nil {\n\t\tin, out := &in.Location, &out.Location\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Properties != nil {\n\t\tin, out := &in.Properties, &out.Properties\n\t\t*out = new(Namespaces_Eventhubs_AuthorizationRule_Properties_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.SystemData != nil {\n\t\tin, out := &in.SystemData, &out.SystemData\n\t\t*out = new(SystemData_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Type != nil {\n\t\tin, out := &in.Type, &out.Type\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "70786662f6c8ce90137b4def6ad66dea", "score": "0.52249706", "text": "func (in *ModelPackageValidationSpecification) DeepCopyInto(out *ModelPackageValidationSpecification) {\n\t*out = *in\n\tif in.ValidationRole != nil {\n\t\tin, out := &in.ValidationRole, &out.ValidationRole\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "c2976f88cac0351343413d1a4f7e1d8c", "score": "0.52226037", "text": "func (in *ValueValidation) DeepCopyInto(out *ValueValidation) {\n\t*out = *in\n\tif in.Maximum != nil {\n\t\tin, out := &in.Maximum, &out.Maximum\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Minimum != nil {\n\t\tin, out := &in.Minimum, &out.Minimum\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.MaxLength != nil {\n\t\tin, out := &in.MaxLength, &out.MaxLength\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.MinLength != nil {\n\t\tin, out := &in.MinLength, &out.MinLength\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.MaxItems != nil {\n\t\tin, out := &in.MaxItems, &out.MaxItems\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.MinItems != nil {\n\t\tin, out := &in.MinItems, &out.MinItems\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.MultipleOf != nil {\n\t\tin, out := &in.MultipleOf, &out.MultipleOf\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Enum != nil {\n\t\tin, out := &in.Enum, &out.Enum\n\t\t*out = make([]JSON, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.MaxProperties != nil {\n\t\tin, out := &in.MaxProperties, &out.MaxProperties\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.MinProperties != nil {\n\t\tin, out := &in.MinProperties, &out.MinProperties\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n\tif in.Required != nil {\n\t\tin, out := &in.Required, &out.Required\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.AllOf != nil {\n\t\tin, out := &in.AllOf, &out.AllOf\n\t\t*out = make([]NestedValueValidation, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.OneOf != nil {\n\t\tin, out := &in.OneOf, &out.OneOf\n\t\t*out = make([]NestedValueValidation, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.AnyOf != nil {\n\t\tin, out := &in.AnyOf, &out.AnyOf\n\t\t*out = make([]NestedValueValidation, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Not != nil {\n\t\tin, out := &in.Not, &out.Not\n\t\t*out = new(NestedValueValidation)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\treturn\n}", "title": "" }, { "docid": "427db3e8b706d03b354d17f9e1dab6e7", "score": "0.5203883", "text": "func (in *MeterLabelQuery) DeepCopyInto(out *MeterLabelQuery) {\n\t*out = *in\n}", "title": "" }, { "docid": "bf54656bfe76bddd0505503cd41d5d9e", "score": "0.52037036", "text": "func (in *CheckResult) DeepCopyInto(out *CheckResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b2e54b5ce77f912be28dba845c3cc9bd", "score": "0.5198212", "text": "func (in *FlexibleappversionReadinessCheck) DeepCopyInto(out *FlexibleappversionReadinessCheck) {\n\t*out = *in\n\tif in.AppStartTimeout != nil {\n\t\tin, out := &in.AppStartTimeout, &out.AppStartTimeout\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.CheckInterval != nil {\n\t\tin, out := &in.CheckInterval, &out.CheckInterval\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.FailureThreshold != nil {\n\t\tin, out := &in.FailureThreshold, &out.FailureThreshold\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Host != nil {\n\t\tin, out := &in.Host, &out.Host\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.SuccessThreshold != nil {\n\t\tin, out := &in.SuccessThreshold, &out.SuccessThreshold\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Timeout != nil {\n\t\tin, out := &in.Timeout, &out.Timeout\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "8dd37ff5c6b79e52ea6cc258872b0b17", "score": "0.5190211", "text": "func (in *ListenerHealthCheck) DeepCopyInto(out *ListenerHealthCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "64a1be39d9afd3584c918698cfb23372", "score": "0.51816374", "text": "func (in *AlgorithmValidationSpecification) DeepCopyInto(out *AlgorithmValidationSpecification) {\n\t*out = *in\n\tif in.ValidationRole != nil {\n\t\tin, out := &in.ValidationRole, &out.ValidationRole\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "bc35cc0cdaaf487a32add18cd08c5d6e", "score": "0.5179685", "text": "func (in *AppEngineFirewallRuleSpec) DeepCopyInto(out *AppEngineFirewallRuleSpec) {\n\t*out = *in\n\tif in.Description != nil {\n\t\tin, out := &in.Description, &out.Description\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Project != nil {\n\t\tin, out := &in.Project, &out.Project\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.ResourceID != nil {\n\t\tin, out := &in.ResourceID, &out.ResourceID\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "f84ae411a5c94a295ab80912873366de", "score": "0.517702", "text": "func (in *Namespaces_AuthorizationRule_STATUS_ARM) DeepCopyInto(out *Namespaces_AuthorizationRule_STATUS_ARM) {\n\t*out = *in\n\tif in.Id != nil {\n\t\tin, out := &in.Id, &out.Id\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Location != nil {\n\t\tin, out := &in.Location, &out.Location\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Properties != nil {\n\t\tin, out := &in.Properties, &out.Properties\n\t\t*out = new(Namespaces_AuthorizationRule_Properties_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.SystemData != nil {\n\t\tin, out := &in.SystemData, &out.SystemData\n\t\t*out = new(SystemData_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Type != nil {\n\t\tin, out := &in.Type, &out.Type\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "40ce69c99e5440bd0efcce40f691047f", "score": "0.5172386", "text": "func (in *SchemaStatus) DeepCopyInto(out *SchemaStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "bbb30c69c8ef6d359a6cf09bfa77464e", "score": "0.5168123", "text": "func (vmq *ValidMessageQuery) Clone() *ValidMessageQuery {\n\tif vmq == nil {\n\t\treturn nil\n\t}\n\treturn &ValidMessageQuery{\n\t\tconfig: vmq.config,\n\t\tlimit: vmq.limit,\n\t\toffset: vmq.offset,\n\t\torder: append([]OrderFunc{}, vmq.order...),\n\t\tpredicates: append([]predicate.ValidMessage{}, vmq.predicates...),\n\t\t// clone intermediate query.\n\t\tsql: vmq.sql.Clone(),\n\t\tpath: vmq.path,\n\t}\n}", "title": "" }, { "docid": "6978b04524c52b73cbb7d18e6ce0c4fd", "score": "0.5120183", "text": "func (in *ManagedDatabaseStatus) DeepCopyInto(out *ManagedDatabaseStatus) {\n\t*out = *in\n\tif in.Errors != nil {\n\t\tin, out := &in.Errors, &out.Errors\n\t\t*out = make([]ManagedDatabaseError, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "505d3f09772658be572a950cc60f4671", "score": "0.51094407", "text": "func (in *DashboardTimeSeriesQuery) DeepCopyInto(out *DashboardTimeSeriesQuery) {\n\t*out = *in\n\tif in.TimeSeriesFilter != nil {\n\t\tin, out := &in.TimeSeriesFilter, &out.TimeSeriesFilter\n\t\t*out = new(DashboardTimeSeriesFilter)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.TimeSeriesFilterRatio != nil {\n\t\tin, out := &in.TimeSeriesFilterRatio, &out.TimeSeriesFilterRatio\n\t\t*out = new(DashboardTimeSeriesFilterRatio)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.TimeSeriesQueryLanguage != nil {\n\t\tin, out := &in.TimeSeriesQueryLanguage, &out.TimeSeriesQueryLanguage\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.UnitOverride != nil {\n\t\tin, out := &in.UnitOverride, &out.UnitOverride\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "2d4d56327bd460c46835de1c3f749349", "score": "0.50957143", "text": "func (in *IpFilterRule_STATUS_ARM) DeepCopyInto(out *IpFilterRule_STATUS_ARM) {\n\t*out = *in\n\tif in.Action != nil {\n\t\tin, out := &in.Action, &out.Action\n\t\t*out = new(IpFilterRule_Action_STATUS)\n\t\t**out = **in\n\t}\n\tif in.FilterName != nil {\n\t\tin, out := &in.FilterName, &out.FilterName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.IpMask != nil {\n\t\tin, out := &in.IpMask, &out.IpMask\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "d3d7ad29aa0592be5d9229baaf054c9d", "score": "0.5086716", "text": "func (in *TLS) DeepCopyInto(out *TLS) {\n\t*out = *in\n\tif in.ClientValidation != nil {\n\t\tin, out := &in.ClientValidation, &out.ClientValidation\n\t\t*out = new(DownstreamValidation)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "1af31c5e5470262d1e9e391a843806e0", "score": "0.50737625", "text": "func (in *FeedbackProperties_STATUS_ARM) DeepCopyInto(out *FeedbackProperties_STATUS_ARM) {\n\t*out = *in\n\tif in.LockDurationAsIso8601 != nil {\n\t\tin, out := &in.LockDurationAsIso8601, &out.LockDurationAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.MaxDeliveryCount != nil {\n\t\tin, out := &in.MaxDeliveryCount, &out.MaxDeliveryCount\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n\tif in.TtlAsIso8601 != nil {\n\t\tin, out := &in.TtlAsIso8601, &out.TtlAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "cd28422de43784db29eff2b292e21357", "score": "0.50729424", "text": "func (o *ValidateRQL) Validate() error {\n\n\terrors := elemental.Errors{}\n\trequiredErrors := elemental.Errors{}\n\n\tif err := elemental.ValidateRequiredString(\"query\", o.Query); err != nil {\n\t\trequiredErrors = requiredErrors.Append(err)\n\t}\n\n\tif len(requiredErrors) > 0 {\n\t\treturn requiredErrors\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b58ae385fef3c5b07555479a9fae4a9c", "score": "0.5068903", "text": "func (in *Rule) DeepCopyInto(out *Rule) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\tout.Status = in.Status\n\treturn\n}", "title": "" }, { "docid": "e315197e0d9ead19327c6af4ed12a3cb", "score": "0.5064065", "text": "func (in *Run) DeepCopyInto(out *Run) {\n\t*out = *in\n\tin.CollectorMeta.DeepCopyInto(&out.CollectorMeta)\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.ImagePullSecret != nil {\n\t\tin, out := &in.ImagePullSecret, &out.ImagePullSecret\n\t\t*out = new(ImagePullSecrets)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n}", "title": "" }, { "docid": "b6e96db4cec029c53e2077e5de3788dd", "score": "0.505914", "text": "func (in *RuleStatus) DeepCopyInto(out *RuleStatus) {\n\t*out = *in\n\tout.ResourceStatus = in.ResourceStatus\n\treturn\n}", "title": "" }, { "docid": "68a13a7c0c041ee3a85bb13527df2b1f", "score": "0.5055869", "text": "func (in *HookRun) DeepCopyInto(out *HookRun) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\tin.Status.DeepCopyInto(&out.Status)\n\treturn\n}", "title": "" }, { "docid": "f414bf2794491524fb001644bf94b6bd", "score": "0.5048874", "text": "func (in *QueryParamsMatch) DeepCopyInto(out *QueryParamsMatch) {\n\t*out = *in\n}", "title": "" }, { "docid": "5a87481aadc9cdcb9cfec1a71079003a", "score": "0.5045695", "text": "func (in *Regex) DeepCopyInto(out *Regex) {\n\t*out = *in\n}", "title": "" }, { "docid": "2d4aa558908ed54dbaf4a9e4a6f4ea7a", "score": "0.50413084", "text": "func (o *MetricsQueryRange) DeepCopyInto(out *MetricsQueryRange) {\n\n\ttarget, err := copystructure.Copy(o)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to deepcopy MetricsQueryRange: %s\", err))\n\t}\n\n\t*out = *target.(*MetricsQueryRange)\n}", "title": "" }, { "docid": "1b191f9e54dc6c3fa5d2ac2f70962986", "score": "0.50355995", "text": "func (in *IpFilterRule_ARM) DeepCopyInto(out *IpFilterRule_ARM) {\n\t*out = *in\n\tif in.Action != nil {\n\t\tin, out := &in.Action, &out.Action\n\t\t*out = new(IpFilterRule_Action)\n\t\t**out = **in\n\t}\n\tif in.FilterName != nil {\n\t\tin, out := &in.FilterName, &out.FilterName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.IpMask != nil {\n\t\tin, out := &in.IpMask, &out.IpMask\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "a43638445c8cbe862bc5cec05c6f0f9b", "score": "0.50279844", "text": "func (in *CloudToDeviceProperties_STATUS_ARM) DeepCopyInto(out *CloudToDeviceProperties_STATUS_ARM) {\n\t*out = *in\n\tif in.DefaultTtlAsIso8601 != nil {\n\t\tin, out := &in.DefaultTtlAsIso8601, &out.DefaultTtlAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Feedback != nil {\n\t\tin, out := &in.Feedback, &out.Feedback\n\t\t*out = new(FeedbackProperties_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MaxDeliveryCount != nil {\n\t\tin, out := &in.MaxDeliveryCount, &out.MaxDeliveryCount\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "4dd669517f6eaa18415a3c46ef9296e6", "score": "0.5024855", "text": "func (in *Rule) DeepCopyInto(out *Rule) {\n\t*out = *in\n\tif in.Match != nil {\n\t\tin, out := &in.Match, &out.Match\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.Filters != nil {\n\t\tin, out := &in.Filters, &out.Filters\n\t\t*out = make([]Filter, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Clusters != nil {\n\t\tin, out := &in.Clusters, &out.Clusters\n\t\t*out = make([]Cluster, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f2129d42bcd5d656fa7bbc24147987c6", "score": "0.50245965", "text": "func (in *MessagingEndpointProperties_STATUS_ARM) DeepCopyInto(out *MessagingEndpointProperties_STATUS_ARM) {\n\t*out = *in\n\tif in.LockDurationAsIso8601 != nil {\n\t\tin, out := &in.LockDurationAsIso8601, &out.LockDurationAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.MaxDeliveryCount != nil {\n\t\tin, out := &in.MaxDeliveryCount, &out.MaxDeliveryCount\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n\tif in.TtlAsIso8601 != nil {\n\t\tin, out := &in.TtlAsIso8601, &out.TtlAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "b26276450e5aefefb834232037c0d595", "score": "0.5021593", "text": "func (in *EventMeshSubscriptionStatus) DeepCopyInto(out *EventMeshSubscriptionStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "bfa47593afd33f3d641799e6d4eea332", "score": "0.5020797", "text": "func (in *RunProperty) DeepCopyInto(out *RunProperty) {\n\t*out = *in\n}", "title": "" }, { "docid": "5c578cc66803dc34475bcf6b7e17e0a7", "score": "0.501865", "text": "func (in *Namespaces_Eventhubs_Consumergroup_STATUS_ARM) DeepCopyInto(out *Namespaces_Eventhubs_Consumergroup_STATUS_ARM) {\n\t*out = *in\n\tif in.Id != nil {\n\t\tin, out := &in.Id, &out.Id\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Location != nil {\n\t\tin, out := &in.Location, &out.Location\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Properties != nil {\n\t\tin, out := &in.Properties, &out.Properties\n\t\t*out = new(Namespaces_Eventhubs_Consumergroup_Properties_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.SystemData != nil {\n\t\tin, out := &in.SystemData, &out.SystemData\n\t\t*out = new(SystemData_STATUS_ARM)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Type != nil {\n\t\tin, out := &in.Type, &out.Type\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "62dd3348eb38277f871d98e5a099531e", "score": "0.49977484", "text": "func (in *RegistryStatus) DeepCopyInto(out *RegistryStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "881ff7b9ca6da2428dc34ab25c0539af", "score": "0.49841842", "text": "func (in *SQLQueryMetric) DeepCopyInto(out *SQLQueryMetric) {\n\t*out = *in\n\tin.PrometheusMetric.DeepCopyInto(&out.PrometheusMetric)\n}", "title": "" }, { "docid": "d7316db39d125a8eec4a5a28365ae7ff", "score": "0.49788243", "text": "func (in *RedisVersionDatabase) DeepCopyInto(out *RedisVersionDatabase) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "22445acbcd8366b10bed4fe6f793b517", "score": "0.49752328", "text": "func (in *ResourceLockerStatus) DeepCopyInto(out *ResourceLockerStatus) {\n\t*out = *in\n\tin.EnforcingReconcileStatus.DeepCopyInto(&out.EnforcingReconcileStatus)\n}", "title": "" }, { "docid": "d4b16039927b1a1a477466f0976c410d", "score": "0.49746385", "text": "func (in *Status) DeepCopyInto(out *Status) {\n\t*out = *in\n\tif in.MetricsAddr != nil {\n\t\tin, out := &in.MetricsAddr, &out.MetricsAddr\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.MetricsInterval != nil {\n\t\tin, out := &in.MetricsInterval, &out.MetricsInterval\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n\tif in.ReportStatus != nil {\n\t\tin, out := &in.ReportStatus, &out.ReportStatus\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.RecordQPSbyDB != nil {\n\t\tin, out := &in.RecordQPSbyDB, &out.RecordQPSbyDB\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "9f5468f2b0dce97bc663c48c49a24404", "score": "0.4972528", "text": "func (in *TestRunStatus) DeepCopyInto(out *TestRunStatus) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2e70112a73d04504504c73d76a1194e4", "score": "0.49724802", "text": "func (in *RedisVersionSpec) DeepCopyInto(out *RedisVersionSpec) {\n\t*out = *in\n\tout.DB = in.DB\n\tout.Exporter = in.Exporter\n\treturn\n}", "title": "" }, { "docid": "3d4bb24ece146aae1abdf7b605ad2fc1", "score": "0.49705988", "text": "func (in *StatusError) DeepCopyInto(out *StatusError) {\n\t*out = *in\n\tout.s = in.s\n\treturn\n}", "title": "" }, { "docid": "8da7dd4c8f4d543286e743fa357b6e52", "score": "0.49703717", "text": "func (in *SharedAccessSignatureAuthorizationRule_STATUS_ARM) DeepCopyInto(out *SharedAccessSignatureAuthorizationRule_STATUS_ARM) {\n\t*out = *in\n\tif in.KeyName != nil {\n\t\tin, out := &in.KeyName, &out.KeyName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Rights != nil {\n\t\tin, out := &in.Rights, &out.Rights\n\t\t*out = new(SharedAccessSignatureAuthorizationRule_Rights_STATUS)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "51cd032ae0688bd7eb299d6e104b56a8", "score": "0.49669912", "text": "func (in *AlertpolicyConditionMonitoringQueryLanguage) DeepCopyInto(out *AlertpolicyConditionMonitoringQueryLanguage) {\n\t*out = *in\n\tif in.EvaluationMissingData != nil {\n\t\tin, out := &in.EvaluationMissingData, &out.EvaluationMissingData\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Trigger != nil {\n\t\tin, out := &in.Trigger, &out.Trigger\n\t\t*out = new(AlertpolicyTrigger)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fb02310d450b23fc3dc65602804d7286", "score": "0.49669027", "text": "func (in *MeshWorkloadStatus) DeepCopyInto(out *MeshWorkloadStatus) {\n\tp := proto.Clone(in).(*MeshWorkloadStatus)\n\t*out = *p\n}", "title": "" }, { "docid": "cb9034a4fe46bad69f5796282b2ee406", "score": "0.49658334", "text": "func (in *HookRunSpec) DeepCopyInto(out *HookRunSpec) {\n\t*out = *in\n\tif in.Metrics != nil {\n\t\tin, out := &in.Metrics, &out.Metrics\n\t\t*out = make([]Metric, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]Argument, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "915ac192eff8266ad217e9e453c2f662", "score": "0.49571675", "text": "func (in *MemcachedRSStatus) DeepCopyInto(out *MemcachedRSStatus) {\n\t*out = *in\n\tif in.NodeList != nil {\n\t\tin, out := &in.NodeList, &out.NodeList\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "aa87cecd4ce531f61645165faeaf0950", "score": "0.4956628", "text": "func (in *HealthCheck) DeepCopyInto(out *HealthCheck) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "488ed9c9b1b965752d7fbeea1875211b", "score": "0.4953272", "text": "func (in *NetworkRuleSetProperties_STATUS_ARM) DeepCopyInto(out *NetworkRuleSetProperties_STATUS_ARM) {\n\t*out = *in\n\tif in.ApplyToBuiltInEventHubEndpoint != nil {\n\t\tin, out := &in.ApplyToBuiltInEventHubEndpoint, &out.ApplyToBuiltInEventHubEndpoint\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.DefaultAction != nil {\n\t\tin, out := &in.DefaultAction, &out.DefaultAction\n\t\t*out = new(NetworkRuleSetProperties_DefaultAction_STATUS)\n\t\t**out = **in\n\t}\n\tif in.IpRules != nil {\n\t\tin, out := &in.IpRules, &out.IpRules\n\t\t*out = make([]NetworkRuleSetIpRule_STATUS_ARM, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "776692f4d450d4fa169c9a1f885dbbd8", "score": "0.49521947", "text": "func (in *NetworkRuleSetIpRule_STATUS_ARM) DeepCopyInto(out *NetworkRuleSetIpRule_STATUS_ARM) {\n\t*out = *in\n\tif in.Action != nil {\n\t\tin, out := &in.Action, &out.Action\n\t\t*out = new(NetworkRuleSetIpRule_Action_STATUS)\n\t\t**out = **in\n\t}\n\tif in.FilterName != nil {\n\t\tin, out := &in.FilterName, &out.FilterName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.IpMask != nil {\n\t\tin, out := &in.IpMask, &out.IpMask\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "003d4575af31e2b17eb2b1f2c06b305f", "score": "0.49513662", "text": "func (in *RunItem) DeepCopyInto(out *RunItem) {\n\t*out = *in\n\tif in.Options != nil {\n\t\tin, out := &in.Options, &out.Options\n\t\t*out = make([]Option, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Conditions != nil {\n\t\tin, out := &in.Conditions, &out.Conditions\n\t\t*out = make([]Condition, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a67ef7c42172a7bcf79f2c47daa912df", "score": "0.49491972", "text": "func (in *Namespaces_Eventhubs_AuthorizationRule_STATUS) DeepCopyInto(out *Namespaces_Eventhubs_AuthorizationRule_STATUS) {\n\t*out = *in\n\tif in.Conditions != nil {\n\t\tin, out := &in.Conditions, &out.Conditions\n\t\t*out = make([]conditions.Condition, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Id != nil {\n\t\tin, out := &in.Id, &out.Id\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Location != nil {\n\t\tin, out := &in.Location, &out.Location\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Rights != nil {\n\t\tin, out := &in.Rights, &out.Rights\n\t\t*out = make([]Namespaces_Eventhubs_AuthorizationRule_Properties_Rights_STATUS, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.SystemData != nil {\n\t\tin, out := &in.SystemData, &out.SystemData\n\t\t*out = new(SystemData_STATUS)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Type != nil {\n\t\tin, out := &in.Type, &out.Type\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "e181240cac3d309ed4a40772c45b4361", "score": "0.4947718", "text": "func (in *FeedbackProperties_ARM) DeepCopyInto(out *FeedbackProperties_ARM) {\n\t*out = *in\n\tif in.LockDurationAsIso8601 != nil {\n\t\tin, out := &in.LockDurationAsIso8601, &out.LockDurationAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.MaxDeliveryCount != nil {\n\t\tin, out := &in.MaxDeliveryCount, &out.MaxDeliveryCount\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n\tif in.TtlAsIso8601 != nil {\n\t\tin, out := &in.TtlAsIso8601, &out.TtlAsIso8601\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "f98dad520f082e3ab6abba4544602410", "score": "0.49462602", "text": "func (in *Namespaces_Eventhubs_Consumergroup_Properties_STATUS_ARM) DeepCopyInto(out *Namespaces_Eventhubs_Consumergroup_Properties_STATUS_ARM) {\n\t*out = *in\n\tif in.CreatedAt != nil {\n\t\tin, out := &in.CreatedAt, &out.CreatedAt\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.UpdatedAt != nil {\n\t\tin, out := &in.UpdatedAt, &out.UpdatedAt\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.UserMetadata != nil {\n\t\tin, out := &in.UserMetadata, &out.UserMetadata\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "ee849286ba6ce7b1599baabc2de674f2", "score": "0.49443105", "text": "func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "ee849286ba6ce7b1599baabc2de674f2", "score": "0.49443105", "text": "func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "f93c64c532bff09def0b078520c7f47b", "score": "0.4942162", "text": "func (in *AzureFailureDomain) DeepCopyInto(out *AzureFailureDomain) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0f3b02aa0c3ce9c466a9d8770d5a1995", "score": "0.49416772", "text": "func (in *UserAgentMatchRule) DeepCopyInto(out *UserAgentMatchRule) {\n\t*out = *in\n\tif in.HTTPVerbs != nil {\n\t\tin, out := &in.HTTPVerbs, &out.HTTPVerbs\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e6d35d8fb179ea14955379c16d522a8a", "score": "0.4941439", "text": "func (in *FlexibleappversionLivenessCheck) DeepCopyInto(out *FlexibleappversionLivenessCheck) {\n\t*out = *in\n\tif in.CheckInterval != nil {\n\t\tin, out := &in.CheckInterval, &out.CheckInterval\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.FailureThreshold != nil {\n\t\tin, out := &in.FailureThreshold, &out.FailureThreshold\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Host != nil {\n\t\tin, out := &in.Host, &out.Host\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.InitialDelay != nil {\n\t\tin, out := &in.InitialDelay, &out.InitialDelay\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.SuccessThreshold != nil {\n\t\tin, out := &in.SuccessThreshold, &out.SuccessThreshold\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.Timeout != nil {\n\t\tin, out := &in.Timeout, &out.Timeout\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "ed16860e06e0f5cc735c9913947ef79a", "score": "0.4941296", "text": "func (in *ChaosResultSpec) DeepCopyInto(out *ChaosResultSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "c56af9e6c27a4d3435320366b8942a2c", "score": "0.4935151", "text": "func (in *HookRunArgument) DeepCopyInto(out *HookRunArgument) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bd1a4b7ee2fe93d85eaccdef77a1cb8d", "score": "0.4934917", "text": "func (in *RulerSpec) DeepCopyInto(out *RulerSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "62347f026bd3cd2fd5ad54abe0b95c70", "score": "0.49339578", "text": "func (in *RuleSpec) DeepCopyInto(out *RuleSpec) {\n\t*out = *in\n\tout.Service = in.Service\n\treturn\n}", "title": "" }, { "docid": "aea03f55dbf313f09b55b139f23c153a", "score": "0.49282274", "text": "func (in *CronTestStatus) DeepCopyInto(out *CronTestStatus) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ca37f35125a35749d57363841dfa8ca4", "score": "0.49282032", "text": "func (in *Namespaces_AuthorizationRule_STATUS) DeepCopyInto(out *Namespaces_AuthorizationRule_STATUS) {\n\t*out = *in\n\tif in.Conditions != nil {\n\t\tin, out := &in.Conditions, &out.Conditions\n\t\t*out = make([]conditions.Condition, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Id != nil {\n\t\tin, out := &in.Id, &out.Id\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Location != nil {\n\t\tin, out := &in.Location, &out.Location\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Rights != nil {\n\t\tin, out := &in.Rights, &out.Rights\n\t\t*out = make([]Namespaces_AuthorizationRule_Properties_Rights_STATUS, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.SystemData != nil {\n\t\tin, out := &in.SystemData, &out.SystemData\n\t\t*out = new(SystemData_STATUS)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Type != nil {\n\t\tin, out := &in.Type, &out.Type\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "01cda9ec058f8de01cc490b6145ec69f", "score": "0.49275932", "text": "func (in *MemcachedRS) DeepCopyInto(out *MemcachedRS) {\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\treturn\n}", "title": "" }, { "docid": "b65cc4ca8b2447f01c1e36b531699a92", "score": "0.49228346", "text": "func (in *RulesForVersion) DeepCopyInto(out *RulesForVersion) {\n\t*out = *in\n\tif in.Rules != nil {\n\t\tin, out := &in.Rules, &out.Rules\n\t\t*out = make([]v1.LocalObjectReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8cef3e86fbcff27b81cc8f0d8f44f030", "score": "0.49203956", "text": "func (in *RedactorStatus) DeepCopyInto(out *RedactorStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "d5ec178c1387586b0bc7bea59c0b0ee8", "score": "0.49184248", "text": "func (in *DeliveryRuleQueryStringCondition_STATUS) DeepCopyInto(out *DeliveryRuleQueryStringCondition_STATUS) {\n\t*out = *in\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Parameters != nil {\n\t\tin, out := &in.Parameters, &out.Parameters\n\t\t*out = new(QueryStringMatchConditionParameters_STATUS)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "title": "" }, { "docid": "60ef41b66a9ba09e9e8c94b666c746b4", "score": "0.49172047", "text": "func (in *QueryStringMatchConditionParameters_STATUS) DeepCopyInto(out *QueryStringMatchConditionParameters_STATUS) {\n\t*out = *in\n\tif in.MatchValues != nil {\n\t\tin, out := &in.MatchValues, &out.MatchValues\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.NegateCondition != nil {\n\t\tin, out := &in.NegateCondition, &out.NegateCondition\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Operator != nil {\n\t\tin, out := &in.Operator, &out.Operator\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Transforms != nil {\n\t\tin, out := &in.Transforms, &out.Transforms\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.TypeName != nil {\n\t\tin, out := &in.TypeName, &out.TypeName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "50cf6bc04f0302fc1c82462c3a4beae9", "score": "0.49161988", "text": "func (in *BenchmarkStatus) DeepCopyInto(out *BenchmarkStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "1fb67ae8ee3c40fa23379962492635e9", "score": "0.49155232", "text": "func (in *ResourceStatusBase) DeepCopyInto(out *ResourceStatusBase) {\n\t*out = *in\n}", "title": "" }, { "docid": "9eb5b38f1e3a9b696968cfc4c85acafa", "score": "0.4910528", "text": "func (in *IpFilterRule_STATUS) DeepCopyInto(out *IpFilterRule_STATUS) {\n\t*out = *in\n\tif in.Action != nil {\n\t\tin, out := &in.Action, &out.Action\n\t\t*out = new(IpFilterRule_Action_STATUS)\n\t\t**out = **in\n\t}\n\tif in.FilterName != nil {\n\t\tin, out := &in.FilterName, &out.FilterName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.IpMask != nil {\n\t\tin, out := &in.IpMask, &out.IpMask\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "99b1f6e62be766f04247e347e20aabfb", "score": "0.49093825", "text": "func (in *RunawayStatus) DeepCopyInto(out *RunawayStatus) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "acc2dcb4f8b5a10470560db2299bc503", "score": "0.49092743", "text": "func (in *BuilderStatus) DeepCopyInto(out *BuilderStatus) {\n\t*out = *in\n}", "title": "" }, { "docid": "2472253f593a4769aeaae689adb9654f", "score": "0.49065006", "text": "func (in *RemoteAddressMatchConditionParameters_STATUS) DeepCopyInto(out *RemoteAddressMatchConditionParameters_STATUS) {\n\t*out = *in\n\tif in.MatchValues != nil {\n\t\tin, out := &in.MatchValues, &out.MatchValues\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.NegateCondition != nil {\n\t\tin, out := &in.NegateCondition, &out.NegateCondition\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Operator != nil {\n\t\tin, out := &in.Operator, &out.Operator\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Transforms != nil {\n\t\tin, out := &in.Transforms, &out.Transforms\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.TypeName != nil {\n\t\tin, out := &in.TypeName, &out.TypeName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "7732b53c69dea84dfdc5b0b46c2f7db3", "score": "0.490517", "text": "func (in *WinRMListener_STATUS) DeepCopyInto(out *WinRMListener_STATUS) {\n\t*out = *in\n\tif in.CertificateUrl != nil {\n\t\tin, out := &in.CertificateUrl, &out.CertificateUrl\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Protocol != nil {\n\t\tin, out := &in.Protocol, &out.Protocol\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "40e9c1d4d401b4ced2d4639a943070d9", "score": "0.49045676", "text": "func (q *SchemaRelationshipFixtureQuery) Copy() *SchemaRelationshipFixtureQuery {\n\treturn &SchemaRelationshipFixtureQuery{\n\t\tBaseQuery: q.BaseQuery.Copy(),\n\t}\n}", "title": "" }, { "docid": "aaeaa948cdd4c27e45bc4cdcc4b8ef7b", "score": "0.48959267", "text": "func (in *QueryFrontEndSpec) DeepCopyInto(out *QueryFrontEndSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b761a77d7b00ab00c029d5817cee4add", "score": "0.48952496", "text": "func (in *KanaryStatefulsetSpecValidation) DeepCopyInto(out *KanaryStatefulsetSpecValidation) {\n\t*out = *in\n\tif in.Manual != nil {\n\t\tin, out := &in.Manual, &out.Manual\n\t\t*out = new(KanaryStatefulsetSpecValidationManual)\n\t\t**out = **in\n\t}\n\tif in.LabelWatch != nil {\n\t\tin, out := &in.LabelWatch, &out.LabelWatch\n\t\t*out = new(KanaryStatefulsetSpecValidationLabelWatch)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.PromQL != nil {\n\t\tin, out := &in.PromQL, &out.PromQL\n\t\t*out = new(KanaryStatefulsetSpecValidationPromQL)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5be3de2bc7d79428644c90f0575188d9", "score": "0.48905382", "text": "func (in *DeepCreatedCustomDomain_STATUS) DeepCopyInto(out *DeepCreatedCustomDomain_STATUS) {\n\t*out = *in\n\tif in.HostName != nil {\n\t\tin, out := &in.HostName, &out.HostName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Name != nil {\n\t\tin, out := &in.Name, &out.Name\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ValidationData != nil {\n\t\tin, out := &in.ValidationData, &out.ValidationData\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "5e788a05e1af3d2ee7999055b84a27a6", "score": "0.48866934", "text": "func (in *AppEngineFirewallRuleStatus) DeepCopyInto(out *AppEngineFirewallRuleStatus) {\n\t*out = *in\n\tif in.Conditions != nil {\n\t\tin, out := &in.Conditions, &out.Conditions\n\t\t*out = make([]k8sv1alpha1.Condition, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.ObservedGeneration != nil {\n\t\tin, out := &in.ObservedGeneration, &out.ObservedGeneration\n\t\t*out = new(int)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "f08debf06ddc2a1ce163802ce68b32b0", "score": "0.48866683", "text": "func (in *ApplicationInsightsWebTestLocationAvailabilityCriteriaParameters) DeepCopyInto(out *ApplicationInsightsWebTestLocationAvailabilityCriteriaParameters) {\n\t*out = *in\n\tif in.ComponentID != nil {\n\t\tin, out := &in.ComponentID, &out.ComponentID\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.FailedLocationCount != nil {\n\t\tin, out := &in.FailedLocationCount, &out.FailedLocationCount\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.WebTestID != nil {\n\t\tin, out := &in.WebTestID, &out.WebTestID\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "f6b3d516228cea584095f302032f50c2", "score": "0.48852906", "text": "func (in *SQLUserSpec) DeepCopyInto(out *SQLUserSpec) {\n\t*out = *in\n\tout.InstanceRef = in.InstanceRef\n\tout.Password = in.Password\n\treturn\n}", "title": "" }, { "docid": "6deefc61701108412f0cf708a7a00cfd", "score": "0.48807946", "text": "func (in *RayWorkerSpec) DeepCopyInto(out *RayWorkerSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7cec181f75c6cc8dcd33811280d7fdd5", "score": "0.48788434", "text": "func (in *UserAccountStatusEmbedded) DeepCopyInto(out *UserAccountStatusEmbedded) {\n\t*out = *in\n\tout.Cluster = in.Cluster\n\tin.UserAccountStatus.DeepCopyInto(&out.UserAccountStatus)\n\treturn\n}", "title": "" }, { "docid": "7f69bd0dc7852af4ca64961567d9d51f", "score": "0.48767287", "text": "func (grq *GrpcRuleQuery) Clone() *GrpcRuleQuery {\n\tif grq == nil {\n\t\treturn nil\n\t}\n\treturn &GrpcRuleQuery{\n\t\tconfig: grq.config,\n\t\tlimit: grq.limit,\n\t\toffset: grq.offset,\n\t\torder: append([]OrderFunc{}, grq.order...),\n\t\tunique: append([]string{}, grq.unique...),\n\t\tpredicates: append([]predicate.GrpcRule{}, grq.predicates...),\n\t\t// clone intermediate query.\n\t\tsql: grq.sql.Clone(),\n\t\tpath: grq.path,\n\t}\n}", "title": "" }, { "docid": "01435fd1d6dc0a5c9bb40678263b4596", "score": "0.48762548", "text": "func (in *MyRS) DeepCopyInto(out *MyRS) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\tin.Status.DeepCopyInto(&out.Status)\n\treturn\n}", "title": "" }, { "docid": "96fc0ef9c62819908fce29d0bfc0fa54", "score": "0.4874499", "text": "func (in *GCPFailureDomain) DeepCopyInto(out *GCPFailureDomain) {\n\t*out = *in\n\treturn\n}", "title": "" } ]
a2773f02471a92aa5ce2321cd21fbaa8
Validate validates the formation's request body input
[ { "docid": "dd7d40fe26d9a1aba58dd46813fbe4f2", "score": "0.6823249", "text": "func (b FormationRequestBody) Validate() error {\n\treturn validation.ValidateStruct(&b,\n\t\tvalidation.Field(&b.State,\n\t\t\tvalidation.When(len(b.Error) == 0, validation.In(model.ReadyFormationState, model.CreateErrorFormationState, model.DeleteErrorFormationState)).\n\t\t\t\tElse(validation.In(model.CreateErrorFormationState, model.DeleteErrorFormationState))))\n}", "title": "" } ]
[ { "docid": "8a14c40de1797f494a90810b937c89f7", "score": "0.75845987", "text": "func BodyValidation(ctx context.Context, e echo.Context, req interface{}, reqType string) error {\n\tvar (\n\t\ttotalRequired int\n\t)\n\n\tif reqType == JSON {\n\t\tif err := json.NewDecoder(e.Request().Body).Decode(req); err != nil {\n\t\t\tif ute, ok := err.(*json.UnmarshalTypeError); ok {\n\t\t\t\tlogger.FieldMandatory(ute.Field, fmt.Sprintf(\"%s harus berupa %s bukan %s\", convertFieldName(ute.Field), convertTypeData(ute.Type.String()), convertTypeData(ute.Value))).Body(ctx)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\n\tto := reflect.TypeOf(req).Elem()\n\tvo := reflect.ValueOf(req).Elem()\n\n\tfor i := 0; i < to.NumField(); i++ {\n\t\tvar (\n\t\t\tfield string\n\t\t)\n\t\tfieldTo := to.Field(i)\n\t\tvalueRequired, reqField := fieldTo.Tag.Lookup(REQUIRED)\n\n\t\tif reqType == JSON {\n\t\t\tfield = fieldTo.Tag.Get(JSON)\n\t\t}\n\n\t\tfieldVo := vo.Field(i)\n\t\tif reqType == FORM && reqField {\n\t\t\tfield = fieldTo.Tag.Get(FORM)\n\t\t\tif !fieldVo.CanSet() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif valueRequired != FILE {\n\t\t\t\tval := reflect.ValueOf(e.FormValue(field))\n\t\t\t\tif !val.IsZero() {\n\t\t\t\t\tv, err := convertKindValue(ctx, fieldTo, val, field, valueRequired)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogger.Message(\"error convert kind %w\", err).To(ctx)\n\t\t\t\t\t\ttotalRequired++\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tval = v\n\n\t\t\t\t\tfieldVo.Set(val)\n\t\t\t\t}\n\t\t\t} else if valueRequired == FILE {\n\t\t\t\tv, err := e.FormFile(field)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif !errors.Is(err, http.ErrMissingFile) {\n\t\t\t\t\t\tlogger.FieldMandatory(strings.ToLower(fieldTo.Name), fmt.Sprintf(\"Field %s harus berbentuk file\", convertFieldName(fieldTo.Name))).Body(ctx)\n\t\t\t\t\t\ttotalRequired++\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tval := reflect.ValueOf(v)\n\t\t\t\tif !val.IsZero() {\n\t\t\t\t\tfieldVo.Set(val)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if reqType == FORM {\n\t\t\tfield = fieldTo.Tag.Get(FORM)\n\t\t\tval := reflect.ValueOf(e.FormValue(field))\n\t\t\tif !val.IsZero() {\n\t\t\t\tv, err := convertKindValue(ctx, fieldTo, val, field, FORM)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Message(\"error convert kind %w\", err).To(ctx)\n\t\t\t\t\ttotalRequired++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tval = v\n\n\t\t\t\tfieldVo.Set(val)\n\t\t\t}\n\t\t}\n\n\t\ttQuery, ok := fieldTo.Tag.Lookup(QUERY)\n\t\tif ok {\n\t\t\tfield = tQuery\n\n\t\t\tval := reflect.ValueOf(e.QueryParam(field))\n\t\t\tif !val.IsZero() {\n\t\t\t\tval, err := convertKindValue(ctx, fieldTo, val, field, QUERY)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Message(\"error convert kind %w\", err).To(ctx)\n\t\t\t\t\ttotalRequired++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfieldVo.Set(val)\n\t\t\t}\n\t\t}\n\n\t\ttParam, paramOk := fieldTo.Tag.Lookup(PARAM)\n\t\tif paramOk {\n\t\t\tfield = tParam\n\n\t\t\tval := reflect.ValueOf(e.Param(field))\n\t\t\tif !val.IsZero() {\n\t\t\t\tval, err := convertKindValue(ctx, fieldTo, val, field, PARAM)\n\t\t\t\tif err != nil {\n\t\t\t\t\ttotalRequired++\n\t\t\t\t\tlogger.Message(\"error convert kind %w\", err).To(ctx)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfieldVo.Set(val)\n\t\t\t}\n\t\t}\n\n\t\tif reqField {\n\t\t\tif fieldVo.IsZero() {\n\t\t\t\t// log.Println(valueRequired, field, fieldVo.Kind(), fieldTo.Type.Kind())\n\t\t\t\tswitch valueRequired {\n\t\t\t\tcase JSON, FORM, FILE:\n\t\t\t\t\tlogger.FieldMandatory(field, fmt.Sprintf(\"%s is required\", convertFieldName(field))).Body(ctx)\n\t\t\t\tcase QUERY:\n\t\t\t\t\tlogger.FieldMandatory(tQuery, fmt.Sprintf(\"%s is required\", convertFieldName(tQuery))).QueryString(ctx)\n\t\t\t\tcase PARAM:\n\t\t\t\t\tlogger.FieldMandatory(field, fmt.Sprintf(\"%s is required\", convertFieldName(field))).Path(ctx)\n\t\t\t\tdefault:\n\t\t\t\t}\n\n\t\t\t\ttotalRequired++\n\t\t\t}\n\t\t}\n\t}\n\n\tif totalRequired > 0 {\n\t\terr := fmt.Errorf(\"%d field required\", totalRequired)\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "69d15b335a3fa30cc04d7d26e41b41cd", "score": "0.6659858", "text": "func ValidateGenRequestBody(body *GenRequestBody) (err error) {\n\tif body.W == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"w\", \"body\"))\n\t}\n\tif body.H == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"h\", \"body\"))\n\t}\n\tif body.W != nil {\n\t\tif *body.W < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.w\", *body.W, 1, true))\n\t\t}\n\t}\n\tif body.W != nil {\n\t\tif *body.W > 1001 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.w\", *body.W, 1001, false))\n\t\t}\n\t}\n\tif body.H != nil {\n\t\tif *body.H < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.h\", *body.H, 1, true))\n\t\t}\n\t}\n\tif body.H != nil {\n\t\tif *body.H > 1001 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.h\", *body.H, 1001, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "29f277ed0e2e55805afdb8e96cc7cf8a", "score": "0.66243523", "text": "func (ar *authorisationRequestBody) Validate(r *http.Request) error {\n\tcardNumber := r.FormValue(\"cardNumber\")\n\tif cardNumber == \"\" {\n\t\treturn errors.New(\"Valid `cardNumber` must be provided`\")\n\t}\n\tar.cardNumber = cardNumber\n\n\tamount, err := strconv.ParseFloat(r.FormValue(\"amount\"), 64)\n\tif err != nil {\n\t\treturn errors.New(\"Valid `amount` must be provided`\")\n\t}\n\tar.amount = amount\n\n\treason := r.FormValue(\"reason\")\n\tif reason == \"\" {\n\t\treturn errors.New(\"argument `reason` to capture money must be provided`\")\n\t}\n\tar.reason = reason\n\n\tmerchantID := r.FormValue(\"merchantId\")\n\tif merchantID == \"\" {\n\t\treturn errors.New(\"argument `merchantId` must be provided`\")\n\t}\n\n\tar.merchantId = merchantID\n\n\treturn nil\n}", "title": "" }, { "docid": "ef12a1f61cffb16d6a39d576cd4d9402", "score": "0.6623866", "text": "func (body *CreateRequestBody) Validate() (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Cron == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"cron\", \"body\"))\n\t}\n\tif body.Color == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"color\", \"body\"))\n\t}\n\tif body.Next == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"next\", \"body\"))\n\t}\n\tif body.Name != nil {\n\t\tif utf8.RuneCountInString(*body.Name) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.name\", *body.Name, utf8.RuneCountInString(*body.Name), 100, false))\n\t\t}\n\t}\n\tif body.Color != nil {\n\t\tif !(*body.Color == \"red\" || *body.Color == \"yellow\" || *body.Color == \"green\" || *body.Color == \"off\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.color\", *body.Color, []interface{}{\"red\", \"yellow\", \"green\", \"off\"}))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "db3c6b456f3909617ed2cc67e66d829e", "score": "0.6514842", "text": "func (m *Body) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "fe164de1f80a53c728c6e5fa821629c1", "score": "0.65123534", "text": "func (body *RecordDataRequestBody) Validate() (err error) {\n\tif body.Service == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"service\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Value == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"value\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc33257bd1b40d096e1fb73ac57f2c89", "score": "0.6453869", "text": "func (b Body) Validate() error {\n\tif b.Context.Operation != assignOperation && b.Context.Operation != unassignOperation {\n\t\treturn apperrors.NewInvalidDataError(fmt.Sprintf(\"Context operation must be either %q or %q\", assignOperation, unassignOperation))\n\t}\n\n\tif len(b.ReceiverTenant.OwnerTenant) == 0 {\n\t\treturn apperrors.NewInvalidDataError(\"Receiver tenant owner tenant must be provided.\")\n\t}\n\n\tif b.GetApplicationConfiguration() != (Configuration{}) {\n\t\toauthCredentials := b.GetOauthCredentials()\n\t\tbasicCredentials := b.GetBasicCredentials()\n\n\t\tif oauthCredentials != (Oauth2ClientCredentials{}) &&\n\t\t\t(oauthCredentials.ClientID == \"\" || oauthCredentials.ClientSecret == \"\" || oauthCredentials.TokenServiceURL == \"\") {\n\t\t\treturn apperrors.NewInvalidDataError(\"All of OauthCredentials properties should be provided\")\n\t\t}\n\n\t\tif basicCredentials != (BasicAuthentication{}) &&\n\t\t\t(basicCredentials.Username == \"\" || basicCredentials.Password == \"\") {\n\t\t\treturn apperrors.NewInvalidDataError(\"All of BasicCredentials properties should be provided\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e21dfc040c5bee50be2e6745cb5dcff", "score": "0.6421068", "text": "func validateBody(class string, context string) error {\n\t// If the given class is empty, return an error\n\tif class == \"\" {\n\t\treturn fmt.Errorf(ErrorMissingClass)\n\t}\n\n\t// If the given context is empty, return an error\n\tif context == \"\" {\n\t\treturn fmt.Errorf(ErrorMissingContext)\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "51dde8824cc7749a1a65ea741cdce4a3", "score": "0.64113545", "text": "func (m *AppendRequest) Validate() error {\n\tif m.Journal != \"\" {\n\t\tif m.Header != nil {\n\t\t\tif err := m.Header.Validate(); err != nil {\n\t\t\t\treturn ExtendContext(err, \"Header\")\n\t\t\t}\n\t\t}\n\t\tif err := m.Journal.Validate(); err != nil {\n\t\t\treturn ExtendContext(err, \"Journal\")\n\t\t} else if m.Offset < 0 {\n\t\t\treturn NewValidationError(\"invalid Offset (%d; expected >= 0)\", m.Offset)\n\t\t} else if len(m.Content) != 0 {\n\t\t\treturn NewValidationError(\"unexpected Content\")\n\t\t}\n\t\tif m.CheckRegisters != nil {\n\t\t\tif err := m.CheckRegisters.Validate(); err != nil {\n\t\t\t\treturn ExtendContext(err, \"CheckRegisters\")\n\t\t\t}\n\t\t}\n\t\tif m.UnionRegisters != nil {\n\t\t\tif err := m.UnionRegisters.Validate(); err != nil {\n\t\t\t\treturn ExtendContext(err, \"UnionRegisters\")\n\t\t\t}\n\t\t}\n\t\tif m.SubtractRegisters != nil {\n\t\t\tif err := m.SubtractRegisters.Validate(); err != nil {\n\t\t\t\treturn ExtendContext(err, \"SubtractRegisters\")\n\t\t\t}\n\t\t}\n\t} else if m.Header != nil {\n\t\treturn NewValidationError(\"unexpected Header\")\n\t} else if m.DoNotProxy {\n\t\treturn NewValidationError(\"unexpected DoNotProxy\")\n\t} else if m.Offset != 0 {\n\t\treturn NewValidationError(\"unexpected Offset\")\n\t} else if m.CheckRegisters != nil {\n\t\treturn NewValidationError(\"unexpected CheckRegisters\")\n\t} else if m.UnionRegisters != nil {\n\t\treturn NewValidationError(\"unexpected UnionRegisters\")\n\t} else if m.SubtractRegisters != nil {\n\t\treturn NewValidationError(\"unexpected SubtractRegisters\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f96a53e7efb62d198e64f860e18594dc", "score": "0.6394264", "text": "func decodeAndValidateRequestBody(r *http.Request, v Validator) (error, error) {\n\tdefer r.Body.Close()\n\n\tif err := json.NewDecoder(r.Body).Decode(v); err != nil {\n\t\treturn err, nil\n\t}\n\treturn v.Validate()\n}", "title": "" }, { "docid": "cc3a53ec666e1afe2e2b721ec67b7aa3", "score": "0.63674754", "text": "func (b Body) Valid() bool {\n\tdata := b.Type\n\tdataTypes := []string{\n\t\t\"text\",\n\t\t\"json\",\n\t\t\"xml\",\n\t\t\"yaml\",\n\t\t\"urlencode\",\n\t}\n\tfor _, dataType := range dataTypes {\n\t\tif data == dataType {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "775c2bfc9cb64846575a126370135b1a", "score": "0.63233477", "text": "func (ut *postPayload) Validate() (err error) {\n\tif ut.URLName == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"url_name\"))\n\t}\n\tif ut.Title == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"title\"))\n\t}\n\tif ut.Contents == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"contents\"))\n\t}\n\tif ut.Status == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"status\"))\n\t}\n\tif ut.Contents != nil {\n\t\tif utf8.RuneCountInString(*ut.Contents) > 120 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.contents`, *ut.Contents, utf8.RuneCountInString(*ut.Contents), 120, false))\n\t\t}\n\t}\n\tif ut.Status != nil {\n\t\tif !(*ut.Status == \"draft\" || *ut.Status == \"published\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(`request.status`, *ut.Status, []interface{}{\"draft\", \"published\"}))\n\t\t}\n\t}\n\tif ut.Title != nil {\n\t\tif utf8.RuneCountInString(*ut.Title) > 120 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.title`, *ut.Title, utf8.RuneCountInString(*ut.Title), 120, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "88f69eaca204aa704cf34e0208730782", "score": "0.6275654", "text": "func (m *HttpBody) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "8f01935a6ab4f66d4190abc76fe98b3b", "score": "0.6253254", "text": "func (c CreateRequest) Validate() error {\n\t/*\n\t * This regex matches the file extension for various languages.\n\n\t * Languages including:\n\t * \tPython, JavaScript(React), TypeScript(React), Go, Kotlin,\n\t *\tC++, SQL, C-Sharp, C (including `.h`), Scala, Haskell,\n\t * \tShell, PowerShell, PHP, Assembly, Julia, Objective-C (.m),\n\t *\tPerl, Crystal, JSON, YAML, TOML, and Plain Text\n\n\t * For any unsupported formats Plain Text should be used.\n\t */\n\tregex := regexp.MustCompile(\"^py$|^[tj](sx|s)$|^go$|^kt$|^java$|^c$|^c(pp|[rs])$|^sql$|^swift$|^dart$|^r$|^r[sb]$|^h$|^scala$|^hs$|^sh$|^p(s1|hp)$|^asm$|^jl$|^m$|^txt$|^pl$|^(x|ya|to)ml$\")\n\n\treturn validation.ValidateStruct(&c,\n\t\tvalidation.Field(\n\t\t\t&c.Content,\n\t\t\tvalidation.Required,\n\t\t\t// Enforce length to follow what's set in the config\n\t\t\tvalidation.Length(2, config.Config.Documents.MaxDocumentLength),\n\t\t),\n\t\t// The purpose of this field is to support client's that perform\n\t\t// syntax highlighting and need to know what highlighter to use.\n\t\tvalidation.Field(\n\t\t\t&c.Extension,\n\t\t\tvalidation.Match(regex),\n\t\t\tvalidation.Required,\n\t\t),\n\t)\n}", "title": "" }, { "docid": "08ead3b58a539953c0def01a1b7766fd", "score": "0.6252451", "text": "func validateNewBody(body Body) error {\n\t// Reject a body that contains the \"_removed\" property, this means that the user\n\t// is trying to update a document they do not have read access to.\n\tif body[BodyRemoved] != nil {\n\t\treturn base.HTTPErrorf(http.StatusNotFound, \"Document revision is not accessible\")\n\t}\n\n\t// Reject bodies that contains the \"_purged\" property.\n\tif _, ok := body[BodyPurged]; ok {\n\t\treturn base.HTTPErrorf(http.StatusBadRequest, \"user defined top-level property '_purged' is not allowed in document body\")\n\t}\n\n\tfor key := range body {\n\t\tif strings.HasPrefix(key, BodyInternalPrefix) {\n\t\t\treturn base.HTTPErrorf(http.StatusBadRequest, \"user defined top-level properties that start with '_sync_' are not allowed in document body\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91721fa65bb3d45581bf5864a78a5941", "score": "0.62033427", "text": "func (ut *messagePayload) Validate() (err error) {\n\tif ut.Content == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"content\"))\n\t}\n\tif ut.Auther == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"auther\"))\n\t}\n\tif ut.Created == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"created\"))\n\t}\n\tif ut.Content != nil {\n\t\tif utf8.RuneCountInString(*ut.Content) < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.content`, *ut.Content, utf8.RuneCountInString(*ut.Content), 1, true))\n\t\t}\n\t}\n\tif ut.Content != nil {\n\t\tif utf8.RuneCountInString(*ut.Content) > 400 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.content`, *ut.Content, utf8.RuneCountInString(*ut.Content), 400, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "79a83d14b64ad5cb610ef6b9b803cfde", "score": "0.61924857", "text": "func (m *PactReificationRequest) Validate() error {\n\tm.Args = []string{}\n\n\tbody, err := json.Marshal(m.Message)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.Args = append(m.Args, []string{\n\t\t\"reify\",\n\t\tstring(body),\n\t}...)\n\n\treturn nil\n}", "title": "" }, { "docid": "1b67f30f119dc11b77877c3a7a524c1c", "score": "0.6190934", "text": "func (r Request) Validate() error {\n\tpanic(\"Implement me!\")\n}", "title": "" }, { "docid": "008e9c1bbac19880a9f5d7d10d972a25", "score": "0.61376554", "text": "func (r updateSeedReq) Validate() error {\n\tif r.Name != r.Body.Name {\n\t\treturn fmt.Errorf(\"seed name mismatch, you requested to update Seed = %s but body contains Seed = %s\", r.Name, r.Body.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8bc73ff2f9fd3db729d02f47dc523987", "score": "0.61372405", "text": "func (ut *roomPayload) Validate() (err error) {\n\tif ut.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"name\"))\n\t}\n\tif ut.Description == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"description\"))\n\t}\n\tif ut.Description != nil {\n\t\tif utf8.RuneCountInString(*ut.Description) > 400 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 400, false))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif ok := goa.ValidatePattern(`[a-z|0-9]+`, *ut.Name); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.name`, *ut.Name, `[a-z|0-9]+`))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) < 3 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 3, true))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) > 20 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 20, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1207efa0d88770dd68e95a1cdbe613b1", "score": "0.609922", "text": "func ValidatePublishRequestBody(body *PublishRequestBody) (err error) {\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Message != nil {\n\t\tif utf8.RuneCountInString(*body.Message) < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.message\", *body.Message, utf8.RuneCountInString(*body.Message), 1, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "660ae96a0b15eaed5147eb7ee44be091", "score": "0.6084845", "text": "func (requestBody *RequestBody) Validate(ctx context.Context, opts ...ValidationOption) error {\n\tctx = WithValidationOptions(ctx, opts...)\n\n\tif requestBody.Content == nil {\n\t\treturn errors.New(\"content of the request body is required\")\n\t}\n\n\tif vo := getValidationOptions(ctx); !vo.examplesValidationDisabled {\n\t\tvo.examplesValidationAsReq, vo.examplesValidationAsRes = true, false\n\t}\n\n\tif err := requestBody.Content.Validate(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn validateExtensions(ctx, requestBody.Extensions)\n}", "title": "" }, { "docid": "7dfe228a1551b94686b18eeb8467fda1", "score": "0.6032931", "text": "func validatePost(c *gin.Context) bool {\n\tc.Request.ParseMultipartForm(1000)\n\tform := c.Request.PostForm\n\tif !isFormValid(form, []string{\"title\", \"content\"}) {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"message\": \"Request Length should be 2\",\n\t\t})\n\t\treturn false\n\t}\n\ttitle := form[\"title\"][0]\n\tcontent := form[\"content\"][0]\n\tif title == \"\" {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"message\": \"filed `title` is not valid\",\n\t\t})\n\t\treturn false\n\t} else if content == \"\" {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"message\": \"filed `content` is not valid\",\n\t\t})\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4e7bb52c75f1c66d7e47bc1725a6df1a", "score": "0.6008374", "text": "func validateImportBody(body Body) error {\n\tif body == nil {\n\t\treturn base.ErrEmptyDocument\n\t}\n\n\tif isPurged, ok := body[BodyPurged].(bool); ok && isPurged {\n\t\treturn base.ErrImportCancelledPurged\n\t}\n\n\t// Prevent disallowed internal properties from being used\n\tdisallowed := []string{BodyId, BodyRev, BodyExpiry, BodyRevisions}\n\tfor _, prop := range disallowed {\n\t\tif _, ok := body[prop]; ok {\n\t\t\treturn base.HTTPErrorf(http.StatusBadRequest, \"top-level property '\"+prop+\"' is a reserved internal property therefore cannot be imported\")\n\t\t}\n\t}\n\t// TODO: Validate attachment data to ensure user is not setting invalid attachments\n\n\treturn nil\n}", "title": "" }, { "docid": "3c09ebb555e2554c1da84fd8077b2523", "score": "0.5970255", "text": "func (o *UndelegateBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAmount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateBaseReq(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDelegatorAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateValidatorAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "146b525ddb886eba52d2390f9bcb7287", "score": "0.596851", "text": "func (e *EmailRequest) Validate() error {\n\n\tif len(e.RecipientEmail) > MaxEmailAddressLength {\n\t\treturn errors.New(\"INVALID_ARG_TO_EXCEEDS_MAX_LENGTH\")\n\t}\n\n\tif len(e.SenderEmail) > MaxEmailAddressLength {\n\t\treturn errors.New(\"INVALID_ARG_FROM_EXCEEDS_MAX_LENGTH\")\n\t}\n\n\tif len(e.Subject) > MaxSubjectLineLength {\n\t\treturn errors.New(\"INVALID_ARG_SUBJECT_EXCEEDS_MAX_LENGTH\")\n\t}\n\n\te.PlainTextBody = getPlainText(e.HTMLBody)\n\n\treturn nil\n\n}", "title": "" }, { "docid": "06d9196731295ed82c252f33435b10e6", "score": "0.59514844", "text": "func ValidateTransferRequestBody(body *TransferRequestBody) (err error) {\n\tif body.ReceiverID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"receiverID\", \"body\"))\n\t}\n\tif body.Amount == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"amount\", \"body\"))\n\t}\n\tif body.ReceiverID != nil {\n\t\tif *body.ReceiverID < 0 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.receiverID\", *body.ReceiverID, 0, true))\n\t\t}\n\t}\n\tif body.Amount != nil {\n\t\tif *body.Amount < 0 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.amount\", *body.Amount, 0, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "70a05c118de2ad807b51191a60ac85aa", "score": "0.5944919", "text": "func (m *ThirdRequest_Body) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for DraftLineId\n\n\tif v, ok := interface{}(m.GetDraftLine()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn ThirdRequest_BodyValidationError{\n\t\t\t\tfield: \"DraftLine\",\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\treturn nil\n}", "title": "" }, { "docid": "e9d1336bbc8888d9f1b8e8508846321e", "score": "0.59360796", "text": "func (m *AddGreetingRequest) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBase64Content(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8fdc05d21826ba33295454edd88b172", "score": "0.5930693", "text": "func (reqd *RequestJSON) Validate() error {\n\tif reqd.DestHost == \"\" {\n\t\treturn errors.New(\"request is missing target host\")\n\t}\n\n\tif reqd.DestPort == 0 {\n\t\treturn errors.New(\"request is missing target port\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1bd12ecb4e589e5a366066b07737bf6a", "score": "0.59266984", "text": "func (o *BuyCandyBadRequestBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "26388912c7b07039d10367aaf5c56120", "score": "0.59092283", "text": "func (req *createAuthorRequest) Validate() error {\n\tswitch {\n\tcase req.UserID < 1:\n\t\treturn fmt.Errorf(\"not correct user id\")\n\tcase req.Age < 1:\n\t\treturn fmt.Errorf(\"not correct age\")\n\tcase req.Name == \"\":\n\t\treturn fmt.Errorf(\"name is required\")\n\tcase req.Description == \"\":\n\t\treturn fmt.Errorf(\"description is required\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c9552863ee43f575b5b83100326e54ab", "score": "0.59031886", "text": "func (o *GetSelfBadRequestBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateMessage(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a18730d516b87b1a4a763420b573d3a7", "score": "0.59020764", "text": "func (mw *Middleware) CheckRequestBody(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"POST\" && r.Method != \"PUT\" {\n\t\t\tnext.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\tbodyBytes, _ := ioutil.ReadAll(r.Body)\n\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))\n\t\tif len(bodyBytes) == 0 {\n\t\t\tutils.RespondWithError(\n\t\t\t\tw,\n\t\t\t\thttp.StatusBadRequest,\n\t\t\t\t\"Empty Request Payload\",\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tvar payload map[string]interface{}\n\t\tif err := json.Unmarshal(bodyBytes, &payload); err != nil {\n\t\t\tutils.RespondWithError(\n\t\t\t\tw,\n\t\t\t\thttp.StatusBadRequest,\n\t\t\t\t\"Invalid request payload\",\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif len(payload) == 0 || payload == nil {\n\t\t\tutils.RespondWithError(w, http.StatusBadRequest,\n\t\t\t\t\"No fields in request payload\")\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t\treturn\n\t})\n}", "title": "" }, { "docid": "7f826b4df9258e865512b2afb9363827", "score": "0.5870959", "text": "func (req *updateAuthorRequest) Validate() error {\n\tswitch {\n\tcase req.ID < 1:\n\t\treturn fmt.Errorf(\"not correct id\")\n\tcase req.UserID < 1:\n\t\treturn fmt.Errorf(\"not correct user id\")\n\tcase req.Age < 1:\n\t\treturn fmt.Errorf(\"not correct age\")\n\tcase req.Name == \"\":\n\t\treturn fmt.Errorf(\"name is required\")\n\tcase req.Description == \"\":\n\t\treturn fmt.Errorf(\"description is required\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "6af262a4ffd9a3887613595c3369c820", "score": "0.58664745", "text": "func (ut *postPayload) Validate() (err error) {\n\tif ut.Title == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"title\"))\n\t}\n\tif ut.Body == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"body\"))\n\t}\n\tif ut.Published == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"published\"))\n\t}\n\n\tif ut.Body != nil {\n\t\tif utf8.RuneCountInString(*ut.Body) < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.body`, *ut.Body, utf8.RuneCountInString(*ut.Body), 1, true))\n\t\t}\n\t}\n\tif ut.Title != nil {\n\t\tif utf8.RuneCountInString(*ut.Title) < 1 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.title`, *ut.Title, utf8.RuneCountInString(*ut.Title), 1, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "69b409afa4371f2003e82e5e0db44757", "score": "0.5845392", "text": "func (r patchTokenReq) Validate() error {\n\tif err := r.commonTokenReq.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif len(r.TokenID) == 0 {\n\t\treturn fmt.Errorf(\"token ID cannot be empty\")\n\t}\n\tif len(r.Body) == 0 {\n\t\treturn fmt.Errorf(\"body can not be empty\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f9bb61fd6d68de49e38080014f55ccec", "score": "0.58397895", "text": "func (m *versionRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "afe3ab9557a29965de4b192ab8e0b13b", "score": "0.5839083", "text": "func Valid(request interface{}) error {\n\tswitch request := request.(type) {\n\tcase *FiatRequest:\n\t\treturn ValidateFiat(request)\n\tcase *CryptoRequest:\n\t\treturn ValidateCrypto(request)\n\tdefault:\n\t\treturn ErrInvalidRequest\n\t}\n}", "title": "" }, { "docid": "44609edfa96d06d96edee71441cb86bb", "score": "0.583855", "text": "func (m *ReadRequest) Validate() error {\n\tif m.Header != nil {\n\t\tif err := m.Header.Validate(); err != nil {\n\t\t\treturn ExtendContext(err, \"Header\")\n\t\t}\n\t}\n\tif err := m.Journal.Validate(); err != nil {\n\t\treturn ExtendContext(err, \"Journal\")\n\t} else if m.Offset < -1 {\n\t\treturn NewValidationError(\"invalid Offset (%d; expected -1 <= Offset <= MaxInt64)\", m.Offset)\n\t} else if m.EndOffset < 0 || m.EndOffset != 0 && m.EndOffset < m.Offset {\n\t\treturn NewValidationError(\"invalid EndOffset (%d; expected 0 <= EndOffset <= Offset)\", m.EndOffset)\n\t}\n\n\t// Block, DoNotProxy, and MetadataOnly (each type bool) require no extra validation.\n\n\treturn nil\n}", "title": "" }, { "docid": "f6533e728287350e62cbab86f5f8421d", "score": "0.5836638", "text": "func (ut *PostPayload) Validate() (err error) {\n\tif ut.Title == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"title\"))\n\t}\n\tif ut.Body == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"body\"))\n\t}\n\n\tif utf8.RuneCountInString(ut.Body) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.body`, ut.Body, utf8.RuneCountInString(ut.Body), 1, true))\n\t}\n\tif utf8.RuneCountInString(ut.Title) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.title`, ut.Title, utf8.RuneCountInString(ut.Title), 1, true))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ebf9f541b64ce3d9b983cf2b0dcbd2db", "score": "0.5836567", "text": "func validatePayload(r *http.Request, w http.ResponseWriter) bool {\n\tif r.ContentLength == 0 { // empty payload should not be accepted\n\t\thttp.Error(w, \"Empty payload\", http.StatusBadRequest)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "df48cd50bf2c90ff8e1cdbc73d708745", "score": "0.583434", "text": "func (o *GetSelfInternalServerErrorBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateMessage(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bec01aaa763712f8c2ce7f68f187a5ff", "score": "0.5827677", "text": "func (ut *recipePayload) Validate() (err error) {\n\tif ut.Title == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"title\"))\n\t}\n\tif ut.Difficulty != nil {\n\t\tif *ut.Difficulty < 0.000000 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`request.difficulty`, *ut.Difficulty, 0.000000, true))\n\t\t}\n\t}\n\tif ut.Difficulty != nil {\n\t\tif *ut.Difficulty > 1.000000 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`request.difficulty`, *ut.Difficulty, 1.000000, false))\n\t\t}\n\t}\n\tfor _, e := range ut.Ingredients {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\tif ut.Rating != nil {\n\t\tif *ut.Rating < 0.000000 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`request.rating`, *ut.Rating, 0.000000, true))\n\t\t}\n\t}\n\tif ut.Rating != nil {\n\t\tif *ut.Rating > 1.000000 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`request.rating`, *ut.Rating, 1.000000, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "78c47c0d1328911cd225967b70108ebc", "score": "0.58263737", "text": "func ValidateWithdrawRequestBody(body *WithdrawRequestBody) (err error) {\n\tif body.Amount == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"amount\", \"body\"))\n\t}\n\tif body.Amount != nil {\n\t\tif *body.Amount < 0 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.amount\", *body.Amount, 0, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc3d41f871da1cce3f6cfcc5dee8ffcc", "score": "0.58170116", "text": "func (ut *appPayload) Validate() (err error) {\n\tif ut.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"name\"))\n\t}\n\tif ut.Description != nil {\n\t\tif utf8.RuneCountInString(*ut.Description) > 300 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 300, false))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) > 50 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 50, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d15a3bb4e6c271bc9420e76d0572f666", "score": "0.5814973", "text": "func (mu *MessageUpdates) Validate() error {\n\tif len(mu.Body) == 0 {\n\t\treturn fmt.Errorf(\"error: no body\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f9518746f8e6018f6115902f6bb796f5", "score": "0.5814216", "text": "func (m *HttpRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tswitch m.Message.(type) {\n\n\tcase *HttpRequest_Header_:\n\n\t\tif v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn HttpRequestValidationError{\n\t\t\t\t\tfield: \"Header\",\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *HttpRequest_Data_:\n\n\t\tif v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn HttpRequestValidationError{\n\t\t\t\t\tfield: \"Data\",\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *HttpRequest_Trailer_:\n\n\t\tif v, ok := interface{}(m.GetTrailer()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn HttpRequestValidationError{\n\t\t\t\t\tfield: \"Trailer\",\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\treturn HttpRequestValidationError{\n\t\t\tfield: \"Message\",\n\t\t\treason: \"value is required\",\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "53d7325eeb8c1ce5ecfa67fc4665fdcf", "score": "0.58069545", "text": "func (o *RatemoviesBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a65227ab0cd27e38df7050dcfc7c936f", "score": "0.5790563", "text": "func (m *HttpGenericBodyMatch) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "1842096926ebde6ec6cb9c759c756a9b", "score": "0.57895285", "text": "func (m *SecondRequest_Body) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for DraftLineId\n\n\tif v, ok := interface{}(m.GetDraftLine()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn SecondRequest_BodyValidationError{\n\t\t\t\tfield: \"DraftLine\",\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\treturn nil\n}", "title": "" }, { "docid": "d1ed57dbd5c0b41b54f02f6e7ddfd3dd", "score": "0.57870907", "text": "func (o *InitPayOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "d2d349b4be22be4c5e6ff58a4387a1dc", "score": "0.5780153", "text": "func (o *ChannelsPostBadRequestBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5a67a8c12ae43e200d53c4553116e620", "score": "0.5776281", "text": "func (mt *Message) Validate() (err error) {\n\n\tif mt.Content == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"content\"))\n\t}\n\tif mt.Auther == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"auther\"))\n\t}\n\n\tif utf8.RuneCountInString(mt.Content) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.content`, mt.Content, utf8.RuneCountInString(mt.Content), 1, true))\n\t}\n\tif utf8.RuneCountInString(mt.Content) > 400 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`response.content`, mt.Content, utf8.RuneCountInString(mt.Content), 400, false))\n\t}\n\treturn\n}", "title": "" }, { "docid": "03ccb80c5d12c86b2dd81538b85354fa", "score": "0.5773225", "text": "func (rv *RequestValidator) ValidateBody(url string, body []byte, expectedSignature string) bool {\n\tparsed, err := urllib.Parse(url)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tbodySHA256 := parsed.Query().Get(\"bodySHA256\")\n\n\t// For x-www-form-urlencoded Request body\n\tif len(bodySHA256) == 0 {\n\t\tparsedBody, err := urllib.ParseQuery(string(body))\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tparams := make(map[string]string)\n\t\tfor k, v := range parsedBody {\n\t\t\t//validate with first value of each key\n\t\t\tparams[k] = v[0]\n\t\t}\n\t\treturn rv.Validate(url, params, expectedSignature)\n\t}\n\n\treturn rv.Validate(url, map[string]string{}, expectedSignature) &&\n\t\trv.validateBody(body, bodySHA256)\n}", "title": "" }, { "docid": "c5b9a01821f119c7bca316ce71ca44de", "score": "0.576583", "text": "func (o *PostHardwaresOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "256dd1773a07af314f896db7efa082bb", "score": "0.57631457", "text": "func (m *BodyResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "cb4ffcdc2b0cf6e2a157304af959d5e4", "score": "0.576011", "text": "func (topup *TopupRequest) Validate(r *http.Request) error {\n\tcardNumber := r.FormValue(\"cardNumber\")\n\tif cardNumber == \"\" {\n\t\treturn errors.New(\"Parameter `cardNumber` must be provided`\")\n\t}\n\ttopup.cardNumber = cardNumber\n\n\tamount, err := strconv.ParseFloat(r.FormValue(\"amount\"), 64)\n\tif err != nil {\n\t\treturn errors.New(\"Parameter `amount` must be provided`\")\n\t}\n\ttopup.amount = amount\n\n\treturn nil\n}", "title": "" }, { "docid": "90acc7a8f5181f9b20ebfb520e75a67e", "score": "0.5760029", "text": "func (o *GetSelfUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateMessage(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ba3ba24f34adef992c8f1ef301fc33d", "score": "0.5758835", "text": "func ValidateSendValidationBadRequestResponseBody(body *SendValidationBadRequestResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "11ecc17cb21547811b1d51a53ece6e8f", "score": "0.5749475", "text": "func (m MyOpBody) Validate() error {\n\treturn validation.Errors{}.Filter()\n}", "title": "" }, { "docid": "ceb488aa306c8e01cecf62e7d598c8ec", "score": "0.5736011", "text": "func (r addTokenReq) Validate() error {\n\tif len(r.Body.Name) == 0 || len(r.ProjectID) == 0 || len(r.ServiceAccountID) == 0 {\n\t\treturn fmt.Errorf(\"the name, service account ID and project ID cannot be empty\")\n\t}\n\tif utf8.RuneCountInString(r.Body.Name) > 50 {\n\t\treturn fmt.Errorf(\"the name is too long, max 50 chars\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e5a9b0ab81bc7c351de1eaa4cc6a9433", "score": "0.57356924", "text": "func (signReq *UrlSignRequest) Validate() error {\n\tif len(signReq.region) == 0 {\n\t\treturn fmt.Errorf(\"Region must be given\")\n\t}\n\tif len(signReq.bucket) == 0 {\n\t\treturn fmt.Errorf(\"Bucket must be given\")\n\t}\n\tif len(signReq.key) == 0 {\n\t\treturn fmt.Errorf(\"Key must be given\")\n\t}\n\tif len(signReq.verb) == 0 {\n\t\treturn fmt.Errorf(\"Verb must be given\")\n\t}\n\tif len(signReq.duration) == 0 {\n\t\treturn fmt.Errorf(\"Duration must be given\")\n\t}\n\t// Check that the duration is parseable\n\t_, err := time.ParseDuration(urlSignRequest.duration)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94314e2fe2f2f417ce86c9e0c3e1e103", "score": "0.57147336", "text": "func formValidation(w http.ResponseWriter, r *http.Request) bool {\n\tif r.FormValue(\"project_name\") == \"\" {\n\t\tw.Write([]byte(\"Please create a project name.\"))\n\t\treturn false\n\t}\n\n\tif r.FormValue(\"item_type\") == \"\" {\n\t\tw.Write([]byte(\"Please choose an item type.\"))\n\t\treturn false\n\t}\n\n\tif r.FormValue(\"label_type\") == \"\" {\n\t\tw.Write([]byte(\"Please choose a label type.\"))\n\t\treturn false\n\t}\n\n\tif r.FormValue(\"task_size\") == \"\" {\n\t\tw.Write([]byte(\"Please specify a task size.\"))\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0f87faa4b9f41830546ce5d00f397c4d", "score": "0.5696229", "text": "func UnmarshalForm(w http.ResponseWriter, r *http.Request, to interface{}) error {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Cannot read request body: %+v\", err)\n\t\tError(w, JSONErrorResponse{\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMessage: \"Cannot read request body\",\n\t\t\tClientMessage: \"Внутренняя ошибка сервера. Пожалуйста, повторите позднее\",\n\t\t})\n\t\treturn xerrors.Errorf(\"cannot read request body: %w\", ErrIncorrectBody)\n\t}\n\terr = json.Unmarshal(body, to)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Cannot unmarshal request body: %+v\", err)\n\t\tError(w, JSONErrorResponse{\n\t\t\tStatus: http.StatusNotAcceptable,\n\t\t\tMessage: \"Cannot unmarshal request body\",\n\t\t\tClientMessage: \"Сервер получил некорректный запрос\",\n\t\t})\n\t\treturn xerrors.Errorf(\"cannot unmarshal request body: %w\", ErrIncorrectBody)\n\t}\n\n\tvalidate := validator.New()\n\terr = validate.Struct(to)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Invalid request body: %+v\", err)\n\t\tError(w, JSONErrorResponse{\n\t\t\tStatus: http.StatusNotAcceptable,\n\t\t\tMessage: \"Invalid request\",\n\t\t\tClientMessage: \"Сервер получил некорректный запрос\",\n\t\t})\n\t\treturn xerrors.Errorf(\"invalid request body: %w\", ErrIncorectFormFields)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc5f6ca11e7e0c8d08b5e6cfd9b3ad93", "score": "0.56923217", "text": "func (body *ScheduleResponseBody) Validate() (err error) {\n\tif utf8.RuneCountInString(body.Name) > 100 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.name\", body.Name, utf8.RuneCountInString(body.Name), 100, false))\n\t}\n\tif !(body.Color == \"red\" || body.Color == \"yellow\" || body.Color == \"green\" || body.Color == \"off\") {\n\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.color\", body.Color, []interface{}{\"red\", \"yellow\", \"green\", \"off\"}))\n\t}\n\treturn\n}", "title": "" }, { "docid": "793b15695e2acc1012d078fefacaa118", "score": "0.568886", "text": "func (o *C11yCorpusGetBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6e78372c849438b8161520206974a65f", "score": "0.568876", "text": "func (b FormationAssignmentRequestBody) Validate() error {\n\tvar fieldRules []*validation.FieldRules\n\tfieldRules = append(fieldRules, validation.Field(&b.State, validation.In(model.ReadyAssignmentState, model.CreateErrorAssignmentState, model.DeleteErrorAssignmentState, model.ConfigPendingAssignmentState)))\n\n\tif b.Error != \"\" {\n\t\tfieldRules = make([]*validation.FieldRules, 0)\n\t\tfieldRules = append(fieldRules, validation.Field(&b.State, validation.In(model.CreateErrorAssignmentState, model.DeleteErrorAssignmentState)))\n\t\tfieldRules = append(fieldRules, validation.Field(&b.Configuration, validation.Empty))\n\t\treturn validation.ValidateStruct(&b, fieldRules...)\n\t} else if len(b.Configuration) > 0 {\n\t\tfieldRules = make([]*validation.FieldRules, 0)\n\t\tfieldRules = append(fieldRules, validation.Field(&b.State, validation.In(model.ReadyAssignmentState, model.ConfigPendingAssignmentState)))\n\t\tfieldRules = append(fieldRules, validation.Field(&b.Error, validation.Empty))\n\t\treturn validation.ValidateStruct(&b, fieldRules...)\n\t}\n\n\treturn validation.ValidateStruct(&b, fieldRules...)\n}", "title": "" }, { "docid": "748a7b76ecb7b6fabbdd81713c6848b9", "score": "0.5687713", "text": "func ValidateFounderResponseBody(body *FounderResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "748a7b76ecb7b6fabbdd81713c6848b9", "score": "0.5687713", "text": "func ValidateFounderResponseBody(body *FounderResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9b460e2174c8aca68ccc4ca83336cc27", "score": "0.56876624", "text": "func ValidateDepositRequestBody(body *DepositRequestBody) (err error) {\n\tif body.Amount == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"amount\", \"body\"))\n\t}\n\tif body.Amount != nil {\n\t\tif *body.Amount < 0 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(\"body.amount\", *body.Amount, 0, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c1651901681dfe24b3382714889649b1", "score": "0.56865716", "text": "func (o *ChannelsPostUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "dc4e0203d426b4661565da8a56498ed4", "score": "0.5684236", "text": "func (f *NewRequest) Valid() bool {\n\tf.Failures = make(map[string]string)\n\n\t// Check for non-empty Requester\n\tif strings.TrimSpace(f.Requester) == \"\" {\n\t\tf.Failures[\"Requester\"] = \"Requester is required\"\n\t\tlog.Printf(\"Request submitted with requester missing\")\n\t} else if utf8.RuneCountInString(f.Requester) > 100 {\n\t\tf.Failures[\"Requester\"] = \"Requester cannot be longer than 100 characters\"\n\t\tlog.Printf(\"Request submitted with requester over limit\")\n\t}\n\n\t// Check for non-empty title\n\tif strings.TrimSpace(f.Title) == \"\" {\n\t\tf.Failures[\"Title\"] = \"Title is required\"\n\t\tlog.Printf(\"Request submitted with title missing\")\n\t}\n\n\treturn len(f.Failures) == 0\n}", "title": "" }, { "docid": "6ba0cdad931b5b417d6b87e91415de49", "score": "0.56707036", "text": "func ValidateEducationRequestBody(body *EducationRequestBody) (err error) {\n\tif body.Institution == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"institution\", \"body\"))\n\t}\n\tif body.Major == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"major\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4bf9250f1f7f264e25727236903ec96e", "score": "0.5667602", "text": "func ValidateProcurementResponseBody(body *ProcurementResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Supplier == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"supplier\", \"body\"))\n\t}\n\tif body.Code == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"code\", \"body\"))\n\t}\n\tif body.Money == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"money\", \"body\"))\n\t}\n\tif body.IsSalesReturn == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"is_sales_return\", \"body\"))\n\t}\n\tif body.Note == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"note\", \"body\"))\n\t}\n\tif body.Head == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"head\", \"body\"))\n\t}\n\tif body.Founder == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"founder\", \"body\"))\n\t}\n\tif body.Supplier != nil {\n\t\tif err2 := ValidateSupplierResponseBody(body.Supplier); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif body.Head != nil {\n\t\tif err2 := ValidateHeadResponseBody(body.Head); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif body.Founder != nil {\n\t\tif err2 := ValidateFounderResponseBody(body.Founder); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6262eb4b9359cc4fe21d4a1822d7afa5", "score": "0.56652474", "text": "func ValidateUserResponseBody(body *UserResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Email == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"email\", \"body\"))\n\t}\n\tif body.Bio == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"bio\", \"body\"))\n\t}\n\tif body.Admin == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"admin\", \"body\"))\n\t}\n\tif body.UpdatedAt == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"updatedAt\", \"body\"))\n\t}\n\tif body.TncDate == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"tncDate\", \"body\"))\n\t}\n\tif body.Name != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidatePattern(\"body.name\", *body.Name, \"\\\\S\"))\n\t}\n\tif body.Name != nil {\n\t\tif utf8.RuneCountInString(*body.Name) > 256 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.name\", *body.Name, utf8.RuneCountInString(*body.Name), 256, false))\n\t\t}\n\t}\n\tif body.Email != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"body.email\", *body.Email, goa.FormatEmail))\n\t}\n\tif body.Email != nil {\n\t\tif utf8.RuneCountInString(*body.Email) > 40 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.email\", *body.Email, utf8.RuneCountInString(*body.Email), 40, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "36ad44d82317a55b19942e67424e7717", "score": "0.5664206", "text": "func (m *PaymentsFrontEndRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "78f2fabc19d6382c43009b1feb393e14", "score": "0.56485313", "text": "func (m *ReplicateRequest) Validate() error {\n\n\tif m.Proposal != nil {\n\n\t\t// TODO(johnny): Migration stub for v0.82 => v0.83. Remove with >= v0.84.\n\t\tif m.Registers == nil {\n\t\t\tm.Registers = new(LabelSet)\n\t\t}\n\n\t\t// Header is sent with the first message of the RPC (which must be a proposal).\n\t\tif m.Header == nil {\n\t\t\t// Pass.\n\t\t} else if err := m.Header.Validate(); err != nil {\n\t\t\treturn ExtendContext(err, \"Header\")\n\t\t} else if m.Acknowledge == false {\n\t\t\treturn NewValidationError(\"expected Acknowledge with Header\")\n\t\t}\n\n\t\tif err := m.Proposal.Validate(); err != nil {\n\t\t\treturn ExtendContext(err, \"Proposal\")\n\t\t} else if m.Registers == nil {\n\t\t\treturn NewValidationError(\"expected Registers with Proposal\")\n\t\t} else if err = m.Registers.Validate(); err != nil {\n\t\t\treturn ExtendContext(err, \"Registers\")\n\t\t} else if m.Content != nil {\n\t\t\treturn NewValidationError(\"unexpected Content with Proposal (len %d)\", len(m.Content))\n\t\t} else if m.ContentDelta != 0 {\n\t\t\treturn NewValidationError(\"unexpected ContentDelta with Proposal (%d)\", m.ContentDelta)\n\t\t}\n\n\t\t// If DeprecatedJournal is set, it must match the proposal.\n\t\tif m.DeprecatedJournal == \"\" {\n\t\t\t// Pass.\n\t\t} else if m.DeprecatedJournal != m.Proposal.Journal {\n\t\t\treturn NewValidationError(\"DeprecatedJournal and Proposal.Journal mismatch (%v vs %v)\",\n\t\t\t\tm.DeprecatedJournal, m.Proposal.Journal)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif m.Content == nil {\n\t\treturn NewValidationError(\"expected Content or Proposal\")\n\t} else if m.ContentDelta < 0 {\n\t\treturn NewValidationError(\"invalid ContentDelta (%d; expected >= 0)\", m.ContentDelta)\n\t} else if m.Header != nil {\n\t\treturn NewValidationError(\"unexpected Header with Content (%s)\", m.Header)\n\t} else if m.Registers != nil {\n\t\treturn NewValidationError(\"unexpected Registers with Content (%s)\", m.Registers)\n\t} else if m.Acknowledge {\n\t\treturn NewValidationError(\"unexpected Acknowledge with Content\")\n\t} else if m.DeprecatedJournal != \"\" {\n\t\treturn NewValidationError(\"unexpected DeprecatedJournal with Content\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a86cc68dec91bf80bee2c1d1310de48", "score": "0.5647766", "text": "func (m *PostMeContactParamsBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAddress(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBirthCountry(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEmail(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFirstName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGender(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLanguage(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLastName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLegalForm(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNationality(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePhone(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a09e32deedba117b93ecba972aa2939", "score": "0.56348085", "text": "func ValidateProductResponseBody(body *ProductResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Unit == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit\", \"body\"))\n\t}\n\tif body.CostPrice == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"cost_price\", \"body\"))\n\t}\n\tif body.MarketPrice == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"market_price\", \"body\"))\n\t}\n\tif body.Note == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"note\", \"body\"))\n\t}\n\tif body.Image == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"image\", \"body\"))\n\t}\n\tif body.Code == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"code\", \"body\"))\n\t}\n\tif body.Size == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"size\", \"body\"))\n\t}\n\tif body.Type == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"type\", \"body\"))\n\t}\n\tif body.IsShelves == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"is_shelves\", \"body\"))\n\t}\n\tif body.Founder == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"founder\", \"body\"))\n\t}\n\tif body.Unit != nil {\n\t\tif !(*body.Unit == 1 || *body.Unit == 2 || *body.Unit == 3 || *body.Unit == 4 || *body.Unit == 5 || *body.Unit == 6 || *body.Unit == 7 || *body.Unit == 8) {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.unit\", *body.Unit, []interface{}{1, 2, 3, 4, 5, 6, 7, 8}))\n\t\t}\n\t}\n\tif body.Type != nil {\n\t\tif !(*body.Type == 1 || *body.Type == 2 || *body.Type == 3 || *body.Type == 4 || *body.Type == 5 || *body.Type == 6 || *body.Type == 7 || *body.Type == 8) {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.type\", *body.Type, []interface{}{1, 2, 3, 4, 5, 6, 7, 8}))\n\t\t}\n\t}\n\tif body.Founder != nil {\n\t\tif err2 := ValidateFounderResponseBody(body.Founder); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bb17cd035430554d93290a73db7b47f1", "score": "0.56305605", "text": "func (m *serviceRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4086bb52251a1df29fe37491beb95ac3", "score": "0.5618645", "text": "func validateBlipBody(rawBody []byte, doc *Document) error {\n\t// Prevent disallowed internal properties from being used\n\tdisallowed := []string{base.SyncPropertyName, BodyId, BodyRev, BodyDeleted, BodyRevisions}\n\tfor _, prop := range disallowed {\n\t\t// Only unmarshal if raw body contains the disallowed property\n\t\tif bytes.Contains(rawBody, []byte(`\"`+prop+`\"`)) {\n\t\t\tif _, ok := doc.Body()[prop]; ok {\n\t\t\t\treturn base.HTTPErrorf(http.StatusBadRequest, \"top-level property '\"+prop+\"' is a reserved internal property\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3ff3e44502198fed76f2ac883ed80e4", "score": "0.56071985", "text": "func (ra *TransactionRequest) Validate(r *http.Request) error {\n\ttransactionID := r.FormValue(\"transactionId\")\n\tif transactionID == \"\" {\n\t\treturn errors.New(\"Parameter `transactionId` must be provided`\")\n\t}\n\tra.transactionId = transactionID\n\n\tamount, err := strconv.ParseFloat(r.FormValue(\"amount\"), 64)\n\tif err != nil {\n\t\treturn errors.New(\"parameter `amount` must be provided`\")\n\t}\n\tra.amount = amount\n\n\tmerchantID := r.FormValue(\"merchantId\")\n\tif merchantID == \"\" {\n\t\treturn errors.New(\"Parameter `merchantId` must be provided`\")\n\t}\n\n\tra.merchantId = merchantID\n\n\treturn nil\n}", "title": "" }, { "docid": "a2a9456fa7f516913d0253182704ea27", "score": "0.56025976", "text": "func (o *PostCategoriesBadRequestBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0008986f3658453b82e57ab096461333", "score": "0.56002617", "text": "func checkMergeRequestPostBodySanity(commit pl.Commit, body map[string]interface{}, isNewRef bool) error {\n\n\tvar commitHash = commit.GetHash().String()\n\n\tobj := objx.New(body)\n\tbase := obj.Get(\"base\")\n\tif !base.IsNil() && !base.IsStr() {\n\t\treturn fe(-1, makeField(\"base\", commitHash), \"expected a string value\")\n\t}\n\n\tbaseHash := obj.Get(\"baseHash\")\n\tif !baseHash.IsNil() && !baseHash.IsStr() {\n\t\treturn fe(-1, makeField(\"baseHash\", commitHash), \"expected a string value\")\n\t}\n\n\ttarget := obj.Get(\"target\")\n\tif !target.IsNil() && !target.IsStr() {\n\t\treturn fe(-1, makeField(\"target\", commitHash), \"expected a string value\")\n\t}\n\n\ttargetHash := obj.Get(\"targetHash\")\n\tif !targetHash.IsNil() && !targetHash.IsStr() {\n\t\treturn fe(-1, makeField(\"targetHash\", commitHash), \"expected a string value\")\n\t}\n\n\t// Base branch name is required for only new merge request reference\n\tif base.String() == \"\" && isNewRef {\n\t\treturn fe(-1, makeField(\"base\", commitHash), \"base branch name is required\")\n\t}\n\n\t// Base branch hash is required for only new merge request reference\n\tbh := baseHash.String()\n\tif bh == \"\" && isNewRef {\n\t\treturn fe(-1, makeField(\"baseHash\", commitHash), \"base branch hash is required\")\n\t}\n\tif len(bh) > 0 && len(bh) != 40 {\n\t\treturn fe(-1, makeField(\"baseHash\", commitHash), \"base branch hash is not valid\")\n\t}\n\n\t// Target branch name is required for only new merge request reference\n\tif target.String() == \"\" && isNewRef {\n\t\treturn fe(-1, makeField(\"target\", commitHash), \"target branch name is required\")\n\t}\n\n\t// Target branch hash is required for only new merge request reference\n\tth := targetHash.String()\n\tif th == \"\" && isNewRef {\n\t\treturn fe(-1, makeField(\"targetHash\", commitHash), \"target branch hash is required\")\n\t}\n\tif len(th) > 0 && len(th) != 40 {\n\t\treturn fe(-1, makeField(\"targetHash\", commitHash), \"target branch hash is not valid\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e07300b1c1e49b281b16e65d050e5c34", "score": "0.55972016", "text": "func (ut *MessagePayload) Validate() (err error) {\n\tif ut.Content == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"content\"))\n\t}\n\tif ut.Auther == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"auther\"))\n\t}\n\n\tif utf8.RuneCountInString(ut.Content) < 1 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.content`, ut.Content, utf8.RuneCountInString(ut.Content), 1, true))\n\t}\n\tif utf8.RuneCountInString(ut.Content) > 400 {\n\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.content`, ut.Content, utf8.RuneCountInString(ut.Content), 400, false))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f05c625872c493027d66901ab9a9afe0", "score": "0.55846584", "text": "func (m *ProcessingRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "6f92a01336d162736d5faf0724511b68", "score": "0.5580851", "text": "func (c *Config) ValidationHandler(w http.ResponseWriter, r *http.Request) {\n\tvar body []byte\n\tif r.Body != nil {\n\t\tif data, err := ioutil.ReadAll(r.Body); err == nil {\n\t\t\tbody = data\n\t\t}\n\t}\n\n\tcontentType := r.Header.Get(\"Content-Type\")\n\tif contentType != \"application/json\" {\n\t\tlogrus.Errorf(\"contentType=%s, expect application/json\", contentType)\n\t}\n\n\tlogrus.Infof(\"About to process request %s\", body)\n\n\t// Initialize new decoder\n\tds := scheme.Codecs.UniversalDeserializer()\n\treq := v1beta1.AdmissionReview{}\n\t_, _, err := ds.Decode(body, nil, &req)\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"Cannot decode request body: %v\", err)\n\n\t}\n\n\tlogrus.Info(\"Coming here to validate\")\n\n\trsp := c.processValidationRequest(req)\n\trspBytes, err := json.Marshal(rsp)\n\n\tif _, err := w.Write(rspBytes); err != nil {\n\t\tlogrus.Errorln(err)\n\t}\n\n}", "title": "" }, { "docid": "b38d3ef114c78bbfb78ba93097046069", "score": "0.5578061", "text": "func (m *RestRequestDetails) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "2c2df7dce159bce30dbecca7c568f963", "score": "0.5574826", "text": "func (o *DeleteStudentBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "67247f5f13e5fd20dac46c85bd871303", "score": "0.55743283", "text": "func (body *WidgetResponseBody) Validate() (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "84e5bdb2c37ef5e7b2a00e2acf368afe", "score": "0.55703926", "text": "func (o *BuyCandyCreatedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b0d139974c78f846d5b0f9d875072e13", "score": "0.5568057", "text": "func ValidateSendValidationForbiddenResponseBody(body *SendValidationForbiddenResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "61d4e87272eb9dae8c8132ff67356397", "score": "0.55664974", "text": "func MustValidateRequestBody(r *http.Request, Unmarshaler func([]byte, interface{}) error, m RequestValidator) bool {\n\tvar body, err = ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(body) > 0 && Unmarshaler != nil {\n\t\terr = Unmarshaler(body, &m)\n\t\tif err != nil {\n\t\t\tm.SetBadRequest(true)\n\t\t\tm.AddErrorf(\"\", MsgBadRequest)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn MustValidate(r, m)\n}", "title": "" }, { "docid": "dc64a3308fafd3134cd93dad58d41ddb", "score": "0.5566225", "text": "func (o *ChannelsPostUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3deb999418e19f4f6504dd17359b5de3", "score": "0.55615085", "text": "func ValidateSupplierResponseBody(body *SupplierResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Level == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"level\", \"body\"))\n\t}\n\tif body.ContactName == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"contact_name\", \"body\"))\n\t}\n\tif body.ContactPhone == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"contact_phone\", \"body\"))\n\t}\n\tif body.ContactAddress == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"contact_address\", \"body\"))\n\t}\n\tif body.Note == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"note\", \"body\"))\n\t}\n\tif body.Head == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"head\", \"body\"))\n\t}\n\tif body.Founder == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"founder\", \"body\"))\n\t}\n\tif body.Level != nil {\n\t\tif !(*body.Level == 1 || *body.Level == 2 || *body.Level == 3 || *body.Level == 4) {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.level\", *body.Level, []interface{}{1, 2, 3, 4}))\n\t\t}\n\t}\n\tif body.Head != nil {\n\t\tif err2 := ValidateHeadResponseBody(body.Head); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif body.Founder != nil {\n\t\tif err2 := ValidateFounderResponseBody(body.Founder); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "59a3f27946024cc8078af25188cea656", "score": "0.5560426", "text": "func (o *PostSendBadRequestBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Error400Data\n\tif err := o.Error400Data.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bbd7ba34a93cf5e1169fdce4cecbeb55", "score": "0.55585754", "text": "func validationRequestHandler(rules *validation.RuleSet) router.Handler {\n\treturn func(ctx *router.Context) {\n\t\tc, w, r := ctx.Context, ctx.Writer, ctx.Request\n\n\t\traw := r.Body\n\t\tif r.Header.Get(\"Content-Encoding\") == \"gzip\" {\n\t\t\tlogging.Infof(c, \"The request is gzip compressed\")\n\t\t\tvar err error\n\t\t\tif raw, err = gzip.NewReader(r.Body); err != nil {\n\t\t\t\tbadRequestStatus(c, w, \"Failed to start decompressing gzip request body\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer raw.Close()\n\t\t}\n\n\t\tvar reqBody config.ValidationRequestMessage\n\t\tswitch err := json.NewDecoder(raw).Decode(&reqBody); {\n\t\tcase err != nil:\n\t\t\tbadRequestStatus(c, w, \"Validation: error decoding request body\", err)\n\t\t\treturn\n\t\tcase reqBody.GetConfigSet() == \"\":\n\t\t\tbadRequestStatus(c, w, \"Must specify the config_set of the file to validate\", nil)\n\t\t\treturn\n\t\tcase reqBody.GetPath() == \"\":\n\t\t\tbadRequestStatus(c, w, \"Must specify the path of the file to validate\", nil)\n\t\t\treturn\n\t\t}\n\n\t\tvc := &validation.Context{Context: c}\n\t\tvc.SetFile(reqBody.GetPath())\n\t\terr := rules.ValidateConfig(vc, reqBody.GetConfigSet(), reqBody.GetPath(), reqBody.GetContent())\n\t\tif err != nil {\n\t\t\tinternalErrStatus(c, w, \"Validation: transient failure\", err)\n\t\t\treturn\n\t\t}\n\n\t\tvar errors errors.MultiError\n\t\tverdict := vc.Finalize()\n\t\tif verr, _ := verdict.(*validation.Error); verr != nil {\n\t\t\terrors = verr.Errors\n\t\t} else if verdict != nil {\n\t\t\terrors = append(errors, verdict)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tvar msgList []*config.ValidationResponseMessage_Message\n\t\tif len(errors) == 0 {\n\t\t\tlogging.Infof(c, \"No validation errors\")\n\t\t} else {\n\t\t\tvar errorBuffer bytes.Buffer\n\t\t\tfor _, error := range errors {\n\t\t\t\t// validation.Context supports just 2 severities now,\n\t\t\t\t// but defensively default to ERROR level in unexpected cases.\n\t\t\t\tmsgSeverity := config.ValidationResponseMessage_ERROR\n\t\t\t\tswitch severity, ok := validation.SeverityTag.In(error); {\n\t\t\t\tcase !ok:\n\t\t\t\t\tlogging.Errorf(c, \"unset validation.Severity in %s\", error)\n\t\t\t\tcase severity == validation.Warning:\n\t\t\t\t\tmsgSeverity = config.ValidationResponseMessage_WARNING\n\t\t\t\tcase severity != validation.Blocking:\n\t\t\t\t\tlogging.Errorf(c, \"unrecognized validation.Severity %d in %s\", severity, error)\n\t\t\t\t}\n\n\t\t\t\terr := error.Error()\n\t\t\t\tmsgList = append(msgList, &config.ValidationResponseMessage_Message{\n\t\t\t\t\tSeverity: msgSeverity,\n\t\t\t\t\tText: err,\n\t\t\t\t})\n\t\t\t\terrorBuffer.WriteString(\"\\n \" + err)\n\t\t\t}\n\t\t\tlogging.Warningf(c, \"Validation errors%s\", errorBuffer.String())\n\t\t}\n\t\tif err := json.NewEncoder(w).Encode(config.ValidationResponseMessage{Messages: msgList}); err != nil {\n\t\t\tinternalErrStatus(c, w, \"Validation: failed to JSON encode output\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6e1864b5334489a4f356b0d3ac08fdf", "score": "0.5556775", "text": "func (req *nameAuthorRequest) Validate() error {\n\tswitch {\n\tcase req.Name == \"\":\n\t\treturn fmt.Errorf(\"name is required\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "f9480fbab936d75f60f8ba6ea4222a29", "score": "0.5554082", "text": "func ValidateSendValidationUnauthorizedResponseBody(body *SendValidationUnauthorizedResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "title": "" } ]
24b8319705d4a86ae67f65b961a2e905
NewUpdateReportingTaskUnauthorized creates a UpdateReportingTaskUnauthorized with default headers values
[ { "docid": "b695e3215aa885ec3444f9a100d1f290", "score": "0.706017", "text": "func NewUpdateReportingTaskUnauthorized() *UpdateReportingTaskUnauthorized {\n\treturn &UpdateReportingTaskUnauthorized{}\n}", "title": "" } ]
[ { "docid": "1fe0ac37fd6e1dee6b996425a62f50a7", "score": "0.5608639", "text": "func NewWatchTaskUnauthorized() *WatchTaskUnauthorized {\n\treturn &WatchTaskUnauthorized{}\n}", "title": "" }, { "docid": "f4004ce27d3d5d8f305eed9411ae02e9", "score": "0.5388267", "text": "func NewUpdateReportingTaskForbidden() *UpdateReportingTaskForbidden {\n\treturn &UpdateReportingTaskForbidden{}\n}", "title": "" }, { "docid": "f835a250c0c61f9fb4c25fb7782f1193", "score": "0.52971584", "text": "func NewUpdateMTOShipmentUnauthorized() *UpdateMTOShipmentUnauthorized {\n\n\treturn &UpdateMTOShipmentUnauthorized{}\n}", "title": "" }, { "docid": "41c5aba5c909b83543883f6574efa36e", "score": "0.52036303", "text": "func NewUpdateTechUnauthorized(body *UpdateTechUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "cdd4d0623f159f939743e9dff279c9e1", "score": "0.50275946", "text": "func NewGetTaskUnauthorized() *GetTaskUnauthorized {\n\treturn &GetTaskUnauthorized{}\n}", "title": "" }, { "docid": "cdd4d0623f159f939743e9dff279c9e1", "score": "0.50275946", "text": "func NewGetTaskUnauthorized() *GetTaskUnauthorized {\n\treturn &GetTaskUnauthorized{}\n}", "title": "" }, { "docid": "61e031fd312c36d4d9fc17f16e0fb826", "score": "0.5018161", "text": "func NewUpdateAssortmentUnauthorized() *UpdateAssortmentUnauthorized {\n\treturn &UpdateAssortmentUnauthorized{}\n}", "title": "" }, { "docid": "69158fc5c1458392f19100b545be32c4", "score": "0.5008158", "text": "func NewUpdateProjectVersionOfAuthEntityUnauthorized() *UpdateProjectVersionOfAuthEntityUnauthorized {\n\treturn &UpdateProjectVersionOfAuthEntityUnauthorized{}\n}", "title": "" }, { "docid": "0c366e413e8c602cbf93356612a6137e", "score": "0.49992302", "text": "func newReportingAuth(db types.Database, auth Auth) *reportingAuth {\n\treturn &reportingAuth{\n\t\tAuth: auth,\n\t\tcomponent: \"db:auth\",\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "dc773c635451e4496f535785322e25a4", "score": "0.48686886", "text": "func NewGdprPortalsRtbfStatusPutUnauthorized() *GdprPortalsRtbfStatusPutUnauthorized {\n\treturn &GdprPortalsRtbfStatusPutUnauthorized{}\n}", "title": "" }, { "docid": "a8bafd272878c5fd3a38a8d88b6f0674", "score": "0.48676443", "text": "func NewUnauthorized(reason string) *StatusError {\n\tmessage := reason\n\tif len(message) == 0 {\n\t\tmessage = \"not authorized\"\n\t}\n\treturn &StatusError{Status{\n\t\tStatus: StatusFailure,\n\t\tCode: http.StatusUnauthorized,\n\t\tReason: StatusReasonUnauthorized,\n\t\tMessage: message,\n\t}}\n}", "title": "" }, { "docid": "202cf39cdf2b9b1129ac84caaf201b95", "score": "0.484814", "text": "func NewUpdateReportingTaskBadRequest() *UpdateReportingTaskBadRequest {\n\treturn &UpdateReportingTaskBadRequest{}\n}", "title": "" }, { "docid": "47d8bb55cd0e16133befb58cfb6825d4", "score": "0.4831222", "text": "func NewProjectUnauthorized(body ProjectUnauthorizedResponseBody) activity.Unauthorized {\n\tv := activity.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "da482232f69ed1fbdc8325a44a574897", "score": "0.4818048", "text": "func NewUpdateMoveTaskOrderStatusUnauthorized() *UpdateMoveTaskOrderStatusUnauthorized {\n\n\treturn &UpdateMoveTaskOrderStatusUnauthorized{}\n}", "title": "" }, { "docid": "603f915e6a6cb1502f72109ad951d85a", "score": "0.479304", "text": "func NewRefreshVideoUploadTaskRequestWithoutParam() *RefreshVideoUploadTaskRequest {\n\n return &RefreshVideoUploadTaskRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/videoUploadTask:refresh\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "f5ba807e30ab28eb9b356e9c53c3234b", "score": "0.4775637", "text": "func NewCreateTechUnauthorized(body *CreateTechUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "5dd277ef9db40413a9fa14dbd9871bf1", "score": "0.47699332", "text": "func unauthorized(w http.ResponseWriter, id int) {\n\tresp := jsonResponse{Id: id, Error: \"unauthorized\"}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"WWW-Authenticate\", \"Basic realm=\\\"Authorization Required\\\"\")\n\tw.WriteHeader(http.StatusUnauthorized)\n\tfmt.Fprintln(w, resp)\n}", "title": "" }, { "docid": "89a86b70549e8195d57475fd86eb1a7c", "score": "0.4749543", "text": "func NewResourceInfoUnauthorized() *ResourceInfoUnauthorized {\n\n\treturn &ResourceInfoUnauthorized{}\n}", "title": "" }, { "docid": "a9c0c1919bff8e736438e13db8de8d12", "score": "0.47455934", "text": "func NewUpdateMTOAgentUnauthorized() *UpdateMTOAgentUnauthorized {\n\treturn &UpdateMTOAgentUnauthorized{}\n}", "title": "" }, { "docid": "cd6bfe49784d15d075db29c60d0d3424", "score": "0.47368297", "text": "func NewUpdateDynamicScanRequestOfProjectVersionUnauthorized() *UpdateDynamicScanRequestOfProjectVersionUnauthorized {\n\treturn &UpdateDynamicScanRequestOfProjectVersionUnauthorized{}\n}", "title": "" }, { "docid": "be634596d2edb82e54eaee73b2149fb6", "score": "0.47176594", "text": "func NewUpdateLabelUnauthorized() *UpdateLabelUnauthorized {\n\treturn &UpdateLabelUnauthorized{}\n}", "title": "" }, { "docid": "73fddc3ea17498ebadf7c10e0a15116c", "score": "0.47085103", "text": "func NewUpdateMoveTaskOrderPostCounselingInformationUnauthorized() *UpdateMoveTaskOrderPostCounselingInformationUnauthorized {\n\treturn &UpdateMoveTaskOrderPostCounselingInformationUnauthorized{}\n}", "title": "" }, { "docid": "315bf3e90d20850b2b8b08d44493755c", "score": "0.47034883", "text": "func NewPostLhvUnauthorized() *PostLhvUnauthorized {\n\treturn &PostLhvUnauthorized{}\n}", "title": "" }, { "docid": "b82b136c91c112966dc721ec9b334af0", "score": "0.47015208", "text": "func (t *HTTPService) SetAuthorization(_ string) {\n\n}", "title": "" }, { "docid": "2f4e900c48c0517955377324b82366f3", "score": "0.47012636", "text": "func NewUpdatePostUnauthorized() *UpdatePostUnauthorized {\n\n\treturn &UpdatePostUnauthorized{}\n}", "title": "" }, { "docid": "3791f45923b03932d6c77a8696ee9a9f", "score": "0.46839345", "text": "func NewUpdateRoutingFileUnauthorized() *UpdateRoutingFileUnauthorized {\n\treturn &UpdateRoutingFileUnauthorized{}\n}", "title": "" }, { "docid": "113c6017f0604e05ab5b03e95758c1ab", "score": "0.46811464", "text": "func NewInitiateVersionControlUpdateUnauthorized() *InitiateVersionControlUpdateUnauthorized {\n\treturn &InitiateVersionControlUpdateUnauthorized{}\n}", "title": "" }, { "docid": "6f54858dc8a6d2a4f4d9bfb91fce4a8d", "score": "0.46465364", "text": "func NewListBugfieldTemplateGroupUnauthorized() *ListBugfieldTemplateGroupUnauthorized {\n\treturn &ListBugfieldTemplateGroupUnauthorized{}\n}", "title": "" }, { "docid": "52c5e3304dad27b732bbe1bfe4d283c6", "score": "0.4631916", "text": "func NewPostSepasctUnauthorized() *PostSepasctUnauthorized {\n\treturn &PostSepasctUnauthorized{}\n}", "title": "" }, { "docid": "99c4d659deb2b4ebf98c5702d23ac914", "score": "0.4630342", "text": "func Unauthorized(format string, args ...interface{}) Error {\n\treturn NewWithSkip(3, nil, http.StatusUnauthorized, format, args...)\n}", "title": "" }, { "docid": "09a79b0d60f0d99bc9a32d4a06b38ada", "score": "0.46160293", "text": "func NewWeaviateActionsPropertiesUpdateUnauthorized() *WeaviateActionsPropertiesUpdateUnauthorized {\n\n\treturn &WeaviateActionsPropertiesUpdateUnauthorized{}\n}", "title": "" }, { "docid": "48c7f0522d04467d04291983877055f0", "score": "0.46153954", "text": "func NewUpdateAppUnauthorized() *UpdateAppUnauthorized {\n\n\treturn &UpdateAppUnauthorized{}\n}", "title": "" }, { "docid": "87e94e51490a560203759796f046f204", "score": "0.45942295", "text": "func NewPostTicketUnauthorized() *PostTicketUnauthorized {\n\treturn &PostTicketUnauthorized{}\n}", "title": "" }, { "docid": "9541be808937cd394c913b60cc898ad8", "score": "0.4579905", "text": "func NewUpdateReportingTaskNotFound() *UpdateReportingTaskNotFound {\n\treturn &UpdateReportingTaskNotFound{}\n}", "title": "" }, { "docid": "efb0b45f061af954fe40a02de5285d38", "score": "0.4571119", "text": "func NewUpdateComponentUnauthorized() *UpdateComponentUnauthorized {\n\treturn &UpdateComponentUnauthorized{}\n}", "title": "" }, { "docid": "b4d27f1f45b7c0b28b0fae53e4eb0838", "score": "0.45637614", "text": "func NewOrderNewUnauthorized() *OrderNewUnauthorized {\n\treturn &OrderNewUnauthorized{}\n}", "title": "" }, { "docid": "651ad5af35bf350396071f30e60202c8", "score": "0.45631313", "text": "func NewPostInstallUnauthorized() *PostInstallUnauthorized {\n\treturn &PostInstallUnauthorized{}\n}", "title": "" }, { "docid": "bfcb793794921a045bb922e10e6c1db1", "score": "0.45595858", "text": "func NewQueryRefreshTaskRequestWithoutParam() *QueryRefreshTaskRequest {\n\n return &QueryRefreshTaskRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/task\",\n Method: \"GET\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "1e4403884a38ef5fa94f3e7632938ea5", "score": "0.4548673", "text": "func NewPostNotificationUnauthorized() *PostNotificationUnauthorized {\n\treturn &PostNotificationUnauthorized{}\n}", "title": "" }, { "docid": "5c4b21030dc4a140e3be220d8d874552", "score": "0.45456347", "text": "func NewSigninUnauthorized(body SigninUnauthorizedResponseBody) auther.Unauthorized {\n\tv := auther.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "36cc06f00f8734ac24c0030aab74bc67", "score": "0.45408747", "text": "func NewPostAPIV10PeerReviewsTaskIDUnauthorized() *PostAPIV10PeerReviewsTaskIDUnauthorized {\n\treturn &PostAPIV10PeerReviewsTaskIDUnauthorized{}\n}", "title": "" }, { "docid": "8a7060da6ed6c5d6218af575271b039a", "score": "0.45392656", "text": "func NewUpdateApplicationAlertingConfigUnauthorized() *UpdateApplicationAlertingConfigUnauthorized {\n\treturn &UpdateApplicationAlertingConfigUnauthorized{}\n}", "title": "" }, { "docid": "7f12798c1fb25c644b83bf245ce8199e", "score": "0.4526118", "text": "func NewUpdateFunnelUnauthorized() *UpdateFunnelUnauthorized {\n\treturn &UpdateFunnelUnauthorized{}\n}", "title": "" }, { "docid": "e3d1dbe61418508e6548a3ff8f0fddcb", "score": "0.45208958", "text": "func NewUpdateInventoryUnauthorized() *UpdateInventoryUnauthorized {\n\treturn &UpdateInventoryUnauthorized{}\n}", "title": "" }, { "docid": "45e362217ac06ae391aea42c5d09f22d", "score": "0.45167994", "text": "func NewUpdateTaskDefault(code int) *UpdateTaskDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &UpdateTaskDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "0afaeede6816f2e9e845e255377230f8", "score": "0.45133734", "text": "func NewServiceEditUnauthorized() *ServiceEditUnauthorized {\n\n\treturn &ServiceEditUnauthorized{}\n}", "title": "" }, { "docid": "190e1e7bf19b1180204a83c2dabe8f8f", "score": "0.45050964", "text": "func NewPutUserDisabledtotpauthUnauthorized() *PutUserDisabledtotpauthUnauthorized {\n\treturn &PutUserDisabledtotpauthUnauthorized{}\n}", "title": "" }, { "docid": "99f03bbac6ecd2e8c8d2e8d28d1dec91", "score": "0.45028725", "text": "func NewWeaviateThingsPropertiesUpdateUnauthorized() *WeaviateThingsPropertiesUpdateUnauthorized {\n\treturn &WeaviateThingsPropertiesUpdateUnauthorized{}\n}", "title": "" }, { "docid": "741d9a83f1fd8fa26b7964b8f9b53031", "score": "0.44906926", "text": "func NewUpdateServiceUnauthorized() *UpdateServiceUnauthorized {\n\treturn &UpdateServiceUnauthorized{}\n}", "title": "" }, { "docid": "47558fd0c6f8b55a1c7ce8678f12979c", "score": "0.44904575", "text": "func NewDeleteTechUnauthorized(body *DeleteTechUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "21b5b4aa4d9fbb12a51ea625dc3019ea", "score": "0.44897604", "text": "func NewCreateNewAPIKeyUnauthorized() *CreateNewAPIKeyUnauthorized {\n\treturn &CreateNewAPIKeyUnauthorized{}\n}", "title": "" }, { "docid": "b7738558a51d6490fca5699ab4094bb3", "score": "0.448598", "text": "func NewPatchEnvironmentUnauthorized() *PatchEnvironmentUnauthorized {\n\treturn &PatchEnvironmentUnauthorized{}\n}", "title": "" }, { "docid": "7f269b8af1fe801d45ac9e5d799eacc3", "score": "0.44825655", "text": "func unauthorizedBasicAuth(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"kubernetes-master\"`)\n\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "8182a8c97ef64e8afdb46078d241e78d", "score": "0.4482299", "text": "func NewPostAuthUnauthorized() *PostAuthUnauthorized {\n\treturn &PostAuthUnauthorized{}\n}", "title": "" }, { "docid": "3e9d186f0f6f659b9f81921ad544dec9", "score": "0.44814587", "text": "func NewPostUpdateSoftwareComponentsUnauthorized() *PostUpdateSoftwareComponentsUnauthorized {\n\treturn &PostUpdateSoftwareComponentsUnauthorized{}\n}", "title": "" }, { "docid": "abe0dae2ca901b1030fb54379e015382", "score": "0.44736806", "text": "func NewPostDiscoveryImportUnauthorized() *PostDiscoveryImportUnauthorized {\n\treturn &PostDiscoveryImportUnauthorized{}\n}", "title": "" }, { "docid": "aed8fb5fb3dd400d5f7a22147a482a6d", "score": "0.44653466", "text": "func NewGetScheduleUnauthorized() *GetScheduleUnauthorized {\n\treturn &GetScheduleUnauthorized{}\n}", "title": "" }, { "docid": "d6230625f4c01005a8b86851b625db3d", "score": "0.4462018", "text": "func NewPutAutoDiscoveryPingsweepUnauthorized() *PutAutoDiscoveryPingsweepUnauthorized {\n\treturn &PutAutoDiscoveryPingsweepUnauthorized{}\n}", "title": "" }, { "docid": "ee655ffa81f56ace4a21ea2df6357218", "score": "0.4461291", "text": "func NewWeaviateThingsUpdateUnauthorized() *WeaviateThingsUpdateUnauthorized {\n\treturn &WeaviateThingsUpdateUnauthorized{}\n}", "title": "" }, { "docid": "72c5ab533b5de7c0c7c981a70098847f", "score": "0.4455622", "text": "func NewCreateSchedulingV1beta1PriorityClassUnauthorized() *CreateSchedulingV1beta1PriorityClassUnauthorized {\n\treturn &CreateSchedulingV1beta1PriorityClassUnauthorized{}\n}", "title": "" }, { "docid": "ecb414eb4d5ad1dce0420446307b12cd", "score": "0.44536525", "text": "func NewSigninUnauthorized(body SigninUnauthorizedResponseBody) account.Unauthorized {\n\tv := account.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "add3485fcb3c3d3918f847ad79ba78bd", "score": "0.44477817", "text": "func NewIndexTSPPsUnauthorized() *IndexTSPPsUnauthorized {\n\n\treturn &IndexTSPPsUnauthorized{}\n}", "title": "" }, { "docid": "f3aa4af3dcd206ff5a00f29840984eb5", "score": "0.44443402", "text": "func newTLS12TicketAuth() IObfs {\n\treturn &tls12TicketAuth{}\n}", "title": "" }, { "docid": "f3aa4af3dcd206ff5a00f29840984eb5", "score": "0.44443402", "text": "func newTLS12TicketAuth() IObfs {\n\treturn &tls12TicketAuth{}\n}", "title": "" }, { "docid": "396ba02e555a51836e6f3c9f6dea646a", "score": "0.4438082", "text": "func NewCreateMTOAgentUnauthorized() *CreateMTOAgentUnauthorized {\n\n\treturn &CreateMTOAgentUnauthorized{}\n}", "title": "" }, { "docid": "d92ae1951964c4ec4421b7952f56e52d", "score": "0.44361922", "text": "func NewOrderNewBulkUnauthorized() *OrderNewBulkUnauthorized {\n\treturn &OrderNewBulkUnauthorized{}\n}", "title": "" }, { "docid": "f378dc1d051135e5763f48df95080a75", "score": "0.4423429", "text": "func NewTaskReport()(*TaskReport) {\n m := &TaskReport{\n Entity: *iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "2a1f9b3875d867144a24b979486ce1c1", "score": "0.4412692", "text": "func NewUpdateMTOServiceItemUnauthorized() *UpdateMTOServiceItemUnauthorized {\n\n\treturn &UpdateMTOServiceItemUnauthorized{}\n}", "title": "" }, { "docid": "76359cd93963e71640ddeb99bca35d44", "score": "0.44094476", "text": "func NewUpdateRunStatusUnauthorized() *UpdateRunStatusUnauthorized {\n\treturn &UpdateRunStatusUnauthorized{}\n}", "title": "" }, { "docid": "af7a886638db899c48ecee273d1efa9a", "score": "0.44073847", "text": "func NewLoginUnauthorized(body Unauthorized) calcsvc.Unauthorized {\n\tv := calcsvc.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "b965d8a77dd09a4edf9750034adc1a71", "score": "0.43971336", "text": "func NewListVMTempUnauthorized() *ListVMTempUnauthorized {\n\n\treturn &ListVMTempUnauthorized{}\n}", "title": "" }, { "docid": "34951b1c474014fdc859cb5f55543716", "score": "0.4397086", "text": "func authDecor(next http.Handler) http.Handler {\n\tclosure := func(w http.ResponseWriter, r *http.Request) {\n\t\tt, ok := r.Header[\"X-Appengine-Taskname\"]\n\t\tif !ok || len(t[0]) == 0 {\n\t\t\t// You may use the presence of the X-Appengine-Taskname header to validate\n\t\t\t// the request comes from Cloud Tasks.\n\t\t\tlog.Println(\"Invalid Task: No X-Appengine-Taskname request header found\")\n\t\t\thttp.Error(w, \"Bad Request - Invalid Task\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(closure)\n}", "title": "" }, { "docid": "2b5b65fe016ed3bb7e8b8ee66a18f5db", "score": "0.43962908", "text": "func newAuthenticator(apiKey string) _http.Authenticator {\n\treturn &authenticator{\n\t\tapiKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "91830a52c9073a39157d2e914faaacc5", "score": "0.43942", "text": "func NewTechListUnauthorized(body *TechListUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "219f43d86e3682939ab0bfbeef03a96e", "score": "0.43935296", "text": "func NewCreateGeneralServicesTicketRequestWithoutParam() *CreateGeneralServicesTicketRequest {\n\n return &CreateGeneralServicesTicketRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/generalServicesTicket\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "c8cdd80911900e4943229d6dc5225ded", "score": "0.43922406", "text": "func NewPostCredentialsUnauthorized() *PostCredentialsUnauthorized {\n\treturn &PostCredentialsUnauthorized{}\n}", "title": "" }, { "docid": "3e0ee6877c446830f7c5f78f83fa8dac", "score": "0.43818673", "text": "func NewUpdateTriggerUnauthorized() *UpdateTriggerUnauthorized {\n\treturn &UpdateTriggerUnauthorized{}\n}", "title": "" }, { "docid": "3b3f36c744b61a40b7a3f2e97f344c71", "score": "0.43796974", "text": "func NewCreateGroupUsingPOSTUnauthorized() *CreateGroupUsingPOSTUnauthorized {\n\treturn &CreateGroupUsingPOSTUnauthorized{}\n}", "title": "" }, { "docid": "61325ce2042118112dca735ffea66dee", "score": "0.43720204", "text": "func newExporter(ctx context.Context, logger logrus.FieldLogger, writer io.WriteCloser, opts exporteroption.Options) (*exporter, error) {\n\tencoder := json.NewEncoder(writer)\n\tvar flow *flowpb.Flow\n\tif opts.FieldMask.Active() {\n\t\tflow = new(flowpb.Flow)\n\t\topts.FieldMask.Alloc(flow.ProtoReflect())\n\t}\n\treturn &exporter{\n\t\tctx: ctx,\n\t\tlogger: logger,\n\t\tencoder: encoder,\n\t\twriter: writer,\n\t\tflow: flow,\n\t\topts: opts,\n\t}, nil\n}", "title": "" }, { "docid": "7ab1d5dc3c656869a11b988127cdbd42", "score": "0.43678093", "text": "func NewDeleteTeamUnauthorized() *DeleteTeamUnauthorized {\n\treturn &DeleteTeamUnauthorized{}\n}", "title": "" }, { "docid": "f3848d4748199ef79eb82739c6417a31", "score": "0.4367309", "text": "func NewRemoveGridmapEntryUnauthorized() *RemoveGridmapEntryUnauthorized {\n\n\treturn &RemoveGridmapEntryUnauthorized{}\n}", "title": "" }, { "docid": "8242ebc447eac4d147c78bd780249705", "score": "0.43648937", "text": "func createRegistryAuth(req resource.OutRequest) *authn.Basic {\n\treturn &authn.Basic{\n\t\tUsername: req.Source.Username,\n\t\tPassword: req.Source.Password,\n\t}\n}", "title": "" }, { "docid": "2fa636666655da4bf351eb03193f5282", "score": "0.43637854", "text": "func NewApproveSITAddressUpdateUnauthorized() *ApproveSITAddressUpdateUnauthorized {\n\n\treturn &ApproveSITAddressUpdateUnauthorized{}\n}", "title": "" }, { "docid": "219bd024e7800db76952828d34c17c61", "score": "0.4362949", "text": "func NewIntakeAddUnauthorized() *IntakeAddUnauthorized {\n\treturn &IntakeAddUnauthorized{}\n}", "title": "" }, { "docid": "fa5aeaa151a02177b8833a2f72be2872", "score": "0.43597457", "text": "func NewPostRemoteAPIJWorkspaceCreateUnauthorized() *PostRemoteAPIJWorkspaceCreateUnauthorized {\n\treturn &PostRemoteAPIJWorkspaceCreateUnauthorized{}\n}", "title": "" }, { "docid": "8712d18442be35cd6d708caa1adc729c", "score": "0.43577117", "text": "func newHistogramReporting(settings component.TelemetrySettings) *histogramReporting {\n\treturn &histogramReporting{\n\t\tsettings: settings,\n\t\tmalformedHistograms: atomic.NewInt64(0),\n\t\tnoAggregationTemporality: atomic.NewInt64(0),\n\t}\n}", "title": "" }, { "docid": "b8efc8461aca14c1e72cf55e349749c0", "score": "0.43535537", "text": "func NewGetTechUnauthorized(body *GetTechUnauthorizedResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "43da63a570e5b3045ee7ce8842e647cc", "score": "0.4352866", "text": "func NewAddUnauthorized() *AddUnauthorized {\n\n\treturn &AddUnauthorized{}\n}", "title": "" }, { "docid": "1e16bb115b9b89f0a599272f80023c80", "score": "0.4350152", "text": "func NewPostAppcompsUnauthorized() *PostAppcompsUnauthorized {\n\treturn &PostAppcompsUnauthorized{}\n}", "title": "" }, { "docid": "0ad25d2217c7f5623a9efe5452b24b75", "score": "0.43476588", "text": "func NewCreateAccountRequestSubmissionUnauthorized() *CreateAccountRequestSubmissionUnauthorized {\n\treturn &CreateAccountRequestSubmissionUnauthorized{}\n}", "title": "" }, { "docid": "72fe7b0553cdf69c47f5f59d7300f295", "score": "0.4343432", "text": "func NewUpdateMTOServiceItemUnauthorized() *UpdateMTOServiceItemUnauthorized {\n\treturn &UpdateMTOServiceItemUnauthorized{}\n}", "title": "" }, { "docid": "ef7eda64a9cb1bb6cacfb632b94c2318", "score": "0.4338663", "text": "func NewFiveUnauthorized(body FiveUnauthorizedResponseBody) tasks.Unauthorized {\n\tv := tasks.Unauthorized(body)\n\treturn v\n}", "title": "" }, { "docid": "b1a2ad219aa24a144daba3da6e2689f5", "score": "0.4336456", "text": "func NewPostKeysUnauthorized() *PostKeysUnauthorized {\n\treturn &PostKeysUnauthorized{}\n}", "title": "" }, { "docid": "3405f3246058dd28201c5d48b3b55608", "score": "0.43320113", "text": "func CreateTaskIssue(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tvar body domain.Issue\n\tparseBody(r, &body)\n\n\tcurrentUser := context.Get(r, \"currentUser\").(*domain.User)\n\n\tfmt.Println(currentUser.ID.Hex())\n\n\tif currentUser == nil {\n\t\trespondWithError(w, http.StatusNotFound, \"User not found\")\n\t\treturn\n\t}\n\n\tplantation, err := domain.GetPlantationByID(body.Location.PlantationID)\n\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tplot, err := domain.GetPlotByID(body.Location.PlotID)\n\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tif body.VisitInfo != nil && body.WorkOrderInfo != nil {\n\t\t//TODO: definir cómo proceder en este caso!\n\t\trespondWithError(w, http.StatusBadRequest, http.StatusText(http.StatusBadRequest))\n\t\treturn\n\t}\n\tbody.Issuer = *currentUser\n\tbody.Location.PlantationName = plantation.Name\n\tbody.Location.PlotCode = plot.PlotCode\n\tbody.CropsType = plot.CropsName\n\tbody.CropVariety = plot.Variety\n\tbody.Status = constants.StatusCreated\n\tbody.IssueNumber = int64(time.Now().UTC().UnixNano() * int64(time.Nanosecond) / int64(time.Millisecond))\n\n\tif visitInfo := body.VisitInfo; visitInfo != nil {\n\t\tif *currentUser.CooperativeID != plantation.CooperativeID {\n\t\t\trespondWithError(w, http.StatusForbidden, http.StatusText(http.StatusForbidden))\n\t\t\treturn\n\t\t}\n\t\tif currentUser.Role != constants.RoleTechnician && currentUser.Role != constants.RoleAdmin {\n\t\t\trespondWithError(w, http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized))\n\t\t\treturn\n\t\t}\n\t\tvisitInfo.Technician = *currentUser\n\t\tvisitInfo.TechnicianID = &visitInfo.Technician.ID\n\t\tif visitInfo.NeedsWorkOrder {\n\t\t\tbody.Status = constants.StatusPendingWorkOrder\n\t\t} else {\n\t\t\tbody.Status = constants.StatusFinished\n\t\t}\n\t\tbody.IssueComment = \"Incidencia creada a partir de visita\"\n\t}\n\n\tif workOrderInfo := body.WorkOrderInfo; workOrderInfo != nil {\n\t\tif *currentUser.CooperativeID != plantation.CooperativeID {\n\t\t\trespondWithError(w, http.StatusForbidden, http.StatusText(http.StatusForbidden))\n\t\t\treturn\n\t\t}\n\t\tworkOrderInfo.Accepted = true\n\t\tbody.Status = constants.StatusAccepted\n\t\tbody.IssueComment = \"Incidencia creada a partir de orden de trabajo\"\n\n\t\tif body.VisitInfo == nil {\n\t\t\tbody.VisitInfo = &domain.Visit{\n\t\t\t\tNeedsWorkOrder: true,\n\t\t\t\tTechnician: *currentUser,\n\t\t\t\tTechnicianID: &currentUser.ID,\n\t\t\t\tVisitDate: time.Now(),\n\t\t\t}\n\t\t} else {\n\t\t\tbody.VisitInfo.NeedsWorkOrder = true\n\t\t}\n\t}\n\n\tissue, err := services.StoreIssue(&body)\n\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, issue)\n}", "title": "" }, { "docid": "138aa77743cb1134f2ab5126650e5451", "score": "0.43203142", "text": "func NewUpdateCancelStatusUsingGETUnauthorized() *UpdateCancelStatusUsingGETUnauthorized {\n\treturn &UpdateCancelStatusUsingGETUnauthorized{}\n}", "title": "" }, { "docid": "49638743fd780ef355165f4a247a3570", "score": "0.4320056", "text": "func (Http) getUnauthorized(msg ...string) *Http {\n\treturn getHttpError(http.StatusUnauthorized, msg...)\n}", "title": "" }, { "docid": "000e6470252816dbf07fabde327a2876", "score": "0.4319503", "text": "func NewV2UpdateHostInstallProgressUnauthorized() *V2UpdateHostInstallProgressUnauthorized {\n\treturn &V2UpdateHostInstallProgressUnauthorized{}\n}", "title": "" }, { "docid": "40b21a1438f8b1f455d27fa4cecbb1fb", "score": "0.4309645", "text": "func NewCreateTransactionFileSubmissionUnauthorized() *CreateTransactionFileSubmissionUnauthorized {\n\treturn &CreateTransactionFileSubmissionUnauthorized{}\n}", "title": "" }, { "docid": "8fd8826108be51d9c5a961488e0c06f1", "score": "0.4307371", "text": "func NewUpdateEnvironmentUsingPUTUnauthorized() *UpdateEnvironmentUsingPUTUnauthorized {\n\treturn &UpdateEnvironmentUsingPUTUnauthorized{}\n}", "title": "" }, { "docid": "bd6fe55814d1dbebb8e277f60b2b55b3", "score": "0.43056005", "text": "func NewPatchSchedulingV1beta1PriorityClassUnauthorized() *PatchSchedulingV1beta1PriorityClassUnauthorized {\n\treturn &PatchSchedulingV1beta1PriorityClassUnauthorized{}\n}", "title": "" } ]
8ed843a0a54b719eb5a0d84b78716e40
IsSuccess returns true when this delete machine disk accepted response has a 2xx status code
[ { "docid": "e91c5c8dc06c8b93466551f3f9473740", "score": "0.7298787", "text": "func (o *DeleteMachineDiskAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" } ]
[ { "docid": "80f91f471a8a401d4946df30742cba7b", "score": "0.7168407", "text": "func (o *DeleteMachineDiskNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "3164832995e965da1139a69f6418726d", "score": "0.7005027", "text": "func (o *DeleteMachineDiskForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "38fcb01f37b5945cea18bb3589f4c7a6", "score": "0.6933639", "text": "func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d71bc937719ceadef7414a46ecc9d988", "score": "0.6864694", "text": "func (o *SnmpTraphostsDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "27a978eefb8836a5b1b3a1b64938793d", "score": "0.68554157", "text": "func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "b4aa518e8492e8edd79f038eac25c86d", "score": "0.6727666", "text": "func (o *DeleteTerraformVersionUsingDELETEUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e8606a57797ac52a1ae4f483257e5326", "score": "0.670961", "text": "func (o *SvmDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "7c4a58057cb041ea13dccdf38144d4aa", "score": "0.66963345", "text": "func (o *PcloudCloudinstancesVolumesDeleteBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "56ab553e77a7f813f9dfcc0e2f731597", "score": "0.66679156", "text": "func (o *PcloudCloudinstancesVolumesDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "cc0eb32c4d3f3b50e45fe8e1dc6ce5a3", "score": "0.664081", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "bb27e97b9ac05d5d352c395f2446c81a", "score": "0.659363", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "3c69432ce4a9e4053c877f6084621acb", "score": "0.65749276", "text": "func (o *TenantsDeleteUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "41e34538d5306ff775ce967f4df285fc", "score": "0.6563447", "text": "func (o *SnmpTraphostsDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "6dec4e1cc3cba3274381afe20ec6cb88", "score": "0.64893043", "text": "func (o *ObjectsDeleteUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5c7dac761a28eb8fbd19ad415740242f", "score": "0.6484045", "text": "func (o *SvmDeleteAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "2c7365ede14ab0115f9c4c4b1b68f4c5", "score": "0.6451278", "text": "func (o *PcloudCloudinstancesVolumesDeleteNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6fcaa6192f49c310d04faa83550c7197", "score": "0.64425755", "text": "func (o *DeleteZoneUsingDELETEOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "b4e9fe92f9cfe9ff0b617ebd74be5f8e", "score": "0.64204836", "text": "func (o *VirtualizationClusterTypesDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "388fbdddef7189e565a7b95180da127b", "score": "0.6377157", "text": "func (o *SchemaObjectsDeleteUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "bbd505ad889e1d181cd0d86687373458", "score": "0.63644034", "text": "func (o *SchemaObjectsDeleteInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "434be9be666d5457f587567d4e4ca246", "score": "0.63391066", "text": "func (o *TenantsDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "431a65f74423e3214522d310e5f76f0f", "score": "0.63274", "text": "func (o *DeleteZoneUsingDELETEForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "39d596959ab259ef570fb77753d25e6b", "score": "0.6322859", "text": "func (o *PcloudCloudinstancesVolumesDeleteForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ea79a8e1aac543efeca9a7846d0dc980", "score": "0.631428", "text": "func (o *DeleteTerraformVersionUsingDELETEForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "dd18aea01afe3e4664596accc221ab7c", "score": "0.6312617", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1a06db51d447b2e429ad7331223c3107", "score": "0.6309178", "text": "func (o *TenantsDeleteInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "a4a4e9aec1eea96ee836f47be331e8b1", "score": "0.62946784", "text": "func (o *ObjectsDeleteInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5b56a9d341cba8575ea3f53661a601f1", "score": "0.62859213", "text": "func (o *DcimDevicesBulkDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "fb05c59cb2143b20b39d79fafe5714e1", "score": "0.62488604", "text": "func HandleDeleteSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/os-vendor-backup-sharing/87566ed6-72cb-4053-aa6e-6f6216b3d507\", 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\tw.WriteHeader(http.StatusOK)\n\t})\n}", "title": "" }, { "docid": "35ea03c3c79c33b2440f16dd9f3c5225", "score": "0.62454486", "text": "func (o *DcimDevicesBulkDeleteNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7711c6364d49172347082aa3f239d295", "score": "0.62435514", "text": "func (o *DeleteTerraformVersionUsingDELETENotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5030f691a62db4239c5d69e8849db0a9", "score": "0.62294185", "text": "func (o *DiskGetDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "6b0af6daa9bcf475972d6033403808ea", "score": "0.621123", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6fd62ca1a7ba4ee5561f0f1176d2e856", "score": "0.62021554", "text": "func (o *SchemaObjectsDeleteBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ba845bc828a8269c7a47079f28896738", "score": "0.61836797", "text": "func (o *DeleteTerraformVersionUsingDELETENoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a84e661ed0277280e637c713c6dbbaf4", "score": "0.61824167", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETENotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "b9fbfc72c057fa77cad42e8f2911082d", "score": "0.61414176", "text": "func (o *PcloudCloudinstancesVolumesDeleteGone) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "a1c3472c1331afa19ba2201f5f37265e", "score": "0.61380905", "text": "func (o *FpolicyPolicyDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "24becdae299167f7e263f8773b3fc15e", "score": "0.61096823", "text": "func (o *PcloudV2VolumesClonetasksGetInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1164c78b7a898638dd888ba66cdf157f", "score": "0.6104168", "text": "func HandleDeleteSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/software_deployments/43489279-7b12-4fc5-90ed-320f29e89419\", 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}", "title": "" }, { "docid": "a4dbfdda1671cd5b86c9328cbb5c318e", "score": "0.61014485", "text": "func (o *DiskGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "e6d483035ca4479b85045df75fe21cb5", "score": "0.6077034", "text": "func (o *PetDeleteBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "754808304ad560b882b3c0d1bf3f21a5", "score": "0.6071381", "text": "func (o *SchemaObjectsDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "8d73442fe735eaae806b0c44e4b0f040", "score": "0.60319406", "text": "func (o *RoleDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "e850e288d39681228eff0e1c97c7a396", "score": "0.6022845", "text": "func (o *DeleteSampleV2OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "78def7a97e8fe3e0ca7d1ffe32940ea8", "score": "0.60186857", "text": "func (o *DeleteBlockDeviceSnapshotAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "3f2769b3c5e194f048f966f4b03d8806", "score": "0.60055923", "text": "func (o *DeleteProjectDashboardOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c2d8e84e5e83b4ebcaece50e65a76111", "score": "0.5995466", "text": "func (o *DeleteSampleV2InternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "67e15b42feb9ccd79480901bf7806a17", "score": "0.5982375", "text": "func (o *DcimPowerFeedsDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "7888fbdbecb489b91835e0b2f1ce3cd8", "score": "0.59810483", "text": "func (o *ConsistencyGroupDeleteOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a1f720edca1e7e931edbfaf539fc03e7", "score": "0.5980811", "text": "func (o *VirtualizationClusterTypesDeleteNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "0161476273f6a573c6d5343de6c81374", "score": "0.5971818", "text": "func (o *DeleteBlockDeviceSnapshotNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "6bd05ace51d554ba04bda53425f59b00", "score": "0.5946918", "text": "func (o *FpolicyPolicyDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "eddb4e0db6b83b369756857ad952dc47", "score": "0.5900575", "text": "func HandleDeleteSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada\", 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}", "title": "" }, { "docid": "79df8a55218fcec40f0e7788e7948053", "score": "0.5885473", "text": "func (o *ObjectsDeleteForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "2ad890d9d41d73e34908cc9696a734e7", "score": "0.5881938", "text": "func (o *SnmpTraphostsDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "a5af83bcc7cc93274e7fc3f54b4cedaa", "score": "0.58732074", "text": "func (o *ObjectsDeleteNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "503252ec6860ae002861266ebbc7cb57", "score": "0.5868018", "text": "func (o *ConsistencyGroupDeleteAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "72dbd52410a38401eee19522cf13071f", "score": "0.5863547", "text": "func (o *ObjectsDeleteNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c4ea655c289872c5a9ecc34fd98b7e21", "score": "0.58598024", "text": "func (o *DeleteAWSAccountsMixin0InternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8d7777b76f25ed28fc1e6e78454595ee", "score": "0.5855841", "text": "func (o *TenantsDeleteForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "04f9b7c2b7b7cae8c35aab8bc44d69bc", "score": "0.58481437", "text": "func (o *RoleDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "78b88ca94f8287f3c95d13ded24a7124", "score": "0.58461124", "text": "func (o *SchemaObjectsDeleteForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5fae3158c03f4f734007e2564298f1c6", "score": "0.5835016", "text": "func (o *DeleteProjectDashboardDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "d24d5ec292a5eae4de147f72b0f02ed2", "score": "0.5816924", "text": "func (o *DeleteBlockDeviceSnapshotForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e056d3ce3b3759a4974161a5f37413ab", "score": "0.5816528", "text": "func (o *ConsistencyGroupDeleteDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "4195aec62f33494243872410ecde39a2", "score": "0.5814238", "text": "func (o *PetDeleteNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e8a37121a9aac6ff51f491b7eedad3bc", "score": "0.5812187", "text": "func (o *PcloudV2VolumesClonetasksGetUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "2c2e98a62796b1c04ef488bab78ac45a", "score": "0.5806858", "text": "func (o *DeleteSampleV2BadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0feed57309e2427e68fc29749b0d3a0a", "score": "0.5789178", "text": "func (o *TenantsDeleteUnprocessableEntity) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0c3f2fdae5c4c0e9291a7e8dc0dde74f", "score": "0.5774734", "text": "func (o *DeleteMachineDiskNoContent) IsCode(code int) bool {\n\treturn code == 204\n}", "title": "" }, { "docid": "3d2250e98f28637956045c4602117eb1", "score": "0.5766142", "text": "func (o *DeleteProjectDashboardNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "382edb810478db2ed2362b3c1b6005db", "score": "0.5764792", "text": "func (o *DcimPowerFeedsDeleteNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "9514fcc1692e4d8a35428c24a1529bb8", "score": "0.576415", "text": "func (o *ShutdownMachineForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "960f08ae8717c69555b27f8c856b7c52", "score": "0.5756701", "text": "func (o *PetDeleteNoContent) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "9cab8a26f974e6eb1ea344727e95a3df", "score": "0.57383245", "text": "func (o *DeleteRulesV1Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5c250a45088b401cd3e5ee4ebd78e48f", "score": "0.57200766", "text": "func (o *DeleteAWSAccountsMixin0BadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6d294a12391a84211605b6dfccde0f7a", "score": "0.571937", "text": "func (o *DeleteV1RunbooksRunbookIDOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "49f2d3c2025faaced8f4769ddaa7965b", "score": "0.5712601", "text": "func (o *RestoreNodesUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5e9376f020ebae60936401110321f7e1", "score": "0.5693305", "text": "func (o *V2DownloadClusterManifestInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "91b1a3cf5bc2cecbd6bc244d6abfdf5e", "score": "0.56897837", "text": "func (agent *Agent) onDeleteSuccess(ctx context.Context, rpc string, response interface{}, reqArgs ...interface{}) {\n\tlogger.Debugw(ctx, \"response-successful\", log.Fields{\"rpc\": rpc, \"device-id\": agent.deviceID})\n\tif err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {\n\t\tlogger.Errorw(ctx, \"delete-device-failure\", log.Fields{\"device-id\": agent.deviceID, \"error\": err, \"args\": reqArgs})\n\t}\n\tpreviousDeviceTransientState := agent.getTransientState()\n\tnewDevice := agent.cloneDeviceWithoutLock()\n\tif err := agent.updateDeviceWithTransientStateAndReleaseLock(ctx, newDevice,\n\t\tvoltha.DeviceTransientState_DELETING_POST_ADAPTER_RESPONSE, previousDeviceTransientState); err != nil {\n\t\tlogger.Errorw(ctx, \"delete-device-failure\", log.Fields{\"device-id\": agent.deviceID, \"error\": err, \"args\": reqArgs})\n\t}\n}", "title": "" }, { "docid": "88b50b93e1124f2809a61caf631ee6fc", "score": "0.56880224", "text": "func (o *PcloudVolumesClonePostInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1c7bf865627636e5122e50c6769271f9", "score": "0.56838924", "text": "func (o *DeleteProjectSearchDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "title": "" }, { "docid": "1d2139fe3de412ddf08c6b4f18b70fcf", "score": "0.5681276", "text": "func (o *PcloudCloudinstancesVolumesDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "e4d48e650cc889b329455333ff02afe0", "score": "0.5677987", "text": "func (o *DeleteRulesV1InternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "3efa9ee6a61bbb81881ddc93d682c78b", "score": "0.56660634", "text": "func (o *DeleteProjectDashboardNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "66567f3087fab206bdf0b0add82d1cda", "score": "0.56633466", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "fe5b356dedc9bfdbebcee80da8f42252", "score": "0.56570566", "text": "func (o *PerformDeviceControlPoliciesActionInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0140a30c2d3afcc975f59c40eb00264c", "score": "0.5656288", "text": "func (o *DeleteSampleV2NotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "3e472340d095b9c5168e1b961c4efc23", "score": "0.5633922", "text": "func (o *DeleteWithKerberosDistroXV1ByNameDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "828b8932b6e9ddc06c12f496409a094f", "score": "0.56278753", "text": "func (o *PcloudV2VolumesClonetasksGetBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "f09bc7bd2117fb0653762fbf46c90b98", "score": "0.56221765", "text": "func (o *DeleteProjectSearchOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1be8309db925d5ad9d18257c51ac9541", "score": "0.5621623", "text": "func (client StorageContainerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent),\n autorest.ByClosing())\n result.Response = resp\n return\n }", "title": "" }, { "docid": "78c96279c4f8728d8d5ae54e9718b1ac", "score": "0.56184566", "text": "func (o *RestoreNodesInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8541a6e470410aa52de829a11c80fef2", "score": "0.5611362", "text": "func (o *V2DownloadClusterManifestUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d25d02a8e45c8b95d28f4e873230eb9f", "score": "0.5610147", "text": "func NSSAIAvailabilityDelete(responseChan chan nssf_message.HandlerResponseMessage, nfId string) {\n\n\tlogger.Nssaiavailability.Infof(\"Request received - NSSAIAvailabilityDelete\")\n\n\tvar (\n\t\tstatus int\n\t\td ProblemDetails\n\t)\n\n\tstatus = nssaiavailabilityDelete(nfId, &d)\n\n\tif status == http.StatusNoContent {\n\t\tresponseChan <- nssf_message.HandlerResponseMessage{\n\t\t\tHttpResponse: &http_wrapper.Response{\n\t\t\t\tHeader: nil,\n\t\t\t\tStatus: status,\n\t\t\t},\n\t\t}\n\t} else {\n\t\tresponseChan <- nssf_message.HandlerResponseMessage{\n\t\t\tHttpResponse: &http_wrapper.Response{\n\t\t\t\tHeader: nil,\n\t\t\t\tStatus: status,\n\t\t\t\tBody: d,\n\t\t\t},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c5789afbc572b16cc1b9c100de504f59", "score": "0.55946076", "text": "func (o *PcloudVolumegroupsActionPostInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "47d6913d7a90f4c613c9e5189aa17696", "score": "0.5594106", "text": "func HandleDeleteSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(fmt.Sprintf(\"/v2/queues/%s/claims/%s\", QueueName, ClaimID),\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tth.TestMethod(t, r, \"DELETE\")\n\t\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\n\t\t\tw.WriteHeader(http.StatusNoContent)\n\t\t})\n}", "title": "" }, { "docid": "b57ca691f69d96ee7bfeffd73cdc0bc7", "score": "0.5587885", "text": "func (o *DeleteProjectDashboardForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0d4b677772a2e50a60950e0f7b05e1df", "score": "0.55554247", "text": "func (o *PutContactsDeviceHardwareIDUnsubscribeOK) IsSuccess() bool {\n\treturn true\n}", "title": "" } ]
73aacbc5c90b25c488ad8e48f5abe0f6
StartServer starts the server for the mobile implementation of kubenav. To register all needed API routes we have to create a new router and a Kubernetes API client. For the Kubernetes API client we only have to set the isMobile argument to true, all other arguments are not needed for the mobile implementation. Therefore we do not check for a returned error, because the initialization of the Kubernetes API client for mobile can not return an error. When the router and Kubernetes API client is created, we are creating a new API client and register all API routes. Finally we start the server which always listen on port 14122.
[ { "docid": "cf4538f4a074b9b44e08c7afac4caec6", "score": "0.73516333", "text": "func StartServer() {\n\tlog.SetLevel(log.FatalLevel)\n\n\trouter := http.NewServeMux()\n\tkubeClient, _ := kube.NewClient(true, false, \"\", \"\", \"\")\n\tapiClient := api.NewClient(false, nil, kubeClient)\n\tapiClient.Register(router)\n\n\tif err := http.ListenAndServe(\":14122\", router); err != nil {\n\t\treturn\n\t}\n}", "title": "" } ]
[ { "docid": "422eb769024db7a1385d6dc8f2910678", "score": "0.7182531", "text": "func (s *Server) StartServer() error {\n\trouter := gin.New()\n\n\t// Global middleware\n\trouter.Use(gin.Logger())\n\trouter.Use(gin.Recovery())\n\n\tdaemonsGroup := router.Group(\"/v1/apps/\")\n\t{\n\t\tdaemonsGroup.GET(\"/metrics\", s.getAllMetrics)\n\t\tdaemonsGroup.POST(\"/:app/metrics/:metric\", s.setMetric)\n\t\tdaemonsGroup.POST(\"/:app/metrics\", s.setMetrics)\n\t}\n\n\trouter.GET(\"/v1/switch\", s.switchStatus)\n\n\tswitchGroup := router.Group(\"/v1/switch/\")\n\t{\n\t\tswitchGroup.POST(\"/on\", s.switchOn)\n\t\tswitchGroup.POST(\"/off\", s.switchOff)\n\t}\n\n\treturn router.Run(\":\" + s.Config.GetString(\"port\"))\n}", "title": "" }, { "docid": "c3b25bcefd290bdb02a083ceb5342a4e", "score": "0.6864036", "text": "func (s *APIServer) StartServer() error {\n\n\ts.server = &http.Server{\n\t\tHandler: s.router,\n\t\tAddr: \"127.0.0.1:8080\",\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\treturn s.server.ListenAndServe()\n}", "title": "" }, { "docid": "ae6893cde6886e2b87d7229b400a9aa4", "score": "0.6833596", "text": "func StartServer() {\n\trouter := setupRoutes()\n\trouter.Run(\":3000\")\n}", "title": "" }, { "docid": "0172b405df4ef99835d358370bba6246", "score": "0.67309237", "text": "func (a *App) StartServer(c *cli.Context) error {\n\tserviceUser := service.NewBasicEcho()\n\t// finder endpoint\n\tendpoints := service.NewEndpoints(serviceUser)\n\thandler := grpcadapter.NewGRPCServer(endpoints)\n\tgRPCServer := grpc.NewServer()\n\tpb.RegisterYourServiceServer(gRPCServer, handler)\n\ta.logger.Info(\"starting grpc server\", zap.String(\"grpc:\", c.String(\"grpc_server_address\")))\n\tlistener, err := net.Listen(\"tcp\", c.String(\"grpc_server_address\"))\n\tif err != nil {\n\t\tlog.Println(\"error\", err)\n\t\treturn err\n\t}\n\treturn gRPCServer.Serve(listener)\n}", "title": "" }, { "docid": "55884d6f52d95452b73ac84770a0c215", "score": "0.6709997", "text": "func StartServer(serverPort string) {\n\n\t// Creates a gin router with default middleware:\n\t// logger and recovery (crash-free) middleware\n\trouter := gin.Default()\n\trouter.GET(\"/\", homeEndpoint)\n\trouter.Run(\":\" + serverPort)\n\n}", "title": "" }, { "docid": "adf67a2a12ec78d95c46d88e4aaf1108", "score": "0.6642553", "text": "func StartServer(config map[string]interface{}) {\n\tsetupConfig(config)\n\tsetupLogger()\n\tdefer log.Sync()\n\tsetupDebug()\n\tserver.PreInit()\n\tconnectToDB()\n\tmodels.BootStrap()\n\ti18n.BootStrap()\n\tserver.LoadTranslations(i18n.Langs)\n\tserver.LoadInternalResources()\n\tviews.BootStrap()\n\tactions.BootStrap()\n\tcontrollers.BootStrap()\n\tmenus.BootStrap()\n\tserver.PostInit()\n\tsrv := server.GetServer()\n\taddress := fmt.Sprintf(\"%s:%s\", viper.GetString(\"Server.Interface\"), viper.GetString(\"Server.Port\"))\n\tcert := viper.GetString(\"Server.Certificate\")\n\tkey := viper.GetString(\"Server.PrivateKey\")\n\tdomain := viper.GetString(\"Server.Domain\")\n\tswitch {\n\tcase cert != \"\":\n\t\tsrv.RunTLS(address, cert, key)\n\tcase domain != \"\":\n\t\tsrv.RunAutoTLS(domain)\n\tdefault:\n\t\tsrv.Run(address)\n\t}\n}", "title": "" }, { "docid": "1f4ed487952ff1d1099200ad38bd9048", "score": "0.6597254", "text": "func StartServer() {\n\tPORT := os.Getenv(\"PORT\")\n\tif PORT == \"\" {\n\t\tPORT = \"7171\"\n\t}\n\n\thttp.HandleFunc(\"/\", utils.Ping)\n\thttp.HandleFunc(\"/test\", getdata.GetData)\n\thttp.HandleFunc(\"/shutdown\", utils.Shutdown)\n\thttp.HandleFunc(\"/api/search\", getdata.Search)\n\thttp.HandleFunc(\"/api/download\", getdata.Download)\n\thttp.HandleFunc(\"/api/view\", getdata.Video)\n\n\tlog.Println(\"listening on\", \":\"+PORT)\n\tlog.Fatal(http.ListenAndServe(\":\"+PORT, nil))\n}", "title": "" }, { "docid": "89c587f01c1453d8ff0209b5691cd7ff", "score": "0.6591597", "text": "func StartServer() {\n\tmodels.InitDB()\n\tdefer models.CloseConnection()\n\n\tapp := fiber.New()\n\n\tapp.Use(cors.New())\n\n\troutes.StartHandleRoutes(app)\n\n\tPORT := os.Getenv(\"PORT\")\n\tif PORT == \"\" {\n\t\tPORT = \"8080\"\n\t}\n\n\tapp.Listen(\":\" + PORT)\n}", "title": "" }, { "docid": "49697f30f71871846b205f9b6f39f1b7", "score": "0.6583925", "text": "func StartServer(serverPort string) {\n\tgo startHealthServerNative(serverPort)\n\n\t// Creates a gin router with default middleware:\n\t// logger and recovery (crash-free) middleware\n\trouter := gin.Default()\n\trouter.GET(\"/\", homeEndpoint)\n\trouter.Run(\":\" + serverPort)\n\n}", "title": "" }, { "docid": "cd6347f452527255d16fef78aa52f1be", "score": "0.6477842", "text": "func Start() {\n\tflag.Parse()\n\n\tglog.Infof(\"Discovery cache refresh interval: %v\", *discoveryInterval)\n\tglog.Infof(\"API server relist interval i.e. cache flush interval: %v\", *informerRelist)\n\tglog.Infof(\"Debug http server address: %v\", *debugAddr)\n\tglog.Infof(\"Run metac locally: %t\", *runAsLocal)\n\n\tvar config *rest.Config\n\tvar err error\n\tif *clientConfigPath != \"\" {\n\t\tglog.Infof(\"Using kubeconfig %s\", *clientConfigPath)\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(\"\", *clientConfigPath)\n\t} else if *kubeAPIServerURL != \"\" {\n\t\tglog.Infof(\"Using kubernetes api server url %s\", *kubeAPIServerURL)\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(*kubeAPIServerURL, \"\")\n\t} else {\n\t\tglog.Info(\"Using in-cluster kubeconfig\")\n\t\tconfig, err = rest.InClusterConfig()\n\t}\n\tif err != nil {\n\t\tglog.Fatal(err)\n\t}\n\tconfig.QPS = float32(*clientGoQPS)\n\tconfig.Burst = *clientGoBurst\n\n\t// declare the stop server function\n\tvar stopServer func()\n\t// common server values\n\tvar mserver = &server.Server{\n\t\tConfig: config,\n\t\tDiscoveryInterval: *discoveryInterval,\n\t\tInformerRelist: *informerRelist,\n\t}\n\t// start metac either as config based or CRD based\n\tif *runAsLocal {\n\t\t// run as local implies starting this binary by\n\t\t// looking up various MetaController resources as\n\t\t// config files\n\t\tconfigServer := &server.ConfigServer{\n\t\t\tServer: mserver,\n\t\t\tConfigPath: *metacConfigPath,\n\t\t\tRetryIndefinitelyForStart: retryIndefinitelyToStart,\n\t\t}\n\t\tstopServer, err = configServer.Start(*workerCount)\n\t} else {\n\t\tcrdServer := &server.CRDServer{\n\t\t\tServer: mserver,\n\t\t}\n\t\tstopServer, err = crdServer.Start(*workerCount)\n\t}\n\tif err != nil {\n\t\tglog.Fatal(err)\n\t}\n\n\t// Expose kubernetes information via this global variable.\n\t// This provides a suitable way for consumers of this library\n\t// to use the same.\n\tKubeDetails = mserver.GetKubeDetails()\n\n\texporter, err := prometheus.NewExporter(prometheus.Options{})\n\tif err != nil {\n\t\tglog.Fatalf(\"Can't create prometheus exporter: %v\", err)\n\t}\n\tview.RegisterExporter(exporter)\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/metrics\", exporter)\n\thttpServer := &http.Server{\n\t\tAddr: *debugAddr,\n\t\tHandler: mux,\n\t}\n\tgo func() {\n\t\tglog.Errorf(\n\t\t\t\"Error serving metrics endpoint: %v\",\n\t\t\thttpServer.ListenAndServe(),\n\t\t)\n\t}()\n\n\t// On SIGTERM, stop all controllers gracefully.\n\tsigchan := make(chan os.Signal, 2)\n\tsignal.Notify(sigchan, os.Interrupt, syscall.SIGTERM)\n\tsig := <-sigchan\n\tglog.Infof(\"Received %q signal. Shutting down...\", sig)\n\n\tstopServer()\n\thttpServer.Shutdown(context.Background())\n}", "title": "" }, { "docid": "f24bd033ac6efd4052fb5560638eb16d", "score": "0.64777946", "text": "func StartServer(serverPort int, serverHost string) {\n\tr := mux.NewRouter()\n\tr.StrictSlash(true)\n\n\t// main page\n\tr.HandleFunc(\"/\", indexHandler)\n\n\t// health endpoint\n\tr.HandleFunc(\"/health\", healthHandler)\n\n\t// Handle /static for static files\n\tfileServer := http.FileServer(pkger.Dir(\"/public/\"))\n\tr.PathPrefix(\"/static/\").Handler(http.StripPrefix(\"/static/\", fileServer))\n\n\taddress := fmt.Sprintf(\"%s:%d\", serverHost, serverPort)\n\tklog.V(3).Infof(\"Starting dashboard server on %s\", address)\n\tsrv := &http.Server{\n\t\tHandler: r,\n\t\tAddr: address,\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\tklog.Infof(\"webserver listening on port %s:%d\", serverHost, serverPort)\n\tklog.Fatal(srv.ListenAndServe())\n}", "title": "" }, { "docid": "c3f9c09ab6cb630fccedc2bc895716db", "score": "0.6470781", "text": "func (m *Manager) StartServer() error {\n\n\t// Set the handler for the web server\n\thttp.HandleFunc(\"/\", m.server)\n\n\t// TODO - remove this\n\tm.v.UpdateQuestions(m.q)\n\t// Start the server\n\treturn http.ListenAndServe(m.addr, nil)\n}", "title": "" }, { "docid": "568f17152b59091d00a410625ba10b61", "score": "0.64704376", "text": "func StartServer() {\n\tport := viper.GetString(\"server.port\")\n\n\t// Sous domaines\n\t// -------------\n\thosts := initSubDomains(port)\n\n\t// Start server\n\t// ------------\n\te := echo.New()\n\te.Any(\"/*\", func(c echo.Context) (err error) {\n\t\trequest := c.Request()\n\t\tresponse := c.Response()\n\n\t\thost := hosts[request.Host]\n\n\t\tif host == nil {\n\t\t\terr = echo.ErrNotFound\n\t\t} else {\n\t\t\thost.Echo.ServeHTTP(response, request)\n\t\t}\n\n\t\treturn\n\t})\n\n\t// Startup banner\n\t// --------------\n\tif viper.GetString(\"environment\") == \"production\" {\n\t\te.HideBanner = true\n\t}\n\n\ts := &http.Server{\n\t\tAddr: \":\" + port,\n\t\tReadTimeout: time.Duration(viper.GetInt(\"server.readTimeout\")) * time.Second,\n\t\tWriteTimeout: time.Duration(viper.GetInt(\"server.writeTimeout\")) * time.Second,\n\t}\n\te.Logger.Fatal(e.StartServer(s))\n}", "title": "" }, { "docid": "699304d4131083badfa17c9d6f32ae6f", "score": "0.64469784", "text": "func StartServer() {\n\n\tlog.Println(\"Starting REST server ...\")\n\n\trouter := route.NewRouter()\n\n\ts := &http.Server{\n\t\tAddr: \":8080\",\n\t\tHandler: router,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\tlog.Fatal(s.ListenAndServe())\n}", "title": "" }, { "docid": "851bdbdb1c24bc5cf00d615190f305d5", "score": "0.64219356", "text": "func StartServer(d dispatcher) error {\n\trouter := mux.NewRouter()\n\n\trouter.HandleFunc(\"/api/new\", NewJobHandler(d)).Methods(\"POST\")\n\trouter.HandleFunc(\"/api/result/{hash}\", GetResultHandler(d)).Methods(\"GET\")\n\n\tlog.Infof(\"Started HTTP server on %s:%s\", \"\", \"8080\")\n\n\treturn http.ListenAndServe(\":8080\", router)\n}", "title": "" }, { "docid": "bde97d4322fec6f2e02f805fab9ca9bc", "score": "0.6407381", "text": "func (s *Server) StartServer() {\n\tsrv := &http.Server{\n\t\tHandler: s.Router,\n\t\tAddr: fmt.Sprintf(\"0.0.0.0:%s\", s.Config.Port),\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\tlog.Fatal(srv.ListenAndServe())\n}", "title": "" }, { "docid": "67c3b39893b255f7b4c8a5f4fb043391", "score": "0.63683236", "text": "func Start(h *store.Handler, config AppserverStruct, gIntegrations []models.IntegrationHandler,\n\tpsCli *pscli.Client, nsCli *nscli.Client, devSessionList *devprovision.DeviceSessionList) (*NetworkServerAPIServer, error) {\n\tlog.WithFields(log.Fields{\n\t\t\"bind\": config.Bind,\n\t\t\"ca_cert\": config.CACert,\n\t\t\"tls_cert\": config.TLSCert,\n\t\t\"tls_key\": config.TLSKey,\n\t}).Info(\"api/as: starting application-server api\")\n\n\tgrpcOpts := helpers.GetgRPCServerOptions()\n\tif config.CACert != \"\" && config.TLSCert != \"\" && config.TLSKey != \"\" {\n\t\tcreds, err := helpers.GetTransportCredentials(config.CACert, config.TLSCert, config.TLSKey, true)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"get transport credentials error\")\n\t\t}\n\t\tgrpcOpts = append(grpcOpts, grpc.Creds(creds))\n\t}\n\tserver := grpc.NewServer(grpcOpts...)\n\tas.RegisterApplicationServerServiceServer(server, NewApplicationServerAPI(h, gIntegrations, psCli, nsCli, devSessionList))\n\n\tln, err := net.Listen(\"tcp\", config.Bind)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"start application-server api listener error\")\n\t}\n\tgo func() {\n\t\t_ = server.Serve(ln)\n\t}()\n\n\treturn &NetworkServerAPIServer{gs: server}, nil\n}", "title": "" }, { "docid": "35b9cce8bef7742f3ff2b7a89abe5aaa", "score": "0.63496494", "text": "func StartServer(Port int) {\n\n\tlog.Printf(\"-------------starting sever at %d -------\\n\", Port)\n\n\t// router.HandleFunc(\"/\", auth.IsAuthenticated(homepage)) //login\n\trouter.HandleFunc(\"/\", homepage)\n\trouter.HandleFunc(\"/api/users\", auth.IsAuthenticated(getUsers)).Methods(\"GET\")\n\trouter.HandleFunc(\"/api/users/{id}\", auth.IsAuthenticated(getUser)).Methods(\"GET\")\n\trouter.HandleFunc(\"/api/users\", auth.IsAuthenticated(createUser)).Methods(\"POST\")\n\trouter.HandleFunc(\"/api/users/{id}\", auth.IsAuthenticated(updateUser)).Methods(\"PUT\")\n\trouter.HandleFunc(\"/api/users/{id}\", auth.IsAuthenticated(deleteUser)).Methods(\"DELETE\")\n\n\t// token, err := auth.GenerateJWT()\n\t// if err != nil {\n\t// \tfmt.Println(err)\n\t// }\n\t// fmt.Println(token)\n\tServer := &http.Server{\n\t\tAddr: \":\" + strconv.Itoa(Port),\n\t\tHandler: router,\n\t}\n\n\t//go func() {\n\tfmt.Println(Server.ListenAndServe())\n\t//log.Fatal(http.ListenAndServe(\":\"+strconv.Itoa(Port), router))\n\t//}()\n}", "title": "" }, { "docid": "3cfeaa737e901c8f04ed8cc4b62a2ac1", "score": "0.63468426", "text": "func StartServer(port string, config *config.Config) error {\n\n\tserverContext, err := context.NewServerContext(config)\n\tif err != nil {\n\t\tlog.Panicln(\"error in init server context\")\n\t\treturn err\n\t}\n\tcontext.Context = serverContext\n\n\tr := handler.NewRouter(config)\n\thttp.ListenAndServe(port, r)\n\n\treturn nil\n}", "title": "" }, { "docid": "bfb0648f90cb2748f9cabf25cdc714a0", "score": "0.632352", "text": "func StartServer(port string) {\n\trouter := web.NewRouter(routes)\n\trouter.ServeFiles(\"/client/*filepath\", http.Dir(os.Getenv(\"PTCFRONTEND\")))\n\tlog.Println(\"starting the webserver...\", \"http://localhost\"+port)\n\tlog.Fatal(http.ListenAndServe(port, router))\n}", "title": "" }, { "docid": "b0c7ddaeb158c6f5a4c0e374252885eb", "score": "0.6300473", "text": "func StartServer() error {\n\t// any request even the service doesn't exist in toml file, it will go to api.ToICAPEGServe\n\t// and there, the request will be filtered to check if the service exists or not\n\n\tconfig.Init()\n\n\t//HTTP server\n\thtmlWebServer := http.NewServeMux()\n\thtmlWebServer.HandleFunc(\"/service/message\", http_server.HtmlMessage)\n\tgo func() {\n\t\thttp.ListenAndServe(\":8081\", htmlWebServer)\n\t}()\n\n\ticap.HandleFunc(\"/\", api.ToICAPEGServe)\n\n\tlogging.Logger.Info(\"starting the ICAP server\")\n\n\tstop := make(chan os.Signal, 1)\n\n\tsignal.Notify(stop, syscall.SIGKILL, syscall.SIGINT, syscall.SIGQUIT)\n\n\tgo func() {\n\t\tif err := icap.ListenAndServe(fmt.Sprintf(\":%d\", config.App().Port), nil); err != nil {\n\t\t\tlogging.Logger.Fatal(err.Error())\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(10 * time.Second)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase _ = <-ticker.C:\n\t\t\t}\n\t\t}\n\t}()\n\n\ttime.Sleep(5 * time.Millisecond)\n\tport := strconv.Itoa(config.App().Port)\n\tlogging.Logger.Info(\"ICAP server is running on localhost: \" + port)\n\n\t<-stop\n\tticker.Stop()\n\n\tlogging.Logger.Info(\"ICAP server gracefully shut down\")\n\n\treturn nil\n}", "title": "" }, { "docid": "fbb0caad87036ef14c2e864f7a925fe7", "score": "0.6300397", "text": "func StartAPIServer(port int64) error {\n\tapi, err := newAPI(port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tapi.database = database.Connect(false)\n\tdefer api.database.Disconnect()\n\n\tapi.log.Infof(\"API server to listen on port %d\", port)\n\n\t// Catch intrerupt\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func(api *API) {\n\t\tfor sig := range c {\n\t\t\t// Shutdown the API when ctrl-C is pressed\n\t\t\tapi.shutdown(sig)\n\t\t\tos.Exit(0)\n\t\t}\n\t}(api)\n\n\treturn api.router.Run(\":\" + strconv.FormatInt(port, 10))\n}", "title": "" }, { "docid": "8ee00a2ae15db577e44c021030fd57ac", "score": "0.62973833", "text": "func StartServer() {\n\tparseAllTemplates()\n\tregisterRoutes()\n\thttp.ListenAndServe(\":8100\", nil)\n}", "title": "" }, { "docid": "b8d9a04d7b514632d8a8a2b01d6fabdd", "score": "0.62916183", "text": "func StartServer() {\n\tr := gin.Default()\n\t// gin.SetMode(gin.DebugMode)\n\tgin.SetMode(config.LoadConfig().Server.SetMode)\n\n\troutes.LoadRoutes(r)\n\n\t// Handle error response when a route is not defined\n\tr.NoRoute(func(c *gin.Context) {\n\t\tc.JSON(404, gin.H{\"message\": \"Not found\"})\n\t})\n\n\tr.Run(config.LoadConfig().Server.Host + \":\" + config.LoadConfig().Server.Port)\n}", "title": "" }, { "docid": "f3f52d7638dc4c67c3eac6b775ee2bda", "score": "0.6287403", "text": "func StartServer() *atomic.Value {\n\trouter := http.NewServeMux()\n\tisReady := initRouter(router)\n\n\tgo func() {\n\t\t_ = http.ListenAndServe(\":\"+constants.ReadinessPort, router)\n\t}()\n\n\treturn isReady\n}", "title": "" }, { "docid": "4823fa1752a8bed0872a9d5ee2979e01", "score": "0.62820506", "text": "func StartServer() {\n\tconfiguration = LoadGlobalConfig()\n\ttmpl = initTemplate()\n\n\tif configuration == nil || tmpl == nil {\n\t\tpanic(\"The initial setup failed, check if there is a problem with the app configuration or template values\")\n\t}\n\n\tstatusUpdater(configuration.IntervalCheck)\n\n\thttp.Handle(\"/templates/\", http.StripPrefix(\"/templates/\", http.FileServer(http.Dir(\"templates\"))))\n\thttp.HandleFunc(\"/\", homePageHandler)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "99b5ededc116e4055cc2f8cc351cab10", "score": "0.62765", "text": "func StartServer(host string, port int16) {\n\tr := mux.NewRouter()\n\tr.Use(middleWare)\n\n\tr.HandleFunc(\"/{avatar}\", handler.GETAvatar)\n\tr.HandleFunc(\"/ss/{screenshot}\", handler.GETScreenshot)\n\tr.HandleFunc(\"/web/osu-screenshot.php\", handler.POSTScreenshot)\n\n\tr.HandleFunc(\"/web/osu-search.php\", handler.SearchDirect)\n\tr.HandleFunc(\"/web/osu-search-set.php\", handler.GETDirectSet)\n\n\tr.HandleFunc(\"/web/osu-submit-modular.php\", handler.POSTSubmitModular)\n\tr.HandleFunc(\"/web/osu-osz2-getscores.php\", handler.GETScoreboard)\n\tr.HandleFunc(\"/web/osu-getreplay.php\", handler.GETreplaycompressed)\n\n\tr.HandleFunc(\"/web/check-updates.php\", handler.GETUpdates)\n\tr.HandleFunc(\"/web/osu-error.php\", handler.POSTosuerror)\n\tr.HandleFunc(\"/web/{web}\", webFolder)\n\n\t// Achievements\n\tr.HandleFunc(\"/images/medals-client/{achievement}.png\", handler.AchievementHandler)\n\tr.HandleFunc(\"/images/medals-client/{achievement}.gif\", handler.AchievementHandler)\n\n\tr.HandleFunc(\"/api/kokoro/addbeatmap\", api.AddMap)\n\tr.NotFoundHandler = unknownWeb()\n\n\tlogger.Infof(\"Kokoro is listening on port %v\\n\", port)\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\"%s:%v\", host, port), r))\n}", "title": "" }, { "docid": "f3fdef1ca45a0be8a9206245716d6015", "score": "0.62728465", "text": "func (s *Server) StartServer(address string, clientsManager bool, tlsConfig *TLSConfig) error {\n\tmux := http.NewServeMux()\n\tif clientsManager == true {\n\t\t// Start the routine to manage the clients (in & out)\n\t\tgo s.manageClientList()\n\t\t// Register the route to manage the SkyProxy cients\n\t\tmux.HandleFunc(\"/_skyproxy/register\", createClientsHTTPHandler(s))\n\t} else {\n\t\t// Register the route to handle the public HTTP(s) traffic\n\t\tmux.HandleFunc(\"/\", createPublicHTTPHandler(s))\n\t}\n\tif tlsConfig != nil {\n\t\treturn http.ListenAndServeTLS(address, tlsConfig.CertFile, tlsConfig.KeyFile, mux)\n\t}\n\treturn http.ListenAndServe(address, mux)\n}", "title": "" }, { "docid": "7f08f05bb7e8ece030191ca80ec5a1e1", "score": "0.6262568", "text": "func StartServer(ctx configs.AppContext) {\n\trouter := mux.NewRouter().StrictSlash(true)\n\n\tfor _, route := range routes {\n\t\tvar handler http.Handler\n\t\thandler = makeHandler(ctx, route.HandlerFunc)\n\t\trouter.\n\t\t\tMethods(route.Method).\n\t\t\tPath(route.Pattern).\n\t\t\tName(route.Name).\n\t\t\tHandler(handler)\n\t}\n\t// security\n\tvar isDevelopment = false\n\tif ctx.Env == configs.Local {\n\t\tisDevelopment = true\n\t}\n\n\tsecureMiddleware := secure.New(secure.Options{\n\t\tIsDevelopment: isDevelopment, // This will cause the AllowedHosts, SSLRedirect, and STSSeconds/STSIncludeSubdomains options to be ignored during development. When deploying to production, be sure to set this to false.\n\t\tAllowedHosts: []string{}, // AllowedHosts is a list of fully qualified domain names that are allowed (CORS)\n\t\tContentTypeNosniff: true, // If ContentTypeNosniff is true, adds the X-Content-Type-Options header with the value `nosniff`. Default is false.\n\t\tBrowserXssFilter: true, // If BrowserXssFilter is true, adds the X-XSS-Protection header with the value `1; mode=block`. Default is false.\n\t})\n\t// start now\n\tn := negroni.New()\n\tn.Use(negroni.NewLogger())\n\tn.Use(negroni.HandlerFunc(secureMiddleware.HandlerFuncWithNext))\n\tn.UseHandler(router)\n\tlog.Println(\"===> Starting app on port \" + ctx.Port + \" in \" + ctx.Env + \" mode.\")\n\tif ctx.Env == configs.Local {\n\t\tn.Run(\"localhost:\" + ctx.Port)\n\t} else {\n\t\tn.Run(\":\" + ctx.Port)\n\t}\n}", "title": "" }, { "docid": "4c558efb26a2c2d1138c4ecd391da425", "score": "0.6236463", "text": "func StartServer(serverPort string) {\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(\"/orchestratorStats\", GetOrchestratorStats).Methods(\"GET\")\n\trouter.HandleFunc(\"/priceHistory/{address}\", GetOrchestratorPriceHistory).Methods(\"GET\")\n\tlog.Infoln(\"Starting server at PORT\", serverPort)\n\tfmt.Println(\"Starting server at PORT\", serverPort)\n\tlog.Fatalln(\"Error in starting server\", http.ListenAndServe(serverPort, handlers.CORS()(router)))\n\tfmt.Println(\"Error in starting server\", http.ListenAndServe(serverPort, handlers.CORS()(router)))\n}", "title": "" }, { "docid": "ce66636a8f469f65322a2ae7df231b01", "score": "0.62253773", "text": "func StartServer() {\n\thttp.HandleFunc(\"/new\", newSessionHandler)\n\thttp.HandleFunc(\"/list\", sessionListHandler)\n\thttp.ListenAndServe(\":1879\", nil)\n}", "title": "" }, { "docid": "28d8bd399b64101897e2a66118ab48c2", "score": "0.62235117", "text": "func startServer() {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(util.ServerURLPrefix+\"/api/status\", routeSyncStatus)\n\tmux.HandleFunc(\"/\", handleUnsupportedEndpoint)\n\n\tfmt.Printf(\"Starting server at %s. Prefix: %v\\n\", util.ServerURL, util.ServerURLPrefix)\n\terr := http.ListenAndServe(util.ServerURL, mux)\n\tlog.Printf(\"%v\", err)\n}", "title": "" }, { "docid": "440b8de2078c372415a03214c8e50de6", "score": "0.6206889", "text": "func startServer(caPath string, keyPath string, certPath string) error {\n\ts := northbound.NewServer(northbound.NewServerConfig(caPath, keyPath, certPath))\n\ts.AddService(admin.Service{})\n\ts.AddService(diags.Service{})\n\ts.AddService(gnmi.Service{})\n\n\treturn s.Serve(func(started string) {\n\t\tlog.Info(\"Started NBI on \", started)\n\t})\n}", "title": "" }, { "docid": "625dbb3192eb8fddf6a8d856ffef25e6", "score": "0.61870575", "text": "func startServer() {\n\t// define the new router, define paths, and handlers on the router\n\trouter := mux.NewRouter().StrictSlash(true)\n\n\t// set the routes on our api\n\trouter.HandleFunc(\"/request\", redirect)\n\trouter.HandleFunc(\"/callback\", callback)\n\n\t// start the server\n\tlog.Info(\"New server started\")\n\tlog.Fatal(http.ListenAndServe(\":5000\", router))\n}", "title": "" }, { "docid": "aaca8d3f393d02030f56820bd3626ee4", "score": "0.61755675", "text": "func (s *Server) Start() {\n\tr, i := s.setupRoutes()\n\n\tgo func() {\n\t\tlog.Fatalln(http.ListenAndServe(fmt.Sprintf(\":%d\", s.Port), r))\n\t}()\n\n\tgo func() {\n\t\tlog.Fatalln(http.ListenAndServe(fmt.Sprintf(\":%d\", s.InternalPort), i))\n\t}()\n\n\tLogger.Infof(\"Tilenol server up and running @ 0.0.0.0:[%d,%d]\", s.Port, s.InternalPort)\n\n\tselect {}\n}", "title": "" }, { "docid": "8f185658335337e51d293cc47ddb9535", "score": "0.6175475", "text": "func Start(addr string, autorestart, devmode bool, logger zerolog.Logger) *Server {\n // TODO add TLS\n mux := goji.NewMux()\n server := &Server{\n httpServer: &http.Server{Addr: addr, Handler: mux},\n stopLock: &sync.Mutex{},\n }\n\n // add graphql endpoint\n mux.Handle(\n pat.New(\"/graphql\"),\n handler.GraphQL(gql.NewExecutableSchema(gql.Config{Resolvers: &gql.Resolver{\n // pass in network manager\n }})),\n )\n\n // optionally add graphql playground\n if devmode {\n mux.Handle(pat.New(\"/playground\"), handler.Playground(\"GraphQL playground\", \"/graphql\"))\n }\n\n statikFS, err := fs.New()\n if err != nil {\n logger.Fatal().Err(err).Msg(\"failed to retrieve bundled ui\")\n }\n\n // add ui bundle\n mux.Handle(pat.New(\"/*\"), http.FileServer(statikFS))\n\n go func() {\n restartLoop:\n for {\n if err := server.httpServer.ListenAndServe(); err != http.ErrServerClosed {\n logger.Error().Err(err).Msg(\"http listener crashed\")\n }\n\n if server.attemptingStop || !autorestart {\n break restartLoop\n }\n }\n }()\n\n return server\n}", "title": "" }, { "docid": "d573aae844b6671895e326f477a92576", "score": "0.61752224", "text": "func (proxyServer *GISProxy) StartServer() {\n\thttp.Handle(\"/\", proxyServer.Router)\n\terr := http.ListenAndServe(proxyServer.Address, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4976281ab54635a43fc22368b59286cb", "score": "0.6174643", "text": "func serverStart(cmd *cobra.Command, args []string) {\n\tlog.Init(debug, false, (logFile != \"\"), logFile)\n\trunLuz(cmd, args)\n\tcontroller.runServer()\n}", "title": "" }, { "docid": "2ce157b80e4dbdeb6c3fab23245dad29", "score": "0.6155879", "text": "func StartServer() {\n\thttp.HandleFunc(\"/ready\", HandlerReady)\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "5808bb1108248a91a0b0fc0a01a321f6", "score": "0.61259985", "text": "func StartServer() error {\n\tcmd := exec.Command(\"adb\", \"start-server\")\n\terr := cmd.Run()\n\treturn util.WrapErrorf(err, util.ServerNotAvailable, \"error starting server: %s\", err)\n}", "title": "" }, { "docid": "932196e861692642090db924fff026dd", "score": "0.61146235", "text": "func StartServer(kubeCli kubernetes.Interface, cli versioned.Interface, port int) {\n\ts := scheduler.NewScheduler(kubeCli, cli)\n\tsvr := &server{scheduler: s}\n\n\tws := new(restful.WebService)\n\tws.\n\t\tPath(\"/scheduler\").\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON)\n\n\tws.Route(ws.POST(\"/filter\").To(svr.filterNode).\n\t\tDoc(\"filter nodes\").\n\t\tOperation(\"filterNodes\").\n\t\tWrites(schedulerapi.ExtenderFilterResult{}))\n\n\tws.Route(ws.POST(\"/preempt\").To(svr.preemptNode).\n\t\tDoc(\"preempt nodes\").\n\t\tOperation(\"preemptNodes\").\n\t\tWrites(schedulerapi.ExtenderPreemptionResult{}))\n\n\tws.Route(ws.POST(\"/prioritize\").To(svr.prioritizeNode).\n\t\tDoc(\"prioritize nodes\").\n\t\tOperation(\"prioritizeNodes\").\n\t\tWrites(schedulerapi.HostPriorityList{}))\n\trestful.Add(ws)\n\n\tklog.Infof(\"start scheduler extender server, listening on 0.0.0.0:%d\", port)\n\tklog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%d\", port), nil))\n}", "title": "" }, { "docid": "40fef5cf3586279e8948eca5005b8077", "score": "0.6114545", "text": "func (s *CounterServer) StartServer(port string) {\n\tlog.Printf(\"service starting on port %s\\n\", port)\n\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%s\", port), s))\n}", "title": "" }, { "docid": "663007ccc8855e32ab635646e4667c1e", "score": "0.6090818", "text": "func StartServer(rootd string, datad string, actions chan<- *messages.Action) {\n\tdatadir = datad\n\trootdir = rootd\n\tWSserv = NewWSServer(\"/api\", actions)\n\tfmt.Println(\"Server created\", WSserv)\n\tgo func() {\n\t\tgo WSserv.Listen()\n\t\thttp.HandleFunc(\"/data/\", serveFileData)\n\t\thttp.Handle(\"/\", http.FileServer(http.Dir(path.Join(rootdir, \"www\"))))\n\t\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n\t\t\tlog.Fatal(\"Couldn't start webserver:\", err)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "92190ab8bd8b9a3cd69fd1a402bbefa3", "score": "0.608551", "text": "func (s Server) Start() error {\n\t// Initialize mux router\n\trouter := mux.NewRouter()\n\n\t// define routes and call their handler function\n\trouter.HandleFunc(\"/api/iban/validate/health\", CheckHealthHandler)\n\trouter.HandleFunc(\"/api/iban/validate/{iban}\", ValidateIbanHandler)\n\n\t// start the server on specified port\n\terr := http.ListenAndServe(fmt.Sprintf(\":%s\", s.Port), router)\n\tlog.Errorf(\"error starting server: %v\", err)\n\treturn err\n}", "title": "" }, { "docid": "b47365a773ae6fa6c5a11eaace58c1b1", "score": "0.60692227", "text": "func (server *Server) StartServer() error {\n\tif server.Config.GetString(\"filesPath\") == \"\" {\n\t\treturn errors.New(\"filesPath is not specified in the configuration file.\")\n\t}\n\n\tif err := os.Mkdir(server.Config.GetString(\"filesPath\"), 0755); err != nil {\n\t\tif !os.IsExist(err) {\n\t\t\treturn errors.New(\"Unable to create filesPath directory: \" + err.Error())\n\t\t}\n\t}\n\n\tif deploymentStore, err := blobstore.NewBlobStore(\"Deployments\", server.Config); err != nil {\n\t\treturn errors.New(\"Unable to create deployments store: \" + err.Error())\n\t} else {\n\t\tserver.DeploymentStore = deploymentStore\n\t}\n\n\tif inClusterDeploymentStore, err := blobstore.NewBlobStore(\"InClusterDeployments\", server.Config); err != nil {\n\t\treturn errors.New(\"Unable to create in-cluster deployments store: \" + err.Error())\n\t} else {\n\t\tserver.InClusterDeploymentStore = inClusterDeploymentStore\n\t}\n\n\tif profileStore, err := blobstore.NewBlobStore(\"UserProfiles\", server.Config); err != nil {\n\t\treturn errors.New(\"Unable to create awsProfiles store: \" + err.Error())\n\t} else {\n\t\tserver.ProfileStore = profileStore\n\t}\n\n\tif templateStore, err := blobstore.NewBlobStore(\"Templates\", server.Config); err != nil {\n\t\treturn errors.New(\"Unable to create templates store: \" + err.Error())\n\t} else {\n\t\tserver.TemplateStore = templateStore\n\t}\n\n\tif err := server.reloadClusterState(); err != nil {\n\t\treturn errors.New(\"Unable to reload cluster state: \" + err.Error())\n\t}\n\n\trouter := gin.New()\n\n\t// Global middleware\n\trouter.Use(gin.Logger())\n\trouter.Use(gin.Recovery())\n\n\trouter.LoadHTMLGlob(filepath.Join(os.Getenv(\"GOPATH\"),\n\t\t\"src/github.com/hyperpilotio/deployer/ui/*.html\"))\n\trouter.Static(\"/static\", filepath.Join(os.Getenv(\"GOPATH\"),\n\t\t\"src/github.com/hyperpilotio/deployer/ui/static\"))\n\n\tuiGroup := router.Group(\"/ui\")\n\t{\n\t\tuiGroup.GET(\"\", server.logUI)\n\t\tuiGroup.GET(\"/logs/:logFile\", server.getDeploymentLogContent)\n\t\tuiGroup.GET(\"/list/:status\", server.refreshUI)\n\n\t\tuiGroup.GET(\"/users\", server.userUI)\n\t\tuiGroup.POST(\"/users\", server.storeUser)\n\t\tuiGroup.DELETE(\"/users/:userId\", server.deleteUser)\n\t\tuiGroup.PUT(\"/users/:userId\", server.storeUser)\n\t}\n\n\tusersGroup := router.Group(\"/v1/users\")\n\t{\n\t\tusersGroup.POST(\"/:userId/deployments\", server.createDeployment)\n\t\tusersGroup.PUT(\"/:userId/deployments/:deployment\", server.updateDeployment)\n\n\t\tusersGroup.POST(\"/:userId/files/:fileId\", server.uploadFile)\n\t}\n\n\tdaemonsGroup := router.Group(\"/v1/deployments\")\n\t{\n\t\tdaemonsGroup.GET(\"\", server.getAllDeployments)\n\t\tdaemonsGroup.GET(\"/:deployment\", server.getDeployment)\n\t\tdaemonsGroup.POST(\"\", server.createDeployment)\n\t\tdaemonsGroup.DELETE(\"/:deployment\", server.deleteDeployment)\n\t\tdaemonsGroup.PUT(\"/:deployment\", server.updateDeployment)\n\n\t\tdaemonsGroup.GET(\"/:deployment/ssh_key\", server.getPemFile)\n\t\tdaemonsGroup.GET(\"/:deployment/kubeconfig\", server.getKubeConfigFile)\n\t\tdaemonsGroup.GET(\"/:deployment/state\", server.getDeploymentState)\n\n\t\tdaemonsGroup.GET(\"/:deployment/services/:service/url\", server.getServiceUrl)\n\t\tdaemonsGroup.GET(\"/:deployment/services/:service/address\", server.getServiceAddress)\n\t\tdaemonsGroup.GET(\"/:deployment/services\", server.getServices)\n\t}\n\n\tawsRegionGroup := router.Group(\"/v1/aws/regions\")\n\t{\n\t\tawsRegionGroup.GET(\"/:region/availabilityZones/:availabilityZone/instances\", server.getAWSRegionInstances)\n\t}\n\n\ttemplateGroup := router.Group(\"/v1/templates\")\n\t{\n\t\ttemplateGroup.POST(\"/:templateId\", server.storeTemplateFile)\n\t\ttemplateGroup.POST(\"/:templateId/deployments\", server.createDeployment)\n\t\ttemplateGroup.PUT(\"/:templateId/deployments/:deployment/reset\", server.resetTemplateDeployment)\n\t\ttemplateGroup.PUT(\"/:templateId/deployments/:deployment/deploy\", server.deployExtensions)\n\t}\n\n\tfilesGroup := router.Group(\"/v1/files\")\n\t{\n\t\tfilesGroup.GET(\"\", server.getFiles)\n\t\tfilesGroup.POST(\"/:fileId\", server.uploadFile)\n\t\tfilesGroup.DELETE(\"/:fileId\", server.deleteFile)\n\t}\n\n\treturn router.Run(\":\" + server.Config.GetString(\"port\"))\n}", "title": "" }, { "docid": "e63886a4c2c8dc4a928ad937663c13d9", "score": "0.60517555", "text": "func StartServer() {\n\tlogger := logging.NewLogger()\n\tlogger.Printf(\"Data server started on separate thread.\\n\")\n\thttp.HandleFunc(\"/patron-data\", servePatronData)\n\t// ListenAndServe should be changed to the TLS variant for prod.\n\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n\t\tlogger.Warnf(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "486b0aca63875d3761d93b5757eb2905", "score": "0.6041731", "text": "func (s *Server) Start() error {\n\tif err := s.init(); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.app.Listen(fmt.Sprintf(\":%d\", s.Config.Port))\n}", "title": "" }, { "docid": "f8f5a0e94a0e7b8488c76535cc65ce53", "score": "0.60407686", "text": "func StartServer() {\n\t// Gin initiate\n\tr := gin.Default()\n\n\tconf := settings.GetConf()\n\n\t// Serve static files\n\tr.Static(\"/service-worker.js\", path.Join(conf.BaseValues.AssetPath, \"build/service-worker.js\"))\n\tr.Static(\"/static\", path.Join(conf.BaseValues.AssetPath, \"build/static\"))\n\tr.Static(\"/cover\", path.Join(conf.BaseValues.AssetPath, \"uploads/img\"))\n\n\t// HTML rendering\n\tr.LoadHTMLGlob(path.Join(conf.BaseValues.AssetPath, \"build/index.html\"))\n\n\t// Open postgres database\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s?sslmode=%s\", conf.BaseValues.DBValues.DBUsername, conf.BaseValues.DBValues.DBPassword, conf.BaseValues.DBValues.DBHostname, conf.BaseValues.DBValues.DBPort, conf.BaseValues.DBValues.DBName, conf.BaseValues.DBValues.DBSSLMode)\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tcError.CheckError(err)\n\tdefer db.Close()\n\n\tr.Use(\n\t\tmiddleware.CORSMiddleware(),\n\t\tmiddleware.APIMiddleware(db),\n\t)\n\n\tmodels.CreateUser(db)\n\tmodels.CreateSMTP(db)\n\tmodels.CreateNextcloud(db)\n\n\t// Gin handlers\n\tr.GET(\"/\", home.Home)\n\tr.GET(\"/signin\", home.Home)\n\tr.POST(\"/signin\", onboard.PostSignIn)\n\tr.GET(\"/signup\", home.Home)\n\tr.POST(\"/signup\", onboard.PostSignUp)\n\tr.GET(\"/smtp\", home.Home)\n\tr.POST(\"/smtp\", onboard.PostSMTP)\n\tr.POST(\"/test-email\", onboard.TestEmail)\n\tr.GET(\"/storage\", home.Home)\n\tr.POST(\"/nextcloud\", onboard.PostNextcloud)\n\tr.GET(\"/nextcloud-auth/:user_id\", onboard.NextcloudAuthCode)\n\tr.GET(\"/check-onboard\", onboard.CheckOnboard)\n\tr.GET(\"/books\", books.GetBooks)\n\tr.POST(\"/upload-books\", books.UploadBooks)\n\n\t// Listen and serve\n\tport, err := strconv.Atoi(conf.BaseValues.ServerPort)\n\tif err != nil {\n\t\tfmt.Println(\"Invalid port specified\")\n\t\tos.Exit(1)\n\t}\n\tr.Run(fmt.Sprintf(\":%d\", port))\n}", "title": "" }, { "docid": "c881ad58ea67db7f5eb3b4ef716664da", "score": "0.60383195", "text": "func (s *Server) StartServer() {\n\n\ts.setupRoutes()\n\ts.setupMiddlewares()\n\n\tsrv := &http.Server{\n\t\tAddr: \":\" + fmt.Sprint(s.config.Port),\n\t\tHandler: s.router,\n\t\t// Good practice: enforce timeouts for servers you create!\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\ts.logger.Infow(\"starting web server\",\n\t\tzap.Int(\"port\", s.config.Port),\n\t)\n\n\t//graceful shutdown - run server in goroutine and handle SIGINT & SIGTERM\n\tgo func() {\n\t\tif err := srv.ListenAndServe(); err != nil {\n\t\t\ts.logger.Infow(\"server stopped\",\n\t\t\t\tzap.Error(err),\n\t\t\t)\n\t\t}\n\t}()\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGINT, syscall.SIGTERM)\n\n\t// block wait for signal\n\t<-c\n\n\tctx, cancel := context.WithTimeout(context.Background(), s.config.Timeout)\n\tdefer cancel()\n\tsrv.Shutdown(ctx)\n\n\ts.logger.Infow(\"server shutting down\")\n\tos.Exit(0)\n}", "title": "" }, { "docid": "1354a7e49ff9403a0d89f394466f0984", "score": "0.6037819", "text": "func StartServer(kubeCli kubernetes.Interface, informerFactory informers.SharedInformerFactory, port int, db store.EtcdInterface) {\n\te := api.NewExecutor(kubeCli, informerFactory, db)\n\tsvr := &server{exec: e}\n\n\tstopCh := make(chan struct{})\n\tgo informerFactory.Start(stopCh)\n\te.Run(stopCh)\n\tws := new(restful.WebService)\n\tws.\n\t\tPath(\"/scheduler\").\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON)\n\n\tws.Route(ws.POST(\"/setonepod\").To(svr.setOnePod).\n\t\tDoc(\"set pod\").\n\t\tOperation(\"SetPod\").\n\t\tWrites(types.SetPodResult{}))\n\n\tws.Route(ws.POST(\"/setbatchpod\").To(svr.setBatchPod).\n\t\tDoc(\"set batch pod\").\n\t\tOperation(\"SetBatchPod\").\n\t\tWrites(types.SetPodResult{}))\n\n\tws.Route(ws.GET(\"/hello\").To(svr.hello).\n\t\tDoc(\"hello\").\n\t\tOperation(\"Hello\").\n\t\tWrites(types.HelloResult{}))\n\tws.Route(ws.GET(\"/util\").To(svr.getUtil).\n\t\tDoc(\"util\").\n\t\tOperation(\"Util\").\n\t\tWrites(types.GetInstanceResult{}))\n\tws.Route(ws.GET(\"/allocation/{which}\").To(svr.getReourceAllocation).\n\t\tDoc(\"get resource allocation\").\n\t\tParam(ws.PathParameter(\"which\", \"identify which\").DataType(\"string\")).\n\t\tWrites(types.QueryResult{}))\n\tws.Route(ws.GET(\"/time/{which}\").To(svr.getResourceTime).\n\t\tDoc(\"get resource time\").\n\t\tParam(ws.PathParameter(\"which\", \"identify which\").DataType(\"string\")).\n\t\tWrites(types.QueryResult{}))\n\tws.Route(ws.GET(\"/qps/{which}\").To(svr.getQPS).\n\t\tDoc(\"get qps\").\n\t\tParam(ws.PathParameter(\"which\", \"identify which\").DataType(\"string\")).\n\t\tWrites(types.QueryResult{}))\n\n\trestful.Add(ws)\n\tglog.Infof(\"start scheduler extender server, listening on 0.0.0.0:%d\", port)\n\tglog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%d\", port), nil))\n}", "title": "" }, { "docid": "aec7a5d92faab623864345b2ee0d4d21", "score": "0.6021034", "text": "func (r *runner) startServer() error {\n\topts := &server.Options{\n\t\tContainerManager: r.manager,\n\t}\n\n\ts := server.New(opts)\n\tgo s.Start()\n\treturn nil\n}", "title": "" }, { "docid": "8a8fee79ab400c89dc12144212b88881", "score": "0.60178536", "text": "func (s *Server) Start() error {\n\t// mount the root set of routes before starting\n\ts.mountGroup(s.Router.rootGroup())\n\n\tif s.options.AppName != \"\" {\n\t\ts.options.Logger.Info(\"starting\", s.options.AppName, \"...\")\n\t}\n\n\ts.options.Logger.Info(\"serving on\", s.server.Addr)\n\n\tif !s.options.HTTPPortSet() && !s.options.ShouldUseTLS() {\n\t\ts.options.Logger.ErrorString(\"domain and HTTP port options are both unset, server will start up but fail to acquire a certificate. reconfigure and restart\")\n\t} else if s.options.ShouldUseHTTP() {\n\t\treturn s.server.ListenAndServe()\n\t}\n\n\treturn s.server.ListenAndServeTLS(\"\", \"\")\n}", "title": "" }, { "docid": "1ebbdff2b17710be6309dc14a2c55080", "score": "0.601387", "text": "func (s *Server) Start() error {\n\t// lock the router modifiers (GET, POST etc.)\n\ts.started.Store(true)\n\n\t// mount the root set of routes before starting\n\ts.router.Finalize()\n\n\tif s.options.AppName != \"\" {\n\t\ts.options.Logger.Info(\"starting\", s.options.AppName, \"...\")\n\t}\n\n\ts.options.Logger.Info(\"serving on\", s.server.Addr)\n\n\tif !s.options.HTTPPortSet() && !s.options.ShouldUseTLS() {\n\t\ts.options.Logger.ErrorString(\"domain and HTTP port options are both unset, server will start up but fail to acquire a certificate. reconfigure and restart\")\n\t} else if s.options.ShouldUseHTTP() {\n\t\treturn s.server.ListenAndServe()\n\t}\n\n\treturn s.server.ListenAndServeTLS(\"\", \"\")\n}", "title": "" }, { "docid": "c170ab28adc1fe6f73d2491f1a55eb22", "score": "0.599361", "text": "func startHttpServer() {\n\tl(\"Starting API server...\", false, true)\n\thttp.HandleFunc(\"/\", testBroadcast)\n\tl(\"API server is listening on port \"+appConfig.Api.Address+\":\"+appConfig.Api.Port, false, true)\n\tlog.Fatal(http.ListenAndServe(appConfig.Api.Address+\":\"+appConfig.Api.Port, nil))\n}", "title": "" }, { "docid": "99dc313cf844e2024c736a9b5c81e8ca", "score": "0.5980867", "text": "func startAppServer (host string, port uint32, context libmc.MCContext) (error) {\t\n\t\n\tGlobalContext = context;\n\n\tcontext.Log (fmt.Sprintf (\"Listening on %s:%d\", host, port), libmc.LogSubSystem_Network, libmc.LogLevel_Message);\t\t\t \n\t\n\tmux := http.NewServeMux();\t\n\tmux.HandleFunc(\"/\", RESTHandler);\n\treturn http.ListenAndServe(fmt.Sprintf(\"%s:%d\", host, port), handlers.CompressHandler(mux));\t\n}", "title": "" }, { "docid": "00fb2b306b39c0eb11c8afedceccaec6", "score": "0.59775454", "text": "func StartServer(port int, autoTLS bool) error {\n\tsrvAddress := fmt.Sprintf(\":%s\", strconv.Itoa(port))\n\te := echo.New()\n\te.Use(middleware.Recover())\n\te.Use(middleware.Logger())\n\taddHandlers(e)\n\tvar err error\n\tif autoTLS {\n\t\te.AutoTLSManager.Cache = autocert.DirCache(\"/var/www/.cache\")\n\t\terr = e.StartAutoTLS(srvAddress)\n\t} else {\n\t\terr = e.Start(srvAddress)\n\t}\n\te.Logger.Fatal(err)\n\n\treturn err\n}", "title": "" }, { "docid": "ab1af253faa653ef57952ab2f563e3bf", "score": "0.59751713", "text": "func (s *MockServersServiceImp) Start(cfg *models.StartMockServerRequestBody) error {\n\tvar err error\n\tswitch cfg.Protocol {\n\tcase constants.TCP:\n\t\terr = s.StartTCPServer(cfg.Port, cfg.Protocol)\n\tcase constants.UDP:\n\t\terr = s.StartUDPServer(cfg.Port, cfg.Protocol)\n\tcase constants.HTTP:\n\t\terr = s.StartHTTPServer(cfg.Port, cfg.Protocol)\n\tcase constants.HTTPS:\n\t\terr = s.StartHTTPSServer(cfg.Port, cfg.Protocol, cfg.Cert, cfg.Key)\n\tdefault:\n\t\terr = errors.New(\"unsupported protocol\")\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "09c7f983ef83a815f48f9070586168df", "score": "0.5971648", "text": "func (s *Server) Start() error {\n\ts.Init()\n\thttp.HandleFunc(apiURL, s.apiHandler)\n\t//\thttp.HandleFunc(mainPageURL, s.mainPageHandler)\n\thttp.HandleFunc(\"/\", s.defaultHandler)\n\tlog.Printf(\"Listening on port %d...\", s.Port)\n\treturn http.ListenAndServe(fmt.Sprintf(\":%d\", s.Port), nil)\n}", "title": "" }, { "docid": "b0ebe5437f66674be3b36f86ffe76fd1", "score": "0.5968267", "text": "func (s *Server) Start() {\n\t// mux := http.NewServeMux()\n\tchiRouter := chi.NewRouter()\n\n\tchiRouter.Use(middleware.RequestID)\n\tchiRouter.Use(middleware.RealIP)\n\tchiRouter.Use(s.ZapLogger)\n\n\tchiRouter.Get(\"/\", s.HelloServer)\n\tchiRouter.Get(\"/healthz\", s.HealthCheck)\n\tchiRouter.Get(\"/unhealthz\", s.UnhealthCheck)\n\n\t// By listening outside of the serve goroutine we\n\t// avoid a race condition in our tests\n\tlistener, err := net.Listen(\"tcp\", s.Addr)\n\tif err != nil {\n\t\ts.Deps.Logger.Fatal(err.Error())\n\t}\n\n\ts.server = &http.Server{\n\t\tAddr: s.Addr,\n\t\tHandler: chiRouter,\n\t\tWriteTimeout: 30 * time.Second,\n\t\tReadTimeout: 30 * time.Second,\n\t}\n\n\tgo func() {\n\t\terr := s.server.Serve(listener)\n\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\ts.Deps.Logger.Error(err.Error())\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "31bfa734d88eedbcd8b325f63fbdd2b2", "score": "0.5951744", "text": "func StartServer(config Config) {\n\tmux := http.NewServeMux()\n\tchain := alice.New(corsHandler)\n\tmux.Handle(config.URLPrefix+\"/api/status\", chain.Then(syncStatus()))\n\tmux.Handle(config.URLPrefix+\"/api/sync\", chain.Then(sync()))\n\tmux.Handle(config.URLPrefix+\"/api/files\", chain.Then(listFiles()))\n\tmux.Handle(config.URLPrefix+\"/api/files/content\", chain.Then(getFileContent()))\n\tmux.Handle(\"/\", handleUnsupportedEndpoint(config))\n\n\tfmt.Printf(\"Starting server at %s. Prefix: %v\\n\", config.URL, config.URLPrefix)\n\n\tserver := &http.Server{Addr: config.URL, Handler: mux}\n\tgo func() {\n\t\tif err := server.ListenAndServe(); err != nil {\n\t\t\tif err != http.ErrServerClosed {\n\t\t\t\tlog.Printf(\"err: %v\", err.Error())\n\t\t\t}\n\t\t}\n\t}()\n\n\tc := make(chan os.Signal, 1)\n\n\tsignal.Notify(c, syscall.SIGTERM, os.Interrupt)\n\n\t// Block until any signal is received\n\ts := <-c\n\tlog.Println(\"Got signal:\", s)\n\n\tif err := server.Shutdown(context.Background()); err != nil {\n\t\tlog.Printf(\"error shutting down: %v\", err.Error())\n \t} else {\n\t\tlog.Printf(\"Shut down server\")\n\t}\n}", "title": "" }, { "docid": "01a549d21f71eb18cb023ac2bc498e56", "score": "0.5946278", "text": "func StartServer(server *http.Server, appCtxCancel func()) {\n\terr := server.ListenAndServe()\n\tif err != nil {\n\t\tlog.Logger.Warn(err.Error())\n\t\tappCtxCancel()\n\t}\n}", "title": "" }, { "docid": "9561157c3fb5c47d6d997f8784a8736f", "score": "0.5939717", "text": "func StartServer(s *grpc.Server, ts *topo.Server) {\n\tvtctlservicepb.RegisterVtctldServer(s, NewVtctldServer(ts))\n}", "title": "" }, { "docid": "18af77aad3a058d08aed5f04ea1ee136", "score": "0.5936852", "text": "func StartServer(s *discordgo.Session, m *discordgo.MessageCreate) {\n\tif(*R) {\n\t\ts.ChannelMessageSend(m.ChannelID, \"Factorio Server is already running!\")\n\t\treturn\n\t}\n\tif(!*R && Stopped) {\n\t\tStopped = false\n\t\treturn\n\t}\n\n\ts.ChannelMessageSend(m.ChannelID, \"FactoCord's running/stopped state for Factorio Server is invalid!\")\n}", "title": "" }, { "docid": "d8e2ccb82a5369603daf575943e45c33", "score": "0.5933623", "text": "func StartServer() {\n\thttp.HandleFunc(\"/board\", getBoard)\n\thttp.HandleFunc(\"/boats\", getBoats)\n\thttp.HandleFunc(\"/hit\", postHit)\n\thttp.ListenAndServe(\":\"+ ownPort, nil)\n}", "title": "" }, { "docid": "13d2a11a2a4d498e572502a3a621acd1", "score": "0.59261006", "text": "func StartServer(zipKinServer string) error {\n\treporter := logreporter.NewReporter(zipKinServer+\"/api/v2/spans\",\n\t\t/* */ logreporter.Timeout(time.Second),\n\t\t/* */ logreporter.Logger(log.New(os.Stderr, \"\", log.LstdFlags)))\n\tendpoint, err := zipkin.NewEndpoint(\"mailAssistant\", \"localhost:8080\")\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\ttracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint), zipkin.WithSharedSpans(true))\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tsrvMiddleware := zipkinhttp.NewServerMiddleware(tracer, zipkinhttp.TagResponseSize(true))\n\t//\n\tjob := jobMonitoring{tracer, zipkin.RemoteEndpoint(endpoint)}\n\t//\n\trouter := mux.NewRouter()\n\trouter.Methods(\"GET\").Path(\"/metrics\").HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\tspan := tracer.StartSpan(\"metrics\", job.SpanOption)\n\t\tpromhttp.Handler().ServeHTTP(writer, request)\n\t\tspan.Finish()\n\t})\n\trouter.Methods(\"GET\").Path(\"/\").Headers(\"Accept\", \"application/json\").HandlerFunc(job.applicationJSON)\n\trouter.Methods(\"GET\").Path(\"/\").Headers(\"Accept\", \"text/yaml\").HandlerFunc(job.textYAML)\n\trouter.Methods(\"GET\").Path(\"/\").HandlerFunc(job.textPlain)\n\trouter.Methods(\"GET\").Path(\"/fire\").Queries(\"name\", \"{name:.*}\").HandlerFunc(job.runJob)\n\trouter.Methods(\"GET\").Path(\"/fire\").HandlerFunc(job.missingJobName)\n\trouter.Methods(\"GET\").Path(\"/favicon.ico\").HandlerFunc(job.favicon)\n\t//\n\tserver := http.Server{Addr: \":8080\", Handler: srvMiddleware(router)}\n\tserver.SetKeepAlivesEnabled(true)\n\t//\n\tgo func() {\n\t\tif err := server.ListenAndServe(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\tgo func() {\n\t\tcntl.WaitForNotify()\n\t\tserver.Close()\n\t\treporter.Close()\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "a3245fc84fbd756b0746852a22020fff", "score": "0.5922268", "text": "func StartServer() {\n\thttp.HandleFunc(\"/task\", TaskUsersAPIHandler)\n\thttp.HandleFunc(\"/registeruser\", RegisterUserHandler)\n\thttp.HandleFunc(\"/task/userinfo\", UserInformationHandler)\n\thttp.HandleFunc(\"/task/user/login\", AuthenticateUserHandler)\n\thttp.HandleFunc(\"/task/user/tasks\", GetAllTasksForUserHandler)\n\thttp.ListenAndServe(\"localhost:1952\", util.BaseHTTPLog(http.DefaultServeMux))\n}", "title": "" }, { "docid": "2cda0534b053d738ba46239052209cc9", "score": "0.5914433", "text": "func StartAPI(port string) {\n\t// create api server - gin framework\n\tr := gin.New()\n\n\t// REST_USER\n\t// new identity register information\n\tr.GET(identity.RouteUserInfo, adapterUsersInfo)\n\t// new identity register information\n\tr.POST(identity.RegisterRoute, adapterRegisterService)\n\t// trigger identity register\n\tr.POST(identity.SendRegisterRoute+ \"/:userEndpoint\" , adapterSendRegisterToService)\n\t// trigger identity unregister from other identity services\n\tr.POST(identity.UnRegisterRoute, adapterUnRegisterFromService)\n\t// trigger identity unregister from other identity services\n\tr.POST(identity.SendUnRegisterRoute, adapterSendUnRegisterToServices)\n\n\t// REST_ELECTION\n\t// election algorithm endpoint\n\tr.POST(election.RouteElection, adapterElectionMessage)\n\t// start election algorithm endpoint\n\tr.POST(election.StartRouteElection, adapterStartElectionMessage)\n\t// start test election with static input\n\tr.POST(election.StartStaticRouteElection, adapterStartStaticElectionMessage)\n\n\t// REST_MUTEX\n\t// mutex message endpoint\n\tr.POST(mutex.RouteMutexMessage, adapterMutexMessage)\n\t// mutex state message endpoint\n\tr.GET(mutex.RouteMutexState, adapterMutexStateMessage)\n\n\t// start api server\n\terr := r.Run(\":\" + port)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"[api.StartAPI] Error running server with error %s\", err)\n\t}\n}", "title": "" }, { "docid": "59772fdcb909ad7879c9a7c1cc9e2c2d", "score": "0.5910552", "text": "func StartServer(deps *shared.Deps, wg *sync.WaitGroup, fatalError chan error) error {\n\taddress := deps.Config.Get().Server.GRPC.Address\n\n\tvar server *grpc.Server\n\t// Add required opts\n\trecoveryOpts := []grpc_recovery.Option{\n\t\tgrpc_recovery.WithRecoveryHandler(handlePanic),\n\t}\n\n\n\n\topts := []grpc.ServerOption{\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(\n\t\t\tgrpc_recovery.UnaryServerInterceptor(recoveryOpts...),\n\t\t)),\n\t}\n\n\t// Creates new GRPC server\n\tserver = grpc.NewServer(opts...)\n\n\tregisterService(server, deps)\n\n\t// Creates TCP listener at a particular port\n\tlis, err := net.Listen(grpcNetwork, address)\n\tif err != nil {\n\t\tnewErr := errors.NewInternalError(err).SetCode(\"APIS.GRPC.LISTENER_FAILED\")\n\t\tfatalError <- newErr\n\t}\n\n\t// Logs server address\n\tlog.Debug(\"GRPC Server listening on : \" + address + \", Version: \" + shared.VERSION)\n\n\t// Links server to the listener\n\terr = server.Serve(lis)\n\tif err != nil {\n\t\tnewErr := errors.NewInternalError(err).SetCode(\"APIS.GRPC.LISTENER_LINK_FAILED\")\n\t\tfatalError <- newErr\n\t}\n\n\t// Go routine finished (can also be deferred)\n\twg.Done()\n\n\treturn nil\n}", "title": "" }, { "docid": "f8601f24fc3dab0eb15e2804c4f0dcac", "score": "0.59014606", "text": "func StartServer(url string) {\n\tsockets.set = make(map[*websocket.Conn]bool)\n\n\trouter := initRouter()\n\tserver := http.Server{\n\t\tHandler: router,\n\t\tAddr: url,\n\t\tWriteTimeout: writeTimeout * time.Second,\n\t\tReadTimeout: readTimeout * time.Second,\n\t}\n\thttp2.ConfigureServer(&server, &http2.Server{})\n\tlog.Println(\"Starting server at\", server.Addr)\n\tif err := server.ListenAndServe(); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "c858737b6154ffc1199397b9ef7fd815", "score": "0.5899454", "text": "func Start() {\n\tif runtime.NumCPU() > 4 {\n\t\truntime.GOMAXPROCS(4)\n\t}\n\n\t//Appni e'lon qilish funksiyasi\n\tconfig := fiber.Config{ServerHeader: \"AppTest server\"}\n\tif runtime.NumCPU() > 1 {\n\t\tconfig.Prefork = true\n\t}\n\tapp := fiber.New(config)\n\n\t// So'rovlarga yuboriladigan natijalarni compress qilish methodini qo'shish\n\tapp.Use(compress.New(compress.Config{\n\t\tLevel: compress.LevelBestSpeed, // 1\n\t}))\n\n\t//Cross site so'rovlari uchun CORS ni ochish methodini qo'shish\n\tapp.Use(cors.New(cors.Config{\n\t\tAllowOrigins: \"*\",\n\t\tAllowHeaders: \"Origin, Content-Type, Accept\",\n\t\tAllowMethods: \"GET,POST,OPTIONS,PUT,DELETE\",\n\t}))\n\n\t// Agar serverda panic hodisasi sodir bo'lsa server o'zini qayta ishga tushirish methodini qo'shish\n\tapp.Use(recover.New())\n\n\t//Serverning routerlarini qo'shib chiqish\n\n\tlog.Fatalln(app.Listen(\":3000\"))\n}", "title": "" }, { "docid": "6a796139a976fe2ec70161ff60b3caa6", "score": "0.58993804", "text": "func (s *APIServer) Start() error {\n\tif s.EtcdURL == nil {\n\t\treturn fmt.Errorf(\"expected EtcdURL to be configured\")\n\t}\n\n\tvar err error\n\n\ts.processState = &internal.ProcessState{}\n\n\ts.processState.DefaultedProcessInput, err = internal.DoDefaulting(\n\t\t\"kube-apiserver\",\n\t\ts.URL,\n\t\ts.CertDir,\n\t\ts.Path,\n\t\ts.StartTimeout,\n\t\ts.StopTimeout,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Defaulting the secure port\n\tif s.SecurePort == 0 {\n\t\ts.SecurePort, _, err = addr.Suggest()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.processState.HealthCheckEndpoint = \"/healthz\"\n\n\ts.URL = &s.processState.URL\n\ts.CertDir = s.processState.Dir\n\ts.Path = s.processState.Path\n\ts.StartTimeout = s.processState.StartTimeout\n\ts.StopTimeout = s.processState.StopTimeout\n\n\ts.processState.Args, err = internal.RenderTemplates(\n\t\tinternal.DoAPIServerArgDefaulting(s.Args), s,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.processState.Start(s.Out, s.Err)\n}", "title": "" }, { "docid": "4bf0562e8645f0cc092a24d6d4d28623", "score": "0.5890249", "text": "func (s *ImmuGwServer) Start() error {\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tcliOpts := &immuclient.Options{\n\t\tDir: s.Options.Dir,\n\t\tAddress: s.Options.ImmudbAddress,\n\t\tPort: s.Options.ImmudbPort,\n\t\tHealthCheckRetries: 1,\n\t\tMTLs: s.Options.MTLs,\n\t\tMTLsOptions: s.Options.MTLsOptions,\n\t\tAuth: true,\n\t\tConfig: \"\",\n\t}\n\n\tic, err := immuclient.NewImmuClient(cliOpts)\n\tif err != nil {\n\t\ts.Logger.Errorf(\"unable to instantiate client: %s\", err)\n\t\treturn err\n\t}\n\tmux := runtime.NewServeMux()\n\n\thandler := cors.Default().Handler(mux)\n\n\tsh := NewSetHandler(mux, ic)\n\tssh := NewSafesetHandler(mux, ic)\n\tsgh := NewSafegetHandler(mux, ic)\n\thh := NewHistoryHandler(mux, ic)\n\tsr := NewSafeReferenceHandler(mux, ic)\n\tsza := NewSafeZAddHandler(mux, ic)\n\n\tmux.Handle(http.MethodPost, schema.Pattern_ImmuService_Set_0(), sh.Set)\n\tmux.Handle(http.MethodPost, schema.Pattern_ImmuService_SafeSet_0(), ssh.Safeset)\n\tmux.Handle(http.MethodPost, schema.Pattern_ImmuService_SafeGet_0(), sgh.Safeget)\n\tmux.Handle(http.MethodGet, schema.Pattern_ImmuService_History_0(), hh.History)\n\tmux.Handle(http.MethodPost, schema.Pattern_ImmuService_SafeReference_0(), sr.SafeReference)\n\tmux.Handle(http.MethodPost, schema.Pattern_ImmuService_SafeZAdd_0(), sza.SafeZAdd)\n\n\terr = schema.RegisterImmuServiceHandlerClient(ctx, mux, *ic.GetServiceClient())\n\tif err != nil {\n\t\ts.Logger.Errorf(\"unable to register client handlers: %s\", err)\n\t\treturn err\n\t}\n\n\ts.installShutdownHandler()\n\ts.Logger.Infof(\"starting immugw: %v\", s.Options)\n\tif s.Options.Pidfile != \"\" {\n\t\tif s.Pid, err = server.NewPid(s.Options.Pidfile); err != nil {\n\t\t\ts.Logger.Errorf(\"failed to write pidfile: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif s.Options.Audit {\n\t\tdefaultAuditor, err := auditor.DefaultAuditor(\n\t\t\ts.Options.AuditInterval,\n\t\t\tfmt.Sprintf(\"%s:%d\", s.Options.ImmudbAddress, s.Options.ImmudbPort),\n\t\t\tcliOpts.DialOptions,\n\t\t\ts.Options.AuditUsername,\n\t\t\ts.Options.AuditPassword,\n\t\t\tcache.NewHistoryFileCache(filepath.Join(cliOpts.Dir, \"auditor\")),\n\t\t\tMetrics.UpdateAuditResult,\n\t\t\tnil)\n\t\tif err != nil {\n\t\t\ts.Logger.Errorf(\"unable to create auditor: %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tauditorDone := make(chan struct{})\n\t\tgo defaultAuditor.Run(s.Options.AuditInterval, false, ctx.Done(), auditorDone)\n\t\tdefer func() { <-auditorDone }()\n\t}\n\n\tgo func() {\n\t\tif err = http.ListenAndServe(s.Options.Address+\":\"+strconv.Itoa(s.Options.Port), handler); err != nil && err != http.ErrServerClosed {\n\t\t\ts.Logger.Errorf(\"unable to launch immugw: %+s\", err)\n\t\t}\n\t}()\n\n\tmetricsServer := StartMetrics(\n\t\ts.Options.MetricsBind(),\n\t\ts.Logger,\n\t\tfunc() float64 { return time.Since(startedAt).Hours() },\n\t)\n\tdefer func() {\n\t\tif err = metricsServer.Close(); err != nil {\n\t\t\ts.Logger.Errorf(\"failed to shutdown metric server: %s\", err)\n\t\t}\n\t}()\n\tstartedAt = time.Now()\n\t<-s.quit\n\tif s.Options.Audit {\n\t\tcancel()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "27d20d44816ae43a8d1103ab5d7ffbb7", "score": "0.5880678", "text": "func (s *server) Start(ctx context.Context) {\n\t// Create Router for HTTP Server\n\trouter := SetupRouter(s.RESTHandler, s.Config.Prometheus, s.Config.Authentication.JWT)\n\t\n\t// // Start Nats Worker\n\t// err := s.NatsHandler.Start(ctx)\n\t// if err != nil {\n\t// \tx, ok := err.(WithKindContextError)\n\t// \tif ok {\n\t// \t\tfields := logrus.Fields{}\n\t// \t\tfor k, v := range x.Context() {\n\t// \t\t\tfields[k] = fmt.Sprintf(\"%v\", v)\n\t// \t\t}\n\t// \t\ts.Logger.WithFields(fields).Error(err.Error())\n\t// \t} else {\n\t// \t\ts.Logger.Error(err.Error())\n\t// \t}\n\t//\n\t// }\n\t\n\t// Start REST Server in Blocking mode\n\ts.RESTHandler.Start(ctx, router, s.Config.Port)\n}", "title": "" }, { "docid": "da846daa9871b66c2ff340ddca7376ba", "score": "0.58710647", "text": "func StartServer() {\n\t// #region Setup global dependencies\n\tdb := GetDatabase(&DatabaseOptions{\n\t\tPath: \"data.db\",\n\t})\n\tdefer db.Close()\n\n\tsessionManager := GetSessionManager(db, &SessionManagerOptions{\n\t\tStorePrefix: \"session:\",\n\t\tCookieName: \"sessionid\",\n\t})\n\n\tvalidator := GetValidator()\n\t// #endregion Setup global dependencies\n\n\t// #region setup routes and global middleware\n\tapp := chi.NewRouter()\n\tapp.Use(chiMiddleware.Logger)\n\tapp.Use(chiMiddleware.Recoverer)\n\tapp.Use(middleware.SetContext(map[globals.ContextKey]interface{}{\n\t\tglobals.DBContext: db,\n\t\tglobals.SessionContext: sessionManager,\n\t\tglobals.ValidatorContext: validator,\n\t}))\n\tapp.Use(middleware.BadgerDB(db))\n\tapp.Use(sessionManager.LoadAndSave)\n\tsetupRoutes(app)\n\t// #endregion setup routes and global middleware\n\n\t// #region Setup server\n\tlogger := log.New(os.Stdout, \"http: \", log.LstdFlags)\n\taddr := \":8080\"\n\tserver := &http.Server{\n\t\tAddr: addr,\n\t\tHandler: app,\n\t\tErrorLog: logger,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tIdleTimeout: 15 * time.Second,\n\t}\n\t// #endregion Setup server\n\n\t// #region Graceful shutdown with [ctrl] + [c]\n\tdone := make(chan bool, 1)\n\tquit := make(chan os.Signal, 1)\n\n\tsignal.Notify(quit, os.Interrupt)\n\n\tgo func() {\n\t\t<-quit\n\t\tlogger.Println(\"Server is shutting down...\")\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\t\tdefer cancel()\n\n\t\tserver.SetKeepAlivesEnabled(false)\n\t\tif err := server.Shutdown(ctx); err != nil {\n\t\t\tlogger.Fatalf(\"Could not gracefully shutdown the server: %v\\n\", err)\n\t\t}\n\n\t\tclose(done)\n\t}()\n\n\tlogger.Println(\"Server is ready to handle requests at\", addr)\n\tif err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\tlog.Fatalf(\"Could not start server on addr \\\"%s\\\": %v\", addr, err)\n\t}\n\n\t<-done\n\tlogger.Println(\"Server stopped\")\n\t// #endregion Graceful shutdown with [ctrl] + [c]\n}", "title": "" }, { "docid": "12d7108804111da319d8cc4075d20d92", "score": "0.58692664", "text": "func startApiServer(srv *http.Server) {\n\n log.Printf(\"API: Starting built-in HTTP server on %s\", srv.Addr)\n\n if debug {\n log.Printf(\" - Using Server Pointer [%p]\", &srv)\n }\n\n log.Fatal(srv.ListenAndServe())\n\n}", "title": "" }, { "docid": "49ac0ca1bfedcfd18729c848433ba219", "score": "0.58573335", "text": "func StartServer(cfgFile string) error {\n\tcfg, err := config.LoadConfig(cfgFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Load config failed: %v\", err)\n\t}\n\ts, err := NewWebServer(cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"NewWebServer failed: %v\", err)\n\t}\n\terr = s.Start()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Start WebServer failed: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94ee609eca3ebd7cd987b0128874d71f", "score": "0.58512664", "text": "func Start() {\n\n\tfmt.Println(\"Server start\")\n\n\tPORT := os.Getenv(\"API_PORT\")\n\n\tif PORT == \"\" {\n\t\tPORT = \"3000\"\n\t}\n\n\trouter := handler.New()\n\n\ts := &http.Server{\n\t\tAddr: \":\" + PORT,\n\t\tHandler: router.Router(),\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t}\n\n\terr := s.ListenAndServe()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "2ae272804d35594343c78b1df6cd659d", "score": "0.5847518", "text": "func (s *Server) Start() error {\n\terr := s.server.Run(\":\" + s.config.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51ac7d99f0b67c7c6f23670251b4e0b6", "score": "0.58422524", "text": "func (c *Client) StartServer(id string) error {\n\tvalues := url.Values{\n\t\t\"SUBID\": {id},\n\t}\n\n\tif err := c.post(`server/start`, values, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d252a5b7ff6c25523bada8912a233c7d", "score": "0.58407885", "text": "func (s *Server) Start() {\n\t// Set the router\n\ts.SetRouter()\n\n\t// Set the routes\n\ts.SetRoutes()\n\n\t// Launch the server\n\ts.Instance = &http.Server{\n\t\tHandler: s.Router,\n\t\tAddr: s.Address,\n\t\tWriteTimeout: s.WriteTimeout,\n\t\tReadTimeout: s.ReadTimeout,\n\t}\n\n\t// Listen and serve\n\tlog.Fatal(s.Instance.ListenAndServe())\n}", "title": "" }, { "docid": "06bbe9ee90a01c579b17c43351eb7258", "score": "0.58367693", "text": "func Start(){\n\terr := server.ListenAndServe()\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "title": "" }, { "docid": "529ba58afcaccef0c7daa04fdb9fac04", "score": "0.5833536", "text": "func (s *Server) Start() error {\n\ts.router = newRouter(s.conf.serverPort)\n\ts.router.setup().Run(s.conf.serverPort)\n\n\treturn nil\n}", "title": "" }, { "docid": "1e3b93378a214bb2c3178aced4c55748", "score": "0.58282673", "text": "func (s *Server) Start() {\n\tlogger.Info(\"Starting darkroom server\")\n\n\tif s.hook != nil {\n\t\ts.hook.initFunc()\n\t\tdefer s.hook.deferFunc()\n\t}\n\n\tportInfo := fmt.Sprintf(\":%d\", config.Port())\n\tserver := &http.Server{Addr: portInfo, Handler: s.handler}\n\n\tgo listenServer(server)\n\twaitForShutdown(server)\n}", "title": "" }, { "docid": "04eceb6e51542a0351da4a049e358cea", "score": "0.58252054", "text": "func StartServer(env env, port string) {\n\n\trouter := mux.NewRouter().StrictSlash(true)\n\tfor _, route := range routes {\n\t\tvar handler http.Handler\n\n\t\thandler = makeHandler(env, route.HandlerFunc)\n\n\t\trouter.\n\t\t\tMethods(route.Method).\n\t\t\tPath(route.Pattern).\n\t\t\tName(route.Name).\n\t\t\tHandler(handler)\n\n\t}\n\n\tn := negroni.Classic()\n\tn.Use(env.Metrics)\n\tn.UseHandler(router)\n\n\tn.Run(\":\" + port)\n}", "title": "" }, { "docid": "2efabc547b8773c804c1acf871b769eb", "score": "0.5823131", "text": "func Start() error {\n\tr := setupRouter()\n\treturn r.Run(app.Cfg.WebServer)\n}", "title": "" }, { "docid": "c1ba37f5a3d1a7c9bb3006086cc8905e", "score": "0.58191365", "text": "func startServer() {\n\n\t// Create echo server instance\n\te := echo.New()\n\n\t// Routes\n\te.GET(\"/\", returnData)\n\te.GET(\"/health\", returnHealth)\n\n\t// Start server\n\tlogrus.StandardLogger().Fatal(e.Start(serverEndpoint))\n}", "title": "" }, { "docid": "ab07f0b3e4a4e3d88fa6eb4579f5ca71", "score": "0.5815548", "text": "func (a *API) Start() error {\n\ta.Server = &http.Server{\n\t\tAddr: a.Config.Address,\n\t\tHandler: a.Gin,\n\t}\n\treturn a.Server.ListenAndServe()\n}", "title": "" }, { "docid": "afe38515b20d9b7bca595121643b85b4", "score": "0.5809384", "text": "func startServer() {\n\tgo main()\n}", "title": "" }, { "docid": "cf0f78ecf1d4c8b128b1b656be07b0f2", "score": "0.58091563", "text": "func startServer() error {\n\texe, err := os.Executable()\n\tif err != nil {\n\t\treturn err\n\t}\n\targs := []string{\"-server\"}\n\targs = append(args, os.Args[1:]...)\n\tcmd := exec.Command(exe, args...)\n\tlog.Printf(\"starting server: %s\", strings.Join(cmd.Args, \" \"))\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\tif err := cmd.Process.Release(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef18c9b0a9e75953228c7f0c5626c56f", "score": "0.580906", "text": "func StartServer() int {\n\tservice := \":2000\"\n\t//server := rpc.NewServer()\n\t//localNode := new(Servable)\n\t//server.Register(localNode)\n\n\t//server.HandleHTTP(rpc.DefaultRPCPath, rpc.DefaultDebugPath)\n\tfmt.Println(\"Prepare listen on port \" + service)\n\tl, e := net.Listen(\"tcp\", service)\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tdefer l.Close()\n\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tgo handle(conn)\n\t}\n\n\tfmt.Println(\"Close \" + l.Addr().String())\n\treturn 0\n}", "title": "" }, { "docid": "0cb78e07307bc3f62db1869bd78c3279", "score": "0.57997465", "text": "func StartServer() {\n\tInfo.Println(\"Starting HTTP server...\")\n\tInfo.Println(\"Building response...\")\n\tResponse = BuildUsage()\n\tgo UpdateJSON()\n\thttp.HandleFunc(\"/usage\", totalUsage)\n\tError.Panicln(http.ListenAndServe(\":\"+Port, nil))\n}", "title": "" }, { "docid": "9b5b6de5ca24ebefe7dbb1684f81b668", "score": "0.57895905", "text": "func StartServer(loggerName string) *Server {\n\ts := Server{\n\t\t// default prometheus.Registerer\n\t\tGRPCOpts: loop.SetupTelemetry(nil),\n\t}\n\n\tlggr, err := loop.NewLogger()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to create logger: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tlggr = logger.Named(lggr, loggerName)\n\ts.Logger = logger.Sugared(lggr)\n\n\tenvCfg, err := GetEnvConfig()\n\tif err != nil {\n\t\tlggr.Fatalf(\"Failed to get environment configuration: %s\\n\", err)\n\t}\n\ts.PromServer = NewPromServer(envCfg.PrometheusPort(), lggr)\n\terr = s.PromServer.Start()\n\tif err != nil {\n\t\tlggr.Fatalf(\"Unrecoverable error starting prometheus server: %s\", err)\n\t}\n\n\ts.Checker = services.NewChecker()\n\terr = s.Checker.Start()\n\tif err != nil {\n\t\tlggr.Fatalf(\"Failed to start health checker: %v\", err)\n\t}\n\n\treturn &s\n}", "title": "" }, { "docid": "cfbf8e5d2bebb1f1d620e396f65ca3bc", "score": "0.5784034", "text": "func StartMagmadServer() error {\n\tsrv, err := service.NewServiceWithOptions(\"\", strings.ToUpper(definitions.MagmadServiceName))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating '%s' service: %v\", definitions.MagmadServiceName, err)\n\t}\n\tprotos.RegisterMagmadServer(srv.GrpcServer, NewMagmadService())\n\tglog.Infof(\"starting '%s' Service\", definitions.MagmadServiceName)\n\terr = srv.Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error starting '%s' service: %s\", definitions.MagmadServiceName, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a4db7893b8a0c79f416d09340a8d2e7", "score": "0.578146", "text": "func (ctx *ServerContext) StartServer(address string) {\n\thttp.ListenAndServe(address, ctx.Router)\n}", "title": "" }, { "docid": "1d8d0f0214485f5655ef88f99415cc01", "score": "0.57794416", "text": "func StartServer() {\n\n\t// Initialise the handle func for each link\n\thttp.HandleFunc(\"/\", index)\n\thttp.HandleFunc(\"/signup\", signup)\n\thttp.HandleFunc(\"/edituser\", edituser)\n\thttp.HandleFunc(\"/deleteuser\", deleteuser)\n\thttp.HandleFunc(\"/addorder\", addorder)\n\thttp.HandleFunc(\"/editorder\", editorder)\n\thttp.HandleFunc(\"/vieworders\", vieworders)\n\thttp.HandleFunc(\"/completeorder\", completeorder)\n\thttp.HandleFunc(\"/pizzasales\", pizzasales)\n\thttp.HandleFunc(\"/addpizza\", addpizza)\n\thttp.HandleFunc(\"/editpizza\", editpizza)\n\thttp.HandleFunc(\"/deletepizza\", deletepizza)\n\thttp.HandleFunc(\"/viewpizza\", viewpizza)\n\thttp.HandleFunc(\"/logout\", logout)\n\n\thttp.Handle(\"/favicon.ico\", http.NotFoundHandler())\n\n\t// Set the listen port\n\terr := http.ListenAndServeTLS(\":5221\", \"certs//cert.pem\", \"certs//key.pem\", nil)\n\tif err != nil {\n\t\tlog.Fatal(\"FATAL: ListenAndServeTLS - \", err)\n\t}\n\n\t// Defer file closure to the end\n\tdefer file.Close()\n\n}", "title": "" }, { "docid": "9d6c75c27ebe47778887fb02bec87317", "score": "0.5773204", "text": "func (e *Eweb) StartServer(s *http.Server) (err error) {\n\ts.ErrorLog = stdLog.New(os.Stderr, \"\", stdLog.LstdFlags)\n\ts.Handler = e\n\n\tkl, err := newListener(s.Addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// for http server\n\tif s.TLSConfig != nil {\n\t\t// https\n\t\treturn s.Serve(tls.NewListener(kl, s.TLSConfig))\n\t}\n\treturn s.Serve(kl)\n\n}", "title": "" }, { "docid": "8db4ea68ba32b0379f2664dbba80e44e", "score": "0.5768035", "text": "func Start() {\n\trouter().Run(\":8080\")\n}", "title": "" }, { "docid": "933844a319a9a68dd1fe76a75ebec131", "score": "0.57661283", "text": "func startServer(caPath string, keyPath string, certPath string, port int) error {\n\ts := service.NewServer(service.NewServerConfig(caPath, keyPath, certPath, int16(port), false))\n\ts.AddService(_map.Service{})\n\ts.AddService(session.Service{})\n\ts.AddService(counter.Service{})\n\ts.AddService(list.Service{})\n\n\treturn s.Serve(func(started string) {\n\t\tlog.Info(\"Started Redis Proxy Server\", started)\n\t})\n}", "title": "" }, { "docid": "20eddae9e2bdc598f40962457bc59ac5", "score": "0.57650644", "text": "func (s GinServer) Start() {\n\tlogrus.WithFields(logrus.Fields{\"port\": s.port, \"host\": s.host}).Info(\"Listening\")\n\tif err := s.Router.Run(fmt.Sprintf(\"%s:%d\", s.host, s.port)); err != nil {\n\t\tlogrus.WithError(err).Fatal(\"Couldn't start router\")\n\t}\n}", "title": "" }, { "docid": "0ceaa9108c5c9895d4fa0e13817ef50d", "score": "0.57631403", "text": "func startServer() {\n\t// Create new mux instance\n\tmux := http.NewServeMux()\n\n\t// Create new server instance\n\tserver := &http.Server{}\n\n\t// Set up server\n\tserver.Addr = \":\" + *port\n\tserver.Handler = mux\n\tserver.ReadTimeout = time.Duration(DEFAULT_SERVER_TIMEOUT) * time.Second\n\tserver.WriteTimeout = time.Duration(DEFAULT_SERVER_TIMEOUT) * time.Second\n\n\t// Set up server routes\n\tmux.Handle(\"/\", http.HandlerFunc(handle))\n\n\t// Log server start\n\tlog.Infof(\"Server running on port %s\", *port)\n\n\t// Attempt to start the server\n\tgo server.ListenAndServe()\n}", "title": "" } ]
88b1cec321dee862167751fc64d10b52
Decrypt attempts to decrypt the PDF file with a specified password. Also tries to decrypt with an empty password. Returns true if successful, false otherwise. An error is returned when there is a problem with decrypting.
[ { "docid": "6c92fef175bf4164e7df58c50c98689e", "score": "0.79829174", "text": "func (parser *PdfParser) Decrypt(password []byte) (bool, error) {\n\t// Also build the encryption/decryption key.\n\tif parser.crypter == nil {\n\t\treturn false, errors.New(\"check encryption first\")\n\t}\n\n\tauthenticated, err := parser.crypter.authenticate(password)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif !authenticated {\n\t\t// TODO(dennwc): R6 handler will try it automatically, make R4 do the same\n\t\tauthenticated, err = parser.crypter.authenticate([]byte(\"\"))\n\t}\n\n\treturn authenticated, err\n}", "title": "" } ]
[ { "docid": "a30e61555bbe4bc16a8a36726a102e58", "score": "0.6578781", "text": "func Decrypt(password string, inputFilePath string, outputFilePath string) error {\n\t_, err := core.Decrypt(password, inputFilePath, outputFilePath)\n\n\treturn err\n}", "title": "" }, { "docid": "4d93b582dcbf0575f7f1bb6eaed5c95a", "score": "0.6103919", "text": "func (c *Client) DecryptPassword() (string, error) {\n\tif len(c.Password) == 0 || len(c.HandleOrEmail) == 0 {\n\t\treturn \"\", errors.New(\"You have to configure your handle and password by `cf config`\")\n\t}\n\treturn decrypt(c.HandleOrEmail, c.Password)\n}", "title": "" }, { "docid": "4fe128bf50702857046a11efc2a85441", "score": "0.5843776", "text": "func (d Decryptor) Decrypt(bs []byte) ([]byte, error) {\n\tswitch d.Algorithm {\n\tcase \"\", AlgoPBEWithMD5AndDES:\n\t\tif d.Password == \"\" {\n\t\t\treturn nil, ErrEmptyPassword\n\t\t}\n\t\treturn DecryptJasypt(bs, d.Password)\n\t}\n\treturn nil, fmt.Errorf(\"unknown jasypt algorithm\")\n}", "title": "" }, { "docid": "857ee085e62d7395c14e386d67620b17", "score": "0.5781206", "text": "func Decrypt(pfxData []byte, password string) (p *Provider, err error) {\n\tp = &Provider{}\n\n\tvar crt *x509.Certificate\n\tvar ca []*x509.Certificate\n\tif p.key, crt, ca, err = pkcs12.DecodeChain(pfxData, password); err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.chain.Certificate = append(p.chain.Certificate, crt.Raw)\n\tfor _, c := range ca {\n\t\tp.chain.Certificate = append(p.chain.Certificate, c.Raw)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "4fab17918ea26ff941d43bf103b39ef0", "score": "0.5628069", "text": "func Decrypt(message, password string) (string, error) {\n\tvar key [32]byte\n\tcopy(key[:], password)\n\tdecryptedMessage, err := DecryptBytes([]byte(message), key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(decryptedMessage), nil\n}", "title": "" }, { "docid": "67dfcca8b6bf9ff539f2678b601c5656", "score": "0.5559813", "text": "func (d *Decrypter) Decrypt(ciphertext []byte) ([]byte, error) {\n\tif ciphertext == nil {\n\t\treturn nil, fmt.Errorf(\"invalid ciphertext: nil\")\n\t}\n\n\tvar salt [saltLen]byte\n\tcopy(salt[:], ciphertext[:saltLen])\n\n\t// Check our cache to see if we have already calculated the AES key\n\t// as it's expensive.\n\tcipher, ok := d.ciphers[salt]\n\tif !ok {\n\t\taesKey, e := aesKeyFromPasswordAndSalt(d.password, salt[:])\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tdefer func(aesKey []byte) {\n\t\t\tfor i := range aesKey {\n\t\t\t\taesKey[i] = 0\n\t\t\t}\n\t\t}(aesKey)\n\n\t\tcipher, e = xts.NewCipher(aes.NewCipher, aesKey)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\td.ciphers[salt] = cipher\n\t}\n\n\tciphertext = ciphertext[saltLen:]\n\n\tplaintext := make([]byte, len(ciphertext))\n\tcipher.Decrypt(plaintext, ciphertext, xtsSectorNum)\n\ti := 0\n\n\t// Check magic bytes\n\tif bytes.Compare(plaintext[i:i+len(magicBytes)], magicBytes) != 0 {\n\t\treturn nil, fmt.Errorf(\"bad password\")\n\t}\n\ti += len(magicBytes)\n\n\t// Check version\n\tif plaintext[i] > version {\n\t\treturn nil, fmt.Errorf(\"unsupported version: we are version '%d' and the content is version '%d'\", version, plaintext[i])\n\t}\n\ti++\n\n\t// Jump over padding\n\tpaddingLen := plaintext[i]\n\ti += 1 + int(paddingLen)\n\n\tstoredDigest := plaintext[i : i+sha512DigestLen]\n\ti += sha512DigestLen\n\n\tplaintext = plaintext[i:]\n\n\trealDigest := sha512.Sum512(plaintext)\n\tif bytes.Compare(storedDigest, realDigest[:]) != 0 {\n\t\treturn nil, fmt.Errorf(\"message authentication code mismatch: data is corrupted and may have been tampered with\")\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "57bf013e12e9196d6abda560949f041f", "score": "0.5550925", "text": "func TestDecryption1(t *testing.T) {\n\tcrypter := PdfCrypt{\n\t\tencrypt: encryptDict{\n\t\t\tV: 2,\n\t\t\tLength: 128,\n\t\t},\n\t\tencryptStd: security.StdEncryptDict{\n\t\t\tR: 3,\n\t\t\tP: 0xfffff0c0,\n\t\t\tEncryptMetadata: true,\n\t\t\tO: []byte{0xE6, 0x00, 0xEC, 0xC2, 0x02, 0x88, 0xAD, 0x8B,\n\t\t\t\t0x0d, 0x64, 0xA9, 0x29, 0xC6, 0xA8, 0x3E, 0xE2, 0x51,\n\t\t\t\t0x76, 0x79, 0xAA, 0x02, 0x18, 0xBE, 0xCE, 0xEA, 0x8B, 0x79, 0x86,\n\t\t\t\t0x72, 0x6A, 0x8C, 0xDB},\n\t\t\tU: []byte{0xED, 0x5B, 0xA7, 0x76, 0xFD, 0xD8, 0xE3, 0x89,\n\t\t\t\t0x4F, 0x54, 0x05, 0xC1, 0x3B, 0xFD, 0x86, 0xCF, 0x00, 0x00, 0x00,\n\t\t\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t\t\t0x00, 0x00},\n\t\t},\n\t\tid0: string([]byte{0x5f, 0x91, 0xff, 0xf2, 0x00, 0x88, 0x13,\n\t\t\t0x5f, 0x30, 0x24, 0xd1, 0x0f, 0x28, 0x31, 0xc6, 0xfa}),\n\t\t// Default algorithm is V2 (RC4).\n\t\tcryptFilters: newCryptFiltersV2(128),\n\t\tdecryptedObjects: make(map[PdfObject]bool),\n\t}\n\n\tstreamData := []byte{0xBC, 0x89, 0x86, 0x8B, 0x3E, 0xCF, 0x24, 0x1C,\n\t\t0xC4, 0x88, 0xF3, 0x60, 0x74, 0x8A, 0x22, 0xE3, 0xAD, 0xF4, 0x48,\n\t\t0x8E, 0x20, 0x94, 0x06, 0x4B, 0x4B, 0xB5, 0x3E, 0x93, 0x89, 0x4E,\n\t\t0x32, 0x38, 0xB4, 0xF6, 0x05, 0x3C, 0x5D, 0x0C, 0x12, 0xE4, 0xEB,\n\t\t0x9B, 0x8D, 0x26, 0x32, 0x7B, 0x09, 0x97, 0xA1, 0xC5, 0x98, 0xF6,\n\t\t0xE7, 0x1C, 0x3B}\n\n\t// Plain text stream (hello world).\n\texp := []byte{0x20, 0x20, 0x42, 0x54, 0x0A, 0x20, 0x20, 0x20, 0x20,\n\t\t0x2F, 0x46, 0x31, 0x20, 0x31, 0x38, 0x20, 0x54, 0x66, 0x0A, 0x20,\n\t\t0x20, 0x20, 0x20, 0x30, 0x20, 0x30, 0x20, 0x54, 0x64, 0x0A, 0x20,\n\t\t0x20, 0x20, 0x20, 0x28, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57,\n\t\t0x6F, 0x72, 0x6C, 0x64, 0x29, 0x20, 0x54, 0x6A, 0x0A, 0x20, 0x20,\n\t\t0x45, 0x54}\n\trawText := \"2 0 obj\\n<< /Length 55 >>\\nstream\\n\" + string(streamData) + \"\\nendstream\\n\"\n\n\tparser := PdfParser{}\n\tparser.xrefs.ObjectMap = make(map[int]XrefObject)\n\tparser.objstms = make(objectStreams)\n\tparser.rs, parser.reader, parser.fileSize = makeReaderForText(rawText)\n\tparser.crypter = &crypter\n\n\tobj, err := parser.ParseIndirectObject()\n\tif err != nil {\n\t\tt.Errorf(\"Error parsing object\")\n\t\treturn\n\t}\n\n\tso, ok := obj.(*PdfObjectStream)\n\tif !ok {\n\t\tt.Errorf(\"Should be stream (is %q)\", obj)\n\t\treturn\n\t}\n\n\tauthenticated, err := parser.Decrypt([]byte(\"\"))\n\tif err != nil {\n\t\tt.Errorf(\"Error authenticating\")\n\t\treturn\n\t}\n\tif !authenticated {\n\t\tt.Errorf(\"Failed to authenticate\")\n\t\treturn\n\t}\n\n\tparser.crypter.Decrypt(so, 0, 0)\n\tif string(so.Stream) != string(exp) {\n\t\tt.Errorf(\"Stream content wrong\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "74e368ea930adb752f4653f58dfcf283", "score": "0.5446994", "text": "func (c *Coffin) Decrypt(data []byte) ([]byte, error) {\n\tswitch c.Mode {\n\tcase CryptCHACHA20:\n\t\treturn c.decryptCHACHA20(data)\n\tcase CryptAES256:\n\t\treturn c.decryptAES256(data)\n\tcase CryptRSA:\n\t\treturn c.decryptRSA(data)\n\tdefault:\n\t\treturn c.decryptCHACHA20(data)\n\t}\n}", "title": "" }, { "docid": "4778768260df4b37ffbd0a6eea6cde57", "score": "0.5378891", "text": "func (k *Filesystem) Decrypt(ctx context.Context, keyID string, ciphertext []byte, aad []byte) ([]byte, error) {\n\tk.mu.RLock()\n\tdefer k.mu.RUnlock()\n\n\t// Figure out which DEK to use\n\tparts := bytes.SplitN(ciphertext, []byte(\":\"), 2)\n\tif len(parts) < 2 {\n\t\treturn nil, fmt.Errorf(\"invalid ciphertext: missing version\")\n\t}\n\tversion, ciphertext := parts[0], parts[1]\n\n\tversionPath := filepath.Join(k.root, keyID, string(version))\n\tdek, err := os.ReadFile(versionPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read encryption key: %w\", err)\n\t}\n\n\tblock, err := aes.NewCipher(dek)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create cipher from dek: %w\", err)\n\t}\n\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create gcm from dek: %w\", err)\n\t}\n\n\tsize := aesgcm.NonceSize()\n\tif len(ciphertext) < size {\n\t\treturn nil, fmt.Errorf(\"malformed ciphertext\")\n\t}\n\tnonce, ciphertextPortion := ciphertext[:size], ciphertext[size:]\n\n\tplaintext, err := aesgcm.Open(nil, nonce, ciphertextPortion, aad)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decrypt ciphertext with dek: %w\", err)\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "edb9479c6fe89cac3bb4625830ee8d2f", "score": "0.53345716", "text": "func Decrypt(key *[KeySize]byte, in []byte) ([]byte, bool) {\r\n\tif len(in) < nonceSize {\r\n\t\treturn nil, false\r\n\t}\r\n\tvar nonce [nonceSize]byte\r\n\tcopy(nonce[:], in)\r\n\treturn secretbox.Open(nil, in[nonceSize:], &nonce, key)\r\n}", "title": "" }, { "docid": "b7713b04d82f1e762bfd3cfc18b36875", "score": "0.53341717", "text": "func decrypt(password []byte, encrypted []byte) ([]byte, error) {\n\tsalt := encrypted[:SaltBytes]\n\tencrypted = encrypted[SaltBytes:]\n\tkey := makeKey(password, salt)\n\n\tblock, err := aes.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err // @todo FailedToDecrypt\n\t}\n\n\tif len(encrypted) < aes.BlockSize {\n\t\t// Cipher is too short\n\t\treturn nil, err // @todo FailedToDecrypt\n\t}\n\n\tiv := encrypted[:aes.BlockSize]\n\tencrypted = encrypted[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\tstream.XORKeyStream(encrypted, encrypted)\n\n\treturn encrypted, nil\n}", "title": "" }, { "docid": "062e75b891a7bda0ffd9d5e447417304", "score": "0.5309596", "text": "func Decrypt(sk, shpe []byte) ([]byte, bool) {\n\n\tvar (\n\t\tdk = sha3.Sum256(sk)\n\t\tkey [32]byte\n\t\tnonce [24]byte\n\t)\n\n\tcopy(key[:], dk[:])\n\n\treturn nacl.Open(nil, shpe, &nonce, &key)\n\n}", "title": "" }, { "docid": "92dbfb62709177ae850b94585affbd64", "score": "0.5226003", "text": "func (parser *PdfParser) IsEncrypted() (bool, error) {\n\tif parser.crypter != nil {\n\t\treturn true, nil\n\t} else if parser.trailer == nil {\n\t\treturn false, nil\n\t}\n\n\tcommon.Log.Trace(\"Checking encryption dictionary!\")\n\te := parser.trailer.Get(\"Encrypt\")\n\tif e == nil {\n\t\treturn false, nil\n\t}\n\tcommon.Log.Trace(\"Is encrypted!\")\n\tvar (\n\t\tdict *PdfObjectDictionary\n\t)\n\tswitch e := e.(type) {\n\tcase *PdfObjectDictionary:\n\t\tdict = e\n\tcase *PdfObjectReference:\n\t\tcommon.Log.Trace(\"0: Look up ref %q\", e)\n\t\tencObj, err := parser.LookupByReference(*e)\n\t\tcommon.Log.Trace(\"1: %q\", encObj)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tencIndObj, ok := encObj.(*PdfIndirectObject)\n\t\tif !ok {\n\t\t\tcommon.Log.Debug(\"Encryption object not an indirect object\")\n\t\t\treturn false, errors.New(\"type check error\")\n\t\t}\n\t\tencDict, ok := encIndObj.PdfObject.(*PdfObjectDictionary)\n\n\t\tcommon.Log.Trace(\"2: %q\", encDict)\n\t\tif !ok {\n\t\t\treturn false, errors.New(\"trailer Encrypt object non dictionary\")\n\t\t}\n\t\tdict = encDict\n\tcase *PdfObjectNull:\n\t\tcommon.Log.Debug(\"Encrypt is a null object. File should not be encrypted.\")\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported type: %T\", e)\n\t}\n\n\tcrypter, err := PdfCryptNewDecrypt(parser, dict, parser.trailer)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// list objects that should never be decrypted\n\tfor _, key := range []string{\"Info\", \"Encrypt\"} {\n\t\tf := parser.trailer.Get(PdfObjectName(key))\n\t\tif f == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch f := f.(type) {\n\t\tcase *PdfObjectReference:\n\t\t\tcrypter.decryptedObjNum[int(f.ObjectNumber)] = struct{}{}\n\t\tcase *PdfIndirectObject:\n\t\t\tcrypter.decryptedObjects[f] = true\n\t\t\tcrypter.decryptedObjNum[int(f.ObjectNumber)] = struct{}{}\n\t\t}\n\t}\n\tparser.crypter = crypter\n\tcommon.Log.Trace(\"Crypter object %b\", crypter)\n\treturn true, nil\n}", "title": "" }, { "docid": "9dafa626cb2f1613a13047ba6f35627c", "score": "0.52240586", "text": "func Decrypt(c []byte, q Poracle, l *log.Logger) (string, error) {\n\tn := len(c) / CipherBlockLen\n\tif n < 2 {\n\t\treturn \"\", ErrInvalidCiphertext\n\t}\n\tif len(c)%CipherBlockLen != 0 {\n\t\treturn \"\", ErrInvalidCiphertext\n\t}\n\t// The clear text have the same length as the cyphertext - 1\n\t// (the IV).\n\tvar m []byte\n\tfor i := 1; i < n; i++ {\n\t\tc0 := c[(i-1)*CipherBlockLen : CipherBlockLen*(i-1)+CipherBlockLen]\n\t\tc1 := c[CipherBlockLen*i : (CipherBlockLen*i)+CipherBlockLen]\n\t\tl.Printf(\"\\ndecripting block %d of %d\", i, n)\n\t\tmi, err := decryptBlock(c0, c1, q, l)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tm = append(m, mi...)\n\t}\n\treturn string(m), nil\n}", "title": "" }, { "docid": "b21dc63069d8def05e65dd6e01c1c068", "score": "0.521818", "text": "func Decrypt(key []byte) []byte {\n\tdecryptedbin, err := dpapi.DecryptBytes(key)\n\terror_log.Check(err, \"Unprotect String with DPAPI\", \"decrypter\")\n\treturn decryptedbin\n}", "title": "" }, { "docid": "55c5f68a25336c6433efab866b4353a7", "score": "0.52180773", "text": "func (cs CryptoService) Decrypt(cipher []byte) (plain []byte, err error) {\n\tif len(cipher) == 0 {\n\t\treturn nil, errors.New(\"vbcore/CryptoService: no content to decrypt\")\n\t}\n\n\tnonce := cipher[0:cs.gcm.NonceSize()]\n\tciphertext := cipher[cs.gcm.NonceSize():]\n\n\tplain, err = cs.gcm.Open(nil, nonce, ciphertext, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fe9e1f48330f824c48aab26d21e60fe6", "score": "0.5210155", "text": "func PwDecrypt(encrypted, byteSecret []byte) (string, error) {\n\n\tvar secretKey [32]byte\n\tcopy(secretKey[:], byteSecret)\n\n\tvar decryptNonce [24]byte\n\tcopy(decryptNonce[:], encrypted[:24])\n\tdecrypted, ok := secretbox.Open(nil, encrypted[24:], &decryptNonce, &secretKey)\n\tif !ok {\n\t\treturn \"\", errors.New(\"PwDecrypt(secretbox.Open)\")\n\t}\n\n\treturn string(decrypted), nil\n}", "title": "" }, { "docid": "78c013b1010b724e4cc9de0cf4b451f8", "score": "0.51834965", "text": "func (m *TripleDesCBC) Decrypt(key, s string) (string, error) {\n\terr := gocrypto.SetDesKey(gocrypto.Md5(key)[0:24])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbsd, err := base64.StdEncoding.DecodeString(strings.Replace(s, kpassSign, \"\", -1))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tacd, err := gocrypto.TripleDesCBCDecrypt(bsd)\n\tif !strings.Contains(string(acd), kpassSign) {\n\t\treturn \"\", errors.New(\"desKey is error\")\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.Replace(string(acd), kpassSign, \"\", -1), err\n}", "title": "" }, { "docid": "df59caa223b0ffa2c2c10f3b5ceadcc8", "score": "0.5172711", "text": "func (d *identityManager) Decrypt(message []byte) ([]byte, error) {\n\treturn Decrypt(message, d.key.PrivateKey)\n}", "title": "" }, { "docid": "fd7b9f9fc9436f0c7368d560d8be4949", "score": "0.5140948", "text": "func Decrypt(cypherBase64 []byte, nonceBase64 string, key []byte) ([]byte, error) {\n\tvar plaintext []byte\n\n\tnonceText := make([]byte, base64.StdEncoding.DecodedLen(len(nonceBase64)))\n\t_, err := base64.StdEncoding.Decode(nonceText, []byte(nonceBase64))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcypherText := make([]byte, base64.StdEncoding.DecodedLen(len(cypherBase64)))\n\tcypherLen, err := base64.StdEncoding.Decode(cypherText, cypherBase64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonceArray := &[nonceLen]byte{}\n\tcopy(nonceArray[:], nonceText[:nonceLen])\n\n\tencKey := &[keyLen]byte{}\n\tcopy(encKey[:], key)\n\n\tplaintext, ok := secretbox.Open(plaintext, cypherText[:cypherLen], nonceArray, encKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Error decrypting\")\n\t}\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "7cc975fe6174c6189e7e9f2a41334e5c", "score": "0.5105508", "text": "func Decrypt(rs io.ReadSeeker, w io.Writer, conf *model.Configuration) error {\n\tif rs == nil {\n\t\treturn errors.New(\"pdfcpu: Decrypt: missing rs\")\n\t}\n\n\tif conf == nil {\n\t\treturn errors.New(\"pdfcpu: missing configuration for decryption\")\n\t}\n\tconf.Cmd = model.DECRYPT\n\n\treturn Optimize(rs, w, conf)\n}", "title": "" }, { "docid": "8a66eefe317e33f9e31b1b3f43c1e532", "score": "0.51005226", "text": "func Decrypt(cipherText []byte, key []byte, iv []byte) []byte {\n\tplainText, err := getCipher(key).Open(nil, iv, cipherText, nil)\n\tif err != nil {\n\t\tpanic(\"Error decrypting data: \" + err.Error())\n\t}\n\n\treturn plainText\n}", "title": "" }, { "docid": "43994649324c6a55679cb6b497fc588d", "score": "0.50906223", "text": "func (j *JetStreamRecord) Decrypt() error {\n\tv, err := decrypt(j.value, j.encryption)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tj.value, err = fromBase64(string(v))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c503f7f6fde60e85d8927b0728c3a68", "score": "0.50814664", "text": "func DecryptPartialReport(s beam.Scope, encryptedReport beam.PCollection, standardPrivateKey *pb.StandardPrivateKey) beam.PCollection {\n\ts = s.Scope(\"DecryptPartialReport\")\n\treturn beam.ParDo(s, &decryptPartialReportFn{StandardPrivateKey: standardPrivateKey}, encryptedReport)\n}", "title": "" }, { "docid": "b63db7e0bdc63a8b45ea67fdddd0f6ae", "score": "0.50652206", "text": "func Decrypt(data []byte, password string) (*Key, error) {\n\tprovider := &Web3KeyStore{}\n\n\treturn provider.Read(data, password)\n}", "title": "" }, { "docid": "59688b771ea11407eb971717fb4d19b4", "score": "0.50647825", "text": "func (crypter *Crypter) Decrypt(reader io.Reader) (io.Reader, error) {\n\terr := crypter.loadSecret()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmd, err := openpgp.ReadMessage(reader, crypter.SecretKey, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn md.UnverifiedBody, nil\n}", "title": "" }, { "docid": "cb7bb098f23ea920a45de65460a84710", "score": "0.5056082", "text": "func Decrypt(data, password []byte, d interface{}) error {\n\tif len(data) < 8 {\n\t\treturn ErrNoVersion\n\t}\n\n\tver, data := data[:8], data[8:]\n\tswitch binary.LittleEndian.Uint64(ver) {\n\tcase 1:\n\t\tbreak\n\tdefault:\n\t\treturn ErrVersionInvalid\n\t}\n\n\tif len(data) < saltSize {\n\t\treturn ErrNoSalt\n\t}\n\n\tsalt, data := data[:saltSize], data[saltSize:]\n\tc, err := aes.NewCipher(derive(password, salt))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgcm, err := cipher.NewGCM(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnonceSize := gcm.NonceSize()\n\tif len(data) < nonceSize {\n\t\treturn ErrNoNonce\n\t}\n\n\tnonce, data := data[:nonceSize], data[nonceSize:]\n\tplaintext, err := gcm.Open(data[:0], nonce, data, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr, err := gzip.NewReader(bytes.NewReader(plaintext))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = gob.NewDecoder(r).Decode(d); err != nil {\n\t\t_ = r.Close()\n\t\treturn err\n\t}\n\n\treturn r.Close()\n}", "title": "" }, { "docid": "c47e0764cb1f3daae74ce61778d54cd8", "score": "0.5046292", "text": "func (r *RSA) Decrypt(ciphertext string) (string, error) {\n\tif r.PrivateKey == nil {\n\t\treturn \"\", errors.New(\"missing private key\")\n\t}\n\n\tcipherBuf, err := r.decode(ciphertext)\n\n\tplaintext, err := rsa.DecryptOAEP(sha256.New(), rand.Reader, r.PrivateKey, cipherBuf, nil)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn string(plaintext), nil\n}", "title": "" }, { "docid": "9641d7fa3faa2d9101e5c24ccf74b4ac", "score": "0.5037447", "text": "func PrivateKeyDecrypt(priv *rsa.PrivateKey, rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) ([]byte, error)", "title": "" }, { "docid": "3ca0a512d17170c67a1f3660540aa3e5", "score": "0.5035295", "text": "func (t *CryptoHandler) Decrypt(ctx *CryptoHandlerOpts) error {\n\treturn t.applyCryptoAction(ctx,\n\t\tfunc(ctx *CryptoHandlerOpts, ci Transformable) error { return t.decrypt(ctx, ci) })\n}", "title": "" }, { "docid": "a8e295859416c216d17e80cc987c75e7", "score": "0.50229514", "text": "func (r *RSACrypto) Decrypt(cipherText []byte) ([]byte, error) {\n\tblock, _ := pem.Decode(r.privateKey)\n\n\tif block == nil {\n\t\treturn nil, errors.New(\"yiigo: invalid rsa private key\")\n\t}\n\n\tkey, err := x509.ParsePKCS1PrivateKey(block.Bytes)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rsa.DecryptPKCS1v15(rand.Reader, key, cipherText)\n}", "title": "" }, { "docid": "105e2459fd035fde52b88c1405ed4d68", "score": "0.50037444", "text": "func (blob *Blob) Decrypt(reader io.ReaderAt, key *crypto.Key) ([]byte, error) {\n\treturn blob.DecryptAndCheck(reader, key, false)\n}", "title": "" }, { "docid": "78bf3289eeec240843cd9d8d98642a1d", "score": "0.49548745", "text": "func decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext is too short.\")\n\t}\n\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCBCDecrypter(block, iv)\n\tcfb.CryptBlocks(text, text)//.XORKeyStream(test, test)\n\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "ea9d030c3a763bb0ac0fa4de548b77a3", "score": "0.49527907", "text": "func Decrypt(keyStr, ivStr, text string) (string, error) {\n\tkey := []byte(keyStr)\n\tiv := []byte(ivStr)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdecoded, err := base64Decode(text)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tciphertext := decoded[aes.BlockSize:]\n\n\tif len(ciphertext)%aes.BlockSize != 0 {\n\t\treturn \"\", errors.New(\"ciphertext is not a multiple of the block size\")\n\t}\n\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\tmode.CryptBlocks(ciphertext, ciphertext)\n\n\tunpaded, err := unpad(ciphertext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"%s\", unpaded), nil\n}", "title": "" }, { "docid": "c1a6093122edb8f9354f51d17a4dc114", "score": "0.4946255", "text": "func (k *DecryptionKey) Decrypt(ciphertext []byte) ([]byte, error) {\n\treturn decrypt(ciphertext, k.sk)\n}", "title": "" }, { "docid": "9c62f3f65a8838ff8f59efa3b00288b6", "score": "0.49450317", "text": "func (a *Age) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) {\n\tctx = ctxutil.WithPasswordCallback(ctx, func(prompt string) ([]byte, error) {\n\t\tpw, err := a.askPass.Passphrase(prompt, \"Decrypting\")\n\t\treturn []byte(pw), err\n\t})\n\tids, err := a.getAllIds(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn a.decrypt(ciphertext, ids...)\n}", "title": "" }, { "docid": "b283e3387ac0f504e607fff717af7e3a", "score": "0.49248904", "text": "func (priv *PKCS11PrivateKeyRSA) Decrypt(rand io.Reader, ciphertext []byte, options crypto.DecrypterOpts) (plaintext []byte, err error) {\n\tlogger.Trace(\"PKCS11PrivateKeyRSA.Decrypt\")\n\n\terr = priv.lib.withSession(priv.lib.Slot.id, func(session pkcs11.SessionHandle) error {\n\t\tif options == nil {\n\t\t\tplaintext, err = priv.lib.decryptPKCS1v15(session, priv, ciphertext, 0)\n\t\t} else {\n\t\t\tswitch o := options.(type) {\n\t\t\tcase *rsa.PKCS1v15DecryptOptions:\n\t\t\t\tplaintext, err = priv.lib.decryptPKCS1v15(session, priv, ciphertext, o.SessionKeyLen)\n\t\t\tcase *rsa.OAEPOptions:\n\t\t\t\tplaintext, err = priv.lib.decryptOAEP(session, priv, ciphertext, o.Hash, o.Label)\n\t\t\tdefault:\n\t\t\t\terr = errUnsupportedRSAOptions\n\t\t\t}\n\t\t}\n\t\treturn err\n\t})\n\treturn plaintext, err\n}", "title": "" }, { "docid": "5768ea7e68a9c85c1b8cd683a353c7e2", "score": "0.49192837", "text": "func (cfg *Config) Decrypt(pw, id string) ([]byte, error) {\n // load the encrypted data entry from disk\n byteArr, err := ioutil.ReadFile(cfg.getOutFilePath(id))\n if err != nil {\n return nil, fmt.Errorf(\"failed to read the encrypted file: %v\", err)\n }\n encFileJSON := &encryptedFileJSON{}\n if err = json.Unmarshal(byteArr, encFileJSON); err != nil {\n return nil, fmt.Errorf(\"failed to parse the encrypted data file: %v\", err)\n }\n\n // decrypt the private key and load it\n privPEM, err := x509.DecryptPEMBlock(cfg.privPem, []byte(pw))\n if err != nil {\n return nil, fmt.Errorf(\"failed to decrypt RSA private key; bad password? : %v\", err)\n }\n privKey, _ := x509.ParsePKCS1PrivateKey(privPEM)\n\n // use the private key to decrypt the ECEK\n ecekBytes, _ := base64.StdEncoding.DecodeString(encFileJSON.ECEK)\n cek, err := rsa.DecryptOAEP(sha256.New(), rand.Reader, privKey, ecekBytes, make([]byte, 0))\n if err != nil {\n return nil, fmt.Errorf(\"failed to decrypt CEK: %v\", err)\n }\n\n // use the CEK to decrypt the content\n cipherBlock, err := aes.NewCipher(cek)\n if err != nil {\n return nil, fmt.Errorf(\"failed to create AES cipher block: %v\", err)\n }\n gcm, err := cipher.NewGCM(cipherBlock)\n if err != nil {\n return nil, fmt.Errorf(\"failed to create GCM cipher: %v\", err)\n }\n nonce, _ := base64.StdEncoding.DecodeString(encFileJSON.Nonce)\n cipherText, _ := base64.StdEncoding.DecodeString(encFileJSON.CipherText)\n plainText, err := gcm.Open(nil, nonce, cipherText, nil)\n if err != nil {\n return nil, fmt.Errorf(\"failed to decrypt the file content: %v\", err)\n }\n\n // delete the encrypted content and return the plaintext\n if err = os.Remove(cfg.getOutFilePath(id)); err != nil {\n return plainText, fmt.Errorf(\"failed to delete the encrypted file: %v\", err)\n }\n return plainText, nil\n}", "title": "" }, { "docid": "19e1713bb69ae2797a90ef64dbff29ad", "score": "0.49118847", "text": "func decrypt(filePath string, fileEncryptionKey string, log *zap.Logger) ([]byte, error) {\n\tlog.Info(fmt.Sprintf(\"Starting file decryption. filePath: %s\", filePath))\n\n\t// decoding the key\n\tkey, err := hex.DecodeString(fileEncryptionKey)\n\tif err != nil {\n\t\tlog.Error(\"Error decoding key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\t// open ecrypted file\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\tlog.Error(\"Error openning ecrypted file\", zap.Error(err))\n\t}\n\tdefer func() {\n\t\tif err = file.Close(); err != nil {\n\t\t\tlog.Error(\"Error closing ecrypted file\", zap.Error(err))\n\t\t}\n\t\tlog.Info(\"Closed file successfully\")\n\t}()\n\n\t// read IV from the beginning of the file\n\tiv := make([]byte, ivSize)\n\tn, err := io.ReadFull(file, iv)\n\tif err != nil {\n\t\tlog.Error(\"Error reading IV from encrypted file.\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\tlog.Info(fmt.Sprintf(\"Reading IV from file successful. IV size: %v\", n))\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlog.Error(\"Error reading key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\t// get aes ctr instance\n\tctr := cipher.NewCTR(block, iv)\n\n\t// get new hmac instance to calculate the local authentication\n\tlocalHmac := hmac.New(sha512.New, key)\n\tlocalHmac.Write(iv)\n\n\t// creates buffer reader out of reader\n\tbufferReader := bufio.NewReaderSize(file, bufferSize)\n\tvar decryptedData []byte\n\n\t// buffer of size bufferSize + hmacSize so we'll read both from encrypted file each iteration\n\tbuffer := make([]byte, bufferSize+hmacSize)\n\tfor {\n\t\tn, err := io.ReadFull(bufferReader, buffer)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tlog.Debug(fmt.Sprintf(\"Read encrypted data in size of: %d\", n))\n\n\t\tencryptedDataSize := n - hmacSize\n\n\t\t// write encrypted data chunk into hmac\n\t\tlocalHmac.Write(buffer[:encryptedDataSize])\n\t\tauthTag := localHmac.Sum(nil)\n\t\tlog.Debug(fmt.Sprintf(\"size of hash: %d\", len(authTag)))\n\n\t\t// verify the information is authenticate\n\t\tif !hmac.Equal(buffer[encryptedDataSize:n], authTag) {\n\t\t\terrMessage := \"Error authenticating the file - auth tags are not equal\"\n\t\t\tlog.Error(errMessage)\n\t\t\treturn nil, errors.New(errMessage)\n\t\t}\n\n\t\t// write current auth tag into hmac for the next verification\n\t\tlocalHmac.Write(authTag)\n\n\t\toutBuffer := make([]byte, int64(encryptedDataSize))\n\t\t// decrypt buffer data chunk into outBuffer\n\t\tctr.XORKeyStream(outBuffer, buffer[:encryptedDataSize])\n\t\t// load the decrypted data to memory\n\t\tdecryptedData = append(decryptedData, outBuffer...)\n\t\tlog.Debug(fmt.Sprintf(\"Appended decrypted data of %d bytes to memory...\", len(buffer[:encryptedDataSize])))\n\t}\n\tlog.Info(fmt.Sprintf(\"Decryption successful. Size of decrypted: %v bytes\", len(decryptedData)))\n\treturn decryptedData, nil\n}", "title": "" }, { "docid": "c9d1266cdfc0f8a3c6a5d95f814c3828", "score": "0.48974973", "text": "func doDecrypt(ctx context.Context, data string, subscriptionID string, providerVaultName string, providerKeyName string, providerKeyVersion string) ([]byte, error) {\n\tkvClient, vaultBaseUrl, keyName, keyVersion, err := getKey(subscriptionID, providerVaultName, providerKeyName, providerKeyVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparameter := kv.KeyOperationsParameters {\n\t\tAlgorithm: kv.RSA15,\n\t\tValue: &data,\n\t}\n\t\n\tresult, err := kvClient.Decrypt(vaultBaseUrl, keyName, keyVersion, parameter)\n\tif err != nil {\n\t\tfmt.Print(\"failed to decrypt, error: \", err)\n\t\treturn nil, err\n\t}\n\tbytes, err := base64.RawURLEncoding.DecodeString(*result.Result)\n\treturn bytes, nil\n}", "title": "" }, { "docid": "7c1484e6359bf381ad2602e94130789d", "score": "0.48974547", "text": "func (e *Envelope) Decrypt(data *EnvelopeInfo, aad []byte) ([]byte, error) {\n\taead, err := e.aeadEncrypter(data.Key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn aead.Open(nil, data.IV, data.Ciphertext, aad)\n}", "title": "" }, { "docid": "5024807e0fc28cf6ae75dc8ff95b76d7", "score": "0.48872244", "text": "func (v envVault) DecryptText(text string) (string, error) {\n\treturn DecryptText(text, v.passPhrase)\n}", "title": "" }, { "docid": "5a3befdb628d57707c68178faf48bd08", "score": "0.4880912", "text": "func (dt DoubleTransform) Decrypt(payload []byte) error {\n\t// TODO inner encrypt\n\t// TODO outer enrypt\n\treturn nil\n}", "title": "" }, { "docid": "13c50afb19f74a745af1598cb7ad0ff8", "score": "0.4878906", "text": "func Verify(password string, dk []byte) (bool, error) {\n\tkeylen := len(dk) - 28\n\tpass := dk[:keylen]\n\n\t// Get the salt\n\tsalt := dk[keylen : keylen+16]\n\n\t// Get the params\n\tvar N, r, p int32\n\tparamIndex := keylen + len(salt)\n\n\t// 4 bytes for N\n\terr := binary.Read(bytes.NewReader(dk[paramIndex:paramIndex+4]), binary.LittleEndian, &N)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// 4 bytes for r\n\terr = binary.Read(bytes.NewReader(dk[paramIndex+4:paramIndex+8]), binary.LittleEndian, &r)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// 4 bytes for p\n\terr = binary.Read(bytes.NewReader(dk[paramIndex+8:paramIndex+12]), binary.LittleEndian, &p)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tpassword += os.Getenv(\"SCRYPT_PEPPER\")\n\n\tkey, err := scrypt.Key([]byte(password), salt, int(N), int(r), int(p), keylen)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn subtle.ConstantTimeCompare(key, pass) != 0, nil\n}", "title": "" }, { "docid": "ca56e72d45377ce3399b873a87e4afd4", "score": "0.4869487", "text": "func decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short\")\n\t}\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(text, text)\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "99caa0f344c5d8e1b706c528d7eca6bf", "score": "0.48690745", "text": "func (d *Decryptor) Decrypt(nbrPatients int, ciphertext *ckks.Ciphertext) (pred []float64) {\n\n\t// Decryption & decoding process\n\td.decryptor.Decrypt(ciphertext, d.plaintext)\n\tvaluesTest := d.encoder.DecodeCoeffs(d.plaintext)\n\n\tpred = make([]float64, nbrPatients)\n\tfor j := 0; j < nbrPatients; j++ {\n\t\tpred[j] = 1 / (math.Exp(-valuesTest[j]) + 1)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f27e032552fceaa42e2aeeabafb1a17b", "score": "0.48654583", "text": "func (fd *FileDecryptionProperties) PlaintextFilesAllowed() bool { return fd.plaintextAllowed }", "title": "" }, { "docid": "74383f265383b56aedff13d62d964930", "score": "0.48643202", "text": "func (refreshProtocol *RefreshProtocol) Decrypt(ciphertext *ckks.Ciphertext, shareDecrypt RefreshShareDecrypt) {\n\trefreshProtocol.dckksContext.ringQ.AddLvl(ciphertext.Level(), ciphertext.Value()[0], shareDecrypt, ciphertext.Value()[0])\n}", "title": "" }, { "docid": "a3c836203dd31d7482888703272ff3fa", "score": "0.48596364", "text": "func Decrypt() error {\n\treader := bufio.NewReader(os.Stdin)\n\n\tvar repoPath string\n\tvar dbPath string\n\tvar filename string\n\tvar testnet bool\n\tvar err error\n\tfor {\n\t\tfmt.Print(\"Decrypt the mainnet or testnet db?: \")\n\t\tresp, _ := reader.ReadString('\\n')\n\t\tif strings.Contains(strings.ToLower(resp), \"mainnet\") {\n\t\t\trepoPath, err = getRepoPath(false)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfilename = \"mainnet.db\"\n\t\t\tdbPath = path.Join(repoPath, \"datastore\", filename)\n\t\t\trepoLockFile := filepath.Join(repoPath, lockfile.LockFile)\n\t\t\tif _, err := os.Stat(repoLockFile); !os.IsNotExist(err) {\n\t\t\t\tfmt.Println(\"Cannot decrypt while the daemon is running.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif _, err := os.Stat(dbPath); os.IsNotExist(err) {\n\t\t\t\tfmt.Println(\"Database does not exist. You may need to run the daemon at least once to initialize it.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbreak\n\t\t} else if strings.Contains(strings.ToLower(resp), \"testnet\") {\n\t\t\trepoPath, err = getRepoPath(true)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\ttestnet = true\n\t\t\tfilename = \"testnet.db\"\n\t\t\tdbPath = path.Join(repoPath, \"datastore\", filename)\n\t\t\trepoLockFile := filepath.Join(repoPath, lockfile.LockFile)\n\t\t\tif _, err := os.Stat(repoLockFile); !os.IsNotExist(err) {\n\t\t\t\tfmt.Println(\"Cannot decrypt while the daemon is running.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif _, err := os.Stat(dbPath); os.IsNotExist(err) {\n\t\t\t\tfmt.Println(\"Database does not exist. You may need to run the node at least once to initialize it.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbreak\n\t\t} else {\n\t\t\tfmt.Println(\"No comprende\")\n\t\t}\n\t}\n\tfmt.Print(\"Enter your password: \")\n\tbytePassword, _ := terminal.ReadPassword(int(syscall.Stdin))\n\tfmt.Println(\"\")\n\tpw := string(bytePassword)\n\tpw = strings.Replace(pw, \"'\", \"''\", -1)\n\tsqlliteDB, err := Create(repoPath, pw, testnet)\n\tif err != nil || sqlliteDB.Config().IsEncrypted() {\n\t\tfmt.Println(\"Invalid password\")\n\t\treturn err\n\t}\n\tif err := os.MkdirAll(path.Join(repoPath, \"tmp\", \"datastore\"), os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\ttmpDB, err := Create(path.Join(repoPath, \"tmp\"), \"\", testnet)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tinitDatabaseTables(tmpDB.db, \"\")\n\tif err := sqlliteDB.Copy(path.Join(repoPath, \"tmp\", \"datastore\", filename), \"\"); err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\terr = os.Rename(path.Join(repoPath, \"tmp\", \"datastore\", filename), path.Join(repoPath, \"datastore\", filename))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tos.RemoveAll(path.Join(repoPath, \"tmp\"))\n\tfmt.Println(\"Success!\")\n\treturn nil\n}", "title": "" }, { "docid": "e2986b2176af7448a74c32c647336194", "score": "0.48550487", "text": "func (i *GPG) Decrypt(\n\tb []byte,\n) ([]byte, error) {\n\treturn i.cli.Decrypt(i.ctx, b)\n}", "title": "" }, { "docid": "7c0f9780699ed745c4623971240085ab", "score": "0.48393357", "text": "func Decrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(text) < aes.BlockSize {\n\t\treturn nil, errors.New(\"ciphertext too short\")\n\t}\n\tiv := text[:aes.BlockSize]\n\ttext = text[aes.BlockSize:]\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tcfb.XORKeyStream(text, text)\n\tdata, err := base64.StdEncoding.DecodeString(string(text))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "cf77d183778cca87fef735ace06340b1", "score": "0.48370984", "text": "func decrypt(ciphertext []byte, IV []byte) []byte {\n plaintext, err := aead.Open(nil, IV, ciphertext, nil)\n if err != nil {\n fmt.Fprintln(os.Stderr, \"Error with AES decryption: \" + err.Error())\n os.Exit(1)\n }\n\n return plaintext\n}", "title": "" }, { "docid": "e0d3ee2f2e104ebeb405d4ddd9f4f73e", "score": "0.48266137", "text": "func Decrypt(ciphertext, key, iv []byte) ([]byte, error) {\n\n\tswitch {\n\tcase len(ciphertext)%8 != 0:\n\t\treturn nil, errors.New(\"invalid ciphertext length\")\n\tcase iv == nil:\n\t\tiv = defaultIV\n\tcase len(iv) != 8:\n\t\treturn nil, errors.New(\"invalid iv length\")\n\t}\n\n\t// create the cipher\n\tdcipher, err := blowfish.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// make initialization vector to be the first 8 bytes of ciphertext\n\tiv = ciphertext[:blowfish.BlockSize]\n\n\t// check last slice of encrypted text, if it's not a modulus of cipher block size, we're in trouble\n\tdecrypted := ciphertext[blowfish.BlockSize:]\n\tif len(decrypted)%blowfish.BlockSize != 0 {\n\t\tpanic(\"decrypted is not a multiple of blowfish.BlockSize\")\n\t}\n\n\t// create the decrypter\n\tdcbc := cipher.NewCBCDecrypter(dcipher, iv)\n\n\t// decrypt!\n\tdcbc.CryptBlocks(decrypted, decrypted)\n\n\treturn decrypted, nil\n}", "title": "" }, { "docid": "37b9490b643498e8184af4667c922a1a", "score": "0.48178688", "text": "func (v passPhraseVault) DecryptText(text string) (string, error) {\n\treturn DecryptText(text, v.passPhrase)\n}", "title": "" }, { "docid": "33530a818fa78e933e808651535ad6e0", "score": "0.4816192", "text": "func DecryptJasypt(encrypted []byte, password string) ([]byte, error) {\n\tif len(encrypted) < des.BlockSize {\n\t\treturn nil, fmt.Errorf(\"Invalid encrypted text. Text length than block size.\")\n\t}\n\n\tsalt := encrypted[:des.BlockSize]\n\tct := encrypted[des.BlockSize:]\n\n\tkey, err := PBKDF1MD5([]byte(password), salt, 1000, des.BlockSize*2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tiv := key[des.BlockSize:]\n\tkey = key[:des.BlockSize]\n\n\tb, err := des.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdst := make([]byte, len(ct))\n\tbm := cipher.NewCBCDecrypter(b, iv)\n\tbm.CryptBlocks(dst, ct)\n\n\t// Remove any padding\n\tpad := int(dst[len(dst)-1])\n\tdst = dst[:len(dst)-pad]\n\n\treturn dst, nil\n}", "title": "" }, { "docid": "fadff042f0e8fd4faec7959f23b5a85f", "score": "0.48117158", "text": "func (pp *PermuteProtocol) Decrypt(ciphertext *bfv.Ciphertext, shareDecrypt RefreshShareDecrypt, sharePlaintext *ring.Poly) {\n\tpp.context.ringQ.Add(ciphertext.Value()[0], shareDecrypt, sharePlaintext)\n}", "title": "" }, { "docid": "6e1cff3edd17f7494e69845344cad47b", "score": "0.48057383", "text": "func (c *Client) Decrypt(ctx context.Context, params *DecryptInput, optFns ...func(*Options)) (*DecryptOutput, error) {\n\tif params == nil {\n\t\tparams = &DecryptInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"Decrypt\", params, optFns, addOperationDecryptMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*DecryptOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "4388b69d39d8265d1e266a0c6083f61f", "score": "0.48051307", "text": "func (a *Agent) Decrypt(b []byte) ([]byte, error) {\n\tchallenge, cipherText, err := sshcryptdata.DecodeChallengeCipherText(string(b))\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"%s\", err)\n\t}\n\tsig, err := sshcryptactions.Sign(a.signer, challenge)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"%s\", err)\n\t}\n\n\tclearText, ok, err := sshcryptactions.DecryptWithPassword(sig.Blob, cipherText)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"%s\", err)\n\t}\n\tif !ok {\n\t\treturn []byte{}, fmt.Errorf(\"couldnt decrypt\")\n\t}\n\treturn []byte(clearText), nil\n}", "title": "" }, { "docid": "9cad2b76ceed77e1d2ca0593bc917b33", "score": "0.48017502", "text": "func (tpe *TPE) Decrypt(Cx_str string, Ty_str string) int {\n\t// Load Matrices Cx and Ty from Base64-String\n\tvar Cx mat.Dense\n\tCxBytes, _ := base64.StdEncoding.DecodeString(Cx_str)\n\tCx.UnmarshalBinary(CxBytes)\n\n\tvar Ty mat.Dense\n\tTyBytes, _ := base64.StdEncoding.DecodeString(Ty_str)\n\tTy.UnmarshalBinary(TyBytes)\n\n\t// Initial Check for Dimentions\n\tc_r, c_c := Cx.Dims()\n\tt_r, t_c := Ty.Dims()\n\tif c_r != c_c || t_r != t_c {\n\t\tfmt.Println(\"ERROR! Matrices need to be Square Matrices.\")\n\t\treturn -1\n\t}\n\tif c_r != t_r || c_r != tpe.setup.N+3 || t_r != tpe.setup.N+3 {\n\t\tfmt.Println(\"ERROR! Matrices need same Dimentions |OR| Matrices need to be of Set Dimentions.\")\n\t\treturn -1\n\t}\n\n\t// Step 1: Compute I = Trace(Cx Ty)\n\tvar CxTy mat.Dense\n\tCxTy.Mul(&Cx, &Ty)\n\tI := CxTy.Trace()\n\n\t// Step 2: Result = 1 if I <= 0, else Result = 0\n\tvar Result int\n\tif I <= 0 {\n\t\tResult = 1\n\t} else {\n\t\tResult = 0\n\t}\n\n\treturn Result\n}", "title": "" }, { "docid": "c77cc98e12d86f96e38118ae7ec33b9c", "score": "0.47989163", "text": "func (m *TripleDesCFB) Decrypt(key, s string) (string, error) {\n\terr := gocrypto.SetDesKey(gocrypto.Md5(key)[0:24])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbsd, err := base64.StdEncoding.DecodeString(strings.Replace(s, kpassSign, \"\", -1))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tacd, err := gocrypto.TripleDesCFBDecrypt(bsd)\n\tif !strings.Contains(string(acd), kpassSign) {\n\t\treturn \"\", errors.New(\"desKey is error\")\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.Replace(string(acd), kpassSign, \"\", -1), err\n}", "title": "" }, { "docid": "502e5fd93d2ee0e14d5429d79c4757de", "score": "0.47961563", "text": "func (kp *FromAddress) Decrypt(input []byte) ([]byte, error) {\n\treturn nil, ErrCannotDecrypt\n}", "title": "" }, { "docid": "5d576742490cd914bba83bad4a13d9a3", "score": "0.47921395", "text": "func (b *Base) Decrypt(req *DecryptReq) (*DecryptResp, error) {\n\treturn nil, ErrFunctionNotSupported\n}", "title": "" }, { "docid": "15bbc6cff0ab0d464668b7e39eddae9b", "score": "0.47920465", "text": "func Decrypt(filePath string, params params.CliParams) {\n\tcontents := crypto.Decrypt(filePath, params.Key)\n\tnormPathname := journal.NormalizePathname(filePath)\n\n\tfile, err := os.Create(normPathname)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw := bufio.NewWriter(file)\n\t_, err = w.WriteString(contents)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tw.Flush()\n\n\tlog.Info(\"wrote decrypted contents to file: `\" + normPathname + \"'\")\n}", "title": "" }, { "docid": "7194b18b2a9b5798a2a7b31f6de358b7", "score": "0.47853956", "text": "func (v nullVault) DecryptText(text string) (string, error) {\n\treturn text, nil\n}", "title": "" }, { "docid": "8305ecda87ec3e19a290d50372f31ee0", "score": "0.47812837", "text": "func (rs *RatchetServer) Decrypt(msg []byte) ([]byte, error) {\n\treturn rs.serverConfig.ProcessOracleMessage(msg)\n}", "title": "" }, { "docid": "8cf84a736f72cdcf884e16a2f35d637c", "score": "0.47738403", "text": "func (obj *MessengerFileCipher) FinishDecryption(signerPublicKey foundation.PublicKey) ([]byte, error) {\n\toutBuf, outBufErr := newBuffer(int(obj.FinishDecryptionOutLen() /* lg2 */))\n\tif outBufErr != nil {\n\t\treturn nil, outBufErr\n\t}\n\tdefer outBuf.delete()\n\n\tproxyResult := /*pr4*/ C.vssq_messenger_file_cipher_finish_decryption(obj.cCtx, (*C.vscf_impl_t)(unsafe.Pointer(signerPublicKey.Ctx())), outBuf.ctx)\n\n\terr := CommKitErrorHandleStatus(proxyResult)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\truntime.KeepAlive(obj)\n\n\truntime.KeepAlive(signerPublicKey)\n\n\treturn outBuf.getData() /* r7 */, nil\n}", "title": "" }, { "docid": "a60fe55c770d1437f6b82e31f32e8c1e", "score": "0.47705325", "text": "func Decrypt(k []byte, crypted string) (string, error) {\n\tif crypted == \"\" || len(crypted) < 8 {\n\t\treturn \"\", nil\n\t}\n\n\tcryptedbytes, err := base64.StdEncoding.DecodeString(crypted[1 : len(crypted)-1])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tivlength := (cryptedbytes[4] & 0xff)\n\tif int(ivlength) > len(cryptedbytes) {\n\t\treturn \"\", errors.New(\"invalid encrypted string\")\n\t}\n\n\tcryptedbytes = cryptedbytes[1:] //Strip the version\n\tcryptedbytes = cryptedbytes[4:] //Strip the iv length\n\tcryptedbytes = cryptedbytes[4:] //Strip the data length\n\n\tiv := cryptedbytes[:ivlength]\n\tcryptedbytes = cryptedbytes[ivlength:]\n\n\tblock, err := aes.NewCipher(k)\n\tif err != nil {\n\t\tfmt.Println(\"Error creating new cipher\", err)\n\t\treturn \"\", err\n\t}\n\tif len(cryptedbytes) < aes.BlockSize {\n\t\tfmt.Println(\"Ciphertext too short\")\n\t\treturn \"\", err\n\t}\n\tif len(cryptedbytes)%aes.BlockSize != 0 {\n\t\tfmt.Println(\"Ciphertext is not a multiple of the block size\")\n\t\treturn \"\", err\n\t}\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\tmode.CryptBlocks(cryptedbytes, cryptedbytes)\n\n\tdecrypted := strings.TrimSpace(string(cryptedbytes))\n\tdecrypted = strings.TrimFunc(decrypted, func(r rune) bool {\n\t\treturn !unicode.IsGraphic(r)\n\t})\n\treturn decrypted, nil\n}", "title": "" }, { "docid": "9281314806af64a70769d95c8b0bb68e", "score": "0.47572508", "text": "func (rc4Opt *RC4Opt) Decrypt(disini []byte) (string, error) {\n\tsrc, err := hex.DecodeString(string(disini))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t/* #nosec */\n\tcipher, err := rc4.NewCipher(rc4Opt.secret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdst := make([]byte, len(src))\n\tcipher.XORKeyStream(dst, src)\n\treturn string(dst), nil\n}", "title": "" }, { "docid": "9121da3a0b7e18027b0272a52ecede85", "score": "0.47485766", "text": "func Decrypt(cipher, key string, rfc ...string) (raw string, err error) {\n\tif len(key) != keyLength {\n\t\terr = fmt.Errorf(\"provided key does not satisfy the key length of 64 chars\")\n\t\treturn\n\t}\n\n\tencrypted, err := in(cipher, rfc)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn decrypt(encrypted, key)\n}", "title": "" }, { "docid": "d165cb28186a03d0be17f15564637155", "score": "0.47412956", "text": "func (session *BobSession) Decrypt(outFile string) error {\n\tif err := utils.CheckDirOfPathExistence(outFile); err != nil {\n\t\treturn err\n\t}\n\n\thandle := C.handle_t(session.handle)\n\n\toutFileCStr := C.CString(outFile)\n\tdefer C.free(unsafe.Pointer(outFileCStr))\n\n\tret := bool(C.E_TableOtComplaintBobSaveDecrypted(\n\t\thandle, outFileCStr))\n\tif !ret {\n\t\treturn fmt.Errorf(\n\t\t\t\"E_TableOtComplaintBobSaveDecrypted(%v, %s) failed\",\n\t\t\thandle, outFile)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "032a569f242a284b579ca174514cb07e", "score": "0.47401437", "text": "func (m *PooledWrapper) Decrypt(ctx context.Context, ct *wrapping.BlobInfo, opt ...wrapping.Option) ([]byte, error) {\n\tif ct.KeyInfo == nil {\n\t\tenc := m.encryptor()\n\t\treturn enc.Decrypt(ctx, ct, opt...)\n\t}\n\n\twrapper := m.WrapperForKeyId(ct.KeyInfo.KeyId)\n\tif wrapper == nil {\n\t\treturn nil, ErrKeyNotFound\n\t}\n\treturn wrapper.Decrypt(ctx, ct, opt...)\n}", "title": "" }, { "docid": "2e67aa394d9635905a92edc734e9e34e", "score": "0.47384813", "text": "func (t *Thread) Decrypt(data []byte) ([]byte, error) {\n\treturn crypto.Decrypt(t.PrivKey, data)\n}", "title": "" }, { "docid": "318870e9c56d9c58d7c8e40335e59250", "score": "0.47349754", "text": "func (e *cbcPKCS5Padding) Decrypt(base64Key, base64CipherText string) (string, error) {\n\tkey, err := base64.StdEncoding.DecodeString(base64Key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcipherText, err := base64.StdEncoding.DecodeString(base64CipherText)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdecryptedData, err := e.decrypt(key, cipherText)\n\treturn string(decryptedData), err\n}", "title": "" }, { "docid": "b2f478d7ff4d29aa67a628f2438decfc", "score": "0.47327417", "text": "func (g *Gpg) Decrypt(blob []byte) ([]byte, error) {\n\n\t// Open the private key file\n\tprivateRingBuffer, err := os.Open(g.PrivateKeyring)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer privateRingBuffer.Close()\n\n\tprivateRing, err := openpgp.ReadKeyRing(privateRingBuffer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivateKey := getKeyByEmail(privateRing, g.Email)\n\n\tfmt.Print(\"GPG Passphrase: \")\n\tpassphrase, err := terminal.ReadPassword(0)\n\tfmt.Println(\"\")\n\n\tlog.Printf(\"[DEBUG] GPG Decrypting private key using passphrase\")\n\t//passphraseByte := []byte(passphrase)\n\tprivateKey.PrivateKey.Decrypt(passphrase)\n\tfor _, subkey := range privateKey.Subkeys {\n\t\tsubkey.PrivateKey.Decrypt(passphrase)\n\t}\n\tlog.Printf(\"[DEBUG] GPG Finished decrypting private key using passphrase\")\n\n\tarmoredBlock, err := armor.Decode(bytes.NewReader(blob))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decrypt it with the contents of the private key\n\tmd, err := openpgp.ReadMessage(armoredBlock.Body, privateRing, nil, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GPG Read message failed: %v\", err)\n\t}\n\tplain, err := ioutil.ReadAll(md.UnverifiedBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn plain, nil\n}", "title": "" }, { "docid": "f294f9b5f460c211fd437ba7a9e89667", "score": "0.4728356", "text": "func (k *KeyStore) Decrypt(ciphertext []byte) (string, error) {\n\n\tif len(k.key) == 0 || len(k.iv) == 0 {\n\t\treturn \"\", fmt.Errorf(\"keystore.Decrypt: keystore not initialized\")\n\t}\n\n\treturn decrypt(k.key, ciphertext)\n}", "title": "" }, { "docid": "1ba3b9df522529f3bdf59ee055e192bc", "score": "0.47280586", "text": "func VerifyPassword(inputpass string, storedpass []byte) (bool, error) {\n\tplaintext, err := decrypt(storedpass, \"password\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif string(plaintext) != inputpass {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "9657d77202aed9741090fadd212cb4f9", "score": "0.47211528", "text": "func Decrypt(cryptoText string) (decryptedText string, err error) {\n\n\t// validate key\n\tif err = initKey(); err != nil {\n\t\treturn\n\t}\n\n\t// create cipher block from key\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tif len(ciphertext) < aes.BlockSize {\n\t\terr = fmt.Errorf(\"ciphertext is too small\")\n\t\treturn\n\t}\n\tiv := ciphertext[:aes.BlockSize]\n\tciphertext = ciphertext[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(ciphertext, ciphertext)\n\n\tdecryptedText = fmt.Sprintf(\"%s\", ciphertext)\n\n\treturn\n}", "title": "" }, { "docid": "23b79caf04b25109bdb8d17a17e2a4de", "score": "0.47204006", "text": "func (ckms *CKMS) Decrypt(path string) ([]byte, error) {\n\tcontent, err := loadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult, err := ckms.DecryptRaw(content)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "b77ac52ed4e098d03daf87c2c8dd03a6", "score": "0.47118825", "text": "func Decrypt(env *CryptoEnvelope, userKey Key, fn DecryptFn,\n\t\thashFn func() hash.Hash) ([]byte, error) {\n\n\tif env == nil {\n\t\treturn nil, fmt.Errorf(\"nil crypto envelope\")\n\t}\n\tif env.Algorithm != CipherAlgo_AES256CTR {\n\t\treturn nil, fmt.Errorf(\"unsupported cipher algorithm\")\n\t}\n\tconst cipherBlockSize = aes.BlockSize\n\n\t// Verify the HMAC.\n\tsig, err := Sign(hmac.New(hashFn, userKey.HMAC()),\n\t\t[]byte(strconv.Itoa(int(env.Algorithm))), env.Iv, env.Key, env.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !hmac.Equal(sig, env.Hmac) {\n\t\treturn nil, fmt.Errorf(\"invalid signature, the data may have been tempered with\")\n\t}\n\n\t// Decrypt the cipher key with the user key.\n\tkeyIV := env.Key[:cipherBlockSize]\n\tkeyCipher := env.Key[cipherBlockSize:]\n\tkey, err := fn(userKey.Encryption(), keyIV, keyCipher)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decrypt the data.\n\tplaintext, err := fn(key, env.Iv, env.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "e727536cbcf83e020beb7f049a5cb9b1", "score": "0.47060558", "text": "func Decrypt(ciphertext string) (string, error) {\n\treturn defaultEncryptor.Decrypt(ciphertext)\n}", "title": "" }, { "docid": "6014af765e09e8183070bd81f1ff40b4", "score": "0.46977612", "text": "func Decrypt(key, iv, ciphertext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ciphertext) < aes.BlockSize {\n\t\treturn nil, fmt.Errorf(\"ciphertext is shorter then block size: %d / %d\", len(ciphertext), aes.BlockSize)\n\t}\n\n\tif iv == nil {\n\t\tiv = ciphertext[:aes.BlockSize]\n\t\tciphertext = ciphertext[aes.BlockSize:]\n\t}\n\n\tcbc := cipher.NewCBCDecrypter(block, iv)\n\tcbc.CryptBlocks(ciphertext, ciphertext)\n\n\treturn unpad(ciphertext)\n}", "title": "" }, { "docid": "3f8c025eb24f858ed50883f7fc5de4c6", "score": "0.4691781", "text": "func DecryptFile(filename string, passphrase string) *[]byte {\r\n\tdata, _ := ioutil.ReadFile(filename)\r\n\treturn dec(&data, passphrase)\r\n}", "title": "" }, { "docid": "be08dba924e5ab2ffe36e74ebbd21bec", "score": "0.46895698", "text": "func TestDecryptionConsistency(t *testing.T) {\n\tplaintext := []byte(\"secret\")\n\tkey1 := []byte(\"11112222333344445555666677778888\")\n\tkey2 := []byte(\"AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH\")\n\n\td1, err := NewDocument(plaintext, key1)\n\td2, err := NewDocument(plaintext, key2)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\td1.DecryptInPlace(key1)\n\td2.DecryptInPlace(key2)\n\n\tif bytes.Compare(d1.Contents, d2.Contents) != 0 {\n\t\tt.Error(\"Document was not properly decrypted\")\n\t}\n}", "title": "" }, { "docid": "1cee1d1f3790c805d1caa6deb9d4be20", "score": "0.46888563", "text": "func Decrypt(data []byte, passphrase string) ([]byte, error) {\n\tif len(data) == 0 || len(passphrase) == 0 {\n\t\treturn data, fmt.Errorf(\"Length of data is zero, can't decrpyt!\")\n\t}\n\ttempParam := utils.SHA3hash(passphrase)\n\tkey := []byte(tempParam[96:128]) // last 32 characters in hash\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlog.Println(\"Error while initializing cipher decryption\")\n\t\treturn data, err\n\t}\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\tlog.Println(\"Failed to initialize a new AES GCM while decrypting\")\n\t\treturn data, err\n\t}\n\tnonceSize := gcm.NonceSize()\n\tnonce, ciphertext := data[:nonceSize], data[nonceSize:]\n\tplaintext, err := gcm.Open(nil, nonce, ciphertext, nil)\n\tif err != nil {\n\t\tlog.Println(\"Failed to open gcm while decrypting\", err)\n\t\treturn plaintext, err\n\t}\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "35ee96537f97825bd3488532398d1eda", "score": "0.4683233", "text": "func (k *ChaCha20DataKey) Decrypt(ciphertext []byte) ([]byte, error) {\n\taead, err := chacha20poly1305.New(k.key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, chacha20poly1305.NonceSize)\n\n\tplaintext, err := aead.Open(ciphertext[:0], nonce, ciphertext, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "3f35c0d6fcb8036d52fd9d0865402ec6", "score": "0.46773553", "text": "func (decryptor *Decryptor) Decrypt(ciphertext *Ciphertext) *Plaintext {\n\tplaintext := NewPlaintext(decryptor.ctx.N, decryptor.ctx.Q, decryptor.ctx.NttParams)\n\tplaintext.Value.MulCoeffs(ciphertext.value[1], *decryptor.secretkey)\n\tplaintext.Value.Add(plaintext.Value, ciphertext.value[0])\n\tplaintext.Value.Poly.InverseNTT()\n\tcenter(plaintext.Value)\n\tplaintext.Value.MulScalar(plaintext.Value, decryptor.ctx.T)\n\tplaintext.Value.DivRound(plaintext.Value, decryptor.ctx.Q)\n\tplaintext.Value.Mod(plaintext.Value, decryptor.ctx.T)\n\treturn plaintext\n}", "title": "" }, { "docid": "f10015d4d9357e93fb82e215d5b632bc", "score": "0.46738043", "text": "func (m EncMessage) Decrypt(k []byte) ([]byte, error) {\n\treturn nil, errors.New(\"Decrypt method must be overridden\")\n}", "title": "" }, { "docid": "ffaa45e30f1648ee66c3b65d8e8341d0", "score": "0.46737295", "text": "func (v *DefaultVaultClient) Decrypt(key, ciphertext string) (string, error) {\n\tkv := map[string]interface{}{\"ciphertext\": ciphertext}\n\ts, err := v.Logical().Write(v.decryptEndpoint(key), kv)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif s == nil {\n\t\treturn \"\", fmt.Errorf(\"Unable to get decryped value using encryption key %s \", key)\n\t}\n\treturn s.Data[\"plaintext\"].(string), nil\n}", "title": "" }, { "docid": "768d4c74a1295bd302e20ab606e86bd5", "score": "0.4671842", "text": "func (nullSecurity) Decrypt(w io.Writer, data []byte) (int, error) {\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "0565af95914c8ded461618133d3e2793", "score": "0.46706372", "text": "func (r *RSA) Decrypt(data []byte) ([]byte, error) {\n\tvar dec, err = rsa.DecryptOAEP(sha1.New(), rand.Reader, r.privateKey, data, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn dec, nil\n}", "title": "" }, { "docid": "5e082fa5334ed7b6cd12993943309203", "score": "0.46680224", "text": "func decrypt(value []byte, key Key) ([]byte, error) {\n\tenc, err := b64.StdEncoding.DecodeString(string(value))\n\tif err != nil {\n\t\treturn value, err\n\t}\n\n\tnsize := key.cipherObj.NonceSize()\n\tnonce, ciphertext := enc[:nsize], enc[nsize:]\n\n\treturn key.cipherObj.Open(nil, nonce, ciphertext, nil)\n}", "title": "" }, { "docid": "63e354aa2c1be4f7754bdaca84d9dde3", "score": "0.46616894", "text": "func (a *decryptPrimitiveSet) Decrypt(ct, aad []byte) ([]byte, error) {\n\tfor cipher, entries := range a.entries(ct) {\n\t\tfor _, e := range entries {\n\t\t\tp, ok := (e.Primitive).(api.CompositeDecrypt)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"ecdh_factory: not a CompositeDecrypt primitive\")\n\t\t\t}\n\n\t\t\tpt, e := p.Decrypt([]byte(cipher), aad)\n\t\t\tif e == nil {\n\t\t\t\treturn pt, nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// nothing worked\n\treturn nil, errors.New(\"ecdh_factory: decryption failed\")\n}", "title": "" }, { "docid": "2e02d3fbe4fb868de7ec5d6bcbb939df", "score": "0.46559682", "text": "func (c AESCBC) Decrypt(cipherText []byte) []byte {\n\t// CBC mode always works in whole blocks.\n\tif len(cipherText)%aes.BlockSize != 0 {\n\t\tpanic(\"ciphertext is not a multiple of the block size\")\n\t}\n\n\tdecryptedText := make([]byte, len(cipherText))\n\n\tmode := cipher.NewCBCDecrypter(c.block, c.iv)\n\n\tfor i := 0; i < len(cipherText)/aes.BlockSize; i++ {\n\t\tmode.CryptBlocks(decryptedText[i*aes.BlockSize:(i+1)*aes.BlockSize], cipherText[i*aes.BlockSize:(i+1)*aes.BlockSize])\n\t}\n\treturn decryptedText\n}", "title": "" }, { "docid": "fcc822d5e49cb07ad005a98ceee67546", "score": "0.46476376", "text": "func Decrypt(key string, cipherText string, nonce string) []byte {\n\tkeyInBytes, err := hex.DecodeString(key)\n\tPanicOnError(err)\n\tdata, err := hex.DecodeString(cipherText)\n\tPanicOnError(err)\n\tblock, err := aes.NewCipher(keyInBytes)\n\tPanicOnError(err)\n\tgcm, err := cipher.NewGCM(block)\n\tPanicOnError(err)\n\tnonceInBytes, err := hex.DecodeString(nonce[0 : 2*gcm.NonceSize()])\n\tPanicOnError(err)\n\tdata, err = gcm.Open(nil, nonceInBytes, data, nil)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn data\n}", "title": "" }, { "docid": "2c9ec2397997b67243f052b800112adb", "score": "0.46455958", "text": "func Decrypt(ciphertext, key string) (string, error) {\n\tvar plaintext, ciphertextb []byte\n\tvar err error\n\n\tciphertextb, err = base64.StdEncoding.DecodeString(string(ciphertext))\n\tplaintext, err = decrypt(ciphertextb, []byte(key))\n\n\treturn string(plaintext), err\n}", "title": "" }, { "docid": "76aaff055e5fb707088ee1096dbeb331", "score": "0.46440604", "text": "func Decrypt(passphrase string, ciphertext []byte) (string, error) {\n\tarr := strings.Split(string(ciphertext), \"-\")\n\tsalt, err := hex.DecodeString(arr[0])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tiv, err := hex.DecodeString(arr[1])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdata, err := hex.DecodeString(arr[2])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tkey, _, err := deriveKey(passphrase, salt)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tb, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taesgcm, err := cipher.NewGCM(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdata, err = aesgcm.Open(nil, iv, data, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(data), nil\n}", "title": "" }, { "docid": "b0e4717cc24a02e5daff1ad9de9bf6f9", "score": "0.46405047", "text": "func Decrypt(key, ciphertext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ciphertext)%aes.BlockSize != 0 {\n\t\treturn nil, errors.New(\"not multiple of AES blocksize\")\n\t}\n\n\tiv := ciphertext[:aes.BlockSize]\n\tmode := cipher.NewCBCDecrypter(block, iv)\n\tmode.CryptBlocks(ciphertext, ciphertext)\n\tpad := ciphertext[len(ciphertext)-1]\n\tif pad > aes.BlockSize {\n\t\treturn nil, fmt.Errorf(\"pad value (%d) larger than AES blocksize (%d)\", pad, aes.BlockSize)\n\t}\n\treturn ciphertext[aes.BlockSize : len(ciphertext)-int(pad)], nil\n}", "title": "" }, { "docid": "a98feb6bf352659799b7156061c34e80", "score": "0.46317896", "text": "func Decrypt(key []byte, text string) string {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcipherText := decodeBase64(text)\n\tcfb := cipher.NewCFBDecrypter(block, iv)\n\tplaintext := make([]byte, len(cipherText))\n\tcfb.XORKeyStream(plaintext, cipherText)\n\treturn string(plaintext)\n}", "title": "" }, { "docid": "4fc3a169005bae2af67654b619a02f51", "score": "0.4626395", "text": "func PBEDecrypt(ciphertext, password []byte) ([]byte, error) {\n\tif password == nil || len(password) == 0 {\n\t\treturn nil, newError(\"null or empty password\")\n\t}\n\n\tvar pbed PBEData\n\tif err := proto.Unmarshal(ciphertext, &pbed); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Recover the keys from the password and the PBE header.\n\tif *pbed.Version != CryptoVersion_CRYPTO_VERSION_2 {\n\t\treturn nil, newError(\"bad version\")\n\t}\n\n\tvar aesKey []byte\n\tvar hmacKey []byte\n\tswitch TaoCryptoSuite {\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported cipher suite\")\n\tcase Basic128BitCipherSuite:\n\t\t// 128-bit AES key.\n\t\taesKey = pbkdf2.Key(password, pbed.Salt[:8], int(*pbed.Iterations), 16, sha256.New)\n\t\tdefer ZeroBytes(aesKey)\n\t\t// 64-byte HMAC-SHA256 key.\n\t\thmacKey = pbkdf2.Key(password, pbed.Salt[8:], int(*pbed.Iterations), 32, sha256.New)\n\tcase Basic192BitCipherSuite:\n\t\t// 256-bit AES key.\n\t\taesKey = pbkdf2.Key(password, pbed.Salt[:8], int(*pbed.Iterations), 32, sha512.New384)\n\t\tdefer ZeroBytes(aesKey)\n\t\t// 48-byte HMAC-SHA384 key.\n\t\thmacKey = pbkdf2.Key(password, pbed.Salt[8:], int(*pbed.Iterations), 48, sha512.New384)\n\t\tdefer ZeroBytes(hmacKey)\n\tcase Basic256BitCipherSuite:\n\t\t// 256-bit AES key.\n\t\taesKey = pbkdf2.Key(password, pbed.Salt[:8], int(*pbed.Iterations), 32, sha512.New)\n\t\tdefer ZeroBytes(aesKey)\n\t\t// 64-byte HMAC-SHA512 key.\n\t\thmacKey = pbkdf2.Key(password, pbed.Salt[8:], int(*pbed.Iterations), 64, sha512.New)\n\t\tdefer ZeroBytes(hmacKey)\n\t}\n\n\tck := new(CryptoKey)\n\tver := CryptoVersion_CRYPTO_VERSION_2\n\tkeyName := \"PBEKey\"\n\tkeyEpoch := int32(1)\n\tkeyType := CrypterTypeFromSuiteName(TaoCryptoSuite)\n\tif keyType == nil {\n\t\treturn nil, newError(\"bad CrypterTypeFromSuiteName\")\n\t}\n\tkeyPurpose := \"crypting\"\n\tkeyStatus := \"active\"\n\tch := &CryptoHeader{\n\t\tVersion: &ver,\n\t\tKeyName: &keyName,\n\t\tKeyEpoch: &keyEpoch,\n\t\tKeyType: keyType,\n\t\tKeyPurpose: &keyPurpose,\n\t\tKeyStatus: &keyStatus,\n\t}\n\tck.KeyHeader = ch\n\tck.KeyComponents = append(ck.KeyComponents, aesKey)\n\tck.KeyComponents = append(ck.KeyComponents, hmacKey)\n\tc := CrypterFromCryptoKey(*ck)\n\n\tdefer ZeroBytes(hmacKey)\n\n\t// Note that we're abusing the PBEData format here, since the IV and\n\t// the MAC are actually contained in the ciphertext from Encrypt().\n\tdata, err := c.Decrypt(pbed.Ciphertext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "29d7bc0c9d064039275a6ed9e4d7920b", "score": "0.46255183", "text": "func Decrypt(str string) (string, error) {\n\tcipherText, err := base64.URLEncoding.DecodeString(str)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tblock, err := aes.NewCipher([]byte(os.Getenv(\"ENC_KEY\")))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(cipherText) < aes.BlockSize {\n\t\terr = errors.New(\"Ciphertext block size is too short!\")\n\t\treturn \"\", err\n\t}\n\n\t//IV needs to be unique, but doesn't have to be secure.\n\t//It's common to put it at the beginning of the ciphertext.\n\tiv := cipherText[:aes.BlockSize]\n\tcipherText = cipherText[aes.BlockSize:]\n\n\tstream := cipher.NewCFBDecrypter(block, iv)\n\t// XORKeyStream can work in-place if the two arguments are the same.\n\tstream.XORKeyStream(cipherText, cipherText)\n\n\treturn string(cipherText), nil\n}", "title": "" } ]
1b6a2645a13bf43eb2a9b0f04e685278
moveTaskOrderPopulated function spot checks a few values in the Move, Orders, and Customer to ensure they are populated.
[ { "docid": "40e80d9605a4564431d3eb4b0b1d1598", "score": "0.809012", "text": "func (suite *HandlerSuite) moveTaskOrderPopulated(response *movetaskorderops.CreateMoveTaskOrderCreated,\n\tdestinationDutyLocation *models.DutyLocation,\n\toriginDutyLocation *models.DutyLocation) {\n\n\tresponsePayload := response.Payload\n\n\tsuite.NotNil(responsePayload.MoveCode)\n\tsuite.NotNil(responsePayload.Order.Customer.FirstName)\n\n\tsuite.Equal(destinationDutyLocation.Name, responsePayload.Order.DestinationDutyLocation.Name)\n\tsuite.Equal(originDutyLocation.Name, responsePayload.Order.OriginDutyLocation.Name)\n\n}", "title": "" } ]
[ { "docid": "9cd32483bc3eb4f027b75bf5b44e39c5", "score": "0.60479504", "text": "func (o *moveTaskOrderCreator) CreateMoveTaskOrder(appCtx appcontext.AppContext, moveTaskOrder *models.Move) (*models.Move, *validate.Errors, error) {\n\t// generate reference id if empty\n\tif moveTaskOrder.ReferenceID == nil || strings.TrimSpace(*moveTaskOrder.ReferenceID) == \"\" {\n\t\treferenceID, err := models.GenerateReferenceID(appCtx.DB())\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tmoveTaskOrder.ReferenceID = &referenceID\n\t}\n\n\tmoveTaskOrder.Show = models.BoolPointer(true)\n\n\t// TODO: Remove this? Doesn't Pop automatically do this?\n\tmoveTaskOrder.CreatedAt = time.Now()\n\tmoveTaskOrder.UpdatedAt = time.Now()\n\n\tverrs, err := o.builder.CreateOne(appCtx, moveTaskOrder)\n\tif verrs != nil || err != nil {\n\t\treturn nil, verrs, err\n\t}\n\n\treturn moveTaskOrder, nil, nil\n}", "title": "" }, { "docid": "ffd76cb7067e8e5728b59f972fbfc3ff", "score": "0.5447879", "text": "func TestPlaceOrder(t *testing.T) {\n\n\ttestStore := Store{\n\t\torders: make(OrderMap),\n\t}\n\ttestCust := &model.Customer{Name: \"Abel Kuruvilla\", Email: \"abel@qwe.com\", Mobile: 8089352216}\n\ttestVegPizza := &model.VegPizza{}\n\ttestStore.PlaceOrder(testCust, testVegPizza)\n\tif !doesArrayContainElem(testStore.orders[testCust], testVegPizza) {\n\t\tt.Errorf(\"Failed in placing Order. Order not in array\")\n\t}\n}", "title": "" }, { "docid": "be5b2e880e4ee5839af65d81b6c2f5f8", "score": "0.5419442", "text": "func (m *MoveOrder) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\tvar vs []validate.Validator\n\tvs = append(vs, &OptionalUUIDIsPresent{Field: m.CustomerID, Name: \"CustomerID\"})\n\tvs = append(vs, &OptionalUUIDIsPresent{Field: m.EntitlementID, Name: \"EntitlementID\"})\n\tvs = append(vs, &OptionalUUIDIsPresent{Field: m.DestinationDutyStationID, Name: \"DestinationDutyStationID\"})\n\tvs = append(vs, &OptionalUUIDIsPresent{Field: m.OriginDutyStationID, Name: \"OriginDutyStationID\"})\n\treturn validate.Validate(vs...), nil\n}", "title": "" }, { "docid": "d30579b7c46aafc26586ba9b52020c72", "score": "0.52560943", "text": "func makeOrder(db *pop.Connection, assertions Assertions) models.Order {\n\t// Create new relational data if not provided\n\tsm := assertions.Order.ServiceMember\n\t// ID is required because it must be populated for Eager saving to work.\n\tif isZeroUUID(assertions.Order.ServiceMemberID) {\n\t\tsm = makeExtendedServiceMember(db, assertions)\n\t}\n\n\tdutyLocation := assertions.Order.NewDutyLocation\n\t// Note above\n\tif isZeroUUID(assertions.Order.NewDutyLocationID) {\n\t\tdutyLocation = fetchOrMakeDefaultNewOrdersDutyLocation(db)\n\t}\n\n\tdocument := assertions.Order.UploadedOrders\n\t// Note above\n\tif isZeroUUID(assertions.Order.UploadedOrdersID) {\n\t\tfullDocumentAssertions := Assertions{\n\t\t\tDocument: models.Document{\n\t\t\t\tServiceMemberID: sm.ID,\n\t\t\t\tServiceMember: sm,\n\t\t\t},\n\t\t}\n\n\t\tmergeModels(&fullDocumentAssertions, assertions)\n\n\t\tdocument = makeDocument(db, fullDocumentAssertions)\n\n\t\tfullUserUploadAssertions := Assertions{\n\t\t\tUserUpload: models.UserUpload{\n\t\t\t\tDocumentID: &document.ID,\n\t\t\t\tDocument: document,\n\t\t\t\tUploaderID: sm.UserID,\n\t\t\t},\n\t\t\tUserUploader: assertions.UserUploader,\n\t\t}\n\n\t\tmergeModels(&fullUserUploadAssertions, assertions)\n\n\t\tu := makeUserUpload(db, fullUserUploadAssertions)\n\n\t\tdocument.UserUploads = append(document.UserUploads, u)\n\t}\n\n\tdefaultOrderNumber := \"ORDER3\"\n\tordersNumber := assertions.Order.OrdersNumber\n\tif ordersNumber == nil {\n\t\tordersNumber = &defaultOrderNumber\n\t}\n\n\tdefaultTACNumber := \"F8E1\"\n\tTAC := assertions.Order.TAC\n\tif TAC == nil {\n\t\tTAC = &defaultTACNumber\n\t}\n\n\tdefaultDepartmentIndicator := \"AIR_FORCE\"\n\tdepartmentIndicator := assertions.Order.DepartmentIndicator\n\tif departmentIndicator == nil {\n\t\tdepartmentIndicator = &defaultDepartmentIndicator\n\t}\n\thasDependents := assertions.Order.HasDependents || false\n\tspouseHasProGear := assertions.Order.SpouseHasProGear || false\n\tgrade := \"E_1\"\n\n\tentitlement := assertions.Entitlement\n\tif isZeroUUID(entitlement.ID) {\n\t\tassertions.Order.Grade = &grade\n\t\tentitlement = makeEntitlement(db, assertions)\n\t}\n\n\toriginDutyLocation := assertions.OriginDutyLocation\n\tif isZeroUUID(originDutyLocation.ID) {\n\t\toriginDutyLocation = makeDutyLocation(db, assertions)\n\t}\n\n\tgbloc, err := models.FetchGBLOCForPostalCode(db, originDutyLocation.Address.PostalCode)\n\tif gbloc.GBLOC == \"\" || err != nil {\n\t\tgbloc = makePostalCodeToGBLOC(db, originDutyLocation.Address.PostalCode, \"KKFA\")\n\t}\n\n\torderTypeDetail := assertions.Order.OrdersTypeDetail\n\thhgPermittedString := internalmessages.OrdersTypeDetail(\"HHG_PERMITTED\")\n\tif orderTypeDetail == nil || *orderTypeDetail == \"\" {\n\t\torderTypeDetail = &hhgPermittedString\n\t}\n\n\t// Added as a stopgap solution to populate these new fields\n\t// This testdatagen function is still being utilized through the MakeMTOServiceItemCustomerContact func\n\tdefaultSupplyAndServicesCostEstimate := models.SupplyAndServicesCostEstimate\n\tdefaultMethodOfPayment := models.MethodOfPayment\n\tdefaultNAICS := models.NAICS\n\tcontractor := fetchOrMakeContractor(db, Assertions{})\n\tdefaultPackingAndShippingInstructions := models.InstructionsBeforeContractNumber + \" \" + contractor.ContractNumber + \" \" + models.InstructionsAfterContractNumber\n\n\torder := models.Order{\n\t\tServiceMember: sm,\n\t\tServiceMemberID: sm.ID,\n\t\tNewDutyLocation: dutyLocation,\n\t\tNewDutyLocationID: dutyLocation.ID,\n\t\tUploadedOrders: document,\n\t\tUploadedOrdersID: document.ID,\n\t\tUploadedAmendedOrders: assertions.Order.UploadedAmendedOrders,\n\t\tUploadedAmendedOrdersID: assertions.Order.UploadedAmendedOrdersID,\n\t\tIssueDate: time.Date(TestYear, time.March, 15, 0, 0, 0, 0, time.UTC),\n\t\tReportByDate: time.Date(TestYear, time.August, 1, 0, 0, 0, 0, time.UTC),\n\t\tOrdersType: internalmessages.OrdersTypePERMANENTCHANGEOFSTATION,\n\t\tOrdersNumber: ordersNumber,\n\t\tHasDependents: hasDependents,\n\t\tSpouseHasProGear: spouseHasProGear,\n\t\tStatus: models.OrderStatusDRAFT,\n\t\tTAC: TAC,\n\t\tDepartmentIndicator: departmentIndicator,\n\t\tGrade: &grade,\n\t\tEntitlement: &entitlement,\n\t\tEntitlementID: &entitlement.ID,\n\t\tOriginDutyLocation: &originDutyLocation,\n\t\tOriginDutyLocationID: &originDutyLocation.ID,\n\t\tOrdersTypeDetail: orderTypeDetail,\n\t\tOriginDutyLocationGBLOC: &gbloc.GBLOC,\n\t\tSupplyAndServicesCostEstimate: defaultSupplyAndServicesCostEstimate,\n\t\tMethodOfPayment: defaultMethodOfPayment,\n\t\tNAICS: defaultNAICS,\n\t\tPackingAndShippingInstructions: defaultPackingAndShippingInstructions,\n\t}\n\n\t// Overwrite values with those from assertions\n\tmergeModels(&order, assertions.Order)\n\n\tmustCreate(db, &order, assertions.Stub)\n\n\treturn order\n}", "title": "" }, { "docid": "cf49cd609117c89e554cbe4e3abd7f5d", "score": "0.5232795", "text": "func (h GetMoveTaskOrderHandler) Handle(params movetaskorderops.GetMoveTaskOrderParams) middleware.Responder {\n\treturn h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest,\n\t\tfunc(appCtx appcontext.AppContext) (middleware.Responder, error) {\n\t\t\tsearchParams := services.MoveTaskOrderFetcherParams{\n\t\t\t\tIsAvailableToPrime: true,\n\t\t\t\tExcludeExternalShipments: true,\n\t\t\t}\n\n\t\t\t// Add either ID or Locator to search params\n\t\t\tmoveTaskOrderID := uuid.FromStringOrNil(params.MoveID)\n\t\t\tif moveTaskOrderID != uuid.Nil {\n\t\t\t\tsearchParams.MoveTaskOrderID = moveTaskOrderID\n\t\t\t} else {\n\t\t\t\tsearchParams.Locator = params.MoveID\n\t\t\t}\n\n\t\t\tmto, err := h.moveTaskOrderFetcher.FetchMoveTaskOrder(appCtx, &searchParams)\n\t\t\tif err != nil {\n\t\t\t\tappCtx.Logger().Error(\"primeapi.GetMoveTaskOrderHandler error\", zap.Error(err))\n\t\t\t\tswitch err.(type) {\n\t\t\t\tcase apperror.NotFoundError:\n\t\t\t\t\treturn movetaskorderops.NewGetMoveTaskOrderNotFound().WithPayload(\n\t\t\t\t\t\tpayloads.ClientError(handlers.NotFoundMessage, *handlers.FmtString(err.Error()), h.GetTraceIDFromRequest(params.HTTPRequest))), err\n\t\t\t\tdefault:\n\t\t\t\t\treturn movetaskorderops.NewGetMoveTaskOrderInternalServerError().WithPayload(\n\t\t\t\t\t\tpayloads.InternalServerError(handlers.FmtString(err.Error()), h.GetTraceIDFromRequest(params.HTTPRequest))), err\n\t\t\t\t}\n\t\t\t}\n\t\t\tmoveTaskOrderPayload := payloads.MoveTaskOrder(mto)\n\n\t\t\treturn movetaskorderops.NewGetMoveTaskOrderOK().WithPayload(moveTaskOrderPayload), nil\n\t\t})\n}", "title": "" }, { "docid": "bf17ec40699e211735b9ed4dc9fbf74e", "score": "0.5156472", "text": "func makeMove(db *pop.Connection, assertions Assertions) models.Move {\n\n\t// Create new Orders if not provided\n\torders := assertions.Order\n\t// ID is required because it must be populated for Eager saving to work.\n\tif isZeroUUID(assertions.Order.ID) {\n\t\torders = makeOrder(db, assertions)\n\t}\n\n\tassertedReferenceID := assertions.Move.ReferenceID\n\tvar referenceID string\n\tif assertedReferenceID == nil || *assertedReferenceID == \"\" {\n\t\treferenceID, _ = models.GenerateReferenceID(db)\n\t}\n\n\tvar contractorID uuid.UUID\n\tmoveContractorID := assertions.Move.ContractorID\n\tif moveContractorID == nil {\n\t\tcontractor := fetchOrMakeContractor(db, assertions)\n\t\tcontractorID = contractor.ID\n\t}\n\n\tppmType := assertions.Move.PPMType\n\tif assertions.Move.PPMType == nil {\n\t\tpartialType := \"PARTIAL\"\n\t\tppmType = &partialType\n\t}\n\n\tmove := models.Move{\n\t\tOrders: orders,\n\t\tOrdersID: orders.ID,\n\t\tPPMType: ppmType,\n\t\tStatus: models.MoveStatusDRAFT,\n\t\tLocator: models.GenerateLocator(),\n\t\tShow: setShow(assertions.Move.Show),\n\t\tContractorID: &contractorID,\n\t\tReferenceID: &referenceID,\n\t}\n\n\t// Overwrite values with those from assertions\n\tmergeModels(&move, assertions.Move)\n\n\tmustCreate(db, &move, assertions.Stub)\n\n\treturn move\n}", "title": "" }, { "docid": "d951b28baf852dbb849a533440e503d5", "score": "0.51457363", "text": "func (router moveRouter) ApproveAmendedOrders(moveID uuid.UUID, ordersID uuid.UUID) (models.Move, error) {\n\tvar move models.Move\n\terr := router.db.EagerPreload(\"MTOServiceItems\").\n\t\tWhere(\"moves.id = ?\", moveID).\n\t\tFirst(&move)\n\n\tif err != nil {\n\t\trouter.logger.Error(\"failure encountered querying for move associated with orders\", zap.Error(err))\n\t\treturn models.Move{}, fmt.Errorf(\"failure encountered querying for move associated with orders, %s, id: %s\", err.Error(), ordersID)\n\t}\n\n\tif move.Status != models.MoveStatusAPPROVALSREQUESTED {\n\t\treturn models.Move{}, errors.Wrap(\n\t\t\tmodels.ErrInvalidTransition,\n\t\t\t\"Cannot approve move with amended orders because the move status is not APPROVALS REQUESTED\",\n\t\t)\n\t}\n\n\tvar hasRequestedServiceItems bool\n\tfor _, serviceItem := range move.MTOServiceItems {\n\t\tif serviceItem.Status == models.MTOServiceItemStatusSubmitted {\n\t\t\thasRequestedServiceItems = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !hasRequestedServiceItems {\n\t\tapproveErr := router.Approve(&move)\n\t\tif approveErr != nil {\n\t\t\treturn models.Move{}, approveErr\n\t\t}\n\t}\n\n\treturn move, nil\n}", "title": "" }, { "docid": "baeeed3e34a43378a2051c37f6863b64", "score": "0.50816244", "text": "func (router moveRouter) Submit(move *models.Move) error {\n\tvar err error\n\trouter.logMove(move)\n\n\tneedsServicesCounseling, err := router.needsServiceCounseling(move)\n\tif err != nil {\n\t\trouter.logger.Error(\"failure determining if a move needs services counseling\", zap.Error(err))\n\t\treturn err\n\t}\n\trouter.logger.Info(\"SUCCESS: Determining if move needs services counseling or not\")\n\n\tif needsServicesCounseling {\n\t\terr = router.sendToServiceCounselor(move)\n\t\tif err != nil {\n\t\t\trouter.logger.Error(\"failure routing move to services counseling\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t\trouter.logger.Info(\"SUCCESS: Move sent to services counseling\")\n\t} else if move.Orders.UploadedAmendedOrders != nil {\n\t\trouter.logger.Info(\"Move has amended orders\")\n\t\ttransactionError := router.db.Transaction(func(tx *pop.Connection) error {\n\t\t\terr = router.SendToOfficeUser(move)\n\t\t\tif err != nil {\n\t\t\t\trouter.logger.Error(\"failure routing move submission with amended orders\", zap.Error(err))\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Let's get the orders for this move so we can wipe out the acknowledgement if it exists already (from a prior orders amendment process)\n\t\t\tvar ordersForMove models.Order\n\t\t\terr = tx.Find(&ordersForMove, move.OrdersID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Here we'll nil out the value (if it's set already) so that on the client-side we'll see view this change\n\t\t\t// in status as 'new orders' that need acknowledging by the TOO.\n\t\t\t// We shouldn't need more complicated logic here since we only hit this point from calling Submit().\n\t\t\t// Other circumstances like new MTOServiceItems will be calling SendToOfficeUser() directly.\n\t\t\trouter.logger.Info(\"Determining whether there is a preexisting orders acknowledgement\")\n\t\t\tif ordersForMove.AmendedOrdersAcknowledgedAt != nil {\n\t\t\t\trouter.logger.Info(\"Move has a preexisting acknowledgement\")\n\t\t\t\tordersForMove.AmendedOrdersAcknowledgedAt = nil\n\t\t\t\t_, err = tx.ValidateAndSave(&ordersForMove)\n\t\t\t\tif err != nil {\n\t\t\t\t\trouter.logger.Error(\"failure resetting orders AmendedOrdersAcknowledgeAt field when routing move submission with amended orders \", zap.Error(err))\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trouter.logger.Info(\"Successfully reset orders acknowledgement\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif transactionError != nil {\n\t\t\treturn transactionError\n\t\t}\n\t\trouter.logger.Info(\"SUCCESS: Move with amended orders sent to office user / TOO queue\")\n\t} else {\n\t\terr = router.sendNewMoveToOfficeUser(move)\n\t\tif err != nil {\n\t\t\trouter.logger.Error(\"failure routing move to office user / TOO queue\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t\trouter.logger.Info(\"SUCCESS: Move sent to office user / TOO queue\")\n\t}\n\n\trouter.logger.Info(\"SUCCESS: Move submitted and routed to the appropriate queue\")\n\treturn nil\n}", "title": "" }, { "docid": "4792353f14b00350105415f0d788e2f5", "score": "0.5037987", "text": "func (t *Task) MoveBefore(list Tasks, target *Task) error {\n\n // make sure both tasks are in the same list to start with\n indexTask := findTaskInSlice(list, t)\n if indexTask == -1 {\n return errors.New(\"pim-move: task is not in list\") \n }\n\n // if specified, make sure target is in the same list\n var indexTarget = len(list)\n if target != nil {\n indexTarget = findTaskInSlice(list, target)\n if indexTarget == -1 {\n return errors.New(\"pim-move: target task is not in list\") \n }\n }\n\n // move me before sibling or to the end of the list\n removeTaskFromSlice(list, indexTask)\n insertTaskInSlice(list, t, indexTarget)\n return nil\n}", "title": "" }, { "docid": "257a34d31aae274de7a5afee214eec48", "score": "0.50271374", "text": "func buildApprovedPPMShipmentWaitingOnCustomer(db *pop.Connection, userUploader *uploader.UserUploader, customs []Customization) models.PPMShipment {\n\tppmShipment := BuildPPMShipment(db, customs, []Trait{GetTraitApprovedPPMShipment})\n\n\tif ppmShipment.HasRequestedAdvance == nil || !*ppmShipment.HasRequestedAdvance {\n\t\treturn ppmShipment\n\t}\n\n\tserviceMember := ppmShipment.Shipment.MoveTaskOrder.Orders.ServiceMember\n\tif db == nil && serviceMember.ID.IsNil() {\n\t\t// this is a stubbed ppm shipment and a stubbed service member\n\t\t// we want to fake out the id in this case\n\t\tserviceMember.ID = uuid.Must(uuid.NewV4())\n\t\tppmShipment.Shipment.MoveTaskOrder.Orders.ServiceMemberID = serviceMember.ID\n\t}\n\n\tif db == nil && ppmShipment.Shipment.MoveTaskOrder.ID.IsNil() {\n\t\t// this is a stubbed ppm shipment and a stubbed move\n\t\t// we want to fake out the id in this case\n\t\tppmShipment.Shipment.MoveTaskOrder.ID = uuid.Must(uuid.NewV4())\n\t\tppmShipment.Shipment.MoveTaskOrderID = ppmShipment.Shipment.MoveTaskOrder.ID\n\t}\n\n\taoaFile := testdatagen.Fixture(\"aoa-packet.pdf\")\n\n\taoaPacket := buildDocumentWithUploads(db, userUploader, serviceMember, aoaFile)\n\n\tppmShipment.AOAPacket = &aoaPacket\n\tppmShipment.AOAPacketID = &aoaPacket.ID\n\n\tif db != nil {\n\t\tmustSave(db, &ppmShipment)\n\t}\n\n\t// Because of the way we're working with the PPMShipment, the\n\t// changes we've made to it aren't reflected in the pointer\n\t// reference that the MTOShipment has, so we'll need to update it\n\t// to point at the latest version.\n\tppmShipment.Shipment.PPMShipment = &ppmShipment\n\n\treturn ppmShipment\n}", "title": "" }, { "docid": "36b6858a1c1fc174ea7f8421d732e3d9", "score": "0.5024329", "text": "func buildApprovedPPMShipmentWithActualInfo(db *pop.Connection, userUploader *uploader.UserUploader, customs []Customization) models.PPMShipment {\n\t// It's easier to use some of the data from other downstream\n\t// functions if we have them go first and then make our changes on\n\t// top of those changes.\n\tppmShipment := buildApprovedPPMShipmentWaitingOnCustomer(db, userUploader, customs)\n\n\tppmShipment.ActualMoveDate = models.TimePointer(ppmShipment.ExpectedDepartureDate.AddDate(0, 0, 1))\n\tppmShipment.ActualPickupPostalCode = &ppmShipment.PickupPostalCode\n\tppmShipment.ActualDestinationPostalCode = &ppmShipment.DestinationPostalCode\n\n\tif ppmShipment.HasRequestedAdvance != nil && *ppmShipment.HasRequestedAdvance {\n\t\tppmShipment.HasReceivedAdvance = models.BoolPointer(true)\n\n\t\tppmShipment.AdvanceAmountReceived = ppmShipment.AdvanceAmountRequested\n\t} else {\n\t\tppmShipment.HasReceivedAdvance = models.BoolPointer(false)\n\t}\n\n\tnewDutyLocationAddress := ppmShipment.Shipment.MoveTaskOrder.Orders.NewDutyLocation.Address\n\n\tw2Address := BuildAddress(db, []Customization{\n\t\t{\n\t\t\tModel: models.Address{\n\t\t\t\tStreetAddress1: \"987 New Street\",\n\t\t\t\tCity: newDutyLocationAddress.City,\n\t\t\t\tState: newDutyLocationAddress.State,\n\t\t\t\tPostalCode: newDutyLocationAddress.PostalCode,\n\t\t\t},\n\t\t},\n\t}, nil)\n\n\tppmShipment.W2AddressID = &w2Address.ID\n\tppmShipment.W2Address = &w2Address\n\n\tif db != nil {\n\t\tmustSave(db, &ppmShipment)\n\t} else {\n\t\t// tests expect a stubbed PPM Shipment built with this factory\n\t\t// method to have CreatedAt/UpdatedAt\n\t\tppmShipment.CreatedAt = time.Now()\n\t\tppmShipment.UpdatedAt = ppmShipment.CreatedAt\n\t}\n\n\t// Because of the way we're working with the PPMShipment, the\n\t// changes we've made to it aren't reflected in the pointer\n\t// reference that the MTOShipment has, so we'll need to update it\n\t// to point at the latest version.\n\tppmShipment.Shipment.PPMShipment = &ppmShipment\n\n\treturn ppmShipment\n\n}", "title": "" }, { "docid": "0b931828824e25e4f7337a68434294b9", "score": "0.5014031", "text": "func (cs *ControllerStruct) PlaceOrder(c *gin.Context) {\n\tvar order Models.Order\n\tif err := c.BindJSON(&order); err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tproductId := order.ProductID\n\tcustomerId := order.CustomerID\n\torderQuantity := order.Quantity\n\torder.Status = \"order placed\"\n\tlastOrderTime, ok := Config.CustomerOrders[customerId]\n\tif ok && time.Now().Sub(lastOrderTime).Milliseconds() < 300000 {\n\t\tc.JSON(http.StatusTooEarly, \"Customer is in cool-down period\")\n\t\treturn\n\t}\n\tproduct, exists, err := Repo.GetProductByID(productId, cs.DB)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tif !exists {\n\t\tc.JSON(http.StatusNoContent, \"Product does not exist\")\n\t\treturn\n\t}\n\tif product.Quantity - orderQuantity < 0 {\n\t\torder.Status = \"failed\"\n\t}\n\tif order.ID == \"\" {\n\t\torder.ID = \"ORD\" + Config.GetOrderCounter()\n\t}\n\terr = Repo.PlaceOrder(&order, cs.DB)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tConfig.CustomerOrders[customerId] = order.CreatedAt\n\tif order.Status == \"failed\" {\n\t\tc.JSON(http.StatusOK, order)\n\t\treturn\n\t}\n\tif err = Repo.UpdateProductByID(&product, cs.DB, product.Price, product.Quantity-orderQuantity); err != nil {\n\t\tfmt.Println(err)\n\t\tc.JSON(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, order)\n}", "title": "" }, { "docid": "0d1605a67fd7142f6fdaae47b5b2dded", "score": "0.50057846", "text": "func (m *MoveOrder) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCustomer(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCustomerID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDateIssued(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDestinationDutyStation(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDestinationDutyStationID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEntitlement(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOriginDutyStation(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOriginDutyStationID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReportByDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf1c156a49da19adfacef5289125d6fd", "score": "0.49912176", "text": "func (gameboard GameBoard) performMove(move Move) (outBoard GameBoard, err error) {\n // outBoard = NewBoard(cap(gameboard.Positions))\n outBoard = gameboard.copy()\n\n // TODO - this should be eventually be part of another method that runs through\n // all the game rules in appropriate order.\n if gameboard.Positions[move.Position.X][move.Position.Y] != EmptyPosition {\n return outBoard, fmt.Errorf(RulesFailureSpaceOccupied, move)\n }\n\n outBoard.Positions[move.Position.X][move.Position.Y] = move.Player\n return outBoard, err\n}", "title": "" }, { "docid": "10db38b57de7887834f99a6190484c79", "score": "0.49759844", "text": "func (r *Runtime) processOrders() {\n\tfor {\n\t\torder := <-r.orderStream\n\n\t\tif COMMAND_CODES[order.GetCommandCode()] == \"update tick\" {\n\t\t\t// Don't need to specialy handle this, since all commands may\n\t\t\t// update the tick number as part of them\n\t\t} else if COMMAND_CODES[order.GetCommandCode()] == \"set queue\" {\n\t\t\tentity := GAME.GetEntityByPlayer(order.GetPlayer())\n\n\t\t\tif len(order.GetActions()) <= 0 {\n\t\t\t\tlog.Printf(\"Ignoring %v's set queue: no actions set\",\n\t\t\t\t\torder.GetPlayer().GetName())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tentity.SetActionQueue(order.GetActions())\n\t\t}\n\n\t\t// Must be done after the rest of the order processing to make sure\n\t\t// that the game state update routine doesn't race condition us\n\t\tupdateTick(order)\n\t}\n}", "title": "" }, { "docid": "6911b77dac8536f970d17d9046033b7c", "score": "0.4975937", "text": "func TestPlaceETTOrder(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\trequest := okgroup.PlaceETTOrderRequest{\n\t\tQuoteCurrency: spotCurrency,\n\t\tType: 0,\n\t\tSize: \"100\",\n\t\tAmount: -1,\n\t\tETT: \"OK06\",\n\t}\n\n\t_, err := o.PlaceETTOrder(context.Background(), &request)\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "2de40388af72f281cf8ea72355507beb", "score": "0.49585462", "text": "func (o *CreateExcessWeightRecordParams) SetMoveTaskOrderID(moveTaskOrderID strfmt.UUID) {\n\to.MoveTaskOrderID = moveTaskOrderID\n}", "title": "" }, { "docid": "024c339a2019327eb252db97701895db", "score": "0.49477267", "text": "func (sm *ShardMaster) execMove(shardNum int, GID int) {\n\t//step1. construct a new config{}\n\tconfig := Config{}\n\t//get the up-2-date config info\n\tsm.getConfig(-1, &config)\n\t//add the index num of the current config\n\tconfig.Num++\n\n\tconfig.Shards[shardNum] = GID\n\n\t//stepNo there is not a rebalance in move\n\t//step3.append new config to sm.configs\n\tsm.configs = append(sm.configs, config)\n\n}", "title": "" }, { "docid": "3a8f91a83a7234346f5e3cb3ce594de1", "score": "0.49266157", "text": "func addNoOrdersBetweenOrders(\n\torderArray []datamodel.OrdersRaw,\n\tfrom time.Time,\n\tto time.Time) (processedOrders []datamodel.OrderEntry) {\n\n\t// Loop through all datapoints\n\tfor index, dataPoint := range orderArray {\n\n\t\t// if first entry and no order has started yet, then add no order till first order starts\n\t\tif index == 0 && dataPoint.BeginTimestamp.After(from) {\n\n\t\t\tnewTimestampEnd := dataPoint.BeginTimestamp.Add(time.Duration(-1) * time.Millisecond) // end it one Millisecond before the next orders starts\n\n\t\t\tfullRow := datamodel.OrderEntry{\n\t\t\t\tTimestampBegin: from,\n\t\t\t\tTimestampEnd: newTimestampEnd,\n\t\t\t\tOrderType: \"noOrder\",\n\t\t\t}\n\t\t\tprocessedOrders = append(processedOrders, fullRow)\n\t\t}\n\n\t\tif index > 0 { // if not the first entry, add a noShift\n\n\t\t\tpreviousDataPoint := orderArray[index-1]\n\t\t\ttimestampBegin := previousDataPoint.EndTimestamp\n\t\t\ttimestampEnd := dataPoint.BeginTimestamp\n\n\t\t\tif timestampBegin != timestampEnd { // timestampBegin == timestampEnd ahppens when a no order is already in the list.\n\t\t\t\t// TODO: Fix\n\t\t\t\tfullRow := datamodel.OrderEntry{\n\t\t\t\t\tTimestampBegin: timestampBegin,\n\t\t\t\t\tTimestampEnd: timestampEnd,\n\t\t\t\t\tOrderType: \"noOrder\",\n\t\t\t\t}\n\t\t\t\tprocessedOrders = append(processedOrders, fullRow)\n\t\t\t}\n\t\t}\n\n\t\t// add original order\n\t\tfullRow := datamodel.OrderEntry{\n\t\t\tTimestampBegin: dataPoint.BeginTimestamp,\n\t\t\tTimestampEnd: dataPoint.EndTimestamp,\n\t\t\tOrderType: dataPoint.OrderName,\n\t\t}\n\t\tprocessedOrders = append(processedOrders, fullRow)\n\n\t\t// if last entry and previous order has finished, add a no order\n\t\tif index == len(orderArray)-1 && dataPoint.EndTimestamp.Before(to) {\n\n\t\t\tnewTimestampBegin := dataPoint.EndTimestamp.Add(time.Duration(1) * time.Millisecond) // start one Millisecond after the previous order ended\n\n\t\t\tfullRow := datamodel.OrderEntry{\n\t\t\t\tTimestampBegin: newTimestampBegin,\n\t\t\t\tTimestampEnd: to,\n\t\t\t\tOrderType: \"noOrder\",\n\t\t\t}\n\t\t\tprocessedOrders = append(processedOrders, fullRow)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0fc2d4a323bbe1064ce2c86c968e856d", "score": "0.48832032", "text": "func (s *NotificationsService) ReprocessUnfulfilledOrders() (processedOrders []Order) {\n\tfor i := 0; i < len(s.Orders); i++ {\n\t\tif !s.Orders[i].Status {\n\t\t\tfmt.Printf(\"Current Order: %v\", s.Orders[i])\n\t\t\tfmt.Printf(\"Processing order ID %d\\n\", s.Orders[i].ID) // XXX\n\t\t\ts.ProcessOrder(s.Orders[i].ID)\n\t\t\tprocessedOrders = append(processedOrders, s.Orders[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1142cb5f04a2dffbafe1960b5c1f5bc0", "score": "0.48464605", "text": "func (m *MeetingTimeSuggestion) SetOrder(value *int32)() {\n err := m.GetBackingStore().Set(\"order\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cc97d4c98cf5ee9f02546d08ec779e26", "score": "0.4844753", "text": "func NewCreateMoveTaskOrderBadRequest() *CreateMoveTaskOrderBadRequest {\n\n\treturn &CreateMoveTaskOrderBadRequest{}\n}", "title": "" }, { "docid": "765b2c7d93a9a5a8a8d9f8351861ec6b", "score": "0.48447412", "text": "func NewHideNonFakeMoveTaskOrdersOK() *HideNonFakeMoveTaskOrdersOK {\n\treturn &HideNonFakeMoveTaskOrdersOK{}\n}", "title": "" }, { "docid": "7e5afdc2c32593149908d4f91c34f242", "score": "0.4776966", "text": "func (task *Tasks) SendDanceMove(d amqp.Delivery) (bool, error) {\n\tif isValid, err := validateTask(task, d); !isValid {\n\t\treturn isValid, err\n\t}\n\n\tfmt.Println(string(d.Body))\n\tmessage := ws.Message{Body: string(d.Body)}\n\n\ttask.Pool.Broadcast <- message\n\n\t// insert moves\n\tvar jsonData map[string]interface{}\n\tif err := json.Unmarshal(d.Body, &jsonData); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tqueryString := `\n\t\tinsert into moves (move, delay, accuracy, timestamp, aid, did, sid)\n\t\tvalues ($1, $2, $3, to_timestamp($4), $5, $6, $7)\n\t`\n\n\tdelay, err := strconv.ParseFloat(fmt.Sprintf(\"%s\", jsonData[\"syncDelay\"]), 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\taccuracy, err := strconv.ParseFloat(fmt.Sprintf(\"%s\", jsonData[\"accuracy\"]), 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimestamp, err := strconv.ParseFloat(fmt.Sprintf(\"%s\", jsonData[\"timestamp\"]), 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tres, err := task.DbConn.Exec(\n\t\tqueryString,\n\t\tjsonData[\"move\"],\n\t\tdelay,\n\t\taccuracy,\n\t\ttimestamp,\n\t\t1, // hack because Accounts is not set up\n\t\t1, // did\n\t\ttask.SessionID,\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trowCnt, err := res.RowsAffected()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Print(rowCnt)\n\treturn true, nil\n}", "title": "" }, { "docid": "bba956cf68c3890614c953501228b6b4", "score": "0.4774638", "text": "func InitOrder(ctx sdk.Context, keeper Keeper) (err error) {\n\tfrom := sdk.AccAddress([]byte(\"FromAddress\"))\n\tto := sdk.AccAddress([]byte(\"ToAddress\"))\n\tpegHash := sdk.PegHash([]byte(\"1\"))\n\n\torder := keeper.om.NewOrder(from, to, pegHash)\n\tkeeper.om.SetOrder(ctx, order)\n\treturn\n}", "title": "" }, { "docid": "527595014796652bb5d06727e79099ba", "score": "0.476617", "text": "func (t *CallbackTask) init() int {\n if t.OriData == \"\" {\n return 1\n }\n c := model.CprOrdersModel{}\n tmpUserData := UserData{}\n tmpUserData.Repeated = gjson.Get(t.OriData, \"repeated\").Int()\n tmpUserData.OrderId = gjson.Get(t.OriData, \"orderId\").Int()\n tmpUserData.StatusCode = gjson.Get(t.OriData, \"statusCode\").Int()\n tmpUserData.RenderTime = gjson.Get(t.OriData, \"renderTime\").Float()\n tmpUserData.ResultVideoUrl = gjson.Get(t.OriData, \"resultVideoUrl\").String()\n tmpUserData.NotifyTime = gjson.Get(t.OriData, \"notifyTime\").Int()\n\n if int(t.MaxRepeat) <= int(tmpUserData.Repeated) {\n //save data\n c.SaveOrderResult(tmpUserData.RenderTime, tmpUserData.ResultVideoUrl, 2)\n return 2\n }\n if tmpUserData.Repeated == 0 {\n\n err := c.GetOrderDetail(tmpUserData.OrderId)\n if err != nil {\n fmt.Println(t.OriData)\n return 4\n }\n\n tmpUserData.NotifyUrl = c.NotifyUrl\n tmpUserData.RecordId = c.RecordId\n tmpUserData.NotifyTime = time.Now().Unix()\n\n } else {\n tmpUserData.NotifyUrl = gjson.Get(t.OriData, \"notifyUrl\").String()\n tmpUserData.RecordId = gjson.Get(t.OriData, \"recordId\").String()\n }\n\n t.UserData = &tmpUserData\n\n if tmpUserData.NotifyTime > time.Now().Unix() {\n return 3\n }\n return 0\n}", "title": "" }, { "docid": "640b15922a8b15dabef37489c6bb056b", "score": "0.4764313", "text": "func NewUpdateMoveTaskOrderStatus(ctx *middleware.Context, handler UpdateMoveTaskOrderStatusHandler) *UpdateMoveTaskOrderStatus {\n\treturn &UpdateMoveTaskOrderStatus{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "a77246c2a4fcedb6c3f2d69a632df338", "score": "0.47608224", "text": "func Assign_global_orders(\n\tpassOrders chan<- chan ownVar.Orders_s,\n\tpassElevators chan<- chan map[string]ownVar.Elevator_s,\n\taddOrderCostChan chan<- ownVar.Order_call_s,\n\tremoveOrderCostChan chan<- ownVar.Order_call_s) {\n\t//Start of function\n\n\t//Channels\n\torderChan := make(chan ownVar.Orders_s)\n\televatorChan := make(chan map[string]ownVar.Elevator_s)\n\televators := make(map[string]ownVar.Elevator_s)\n\n\t//Variables\n\tvar orders ownVar.Orders_s\n\tvar bestElevator ownVar.Elevator_s\n\tvar orderCall ownVar.Order_call_s\n\torderCall.OrderType = ownVar.GLOBAL\n\townIp := Get_own_ip()\n\n\t//Do\n\tfor {\n\t\tselect {\n\t\tcase passElevators <- elevatorChan:\n\t\t\televators = <-elevatorChan\n\t\tcase passOrders <- orderChan:\n\t\t\torders = <-orderChan\n\n\t\tdefault:\n\n\t\t\tfor i := 0; i < N_GLOBALBUTTONTYPES; i++ {\n\n\t\t\t\tif i == BUTTON_CALL_UP {\n\t\t\t\t\torderCall.ButtonType = driver.BUTTON_CALL_UP\n\t\t\t\t} else if i == BUTTON_CALL_DOWN {\n\t\t\t\t\torderCall.ButtonType = driver.BUTTON_CALL_DOWN\n\t\t\t\t}\n\t\t\t\tfor j := 0; j < N_FLOORS; j++ {\n\n\t\t\t\t\tif orders.GlobalOrders[i][j] == 1 {\n\n\t\t\t\t\t\torderCall.Floor = j\n\t\t\t\t\t\torderCall.OrderType = ownVar.GLOBAL\n\t\t\t\t\t\tbestElevator = find_min_elev(elevators, orderCall)\n\t\t\t\t\t\t//fmt.Println(bestElevator.Ip)\n\t\t\t\t\t\tif (bestElevator.Ip == ownIp) && (orders.LocalOrders[i][j] == 0) {\n\t\t\t\t\t\t\torders.LocalOrders[i][j] = 1\n\t\t\t\t\t\t\tfmt.Println(\"Assign global order\")\n\t\t\t\t\t\t\torderCall.OrderType = ownVar.LOCAL\n\t\t\t\t\t\t\taddOrderCostChan <- orderCall\n\t\t\t\t\t\t} else if (bestElevator.Ip != ownIp) && (orders.LocalOrders[i][j] == 1) {\n\t\t\t\t\t\t\torders.LocalOrders[i][j] = 0\n\n\t\t\t\t\t\t\tremoveOrderCostChan <- orderCall\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06dd273c4a1118fe4de4cbe129dfe758", "score": "0.47465974", "text": "func (f *FTX) ModifyPlacedOrder(ctx context.Context, orderID, clientID string, price, size float64) (OrderData, error) {\n\treq := make(map[string]interface{})\n\treq[\"price\"] = price\n\treq[\"size\"] = size\n\tif clientID != \"\" {\n\t\treq[\"clientID\"] = clientID\n\t}\n\tresp := struct {\n\t\tData OrderData `json:\"result\"`\n\t}{}\n\treturn resp.Data, f.SendAuthHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, fmt.Sprintf(modifyOrder, orderID), req, &resp)\n}", "title": "" }, { "docid": "9be729d893787f4a9deb258e21c3891b", "score": "0.47183162", "text": "func NewUpdateMoveTaskOrderDestinationAddressParams() *UpdateMoveTaskOrderDestinationAddressParams {\n\tvar ()\n\treturn &UpdateMoveTaskOrderDestinationAddressParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "46f9bc0c4f29b7770f3567b62def382a", "score": "0.4704759", "text": "func ProcessOrder(o *Order, n Notifier) *Order {\n\to.isProcessed = n.NotifyUser(o.userEmail)\n\n\treturn o\n}", "title": "" }, { "docid": "022221e4b69ab64c7b52c30505bf1e93", "score": "0.47047234", "text": "func (f mtoShipmentCreator) CreateMTOShipment(shipment *models.MTOShipment, serviceItems models.MTOServiceItems) (*models.MTOShipment, error) {\n\tvar verrs *validate.Errors\n\tvar err error\n\n\tvar moveTaskOrder models.MoveTaskOrder\n\tmoveTaskOrderID := shipment.MoveTaskOrderID\n\n\tqueryFilters := []services.QueryFilter{\n\t\tquery.NewQueryFilter(\"id\", \"=\", moveTaskOrderID),\n\t}\n\n\t// check if MTO exists\n\terr = f.builder.FetchOne(&moveTaskOrder, queryFilters)\n\tif err != nil {\n\t\treturn nil, services.NewNotFoundError(moveTaskOrderID, fmt.Sprintf(\"MoveTaskOrderID: %s\", err))\n\t}\n\n\terr = f.db.Transaction(func(tx *pop.Connection) error {\n\t\t// create new builder to use tx\n\t\ttxBuilder := f.createNewBuilder(tx)\n\n\t\t// create pickup and destination addresses\n\t\tif shipment.PickupAddress != nil {\n\t\t\tverrs, err = txBuilder.CreateOne(shipment.PickupAddress)\n\t\t\tif verrs != nil || err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create pickup address %#v %e\", verrs, err)\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(\"pickup address missing\")\n\t\t}\n\n\t\tif shipment.DestinationAddress != nil {\n\t\t\tverrs, err = txBuilder.CreateOne(shipment.DestinationAddress)\n\n\t\t\tif verrs != nil || err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create destination address %#v %e\", verrs, err)\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(\"destination address missing\")\n\t\t}\n\n\t\t// assign addresses to shipment\n\t\tshipment.PickupAddressID = &shipment.PickupAddress.ID\n\t\tshipment.DestinationAddressID = &shipment.DestinationAddress.ID\n\n\t\t// check that required items to create shipment are present\n\t\tif shipment.RequestedPickupDate == nil {\n\t\t\treturn errors.New(\"requested pickup date missing\")\n\t\t}\n\t\tif shipment.ShipmentType == \"\" {\n\t\t\treturn errors.New(\"shipment type missing\")\n\t\t}\n\t\t//assign status to shipment submitted\n\t\tshipment.Status = models.MTOShipmentStatusSubmitted\n\n\t\t// create a shipment\n\t\tverrs, err = txBuilder.CreateOne(shipment)\n\n\t\tif verrs != nil || err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create shipment %s %e\", verrs.Error(), err)\n\t\t}\n\n\t\t// create MTOAgents List\n\t\tif shipment.MTOAgents != nil {\n\t\t\tfor _, agent := range shipment.MTOAgents {\n\t\t\t\tagent.MTOShipmentID = shipment.ID\n\t\t\t\tverrs, err = txBuilder.CreateOne(&agent)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// create MTOServiceItems List\n\t\tif serviceItems != nil {\n\t\t\tmtoServiceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(txBuilder)\n\t\t\tfor i, serviceItem := range serviceItems {\n\t\t\t\tserviceItem.MTOShipmentID = &shipment.ID\n\t\t\t\tserviceItem, verrs, error := mtoServiceItemCreator.CreateMTOServiceItem(&serviceItem)\n\t\t\t\tif verrs != nil || error != nil {\n\t\t\t\t\treturn fmt.Errorf(\"%#v %e\", verrs, error)\n\t\t\t\t}\n\t\t\t\tserviceItems[i] = *serviceItem\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn shipment, err\n}", "title": "" }, { "docid": "f250d00da103492bf72e2eba5a9d6154", "score": "0.46786368", "text": "func TestPlaceMultipleSpotOrders(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\tord := okgroup.PlaceOrderRequest{\n\t\tInstrumentID: spotCurrency,\n\t\tType: order.Limit.Lower(),\n\t\tSide: order.Buy.Lower(),\n\t\tSize: \"-100\",\n\t\tPrice: \"1\",\n\t}\n\n\trequest := []okgroup.PlaceOrderRequest{\n\t\tord,\n\t}\n\n\t_, errs := o.PlaceMultipleSpotOrders(context.Background(), request)\n\tif len(errs) > 0 {\n\t\ttestStandardErrorHandling(t, errs[0])\n\t}\n}", "title": "" }, { "docid": "7ceac6c4ed8f2f65cd2346adeb4bffd8", "score": "0.46645826", "text": "func (m *MockStateInterface) MoveTokensFromPlacesToPlaces(ctx context.Context, from, to []string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MoveTokensFromPlacesToPlaces\", ctx, from, to)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "766a59a6828266714734481e590ffed7", "score": "0.46644825", "text": "func (ir *IRobot) EnqueueTask(commands string) (taskID string, position chan RobotState, err chan error) {\n\n\tfmt.Println(\"Processing Robot ID: \", ir.ID)\n\terr = make(chan error)\n\tposition = make(chan RobotState)\n\n\tgo func() {\n\t\t// Split strings using white space\n\t\tactions := strings.Fields(commands)\n\t\tisFail := false\n\n\t\tfor i := 0; i < len(actions); i++ {\n\t\t\tif actions[i] == \"N\" {\n\t\t\t\tif ir.RobotState.Y != 9 {\n\t\t\t\t\tir.RobotState.Y++\n\t\t\t\t\tfmt.Println(\"Travelling North \", ir.RobotState.Y)\n\t\t\t\t} else {\n\t\t\t\t\terr <- errors.New(\"Can not move to North\")\n\t\t\t\t\tisFail = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if actions[i] == \"S\" {\n\t\t\t\tif ir.RobotState.Y != 0 {\n\t\t\t\t\tir.RobotState.Y--\n\t\t\t\t\tfmt.Println(\"Travelling South\")\n\t\t\t\t} else {\n\t\t\t\t\terr <- errors.New(\"Can not move to South\")\n\t\t\t\t\tisFail = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if actions[i] == \"E\" {\n\t\t\t\tif ir.RobotState.X != 9 {\n\t\t\t\t\tir.RobotState.X++\n\t\t\t\t\tfmt.Println(\"Travelling East\", ir.RobotState.Y)\n\t\t\t\t} else {\n\t\t\t\t\terr <- errors.New(\"Can not move to East\")\n\t\t\t\t\tisFail = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if actions[i] == \"W\" {\n\t\t\t\tif ir.RobotState.X != 0 {\n\t\t\t\t\tir.RobotState.X--\n\t\t\t\t\tfmt.Println(\"Travelling West\")\n\t\t\t\t} else {\n\t\t\t\t\terr <- errors.New(\"Can not move to West\")\n\t\t\t\t\tisFail = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Println(\"Sending position\")\n\t\t\tposition <- ir.RobotState\n\n\t\t}\n\n\t\tif !isFail {\n\t\t\terr <- errors.New(\"OK\")\n\t\t}\n\t}()\n\tincrementRobotTaskCounter()\n\treturn fmt.Sprint(RobotTaskCounter), position, err\n\n}", "title": "" }, { "docid": "0489c3afaf84720bc8186c391b7e2007", "score": "0.46531639", "text": "func TestPlaceFuturesOrderBatch(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\t_, err := o.PlaceFuturesOrderBatch(context.Background(),\n\t\tokgroup.PlaceFuturesOrderBatchRequest{\n\t\t\tInstrumentID: getFutureInstrumentID(),\n\t\t\tLeverage: 10,\n\t\t\tOrdersData: []okgroup.PlaceFuturesOrderBatchRequestDetails{\n\t\t\t\t{\n\t\t\t\t\tClientOid: \"1\",\n\t\t\t\t\tMatchPrice: \"0\",\n\t\t\t\t\tPrice: \"-100\",\n\t\t\t\t\tSize: \"100\",\n\t\t\t\t\tType: \"1\",\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "c6b7b15882f15a9b25df539b8e93d506", "score": "0.46457005", "text": "func TestPlaceFuturesOrder(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\t_, err := o.PlaceFuturesOrder(context.Background(),\n\t\tokgroup.PlaceFuturesOrderRequest{\n\t\t\tInstrumentID: getFutureInstrumentID(),\n\t\t\tLeverage: 10,\n\t\t\tType: 1,\n\t\t\tSize: 2,\n\t\t\tPrice: -432.11,\n\t\t\tClientOid: \"12233456\",\n\t\t})\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "910470b9230de1cdc8a967778a44a24f", "score": "0.4644778", "text": "func (c *Customer) AddCustomersToQueue(checkouts []*Checkout, wg *sync.WaitGroup) {\n\tvar num int = -1\n\tvar cap int = 6\n\ttime.Sleep(time.Second * time.Duration(c.WaitTime*randomWeather.weatherEffect)) // Weather would affect the customer rate arrival\n\tcheckoutQueueLock.Lock()\n\tif c.noOfProducts <= 5 {\n\t\tfor i := 0; i < checkoutLessThan5; i++ {\n\t\t\tif len(checkouts[i].customerQueue) < cap {\n\t\t\t\tnum = i\n\t\t\t\tcap = len(checkouts[i].customerQueue)\n\t\t\t}\n\t\t}\n\t}\n\n\tif c.noOfProducts > 5 || num < 0 {\n\t\tfor i := checkoutLessThan5; i < totalCheckouts; i++ {\n\t\t\tif len(checkouts[i].customerQueue) < cap {\n\t\t\t\tnum = i\n\t\t\t\tcap = len(checkouts[i].customerQueue)\n\t\t\t}\n\t\t}\n\t}\n\tif num < 0 {\n\t\tcustomerLock.Lock()\n\t\tcustomersLost++\n\t\tfmt.Printf(\" Customer %d left the store \\n\", c.customerId)\n\t\tfmt.Printf(\" No. of customers left the store without purchasing : %d \\n\", customersLost)\n\t\tcustomerLock.Unlock()\n\t\twg.Done()\n\t} else {\n\t\tc.setBeginTime()\n\t\tcustomerLock.Lock()\n\t\ttotalItemsProcessed = totalItemsProcessed + c.noOfProducts\n\t\tcheckouts[num].addCustomer(c.customerId)\n\t\tcustomerLock.Unlock()\n\t}\n\tcheckoutQueueLock.Unlock()\n\n}", "title": "" }, { "docid": "7c5f4a66a2dd75df93c9b2bd9fb48b7f", "score": "0.46368796", "text": "func (o *ProcessedTransaction) SetUserOrders(exec boil.Executor, insert bool, related ...*UserOrder) error {\n\tquery := \"update \\\"user_order\\\" set \\\"processed_transaction_id\\\" = null where \\\"processed_transaction_id\\\" = $1\"\n\tvalues := []interface{}{o.ID}\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err := exec.Exec(query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to remove relationships before set\")\n\t}\n\n\tif o.R != nil {\n\t\tfor _, rel := range o.R.UserOrders {\n\t\t\tqueries.SetScanner(&rel.ProcessedTransactionID, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.ProcessedTransaction = nil\n\t\t}\n\n\t\to.R.UserOrders = nil\n\t}\n\treturn o.AddUserOrders(exec, insert, related...)\n}", "title": "" }, { "docid": "fab9c92bc04f7cb81c1880b4d5c25246", "score": "0.4629578", "text": "func NewGetMoveTaskOrderOK() *GetMoveTaskOrderOK {\n\treturn &GetMoveTaskOrderOK{}\n}", "title": "" }, { "docid": "79e903531507f9827b3c2d13fce70f8e", "score": "0.4611074", "text": "func NewCreateMoveTaskOrderUnauthorized() *CreateMoveTaskOrderUnauthorized {\n\n\treturn &CreateMoveTaskOrderUnauthorized{}\n}", "title": "" }, { "docid": "c79f4073ca144e5d5e1688a54afb9561", "score": "0.458081", "text": "func (r Product_Order) PlaceOrder(orderData interface{}, saveAsQuote *bool) (resp datatypes.Container_Product_Order_Receipt, err error) {\n\terr = datatypes.SetComplexType(orderData)\n\tif err != nil {\n\t\treturn\n\t}\n\tparams := []interface{}{\n\t\torderData,\n\t\tsaveAsQuote,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Product_Order\", \"placeOrder\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "dd058820ed75220f8e56db577951e0aa", "score": "0.4568224", "text": "func OrderByOrderNumber(Order *model.Order, orderNumber string) (err error) {\n\tvar OrderDetails []*model.OrderDetails\n\terr = db.DB[\"smartdb\"].Where(\"OrderNumber='\" + orderNumber + \"'\").Find(&OrderDetails).Error\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\tfor _, val := range OrderDetails {\n\n\t\tvar buyer model.User\n\t\tbuyer.Name = val.BuyerName\n\t\tbuyer.Email = val.BuyerEmail\n\t\tbuyer.City = val.BuyerCity\n\t\tbuyer.State = val.BuyerState\n\t\tbuyer.Mobile = val.BuyerMobile\n\t\tbuyer.Pincode = &val.BuyerPincode\n\t\tOrder.Buyer = &buyer\n\n\t\tvar supplier model.User\n\t\tsupplier.Name = val.SupplierName\n\t\tsupplier.Email = val.SupplierEmail\n\t\tsupplier.City = val.SupplierCity\n\t\tsupplier.State = val.SupplierState\n\t\tsupplier.Mobile = val.SupplierMobile\n\t\tsupplier.Pincode = &val.SupplierPincode\n\t\tOrder.Supplier = &supplier\n\n\t\tOrder.ID = val.ID\n\t\tOrder.Source = val.Source\n\t\tOrder.BuyerID = val.BuyerID\n\t\tOrder.OrderNumber = val.OrderNumber\n\t\tOrder.OrderDate = val.OrderDate\n\t\tOrder.SupplierID = val.SupplierID\n\t\tOrder.TakenOn = val.TakenOn\n\t\tOrder.DeliveryOption = val.DeliveryOption\n\t\tOrder.DeliveryMode = val.DeliveryMode\n\t\tOrder.Remarks = val.Remarks\n\t\tOrder.WorkspaceID = val.WorkspaceID\n\t\tOrder.Status = val.Status\n\t\tOrder.InvoiceNumber = val.InvoiceNumber\n\t\tOrder.IsBounced = val.IsBounced\n\n\t\tvar product model.Product\n\t\tproduct.ProductCode = val.ProductCode\n\t\tproduct.ProductName = val.ProductName\n\t\tproduct.Company = val.Company\n\t\tproduct.Pack = val.Pack\n\t\tproduct.Quantity = val.Quantity\n\t\tproduct.FreeQuantity = val.FreeQuantity\n\t\tproduct.SchemePercentage = val.SchemePercentage\n\t\tproduct.Closing = val.Closing\n\t\tproduct.Mrp = val.Mrp\n\t\tproduct.Ptr = val.Ptr\n\t\tproduct.Pts = val.Pts\n\t\tOrder.Products = append(Order.Products, &product)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d64c6cc645c05b4d3bfc02c3c7a802a0", "score": "0.4559819", "text": "func (m *PlannerProgressTaskBoardTaskFormat) SetOrderHint(value *string)() {\n m.orderHint = value\n}", "title": "" }, { "docid": "90f71d558637fdf3dcc6c870a9a55ce4", "score": "0.45542493", "text": "func (n *NotionHandler) MoveTasks(ctx context.Context, board *TaskBoard, tasks ...notion.Page) (err error) {\n\tfor _, task := range tasks {\n\t\tparams := notion.UpdatePageParams{\n\t\t\tDatabasePageProperties: &notion.DatabasePageProperties{\n\t\t\t\tboard.Selectors.ColumnName: notion.DatabasePageProperty{\n\t\t\t\t\tSelect: &notion.SelectOptions{\n\t\t\t\t\t\tName: board.Selectors.TargetColumn,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\t_, err = n.client.UpdatePageProps(ctx, task.ID, params)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "72f05fc3b70d7ca196f77f1433eff45b", "score": "0.4553303", "text": "func (o *UpdateMoveTaskOrderDestinationAddressParams) WithHTTPClient(client *http.Client) *UpdateMoveTaskOrderDestinationAddressParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "5e211eb145f9cab132f627069d995478", "score": "0.45424205", "text": "func (b *Board) MakeMoves(player string, moves []MoveMessage) *ErrorResponse {\n\tb.boardLock.Lock()\n\tdefer b.boardLock.Unlock()\n\tif !b.IsCurrent(player) {\n\t\treturn b.error(\"not current\", nil)\n\t}\n\tfor _, move := range moves {\n\t\terr := b.VerifyMove(player, move)\n\t\tif err != nil {\n\t\t\treturn b.error(\"invalid move\", err)\n\t\t}\n\t\tmoveResult := b.makeMove(player, move)\n\t\tif moveResult == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := b.moveCache[moveResult.Attacker]; ok {\n\t\t\tb.moveCache[moveResult.Attacker] = append(b.moveCache[moveResult.Attacker], moveResult)\n\t\t} else {\n\t\t\tb.moveCache[moveResult.Attacker] = []*FightResponse{moveResult}\n\t\t}\n\t\tif _, ok := b.moveCache[moveResult.Defender]; ok {\n\t\t\tb.moveCache[moveResult.Defender] = append(b.moveCache[moveResult.Defender], moveResult)\n\t\t} else {\n\t\t\tb.moveCache[moveResult.Defender] = []*FightResponse{moveResult}\n\t\t}\n\n\t}\n\tb.resetUsed(moves)\n\tb.setNext()\n\treturn nil\n}", "title": "" }, { "docid": "9499e53636dd49eb2c1dbf376c0a2ca0", "score": "0.45422983", "text": "func (o *CreateMoveTaskOrderUnprocessableEntity) WithPayload(payload *supportmessages.ValidationError) *CreateMoveTaskOrderUnprocessableEntity {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "9d70ead9b4555b18aba14950ffe73420", "score": "0.4528165", "text": "func TestMove(t *testing.T) {\n tests := []TestMoveStruct {\n TestMoveStruct{\n \"e2e4\", \"rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1\",\n },\n TestMoveStruct{\n \"e7e5\", \"rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2\",\n },\n TestMoveStruct{\n \"g1f3\", \"rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2\",\n },\n TestMoveStruct{\n \"b8c6\", \"r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3\",\n },\n TestMoveStruct{\n \"f1b5\", \"r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3\",\n },\n TestMoveStruct{\n \"g8f6\", \"r1bqkb1r/pppp1ppp/2n2n2/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4\",\n },\n TestMoveStruct{\n \"e1g1\", \"r1bqkb1r/pppp1ppp/2n2n2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 b kq - 5 4\",\n },\n TestMoveStruct{\n \"d7d6\", \"r1bqkb1r/ppp2ppp/2np1n2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 0 5\",\n },\n TestMoveStruct{\n \"f1e1\", \"r1bqkb1r/ppp2ppp/2np1n2/1B2p3/4P3/5N2/PPPP1PPP/RNBQR1K1 b kq - 1 5\",\n },\n TestMoveStruct{\n \"a7a6\", \"r1bqkb1r/1pp2ppp/p1np1n2/1B2p3/4P3/5N2/PPPP1PPP/RNBQR1K1 w kq - 0 6\",\n },\n TestMoveStruct{\n \"b5a4\", \"r1bqkb1r/1pp2ppp/p1np1n2/4p3/B3P3/5N2/PPPP1PPP/RNBQR1K1 b kq - 1 6\",\n },\n TestMoveStruct{\n \"b7b5\", \"r1bqkb1r/2p2ppp/p1np1n2/1p2p3/B3P3/5N2/PPPP1PPP/RNBQR1K1 w kq b6 0 7\",\n },\n TestMoveStruct{\n \"a4b3\", \"r1bqkb1r/2p2ppp/p1np1n2/1p2p3/4P3/1B3N2/PPPP1PPP/RNBQR1K1 b kq - 1 7\",\n },\n TestMoveStruct{\n \"b5b4\", \"r1bqkb1r/2p2ppp/p1np1n2/4p3/1p2P3/1B3N2/PPPP1PPP/RNBQR1K1 w kq - 0 8\",\n },\n TestMoveStruct{\n \"c2c4\", \"r1bqkb1r/2p2ppp/p1np1n2/4p3/1pP1P3/1B3N2/PP1P1PPP/RNBQR1K1 b kq c3 0 8\",\n },\n TestMoveStruct{\n \"b4c3\", \"r1bqkb1r/2p2ppp/p1np1n2/4p3/4P3/1Bp2N2/PP1P1PPP/RNBQR1K1 w kq - 0 9\",\n },\n TestMoveStruct{\n \"b1c3\", \"r1bqkb1r/2p2ppp/p1np1n2/4p3/4P3/1BN2N2/PP1P1PPP/R1BQR1K1 b kq - 0 9\",\n },\n TestMoveStruct{\n \"f8e7\", \"r1bqk2r/2p1bppp/p1np1n2/4p3/4P3/1BN2N2/PP1P1PPP/R1BQR1K1 w kq - 1 10\",\n },\n TestMoveStruct{\n \"d2d4\", \"r1bqk2r/2p1bppp/p1np1n2/4p3/3PP3/1BN2N2/PP3PPP/R1BQR1K1 b kq d3 0 10\",\n },\n TestMoveStruct{\n \"e8g8\", \"r1bq1rk1/2p1bppp/p1np1n2/4p3/3PP3/1BN2N2/PP3PPP/R1BQR1K1 w - - 1 11\",\n },\n TestMoveStruct{\n \"d4e5\", \"r1bq1rk1/2p1bppp/p1np1n2/4P3/4P3/1BN2N2/PP3PPP/R1BQR1K1 b - - 0 11\",\n },\n TestMoveStruct{\n \"c6d4\", \"r1bq1rk1/2p1bppp/p2p1n2/4P3/3nP3/1BN2N2/PP3PPP/R1BQR1K1 w - - 1 12\",\n },\n TestMoveStruct{\n \"e5f6\", \"r1bq1rk1/2p1bppp/p2p1P2/8/3nP3/1BN2N2/PP3PPP/R1BQR1K1 b - - 0 12\",\n },\n TestMoveStruct{\n \"d4b3\", \"r1bq1rk1/2p1bppp/p2p1P2/8/4P3/1nN2N2/PP3PPP/R1BQR1K1 w - - 0 13\",\n },\n TestMoveStruct{\n \"f6e7\", \"r1bq1rk1/2p1Pppp/p2p4/8/4P3/1nN2N2/PP3PPP/R1BQR1K1 b - - 0 13\",\n },\n TestMoveStruct{\n \"b3c1\", \"r1bq1rk1/2p1Pppp/p2p4/8/4P3/2N2N2/PP3PPP/R1nQR1K1 w - - 0 14\",\n },\n TestMoveStruct{\n \"e7d8q\", \"r1bQ1rk1/2p2ppp/p2p4/8/4P3/2N2N2/PP3PPP/R1nQR1K1 b - - 0 14\",\n },\n TestMoveStruct{\n \"g8h8\", \"r1bQ1r1k/2p2ppp/p2p4/8/4P3/2N2N2/PP3PPP/R1nQR1K1 w - - 1 15\",\n },\n TestMoveStruct{\n \"d8f8\", \"r1b2Q1k/2p2ppp/p2p4/8/4P3/2N2N2/PP3PPP/R1nQR1K1 b - - 0 15\",\n },\n }\n\n b := GenerateBoard(\"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\")\n for _, test := range(tests) {\n b.moveUCI(test.uci)\n generatedFen := b.GenerateFen()\n if generatedFen != test.fen {\n t.Error(fmt.Sprintf(\"Expected fen %v after move %v, got %v\", test.fen, test.uci, generatedFen))\n }\n }\n}", "title": "" }, { "docid": "108d7be9005f31a1b6c335c70a82c4f9", "score": "0.45276216", "text": "func OrderByWorkspaceId(Order *model.OrderByWorkspaceID, workspaceID string, fromDate string, toDate string) (err error) {\n\tvar OrderDetails []*model.OrderDetails\n\terr = db.DB[\"smartdb\"].Where(\"WorkspaceId='\" + workspaceID + \"' and OrderDate between '\" + fromDate + \"' and '\" + toDate + \"'\").Find(&OrderDetails).Error\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\n\t}\n\torderMap := make(map[string]model.Order, len(OrderDetails)+1)\n\tfor _, val := range OrderDetails {\n\t\tvar buyer model.User\n\t\tbuyer.Name = val.BuyerName\n\t\tbuyer.Email = val.BuyerEmail\n\t\tbuyer.City = val.BuyerCity\n\t\tbuyer.State = val.BuyerState\n\t\tbuyer.Mobile = val.BuyerMobile\n\t\tbuyer.Pincode = &val.BuyerPincode\n\t\tOrder.Buyer = &buyer\n\n\t\tvar supplier model.User\n\t\tsupplier.Name = val.SupplierName\n\t\tsupplier.Email = val.SupplierEmail\n\t\tsupplier.City = val.SupplierCity\n\t\tsupplier.State = val.SupplierState\n\t\tsupplier.Mobile = val.SupplierMobile\n\t\tsupplier.Pincode = &val.SupplierPincode\n\t\tOrder.Supplier = &supplier\n\t\tif _, ok := orderMap[val.OrderNumber]; !ok {\n\t\t\tvar tempOrder model.Order\n\t\t\ttempOrder.ID = val.ID\n\t\t\ttempOrder.Source = val.Source\n\t\t\ttempOrder.BuyerID = val.BuyerID\n\t\t\ttempOrder.OrderNumber = val.OrderNumber\n\t\t\ttempOrder.OrderDate = val.OrderDate\n\t\t\ttempOrder.SupplierID = val.SupplierID\n\t\t\ttempOrder.TakenOn = val.TakenOn\n\t\t\ttempOrder.DeliveryOption = val.DeliveryOption\n\t\t\ttempOrder.DeliveryMode = val.DeliveryMode\n\t\t\ttempOrder.Remarks = val.Remarks\n\t\t\ttempOrder.WorkspaceID = val.WorkspaceID\n\t\t\ttempOrder.Status = val.Status\n\t\t\ttempOrder.InvoiceNumber = val.InvoiceNumber\n\t\t\ttempOrder.IsBounced = val.IsBounced\n\t\t\torderMap[val.OrderNumber] = tempOrder\n\t\t}\n\t\to, _ := orderMap[val.OrderNumber]\n\t\tvar product model.Product\n\t\tproduct.ProductCode = val.ProductCode\n\t\tproduct.ProductName = val.ProductName\n\t\tproduct.Company = val.Company\n\t\tproduct.Pack = val.Pack\n\t\tproduct.Quantity = val.Quantity\n\t\tproduct.FreeQuantity = val.FreeQuantity\n\t\tproduct.SchemePercentage = val.SchemePercentage\n\t\tproduct.Closing = val.Closing\n\t\tproduct.Mrp = val.Mrp\n\t\tproduct.Ptr = val.Ptr\n\t\tproduct.Pts = val.Pts\n\t\to.Products = append(o.Products, &product)\n\t\torderMap[val.OrderNumber] = o\n\t}\n\n\tfor _, mapVal := range orderMap {\n\t\ttemp := mapVal\n\t\tOrder.Order = append(Order.Order, &temp)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19e0c68ce4b961df72aadc266eeb99a8", "score": "0.45258984", "text": "func (o *ProcessedTransaction) SetOrder(exec boil.Executor, insert bool, related *UserOrder) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"processed_transaction\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"order_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, processedTransactionPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.OrderID = related.ID\n\tif o.R == nil {\n\t\to.R = &processedTransactionR{\n\t\t\tOrder: related,\n\t\t}\n\t} else {\n\t\to.R.Order = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &userOrderR{\n\t\t\tOrderProcessedTransaction: o,\n\t\t}\n\t} else {\n\t\trelated.R.OrderProcessedTransaction = o\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "671dff3df6d6e91506ded3899e6385d1", "score": "0.4523484", "text": "func (db *BoltDB) UpdateOrder(m *dexdb.MetaOrder) error {\n\tord, md := m.Order, m.MetaData\n\tif md.Status == order.OrderStatusUnknown {\n\t\treturn fmt.Errorf(\"cannot set order %s status to unknown\", ord.ID())\n\t}\n\tif md.Host == \"\" {\n\t\treturn fmt.Errorf(\"empty DEX not allowed\")\n\t}\n\tif len(md.Proof.DEXSig) == 0 {\n\t\treturn fmt.Errorf(\"cannot save order without DEX signature\")\n\t}\n\treturn db.ordersUpdate(func(ob, archivedOB *bbolt.Bucket) error {\n\t\toid := ord.ID()\n\n\t\t// Create or move an order bucket based on order status. Active\n\t\t// orders go in the activeOrdersBucket. Inactive orders go in the\n\t\t// archivedOrdersBucket.\n\t\tbkt := ob\n\t\twhichBkt := \"active\"\n\t\tinactive := !md.Status.IsActive()\n\t\tif inactive {\n\t\t\t// No order means that it was never added to the active\n\t\t\t// orders bucket, or UpdateOrder was already called on\n\t\t\t// this order after it became inactive.\n\t\t\tif ob.Bucket(oid[:]) != nil {\n\t\t\t\t// This order now belongs in the archived orders\n\t\t\t\t// bucket. Delete it from active orders.\n\t\t\t\tif err := ob.DeleteBucket(oid[:]); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"archived order bucket delete error: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbkt = archivedOB\n\t\t\twhichBkt = \"archived\"\n\t\t}\n\t\toBkt, err := bkt.CreateBucketIfNotExists(oid[:])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s bucket error: %w\", whichBkt, err)\n\t\t}\n\n\t\tvar linkedB []byte\n\t\tif !md.LinkedOrder.IsZero() {\n\t\t\tlinkedB = md.LinkedOrder[:]\n\t\t}\n\n\t\treturn newBucketPutter(oBkt).\n\t\t\tput(baseKey, uint32Bytes(ord.Base())).\n\t\t\tput(quoteKey, uint32Bytes(ord.Quote())).\n\t\t\tput(statusKey, uint16Bytes(uint16(md.Status))).\n\t\t\tput(dexKey, []byte(md.Host)).\n\t\t\tput(updateTimeKey, uint64Bytes(timeNow())).\n\t\t\tput(proofKey, md.Proof.Encode()).\n\t\t\tput(changeKey, md.ChangeCoin).\n\t\t\tput(linkedKey, linkedB).\n\t\t\tput(typeKey, []byte{byte(ord.Type())}).\n\t\t\tput(orderKey, order.EncodeOrder(ord)).\n\t\t\tput(swapFeesKey, uint64Bytes(md.SwapFeesPaid)).\n\t\t\tput(maxFeeRateKey, uint64Bytes(md.MaxFeeRate)).\n\t\t\tput(redemptionFeesKey, uint64Bytes(md.RedemptionFeesPaid)).\n\t\t\terr()\n\t})\n}", "title": "" }, { "docid": "cb19b985fe469e50c48414ad2e3f85ce", "score": "0.4523465", "text": "func (o *UpdateMoveTaskOrderDestinationAddressParams) SetMoveTaskOrderID(moveTaskOrderID string) {\n\to.MoveTaskOrderID = moveTaskOrderID\n}", "title": "" }, { "docid": "69d0d1b79d6eee1e9915692043d53e30", "score": "0.4519263", "text": "func (this *Reservation) RequestPlacement(pending []*action.PendingTask, requestSpec, filterProperties map[string]string) (map[string]string, error) {\n\textCongfix := make(map[string]string)\n\textCongfix[\"Username\"] = this.Meta.OpsManagerUsername\n\textCongfix[\"Password\"] = this.Meta.OpsManagerPassword\n\tvmturboApi := NewVmtApi(this.Meta.ServerAddress, extCongfix)\n\n\tglog.V(4).Info(\"Inside RequestPlacement\")\n\tparameterString, err := buildReservationParameterString(requestSpec) // TODO soon fix exception\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tglog.V(4).Infof(\"parameterString %s\\n\", parameterString)\n\treservationUUID, err := vmturboApi.Post(\"/reservations\", parameterString)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"Error posting reservations %s \\n\", err)\n\t\t// TODO should there be a default placement?? relay to mesos\n\t\treturn nil, fmt.Errorf(\"Error posting reservations: %s\", err)\n\t}\n\treservationUUID = strings.Replace(reservationUUID, \"\\n\", \"\", -1)\n\tglog.V(3).Infof(\"Reservation UUID is %s\\n\", string(reservationUUID))\n\n\tvar getResponse string\n\tvar getRevErr error\n\tvar destVMs []string\n\t// TODO, do we want to wait for a predefined time or send send API requests multiple times.\n\tfor counter := 0; counter < 10; counter++ {\n\t\ttime.Sleep(2 * time.Second)\n\t\tglog.V(3).Infof(\"Attempt #%d : reserve UUID %s \\n\", counter+1, reservationUUID)\n\t\tgetResponse, getRevErr = vmturboApi.Get(\"/reservations/\" + reservationUUID)\n\t\tdestVMs, err = GetTaskReservationDestination(getResponse)\n\t\tif err != nil {\n\t\t\t// TODO handle the one task that didn't get placement, all others ok\n\t\t\tfmt.Errorf(\"Error getting reservations destinations: %s \\n\", err)\n\t\t}\n\t\t// array of VMs to place tasks on\n\t\tif destVMs != nil {\n\t\t\tglog.V(3).Infof(\"Got a reservation destination! \\n\")\n\t\t\tbreak\n\t\t}\n\t}\n\t// After trying to get or getting the destination, delete the reservation.\n\t// Check , does this delete multiple reservations ???\n\tdeleteResponse, err := vmturboApi.Delete(\"/reservations/\" + reservationUUID)\n\tif err != nil {\n\t\t// TODO, Should we return without placement?\n\t\treturn nil, fmt.Errorf(\"Error deleting reservations destinations: %s response is : %s \\n\", err, deleteResponse)\n\t}\n\t//\tglog.V(4).Infof(\"delete response of reservation %s is %s\", reservationUUID, deleteResponse)\n\tif getRevErr != nil {\n\t\treturn nil, fmt.Errorf(\"Error getting reservations destinations: %s\", err)\n\t}\n\n\t// generate map of VM IPs\n\tfullUrl := \"http://\" + this.Meta.MesosIP + \":\" + this.Meta.MesosPort + \"/state\"\n\tglog.V(4).Infof(\"The full Url is %s \\n\", fullUrl)\n\treq, err := http.NewRequest(\"GET\", fullUrl, nil)\n\tglog.V(3).Infof(\"GET request is : %+v\\n\", req)\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tglog.Errorf(\"Error getting response: %s\", err)\n\t}\n\n\t// Create map of IP to Slave MesosID\n\trespMap, err := util.CreateSlaveIpIdMap(resp)\n\tif err != nil {\n\t\tglog.Errorf(\"Error parsing response into map: %s\", err)\n\t\t// TODO return or try again ???\n\t}\n\t// Use map to create a map of taskname to placement destination VM MesosID\n\tdestinationMap := make(map[string]string)\n\tfor j, ip := range destVMs {\n\t\tif ip == \"no_VM\" {\n\t\t\t// do nothing about this, next pending task list will take care\n\t\t} else {\n\t\t\ttaskName := pending[j].Name\n\t\t\tdestinationMap[taskName] = respMap[ip]\n\n\t\t}\n\t}\n\n\tglog.V(3).Infof(\"IP:ID map is %v \\n\", respMap)\n\tdefer resp.Body.Close()\n\n\tglog.V(3).Infof(\"Task - Destination map is : %+v \\n\", destinationMap)\n\treturn destinationMap, nil\n}", "title": "" }, { "docid": "a8bebab86f6d62f6ab2b60c7dc580f10", "score": "0.45139718", "text": "func (o *CreateExcessWeightRecordParams) WithMoveTaskOrderID(moveTaskOrderID strfmt.UUID) *CreateExcessWeightRecordParams {\n\to.SetMoveTaskOrderID(moveTaskOrderID)\n\treturn o\n}", "title": "" }, { "docid": "9c1016e53671ab63386b660dbea2f908", "score": "0.45121157", "text": "func PickUpOrderActivity(ctx context.Context, execution cadence.WorkflowExecution, orderID string) (string, error) {\n\treturn \"\", errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "a463c1d813229e426f32d04665f33f21", "score": "0.4500495", "text": "func InsertOrder(userID uint, cookieID uint, quantity uint) (*models.Order, error) {\n\tvar order, sameAreaOrder models.Order\n\tvar deliveryPerson models.DeliveryPerson\n\tvar customer models.User\n\tvar cookie models.Cookie\n\n\tif result := DB.First(&customer, userID); result.Error != nil {\n\t\treturn &order, result.Error\n\t}\n\n\tdeliveryArea := customer.Profile.Address\n\n\tif result := DB.First(&cookie, cookieID); result.Error != nil {\n\t\treturn &order, result.Error\n\t}\n\n\tif cookie.Quantity < quantity {\n\t\tprintln(\"This is negative\")\n\t\treturn &order, errors.New(\"Not enough Quantity\")\n\t}\n\n\terr := DB.Transaction(func(tx *gorm.DB) error {\n\n\t\tcookie.Quantity = cookie.Quantity - quantity\n\t\tif result := tx.Save(&cookie); result.Error != nil {\n\t\t\tprintln(\"This is an error 1\")\n\t\t\treturn result.Error\n\t\t}\n\n\t\tprintln(\"deliveryArea\", deliveryArea)\n\n\t\tif result := tx.Where(\"delivery_\tarea = ?\", deliveryArea).First(&sameAreaOrder); result.Error == nil {\n\t\t\tprintln(\"FOund delivery in same area\")\n\t\t\tdeliveryPersonID := sameAreaOrder.DeliveryPersonID\n\t\t\tprintln(\"deliveryPersonID\", deliveryPersonID)\n\t\t\tif result := tx.First(&deliveryPerson, deliveryPersonID); result.Error != nil {\n\t\t\t\tprintln(\"This is an error 2\", result.Error)\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\tdeliveryPerson.OnDelivery = true\n\t\t\tif result := tx.Model(&deliveryPerson).Update(\"on_delivery\", \"1\").Where(\"id\", deliveryPersonID); result.Error != nil {\n\t\t\t\tprintln(\"This is an error 3\")\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\testimatedDelivery := int(deliveryArea - deliveryPerson.CurrentLoc)\n\t\t\tif estimatedDelivery < 0 {\n\t\t\t\testimatedDelivery = -estimatedDelivery\n\t\t\t}\n\n\t\t\torder.CookieID = cookieID\n\t\t\torder.Quantity = quantity\n\t\t\torder.UserID = userID\n\t\t\torder.DeliveryPersonID = deliveryPersonID\n\t\t\torder.EstimatedDelivery = uint(estimatedDelivery)\n\t\t\torder.Status = \"EnRoute\"\n\t\t\torder.DeliveryArea = deliveryArea\n\n\t\t\tif result := tx.Create(&order); result.Error != nil {\n\t\t\t\tprintln(\"This is an error 4\")\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t} else {\n\t\t\tprintln(\"FOund not delivery in same area\")\n\n\t\t\tvar minEstDelivery int = 99999\n\t\t\tvar deliveryPersonID uint = 0\n\t\t\tprintln(\"min\", minEstDelivery)\n\t\t\tdeliveryPeople, _ := QueryAllDeliveryPeople()\n\n\t\t\tfor _, value := range *(deliveryPeople) {\n\t\t\t\tcurrentLoc := value.CurrentLoc\n\t\t\t\testDelivery := AbsIntUtil(int(currentLoc) - int(deliveryArea))\n\t\t\t\tprintln(\"minimunnn\", currentLoc, deliveryArea, minEstDelivery, value.ID)\n\t\t\t\tif estDelivery < minEstDelivery {\n\t\t\t\t\tminEstDelivery = estDelivery\n\t\t\t\t\tdeliveryPersonID = value.ID\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprintln(\"Minimu is \", minEstDelivery, deliveryPersonID)\n\n\t\t\tif result := DB.First(&deliveryPerson, deliveryPersonID); result.Error != nil {\n\t\t\t\tprintln(\"This is an error 22\", result.Error)\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\torder.CookieID = cookieID\n\t\t\torder.Quantity = quantity\n\t\t\torder.UserID = userID\n\t\t\torder.DeliveryPersonID = deliveryPersonID\n\t\t\torder.EstimatedDelivery = uint(minEstDelivery)\n\t\t\torder.Status = \"EnRoute\"\n\t\t\torder.DeliveryArea = deliveryArea\n\n\t\t\tif result := tx.First(&deliveryPerson, deliveryPersonID); result.Error != nil {\n\t\t\t\tprintln(\"This is an error\")\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\tdeliveryPerson.OnDelivery = true\n\t\t\tif result := tx.Model(&deliveryPerson).Update(\"on_delivery\", \"1\").Where(\"id\", deliveryPersonID); result.Error != nil {\n\t\t\t\tprintln(\"This is an error\")\n\t\t\t\treturn result.Error\n\t\t\t}\n\n\t\t\tif result := tx.Create(&order); result.Error != nil {\n\t\t\t\tprintln(\"This is an error\")\n\t\t\t\treturn result.Error\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn &order, err\n}", "title": "" }, { "docid": "678e0b21e0d99161ddde607ff8aa729f", "score": "0.44999528", "text": "func (m *UserAttributeAssignmentsRequestBuilder) SetOrder()(*if36adc310cbd330bf50068cee323b550c674cedffe684c4068c171a72312f9fd.SetOrderRequestBuilder) {\n return if36adc310cbd330bf50068cee323b550c674cedffe684c4068c171a72312f9fd.NewSetOrderRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "dd48aaea5ff5e8c3abf5060139600200", "score": "0.44985175", "text": "func TestCreateOrder(t *testing.T) {\n\ta := assert.New(t)\n\n\tInitMockModel()\n\n\tvar (\n\t\texpectDistance = rand.Intn(100)\n\t\texpectedId = rand.Int63n(100)\n\t)\n\t// init the mock calculator\n\tdistance.InitMockCalculator(expectDistance, nil)\n\n\t// mock the query that create order\n\tmocket.Catcher.NewMock().WithQuery(`INSERT INTO \"orders\" (\"distance\",\"status\") VALUES (?,?)`).WithID(expectedId)\n\tdefer mocket.Catcher.Reset()\n\n\tvar (\n\t\tsrc = []string{\"1\", \"2\"}\n\t\tdes = []string{\"1.5\", \"1.6\"}\n\t)\n\n\to, err := CreateOrder(src, des)\n\n\t// check if the order return without error\n\ta.Nil(err, \"order should be created without err\")\n\ta.NotNil(o, \"order should be created\")\n\ta.Equal(expectedId, o.ID, \"id should be as expected\")\n\ta.Equal(expectDistance, o.Distance, \"distance should be as expected\")\n\ta.Equal(StatusUnassigned, o.Status, \"status should be UNASSIGNED\")\n}", "title": "" }, { "docid": "04e2a2600e7476ac5c482f5fbf1fd31b", "score": "0.44910505", "text": "func (c *Client) PlaceOrder(side string, pair exchanger.Pair, price, quantity float64, orderType string) (map[string]interface{}, error) {\n\tconst path = \"/api/1/trading/new_order\"\n\n\tsize, ok := LotSizes[pair]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%s: No lot size for this currency pair %s\", ExchangerName, pair)\n\t}\n\n\tp, ok := Pairs[pair]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%s: Pair not traded on this market %s\", ExchangerName, pair)\n\t}\n\n\tlots := fmt.Sprintf(\"%f\", quantity/size)\n\n\tdata := &url.Values{\n\t\t\"clientOrderId\": []string{fmt.Sprintf(\"hitbtc-%d\", makeTimestamp())},\n\t\t\"symbol\": []string{p},\n\t\t\"side\": []string{side},\n\t\t\"quantity\": []string{lots},\n\t\t\"type\": []string{orderType},\n\t}\n\n\t// TODO: use decimal type?\n\t// TODO: what about stopLimit type?\n\t// TODO: Price, in currency units, consider price steps?\n\tif orderType == \"limit\" {\n\t\tdata.Add(\"price\", fmt.Sprint(price))\n\t\tdata.Add(\"timeInForce\", \"GTC\")\n\t} else {\n\t\tdata.Add(\"timeInForce\", \"IOC\")\n\t}\n\n\t// Success response example (status can be `new` or `rejected`)\n\tvar v struct {\n\t\tExecutionReport map[string]interface{}\n\t}\n\n\t// err example: {\"code\":\"InvalidArgument\",\"message\":\"Fields are not valid: quantity\"}\n\terr := c.authPost(path, data, &v)\n\treturn v.ExecutionReport, err\n}", "title": "" }, { "docid": "cb15f15b3a52e396be41a305150bbefa", "score": "0.449089", "text": "func FinishOrder(c *gin.Context) {\r\n\ttype DoneOrder struct {\r\n\t\tHelperID string `json:\"helpid\"`\r\n\t\tDoneText string `json:\"donetext\" binding:\"required,min=1,max=255\"`\r\n\t\tActualType string `json:\"actualtype\" binding:\"required,min=1,max=40\"`\r\n\t}\r\n\tid := c.Param(\"id\")\r\n\torder := model.Order{}\r\n\tif err := model.DB.Where(\"id = ?\", id).First(&order).Error; err != nil {\r\n\t\tutils.InternalError(c, nil, err.Error())\r\n\t\treturn\r\n\t}\r\n\tif order.AudittedAt.IsZero() {\r\n\t\tutils.BadRequest(c, nil, \"该订单未审核\")\r\n\t\treturn\r\n\t}\r\n\tif order.GotAt.IsZero() {\r\n\t\tutils.BadRequest(c, nil, \"该订单未接受\")\r\n\t\treturn\r\n\t}\r\n\tif !order.DoneAt.IsZero() {\r\n\t\tutils.BadRequest(c, nil, \"订单已经完成过了\")\r\n\t\treturn\r\n\t}\r\n\tsession := sessions.Default(c)\r\n\tuserid := session.Get(\"UserID\").(string)\r\n\r\n\tif order.MaintainerID != userid {\r\n\t\tutils.BadRequest(c, nil, \"不能完成他人订单\")\r\n\t\treturn\r\n\t}\r\n\tdoneorder := DoneOrder{}\r\n\tuser := model.User{}\r\n\r\n\tif err := c.BindJSON(&doneorder); err != nil {\r\n\t\tutils.BadRequest(c, nil, err.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\tif !model.IsSelectExist(\"problemtype\", doneorder.ActualType) {\r\n\t\tutils.BadRequest(c, nil, \"问题类型不存在\")\r\n\t\treturn\r\n\t}\r\n\r\n\tuser.WorkID = doneorder.HelperID\r\n\texist, err := user.IsUserExist()\r\n\r\n\tif err != nil {\r\n\t\tutils.InternalError(c, nil, \"数据库操作失败\")\r\n\t\treturn\r\n\t}\r\n\tif !exist {\r\n\t\tutils.BadRequest(c, nil, \"协同人员不存在\")\r\n\t\treturn\r\n\t}\r\n\torder.ActualType = html.EscapeString(doneorder.ActualType)\r\n\torder.DoneText = html.EscapeString(doneorder.DoneText)\r\n\torder.HelperID = doneorder.HelperID\r\n\torder.DoneAt = time.Now()\r\n\r\n\tif err := model.DB.Model(&order).Updates(&order).Error; err != nil {\r\n\t\tutils.InternalError(c, nil, err.Error())\r\n\t\treturn\r\n\t}\r\n\tutils.Success(c, nil, \"完成\")\r\n}", "title": "" }, { "docid": "c176ad53f64c2fad4e7932b53b9f8a47", "score": "0.44877565", "text": "func (_class VMClass) SetOrder(sessionID SessionRef, self VMRef, value int) (_err error) {\n\tif IsMock {\n\t\treturn _class.SetOrderMock(sessionID, self, value)\n\t}\t\n\t_method := \"VM.set_order\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVMRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertIntToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "37107b72fc9f7535a1a5fd292a9afcfe", "score": "0.44845834", "text": "func (prg *PaymentResourceGroup) BuildOrderTransaction() iface.Transaction {\n\treturn nil\n}", "title": "" }, { "docid": "c0625a444a03a80305e79344525d7a98", "score": "0.44819555", "text": "func (task *Tasks) SendDancePosition(d amqp.Delivery) (bool, error) {\n\tif isValid, err := validateTask(task, d); !isValid {\n\t\treturn isValid, err\n\t}\n\tfmt.Println(string(d.Body))\n\tmessage := ws.Message{Body: string(d.Body)}\n\n\ttask.Pool.Broadcast <- message\n\n\t// insert moves\n\tvar jsonData map[string]interface{}\n\tif err := json.Unmarshal(d.Body, &jsonData); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tqueryString := `\n\t\tinsert into positions (position, delay, timestamp, aid, did, sid)\n\t\tvalues ($1, $2, to_timestamp($3), $4, $5, $6)\n\t`\n\n\tdelay, err := strconv.ParseFloat(fmt.Sprintf(\"%s\", jsonData[\"syncDelay\"]), 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ttimestamp, err := strconv.ParseFloat(fmt.Sprintf(\"%s\", jsonData[\"timestamp\"]), 64)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tres, err := task.DbConn.Exec(\n\t\tqueryString,\n\t\tjsonData[\"position\"],\n\t\tdelay,\n\t\ttimestamp,\n\t\t1, // hack because Accounts is not set up\n\t\t1, // did\n\t\ttask.SessionID,\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = res.RowsAffected()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "de4c2619f277519956ac40b1200d4a1c", "score": "0.44815537", "text": "func TestPlaceMultipleMarginOrders(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\tord := okgroup.PlaceOrderRequest{\n\t\tInstrumentID: spotCurrency,\n\t\tType: order.Limit.Lower(),\n\t\tSide: order.Buy.Lower(),\n\t\tMarginTrading: \"1\",\n\t\tSize: \"-100\",\n\t\tNotional: \"100\",\n\t}\n\n\trequest := []okgroup.PlaceOrderRequest{\n\t\tord,\n\t}\n\n\t_, errs := o.PlaceMultipleMarginOrders(context.Background(), request)\n\tif len(errs) > 0 {\n\t\ttestStandardErrorHandling(t, errs[0])\n\t}\n}", "title": "" }, { "docid": "dbe5177dd810f8fd0c5f691e5d9c69e6", "score": "0.44790515", "text": "func MakeOrder(w http.ResponseWriter, r *http.Request) {\n\n\tq,_ := url.ParseQuery(r.URL.Path)\n\tprojectOwner := q[\"/submitOrder/pid\"][0]\n\tinvestor := q[\"uname\"][0]\n\tamount := q[\"amount\"][0]\n\n\tutils.MakeTransaction(investor,projectOwner,amount + \" USDT\",\"eosio.token\",\"transfer\")\n\tlog.Printf(\"after transfer USTD\")\n\tutils.MakeTransaction(projectOwner,investor,amount + \" ABC\",\"eosio.token\",\"transfer\")\n\tlog.Printf(\"after transfer ABC\")\n\n\tvar result entity.BalanceResult\n\tresult.Ret = \"200\"\n\n\tvar data entity.Data\n\tdata.Code = \"200\"\n\tdata.MSG =\"OK\"\n\tresult.Data = data\n\tcontentString := utils.StructToJson(result)\n\n\tutils.Output(w,contentString)\n\n}", "title": "" }, { "docid": "18daa31d333349167e2a060432d7684f", "score": "0.44770703", "text": "func (tx Tx) SaveOrder(o *model.Order) {\n\tvar (\n\t\tq strings.Builder\n\t\tres sql.Result\n\t\terr error\n\t)\n\tq.WriteString(`INSERT OR REPLACE INTO orderT (`)\n\tq.WriteString(orderColumns)\n\tq.WriteString(`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`)\n\tres, err = tx.tx.Exec(q.String(), ID(o.ID), o.Token, o.Valid, o.Source,\n\t\to.Name, o.Email, o.Address, o.City, o.State, o.Zip, o.Phone,\n\t\to.Customer, o.Member, Time(o.Created), o.CNote, o.ONote,\n\t\to.InAccess, o.Coupon)\n\tpanicOnError(err)\n\tif o.ID == 0 {\n\t\to.ID = model.OrderID(lastInsertID(res))\n\t}\n\tfor i, p := range o.Payments {\n\t\tres, err = tx.tx.Exec(\n\t\t\t`INSERT OR REPLACE INTO payment (id, orderid, type, subtype, method, stripe, created, initial, amount) VALUES (?,?,?,?,?,?,?,?,?)`,\n\t\t\tID(p.ID), o.ID, p.Type, p.Subtype, p.Method, p.Stripe, Time(p.Created), i == 0, p.Amount)\n\t\tpanicOnError(err)\n\t\tif p.ID == 0 {\n\t\t\tp.ID = model.PaymentID(lastInsertID(res))\n\t\t}\n\t}\n\tfor _, ol := range o.Lines {\n\t\tres, err = tx.tx.Exec(\n\t\t\t`INSERT OR REPLACE INTO order_line (id, orderid, product, quantity, price, guest_name, guest_email, option) VALUES (?,?,?,?,?,?,?,?)`,\n\t\t\tID(ol.ID), o.ID, ol.Product.ID, ol.Quantity, ol.Price, ol.GuestName, ol.GuestEmail, ol.Option)\n\t\tpanicOnError(err)\n\t\tif ol.ID == 0 {\n\t\t\tol.ID = model.OrderLineID(lastInsertID(res))\n\t\t} else {\n\t\t\tpanicOnExecError(tx.tx.Exec(`DELETE FROM ticket WHERE order_line=?`, ol.ID))\n\t\t}\n\t\tfor _, t := range ol.Tickets {\n\t\t\tvar eid model.EventID\n\t\t\tif t.Event != nil {\n\t\t\t\teid = t.Event.ID\n\t\t\t}\n\t\t\tres, err = tx.tx.Exec(\n\t\t\t\t`INSERT INTO ticket (id, order_line, event, used) VALUES (?,?,?,?)`,\n\t\t\t\tID(t.ID), ol.ID, IDStr(eid), Time(t.Used))\n\t\t\tpanicOnError(err)\n\t\t\tif t.ID == 0 {\n\t\t\t\tt.ID = model.TicketID(lastInsertID(res))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bbb14d72dd6827dd6b39c8c9c84558b1", "score": "0.4473788", "text": "func (t *Task) ChangePosition(newPosition int) {\n\tallTasks := t.HostColumn.Tasks\n\ttaskCount := len(allTasks)\n\tif taskCount <= 1 {\n\t\treturn\n\t}\n\tnewPosition = getBoundIndex(newPosition, taskCount)\n\tnewPriorityFrom := allTasks[newPosition].Priority\n\tvar newPriorityTo float64\n\n\tif newPosition == 0 {\n\t\tnewPriorityTo = newPriorityFrom - 1\n\t} else if newPosition == taskCount-1 {\n\t\tnewPriorityTo = newPriorityFrom + 1\n\t} else if newPriorityFrom > t.Priority {\n\t\tnewPriorityTo = t.HostColumn.Tasks[newPosition+1].Priority\n\t} else if newPriorityFrom < t.Priority {\n\t\tnewPriorityTo = t.HostColumn.Tasks[newPosition-1].Priority\n\t}\n\tt.Priority = getBetweenPriority(newPriorityFrom, newPriorityTo)\n\n\tsort.SliceStable(allTasks, func(i, j int) bool {\n\t\treturn allTasks[i].Priority < allTasks[j].Priority\n\t})\n}", "title": "" }, { "docid": "4dd58817cdb6d542517495f2022ef75d", "score": "0.44707954", "text": "func NewHideNonFakeMoveTaskOrdersPreconditionFailed() *HideNonFakeMoveTaskOrdersPreconditionFailed {\n\treturn &HideNonFakeMoveTaskOrdersPreconditionFailed{}\n}", "title": "" }, { "docid": "0bbd24a1b0eb8f52b42534a881f95f26", "score": "0.44700232", "text": "func ShouldElevatorExecuteOrder(order logmanagement.Order, currentfloor int, destination int) bool {\n\tif destination == -1 || destination == order.Floor {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "07f787722dcc112be7d8e908f582fbff", "score": "0.44679946", "text": "func(w *Worker)FuncThatPlacesOrder(in model.OrderInput) model.OrderOutput{\n\tquant,_ := strconv.ParseFloat(in.Quantity, 64)\n\treturn model.OrderOutput{\n\t\tOrderID: 100,\n\t\tClientID: 1,\n\t\tSymbol: in.Symbol,\n\t\tTicker: in.Ticker,\n\t\tQuantity: quant,\n\t\tBalance: 0.02661173,\n\t}\n}", "title": "" }, { "docid": "209d407aea4057b96df3f8480881ba7b", "score": "0.44543758", "text": "func (o *UserOrder) Insert(exec boil.Executor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no user_order provided for insertion\")\n\t}\n\n\tvar err error\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\tif o.UpdatedAt.IsZero() {\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeInsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userOrderColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tuserOrderInsertCacheMut.RLock()\n\tcache, cached := userOrderInsertCache[key]\n\tuserOrderInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tuserOrderColumns,\n\t\t\tuserOrderColumnsWithDefault,\n\t\t\tuserOrderColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userOrderType, userOrderMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(userOrderType, userOrderMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"user_order\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"user_order\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into user_order\")\n\t}\n\n\tif !cached {\n\t\tuserOrderInsertCacheMut.Lock()\n\t\tuserOrderInsertCache[key] = cache\n\t\tuserOrderInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(exec)\n}", "title": "" }, { "docid": "3c8f23df62ba1fef9ad956255eb38bcb", "score": "0.44509062", "text": "func updateOrder(c *gin.Context) {\n\tupdatedBy := c.MustGet(\"id\").(string)\n\toid := c.Param(\"id\")\n\toiInDB, err := getOrderByID(oid)\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, errors.GetMessage(err))\n\t\treturn\n\t}\n\tif oiInDB == nil {\n\t\tc.JSON(http.StatusBadRequest, fmt.Sprintf(\"Order %s doesn't exist\", oid))\n\t\treturn\n\t}\n\toi := orderItem{\n\t\tID: oid,\n\t\tExtraInfo: c.PostForm(\"extra_info\"),\n\t\tSpecialNotice: c.PostForm(\"special_notice\"),\n\t\tStatus: orderStatusAToOrderStatusM(strings.ToUpper(c.PostForm(\"status\"))),\n\t}\n\tpriceUSDStr := c.PostForm(\"sold_price_usd\")\n\tif priceUSDStr != \"\" {\n\t\tcValue, err := util.StringToFloat(priceUSDStr)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else if cValue == 0 {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else {\n\t\t\toi.SoldPriceUSD = cValue\n\t\t}\n\t}\n\tpriceCNYStr := c.PostForm(\"sold_price_cny\")\n\tif priceCNYStr != \"\" {\n\t\tcValue, err := util.StringToFloat(priceCNYStr)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else if cValue == 0 {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else {\n\t\t\toi.SoldPriceCNY = cValue\n\t\t}\n\t}\n\tpriceEURStr := c.PostForm(\"sold_price_eur\")\n\tif priceEURStr != \"\" {\n\t\tcValue, err := util.StringToFloat(priceEURStr)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else if cValue == 0 {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderPriceNotValid)\n\t\t\treturn\n\t\t} else {\n\t\t\toi.SoldPriceEUR = cValue\n\t\t}\n\t}\n\tdownPaymentStr := c.PostForm(\"downpayment\")\n\tif downPaymentStr != \"\" {\n\t\tcValue, err := util.StringToFloat(downPaymentStr)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderDownPaymentNotValid)\n\t\t\treturn\n\t\t} else if cValue == 0 {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderDownPaymentNotValid)\n\t\t\treturn\n\t\t} else {\n\t\t\toi.DownPayment = cValue\n\t\t}\n\t}\n\n\tif oi.Status != \"\" {\n\t\tif !util.IsInArrayString(oi.Status, validOrderStatusM) {\n\t\t\tc.JSON(http.StatusOK, vemsgOrderStatusNotValid)\n\t\t\treturn\n\t\t}\n\n\t\tif oi.Status == CANCELLED || oi.Status == MCANCELLED {\n\t\t\tvemsgOrderStatusNotValid.Message = \"Not allowed to cancel order, please call cancel API\"\n\t\t\tc.JSON(http.StatusOK, vemsgOrderStatusNotValid)\n\t\t\treturn\n\t\t}\n\t\tif !isOrderStatusChangeAllowed(oiInDB.Status, oi.Status) {\n\t\t\tvemsgOrderStatusNotValid.Message = fmt.Sprintf(\"Cannot change status from %s to %s\", oiInDB.Status, oi.Status)\n\t\t\tc.JSON(http.StatusOK, vemsgOrderStatusNotValid)\n\t\t\treturn\n\t\t}\n\t}\n\tif oi.Status != \"\" && strings.ToUpper(oiInDB.ItemCategory) == DIAMOND {\n\t\terr := dbTransact(db, func(tx *sql.Tx) error {\n\t\t\tq := oi.composeUpdateQueryTrack(updatedBy)\n\t\t\ttraceSQL(q)\n\t\t\tresult, err := tx.Exec(q)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif r, err := result.RowsAffected(); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if r != 1 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\ttq := fmt.Sprintf(`UPDATE diamonds SET status='%s' WHERE id='%s'`, oi.Status, oiInDB.ItemID)\n\t\t\ttraceSQL(tq)\n\t\t\t_, err = tx.Exec(tq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// r, err := result.RowsAffected()\n\t\t\t// if err != nil {\n\t\t\t// \treturn err\n\t\t\t// }\n\t\t\t// if r == 1 {\n\t\t\t// \toStateMap := make(map[string]interface{})\n\t\t\t// \toStateMap[\"status\"] = oi.Status + \",Due to Order: \" + oid + \" Status Change\"\n\t\t\t// \t//diamonds status changed\n\t\t\t// \tgo newHistoryRecords(updatedBy, \"diamonds\", oiInDB.ItemID, oStateMap)\n\t\t\t// }\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, errors.GetMessage(err))\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tq := oi.composeUpdateQueryTrack(updatedBy)\n\t\tif _, err := dbExec(q); err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, errors.GetMessage(err))\n\t\t\treturn\n\t\t}\n\t}\n\n\tc.JSON(http.StatusOK, \"SUCCESS\")\n\t// go newHistoryRecords(updatedBy, \"orders\", oi.ID, oi.parmsKV())\n}", "title": "" }, { "docid": "38b635a904db891af47e8df97a0c4d91", "score": "0.44493213", "text": "func TestPlaceMultipleSwapOrders(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\t_, err := o.PlaceMultipleSwapOrders(context.Background(),\n\t\tokgroup.PlaceMultipleSwapOrdersRequest{\n\t\t\tInstrumentID: fmt.Sprintf(\"%v-%v-SWAP\", currency.BTC, currency.USD),\n\t\t\tLeverage: 10,\n\t\t\tOrdersData: []okgroup.PlaceMultipleSwapOrderData{\n\t\t\t\t{\n\t\t\t\t\tClientOID: \"hello\",\n\t\t\t\t\tMatchPrice: \"0\",\n\t\t\t\t\tPrice: \"10\",\n\t\t\t\t\tSize: \"-1\",\n\t\t\t\t\tType: \"1\",\n\t\t\t\t}, {\n\t\t\t\t\tClientOID: \"hello2\",\n\t\t\t\t\tMatchPrice: \"0\",\n\t\t\t\t\tPrice: \"10\",\n\t\t\t\t\tSize: \"-1\",\n\t\t\t\t\tType: \"1\",\n\t\t\t\t}},\n\t\t})\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "a35a5840f1c7ba550386675f11ec6551", "score": "0.4438705", "text": "func (m *InMem) Move(context.Context, string, string, bool) error {\n\treturn nil\n}", "title": "" }, { "docid": "2097043eb69a45e4ddcbe84d8bcb9c8e", "score": "0.44314495", "text": "func (o *UpdateMoveTaskOrderDestinationAddressParams) WithMoveTaskOrderID(moveTaskOrderID string) *UpdateMoveTaskOrderDestinationAddressParams {\n\to.SetMoveTaskOrderID(moveTaskOrderID)\n\treturn o\n}", "title": "" }, { "docid": "656a22a5e009f84f38a8ac685b6c103d", "score": "0.4430236", "text": "func (move) process(s *state) {\n\tif s.cmd != \"F\" && s.cmd != \"B\" && len(s.words) < 1 {\n\t\ts.msg.Actor.SendInfo(\"You wanted to move where?\")\n\t\treturn\n\t}\n\n\tif s.actor.Stam.Current <= 0 {\n\t\ts.msg.Actor.SendBad(\"You are far too tired to do that.\")\n\t\treturn\n\t}\n\n\t// Check some timers\n\tready, msg := s.actor.TimerReady(\"combat\")\n\tif !ready {\n\t\ts.msg.Actor.SendBad(msg)\n\t\treturn\n\t}\n\n\tif s.actor.Equipment.GetWeight() > s.actor.MaxWeight() {\n\t\ts.msg.Actor.SendBad(\"You are carrying too much to move.\")\n\t\treturn\n\t}\n\n\ts.actor.RunHook(\"gridmove\")\n\n\tprevious := s.actor.Placement\n\tif s.cmd == \"SPRINT\" || s.cmd == \"SPR\" {\n\t\tdirection := string(s.words[0][0])\n\t\tif direction == \"F\" {\n\t\t\tif 5-s.actor.Placement >= 2 {\n\t\t\t\ts.actor.Placement += 2\n\t\t\t\ts.actor.SetTimer(\"global\", 8)\n\t\t\t\tif s.actor.Placement == 5 {\n\t\t\t\t\ts.msg.Actor.SendGood(\"You sprint forward, to the front of the room.\")\n\t\t\t\t} else {\n\t\t\t\t\ts.msg.Actor.SendGood(\"You sprint forward.\")\n\t\t\t\t}\n\t\t\t\tif s.actor.Flags[\"hidden\"] != true && s.actor.Flags[\"invisible\"] != true {\n\t\t\t\t\tfor _, char := range s.where.Chars.Contents {\n\t\t\t\t\t\tif char != s.actor {\n\t\t\t\t\t\t\tchar.WriteMovement(previous, s.actor.Placement, s.actor.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ts.msg.Actor.SendBad(\"There's not enough room to sprint forward\")\n\t\t\t}\n\t\t} else if direction[0:] == \"B\" {\n\t\t\tif s.actor.Placement-1 >= 2 {\n\t\t\t\ts.actor.Placement -= 2\n\t\t\t\ts.actor.SetTimer(\"global\", 8)\n\t\t\t\tif s.actor.Placement == 1 {\n\t\t\t\t\ts.msg.Actor.SendGood(\"You sprint back, to the back of the room.\")\n\t\t\t\t} else {\n\t\t\t\t\ts.msg.Actor.SendGood(\"You sprint backward.\")\n\t\t\t\t}\n\t\t\t\tif s.actor.Flags[\"hidden\"] != true && s.actor.Flags[\"invisible\"] != true {\n\t\t\t\t\tfor _, char := range s.where.Chars.Contents {\n\t\t\t\t\t\tif char != s.actor {\n\t\t\t\t\t\t\tchar.WriteMovement(previous, s.actor.Placement, s.actor.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ts.msg.Actor.SendBad(\"There's not enough room to sprint backward\")\n\t\t\t}\n\t\t}\n\t} else if s.cmd == \"F\" || s.cmd == \"FORWARD\" || (len(s.words) > 0 && string(s.words[0][0]) == \"F\") {\n\t\tif 5-s.actor.Placement >= 1 {\n\t\t\ts.actor.Placement += 1\n\t\t\ts.actor.SetTimer(\"global\", 4)\n\t\t\tif s.actor.Placement == 5 {\n\t\t\t\ts.msg.Actor.SendGood(\"You move forward, to the front of the room.\")\n\t\t\t} else {\n\t\t\t\ts.msg.Actor.SendGood(\"You move forward.\")\n\t\t\t}\n\t\t\tif s.actor.Flags[\"hidden\"] != true && s.actor.Flags[\"invisible\"] != true {\n\t\t\t\tfor _, char := range s.where.Chars.Contents {\n\t\t\t\t\tif char != s.actor {\n\t\t\t\t\t\tchar.WriteMovement(previous, s.actor.Placement, s.actor.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\ts.msg.Actor.SendBad(\"There's not enough room to move forward\")\n\t\t}\n\t} else if s.cmd == \"B\" || s.cmd == \"BACK\" || (len(s.words) > 0 && string(s.words[0][0]) == \"B\") {\n\t\tif s.actor.Placement-1 >= 1 {\n\t\t\ts.actor.Placement -= 1\n\t\t\ts.actor.SetTimer(\"global\", 4)\n\t\t\tif s.actor.Placement == 1 {\n\t\t\t\ts.msg.Actor.SendGood(\"You move back, to the back of the room.\")\n\t\t\t} else {\n\t\t\t\ts.msg.Actor.SendGood(\"You move backward.\")\n\t\t\t}\n\t\t\tif s.actor.Flags[\"hidden\"] != true && s.actor.Flags[\"invisible\"] != true {\n\t\t\t\tfor _, char := range s.where.Chars.Contents {\n\t\t\t\t\tif char != s.actor {\n\t\t\t\t\t\tchar.WriteMovement(previous, s.actor.Placement, s.actor.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\ts.msg.Actor.SendBad(\"There's not enough room to move backwards.\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e6e007c7674af9a46320d1803574044d", "score": "0.44286716", "text": "func (w *Wechat) translateToOrders(array []string) error {\n\tfor idx, a := range array {\n\t\ta = strings.Trim(a, \" \")\n\t\ta = strings.Trim(a, \"\\t\")\n\t\tarray[idx] = a\n\t}\n\tvar bill Order\n\tvar err error\n\tbill.PayTime, err = time.Parse(LocalTimeFmt, array[0]+\" +0800\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse create time %s error: %v\", array[0], err)\n\t}\n\n\tbill.TxType = getTxType(array[1])\n\tif bill.TxType == TxTypeCash2Cash {\n\t\tfmt.Printf(\"Get an unusable tx type, ignore it: %s\\n\", bill.TxType)\n\t\treturn nil\n\t} else if bill.TxType == TxTypeUnknown {\n\t\treturn fmt.Errorf(\"Failed to get the tx type %s: %v\", array[1], err)\n\t}\n\tbill.Peer = array[2]\n\tbill.Item = array[3]\n\tbill.Type = getOrderType(array[4])\n\tbill.TypeOriginal = array[4]\n\tif bill.Type == OrderTypeUnknown {\n\t\treturn fmt.Errorf(\"Failed to get the order type %s: %v\", array[4], err)\n\t}\n\tbill.Money, err = strconv.ParseFloat(array[5][2:], 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse money %s error: %v\", array[5], err)\n\t}\n\tbill.Method = array[6]\n\tbill.OrderID = array[8]\n\tbill.MechantOrderID = array[9]\n\n\tw.Orders = append(w.Orders, bill)\n\treturn nil\n}", "title": "" }, { "docid": "09ad91a6d938dd97c8113f67d3020521", "score": "0.44261512", "text": "func placeOrder(o Order, db *sql.DB) (Order, error) {\n\tquery := fmt.Sprintf(\"INSERT INTO orders(status, distance) VALUES('%s', '%d')\", o.Status, o.Distance)\n\n\t_, err := db.Exec(query)\n\tif err != nil {\n\t\treturn o, err\n\t}\n\t//Get the ID of the last order inserted\n\terr = db.QueryRow(\"SELECT LAST_INSERT_ID()\").Scan(&o.ID)\n\tif err != nil {\n\t\treturn o, err\n\t}\n\treturn o, nil\n}", "title": "" }, { "docid": "444fa81e10000ec8ed32091767826600", "score": "0.44215357", "text": "func (l *LimitOrder) GenerateOrderFill(orderID *OrderID, execPrice float64) (orderExec OrderExecution, setExecs []*SettlementExecution, err error) {\n\n\tif l.AmountHave == 0 {\n\t\terr = fmt.Errorf(\"Error generating order fill: empty order, the AmountHave cannot be 0\")\n\t\treturn\n\t}\n\n\tif execPrice == float64(0) {\n\t\terr = fmt.Errorf(\"Error generating order fill: price cannot be zero\")\n\t\treturn\n\t}\n\t// So we want to make sure that we're filling this, so first calculate the amountWantToFill and make sure it equals amountHave\n\tvar amountToDebit uint64\n\tvar debitAsset Asset\n\tvar creditAsset Asset\n\tif l.Side == Buy {\n\t\tdebitAsset = l.TradingPair.AssetWant\n\t\tcreditAsset = l.TradingPair.AssetHave\n\t} else if l.Side == Sell {\n\t\tdebitAsset = l.TradingPair.AssetHave\n\t\tcreditAsset = l.TradingPair.AssetWant\n\t} else {\n\t\terr = fmt.Errorf(\"Error generating order fill from price, order is not buy or sell side, it's %s side\", l.Side.String())\n\t\treturn\n\t}\n\tamountToDebit = uint64(float64(l.AmountHave) * execPrice)\n\n\t// IMPORTANT! These lines:\n\t// > OrderID: make([]byte, len(orderID),\n\t// > copy(execution.OrderID, orderID)\n\t// are EXTREMELY IMPORTANT because there's pretty much no other way to copy\n\t// bytes. This was a really annoying issue to debug\n\t// Finally generate execution\n\torderExec = OrderExecution{\n\t\tOrderID: *orderID,\n\t\tNewAmountWant: 0,\n\t\tNewAmountHave: 0,\n\t\tFilled: true,\n\t}\n\tdebitSetExec := SettlementExecution{\n\t\tAmount: amountToDebit,\n\t\tAsset: debitAsset,\n\t\tType: Debit,\n\t}\n\tcreditSetExec := SettlementExecution{\n\t\tAmount: l.AmountHave,\n\t\tAsset: creditAsset,\n\t\tType: Credit,\n\t}\n\n\tcopy(debitSetExec.Pubkey[:], l.Pubkey[:])\n\tcopy(creditSetExec.Pubkey[:], l.Pubkey[:])\n\n\tsetExecs = append(setExecs, &debitSetExec)\n\tsetExecs = append(setExecs, &creditSetExec)\n\treturn\n}", "title": "" }, { "docid": "e536d99362f068035c1b9c4e5ff26801", "score": "0.44164756", "text": "func SetupPlacement(\n\tcoordAPI Coordinator,\n\tcoordHost InstanceInfo,\n\taggs Aggregators,\n\topts AggregatorClusterOptions,\n) error {\n\t// Setup aggregator placement.\n\tvar env, zone string\n\tinstances := make([]*placementpb.Instance, 0, len(aggs))\n\tfor i, agg := range aggs {\n\t\tinfo, err := agg.HostDetails()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif i == 0 {\n\t\t\tenv = info.Env\n\t\t\tzone = info.Zone\n\t\t}\n\n\t\tinstance := &placementpb.Instance{\n\t\t\tId: info.ID,\n\t\t\tIsolationGroup: fmt.Sprintf(\"isogroup-%02d\", i%int(opts.NumIsolationGroups)),\n\t\t\tZone: info.Zone,\n\t\t\tWeight: 1,\n\t\t\tEndpoint: net.JoinHostPort(info.M3msgAddress, strconv.Itoa(int(info.M3msgPort))),\n\t\t\tHostname: info.ID,\n\t\t\tPort: info.M3msgPort,\n\t\t}\n\n\t\tinstances = append(instances, instance)\n\t}\n\n\taggPlacementRequestOptions := PlacementRequestOptions{\n\t\tService: ServiceTypeM3Aggregator,\n\t\tZone: zone,\n\t\tEnv: env,\n\t}\n\n\t_, err := coordAPI.InitPlacement(\n\t\taggPlacementRequestOptions,\n\t\tadmin.PlacementInitRequest{\n\t\t\tNumShards: opts.NumShards,\n\t\t\tReplicationFactor: opts.RF,\n\t\t\tInstances: instances,\n\t\t\tOptionOverride: &placementpb.Options{\n\t\t\t\tSkipPortMirroring: &protobuftypes.BoolValue{Value: true},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to init aggregator placement: %w\", err)\n\t}\n\n\t// Setup coordinator placement.\n\tcoordPlacementRequestOptions := PlacementRequestOptions{\n\t\tService: ServiceTypeM3Coordinator,\n\t\tZone: coordHost.Zone,\n\t\tEnv: coordHost.Env,\n\t}\n\t_, err = coordAPI.InitPlacement(\n\t\tcoordPlacementRequestOptions,\n\t\tadmin.PlacementInitRequest{\n\t\t\tInstances: []*placementpb.Instance{\n\t\t\t\t{\n\t\t\t\t\tId: coordHost.ID,\n\t\t\t\t\tZone: coordHost.Zone,\n\t\t\t\t\tEndpoint: net.JoinHostPort(coordHost.M3msgAddress, strconv.Itoa(int(coordHost.M3msgPort))),\n\t\t\t\t\tHostname: coordHost.ID,\n\t\t\t\t\tPort: coordHost.M3msgPort,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to init coordinator placement: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9901281b58224fe1c88585adede19c4b", "score": "0.44100487", "text": "func (s *NotificationsService) ProcessOrder(id int) error {\n\torder, err := s.GetOrder(id)\n\tapplesAvail := s.stockCountApples\n\torangesAvail := s.stockCountOranges\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Determine if order can be fulfilled with current stock\n\tfor _, itm := range order.OrderInput {\n\t\tswitch strings.ToLower(itm) {\n\t\tcase \"apple\":\n\t\t\tif applesAvail--; applesAvail == -1 {\n\t\t\t\treturn ErrOutOfStock{\"Apple\"}\n\t\t\t}\n\t\tcase \"orange\":\n\t\t\tif orangesAvail--; orangesAvail == -1 {\n\t\t\t\treturn ErrOutOfStock{\"Orange\"}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Update stock count for this order\n\ts.stockCountApples -= s.stockCountApples - applesAvail\n\ts.stockCountOranges -= s.stockCountOranges - orangesAvail\n\t// Indicate that this order has been processed\n\torder.Status = true\n\treturn nil\n}", "title": "" }, { "docid": "25dc1d06f2b07a48a3cbc777ee37d051", "score": "0.4407444", "text": "func (self AggressiveAi1) Orders(logger common.Logger, me state.PlayerId, s *state.State) (result state.Orders) {\n\n logger.Printf(\"AggressiveAi1 calculating orders for player: %v\", me)\n\n //list of all nodes I don't own and haven't sent guys to yet\n unclaimed := make([]state.NodeId, 0, len(s.Nodes))\n\n //list of all nodes with enemy guys on them\n enemy := make([]state.NodeId, 0, len(s.Nodes))\n\n //map of nodes where guys are (or are about to be) available to a map of delay to number of soldiers with that delay\n allAvailable := make(map[state.NodeId]map[int]int, len(s.Nodes))\n\n //total available guys across all nodes\n totalAvailable := 0\n\n //map of source and destination node IDs (concatenated together) to the length of the path between those nodes\n shortestPaths := make(map[state.NodeId]int)\n\n // iterate over all nodes in order to populate the unclaimed list, enemy list, available soldiers map, and shortest paths map\n for _, node := range s.Nodes {\n enemyUnits := 0\n units := 0\n // count enemy and friendly units\n for playerId, numUnits := range node.Units {\n if playerId == me {\n units += numUnits\n } else {\n enemyUnits += numUnits\n }\n }\n //logger.Printf(\"totalAvailable: %v\", totalAvailable)\n //logger.Printf(\"node: %v has units: %v enemyUnits: %v\", node.Id, units, enemyUnits)\n // check for enemy node\n if enemyUnits > 0 {\n enemy = append(enemy, node.Id)\n for src := range allAvailable {\n shortestPaths[src+node.Id] = len(s.Path(src, node.Id, nil))\n }\n // check for unclaimed node\n } else if units <= 0 {\n unclaimed = append(unclaimed, node.Id)\n // find shortest paths from all available guys to this new unclaimed node\n for src := range allAvailable {\n shortestPaths[src+node.Id] = len(s.Path(src, node.Id, nil))\n }\n }\n // check for available units on node itself\n if units > 1 {\n // always leave 1 home to keep ownership of the node\n units--\n // is this node new to us?\n if len(allAvailable[node.Id]) == 0 {\n // create map\n allAvailable[node.Id] = map[int]int{0: units}\n // find shortest path from this new node to all unclaimed and enemy nodes\n for _, dst := range unclaimed {\n shortestPaths[node.Id+dst] = len(s.Path(node.Id, dst, nil))\n }\n for _, dst := range enemy {\n shortestPaths[node.Id+dst] = len(s.Path(node.Id, dst, nil))\n }\n } else {\n // add key to map\n allAvailable[node.Id][0] += units\n }\n totalAvailable += units\n //logger.Printf(\"totalAvailable (from node): %v\", totalAvailable)\n }\n // check for available units on each edge leaving from this node\n for _, edge := range node.Edges {\n for index, unitMap := range edge.Units {\n if units = unitMap[me]; units > 0 {\n delay := len(edge.Units) - index\n // is this node new to us?\n if len(allAvailable[edge.Dst]) == 0 {\n // create map\n allAvailable[edge.Dst] = map[int]int{delay: units}\n // find shortest path from this new node to all unclaimed nodes\n for _, dst := range unclaimed {\n shortestPaths[edge.Dst+dst] = len(s.Path(edge.Dst, dst, nil))\n }\n } else {\n // add key to map\n allAvailable[edge.Dst][delay] += units\n }\n totalAvailable += units\n //logger.Printf(\"totalAvailable (from edge %v): %v\", edge.Dst, totalAvailable)\n }\n }\n }\n }\n\n // print some data to the logger for debugging/info purposes\n logger.Printf(\"Unclaimed: %v\", len(unclaimed))\n logger.Printf(\"Enemy: %v\", len(enemy))\n logger.Printf(\"totalAvailable: %v\", totalAvailable)\n //logger.Printf(\"allAvailable: %v\", len(allAvailable))\n count := 0\n for src, availables := range allAvailable {\n for _, units := range availables {\n count += units\n }\n logger.Printf(\"src: %v availables: %v count: %v\", src, availables, count)\n }\n logger.Printf(\"nodes: %v\", len(s.Nodes))\n\n // for each unclaimed node, add shortest path to pathQueue\n pathQueue := make([]Path, 0, len(unclaimed))\n for _, node := range unclaimed {\n best := Path{\n dst: node,\n length: -1,\n }\n logger.Printf(\"finding best available for: %v\", node)\n for src, availables := range allAvailable {\n dist := shortestPaths[src+node]\n for delay, units := range availables {\n if units > 0 && (best.length < 0 || dist+delay < best.length) {\n best.src = src\n best.delay = delay\n best.length = dist + delay\n }\n }\n }\n // logger.Printf(\"best option is from: %v delay: %v length: %v\", best.src, best.delay, best.length)\n // insert into queue\n pathQueue = append(pathQueue, best)\n }\n\n // sort the queue\n sort.Sort(ByDist{pathQueue})\n\n // as long as there are still units available, for each path in the queue, try to resolve it\n for totalAvailable > 0 && len(pathQueue) > 0 {\n next := pathQueue[0]\n pathQueue = pathQueue[1:]\n if allAvailable[next.src][next.delay] > 0 {\n if allAvailable[next.src][next.delay] == 1 {\n delete(allAvailable[next.src], next.delay)\n } else {\n allAvailable[next.src][next.delay] -= 1\n }\n totalAvailable--\n if next.delay == 0 {\n result = append(result, state.Order{\n Src: next.src,\n Dst: s.Path(next.src, next.dst, nil)[0],\n Units: 1,\n })\n // logger.Printf(\"sending 1 soldier from: %v towards: %v\", next.src, next.dst)\n }\n } else {\n logger.Printf(\"soldier no longer available, finding next best available for: %v (totalAvail: %v allAvail: %v)\", next.dst, totalAvailable, len(allAvailable))\n best := Path{\n dst: next.dst,\n length: -1,\n }\n for src, availables := range allAvailable {\n dist := shortestPaths[src+next.dst]\n //logger.Printf(\"src: %v availables: %v dist: %v\", src, availables, dist)\n for delay, units := range availables {\n //logger.Printf(\"delay: %v units: %v\", delay, units)\n if units > 0 && (best.length < 0 || dist+delay < best.length) {\n best.src = src\n best.delay = delay\n best.length = dist + delay\n }\n }\n }\n //logger.Printf(\"next best option is from: %v delay: %v length: %v\", best.src, best.delay, best.length)\n // insert into queue\n pathQueue = append(pathQueue, best)\n // re-sort the queue\n sort.Sort(ByDist{pathQueue})\n }\n }\n\n // send remaining available units to closest node that has any enemy units on it\n if totalAvailable > 0 {\n for src, availables := range allAvailable {\n if units := availables[0]; units > 0 {\n //find closest enemy node\n // logger.Printf(\"finding closest enemy for %v available guys on %v\", units, src)\n best := -1\n bestEdge := src\n for _, dst := range enemy {\n if dst == src {\n best = 0\n bestEdge = src\n }\n dist := shortestPaths[src+dst]\n if best < 0 || dist < best {\n best = dist\n bestEdge = s.Path(src, dst, nil)[0]\n }\n }\n if bestEdge == src {\n // logger.Printf(\"leaving them at home on %v\", bestEdge)\n } else {\n // logger.Printf(\"sending them along %v\", bestEdge)\n result = append(result, state.Order{\n Src: src,\n Dst: bestEdge,\n Units: units,\n })\n }\n }\n }\n }\n\n // all done, return the orders list\n return\n}", "title": "" }, { "docid": "b334bfcd0dffd2123f47b3683d02d5a7", "score": "0.44064975", "text": "func (o *Order) NewOrderPlacedEvent() *Event {\n\treturn &Event{eventType: ORDER_PLACED, payload: o}\n}", "title": "" }, { "docid": "ae205f66e83ac49125806a6d66d1170a", "score": "0.4405644", "text": "func (p OrderAmendBulkParams) IsNil() bool {\n\treturn len(p.Orders) == 0\n}", "title": "" }, { "docid": "869946a025bacee6e06b4e56fe192c93", "score": "0.43972647", "text": "func (ok *Okx) PlaceMultipleOrders(ctx context.Context, args []PlaceOrderRequestParam) ([]OrderData, error) {\n\tif len(args) == 0 {\n\t\treturn nil, errNoOrderParameterPassed\n\t}\n\tvar err error\n\tfor x := range args {\n\t\terr = ok.validatePlaceOrderParams(&args[x])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar resp []OrderData\n\terr = ok.SendHTTPRequest(ctx, exchange.RestSpot, placeMultipleOrdersEPL, http.MethodPost, placeMultipleOrderURL, &args, &resp, true)\n\tif err != nil {\n\t\tif len(resp) == 0 {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar errs error\n\t\tfor x := range resp {\n\t\t\terrs = common.AppendError(errs, fmt.Errorf(\"error code:%s message: %v\", resp[x].SCode, resp[x].SMessage))\n\t\t}\n\t\treturn nil, errs\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "9a1b0a0c992e103727cb83948b4f6771", "score": "0.43905473", "text": "func (mr *MockStateInterfaceMockRecorder) MoveTokensFromPlacesToPlaces(ctx, from, to interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MoveTokensFromPlacesToPlaces\", reflect.TypeOf((*MockStateInterface)(nil).MoveTokensFromPlacesToPlaces), ctx, from, to)\n}", "title": "" }, { "docid": "2378a27f1288e3a9d33cf1c6eec654e0", "score": "0.43888775", "text": "func executeOrder(book *rbt.Tree, ord Order) (Order, []Fill) {\n\tvar fills []Fill\n\n\tif ord.Direction == BID {\n\t\t// start left\n\t\tit := book.Iterator()\n\n\t\tfor it.Begin(); it.Next(); {\n\t\t\tnodePrice, node := it.Key().(int), it.Value().(*TreeNode)\n\n\t\t\t//Check price\n\t\t\tif ord.Price >= nodePrice {\n\t\t\t\t// Have to append to top level variable but am dealing with scoped binding as well :=,\n\t\t\t\t// so it takes an extra line\n\n\t\t\t\tnodeOrderResult, nodeFills := matchNode(node, ord)\n\t\t\t\tord = nodeOrderResult\n\t\t\t\tfor _, fill := range nodeFills {\n\t\t\t\t\tif fill.Number > 0 {\n\t\t\t\t\t\tfills = append(fills, fill)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t//skip this node, too expensive (The cheapest ask could be higher than this bid)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif ord.NumberOutstanding == 0 {\n\t\t\t\t// if we have 0 outstanding we can quit\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t\treturn ord, fills\n\t} else if ord.Direction == ASK {\n\t\t// start left\n\t\tit := book.Iterator()\n\n\t\tfor it.End(); it.Prev(); {\n\t\t\tnodePrice, node := it.Key().(int), it.Value().(*TreeNode)\n\n\t\t\t//Check price\n\t\t\tif ord.Price <= nodePrice {\n\t\t\t\tnodeOrderResult, nodeFills := matchNode(node, ord)\n\t\t\t\tord = nodeOrderResult\n\t\t\t\tfor _, fill := range nodeFills {\n\t\t\t\t\tif fill.Number > 0 {\n\t\t\t\t\t\tfills = append(fills, fill)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//skip this node, too expensive (The cheapest ask could be higher than this bid)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif ord.NumberOutstanding == 0 {\n\t\t\t\t// if we have 0 outstanding we can quit\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t\treturn ord, fills\n\t} else {\n\t\t// Not a valid bid/ask\n\t}\n\n\treturn Order{}, nil\n}", "title": "" }, { "docid": "07dbd465b2cec42770d699fd62cceca1", "score": "0.43877596", "text": "func TestPlaceOrderOK(t *testing.T) {\n\tconst (\n\t\tpayload = `{\n\t\t\t\"petId\": 6,\n\t\t\t\"quantity\": 1,\n\t\t\t\"comment\": \"comment\",\n\t\t\t\"id\": 0,\n\t\t\t\"shipDate\": \"2000-01-23T04:56:07.000+00:00\",\n\t\t\t\"complete\": false,\n\t\t\t\"status\": \"placed\",\n\t\t\t\"RequireTest\": \"required\"\n\t\t }`\n\t\tstatus = http.StatusOK\n\t)\n\n\tbodyReader := strings.NewReader(payload)\n\treq := httptest.NewRequest(http.MethodPost, \"/v2/store/order\", bodyReader)\n\tw := httptest.NewRecorder()\n\n\t// Create the service and inject the logic\n\tservice := &StoreAPITestService{}\n\tservice.placeOrder = func(order petstoreserver.Order) (petstoreserver.ImplResponse, error) {\n\t\tcomment := \"comment\"\n\t\tassert.Equal(t, int64(6), order.PetId)\n\t\tassert.Equal(t, int32(1), order.Quantity)\n\t\tassert.Equal(t, &comment, order.Comment)\n\t\tassert.Equal(t, int64(0), order.Id)\n\t\t// assert.Equal(t, time.Time, order.ShipDate) // TODO: Fix datetime test\n\t\tassert.False(t, order.Complete)\n\t\tassert.Equal(t, \"placed\", order.Status)\n\t\tassert.Equal(t, \"required\", order.RequireTest)\n\n\t\treturn petstoreserver.Response(status, nil), nil\n\t}\n\n\t// Create the controller with the service\n\trouter := petstoreserver.NewStoreAPIController(service)\n\tcontroller, ok := router.(*petstoreserver.StoreAPIController)\n\trequire.True(t, ok)\n\n\t// Call the method of controller we are testing\n\tcontroller.PlaceOrder(w, req)\n\n\tres := w.Result()\n\tassert.Equal(t, status, res.StatusCode)\n\tdefer res.Body.Close()\n\n\t// Check the response\n\tdata, err := io.ReadAll(res.Body)\n\trequire.NoError(t, err)\n\tassert.Empty(t, data)\n}", "title": "" }, { "docid": "b4af93668132aa874c333a52b8d6275f", "score": "0.43865114", "text": "func (a *OrdersApiService) ConfirmOrdersExecute(r ApiConfirmOrdersRequest) (MainSetIntegrateOrdersInput, *_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 MainSetIntegrateOrdersInput\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"OrdersApiService.ConfirmOrders\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/integration/v1/orders/confirm\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xREKKIAuthorizationType == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"xREKKIAuthorizationType is required and must be specified\")\n\t}\n\tif r.input == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"input 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\tlocalVarHeaderParams[\"X-REKKI-Authorization-Type\"] = parameterToString(*r.xREKKIAuthorizationType, \"\")\n\t// body params\n\tlocalVarPostBody = r.input\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[\"ApiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\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 MainFailedOrderError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "5b81874790373a5c0adcf3ba7d5f679b", "score": "0.43861908", "text": "func ValidateMove(board models.Board, move models.Move) error {\n\tif move.X < 0 || move.Y < 0 || move.X >= board.Width || move.Y >= board.Height {\n\t\treturn errors.New(\"Out of bounds\")\n\t}\n\tif board.Torpedoes[move.X][move.Y] {\n\t\treturn errors.New(\"Do not waste your torpedoes\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4eb7576c0f5633c6f5015a77f41b9467", "score": "0.43851066", "text": "func processMove(b *Board) {\n\tfmt.Printf(\"Your move, %s. [Example: move bishop to c3 with Bc3]\\n\", b.getPlayerWithNextMove())\n\tvar move string\n\tfor {\n\t\t_, err := fmt.Scanf(\"%s\", &move)\n\t\tresult, err := b.attemptUserMove(move)\n\t\tif result && err == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfmt.Printf(\"Bad move, buster: %s\\n\", err.Error())\n\n\t}\n\n\t// TODO: Now, do something!\n\tfmt.Printf(\"I should do something here, but I don't yet.\\n\")\n}", "title": "" }, { "docid": "1831fd23187399da052aa7f29286d8ff", "score": "0.43758547", "text": "func pawnPromotionsHelper(move Move, isWhiteToMove bool) (allMoves []Move) {\n\tif isWhiteToMove {\n\t\tif (move.getDestSquare() & EighthRank) == 0 { //if there are no possible promotions, return default move\n\t\t\treturn []Move{move}\n\t\t}\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(whiteKnight))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(whiteBishop))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(whiteRook))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(whiteQueen))\n\t} else {\n\t\tif (move.getDestSquare() & FirstRank) == 0 {\n\t\t\treturn []Move{move}\n\t\t}\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(blackKnight))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(blackBishop))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(blackRook))\n\t\tallMoves = append(allMoves, move.copyMoveAndSetDestOccupancy(blackQueen))\n\t}\n\treturn allMoves\n}", "title": "" }, { "docid": "2461f8503850c3e104eef866f9b81efe", "score": "0.43715066", "text": "func buildPPMShipmentReadyForFinalCustomerCloseOutWithCustoms(db *pop.Connection, userUploader *uploader.UserUploader, customs []Customization) models.PPMShipment {\n\t// It's easier to use some of the data from other downstream functions if we have them go first and then make our\n\t// changes on top of those changes.\n\tppmShipment := buildApprovedPPMShipmentWithActualInfo(db, userUploader, customs)\n\n\tvar weightTicketTemplate *models.WeightTicket\n\tif result := findValidCustomization(customs, WeightTicket); result != nil {\n\t\tcWeightTicket := result.Model.(models.WeightTicket)\n\t\tweightTicketTemplate = &cWeightTicket\n\t}\n\n\tAddWeightTicketToPPMShipment(db, &ppmShipment, userUploader, weightTicketTemplate)\n\n\tppmShipment.FinalIncentive = ppmShipment.EstimatedIncentive\n\n\tif db != nil {\n\t\tmustSave(db, &ppmShipment)\n\t}\n\n\t// Because of the way we're working with the PPMShipment, the\n\t// changes we've made to it aren't reflected in the pointer\n\t// reference that the MTOShipment has, so we'll need to update it\n\t// to point at the latest version.\n\tppmShipment.Shipment.PPMShipment = &ppmShipment\n\n\treturn ppmShipment\n\n}", "title": "" }, { "docid": "7b72cd9d3deee3158bd8492bcc084713", "score": "0.43702057", "text": "func (s state) makeMove(m move) state {\n\tvar newState state\n\tnewState.goal.x = s.goal.x\n\tnewState.goal.y = s.goal.y\n\tnewState.empty = make([]coord, len(s.empty))\n\tfor i, e := range s.empty {\n\t\tnewState.empty[i] = e\n\t}\n\n\tnewState.nodes = make(map[coord]node, len(s.nodes))\n\tfor k, v := range s.nodes {\n\t\tnewState.nodes[k] = v\n\t}\n\n\tif m.A.x == s.goal.x && m.A.y == s.goal.y {\n\t\t// fmt.Printf(\"Goal moves to %v \\n\", m.B)\n\t\tnewState.goal = m.B\n\t}\n\n\tfor i, e := range newState.empty {\n\t\tif m.B.x == e.x && m.B.y == e.y {\n\t\t\tnewState.empty[i] = m.A\n\t\t\t// fmt.Printf(\"Empty moves to %v \\n\", m.A)\n\t\t}\n\t}\n\n\tnewState.move(m.A, m.B)\n\t// fmt.Printf(\"After move state %v\\n\", newState)\n\t// fmt.Printf(\"And original state %v\\n\", s)\n\treturn newState\n}", "title": "" }, { "docid": "ab913d0149047b5d8ef88cfb60b833b9", "score": "0.43699363", "text": "func NewCreateMoveTaskOrderNotFound() *CreateMoveTaskOrderNotFound {\n\n\treturn &CreateMoveTaskOrderNotFound{}\n}", "title": "" }, { "docid": "8b2a0d383e9622850cc70c2b1594a788", "score": "0.4369033", "text": "func handleTradeUpdates(tu alpaca.TradeUpdate) {\n\tfmt.Printf(\"%s event received for order %s.\\n\", tu.Event, tu.Order.ID)\n\n\tif tu.Order.Symbol != alpacaClient.stock {\n\t\t// The order was for a position unrelated to this script\n\t\treturn\n\t}\n\n\teventType := tu.Event\n\toid := tu.Order.ID\n\n\tif eventType == \"fill\" || eventType == \"partial_fill\" {\n\t\t// Our position size has changed\n\t\tpos, err := alpacaClient.client.GetPosition(alpacaClient.stock)\n\t\tif err != nil {\n\t\t\talpacaClient.position = 0\n\t\t} else {\n\t\t\talpacaClient.position = pos.Qty.IntPart()\n\t\t}\n\n\t\tfmt.Printf(\"New position size due to order fill: %d\\n\", alpacaClient.position)\n\t\tif eventType == \"fill\" && alpacaClient.currOrder == oid {\n\t\t\talpacaClient.currOrder = \"\"\n\t\t}\n\t} else if eventType == \"rejected\" || eventType == \"canceled\" {\n\t\tif alpacaClient.currOrder == oid {\n\t\t\t// Our last order should be removed\n\t\t\talpacaClient.currOrder = \"\"\n\t\t}\n\t} else if eventType == \"new\" {\n\t\talpacaClient.currOrder = oid\n\t} else {\n\t\tfmt.Printf(\"Unexpected order event type %s received\\n\", eventType)\n\t}\n}", "title": "" }, { "docid": "115c3b1cfe2ef6f1409faefdd22b17e6", "score": "0.43669972", "text": "func orderProcessor(){\n\tvar status string\n\n\tsession, err := mgo.Dial(mongodb_server)\n\tfor;;{\n\t\t// Connects to MongoDB\n if err != nil {\n \tfmt.Println(\"Orders API - orderProcessing - Unable to connect to MongoDB during read operation\")\n panic(err)\n }\n session.SetMode(mgo.Monotonic, true)\n c := session.DB(mongodb_database).C(mongodb_collection)\n var result []bson.M\n\t\terr = c.Find(nil).All(&result)\n\t\tif err != nil {\n fmt.Println(\"Orders API - orderProcessing - Error reading data from MongoDB\")\n }\n for i:=0;i<len(result);i++{\n \tif(result[i][\"status\"] != \"Delivered\"){\n \t//fmt.Println(\"\\n\\nOrder ID being updated is:\\n\", result[i][\"orderId\"])\n \tswitch result[i][\"status\"] {\n \tcase \"Order Placed\": status = \"Order Processed\"\n \tcase \"Order Processed\": status = \"Shipped\"\n \tcase \"Shipped\": status = \"Delivered\"\n \t}\n\n \t//fmt.Println(\"Order ID: \",result[i][\"orderId\"],\" Updated Status: \",result[i][\"status\"],\"\\n\\n\")\n \t//Update MongoDB with the new status\n \t//fmt.Println(result[i])\n \tquery := bson.M{\"orderId\" : result[i][\"orderId\"]}\n \tchange := bson.M{\"$set\": bson.M{ \"status\" : status}}\n \terr = c.Update(query, change)\n \ttimer1 := time.NewTimer(time.Second * 10)\n\t\t\t<-timer1.C\n\t\t}\n }\n\t}\n defer session.Close()\n}", "title": "" }, { "docid": "77f89aa0f3ffe1b5ff8644c28d62ea85", "score": "0.43625188", "text": "func (server *Server) UpdateOrder(writer http.ResponseWriter, request *http.Request) {\n\n\tvars := mux.Vars(request)\n\tshopID := vars[\"shop_id\"]\n\torderID := vars[\"order_id\"]\n\tshop := models.Shop{}\n\torder := models.Order{}\n\torderFinder := models.Order{}\n\n\tbody, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusUnprocessableEntity, err)\n\t}\n\n\terr = json.Unmarshal(body, &order)\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\terr = order.Validate(\"updatestatus\")\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tisAdmin, err := auth.IsAdminToken(request)\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tif !isAdmin {\n\t\tresponses.ERROR(writer, http.StatusUnauthorized, errors.New(\"Unauthorized: This is not an admin token\"))\n\t\treturn\n\t}\n\n\tcurrentOrder, err := orderFinder.FindOrderByID(server.DB, orderID)\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tif currentOrder.ShopID.String() != shopID {\n\t\tresponses.ERROR(writer, http.StatusUnauthorized, errors.New(\"Unauthorized: This order does not belong to the given shop\"))\n\t\treturn\n\t}\n\n\t_, err = shop.FindShopByID(server.DB, currentOrder.ShopID.String())\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tupdatedOrder, err := order.UpdateOrder(server.DB, orderID)\n\tif err != nil {\n\t\tresponses.ERROR(writer, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(writer, http.StatusOK, updatedOrder)\n}", "title": "" }, { "docid": "3684614c797608b7a699fdd602fa295f", "score": "0.4361552", "text": "func NewMoveTask(t goauto.Transformer) goauto.Tasker {\n\treturn goauto.NewTask(t, move)\n}", "title": "" } ]
39a04b9a2dedd89a53156ae7d05e2059
addFileToZip adds file to zip file by using zip.Writer. The file name should be a absolute path.
[ { "docid": "26e3ddcef40208d81234f7c052747115", "score": "0.81733125", "text": "func addFileToZip(zipWriter *zip.Writer, filename string) error {\n\t// open file for addition\n\tfileToZip, err := os.Open(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't open file %v due to: %v\", filename, err)\n\t}\n\tdefer func() {\n\t\tif closeErr := fileToZip.Close(); closeErr != nil {\n\t\t\terr = fmt.Errorf(\"can't close zip file %v opened \"+\n\t\t\t\t\"for file appending due to: %v\", filename, closeErr)\n\t\t}\n\t}()\n\n\t// get information from file for addition\n\tinfo, err := fileToZip.Stat()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't get information about file (%v) \"+\n\t\t\t\"that should be added to zip file due to: %v\", filename, err)\n\t}\n\n\t// add file to zip file\n\theader, err := zip.FileInfoHeader(info)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create zip file info header for file %v due to: %v\", filename, err)\n\t}\n\theader.Method = zip.Deflate // enables compression\n\twriter, err := zipWriter.CreateHeader(header)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create zip header for file %v due to: %v\", filename, err)\n\t}\n\t_, err = io.Copy(writer, fileToZip)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't copy content of file %v to zip file due to: %v\", filename, err)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "12ca695f80cb611e21ff10570f8eed22", "score": "0.8541575", "text": "func addFileToZip(zipWriter *zip.Writer, filename string) error {\n\n\tfileToZip, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fileToZip.Close()\n\n\t// Get the file information\n\tinfo, err := fileToZip.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theader, err := zip.FileInfoHeader(info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Using FileInfoHeader() above only uses the basename of the file. If we want\n\t// to preserve the folder structure we can overwrite this with the full path.\n\theader.Name = filename\n\n\t// Change to deflate to gain better compression\n\t// see http://golang.org/pkg/archive/zip/#pkg-constants\n\theader.Method = zip.Deflate\n\n\twriter, err := zipWriter.CreateHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(writer, fileToZip)\n\treturn err\n}", "title": "" }, { "docid": "0ea85697a5acb42cc7f05e8dc8fe00f8", "score": "0.69003826", "text": "func zipFile(bytesToWrite []byte, zipName, fileName string) error {\n\toutFile, err := os.Create(zipName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"falha ao criar arquivo zip %s, erro %q\", zipName, err)\n\t}\n\tdefer outFile.Close()\n\tw := zip.NewWriter(outFile)\n\tdefer w.Close()\n\tf, err := w.Create(fileName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"falha ao criar o zip, err %q\", err)\n\t}\n\tif _, err = f.Write(bytesToWrite); err != nil {\n\t\treturn fmt.Errorf(\"falha ao escrever o zip, err %q\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e37a982455b7946cb52fbdadf12d16d4", "score": "0.6689072", "text": "func addFile(zipW *zip.Writer, name string, fileName string) {\n\t// do not read the whole file at once - it can be very big\n\n\tvar r io.ReadCloser\n\tr, err := os.Open(fileName) //nolint:gosec\n\tif err != nil {\n\t\t// use error instead of file data\n\t\tlogrus.Debugf(\"%s\", err)\n\t\tr = ioutil.NopCloser(bytes.NewReader([]byte(err.Error() + \"\\n\")))\n\t}\n\tdefer r.Close() //nolint:errcheck\n\n\tmodTime := time.Now()\n\tif fi, _ := os.Stat(fileName); fi != nil {\n\t\tmodTime = fi.ModTime()\n\t}\n\n\taddData(zipW, name, modTime, r)\n}", "title": "" }, { "docid": "b6c18ea16bb7266b8aa0a7dbed1788e1", "score": "0.65950906", "text": "func AddToZip(zipWriter *zip.Writer, source string, rootSource string, logger *zerolog.Logger) error {\n\treturn AnnotateAddToZip(zipWriter, source, rootSource, nil, logger)\n}", "title": "" }, { "docid": "b07711850461744a493f76aa8c9f4350", "score": "0.63569605", "text": "func AnnotateAddToZip(zipWriter *zip.Writer,\n\tsource string,\n\trootSource string,\n\tannotator FileHeaderAnnotator,\n\tlogger *zerolog.Logger) error {\n\n\tlinuxZipName := func(platformValue string) string {\n\t\treturn strings.Replace(platformValue, \"\\\\\", \"/\", -1)\n\t}\n\n\tfullPathSource, err := filepath.Abs(source)\n\tif nil != err {\n\t\treturn errors.Wrapf(err, \"Failed to get absolute filepath\")\n\t}\n\n\tappendFile := func(info os.FileInfo) error {\n\t\tzipEntryName := info.Name()\n\t\tif rootSource != \"\" {\n\t\t\tzipEntryName = fmt.Sprintf(\"%s/%s\", linuxZipName(rootSource), info.Name())\n\t\t}\n\t\t// Create a header for this zipFile, basically let's see\n\t\t// if we can get the executable bits to travel along..\n\t\tfileHeader, fileHeaderErr := zip.FileInfoHeader(info)\n\t\tif fileHeaderErr != nil {\n\t\t\treturn fileHeaderErr\n\t\t}\n\t\t// Update the name to the proper thing...\n\t\tfileHeader.Name = zipEntryName\n\t\tif annotator != nil {\n\t\t\tannotatedHeader, annotatedHeaderErr := annotator(fileHeader)\n\t\t\tif annotatedHeaderErr != nil {\n\t\t\t\treturn errors.Wrapf(annotatedHeaderErr, \"Failed to annotate Zip entry file header\")\n\t\t\t}\n\t\t\tfileHeader = annotatedHeader\n\t\t}\n\n\t\tlogger.Debug().\n\t\t\tStr(\"Source\", info.Name()).\n\t\t\tInterface(\"Header\", fileHeader).\n\t\t\tMsg(\"Adding ZIP\")\n\n\t\t// File info for the binary executable\n\t\tbinaryWriter, binaryWriterErr := zipWriter.CreateHeader(fileHeader)\n\t\tif binaryWriterErr != nil {\n\t\t\treturn binaryWriterErr\n\t\t}\n\t\t/* #nosec */\n\t\treader, readerErr := os.Open(fullPathSource)\n\t\tif readerErr != nil {\n\t\t\treturn readerErr\n\t\t}\n\t\twritten, copyErr := io.Copy(binaryWriter, reader)\n\t\terrClose := reader.Close()\n\t\tif errClose != nil {\n\t\t\tlogger.Warn().\n\t\t\t\tErr(errClose).\n\t\t\t\tMsg(\"Failed to close Zip input stream\")\n\t\t}\n\t\tlogger.Debug().\n\t\t\tInt64(\"WrittenBytes\", written).\n\t\t\tStr(\"SourcePath\", fullPathSource).\n\t\t\tStr(\"ZipName\", zipEntryName).\n\t\t\tMsg(\"Archiving file\")\n\t\treturn copyErr\n\t}\n\n\tdirectoryWalker := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed to create FileInfoHeader\")\n\t\t}\n\t\t// Normalize the Name\n\t\tplatformName := strings.TrimPrefix(strings.TrimPrefix(path, rootSource), string(os.PathSeparator))\n\t\theader.Name = linuxZipName(platformName)\n\n\t\tif info.IsDir() {\n\t\t\theader.Name += \"/\"\n\t\t} else {\n\t\t\theader.Method = zip.Deflate\n\t\t}\n\t\twriter, err := zipWriter.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\t/* #nosec */\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed to open file: %s\", path)\n\t\t}\n\n\t\t/* #nosec */\n\t\tdefer func() {\n\t\t\tif closeErr := file.Close(); closeErr != nil {\n\t\t\t\tlogger.Warn().\n\t\t\t\t\tErr(closeErr).\n\t\t\t\t\tMsg(\"Failed to close zip writer\")\n\t\t\t}\n\t\t}()\n\n\t\t_, err = io.Copy(writer, file)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed to copy file contents\")\n\t\t}\n\t\treturn nil\n\t}\n\n\tfileInfo, err := os.Stat(fullPathSource)\n\tif nil != err {\n\t\treturn errors.Wrapf(err, \"Failed to get file information\")\n\t}\n\tswitch mode := fileInfo.Mode(); {\n\tcase mode.IsDir():\n\t\terr = filepath.Walk(fullPathSource, directoryWalker)\n\tcase mode.IsRegular():\n\t\terr = appendFile(fileInfo)\n\tdefault:\n\t\terr = errors.New(\"Inavlid source type\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to determine file mode\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1fa165aa82c59ce05b473c7385bf133", "score": "0.61163706", "text": "func AppendZipFile(zw ZipWriter, source string) error {\n\tzr, err := zip.OpenReader(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot open source zip %q: %v\", source, err)\n\t}\n\tif len(zr.File) == 0 {\n\t\tzr.Close()\n\t\treturn nil\n\t}\n\n\terr = AppendZip(zw, zr)\n\tzr.Close()\n\treturn err\n}", "title": "" }, { "docid": "37a4d8a4cadf46cef96bc02925299d2e", "score": "0.5911608", "text": "func writeFiles(filename string, zipw *zip.Writer) error {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to open %s: %s\", filename, err)\n\t}\n\tdefer file.Close()\n\n\twr, err := zipw.Create(filename)\n\tif err != nil {\n\t\tmsg := \"Failed to create entry for %s in zip file: %s\"\n\t\treturn fmt.Errorf(msg, filename, err)\n\t}\n\n\tif _, err := io.Copy(wr, file); err != nil {\n\t\treturn fmt.Errorf(\"Failed to write %s to zip: %s\", filename, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "334d266855fcc34c3ce3bd5711d23360", "score": "0.59115386", "text": "func addFileToTarWriter(rootDir, filePath string, tarWriter *tar.Writer) error {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not open file '%s', got error '%s'\", filePath, err.Error())\n\t}\n\tdefer file.Close()\n\n\tstat, err := file.Stat()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get stat for file '%s', got error '%v'\", filePath, err.Error())\n\t}\n\n\ttarPath := filePath[len(rootDir):]\n\n\theader := &tar.Header{\n\t\tName: tarPath,\n\t\tSize: stat.Size(),\n\t\tMode: int64(stat.Mode()),\n\t\tModTime: stat.ModTime(),\n\t}\n\n\terr = tarWriter.WriteHeader(header)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not write header for file '%s', got error '%v'\", filePath, err.Error())\n\t}\n\n\t_, err = io.Copy(tarWriter, file)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not copy the file '%s' data to the tarball, got error '%v'\", filePath, err.Error())\n\t}\n\t//fmt.Printf(\"Adding tar file %s relative path = %s size %d\\n \", filePath, relativePath, stat.Size())\n\n\treturn nil\n}", "title": "" }, { "docid": "4f3d4bb7bd67eef2efbbbaba0a9795c5", "score": "0.5876296", "text": "func createZipFile(zipFileName string, dirName string) (err error) {\n\t// create zip writer\n\tzipFile, err := os.Create(zipFileName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create empty zip file(%v) due to: %v\", zipFileName, err)\n\t}\n\tdefer func() {\n\t\tif closeErr := zipFile.Close(); closeErr != nil {\n\t\t\terr = fmt.Errorf(\"can't close zip file %v due to: %v\", zipFileName, closeErr)\n\t\t}\n\t}()\n\tzipWriter := zip.NewWriter(zipFile)\n\tdefer func() {\n\t\tif closeErr := zipWriter.Close(); closeErr != nil {\n\t\t\terr = fmt.Errorf(\"can't close zip file writer for zip file %v due to: %v\", zipFileName, closeErr)\n\t\t}\n\t}()\n\n\t// Add files to zip\n\tdirItems, err := os.ReadDir(dirName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't read report directory(%v) due to: %v\", dirName, err)\n\t}\n\tfor _, dirItem := range dirItems {\n\t\tif !dirItem.IsDir() {\n\t\t\tif err = addFileToZip(zipWriter, filepath.Join(dirName, dirItem.Name())); err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't add file dirItem.Name() to report zip file due to: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc3e0710ec16693b54d91698d0571790", "score": "0.58721054", "text": "func AppendZip(zw ZipWriter, zr *zip.ReadCloser) error {\n\tfor _, f := range zr.File {\n\t\tw, err := zw.CreateHeader(&f.FileHeader)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating header for %q: %v\", f.FileHeader.Name, err)\n\t\t}\n\t\tsrc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error opening %s: %v\", f.Name, err)\n\t\t}\n\t\t// We always get \"zip: checksum error\", but the resulting file is OK.\n\t\tif _, err = io.Copy(w, src); err != nil && !strings.HasSuffix(err.Error(), \"checksum error\") {\n\t\t\tsrc.Close()\n\t\t\treturn fmt.Errorf(\"error copying from %s: %v\", f.Name, err)\n\t\t}\n\t\tsrc.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a42b299d4b5cf101961d6084527e0fe8", "score": "0.57490164", "text": "func zipFiles(filename string, files []string) error {\n\n\tnewZipFile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer newZipFile.Close()\n\n\tzipWriter := zip.NewWriter(newZipFile)\n\tdefer zipWriter.Close()\n\n\t// Add files to zip\n\tfor _, file := range files {\n\t\tif err = addFileToZip(zipWriter, file); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ef3288d678825aacba9e6631aa67263", "score": "0.57214653", "text": "func (a *Workbook) WriteZip(zw *zip.Writer) error {\n\ta.files[\"xl/workbook.xml\"] = regCalcID.ReplaceAll(a.files[\"xl/workbook.xml\"], []byte(`<calcPr calcId=\"\"`))\n\tfor name, body := range a.files {\n\t\tw, err := zw.Create(name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := w.Write(body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn zw.Close()\n}", "title": "" }, { "docid": "ae8180087b03846de3aa0f22100c1978", "score": "0.56099933", "text": "func DoZipFile(filename string) error {\n\t//check exist file\n \n\tif fileutils.Exists(filename + \".zip\") {\n\t\terr := fileutils.ErrFileAlreadyExists\n\t\tlog.Println(\"err\", err)\n\t\treturn err\n\t}\n\t//check exist file end\n\tnewfile, err := os.Create(filename + \".zip\")\n\tif err != nil {\n\t\treturn err\n\t}\t \n defer checkErrorFunc(newfile.Close)\n\n\tzipit := zip.NewWriter(newfile)\t\n\tdefer checkErrorFunc(zipit.Close)\n \n\tzipfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\t\n\tdefer checkErrorFunc(zipfile.Close)\n \n\t// get the file information\n\tinfo, err := zipfile.Stat()\n\tif err != nil {\t\t\n\t\treturn err\n\t}\n \n\theader, err := zip.FileInfoHeader(info)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theader.Method = zip.Deflate\n \n\twriter, err := zipit.CreateHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(writer, zipfile)\n\treturn err\n\n}", "title": "" }, { "docid": "e505af3f8130e8d8c7a43ad7dc3cc348", "score": "0.5579673", "text": "func ZipFiles(filename string, files []string) *errors.APIError {\n\n\tnewfile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn errors.ErrGeneralInternalFault\n\t}\n\tdefer newfile.Close()\n\n\tzipWriter := zip.NewWriter(newfile)\n\tdefer zipWriter.Close()\n\n\t// Add files to zip\n\tfor _, file := range files {\n\t\tzap.L().Sugar().Debugf(\"zip file %s\", file)\n\n\t\tzipfile, err := os.Open(file)\n\t\tif err != nil {\n\t\t\treturn errors.ErrGeneralInternalFault\n\t\t}\n\t\tdefer zipfile.Close()\n\n\t\t// Get the file information\n\t\tinfo, err := zipfile.Stat()\n\t\tif err != nil {\n\t\t\treturn errors.ErrGeneralInternalFault\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn errors.ErrGeneralInternalFault\n\t\t}\n\t\t// Change to deflate to gain better compression\n\t\t// see http://golang.org/pkg/archive/zip/#pkg-constants\n\t\theader.Method = zip.Deflate\n\n\t\twriter, err := zipWriter.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn errors.ErrGeneralInternalFault\n\t\t}\n\t\t_, err = io.Copy(writer, zipfile)\n\t\tif err != nil {\n\t\t\treturn errors.ErrGeneralInternalFault\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e683687c213a4ffe54ffbd01a9b3c802", "score": "0.5565575", "text": "func MakeZip(zip_file string, files []string) error {\n\tnewZipFile, err := os.Create(zip_file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer newZipFile.Close()\n\n\tzipWriter := zip.NewWriter(newZipFile)\n\tdefer zipWriter.Close()\n\n\tfor _, file := range files {\n\t\tfileToZip, err := os.Open(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer fileToZip.Close()\n\t\tinfo, err := fileToZip.Stat()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\theader.Name = file\n\t\theader.Method = zip.Deflate\n\t\twriter, err := zipWriter.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = io.Copy(writer, fileToZip)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d5d2f3b7935c8dbdb04ef725955d0c89", "score": "0.5547175", "text": "func (a *Archiver) CreateZip(ctx context.Context, dst io.Writer) error {\n\tw := zip.NewWriter(dst)\n\n\tvar filesCount, sizeFiles int64\n\n\tfor _, root := range a.files {\n\t\terr := a.walker.Walk(ctx, root, func(path string, info *provider.ResourceInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tisDir := info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER\n\n\t\t\tfilesCount++\n\t\t\tif filesCount > a.config.MaxNumFiles {\n\t\t\t\treturn ErrMaxFileCount{}\n\t\t\t}\n\n\t\t\tif !isDir {\n\t\t\t\t// only add the size if the resource is not a directory\n\t\t\t\t// as its size could be resursive-computed, and we would\n\t\t\t\t// count the files not only once\n\t\t\t\tsizeFiles += int64(info.Size)\n\t\t\t\tif sizeFiles > a.config.MaxSize {\n\t\t\t\t\treturn ErrMaxSize{}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO (gdelmont): remove duplicates if the resources requested overlaps\n\t\t\tfileName, err := filepath.Rel(a.dir, path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif fileName == \"\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\theader := zip.FileHeader{\n\t\t\t\tName: fileName,\n\t\t\t\tModified: time.Unix(int64(info.Mtime.Seconds), 0),\n\t\t\t}\n\n\t\t\tif isDir {\n\t\t\t\theader.Name += \"/\"\n\t\t\t} else {\n\t\t\t\theader.UncompressedSize64 = info.Size\n\t\t\t}\n\n\t\t\tdst, err := w.CreateHeader(&header)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif !isDir {\n\t\t\t\tr, err := a.downloader.Download(ctx, path, \"\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif _, err := io.Copy(dst, r); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn w.Close()\n}", "title": "" }, { "docid": "ea75fc28b06eb32f33a8de7b39363c2a", "score": "0.5541182", "text": "func MakeZip(zip_file string, files []string) error {\r\n\tnewZipFile, err := os.Create(zip_file)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer newZipFile.Close()\r\n\r\n\tzipWriter := zip.NewWriter(newZipFile)\r\n\tdefer zipWriter.Close()\r\n\r\n\tfor _, file := range files {\r\n\t\tfileToZip, err := os.Open(file)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\tdefer fileToZip.Close()\r\n\t\tinfo, err := fileToZip.Stat()\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\theader, err := zip.FileInfoHeader(info)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\theader.Name = file\r\n\t\theader.Method = zip.Deflate\r\n\t\twriter, err := zipWriter.CreateHeader(header)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\t_, err = io.Copy(writer, fileToZip)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "1373646b4b27e6bdafdc36973421841e", "score": "0.5526589", "text": "func ZipTo(path string, output io.Writer) error {\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif fi.IsDir() {\n\t\tabsDir, err := filepath.Abs(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tarchive := zip.NewWriter(output)\n\t\tdefer archive.Close()\n\n\t\treturn filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\theader, err := zip.FileInfoHeader(info)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\theader.Name = strings.TrimPrefix(strings.TrimPrefix(path, absDir), \"/\")\n\t\t\tif header.Name == \"\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif info.IsDir() {\n\t\t\t\theader.Name += \"/\"\n\t\t\t} else {\n\t\t\t\theader.Method = zip.Deflate\n\t\t\t}\n\n\t\t\twriter, err := archive.CreateHeader(header)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif info.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tfile, err := os.Open(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer file.Close()\n\n\t\t\t_, err = io.Copy(writer, file)\n\t\t\treturn err\n\t\t})\n\t}\n\n\theader, err := zip.FileInfoHeader(fi)\n\tif err != nil {\n\t\treturn err\n\t}\n\theader.Method = zip.Deflate\n\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tarchive := zip.NewWriter(output)\n\tdefer archive.Close()\n\n\tgzw, err := archive.CreateHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = io.Copy(gzw, file)\n\treturn err\n}", "title": "" }, { "docid": "2dc6be1a7a317ccd274e456c8108bdbc", "score": "0.5523614", "text": "func AddFileToDirectory(dir, fileName, fileContents string) error {\n\tarchived, err := tryAddFileToArchive(dir, fileName, fileContents)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"adding file to archive\")\n\t}\n\tif archived {\n\t\treturn nil\n\t}\n\n\tfile, err := os.Create(filepath.Join(dir, fileName))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := file.Write([]byte(fileContents)); err != nil {\n\t\tcatcher := grip.NewBasicCatcher()\n\t\tcatcher.Add(err)\n\t\tcatcher.Add(file.Close())\n\t\treturn catcher.Resolve()\n\t}\n\treturn file.Close()\n}", "title": "" }, { "docid": "bea48318db4fd510bf35b86b0824d06b", "score": "0.54536384", "text": "func Zip(path, file, backupDir string, log *LogContext){\r\n\tfileName := path + file\r\n\tname := backupDir + file + \".gz\"\r\n\tdstFile, err := os.Create(name)\r\n\tif err != nil{\r\n\t\tlog.LogInfo(\"%v\", err)\r\n\t\treturn\r\n\t}\r\n\tdefer dstFile.Close()\r\n\r\n\tf, err := os.Open(fileName)\r\n\tif err != nil{\r\n\t\tlog.LogInfo(\"%v\", err)\r\n\t\treturn\r\n\t}\r\n\tdefer f.Close()\r\n\r\n\twriter := gzip.NewWriter(dstFile)\r\n\tbuf := make([]byte, blockSize)\r\n\tfor{\r\n\t\tn, err := f.Read(buf)\r\n\t\tif err == io.EOF || n == 0{\r\n\t\t\tbreak\r\n\t\t}\r\n\t\twriter.Write(buf[:n])\r\n\t}\r\n\twriter.Close()\r\n\tos.Remove(fileName)\r\n\tlog.LogInfo(\"done: %s zip file:%s\", file, name)\r\n}", "title": "" }, { "docid": "0fdc2f716ea771490cf15be41fc36977", "score": "0.543588", "text": "func ZipFiles(filename string, files []string) error {\n\n\tnewZipFile, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer newZipFile.Close()\n\n\tzipWriter := zip.NewWriter(newZipFile)\n\tdefer zipWriter.Close()\n\n\t// Add files to zip\n\tfor _, file := range files {\n\n\t\tzipfile, err := os.Open(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer zipfile.Close()\n\n\t\t// Get the file information\n\t\tinfo, err := zipfile.Stat()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Using FileInfoHeader() above only uses the basename of the file. If we want\n\t\t// to preserve the folder structure we can overwrite this with the full path.\n\t\theader.Name = file\n\n\t\t// Change to deflate to gain better compression\n\t\t// see http://golang.org/pkg/archive/zip/#pkg-constants\n\t\theader.Method = zip.Deflate\n\n\t\twriter, err := zipWriter.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err = io.Copy(writer, zipfile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26f5970a351cd1a9338db891734ee2ac", "score": "0.53648657", "text": "func addFileToTar(tw *tar.Writer, origPath string, destPath string) error {\n\tfile, err := os.Open(origPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif stat, err := file.Stat(); err == nil {\n\t\t// Create the header as needed for this file within the tarball\n\t\theader := new(tar.Header)\n\t\theader.Name = destPath\n\t\theader.Size = stat.Size()\n\t\theader.Mode = int64(stat.Mode())\n\t\theader.ModTime = stat.ModTime()\n\t\t// Write the header to the tarball archive\n\t\tif err := tw.WriteHeader(header); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Copy the file data to the tarball\n\t\tif _, err := io.Copy(tw, file); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a63efcb7a78bc1d1372768aea8be8db", "score": "0.5323272", "text": "func (w *Writer) AddFile(sourceFilename, filename string, ct ContentType,\n\tproperties ...string) error {\n\tfile, err := os.Open(sourceFilename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\treturn w.Add(filename, ct, file, properties...)\n}", "title": "" }, { "docid": "53ac066e09a13679c32e596bb891b7aa", "score": "0.5312618", "text": "func (actor Actor) ZipArchiveResources(sourceArchivePath string, filesToInclude []Resource) (string, error) {\n\tlog.WithField(\"sourceArchive\", sourceArchivePath).Info(\"zipping source files from archive\")\n\tzipFile, err := ioutil.TempFile(\"\", \"cf-cli-\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer zipFile.Close()\n\tzipPath := zipFile.Name()\n\n\twriter := zip.NewWriter(zipFile)\n\tdefer writer.Close()\n\n\tsource, err := os.Open(sourceArchivePath)\n\tif err != nil {\n\t\treturn zipPath, err\n\t}\n\tdefer source.Close()\n\n\treader, err := actor.newArchiveReader(source)\n\tif err != nil {\n\t\treturn zipPath, err\n\t}\n\n\tfor _, archiveFile := range reader.File {\n\t\tresource, ok := actor.findInResources(archiveFile.Name, filesToInclude)\n\t\tif !ok {\n\t\t\tlog.WithField(\"archiveFileName\", archiveFile.Name).Debug(\"skipping file\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.WithField(\"archiveFileName\", archiveFile.Name).Debug(\"zipping file\")\n\t\t// archiveFile.Open opens the symlink file, not the file it points too\n\t\treader, openErr := archiveFile.Open()\n\t\tif openErr != nil {\n\t\t\tlog.WithField(\"archiveFile\", archiveFile.Name).Errorln(\"opening path in dir:\", openErr)\n\t\t\treturn zipPath, openErr\n\t\t}\n\t\tdefer reader.Close()\n\n\t\terr = actor.addFileToZipFromFileSystem(\n\t\t\tresource.Filename, reader, archiveFile.FileInfo(),\n\t\t\tresource, writer,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.WithField(\"archiveFileName\", archiveFile.Name).Errorln(\"zipping file:\", err)\n\t\t\treturn zipPath, err\n\t\t}\n\t\treader.Close()\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"zip_file_location\": zipFile.Name(),\n\t\t\"zipped_file_count\": len(filesToInclude),\n\t}).Info(\"zip file created\")\n\treturn zipPath, nil\n}", "title": "" }, { "docid": "66e54c37f5939a99fb68deb49f879b30", "score": "0.53086835", "text": "func (f *zipFileHeads) doFilesZip(comment string) *bytes.Buffer {\n\tb := new(bytes.Buffer)\n\tz := zip.NewWriter(b)\n\tz.SetComment(comment)\n\tfor _, file := range f.Files {\n\t\tfh := &zip.FileHeader{\n\t\t\tName: file.Name,\n\t\t\tModified: file.Modified,\n\t\t\tMethod: file.Method,\n\t\t}\n\t\tzf, err := z.CreateHeader(fh)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif _, err = zf.Write(file.Body); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif err := z.Close(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "66d5fbc05a28921aeaa638c2a624943d", "score": "0.53017247", "text": "func ZipFiles2(inPath, outPath, passwd string) error {\n\toutFile, err := os.Create(outPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer outFile.Close()\n\n\tw := zip.NewWriter(outFile)\n\tdefer w.Close()\n\n\t// walk folder and add stuffs\n\treturn addFiles(w, inPath, \"\", passwd)\n}", "title": "" }, { "docid": "a687d489d9f1bbb84111d6a35f1bae98", "score": "0.5274659", "text": "func CompressZip(fileDir string, outputPath string) error {\n\toutFile, err := os.Create(outputPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer outFile.Close()\n\tw := zip.NewWriter(outFile)\n\tdefer w.Close()\n\n\treturn filepath.Walk(fileDir, func(path string, f os.FileInfo, err error) error {\n\t\tif f == nil {\n\t\t\treturn err\n\t\t}\n\t\tif f.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\trel, _ := filepath.Rel(fileDir, path)\n\t\tfmt.Println(rel, path)\n\t\tcompress(rel, path, w)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "b193e53055835d3d19aafb40c6cae0ae", "score": "0.5265118", "text": "func (manifest *fileManifest) AddFile(path string) error {\n\treturn manifest.encoder.Encode(fileManifestEntry{Path: path, IsDir: false})\n}", "title": "" }, { "docid": "a7e024c492aea5ddca3c7bd26d751737", "score": "0.5240752", "text": "func AddFile(a Archive, file string) error {\n\tfd, err := os.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fd.Close()\n\tfi, err := fd.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tw, err := a.Header(fi)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := io.Copy(w, fd); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aaad6c27b8c8524e23c4167600777d52", "score": "0.51931334", "text": "func addZip(c Config, gallery string) {\n\tif c.Galleries[gallery].Download {\n\t\tfolders := []string{filepath.FromSlash(galleryPath + gallery + \"/\" + origImgDir), filepath.FromSlash(galleryPath + gallery + \"/\" + featImgDir)}\n\t\terr := archiver.Zip.Make(filepath.FromSlash(galleryPath+gallery+\"/\"+gallery+\"_images.zip\"), folders)\n\t\tcheck(err)\n\t\tlog.Print(\"New zip file for \" + gallery + \" gallery created.\")\n\t} else {\n\t\tif !checkFile(filepath.FromSlash(galleryPath + gallery + \"/\" + gallery + \"_images.zip\")) {\n\t\t\tremoveFile(filepath.FromSlash(galleryPath + gallery + \"/\" + gallery + \"_images.zip\"))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ae6990724dbd0e975f0f9644f31d02c9", "score": "0.51822597", "text": "func (actor Actor) ZipDirectoryResources(sourceDir string, filesToInclude []Resource) (string, error) {\n\tlog.WithField(\"sourceDir\", sourceDir).Info(\"zipping source files from directory\")\n\tzipFile, err := ioutil.TempFile(\"\", \"cf-cli-\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer zipFile.Close()\n\tzipPath := zipFile.Name()\n\n\twriter := zip.NewWriter(zipFile)\n\tdefer writer.Close()\n\n\tfor _, resource := range filesToInclude {\n\t\tfullPath := filepath.Join(sourceDir, resource.Filename)\n\t\tlog.WithField(\"fullPath\", fullPath).Debug(\"zipping file\")\n\n\t\tfileInfo, err := os.Lstat(fullPath)\n\t\tif err != nil {\n\t\t\tlog.WithField(\"fullPath\", fullPath).Errorln(\"stat error in dir:\", err)\n\t\t\treturn zipPath, err\n\t\t}\n\n\t\tlog.WithField(\"file-mode\", fileInfo.Mode().String()).Debug(\"resource file info\")\n\t\tif fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink {\n\t\t\t// we need to user os.Readlink to read a symlink file from a directory\n\t\t\terr = actor.addLinkToZipFromFileSystem(fullPath, fileInfo, resource, writer)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithField(\"fullPath\", fullPath).Errorln(\"zipping file:\", err)\n\t\t\t\treturn zipPath, err\n\t\t\t}\n\t\t} else {\n\t\t\tsrcFile, err := os.Open(fullPath)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithField(\"fullPath\", fullPath).Errorln(\"opening path in dir:\", err)\n\t\t\t\treturn zipPath, err\n\t\t\t}\n\t\t\tdefer srcFile.Close()\n\n\t\t\terr = actor.addFileToZipFromFileSystem(\n\t\t\t\tfullPath, srcFile, fileInfo,\n\t\t\t\tresource, writer,\n\t\t\t)\n\t\t\tsrcFile.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithField(\"fullPath\", fullPath).Errorln(\"zipping file:\", err)\n\t\t\t\treturn zipPath, err\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"zip_file_location\": zipFile.Name(),\n\t\t\"zipped_file_count\": len(filesToInclude),\n\t}).Info(\"zip file created\")\n\treturn zipPath, nil\n}", "title": "" }, { "docid": "0607b4b8120f434213fbdfbdc8d44836", "score": "0.5135585", "text": "func (a *App) AddFile(name string, contents string) {\n\t// copy files if missing\n\ta.copyFiles()\n\n\t// set file\n\ta.files[name] = []byte(contents)\n}", "title": "" }, { "docid": "83c86937b979f145c82cc5b04beefa2b", "score": "0.5131856", "text": "func RecursiveZip(pathToZip, destinationPath string) error {\n\tdestinationFile, err := os.Create(destinationPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmyZip := zip.NewWriter(destinationFile)\n\terr = filepath.Walk(pathToZip, func(filePath string, info os.FileInfo, err error) error {\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trelPath := strings.TrimPrefix(filePath, filepath.Dir(pathToZip))\n\t\tzipFile, err := myZip.Create(relPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfsFile, err := os.Open(filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = io.Copy(zipFile, fsFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = myZip.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e29db551da0541226e9d0d583cb3db4", "score": "0.5121727", "text": "func zipit(source, target string) error {\n\tzipfile, err := os.Create(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer zipfile.Close()\n\n\tarchive := zip.NewWriter(zipfile)\n\tdefer archive.Close()\n\n\tinfo, err := os.Stat(source)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar baseDir string\n\tif info.IsDir() {\n\t\tbaseDir = filepath.Base(source)\n\t}\n\n\tfilepath.Walk(source, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif baseDir != \"\" {\n\t\t\theader.Name = filepath.Join(baseDir, strings.TrimPrefix(path, source))\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\theader.Name += \"/\"\n\t\t} else {\n\t\t\theader.Method = zip.Deflate\n\t\t}\n\n\t\twriter, err := archive.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t\t_, err = io.Copy(writer, file)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "d6f24842a22851e023a48116cc1be8d9", "score": "0.5086094", "text": "func Archive(inFilePath string, writer io.Writer, progress ProgressFunc) error {\n\tzipWriter := zip_impl.NewWriter(writer)\n\n\tbasePath := filepath.Dir(inFilePath)\n\n\terr := filepath.Walk(inFilePath, func(filePath string, fileInfo os.FileInfo, err error) error {\n\t\tif err != nil || fileInfo.IsDir() {\n\t\t\treturn err\n\t\t}\n\n\t\trelativeFilePath, err := filepath.Rel(basePath, filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tarchivePath := path.Join(filepath.SplitList(relativeFilePath)...)\n\n\t\tif progress != nil {\n\t\t\tif add := progress(archivePath); !add {\n\t\t\t\t// Should skip the current file\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tfile, err := os.Open(filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer func() {\n\t\t\t_ = file.Close()\n\t\t}()\n\n\t\tzipFileWriter, err := zipWriter.Create(archivePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = io.Copy(zipFileWriter, file)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn zipWriter.Close()\n}", "title": "" }, { "docid": "b3350e843905a4c18d42c34262a96833", "score": "0.5049292", "text": "func addFile(tw *tar.Writer, path string) error {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif stat, err := file.Stat(); err == nil {\n\t\t// now lets create the header as needed for this file within the tarball\n\t\theader := new(tar.Header)\n\t\theader.Name = path\n\t\theader.Size = stat.Size()\n\t\theader.Mode = int64(stat.Mode())\n\t\theader.ModTime = stat.ModTime()\n\n\t\t// write the header to the tarball archive\n\t\tif err := tw.WriteHeader(header); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// copy the file data to the tarball\n\t\tif _, err := io.Copy(tw, file); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ef265b59ce8fafe46b26f3ffc6c0565", "score": "0.5042108", "text": "func (a Archive) Add(name, path string) error {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tstat, err := file.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif stat.IsDir() {\n\t\treturn errors.New(\"unable to add dir into archive: \" + path)\n\t}\n\n\theader, err := zip.FileInfoHeader(stat)\n\tif err != nil {\n\t\treturn err\n\t}\n\theader.Method = zip.Deflate\n\theader.Name = name\n\tf, err := a.z.CreateHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(f, file)\n\treturn err\n}", "title": "" }, { "docid": "7423f066873d6bfcbdeef42ab5ff48de", "score": "0.50150406", "text": "func (z *Zip) Create(src ...string) (cnt int, err error) {\n\t// If there isn't a destination, return err\n\tif z.Car.Name == \"\" {\n\t\treturn 0, fmt.Errorf(\"destination required to create a zip archive\")\n\t}\n\t// If there aren't any sources, return err\n\tif len(src) == 0 {\n\t\treturn 0, fmt.Errorf(\"a source is required to create a zip archive\")\n\t}\n\t// See if we can create the destination file before processing\n\tz.File, err = os.OpenFile(z.Car.Name, os.O_RDWR|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer z.File.Close()\n\tbuf := new(bytes.Buffer)\n\tz.Writer = zip.NewWriter(buf)\n\tdefer z.Writer.Close()\n\t// Set up the file queue and its drain.\n\tz.FileCh = make(chan *os.File)\n\twait, err := z.write()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tvar fullPath string\n\t// Walk the sources, add each file to the queue.\n\t// This isn't limited as a large number of sources is not expected.\n\tvisitor := func(p string, fi os.FileInfo, err error) error {\n\t\treturn z.AddFile(fullPath, p, fi, err)\n\t}\n\tvar wg sync.WaitGroup\n\twg.Add(len(src) - 1)\n\tfor _, source := range src {\n\t\t// first get the absolute, its needed either way\n\t\tfullPath, err = filepath.Abs(source)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\terr = walk.Walk(fullPath, visitor)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\twg.Wait()\n\tclose(z.FileCh)\n\twait.Wait()\n\tz.Writer.Close()\n\t// Copy the zip\n\t_, err = z.File.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tz.File.Close()\n\tz.setDelta()\n\treturn int(z.Car.files), nil\n}", "title": "" }, { "docid": "03114466573f57e09f10ccebcadb4535", "score": "0.50016224", "text": "func addData(zipW *zip.Writer, name string, modTime time.Time, r io.Reader) {\n\tw, err := zipW.CreateHeader(&zip.FileHeader{\n\t\tName: name,\n\t\tMethod: zip.Deflate,\n\t\tModified: modTime,\n\t})\n\tif err == nil {\n\t\t_, err = io.Copy(w, r)\n\t}\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s\", err)\n\t}\n}", "title": "" }, { "docid": "bf989eca3fe0ea4c44c72bfcdd153b25", "score": "0.49971208", "text": "func zipit(source, target, prefix string) error {\n\tzipfile, err := os.Create(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer zipfile.Close()\n\n\tif prefix != \"\" {\n\t\t_, err = io.WriteString(zipfile, prefix)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tarchive := zip.NewWriter(zipfile)\n\tdefer archive.Close()\n\n\terr = filepath.Walk(source, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader.Name = strings.TrimPrefix(path, source)\n\n\t\tif info.IsDir() {\n\t\t\theader.Name += string(os.PathSeparator)\n\t\t} else {\n\t\t\theader.Method = zip.Deflate\n\t\t}\n\n\t\twriter, err := archive.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\n\t\t_, err = io.Copy(writer, file)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "0db7b37a534873a8efda0273306624d1", "score": "0.49487117", "text": "func copyToFile(f *zip.File, dest string) (fileName string, err error) {\n\trc, err := f.Open()\n\tif err != nil {\n\t\treturn fileName, err\n\t}\n\n\tdefer rc.Close()\n\n\t// Store filename/path for returning and using later on\n\tfileName = filepath.Join(dest, f.Name)\n\n\tif f.FileInfo().IsDir() {\n\t\t// Make Folder\n\t\treturn fileName, os.MkdirAll(fileName, os.ModePerm)\n\t}\n\n\t// Make File\n\tvar fdir string\n\n\tif lastIndex := strings.LastIndex(fileName, string(os.PathSeparator)); lastIndex > -1 {\n\t\tfdir = fileName[:lastIndex]\n\t}\n\n\terr = os.MkdirAll(fdir, os.ModePerm)\n\tif err != nil {\n\t\treturn fileName, err\n\t}\n\n\tfd, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\n\tif err != nil {\n\t\treturn fileName, err\n\t}\n\n\tdefer fd.Close()\n\n\t_, err = io.Copy(fd, rc)\n\tif err != nil {\n\t\treturn fileName, err\n\t}\n\n\treturn fileName, nil\n}", "title": "" }, { "docid": "54f6b8fcb1ace383d5666b948e7d7f3d", "score": "0.49472177", "text": "func ZipFiles(dest io.Writer, skipOnError, unsafeArchFn bool, files ...ArchFileItem) (err error) {\n\tfilesch := make(chan ArchFileItem)\n\tgo func() {\n\t\tfor _, item := range files {\n\t\t\tfilesch <- item\n\t\t}\n\t\tclose(filesch)\n\t}()\n\treturn zipFiles(dest, skipOnError, unsafeArchFn, filesch)\n}", "title": "" }, { "docid": "88d1680b276b900228cd7cd9b8744e34", "score": "0.4927648", "text": "func AddFileException(path string) error {\n\t// Make sure we can open the file indicated in path\n\tfd, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfd.Close()\n\texceptionSources = append(exceptionSources, &exceptionFile{Path: path})\n\treturn nil\n}", "title": "" }, { "docid": "24c86130dc5f633bafc32587430c3e95", "score": "0.49217558", "text": "func (a *Archiver) AddToArchive(relativePath string) error {\n\tabsFilepath := path.Join(a.basePath, relativePath)\n\tif a.writtenFiles[relativePath] != nil {\n\t\treturn nil\n\t}\n\n\t// We skip files that are suddenly not there anymore\n\tstat, err := os.Stat(absFilepath)\n\tif err != nil {\n\t\t// config.Logf(\"[Upstream] Couldn't stat file %s: %s\\n\", absFilepath, err.Error())\n\t\treturn nil\n\t}\n\n\t// Exclude files on the exclude list\n\tif a.ignoreMatcher != nil && util.MatchesPath(a.ignoreMatcher, relativePath, stat.IsDir()) {\n\t\treturn nil\n\t}\n\n\tfileInformation := createFileInformationFromStat(relativePath, stat)\n\tif stat.IsDir() {\n\t\t// Recursively tar folder\n\t\treturn a.tarFolder(fileInformation, stat)\n\t}\n\n\treturn a.tarFile(fileInformation, stat)\n}", "title": "" }, { "docid": "65a2cf9025ce30aaa8beb9eae1899477", "score": "0.49096304", "text": "func (rs *ResourceSet) AddFile(ctx context.Context, filename string) error {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open %q: %w\", filename, err)\n\t}\n\tdefer f.Close()\n\treturn rs.Add(ctx, f)\n}", "title": "" }, { "docid": "5eff5b224e12b4e8db68a7de0f9f87f9", "score": "0.48752397", "text": "func extractFile(in_file *zip.File, out_file string) error {\n\tout, err := os.Create(out_file)\n\tif err != nil {\n\t\tlog_geolocip.Err(fmt.Sprintf(\"Cannot create %s: %v\", out_file, err))\n\t\treturn err\n\t}\n\tdefer out.Close()\n\tin, err := in_file.Open()\n if err != nil {\n\t\tlog_geolocip.Err(fmt.Sprintf(\"Cannot open archive for reading: %v\", err))\n\t\treturn err\n }\t\n defer in.Close()\n io.Copy(out, in)\n\tlog_geolocip.Notice(fmt.Sprintf(\"Extracted %s\", out_file))\n\treturn nil\n}", "title": "" }, { "docid": "e14b3d35740ef37260025538b4db4137", "score": "0.48630026", "text": "func (w *Watcher) AddFile(name string) (err error) {\n\tDEBUG_INFO(\"Adding file '%s' to watcher\", name)\n\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\tname, err = filepath.Abs(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// add file to file lists\n\tstat, err := os.Stat(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !stat.Mode().IsRegular() {\n\t\treturn err\n\t}\n\tw.files[name] = stat\n\n\treturn nil\n}", "title": "" }, { "docid": "2b340178a8b860f8f46b1833781a26f7", "score": "0.48583376", "text": "func (p *TestPackage) AddFile(filename, content string) {\r\n\tp.Files[path.Join(p.Path, filename)] = content\r\n}", "title": "" }, { "docid": "94c4ac5f09732146e106284ff5b8d927", "score": "0.48583284", "text": "func (srv *Server) AddFileToChan(chainID string, files []*common.FileSyncInfo) error {\n\tif chainID == \"\" {\n\t\treturn errors.New(\"Channel ID must be provided\")\n\t}\n\tif len(files) == 0 {\n\t\treturn errors.New(\"files can't be nil or empty\")\n\t}\n\n\tmac := channel.GenerateMAC(srv.gossip.SelfPKIid(), chainID)\n\tchainState, err := srv.gossip.AddFileToChain(mac, files)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn srv.rewriteChainConfigFile(mac, chainState)\n}", "title": "" }, { "docid": "d0648414b9cc371180b5bc238ada73ec", "score": "0.48347116", "text": "func zipFiles(dest io.Writer, skipOnError, unsafeArchFn bool, files <-chan ArchFileItem) (err error) {\n\tif dfh, ok := dest.(syncer); ok {\n\t\tdefer func() {\n\t\t\tif e := dfh.Sync(); e != nil && err == nil && !strings.Contains(e.Error(), \"invalid argument\") {\n\t\t\t\terr = e\n\t\t\t}\n\t\t}()\n\t}\n\tzfh := zip.NewWriter(dest)\n\tdefer func() {\n\t\tif e := zfh.Close(); e != nil && err == nil {\n\t\t\terr = e\n\t\t}\n\t}()\n\tvar (\n\t\tfi os.FileInfo\n\t\tzi *zip.FileHeader\n\t\tw io.Writer\n\t\terrs []error\n\t\topenedHere bool\n\t)\n\tappendErr := func(err error) {\n\t\tif err == nil || err.Error() == \"\" {\n\t\t\treturn\n\t\t}\n\t\tif errs == nil {\n\t\t\terrs = []error{err}\n\t\t} else {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\tfor item := range files {\n\t\topenedHere = false\n\t\tif item.File == nil {\n\t\t\tif item.Filename == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\topenedHere = true\n\t\t\tf, err := os.Open(item.Filename)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"zip cannot open %q: %w\", item.Filename, err)\n\t\t\t\tif !skipOnError {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tappendErr(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\titem.File = f\n\t\t}\n\t\tif fi, err = item.File.Stat(); err != nil {\n\t\t\tif openedHere {\n\t\t\t\t_ = item.File.Close()\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"error stating %s: %w\", item.File, err)\n\t\t} else if fi == nil {\n\t\t\terr = fmt.Errorf(\"nil stat of %#v\", item.File)\n\t\t}\n\t\tif err != nil {\n\t\t\tif !skipOnError {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tappendErr(err)\n\t\t\tcontinue\n\t\t}\n\t\tif zi, err = zip.FileInfoHeader(fi); err != nil {\n\t\t\tif openedHere {\n\t\t\t\t_ = item.File.Close()\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"convert stat %s to header: %w\", item.File, err)\n\t\t\tif !skipOnError {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tappendErr(err)\n\t\t\tcontinue\n\t\t}\n\t\tif item.Archive != \"\" {\n\t\t\tzi.Name = item.Archive\n\t\t} else if unsafeArchFn {\n\t\t\tzi.Name = unsafeFn(zi.Name, true)\n\t\t}\n\t\tif w, err = zfh.CreateHeader(zi); err != nil {\n\t\t\tif openedHere {\n\t\t\t\t_ = item.File.Close()\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"creating header for %q: %w\", zi.Name, err)\n\t\t\tif !skipOnError {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tappendErr(err)\n\t\t\tcontinue\n\t\t}\n\t\t_, err = io.Copy(w, item.File)\n\t\tif openedHere {\n\t\t\t_ = item.File.Close()\n\t\t}\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"writing %s to zipfile: %w\", item.File, err)\n\t\t\tlogger.Info(\"ERROR write to zip\", \"error\", err)\n\t\t\tif !skipOnError {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tappendErr(err)\n\t\t\tcontinue\n\t\t}\n\t}\n\tlogger.Info(\"zipFiles\", \"errors\", errs)\n\tif len(errs) == 0 {\n\t\treturn nil\n\t}\n\tsarr := make([]string, 0, len(errs))\n\tfor _, err = range errs {\n\t\tsarr = append(sarr, err.Error())\n\t}\n\treturn errors.New(strings.Join(sarr, \"\\n\"))\n}", "title": "" }, { "docid": "c10788b85fa6313bf13d91de07d1077f", "score": "0.4831551", "text": "func FileFromZipReader(r io.Reader, path string) (io.ReadCloser, error) {\n\tfile, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileReader := bytes.NewReader(file)\n\n\tzipReader, err := zip.NewReader(fileReader, int64(len(file)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, f := range zipReader.File {\n\t\tif f.Name == path {\n\t\t\treturn f.Open()\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"did not find file %s in zip file\", path)\n}", "title": "" }, { "docid": "cb6a8ddfa22489a81b190832aa52be0f", "score": "0.48254243", "text": "func Zip(path string, dirs []string) (err error) {\n\tif IsZip(path) {\n\t\treturn AppendZip(path, dirs)\n\t}\n\n\tf, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tstartoffset, err := f.Seek(0, os.SEEK_END)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tw := zip.NewWriter(f)\n\tw.SetOffset(startoffset)\n\n\tfor _, dir := range dirs {\n\t\terr = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfh, err := zip.FileInfoHeader(info)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfh.Name = path\n\n\t\t\tp, err := w.CreateHeader(fh)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !info.IsDir() {\n\t\t\t\tcontent, err := ioutil.ReadFile(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t_, err = p.Write(content)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\t}\n\terr = w.Close()\n\treturn\n}", "title": "" }, { "docid": "0281a1165617573cf42c29b50defdf21", "score": "0.4824039", "text": "func Zipit(source, target string) error {\n\tzipfile, err := os.Create(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer zipfile.Close()\n\n\tarchive := zip.NewWriter(zipfile)\n\tdefer archive.Close()\n\n\tinfo, err := os.Stat(source)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar baseDir string\n\tif info.IsDir() {\n\t\tbaseDir = filepath.Base(source)\n\t}\n\n\tif err = filepath.Walk(source, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif baseDir != \"\" {\n\t\t\theader.Name = filepath.Join(baseDir, strings.TrimPrefix(path, source))\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\theader.Name += \"/\"\n\t\t} else {\n\t\t\theader.Method = zip.Deflate\n\t\t}\n\n\t\twriter, err := archive.CreateHeader(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t\t_, err = io.Copy(writer, file)\n\t\treturn err\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "55d1640dafad5e4c3e2b1a6775f40d15", "score": "0.4811923", "text": "func (a *Assets) AddFileToFolder(path, content string) {\n\ta.T.Helper()\n\ta.AddFileToFolderWithPermissions(path, content, 0600)\n}", "title": "" }, { "docid": "5e8785014d02c08a4976e783d0f8cef1", "score": "0.48102483", "text": "func (mem *MemFS) WriteFile(zapped tlsfs.ZapFile) (error) {\n\tvar bu bytes.Buffer\n\tif _, err := zapped.WriteGzippedTo(&bu); err != nil {\n\t\treturn err\n\t}\n\n\tmem.fl.Lock()\n\tmem.files[zapped.Name] = bu.Bytes()\n\tmem.fl.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "db819c2593cf35478250710f43b6a9b3", "score": "0.48074666", "text": "func ReadFileAndZip(fileName string) error {\n if fileName == \"\" {\n log.Fatal(\"File name is required to send file!\")\n }\n \n\tf, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer closeFile(f)\n\n\tbuf := make([]byte, groupFileSize)\n\tfor i := 0; ; i++ {\n\t\tn, err := f.Read(buf)\n\t\tif err != nil && err != io.EOF {\n\t\t\tlog.Fatal(\"Error reading file: \", err)\n\t\t}\n\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\toutputFileName := fmt.Sprintf(\"%s.%d\", fileName, i)\n\t\twriteFile(outputFileName, buf[:n])\n\t\tdefer deleteFile(outputFileName)\n\t\terr = createZipFile(outputFileName, outputFileName+\".zip\")\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating zip\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bc60da959bf4e4f05ebdfb04f2197c0b", "score": "0.4801393", "text": "func (s *SemanticRelease) ZipFiles() error {\n\tassets := assets.New(s.repository, \"\")\n\n\tif err := assets.Add(s.config.Assets...); err != nil {\n\t\treturn err\n\t}\n\tif err := assets.GenerateChecksum(); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, asset := range assets.All() {\n\t\tpath, err := asset.GetPath()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Infof(\"File %s under %s is zipped %t\", asset.GetName(), path, asset.IsCompressed())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a45454c04e4f656765257ec819d1ca1", "score": "0.47856623", "text": "func WriteArchive(name string, files []string) (err error) {\n\tarchfd, err := os.Create(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tarchfd.Close()\n\t\t// Remove the half-written archive on failure.\n\t\tif err != nil {\n\t\t\tos.Remove(name)\n\t\t}\n\t}()\n\tarchive, basename := NewArchive(archfd)\n\tif archive == nil {\n\t\treturn fmt.Errorf(\"unknown archive extension\")\n\t}\n\tfmt.Println(name)\n\tif err := archive.Directory(basename); err != nil {\n\t\treturn err\n\t}\n\tfor _, file := range files {\n\t\tfmt.Println(\" +\", filepath.Base(file))\n\t\tif err := AddFile(archive, file); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn archive.Close()\n}", "title": "" }, { "docid": "99289b5b20c2dee77aafc94df1c4b931", "score": "0.47737056", "text": "func (p *Package) AddFile(file *File) *Package {\n\tfile.InPackage = p\n\tp.files = append(p.files, file)\n\treturn p\n}", "title": "" }, { "docid": "c82a69633725ec3c577dc4616d508265", "score": "0.4763302", "text": "func writeFiles(t *testing.T, f *os.File, tname string, want map[string][]byte) {\n\tw := zip.NewWriter(f)\n\tdefer w.Close()\n\n\t// Write zipped files\n\tfor fname, fbytes := range want {\n\t\tfi := iotest.FileInfo(t, fbytes)\n\n\t\t// Write the file\n\t\terr := w.NextFile(fname, fi)\n\t\tswitch err {\n\t\tcase io.EOF:\n\t\t\tbreak\n\t\tdefault:\n\t\t\tt.Fatalf(\"%s: write header for next file: %v\", tname, err)\n\t\tcase nil: // Proceed below\n\t\t}\n\t\tif _, err := io.Copy(w, bytes.NewReader(fbytes)); err != nil {\n\t\t\tt.Fatalf(\"%s: copy to writer: %v\", tname, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "34ec4b370e151af866203189a6fd001f", "score": "0.47428307", "text": "func (w *Writer) Add(filename string, ct ContentType, r io.Reader,\n\tproperties ...string) error {\n\tfilename = filepath.ToSlash(filename)\n\tfor _, item := range w.manifest {\n\t\tif item.Href == filename {\n\t\t\treturn fmt.Errorf(\"a file with the name %q has already been added\"+\n\t\t\t\t\" to the publication\", filename)\n\t\t}\n\t}\n\tw.counter++\n\tvar id = fmt.Sprintf(\"id%02x\", w.counter)\n\tvar item = &Item{\n\t\tID: id,\n\t\tHref: filename,\n\t\tMediaType: TypeByFilename(filename),\n\t\tProperties: strings.Join(properties, \" \"),\n\t}\n\tw.manifest = append(w.manifest, item)\n\tif ct < Media {\n\t\titemref := &ItemRef{IDRef: id}\n\t\tif ct == Auxiliary {\n\t\t\titemref.Linear = \"no\"\n\t\t}\n\t\tw.spine = append(w.spine, itemref)\n\t}\n\tfileWriter, err := w.zipWriter.Create(path.Join(RootPath, filename))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(fileWriter, r)\n\treturn err\n}", "title": "" }, { "docid": "78e0577ba32e19e3d1ede27842a82fed", "score": "0.47334537", "text": "func AddToTar(tarWriter *tar.Writer, fileName string) error {\n\t// #nosec G304\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err = file.Close(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\tfileStat, err := file.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theader, err := tar.FileInfoHeader(fileStat, fileStat.Name())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theader.Name = fileName\n\n\terr = tarWriter.WriteHeader(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = io.Copy(tarWriter, file)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "784577213ecac7b2527f03497ae76fa3", "score": "0.47296506", "text": "func (file *KeystoneFile) AddFile(filekey FileKey) *KeystoneFile {\n\tif file.Err() != nil {\n\t\treturn file\n\t}\n\n\tfile.RemoveFile(filekey.Path)\n\n\tfile.Files = append(file.Files, filekey)\n\n\treturn file\n}", "title": "" }, { "docid": "137ec391d6c755048b9b108a1af7e154", "score": "0.47218248", "text": "func (w *Writer) NextFile(name string, fi os.FileInfo) error {\n\tif name == \"\" {\n\t\tname = fi.Name()\n\t}\n\thdr, err := zip.FileInfoHeader(fi)\n\tif err != nil {\n\t\treturn err\n\t}\n\thdr.Name = name\n\tw.w, err = w.CreateHeader(hdr)\n\treturn err\n}", "title": "" }, { "docid": "bb216b88c1b590e286888e6e2ee2c4e3", "score": "0.4694875", "text": "func UnZip(srcFile, dstDir string) error {\r\n\tarchive, err := zip.OpenReader(srcFile)\r\n\tif err != nil {\r\n\t\treturn fmt.Errorf(\"error opening archive file: %w\", err)\r\n\t}\r\n\tdefer archive.Close()\r\n\r\n\tfor _, f := range archive.File {\r\n\t\tfilePath := filepath.Join(dstDir, f.Name)\r\n\t\tfmt.Println(\"unzipping file \", filePath)\r\n\r\n\t\tif !strings.HasPrefix(filePath, filepath.Clean(dstDir)+string(os.PathSeparator)) {\r\n\t\t\treturn fmt.Errorf(\"invalid file path\")\r\n\t\t}\r\n\t\tif f.FileInfo().IsDir() {\r\n\t\t\tfmt.Println(\"creating directory...\")\r\n\t\t\tos.MkdirAll(filePath, os.ModePerm)\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tif err := os.MkdirAll(filepath.Dir(filePath), os.ModePerm); err != nil {\r\n\t\t\treturn fmt.Errorf(\"error creating directory: %w\", err)\r\n\t\t}\r\n\r\n\t\tdstFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())\r\n\t\tif err != nil {\r\n\t\t\treturn fmt.Errorf(\"error opening file: %w\", err)\r\n\t\t}\r\n\r\n\t\tfileInArchive, err := f.Open()\r\n\t\tif err != nil {\r\n\t\t\treturn fmt.Errorf(\"error opening archive file: %w\", err)\r\n\t\t}\r\n\r\n\t\tif _, err := io.Copy(dstFile, fileInArchive); err != nil {\r\n\t\t\treturn fmt.Errorf(\"error processing archive file: %w\", err)\r\n\t\t}\r\n\r\n\t\tdstFile.Close()\r\n\t\tfileInArchive.Close()\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "85ea4d3aaf9ec6076ac2653e39cacc4b", "score": "0.46929362", "text": "func (b *Mailbox) writeFile(name string, data string) error {\n\terr := createDir(b.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpath := b.path + \"/\" + name\n\treturn ioutil.WriteFile(path, []byte(data), 0600)\n}", "title": "" }, { "docid": "d43b330cdd6593a8dc65252a6d93e5ea", "score": "0.46832454", "text": "func (b *Builder) AddFile(pkg string, path string, src []byte) error {\n\treturn b.addFile(pkg, path, src, true)\n}", "title": "" }, { "docid": "126ed8f475f4b557d0b99c925a995d2a", "score": "0.4678865", "text": "func (a *Workbook) WriteFile(name string) error {\n\tf, err := os.Create(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tif err := a.Write(f); err != nil {\n\t\treturn err\n\t}\n\treturn f.Sync()\n}", "title": "" }, { "docid": "1c9fcd5b1d0e0462f2d9b7678f2f925b", "score": "0.46575937", "text": "func (m *Map) AddFile(file *spb.VName) {\n\tdirPath := CleanDirPath(path.Dir(file.Path))\n\tdir := m.ensureDir(file.Corpus, file.Root, dirPath)\n\tdir.Entry = addEntry(dir.Entry, &ftpb.DirectoryReply_Entry{\n\t\tKind: ftpb.DirectoryReply_FILE,\n\t\tName: filepath.Base(file.Path),\n\t\tGenerated: file.GetRoot() != \"\",\n\t})\n}", "title": "" }, { "docid": "078ece8e00bde341c9fc38b25dbf72ba", "score": "0.4653917", "text": "func (z *Zip) write() (*sync.WaitGroup, error) {\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() error {\n\t\tdefer wg.Done()\n\t\tfor f := range z.FileCh {\n\t\t\tdefer f.Close()\n\t\t\tinfo, err := f.Stat()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif info.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\theader, err := zip.FileInfoHeader(info)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\theader.Name = f.Name()\n\t\t\tfw, err := z.Writer.CreateHeader(header)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = io.Copy(fw, f)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}()\n\treturn &wg, nil\n}", "title": "" }, { "docid": "58d6360a0c3654f58df157c79317d03d", "score": "0.46504048", "text": "func WriteGzippedFile(by []byte, gzipped string) error {\n\tfn := gzipped + \".temp\"\n\tvar file *os.File\n\tfile, err := os.Create(fn)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"problem creating outfile '%s': %s\", fn, err))\n\t}\n\tdefer file.Close()\n\n\tgz := gzip.NewWriter(file)\n\tdefer gz.Close()\n\n\t_, err = bytes.NewBuffer(by).WriteTo(gz)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tgz.Close()\n\tfile.Close()\n\texec.Command(\"mv\", fn, gzipped).Run()\n\n\treturn err\n}", "title": "" }, { "docid": "63139977c7a5510ecec039dcf1f3af8c", "score": "0.4648244", "text": "func (w *Writer) Add(name string, r io.Reader) error {\n\tif w.zip == nil {\n\t\treturn io.ErrClosedPipe // write stream closed\n\t}\n\t// Ignore unhandled files\n\tswitch path.Ext(name) {\n\tcase \".json\": // From json-files we add only the description directly\n\t\tif name != \"pass.json\" {\n\t\t\treturn nil\n\t\t}\n\tcase \".png\": // picture\n\tcase \".strings\": // localization\n\tdefault: // Everything else is ignored\n\t\treturn nil\n\t}\n\tzipw, err := w.zip.Create(name) // Create a new file in the archive\n\tif err != nil {\n\t\treturn err\n\t}\n\thash := sha1.New() // Initialize hash counting\n\t// At the same time we write to the archive and consider a hash\n\tif _, err := io.Copy(io.MultiWriter(zipw, hash), r); err != nil {\n\t\treturn err\n\t}\n\tw.manifest[name] = hex.EncodeToString(hash.Sum(nil)) // Save received hash\n\tif name == \"pass.json\" {\n\t\tw.hasPass = true // Save the flag that the main description is added\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23e4f9eb780adb2a008a726b2392d0a7", "score": "0.4643225", "text": "func add_file(file []byte, destination_file_path string) error {\n return nil\n}", "title": "" }, { "docid": "2e01706f298da7fd99f90561bef2de8f", "score": "0.46366474", "text": "func makeZip(fpath string, bpath string, which string, verbose bool) string {\r\n\tt := time.Now() //It will return time.Time object with current timestamp\r\n\ttUnixMilli := int64(time.Nanosecond) * t.UnixNano() / int64(time.Millisecond)\r\n\tzipName := fmt.Sprintf(\"GravioDiagnostics_%s_%d.zip\", which, tUnixMilli)\r\n\tfile, err := os.Create(zipName)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer file.Close()\r\n\r\n\tw := zip.NewWriter(file)\r\n\tdefer w.Close()\r\n\r\n\twalker := func(path string, info os.FileInfo, err error) error {\r\n\t\tif verbose {\r\n\t\t\t// fmt.Printf(\"Crawling: %#v\\n\", path)\r\n\t\t}\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\tif info.IsDir() {\r\n\t\t\treturn nil\r\n\t\t}\r\n\t\tfile, err := os.Open(path)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\tdefer file.Close()\r\n\r\n\t\t// Ensure that `path` is not absolute; it should not start with \"/\".\r\n\t\t// This snippet happens to work because I don't use\r\n\t\t// absolute paths, but ensure your real-world code\r\n\t\t// transforms path into a zip-root relative path.\r\n\t\tmpath := strings.Replace(path, os.ExpandEnv(bpath), split(bpath), 1)\r\n\t\tfmt.Println(\"fpath: \" + path)\r\n\t\tfmt.Println(\"bpath: \" + os.ExpandEnv(bpath))\r\n\t\tfmt.Println(\"rpl: \" + mpath)\r\n\t\tf, err := w.Create(mpath)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\t_, err = io.Copy(f, file)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\treturn nil\r\n\t}\r\n\terr = filepath.Walk(fpath, walker)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\treturn zipName\r\n}", "title": "" }, { "docid": "4d6a9e160ffbca883d76e7edb8f37c0f", "score": "0.45949787", "text": "func zipDir(src, dest string) error {\n\tfolderName := filepath.Base(src)\n\n\tfile, err := os.Create(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tw := zip.NewWriter(file)\n\tdefer w.Close()\n\n\twalkFunc := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\n\t\trelPath := filepath.Join(folderName, strings.TrimPrefix(path, src))\n\t\tf, err := w.Create(relPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = io.Copy(f, file)\n\t\treturn err\n\t}\n\n\treturn filepath.Walk(src, walkFunc)\n}", "title": "" }, { "docid": "030c334fc4c51f2864ceb5c94dc12f85", "score": "0.45874804", "text": "func AppendZip(path string, dirs []string) (err error) {\n\tallData := make([]byte, 0, 0)\n\n\t// Open the ZIP file\n\tzipFile, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer zipFile.Close()\n\n\tstats, _ := zipFile.Stat()\n\tzipData := make([]byte, stats.Size(), stats.Size())\n\t_, err = zipFile.Read(zipData)\n\n\t// TODO : create byte slice of all files, serialized as ZIP files\n\tfor _, fname := range dirs {\n\t\tf, err := os.Open(fname)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Unable to open file '%s' (%s), skipping\\n\", fname, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tdefer f.Close()\n\t\ttemp, _ := generateChunk(f)\n\t\tallData = append(allData, temp...)\n\t}\n\n\t// Find end of central directory record, and offset to start of central directory\n\tvar endOfCentralDirectoryPtr = -1\n\tptr := len(zipData) - 4\n\tfor {\n\t\tif bytes.Compare(zipData[ptr:ptr+4], []byte{'P', 'K', 5, 6}) == 0 {\n\t\t\tendOfCentralDirectoryPtr = ptr\n\t\t\t// fmt.Printf(\"[+] Found EOCD Record: 0x%x\\n\", ptr)\n\t\t\tbreak\n\t\t}\n\t\tptr -= 1\n\t}\n\n\tif endOfCentralDirectoryPtr < 0 {\n\t\terr = errors.New(\"Unable to find EOCD record\")\n\t\treturn\n\t}\n\n\tstartOfCentralDirectory := uint32(binary.LittleEndian.Uint32(zipData[endOfCentralDirectoryPtr+16 : endOfCentralDirectoryPtr+20]))\n\n\t// Update start of central directory index\n\tnewStartOfCentralDirectory := startOfCentralDirectory + uint32(len(allData))\n\tbinary.LittleEndian.PutUint32(zipData[endOfCentralDirectoryPtr+16:endOfCentralDirectoryPtr+20], newStartOfCentralDirectory)\n\n\t// Move central directory and insert data\n\tnewZipData := make([]byte, 0, 0)\n\tnewZipData = append(newZipData, zipData[:startOfCentralDirectory]...)\n\tnewZipData = append(newZipData, allData...)\n\tnewZipData = append(newZipData, zipData[startOfCentralDirectory:]...)\n\t// fmt.Println(\"[+] Injected data above the central directory!\")\n\n\t// Write file back out\n\terr = zipFile.Truncate(int64(len(newZipData)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tzipFile.Seek(0, os.SEEK_SET)\n\tzipFile.Write(newZipData)\n\tzipFile.Sync()\n\n\treturn nil\n}", "title": "" }, { "docid": "b7d33e913f1cf4b5279be2817d4f6030", "score": "0.45833158", "text": "func unzipFile(zf *zip.File, dest string, dirMap map[string]string) error {\n\tvar err error\n\t//if fpath already exist, change the fpath to dir(n)/file\n\tfor {\n\t\tfpath := generatePath(dirMap, dest, zf.Name)\n\n\t\tif zf.FileInfo().IsDir() {\n\t\t\terr = os.MkdirAll(fpath, os.ModePerm)\n\t\t} else {\n\t\t\trc, err := zf.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer rc.Close()\n\n\t\t\terr = writeNewFile(fpath, rc, zf.FileInfo().Mode())\n\t\t}\n\n\t\tif !os.IsExist(err) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "6652771d531a7b1cbda84741fbee74d8", "score": "0.45770013", "text": "func (f *FIM) AddFile(name string) error {\n\tfstat := &syscall.Stat_t{}\n\tif err := syscall.Stat(name, fstat); err != nil {\n\t\tf.Error().Err(err).Msgf(\"Error stating file: %v\", name)\n\t\treturn err\n\t}\n\n\tf.Debug().Str(\"file\", name).Msgf(\"created/updated Key : %v\", fstat.Ino)\n\tpkey, pvalue := unsafe.Pointer(&fstat.Ino), unsafe.Pointer(&fstat.Dev)\n\tf.Debug().Str(\"file\", name).Msg(\"pushing to ebpf\")\n\tif err := f.Module.UpdateElement(f.RulesTable, pkey, pvalue, bpfAny); err != nil {\n\t\treturn err\n\t}\n\tf.mapping.Store(fstat.Ino, name)\n\tf.reverse.Store(name, fstat.Ino)\n\treturn nil\n}", "title": "" }, { "docid": "e1bc3d8628980a80aae5a428ceaf5542", "score": "0.45739132", "text": "func copyFileToWriter(w io.Writer, srcPath string) error {\n\tf, err := os.Open(srcPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading source file %q: %v\", srcPath, err)\n\t}\n\tdefer f.Close()\n\n\tif _, err := io.Copy(w, f); err != nil {\n\t\treturn fmt.Errorf(\"error writing to tar file for %q: %v\", srcPath, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4e96b2da555660d0e71f3a12edd471be", "score": "0.4558019", "text": "func (b *MessageCreateBuilder) AddFile(name string, reader io.Reader, flags ...restclient.FileFlags) *MessageCreateBuilder {\n\tb.Files = append(b.Files, restclient.File{\n\t\tName: name,\n\t\tReader: reader,\n\t\tFlags: restclient.FileFlagNone.Add(flags...),\n\t})\n\treturn b\n}", "title": "" }, { "docid": "100b5e863180d99bf49fed470563f1ed", "score": "0.4557539", "text": "func (v *Version) addFile(level int, file *FileMeta) {\n\tv.levels[level].addFile(file)\n}", "title": "" }, { "docid": "9598e79b62c2099af42fb55a09b6a4b3", "score": "0.45454776", "text": "func (r *ProjectsLocationsRepositoriesWorkspacesService) WriteFile(workspace string, writefilerequest *WriteFileRequest) *ProjectsLocationsRepositoriesWorkspacesWriteFileCall {\n\tc := &ProjectsLocationsRepositoriesWorkspacesWriteFileCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.workspace = workspace\n\tc.writefilerequest = writefilerequest\n\treturn c\n}", "title": "" }, { "docid": "7dbbb1443cce131167c44de8a282da2e", "score": "0.4520378", "text": "func (r *Root) AddFile(path string, _ string) error {\n\treturn r.insert(path, false, \"\")\n}", "title": "" }, { "docid": "a771f6137034e8342e4a948fbb293eea", "score": "0.45157576", "text": "func (r *Reader) ExtractTo(dest string) error {\n\n\tfor _, file := range r.zip_reader.File {\n\n\t\tfilePath := path.Join(dest, file.Name)\n\n\t\tif file.FileInfo().IsDir() {\n\t\t\tos.MkdirAll(filePath, file.FileInfo().Mode().Perm())\n\n\t\t\tcontinue\n\t\t}\n\n\t\tdata, err := file.Open()\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = os.MkdirAll(filepath.Dir(filePath), os.ModePerm)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toutFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, file.Mode())\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tio.Copy(outFile, data)\n\n\t\toutFile.Close()\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "689303c89d1aea8e7631e38cd2b16494", "score": "0.45070708", "text": "func NewSrZipFile(name string) (*SrZip, error) {\n\tw, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewSrZip(zip.NewWriter(w)), nil\n}", "title": "" }, { "docid": "c4ffaeff8ad68ba780faf4d390a2f952", "score": "0.44786423", "text": "func (req *UploadFileRequest) AddFile(filename string, r io.Reader) error {\n\tw, err := req.writer().CreateFormFile(\"file\", filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = io.Copy(w, r)\n\treturn err\n\n}", "title": "" }, { "docid": "28ca21fbf70eaa0f095e3a5fde0f538f", "score": "0.44681957", "text": "func (o *BillingInfoResponse) SetZip(v string) {\n\to.Zip = v\n}", "title": "" }, { "docid": "0776fe010a3f94bfd6adc4bc7888d370", "score": "0.44600213", "text": "func addFile(w *multipart.Writer, fieldName, path string) error {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tpart, err := w.CreateFormFile(fieldName, filepath.Base(path))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(part, file)\n\n\treturn err\n}", "title": "" }, { "docid": "1765ff8e901905e029aaf05cb9732df8", "score": "0.44585222", "text": "func (zipFormat) Make(zipPath string, filePaths []string) error {\n\tout, err := os.Create(zipPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %v\", zipPath, err)\n\t}\n\tdefer out.Close()\n\n\treturn Zip.Write(out, filePaths)\n}", "title": "" }, { "docid": "eea433ccfa9e776ab057f528bf5d9adc", "score": "0.4451684", "text": "func (p *CalculatorClient) Zip(ctx context.Context) (_err error) {\n var _args9 CalculatorZipArgs\n p.SetLastResponseMeta_(thrift.ResponseMeta{})\n if _, err := p.Client_().Call(ctx, \"zip\", &_args9, nil); err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "29dd0a6680a2b463fb0aa50e67b423ea", "score": "0.44507843", "text": "func (rels *Relationships) AddFile(t ml.RelationType, target string) (int, ml.RID) {\n\tif target[0] != '/' {\n\t\ttarget = \"/\" + target\n\t}\n\n\treturn rels.add(t, target, ml.TargetModeInternal)\n}", "title": "" }, { "docid": "79491d1638b4692d0d595ea60ab1a90f", "score": "0.4449074", "text": "func ZipDir(source, target string) error {\n\n\tzipfile, err := os.Create(target)\n\tif err != nil {\n\t\tlogrus.Println(err)\n\t\treturn err\n\t}\n\tdefer zipfile.Close()\n\n\tarchive := zip.NewWriter(zipfile)\n\tdefer archive.Close()\n\n\tinfo, err := os.Stat(source)\n\tif err != nil {\n\t\tlogrus.Println(err)\n\t\treturn nil\n\t}\n\tvar baseDir string\n\tif info.IsDir() {\n\t\tbaseDir = filepath.Base(source)\n\t}\n\tfilepath.Walk(source, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlogrus.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\theader, err := zip.FileInfoHeader(info)\n\t\tif err != nil {\n\t\t\tlogrus.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif baseDir != \"\" {\n\t\t\t//不需要解压后加上目录基目录名称;\n\t\t\t//header.Name = filepath.Join(baseDir, strings.TrimPrefix(path, source))\n\t\t\theader.Name = filepath.Join(\"\", strings.TrimPrefix(path, source))\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\theader.Name += \"/\"\n\t\t} else {\n\t\t\theader.Method = zip.Deflate\n\t\t}\n\t\t//info.ModTime() //may be 更加准确 而不是当前的时间!?\n\t\theader.Modified = time.Now() //默认时间是不对的; 需要这样处理\n\t\twriter, err := archive.CreateHeader(header)\n\t\tif err != nil {\n\t\t\tlogrus.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\tlogrus.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\tlogrus.Println(err)\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t\t_, err = io.Copy(writer, file)\n\t\treturn err\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "3e20a0ae3593a1fafb999f0b866b6abb", "score": "0.44398785", "text": "func (_FileStorage *FileStorageTransactor) AddFile(opts *bind.TransactOpts, hash string, name string) (*types.Transaction, error) {\n\treturn _FileStorage.contract.Transact(opts, \"addFile\", hash, name)\n}", "title": "" }, { "docid": "38e784fa5cfa048be49e20770cb692f4", "score": "0.44284603", "text": "func Add(path string) error {\n\tsrcArchive, err := srcArchive()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tarchiveFilePath := filepath.Join(srcArchive, AppendablePath(path))\n\terr = os.MkdirAll(filepath.Dir(archiveFilePath), 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\tarchiveFile, err := os.Create(archiveFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer archiveFile.Close()\n\n\t_, err = io.Copy(archiveFile, file)\n\treturn err\n}", "title": "" }, { "docid": "47b991d08b68eb19a79e2e981cd4d6eb", "score": "0.44186056", "text": "func addFile(pool *x509.CertPool, path string) error {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tvar buf bytes.Buffer\n\tif _, err := buf.ReadFrom(f); err != nil {\n\t\treturn err\n\t}\n\tif ok := pool.AppendCertsFromPEM(buf.Bytes()); !ok {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ed885ea73558a1a7fad5a859ea766bc", "score": "0.44177634", "text": "func (app *Application) AddFile(file *File) int {\n\tapp.setComputedFileFields(file)\n\tfile.Owner = app\n\tfile.Mime = getMimeType(file.Path)\n file.Binary = isBinaryMime(file.Name, file.Mime)\n\tapp.Files = append(app.Files, file)\n\treturn len(app.Files)\n}", "title": "" }, { "docid": "ee01fc4fe7462643735ad36def9915d2", "score": "0.44114977", "text": "func newZipWriter(w io.Writer) *zipWriter {\n\treturn &zipWriter{w: w}\n}", "title": "" }, { "docid": "caeeb3a39bec130b835ab87ad2e7ae0b", "score": "0.4382196", "text": "func (fm *FileManager) AddFile(filename string, data []byte) error {\n\tfm.fileMu.Lock()\n\tdefer fm.fileMu.Unlock()\n\t_, ok := fm.filenameToData[filename]\n\tif ok {\n\t\treturn &errs.SrvError{defs.ErrFileExists,\n\t\t\tfmt.Sprintf(\"Filename \\\"%s\\\" already exists\", filename)}\n\t}\n\tfm.filenameToData[filename] = data\n\treturn nil\n}", "title": "" }, { "docid": "e2602d87d94521c4ff2428acfedb956e", "score": "0.43758065", "text": "func (zipFormat) Write(output io.Writer, filePaths []string) error {\n\tw := zip.NewWriter(output)\n\tfor _, fpath := range filePaths {\n\t\tif err := zipFile(w, fpath); err != nil {\n\t\t\tw.Close()\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn w.Close()\n}", "title": "" }, { "docid": "14654aedba7e76eb6d207bad5bc987a3", "score": "0.43672952", "text": "func WriteFile(file *os.File, absoluteBasePath string, filesToPack []string, useStrict bool) {\n\t// Write all lines to file\n\twriter := bufio.NewWriter(file)\n\n\tfor _, relativePath := range filesToPack {\n\t\tif ShouldDiscardFile(relativePath, useStrict) {\n\t\t\tcontinue\n\t\t}\n\t\tWriteEntry(writer, strings.Replace(relativePath, \"/\", \"\\\\\", -1))\n\t\tWriteEntry(writer, strings.Replace(absoluteBasePath+relativePath, \"/\", \"\\\\\", -1))\n\t}\n\n\twriter.Flush()\n}", "title": "" } ]
a44f1696d4784837f01f1918cacec0a1
GetDialogNode : Get dialog node Get information about a dialog node.
[ { "docid": "4e2606389074f099e4a6c965c755a60d", "score": "0.74698746", "text": "func (assistant *AssistantV1) GetDialogNode(getDialogNodeOptions *GetDialogNodeOptions) (result *DialogNode, response *core.DetailedResponse, err error) {\n\treturn assistant.GetDialogNodeWithContext(context.Background(), getDialogNodeOptions)\n}", "title": "" } ]
[ { "docid": "ba315884cdc19782e77c25c36bebb045", "score": "0.67533314", "text": "func (*AssistantV1) NewGetDialogNodeOptions(workspaceID string, dialogNode string) *GetDialogNodeOptions {\n\treturn &GetDialogNodeOptions{\n\t\tWorkspaceID: core.StringPtr(workspaceID),\n\t\tDialogNode: core.StringPtr(dialogNode),\n\t}\n}", "title": "" }, { "docid": "bb10f263a0dc912691708cb3bd813d04", "score": "0.61745286", "text": "func (assistant *AssistantV1) GetDialogNodeWithContext(ctx context.Context, getDialogNodeOptions *GetDialogNodeOptions) (result *DialogNode, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getDialogNodeOptions, \"getDialogNodeOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getDialogNodeOptions, \"getDialogNodeOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"workspace_id\": *getDialogNodeOptions.WorkspaceID,\n\t\t\"dialog_node\": *getDialogNodeOptions.DialogNode,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = assistant.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(assistant.Service.Options.URL, `/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getDialogNodeOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"conversation\", \"V1\", \"GetDialogNode\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tbuilder.AddQuery(\"version\", fmt.Sprint(*assistant.Version))\n\tif getDialogNodeOptions.IncludeAudit != nil {\n\t\tbuilder.AddQuery(\"include_audit\", fmt.Sprint(*getDialogNodeOptions.IncludeAudit))\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 = assistant.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalDialogNode)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a64889965bed6213faf7f052219a5446", "score": "0.6159472", "text": "func (_options *GetDialogNodeOptions) SetDialogNode(dialogNode string) *GetDialogNodeOptions {\n\t_options.DialogNode = core.StringPtr(dialogNode)\n\treturn _options\n}", "title": "" }, { "docid": "6db57f13aead7f53fb33961eb56ce21f", "score": "0.61285704", "text": "func UnmarshalDialogNode(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(DialogNode)\n\terr = core.UnmarshalPrimitive(m, \"dialog_node\", &obj.DialogNode)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"conditions\", &obj.Conditions)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"parent\", &obj.Parent)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"previous_sibling\", &obj.PreviousSibling)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"output\", &obj.Output, UnmarshalDialogNodeOutput)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"context\", &obj.Context, UnmarshalDialogNodeContext)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"metadata\", &obj.Metadata)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"next_step\", &obj.NextStep, UnmarshalDialogNodeNextStep)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"title\", &obj.Title)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"event_name\", &obj.EventName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"variable\", &obj.Variable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"actions\", &obj.Actions, UnmarshalDialogNodeAction)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"digress_in\", &obj.DigressIn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"digress_out\", &obj.DigressOut)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"digress_out_slots\", &obj.DigressOutSlots)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"user_label\", &obj.UserLabel)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"disambiguation_opt_out\", &obj.DisambiguationOptOut)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"disabled\", &obj.Disabled)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created\", &obj.Created)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated\", &obj.Updated)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "a96ea76e59ca1cfe20839ae8f5e9f5b3", "score": "0.57978463", "text": "func (cliCtx CLIContext) GetNode() (rpcclient.Client, error) {\n\tif cliCtx.Client == nil {\n\t\treturn nil, errors.New(\"no RPC client defined\")\n\t}\n\n\treturn cliCtx.Client, nil\n}", "title": "" }, { "docid": "5b6368761ab86f322c310b1e7b880c3a", "score": "0.5595249", "text": "func (api *API) GetNode(c *common.Context) (interface{}, error) {\n\tns, n := c.GetNamespace(), c.GetNameFromParam()\n\tnode, err := api.Node.Get(ns, n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tview, err := node.View(OfflineDuration)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn view, nil\n}", "title": "" }, { "docid": "4906104bf1a4e7e7a3bcd87401dc083a", "score": "0.55475587", "text": "func (client *Client) GetNodeTransferPacket(request *GetNodeTransferPacketRequest) (response *GetNodeTransferPacketResponse, err error) {\n\tresponse = CreateGetNodeTransferPacketResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "c179a5cc3c2cf13d429e93e3474d619e", "score": "0.5521428", "text": "func (t Transport) GetNode() (rpcclient.Client, error) {\n\tif t.client == nil {\n\t\treturn nil, errors.InvalidNodeURL(\"Must define node URL\")\n\t}\n\treturn t.client, nil\n}", "title": "" }, { "docid": "1e11759ada29669250f0dcc914a41575", "score": "0.5462533", "text": "func (_NodesV2 *NodesV2Caller) GetNode(opts *bind.CallOpts, index *big.Int) ([]byte, uint32, uint16, uint32, uint32, error) {\n\tvar (\n\t\tret0 = new([]byte)\n\t\tret1 = new(uint32)\n\t\tret2 = new(uint16)\n\t\tret3 = new(uint32)\n\t\tret4 = new(uint32)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t}\n\terr := _NodesV2.contract.Call(opts, out, \"getNode\", index)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, err\n}", "title": "" }, { "docid": "c169742d7af1c2c26b8d48918a2bc5f9", "score": "0.54611677", "text": "func (_options *DeleteDialogNodeOptions) SetDialogNode(dialogNode string) *DeleteDialogNodeOptions {\n\t_options.DialogNode = core.StringPtr(dialogNode)\n\treturn _options\n}", "title": "" }, { "docid": "582906b677f3c7948fe0f4f9d4d199c0", "score": "0.54509264", "text": "func (_options *CreateDialogNodeOptions) SetDialogNode(dialogNode string) *CreateDialogNodeOptions {\n\t_options.DialogNode = core.StringPtr(dialogNode)\n\treturn _options\n}", "title": "" }, { "docid": "5fb33eac2742ac27f92ee78247cd9915", "score": "0.5447122", "text": "func (*AssistantV1) NewDialogNode(dialogNode string) (_model *DialogNode, err error) {\n\t_model = &DialogNode{\n\t\tDialogNode: core.StringPtr(dialogNode),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "8c43e4fa9f8fe475f2433c91e06607d0", "score": "0.54264283", "text": "func (a *Client) NdmpNodeGet(params *NdmpNodeGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NdmpNodeGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewNdmpNodeGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"ndmp_node_get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/protocols/ndmp/nodes/{node.uuid}\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &NdmpNodeGetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*NdmpNodeGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*NdmpNodeGetDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "cc59d32634504df24d1bdeb735b5a4c2", "score": "0.5359069", "text": "func (c *HBComp) GetNode() *models.Node {\n\treturn c.mObj\n}", "title": "" }, { "docid": "a02cf3609ff66b9746c2c1bdc96d77db", "score": "0.5354953", "text": "func (ds *DistSender) getNodeDescriptor() *roachpb.NodeDescriptor {\n\tif desc := atomic.LoadPointer(&ds.nodeDescriptor); desc != nil {\n\t\treturn (*roachpb.NodeDescriptor)(desc)\n\t}\n\tif ds.gossip == nil {\n\t\treturn nil\n\t}\n\n\townNodeID := ds.gossip.GetNodeID()\n\tif ownNodeID > 0 {\n\t\t// TODO(tschottdorf): Consider instead adding the NodeID of the\n\t\t// coordinator to the header, so we can get this from incoming\n\t\t// requests. Just in case we want to mostly eliminate gossip here.\n\t\tnodeDesc := &roachpb.NodeDescriptor{}\n\t\tif err := ds.gossip.GetInfoProto(gossip.MakeNodeIDKey(ownNodeID), nodeDesc); err == nil {\n\t\t\tatomic.StorePointer(&ds.nodeDescriptor, unsafe.Pointer(nodeDesc))\n\t\t\treturn nodeDesc\n\t\t}\n\t}\n\tlog.Infof(context.TODO(), \"unable to determine this node's attributes for replica \"+\n\t\t\"selection; node is most likely bootstrapping\")\n\treturn nil\n}", "title": "" }, { "docid": "9b5c0cc5d532849c6fb270771b81329e", "score": "0.53339523", "text": "func (c *ModelAdaptor) getNode(nk model.NodeKey) (*model.KVPair, error) {\n\tvar err error\n\n\t// Fill in the Metadata specific part of the node configuration. At the\n\t// moment, there is nothing to fill in.\n\tif _, err = c.client.Get(model.HostMetadataKey{nk.Hostname}); err != nil {\n\t\treturn nil, err\n\t}\n\tnv := model.Node{}\n\n\terr = c.getNodeSubcomponents(nk, &nv)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &model.KVPair{Key: nk, Value: &nv}, nil\n}", "title": "" }, { "docid": "6c267208f4ccef6da0cfbe04d4dafd83", "score": "0.5306282", "text": "func (_options *UpdateDialogNodeOptions) SetDialogNode(dialogNode string) *UpdateDialogNodeOptions {\n\t_options.DialogNode = core.StringPtr(dialogNode)\n\treturn _options\n}", "title": "" }, { "docid": "f0120897c74eefb84bcf535e69e51e32", "score": "0.52797097", "text": "func (h *NodeHandler) GetNode(c echo.Context) error {\n\tctx := c.Request().Context()\n\n\tname := c.Param(\"name\")\n\n\tn, err := h.service.Get(ctx, name)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn echo.NewHTTPError(http.StatusNotFound)\n\t\t}\n\t\tklog.Errorf(\"failed to get node: %+v\", err)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError)\n\t}\n\n\treturn c.JSON(http.StatusOK, n)\n}", "title": "" }, { "docid": "2c81a0996ea14b8f7199d88c84a57532", "score": "0.5256255", "text": "func GetNode(cf cfg.Cfg) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// validate request\n\t\tnodeID := bone.GetValue(r, \"id\")\n\t\tif nodeID == \"\" {\n\t\t\treqres.RespondJSON(w, reqres.NewAPIError(\"node ID cannot be empty\", http.StatusInternalServerError))\n\t\t\treturn\n\t\t}\n\n\t\t// make request and get channels\n\t\tch := tool.Nodes(cf.Node)\n\t\tvar nodes []p2p.DefaultNodeInfo\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase nr, open := <-ch:\n\t\t\t\t// check error first\n\t\t\t\tif nr.Err != nil {\n\t\t\t\t\treqres.RespondJSON(w, reqres.NewAPIError(fmt.Sprintf(\"error fetching node info: %v\", nr.Err), http.StatusInternalServerError))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// add nodes to response\n\t\t\t\tnodes = append(nodes, nr.Nodes...)\n\t\t\t\tif !open { // send response when channel closed\n\t\t\t\t\tfor i := range nodes {\n\t\t\t\t\t\tif string(nodes[i].ID()) == nodeID {\n\t\t\t\t\t\t\treqres.RespondJSON(w, reqres.OKResponse(nodes[i]))\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\t// if not found\n\t\t\t\t\treqres.RespondJSON(w, reqres.NewAPIError(fmt.Sprintf(\"could not find node: %v\", nodeID), http.StatusNotFound))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase <-time.After(defaultTendermintTimeout):\n\t\t\t\tlogrus.Warn(\"Timeout fetching cf.Node info.\")\n\t\t\t\treqres.RespondJSON(w, reqres.NewAPIError(\"timed out fetching node info\", http.StatusInternalServerError))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44a95f911a9533bd8b110eeacfb66292", "score": "0.52515054", "text": "func getNode(nd *wssdcloud.Node) *cloud.Node {\n\treturn &cloud.Node{\n\t\tName: &nd.Name,\n\t\tLocation: &nd.LocationName,\n\t\tNodeProperties: &cloud.NodeProperties{\n\t\t\tFQDN: &nd.Fqdn,\n\t\t\tPort: &nd.Port,\n\t\t\tAuthorizerPort: &nd.AuthorizerPort,\n\t\t\tCertificate: &nd.Certificate,\n\t\t\tStatuses: getNodeStatuses(nd),\n\t\t},\n\t\tVersion: &nd.Status.Version.Number,\n\t\tTags: generateNodeTags(nd),\n\t}\n}", "title": "" }, { "docid": "0407a3d6a7bc67e2e2c20767485cbe6c", "score": "0.52429104", "text": "func (i *IDOTA2DPC) GetLeagueNodeData() (*geyser.Request, error) {\n\tsm, err := i.Interface.Methods.Get(schema.MethodKey{\n\t\tName: \"GetLeagueNodeData\",\n\t\tVersion: 1,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := geyser.NewRequest(i.Interface, sm)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "bda81533383261728c51c6e9f9d505da", "score": "0.5198333", "text": "func (*AssistantV1) NewDialogNodeAction(name string, resultVariable string) (_model *DialogNodeAction, err error) {\n\t_model = &DialogNodeAction{\n\t\tName: core.StringPtr(name),\n\t\tResultVariable: core.StringPtr(resultVariable),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "fb43ffab184af6be637212009c205cba", "score": "0.5187051", "text": "func (c *Client) GetNode(nodename string) (*types.Node, error) {\n\tclient := pb.NewCoreRPCClient(c.conn)\n\tresp, err := client.GetNodeByName(context.Background(), &pb.GetNodeOptions{Nodename: nodename})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnode := &types.Node{\n\t\tName: resp.Name,\n\t\tPodname: resp.Podname,\n\t\tEndpoint: resp.Endpoint,\n\t\tAvailable: resp.Available,\n\t}\n\treturn node, nil\n}", "title": "" }, { "docid": "dc74049c743320a0908ea244aecdec33", "score": "0.5170027", "text": "func getNodeObject(cli *k8sclient.Clientset) (*core_v1.Node, error) {\n\tnode, err := cli.CoreV1().Nodes().Get(context.TODO(), nodeName, meta_v1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, agentError(\"failed to get node object for node %q: %v\", nodeName, err)\n\t}\n\treturn node, nil\n}", "title": "" }, { "docid": "4b0bd44549e3067a937bc793b650c790", "score": "0.5163136", "text": "func (_NodesV2 *NodesV2CallerSession) GetNode(index *big.Int) ([]byte, uint32, uint16, uint32, uint32, error) {\n\treturn _NodesV2.Contract.GetNode(&_NodesV2.CallOpts, index)\n}", "title": "" }, { "docid": "ab407431f46c202ccf7182778581d2ab", "score": "0.5123931", "text": "func GetNode(row, col int) Node {\n\treturn Node{row: row, col: col}\n}", "title": "" }, { "docid": "388887e8d19d6daaef2fff2d75067fd5", "score": "0.5116086", "text": "func (h K8sHelpers) GetNode(cli *k8sclient.Clientset, NodeName string) (*api.Node, error) {\n\t//fmt.Println(\"Got node name as \", NodeName)\n\t// Get the node object using the node name\n\tnode, err := cli.Core().Nodes().Get(NodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\tfmt.Println(\"can't get node: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "fd8a961276b640a0f3457a001c915879", "score": "0.50888085", "text": "func getNode(gp *wssdcloud.Node) *cloud.Node {\n\treturn &cloud.Node{\n\t\tName: &gp.Name,\n\t\tLocation: &gp.LocationName,\n\t\tNodeProperties: &cloud.NodeProperties{\n\t\t\tFQDN: &gp.Fqdn,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "0ce43811ce9a5ade605dcda42734681b", "score": "0.50514627", "text": "func (_NodesV2 *NodesV2Session) GetNode(index *big.Int) ([]byte, uint32, uint16, uint32, uint32, error) {\n\treturn _NodesV2.Contract.GetNode(&_NodesV2.CallOpts, index)\n}", "title": "" }, { "docid": "8e73d31bd130c72ffa03f9470bb4f89f", "score": "0.50332385", "text": "func (o *RemoteTransform2D) GetRemoteNode() gdnative.NodePath {\n\t//log.Println(\"Calling RemoteTransform2D.GetRemoteNode()\")\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(\"RemoteTransform2D\", \"get_remote_node\")\n\n\t// Call the parent method.\n\t// NodePath\n\tretPtr := gdnative.NewEmptyNodePath()\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.NewNodePathFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "5f0debc58082b092ca9d0b43ee9e71ba", "score": "0.50238216", "text": "func GetNode(env interface{}) (*core.IpfsNode, error) {\n\tctx, ok := env.(*commands.Context)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"expected env to be of type %T, got %T\", ctx, env)\n\t}\n\n\treturn ctx.GetNode()\n}", "title": "" }, { "docid": "10d48eafb6aafd50ab35afd663ecd244", "score": "0.50210744", "text": "func (h K8sHelpers) GetNode(cli *k8sclient.Clientset, NodeName string) (*api.Node, error) {\n\t// Get the node object using the node name\n\tnode, err := cli.Core().Nodes().Get(NodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\tglog.Errorf(\"Can't get node: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "acec0a59abd78f17f62cbe8115efdda3", "score": "0.50207466", "text": "func NewNdmpNodeGetOK() *NdmpNodeGetOK {\n\treturn &NdmpNodeGetOK{}\n}", "title": "" }, { "docid": "56a34d3af100c0a729dd22aa68ae56cf", "score": "0.5015682", "text": "func NewCmdGetNode() *cobra.Command {\n\treturn NewCmd(\"node\").\n\t\tWithDescription(\"Get node list\").\n\t\tSetAliases([]string{\"nodes\"}).\n\t\tRunWithNoArgs(execGetNode)\n}", "title": "" }, { "docid": "dc6f20fe9966b85daebd0ff987429322", "score": "0.4999145", "text": "func (assistant *AssistantV1) DeleteDialogNode(deleteDialogNodeOptions *DeleteDialogNodeOptions) (response *core.DetailedResponse, err error) {\n\treturn assistant.DeleteDialogNodeWithContext(context.Background(), deleteDialogNodeOptions)\n}", "title": "" }, { "docid": "f518f1917142e3abadf6e15974674b76", "score": "0.49856248", "text": "func (c *Controller) GetNode(task concurrency.Task, hostID string) (host *pb.Host, err error) {\n\tif c == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif hostID == \"\" {\n\t\treturn nil, fail.InvalidParameterError(\"hostID\", \"cannot be empty string\")\n\t}\n\tif task == nil {\n\t\treturn nil, fail.InvalidParameterError(\"task\", \"cannot be nil\")\n\t}\n\n\ttracer := debug.NewTracer(task, fmt.Sprintf(\"(%s)\", hostID), true)\n\tdefer tracer.GoingIn().OnExitTrace()()\n\tdefer fail.OnExitLogError(tracer.TraceMessage(\"\"), &err)()\n\n\tc.RLock(task)\n\tdefer c.RUnlock(task)\n\n\tfound := false\n\terr = c.Properties.LockForRead(property.NodesV1).ThenUse(\n\t\tfunc(clonable data.Clonable) error {\n\t\t\tnodesV1 := clonable.(*clusterpropsv1.Nodes)\n\t\t\t// found, _ := findNodeByID(nodesV1.PublicNodes, hostID)\n\t\t\t// if !found {\n\t\t\tfound, _ = findNodeByID(nodesV1.PrivateNodes, hostID)\n\t\t\t// }\n\t\t\treturn nil\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"failed to find node '%s' in Cluster '%s'\", hostID, c.Name)\n\t}\n\treturn client.New().Host.Inspect(hostID, temporal.GetExecutionTimeout())\n}", "title": "" }, { "docid": "22d541995337545656bd86e0feb57141", "score": "0.4965532", "text": "func (_NodeManager *NodeManagerCaller) GetNodeDetails(opts *bind.CallOpts, enodeId string) (struct {\n\tOrgId string\n\tEnodeId string\n\tIp string\n\tPort uint16\n\tRaftport uint16\n\tNodeStatus *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _NodeManager.contract.Call(opts, &out, \"getNodeDetails\", enodeId)\n\n\toutstruct := new(struct {\n\t\tOrgId string\n\t\tEnodeId string\n\t\tIp string\n\t\tPort uint16\n\t\tRaftport uint16\n\t\tNodeStatus *big.Int\n\t})\n\n\toutstruct.OrgId = out[0].(string)\n\toutstruct.EnodeId = out[1].(string)\n\toutstruct.Ip = out[2].(string)\n\toutstruct.Port = out[3].(uint16)\n\toutstruct.Raftport = out[4].(uint16)\n\toutstruct.NodeStatus = out[5].(*big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "c2c591ece56c6a1cb3f2546f9260aab5", "score": "0.4961001", "text": "func get_node(id int32, tree *Btree) *Node {\n\tif node, ok := tree.nodes[id].(*Node); ok {\n\t\treturn node\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b0adfad9093e90801aec88bc42f6040", "score": "0.49543735", "text": "func (client *ZooKeeperClient) GetNode(node string, ignoreNotExists bool) ([]byte, error) {\n\tdata, _, err := client.conn.Get(node)\n\tif err == nil || (err == zk.ErrNoNode && ignoreNotExists) {\n\t\treturn data, nil\n\t}\n\tglog.Errorf(\"Failed to get node=%s, error=%s\", node, err)\n\treturn nil, err\n}", "title": "" }, { "docid": "c9929904d861104950376b9a9628ca0b", "score": "0.49412113", "text": "func (c *ShareableCluster) GetNode(n int) *Command {\n\t// Put all the node IDs into a list to be sorted.\n\tids := make([]nodePlace, len(c.Nodes))\n\tfor i := range c.Nodes {\n\t\tids[i].id = c.Nodes[i].ID()\n\t\tids[i].idx = i\n\t}\n\n\t// Sort the list.\n\tsort.SliceStable(ids, func(i, j int) bool {\n\t\treturn ids[i].id < ids[j].id\n\t})\n\n\t// Return the node which is at the given position in the sorted list.\n\treturn c.Nodes[ids[n].idx]\n}", "title": "" }, { "docid": "a77bced33b3691fdc43960fb142c302f", "score": "0.4935965", "text": "func (cs *supply) GetNode() Node {\n\treturn cs.node\n}", "title": "" }, { "docid": "24be738d68b2a1f24dac58689196f681", "score": "0.49345222", "text": "func (dag *DAG) GetNode(ctx context.Context, ref string) (interface{}, error) {\n\tparsedRef, err := path.ParsePath(ref)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresolver := resolver.NewBasicResolver(dag.dserv)\n\n\tobjc, rem, err := resolver.ResolveToLastNode(ctx, parsedRef)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobj, err := dag.dserv.Get(ctx, objc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar out interface{} = obj\n\tif len(rem) > 0 {\n\t\tfinal, _, err := obj.Resolve(rem)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = final\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "df1117410770c2008c61d7266384beb6", "score": "0.4921358", "text": "func (cm *ClusterManager) GetNodeTemplate(ctx context.Context,\n\treq *cmproto.GetNodeTemplateRequest, resp *cmproto.GetNodeTemplateResponse) error {\n\treqID, err := requestIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := time.Now()\n\tga := nodetemplate.NewGetAction(cm.model)\n\tga.Handle(ctx, req, resp)\n\tmetrics.ReportAPIRequestMetric(\"GetNodeTemplate\", \"grpc\", strconv.Itoa(int(resp.Code)), start)\n\tblog.Infof(\"reqID: %s, action: GetNodeTemplate, req %v, resp.Code %d, resp.Message %s\",\n\t\treqID, req, resp.Code, resp.Message)\n\tblog.V(5).Infof(\"reqID: %s, action: GetNodeTemplate, req %v, resp %v\", reqID, req, resp)\n\treturn nil\n}", "title": "" }, { "docid": "94177aa873c407dea7dcf811c452895c", "score": "0.49061903", "text": "func (g Graph) GetNode(nodeValue interface{}) (*Node, bool) {\n\tnode, exists := g.nodes[nodeValue]\n\treturn node, exists\n}", "title": "" }, { "docid": "88ba307b8a0f89a42bc36cd795ab0997", "score": "0.4902531", "text": "func (a *InfrastructureApiService) GetNode(ctx _context.Context, id string) (Node, *_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 Node\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/infra/nodes/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\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\", \"id\", \"entity_type\", \"node_type\", \"node_id\", \"ip_address\"}\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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v Node\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\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "54164eabffff567e94c8d345a2a9c447", "score": "0.48964372", "text": "func (p *persistentVolume) GetNode() report.Node {\n\treturn p.MetaNode(report.MakePersistentVolumeNodeID(p.UID())).WithLatests(map[string]string{\n\t\tNodeType: \"Persistent Volume\",\n\t\tVolumeClaim: p.GetVolume(),\n\t\tStorageClassName: p.Spec.StorageClassName,\n\t\tStatus: string(p.Status.Phase),\n\t\tAccessModes: p.GetAccessMode(),\n\t})\n}", "title": "" }, { "docid": "ca886453e84a140720fc7ee039c49ae1", "score": "0.48914784", "text": "func (tr *trees) getNode(id string) (*jdh.Node, error) {\n\tif len(id) == 0 {\n\t\treturn nil, errors.New(\"node without identificiation\")\n\t}\n\tnd, ok := tr.nodes[id]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\treturn nd.data, nil\n}", "title": "" }, { "docid": "19af6d06d45574a1bc96c3f80bec123a", "score": "0.48836765", "text": "func GetTree() TreeNode {\n\tSend(\"\", GET_TREE)\n\n\treturn <-ChTree\n}", "title": "" }, { "docid": "6d3f3bc8b3c2012401e16b56d54f0c7b", "score": "0.48795155", "text": "func (_options *UpdateDialogNodeOptions) SetNewDialogNode(newDialogNode string) *UpdateDialogNodeOptions {\n\t_options.NewDialogNode = core.StringPtr(newDialogNode)\n\treturn _options\n}", "title": "" }, { "docid": "8b070c164b721ce87b3607b71585242f", "score": "0.48771465", "text": "func (assistant *AssistantV1) ListDialogNodes(listDialogNodesOptions *ListDialogNodesOptions) (result *DialogNodeCollection, response *core.DetailedResponse, err error) {\n\treturn assistant.ListDialogNodesWithContext(context.Background(), listDialogNodesOptions)\n}", "title": "" }, { "docid": "159b8034720d95980d5809199fcae0b2", "score": "0.4851909", "text": "func UnmarshalDialogNodeAction(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(DialogNodeAction)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"parameters\", &obj.Parameters)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"result_variable\", &obj.ResultVariable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"credentials\", &obj.Credentials)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "ac6bc94bb9f8b3201252b740025f8b8d", "score": "0.48517177", "text": "func (p *routeProvider) getNode(name string) (*v1.Node, error) {\n\tp.nodeMapLock.Lock()\n\tdefer p.nodeMapLock.Unlock()\n\tif p.nodeMap[name] != nil {\n\t\treturn p.nodeMap[name], nil\n\t}\n\treturn nil, errors.New(\"Node not found\")\n}", "title": "" }, { "docid": "1445972ef81f8aab57350ed511d73e00", "score": "0.48458883", "text": "func (nodekeeper *NodeKeeper) GetConnection(node *diztl.Node) (pb.DiztlServiceClient, error) {\n\tc, exists := nodekeeper.Connections[node.GetIp()]\n\tif exists {\n\t\treturn c, nil\n\t}\n\n\tconn, err := grpc.Dial(util.Address(node), grpc.WithInsecure())\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not connect to node %s: %v\", node.GetIp(), err)\n\t\treturn nil, err\n\t}\n\n\tr := pb.NewDiztlServiceClient(conn)\n\tnodekeeper.Connections[node.GetIp()] = r\n\treturn r, nil\n}", "title": "" }, { "docid": "ca68ac719cdee58d426870d20c118c76", "score": "0.48435938", "text": "func Dialog() *dom.BasicHTMLElement {\n\treturn &dom.BasicHTMLElement{&dom.BasicElement{&dom.BasicNode{js.Global.Get(\"document\").Call(\"createElement\", \"dialog\")}}}\n}", "title": "" }, { "docid": "6ede65f9b84ccaf07737787f36c2f0d4", "score": "0.48411718", "text": "func (f *fakeNodePlugin) NodeGetInfo(ctx context.Context) (*api.NodeCSIInfo, error) {\n\tif f.socket == \"fail\" {\n\t\treturn nil, fmt.Errorf(\"plugin %s is not ready\", f.name)\n\t}\n\treturn &api.NodeCSIInfo{\n\t\tPluginName: f.name,\n\t\tNodeID: fmt.Sprintf(\"node_%s\", f.name),\n\t}, nil\n}", "title": "" }, { "docid": "4864e35781fe61608622135922148115", "score": "0.48205662", "text": "func (pA *TK) GetXMLNode(xmlA string, labelsA ...string) (*xmlx.Node, error) {\n\treturn xmlx.GetXMLNode(xmlA, labelsA...)\n}", "title": "" }, { "docid": "208e8337502aee3d3ab197bef8b05c25", "score": "0.4814877", "text": "func (s *Server) GetNodeResource(ctx context.Context, req *cdpb.GetNodeResourceRequest) (*cdpb.GetNodeResourceResponse, error) {\n\trsp := &cdpb.GetNodeResourceResponse{\n\t\tHeader: &cdpb.ResponseHeader{\n\t\t\tError: &cdpb.Error{},\n\t\t},\n\t}\n\tnodes, err := s.c.Node().GetAll()\n\tif err != nil {\n\t\tglog.Errorf(\"get all node info error,err=%v\", err)\n\t\trsp.Header.Error.Type = cdpb.ErrorType_INTERNAL_ERROR\n\t\trsp.Header.Error.Message = fmt.Sprintf(\"get all node info error,err=%v\", err)\n\t\treturn rsp, err\n\t}\n\tglog.Infof(\"GetNodeResource have %d nodes\", len(nodes))\n\tfor _, node := range nodes {\n\t\trspNode := util.ToRPCNode(node)\n\t\trsp.Node = append(rsp.Node, rspNode)\n\t}\n\trsp.Header.Error.Type = cdpb.ErrorType_OK\n\trsp.Header.Error.Message = \"success\"\n\treturn rsp, nil\n}", "title": "" }, { "docid": "756503984e34d55ea3e43ec24072f859", "score": "0.48075688", "text": "func (assistant *AssistantV1) UpdateDialogNode(updateDialogNodeOptions *UpdateDialogNodeOptions) (result *DialogNode, response *core.DetailedResponse, err error) {\n\treturn assistant.UpdateDialogNodeWithContext(context.Background(), updateDialogNodeOptions)\n}", "title": "" }, { "docid": "b268486229f2acd6dd79bf710fe07a0a", "score": "0.48016348", "text": "func (c *AppClient) GetNode(id int) (Node, error) {\n\ts := Node{client: c}\n\terr := c.get(\"/application/nodes/\"+strconv.Itoa(id), &s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "b1b5d0af03fc2e4f06fdf4f2f7761d3a", "score": "0.47978532", "text": "func (ring *Ring) GetNode(key string) (id, hostname string) {\n id = ring.hashring.Get(key)\n hostname = ring.idToHostname[id]\n return\n}", "title": "" }, { "docid": "1eb497ed8e7bc57d8de2fc3f9e0c6025", "score": "0.47958738", "text": "func (op Operations) GetImagedNode(ctx context.Context, nodeUUID string) (*ImagedNodeDetails, error) {\n\tpath := fmt.Sprintf(\"/imaged_nodes/%s\", nodeUUID)\n\n\treq, err := op.client.NewRequest(ctx, http.MethodGet, path, nil)\n\timagedNodeDetails := new(ImagedNodeDetails)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imagedNodeDetails, op.client.Do(ctx, req, imagedNodeDetails)\n}", "title": "" }, { "docid": "5c8ef706acaf641bb7ec418d91e1ee09", "score": "0.4789558", "text": "func (*GetNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_tpu_v1_cloud_tpu_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "48c3713bcf764824ecedf489cc7cf3e2", "score": "0.47745606", "text": "func (a *Client) NdmpNodeSessionGet(params *NdmpNodeSessionGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NdmpNodeSessionGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewNdmpNodeSessionGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"ndmp_node_session_get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/protocols/ndmp/sessions/{owner.uuid}/{session.id}\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &NdmpNodeSessionGetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*NdmpNodeSessionGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*NdmpNodeSessionGetDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "442922d4e11bb1deeebf807d3154a074", "score": "0.47643954", "text": "func DBGetNode(id string) Node {\n\tdb := connect()\n\trow := db.QueryRow(\"SELECT id, account_id, name, url, hostname, port, status, public, created_at, updated_at FROM nodes WHERE id = $1 OR name = $1\", id)\n\tnl := NodeList{}\n\treturn nl.FromDBRow(row)\n}", "title": "" }, { "docid": "86c157065afb63a5a3dff2d922ca628f", "score": "0.47624475", "text": "func (api *API) DAGGetNode(ctx context.Context, ref string) (interface{}, error) {\n\treturn api.dag.GetNode(ctx, ref)\n}", "title": "" }, { "docid": "8c11014e02e769895a37d6879f3623a9", "score": "0.4759829", "text": "func (t *Tree) GetNode(query interface{}) *Node {\n\treturn dfsQuery(t.Root, query)\n}", "title": "" }, { "docid": "cdb2b92cb25e82a155876b1ce2275ec0", "score": "0.47485656", "text": "func GetNodeNum(n Node) Num {\n\treturn String(n.ResValue()).Num()\n}", "title": "" }, { "docid": "22de2285375201530200dfd23391cd35", "score": "0.47479233", "text": "func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: d.NodeID,\n\t}, nil\n}", "title": "" }, { "docid": "22de2285375201530200dfd23391cd35", "score": "0.47479233", "text": "func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: d.NodeID,\n\t}, nil\n}", "title": "" }, { "docid": "a623b721c14dc9e560ef1ff168e9a415", "score": "0.47427222", "text": "func (s *VolMgrServer) GetDataNode(ctx context.Context, in *vp.GetDataNodeReq) (*vp.GetDataNodeAck, error) {\n\tack := vp.GetDataNodeAck{}\n\tv, err := s.Cluster.RaftGroup.DataNodeGetAll(1)\n\tif err != nil {\n\t\tlogger.Error(\"GetAllDataNode Info failed:%v\", err)\n\t\treturn &ack, err\n\t}\n\n\tack.DataNodes = v\n\tack.Ret = 0\n\treturn &ack, nil\n}", "title": "" }, { "docid": "58f2dcbc66ee15e3744b6dcf107613f2", "score": "0.47373593", "text": "func (*GetNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_cmdb_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "aa91315769715b542cf8ed6baf81cb5c", "score": "0.47244513", "text": "func GetNode(configPath, group string) ([]string, error) {\n\tpa, err := decodeJSON(configPath)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tvar nodeTmp []string\n\tfor nodeRemarks := range pa.Node[group] {\n\t\tnodeTmp = append(nodeTmp, nodeRemarks)\n\t}\n\tsort.Strings(nodeTmp)\n\treturn nodeTmp, nil\n}", "title": "" }, { "docid": "e4476e112d55616f741f3d49b69bb152", "score": "0.47182757", "text": "func (s *SafeAuth) GetKeyNode(ctx context.Context, req *pb.GetKeyNodeRequest) (*pb.GetKeyNodeResponse, error) {\n\tstart := time.Now().UnixNano()\n\tresp := &pb.GetKeyNodeResponse{}\n\tresp.ErrorCode = 401\n\tresp.ErrorMessage = \"not authorized\"\n\n\tclaims, err := s.GetJwtFromContext(ctx)\n\tif err == nil {\n\t\tsafebox := GetStringFromClaims(claims, \"safebox\")\n\t\tif (safebox == \"admin\") || (safebox == \"datakeyrw\") || (safebox == \"keynoderw\") || (safebox == \"keynodero\") {\n\t\t\treq.AccountName = GetStringFromClaims(claims, \"actname\")\n\t\t\tresp, err = s.safeService.GetKeyNode(ctx, req)\n\t\t}\n\t} else {\n\t\tif err.Error() == tokenExpiredMatch {\n\t\t\tresp.ErrorCode = 498\n\t\t\tresp.ErrorMessage = tokenExpiredMessage\n\t\t}\n\n\t\terr = nil\n\t}\n\n\tduration := time.Now().UnixNano() - start\n\tlevel.Info(s.logger).Log(\"endpoint\", \"GetKeyNode\",\n\t\t\"path\", req.GetNodePath(),\n\t\t\"key\", req.GetKeyName(),\n\t\t\"errcode\", resp.GetErrorCode(), \"duration\", duration)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "eb7addd08357c284755d106c57bdb9f3", "score": "0.47073144", "text": "func (xm *xmlMap) GetNode(path string) (result interface{}, rtnerror error) {\n\n\tdefer func() {\n\t\tif r := recover(); r == nil {\n\t\t\treturn // Pass-thru existing error code\n\t\t} else {\n\t\t\trtnerror = errors.New(\"Error with XPATH: \" + path)\n\t\t}\n\t}()\n\n\tif xm.data == nil {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tnodeList, err := xmlquery.QueryAll(xm.data, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(nodeList) > 1 {\n\t\tarray := make([]string, 0)\n\t\tfor _, v := range nodeList {\n\t\t\tarray = append(array, v.InnerText())\n\t\t}\n\t\treturn array, nil\n\t} else if len(nodeList) == 1 {\n\t\treturn nodeList[0].InnerText(), nil\n\t} else {\n\t\treturn nil, ErrNotFound\n\t}\n}", "title": "" }, { "docid": "c51a5b44aeb3184e632b32ba256a234a", "score": "0.46944046", "text": "func (p *peer) PeerNode() *enode.Node {\n\treturn p.Peer.Node()\n}", "title": "" }, { "docid": "fe68d05142a4b91c1a74cfa33f83db7e", "score": "0.4688203", "text": "func (chr *JumpHashRing) GetNode(key string) Node {\n\tvar key64 uint64 = Fnv1a64([]byte(key))\n\tidx := Jump(key64, len(chr.ring))\n\t//fmt.Printf(\"JUMP: %s => %x => %d\\n\", key, key64, idx)\n\treturn chr.ring[idx]\n}", "title": "" }, { "docid": "aabcade42334e6def89d6cab0eb882a7", "score": "0.4685978", "text": "func (g *Graph) GetNode(n *Node) *Node {\n\tn.mtx.RLock()\n\tdefer n.mtx.RUnlock()\n\n\tg.mtx.RLock()\n\tdefer g.mtx.RUnlock()\n\n\treturn g.Nodes[n.Key]\n}", "title": "" }, { "docid": "dff30580fa1514e05293f47475debdfd", "score": "0.4659968", "text": "func execGetNode(ctx context.Context, out io.Writer) error {\n\treturn runExecutor(ctx, func(executor Executor) error {\n\t\tlistOpt := metav1.ListOptions{}\n\t\tnodes, err := executor.Client.CoreV1().Nodes().List(context.Background(), listOpt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(nodes.Items) <= 0 {\n\t\t\tcolor.Red.Fprintln(out, \"No node exists in the namespace\")\n\t\t\treturn nil\n\t\t}\n\n\t\trunner.RenderNodeListInfo(nodes.Items)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "32bde92a2cf2647979d83c4ac1ad8dd4", "score": "0.46486208", "text": "func UnmarshalDialogNodeContext(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(DialogNodeContext)\n\terr = core.UnmarshalPrimitive(m, \"integrations\", &obj.Integrations)\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, \"integrations\")\n\tfor k := range m {\n\t\tvar v interface{}\n\t\te := core.UnmarshalPrimitive(m, k, &v)\n\t\tif e != nil {\n\t\t\terr = e\n\t\t\treturn\n\t\t}\n\t\tobj.SetProperty(k, v)\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "cfa6b33b2526719b136e485a6b9958ab", "score": "0.46453443", "text": "func (lb LayoutBox) GetStyledNode() StyledNode {\n\tnode := lb.Node\n\tif node == nil {\n\t\treturn StyledNode{}\n\t}\n\n\treturn *node\n}", "title": "" }, { "docid": "b825a7f7dec10004f026f5108953f0c8", "score": "0.46344066", "text": "func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {\n\tklog.V(5).Infof(\"Using default NodeGetInfo\")\n\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: ns.Driver.nodeID,\n\t}, nil\n}", "title": "" }, { "docid": "f4bf63de9e80aa9c58aa4ded290deb93", "score": "0.4601419", "text": "func GetConnecting(g *TerraNomina) *Connecting {\n\treturn &Connecting{parent:g}\n}", "title": "" }, { "docid": "efe8c6d67bcd831989cfaeffc756ab37", "score": "0.45928335", "text": "func GetAnyNode(w http.ResponseWriter, r *http.Request, name string) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tnode, err := global.GetNode(name)\n\tif err != nil {\n\t\tlibhttp.HandleErrorJson(w, err)\n\t\treturn\n\t}\n\ttmpl, err := template.ParseFiles(\"templates/_head.tmpl.html\", \"templates/get/node.tmpl.html\")\n\tif err != nil {\n\t\tlibhttp.HandleErrorJson(w, err)\n\t\treturn\n\t}\n\ttmpl.Execute(w, node)\n\tip := r.RemoteAddr\n\tlogrus.Infoln(\"GET /get/node/\" + name + \" from \" + ip)\n\n}", "title": "" }, { "docid": "04a4fdfbb9652b70599e40b744d82f8c", "score": "0.45737115", "text": "func (s *SafeAuth) GetDecryptedKeyNode(ctx context.Context, req *pb.GetDecryptedKeyNodeRequest) (*pb.GetDecryptedKeyNodeResponse, error) {\n\tstart := time.Now().UnixNano()\n\tresp := &pb.GetDecryptedKeyNodeResponse{}\n\tresp.ErrorCode = 401\n\tresp.ErrorMessage = \"not authorized\"\n\n\tclaims, err := s.GetJwtFromContext(ctx)\n\tif err == nil {\n\t\tsafebox := GetStringFromClaims(claims, \"safebox\")\n\t\tif (safebox == \"admin\") || (safebox == \"datakeyrw\") || (safebox == \"keynoderw\") || (safebox == \"keynodero\") {\n\t\t\treq.AccountName = GetStringFromClaims(claims, \"actname\")\n\t\t\tresp, err = s.safeService.GetDecryptedKeyNode(ctx, req)\n\t\t}\n\t} else {\n\t\tif err.Error() == tokenExpiredMatch {\n\t\t\tresp.ErrorCode = 498\n\t\t\tresp.ErrorMessage = tokenExpiredMessage\n\t\t}\n\n\t\terr = nil\n\t}\n\n\tduration := time.Now().UnixNano() - start\n\tlevel.Info(s.logger).Log(\"endpoint\", \"GetDecryptedKeyNode\",\n\t\t\"path\", req.GetNodePath(),\n\t\t\"key\", req.GetKeyName(),\n\t\t\"errcode\", resp.GetErrorCode(), \"duration\", duration)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "3757e0542e57430dd7363738ee05a8d6", "score": "0.4572409", "text": "func UnmarshalDialogNodeOutput(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(DialogNodeOutput)\n\terr = core.UnmarshalModel(m, \"generic\", &obj.Generic, UnmarshalDialogNodeOutputGeneric)\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, \"generic\")\n\terr = core.UnmarshalPrimitive(m, \"integrations\", &obj.Integrations)\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, \"integrations\")\n\terr = core.UnmarshalModel(m, \"modifiers\", &obj.Modifiers, UnmarshalDialogNodeOutputModifiers)\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, \"modifiers\")\n\tfor k := range m {\n\t\tvar v interface{}\n\t\te := core.UnmarshalPrimitive(m, k, &v)\n\t\tif e != nil {\n\t\t\terr = e\n\t\t\treturn\n\t\t}\n\t\tobj.SetProperty(k, v)\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "de13be016013f0e3e1ba3e1f0975e53d", "score": "0.45714986", "text": "func GetNode(smiModulePtr *types.SmiModule, name string) *types.SmiNode {\n\tif name == \"\" {\n\t\treturn nil\n\t}\n\tvar modulePtr *internal.Module\n\tif smiModulePtr != nil {\n\t\tmodulePtr = (*internal.Module)(unsafe.Pointer(smiModulePtr))\n\t\tobjPtr := modulePtr.Objects.GetName(name)\n\t\tif objPtr == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn objPtr.GetSmiNode()\n\t}\n\tfor modulePtr = internal.GetFirstModule(); modulePtr != nil; modulePtr = modulePtr.Next {\n\t\tobjPtr := modulePtr.Objects.GetName(name)\n\t\tif objPtr != nil {\n\t\t\treturn objPtr.GetSmiNode()\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29a13e7741e910c9eac79dd97717bacc", "score": "0.45576477", "text": "func fetchNode(key, name string) (string, error) {\n\tinstance, err := fetchBindings(key, name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn instance.Node, nil\n}", "title": "" }, { "docid": "e5d02cd6d7d10632626072b468689e62", "score": "0.45567933", "text": "func (n *nodeDB) dbGetNode() {\n\tif n.tx == nil {\n\t\tlog.Fatal(\"Transaction not initialized\")\n\t}\n\n\t// Get dates with strftime to get timestamps\n\tquery := `SELECT id, protocol, user_agent, online, online_at, \n\t\t\t\tsuccess, success_at, next_refresh\n\t\t\tFROM nodes \n\t\t\tWHERE ip=?\n \t\t\t AND port=?`\n\trow := n.tx.QueryRow(query, n.dbInfo.ip, n.dbInfo.port)\n\n\terr := row.Scan(&(n.dbInfo.id), &(n.dbInfo.protocol), &(n.dbInfo.user_agent),\n\t\t&(n.dbInfo.online), &(n.dbInfo.online_at),\n\t\t&(n.dbInfo.success), &(n.dbInfo.success_at),\n\t\t&(n.dbInfo.next_refresh))\n\n\t// Ignore if err if node does not exist\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tn.dbInfo.id = -1\n\tcase err != nil:\n\t\tlogQueryError(query, err)\n\t}\n}", "title": "" }, { "docid": "31b63146223fa4cbffa61444ca05eee2", "score": "0.45565757", "text": "func (r nodes) Get(ctx context.Context, name string, opts options.GetOptions) (*libapiv3.Node, error) {\n\tout, err := r.client.resources.Get(ctx, opts, libapiv3.KindNode, noNamespace, name)\n\tif out != nil {\n\t\treturn out.(*libapiv3.Node), err\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "b023d62f51f85221c9bace87ccf3bc79", "score": "0.45536533", "text": "func (d *DriverCore) getNodeInfo() *optimization.NodeInfo {\n\treturn d.nodeInfo\n}", "title": "" }, { "docid": "dfec6642db684de828b41ea0ac604be0", "score": "0.45484278", "text": "func (g *Graph) getNode(key int) *Nodes{\n\n\tif key != 0 {\n\n\t\tfor _ ,v := range g.nodes{\n\t\t\tif v.key == key {\n\t\t\t\treturn v\n\t\t\t}\n\t\t}\n\n\t}\n\treturn &Nodes{}\n}", "title": "" }, { "docid": "7da9863adc02355bf52193d17b4f1c98", "score": "0.45476645", "text": "func (n *node) GetConfig() perun.NodeConfig {\n\tn.Debug(\"Received request: node.GetConfig\")\n\treturn n.cfg\n}", "title": "" }, { "docid": "d7ab7f9c22e02ec7e49d11726e0bf0bd", "score": "0.45454884", "text": "func (a *Client) GetNodeInstance(params *GetNodeInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNodeInstanceOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetNodeInstanceParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getNodeInstance\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/customers/{cUUID}/nodes/{nodeUUID}/list\",\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: &GetNodeInstanceReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetNodeInstanceOK)\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 getNodeInstance: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "e7debfdc2bd4b01871506b74cafacda9", "score": "0.4545311", "text": "func (a *Client) GetNodeDeployment(params *GetNodeDeploymentParams, authInfo runtime.ClientAuthInfoWriter) (*GetNodeDeploymentOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetNodeDeploymentParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getNodeDeployment\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/nodedeployments/{nodedeployment_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetNodeDeploymentReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetNodeDeploymentOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetNodeDeploymentDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "5e469ac42671165a56fa244a39b8eeaf", "score": "0.45434725", "text": "func (s *Server) GetNode(ctx context.Context, req *request.Node) (*response.Node, error) {\n\terr := validation.New(validation.Options{\n\t\tTarget: \"node\",\n\t\tRequest: *req,\n\t\tRequiredDefault: true,\n\t}).Validate()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := s.createClient(ctx, req.OrgId, req.ServerId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := c.client.Nodes.Get(req.Name)\n\tif err != nil {\n\t\treturn nil, ParseAPIError(err)\n\t}\n\n\tnode, err := responseNodeObject(&res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "5e3a1f621c043bb8a456c9738f726b2d", "score": "0.45346728", "text": "func (k *Krypton) GetNode(ctx context.Context, podname, nodename string) (*types.Node, error) {\n\tkey := fmt.Sprintf(nodeInfoKey, podname, nodename)\n\tresp, err := k.etcd.Get(ctx, key, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Node.Dir {\n\t\treturn nil, fmt.Errorf(\"Node storage path %q in etcd is a directory\", key)\n\t}\n\n\tnode := &types.Node{}\n\tif err := json.Unmarshal([]byte(resp.Node.Value), node); err != nil {\n\t\treturn nil, err\n\t}\n\n\tengine, err := k.makeDockerClient(ctx, podname, nodename, node.Endpoint, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnode.Engine = engine\n\treturn node, nil\n}", "title": "" }, { "docid": "1f773ec442ab66024c47256f4dcdec77", "score": "0.45206696", "text": "func (p *peer) NodeInfo() NodeInfo {\n\treturn p.nodeInfo\n}", "title": "" }, { "docid": "07be25c324b814ade7329545aee6695b", "score": "0.45192346", "text": "func (assistant *AssistantV1) UpdateDialogNodeWithContext(ctx context.Context, updateDialogNodeOptions *UpdateDialogNodeOptions) (result *DialogNode, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(updateDialogNodeOptions, \"updateDialogNodeOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(updateDialogNodeOptions, \"updateDialogNodeOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"workspace_id\": *updateDialogNodeOptions.WorkspaceID,\n\t\t\"dialog_node\": *updateDialogNodeOptions.DialogNode,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = assistant.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(assistant.Service.Options.URL, `/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range updateDialogNodeOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"conversation\", \"V1\", \"UpdateDialogNode\")\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/json\")\n\n\tbuilder.AddQuery(\"version\", fmt.Sprint(*assistant.Version))\n\tif updateDialogNodeOptions.IncludeAudit != nil {\n\t\tbuilder.AddQuery(\"include_audit\", fmt.Sprint(*updateDialogNodeOptions.IncludeAudit))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif updateDialogNodeOptions.NewDialogNode != nil {\n\t\tbody[\"dialog_node\"] = updateDialogNodeOptions.NewDialogNode\n\t}\n\tif updateDialogNodeOptions.NewDescription != nil {\n\t\tbody[\"description\"] = updateDialogNodeOptions.NewDescription\n\t}\n\tif updateDialogNodeOptions.NewConditions != nil {\n\t\tbody[\"conditions\"] = updateDialogNodeOptions.NewConditions\n\t}\n\tif updateDialogNodeOptions.NewParent != nil {\n\t\tbody[\"parent\"] = updateDialogNodeOptions.NewParent\n\t}\n\tif updateDialogNodeOptions.NewPreviousSibling != nil {\n\t\tbody[\"previous_sibling\"] = updateDialogNodeOptions.NewPreviousSibling\n\t}\n\tif updateDialogNodeOptions.NewOutput != nil {\n\t\tbody[\"output\"] = updateDialogNodeOptions.NewOutput\n\t}\n\tif updateDialogNodeOptions.NewContext != nil {\n\t\tbody[\"context\"] = updateDialogNodeOptions.NewContext\n\t}\n\tif updateDialogNodeOptions.NewMetadata != nil {\n\t\tbody[\"metadata\"] = updateDialogNodeOptions.NewMetadata\n\t}\n\tif updateDialogNodeOptions.NewNextStep != nil {\n\t\tbody[\"next_step\"] = updateDialogNodeOptions.NewNextStep\n\t}\n\tif updateDialogNodeOptions.NewTitle != nil {\n\t\tbody[\"title\"] = updateDialogNodeOptions.NewTitle\n\t}\n\tif updateDialogNodeOptions.NewType != nil {\n\t\tbody[\"type\"] = updateDialogNodeOptions.NewType\n\t}\n\tif updateDialogNodeOptions.NewEventName != nil {\n\t\tbody[\"event_name\"] = updateDialogNodeOptions.NewEventName\n\t}\n\tif updateDialogNodeOptions.NewVariable != nil {\n\t\tbody[\"variable\"] = updateDialogNodeOptions.NewVariable\n\t}\n\tif updateDialogNodeOptions.NewActions != nil {\n\t\tbody[\"actions\"] = updateDialogNodeOptions.NewActions\n\t}\n\tif updateDialogNodeOptions.NewDigressIn != nil {\n\t\tbody[\"digress_in\"] = updateDialogNodeOptions.NewDigressIn\n\t}\n\tif updateDialogNodeOptions.NewDigressOut != nil {\n\t\tbody[\"digress_out\"] = updateDialogNodeOptions.NewDigressOut\n\t}\n\tif updateDialogNodeOptions.NewDigressOutSlots != nil {\n\t\tbody[\"digress_out_slots\"] = updateDialogNodeOptions.NewDigressOutSlots\n\t}\n\tif updateDialogNodeOptions.NewUserLabel != nil {\n\t\tbody[\"user_label\"] = updateDialogNodeOptions.NewUserLabel\n\t}\n\tif updateDialogNodeOptions.NewDisambiguationOptOut != nil {\n\t\tbody[\"disambiguation_opt_out\"] = updateDialogNodeOptions.NewDisambiguationOptOut\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\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 = assistant.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalDialogNode)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7756d3dd99a46dea15c6b8a37568fa8b", "score": "0.45187077", "text": "func (ns *NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: ns.Driver.nodeID,\n\t}, nil\n}", "title": "" }, { "docid": "c44a9b98e9b38003fe1ab3b3d5517710", "score": "0.45186523", "text": "func (a *Client) NdmpNodeCollectionGet(params *NdmpNodeCollectionGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NdmpNodeCollectionGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewNdmpNodeCollectionGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"ndmp_node_collection_get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/protocols/ndmp/nodes\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &NdmpNodeCollectionGetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*NdmpNodeCollectionGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*NdmpNodeCollectionGetDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" } ]
8c590470c702c4633ca8e0955e3e8ce9
ChangePasswordUserServicePath returns the URL path to the user_service service changePassword HTTP endpoint.
[ { "docid": "116608513e792cb1a256590b5a9ab4a6", "score": "0.89982635", "text": "func ChangePasswordUserServicePath() string {\n\treturn \"/changePassword\"\n}", "title": "" } ]
[ { "docid": "8cf18896f3e7163469371db81a054ff9", "score": "0.7908162", "text": "func ResetPasswordUserServicePath() string {\n\treturn \"/resetPassword\"\n}", "title": "" }, { "docid": "0858c92df090a3bd72127797612a5437", "score": "0.7696175", "text": "func ChangePasswordUserPath(userID int) string {\n\tparam0 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/users/%s/password\", param0)\n}", "title": "" }, { "docid": "34ed48aa8ecb294383e60e39143084a2", "score": "0.7329052", "text": "func UpdateUsernameUserServicePath() string {\n\treturn \"/updateUsername\"\n}", "title": "" }, { "docid": "733188c9fcdf76765cac1d57ec8ec2f3", "score": "0.64871985", "text": "func VerifyPasswordResetTokenUserServicePath() string {\n\treturn \"/verifyPasswordResetToken\"\n}", "title": "" }, { "docid": "a017d416217a19dab330a057aac4e8dd", "score": "0.64399856", "text": "func UpdateUserPath(userID int) string {\n\tparam0 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/users/%s\", param0)\n}", "title": "" }, { "docid": "5c1284ac806c652691e6197c6f7bcab0", "score": "0.6382104", "text": "func LoginUserServicePath() string {\n\treturn \"/login\"\n}", "title": "" }, { "docid": "693c7161e788977742ca27efc1d8deb3", "score": "0.63310164", "text": "func UpdateUserPath(id string) string {\n\treturn fmt.Sprintf(\"/v2/users/%v\", id)\n}", "title": "" }, { "docid": "d45649f7b60fa1767f34570cec19a33e", "score": "0.6092441", "text": "func UpdateUserHyUserPath(userID int) string {\n\treturn fmt.Sprintf(\"/api/user/%v\", userID)\n}", "title": "" }, { "docid": "e75d1f0cf61096026b0d69222a35d2d4", "score": "0.6072851", "text": "func RefreshAccessTokenUserServicePath() string {\n\treturn \"/refreshAccessToken\"\n}", "title": "" }, { "docid": "af784e1bc73c28a54179e8ed44755360", "score": "0.59865534", "text": "func LogoutUserServicePath() string {\n\treturn \"/logout\"\n}", "title": "" }, { "docid": "e2e6095cecd040b5fcb41369828afb41", "score": "0.5965614", "text": "func UpdateUserPath(organizationID int, userID int) string {\n\tparam0 := strconv.Itoa(organizationID)\n\tparam1 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/organizations/%s/users/%s\", param0, param1)\n}", "title": "" }, { "docid": "9bad4007a3546f1f4ad16bdda486f3c2", "score": "0.5807964", "text": "func RefreshUserPath() string {\n\n\treturn fmt.Sprintf(\"/refresh\")\n}", "title": "" }, { "docid": "03f440ab911afc2393eecdc2aeaea3b3", "score": "0.56886995", "text": "func RecoveryUserPath() string {\n\n\treturn fmt.Sprintf(\"/user/recovery\")\n}", "title": "" }, { "docid": "55f9e82b13a73a0a2a218c586a92b464", "score": "0.5684809", "text": "func SignupUserServicePath() string {\n\treturn \"/signup\"\n}", "title": "" }, { "docid": "2932cb0cb5bc3afc48428431b76fe0e6", "score": "0.5644371", "text": "func VerifyConfirmationTokenUserServicePath() string {\n\treturn \"/verifyConfirmationToken\"\n}", "title": "" }, { "docid": "004d607ec8486242d7be6fc5f7dff6fa", "score": "0.5629422", "text": "func (c *Client) ChangePassword() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeChangePasswordRequest(c.encoder)\n\t\tdecodeResponse = DecodeChangePasswordResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildChangePasswordRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.ChangePasswordDoer.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"user_service\", \"changePassword\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "12e995e6dd2756d9e2ab5b928c2e97f5", "score": "0.5567479", "text": "func (c *Client) ChangePasswordUser(ctx context.Context, path string, payload *UpdateUserPasswordPayload) (*http.Response, error) {\n\treq, err := c.NewChangePasswordUserRequest(ctx, path, payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "36826f924935e57a70e8132f5c7c26d0", "score": "0.5567468", "text": "func (service *serviceImpl) ChangeUserPassword(c echo.Context) error {\n\tvar request struct {\n\t\tUserId string `json:\"userId\"`\n\t\tNewPassword string `json:\"newPassword\"`\n\t}\n\tc.Bind(&request)\n\n\tif request.UserId == \"\" {\n\t\treturn c.JSON(http.StatusBadRequest, util.CreateErrResponse(errors.New(\"Missing parameter 'userId'\")))\n\t}\n\n\tif request.NewPassword == \"\" {\n\t\treturn c.JSON(http.StatusBadRequest, util.CreateErrResponse(errors.New(\"Missing parameter 'newPassword'\")))\n\t}\n\n\tvar userDoc collections.UserDocument\n\terr := service.userCollection.FindId(bson.ObjectIdHex(request.UserId)).One(&userDoc)\n\tif err != nil {\n\t\terr = errors.New(\"No such user.\")\n\t\tc.JSON(http.StatusNotFound, util.CreateErrResponse(err))\n\t\treturn err\n\t}\n\n\thashedPass, err := bcrypt.GenerateFromPassword([]byte(request.NewPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, util.CreateErrResponse(err))\n\t}\n\n\terr = service.userCollection.UpdateId(\n\t\tbson.ObjectIdHex(request.UserId),\n\t\tbson.M{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"hashedPass\": hashedPass,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, util.CreateErrResponse(err))\n\t}\n\n\treturn c.JSON(http.StatusOK, util.CreateOkResponse(nil))\n}", "title": "" }, { "docid": "fa7d6b2eb8830dc7f01b0309f80564e2", "score": "0.553389", "text": "func (s *UsersService) ChangePassword(opt *UsersChangePasswordOption) (resp *http.Response, err error) {\n\terr = s.ValidateChangePasswordOpt(opt)\n\tif err != nil {\n\t\treturn\n\t}\n\treq, err := s.client.NewRequest(\"POST\", \"users/change_password\", opt)\n\tif err != nil {\n\t\treturn\n\t}\n\tresp, err = s.client.Do(req, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "7878ea4746c31830b9d3970a56d83b50", "score": "0.55204767", "text": "func (g *Gate) UpdateUserPassword(ctx context.Context, req *meta.GateUpdateUserPasswordRequest) (*meta.GateUpdateUserPasswordResponse, error) {\n\tlog.Debug(\"Gate UpdateUserPassword\")\n\treturn nil, ErrUndefineMethod\n}", "title": "" }, { "docid": "b560dd2a60f658b8e58e7c9f397c7cc7", "score": "0.5488013", "text": "func ListUsersUserServicePath() string {\n\treturn \"/listUsers\"\n}", "title": "" }, { "docid": "b02db4208b9ba66dccabbf141e564142", "score": "0.53887725", "text": "func AddUserPath() string {\n\n\treturn fmt.Sprintf(\"/users\")\n}", "title": "" }, { "docid": "da93d9de3a776a9889e8382b74680991", "score": "0.5381056", "text": "func LogoutUserPath() string {\n\n\treturn fmt.Sprintf(\"/logout\")\n}", "title": "" }, { "docid": "02d8bce4365eff45a2d7d267031a0a6a", "score": "0.53650236", "text": "func LoginUserPath() string {\n\n\treturn fmt.Sprintf(\"/login\")\n}", "title": "" }, { "docid": "4bafddc25de779be46cf5557aeb9e02b", "score": "0.5349452", "text": "func RecoveryLookupUserPath() string {\n\n\treturn fmt.Sprintf(\"/user/recovery/lookup\")\n}", "title": "" }, { "docid": "ee4e1acc166fb7639077babd7af5c093", "score": "0.5348676", "text": "func (r *User) Path() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"path\"])\n}", "title": "" }, { "docid": "8ead5307eb3b7ba9aa67f5ffb0662db4", "score": "0.53437257", "text": "func (a *UserApiService) ChangeUserPasswordExecute(r UserApiApiChangeUserPasswordRequest) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"UserApiService.ChangeUserPassword\")\n\tif err != nil {\n\t\treturn nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/users/{userId}/password\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"userId\"+\"}\", url.PathEscape(parameterToString(r.userId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\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.putUserPasswordRequest\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 := 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}", "title": "" }, { "docid": "b23ebd9061f24bce41a9288715d60da6", "score": "0.5330821", "text": "func (a *DefaultApiService) UpdateUserPassword(ctx context.Context, body UpdateUserPasswordRequest) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/admin/users/credentials\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"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 = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "1c5ee5cc451625c17fb6e39dcbdc885a", "score": "0.532128", "text": "func (s *userServiceServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"rpc\", \"UserService\")\n}", "title": "" }, { "docid": "d6b2b480178f0ba98489826d8e2cbd50", "score": "0.53203124", "text": "func GetCurrentUserPath() string {\n\n\treturn fmt.Sprintf(\"/user\")\n}", "title": "" }, { "docid": "460da9b0ee53064d309d2f37cc5ad2ec", "score": "0.5285554", "text": "func (*ReverseProxyAuthProfile) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/auth_profile/%s\", ref)\n}", "title": "" }, { "docid": "7054c6a0086759c785919cc80e61d101", "score": "0.52306527", "text": "func GetIDUserPath(userID int) string {\n\tparam0 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/users/%s\", param0)\n}", "title": "" }, { "docid": "c38952c7546a94dedb837838cc38886a", "score": "0.52071255", "text": "func GetUserHyUserPath(userID int) string {\n\treturn fmt.Sprintf(\"/api/user/%v\", userID)\n}", "title": "" }, { "docid": "eac13baba44f7e69444a37971740ff24", "score": "0.5147972", "text": "func UserChangePassword(login, password string) error {\n\treturn core.UserChangePassword(login, password)\n}", "title": "" }, { "docid": "40df76a740b3db75f7bc94e86920e83d", "score": "0.5124414", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOutput) ApplicationServicePath() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoData) string {\n\t\treturn v.ApplicationServicePath\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9bedadef99cc539aeceba568e0f5a388", "score": "0.5098184", "text": "func (c Config) GetProvisionerPasswordPath() string {\n\tif c.ProvisionerPasswordPath != \"\" {\n\t\treturn c.ProvisionerPasswordPath\n\t}\n\n\treturn \"/home/step/password/password\"\n}", "title": "" }, { "docid": "eff9dfd05194cfa4d11b33bd41ac3a3e", "score": "0.5091732", "text": "func um_users_path(usrid string) string {\n\treturn um() + slash(\"users\") + slash(usrid)\n}", "title": "" }, { "docid": "d52cf12d1ada47d45f1e5c861ffc18e3", "score": "0.5089696", "text": "func ChangeUserPasswd(c echo.Context) error {\n\tvar id string\n\terr := validation.ValidateUser(c, &id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar password TPasswordData\n\tif err := c.Bind(&password); err != nil {\n\t\treturn utils.InvalidParams()\n\t}\n\n\tif PswErr := canUpdateUsePsw(id, password.OldPassword); PswErr != nil{\n\t\treturn PswErr\n\t}\n\n\tif password.NewPassword != password.NewPassword2{\n\t\treturn utils.Unauthorized(\"新密码确认匹配失败,请再次输入验证!\")\n\t}\n\n\terr = userDB.C(\"classes\").UpdateId(bson.ObjectIdHex(id), bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"password\": password.NewPassword,\n\t\t},\n\t})\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\treturn c.JSON(http.StatusOK, \"Successfully update passwd info.\")\n}", "title": "" }, { "docid": "3a2a68939a79c734939e0f2d386d60cd", "score": "0.5033875", "text": "func (*ReverseProxyProfile) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/profile/%s\", ref)\n}", "title": "" }, { "docid": "7cef6c3c0e37211cac8cb78f6c27a529", "score": "0.5032728", "text": "func (self *UserHandler) ChangeUserPassword(writer http.ResponseWriter, request *http.Request) {\n\n}", "title": "" }, { "docid": "e9130ea5f6daac5f54a4acbf0b89b95f", "score": "0.5002573", "text": "func ValidateUserPath() string {\n\n\treturn fmt.Sprintf(\"/validate\")\n}", "title": "" }, { "docid": "7434a5a8f8f570144fe34a5adaf9a925", "score": "0.4992783", "text": "func (s *Service) GetPath() string {\n\treturn fmt.Sprintf(\"%s:%d\", s.GetAddress(), s.GetPort())\n}", "title": "" }, { "docid": "39d2d4b9b47bcfcf8c12ae76e753c626", "score": "0.4991257", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataPtrOutput) ApplicationServicePath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoData) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ApplicationServicePath\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "01efc41bec8434dd711904661fcc7917", "score": "0.49836147", "text": "func DeleteUserHyUserPath(userID int) string {\n\treturn fmt.Sprintf(\"/api/user/%v\", userID)\n}", "title": "" }, { "docid": "cadb0b7003137744fdcbcab6cbc1e362", "score": "0.49647933", "text": "func (icpd *IcpdV1) ChangePassword(changePasswordOptions *ChangePasswordOptions) (*core.DetailedResponse, error) {\n\tif err := core.ValidateNotNil(changePasswordOptions, \"changePasswordOptions cannot be nil\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := core.ValidateStruct(changePasswordOptions, \"changePasswordOptions\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpathSegments := []string{\"v1/changepassword\"}\n\tpathParameters := []string{}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tif _, err := builder.ConstructHTTPURL(icpd.Service.Options.URL, pathSegments, pathParameters); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor headerName, headerValue := range changePasswordOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"icpd\", \"V1\", \"ChangePassword\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tbuilder.AddFormData(\"password\", \"\", \"\", fmt.Sprint(*changePasswordOptions.Password))\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := icpd.Service.Request(request, new(SuccessResponse))\n\treturn response, err\n}", "title": "" }, { "docid": "ad7139c96d80a599c0e0c57da311a1bc", "score": "0.49506402", "text": "func (u *UserSrv) ChangePwd(ctx context.Context, req *pb.ChangePwdReq) (*pb.ChangePwdRes, error) {\n\treturn u.userSvc.ChangePwd(ctx, req)\n}", "title": "" }, { "docid": "ee632a2cd55d92a4c9a9bcd4b0614ff8", "score": "0.49332562", "text": "func (*ReverseProxyFrontend) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/frontend/%s\", ref)\n}", "title": "" }, { "docid": "15862ee529df85330396cb04de44de3d", "score": "0.49305195", "text": "func (um *UserManager) ChangePassword(newPassword string, opts *ChangePasswordOptions) error {\n\tif newPassword == \"\" {\n\t\treturn makeInvalidArgumentsError(\"new password cannot be empty\")\n\t}\n\n\tif opts == nil {\n\t\topts = &ChangePasswordOptions{}\n\t}\n\n\tstart := time.Now()\n\tdefer um.meter.ValueRecord(meterValueServiceManagement, \"manager_users_change_password\", start)\n\n\tpath := \"/controller/changePassword\"\n\tspan := createSpan(um.tracer, opts.ParentSpan, \"manager_users_change_password\", \"management\")\n\tspan.SetAttribute(\"db.operation\", \"POST \"+path)\n\tdefer span.End()\n\n\treqForm := make(url.Values)\n\treqForm.Add(\"password\", newPassword)\n\n\treq := mgmtRequest{\n\t\tService: ServiceTypeManagement,\n\t\tMethod: \"POST\",\n\t\tPath: path,\n\t\tBody: []byte(reqForm.Encode()),\n\t\tContentType: \"application/x-www-form-urlencoded\",\n\t\tRetryStrategy: opts.RetryStrategy,\n\t\tUniqueID: uuid.New().String(),\n\t\tTimeout: opts.Timeout,\n\t\tparentSpanCtx: span.Context(),\n\t}\n\n\tresp, err := um.provider.executeMgmtRequest(opts.Context, req)\n\tif err != nil {\n\t\treturn makeGenericMgmtError(err, &req, resp, \"\")\n\t}\n\tdefer ensureBodyClosed(resp.Body)\n\n\tif resp.StatusCode != 200 {\n\t\tusrErr := um.tryParseErrorMessage(&req, resp)\n\t\tif usrErr != nil {\n\t\t\treturn usrErr\n\t\t}\n\t\treturn makeMgmtBadStatusError(\"failed to change password\", &req, resp)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "66962ec153621bfa2dbc32bbf6efb35f", "score": "0.4913216", "text": "func (c *UserController) ChangePassword(w http.ResponseWriter, r *http.Request) {\n\n\t// parse the JSON coming from the client\n\tvar pwChangeRequest passwordChangeRequest\n\tdecoder := json.NewDecoder(r.Body)\n\n\t// check if the parsing succeeded\n\tif err := decoder.Decode(&pwChangeRequest); err != nil {\n\t\tlog.Println(err)\n\t\tc.Error500(w, err, \"Error decoding JSON\")\n\t\treturn\n\t}\n\n\t// get the current user session\n\t_, userSession, err := middleware.GetUserSession(r)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.Forbidden(w, err, \"Error getting user session\")\n\t\treturn\n\t}\n\n\t// load the user and verify email and password authentication\n\tdbUser, err := models.FindUserByEmail(userSession.Email)\n\tif err != nil || dbUser == nil {\n\t\tlog.Printf(\"User %v not found in database: %v\", userSession.Email, err)\n\t\tc.Forbidden(w, err, \"Error authenticating user\")\n\t\treturn\n\t}\n\n\tif err := dbUser.CheckPassword(pwChangeRequest.CurrentPassword); err != nil {\n\t\tlog.Printf(\"Incorrect password for user %v\", userSession.Email)\n\t\tc.Forbidden(w, err, \"Incorrect password\")\n\t\treturn\n\t}\n\n\t// check if new passwords are valid\n\tif err := passwordsAreValid(pwChangeRequest.NewPassword, pwChangeRequest.PasswordConfirmation); err != nil {\n\t\tlog.Println(err)\n\t\tc.Error500(w, err, err.Error())\n\t\treturn\n\t}\n\n\tif err := dbUser.UpdatePassword(pwChangeRequest.NewPassword); err != nil {\n\t\tlog.Printf(\"Error updating the password in the database: %v\", err)\n\t\tc.Error500(w, err, \"Error updating the password in the database\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "012d766fc4dc02bfa98c18c5dd913024", "score": "0.49084905", "text": "func ChangeOwnPasswordRoute(router *gin.RouterGroup) {\n\trouter.PUT(\"/password\", ChangePassword)\n}", "title": "" }, { "docid": "7aa283e21a1c29f8572dff33cf0f6812", "score": "0.48939764", "text": "func (ks *Services) path() string {\n\n\treturn fmt.Sprintf(\"%s/%s\", ServicesURI, ks.service.ID)\n}", "title": "" }, { "docid": "ae8c61e0316059c24b2f1af2001596c5", "score": "0.48911107", "text": "func UserListHyUserPath() string {\n\treturn \"/api/user\"\n}", "title": "" }, { "docid": "32f6cdc889bfe21e0e2cfc1cfa24c3f3", "score": "0.48819527", "text": "func ServiceChainTestServicePath(svcLo string, svcOther string) string {\n\tparam0 := svcLo\n\tparam1 := svcOther\n\n\treturn fmt.Sprintf(\"/api/%s/%s\", param0, param1)\n}", "title": "" }, { "docid": "87a6e6b58690a322122203b0be6268ff", "score": "0.48741937", "text": "func ProjectRolesUserPath() string {\n\n\treturn fmt.Sprintf(\"/projects/roles\")\n}", "title": "" }, { "docid": "1166fedf73181ef7bb93ccdf3efa3e52", "score": "0.4871357", "text": "func AccountTerminalStatusUpdateUsersPath() string {\n\treturn fmt.Sprintf(\"/api/v2/users/status\")\n}", "title": "" }, { "docid": "3ccfe3a87b6b929be1f694577d8daa81", "score": "0.48577312", "text": "func (o CassandraOutput) ServicePassword() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cassandra) pulumi.StringOutput { return v.ServicePassword }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c068640375ea1dcec6a3483519034784", "score": "0.4841795", "text": "func TransmissionTokenUserPath() string {\n\n\treturn fmt.Sprintf(\"/user/transmission-token\")\n}", "title": "" }, { "docid": "da687aa9cf2ee1b5ede7d56670de0cc6", "score": "0.48369464", "text": "func ChangePassword(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\toldPassword := strings.TrimSpace(r.FormValue(\"OldPassword\"))\n\tnewPassword := strings.TrimSpace(r.FormValue(\"NewPassword\"))\n\tconfirmPassword := strings.TrimSpace(r.FormValue(\"ConfirmPassword\"))\n\n\tuser, err := server.GetCurrentUser(r)\n\tif err != nil {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tif user == nil {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"The user is not existed.\",\n\t\t})\n\t\treturn\n\t}\n\n\t// check whether password is empty\n\tif oldPassword == \"\" {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"Old password is not allowed to be empty.\",\n\t\t})\n\t\treturn\n\t}\n\n\tif newPassword == \"\" {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"New password is not allowed to be empty.\",\n\t\t})\n\t\treturn\n\t}\n\n\tif confirmPassword == \"\" {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"Confirm password is not allowed to be empty.\",\n\t\t})\n\t\treturn\n\t}\n\n\tif newPassword != confirmPassword {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"New password and confirm password is not the same.\",\n\t\t})\n\t\treturn\n\t}\n\n\t// verify old password\n\toldPassword = helper.MD5(oldPassword + user.Salt)\n\n\tif oldPassword != user.Password {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: \"Old password is not correct.\",\n\t\t})\n\t\treturn\n\t}\n\n\t// change password\n\tsalt := helper.TimeToString(time.Now(), \"yyyyMMddHHmmss\")\n\tpassword := helper.MD5(newPassword + salt)\n\n\tuserID, _ := primitive.ObjectIDFromHex(user.ID)\n\n\tfilter := bson.M{\n\t\t\"ID\": userID,\n\t}\n\tupdate := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"Password\": password,\n\t\t\t\"Salt\": salt,\n\t\t},\n\t}\n\n\tdb, err := server.Mongo()\n\tif err != nil {\n\t\thelper.WriteJSON(w, server.Result{\n\t\t\tCode: 300,\n\t\t\tMsg: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tdb.UpdateOne(server.UserCollectionName, filter, update)\n\n\thelper.WriteJSON(w, server.Result{\n\t\tCode: 200,\n\t\tMsg: \"Password changed successfully!\",\n\t})\n}", "title": "" }, { "docid": "9bd273c964aa22bb440ddfd2396f145e", "score": "0.48294392", "text": "func (*ReverseProxyBackend) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/backend/%s\", ref)\n}", "title": "" }, { "docid": "0d2ca4aebcc30d9821cfb54ff5149d5e", "score": "0.48254308", "text": "func ChangePassword(c *fiber.Ctx) error {\n\n\tclaims := c.Locals(mjwt.CLAIMS).(*mjwt.CustomClaim)\n\n\tvar user users.UserChangePasswordRequest\n\tif err := c.BodyParser(&user); err != nil {\n\t\tapiErr := rest_err.NewBadRequestError(err.Error())\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\tif err := user.Validate(); err != nil {\n\t\tapiErr := rest_err.NewBadRequestError(err.Error())\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\t//mengganti user email dengan user aktif\n\tuser.Email = claims.Identity\n\n\tapiErr := services.UserService.ChangePassword(user)\n\tif apiErr != nil {\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\treturn c.JSON(fiber.Map{\"msg\": \"Password berhasil diubah!\"})\n}", "title": "" }, { "docid": "5f4911f9fe6bf91bad25fc9242fe0394", "score": "0.4822798", "text": "func (p *LDAPUserProvider) UpdatePassword(username, password string) (err error) {\n\tvar (\n\t\tclient LDAPClient\n\t\tprofile *ldapUserProfile\n\t)\n\n\tif client, err = p.connect(); err != nil {\n\t\treturn fmt.Errorf(\"unable to update password. Cause: %w\", err)\n\t}\n\n\tdefer client.Close()\n\n\tif profile, err = p.getUserProfile(client, username); err != nil {\n\t\treturn fmt.Errorf(\"unable to update password. Cause: %w\", err)\n\t}\n\n\tvar controls []ldap.Control\n\n\tswitch {\n\tcase p.features.ControlTypes.MsftPwdPolHints:\n\t\tcontrols = append(controls, &controlMsftServerPolicyHints{ldapOIDControlMsftServerPolicyHints})\n\tcase p.features.ControlTypes.MsftPwdPolHintsDeprecated:\n\t\tcontrols = append(controls, &controlMsftServerPolicyHints{ldapOIDControlMsftServerPolicyHintsDeprecated})\n\t}\n\n\tswitch {\n\tcase p.features.Extensions.PwdModifyExOp:\n\t\tpwdModifyRequest := ldap.NewPasswordModifyRequest(\n\t\t\tprofile.DN,\n\t\t\t\"\",\n\t\t\tpassword,\n\t\t)\n\n\t\terr = p.pwdModify(client, pwdModifyRequest)\n\tcase p.config.Implementation == schema.LDAPImplementationActiveDirectory:\n\t\tmodifyRequest := ldap.NewModifyRequest(profile.DN, controls)\n\t\t// The password needs to be enclosed in quotes\n\t\t// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/6e803168-f140-4d23-b2d3-c3a8ab5917d2\n\t\tpwdEncoded, _ := utf16LittleEndian.NewEncoder().String(fmt.Sprintf(\"\\\"%s\\\"\", password))\n\t\tmodifyRequest.Replace(ldapAttributeUnicodePwd, []string{pwdEncoded})\n\n\t\terr = p.modify(client, modifyRequest)\n\tdefault:\n\t\tmodifyRequest := ldap.NewModifyRequest(profile.DN, controls)\n\t\tmodifyRequest.Replace(ldapAttributeUserPassword, []string{password})\n\n\t\terr = p.modify(client, modifyRequest)\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to update password. Cause: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eedba1d484fced6c7d56aaf1dccf34bd", "score": "0.48187965", "text": "func ShowUserPath(id string) string {\n\treturn fmt.Sprintf(\"/v2/users/%v\", id)\n}", "title": "" }, { "docid": "1e378c4a5e4c3707322e362c1377747d", "score": "0.48113322", "text": "func (u *User) ChangePassword(p *ConnectionPoolWrapper, password string) error {\n\tdb := p.GetConnection()\n\tdefer p.ReleaseConnection(db)\n\t_, err := db.Exec(\"update users set password = $1 where id = $2\", password, u.Id)\n\treturn err\n}", "title": "" }, { "docid": "fa0ccd3a75ae40b1ae99988fb04894f3", "score": "0.48106182", "text": "func (o ServiceReferencePatchOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceReferencePatch) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6a3bd8ea34b47cfc37fa53d6000dd616", "score": "0.4795039", "text": "func ChangePassword(c *gin.Context) {\n\ttoken := c.Request.FormValue(\"token\")\n\tdb := connection.CreateConnection()\n\n\tvar userID int\n\terr := db.Get(&userID, \"UPDATE token SET is_revoked = $2 WHERE token = $1 RETURNING user_id\", token, true)\n\n\tif err != nil {\n\t\tc.JSON(400, err)\n\t\treturn\n\t}\n\n\tpassword := functions.GenerateMD5(c.Request.FormValue(\"password\"))\n\n\tuser := models.User{}\n\n\terr = db.Get(&user, \"UPDATE users SET password = ($2) WHERE id = ($1) RETURNING *\", userID, password)\n\tif err != nil {\n\t\tc.JSON(400, err)\n\t\treturn\n\t}\n\n\tdefer db.Close()\n\tc.JSON(200, user)\n}", "title": "" }, { "docid": "2edeeb2120b59833373e886e4a00c7c1", "score": "0.4788393", "text": "func (u *UserSrv) ChangePwd(ctx context.Context, req *pb.ChangePwdReq) (*pb.ChangePwdRes, error) {\n\treturn nil, status.Errorf(codes.Unimplemented, \"method CreateUser not implemented\")\n}", "title": "" }, { "docid": "6ed9f7a0dc028147a94000af0252ee79", "score": "0.47863194", "text": "func (c *Client) NewChangePasswordUserRequest(ctx context.Context, path string, payload *UpdateUserPasswordPayload) (*http.Request, error) {\n\tvar body bytes.Buffer\n\terr := c.Encoder.Encode(payload, &body, \"*/*\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"https\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"PATCH\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\tif c.JWTSigner != nil {\n\t\tif err := c.JWTSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "89bce85b23ad41ca699038fa259a4aba", "score": "0.47786084", "text": "func (r *UserRootResolver) Password(ctx context.Context, args struct {\n\tOld string\n\tNew string\n}) (bool, error) {\n\tuser := auth.FromContext(ctx)\n\t// clientID := clientid.FromContext(ctx)\n\n\tif err := usecase.ChangePassword(ctx, r.repositories, user, args.Old, args.New); err != nil {\n\t\treturn false, err\n\t}\n\n\t// r.publisher.Publish(\n\t// \tpublisher.NewEvent(clientID, publisher.TopicUser, publisher.Update, user),\n\t// )\n\n\treturn true, nil\n}", "title": "" }, { "docid": "34317f59f5dd35e8dd69ed1754357109", "score": "0.47774535", "text": "func (c *Client) DBaasQueueUserChangePassword(serviceName, userID string) (*types.DBaasQueueUser, error) {\n\tuser := &types.DBaasQueueUser{}\n\terr := c.Post(queryEscape(\"/dbaas/queue/%s/user/%s/changePassword\", serviceName, userID), nil, user)\n\treturn user, err\n}", "title": "" }, { "docid": "2902b7c3975170d5a8bc3ee601ce1015", "score": "0.47567546", "text": "func UpdatePassword(w http.ResponseWriter, r *http.Request) {\n\tuserIDfromToken, err := authentication.GetUserID(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnauthorized, err)\n\t\treturn\n\t}\n\n\tuserID, err := getUserID(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif userIDfromToken != userID {\n\t\tresponses.Error(w, http.StatusForbidden, errors.New(\"Unable to update password of other user\"))\n\t\treturn\n\t}\n\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\n\tvar password models.Password\n\tif err = json.Unmarshal(requestBody, &password); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\trepository := repositories.NewUsersRepository(db)\n\tsavedPassword, err := repository.SearchPassword(userID)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tif err = security.CheckPassword(password.Current, savedPassword); err != nil {\n\t\tresponses.Error(w, http.StatusUnauthorized, errors.New(\"Invalid password\"))\n\t\treturn\n\t}\n\n\thashedPassword, err := security.Hash(password.New)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err = repository.UpdatePassword(userID, string(hashedPassword)); err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusNoContent, nil)\n}", "title": "" }, { "docid": "daec052221e679b5407d114bed2bb3fa", "score": "0.47539955", "text": "func (body PUTUpdateAttributeValueRequest) Path() string {\n\treturn \"/values/update\"\n}", "title": "" }, { "docid": "ce6be5c30934a5c3178773715a386ff5", "score": "0.4748924", "text": "func (s *grpcServer) ChangePassword(ctx context.Context, r *pb.ChangePasswordRequest) (*pb.ChangePasswordResponse, error) {\n\t_, resp, err := s.changePassword.ServeGRPC(ctx, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.ChangePasswordResponse), nil\n}", "title": "" }, { "docid": "65126dcc4c3dbc78d7a1c3698fd1e9dd", "score": "0.4741154", "text": "func (u *UserHandler) updatePassword(w http.ResponseWriter, r *http.Request) {\n\n\tvar twoPass models.UpdatePassword\n\terr := easyjson.UnmarshalFromReader(r.Body, &twoPass)\n\tif err != nil {\n\t\tcustomerror.PostError(w, r, u.log, err, clientError.BadRequest)\n\t\treturn\n\t}\n\n\tusr, ok := r.Context().Value(packageConfig.RequestUser).(models.User)\n\tif !ok {\n\t\tcustomerror.PostError(w, r, u.log, errors.New(\"Unauthorized\"), clientError.Unauthorizied)\n\t\treturn\n\t}\n\n\terr = u.UserUseCase.ComparePassword(twoPass.OldPassword, usr.Password)\n\tif err != nil {\n\t\tcustomerror.PostError(w, r, u.log, errors.New(\"wrong old password\"), clientError.PaymentReq)\n\t\treturn\n\t}\n\tusr.Password = twoPass.NewPassword\n\terr = u.UserUseCase.UpdatePassword(usr)\n\tif err != nil {\n\t\tcustomerror.PostError(w, r, u.log, err, nil)\n\t\treturn\n\t}\n\tresponses.SendOkResponse(w)\n}", "title": "" }, { "docid": "22c1243ece74408ae5a217c16766e5c3", "score": "0.47378832", "text": "func (*ReverseProxyRedirection) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/redirection/%s\", ref)\n}", "title": "" }, { "docid": "3079d7424bc436773a878e500d2ed45c", "score": "0.4735448", "text": "func (body PUTUpdateAttributeRequest) Path() string {\n\treturn \"/update\"\n}", "title": "" }, { "docid": "2cf14fbffde94d542d298717b9e5ee2f", "score": "0.47165522", "text": "func SetUserConfigPath(path string) {\n\tusrDirPath = path\n}", "title": "" }, { "docid": "d8fcc6444fb470a0e1ee9951101edc4b", "score": "0.4708814", "text": "func UpdateUserPasswd(c *gin.Context) {\n\n\t_userid := c.Params.ByName(\"userid\")\n\t_old := c.Params.ByName(\"old\")\n\t_new := c.Params.ByName(\"new\")\n\n\tsumOld := sha256.Sum256([]byte(_old))\n\toldPasswd := fmt.Sprintf(\"%x\", sumOld)\n\n\t_, err := persist.GetPersist().Login(_userid, oldPasswd)\n\tif err != nil {\n\t\tc.JSON(http.StatusOK, gin.H{\"errcode\": 1, \"msg\": err.Error()})\n\t\treturn\n\t}\n\n\tsum := sha256.Sum256([]byte(_new))\n\tnewPasswd := fmt.Sprintf(\"%x\", sum)\n\n\terr = persist.GetPersist().UpdateUserPasswd(_userid, newPasswd)\n\tif err != nil {\n\t\tc.JSON(http.StatusOK, gin.H{\"errcode\": 1, \"msg\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"errcode\": 0, \"msg\": \"success\"})\n}", "title": "" }, { "docid": "a9aab3ec1a1c2fbe6d1f4198cccb3272", "score": "0.46923164", "text": "func (a *Client) ChangePassword(params *ChangePasswordParams, authInfo runtime.ClientAuthInfoWriter) (*ChangePasswordOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewChangePasswordParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ChangePassword\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/v1/users/password:change\",\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: &ChangePasswordReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ChangePasswordOK), nil\n\n}", "title": "" }, { "docid": "2a73c8c94515c66be7798cd0e7dc4923", "score": "0.46870345", "text": "func DeleteUserPath(organizationID int, userID int) string {\n\tparam0 := strconv.Itoa(organizationID)\n\tparam1 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/organizations/%s/users/%s\", param0, param1)\n}", "title": "" }, { "docid": "70e2c5bf1005e89b93a708b123017630", "score": "0.4684068", "text": "func (o ServiceReferencePatchPtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ServiceReferencePatch) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cb09bab4b3fb911170a772d4bda585a8", "score": "0.46819755", "text": "func RouteChangePassword(request *api.Request) api.Response {\n\tvar model = &ChangePasswordModel{}\n\n\tvar err = jsonutil.DeserializeJSON(request.Body, model)\n\tif err != nil {\n\t\treturn api.BadRequest(err)\n\t}\n\n\treturn changePassword(model)\n}", "title": "" }, { "docid": "f85094b1858b444e0c6c57707efb4ab4", "score": "0.46745273", "text": "func (o BackendServiceConsistentHashHttpCookieOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceConsistentHashHttpCookie) *string { return v.Path }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "31a9bdb948eff335e48c17ce798066fb", "score": "0.46712413", "text": "func (c *UserManagementModule) changePassword(password string) (err error) {\n\t_, err = executeCommand([]string{DsclPath, \".\", \"-passwd\", path.Join(\"Users\", c.User), password}, \"\", []string{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ec2macosinit: failed to set %s's password: %s\", c.User, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ded43a428acbcf2afbcd12cf75fe142a", "score": "0.46535194", "text": "func (o BackendServiceConsistentHashHttpCookiePtrOutput) Path() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BackendServiceConsistentHashHttpCookie) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Path\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a4c05c800226471379b0a6690f1aeff6", "score": "0.46464902", "text": "func (u UserResource) WebService() *restful.WebService {\n\tws := new(restful.WebService)\n\tws.\n\t\tPath(userResourceRootPath).\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON) // you can specify this per route as well\n\n\t// install webservice filters\n\tws.Filter(middleware.RequestIDRest)\n\tws.Filter(middleware.Logging)\n\n\ttags := []string{\"users\"}\n\n\tws.Route(ws.GET(\"/\").To(u.findAllUsers).\n\t\t// docs\n\t\tDoc(\"get all users\").\n\t\tMetadata(restfulspec.KeyOpenAPITags, tags).\n\t\tWrites([]User{}).\n\t\tReturns(200, \"OK\", []User{}))\n\n\tws.Route(ws.GET(\"/{user-id}\").To(u.findUser).\n\t\t// docs\n\t\tDoc(\"get a user\").\n\t\tParam(ws.PathParameter(\"user-id\", \"identifier of the user\").DataType(\"integer\").DefaultValue(\"1\")).\n\t\tMetadata(restfulspec.KeyOpenAPITags, tags).\n\t\tWrites(User{}). // on the response\n\t\tReturns(200, \"OK\", User{}).\n\t\tReturns(404, \"Not Found\", nil))\n\n\tws.Route(ws.PUT(\"/{user-id}\").To(u.updateUser).\n\t\t// docs\n\t\tDoc(\"update a user\").\n\t\tParam(ws.PathParameter(\"user-id\", \"identifier of the user\").DataType(\"string\")).\n\t\tMetadata(restfulspec.KeyOpenAPITags, tags).\n\t\tReads(User{})) // from the request\n\n\treturn ws\n}", "title": "" }, { "docid": "c112f37e9b8e73148016fe4f121c311a", "score": "0.4634756", "text": "func (u User) ChangePassword() error {\n\th := sha256.New()\n\tpass, err := b64.StdEncoding.DecodeString(u.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\th.Write([]byte(pass))\n\treturn u.DBClient.ChangeUserPassword(u.ID, fmt.Sprintf(\"%x\", h.Sum(nil)))\n}", "title": "" }, { "docid": "3027d26cdbdd8a1476de00d2ebe250f8", "score": "0.46290883", "text": "func SendValidationUserPath(userID int) string {\n\tparam0 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/users/%s/validate-email\", param0)\n}", "title": "" }, { "docid": "b6991ae6629484177829580b9ee69e8a", "score": "0.46279693", "text": "func (a *DefaultApiService) UpdateUserPassword1(ctx context.Context, body UpdateUserPasswordRequest) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/users/credentials\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"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 = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "5002dfce81c8a92a7b16d087e0e1b6a9", "score": "0.4624141", "text": "func (*ChangeCurrentUserPassword) Descriptor() ([]byte, []int) {\n\treturn file_uac_UserV2_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "eb22130aab0511bccf9b42cfffac8474", "score": "0.46225706", "text": "func ResetPassword(c *fiber.Ctx) error {\n\n\tdata := users.UserChangePasswordRequest{\n\t\tEmail: c.Params(\"user_email\"),\n\t\tNewPassword: \"Password\",\n\t}\n\n\tapiErr := services.UserService.ResetPassword(data)\n\tif apiErr != nil {\n\t\treturn c.Status(apiErr.Status()).JSON(apiErr)\n\t}\n\n\treturn c.JSON(fiber.Map{\"msg\": fmt.Sprintf(\"Password user %s berhasil di reset!\", c.Params(\"user_email\"))})\n}", "title": "" }, { "docid": "44f2dd79d8f9ae1cddd7a73b52684c1c", "score": "0.46220845", "text": "func RetrieveUserPath(organizationID int, userID int) string {\n\tparam0 := strconv.Itoa(organizationID)\n\tparam1 := strconv.Itoa(userID)\n\n\treturn fmt.Sprintf(\"/organizations/%s/users/%s\", param0, param1)\n}", "title": "" }, { "docid": "421693ae5e4ebac3ef1ec800c7917150", "score": "0.4619171", "text": "func (r *ReverseProxyAuthProfile) GetPath() string {\n\treturn fmt.Sprintf(\"/api/objects/reverse_proxy/auth_profile/%s\", r.Reference)\n}", "title": "" }, { "docid": "1021c1d9b3ecfd4d421581f695628eb0", "score": "0.46151757", "text": "func EditUser(ctx *context.APIContext) {\n\t// swagger:operation PATCH /admin/users/{username} admin adminEditUser\n\t// ---\n\t// summary: Edit an existing user\n\t// consumes:\n\t// - application/json\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: username\n\t// in: path\n\t// description: username of user to edit\n\t// type: string\n\t// required: true\n\t// - name: body\n\t// in: body\n\t// schema:\n\t// \"$ref\": \"#/definitions/EditUserOption\"\n\t// responses:\n\t// \"200\":\n\t// \"$ref\": \"#/responses/User\"\n\t// \"403\":\n\t// \"$ref\": \"#/responses/forbidden\"\n\t// \"422\":\n\t// \"$ref\": \"#/responses/validationError\"\n\n\tform := web.GetForm(ctx).(*api.EditUserOption)\n\n\tparseAuthSource(ctx, ctx.ContextUser, form.SourceID, form.LoginName)\n\tif ctx.Written() {\n\t\treturn\n\t}\n\n\tif len(form.Password) != 0 {\n\t\tif len(form.Password) < setting.MinPasswordLength {\n\t\t\tctx.Error(http.StatusBadRequest, \"PasswordTooShort\", fmt.Errorf(\"password must be at least %d characters\", setting.MinPasswordLength))\n\t\t\treturn\n\t\t}\n\t\tif !password.IsComplexEnough(form.Password) {\n\t\t\terr := errors.New(\"PasswordComplexity\")\n\t\t\tctx.Error(http.StatusBadRequest, \"PasswordComplexity\", err)\n\t\t\treturn\n\t\t}\n\t\tpwned, err := password.IsPwned(ctx, form.Password)\n\t\tif pwned {\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err.Error())\n\t\t\t}\n\t\t\tctx.Error(http.StatusBadRequest, \"PasswordPwned\", errors.New(\"PasswordPwned\"))\n\t\t\treturn\n\t\t}\n\t\tif ctx.ContextUser.Salt, err = user_model.GetUserSalt(); err != nil {\n\t\t\tctx.Error(http.StatusInternalServerError, \"UpdateUser\", err)\n\t\t\treturn\n\t\t}\n\t\tif err = ctx.ContextUser.SetPassword(form.Password); err != nil {\n\t\t\tctx.InternalServerError(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif form.MustChangePassword != nil {\n\t\tctx.ContextUser.MustChangePassword = *form.MustChangePassword\n\t}\n\n\tctx.ContextUser.LoginName = form.LoginName\n\n\tif form.FullName != nil {\n\t\tctx.ContextUser.FullName = *form.FullName\n\t}\n\tvar emailChanged bool\n\tif form.Email != nil {\n\t\temail := strings.TrimSpace(*form.Email)\n\t\tif len(email) == 0 {\n\t\t\tctx.Error(http.StatusUnprocessableEntity, \"\", fmt.Errorf(\"email is not allowed to be empty string\"))\n\t\t\treturn\n\t\t}\n\n\t\tif err := user_model.ValidateEmail(email); err != nil {\n\t\t\tctx.InternalServerError(err)\n\t\t\treturn\n\t\t}\n\n\t\temailChanged = !strings.EqualFold(ctx.ContextUser.Email, email)\n\t\tctx.ContextUser.Email = email\n\t}\n\tif form.Website != nil {\n\t\tctx.ContextUser.Website = *form.Website\n\t}\n\tif form.Location != nil {\n\t\tctx.ContextUser.Location = *form.Location\n\t}\n\tif form.Description != nil {\n\t\tctx.ContextUser.Description = *form.Description\n\t}\n\tif form.Active != nil {\n\t\tctx.ContextUser.IsActive = *form.Active\n\t}\n\tif len(form.Visibility) != 0 {\n\t\tctx.ContextUser.Visibility = api.VisibilityModes[form.Visibility]\n\t}\n\tif form.Admin != nil {\n\t\tctx.ContextUser.IsAdmin = *form.Admin\n\t}\n\tif form.AllowGitHook != nil {\n\t\tctx.ContextUser.AllowGitHook = *form.AllowGitHook\n\t}\n\tif form.AllowImportLocal != nil {\n\t\tctx.ContextUser.AllowImportLocal = *form.AllowImportLocal\n\t}\n\tif form.MaxRepoCreation != nil {\n\t\tctx.ContextUser.MaxRepoCreation = *form.MaxRepoCreation\n\t}\n\tif form.AllowCreateOrganization != nil {\n\t\tctx.ContextUser.AllowCreateOrganization = *form.AllowCreateOrganization\n\t}\n\tif form.ProhibitLogin != nil {\n\t\tctx.ContextUser.ProhibitLogin = *form.ProhibitLogin\n\t}\n\tif form.Restricted != nil {\n\t\tctx.ContextUser.IsRestricted = *form.Restricted\n\t}\n\n\tif err := user_model.UpdateUser(ctx, ctx.ContextUser, emailChanged); err != nil {\n\t\tif user_model.IsErrEmailAlreadyUsed(err) ||\n\t\t\tuser_model.IsErrEmailCharIsNotSupported(err) ||\n\t\t\tuser_model.IsErrEmailInvalid(err) {\n\t\t\tctx.Error(http.StatusUnprocessableEntity, \"\", err)\n\t\t} else {\n\t\t\tctx.Error(http.StatusInternalServerError, \"UpdateUser\", err)\n\t\t}\n\t\treturn\n\t}\n\tlog.Trace(\"Account profile updated by admin (%s): %s\", ctx.Doer.Name, ctx.ContextUser.Name)\n\n\tctx.JSON(http.StatusOK, convert.ToUser(ctx, ctx.ContextUser, ctx.Doer))\n}", "title": "" }, { "docid": "921e95f855a02e8a45f92d9b84cd0d68", "score": "0.46144688", "text": "func (c *Client) ResetPassword() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeResetPasswordRequest(c.encoder)\n\t\tdecodeResponse = DecodeResetPasswordResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildResetPasswordRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.ResetPasswordDoer.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"user_service\", \"resetPassword\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "title": "" }, { "docid": "d5b701c019be67d4a07622ed2919ee5b", "score": "0.46142027", "text": "func (e *ExternalInterface) UpdateRemoteAccountPasswordService(ctx context.Context, req *managersproto.ManagerRequest) {\n\ttarget, err := mgrmodel.GetTempPassword(req.ManagerID)\n\tif err != nil {\n\t\terrMsg := \"no password found: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\treturn\n\t}\n\tif err := mgrmodel.UpdateSystem(target.DeviceUUID, target); err != nil {\n\t\terrMsg := \"error while update password : \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\treturn\n\t}\n\tif err := mgrmodel.DeleteTempPassword(req.ManagerID); err != nil {\n\t\terrMsg := \"error while delete temp password : \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\treturn\n\t}\n\tl.LogWithFields(ctx).Info(\"Password updated successfully for device \" + target.DeviceUUID)\n}", "title": "" }, { "docid": "7a90069995f4bdbf7989bbd448e79782", "score": "0.4610379", "text": "func (usr UserInfo) ChangePassword(roleID string) error {\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(usr.Password), 5)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"internal server error, %v\", err)\n\t}\n\n\tusr.Password = string(hash)\n\n\tif roleID == apicontext.CustomerRole {\n\t\terr = mongodb.Update(mongodb.CustomerCollection, bson.M{\"_id\": bson.ObjectIdHex(usr.UserID)}, bson.M{\"$set\": bson.M{\"pswd\": usr.Password}})\n\t} else if roleID == apicontext.AdminRole {\n\t\terr = mongodb.Update(mongodb.AdminCollection, bson.M{\"_id\": bson.ObjectIdHex(usr.UserID)}, bson.M{\"$set\": bson.M{\"pswd\": usr.Password}})\n\t} else {\n\t\terr = errors.New(\"user role not authentic\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "8d07e2787f8f695f2469d9901a9464ae", "score": "0.4592196", "text": "func (i Systemd) ServiceScriptPath(h Host, s string) (string, error) {\n\treturn h.ExecOutputf(`sudo -s systemctl show -p FragmentPath %s.service 2> /dev/null | cut -d\"=\" -f2`, s)\n}", "title": "" }, { "docid": "1a1d234a813a9642915f37ff4ee02088", "score": "0.45832357", "text": "func (s *systemDRecord) servicePath() string {\n\treturn \"/etc/systemd/system/\" + s.serviceName()\n}", "title": "" }, { "docid": "18b4a1781509c25cbabd43ba51aa92f2", "score": "0.45804772", "text": "func (ds *DataBase) UpdateUserPassword(user data.User) error {\n\t_, err := ds.db.NamedExec(\"UPDATE users SET password_hash=:password_hash WHERE username=:username\", user)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w : %s\", data.ErrSql, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "978c4c870819173c1f69b16409bd02fa", "score": "0.45775372", "text": "func (*DhcpServer6) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/dhcp/server6/%s\", ref)\n}", "title": "" } ]
236862dbd9448a6fd5c7bbbf5959859d
Default returns the default "typed" type for an "untyped" type; it returns the incoming type for all other types. The default type for untyped nil is untyped nil.
[ { "docid": "d3ea081f376ccda5dfe0110c1d14b0bd", "score": "0.6644201", "text": "func Default(pkg *Package, t types.Type) types.Type {\n\treturn DefaultConv(pkg, t, nil)\n}", "title": "" } ]
[ { "docid": "fad68b8fba6b7a5d418183a6e1793a05", "score": "0.653187", "text": "func ToTypeWithDefault(typ TypeCode, value interface{}, defaultValue interface{}) interface{} {\n\tif value == nil {\n\t\treturn defaultValue\n\t}\n\n\t// Convert to known types\n\tif typ == String {\n\t\tval, _ := defaultValue.(string)\n\t\treturn ToStringWithDefault(value, val)\n\t} else if typ == Boolean {\n\t\tval, _ := defaultValue.(bool)\n\t\treturn BooleanConverter.ToBooleanWithDefault(value, val)\n\t} else if typ == Integer {\n\t\tval, _ := defaultValue.(int)\n\t\treturn IntegerConverter.ToIntegerWithDefault(value, val)\n\t} else if typ == Long {\n\t\tval, _ := defaultValue.(int64)\n\t\treturn LongConverter.ToLongWithDefault(value, val)\n\t} else if typ == Float {\n\t\tval, _ := defaultValue.(float32)\n\t\treturn FloatConverter.ToFloatWithDefault(value, val)\n\t} else if typ == Double {\n\t\tval, _ := defaultValue.(float64)\n\t\treturn DoubleConverter.ToDoubleWithDefault(value, val)\n\t} else if typ == DateTime {\n\t\tval, _ := defaultValue.(time.Time)\n\t\treturn DateTimeConverter.ToDateTimeWithDefault(value, val)\n\t} else if typ == Duration {\n\t\tval, _ := defaultValue.(time.Duration)\n\t\treturn DurationConverter.ToDurationWithDefault(value, val)\n\t} else if typ == Array {\n\t\tval, _ := defaultValue.([]interface{})\n\t\treturn ArrayConverter.ToArrayWithDefault(value, val)\n\t} else if typ == Map {\n\t\tval, _ := defaultValue.(map[string]interface{})\n\t\treturn MapConverter.ToMapWithDefault(value, val)\n\t} else {\n\t\treturn defaultValue\n\t}\n}", "title": "" }, { "docid": "e8bfefd42763b4db51f38844c4ef7175", "score": "0.6396005", "text": "func (d *DefaultDict) getDefault() defaultType {\n\tt := reflect.ValueOf(d.DefaultFactory)\n\n\tswitch t.Kind() {\n\t// bool\n\tcase reflect.Bool:\n\t\treturn false\n\t// int types\n\tcase reflect.Int:\n\t\treturn int(0)\n\tcase reflect.Int8:\n\t\treturn int8(0)\n\tcase reflect.Int32:\n\t\treturn int32(0)\n\tcase reflect.Int64:\n\t\treturn int64(0)\n\t// uint types\n\tcase reflect.Uint:\n\t\treturn uint(0)\n\tcase reflect.Uint8:\n\t\treturn uint8(0)\n\tcase reflect.Uint32:\n\t\treturn uint32(0)\n\tcase reflect.Uint64:\n\t\treturn uint64(0)\n\t// float types\n\tcase reflect.Float32:\n\t\treturn float32(0)\n\tcase reflect.Float64:\n\t\treturn float64(0)\n\t// string\n\tcase reflect.String:\n\t\treturn string(\"\")\n\t// more complex types created with make\n\tcase reflect.Slice:\n\t\ts := make([]interface{}, 0)\n\t\treturn s\n\tcase reflect.Map:\n\t\tm := make(map[interface{}]interface{})\n\t\treturn m\n\tcase reflect.Chan:\n\t\tc := make(chan interface{}, 0)\n\t\treturn c\n\t// return nil if we can't get type by reflection\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "d907f3791f19a7ee3de92b2d70db5ae5", "score": "0.6214732", "text": "func DefaultTypeForValue(value interface{}) *FieldType {\n\tswitch x := value.(type) {\n\tcase nil:\n\t\treturn NewFieldType(mysql.TypeNull)\n\tcase bool, int64, int:\n\t\treturn NewFieldType(mysql.TypeLonglong)\n\tcase uint64:\n\t\ttp := NewFieldType(mysql.TypeLonglong)\n\t\ttp.Flag |= mysql.UnsignedFlag\n\t\treturn tp\n\tcase string:\n\t\ttp := NewFieldType(mysql.TypeVarchar)\n\t\ttp.Charset = mysql.DefaultCharset\n\t\ttp.Collate = mysql.DefaultCollationName\n\t\treturn tp\n\tcase float64:\n\t\treturn NewFieldType(mysql.TypeNewDecimal)\n\tcase []byte:\n\t\ttp := NewFieldType(mysql.TypeBlob)\n\t\ttp.Charset = charset.CharsetBin\n\t\ttp.Collate = charset.CharsetBin\n\t\treturn tp\n\tcase mysql.Bit:\n\t\treturn NewFieldType(mysql.TypeBit)\n\tcase mysql.Hex:\n\t\ttp := NewFieldType(mysql.TypeVarchar)\n\t\ttp.Charset = charset.CharsetBin\n\t\ttp.Collate = charset.CharsetBin\n\t\treturn tp\n\tcase mysql.Time:\n\t\treturn NewFieldType(x.Type)\n\tcase mysql.Duration:\n\t\treturn NewFieldType(mysql.TypeDuration)\n\tcase mysql.Decimal:\n\t\treturn NewFieldType(mysql.TypeNewDecimal)\n\tcase mysql.Enum:\n\t\treturn NewFieldType(mysql.TypeEnum)\n\tcase mysql.Set:\n\t\treturn NewFieldType(mysql.TypeSet)\n\tcase *DataItem:\n\t\treturn x.Type\n\t}\n\tlog.Errorf(\"Unknown value type %T for default field type.\", value)\n\treturn nil\n}", "title": "" }, { "docid": "85a06141f0ff2813f49317f6caf3d274", "score": "0.6150809", "text": "func (c *TTypeConverter) ToTypeWithDefault(typ TypeCode, value interface{}, defaultValue interface{}) interface{} {\n\treturn ToTypeWithDefault(typ, value, defaultValue)\n}", "title": "" }, { "docid": "fd55c08a1bfcd371a34e6ee8f003db8f", "score": "0.5958822", "text": "func DefaultTypeOfKind(kind reflect.Kind) Type {\n\treturn kindTypes[kind]\n}", "title": "" }, { "docid": "fd55c08a1bfcd371a34e6ee8f003db8f", "score": "0.5958822", "text": "func DefaultTypeOfKind(kind reflect.Kind) Type {\n\treturn kindTypes[kind]\n}", "title": "" }, { "docid": "550ccbdb03cdbeaddd210ec5ba2cbf0f", "score": "0.55490714", "text": "func basicType(rt reflect.Type) *Type {\n\tfor rt.Kind() == reflect.Ptr {\n\t\trt = rt.Elem()\n\t}\n\tswitch rt {\n\tcase rtError:\n\t\t// TODO(bprosnitz) Remove this for new vdl error logic\n\t\treturn ErrorType\n\tcase rtInterface, rtValue:\n\t\treturn AnyType\n\tcase rtType:\n\t\treturn TypeObjectType\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84809f0397187ce9f67bdb3247621be8", "score": "0.53956807", "text": "func (f *Field) DefaultTypeName() TypeName {\n\treturn f.defaultTypeName\n}", "title": "" }, { "docid": "a6f3a08c0718a1e9a9eaa98b151f1c26", "score": "0.5389076", "text": "func (me XsdGoPkgHasAttr_Type_TNodeType_Node) TypeDefault() TNodeType { return TNodeType(\"NODE\") }", "title": "" }, { "docid": "278a9995c180f8de19b95e55ff135182", "score": "0.5278191", "text": "func defaultTypeHandlers() map[SchemaType]TypeHandler {\n\treturn map[SchemaType]TypeHandler{\n\t\tArray: arrayHandler,\n\t\tOneOf: oneOfHandler,\n\t\tAnyOf: anyOfHandler,\n\t\tAllOf: allOfHandler,\n\t\tRef: refHandler,\n\t\tObject: objectHandler,\n\t\tEnum: enumHandler,\n\t\tString: fixedTypeHandler(astmodel.StringType, \"string\"),\n\t\tInt: fixedTypeHandler(astmodel.IntType, \"int\"),\n\t\tNumber: fixedTypeHandler(astmodel.FloatType, \"number\"),\n\t\tBool: fixedTypeHandler(astmodel.BoolType, \"bool\"),\n\t}\n}", "title": "" }, { "docid": "083736277022a0b75a94a49023ced331", "score": "0.52412397", "text": "func NewUnTyped() Type {\n\treturn &unTyped{}\n}", "title": "" }, { "docid": "d76cd0c6cec5921b1a341ec511786074", "score": "0.5218289", "text": "func Default(typ types.TypeID) Tokenizer {\n\tt, found := defaults[typ]\n\tx.AssertTruef(found, \"No default tokenizer set for type %v\", typ)\n\treturn t\n}", "title": "" }, { "docid": "f13a1b75c01143f7bb0a717a2213aac5", "score": "0.515768", "text": "func newDefaultValue(typ reflect.Type) (skylark.Value, error) {\n\tswitch typ.Kind() {\n\tcase reflect.Bool:\n\t\treturn skylark.False, nil\n\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn skylark.Float(0), nil\n\n\tcase reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64:\n\t\treturn skylark.MakeInt(0), nil\n\n\tcase reflect.String:\n\t\treturn skylark.String(\"\"), nil\n\n\tcase reflect.Slice: // this is either a repeated field or 'bytes'\n\t\treturn skylark.NewList(nil), nil\n\n\tcase reflect.Ptr: // a message field (*Struct) or proto2 scalar field (*int64)\n\t\tif typ.Elem().Kind() != reflect.Struct {\n\t\t\treturn nil, errNoProto2\n\t\t}\n\t\tt, err := GetMessageType(typ)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"can't instantiate value for go type %q - %s\", typ, err)\n\t\t}\n\t\treturn NewMessage(t), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"do not know how to instantiate skylark value for go type %q\", typ)\n}", "title": "" }, { "docid": "0d6e471e5aec15a55ae852001670f398", "score": "0.5114247", "text": "func yangBuiltinTypeToGoType(t yang.TypeKind) interface{} {\n\tswitch t {\n\tcase yang.Yint8:\n\t\treturn int8(0)\n\tcase yang.Yint16:\n\t\treturn int16(0)\n\tcase yang.Yint32:\n\t\treturn int32(0)\n\tcase yang.Yint64:\n\t\treturn int64(0)\n\tcase yang.Yuint8:\n\t\treturn uint8(0)\n\tcase yang.Yuint16:\n\t\treturn uint16(0)\n\tcase yang.Yuint32:\n\t\treturn uint32(0)\n\tcase yang.Yuint64:\n\t\treturn uint64(0)\n\tcase yang.Ybool, yang.Yempty:\n\t\treturn bool(false)\n\tcase yang.Ystring:\n\t\treturn string(\"\")\n\tcase yang.Ydecimal64:\n\t\treturn float64(0)\n\tcase yang.Ybinary:\n\t\treturn []byte(nil)\n\tcase yang.Yenum, yang.Yidentityref:\n\t\treturn int64(0)\n\tdefault:\n\t\t// TODO(mostrowski): handle bitset.\n\t\tlog.Errorf(\"unexpected type %v in yangBuiltinTypeToGoPtrType\", t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cbb687c31c98c4a53d7a40d9b32ac2f", "score": "0.5109581", "text": "func (g *irgen) typ0(typ types2.Type) *types.Type {\n\tswitch typ := typ.(type) {\n\tcase *types2.Basic:\n\t\treturn g.basic(typ)\n\tcase *types2.Named:\n\t\t// If tparams is set, but targs is not, typ is a base generic\n\t\t// type. typ is appearing as part of the source type of an alias,\n\t\t// since that is the only use of a generic type that doesn't\n\t\t// involve instantiation. We just translate the named type in the\n\t\t// normal way below using g.obj().\n\t\tif typ.TypeParams() != nil && typ.TypeArgs() != nil {\n\t\t\t// typ is an instantiation of a defined (named) generic type.\n\t\t\t// This instantiation should also be a defined (named) type.\n\t\t\t// types2 gives us the substituted type in t.Underlying()\n\t\t\t// The substituted type may or may not still have type\n\t\t\t// params. We might, for example, be substituting one type\n\t\t\t// param for another type param.\n\t\t\t//\n\t\t\t// When converted to types.Type, typ has a unique name,\n\t\t\t// based on the names of the type arguments.\n\t\t\tinstName := g.instTypeName2(typ.Obj().Name(), typ.TypeArgs())\n\t\t\ts := g.pkg(typ.Obj().Pkg()).Lookup(instName)\n\n\t\t\t// Make sure the base generic type exists in type1 (it may\n\t\t\t// not yet if we are referecing an imported generic type, as\n\t\t\t// opposed to a generic type declared in this package). Make\n\t\t\t// sure to do this lookup before checking s.Def, in case\n\t\t\t// s.Def gets defined while importing base (if an imported\n\t\t\t// type). (Issue #50486).\n\t\t\tbase := g.obj(typ.Origin().Obj())\n\n\t\t\tif s.Def != nil {\n\t\t\t\t// We have already encountered this instantiation.\n\t\t\t\t// Use the type we previously created, since there\n\t\t\t\t// must be exactly one instance of a defined type.\n\t\t\t\treturn s.Def.Type()\n\t\t\t}\n\n\t\t\tif base.Class == ir.PAUTO {\n\t\t\t\t// If the base type is a local type, we want to pop\n\t\t\t\t// this instantiated type symbol/definition when we\n\t\t\t\t// leave the containing block, so we don't use it\n\t\t\t\t// incorrectly later.\n\t\t\t\ttypes.Pushdcl(s)\n\t\t\t}\n\n\t\t\t// Create a forwarding type first and put it in the g.typs\n\t\t\t// map, in order to deal with recursive generic types\n\t\t\t// (including via method signatures). Set up the extra\n\t\t\t// ntyp information (Def, RParams, which may set\n\t\t\t// HasTParam) before translating the underlying type\n\t\t\t// itself, so we handle recursion correctly.\n\t\t\tntyp := typecheck.NewIncompleteNamedType(g.pos(typ.Obj().Pos()), s)\n\t\t\tg.typs[typ] = ntyp\n\n\t\t\t// If ntyp still has type params, then we must be\n\t\t\t// referencing something like 'value[T2]', as when\n\t\t\t// specifying the generic receiver of a method, where\n\t\t\t// value was defined as \"type value[T any] ...\". Save the\n\t\t\t// type args, which will now be the new typeparams of the\n\t\t\t// current type.\n\t\t\t//\n\t\t\t// If ntyp does not have type params, we are saving the\n\t\t\t// non-generic types used to instantiate this type. We'll\n\t\t\t// use these when instantiating the methods of the\n\t\t\t// instantiated type.\n\t\t\ttargs := typ.TypeArgs()\n\t\t\trparams := make([]*types.Type, targs.Len())\n\t\t\tfor i := range rparams {\n\t\t\t\trparams[i] = g.typ1(targs.At(i))\n\t\t\t}\n\t\t\tntyp.SetRParams(rparams)\n\t\t\t//fmt.Printf(\"Saw new type %v %v\\n\", instName, ntyp.HasTParam())\n\n\t\t\t// Save the symbol for the base generic type.\n\t\t\tntyp.SetOrigType(base.Type())\n\t\t\tntyp.SetUnderlying(g.typ1(typ.Underlying()))\n\t\t\tif typ.NumMethods() != 0 {\n\t\t\t\t// Save a delayed call to g.fillinMethods() (once\n\t\t\t\t// potentially recursive types have been fully\n\t\t\t\t// resolved).\n\t\t\t\tg.typesToFinalize = append(g.typesToFinalize,\n\t\t\t\t\t&typeDelayInfo{\n\t\t\t\t\t\ttyp: typ,\n\t\t\t\t\t\tntyp: ntyp,\n\t\t\t\t\t})\n\t\t\t}\n\t\t\treturn ntyp\n\t\t}\n\t\tobj := g.obj(typ.Obj())\n\t\tif obj.Op() != ir.OTYPE {\n\t\t\tbase.FatalfAt(obj.Pos(), \"expected type: %L\", obj)\n\t\t}\n\t\treturn obj.Type()\n\n\tcase *types2.Array:\n\t\treturn types.NewArray(g.typ1(typ.Elem()), typ.Len())\n\tcase *types2.Chan:\n\t\treturn types.NewChan(g.typ1(typ.Elem()), dirs[typ.Dir()])\n\tcase *types2.Map:\n\t\treturn types.NewMap(g.typ1(typ.Key()), g.typ1(typ.Elem()))\n\tcase *types2.Pointer:\n\t\treturn types.NewPtr(g.typ1(typ.Elem()))\n\tcase *types2.Signature:\n\t\treturn g.signature(nil, typ)\n\tcase *types2.Slice:\n\t\treturn types.NewSlice(g.typ1(typ.Elem()))\n\n\tcase *types2.Struct:\n\t\tfields := make([]*types.Field, typ.NumFields())\n\t\tfor i := range fields {\n\t\t\tv := typ.Field(i)\n\t\t\tf := types.NewField(g.pos(v), g.selector(v), g.typ1(v.Type()))\n\t\t\tf.Note = typ.Tag(i)\n\t\t\tif v.Embedded() {\n\t\t\t\tf.Embedded = 1\n\t\t\t}\n\t\t\tfields[i] = f\n\t\t}\n\t\treturn types.NewStruct(g.tpkg(typ), fields)\n\n\tcase *types2.Interface:\n\t\tembeddeds := make([]*types.Field, typ.NumEmbeddeds())\n\t\tj := 0\n\t\tfor i := range embeddeds {\n\t\t\t// TODO(mdempsky): Get embedding position.\n\t\t\te := typ.EmbeddedType(i)\n\n\t\t\t// With Go 1.18, an embedded element can be any type, not\n\t\t\t// just an interface.\n\t\t\tembeddeds[j] = types.NewField(src.NoXPos, nil, g.typ1(e))\n\t\t\tj++\n\t\t}\n\t\tembeddeds = embeddeds[:j]\n\n\t\tmethods := make([]*types.Field, typ.NumExplicitMethods())\n\t\tfor i := range methods {\n\t\t\tm := typ.ExplicitMethod(i)\n\t\t\tmtyp := g.signature(types.FakeRecv(), m.Type().(*types2.Signature))\n\t\t\tmethods[i] = types.NewField(g.pos(m), g.selector(m), mtyp)\n\t\t}\n\n\t\treturn types.NewInterface(g.tpkg(typ), append(embeddeds, methods...), typ.IsImplicit())\n\n\tcase *types2.TypeParam:\n\t\t// Save the name of the type parameter in the sym of the type.\n\t\t// Include the types2 subscript in the sym name\n\t\tpkg := g.tpkg(typ)\n\t\t// Create the unique types1 name for a type param, using its context\n\t\t// with a function, type, or method declaration. Also, map blank type\n\t\t// param names to a unique name based on their type param index. The\n\t\t// unique blank names will be exported, but will be reverted during\n\t\t// types2 and gcimporter import.\n\t\tassert(g.curDecl != \"\")\n\t\tnm := typecheck.TparamExportName(g.curDecl, typ.Obj().Name(), typ.Index())\n\t\tsym := pkg.Lookup(nm)\n\t\tif sym.Def != nil {\n\t\t\t// Make sure we use the same type param type for the same\n\t\t\t// name, whether it is created during types1-import or\n\t\t\t// this types2-to-types1 translation.\n\t\t\treturn sym.Def.Type()\n\t\t}\n\t\ttp := types.NewTypeParam(sym, typ.Index())\n\t\tnname := ir.NewDeclNameAt(g.pos(typ.Obj().Pos()), ir.OTYPE, sym)\n\t\tsym.Def = nname\n\t\tnname.SetType(tp)\n\t\ttp.SetNod(nname)\n\t\t// Set g.typs[typ] in case the bound methods reference typ.\n\t\tg.typs[typ] = tp\n\n\t\tbound := g.typ1(typ.Constraint())\n\t\ttp.SetBound(bound)\n\t\treturn tp\n\n\tcase *types2.Union:\n\t\tnt := typ.Len()\n\t\ttlist := make([]*types.Type, nt)\n\t\ttildes := make([]bool, nt)\n\t\tfor i := range tlist {\n\t\t\tt := typ.Term(i)\n\t\t\ttlist[i] = g.typ1(t.Type())\n\t\t\ttildes[i] = t.Tilde()\n\t\t}\n\t\treturn types.NewUnion(tlist, tildes)\n\n\tcase *types2.Tuple:\n\t\t// Tuples are used for the type of a function call (i.e. the\n\t\t// return value of the function).\n\t\tif typ == nil {\n\t\t\treturn (*types.Type)(nil)\n\t\t}\n\t\tfields := make([]*types.Field, typ.Len())\n\t\tfor i := range fields {\n\t\t\tfields[i] = g.param(typ.At(i))\n\t\t}\n\t\tt := types.NewStruct(types.LocalPkg, fields)\n\t\tt.StructType().Funarg = types.FunargResults\n\t\treturn t\n\n\tdefault:\n\t\tbase.FatalfAt(src.NoXPos, \"unhandled type: %v (%T)\", typ, typ)\n\t\tpanic(\"unreachable\")\n\t}\n}", "title": "" }, { "docid": "64880dd4c55646f1ccf13a32e08619cb", "score": "0.50943595", "text": "func (d Node) Type() Type {\n\tif len(d) == 0 {\n\t\treturn UNKNOWN\n\t}\n\n\treturn d[0]\n}", "title": "" }, { "docid": "677f7793737e7d71e6fb91d038bc8b9a", "score": "0.5070462", "text": "func WithDefaultVarType(value VarType) Option {\n\treturn func(opts *options) {\n\t\topts.defaultType = value\n\t}\n}", "title": "" }, { "docid": "cbf8992f25c4f233e8cbac14d5a0ad99", "score": "0.50377846", "text": "func (c *CarbonIngesterAggregationConfiguration) TypeOrDefault() aggregation.Type {\n\tif c.Type != nil {\n\t\treturn *c.Type\n\t}\n\n\treturn defaultCarbonIngesterAggregationType\n}", "title": "" }, { "docid": "99cc20ddec4d8a48dea38f8acd2aa53e", "score": "0.49846533", "text": "func New() Type {\n\treturn make(Type)\n}", "title": "" }, { "docid": "26a0fe1164d371e5795e7d72ad1aa5a8", "score": "0.49533015", "text": "func nomsTypeToGraphQLType(nomsType *types.Type, boxedIfScalar bool, tm *typeMap) graphql.Type {\n\tkey := typeMapKey{nomsType.Hash(), boxedIfScalar}\n\tgqlType, ok := (*tm)[key]\n\tif ok {\n\t\treturn gqlType\n\t}\n\n\t// In order to handle cycles, we eagerly create the type so we can put it into the cache before\n\t// creating any subtypes. Since all noms-types are non-nullable, the graphql NonNull creates a\n\t// handy piece of state for us to mutate once the subtype is fully created\n\tnewNonNull := &graphql.NonNull{}\n\t(*tm)[key] = newNonNull\n\n\tswitch nomsType.Kind() {\n\tcase types.NumberKind:\n\t\tnewNonNull.OfType = graphql.Float\n\t\tif boxedIfScalar {\n\t\t\tnewNonNull.OfType = scalarToValue(nomsType, newNonNull.OfType, tm)\n\t\t}\n\n\tcase types.StringKind:\n\t\tnewNonNull.OfType = graphql.String\n\t\tif boxedIfScalar {\n\t\t\tnewNonNull.OfType = scalarToValue(nomsType, newNonNull.OfType, tm)\n\t\t}\n\n\tcase types.BoolKind:\n\t\tnewNonNull.OfType = graphql.Boolean\n\t\tif boxedIfScalar {\n\t\t\tnewNonNull.OfType = scalarToValue(nomsType, newNonNull.OfType, tm)\n\t\t}\n\n\tcase types.StructKind:\n\t\tnewNonNull.OfType = structToGQLObject(nomsType, tm)\n\n\tcase types.ListKind, types.SetKind:\n\t\tnomsValueType := nomsType.Desc.(types.CompoundDesc).ElemTypes[0]\n\t\tvar valueType graphql.Type\n\t\tif !isEmptyNomsUnion(nomsValueType) {\n\t\t\tvalueType = nomsTypeToGraphQLType(nomsValueType, false, tm)\n\t\t}\n\n\t\tnewNonNull.OfType = collectionToGraphQLObject(nomsType, valueType, tm)\n\n\tcase types.MapKind:\n\t\tnomsKeyType := nomsType.Desc.(types.CompoundDesc).ElemTypes[0]\n\t\tnomsValueType := nomsType.Desc.(types.CompoundDesc).ElemTypes[1]\n\t\tvar valueType graphql.Type\n\t\tif !isEmptyNomsUnion(nomsKeyType) && !isEmptyNomsUnion(nomsValueType) {\n\t\t\tvalueType = mapEntryToGraphQLObject(nomsKeyType, nomsValueType, tm)\n\t\t}\n\n\t\tnewNonNull.OfType = collectionToGraphQLObject(nomsType, valueType, tm)\n\n\tcase types.RefKind:\n\t\tnewNonNull.OfType = refToGraphQLObject(nomsType, tm)\n\n\tcase types.UnionKind:\n\t\tnewNonNull.OfType = unionToGQLUnion(nomsType, tm)\n\n\tcase types.BlobKind, types.ValueKind, types.TypeKind:\n\t\t// TODO: https://github.com/attic-labs/noms/issues/3155\n\t\tnewNonNull.OfType = graphql.String\n\n\tcase types.CycleKind:\n\t\tpanic(\"not reached\") // we should never attempt to create a schedule for any unresolved cycle\n\n\tdefault:\n\t\tpanic(\"not reached\")\n\t}\n\n\treturn newNonNull\n}", "title": "" }, { "docid": "71788dd61476e8241bd721257dedfdbc", "score": "0.4947661", "text": "func (pkg *Package) marshalType(t Type, plain bool) TypeSpec {\n\tswitch t := t.(type) {\n\tcase *InputType:\n\t\tel := pkg.marshalType(t.ElementType, plain)\n\t\tel.Plain = false\n\t\treturn el\n\tcase *ArrayType:\n\t\tel := pkg.marshalType(t.ElementType, plain)\n\t\treturn TypeSpec{\n\t\t\tType: \"array\",\n\t\t\tItems: &el,\n\t\t\tPlain: !plain,\n\t\t}\n\tcase *MapType:\n\t\tel := pkg.marshalType(t.ElementType, plain)\n\t\treturn TypeSpec{\n\t\t\tType: \"object\",\n\t\t\tAdditionalProperties: &el,\n\t\t\tPlain: !plain,\n\t\t}\n\tcase *UnionType:\n\t\toneOf := make([]TypeSpec, len(t.ElementTypes))\n\t\tfor i, el := range t.ElementTypes {\n\t\t\toneOf[i] = pkg.marshalType(el, plain)\n\t\t}\n\n\t\tdefaultType := \"\"\n\t\tif t.DefaultType != nil {\n\t\t\tdefaultType = pkg.marshalType(t.DefaultType, plain).Type\n\t\t}\n\n\t\tvar discriminator *DiscriminatorSpec\n\t\tif t.Discriminator != \"\" {\n\t\t\tdiscriminator = &DiscriminatorSpec{\n\t\t\t\tPropertyName: t.Discriminator,\n\t\t\t\tMapping: t.Mapping,\n\t\t\t}\n\t\t}\n\n\t\treturn TypeSpec{\n\t\t\tType: defaultType,\n\t\t\tOneOf: oneOf,\n\t\t\tDiscriminator: discriminator,\n\t\t\tPlain: !plain,\n\t\t}\n\tcase *ObjectType:\n\t\treturn TypeSpec{Ref: pkg.marshalTypeRef(t.PackageReference, \"types\", t.Token)}\n\tcase *EnumType:\n\t\treturn TypeSpec{Ref: pkg.marshalTypeRef(t.PackageReference, \"types\", t.Token)}\n\tcase *ResourceType:\n\t\treturn TypeSpec{Ref: pkg.marshalTypeRef(t.Resource.PackageReference, \"resources\", t.Token)}\n\tcase *TokenType:\n\t\tvar defaultType string\n\t\tif t.UnderlyingType != nil {\n\t\t\tdefaultType = pkg.marshalType(t.UnderlyingType, plain).Type\n\t\t}\n\n\t\treturn TypeSpec{\n\t\t\tType: defaultType,\n\t\t\tRef: pkg.marshalTypeRef(pkg.Reference(), \"types\", t.Token),\n\t\t}\n\tdefault:\n\t\tswitch t {\n\t\tcase BoolType:\n\t\t\treturn TypeSpec{Type: \"boolean\"}\n\t\tcase StringType:\n\t\t\treturn TypeSpec{Type: \"string\"}\n\t\tcase IntType:\n\t\t\treturn TypeSpec{Type: \"integer\"}\n\t\tcase NumberType:\n\t\t\treturn TypeSpec{Type: \"number\"}\n\t\tcase AnyType:\n\t\t\treturn TypeSpec{Ref: \"pulumi.json#/Any\"}\n\t\tcase ArchiveType:\n\t\t\treturn TypeSpec{Ref: \"pulumi.json#/Archive\"}\n\t\tcase AssetType:\n\t\t\treturn TypeSpec{Ref: \"pulumi.json#/Asset\"}\n\t\tcase JSONType:\n\t\t\treturn TypeSpec{Ref: \"pulumi.json#/Json\"}\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unexepcted type %v (%T)\", t, t))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f8c4464c7fac8e944082a32460c9051", "score": "0.49433538", "text": "func (v Val) Type() bsontype.Type {\n\tif v.t == bsontype.Type(0) {\n\t\treturn bsontype.Null\n\t}\n\treturn v.t\n}", "title": "" }, { "docid": "c20eb037b568d19fb02a56e2c24a21cc", "score": "0.4917417", "text": "func (its *DatatypeDoc) GetType() model.TypeOfDatatype {\n\treturn model.TypeOfDatatype(model.TypeOfDatatype_value[its.Type])\n}", "title": "" }, { "docid": "850f0fd246bac3f69ace02d95ee1c251", "score": "0.49148253", "text": "func (o HookDefaultVersionOutput) TypeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HookDefaultVersion) pulumi.StringPtrOutput { return v.TypeName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0a0fc70a92ff01a538aca7e511333f4b", "score": "0.49057296", "text": "func (p Ptr) Default(def []byte) (Ptr, error) {\n\tif !p.IsValid() {\n\t\treturn unmarshalDefault(def)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "5da1132ed2c5095e4a7b7b1901bb641d", "score": "0.4886728", "text": "func Default(method, contentType string) Binding {\n\tif method == \"GET\" {\n\t\treturn Form\n\t}\n\n\tswitch contentType {\n\tcase MIMEJSON:\n\t\treturn JSON\n\tcase MIMEXML, MIMEXML2:\n\t\treturn XML\n\tcase MIMEPROTOBUF:\n\t\treturn ProtoBuf\n\tcase MIMEMSGPACK, MIMEMSGPACK2:\n\t\treturn MsgPack\n\tcase MIMEYAML:\n\t\treturn YAML\n\tcase MIMEMultipartPOSTForm:\n\t\treturn FormMultipart\n\tdefault: // case MIMEPOSTForm:\n\t\treturn Form\n\t}\n}", "title": "" }, { "docid": "f49464273db434d62695287c9d6cc578", "score": "0.48853636", "text": "func DefaultAny(inputValue interface{}, defaultValue interface{}) (_result interface{}) {\n\tif tea.BoolValue(util.IsUnset(inputValue)) {\n\t\t_result = defaultValue\n\t\treturn _result\n\t}\n\n\t_result = inputValue\n\treturn _result\n}", "title": "" }, { "docid": "17806b095af269360295b256ae44d8cc", "score": "0.48739445", "text": "func (v *Value) Type() (actual Type, fundamental Type, err error) {\n\tif !v.IsValue() {\n\t\treturn actual, fundamental, errors.New(\"invalid GValue\")\n\t}\n\tcActual := C._g_value_type(v.native())\n\tcFundamental := C._g_value_fundamental(cActual)\n\treturn Type(cActual), Type(cFundamental), nil\n}", "title": "" }, { "docid": "6df8c9223ff219178ebf052e9ef092a3", "score": "0.4860989", "text": "func (*InputStickerSetEmojiDefaultStatuses) TypeName() string {\n\treturn \"inputStickerSetEmojiDefaultStatuses\"\n}", "title": "" }, { "docid": "b699514152118900230380e550823ba6", "score": "0.48527688", "text": "func (f Flag) Default() interface{} {\n\tswitch f.flagT.(type) {\n\tcase *stringFlag:\n\t\treturn f.flagT.(*stringFlag).defValue\n\n\tcase *intFlag:\n\t\treturn f.flagT.(*intFlag).defValue\n\n\tcase *boolFlag:\n\t\treturn f.flagT.(*boolFlag).defValue\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20d6bacb22a95846d58ab9db19a815bf", "score": "0.48496088", "text": "func (n InterfaceCommon) Typ(options ...Option) *Type {\n\tif n.Err() != nil {\n\t\treturn NewType(nil, n.Err())\n\t}\n\treturn NewType(n.V(), n.Err(), options...)\n}", "title": "" }, { "docid": "f74d89cc7865da480480f6375484de15", "score": "0.48389098", "text": "func (t *unTyped) Underlying() Type {\n\treturn t\n}", "title": "" }, { "docid": "eec718bbf864a1d64c4353f04221353d", "score": "0.482509", "text": "func (o WebAclDefaultActionPtrOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclDefaultAction) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Type\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2ba0d365deb4ea8ef7290c5ed44e3232", "score": "0.48188913", "text": "func (s *Uint) GetDefault() interface{} {\n\treturn s.Default\n}", "title": "" }, { "docid": "804a1a4341374f9aa6baa59d8ed418d9", "score": "0.48162204", "text": "func getDefaultDTypeSQL(schema model.ColSchema) (str string) {\n\n\tif schema.ColumnDefault != \"\" && schema.SeqName == \"\" {\n\t\tstr = fmt.Sprintf(\" %v %v\", defaultField, trimDefaultType(schema))\n\t}\n\treturn\n}", "title": "" }, { "docid": "18c1f419fada8bc52ec1df9fac05b0f1", "score": "0.4805187", "text": "func (p *payload) GetDefault(dv interface{}) interface{} {\n\treturn p.Get(PayloadDefault, dv)\n}", "title": "" }, { "docid": "9f457196abde4616de005186b9272a25", "score": "0.47971076", "text": "func (d handler) createType(typ types.Type) Type {\n\tif typ == nil {\n\t\treturn TsAny\n\t}\n\tnamed, isNamed := typ.(*types.Named)\n\n\t// special case for Date\n\tif isNamed && named.Obj().Name() == \"Date\" {\n\t\treturn TsDate\n\t}\n\n\t// special case for time.Time\n\tif utils.IsUnderlyingTime(typ) {\n\t\treturn TsTime\n\t}\n\n\tif isNamed {\n\t\tfinalName := named.Obj().Name()\n\t\torigin := typ.String()\n\t\t// first we look for enums type (which usually have underlying basic types)\n\t\tif enum, isEnum := d.enumsTable[finalName]; isEnum {\n\t\t\treturn enumT{origin: origin, enum: enum}\n\t\t}\n\n\t\t// handle interface after ending the walk\n\t\tif inter, isInter := typ.Underlying().(*types.Interface); isInter {\n\t\t\t// interface are handled after walking\n\t\t\treturn &union{\n\t\t\t\torigin: origin,\n\t\t\t\tname_: finalName,\n\t\t\t\ttype_: inter,\n\t\t\t\t// members are completed after walking the file\n\t\t\t}\n\t\t}\n\n\t\t// caveat for String, which is reserved\n\t\tif finalName == \"String\" {\n\t\t\tfinalName = \"String_\"\n\t\t}\n\n\t\t// otherwise, extract underlying type and look for structs\n\t\tunderlyingTsType := d.AnalyseType(typ.Underlying())\n\t\tif st, isObject := underlyingTsType.(*class); isObject {\n\t\t\tst.origin = origin\n\t\t\tst.name_ = finalName\n\t\t\t// return st\n\t\t}\n\n\t\treturn namedType{origin: origin, name_: finalName, underlying: underlyingTsType}\n\t}\n\n\tswitch typ := typ.Underlying().(type) {\n\tcase *types.Basic:\n\t\treturn analyseBasicType(typ)\n\tcase *types.Pointer:\n\t\t// indirection\n\t\treturn d.AnalyseType(typ.Elem())\n\tcase *types.Struct:\n\t\tout := &class{renderCache: d.renderCache}\n\t\t// register the struct before calling convertFields\n\t\t// to properly handle recursive types\n\t\td.types[typ] = out\n\t\tout.fields, out.embeded = d.convertFields(typ)\n\t\treturn out\n\tcase *types.Array:\n\t\tvalueTsType := d.AnalyseType(typ.Elem())\n\t\treturn array{elem: valueTsType}\n\tcase *types.Slice:\n\t\tvalueTsType := d.AnalyseType(typ.Elem())\n\t\treturn nullableTsType{Type: array{elem: valueTsType}}\n\tcase *types.Map:\n\t\treturn nullableTsType{Type: dict{\n\t\t\tkey: d.AnalyseType(typ.Key()),\n\t\t\telem: d.AnalyseType(typ.Elem()),\n\t\t}}\n\t}\n\t// unhandled type:\n\treturn TsAny\n}", "title": "" }, { "docid": "207f5e1c427cd93fa5027acb5ac42d5a", "score": "0.4788028", "text": "func (config DefaultConfig) GetBaseType(context *structContext) infra.GoStructorValue {\r\n\tlogrus.Debug(\"default values sources start\")\r\n\tvalueIndirect := reflect.Indirect(context.Value)\r\n\tvalue := context.StructField.Tag.Get(tags.TagDefault)\r\n\tif err := middlewares.ExecutorMiddlewaresByTagValue(value, tags.TagDefault); err != nil {\r\n\t\treturn infra.NewGoStructorNoValue(context.Value, err)\r\n\t}\r\n\treturn converters.ConvertBetweenPrimitiveTypes(reflect.ValueOf(value), valueIndirect)\r\n}", "title": "" }, { "docid": "dccd407a8ac2e78dc8e38d9e6077f8f2", "score": "0.47876468", "text": "func (val Value) InferredTypeName() *sources.TypeName {\n\tswitch val.Expression.SubType {\n\tcase sources.ExpressionPrimary:\n\t\tswitch val.Expression.Primary.SubType {\n\t\tcase sources.ExpressionPrimaryBoolean:\n\t\t\telementaryTypeName := sources.NewElementaryTypeName()\n\t\t\telementaryTypeName.SubType = sources.ElementaryTypeNameBool\n\n\t\t\ttypeName := sources.NewTypeName()\n\t\t\ttypeName.SubType = sources.TypeNameElementary\n\t\t\ttypeName.Elementary = elementaryTypeName\n\n\t\t\treturn typeName\n\n\t\tcase sources.ExpressionPrimaryNumber:\n\t\t\ttypeName := sources.NewTypeName()\n\t\t\ttypeName.SubType = sources.TypeNameElementary\n\t\t\ttypeName.Elementary = inferIntegerType(val.Expression.Primary)\n\n\t\t\treturn typeName\n\n\t\tcase sources.ExpressionPrimaryHex:\n\t\t\telementaryTypeName := sources.NewElementaryTypeName()\n\t\t\telementaryTypeName.SubType = sources.ElementaryTypeNameString\n\n\t\t\ttypeName := sources.NewTypeName()\n\t\t\ttypeName.SubType = sources.TypeNameElementary\n\t\t\ttypeName.Elementary = elementaryTypeName\n\n\t\t\treturn typeName\n\t\t}\n\t}\n\n\ttypeName := sources.NewTypeName()\n\ttypeName.SubType = sources.TypeNameUnknown\n\n\treturn typeName\n}", "title": "" }, { "docid": "5a90c1751acde355788ce4938a602e0d", "score": "0.47800922", "text": "func (v Value) Untyped() Value {\n\tif v.IsNil() {\n\t\treturn NewValue(nil)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9b58db36c7b48202c30620b4eabc88ea", "score": "0.4748757", "text": "func (r *root) getType(def *definition) (builtType cppType, err error) {\n\tif def.cppType != nil {\n\t\treturn def.cppType, nil\n\t}\n\tdefer func() { def.cppType = builtType }()\n\n\tif def.Ref != \"\" {\n\t\tref, err := r.getRef(def.Ref)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn ref.def.cppType, nil\n\t}\n\n\t// The DAP spec introduces ambiguities with its particular uses of OneOf, just set to object\n\tif len(def.OneOf) != 0 {\n\t\tdeps := make([]cppType, len(def.OneOf))\n\t\tfor i, oneOf := range def.OneOf {\n\t\t\tif oneOf == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Item %d in oneOf is nil\", i)\n\t\t\t}\n\t\t\telTy, err := r.getType(oneOf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdeps[i] = elTy\n\t\t}\n\t\treturn &cppBasicType{\n\t\t\tname: \"object\",\n\t\t\tdesc: def.Description,\n\t\t\tdeps: deps,\n\t\t}, nil\n\t}\n\n\tv := reflect.ValueOf(def.Ty)\n\n\tif v.Kind() == reflect.Interface {\n\t\tv = v.Elem()\n\t}\n\n\tvar typeof func(reflect.Value) (cppType, error)\n\ttypeof = func(v reflect.Value) (cppType, error) {\n\t\tif v.Kind() == reflect.Interface {\n\t\t\tv = v.Elem()\n\t\t}\n\t\tswitch v.Kind() {\n\t\tcase reflect.String:\n\t\t\tty := v.Interface().(string)\n\t\t\tswitch ty {\n\t\t\tcase \"string\":\n\t\t\t\tdesc := appendEnumDetails(def.Description, nil, def.ClosedEnum)\n\t\t\t\tdefaultValue := \"\"\n\t\t\t\tif len(def.ClosedEnum) > 0 {\n\t\t\t\t\tdefaultValue = `\"` + def.ClosedEnum[0] + `\"`\n\t\t\t\t}\n\t\t\t\tty := &cppBasicType{\n\t\t\t\t\tname: ty,\n\t\t\t\t\tdefaultValue: defaultValue,\n\t\t\t\t\tdesc: desc,\n\t\t\t\t}\n\t\t\t\treturn ty, nil\n\n\t\t\tcase \"object\", \"boolean\", \"integer\", \"number\", \"null\":\n\t\t\t\tty := &cppBasicType{\n\t\t\t\t\tname: ty,\n\t\t\t\t\tdesc: def.Description,\n\t\t\t\t}\n\t\t\t\treturn ty, nil\n\t\t\tcase \"array\":\n\t\t\t\tname := \"array<any>\"\n\t\t\t\tdeps := []cppType{}\n\t\t\t\tif def.Items != nil {\n\t\t\t\t\telTy, err := r.getType(def.Items)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tname = fmt.Sprintf(\"array<%s>\", elTy.Name())\n\t\t\t\t\tdeps = append(deps, elTy)\n\t\t\t\t}\n\t\t\t\treturn &cppBasicType{\n\t\t\t\t\tname: name,\n\t\t\t\t\tdesc: def.Description,\n\t\t\t\t\tdeps: deps,\n\t\t\t\t}, nil\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"Unhandled property type '%v'\", ty)\n\t\t\t}\n\t\tcase reflect.Slice, reflect.Array:\n\t\t\targs := []string{}\n\t\t\tdeps := []cppType{}\n\t\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\t\telTy, err := typeof(v.Index(i))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tdeps = append(deps, elTy)\n\t\t\t\targs = append(args, elTy.Name())\n\t\t\t}\n\t\t\treturn &cppBasicType{\n\t\t\t\tname: \"variant<\" + strings.Join(args, \", \") + \">\",\n\t\t\t\tdesc: def.Description,\n\t\t\t\tdeps: deps,\n\t\t\t}, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Unsupported type '%v' kind: %v\", v.Interface(), v.Kind())\n\t}\n\n\treturn typeof(v)\n}", "title": "" }, { "docid": "0e739c7d51a8f63f89532967d4ed3a03", "score": "0.47465026", "text": "func (n *TerminalDevice_Channel_Ethernet_Lldp_Neighbor_TlvAny) Type() *TerminalDevice_Channel_Ethernet_Lldp_Neighbor_Tlv_TypeAny {\n\treturn &TerminalDevice_Channel_Ethernet_Lldp_Neighbor_Tlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e9333ee02128813e795b28020608cd83", "score": "0.4734074", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3a0298991301e3f31153bac0a06437ec", "score": "0.47337902", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_TrafficEngineering_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "45eca1c3b5f489ba7b6bf3c9ffe6c098", "score": "0.4711791", "text": "func (ub UnknownBox) Type() BoxType {\n\treturn ub.t\n}", "title": "" }, { "docid": "f9ed07151407df5da9ec97877e9f1a88", "score": "0.47085574", "text": "func (v Value) Type() Type {\n\treturn v.ty\n}", "title": "" }, { "docid": "7785dd7851193b49c123bd627262995f", "score": "0.47030133", "text": "func ExampleValidateType_defaultMistmatches() {\n\tprintErrors := func(args ...interface{}) {\n\t\tfor _, arg := range args {\n\t\t\tresults := ValidateType(arg, NewStructList())\n\t\t\tfor _, err := range results {\n\t\t\t\tfmt.Println(err.Error.Code, err.Error.Message)\n\t\t\t}\n\t\t}\n\t}\n\n\ttype BoolStringMismatch struct {\n\t\tValue bool `default:\"fail\"`\n\t}\n\ttype FloatStringMismatch struct {\n\t\tValue float64 `default:\"fail\"`\n\t}\n\ttype IntStringMismatch struct {\n\t\tValue int `default:\"fail\"`\n\t}\n\ttype IntFloatMismatch struct {\n\t\tValue int `default:\"10.1\"`\n\t}\n\ttype UintStringMismatch struct {\n\t\tValue uint `default:\"fail\"`\n\t}\n\ttype UintFloatMismatch struct {\n\t\tValue uint `default:\"10.1\"`\n\t}\n\ttype UintIntMismatch struct {\n\t\tValue uint `default:\"-1\"`\n\t}\n\tprintErrors(\n\t\t&BoolStringMismatch{},\n\t\t&FloatStringMismatch{},\n\t\t&IntStringMismatch{},\n\t\t&IntFloatMismatch{},\n\t\t&UintStringMismatch{},\n\t\t&UintFloatMismatch{},\n\t\t&UintIntMismatch{},\n\t)\n\t//Output:\n\t//BAD_DEFAULT_VALUE Unable to convert \"fail\" to kind bool with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"fail\" to kind float64 with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"fail\" to kind int with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"10.1\" to kind int with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"fail\" to kind uint with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"10.1\" to kind uint with field \"Value\"\n\t//BAD_DEFAULT_VALUE Unable to convert \"-1\" to kind uint with field \"Value\"\n}", "title": "" }, { "docid": "4067b11670a05dedef263720ac9b04aa", "score": "0.4697358", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "17ef59d5b5ee76400e9e951b19e21cd6", "score": "0.46947008", "text": "func (fp *Secret_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Secret_FieldPathSelectorName:\n\t\treturn (*Name)(nil)\n\tcase Secret_FieldPathSelectorEncData:\n\t\treturn ([]byte)(nil)\n\tcase Secret_FieldPathSelectorData:\n\t\treturn (map[string]string)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Secret: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "48c0d1b10fbcc2b4d26047bf8f1f0a34", "score": "0.4683165", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "24f87179a6f47c746e0f7f815082bcb4", "score": "0.4678446", "text": "func (u *UnknownNode) Type() Type {\n\treturn Unknown\n}", "title": "" }, { "docid": "b87c7fe541bc56973e811a0a41de6c5a", "score": "0.46783528", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "83b179dab16bcb5f06ac8464cd08b71e", "score": "0.4669047", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedLink_Tlv_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "653f792f8beafd222ca2d1f4da77377b", "score": "0.46682703", "text": "func (v Value) Type() Type", "title": "" }, { "docid": "ba52a0fccea675fb80ae538b9207e916", "score": "0.46580946", "text": "func (b *Scalar) Type() FieldType {\n\treturn b.t\n}", "title": "" }, { "docid": "757bc7f1b28afd5008fe463075193b03", "score": "0.4657609", "text": "func TypeOf(x interface{}) Type {\n\tswitch x := x.(type) {\n\tcase nil:\n\t\treturn NewNull()\n\tcase bool:\n\t\treturn B\n\tcase string:\n\t\treturn S\n\tcase json.Number:\n\t\treturn N\n\tcase map[string]interface{}:\n\t\t// The ast.ValueToInterface() function returns ast.Object values as map[string]interface{}\n\t\t// so map[string]interface{} must be handled here because the type checker uses the value\n\t\t// to interface conversion when inferring object types.\n\t\tstatic := make([]*StaticProperty, 0, len(x))\n\t\tfor k, v := range x {\n\t\t\tstatic = append(static, NewStaticProperty(k, TypeOf(v)))\n\t\t}\n\t\treturn NewObject(static, nil)\n\tcase map[interface{}]interface{}:\n\t\tstatic := make([]*StaticProperty, 0, len(x))\n\t\tfor k, v := range x {\n\t\t\tstatic = append(static, NewStaticProperty(k, TypeOf(v)))\n\t\t}\n\t\treturn NewObject(static, nil)\n\tcase []interface{}:\n\t\tstatic := make([]Type, len(x))\n\t\tfor i := range x {\n\t\t\tstatic[i] = TypeOf(x[i])\n\t\t}\n\t\treturn NewArray(static, nil)\n\t}\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "0fa51fcc24475ae1e23468f781009c5b", "score": "0.46550897", "text": "func typeForDatum(d parser.Datum) pgType {\n\tif d == parser.DNull {\n\t\treturn pgType{}\n\t}\n\n\tswitch d.(type) {\n\tcase parser.DBool:\n\t\treturn pgType{oid.T_bool, 1}\n\n\tcase parser.DBytes:\n\t\treturn pgType{oid.T_bytea, -1}\n\n\tcase parser.DInt:\n\t\treturn pgType{oid.T_int8, 8}\n\n\tcase parser.DFloat:\n\t\treturn pgType{oid.T_float8, 8}\n\n\tcase *parser.DDecimal:\n\t\treturn pgType{oid.T_numeric, -1}\n\n\tcase parser.DString:\n\t\treturn pgType{oid.T_text, -1}\n\n\tcase parser.DDate:\n\t\treturn pgType{oid.T_date, 8}\n\n\tcase parser.DTimestamp:\n\t\treturn pgType{oid.T_timestamptz, 8}\n\n\tcase parser.DInterval:\n\t\treturn pgType{oid.T_interval, 8}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported type %T\", d))\n\t}\n}", "title": "" }, { "docid": "8aec26c22f79a8be4aa44a65358c473f", "score": "0.46548226", "text": "func (p Ptr) StructDefault(def []byte) (Struct, error) {\n\ts := p.Struct()\n\tif s.seg == nil {\n\t\tif def == nil {\n\t\t\treturn Struct{}, nil\n\t\t}\n\t\tdefp, err := unmarshalDefault(def)\n\t\tif err != nil {\n\t\t\treturn Struct{}, err\n\t\t}\n\t\treturn defp.Struct(), nil\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "ab9e52a69f621d713c621afd98b018b5", "score": "0.4651804", "text": "func gno2GoType(t Type) reflect.Type {\n\tswitch ct := baseOf(t).(type) {\n\tcase PrimitiveType:\n\t\tswitch ct {\n\t\tcase BoolType, UntypedBoolType:\n\t\t\treturn reflect.TypeOf(false)\n\t\tcase StringType, UntypedStringType:\n\t\t\treturn reflect.TypeOf(\"\")\n\t\tcase IntType:\n\t\t\treturn reflect.TypeOf(int(0))\n\t\tcase Int8Type:\n\t\t\treturn reflect.TypeOf(int8(0))\n\t\tcase Int16Type:\n\t\t\treturn reflect.TypeOf(int16(0))\n\t\tcase Int32Type, UntypedRuneType:\n\t\t\treturn reflect.TypeOf(int32(0))\n\t\tcase Int64Type:\n\t\t\treturn reflect.TypeOf(int64(0))\n\t\tcase UintType:\n\t\t\treturn reflect.TypeOf(uint(0))\n\t\tcase Uint8Type:\n\t\t\treturn reflect.TypeOf(uint8(0))\n\t\tcase Uint16Type:\n\t\t\treturn reflect.TypeOf(uint16(0))\n\t\tcase Uint32Type:\n\t\t\treturn reflect.TypeOf(uint32(0))\n\t\tcase Uint64Type:\n\t\t\treturn reflect.TypeOf(uint64(0))\n\t\tcase BigintType, UntypedBigintType:\n\t\t\tpanic(\"not yet implemented\")\n\t\tdefault:\n\t\t\tpanic(\"should not happen\")\n\t\t}\n\tcase PointerType:\n\t\tet := gno2GoType(ct.Elem())\n\t\treturn reflect.PtrTo(et)\n\tcase *ArrayType:\n\t\tne := ct.Len\n\t\tet := gno2GoType(ct.Elem())\n\t\treturn reflect.ArrayOf(ne, et)\n\tcase *SliceType:\n\t\tet := gno2GoType(ct.Elem())\n\t\treturn reflect.SliceOf(et)\n\tcase *StructType:\n\t\tgfs := make([]reflect.StructField, len(ct.Fields))\n\t\tfor i, field := range ct.Fields {\n\t\t\tgft := gno2GoType(field.Type)\n\t\t\tfn := string(field.Name)\n\t\t\tif fn == \"\" {\n\t\t\t\tfn = string(field.Embedded)\n\t\t\t}\n\t\t\tpkgPath := \"\"\n\t\t\tif !isUpper(fn) {\n\t\t\t\tpkgPath = ct.PkgPath\n\t\t\t}\n\t\t\tgfs[i] = reflect.StructField{\n\t\t\t\tName: fn,\n\t\t\t\tPkgPath: pkgPath,\n\t\t\t\tType: gft,\n\t\t\t\tTag: reflect.StructTag(field.Tag),\n\t\t\t\tAnonymous: field.Name == \"\",\n\t\t\t\t// Offset: dontcare\n\t\t\t\t// Index: dontcare\n\t\t\t}\n\t\t}\n\t\treturn reflect.StructOf(gfs)\n\tcase *MapType:\n\t\tkt := gno2GoType(ct.Key)\n\t\tvt := gno2GoType(ct.Value)\n\t\treturn reflect.MapOf(kt, vt)\n\tcase *FuncType:\n\t\tpanic(\"should not happen\")\n\tcase *InterfaceType:\n\t\tif ct.IsEmptyInterface() {\n\t\t\t// XXX move out\n\t\t\trt := reflect.TypeOf((*interface{})(nil)).Elem()\n\t\t\treturn rt\n\t\t} else {\n\t\t\t// NOTE: can this be implemented in go1.15? i think not.\n\t\t\tpanic(\"not yet supported\")\n\t\t}\n\tcase *TypeType:\n\t\tpanic(\"should not happen\")\n\tcase *DeclaredType:\n\t\t// NOTE: Go1.15 has issues with generating types and values using\n\t\t// reflect to declare types with methods. When Go has fixed these\n\t\t// issues, we can revisit. For now, all Gno objects passed to Go\n\t\t// lose their names or \"namedness\", e.g. cannot satisfy anything\n\t\t// but empty interfaces, and have no methods.\n\n\t\t// We switch on baseOf(t).\n\t\tpanic(\"should not happen\")\n\tcase *PackageType:\n\t\tpanic(\"should not happen\")\n\tcase *nativeType:\n\t\treturn ct.Type\n\tdefault:\n\t\tpanic(\"should not happen\")\n\t}\n}", "title": "" }, { "docid": "e261c1d7bd51239b254ba3fc914f7782", "score": "0.46508434", "text": "func (n *Lldp_Interface_Neighbor_TlvAny) Type() *Lldp_Interface_Neighbor_Tlv_TypeAny {\n\treturn &Lldp_Interface_Neighbor_Tlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "949dd7cd96bac2f9660ceda2c17f8c80", "score": "0.46463108", "text": "func ValueType(value r.Value) r.Type {\n\tif !value.IsValid() || value == None {\n\t\treturn nil\n\t}\n\treturn value.Type()\n}", "title": "" }, { "docid": "209a1baf0e5bda17748a80b916eac3e7", "score": "0.46422732", "text": "func (fp *WatchNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationRequest_FieldPathSelectorName:\n\t\treturn (*notification.Reference)(nil)\n\tcase WatchNotificationRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase WatchNotificationRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "ef8a26e3dd8abb5688ec63d5b69a7fe9", "score": "0.46306813", "text": "func (fp *CreateNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase CreateNotificationRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentReference)(nil)\n\tcase CreateNotificationRequest_FieldPathSelectorNotification:\n\t\treturn (*notification.Notification)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "c3b93e46204d27cc3e5a59b0cf2dad3f", "score": "0.46298367", "text": "func OneOfType(types []interface{}) dgo.Type {\n\tl := len(types)\n\tswitch l {\n\tcase 0:\n\t\t// One of no types doesn't represent any values at all\n\t\treturn notAnyType\n\tcase 1:\n\t\treturn AsType(Value(types[0]))\n\t}\n\tts := make([]dgo.Value, l)\n\tfor i := range types {\n\t\tts[i] = AsType(Value(types[i]))\n\t}\n\treturn &oneOfType{slice: ts, frozen: true}\n}", "title": "" }, { "docid": "074161b4532bc15e2068a1eef9abf18b", "score": "0.46264035", "text": "func DefaultTGTypeNotSupported() *TypeNotSupported {\n\tnewException := TypeNotSupported{\n\t\tTGDBError: DefaultTGDBError(),\n\t}\n\tnewException.ErrorType = TGErrorTypeNotSupported\n\treturn &newException\n}", "title": "" }, { "docid": "4edcf8bccc22b5d6c7c5fc285cf462b3", "score": "0.4624308", "text": "func (r *Store) GetDefault(key string, def interface{}) interface{} {\n\tv := r.GetEntry(key)\n\tif v == nil || v.ValueRaw == nil {\n\t\treturn def\n\t}\n\tvv := v.Value()\n\tif vv == nil {\n\t\treturn def\n\t}\n\treturn vv\n}", "title": "" }, { "docid": "d05a1222c76d4214ff487d70f43b7ad3", "score": "0.46110484", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlvAny) Type() *NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_UndefinedTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "71ef5b3e279b98476a6a9958812b5db7", "score": "0.46062857", "text": "func NewUpdateSignatureTypeDefault(code int) *UpdateSignatureTypeDefault {\n\treturn &UpdateSignatureTypeDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "92d252af5aa914ce2db2f236e3e9b188", "score": "0.4603786", "text": "func (fp *GetNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase GetNotificationRequest_FieldPathSelectorName:\n\t\treturn (*notification.Reference)(nil)\n\tcase GetNotificationRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase GetNotificationRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "bf8aca1d2043ad53c0a76d778ae3e418", "score": "0.45863026", "text": "func TypeOf(i any) Type {\n\teface := *(*emptyInterface)(unsafe.Pointer(&i))\n\treturn toType(eface.typ)\n}", "title": "" }, { "docid": "bf8aca1d2043ad53c0a76d778ae3e418", "score": "0.45863026", "text": "func TypeOf(i any) Type {\n\teface := *(*emptyInterface)(unsafe.Pointer(&i))\n\treturn toType(eface.typ)\n}", "title": "" }, { "docid": "1562a4ec6873927c7c868daaa2dfa579", "score": "0.45818484", "text": "func (fp *Memo_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Memo_FieldPathSelectorCreateTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase Memo_FieldPathSelectorUpdateTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase Memo_FieldPathSelectorMessage:\n\t\treturn \"\"\n\tcase Memo_FieldPathSelectorCreatedBy:\n\t\treturn \"\"\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Memo: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "5b53d3435d9f9d502c0d9236df4a8952", "score": "0.457779", "text": "func unnamedType(typ ast.Type) ast.Type {\n\tfor {\n\t\tswitch t := typ.(type) {\n\t\tcase *ast.TypeDecl:\n\t\t\ttyp = t.Type\n\t\tcase *ast.TypeVar:\n\t\t\tif t.Type == nil {\n\t\t\t\treturn t\n\t\t\t}\n\t\t\ttyp = t.Type\n\t\tdefault:\n\t\t\treturn t\n\t\t}\n\t}\n}", "title": "" }, { "docid": "99f14a493d0470c554b9150e03dcb93e", "score": "0.45764166", "text": "func trimDefaultType(schema model.ColSchema) (defVal string) {\n\n\tdefVal = schema.ColumnDefault\n\tif strings.Contains(defVal, \"::\") {\n\t\tdefVal = strings.TrimSuffix(defVal, \"::\"+schema.DataType)\n\t\tdefVal = strings.TrimSuffix(defVal, \"::\"+pgAlias[schema.DataType])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c182818c02a5c303eb3c54b5e4488ed8", "score": "0.4573873", "text": "func TestMountOptDefaultType(t *testing.T) {\n\tvar mount MountOpt\n\tassert.NilError(t, mount.Set(\"target=/target,source=/foo\"))\n\tassert.Check(t, is.Equal(mounttypes.TypeVolume, mount.values[0].Type))\n}", "title": "" }, { "docid": "d5c214c34a262aaad3ae538bd6be9aed", "score": "0.4572612", "text": "func (mt MonoType) ValueType() (MonoType, error) {\n\tdict, err := getDict(mt.tbl)\n\tif err != nil {\n\t\treturn MonoType{}, err\n\t}\n\tvar tbl flatbuffers.Table\n\tif !dict.V(&tbl) {\n\t\treturn MonoType{}, errors.New(codes.Internal, \"missing dictionary value type\")\n\t}\n\treturn NewMonoType(tbl, dict.VType())\n}", "title": "" }, { "docid": "89a86511c76818c40e514be5aecbe3df", "score": "0.45709175", "text": "func GetType(val interface{}) (Type, error) {\n\n\tswitch t := val.(type) {\n\tcase string:\n\t\treturn STRING, nil\n\tcase int:\n\t\treturn INTEGER, nil\n\tcase float64:\n\t\treturn NUMBER, nil\n\tcase json.Number:\n\t\treturn NUMBER, nil\n\tcase bool:\n\t\treturn BOOLEAN, nil\n\tcase map[string]interface{}:\n\t\treturn OBJECT, nil\n\tcase []interface{}:\n\t\treturn ARRAY, nil\n\tcase ComplexObject:\n\t\treturn COMPLEX_OBJECT, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"Unable to determine type of %#v\", t)\n\t}\n}", "title": "" }, { "docid": "9ac5c5f08673fed3eb82d4fd6a99e061", "score": "0.45686704", "text": "func (v *Value) Type() kiwi.ValueType {\n\treturn Type\n}", "title": "" }, { "docid": "09c018d0d55fc8bd63c974829ca8a6f3", "score": "0.4567344", "text": "func safeUnderlying(typ Type) Type {\n\tif t, _ := typ.(*Named); t != nil {\n\t\treturn t.underlying\n\t}\n\treturn typ.Underlying()\n}", "title": "" }, { "docid": "d9b2a547f9dc7c21b6be034d27e5d692", "score": "0.45641539", "text": "func (fp *Status_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Status_FieldPathSelectorCode:\n\t\treturn int32(0)\n\tcase Status_FieldPathSelectorMessage:\n\t\treturn \"\"\n\tcase Status_FieldPathSelectorDetails:\n\t\treturn ([]*any.Any)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Status: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "7e5068ef11f99ad705a5740f07efaa94", "score": "0.4563507", "text": "func (r *Store) GetDefault(key string, def interface{}) interface{} {\n\tv, ok := r.GetEntry(key)\n\tif !ok || v.ValueRaw == nil {\n\t\treturn def\n\t}\n\tvv := v.Value()\n\tif vv == nil {\n\t\treturn def\n\t}\n\treturn vv\n}", "title": "" }, { "docid": "abf06a13aec30ae9df3f332fc483339b", "score": "0.45617652", "text": "func (*URLAuthResultDefault) TypeName() string {\n\treturn \"urlAuthResultDefault\"\n}", "title": "" }, { "docid": "56c1bc8b5bcb5a72a03a35a307d050d8", "score": "0.45584145", "text": "func (fp *UpdateNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateNotificationRequest_FieldPathSelectorNotification:\n\t\treturn (*notification.Notification)(nil)\n\tcase UpdateNotificationRequest_FieldPathSelectorUpdateMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase UpdateNotificationRequest_FieldPathSelectorCas:\n\t\treturn (*UpdateNotificationRequest_CAS)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "46d2061d34c8730036af70994e5ac27d", "score": "0.45454276", "text": "func (fp *SearchNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase SearchNotificationsRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentName)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase SearchNotificationsRequest_FieldPathSelectorPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*notification.OrderBy)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorFilter:\n\t\treturn (*notification.Filter)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase SearchNotificationsRequest_FieldPathSelectorPhrase:\n\t\treturn \"\"\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for SearchNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "b94e3f984e96d2ccd2f4484f2fd11901", "score": "0.4542754", "text": "func (ruo *ReferrerUpdateOne) SetNillableType(s *string) *ReferrerUpdateOne {\n\tif s != nil {\n\t\truo.SetType(*s)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "311cf929a09668a8a83607898d5a7c2f", "score": "0.45371985", "text": "func (i SimpleType) Type() Type {\n\treturn Type{SimpleTypes: &i}\n}", "title": "" }, { "docid": "b7a0c71797bfb00a707d7f39302069f9", "score": "0.45369452", "text": "func (s *NullSchema) Type() Type {\n\treturn Null\n}", "title": "" }, { "docid": "b6f4bc923fe22918144f9e1141c2126f", "score": "0.45364222", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_UnknownTlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_UnknownTlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_UnknownTlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eef8dc741bb5a4366bc45281b41f9071", "score": "0.4535905", "text": "func (domain *Domain) Default() {\n\tdomain.defaultImpl()\n\tvar temp any = domain\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "title": "" }, { "docid": "003cac5183c4184c438208cb459abc84", "score": "0.4534593", "text": "func (fp *WatchNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationsRequest_FieldPathSelectorType:\n\t\treturn watch_type.WatchType_STATEFUL\n\tcase WatchNotificationsRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentReference)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase WatchNotificationsRequest_FieldPathSelectorPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*notification.OrderBy)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchNotificationsRequest_FieldPathSelectorStartingTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorFilter:\n\t\treturn (*notification.Filter)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase WatchNotificationsRequest_FieldPathSelectorMaxChunkSize:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "45a5b54645fbb8ea604e62fcc3ca926d", "score": "0.45264468", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_TlvAny) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv_TypeAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv_TypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9e442580556fa7ea06d363d5dc1395b0", "score": "0.45070687", "text": "func parseDefault(val string, t reflect.Kind) (interface{}, bool) {\n\n\tif val == \"\" {\n\t\treturn nil, false\n\t}\n\n\tswitch t {\n\tcase reflect.Int, reflect.Int32, reflect.Int16, reflect.Int64:\n\t\tif i, err := parseInt(val); err == nil {\n\t\t\treturn i, true\n\t\t} else {\n\t\t\tlogging.Error(\"Error parsing int default '%s': %s\", val, err)\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tif f, err := parseFloat(val); err == nil {\n\t\t\treturn f, true\n\t\t} else {\n\t\t\tlogging.Error(\"Error parsing float default '%s': %s\", val, err)\n\t\t}\n\tcase reflect.String:\n\t\treturn val, true\n\tcase reflect.Bool:\n\t\tif b, err := parseBool(val); err == nil {\n\t\t\treturn b, true\n\t\t} else {\n\t\t\tlogging.Error(\"Error parsing bool default '%s': %s\", val, err)\n\t\t}\n\tcase reflect.Slice:\n\t\tif l, err := parseList(val); err == nil {\n\t\t\treturn l, true\n\t\t} else {\n\t\t\tlogging.Error(\"Error parsing string list '%s': %s\", val, err)\n\t\t}\n\t}\n\n\treturn nil, false\n}", "title": "" }, { "docid": "3a00ed0eb0a90f9abdd41c609aae9a01", "score": "0.45058158", "text": "func (*PollTypeRegular) TypeName() string {\n\treturn \"pollTypeRegular\"\n}", "title": "" }, { "docid": "8fccc9b91f5c0e7f3ee49c46960e7d9f", "score": "0.4502964", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8fccc9b91f5c0e7f3ee49c46960e7d9f", "score": "0.4502964", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv) Type() *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_Type {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_GraceLsa_Tlv_UnknownTlv_Type{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "24475b4c0da076164c6dd522e5a0ca26", "score": "0.45026922", "text": "func Default(def interface{}) {\n\tif a, ok := attributeDefinition(); ok {\n\t\tif a.Type != nil {\n\t\t\tif !a.Type.CanHaveDefault() {\n\t\t\t\tdslengine.ReportError(\"%s type cannot have a default value\", qualifiedTypeName(a.Type))\n\t\t\t} else if !a.Type.IsCompatible(def) {\n\t\t\t\tdslengine.ReportError(\"default value %#v is incompatible with attribute of type %s\",\n\t\t\t\t\tdef, qualifiedTypeName(a.Type))\n\t\t\t} else {\n\t\t\t\ta.SetDefault(def)\n\t\t\t}\n\t\t} else {\n\t\t\ta.SetDefault(def)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3adf29d6d1bd1f5d84c1185fc4375b87", "score": "0.45012498", "text": "func GetDefaultLoggerType() string {\n\treturn GetDefaultLogTypeKey()\n}", "title": "" }, { "docid": "bb11d444cfe156565c7316a4a7ca0b49", "score": "0.4500801", "text": "func (*BotMenuButtonDefault) TypeName() string {\n\treturn \"botMenuButtonDefault\"\n}", "title": "" }, { "docid": "ca2039a3cbe586c5821c2a7ff702fa41", "score": "0.4500386", "text": "func (s *FieldSchema) DefaultOrZero() interface{} {\n\tif s.Default != nil {\n\t\tswitch s.Type {\n\t\tcase TypeDurationSecond:\n\t\t\tvar result int\n\t\t\tswitch inp := s.Default.(type) {\n\t\t\tcase nil:\n\t\t\t\treturn s.Type.Zero()\n\t\t\tcase int:\n\t\t\t\tresult = inp\n\t\t\tcase int64:\n\t\t\t\tresult = int(inp)\n\t\t\tcase float32:\n\t\t\t\tresult = int(inp)\n\t\t\tcase float64:\n\t\t\t\tresult = int(inp)\n\t\t\tcase string:\n\t\t\t\tdur, err := parseutil.ParseDurationSecond(inp)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn s.Type.Zero()\n\t\t\t\t}\n\t\t\t\tresult = int(dur.Seconds())\n\t\t\tcase json.Number:\n\t\t\t\tvalInt64, err := inp.Int64()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn s.Type.Zero()\n\t\t\t\t}\n\t\t\t\tresult = int(valInt64)\n\t\t\tdefault:\n\t\t\t\treturn s.Type.Zero()\n\t\t\t}\n\t\t\treturn result\n\n\t\tdefault:\n\t\t\treturn s.Default\n\t\t}\n\t}\n\n\treturn s.Type.Zero()\n}", "title": "" }, { "docid": "d2488bbe5b849c492559997d60d26152", "score": "0.44985524", "text": "func (this *Meta) GetDefaultValue(ctx *core.Context, recorde interface{}) (v interface{}) {\n\tvar zero interface{}\n\tif this.DefaultValueFunc != nil {\n\t\tzero = this.DefaultValueFunc(recorde, ctx)\n\t} else if this.FieldStruct != nil {\n\t\tz := reflect.New(this.FieldStruct.Struct.Type).Elem()\n\t\tif this.FieldStruct.Struct.Type.Kind() == reflect.Struct {\n\t\t\tzero = z.Addr().Interface()\n\t\t} else {\n\t\t\tzero = z.Interface()\n\t\t}\n\t}\n\tvar err error\n\tif v, err = this.TriggerValuerEvent(E_META_DEFAULT_VALUE, recorde, ctx, nil, zero); err != nil {\n\t\tpanic(MetaEventError{this, E_META_DEFAULT_VALUE, err})\n\t}\n\treturn\n}", "title": "" } ]
ed0e9be098e1e2c0d8b0978cb2a2b611
SendInventory sends inventory of specific type
[ { "docid": "2571233397d6ac86b9fbd5a0940b8cf4", "score": "0.7977228", "text": "func (node *Node) SendInventory(address, kind string, items [][]byte) {\n\tinventory := InventoryCommand{node.Address, kind, items}\n\tpayload := EncodeData(inventory)\n\trequest := append(ToBytes(\"inventory\"), payload...)\n\tnode.SendData(address, request)\n}", "title": "" } ]
[ { "docid": "4186ca4e875ed1c3443d898618421fa8", "score": "0.79022616", "text": "func SendInventory(address, kind string, items [][]byte) {\n\tinventory := Inventory{nodeAddress, kind, items}\n\tpayload := GobEncode(inventory)\n\trequest := append(CmdToBytes(\"inv\"), payload...)\n\n\tSendData(address, request)\n}", "title": "" }, { "docid": "575323bd0e86c0920402181335df6d27", "score": "0.65154785", "text": "func HandleInventory(request []byte, chain *blockchain.BlockChain) {\n\tvar buff bytes.Buffer\n\tvar payload Inventory\n\n\tbuff.Write(request[commandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\tErrorHandler(err)\n\n\tfmt.Printf(\"Recevied inventory with %d %s \\n\", len(payload.Items), payload.Type)\n\n\tswitch payload.Type {\n\tcase \"block\":\n\t\tblocksInTransit = payload.Items\n\n\t\tblockHash := payload.Items[0]\n\t\tSendGetData(payload.AddrFrom, \"block\", blockHash)\n\n\t\tnewInTransit := [][]byte{}\n\t\tfor _, block := range blocksInTransit {\n\t\t\tif bytes.Equal(block, blockHash) {\n\t\t\t\tnewInTransit = append(newInTransit, block)\n\t\t\t}\n\t\t}\n\t\tblocksInTransit = newInTransit\n\tcase \"tx\":\n\t\ttxID := payload.Items[0]\n\n\t\t// check if the incomming transcation is in the memory pool, if it's not clain the transaction data\n\t\tif memoryPool[hex.EncodeToString(txID)].ID == nil {\n\t\t\tSendGetData(payload.AddrFrom, \"tx\", txID)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "390b3c1bb76b2e10a73d58181f10b6f8", "score": "0.6384221", "text": "func (c *NodeClient) SendInv(address netlib.NodeAddr, kind string, items [][]byte) error {\n\tdata := ComInv{c.NodeAddress, kind, items}\n\n\trequest, err := c.BuildCommandData(\"inv\", &data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.SendData(address, request)\n}", "title": "" }, { "docid": "a1cf1945440bbc16165adc868c1a2076", "score": "0.61463344", "text": "func (p *peer) QueueInventory(invVect *wire.InvVect) {\n\t// Don't add the inventory to the send queue if the peer is\n\t// already known to have it.\n\tif p.isKnownInventory(invVect) {\n\t\treturn\n\t}\n\n\t// Avoid risk of deadlock if goroutine already exited. The goroutine\n\t// we will be sending to hangs around until it knows for a fact that\n\t// it is marked as disconnected. *then* it drains the channels.\n\tif !p.Connected() {\n\t\treturn\n\t}\n\n\tp.outputInvChan <- invVect\n}", "title": "" }, { "docid": "f16809c8f0f8069b32d0cc10d94a1326", "score": "0.61012197", "text": "func InventoryItems(player *Player) (p *packet.Packet) {\n\tp = packet.NewOutgoingPacket(53)\n\tp.AddByte(uint8(player.Inventory.Size()))\n\tplayer.Inventory.Range(func(item *Item) bool {\n\t\tif item.Worn {\n\t\t\tp.AddShort(uint16(item.ID + 0x8000))\n\t\t} else {\n\t\t\tp.AddShort(uint16(item.ID))\n\t\t}\n\t\tif ItemDefs[item.ID].Stackable {\n\t\t\tp.AddInt2(uint32(item.Amount))\n\t\t}\n\t\treturn true\n\t})\n\treturn\n}", "title": "" }, { "docid": "61a1c04a7320eb4c841c1ba5f8a44c02", "score": "0.60339296", "text": "func (s *server) RelayInventory(invVect *msg.InvVect, data interface{}) {\n\ts.relayInv <- relayMsg{invVect: invVect, data: data}\n}", "title": "" }, { "docid": "97a2f6baf2469f8080a61f78840383ff", "score": "0.603333", "text": "func (s *server) RelayInventory(invVect *wire.InvVect, data interface{}) {\n\ts.relayInv <- relayMsg{invVect: invVect, data: data}\n}", "title": "" }, { "docid": "912068e9721aec37947a0111a1ab282e", "score": "0.59496343", "text": "func handleInv(request []byte, bc *Blockchain) {\n\tvar buff bytes.Buffer\n\tvar payload inv\n\n\tbuff.Write(request[commandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfmt.Printf(\"Recevied inventory with %d %s\\n\", len(payload.Items), payload.Type)\n\n\tif payload.Type == \"block\" {\n\t\tblocksInTransit = payload.Items\n\n\t\tblockHash := payload.Items[0]\n\t\tsendGetData(payload.AddrFrom, \"block\", blockHash)\n\n\t\tnewInTransit := [][]byte{}\n\t\tfor _, b := range blocksInTransit {\n\t\t\tif bytes.Compare(b, blockHash) != 0 {\n\t\t\t\tnewInTransit = append(newInTransit, b)\n\t\t\t}\n\t\t}\n\t\tblocksInTransit = newInTransit\n\t}\n\n\tif payload.Type == \"tx\" {\n\t\ttxID := payload.Items[0]\n\n\t\tif mempool[hex.EncodeToString(txID)].ID == nil {\n\t\t\tsendGetData(payload.AddrFrom, \"tx\", txID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92841c6277d2ecee4ea7e7de72c18003", "score": "0.58609504", "text": "func HandleInv(request []byte, chain *blockchain.BlockChain) {\n\tvar payload Inv\n\n\tif err := DeserializePayload(request, &payload); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfmt.Printf(\"Recivied inventory with %d, %s\\n\", len(payload.Items), payload.Type)\n\n\tif payload.Type == \"block\" {\n\t\tblocksInTransit = payload.Items\n\t\tblockHash := payload.Items[0]\n\t\tSendGetData(payload.AddrFrom, \"block\", blockHash)\n\n\t\tnewInTransit := [][]byte{}\n\n\t\tfor _, v := range blocksInTransit {\n\t\t\tif !bytes.Equal(v, blockHash) {\n\t\t\t\tnewInTransit = append(newInTransit, v)\n\t\t\t}\n\t\t}\n\n\t\tblocksInTransit = newInTransit\n\t}\n\n\tif payload.Type == \"tx\" {\n\t\ttxID := payload.Items[0]\n\t\tif memoryPool[hex.EncodeToString(txID)].ID == nil {\n\t\t\tSendGetData(payload.AddrFrom, \"tx\", txID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a6ef5e470869ba58f93021230998278", "score": "0.5835428", "text": "func (msg MsgSendToEthereum) Type() string { return \"send_to_eth\" }", "title": "" }, { "docid": "c256d4be91e6ef555ae69c2ae93206d2", "score": "0.58303165", "text": "func EncodeInventory(i Inventory) ([]byte, error) {\n\treturn json.Marshal(i)\n}", "title": "" }, { "docid": "1f2ca2232cb31b136d4953fff67a3fb2", "score": "0.57400733", "text": "func (m *PstnCallLogRow) SetInventoryType(value *string)() {\n err := m.GetBackingStore().Set(\"inventoryType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "33c24bbf65604dfb114daecb8fe16f8f", "score": "0.5734964", "text": "func (node *Node) ReceiveInventoryCommand(request []byte, env Config) {\n\tvar buff bytes.Buffer\n\tvar payload InventoryCommand\n\tbuff.Write(request[CommandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tfmt.Printf(\"recevied inventory with %d %s\\n\", len(payload.Data), payload.Type)\n\tif payload.Type == \"block\" {\n\t\tnode.Transit = payload.Data\n\t\tblockHash := payload.Data[0]\n\t\tnode.SendGetDataCommand(payload.Origin, \"block\", blockHash)\n\t\tnewInTransit := [][]byte{}\n\t\tfor _, b := range node.Transit {\n\t\t\tif bytes.Compare(b, blockHash) != 0 {\n\t\t\t\tnewInTransit = append(newInTransit, b)\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"new in transit: %d \\n\", len(newInTransit))\n\t\tnode.Transit = newInTransit\n\t}\n\tif payload.Type == \"transaction\" {\n\t\ttxID := payload.Data[0]\n\t\tif node.Mempool[hex.EncodeToString(txID)].ID == nil {\n\t\t\tnode.SendGetDataCommand(payload.Origin, \"transaction\", txID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b9428317de4d9d7865dfd7108727c15a", "score": "0.5610071", "text": "func (c inventoriesCollector) Send(s *serializer.Serializer) error {\n\tif s == nil {\n\t\treturn nil\n\t}\n\n\tpayload, err := createPayload(c.ac, c.coll)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.SendMetadata(payload); err != nil {\n\t\treturn fmt.Errorf(\"unable to submit inventories payload, %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "524762bf2563d2c59b6ae7969e1bba85", "score": "0.5600657", "text": "func (d *DAC) SendEventEquipVirtualItem(\n\tctx context.Context,\n\teventID uint32,\n\tdefIndex uint32,\n\tequipSlot uint32,\n\tequipSubSlot uint32,\n) (*protocol.CMsgClientToGCEventEquipVirtualItemResponse, error) {\n\treq := &protocol.CMsgClientToGCEventEquipVirtualItem{\n\t\tEventId: &eventID,\n\t\tDefIndex: &defIndex,\n\t\tEquipSlot: &equipSlot,\n\t\tEquipSubSlot: &equipSubSlot,\n\t}\n\tresp := &protocol.CMsgClientToGCEventEquipVirtualItemResponse{}\n\n\treturn resp, d.MakeRequest(\n\t\tctx,\n\t\tuint32(protocol.EGCDACClientMessages_k_EMsgClientToGCEventEquipVirtualItem),\n\t\treq,\n\t\tuint32(protocol.EGCDACClientMessages_k_EMsgClientToGCEventEquipVirtualItemResponse),\n\t\tresp,\n\t)\n}", "title": "" }, { "docid": "1e85ff14591193b2ac287921cc25a2cf", "score": "0.5576279", "text": "func Inventory(w http.ResponseWriter, r *http.Request) {\n\t//go CmdStats(\"inventory:get\", \"\")\n\tuser := mux.Vars(r)[\"userID\"]\n\n\trespond(w,\n\t\tmap[string]interface{}{\n\t\t\t\"items\": DBGetInventory(user),\n\t\t\t\"fish\": DBGetFishInv(user),\n\t\t\t\"maxFish\": DBGetInvCapacity(user),\n\t\t\t\"maxBait\": DBGetBaitCapacity(user),\n\t\t\t\"userTier\": ExpToTier(DBGetGlobalScore(user)),\n\t\t},\n\t)\n}", "title": "" }, { "docid": "6f33b2c4877367a59ddaa211addb79f4", "score": "0.5574902", "text": "func handleInventory(req []byte, address NetAddress, bc *core.Blockchain) {\n\tvar payload Inventory\n\n\tdec := gob.NewDecoder(bytes.NewReader(req))\n\tif err := dec.Decode(&payload); err != nil {\n\t\tfmt.Printf(\"error decoding handleInventory of length %d: %v\\n\", len(req), err)\n\t\treturn\n\t}\n\n\tif payload.Kind == \"blocks\" {\n\t\t// populate the map blocksNeeded with all the new blocks to get\n\t\tfor idx, height := range payload.Height {\n\t\t\tblocksNeeded[height] = payload.Items[idx]\n\t\t}\n\n\t\tsendGetData(\"blocks\")\n\t}\n}", "title": "" }, { "docid": "06946543788f2309f2a0b19ee3527d32", "score": "0.5505515", "text": "func (cli *CLI) send(from, to string, amt int) {\n\tbc := GetBlockchain()\n\tdefer bc.db.Close()\n\n\ttx := NewTransaction(from, to, amt, bc)\n\tbc.MineBlock([]*Transaction{tx})\n\tlog.Println(\"send success\")\n}", "title": "" }, { "docid": "cb0a2ca6f8c82377354caf2ee141dd75", "score": "0.54974276", "text": "func (a *InventoryApiService) PatchInventoryGenericInventory(ctx context.Context, moid string) ApiPatchInventoryGenericInventoryRequest {\n\treturn ApiPatchInventoryGenericInventoryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "c23a16e527ed1da2ced5ef47e9262b09", "score": "0.54729027", "text": "func Send(wallet, source, destination, id string, amount int, work string) (string, error) {\n\tpayload := map[string]interface{}{\n\t\t\"wallet\": wallet,\n\t\t\"source\": source,\n\t\t\"destination\": destination,\n\t\t\"id\": id,\n\t\t\"amount\": amount,\n\t}\n\n\tif work != \"\" {\n\t\tpayload[\"work\"] = work\n\t}\n\n\treturn client.fetchString(\"send\", payload, \"block\")\n}", "title": "" }, { "docid": "00f57c26362f29eee5261b195b0427fc", "score": "0.54359406", "text": "func CreateInventory(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tvar inv entities.Inventory\n\tbody, _ := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\terr := json.Unmarshal(body, &inv)\n\tif err != nil || !db.Conn.NewRecord(inv) {\n\t\tSend(&w, err, http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Println(inv)\n\tdb.Conn.Create(&inv)\n\tSend(&w, inv, http.StatusCreated)\n}", "title": "" }, { "docid": "0834b34781ca9e72de2bd79653470bd3", "score": "0.54283124", "text": "func (a *InventoryApiService) UpdateInventoryGenericInventory(ctx context.Context, moid string) ApiUpdateInventoryGenericInventoryRequest {\n\treturn ApiUpdateInventoryGenericInventoryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "3692a91413f6c37a5122907a8d13f637", "score": "0.5418909", "text": "func PrintInventory(inventory INVENTORY) {\n\tfor _, value := range inventory.Items {\n\t\tfmt.Println(value)\n\t}\n}", "title": "" }, { "docid": "cba9002ee03a111bff44891617464ed0", "score": "0.5416515", "text": "func (r GetBucketInventoryConfigurationRequest) Send(ctx context.Context) (*GetBucketInventoryConfigurationResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &GetBucketInventoryConfigurationResponse{\n\t\tGetBucketInventoryConfigurationOutput: r.Request.Data.(*GetBucketInventoryConfigurationOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "fe877061c2807fd2dec15fa585b9afe4", "score": "0.5370073", "text": "func (i *MobInventory) Add(o *Mob) {\n\t//log.Println(\"Adding mob\" + o.Name)\n\ti.Contents = append(i.Contents, o)\n}", "title": "" }, { "docid": "0c7aa68c4dd259dc89b48f5797264bcd", "score": "0.53088635", "text": "func (j Joueur) Transmit(){\n\tarr:=j.stringify()\n\tfor k,e := range arr{\n\t\tdata.AddNewAction(constants.ActionPlayerRessource,j.UID,k,e)\n\t}\n}", "title": "" }, { "docid": "9a895b50d0302b515186cbe093db7797", "score": "0.52670646", "text": "func (s *Server) Send(ctx context.Context,\n\tin *tr.CarrierDto,\n) (*tr.Empthy, error) {\n\tselect {\n\tcase s.loggerCh <- *in:\n\tcase s.trashBoxCh <- *in:\n\t}\n\treturn &tr.Empthy{}, nil\n}", "title": "" }, { "docid": "c050fdcea0cf5934da9decc5adfeda18", "score": "0.52625763", "text": "func (u *UIController) AddToInventory(ingredient string) {\n\tu.chef.AddToInventory(ingredient)\n}", "title": "" }, { "docid": "3c5e49f1eb53c6472fb4e6d57424006a", "score": "0.52537495", "text": "func (i *InventoryModifyHandler) MarshalJSON() ([]byte, error) {\n\tvar actionType string\n\taction := uint32(i.Action)\n\tinventoryOperationID := Constants.ByKeys[\"InventoryOperationBaseValue\"]\n\tif action == inventoryOperationID {\n\t\tactionType = \"discard\"\n\t} else if action == inventoryOperationID+1 {\n\t\tactionType = \"move\"\n\t} else if action == inventoryOperationID+2 {\n\t\tactionType = \"swap\"\n\t} else if action == inventoryOperationID+5 {\n\t\tactionType = \"merge\"\n\t} else if action == inventoryOperationID+10 {\n\t\tactionType = \"split\"\n\t}\n\treturn jsoniter.Marshal(&struct {\n\t\tSeq uint32 `json:\"seq\"`\n\t\tAction string `json:\"action\"`\n\t\tPad0006 [6]uint8 `json:\"pad_0006\"`\n\t\tFromContainer uint16 `json:\"fromContainer\"`\n\t\tPad000E [2]uint8 `json:\"pad_000E\"`\n\t\tFromSlot uint8 `json:\"fromSlot\"`\n\t\tPad0011 [15]uint8 `json:\"pad_0011\"`\n\t\tToContainer uint16 `json:\"toContainer\"`\n\t\tPad0022 [2]uint8 `json:\"pad_0022\"`\n\t\tToSlot uint8 `json:\"toSlot\"`\n\t\tPad0025 [3]uint8 `json:\"pad_0025\"`\n\t\tSplitCount uint32 `json:\"splitCount\"`\n\t}{\n\t\tSeq: i.Seq,\n\t\tAction: actionType,\n\t\tPad0006: i.Pad0006,\n\t\tFromContainer: i.FromContainer,\n\t\tPad000E: i.Pad000E,\n\t\tFromSlot: i.FromSlot,\n\t\tPad0011: i.Pad0011,\n\t\tToContainer: i.ToContainer,\n\t\tPad0022: i.Pad0022,\n\t\tToSlot: i.ToSlot,\n\t\tPad0025: i.Pad0025,\n\t\tSplitCount: i.SplitCount,\n\t})\n}", "title": "" }, { "docid": "4e222ff8a98baecaa74ef3a36f0e70f8", "score": "0.52326035", "text": "func (a *account) Send(id rune, amount int) {\n\tif a.mediator == nil {\n\t\tlog.Println(\"mediator required\")\n\t\treturn\n\t}\n\ta.mediator.Notify('A', amount)\n}", "title": "" }, { "docid": "beccfd92936dbbf16692d20713dbc435", "score": "0.5228417", "text": "func (client *GslbInventoryClient) Create(obj *models.GslbInventory, options ...session.ApiOptionsParams) (*models.GslbInventory, error) {\n\tvar robj *models.GslbInventory\n\terr := client.aviSession.Post(client.getAPIPath(\"\"), obj, &robj, options...)\n\treturn robj, err\n}", "title": "" }, { "docid": "6681a6b62f3c0aa25890defc9b7de984", "score": "0.52220803", "text": "func (cm *rpcConnManager) AddRebroadcastInventory(iv *wire.InvVect, data interface{}) {\n\t// cm.AddRebroadcastInventory(iv, data)\n}", "title": "" }, { "docid": "c5b0559a3252dbc13d7ea490b5d8fa06", "score": "0.5202617", "text": "func (state *npcState) SendShop(goods [][]int32) {\n\tstate.goods = goods\n\tstate.conn.Send(packetShop(state.npcID, goods))\n}", "title": "" }, { "docid": "62d88b3a026d660d57353811e3b7746c", "score": "0.51937586", "text": "func (marshaler *JSONMessageMarshaler) Send(command string, args Args, kwargs KWArgs) error {\n\treturn marshaler.encoder.Encode(message{command, args, kwargs})\n}", "title": "" }, { "docid": "dfb041e37deae13c5aa94aec3a2839ff", "score": "0.51729834", "text": "func (srv *Server) handle_list_inventory() {\n\tfor idx, val := range item_names {\n\t\tfmt.Fprintf(os.Stdout, \"%s %d\\n\",\n\t\t\tval, srv.record.Amounts[idx])\n\t}\n}", "title": "" }, { "docid": "f3886eefcbde4e19a715b6e7fc088448", "score": "0.51688915", "text": "func SendRaw(selp *iotextypes.Action) error {\n\tconn, err := util.ConnectToEndpoint(config.ReadConfig.SecureConnect && !config.Insecure)\n\tif err != nil {\n\t\treturn output.NewError(output.NetworkError, \"failed to connect to endpoint\", err)\n\t}\n\tdefer conn.Close()\n\tcli := iotexapi.NewAPIServiceClient(conn)\n\tctx := context.Background()\n\n\tjwtMD, err := util.JwtAuth()\n\tif err == nil {\n\t\tctx = metautils.NiceMD(jwtMD).ToOutgoing(ctx)\n\t}\n\n\trequest := &iotexapi.SendActionRequest{Action: selp}\n\tif _, err = cli.SendAction(ctx, request); err != nil {\n\t\tif sta, ok := status.FromError(err); ok {\n\t\t\treturn output.NewError(output.APIError, sta.Message(), nil)\n\t\t}\n\t\treturn output.NewError(output.NetworkError, \"failed to invoke SendAction api\", err)\n\t}\n\tshash := hash.Hash256b(byteutil.Must(proto.Marshal(selp)))\n\ttxhash := hex.EncodeToString(shash[:])\n\tmessage := sendMessage{Info: \"Action has been sent to blockchain.\", TxHash: txhash, URL: \"https://\"}\n\tswitch config.ReadConfig.Explorer {\n\tcase \"iotexscan\":\n\t\tif strings.Contains(config.ReadConfig.Endpoint, \"testnet\") {\n\t\t\tmessage.URL += \"testnet.\"\n\t\t}\n\t\tmessage.URL += \"iotexscan.io/action/\" + txhash\n\tcase \"iotxplorer\":\n\t\tmessage.URL = \"iotxplorer.io/actions/\" + txhash\n\tdefault:\n\t\tmessage.URL = config.ReadConfig.Explorer + txhash\n\t}\n\tfmt.Println(message.String())\n\treturn nil\n}", "title": "" }, { "docid": "7a88af8395bc779fad5f8d9b0745c290", "score": "0.5155837", "text": "func (is *Inventory) String() string {\n\tstrs := []string{}\n\tfor _, item := range is.GetItems() {\n\t\tstrs = append(strs, item.String())\n\t}\n\tsort.Strings(strs)\n\treturn strings.Join(strs, \", \")\n}", "title": "" }, { "docid": "31f9ea63dd6066b544656a0a5058e276", "score": "0.5155429", "text": "func (marshaler *MsgPackMessageMarshaler) Send(command string, args types.Args, kwargs types.KWArgs) error {\n\treturn marshaler.encoder.Encode(message{command, args, kwargs})\n}", "title": "" }, { "docid": "2dc48e421dcf6c0fced72a7dc5c154e0", "score": "0.51507163", "text": "func (d *Dota2) SendCandyShopDevClearInventory(\n\tctx context.Context,\n\tcandyShopID uint32,\n) (*protocol.CMsgClientToGCCandyShopDevClearInventoryResponse, error) {\n\treq := &protocol.CMsgClientToGCCandyShopDevClearInventory{\n\t\tCandyShopId: &candyShopID,\n\t}\n\tresp := &protocol.CMsgClientToGCCandyShopDevClearInventoryResponse{}\n\n\treturn resp, d.MakeRequest(\n\t\tctx,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgClientToGCCandyShopDevClearInventory),\n\t\treq,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgClientToGCCandyShopDevClearInventoryResponse),\n\t\tresp,\n\t)\n}", "title": "" }, { "docid": "9dd5045fe41eeeeae1a99930b82036aa", "score": "0.5147443", "text": "func (d *DAC) SendEquipLoadout(\n\tctx context.Context,\n\tloadoutSlot []uint32,\n\titemID []uint64,\n\tloadoutSubSlot []uint32,\n) (*protocol.CMsgClientToGCEquipLoadoutResponse, error) {\n\treq := &protocol.CMsgClientToGCEquipLoadout{\n\t\tLoadoutSlot: loadoutSlot,\n\t\tItemId: itemID,\n\t\tLoadoutSubSlot: loadoutSubSlot,\n\t}\n\tresp := &protocol.CMsgClientToGCEquipLoadoutResponse{}\n\n\treturn resp, d.MakeRequest(\n\t\tctx,\n\t\tuint32(protocol.EGCDACClientMessages_k_EMsgClientToGCEquipLoadout),\n\t\treq,\n\t\tuint32(protocol.EGCDACClientMessages_k_EMsgClientToGCEquipLoadoutResponse),\n\t\tresp,\n\t)\n}", "title": "" }, { "docid": "96b059f762ab56de15fb1b7d2c583d64", "score": "0.5138508", "text": "func (m *Mover)Send(a,b *place.Place){\n\tp:=m.makePackage(a)\n\tb.InsertPack(p)\n\tif m.favorit==0{\n\t\tm.favorit=1\n\t}else{\n\t\tm.favorit=0\n\t}\n}", "title": "" }, { "docid": "d59e1f79857a7070b1539752fb81c342", "score": "0.51343966", "text": "func SendTx(c *cli.Context) error {\n if len(c.Args()) != 2 {\n return fmt.Errorf(\"To and amount must be specified\")\n }\n to := c.Args()[0]\n amount := c.Args()[1]\n var from string \n if c.String(\"from\") == \"\" {\n from = \"default\"\n } else {\n from = c.String(\"from\")\n }\n memo := c.String(\"memo\")\n \n var res types.SendTxResponse\n err := Call(\"sendtx\", map[string]string{\n \"to\": to, \n \"amount\": amount,\n \"from\": from,\n \"memo\": memo,\n }, &res)\n \n out, err := json.MarshalIndent(res, \"\",\" \")\n if err != nil {\n return err\n }\n fmt.Println(string(out))\n return nil\n}", "title": "" }, { "docid": "104af58815fd1be533e436412a7e099f", "score": "0.5119255", "text": "func (a *InventoryApiService) PatchInventoryGenericInventoryExecute(r ApiPatchInventoryGenericInventoryRequest) (*InventoryGenericInventory, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *InventoryGenericInventory\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"InventoryApiService.PatchInventoryGenericInventory\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/inventory/GenericInventories/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.inventoryGenericInventory == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"inventoryGenericInventory is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.inventoryGenericInventory\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "af96d79a279a355f648245f256abb432", "score": "0.51115704", "text": "func GetInventory(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{})\n}", "title": "" }, { "docid": "081e6f41b586fd0211c667b4b40a3879", "score": "0.51082206", "text": "func EncodeInventoryReply(ir InventoryReply) ([]byte, error) {\n\treturn json.Marshal(ir)\n}", "title": "" }, { "docid": "f052b3a3361436c01cf01eef1ac04130", "score": "0.5089201", "text": "func (p *ticketVotePlugin) inventoryAdd(token string, s ticketvote.VoteStatusT) {\n\terr := p.invAdd(token, s)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"invAdd %v %v: %v\", token, s, err))\n\t}\n}", "title": "" }, { "docid": "4ed114b46605bbb454ca6c5cd7b431f7", "score": "0.50675803", "text": "func (conn *Connection) Send(typ string, args ...string) (n int, err error) {\n\tif args == nil {\n\t\targs = make([]string, 0)\n\t}\n\tconn.currentID++\n\treturn conn.write(Message{\n\t\tID: conn.currentID,\n\t\tType: typ,\n\t\tArguments: args,\n\t})\n}", "title": "" }, { "docid": "0b2418e64e75606eec701c4bd4a7a33f", "score": "0.5066564", "text": "func (client *Client) SendOrder(action, otype string, amount, price float64) (int64, error) {\n\t// Set method\n\tvar method string\n\tif action == \"buy\" {\n\t\tmethod = \"buyOrder2\"\n\t} else if action == \"sell\" {\n\t\tmethod = \"sellOrder2\"\n\t} else {\n\t\treturn 0, fmt.Errorf(\"%s SendOrder error: only \\\"buy\\\" and \\\"sell\\\" actions supported\", client)\n\t}\n\n\t// Check order type\n\tif otype != \"limit\" {\n\t\treturn 0, fmt.Errorf(\"%s SendOrder error: only limit orders supported\", client)\n\t}\n\n\t// Set params\n\tstrPrice := strconv.FormatFloat(price, 'f', 2, 64)\n\tstrAmount := strconv.FormatFloat(amount, 'f', 4, 64)\n\tparams := []interface{}{strPrice, strAmount, client.market}\n\tparamString := strings.Join([]string{strPrice, strAmount, client.market}, \",\")\n\n\t// Send POST\n\treq := request{method, params, 1}\n\tdata, err := client.post(method, paramString, req)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%s SendOrder error: %s\", client, err)\n\t}\n\n\t// Unmarshal\n\tvar response struct {\n\t\tResult int64\n\t\tError struct {\n\t\t\tCode int\n\t\t\tMessage string\n\t\t}\n\t}\n\tif err := json.Unmarshal(data, &response); err != nil {\n\t\treturn 0, fmt.Errorf(\"%s SendOrder error: %s\", client, err)\n\t}\n\tif response.Error.Message != \"\" {\n\t\treturn 0, fmt.Errorf(\"%s SendOrder error code %d: %s\", client, response.Error.Code, response.Error.Message)\n\t}\n\n\treturn response.Result, nil\n}", "title": "" }, { "docid": "c8bacf8ac137b76b54ca26ca84951f85", "score": "0.5061497", "text": "func (n Notification) notifyInStock(item Item) {\n fmt.Printf(\"%s : %s\\n\", item.name, \"IN STOCK\")\n err := beeep.Notify(\"In Stock Item\", item.url, \"assets/warehouse.png\")\n if err != nil {\n panic(err)\n }\n message := n.buildTextMessage(item)\n n.sendTextMessage(message)\n}", "title": "" }, { "docid": "ec52fffffa6d2213f9de1efd3d909d67", "score": "0.5058944", "text": "func (g *Gift) Send(c *gin.Context) {\n\tvar errorCode codes.ErrorCode\n\tg.userInfo, errorCode = g.validUserInfo(c)\n\tif g.userInfo == nil {\n\t\trespformat := g.Response(c, errorCode, nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\trc := roomClient.NewRoom(g.getRoomRPCAddress())\n\tuserRoom := &pbroom.UserRoom{\n\t\tUserID: g.userInfo.UserID,\n\t\tRoomID: g.getRoomID(c),\n\t}\n\troomInfo, err := rc.Info(userRoom)\n\tif err != nil {\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\tif !isRoomValid(roomInfo) {\n\t\trespformat := g.Response(c, rpcErrorFormat(codes.ErrorCodeBroadcastClosed.String()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\tgiftID := &pbgift.GiftID{GiftID: g.getGiftID(c)}\n\tgc := giftClient.NewGift(g.getGiftPCAddress())\n\tgiftInfo, err := gc.Info(giftID)\n\n\tif err != nil {\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\tamm := &pbprofile.Ammount{\n\t\tUserID: g.userInfo.UserID,\n\t\tSnowFlake: giftInfo.SnowFlake,\n\t\tSnowBall: giftInfo.SnowBall,\n\t\tTypeID: uint32(typeids.PaymentSendGift),\n\t\tTargetID: giftInfo.GiftID,\n\t}\n\tpc := profileClient.NewProfile(g.getProfileRPCAddress())\n\twd, err := pc.Withdraw(amm)\n\tif err != nil {\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\tmsgID := wd.MsgID\n\t// gift send_gift\n\tsendGift := &pbgift.SendGift{\n\t\tGiftID: giftInfo.GiftID,\n\t\tUserID: g.userInfo.UserID,\n\t\tToUserID: roomInfo.UserID,\n\t\tBroadcastID: roomInfo.Broadcast.BroadcastID,\n\t\tMsgID: msgID,\n\t\tNumber: 1,\n\t}\n\t// maybe can use gc\n\tgc2 := giftClient.NewGift(g.getGiftPCAddress())\n\tsendReply, err := gc2.Send(sendGift)\n\tif err != nil {\n\t\tpc2 := profileClient.NewProfile(g.getProfileRPCAddress())\n\t\tmsg := &pbprofile.Message{\n\t\t\tMsgID: msgID,\n\t\t\tUserID: g.userInfo.UserID,\n\t\t}\n\t\t_, err2 := pc2.WithdrawRollback(msg)\n\t\tif err2 != nil {\n\t\t\trespformat := g.Response(c, rpcErrorFormat(err2.Error()), nil)\n\t\t\tc.JSON(http.StatusOK, respformat)\n\t\t\treturn\n\t\t}\n\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\t// profile Withdraw commit\n\tmsg := &pbprofile.Message{\n\t\tMsgID: sendReply.MsgID,\n\t\tUserID: g.userInfo.UserID,\n\t}\n\tpc3 := profileClient.NewProfile(g.getProfileRPCAddress())\n\t_, err = pc3.WithdrawCommit(msg)\n\tif err != nil {\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\t// gift broadcast\n\tgc3 := giftClient.NewGift(g.getGiftPCAddress())\n\tsendGiftID := &pbgift.SendGiftID{\n\t\tSendGiftID: sendReply.SendGiftID,\n\t\tUsername: g.userInfo.Nickname,\n\t}\n\tbroadcastReply, err := gc3.Broadcast(sendGiftID)\n\tif err != nil {\n\t\trespformat := g.Response(c, rpcErrorFormat(err.Error()), nil)\n\t\tc.JSON(http.StatusOK, respformat)\n\t\treturn\n\t}\n\n\trespformat := g.Response(c, codes.ErrorCodeSuccess, broadcastReply)\n\tc.JSON(http.StatusOK, respformat)\n\treturn\n}", "title": "" }, { "docid": "c9b9f04b052e9c71e6198e675bcd5049", "score": "0.50573856", "text": "func SendMsjPet(cod string, data interface{}, e echo.Context) error {\n\tmsjs := GetMsjPet()\n\treturn msjs.Send(cod, data, e)\n}", "title": "" }, { "docid": "b7280eff39968443115d96ba1523d2a0", "score": "0.504587", "text": "func AddInventory(w http.ResponseWriter, r *http.Request) {\n\tvalidateRequestMethod(w, r, \"POST\")\n\n\tinv := parseRequestToInventory(w, r)\n\n\tresult, err := api.SaveInventory(inv)\n\n\tcheckInternalServerError(err, w)\n\n\tcheckQueryResult(result, \"Inventory has been successfully Added to database.\", \"Cannot add inventory.\", w)\n}", "title": "" }, { "docid": "9aaaab373a8453569cb776bdb34fb267", "score": "0.50433993", "text": "func (o *GetLolInventoryV1InventoryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tvaluesInventoryTypes := o.InventoryTypes\n\n\tjoinedInventoryTypes := swag.JoinByFormat(valuesInventoryTypes, \"\")\n\t// query array param inventoryTypes\n\tif err := r.SetQueryParam(\"inventoryTypes\", joinedInventoryTypes...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c694b3ba52845c8e10bd7671753ca45", "score": "0.50380737", "text": "func (t *ModData) ModSendData(m modulescommon.ModOutput, reply *[]byte) error {\n\tlogging.Logger.Println(\"SendData called\")\n\tlogging.Logger.Println(m)\n\t//Send Loot data for it to be processed\n\tif m.OutputType == \"Loot\" {\n\t\tloot.SaveLoot(m.AgentKey, m.Output)\n\t}\n\tjsonM, _ := json.Marshal(m)\n\toutMsg := websockets.SendMessage{\n\t\tType: \"Agent\",\n\t\tFunctionName: \"ModOutput\",\n\t\tData: string(jsonM),\n\t\tSuccess: true,\n\t}\n\twebsockets.AlertRegisteredUsers(outMsg, m.AgentKey)\n\tlogging.Logger.Println(\"End of ModSendData\")\n\treturn nil\n}", "title": "" }, { "docid": "03a3896af7d06684477c50eccf283043", "score": "0.5014269", "text": "func (c *Cli) Send(recvAddr string, amount int64) (string, error) {\n\t// validate the recvAddr\n\tif _, err := cipher.DecodeBase58Address(recvAddr); err != nil {\n\t\treturn \"\", err\n\t}\n\tif amount < 1 {\n\t\treturn \"\", fmt.Errorf(\"Can't send %d coins\", amount)\n\t}\n\n\tamt := strconv.FormatInt(amount, 10)\n\n\tv, err := c.run(exec.Command(\"skycoin-cli\", \"send\", \"-j\", \"-f\", c.wltFile, recvAddr, amt))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar rlt struct {\n\t\tTxid string `json:\"txid\"`\n\t}\n\n\tif err := json.NewDecoder(bytes.NewReader(v)).Decode(&rlt); err != nil {\n\t\treturn \"\", errors.New(string(v))\n\t}\n\n\treturn rlt.Txid, nil\n}", "title": "" }, { "docid": "7b492e7f9a13c9a8303679646b755a1a", "score": "0.5010179", "text": "func (ss *SyncServer) send(b *Box, conn net.Conn, cType ...int) {\n\ttType := OptionalParamInt(cType)\n\n\tswitch tType {\n\tcase 0:\n\t\tss.tcpsend(b, conn)\n\t\tbreak\n\tcase 1:\n\t\tss.wssend(b, conn)\n\t\tbreak\n\tdefault:\n\t\tlog.Println(\"Box dropped, connection type not found.\")\n\t}\n\n}", "title": "" }, { "docid": "1fbb60a9d796be5cee4bd4655325044b", "score": "0.5008444", "text": "func (r *Reader) PlayerInventoryAction(x *UseItemTransactionData) {\n\tr.Varint32(&x.LegacyRequestID)\n\tif x.LegacyRequestID < -1 && (x.LegacyRequestID&1) == 0 {\n\t\tSlice(r, &x.LegacySetItemSlots)\n\t}\n\tSlice(r, &x.Actions)\n\tr.Varuint32(&x.ActionType)\n\tr.BlockPos(&x.BlockPosition)\n\tr.Varint32(&x.BlockFace)\n\tr.Varint32(&x.HotBarSlot)\n\tr.ItemInstance(&x.HeldItem)\n\tr.Vec3(&x.Position)\n\tr.Vec3(&x.ClickedPosition)\n\tr.Varuint32(&x.BlockRuntimeID)\n}", "title": "" }, { "docid": "09531f3e04d3bff1d54ba1beb1281d56", "score": "0.50042176", "text": "func DeleteInventory(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tid, err := strconv.Atoi(params.ByName(\"id\"))\n\tif err != nil {\n\t\tSend(&w, err, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tdb.Conn.Where(\"ID = ?\", id).Delete(&entities.Inventory{})\n\tSend(&w, \"\", http.StatusOK)\n}", "title": "" }, { "docid": "65fdc6ab6458b4ed84b3b87984bdbcea", "score": "0.49974406", "text": "func (client BitcoindClient) Send(method string, args interface{}) string {\n\tvar reply string\n\terr := client.jsonClient.Call(method, args, &reply)\n\tspew.Dump(reply)\n\tif err != nil {\n\t\tlog.Fatal(\"JSON call error:\", err)\n\t}\n\treturn reply\n}", "title": "" }, { "docid": "bddf2830896493079f0b975ec44a2c39", "score": "0.49789977", "text": "func UpdateInventory(w http.ResponseWriter, r *http.Request) {\n\tvalidateRequestMethod(w, r, \"PUT\")\n\n\tinv := parseRequestToInventory(w, r)\n\tresult, err := api.EditInventoryData(inv)\n\n\tcheckInternalServerError(err, w)\n\n\tcheckQueryResult(result, \"Inventory has been successfully Updated.\", \"Cannot update inventory.\", w)\n}", "title": "" }, { "docid": "c3c019ad538a895b4cce3dab4fc239eb", "score": "0.49733016", "text": "func (p *player) send(cmd string, data interface{}) {\n\tp.client.Router.Send(cmd, data)\n}", "title": "" }, { "docid": "92ef0fab5042fa9c1523a9c5548e150e", "score": "0.4965513", "text": "func (c *Client) Send(mtype string, data Object) error {\n\treturn c.writeTo(mtype, data)\n}", "title": "" }, { "docid": "4a3b8749993561dbf6a83e3e323587c6", "score": "0.49556503", "text": "func add_inventory(inventory InventoryType) {\n\tvar hashProductos []dijkstra.Hashable\n\tfor i := 0; i < len(inventory.Inventarios); i++ {\n\t\tPosition := list.Get_position(inventory.Inventarios[i].Departamento, inventory.Inventarios[i].Tienda, inventory.Inventarios[i].Calificacion)\n\t\tfor j := 0; j < len(inventory.Inventarios[i].Productos); j++ {\n\t\t\ttmp := inventory.Inventarios[i].Productos[j]\n\t\t\tproduct := Structs.Product{tmp.Nombre, tmp.Codigo, tmp.Descripcion, tmp.Precio, tmp.Cantidad, tmp.Imagen, tmp.Almacenamiento}\n\t\t\thashProductos = append(hashProductos, dijkstra.Block(product.Nombre+\"\\\\n\"+product.Almacenamiento+\"\\\\n\"+strconv.FormatFloat(product.Precio, 'E', -1, 32)+\"\\\\n\"+product.Descripcion))\n\t\t\tlist.Get_store_node(inventory.Inventarios[i].Tienda, inventory.Inventarios[i].Calificacion, list.GlobalVector[Position], product)\n\t\t}\n\t\tlist.VerNodos(list.GlobalVector[Position])\n\t}\n\tdijkstra.PrintTree(dijkstra.BuildTree(hashProductos)[0].(dijkstra.Node))\n\tdot.CrearArchivoEvery(dijkstra.DotMerkleTree+\"}\", \"txt\", \"DotAnios\")\n\tdot.GraphEvery(\"MerkleProductos\", \"jpg\", \"DotAnios\")\n\tdijkstra.DotMerkleTree = \"digraph { node [shape=box, style=\\\"filled\\\", fillcolor=\\\"#61e665\\\"];\"\n}", "title": "" }, { "docid": "39bbf50c06a79b2efe637bd6846c4345", "score": "0.49459216", "text": "func (c *clientConnection) sendType(typ string, message interface{}) {\n\tb, err := json.Marshal(message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tctx, cancel := context.WithTimeout(c.ctx, time.Second)\n\tdefer cancel()\n\n\t_, err = Handler(ctx, events.APIGatewayWebsocketProxyRequest{\n\t\tBody: string(b),\n\t\tRequestContext: events.APIGatewayWebsocketProxyRequestContext{\n\t\t\tConnectionID: c.connID,\n\t\t\tEventType: typ,\n\t\t},\n\t})\n\n\tExpect(err).NotTo(HaveOccurred())\n}", "title": "" }, { "docid": "7f5aabdcd52bb90e0d32c9cbdf95ff63", "score": "0.49451986", "text": "func addItemToInventory(inv *[]string, index int, itemID string) {\n\tif index != -1 {\n\t\tvar inventory = *inv\n\n\t\tinventory[index] = itemID\n\n\t\t*inv = inventory\n\t}\n}", "title": "" }, { "docid": "823fd4e21aa244127984a1955ecf6cc8", "score": "0.49443123", "text": "func (r ApiUpdateInventoryGenericInventoryRequest) InventoryGenericInventory(inventoryGenericInventory InventoryGenericInventory) ApiUpdateInventoryGenericInventoryRequest {\n\tr.inventoryGenericInventory = &inventoryGenericInventory\n\treturn r\n}", "title": "" }, { "docid": "7486c783e5e5427a18fff4759aef1d33", "score": "0.49426213", "text": "func (r ApiPatchInventoryGenericInventoryRequest) InventoryGenericInventory(inventoryGenericInventory InventoryGenericInventory) ApiPatchInventoryGenericInventoryRequest {\n\tr.inventoryGenericInventory = &inventoryGenericInventory\n\treturn r\n}", "title": "" }, { "docid": "809338280a847f94b4c3a2a14fbb53f7", "score": "0.49411234", "text": "func (a *InventoryApiService) UpdateInventoryGenericInventoryExecute(r ApiUpdateInventoryGenericInventoryRequest) (*InventoryGenericInventory, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *InventoryGenericInventory\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"InventoryApiService.UpdateInventoryGenericInventory\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/inventory/GenericInventories/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.inventoryGenericInventory == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"inventoryGenericInventory is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.inventoryGenericInventory\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "12758ba2870422798087cb88119877f9", "score": "0.49394447", "text": "func (i *Inventory) Add(id int, qty int) int {\n\tif qty == 0 {\n\t\treturn -1\n\t}\n\tif !i.CanHold(id, qty) {\n\t\tAddItem(NewGroundItemFor(i.Owner.UsernameHash(), id, qty, i.Owner.X(), i.Owner.Y()))\n\t\ti.Owner.Message(\"Your inventory is full, the \" + definitions.Items[id].Name + \" drops to the ground!\")\n\t\treturn -1\n\t}\n\tif item := i.GetByID(id); (i.stackEverything || definitions.Items[id].Stackable) && item != nil {\n\t\tif item.Amount < 0 {\n\t\t\tlog.Suspicious.Println(errors.NewArgsError(\"*Inventory.Add(id,amt) Resulting item amount less than zero: \" + strconv.FormatUint(uint64(item.Amount+qty), 10)))\n\t\t}\n\t\tif item.Amount+qty > math.MaxInt32 {\n\t\t\titem.Amount = math.MaxInt32\n\t\t\treturn i.GetIndex(id)\n\t\t}\n\t\titem.Amount += qty\n\t\treturn i.GetIndex(id)\n\t}\n\n\tif qty < 0 {\n\t\treturn -1\n\t}\n\n\tnewItem := &Item{ID: id, Amount: qty}\n\ti.Lock.Lock()\n\ti.List = append(i.List, newItem)\n\ti.Lock.Unlock()\n\treturn i.Size() - 1\n}", "title": "" }, { "docid": "569f8135ab35cc67f9df63dddd9fb89d", "score": "0.49273846", "text": "func (p *ticketVotePlugin) inventoryUpdate(token string, s ticketvote.VoteStatusT) {\n\terr := p.invUpdate(token, s, 0)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"invUpdate %v %v: %v\", token, s, err))\n\t}\n}", "title": "" }, { "docid": "087141ef2e28e864abb78f46d1745cae", "score": "0.49256673", "text": "func (m *Mobile) inv(cmd *command.Command) (handled bool) {\n\n\tif cmd.Target != \"\" {\n\t\treturn\n\t}\n\n\tresponse := \"\"\n\n\tif inventory := m.Inventory.List(); len(inventory) == 0 {\n\t\tresponse = \"You are not carrying anything.\"\n\t} else {\n\t\tresponse = \"You are currently carrying:\\n\"\n\t\tfor _, item := range inventory {\n\t\t\tresponse += \"\\t\" + item.Name() + \"\\n\"\n\t\t}\n\t}\n\tcmd.Respond(response)\n\n\treturn true\n}", "title": "" }, { "docid": "f36c38b62e61ab06ac6547cfd4294dd9", "score": "0.4925068", "text": "func (inv *Inventory) PutItem(item *Slot) {\n // TODO optimize this algorithm, maybe by maintaining a map of non-full\n // slots containing an item of various item type IDs. Additionally, it\n // should prefer to put stackable items into stacks of the same type,\n // rather than in empty slots.\n for slotIndex := range inv.slots {\n if item.Count <= 0 {\n break\n }\n slot := &inv.slots[slotIndex]\n if slot.Add(item) {\n inv.slotUpdate(slot, SlotId(slotIndex))\n }\n }\n}", "title": "" }, { "docid": "a98079ae3963cc9ed6e88e28900fc2a9", "score": "0.4921746", "text": "func (h *InventoryTransactionHandler) resendInventories(s *Session) {\n\ts.sendInv(s.inv, protocol.WindowIDInventory)\n\ts.sendInv(s.ui, protocol.WindowIDUI)\n\ts.sendInv(s.offHand, protocol.WindowIDOffHand)\n\ts.sendInv(s.armour.Inv(), protocol.WindowIDArmour)\n}", "title": "" }, { "docid": "0d631f6b1dce0581cf1a0920bd746a56", "score": "0.4921383", "text": "func (m *PstnCallLogRow) GetInventoryType()(*string) {\n val, err := m.GetBackingStore().Get(\"inventoryType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "9e9b13830c4528d0e8e999e7ea611f2a", "score": "0.49125507", "text": "func (i *Inventory) String() string {\n\treturn fmt.Sprintf(\"%s%s%s%s%s%s%s\",\n\t\ti.Namespace, fieldSeparator,\n\t\ti.Name, fieldSeparator,\n\t\ti.GroupKind.Group, fieldSeparator,\n\t\ti.GroupKind.Kind)\n}", "title": "" }, { "docid": "7364e3652579d07b4108675af7e5a8fd", "score": "0.49113765", "text": "func TransferItem(request *skillserver.EchoRequest) *skillserver.EchoResponse {\n\n\tresponse := skillserver.NewEchoResponse()\n\taccessToken := request.Session.User.AccessToken\n\tcountStr, _ := request.GetSlotValue(\"Count\")\n\tcount := -1\n\tif countStr != \"\" {\n\t\ttempCount, ok := strconv.Atoi(countStr)\n\t\tif ok != nil {\n\t\t\tresponse = skillserver.NewEchoResponse()\n\t\t\tresponse.OutputSpeech(\"Sorry Guardian, I didn't understand the number you asked to be transferred. Do not specify a quantity if you want all to be transferred.\")\n\t\t\treturn response\n\t\t}\n\n\t\tif tempCount <= 0 {\n\t\t\toutput := fmt.Sprintf(\"Sorry Guardian, you need to specify a positive, non-zero number to be transferred, not %d\", tempCount)\n\t\t\tresponse.OutputSpeech(output)\n\t\t\treturn response\n\t\t}\n\n\t\tcount = tempCount\n\t}\n\n\titem, _ := request.GetSlotValue(\"Item\")\n\tsourceClass, _ := request.GetSlotValue(\"Source\")\n\tdestinationClass, _ := request.GetSlotValue(\"Destination\")\n\tif destinationClass == \"\" {\n\t\tresponse.OutputSpeech(\"Sorry Guardian, you must specify a destination for the items to be transferred.\")\n\t\treturn response\n\t}\n\n\tglg.Infof(\"Transferring %d of your %s from your %s to your %s\", count, strings.ToLower(item), strings.ToLower(sourceClass), strings.ToLower(destinationClass))\n\tspeech, err := bungie.TransferItem(strings.ToLower(item), accessToken, strings.ToLower(sourceClass), strings.ToLower(destinationClass), count)\n\tif err != nil {\n\t\traven.CaptureError(err, nil)\n\t\tresponse.OutputSpeech(\"Sorry Guardian, an error occurred trying to transfer that item.\")\n\t\treturn response\n\t}\n\n\tresponse.OutputSpeech(speech)\n\treturn response\n}", "title": "" }, { "docid": "f4ba02cf1c6859c77218028cdbb6162e", "score": "0.4910969", "text": "func (c *Client) send(msgType string) {\n\tc.Clock++\n\tmsg := Msg{c.ID, c.Clock, msgType}\n\n\tswitch msgType {\n\tcase \"Request\":\n\t\tfmt.Println(\"Node\", c.ID, \"--------REQ-------> Server\")\n\t\tc.Server.Channel <- msg\n\n\tcase \"Release\":\n\t\tfmt.Println(\"Node\", c.ID, \"--------RELEASE-------> Server\")\n\t\tc.Server.Channel <- msg\n\t}\n}", "title": "" }, { "docid": "4626fbd35e95df9e0dee485874a6a5e8", "score": "0.49044895", "text": "func (o *MicrosoftGraphConfigurationManagerClientEnabledFeatures) SetInventory(v bool) {\n\to.Inventory = &v\n}", "title": "" }, { "docid": "09c635c2953581aec88a67dd7520bb6b", "score": "0.49042693", "text": "func GetInventory(w http.ResponseWriter, r *http.Request) {\n\tvalidateRequestMethod(w, r, \"GET\")\n\n\tsku := r.FormValue(\"sku\")\n\tinv, err := api.GetInventoryBySKU(sku)\n\n\tcheckInternalServerError(err, w)\n\n\tjson.NewEncoder(w).Encode(inv)\n}", "title": "" }, { "docid": "0bb621500119dc87419c2217e359b330", "score": "0.49032766", "text": "func GetInventory(ctx *sweetygo.Context) error {\n\titems, err := model.GetInventory()\n\tif err != nil {\n\t\treturn ctx.JSON(500, 0, err.Error(), nil)\n\t}\n\tif len(items) == 0 {\n\t\treturn ctx.JSON(200, 0, \"no result found\", nil)\n\t}\n\treturn ctx.JSON(200, 1, \"success\", items)\n}", "title": "" }, { "docid": "75393ee81cd6b1f2ae7cf666e6a43530", "score": "0.48997748", "text": "func SendTransaction(abi abi.ABI, to, name string, inputs []interface{}, gas int) (resp json.RPCResponse, err error) {\n\tvar data string\n\tif data, err = Pack(abi, name, inputs...); err != nil {\n\t\treturn\n\t}\n\n\tc := crypto.GetInstance()\n\tr := rpc.GetInstance()\n\trespStr, err := r.SendTransaction(c.GetAddress(), to, data, gas)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresp = json.GetRPCResponseFromJSON(respStr)\n\treturn\n}", "title": "" }, { "docid": "b2f19338a3d846d6221dce0d260d37fe", "score": "0.4899328", "text": "func AddBulkInventory(w http.ResponseWriter, r *http.Request) {\n\tvalidateRequestMethod(w, r, \"POST\")\n\n\tinvs := parseArrayRequestToInventory(w, r)\n\n\tfor index := 0; index < len(invs); index++ {\n\t\tinv := invs[index]\n\t\t_, err := api.SaveInventory(inv)\n\t\tcheckInternalServerError(err, w)\n\t}\n\n\thttp.Redirect(w, r, \"/inventory/list\", http.StatusPermanentRedirect)\n}", "title": "" }, { "docid": "52d06d4e99d57891e9a2f6c6c849f035", "score": "0.48965263", "text": "func (self *IntkeyClient) sendTransaction(verb string, name string, value uint, wait uint) (string, error) {\n\tpayload := IntkeyPayload{\n\t\tVerb: verb,\n\t\tName: name,\n\t\tValue: value,\n\t}\n\n\tbatchId, err := self.ExecutePayload(&payload)\n\tif err != nil {\n\t\treturn batchId, err\n\t}\n\n\tif wait > 0 {\n\t\tself.WaitBatch(batchId, int(wait), 1)\n\t}\n\n\treturn batchId, nil\n}", "title": "" }, { "docid": "8c92659d2961258a57f071b986261591", "score": "0.48934522", "text": "func (client *TextmagicRestClient) SendInvite(data map[string]string) (bool, error) {\n\tvar success bool\n\n\tmethod := \"POST\"\n\n\tparams := preparePostParams(data)\n\n\turi := fmt.Sprintf(\"%s/%s\", client.BaseUrl(), SUBACCOUNT_RES)\n\n\tresponse, err := client.Request(method, uri, nil, params)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif response[0] == 204 {\n\t\tsuccess = true\n\t}\n\n\treturn success, err\n}", "title": "" }, { "docid": "d273e07c714dc970e94c740a6a867afa", "score": "0.48857158", "text": "func (a *Agent) Send(fitness float64) {\r\n\ta.chSend <- fitness\r\n\ta.isWorking = false\r\n}", "title": "" }, { "docid": "3c5aeb187fd5cbbdbb31cee4849d3ddd", "score": "0.486272", "text": "func (c *Client) Send(data interface{}) {\n\tmessage, _ := json.Marshal(data)\n\tc.sent <- message\n}", "title": "" }, { "docid": "338d3a06e9259d5fa231590dc4114f71", "score": "0.4860555", "text": "func (ec *executionContext) _Inventory_InventoryId(ctx context.Context, field graphql.CollectedField, obj *model.Inventory) (ret graphql.Marshaler) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = graphql.Null\n\t\t}\n\t}()\n\tfc := &graphql.FieldContext{\n\t\tObject: \"Inventory\",\n\t\tField: field,\n\t\tArgs: nil,\n\t\tIsMethod: false,\n\t\tIsResolver: false,\n\t}\n\n\tctx = graphql.WithFieldContext(ctx, fc)\n\tresTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {\n\t\tctx = rctx // use context from middleware stack in children\n\t\treturn obj.InventoryID, nil\n\t})\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn graphql.Null\n\t}\n\tif resTmp == nil {\n\t\tif !graphql.HasFieldError(ctx, fc) {\n\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t}\n\t\treturn graphql.Null\n\t}\n\tres := resTmp.(string)\n\tfc.Result = res\n\treturn ec.marshalNID2string(ctx, field.Selections, res)\n}", "title": "" }, { "docid": "029540f81842911b59520c2bcd125b1f", "score": "0.48600286", "text": "func (c *gencommon) Inventory() collector.InventoryStats {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn collector.InventoryStats{\n\t\tID: c.id,\n\t\tLastRunStart: c.lastStart.Format(time.RFC3339Nano),\n\t\tLastRunEnd: c.lastEnd.Format(time.RFC3339Nano),\n\t\tLastRunDuration: c.lastRunDuration.String(),\n\t\tLastError: c.lastError,\n\t}\n}", "title": "" }, { "docid": "47c357229cc9860a6fdcda32c9e9f7f0", "score": "0.48478404", "text": "func (env *testEnv) SendTransaction(ctx context.Context, tx *eth.Transaction) error {\n\t// do nothing to avoid executing by transactor, only generating needed\n\treturn nil\n}", "title": "" }, { "docid": "b41c3e5255a81a892f7d0c087af63be0", "score": "0.48423156", "text": "func (i InvItems) String() string {\n\tji, _ := json.Marshal(i)\n\treturn string(ji)\n}", "title": "" }, { "docid": "6f196bada6d39b10bfbf5f77ad2ddd9c", "score": "0.48305285", "text": "func Send(e *common.SimpleStock) error {\n\n\tif e == nil {\n\t\treturn errors.New(\"Required argument: event\")\n\t}\n\n\tlog.Printf(\"Data: %s - %s\", e.ID, e.Symbol)\n\n\tctx := cloudevents.EventContext{\n\t\tCloudEventsVersion: cloudevents.CloudEventsVersion,\n\t\tEventType: \"tech.knative.demo.kapi.stock\",\n\t\tEventID: e.ID,\n\t\tEventTime: e.RequestOn,\n\t\tContentType: \"application/json\",\n\t\tSource: \"tech.knative.demo.kapi\",\n\t}\n\n\treq, err := cloudevents.Binary.NewRequest(sinkURI, e, ctx)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to marshal: %v\", err)\n\t\treturn err\n\t}\n\n\tlog.Printf(\"Ce-Source: %s\", req.Header.Get(\"Ce-Source\"))\n\tlog.Printf(\"Ce-Eventtype: %s\", req.Header.Get(\"Ce-Eventtype\"))\n\n\treq.Header.Set(\"Ce-Source\", \"tech.knative.demo.kapi\")\n\treq.Header.Set(\"Ce-Eventtype\", \"tech.knative.demo.kapi.stock\")\n\n\tlog.Printf(\"Posting: %v\", req)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK &&\n\t\tresp.StatusCode != http.StatusAccepted {\n\t\tlog.Printf(\"Response Status Code: %d\", resp.StatusCode)\n\t\treturn fmt.Errorf(\"Invalid response status code: %s\", resp.Status)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading response body: %v\", err)\n\t\treturn err\n\t}\n\n\tlog.Printf(\"Response Body: %s\", string(body))\n\n\treturn nil\n\n}", "title": "" }, { "docid": "5b95a6f42cf9bd59ac18d42b8bc8dd7d", "score": "0.4825691", "text": "func (t *BaseCase) SendCommand(packID string) (PackFunc, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "75140720d4a7ae54ded1196e2f39df40", "score": "0.48244664", "text": "func (is *Inventory) Equals(other *Inventory) bool {\n\tif other == nil {\n\t\treturn false\n\t}\n\treturn is.String() == other.String()\n}", "title": "" }, { "docid": "acf54555cb042eef88ae2d98e04b84a8", "score": "0.48163632", "text": "func (s *server) AddRebroadcastInventory(iv *wire.InvVect, data interface{}) {\n\t// Ignore if shutting down.\n\tif atomic.LoadInt32(&s.shutdown) != 0 {\n\t\treturn\n\t}\n\n\ts.modifyRebroadcastInv <- broadcastInventoryAdd{invVect: iv, data: data}\n}", "title": "" }, { "docid": "ba2806aa40eb29f4828c15812dc1298e", "score": "0.48041266", "text": "func NewMobInventory(o ...*Mob) *MobInventory {\n\ti := &MobInventory{\n\t\tContents: make([]*Mob, 0, len(o)),\n\t}\n\n\tfor _, ob := range o {\n\t\ti.Add(ob)\n\t}\n\n\treturn i\n}", "title": "" }, { "docid": "0fa77d6ab59a03dd8cb5364173ec1e12", "score": "0.48034433", "text": "func (t *Transaction) sendAction(a *Action) error {\n\tswitch a.kind {\n\tcase CommandAction:\n\t\treturn t.conn.Send(a.name, a.args...)\n\tcase ScriptAction:\n\t\treturn a.script.Send(t.conn, a.args...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8db3b81f30ea95c95543b13ce558386a", "score": "0.4797454", "text": "func EditInventory(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tid, err := strconv.Atoi(params.ByName(\"id\"))\n\tif err != nil {\n\t\tSend(&w, err, http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tvar existing entities.Inventory\n\tvar updated entities.Inventory\n\n\tdb.Conn.First(&existing, id)\n\tbody, _ := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\terr = json.Unmarshal(body, &updated)\n\tif err != nil {\n\t\tSend(&w, err, http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tupdated.ID = existing.ID\n\tdb.Conn.Save(&updated)\n\tSend(&w, updated, http.StatusAccepted)\n}", "title": "" }, { "docid": "b362797a7e4b35e3ae509318c7d50c70", "score": "0.47958043", "text": "func (c *Client) TicketVoteInventory(i tkv1.Inventory) (*tkv1.InventoryReply, error) {\n\tresBody, err := c.makeReq(http.MethodPost,\n\t\ttkv1.APIRoute, tkv1.RouteInventory, i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ir tkv1.InventoryReply\n\terr = json.Unmarshal(resBody, &ir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ir, nil\n}", "title": "" }, { "docid": "28fc1a7557408cba6bcd9ddb2ef48f2a", "score": "0.4782596", "text": "func (i *Inventory) Equals(other *Inventory) bool {\n\tif other == nil {\n\t\treturn false\n\t}\n\treturn i.String() == other.String()\n}", "title": "" }, { "docid": "3850b68bf7cc18b9e19754b5aac4772b", "score": "0.4772658", "text": "func GetInventory(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tvar inv entities.Inventory\n\tid, err := strconv.Atoi(params.ByName(\"id\"))\n\tif err != nil {\n\t\tSend(&w, err, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdb.Conn.First(&inv, id)\n\tSend(&w, inv, http.StatusOK)\n}", "title": "" } ]
653968f78b0240fed15080ab198a5b99
AggregateInteger aggregates a point into the reducer.
[ { "docid": "83d944880243dbfff78d658470e47b2c", "score": "0.7787857", "text": "func (r *IntegerMeanReducer) AggregateInteger(p *IntegerPoint) {\n\tif p.Aggregated >= 2 {\n\t\tr.sum += p.Value * int64(p.Aggregated)\n\t\tr.count += p.Aggregated\n\t} else {\n\t\tr.sum += p.Value\n\t\tr.count++\n\t}\n}", "title": "" } ]
[ { "docid": "13dc23509679a8484572af7facc73174", "score": "0.7862297", "text": "func (r *IntegerMovingAverageReducer) AggregateInteger(p *IntegerPoint) {\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}", "title": "" }, { "docid": "657cd32f96cacd760b3b775c8e8d37f7", "score": "0.54185855", "text": "func (info Scalar) SumInt64(e *Config, key *keys.Int64) {\n\tdata := &Int64Data{Info: &info, key: key}\n\te.subscribe(key, data.sum)\n}", "title": "" }, { "docid": "37d35d704699e68f3e641893a7d43b83", "score": "0.5366683", "text": "func (r *FloatMeanReducer) AggregateFloat(p *FloatPoint) {\n\tif p.Aggregated >= 2 {\n\t\tr.sum += p.Value * float64(p.Aggregated)\n\t\tr.count += p.Aggregated\n\t} else {\n\t\tr.sum += p.Value\n\t\tr.count++\n\t}\n}", "title": "" }, { "docid": "7c6ceea4418ef42e83bced4676f65dde", "score": "0.5360276", "text": "func (m *Map) ReduceIntSum(reduce func(map[interface{}]interface{}) int) int {\n\tresult := 0\n\tsplits := m.splits\n\tfor i := 0; i < len(splits); i++ {\n\t\tresult += splits[i].reduceInt(reduce)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3a0c860822ea39c5202524e99e107128", "score": "0.517593", "text": "func (a SumAggregator) Aggregate(values []float64) float64 {\n\tresult := 0.0\n\tfor _, v := range values {\n\t\tresult += v\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1aa06f6536c44b14258e5ecacd370bca", "score": "0.51586866", "text": "func (m *Map) ReduceInt(\n\treduce func(map[interface{}]interface{}) int,\n\tjoin func(x, y int) int,\n) int {\n\tsplits := m.splits\n\t// NewMap ensures that len(splits) > 0\n\tresult := splits[0].reduceInt(reduce)\n\tfor i := 1; i < len(splits); i++ {\n\t\tresult = join(result, splits[i].reduceInt(reduce))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "482922fb001085a925c720a54ab4075e", "score": "0.5146841", "text": "func (r *IntegerMeanReducer) Emit() []FloatPoint {\n\treturn []FloatPoint{{\n\t\tTime: ZeroTime,\n\t\tValue: float64(r.sum) / float64(r.count),\n\t\tAggregated: r.count,\n\t}}\n}", "title": "" }, { "docid": "4abac5bcb32500bca0758cb3255436da", "score": "0.50968313", "text": "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}", "title": "" }, { "docid": "77739bd8147ec7831783197957c6a818", "score": "0.49845332", "text": "func (a AverageAggregator) Aggregate(values []float64) float64 {\n\tif len(values) == 0 {\n\t\treturn 0.0\n\t}\n\n\tresult := 0.0\n\tfor _, v := range values {\n\t\tresult += v\n\t}\n\treturn result / float64(len(values))\n}", "title": "" }, { "docid": "4ae972f804c189f2db9f78059d12552a", "score": "0.4978729", "text": "func add1(x, y int64) int64", "title": "" }, { "docid": "0247b44ea47c20c03987c6127e742ddf", "score": "0.4939186", "text": "func (a *Int64) Accumulate(i int, err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*a += Int64(i)\n}", "title": "" }, { "docid": "dbd593965262e750afe5529dbcef67cc", "score": "0.49347785", "text": "func Accumulate_int(input <-chan int) int {\n\tsum := 0\n\tfor x := range input {\n\t\tsum += x\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "8d4558ece63e4ebdd2319ff6887d53c8", "score": "0.491244", "text": "func (q *Counts) Aggregate() int {\n\tagg := 0\n\tfor _, count := range q.Counts {\n\t\tagg += count\n\t}\n\treturn agg\n}", "title": "" }, { "docid": "fbdfe81a3d8d641b44491c93d4f84a73", "score": "0.4873954", "text": "func (ecpgb *EntityContactPointGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = ecpgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{entitycontactpoint.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EntityContactPointGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb9e156137da5b49e63087a875ef90d9", "score": "0.48586056", "text": "func (cma *CMA) AddSampleInt64(s int64) float64 {\n\tcma.avg = cma.avg + (float64(s)-cma.avg)/float64(cma.n+1)\n\tcma.n++\n\treturn cma.avg\n}", "title": "" }, { "docid": "8fa628b7c6790973bb45b1925bafa765", "score": "0.48102996", "text": "func AvgInt(xs ...int) int {\n\tvar output int\n\tfor i := 0; i < len(xs); i++ {\n\t\toutput += xs[i]\n\t}\n\treturn output / len(xs)\n}", "title": "" }, { "docid": "3edfcb2959d6b0b230d8b21e8fe3670d", "score": "0.48048177", "text": "func add(x, y int) int", "title": "" }, { "docid": "047cf2afe6be2e3832be7c12148144dd", "score": "0.48022312", "text": "func (oupgb *OrgUnitPositionGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = oupgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{orgunitposition.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrgUnitPositionGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d2b823a11ab88fea8d3f932e0e9f9c65", "score": "0.47872356", "text": "func (ev *evaluator) evalInt(e Expr) int64 {\n\tsc := ev.evalScalar(e)\n\tif !convertibleToInt64(sc.Value) {\n\t\tev.errorf(\"scalar value %v overflows int64\", sc.Value)\n\t}\n\treturn int64(sc.Value)\n}", "title": "" }, { "docid": "028c0a2d1b2497c3141936485603dfe9", "score": "0.4757391", "text": "func (a *Int64) Accumulate64(i int64, err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*a += Int64(i)\n}", "title": "" }, { "docid": "d4318a7e9cb7df40c2cc2abea476e0a7", "score": "0.47395533", "text": "func (s *histValues[N]) Aggregate(value N, attr attribute.Set) {\n\t// Accept all types to satisfy the Aggregator interface. However, since\n\t// the Aggregation produced by this Aggregator is only float64, convert\n\t// here to only use this type.\n\tv := float64(value)\n\n\t// This search will return an index in the range [0, len(s.bounds)], where\n\t// it will return len(s.bounds) if value is greater than the last element\n\t// of s.bounds. This aligns with the buckets in that the length of buckets\n\t// is len(s.bounds)+1, with the last bucket representing:\n\t// (s.bounds[len(s.bounds)-1], +∞).\n\tidx := sort.SearchFloat64s(s.bounds, v)\n\n\ts.valuesMu.Lock()\n\tdefer s.valuesMu.Unlock()\n\n\tb, ok := s.values[attr]\n\tif !ok {\n\t\t// N+1 buckets. For example:\n\t\t//\n\t\t// bounds = [0, 5, 10]\n\t\t//\n\t\t// Then,\n\t\t//\n\t\t// buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞)\n\t\tb = newBuckets(len(s.bounds) + 1)\n\t\t// Ensure min and max are recorded values (not zero), for new buckets.\n\t\tb.min, b.max = v, v\n\t\ts.values[attr] = b\n\t}\n\tb.bin(idx, v)\n}", "title": "" }, { "docid": "8be9ef46c2a42dc40bb1509f0bef7f92", "score": "0.4706342", "text": "func IntAdd(z *big.Int, x, y *big.Int,) *big.Int", "title": "" }, { "docid": "34d34a3883908538d0ef1cd577771448", "score": "0.4687354", "text": "func (upgb *UnsavedPostGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = upgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{unsavedpost.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UnsavedPostGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3104658361435b5e450f9f131b8d844a", "score": "0.46871763", "text": "func (z *Int) Add(x, y *Int) {\n\tvar (\n\t\tcarry bool\n\t)\n\tz[0], carry = u64Add(x[0], y[0], carry)\n\tz[1], carry = u64Add(x[1], y[1], carry)\n\tz[2], carry = u64Add(x[2], y[2], carry)\n\t// Last group\n\tz[3] = x[3] + y[3]\n\tif carry {\n\t\tz[3]++\n\t}\n}", "title": "" }, { "docid": "40ceff4817392f86aa4c231b4581ed87", "score": "0.46791732", "text": "func (m mathUtil) SumInt(values ...int) int {\n\tvar total int\n\tfor _, v := range values {\n\t\ttotal += v\n\t}\n\treturn total\n}", "title": "" }, { "docid": "d7c863d70029a9d90c4ecb6c10c2c03f", "score": "0.46781215", "text": "func (m *Map) ParallelReduceIntSum(reduce func(map[interface{}]interface{}) int) int {\n\tvar recur func(splits []Split) int\n\trecur = func(splits []Split) int {\n\t\tif len(splits) < 2 {\n\t\t\t// NewMap and case 2 below ensure that len(splits) > 0\n\t\t\treturn splits[0].reduceInt(reduce)\n\t\t}\n\t\tvar left, right int\n\t\tvar p interface{}\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(1)\n\t\tswitch len(splits) {\n\t\tcase 2:\n\t\t\tgo func() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp = internal.WrapPanic(recover())\n\t\t\t\t\twg.Done()\n\t\t\t\t}()\n\t\t\t\tright = splits[1].reduceInt(reduce)\n\t\t\t}()\n\t\t\tleft = splits[0].reduceInt(reduce)\n\t\tdefault:\n\t\t\thalf := len(splits) / 2\n\t\t\tgo func() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tp = internal.WrapPanic(recover())\n\t\t\t\t\twg.Done()\n\t\t\t\t}()\n\t\t\t\tright = recur(splits[half:])\n\t\t\t}()\n\t\t\tleft = recur(splits[:half])\n\t\t}\n\t\twg.Wait()\n\t\tif p != nil {\n\t\t\tpanic(p)\n\t\t}\n\t\treturn left + right\n\t}\n\treturn recur(m.splits)\n}", "title": "" }, { "docid": "ce8cdec6400a0291ebf551fd418fc20f", "score": "0.46716225", "text": "func sum(xi ...int) int {\n\tfmt.Printf(\"%T\\n\", xi)\n\ttotal := 0\n\tfor _, v := range xi {\n\t\ttotal += v\n\t}\n\treturn total\n}", "title": "" }, { "docid": "fc86cd132d754bd8617e7a1c22bc993a", "score": "0.46686584", "text": "func sum(xi ...int) int {\n\ttotal := 0\n\tfor _, v := range xi {\n\t\ttotal += v\n\t}\n\treturn total\n}", "title": "" }, { "docid": "bbd52bf6a947e678f803ad3d99a0aef7", "score": "0.46589476", "text": "func (m mathUtil) MeanInt(values ...int) int {\n\treturn m.SumInt(values...) / len(values)\n}", "title": "" }, { "docid": "c5e93fd86016fcf9962e2fbc68e0dd5a", "score": "0.4583979", "text": "func mapSum(itr Iterator, m *mapper) {\n\tn := float64(0)\n\tfor k, v := itr.Next(); k != 0; k, v = itr.Next() {\n\t\tn += v.(float64)\n\t}\n\tm.emit(itr.Time(), n)\n}", "title": "" }, { "docid": "638dc30a7814bdffbacc1de7cc71bd64", "score": "0.45779374", "text": "func sum(x ...int) int {\n\tfmt.Println(x)\n\tfmt.Printf(\"%T\\n\", x)\n\ts := 0\n\tfor i, v := range x {\n\t\ts += v\n\t\tfmt.Println(\"for item number\", i, \"current sum:\", s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "32f9d15f08b4cd898663ff202c7260bf", "score": "0.45692238", "text": "func (rgb *RentGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = rgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{rent.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RentGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "60142e1f775fc8d6587ff5f76de8c3cc", "score": "0.4567027", "text": "func MapSum(itr Iterator) interface{} {\n\tn := float64(0)\n\tcount := 0\n\tvar resultType NumberType\n\tfor k, v := itr.Next(); k != -1; k, v = itr.Next() {\n\t\tcount++\n\t\tswitch n1 := v.(type) {\n\t\tcase float64:\n\t\t\tn += n1\n\t\tcase int64:\n\t\t\tn += float64(n1)\n\t\t\tresultType = Int64Type\n\t\t}\n\t}\n\tif count > 0 {\n\t\tswitch resultType {\n\t\tcase Float64Type:\n\t\t\treturn n\n\t\tcase Int64Type:\n\t\t\treturn int64(n)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0c93432243e1cc3798f9c49cdcdd31e", "score": "0.4566185", "text": "func ArraySumInt(a ...int64) int64 {\n\tvar sum int64\n\tfor i := 0; i < len(a); i++ {\n\t\tsum += a[i]\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "4a086bb282a1acf2bb4f3e6529bccf98", "score": "0.45621386", "text": "func (c *core) HashPoints(points ...*point) *big.Int {\n\thasher := c.getHasher()\n\thasher.Write([]byte{c.SuiteString, 0x2})\n\tfor _, pt := range points {\n\t\thasher.Write(c.Marshal(pt))\n\t}\n\treturn bits2int(hasher.Sum(nil), c.N()*8)\n}", "title": "" }, { "docid": "f8c5c5d82cacc163e7cc8dd83f76f903", "score": "0.45601895", "text": "func reduceSum(key string, values []interface{}, r *reducer) {\n\tvar n float64\n\tfor _, v := range values {\n\t\tn += v.(float64)\n\t}\n\tr.emit(key, n)\n}", "title": "" }, { "docid": "4c875aed6710017e2675388c0f054baf", "score": "0.45580032", "text": "func AllReduceInt64(comm Comm, in, out *int64, n int, op Op) {\n\tC.MPI_Allreduce(unsafe.Pointer(in), unsafe.Pointer(out), C.int(n), C.MPI_Datatype(MPI_i64), C.MPI_Op(SUM), C.MPI_Comm(comm))\n}", "title": "" }, { "docid": "a61d96e9036158702577315c118198ae", "score": "0.45463738", "text": "func (hgb *HarborGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = hgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{harbor.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: HarborGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad031df108ce4b12f7a9fc55d835d175", "score": "0.45406383", "text": "func (rs *localRegion) aggregate(ctx *selectContext, h int64, row map[int64][]byte) error {\n\t// Put row data into evaluate context for later evaluation.\n\terr := rs.setColumnValueToCtx(ctx, h, row, ctx.aggColumns)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\t// Get group key.\n\tgk, err := rs.getGroupKey(ctx)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif _, ok := ctx.groups[string(gk)]; !ok {\n\t\tctx.groups[string(gk)] = true\n\t\tctx.groupKeys = append(ctx.groupKeys, gk)\n\t}\n\t// Update aggregate funcs.\n\tfor _, agg := range ctx.aggregates {\n\t\tagg.currentGroup = gk\n\t\targs := make([]types.Datum, 0, len(agg.expr.Children))\n\t\t// Evaluate arguments.\n\t\tfor _, x := range agg.expr.Children {\n\t\t\tcv, err := ctx.eval.Eval(x)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\targs = append(args, cv)\n\t\t}\n\t\tagg.update(ctx, args)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ecc26aea5ffead0e4f648cbcffb35df", "score": "0.45301595", "text": "func IntReduce(source []int, f func(accumulator interface{}, currentValue, currentIndex int, array []int) interface{}) (interface{}, error) {\n\tvar accumulator interface{} = source[0]\n\tfor index := 1; index < len(source); index++ {\n\t\taccumulator = f(accumulator, source[index], index, source)\n\t}\n\treturn accumulator, nil\n}", "title": "" }, { "docid": "110a94c4b43c5f82b2ece1d94485113d", "score": "0.45135564", "text": "func countTotal(P []int, x int, y int) int {\n return P[y+1] - P[x]\n}", "title": "" }, { "docid": "7ef33234b7517eba9a4827f6a658ca75", "score": "0.4507855", "text": "func (hgb *HarborGroupBy) IntX(ctx context.Context) int {\n\tv, err := hgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0caeb60079e7b0b0a1760fd26923d9f0", "score": "0.45066398", "text": "func (rrgb *ReserveRoomGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = rrgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{reserveroom.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ReserveRoomGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "0422fb2f19f1e2ff8ad437ca642ae5f6", "score": "0.450434", "text": "func (r *IntegerMovingAverageReducer) Emit() []FloatPoint {\n\tif len(r.buf) != cap(r.buf) {\n\t\treturn []FloatPoint{}\n\t}\n\treturn []FloatPoint{\n\t\t{\n\t\t\tValue: float64(r.sum) / float64(len(r.buf)),\n\t\t\tTime: r.time,\n\t\t\tAggregated: uint32(len(r.buf)),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1f8b8ce370e952dc08a191ca172f9069", "score": "0.4499503", "text": "func (rgb *RemedyGroupBy) IntX(ctx context.Context) int {\n\tv, err := rgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9e1ac68e8d5c1ca4d28c9e823b6fb1fa", "score": "0.4497729", "text": "func applyInt(afunct func (int) int, val int) int {\n\tval = val + 1\n\treturn afunct(val)\n}", "title": "" }, { "docid": "61702b760130bb93698e0cf622781e75", "score": "0.44889185", "text": "func (self *Histogram) AddPoint(val float64) {\n\tself.mu.Lock()\n\tdefer self.mu.Unlock()\n\n\tself.values = append(self.values, val)\n\tif val < self.min {\n\t\tself.min = val\n\t}\n\tif val > self.max {\n\t\tself.max = val\n\t}\n\tself.sum += val\n\tself.count++\n}", "title": "" }, { "docid": "d6f1912d2617e13869fd330f680df000", "score": "0.44834754", "text": "func (lugb *LastUpdatedGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = lugb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{lastupdated.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: LastUpdatedGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d51017b03bf39db57cd54715a4aca301", "score": "0.44819096", "text": "func (set Int64Set) Sum() int64 {\n\tsum := int64(0)\n\tfor v, _ := range set {\n\t\tsum = sum + v\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "99f5ad3f30b1984eebc3a43486f12001", "score": "0.44811183", "text": "func (rgb *RemedyGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = rgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{remedy.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RemedyGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "e286793e104a857df5b53035154bbad1", "score": "0.44780326", "text": "func (h Hits) Sum() (a, b int, err error) {\n\tfor _, hit := range h {\n\t\tla, lb := hit.Aepos-hit.Abpos, hit.Bepos-hit.Bbpos\n\t\tif la < 0 || lb < 0 {\n\t\t\treturn 0, 0, errors.New(\"dp: negative trapezoid area\")\n\t\t}\n\t\ta, b = a+la, b+lb\n\t}\n\treturn\n}", "title": "" }, { "docid": "c08719299a5d8896737ff189a5f2d4a8", "score": "0.44755822", "text": "func sum(x ...int) int {\n\tfmt.Println(x)\n\tfmt.Printf(\"%T\\n\", x)\n\tsum := 0\n\tfor _, v := range x {\n\t\tsum += v\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "c08719299a5d8896737ff189a5f2d4a8", "score": "0.44755822", "text": "func sum(x ...int) int {\n\tfmt.Println(x)\n\tfmt.Printf(\"%T\\n\", x)\n\tsum := 0\n\tfor _, v := range x {\n\t\tsum += v\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "0ece45e39ee6bb4c688cb1d6ef2ca261", "score": "0.4468875", "text": "func AggregateMetric(metrics map[string]Metric, metric Metric) {\n\texistingMetric, metricExists := metrics[metric.Key]\n\n\t// If the metric exists in the specified map, we either take the last value or\n\t// sum the values and increment the hit count.\n\tif metricExists {\n\t\t// Occasionally metrics are sampled and may inflate their numbers.\n\t\texistingMetric.TotalHits += metric.TotalHits\n\n\t\texistingMetric.AllValues = append(existingMetric.AllValues, metric.LastValue)\n\n\t\tswitch {\n\t\tcase metric.MetricType == MetricTypeCounter:\n\t\t\texistingMetric.LastValue += metric.LastValue * metric.TotalHits\n\t\tcase metric.MetricType == MetricTypeGauge:\n\t\t\texistingMetric.LastValue = metric.LastValue\n\t\tcase metric.MetricType == MetricTypeSet:\n\t\t\texistingMetric.LastValue = metric.LastValue\n\t\tcase metric.MetricType == MetricTypeTimer:\n\t\t\texistingMetric.LastValue = metric.LastValue\n\t\t}\n\n\t\tmetrics[metric.Key] = existingMetric\n\t} else {\n\t\tmetrics[metric.Key] = metric\n\t}\n}", "title": "" }, { "docid": "f25de58eb0efaa29aa666f63a7a86ed0", "score": "0.4456707", "text": "func (ecpgb *EntityContactPointGroupBy) IntX(ctx context.Context) int {\n\tv, err := ecpgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1ce992b8675e29193a8fc2cb6122ff67", "score": "0.44548482", "text": "func ReduceAnyValueToInt(in []AnyValue, memo int, f func(int, AnyValue) int) int {\n\tfor _, value := range in {\n\t\tmemo = f(memo, value)\n\t}\n\treturn memo\n}", "title": "" }, { "docid": "74ad6bd978981d46c93e630c0b5c7fdd", "score": "0.4450588", "text": "func Sum(xi ...int) int {\n\ts := 0\n\tfor _, v := range xi {\n\t\ts += v\n\t}\n\treturn s\n}", "title": "" }, { "docid": "8c6eceaf9f0f65f5a7ef67a3b0f20f6c", "score": "0.4446509", "text": "func Sum(x int, y int) int {\n\treturn x + y\n}", "title": "" }, { "docid": "e9347dc839f43485e6f88545e732873d", "score": "0.44311938", "text": "func ReduceIntToAnyValue(in []int, memo AnyValue, f func(AnyValue, int) AnyValue) AnyValue {\n\tfor _, value := range in {\n\t\tmemo = f(memo, value)\n\t}\n\treturn memo\n}", "title": "" }, { "docid": "322f305270109f250e542d9ccb0766a0", "score": "0.44201213", "text": "func (s *StatGroup) Push(n float64) {\n\tif s.Count == 0 {\n\t\ts.Min = n\n\t\ts.Max = n\n\t\ts.Mean = n\n\t\ts.Count = 1\n\t\ts.Sum = n\n\t\treturn\n\t}\n\n\tif n < s.Min {\n\t\ts.Min = n\n\t}\n\tif n > s.Max {\n\t\ts.Max = n\n\t}\n\n\ts.Sum += n\n\n\t// constant-space mean update:\n\tsum := s.Mean*float64(s.Count) + n\n\ts.Mean = sum / float64(s.Count+1)\n\n\ts.Count++\n}", "title": "" }, { "docid": "1483df17ae5440b27990b6e6ce01458b", "score": "0.4419866", "text": "func (p *StatsDParser) Aggregate(line string) error {\n\tparsedMetric, err := parseMessageToMetric(line, p.enableMetricType)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch parsedMetric.description.statsdMetricType {\n\tcase statsdGauge:\n\t\t_, ok := p.gauges[parsedMetric.description]\n\t\tif !ok {\n\t\t\tp.gauges[parsedMetric.description] = buildGaugeMetric(parsedMetric, timeNowFunc())\n\t\t} else {\n\t\t\tif parsedMetric.addition {\n\t\t\t\tsavedValue := p.gauges[parsedMetric.description].Metrics().At(0).DoubleGauge().DataPoints().At(0).Value()\n\t\t\t\tparsedMetric.floatvalue = parsedMetric.floatvalue + savedValue\n\t\t\t\tp.gauges[parsedMetric.description] = buildGaugeMetric(parsedMetric, timeNowFunc())\n\t\t\t} else {\n\t\t\t\tp.gauges[parsedMetric.description] = buildGaugeMetric(parsedMetric, timeNowFunc())\n\t\t\t}\n\t\t}\n\n\tcase statsdCounter:\n\t\t_, ok := p.counters[parsedMetric.description]\n\t\tif !ok {\n\t\t\tp.counters[parsedMetric.description] = buildCounterMetric(parsedMetric, timeNowFunc())\n\t\t} else {\n\t\t\tsavedValue := p.counters[parsedMetric.description].Metrics().At(0).IntSum().DataPoints().At(0).Value()\n\t\t\tparsedMetric.intvalue = parsedMetric.intvalue + savedValue\n\t\t\tp.counters[parsedMetric.description] = buildCounterMetric(parsedMetric, timeNowFunc())\n\t\t}\n\n\tcase statsdHistogram:\n\t\tswitch p.observeHistogram {\n\t\tcase \"gauge\":\n\t\t\tp.timersAndDistributions = append(p.timersAndDistributions, buildGaugeMetric(parsedMetric, timeNowFunc()))\n\t\tcase \"summary\":\n\t\t\teachSummaryMetric, ok := p.summaries[parsedMetric.description]\n\t\t\tif !ok {\n\t\t\t\tp.summaries[parsedMetric.description] = summaryMetric{\n\t\t\t\t\tname: parsedMetric.description.name,\n\t\t\t\t\tsummaryPoints: []float64{parsedMetric.floatvalue},\n\t\t\t\t\tlabelKeys: parsedMetric.labelKeys,\n\t\t\t\t\tlabelValues: parsedMetric.labelValues,\n\t\t\t\t\ttimeNow: timeNowFunc(),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpoints := eachSummaryMetric.summaryPoints\n\t\t\t\tp.summaries[parsedMetric.description] = summaryMetric{\n\t\t\t\t\tname: parsedMetric.description.name,\n\t\t\t\t\tsummaryPoints: append(points, parsedMetric.floatvalue),\n\t\t\t\t\tlabelKeys: parsedMetric.labelKeys,\n\t\t\t\t\tlabelValues: parsedMetric.labelValues,\n\t\t\t\t\ttimeNow: timeNowFunc(),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase statsdTiming:\n\t\tswitch p.observeTimer {\n\t\tcase \"gauge\":\n\t\t\tp.timersAndDistributions = append(p.timersAndDistributions, buildGaugeMetric(parsedMetric, timeNowFunc()))\n\t\tcase \"summary\":\n\t\t\teachSummaryMetric, ok := p.summaries[parsedMetric.description]\n\t\t\tif !ok {\n\t\t\t\tp.summaries[parsedMetric.description] = summaryMetric{\n\t\t\t\t\tname: parsedMetric.description.name,\n\t\t\t\t\tsummaryPoints: []float64{parsedMetric.floatvalue},\n\t\t\t\t\tlabelKeys: parsedMetric.labelKeys,\n\t\t\t\t\tlabelValues: parsedMetric.labelValues,\n\t\t\t\t\ttimeNow: timeNowFunc(),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpoints := eachSummaryMetric.summaryPoints\n\t\t\t\tp.summaries[parsedMetric.description] = summaryMetric{\n\t\t\t\t\tname: parsedMetric.description.name,\n\t\t\t\t\tsummaryPoints: append(points, parsedMetric.floatvalue),\n\t\t\t\t\tlabelKeys: parsedMetric.labelKeys,\n\t\t\t\t\tlabelValues: parsedMetric.labelValues,\n\t\t\t\t\ttimeNow: timeNowFunc(),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1bf70ac34776cf6df449d6db3b4c81b1", "score": "0.44159004", "text": "func parseInt(content []byte, aggErr *AggregateError) int {\n result, err := strconv.Atoi(string(content))\n if err != nil {\n aggErr.Append(err)\n }\n return result\n}", "title": "" }, { "docid": "8da8ffe098996ec210e6493d2d7784ef", "score": "0.44145235", "text": "func NewIntegerMovingAverageReducer(n int) *IntegerMovingAverageReducer {\n\treturn &IntegerMovingAverageReducer{\n\t\tbuf: make([]int64, 0, n),\n\t}\n}", "title": "" }, { "docid": "8059828842ac0ba28fd5b15f472c87b0", "score": "0.44127226", "text": "func (goagb *GroupOfAgeGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = goagb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{groupofage.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: GroupOfAgeGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "529f336d5367d9544092bbee4d44d37f", "score": "0.441175", "text": "func sumOfNumbers(slice []int) int {\n\tnumber := 0\n\n\tfor _, value := range slice {\n\t\tnumber += value\n\t}\n\treturn number\n}", "title": "" }, { "docid": "e761df4f907d1232d70f6227f0734e58", "score": "0.4406564", "text": "func (p *PointPolicy) Reduce(f func(Iterator) float64) float64 {\n\tp.mu.RLock()\n\tdefer p.mu.RUnlock()\n\toffset := p.offset + 1\n\tif offset == p.size {\n\t\toffset = 0\n\t}\n\titerator := p.window.Iterator(offset, p.size)\n\treturn f(iterator)\n}", "title": "" }, { "docid": "bc6a4b744b6b5b94b593511a375748ac", "score": "0.4405025", "text": "func add(ctx *build.Context, x, y ir.Int, k int) ir.Int {\n\tz := ctx.Int(\"sum\", k)\n\tc := ctx.Register(\"c\")\n\tAddInto(ctx, z, x, y, c)\n\treturn z\n}", "title": "" }, { "docid": "7e255b6ff8460330d12a12d1bad1ab7c", "score": "0.44024423", "text": "func (q *Query) Sum(a interface{}) (int, int, error) {\n\tif !q.isIndexQuery || len(q.indexName) == 0 {\n\t\treturn 0, 0, errors.New(\"Aggregation must use an index Query\")\n\t}\n\n\tq.aggTarget = a\n\tq.isAggQuery = true\n\treturn q.execute()\n}", "title": "" }, { "docid": "18ba4eb81c12bc429c04daabb2e387ec", "score": "0.43960375", "text": "func IntSummation(stream IntStream) IntStream {\n\treturn &intSumStream{stream: stream}\n}", "title": "" }, { "docid": "24161f2d1f2f2e4a56c03bc99b495a74", "score": "0.43955776", "text": "func metricInt(c prometheus.Collector) int {\n\treturn int(testutil.ToFloat64(c))\n}", "title": "" }, { "docid": "d1384b8734903ddabf31ffac1e724f16", "score": "0.43940344", "text": "func (rgb *RentGroupBy) IntX(ctx context.Context) int {\n\tv, err := rgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "71440da48724e7f1dd506c1d5f4ae817", "score": "0.43918675", "text": "func sum(in []int) int {\n\tvar result int\n\tfor i := 0; i < len(in); i++ {\n\t\tresult += in[i]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "84d2950ab323d30f5fbb8c8cf3df4f37", "score": "0.4390475", "text": "func (ougb *OrgUnitGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = ougb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{orgunit.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrgUnitGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "5e0a0e8cbe949b01c505f89a7ced53d0", "score": "0.43875182", "text": "func (pgb *ParticipantGroupBy) IntX(ctx context.Context) int {\n\tv, err := pgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ae26c49869fdb914286332b8b56121ea", "score": "0.43852335", "text": "func Aggregate(key Type, val time.Duration) {\n\tif globalStats != nil {\n\t\tmutex.Lock()\n\t\tdefer mutex.Unlock()\n\n\t\tglobalStats[key] = globalStats[key] + val\n\t}\n}", "title": "" }, { "docid": "394c8d2848182848fc5d89946685f76c", "score": "0.4383281", "text": "func concat(inputs []concatInput) uint64 {\n\tvar accum uint64 = 0\n\tfor _, input := range inputs {\n\t\tinputNumBits := input.endPos - input.startPos + 1\n\t\taccum <<= inputNumBits\n\t\taccum |= extractShift(input.x, input.startPos, input.endPos)\n\t}\n\treturn accum\n}", "title": "" }, { "docid": "304cc59491c9fedab68f50540d73d6d3", "score": "0.43800876", "text": "func (upgb *UnsavedPostGroupBy) IntX(ctx context.Context) int {\n\tv, err := upgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "aff6435237e64e8840afc993feea45ae", "score": "0.43770203", "text": "func ExampleIntSet_Sum() {\n\ts1 := gset.NewIntSet()\n\ts1.Add([]int{1, 2, 3, 4}...)\n\tfmt.Println(s1.Sum())\n\n\t// Output:\n\t// 10\n}", "title": "" }, { "docid": "6e2a037bb36d135e0fef975393927119", "score": "0.43762118", "text": "func (session *Session) SumInt(bean interface{}, columnName string) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tvar err error\n\tif len(session.Statement.RawSQL) == 0 {\n\t\tsqlStr, args, err = session.Statement.genSumSQL(bean, columnName)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tsession.queryPreprocess(&sqlStr, args...)\n\n\tvar res int64\n\tif session.IsAutoCommit {\n\t\terr = session.DB().QueryRow(sqlStr, args...).Scan(&res)\n\t} else {\n\t\terr = session.Tx.QueryRow(sqlStr, args...).Scan(&res)\n\t}\n\n\tif err == sql.ErrNoRows || err == nil {\n\t\treturn res, nil\n\t}\n\treturn 0, err\n}", "title": "" }, { "docid": "b8824c4fcdb373c41aec6909df0ee640", "score": "0.43760893", "text": "func getAverage(points []Point) Point {\n\tnewPoint := make(Point, len(points[0]))\n\tfor _, point := range points {\n\t\tfor j, val := range point {\n\t\t\tnewPoint[j] += val\n\t\t}\n\t}\n\tfor i := range newPoint {\n\t\tnewPoint[i] = newPoint[i]/float64(len(points))\n\t}\n\treturn newPoint\n}", "title": "" }, { "docid": "7d0fa81c33bef99bd91b6142ad4ea262", "score": "0.43755722", "text": "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}", "title": "" }, { "docid": "f8ccf1b4d78d7960202060b8c43bd933", "score": "0.4371479", "text": "func (lugb *LastUpdatedGroupBy) IntX(ctx context.Context) int {\n\tv, err := lugb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9ee1d68c04da94ec41e5d59c0c35948f", "score": "0.4370561", "text": "func (oupgb *OrgUnitPositionGroupBy) IntX(ctx context.Context) int {\n\tv, err := oupgb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "acad50ed1d9945b660ae900069494851", "score": "0.4370465", "text": "func (s *statGroup) push(n float64) {\n\tif s.count == 0 {\n\t\ts.min = n\n\t\ts.max = n\n\t\ts.mean = n\n\t\ts.count = 1\n\t\ts.sum = n\n\n\t\ts.m = n\n\t\ts.s = 0.0\n\t\ts.stdDev = 0.0\n\t\tif len(s.values) > 0 {\n\t\t\ts.values[0] = n\n\t\t} else {\n\t\t\ts.values = append(s.values, n)\n\t\t}\n\t\treturn\n\t}\n\n\tif n < s.min {\n\t\ts.min = n\n\t}\n\tif n > s.max {\n\t\ts.max = n\n\t}\n\n\ts.sum += n\n\n\t// constant-space mean update:\n\tsum := s.mean*float64(s.count) + n\n\ts.mean = sum / float64(s.count+1)\n\tif int(s.count) == len(s.values) {\n\t\ts.values = append(s.values, n)\n\t} else {\n\t\ts.values[s.count] = n\n\t}\n\n\ts.count++\n\n\toldM := s.m\n\ts.m += (n - oldM) / float64(s.count)\n\ts.s += (n - oldM) * (n - s.m)\n\ts.stdDev = math.Sqrt(s.s / (float64(s.count) - 1.0))\n}", "title": "" }, { "docid": "1a883e53d87cfd94e321e3a9e9a02894", "score": "0.4368082", "text": "func (pgb *ParticipantGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = pgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{participant.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ParticipantGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "63207e3110dcfb973510bfbba3167a08", "score": "0.436707", "text": "func (ksgb *KqiSourceGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = ksgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqisource.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiSourceGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "0248349ccc3a1f560126c8c4b9dec520", "score": "0.4364962", "text": "func (b bucket) Consolidate(consolidation int) Point {\n\tpoint := Point{\n\t\tTime: b.time,\n\t\tValue: Value(math.NaN()),\n\t}\n\n\tlength := len(b.points)\n\tif length == 0 {\n\t\treturn point\n\t}\n\n\tswitch consolidation {\n\tcase ConsolidateAverage:\n\t\tsum := 0.0\n\t\tsumCount := 0\n\t\tfor _, p := range b.points {\n\t\t\tif p.Value.IsNaN() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsum += float64(p.Value)\n\t\t\tsumCount++\n\t\t}\n\n\t\tif sumCount > 0 {\n\t\t\tpoint.Value = Value(sum / float64(sumCount))\n\t\t}\n\n\tcase ConsolidateSum:\n\t\tsum := 0.0\n\t\tsumCount := 0\n\t\tfor _, p := range b.points {\n\t\t\tif p.Value.IsNaN() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsum += float64(p.Value)\n\t\t\tsumCount++\n\t\t}\n\n\t\tif sumCount > 0 {\n\t\t\tpoint.Value = Value(sum)\n\t\t}\n\n\tcase ConsolidateFirst:\n\t\tpoint.Value = b.points[0].Value\n\n\tcase ConsolidateLast:\n\t\tpoint.Value = b.points[length-1].Value\n\n\tcase ConsolidateMax:\n\t\tfor _, p := range b.points {\n\t\t\tif !p.Value.IsNaN() && p.Value > point.Value || point.Value.IsNaN() {\n\t\t\t\tpoint.Value = p.Value\n\t\t\t}\n\t\t}\n\n\tcase ConsolidateMin:\n\t\tfor _, p := range b.points {\n\t\t\tif !p.Value.IsNaN() && p.Value < point.Value || point.Value.IsNaN() {\n\t\t\t\tpoint.Value = p.Value\n\t\t\t}\n\t\t}\n\t}\n\n\treturn point\n}", "title": "" }, { "docid": "17a7ab6ebbfe92a7d4570b3dd3e5bf3a", "score": "0.43617058", "text": "func aggregateDatapoints(\n\tlogger *zap.Logger,\n\tdps []*sfxpb.DataPoint,\n\tdimensionsKeys []string,\n\taggregation AggregationMethod,\n) []*sfxpb.DataPoint {\n\tif len(dps) == 0 {\n\t\treturn nil\n\t}\n\n\t// group datapoints by dimension values\n\tdimValuesToDps := make(map[string][]*sfxpb.DataPoint, len(dps))\n\tfor i, dp := range dps {\n\t\taggregationKey, err := getAggregationKey(dp.Dimensions, dimensionsKeys)\n\t\tif err != nil {\n\t\t\tlogger.Debug(\"datapoint is dropped\", zap.String(\"metric\", dp.Metric), zap.Error(err))\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := dimValuesToDps[aggregationKey]; !ok {\n\t\t\t// set slice capacity to the possible maximum = len(dps)-i to avoid reallocations\n\t\t\tdimValuesToDps[aggregationKey] = make([]*sfxpb.DataPoint, 0, len(dps)-i)\n\t\t}\n\t\tdimValuesToDps[aggregationKey] = append(dimValuesToDps[aggregationKey], dp)\n\t}\n\n\t// Get aggregated results\n\tresult := make([]*sfxpb.DataPoint, 0, len(dimValuesToDps))\n\tfor _, dps := range dimValuesToDps {\n\t\tdp := proto.Clone(dps[0]).(*sfxpb.DataPoint)\n\t\tdp.Dimensions = filterDimensions(dp.Dimensions, dimensionsKeys)\n\t\tswitch aggregation {\n\t\tcase AggregationMethodCount:\n\t\t\tgauge := sfxpb.MetricType_GAUGE\n\t\t\tdp.MetricType = &gauge\n\t\t\tvalue := int64(len(dps))\n\t\t\tdp.Value = sfxpb.Datum{\n\t\t\t\tIntValue: &value,\n\t\t\t}\n\t\tcase AggregationMethodSum:\n\t\t\tvar intValue int64\n\t\t\tvar floatValue float64\n\t\t\tvalue := sfxpb.Datum{}\n\t\t\tfor _, dp := range dps {\n\t\t\t\tif dp.Value.IntValue != nil {\n\t\t\t\t\tintValue += *dp.Value.IntValue\n\t\t\t\t\tvalue.IntValue = &intValue\n\t\t\t\t}\n\t\t\t\tif dp.Value.DoubleValue != nil {\n\t\t\t\t\tfloatValue += *dp.Value.DoubleValue\n\t\t\t\t\tvalue.DoubleValue = &floatValue\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp.Value = value\n\t\t}\n\t\tresult = append(result, dp)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "f00c75ed153d14f5a8a667c18ebbdd7c", "score": "0.43561804", "text": "func (rogb *RestaurantOwnerGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = rogb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{restaurantowner.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RestaurantOwnerGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "c28ee3e9946da918a9fca942cf31ff8c", "score": "0.43517363", "text": "func Sum(in []int) (total int) {\n\ttotal = 0\n\tfor _, v := range in {\n\t\ttotal += v\n\t}\n\treturn\n}", "title": "" }, { "docid": "e3d5e5b1e7061a954e5844382af92ffd", "score": "0.43367893", "text": "func (t *TimerSnapshot) Sum() int64 { return t.histogram.Sum() }", "title": "" }, { "docid": "c764136abe3f91e21f01c76f9fdebe19", "score": "0.43288314", "text": "func (dagb *DrugAllergyGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = dagb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{drugallergy.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DrugAllergyGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "aa95c9ff11787399db72b48edc70741f", "score": "0.43248916", "text": "func mergeFn(a, b int) int {\n\treturn a + b\n}", "title": "" }, { "docid": "f8cea6ff39a40b5467cf8852314ce1a5", "score": "0.4322886", "text": "func consume(ctx context.Context, count int, p *payload) []int {\n\taccumulator := make([]int, 0)\n\tvisited := make(map[int]struct{})\n\tfor i := 0; i < count; i++ {\n\t\tselect {\n\t\tcase res := <-p.res:\n\t\t\tfor _, val := range res.Numbers {\n\t\t\t\tif _, ok := visited[val]; !ok {\n\t\t\t\t\taccumulator = append(accumulator, val)\n\t\t\t\t\tvisited[val] = struct{}{}\n\t\t\t\t}\n\t\t\t}\n\t\tcase err := <-p.err:\n\t\t\tlog.Println(err)\n\t\tcase <-ctx.Done():\n\t\t\tlog.Println(ctx.Err())\n\t\t\tsort.Ints(accumulator)\n\t\t\treturn accumulator\n\t\t}\n\t}\n\tsort.Ints(accumulator)\n\treturn accumulator\n}", "title": "" }, { "docid": "3941cba96a7188ea10ecff3998f1ecd5", "score": "0.43164515", "text": "func (m *Map) ReduceIntProduct(reduce func(map[interface{}]interface{}) int) int {\n\tresult := 1\n\tsplits := m.splits\n\tfor i := 0; i < len(splits); i++ {\n\t\tresult *= splits[i].reduceInt(reduce)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4c8525f90b29bbb78782f046b4b2ec5b", "score": "0.43113887", "text": "func sum(b *bolt.Bucket, fn func([]byte) int) (int, error) {\n\tsum := 0\n\terr := b.ForEach(func(_, v []byte) error {\n\t\tsum += fn(v)\n\t\treturn nil\n\t})\n\treturn sum, err\n}", "title": "" }, { "docid": "16e4ab3920cdc4e506c6a80d96d832ef", "score": "0.43091783", "text": "func ReduceIntToInt(in []int, memo int, f func(int, int) int) int {\n\tfor _, value := range in {\n\t\tmemo = f(memo, value)\n\t}\n\treturn memo\n}", "title": "" }, { "docid": "99193f6ea45aeb1c0c82ec2fe0c5df68", "score": "0.43068856", "text": "func (dagb *DrugAllergyGroupBy) IntX(ctx context.Context) int {\n\tv, err := dagb.Int(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3cfbe77d5e71c74cc87cbc653ffde652", "score": "0.4303224", "text": "func total(number ...int) float64 {\n\ttotal := 0\n\n\tfor _, tot := range number {\n\t\ttotal += tot\n\t}\n\n\tvar avg = float64(total) / float64(len(number))\n\treturn avg\n\n}", "title": "" }, { "docid": "2db095331a4cb79063b05ec15f4c3395", "score": "0.42942223", "text": "func (wgb *WidgetGroupBy) Int(ctx context.Context) (_ int, err error) {\n\tvar v []int\n\tif v, err = wgb.Ints(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{widget.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: WidgetGroupBy.Ints returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" } ]
97a98f180d72f7e050c192dbdf015166
It should implement GetAttachCount() and DeviceID() as api.Device implementation here it shares function from GenericDevice so we don't need duplicate codes
[ { "docid": "b31b24c88771cd101515331780f6315b", "score": "0.0", "text": "func getVFIODetails(deviceFileName, iommuDevicesPath string) (deviceBDF, deviceSysfsDev string, vfioDeviceType config.VFIODeviceType, err error) {\n\tvfioDeviceType = GetVFIODeviceType(deviceFileName)\n\n\tswitch vfioDeviceType {\n\tcase config.VFIODeviceNormalType:\n\t\t// Get bdf of device eg. 0000:00:1c.0\n\t\tdeviceBDF = getBDF(deviceFileName)\n\t\t// Get sysfs path used by cloud-hypervisor\n\t\tdeviceSysfsDev = filepath.Join(config.SysBusPciDevicesPath, deviceFileName)\n\tcase config.VFIODeviceMediatedType:\n\t\t// Get sysfsdev of device eg. /sys/devices/pci0000:00/0000:00:02.0/f79944e4-5a3d-11e8-99ce-479cbab002e4\n\t\tsysfsDevStr := filepath.Join(iommuDevicesPath, deviceFileName)\n\t\tdeviceSysfsDev, err = getSysfsDev(sysfsDevStr)\n\t\tdeviceBDF = getBDF(getMediatedBDF(deviceSysfsDev))\n\tdefault:\n\t\terr = fmt.Errorf(\"Incorrect tokens found while parsing vfio details: %s\", deviceFileName)\n\t}\n\n\treturn deviceBDF, deviceSysfsDev, vfioDeviceType, err\n}", "title": "" } ]
[ { "docid": "f7f3e00c732deae20de824d7ea014716", "score": "0.5999302", "text": "func (*Device) Descriptor() ([]byte, []int) {\n\treturn file_grpc_messages_devices_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4782fb6bb35d4721b527b18dfda684bf", "score": "0.58550286", "text": "func (*Device) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a4d7271ad71f47a615dd6d3130a930fe", "score": "0.58390325", "text": "func (d Device) Device() unsafe.Pointer { return *(*unsafe.Pointer)(unsafe.Pointer(&d.device)) }", "title": "" }, { "docid": "bee0818d55f1466eed84b9f006601d1b", "score": "0.5832199", "text": "func (*ReqGetDevices) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "72cac1be38a60f8147c14a035a73a763", "score": "0.578966", "text": "func (*ReqGetDevice) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0759daecf328f8c5c7cb196ad90ac561", "score": "0.57266504", "text": "func (m *DetectedApp) GetDeviceCount()(*int32) {\n return m.deviceCount\n}", "title": "" }, { "docid": "2200267a28a77336c495b369c4f00226", "score": "0.56680995", "text": "func (m *UserExperienceAnalyticsRemoteConnection) GetDeviceCount()(*int32) {\n val, err := m.GetBackingStore().Get(\"deviceCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "a8687b2b7fc840e81efe6706b9e9db23", "score": "0.5659731", "text": "func (*ReqCreateDevice) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "01b77a39984747bae20714159daf5897", "score": "0.56490767", "text": "func (*ReqDeleteDevice) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "7282b7f9187cc916dc122c5c4cbb2c6f", "score": "0.5641231", "text": "func GetDeviceCount() (count int, e error) {\n\te = af_call(C.af_get_device_count((*C.int)(unsafe.Pointer(&count))))\n\treturn\n}", "title": "" }, { "docid": "f5e511858d549ea9b4ed74e5726b0c66", "score": "0.5640354", "text": "func (m *DeviceConfigurationUserStatus) GetDevicesCount()(*int32) {\n return m.devicesCount\n}", "title": "" }, { "docid": "8f0be980cc0774857ec6c502620d9801", "score": "0.5605706", "text": "func (*ReqUpdateDevice) Descriptor() ([]byte, []int) {\n\treturn file_proto_meeting_device_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a6ae993fc0f482b92ee63a770ac1518f", "score": "0.5583899", "text": "func (*Device) Descriptor() ([]byte, []int) {\n\treturn file_switch_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "750eade27bea8602095836671afe72c2", "score": "0.55771947", "text": "func (m *UserExperienceAnalyticsDevicePerformance) GetDeviceCount()(*int64) {\n return m.deviceCount\n}", "title": "" }, { "docid": "d8c999e270e99d9350b47bc42df49b66", "score": "0.55604696", "text": "func (ac *authContext) Device() (*DeviceState, error) {\n\tac.state.Lock()\n\tdefer ac.state.Unlock()\n\n\treturn Device(ac.state)\n}", "title": "" }, { "docid": "55910bb13ebf0fa4c4344f1916a2746e", "score": "0.55333585", "text": "func (s *Store) DeviceList(ctx context.Context, pagination paginator.Query, filters []models.Filter, status models.DeviceStatus, sort string, order string, mode store.DeviceListMode) ([]models.Device, int, error) {\n\tqueryMatch, err := queries.BuildFilterQuery(filters)\n\tif err != nil {\n\t\treturn nil, 0, FromMongoError(err)\n\t}\n\n\tquery := []bson.M{\n\t\t{\n\t\t\t\"$match\": bson.M{\n\t\t\t\t\"uid\": bson.M{\n\t\t\t\t\t\"$ne\": nil,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"connected_devices\",\n\t\t\t\t\"localField\": \"uid\",\n\t\t\t\t\"foreignField\": \"uid\",\n\t\t\t\t\"as\": \"online\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$addFields\": bson.M{\n\t\t\t\t\"online\": bson.M{\"$anyElementTrue\": []interface{}{\"$online\"}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"namespaces\",\n\t\t\t\t\"localField\": \"tenant_id\",\n\t\t\t\t\"foreignField\": \"tenant_id\",\n\t\t\t\t\"as\": \"namespace\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$addFields\": bson.M{\n\t\t\t\t\"namespace\": \"$namespace.name\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$unwind\": \"$namespace\",\n\t\t},\n\t}\n\n\tif status != \"\" {\n\t\tquery = append([]bson.M{{\n\t\t\t\"$match\": bson.M{\n\t\t\t\t\"status\": status,\n\t\t\t},\n\t\t}}, query...)\n\n\t\t// As we have added to device the field called \"acceptable\" we needed, also, to add the correct value to it.\n\t\t// The value of \"acceptable\" is based on the device status and the list mode. If the list status is \"accepted\"\n\t\t// we need to add the field \"acceptable\" with the value \"false\", because the device is already accepted.\n\t\t// Otherwise, if the list status is \"pending\" or \"rejected\" we evaluate the list mode. When it is\n\t\t// store.DeviceListModeMaxDeviceReached we need to check if the device is in the removed devices list.\n\t\t// If it is, the device is only acceptable if it is in the removed devices list. Otherwise, the device is\n\t\t// unacceptable.\n\t\tswitch status {\n\t\tcase models.DeviceStatusAccepted:\n\t\t\tquery = append(query, bson.M{\n\t\t\t\t\"$addFields\": bson.M{\n\t\t\t\t\t\"acceptable\": false,\n\t\t\t\t},\n\t\t\t})\n\t\tcase models.DeviceStatusPending, models.DeviceStatusRejected:\n\t\t\tswitch mode {\n\t\t\tcase store.DeviceListModeMaxDeviceReached:\n\t\t\t\tquery = append(query, []bson.M{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\t\t\t\"from\": \"removed_devices\",\n\t\t\t\t\t\t\t\"localField\": \"uid\",\n\t\t\t\t\t\t\t\"foreignField\": \"uid\",\n\t\t\t\t\t\t\t\"as\": \"removed\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"$addFields\": bson.M{\n\t\t\t\t\t\t\t\"acceptable\": bson.M{\"$anyElementTrue\": []interface{}{\"$removed\"}},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"$unset\": \"removed\",\n\t\t\t\t\t},\n\t\t\t\t}...)\n\t\t\tdefault:\n\t\t\t\tquery = append(query, bson.M{\n\t\t\t\t\t\"$addFields\": bson.M{\n\t\t\t\t\t\t\"acceptable\": true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\torderVal := map[string]int{\n\t\t\"asc\": 1,\n\t\t\"desc\": -1,\n\t}\n\n\tif sort != \"\" {\n\t\tquery = append(query, bson.M{\n\t\t\t\"$sort\": bson.M{sort: orderVal[order]},\n\t\t})\n\t} else {\n\t\tquery = append(query, bson.M{\n\t\t\t\"$sort\": bson.M{\"last_seen\": -1},\n\t\t})\n\t}\n\n\t// Apply filters if any\n\tif len(queryMatch) > 0 {\n\t\tquery = append(query, queryMatch...)\n\t}\n\n\t// Only match for the respective tenant if requested\n\tif tenant := gateway.TenantFromContext(ctx); tenant != nil {\n\t\tquery = append(query, bson.M{\n\t\t\t\"$match\": bson.M{\n\t\t\t\t\"tenant_id\": tenant.ID,\n\t\t\t},\n\t\t})\n\t}\n\n\tqueryCount := query\n\tqueryCount = append(queryCount, bson.M{\"$count\": \"count\"})\n\tcount, err := AggregateCount(ctx, s.db.Collection(\"devices\"), queryCount)\n\tif err != nil {\n\t\treturn nil, 0, FromMongoError(err)\n\t}\n\n\tquery = append(query, queries.BuildPaginationQuery(pagination)...)\n\n\tdevices := make([]models.Device, 0)\n\n\tcursor, err := s.db.Collection(\"devices\").Aggregate(ctx, query)\n\tif err != nil {\n\t\treturn devices, count, FromMongoError(err)\n\t}\n\tdefer cursor.Close(ctx)\n\n\tfor cursor.Next(ctx) {\n\t\tdevice := new(models.Device)\n\t\terr = cursor.Decode(&device)\n\t\tif err != nil {\n\t\t\treturn devices, count, err\n\t\t}\n\t\tdevices = append(devices, *device)\n\t}\n\n\treturn devices, count, FromMongoError(err)\n}", "title": "" }, { "docid": "c6cd83ca8dc9214ab428fa887b065e2c", "score": "0.55316424", "text": "func DeviceCount() (uint, error) {\n\treturn 0, errNoCgo\n}", "title": "" }, { "docid": "00f4e9f1f6c42bbe6902171e587fcbdb", "score": "0.54853696", "text": "func HandleDeviceList(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\tjsonError(w, http.StatusMethodNotAllowed, errors.New(\"Method Not Allowed, use GET\"))\n\t\treturn\n\t}\n\tif id := r.FormValue(\"id\"); id != \"\" {\n\t\tvar dev model.Device\n\t\terr := db.Get(&dev, `SELECT d.active,\n d.hostname,\n d.id,\n d.ip_address,\n d.ping_frequency,\n d.polling_frequency,\n d.snmp_alternate_community,\n d.snmp_community,\n d.snmp_connection_count,\n d.snmp_disable_bulk,\n d.snmp_port,\n d.snmp_retries,\n d.snmp_timeout,\n d.snmp_version,\n d.snmpv3_auth_passwd,\n d.snmpv3_auth_proto,\n d.snmpv3_auth_user,\n d.snmpv3_privacy_passwd,\n d.snmpv3_privacy_proto,\n d.snmpv3_security_level,\n d.tags,\n p.category,\n p.model,\n p.vendor\n FROM devices d,\n profiles p\n WHERE d.id = $1\n AND d.profile_id = p.id`, id)\n\t\tif err == sql.ErrNoRows {\n\t\t\tjsonError(w, http.StatusNotFound, errors.New(\"Device not found\"))\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"HandleDeviceList: select device %s: %v\", id, err)\n\t\t\tjsonBadRequest(w, err)\n\t\t\treturn\n\t\t}\n\t\tbuf, _ := json.MarshalIndent(dev, \"\", \" \")\n\t\tfmt.Fprintf(w, \"%s\", buf)\n\t\treturn\n\t}\n\n\tvar devs []model.Device\n\terr := db.Select(&devs, `SELECT d.active,\n d.hostname,\n d.id,\n d.ip_address,\n d.ping_frequency,\n d.polling_frequency,\n d.snmp_alternate_community,\n d.snmp_community,\n d.snmp_connection_count,\n d.snmp_disable_bulk,\n d.snmp_port,\n d.snmp_retries,\n d.snmp_timeout,\n d.snmp_version,\n d.snmpv3_auth_passwd,\n d.snmpv3_auth_proto,\n d.snmpv3_auth_user,\n d.snmpv3_privacy_passwd,\n d.snmpv3_privacy_proto,\n d.snmpv3_security_level,\n d.tags,\n p.category,\n p.model,\n p.vendor\n FROM devices d,\n profiles p\n WHERE d.profile_id = p.id\n ORDER BY d.id`)\n\tif err != nil {\n\t\tlog.Warning(\"HandleDeviceList: select all devices: \", err)\n\t\tjsonBadRequest(w, err)\n\t\treturn\n\t}\n\tbuf, _ := json.MarshalIndent(devs, \"\", \" \")\n\tfmt.Fprintf(w, \"%s\", buf)\n}", "title": "" }, { "docid": "29192e714a76264740713f4c6bc21bd6", "score": "0.5481412", "text": "func (*GetDevicesResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_messages_devices_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ffc0bb9ad6b866b0a09d3f972dea3ce2", "score": "0.5459286", "text": "func (dd DeviceDaoImpl) GetDevice(id int) (devicemodel.Device, error) {\n\n\tdevice := devicemodel.Device{}\n\n\tif id == 0 {\n\t\treturn device, errors.New(\"id cannot be empty\")\n\t}\n\n\tsql := \"SELECT dr.device_request_id, di.imei, dr.request_by, ds.device_status_id, ds.name, dr.created_date_time, \"\n\tsql += \"di.android_device_id, di.android_version, di.api_level, di.brand, di.build_number, \"\n\tsql += \"di.cpu_hardware, di.display_density, di.display_physical_size, di.display_resolution, \"\n\tsql += \"di.hardware_serial_no, di.instruction_sets, di.manufacturer, di.model \"\n\tsql += \"FROM device_request dr \"\n\tsql += \"LEFT JOIN device_status ds ON ds.device_status_id = dr. device_status_id \"\n\tsql += \"LEFT JOIN device_info di ON di.device_info_id = dr.device_info_id \"\n\tsql += \"LEFT JOIN device_type dt ON dt.device_type_id = di.device_type_id \"\n\tsql += \"WHERE dr.device_request_id = $1 \"\n\n\t// TODO\n\t//row := config.Database.QueryRow(sql, id)\n\n\t//err = row.QueryRow(sql, id).Scan(&device.ID, &device.Imei, &device.RequestBy, &device.Status, &device.StatusText, &device.Timestamp, &device.DeviceInfo.AndroidDeviceID, &device.DeviceInfo.AndroidVersion,\n\t//\t&device.DeviceInfo.APILevel, &device.DeviceInfo.Brand, &device.DeviceInfo.BuildNumber, &device.DeviceInfo.CPUHardware, &device.DeviceInfo.DisplayDensity, &device.DeviceInfo.DisplayPhysicalSize,\n\t//\t&device.DeviceInfo.DisplayResolution, &device.DeviceInfo.HardwareSerialNo, &device.DeviceInfo.InstructionSets, &device.DeviceInfo.Manufacturer, &device.DeviceInfo.Model)\n\n\tstmt, err := dd.db.Prepare(sql)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn device, err\n\t}\n\n\terr = stmt.QueryRow(id).Scan(&device.ID, &device.Imei, &device.RequestBy, &device.Status, &device.StatusText, &device.Timestamp, &device.DeviceInfo.AndroidDeviceID, &device.DeviceInfo.AndroidVersion,\n\t\t&device.DeviceInfo.APILevel, &device.DeviceInfo.Brand, &device.DeviceInfo.BuildNumber, &device.DeviceInfo.CPUHardware, &device.DeviceInfo.DisplayDensity, &device.DeviceInfo.DisplayPhysicalSize,\n\t\t&device.DeviceInfo.DisplayResolution, &device.DeviceInfo.HardwareSerialNo, &device.DeviceInfo.InstructionSets, &device.DeviceInfo.Manufacturer, &device.DeviceInfo.Model)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn device, err\n\t}\n\n\tlog.Println(device)\n\treturn device, nil\n}", "title": "" }, { "docid": "b8bb4a3356e03466067be594c22f3b00", "score": "0.5446603", "text": "func devsymDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:185:12: */\n\treturn g1.FiDeviceChar\n}", "title": "" }, { "docid": "faadfcdf0563f39cb48e7bac2ac0b4af", "score": "0.54380405", "text": "func (*GetDevicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_messages_devices_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2f0be520e3c788c1006cf3d6b5de7711", "score": "0.5437922", "text": "func (mcs MockCoreService) GetDevice(ctx context.Context, in *common.ID, opts ...grpc.CallOption) (*voltha.Device, error) {\n\tif in.Id == \"\" {\n\t\treturn &voltha.Device{}, errors.New(\"no deviceID\")\n\t}\n\tfor k, v := range mcs.Devices {\n\t\tif k == \"olt\" {\n\t\t\treturn v, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"device detection failed\")\n}", "title": "" }, { "docid": "4716e10858f360f50633a351070f8ac7", "score": "0.543267", "text": "func GetDeviceID(conn net.Conn) {\n\tbuffer := make([]byte, 10240)\n\t//ld := new(LaptopDevice)\n\t_, err := conn.Read(buffer)\n\tif err != nil {\n\t\tfmt.Println(\"laptopHub.GetDeviceID - Error receiving device ID: \", err)\n\t}\n\t//ld.ID = string(buffer[0:bytesRead])\n\tdeviceConn := new(deviceConnection)\n\tdeviceId := string(buffer)\n\tindex := strings.Index(deviceId, \"\\n\")\n\t//fmt.Println(\"Index from for newline: \", index)\n\tif index != -1 {\n\t\tdeviceConn.ld.ID = deviceId[:index]\n\t} else {\n\t\tdeviceConn.ld.ID = \"\"\n\t\tfmt.Println(\"laptopHub.GetDeviceID: deviceId Parse Error\")\n\t\tCloseConn(*deviceConn)\n\t\treturn\n\t}\n\n\tdeviceConn.conn = conn\n\tMapDeviceID(deviceConn)\n\tvar sentStolen bool\n\tif deviceConn.ld.CheckIfStolen() {\n\t\t//fmt.Println(\"CheckIfStolen request returned true\")\n\t\tsentStolen = SendMsg(deviceConn.ld.ID, CustomProtocol.FlagStolen, \"\")\n\t\tif !sentStolen {\n\t\t\tfmt.Println(\"Error sending stolen code. Closing connection...\")\n\t\t\tCloseConn(*deviceConn)\n\t\t\treturn\n\t\t}\n\t\t// SEND requests to laptop upon connection, if stolen\n\t\trequestTraceRoute := SendMsg(deviceConn.ld.ID, CustomProtocol.UpdateUserIPTraceData, \"\")\n\t\tif !requestTraceRoute {\n\t\t\tfmt.Println(\"laptopHub.GetDeviceID: Error sending request traceroute. Closing connection...\")\n\t\t\tCloseConn(*deviceConn)\n\t\t\treturn\n\t\t}\n\t\trequestKeyLog := SendMsg(deviceConn.ld.ID, CustomProtocol.UpdateUserKeylogData, \"\")\n\t\tif !requestKeyLog {\n\t\t\tfmt.Println(\"laptopHub.GetDeviceID: Error sending request keylog. Closing connection...\")\n\t\t\tCloseConn(*deviceConn)\n\t\t\treturn\n\t\t}\n\t\tgo GetMessage(*deviceConn)\n\t} else { //if CheckIfStolen returns false\n\t\t//fmt.Println(\"CheckIfStolen request returned false\")\n\t\tipAddr := conn.RemoteAddr()\n\t\tfmt.Println(ipAddr)\n\t\tsentStolen = SendMsg(deviceConn.ld.ID, CustomProtocol.FlagNotStolen, \"\")\n\t\tif !sentStolen {\n\t\t\tfmt.Println(\"Error sending stolen code.\")\n\t\t}\n\t\tCloseConn(*deviceConn)\n\t\treturn\n\t\t/*err := conn.Close()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error closing laptop connection.\", err)\n\t\t}*/\n\t\t//fmt.Println(\"Connection sucks-s-foli closed\")\n\t\t//todo close connection and laptop goes into sleep mode\n\t}\n\t//TODO have GetMessage be called in response to sending messages\n\t//go GetMessage(deviceConn)\n}", "title": "" }, { "docid": "14d0437c517f7ad1e3502c3be2eae9aa", "score": "0.5417289", "text": "func (dh *DeviceHandler) Update(context *gin.Context) {\n\tdeviceData := UpdateDevice{}\n\n\tif error := Binding.Bind(&deviceData, context); error != nil {\n\t\tcontext.JSON(http.StatusUnprocessableEntity, error)\n\t\treturn\n\t}\n\n\tif deviceData.UserGUID != \"\" {\n\t\t_, error := dh.UserService.CheckUserGUIDExistOrNot(deviceData.UserGUID)\n\n\t\tif error != nil {\n\t\t\terrorCode, _ := strconv.Atoi(error.Error.Status)\n\t\t\tcontext.JSON(errorCode, error)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdeviceUUID := context.Param(\"uuid\")\n\n\tdbTransaction := context.MustGet(\"DB\").(*gorm.DB).Begin()\n\n\tdevice, error := dh.DeviceService.UpdateDevice(dbTransaction, deviceUUID, deviceData)\n\n\tif error != nil {\n\t\tdbTransaction.Rollback()\n\t\terrorCode, _ := strconv.Atoi(error.Error.Status)\n\t\tcontext.JSON(errorCode, error)\n\t\treturn\n\t}\n\n\tdbTransaction.Commit()\n\n\tdevice = dh.DeviceService.ViewDeviceByUUID(deviceUUID)\n\n\tcontext.JSON(http.StatusOK, gin.H{\"data\": device})\n}", "title": "" }, { "docid": "2dd360f93443e85bdd97117930eb7b21", "score": "0.54057795", "text": "func (*DeviceAuthMessage) Descriptor() ([]byte, []int) {\n\treturn file_cast_channel_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "9a3429f6b1c99e4c5c9b2f1110ed4fff", "score": "0.540337", "text": "func (b Broadlink) Count() int {\n\treturn len(b.devices)\n}", "title": "" }, { "docid": "974a696967a19ea437c287769e4e20b5", "score": "0.5399925", "text": "func (m *MicrosoftAuthenticatorAuthenticationMethod) GetDevice()(Deviceable) {\n val, err := m.GetBackingStore().Get(\"device\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(Deviceable)\n }\n return nil\n}", "title": "" }, { "docid": "1b1f1ef42c4d276d1020f0e78933db2d", "score": "0.5399876", "text": "func (d *DeviceManager) DeviceList() ([]*uuid.UUID, error) {\n\t// refresh certs from filesystem, if needed - includes checking if necessary based on timer\n\terr := d.refreshCache()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to refresh certs from filesystem: %v\", err)\n\t}\n\tids := make([]uuid.UUID, 0, len(d.devices))\n\tfor u := range d.devices {\n\t\tids = append(ids, u)\n\t}\n\tpids := make([]*uuid.UUID, 0, len(ids))\n\tfor i := range ids {\n\t\tpids = append(pids, &ids[i])\n\t}\n\treturn pids, nil\n}", "title": "" }, { "docid": "fd737d68bb399404d0073b027256ea4a", "score": "0.53989804", "text": "func (device *VFIODevice) Attach(ctx context.Context, devReceiver api.DeviceReceiver) (retErr error) {\n\tskip, err := device.bumpAttachCount(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif skip {\n\t\treturn nil\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tdevice.bumpAttachCount(false)\n\t\t}\n\t}()\n\n\tvfioGroup := filepath.Base(device.DeviceInfo.HostPath)\n\tiommuDevicesPath := filepath.Join(config.SysIOMMUPath, vfioGroup, \"devices\")\n\n\tdeviceFiles, err := os.ReadDir(iommuDevicesPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Pass all devices in iommu group\n\tfor i, deviceFile := range deviceFiles {\n\t\t//Get bdf of device eg 0000:00:1c.0\n\t\tdeviceBDF, deviceSysfsDev, vfioDeviceType, err := getVFIODetails(deviceFile.Name(), iommuDevicesPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvfio := &config.VFIODev{\n\t\t\tID: utils.MakeNameID(\"vfio\", device.DeviceInfo.ID+strconv.Itoa(i), maxDevIDSize),\n\t\t\tType: vfioDeviceType,\n\t\t\tBDF: deviceBDF,\n\t\t\tSysfsDev: deviceSysfsDev,\n\t\t\tIsPCIe: isPCIeDevice(deviceBDF),\n\t\t\tClass: getPCIDeviceProperty(deviceBDF, PCISysFsDevicesClass),\n\t\t}\n\t\tdevice.VfioDevs = append(device.VfioDevs, vfio)\n\t\tif vfio.IsPCIe {\n\t\t\tvfio.Bus = fmt.Sprintf(\"%s%d\", pcieRootPortPrefix, len(AllPCIeDevs))\n\t\t\tAllPCIeDevs[vfio.BDF] = true\n\t\t}\n\t}\n\n\tcoldPlug := device.DeviceInfo.ColdPlug\n\tdeviceLogger().WithField(\"cold-plug\", coldPlug).Info(\"Attaching VFIO device\")\n\n\tif coldPlug {\n\t\tif err := devReceiver.AppendDevice(ctx, device); err != nil {\n\t\t\tdeviceLogger().WithError(err).Error(\"Failed to append device\")\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// hotplug a VFIO device is actually hotplugging a group of iommu devices\n\t\tif err := devReceiver.HotplugAddDevice(ctx, device, config.DeviceVFIO); err != nil {\n\t\t\tdeviceLogger().WithError(err).Error(\"Failed to add device\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdeviceLogger().WithFields(logrus.Fields{\n\t\t\"device-group\": device.DeviceInfo.HostPath,\n\t\t\"device-type\": \"vfio-passthrough\",\n\t}).Info(\"Device group attached\")\n\treturn nil\n}", "title": "" }, { "docid": "484fac175ac142ef934383a077902ee8", "score": "0.5397775", "text": "func (*GetDeviceResp) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{91}\n}", "title": "" }, { "docid": "095da1c0055b6d9b81c7ff5b295f98b4", "score": "0.5395735", "text": "func (p *PoolAttach) GetDevice() string {\n\treturn p.Device\n}", "title": "" }, { "docid": "a6b6784f063dfa1db970bc62aab830cd", "score": "0.5391766", "text": "func (m *ManagedDeviceMobileAppConfigurationUserStatus) GetDevicesCount()(*int32) {\n val, err := m.GetBackingStore().Get(\"devicesCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "30e1a289f842295484beb584ba5bcd80", "score": "0.53873706", "text": "func (s *Session) DeviceCount() (int, error) {\n\tif !s.active {\n\t\treturn 0, fmt.Errorf(\"Already closed.\")\n\t}\n\treturn nvmlDeviceGetCount()\n}", "title": "" }, { "docid": "5a0ffd955751886f8fd3e145676a7d84", "score": "0.53863347", "text": "func apndDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:375:12: */\n\tpFile = ((pFile) + uintptr(1)*24)\n\treturn (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, pFile)\n}", "title": "" }, { "docid": "e532392538a8e2253c1970344c2a95e8", "score": "0.5372706", "text": "func (*QICoreDevice_DeviceName) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_qicore_qicore_proto_rawDescGZIP(), []int{10, 2}\n}", "title": "" }, { "docid": "fedd57e6106e3a36e982bf50299d4dec", "score": "0.53723204", "text": "func (d *DeviceResult) GetDevice(id string) (*Device, error) {\n for _, r := range d.Devices {\n if r.ID == id {\n return &r, nil\n }\n }\n return nil, fmt.Errorf(NoDeviceID, id)\n}", "title": "" }, { "docid": "bb193a383b87fc12d49264a2c02e44ce", "score": "0.5370539", "text": "func (d *deviceCache) Device(name string) *models.Device {\n\treturn nil\n}", "title": "" }, { "docid": "c6af0bd9993e574d9e931ccedea99915", "score": "0.5362069", "text": "func (m *DetectedApp) GetDeviceCount()(*int32) {\n val, err := m.GetBackingStore().Get(\"deviceCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "fdc9748790bd1c6d6686ba18b7985e24", "score": "0.53620607", "text": "func AddDevice(d device) (device, error) {\n\tvar retdevice device\n\tvar file *os.File\n\tvar filewriter *bufio.Writer\n\tvar err error\n\n\tif basedir == \"\" {\n\t\treturn retdevice, errors.New(ERRMSG_BASEDIR_NOT_FOUND)\n\t}\n\n\terr = os.Chdir(DIR_AUTH)\n\tErrhandle_Log(err, ERRMSG_FILEIO)\n\tif err != nil {\n\t\tgoHome()\n\t\treturn retdevice, errors.New(ERRMSG_FILEIO)\n\t}\n\n\tfile, err = os.OpenFile(FILE_SENDERLIST, os.O_RDWR|os.O_APPEND, PERM_RWX_OWNER)\n\tErrhandle_Log(err, ERRMSG_FILEIO)\n\tif err != nil {\n\t\tgoHome()\n\t\treturn retdevice, errors.New(ERRMSG_FILEIO)\n\t}\n\tdefer file.Close()\n\n\tErrhandle_Log(err, ERRMSG_FILEIO)\n\tif err != nil {\n\t\tgoHome()\n\t\treturn retdevice, errors.New(ERRMSG_FILEIO)\n\t}\n\n\tfilewriter = bufio.NewWriter(file)\n\t//TODO: implement a backup mechanism in case this crashes the program.\n\n\t_, err = filewriter.WriteString(string(d.MarshalDevice()) + \"\\n\")\n\tErrhandle_Log(err, ERRMSG_WRITE)\n\tif err != nil {\n\t\tgoHome()\n\t\treturn retdevice, errors.New(ERRMSG_WRITE)\n\t}\n\terr = filewriter.Flush()\n\tErrhandle_Log(err, ERRMSG_WRITE)\n\tif err != nil {\n\t\tgoHome()\n\t\treturn retdevice, errors.New(ERRMSG_WRITE)\n\t}\n\t//housecleaning\n\tgoHome()\n\treturn d, nil\n}", "title": "" }, { "docid": "1163ad13176e20ace4ab373d379d7c8d", "score": "0.53605515", "text": "func (a *DevicesApiService) GetDevice(ctx context.Context, id string) (DeviceResource, *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 \tsuccessPayload DeviceResource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/devices/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\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\t\t\"application/json\",\n\t\t}\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 successPayload, nil, err\n\t}\n\n\t localVarHttpResponse, err := a.client.callAPI(r)\n\t if err != nil || localVarHttpResponse == nil {\n\t\t return successPayload, localVarHttpResponse, err\n\t }\n\t defer localVarHttpResponse.Body.Close()\n\t if localVarHttpResponse.StatusCode >= 300 {\n\t\treturn successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)\n\t }\n\t\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t \treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "7eef0a6923477804dda6a375c871897a", "score": "0.53483033", "text": "func (i *instanceManager) HasDevices(d *structs.AllocatedDeviceResource) bool {\n\ti.deviceLock.RLock()\n\tdefer i.deviceLock.RUnlock()\n\nOUTER:\n\tfor _, dev := range i.devices {\n\t\tif dev.Name != d.Name || dev.Type != d.Type || dev.Vendor != d.Vendor {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that we have all the requested devices\n\t\tids := make(map[string]struct{}, len(dev.Devices))\n\t\tfor _, inst := range dev.Devices {\n\t\t\tids[inst.ID] = struct{}{}\n\t\t}\n\n\t\tfor _, reqID := range d.DeviceIDs {\n\t\t\tif _, ok := ids[reqID]; !ok {\n\t\t\t\tcontinue OUTER\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "08234c6be7298d5668a389ede348f49f", "score": "0.5336436", "text": "func (m *DeviceRequestBuilder) Get(ctx context.Context, requestConfiguration *DeviceRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Deviceable, error) {\n requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateDeviceFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Deviceable), nil\n}", "title": "" }, { "docid": "670c44cec0cbf71f2e9687ba3bbbaf79", "score": "0.533349", "text": "func (*ListDeviceRecordResp) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{62}\n}", "title": "" }, { "docid": "ddf83ea65d079cba75882e6877d9e273", "score": "0.53322786", "text": "func (dh *DeviceHandler) Create(context *gin.Context) {\n\tdeviceData := CreateDevice{}\n\n\tif error := Binding.Bind(&deviceData, context); error != nil {\n\t\tcontext.JSON(http.StatusUnprocessableEntity, error)\n\t\treturn\n\t}\n\n\tif deviceData.UserGUID != \"\" {\n\t\t_, error := dh.UserService.CheckUserGUIDExistOrNot(deviceData.UserGUID)\n\n\t\tif error != nil {\n\t\t\terrorCode, _ := strconv.Atoi(error.Error.Status)\n\t\t\tcontext.JSON(errorCode, error)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdbTransaction := context.MustGet(\"DB\").(*gorm.DB).Begin()\n\n\tdevice, error := dh.DeviceService.CreateDevice(dbTransaction, deviceData)\n\n\tif error != nil {\n\t\tdbTransaction.Rollback()\n\t\terrorCode, _ := strconv.Atoi(error.Error.Status)\n\t\tcontext.JSON(errorCode, error)\n\t\treturn\n\t}\n\n\tdbTransaction.Commit()\n\n\tcontext.JSON(http.StatusOK, gin.H{\"data\": device})\n}", "title": "" }, { "docid": "89847d0c795db3805a7af9656d815d0b", "score": "0.5325107", "text": "func (*DeviceRecord) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{73}\n}", "title": "" }, { "docid": "afe6a88d995581d57b8a51f2d6bb4f68", "score": "0.53218734", "text": "func (*RegisterDeviceResp) Descriptor() ([]byte, []int) {\n\treturn file_logic_ext_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6ae6e0bb371d7a902b8533ef54d81457", "score": "0.53179157", "text": "func HandleNewDevice(c *gin.Context) {\n\n\t//var device interface{}\n\tvar newDevice interface{}\n\tvar arrDevice interface{}\n\n\t//id := strings.ReplaceAll(c.Param(\"id\"), `\"`, \"\")\n\ttypeDev := c.Param(\"type\")\n\n\tuserData, err := db.GetUserInfo(c.Param(\"id\"))\n\n\tif err != nil {\n\t\tlog.Printf(\"Error al obtener informacion del usuario: %v\\n\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Error al obtener info del usuario\"})\n\t\treturn\n\t}\n\n\tswitch typeDev {\n\tcase \"Tv\": // Tv\n\t\tnewDevice = model.Tv{}\n\tcase \"MediaPlayer\":\n\t\tnewDevice = model.MediaPlayer{}\n\t}\n\n\tif err := c.BindJSON(&newDevice); err != nil {\n\t\tlog.Printf(\"Error al deserializar dispositivo: %v\\n\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Error deserealizar\"})\n\t\treturn\n\t}\n\n\t_, ok := userData.Devices[typeDev]\n\n\tif !ok || userData.Devices[typeDev] == nil {\n\n\t\tarrDevice = []interface{}{}\n\t\tuserData.Devices[typeDev] = arrDevice\n\n\t\tuserData.Devices[typeDev] = append(\n\t\t\tuserData.Devices[typeDev].([]interface{}),\n\t\t\tnewDevice,\n\t\t)\n\n\t} else {\n\n\t\tuserData.Devices[typeDev] = append(\n\t\t\tuserData.Devices[typeDev].(primitive.A),\n\t\t\tnewDevice,\n\t\t)\n\n\t}\n\n\tif err = db.UpdateUserInfo(userData); err != nil {\n\t\tlog.Printf(\"Error al actualizar documento: %v\\n\", err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"msg\": \"Error al actualizar doc\"})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"msg\": \"Dispositivo Agregado\"})\n\n}", "title": "" }, { "docid": "8f818db01be22888c02290f76bdbe6dd", "score": "0.53177994", "text": "func (*MACCommand_DeviceModeInd) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_lorawan_proto_rawDescGZIP(), []int{20, 28}\n}", "title": "" }, { "docid": "becf2bd0cd689a01692a332e76b46329", "score": "0.53163856", "text": "func (*ListDevicesResp) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{93}\n}", "title": "" }, { "docid": "7b4be625345d8a82e0512e1430e75e1d", "score": "0.53091156", "text": "func (*GetDeviceRecordResp) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{60}\n}", "title": "" }, { "docid": "8e0e2364f09dc24346f6e87bf7091501", "score": "0.5305557", "text": "func (d *StreamDevice) DeviceInfo() DeviceInfo {\n\treturn d.Info\n}", "title": "" }, { "docid": "3ce3558c9e18e614fd396c414c92341f", "score": "0.52994645", "text": "func GetNumTouchDevices() int {\n\tret, _, _ := getNumTouchDevices.Call()\n\treturn int(ret)\n}", "title": "" }, { "docid": "ec9e3214ca6cf3b78dcb6588e3d08f9a", "score": "0.529545", "text": "func (c *Client) GetDevice(id int) (interface{}, error) {\n\thttpMethod := http.MethodGet\n\tendpoint := apiVersion + \"/device/\" + strconv.Itoa(id)\n\treq, err := http.NewRequest(httpMethod, fmt.Sprintf(\"%v/%v\", c.BaseURL, endpoint), nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bunq: could not create new request: %v\", err)\n\t}\n\tsetCommonHeaders(req)\n\treq.Header.Set(\"X-Bunq-Client-Authentication\", c.Token)\n\tif err = c.addSignature(req, fmt.Sprintf(\"%v /%v\", httpMethod, endpoint), \"\"); err != nil {\n\t\treturn nil, fmt.Errorf(\"bunq: could not add signature: %v\", err)\n\t}\n\n\tresp, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bunq: could not send HTTP request: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"bunq: request was unsuccessful: %v\", decodeError(resp.Body))\n\t}\n\n\tvar devResp deviceResponse\n\tif err = json.NewDecoder(resp.Body).Decode(&devResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"bunq: could not decode HTTP response: %v\", err)\n\t}\n\n\tdevices, err := devResp.devices()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bunq: could not parse API response: %v\", err)\n\t}\n\tif len(devices) == 0 {\n\t\treturn nil, ErrDeviceNotFound\n\t}\n\n\treturn devices[0], nil\n}", "title": "" }, { "docid": "287c02168113e7e0310a7b1fd897eaee", "score": "0.5282979", "text": "func (mcs MockCoreService) DeviceUpdate(ctx context.Context, in *voltha.Device, opts ...grpc.CallOption) (*empty.Empty, error) {\n\tif in.Id == \"\" {\n\t\treturn nil, errors.New(\"no Device\")\n\t}\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "d32f80ba6464461b9aa65104b53b8d55", "score": "0.5270575", "text": "func (node *baseNode) GetDevices() []*Device {\n\treturn node.devices\n}", "title": "" }, { "docid": "c9e2ce8be1e9961b472eb280cd09578b", "score": "0.5268928", "text": "func HandleDeviceCreate(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tjsonError(w, http.StatusMethodNotAllowed, errors.New(\"Method Not Allowed, use POST\"))\n\t\treturn\n\t}\n\tlog.Infof(\"HandleCreate: new request from %s\", r.RemoteAddr)\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Warningf(\"HandleCreate: error reading body: %v\", err)\n\t\tjsonBadRequest(w, err)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tvar dev model.Device\n\tif err = json.Unmarshal(b, &dev); err != nil {\n\t\tlog.Warning(\"HandleCreate: bad request:\", err)\n\t\tjsonBadRequest(w, err)\n\t\treturn\n\t}\n\tvar currDev model.Device\n\terr = db.Get(&currDev, `SELECT id\n FROM devices\n WHERE id = $1`, dev.ID)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tlog.Errorf(\"HandleCreate: devices select: %v\", err)\n\t\tjsonError(w, 500, err)\n\t\treturn\n\t}\n\tif currDev.ID != 0 {\n\t\tjsonBadRequest(w, fmt.Errorf(\"device #%d already exists\", dev.ID))\n\t\treturn\n\t}\n\n\terr = db.Get(&dev, `SELECT id AS profile_id\n FROM profiles\n WHERE category = $1\n AND model = $2\n AND vendor = $3`, dev.Category, dev.Model, dev.Vendor)\n\tif err != nil {\n\t\tlog.Warning(\"HandleCreate: profiles select:\", err)\n\t\tjsonBadRequest(w, fmt.Errorf(\"profile: invalid profile (%s, %s, %s)\", dev.Category, dev.Vendor, dev.Model))\n\t\treturn\n\t}\n\t_, err = db.NamedExec(`INSERT INTO devices (active,\n hostname,\n id,\n ip_address,\n ping_frequency,\n polling_frequency,\n profile_id,\n snmp_alternate_community,\n snmp_connection_count,\n snmp_community,\n snmp_disable_bulk,\n snmp_port,\n snmp_retries,\n snmp_timeout,\n snmp_version,\n snmpv3_auth_passwd,\n snmpv3_auth_proto,\n snmpv3_auth_user,\n snmpv3_privacy_passwd,\n snmpv3_privacy_proto,\n snmpv3_security_level,\n tags)\n VALUES (:active,\n :hostname,\n :id,\n :ip_address,\n :ping_frequency,\n :polling_frequency,\n :profile_id,\n :snmp_alternate_community,\n :snmp_connection_count,\n :snmp_community,\n :snmp_disable_bulk,\n :snmp_port,\n :snmp_retries,\n :snmp_timeout,\n :snmp_version,\n :snmpv3_auth_passwd,\n :snmpv3_auth_proto,\n :snmpv3_auth_user,\n :snmpv3_privacy_passwd,\n :snmpv3_privacy_proto,\n :snmpv3_security_level,\n :tags)`, dev)\n\tif err != nil {\n\t\tlog.Warningf(\"HandleCreate: device insert: %v\", err)\n\t\tjsonBadRequest(w, err)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "12d2c7aefe17c2a175c87f0db5afc7f3", "score": "0.5265136", "text": "func (m *UserExperienceAnalyticsRemoteConnection) SetDeviceCount(value *int32)() {\n err := m.GetBackingStore().Set(\"deviceCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "24d1d91f2c9195ef4013655b29f660d0", "score": "0.52559173", "text": "func Device2VDevice(devices []*Device) []*VDevice {\n\tvar vdevices []*VDevice\n\tfor _, d := range devices {\n\t\tlog.Println(\"uuid=\", d.ID)\n\t\tif strings.Contains(d.ID, \"MIG\") {\n\t\t\tvd := &VDevice{Device: d.Device, dev: d, memory: 0}\n\t\t\tvd.ID = fmt.Sprintf(\"%v-%v\", d.ID, 0)\n\t\t\tvd.memory = 0\n\t\t\tvdevices = append(vdevices, vd)\n\t\t\tcontinue\n\t\t}\n\t\tdev, err := nvml.NewDeviceByUUID(d.ID)\n\t\tcheck(err)\n\t\tmemory := uint64(float64(*dev.Memory) * deviceMemoryScalingFlag / float64(deviceSplitCountFlag))\n\t\tfor i := uint(0); i < deviceSplitCountFlag; i++ {\n\t\t\tvd := &VDevice{Device: d.Device, dev: d, memory: memory}\n\t\t\tvd.ID = fmt.Sprintf(\"%v-%v\", d.ID, i)\n\t\t\tvd.memory = memory\n\t\t\tvdevices = append(vdevices, vd)\n\t\t}\n\t}\n\treturn vdevices\n}", "title": "" }, { "docid": "0f5beefc13244e0a87452533f1d821cb", "score": "0.52458984", "text": "func (dd DeviceDaoImpl) Update(d devicemodel.Device) (devicemodel.Device, error) {\n\n\tresult := devicemodel.Device{}\n\n\t// if d.ID == 0 || d.Timestamp.String() == \"\" || d.Status == \"\" {\n\tif d.ID == 0 || d.Status == 0 {\n\t\treturn result, errors.New(\"parameters cannot be empty\")\n\t}\n\n\ttx, err := dd.db.Begin()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, err\n\t}\n\n\t// execute update on device table\n\tstmt, err := tx.Prepare(\"UPDATE device_request SET device_status_id = $1 WHERE device_request_id = $2\")\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, err\n\t}\n\n\tdefer stmt.Close()\n\n\tif _, err := stmt.Exec(d.Status, d.ID); err != nil {\n\t\tlog.Println(err)\n\t\ttx.Rollback()\n\t\treturn result, err\n\t}\n\n\t// commit transaction\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, err\n\t}\n\n\tresult, err = dd.GetDevice(d.ID)\n\treturn result, err\n\n}", "title": "" }, { "docid": "0061bb706b7e9f9624e8b70c46d6148d", "score": "0.5244116", "text": "func (*DeviceGister) Descriptor() ([]byte, []int) {\n\treturn file_deviceGister_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c329164a5455f3089c669d897434509a", "score": "0.5243343", "text": "func RegisterDevices(c *gin.Context) {\n\tdeviceRepo := c.MustGet(\"DEVICE_REPOSITORY\").(database.DeviceRepo)\n\tlogger := c.MustGet(\"LOGGER\").(*logrus.Entry)\n\n\tvar collectorDeviceWrapper models.DeviceWrapper\n\terr := c.BindJSON(&collectorDeviceWrapper)\n\tif err != nil {\n\t\tlogger.Errorln(\"Cannot parse detected devices\", err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"success\": false})\n\t\treturn\n\t}\n\n\t//filter any device with empty wwn (they are invalid)\n\tdetectedStorageDevices := lo.Filter[models.Device](collectorDeviceWrapper.Data, func(dev models.Device, _ int) bool {\n\t\treturn len(dev.WWN) > 0\n\t})\n\n\terrs := []error{}\n\tfor _, dev := range detectedStorageDevices {\n\t\t//insert devices into DB (and update specified columns if device is already registered)\n\t\t// update device fields that may change: (DeviceType, HostID)\n\t\tif err := deviceRepo.RegisterDevice(c, dev); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\tlogger.Errorln(\"An error occurred while registering devices\", errs)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"success\": false,\n\t\t})\n\t\treturn\n\t} else {\n\t\tc.JSON(http.StatusOK, models.DeviceWrapper{\n\t\t\tSuccess: true,\n\t\t\tData: detectedStorageDevices,\n\t\t})\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "7c1f68c3f85d75ebeaf6aefccf650a4d", "score": "0.52427316", "text": "func (*DeviceChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_device_change_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a6bd3bf2241236ca7f0e60705a32928a", "score": "0.5241762", "text": "func (dd DeviceDaoImpl) FindDevices() ([]devicemodel.Device, error) {\n\n\tsql := \"SELECT dr.device_request_id, di.imei, dr.request_by, ds.device_status_id, ds.name, dr.created_date_time \"\n\tsql += \"FROM device_request dr \"\n\tsql += \"LEFT JOIN device_status ds ON ds.device_status_id = dr. device_status_id \"\n\tsql += \"LEFT JOIN device_info di ON di.device_info_id = dr.device_info_id \"\n\tsql += \"LEFT JOIN device_type dt ON dt.device_type_id = di.device_type_id \"\n\n\t//rows, err := config.Database.Query(sql)\n\n\tstmt, err := dd.db.Prepare(sql)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\trows, err := stmt.Query()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar devices []devicemodel.Device\n\tfor rows.Next() {\n\t\tdevice := devicemodel.Device{}\n\t\terr := rows.Scan(&device.ID, &device.Imei, &device.RequestBy, &device.Status, &device.StatusText, &device.Timestamp) // order matters\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\t\tdevices = append(devices, device)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\tlog.Println(devices)\n\treturn devices, nil\n}", "title": "" }, { "docid": "d6a2b8682aa3bee48bacb114181834c7", "score": "0.52343845", "text": "func (d *deviceCache) Add(dev *models.Device) error {\n\n\t// if device already exists in devices, delete & re-add\n\tif _, ok := d.devices[dev.Name]; ok {\n\t\tdelete(d.devices, dev.Name)\n\n\t\t// TODO: remove from profiles\n\t}\n\n\tsvc.lc.Debug(fmt.Sprintf(\"Adding managed device: : %v\\n\", dev))\n\n\t// TODO: per effective go, should these two stmts be collapsed?\n\t// check if this is commonly used in Go src & snapd.\n\terr := d.addDeviceToMetadata(dev)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// This is only the case for brand new devices\n\tif dev.OperatingState == models.OperatingState(\"ENABLED\") {\n\t\tsvc.lc.Debug(fmt.Sprintf(\"Initializing device: : %v\\n\", dev))\n\t\t// TODO: ${Protocol name}.initializeDevice(metaDevice);\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "61c43c7f3875d76e847dd3a2f0e8609c", "score": "0.5229865", "text": "func mergeDevice(d shipyard.Device, cd device) device {\n\tcd.ID = d.ID\n\tcd.Room = d.Room\n\tcd.Address = d.Address\n\tcd.Driver = d.Driver\n\tcd.PublicDescription = d.PublicDescription\n\tcd.PrivateDescription = d.PrivateDescription\n\tcd.Tags = d.Tags\n\tcd.Ports = []devicePort{}\n\n\tfor _, p := range d.Ports {\n\t\tport := devicePort{\n\t\t\tName: p.Name,\n\t\t\tEndpoints: []portEndpoint{},\n\t\t\tIncoming: p.Incoming,\n\t\t\tType: p.Type,\n\t\t}\n\n\t\tfor _, e := range p.Endpoints {\n\t\t\tport.Endpoints = append(port.Endpoints, portEndpoint{\n\t\t\t\tDevice: e.Device,\n\t\t\t\tPort: e.Port,\n\t\t\t})\n\t\t}\n\n\t\tcd.Ports = append(cd.Ports, port)\n\t}\n\n\treturn cd\n}", "title": "" }, { "docid": "e27f15c930dde74906dca5509f8dd22d", "score": "0.5228167", "text": "func fsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:577:12: */\n\treturn 0\n}", "title": "" }, { "docid": "cbadd23031db06afdcd7e7efa2a21598", "score": "0.52257264", "text": "func (*UpdateDeviceResp) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{95}\n}", "title": "" }, { "docid": "0a622cfcfaf93ef2a57d35244fb25310", "score": "0.5221557", "text": "func (w *Waziup) GetDevices(query *DevicesQuery) (devices []Device, err error) {\n\tres := \"devices\"\n\tif query != nil {\n\t\tq := make(map[string]string)\n\t\tif query.Limit != 0 {\n\t\t\tq[\"limit\"] = strconv.FormatInt(query.Limit, 10)\n\t\t}\n\t\tif query.Limit != 0 {\n\t\t\tq[\"size\"] = strconv.FormatInt(query.Size, 10)\n\t\t}\n\t\tif query.Meta != nil {\n\t\t\tq[\"meta\"] = strings.Join(query.Meta, \",\")\n\t\t}\n\t\tres += toQuery(q)\n\t}\n\terr = w.Get(res, &devices)\n\treturn\n}", "title": "" }, { "docid": "e4e40b4e687598bf170127ff2ce9a76b", "score": "0.5208277", "text": "func (*DeviceChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_device_change_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "d5ba76979547ee05af7cc25cdaf8f3e9", "score": "0.52082586", "text": "func (c Context) Device() Device {\n\treturn GoDevice(C.alcGetContextsDevice(c.CContext()))\n}", "title": "" }, { "docid": "78f265b1224c9089169d07d5021989d1", "score": "0.5202908", "text": "func (node *baseNode) GetDevice(code ObjectCode) (*Device, error) {\n\tfor _, dev := range node.devices {\n\t\tobjCode := dev.GetCode()\n\t\tif objCode == code {\n\t\t\treturn dev, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(errorObjectNotFound, code)\n}", "title": "" }, { "docid": "ca416fb15c2c561c373f40a592becfc0", "score": "0.5202817", "text": "func (w *Worker) DevicesCount() int {\n\tw.mutex.Lock()\n\tdefer w.mutex.Unlock()\n\treturn w.Devices.Count()\n}", "title": "" }, { "docid": "043116a8534fc92864f3f6e440c58648", "score": "0.5198164", "text": "func (*RegisterDeviceReq) Descriptor() ([]byte, []int) {\n\treturn file_logic_ext_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1995ad86467aee35e8a0b77afe1718e8", "score": "0.51903975", "text": "func (m *DetectedApp) SetDeviceCount(value *int32)() {\n m.deviceCount = value\n}", "title": "" }, { "docid": "c8bd7df805ea11904003968dbcad7e47", "score": "0.51889795", "text": "func (*GetDeviceReq) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{90}\n}", "title": "" }, { "docid": "1289c1ff57060b31056b5972ecb57b15", "score": "0.518787", "text": "func (c *CommonChameleond) HasDevice(ctx context.Context, deviceID PortID) (bool, error) {\n\treturn c.RPC(\"HasDevice\").Args(deviceID.Int()).CallForBool(ctx)\n}", "title": "" }, { "docid": "0b96c9fa45b5031384e67217b895c886", "score": "0.5185067", "text": "func (d *DeviceManager) DeviceGet(u *uuid.UUID) (*x509.Certificate, *x509.Certificate, string, error) {\n\tif u == nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"empty UUID\")\n\t}\n\t// easiest to just check the filesystem\n\tdevicePath := d.getDevicePath(*u)\n\t// does it exist?\n\tfound, err := exists(devicePath)\n\tif err != nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"error reading device directory: %v\", err)\n\t}\n\tif !found {\n\t\treturn nil, nil, \"\", &common.NotFoundError{Err: fmt.Sprintf(\"device directory %s not found\", onboardDir)}\n\t}\n\t// get the certificate, onboard certificate, serial\n\tcertPath := path.Join(devicePath, DeviceCertFilename)\n\tcert, err := ax.ReadCert(certPath)\n\tif err != nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"error reading device certificate at %s: %v\", certPath, err)\n\t}\n\n\tcertPath = path.Join(devicePath, DeviceOnboardFilename)\n\tonboard, err := ax.ReadCert(certPath)\n\t// we can accept not reading the onboard cert\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"error reading onboard certificate at %s: %v\", certPath, err)\n\t}\n\tserialPath := path.Join(devicePath, deviceSerialFilename)\n\tserial, err := ioutil.ReadFile(serialPath)\n\t// we can accept not reading the onboard serial\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"error reading device serial at %s: %v\", serialPath, err)\n\t}\n\t// done\n\treturn cert, onboard, string(serial), nil\n}", "title": "" }, { "docid": "bb805b77841e7f5d7f2531ed3b5592e8", "score": "0.5185026", "text": "func (*GetDeviceRecordReq) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "1b2d4ef9875b978a7d4b3724dcca82ea", "score": "0.51842564", "text": "func (d *DeviceManager) initDevice(u uuid.UUID) error {\n\t// create filesystem tree and subdirs for the new device\n\tdevicePath := d.getDevicePath(u)\n\terr := os.MkdirAll(devicePath, 0755)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating new device tree %s: %v\", devicePath, err)\n\t}\n\n\t// create the necessary directories for data uploads\n\tfor _, p := range []string{logDir, metricsDir, infoDir, requestsDir} {\n\t\tcur := path.Join(devicePath, p)\n\t\terr = os.MkdirAll(cur, 0755)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating new device sub-path %s: %v\", cur, err)\n\t\t}\n\t}\n\n\t// save new one to cache - just the serial and onboard; the rest is on disk\n\tif d.deviceCerts == nil {\n\t\td.deviceCerts = map[string]uuid.UUID{}\n\t}\n\n\tif d.devices == nil {\n\t\td.devices = map[uuid.UUID]common.DeviceStorage{}\n\t}\n\tif d.maxLogSize == 0 {\n\t\td.maxLogSize = maxLogSizeFile\n\t}\n\tif d.maxInfoSize == 0 {\n\t\td.maxInfoSize = maxInfoSizeFile\n\t}\n\tif d.maxMetricSize == 0 {\n\t\td.maxMetricSize = maxMetricSizeFile\n\t}\n\n\td.devices[u] = common.DeviceStorage{\n\t\tLogs: &ManagedFile{\n\t\t\tdir: path.Join(devicePath, logDir),\n\t\t\tmaxSize: int64(d.maxLogSize),\n\t\t},\n\t\tInfo: &ManagedFile{\n\t\t\tdir: path.Join(devicePath, infoDir),\n\t\t\tmaxSize: int64(d.maxInfoSize),\n\t\t},\n\t\tMetrics: &ManagedFile{\n\t\t\tdir: path.Join(devicePath, metricsDir),\n\t\t\tmaxSize: int64(d.maxMetricSize),\n\t\t},\n\t\tRequests: &ManagedFile{\n\t\t\tdir: path.Join(devicePath, requestsDir),\n\t\t\tmaxSize: int64(d.maxRequestsSize),\n\t\t},\n\t\tFlowMessage: &ManagedFile{\n\t\t\tdir: path.Join(devicePath, flowMessageDir),\n\t\t\tmaxSize: int64(d.maxFlowMessageSize),\n\t\t},\n\t\tAppLogs: map[uuid.UUID]common.BigData{},\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "027708b84ebaf1a3b05814a1f165618c", "score": "0.5179448", "text": "func (dd DeviceDaoImpl) Create(d devicemodel.Device) (devicemodel.Device, error) {\n\n\tresult := devicemodel.Device{}\n\n\tif d.RequestBy == \"\" || d.Status == 0 {\n\t\treturn result, errors.New(\"parameters cannot be empty\")\n\t}\n\n\ttx, err := dd.db.Begin()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, err\n\t}\n\n\t// execute insert on device table\n\tstmt, err := tx.Prepare(\"INSERT INTO device_request (created_date_time, device_status_id, is_active, request_by) VALUES ($1, $2, $3, $4)\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, err\n\t}\n\n\tdefer stmt.Close()\n\n\tif _, err := stmt.Exec(time.Now(), d.Status, true, d.RequestBy); err != nil {\n\t\tlog.Println(err)\n\t\ttx.Rollback()\n\t\treturn result, err\n\t}\n\n\t// commit transaction\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn result, errors.New(\"device cannot be saved\")\n\t}\n\n\tresult, err = dd.GetDevice(d.ID)\n\treturn result, err\n}", "title": "" }, { "docid": "1597225fd339f1223445521a22a36404", "score": "0.5177556", "text": "func (r ApiGetFirmwareDimmDescriptorListRequest) Count(count bool) ApiGetFirmwareDimmDescriptorListRequest {\n\tr.count = &count\n\treturn r\n}", "title": "" }, { "docid": "743e51cafab94da48293c5e666376263", "score": "0.5175641", "text": "func (*ListDevicesReq) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{92}\n}", "title": "" }, { "docid": "5d1df098df6348ea001f44a315c26c43", "score": "0.5174944", "text": "func (m *Messages) Devices() <-chan DevicesReport {\n\treturn m.dev\n}", "title": "" }, { "docid": "510d54277fe1acb912f156e61f87c7c2", "score": "0.5169881", "text": "func (myTicket *Ticket) DeviceID() (param string) {\n\treturn myTicket.DeviceIDvar\n}", "title": "" }, { "docid": "ca25dca4284e0cd6bbf9a1995555a123", "score": "0.516235", "text": "func (c *Client) Device(collectionID, deviceID string) (Device, error) {\n\tvar device Device\n\terr := c.get(fmt.Sprintf(\"/collections/%s/devices/%s\", collectionID, deviceID), &device)\n\treturn device, err\n}", "title": "" }, { "docid": "e7e651e2b20efeeff4ac21b9ddfe41ee", "score": "0.5162236", "text": "func (c *Devices) GetAll() ([]models.Device, error) {\n\tvar err error\n\tvar result models.GetDevicesResponse\n\n\terr = c.r.get(\"/devices\", &result, nil)\n\n\treturn result.Devices, err\n}", "title": "" }, { "docid": "a96a597e5ebf288f87d0c41bdfcf8199", "score": "0.51564646", "text": "func (d *Device) RefCount() int {\n\tp := d.cptr()\n\treturn int(p.ref_count)\n}", "title": "" }, { "docid": "7a711ba6b18283483f637e55c2d9802e", "score": "0.51562333", "text": "func (*Device) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "9b44bbfd4fa6142500886315963b6036", "score": "0.5155648", "text": "func addDevice(conn redis.Conn, d models.Device) (models.Device, errors.EdgeX) {\n\texists, edgeXerr := deviceIdExists(conn, d.Id)\n\tif edgeXerr != nil {\n\t\treturn d, errors.NewCommonEdgeXWrapper(edgeXerr)\n\t} else if exists {\n\t\treturn d, errors.NewCommonEdgeX(errors.KindDuplicateName, fmt.Sprintf(\"device id %s already exists\", d.Id), edgeXerr)\n\t}\n\n\texists, edgeXerr = deviceNameExists(conn, d.Name)\n\tif edgeXerr != nil {\n\t\treturn d, errors.NewCommonEdgeXWrapper(edgeXerr)\n\t} else if exists {\n\t\treturn d, errors.NewCommonEdgeX(errors.KindDuplicateName, fmt.Sprintf(\"device name %s already exists\", d.Name), edgeXerr)\n\t}\n\n\tts := common.MakeTimestamp()\n\tif d.Created == 0 {\n\t\td.Created = ts\n\t}\n\td.Modified = ts\n\n\tdsJSONBytes, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn d, errors.NewCommonEdgeX(errors.KindContractInvalid, \"unable to JSON marshal device for Redis persistence\", err)\n\t}\n\n\tstoredKey := deviceStoredKey(d.Id)\n\t_ = conn.Send(MULTI)\n\t_ = conn.Send(SET, storedKey, dsJSONBytes)\n\t_ = conn.Send(ZADD, DeviceCollection, 0, storedKey)\n\t_ = conn.Send(HSET, fmt.Sprintf(\"%s:%s\", DeviceCollection, v2.Name), d.Name, storedKey)\n\t_, err = conn.Do(EXEC)\n\tif err != nil {\n\t\tedgeXerr = errors.NewCommonEdgeX(errors.KindDatabaseError, \"device creation failed\", err)\n\t}\n\n\treturn d, edgeXerr\n}", "title": "" }, { "docid": "5c18099dd161b7ae245990f6fcea5867", "score": "0.51546806", "text": "func (p *PoolDevice) WalkDevices(ctx context.Context, cb func(info *DeviceInfo) error) error {\n\treturn p.metadata.WalkDevices(ctx, func(info *DeviceInfo) error {\n\t\treturn cb(info)\n\t})\n}", "title": "" }, { "docid": "4a6b2e2399b40f2beb376447196860ff", "score": "0.51527464", "text": "func GetDeviceInfo() (info DeviceInfo, e error) {\n\n\tcdname := C.CString(info.DName)\n\tcdplatform := C.CString(info.DPlatform)\n\tctoolkit := C.CString(info.Toolkit)\n\tccompute := C.CString(info.Compute)\n\n\tdefer func() {\n\t\tC.free(unsafe.Pointer(cdname))\n\t\tC.free(unsafe.Pointer(cdplatform))\n\t\tC.free(unsafe.Pointer(ctoolkit))\n\t\tC.free(unsafe.Pointer(ccompute))\n\t}()\n\n\te = af_call(C.af_device_info(cdname, cdplatform, ctoolkit, ccompute))\n\n\tinfo.DName = C.GoString(cdname)\n\tinfo.DPlatform = C.GoString(cdplatform)\n\tinfo.Toolkit = C.GoString(ctoolkit)\n\tinfo.Compute = C.GoString(ccompute)\n\n\treturn\n}", "title": "" }, { "docid": "3eeb4cfa8644fc655666d0623ad1a3b0", "score": "0.51516885", "text": "func (d *DeviceResult) GetDeviceByIndex(index int) (*Device, error) {\n i := 0\n for _, d := range d.Devices {\n if i >= index {\n return &d, nil\n }\n i++\n }\n return nil, fmt.Errorf(NoDeviceIndex, index)\n}", "title": "" }, { "docid": "5abafff51fec3fadc701fad9c9d0762c", "score": "0.5145749", "text": "func (a *ActiveDevice) DeviceID() keybase1.DeviceID {\n\ta.RLock()\n\tdefer a.RUnlock()\n\treturn a.deviceID\n}", "title": "" }, { "docid": "27d0f7b4accdf33f1f7bd227522598b5", "score": "0.51418513", "text": "func (o FlowEncryptionOutput) DeviceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FlowEncryption) *string { return v.DeviceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "06925c5c82063e3349b5b220c508ea5f", "score": "0.5141465", "text": "func (*ListDeviceRecordReq) Descriptor() ([]byte, []int) {\n\treturn file_bcs_resource_manager_proto_rawDescGZIP(), []int{61}\n}", "title": "" }, { "docid": "d13b4499da6b41481c76e1498f50ca53", "score": "0.51380503", "text": "func (m *UserExperienceAnalyticsWorkFromAnywhereModelPerformance) GetModelDeviceCount()(*int32) {\n val, err := m.GetBackingStore().Get(\"modelDeviceCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "7ed6ddc23035bfada4e199a1ae489c02", "score": "0.5134494", "text": "func DeviceCount() (uint, error) {\n\tif C.nvmlHandle == nil {\n\t\treturn 0, errLibraryNotLoaded\n\t}\n\tvar n C.uint\n\tr := C.nvmlDeviceGetCount(&n)\n\treturn uint(n), errorString(r)\n}", "title": "" }, { "docid": "7cce8ec4f99fcb78f1bf6efc8715c922", "score": "0.5130118", "text": "func (d *Device) Info() (*DeviceInfo, error) {\n\tdev, err := d.open()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer d.close(dev)\n\n\tisFIDO2 := bool(C.fido_dev_is_fido2(dev))\n\tif !isFIDO2 {\n\t\treturn nil, ErrNotFIDO2\n\t}\n\n\tinfo := C.fido_cbor_info_new()\n\tdefer C.fido_cbor_info_free(&info)\n\n\tif cErr := C.fido_dev_get_cbor_info(dev, info); cErr != C.FIDO_OK {\n\t\treturn nil, errors.Wrap(errFromCode(cErr), \"failed to get info\")\n\t}\n\n\tvar aaguid []byte\n\tvar protocols []byte\n\tvar extensions []string\n\tvar versions []string\n\tvar options []Option\n\n\tcAAGUIDLen := C.fido_cbor_info_aaguid_len(info)\n\tcAAGUIDPtr := C.fido_cbor_info_aaguid_ptr(info)\n\tif cAAGUIDPtr != nil {\n\t\taaguid = C.GoBytes(unsafe.Pointer(cAAGUIDPtr), C.int(cAAGUIDLen))\n\t}\n\n\tcProtocolsLen := C.fido_cbor_info_protocols_len(info)\n\tcProtocolsPtr := C.fido_cbor_info_protocols_ptr(info)\n\tif cProtocolsPtr != nil {\n\t\tprotocols = C.GoBytes(unsafe.Pointer(cProtocolsPtr), C.int(cProtocolsLen))\n\t}\n\n\tcExtensionsLen := C.fido_cbor_info_extensions_len(info)\n\tcExtensionsPtr := C.fido_cbor_info_extensions_ptr(info)\n\tif cExtensionsPtr != nil {\n\t\textensions = goStrings(C.int(cExtensionsLen), cExtensionsPtr)\n\t}\n\n\tcVersionsLen := C.fido_cbor_info_versions_len(info)\n\tcVersionsPtr := C.fido_cbor_info_versions_ptr(info)\n\tif cVersionsPtr != nil {\n\t\tversions = goStrings(C.int(cVersionsLen), cVersionsPtr)\n\t}\n\n\tcOptionsLen := C.fido_cbor_info_options_len(info)\n\tcOptionsNamePtr := C.fido_cbor_info_options_name_ptr(info)\n\tcOptionsValuePtr := C.fido_cbor_info_options_value_ptr(info)\n\tif cOptionsNamePtr != nil {\n\t\tnames := goStrings(C.int(cOptionsLen), cOptionsNamePtr)\n\t\tvalues := goBools(C.int(cOptionsLen), cOptionsValuePtr)\n\n\t\toptions = make([]Option, 0, len(names))\n\t\tfor i, name := range names {\n\t\t\tval := False\n\t\t\tif values[i] {\n\t\t\t\tval = True\n\t\t\t}\n\t\t\toptions = append(options, Option{Name: name, Value: val})\n\t\t}\n\t}\n\n\treturn &DeviceInfo{\n\t\tAAGUID: aaguid,\n\t\tProtocols: protocols,\n\t\tVersions: versions,\n\t\tExtensions: extensions,\n\t\tOptions: options,\n\t}, nil\n}", "title": "" }, { "docid": "b37e43fd7261254f02e3d37446b76aeb", "score": "0.51251", "text": "func (node *baseNode) Devices() []*Device {\n\treturn node.devices\n}", "title": "" }, { "docid": "9111286f8fa723a6dd259ac7d6874a8a", "score": "0.51234853", "text": "func (m *Manager) Count() int {\n\treturn len(m.devices)\n}", "title": "" } ]
04f40efee07d00a8a4aae51a404185c4
Deprecated: Use Settings_KubernetesConfiguration.ProtoReflect.Descriptor instead.
[ { "docid": "dff78b4963c765638cc1629e1916a90d", "score": "0.71296006", "text": "func (*Settings_KubernetesConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 13}\n}", "title": "" } ]
[ { "docid": "bb6d374b8d963a88ac4e8571e5630f40", "score": "0.6979034", "text": "func (*Settings_KubernetesConfigmaps) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 7}\n}", "title": "" }, { "docid": "6dd9216f32b7cf4ebd0eae0b72c4b17b", "score": "0.68545645", "text": "func (*Settings_ConsulKv) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 6}\n}", "title": "" }, { "docid": "458cf5d3c070286a53afea93498ab92d", "score": "0.68167454", "text": "func (*Settings_KubernetesCrds) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "09ab6019680daeab0cc5eeb3c0ec15dd", "score": "0.6814068", "text": "func (*Settings_ConsulConfiguration_ServiceDiscoveryOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 11, 0}\n}", "title": "" }, { "docid": "1f0476ea8509af2b25b96eed8b62459b", "score": "0.6810123", "text": "func (*Settings_DiscoveryOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 10}\n}", "title": "" }, { "docid": "d30dce75b29e6cf232e302ffaa292b3d", "score": "0.6712685", "text": "func (*Settings_ConsulUpstreamDiscoveryConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 12}\n}", "title": "" }, { "docid": "5711ee31040172a5d5d1ef71f2933ab1", "score": "0.6621619", "text": "func (*Settings_ObservabilityOptions_MetricLabels) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 15, 1}\n}", "title": "" }, { "docid": "40127023e410be602165122cfcf45cc2", "score": "0.6511832", "text": "func (*WatchConfigMapRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_config_map_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "3a92b507d31ad32772a34d43d72ed36f", "score": "0.6508039", "text": "func (*Settings_ConsulConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 11}\n}", "title": "" }, { "docid": "5c6952016842e66865ca375ca8fc85f1", "score": "0.6500386", "text": "func (*Settings_KnativeOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 9}\n}", "title": "" }, { "docid": "f6e073d64bad54c6b71f235b248ddf75", "score": "0.6443628", "text": "func (*DeleteConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "869754c7d346adb3b74b83777bade85e", "score": "0.6442486", "text": "func (*DeleteWaiterRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "4ee3249fbedd5d5cfc18fc2151d81ae1", "score": "0.64075315", "text": "func (*GlooOptions_InvalidConfigPolicy) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{2, 1}\n}", "title": "" }, { "docid": "7622d3a5f33ef2196471452740bcddc3", "score": "0.6404648", "text": "func (*OperationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "cb7161941fcc6af66c9c977e2a4d93ea", "score": "0.63957214", "text": "func (*WatchVariableRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "7bfda773999f743e90d596e8c393945d", "score": "0.6382692", "text": "func (*Settings_ObservabilityOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 15}\n}", "title": "" }, { "docid": "563e55fcf2c77f151cc834daeb0d01c4", "score": "0.6379223", "text": "func (*GetConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c44c19f08620122d89d6795fd294b500", "score": "0.63648707", "text": "func (*PatchFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{621}\n}", "title": "" }, { "docid": "46903278f55b853a138f6ee22259a8c6", "score": "0.63635826", "text": "func (*NotificationEndpointGrpcSettings) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{328}\n}", "title": "" }, { "docid": "21dfdc3bcb476402449d9be9f312b124", "score": "0.6361425", "text": "func (*UpdateDeploymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "64f252df51b6b5186b4954f78284da55", "score": "0.63424206", "text": "func (*Settings_KubernetesSecrets) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "e7c4a9bae29bf0cc86adc54dd0b19634", "score": "0.63377136", "text": "func (*DeprecationStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "78549d156bd5afbaa70b659063043430", "score": "0.6329813", "text": "func (*PatchRuleFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{622}\n}", "title": "" }, { "docid": "21002965a7423893207e9347be005fa6", "score": "0.63295674", "text": "func (*GetDeploymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1039adbd27379afacff40803f46e126d", "score": "0.63191575", "text": "func (*UpdateConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b2d9da7210a8e83625185a42f726e624", "score": "0.6303616", "text": "func (*PatchFirewallRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{631}\n}", "title": "" }, { "docid": "f84b013fe5ce116a6350842833e15a92", "score": "0.62710917", "text": "func (*Settings_DiscoveryOptions_FdsOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 10, 1}\n}", "title": "" }, { "docid": "f864856695cff8f0b40a34b090f3edbc", "score": "0.6270066", "text": "func (*SurfacerConf) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_surfacers_prometheus_proto_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "582a96825770e2a8fc918b0508478edf", "score": "0.6264359", "text": "func (*DNSConfig) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_third_party_k8s_io_cri_api_pkg_apis_runtime_v1alpha2_api_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b9adc7a6711574823bdf30419113a561", "score": "0.6262507", "text": "func (*UpdateNotificationConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_securitycenter_v1p1beta1_securitycenter_service_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "133d1fe68bf0015d7dfff55375551fff", "score": "0.6260195", "text": "func (*GraphqlOptions_SchemaChangeValidationOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{6, 0}\n}", "title": "" }, { "docid": "c65a13777daf14cf15550ebb2bb9b0d9", "score": "0.62436134", "text": "func (*CPlayer_PrivacySettingsChanged_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_player_steamclient_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "15a0a5fbff3c72898d092d8713ebf9eb", "score": "0.623883", "text": "func (*DeleteDeploymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "ae7c4b7e0aa4b8d02e7390e748038bda", "score": "0.62363225", "text": "func (*WatchConfigMapsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_config_map_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "a8fa861ed72c7391c7f88f0a15263840", "score": "0.62319946", "text": "func (*UpdateRuntimeConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_third_party_k8s_io_cri_api_pkg_apis_runtime_v1alpha2_api_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "e223b7b18c94d10ceb9c58e1e4efca1f", "score": "0.6223041", "text": "func (*GetNotificationConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_securitycenter_v1p1beta1_securitycenter_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "14707e605080b232df0967ea30956bae", "score": "0.6220903", "text": "func (*ConsoleOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "11d1ee3fed939448c68ba957fd0c4ac5", "score": "0.6218758", "text": "func (*SetLabelsGlobalForwardingRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{650}\n}", "title": "" }, { "docid": "2c9bb5e68ccdf4f089259e569de93f48", "score": "0.62161475", "text": "func (*ServiceMapConfig) Descriptor() ([]byte, []int) {\n\treturn file_api_admin_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "bd58c3c24cb77f4e2a910ad7f389caad", "score": "0.62155426", "text": "func (*CreateDeploymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "335e965c231991a63a78b946b7df6c74", "score": "0.6213", "text": "func (*DeploymentOperationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "395c8cebc83c8277b87623ac373fa8c1", "score": "0.62090456", "text": "func (*DeleteConfigMapRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_config_map_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "148ccf45ece16a43b2663279ce0da131", "score": "0.6208024", "text": "func (*Settings_VaultTlsConfig) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 5}\n}", "title": "" }, { "docid": "9a0b9cd56f2b820b059066b34fe5ae30", "score": "0.620619", "text": "func (*GradientControllerConfig) Descriptor() ([]byte, []int) {\n\treturn file_envoy_extensions_filters_http_adaptive_concurrency_v3_adaptive_concurrency_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c181d2870934f2bde2f49a5dba3411cb", "score": "0.620502", "text": "func (*VirtualServiceOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "58a9e970fe024baba485712c3128e4f9", "score": "0.62048185", "text": "func (*ControlPlane) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "19d05f7a516ea026390e9d9cee5e15b7", "score": "0.6202656", "text": "func (*SetConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_cri_resource_manager_config_api_v1_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "370ca15415a5914178b5b5f3243c96ed", "score": "0.6188674", "text": "func (*DefaultLabelPolicyUpdate) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{48}\n}", "title": "" }, { "docid": "17f2cb19120a550edeea7581c99e980d", "score": "0.6186295", "text": "func (*SecurityPoliciesWafConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{442}\n}", "title": "" }, { "docid": "d6e500d7317c8fe47a99ff4d470bbf04", "score": "0.6183136", "text": "func (*SetLabelsForwardingRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{639}\n}", "title": "" }, { "docid": "cd88c99635b5fdb1e8e7f33d197b9b79", "score": "0.6180287", "text": "func (*UpdateProjectSettingsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_settings_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "96c0ee4a76ba4f78f945ae1f1fa73ff2", "score": "0.61652005", "text": "func (*DeleteNotificationConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_securitycenter_v1p1beta1_securitycenter_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a60c7f5bd3c33e51da462d0d880dcbc1", "score": "0.61632377", "text": "func (*SecuritySettings) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "d9304ac7badca9c7b10743f568039ed6", "score": "0.6159795", "text": "func (*CreateConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d4f27907761c09da34750194f6ea3760", "score": "0.61532986", "text": "func (*RuntimeConfig) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_third_party_k8s_io_cri_api_pkg_apis_runtime_v1alpha2_api_proto_rawDescGZIP(), []int{99}\n}", "title": "" }, { "docid": "a8f3ada4c32e31522c8601b4546c1a7e", "score": "0.61511874", "text": "func (*LogConfigCloudAuditOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{269}\n}", "title": "" }, { "docid": "bfb528089dba5c7779b503e3fa6c0d04", "score": "0.6150973", "text": "func (*Resource) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "32061f02c37d1d2626b98fa8491c95ec", "score": "0.6150016", "text": "func (*Settings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "05bfbe8ee66806c5bee032d7c1af3c48", "score": "0.6143897", "text": "func (*Deployment) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "43a4927bb3bb46b9ed2e7b22cc87e88a", "score": "0.6140474", "text": "func (*KeyValue) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_third_party_k8s_io_cri_api_pkg_apis_runtime_v1alpha2_api_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "fcda13164eda161a2bb6c4a109cd54da", "score": "0.6140073", "text": "func (*UpdateVariableRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "413200b1c5245474d46d688c2c5998b0", "score": "0.61357737", "text": "func (*GrpcConfig) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_squzy_monitoring_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "29c30f9ee1313cd548df965194b39816", "score": "0.61331946", "text": "func (*Settings_DiscoveryOptions_UdsOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 10, 0}\n}", "title": "" }, { "docid": "faa08c37fa9184ba3af60a017dadbb2d", "score": "0.6130044", "text": "func (*GetProjectSettingsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_settings_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "69fff265af5705c24300416b854f74bd", "score": "0.6128411", "text": "func (*WatchConfigMapResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_config_map_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "b2369e30c9d792fa508b44b8b74f1129", "score": "0.6125815", "text": "func (*ConfigDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_sys_v1_sys_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "46d873d9140c4c2c84f90cd4b563be45", "score": "0.6123732", "text": "func (*SubClustersConfig) Descriptor() ([]byte, []int) {\n\treturn file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f5af9711d2d55438957e61f231e036fe", "score": "0.6121577", "text": "func (*FirewallPolicyRuleMatcherLayer4Config) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{117}\n}", "title": "" }, { "docid": "a6fab3476fa0001807776722a53158c8", "score": "0.61213243", "text": "func (*ModifyPushConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_pubsub_v1beta2_pubsub_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "01a20203303a03d957c9e7aa898bfcda", "score": "0.61205953", "text": "func (*DeleteVariableRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "97c54edaa1c6242282085fb18eb04458", "score": "0.61148643", "text": "func (*Builder) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_project_config_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a207b3321747e1614f3ac81b183d62f4", "score": "0.6112023", "text": "func (*PerInstanceConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{202}\n}", "title": "" }, { "docid": "405ef8f65e5d506c232f324a0a9174d6", "score": "0.6109583", "text": "func (*CreateWaiterRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_runtimeconfig_v1beta1_runtimeconfig_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "f6cb6a640b175e811a05f73e5332a475", "score": "0.6109506", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Schema{\n\t\t\tSchema: &desc.SchemaDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e5ff1888240af6fb0297a3422c2bca7a", "score": "0.6104899", "text": "func (*PlatformKeyExtractorConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_configuration_scheduler_scheduler_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a0c41963ed87512da06c87dce422b60c", "score": "0.6100546", "text": "func (*UpdateGlobalConfigReq) Descriptor() ([]byte, []int) {\n\treturn file_dns_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "be893f508b7bd4a8319e076d9984d383", "score": "0.6099042", "text": "func (*GraphqlOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "3c118344acbb4d70bbf1594aabbade0e", "score": "0.60967994", "text": "func (*SurfacerDef) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_surfacers_proto_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b7b15fad8328f0c3d85d39a4b33fa84c", "score": "0.6096605", "text": "func (*TerraformBlueprint) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "2da689686b39f59b4c2bac4928313a84", "score": "0.6095004", "text": "func (*ConfigDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_sys_proto_rawDescGZIP(), []int{81}\n}", "title": "" }, { "docid": "11623b2134e51ad81a9143096ce4c533", "score": "0.6086803", "text": "func (*Swarming) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_project_config_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "57e24ecbcf58cd1567c7815160be34ee", "score": "0.6085752", "text": "func (*ServiceSettings) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0db9c279b7c8c9175d9d35deedf8a475", "score": "0.60842294", "text": "func (*Settings_SecretOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "b742a6f4e63b9bc95b66bbeb0af1e41f", "score": "0.6083516", "text": "func (*Zone_DiscoverySpec_JsonOptions) Descriptor() ([]byte, []int) {\n\treturn file_cloud_dataplex_v1_data_proto_rawDescGZIP(), []int{2, 1, 1}\n}", "title": "" }, { "docid": "81c4991bd3f53ccbb45cbc9b4cc79571", "score": "0.60812384", "text": "func (*Cluster_RingHashLbConfig_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_xds_cds_proto_rawDescGZIP(), []int{0, 2, 0}\n}", "title": "" }, { "docid": "67cbf126e875961261eb510823bffb20", "score": "0.60767585", "text": "func (*ConfigNotification) Descriptor() ([]byte, []int) {\n\treturn file_config_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "0803aa764b79722b5c8aee03cc60dc3e", "score": "0.6075068", "text": "func (*ConfidentialInstanceConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{80}\n}", "title": "" }, { "docid": "43c544ccac6b0ef9b8bedc8437920a92", "score": "0.6074864", "text": "func (*MetricDescriptor_StorageConfig) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_metric_descriptor_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "cfe65670cf9e0d18b6d80153a2780603", "score": "0.60657823", "text": "func (*RateLimitConfigRef) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "486ffbdaecdf45685db3d172ef4af368", "score": "0.606565", "text": "func (*MockedApiConfig) Descriptor() ([]byte, []int) {\n\treturn file_wso2_discovery_api_mocked_api_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "85b51ffafd4eff4200ae1bfcc91ce1be", "score": "0.60639584", "text": "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_base_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "28c360b553f7d6cc1ff867e7a6930586", "score": "0.6058342", "text": "func (*Config) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_logdog_api_config_svcconfig_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2581c2a43d130eca3a83400205bb9488", "score": "0.6056944", "text": "func (*ProbeConf) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_probes_dns_proto_config_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2f781ee751ea11d75f91f74cd9b3cb45", "score": "0.60568696", "text": "func (*GrpcProtocolOptions) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "c33b8f959072e1354816cc8421015aff", "score": "0.60543954", "text": "func (*ConfigSpec) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "6c18d626b0a01387ef116ca4015bbc84", "score": "0.60531765", "text": "func (*UpdateFirewallRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{632}\n}", "title": "" }, { "docid": "ed82badb0b7661e27acfd1327567f893", "score": "0.60508496", "text": "func (*KeepaliveSettings) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_protocol_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "b8ddfdc11ee1fa9c7b6a7a22c79d8815", "score": "0.6050715", "text": "func (*WatchConfigMapsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha_config_map_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "13e9fd0650d30890dd9aa2f3787e62b8", "score": "0.6048907", "text": "func (*Revision) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "c3bcf1eaf5954f342fc739517ae28950", "score": "0.6046545", "text": "func (*AddRuleFirewallPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{610}\n}", "title": "" } ]
7a291aadb59cc98e57da88d2f8d58fcc
Loop is the loop for the audio instance.
[ { "docid": "b1eb4169772b6142a294bf1cd3dfb15c", "score": "0.73438334", "text": "func (instance *Instance) Loop() {\n\tfor {\n\t\tselect {\n\t\tcase <-instance.QuitChannel:\n\t\t\tinstance.log.Println(\"Quit\")\n\t\t\t// TODO: Cleanup.\n\t\t\treturn\n\t\tcase cmd := <-instance.CommandChannel:\n\t\t\tswitch c := cmd.(type) {\n\t\t\tcase CommandNewSound:\n\t\t\t\tif _, ok := instance.sounds[c.ID]; !ok {\n\t\t\t\t\tsnd := newSoundFromCommand(c)\n\t\t\t\t\tinstance.sounds[c.ID] = snd\n\t\t\t\t}\n\t\t\tcase CommandPlaySound:\n\t\t\t\tif snd, ok := instance.sounds[c.ID]; ok {\n\t\t\t\t\tsnd.playAsSound(c.Volume)\n\t\t\t\t} else {\n\t\t\t\t\tinstance.log.Errorf(\"[Audio] missing sound %d\", c.ID)\n\t\t\t\t}\n\t\t\tcase CommandStopSound:\n\t\t\tcase CommandPlayMusic:\n\t\t\t\tif snd, ok := instance.sounds[c.ID]; ok {\n\t\t\t\t\tsnd.playAsMusic(c.PlaybackID, c.Volume, 0)\n\t\t\t\t\tinstance.playingMusic[c.PlaybackID] = c.ID\n\t\t\t\t} else {\n\t\t\t\t\tinstance.log.Errorf(\"[Audio] missing sound %d\", c.ID)\n\t\t\t\t}\n\t\t\tcase CommandStopMusic:\n\t\t\t\tif sndId, ok := instance.playingMusic[c.PlaybackID]; ok {\n\t\t\t\t\tif snd, ok := instance.sounds[sndId]; ok {\n\t\t\t\t\t\tsnd.stopMusic(c.PlaybackID)\n\t\t\t\t\t\tdelete(instance.playingMusic, c.PlaybackID)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinstance.log.Errorf(\"[Audio] missing sound %d\", sndId)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tinstance.log.Errorf(\"[Audio] missing music playback %d\", c.PlaybackID)\n\t\t\t\t}\n\t\t\tcase CommandStopAllMusic:\n\t\t\t\tfor playbackID, sndId := range instance.playingMusic {\n\t\t\t\t\tif snd, ok := instance.sounds[sndId]; ok {\n\t\t\t\t\t\tsnd.stopMusic(playbackID)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinstance.playingMusic = make(map[uint32]uint32)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "eda30043ba337ac6adb24d2dd4e8ba70", "score": "0.6672821", "text": "func (l *Loop) Play(d AudioDevice) error {\n\tContext().LoopControl.Begin(l)\n\treturn nil\n}", "title": "" }, { "docid": "f4dc298d32b424a39b38da54346f592c", "score": "0.65188223", "text": "func (g *Gui) Loop() {\n\tqml.Run(g.loop)\n}", "title": "" }, { "docid": "b6b7dbda82c4d42c83f0678b1f12fabd", "score": "0.64666736", "text": "func NewLoop(d time.Duration, in Sound) *Loop {\n\treturn &Loop{newmono(in), newbufc(Dtof(d, in.SampleRate()), 0), false, false, 0, 0}\n}", "title": "" }, { "docid": "7daed3cf34ec71e8601ba4534ba1387b", "score": "0.6379543", "text": "func (self *Sample) Play(gain, pan, speed float32, loop PlayMode) (ok bool, id SampleId) {\n ok = cb2b(C.al_play_sample(self.handle, C.float(gain), C.float(pan), C.float(speed), loop.toC(), (&id).toC()))\n return ok, id\n}", "title": "" }, { "docid": "dafafc789d972121bece30a3bb883e88", "score": "0.63723063", "text": "func (c *Controller) Loop() error {\n\terr := c.init()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"initializing: %w\", err)\n\t}\n\tdefer c.close()\n\tuiEvents := c.CUILib.PollEvents()\n\tfor {\n\t\tselect {\n\t\tcase e := <-uiEvents:\n\t\t\tquit := c.handleEvent(e)\n\t\t\tif quit {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tdefault:\n\t\t\terr := c.Update()\n\t\t\tif err != nil {\n\t\t\t\tc.stateBar.Warn(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af7fad224121ccc57ad74d0e6d7e3097", "score": "0.6308446", "text": "func Loop(mx loop.Mux, queue int) loop.Looper {\n\tsub := Sub{mux: mx, queue: queue}\n\tsub.Connect()\n\treturn &sub\n}", "title": "" }, { "docid": "38ca350e317785a7bec7cd5e8adfa639", "score": "0.62925583", "text": "func (s *Song) SetLooping(loop bool) {\n if loop {\n C.vox_set_autostop(s.slot, C.int(0));\n } else {\n C.vox_set_autostop(s.slot, C.int(1));\n }\n}", "title": "" }, { "docid": "df307233e493568a40edf34290d81f49", "score": "0.626243", "text": "func Start(loop bool, names ...string) (*klg.Audio, error) {\n\tif len(names) == 0 {\n\t\treturn nil, errors.New(\"No names provided\")\n\t}\n\n\tvar music klg.Audio\n\tvar err error\n\tmusic, err = audio.Load(filepath.Join(\"assets\", \"audio\"), names[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmusic, err = music.Copy()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmusic = music.MustFilter(\n\t\tfilter.Volume(0.5 * settings.Active.MusicVolume * settings.Active.MasterVolume),\n\t)\n\tif loop && len(names) == 1 {\n\t\tmusic = music.MustFilter(\n\t\t\tfilter.LoopOn(),\n\t\t)\n\t}\n\n\tmusic.Play()\n\n\tif len(names) > 0 {\n\t\tgo func() {\n\t\t\tfor i := 1; i < len(names); i++ {\n\t\t\t\ttime.Sleep(music.PlayLength())\n\t\t\t\tmusic, err = audio.Load(filepath.Join(\"assets\", \"audio\"), names[i])\n\t\t\t\tdlog.ErrorCheck(err)\n\t\t\t\tmusic, err = music.Copy()\n\t\t\t\tdlog.ErrorCheck(err)\n\t\t\t\tmusic = music.MustFilter(\n\t\t\t\t\tfilter.Volume(0.5 * settings.Active.MusicVolume * settings.Active.MasterVolume),\n\t\t\t\t)\n\t\t\t\tif loop && i == len(names)-1 {\n\t\t\t\t\tmusic = music.MustFilter(\n\t\t\t\t\t\tfilter.LoopOn(),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tmusic.Play()\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn &music, nil\n}", "title": "" }, { "docid": "8b7a57a461c8f5dc81be880bc6564c56", "score": "0.62240905", "text": "func (prod *SimpleProducer) ControlLoop() {\n\tprod.setState(PluginStateActive)\n\tdefer prod.setState(PluginStateDead)\n\tdefer prod.Log.Debug.Print(\"Stopped\")\n\n\tfor {\n\t\tcommand := <-prod.control\n\t\tswitch command {\n\t\tdefault:\n\t\t\tprod.Log.Debug.Print(\"Received untracked command\")\n\t\t\t// Do nothing\n\n\t\tcase PluginControlStopProducer:\n\t\t\tprod.Log.Debug.Print(\"Preparing for stop\")\n\t\t\tprod.setState(PluginStatePrepareStop)\n\n\t\t\tif prod.onPrepareStop != nil {\n\t\t\t\tif !tgo.ReturnAfter(prod.shutdownTimeout*5, prod.onPrepareStop) {\n\t\t\t\t\tprod.Log.Error.Print(\"Timeout during onPrepareStop.\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprod.Log.Debug.Print(\"Executing stop command\")\n\t\t\tprod.setState(PluginStateStopping)\n\n\t\t\tif prod.onStop != nil {\n\t\t\t\tif !tgo.ReturnAfter(prod.shutdownTimeout*5, prod.onStop) {\n\t\t\t\t\tprod.Log.Error.Print(\"Timeout during onStop.\")\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn // ### return ###\n\n\t\tcase PluginControlRoll:\n\t\t\tprod.Log.Debug.Print(\"Received roll command\")\n\t\t\tif prod.onRoll != nil {\n\t\t\t\tprod.onRoll()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "685604947c23491ab1c3139ced451141", "score": "0.61668694", "text": "func (l *Loop) Handle(tim *Timeline, when time.Time) {\n\tl.mutex.RLock()\n\tif !l.isRunning {\n\t\tl.mutex.RUnlock()\n\t\treturn\n\t}\n\tl.mutex.RUnlock()\n\tl.reschedule(Context().AudioDevice, when)\n}", "title": "" }, { "docid": "70531eda0e982353839db0384f8be4e0", "score": "0.6161405", "text": "func (l *Loop) Name() string { return \"loop\" }", "title": "" }, { "docid": "b2d22836141b8b9974b1ae24d530ad43", "score": "0.6154523", "text": "func (bpc *BinlogPlayerController) Loop() {\n\tfor {\n\t\terr := bpc.Iteration()\n\t\tif err == nil {\n\t\t\t// this happens when we get interrupted\n\t\t\tbreak\n\t\t}\n\t\tlog.Warningf(\"%v: %v\", bpc, err)\n\n\t\t// clear the source, remember the error\n\t\tbpc.playerMutex.Lock()\n\t\tbpc.sourceTablet = nil\n\t\tbpc.lastError = err\n\t\tbpc.playerMutex.Unlock()\n\n\t\t// sleep for a bit before retrying to connect\n\t\ttime.Sleep(*retryDelay)\n\t}\n\n\tlog.Infof(\"%v: exited main binlog player loop\", bpc)\n\tclose(bpc.done)\n}", "title": "" }, { "docid": "06eb94c2370a1e3a7234c465d7f271e2", "score": "0.6131642", "text": "func (self *AudioStream) LoopSeconds(start, end float64) bool {\n return cb2b(C.al_set_audio_stream_loop_secs(self.handle, C.double(start), C.double(end)))\n}", "title": "" }, { "docid": "29bd08d4a1546a9509a3aa610efa43de", "score": "0.6071265", "text": "func (h *HelloScene) Loop() bool {\n\th.r.AddRotation(mgl64.RadToDeg(.00005), mgl64.Vec3{0, 1, 0})\n\treturn true\n}", "title": "" }, { "docid": "dc20c3f227bbd9a68140489b44b0fa73", "score": "0.6062177", "text": "func (t *Target) Loop(condition usm.Number, body usm.Block) {\n\tt.WriteByte(Loop)\n\tt.WriteValue(condition)\n\tt.WriteBlock(body)\n}", "title": "" }, { "docid": "17b229843e4ecd6b9b7e4a4ef7f743ad", "score": "0.60110664", "text": "func (ui *UI) Loop() {\n\tif err := ui.gui.MainLoop(); err != nil && err != gocui.ErrQuit {\n\t\tlog.Panicln(err)\n\t}\n}", "title": "" }, { "docid": "cf11720f390f0bbb6db06f843a8ad8f8", "score": "0.59676826", "text": "func (self *SampleInstance) Play() bool {\n return cb2b(C.al_play_sample_instance(self.handle))\n}", "title": "" }, { "docid": "08eaeaf5a3a72b7c39d1b81d91b56639", "score": "0.5959412", "text": "func (r *Robot) loop() {\n\tr.isRunning = true\n\tfor r.mode != Off || r.turnRobotOnFlag {\n\t\tr.updateMode()\n\t\tr.modeLogic()\n\t}\n\tr.isRunning = false\n}", "title": "" }, { "docid": "330ebb6b1376b0b3f340976dbcc1037a", "score": "0.588146", "text": "func (s *Service) Loop(f func()) {\n quit := false\n for !quit {\n select {\n case <-s.QuitChannel:\n quit = true\n default:\n f()\n }\n }\n}", "title": "" }, { "docid": "f50e7a6dd9cafae7142270eb89d3e733", "score": "0.58793986", "text": "func Loop() {\n\n}", "title": "" }, { "docid": "097babd7e4598244369558b01ff93809", "score": "0.58425796", "text": "func (g *Game) Loop(screen *ebiten.Image) error {\n\n\tg.Update(screen)\n\tif !ebiten.IsDrawingSkipped() {\n\t\tg.Draw(screen)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4f31a27aba6625e3eb14cdce35941764", "score": "0.58342004", "text": "func (sender *Sender) Loop(timeout time.Duration) {\n\tmessages := make(chan telebot.Message)\n\tsender.bot.Listen(messages, timeout)\n\n\tfor {\n\t\tmessage, ok := <-messages\n\t\tif !ok {\n\t\t\tsender.logger.Warn(\"Telegram messages channel was closed, stop listening and deregister\")\n\t\t\tsender.DataBase.DeregisterBot(messenger)\n\t\t\treturn\n\t\t}\n\t\tif err := sender.handleMessage(message); err != nil {\n\t\t\tsender.logger.ErrorF(\"Error sending message: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "25baaa2ff44cabb563816f4d154e1f83", "score": "0.5831018", "text": "func (s *Sound) Play(vc *discordgo.VoiceConnection) {\n\tvc.Speaking(true)\n\tdefer vc.Speaking(false)\n\n\t// t := time.NewTicker(time.Duration(1) * time.Second)\n\t// go s.control(t)\n\n\tfor _, buff := range s.buffer {\n\t\tvc.OpusSend <- buff\n\t\tif skips[vc.GuildID] == true {\n\t\t\t//skips[vc.GuildID] = false\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cbab78f404cfd5ead1e1630e72bcd97c", "score": "0.5824877", "text": "func (e *Engine) RadioSendNetworkLoop() {\n\tsegment := make([]byte, N)\n\tfor {\n\t\tn, err := e.Audio.Read(segment)\n\t\tCheck(err)\n\t\tif n != N {\n\t\t\tlog.Panicf(\"e.Audio.Read got %d bytes, wanted %d\", n, N)\n\t\t\tos.Exit(13)\n\t\t}\n\t\tif e.HumansAreAlive() {\n\t\t\tx := SayPower(segment)\n\t\t\tif x > float64(*SQUELCH) {\n\t\t\t\te.SendToHub(segment, RadioFlag)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d96f3e819c3eb8eac5951385bb7915ad", "score": "0.5818974", "text": "func (prod *SimpleProducer) TickerControlLoop(interval time.Duration, onTimeOut func()) {\n\tprod.setState(PluginStateActive)\n\tgo prod.ControlLoop()\n\tprod.tickerLoop(interval, onTimeOut)\n}", "title": "" }, { "docid": "e1b604aa0837372f485b353f67e52873", "score": "0.5786371", "text": "func (s *Service) StartLoop(f func()) {\n s.Start(func() {\n s.Loop(f)\n })\n}", "title": "" }, { "docid": "efb880b358152d39ba76add4c4caf1b1", "score": "0.5761593", "text": "func (recv *PixbufSimpleAnim) SetLoop(loop bool) {\n\tc_loop :=\n\t\tboolToGboolean(loop)\n\n\tC.gdk_pixbuf_simple_anim_set_loop((*C.GdkPixbufSimpleAnim)(recv.native), c_loop)\n\n\treturn\n}", "title": "" }, { "docid": "0f187400dec151a51ab592d02585906f", "score": "0.57538474", "text": "func (spi *SPI) Loop() bool {\n\treturn spi.mode&SPI_3WIRE != 0\n}", "title": "" }, { "docid": "1d41f2df61829edc64456ab77c6ac33d", "score": "0.57508343", "text": "func (cm *ConnManager) Loop(parent goprocess.Process) {\n\tcm.mutex.Lock()\n\tcm.loop(parent)\n\tcm.mutex.Unlock()\n}", "title": "" }, { "docid": "7440a6299dddea7fe897409621140223", "score": "0.5712247", "text": "func (r *Runtime) Loop() {\n\n\tlog.V(logLevel).Infof(\"%s:> runtime loop\", logPrefix)\n\n\tvar (\n\t\tlead = make(chan bool)\n\t)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-r.ctx.Done():\n\t\t\t\treturn\n\t\t\tcase l := <-lead:\n\t\t\t\t{\n\n\t\t\t\t\tif l {\n\n\t\t\t\t\t\tif r.active {\n\t\t\t\t\t\t\tlog.V(logLevel).Debugf(\"%s:loop:> is already marked as master -> skip\", logPrefix)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlog.V(logLevel).Debugf(\"%s:loop:> mark as master\", logPrefix)\n\n\t\t\t\t\t\tr.active = true\n\n\t\t\t\t\t\tgo r.builderCtrl.Start(r.ctx)\n\t\t\t\t\t\tgo r.buildCtrl.Start(r.ctx)\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif !r.active {\n\t\t\t\t\t\tlog.V(logLevel).Debugf(\"%s:loop:> is already marked as slave -> skip\", logPrefix)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tlog.V(logLevel).Debugf(\"%s:loop:> mark as slave\", logPrefix)\n\t\t\t\t\tr.active = false\n\n\t\t\t\t\tr.builderCtrl.Stop()\n\t\t\t\t\tr.buildCtrl.Stop()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo r.process.HeartBeat(r.ctx, lead)\n}", "title": "" }, { "docid": "5d9af7e0f37ff47da2afa572ced9a4e3", "score": "0.5695795", "text": "func (c *Controller) Loop() error {\n\tserial.Print(\"Connecting to [\")\n\tserial.Print(host)\n\tserial.Print(\":\")\n\tserial.Print(port)\n\tserial.Print(\")] ...\")\n\tif client.Connect(host, port) {\n\t\tserial.Println(\" Connected!\")\n\t\tclient.Println(request)\n\t} else {\n\t\tserial.Println(\" Failed!\")\n\t}\n\ttimer.Delay(5000)\n\treturn nil\n}", "title": "" }, { "docid": "369fe65bc3a2340b6fc6c7fd851125c4", "score": "0.56819844", "text": "func (simulation *Simulation) loop() {\n\tfor {\n\t\tif !simulation.running {\n\t\t\tsimulation.ticker.Stop()\n\t\t\tsimulation.Shutdown()\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05ebae279a1563817a44bef1417951f3", "score": "0.56723386", "text": "func (spi *SPI) SetLoop(loop bool) error {\n\treturn spi.setModeFlag(loop, SPI_LOOP)\n}", "title": "" }, { "docid": "dcec32f2d584dd54ce1bbf5b098818e8", "score": "0.5671137", "text": "func (p *Provider) MainLoop() {\n\tfor {\n\t\tevent := p.internalChan.ReadEvent()\n\t\tp.SendEvent(event)\n\t}\n}", "title": "" }, { "docid": "837a486f901858b771ecc96a96e1071b", "score": "0.56444705", "text": "func (s *Sensors) SetLoopFrequency(freq time.Duration) *Sensors {\n\ts.loopFreq = freq\n\treturn s\n}", "title": "" }, { "docid": "3d15940f6d63066cb25c7ad85ea3592e", "score": "0.562951", "text": "func (m *Module) runLoop(realSink bar.Sink) {\n\tstarted := false\n\tfinished := false\n\tvar refreshFn func()\n\tif r, ok := m.original.(bar.RefresherModule); ok {\n\t\trefreshFn = r.Refresh\n\t}\n\ttimedSink := newTimedSink(realSink, refreshFn)\n\tl.Attach(m.original, timedSink, \"~internal-sink\")\n\toutputCh := make(chan bar.Output)\n\tinnerSink := func(o bar.Output) { outputCh <- o }\n\tdoneCh := make(chan struct{})\n\n\tgo func(m bar.Module, innerSink bar.Sink, doneCh chan<- struct{}) {\n\t\tl.Fine(\"%s started\", l.ID(m))\n\t\tm.Stream(innerSink)\n\t\tl.Fine(\"%s finished\", l.ID(m))\n\t\tdoneCh <- struct{}{}\n\t}(m.original, innerSink, doneCh)\n\n\tvar out bar.Output\n\tfor {\n\t\tselect {\n\t\tcase out = <-outputCh:\n\t\t\tstarted = true\n\t\t\ttimedSink.Output(out, true)\n\t\tcase <-doneCh:\n\t\t\tfinished = true\n\t\t\ttimedSink.Stop()\n\t\t\tout = toSegments(out)\n\t\t\tl.Fine(\"%s: set restart handlers\", l.ID(m))\n\t\t\ttimedSink.Output(addRestartHandlers(out, m.restartFn), false)\n\t\tcase <-m.replayCh:\n\t\t\tif started {\n\t\t\t\tl.Fine(\"%s: replay last output\", l.ID(m))\n\t\t\t\ttimedSink.Output(out, true)\n\t\t\t}\n\t\tcase <-m.restartCh:\n\t\t\tif finished {\n\t\t\t\tl.Fine(\"%s restarted\", l.ID(m.original))\n\t\t\t\ttimedSink.Output(stripErrors(out, l.ID(m)), false)\n\t\t\t\treturn // Stream will restart the run loop.\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0b6a43d3c8ef579afb462e96ad45036", "score": "0.5614474", "text": "func (game *Game) mainLoop() {\n\tticker := time.NewTicker(NanosecondsInSecond / TicksPerSecond)\n\n\tfor {\n\t\tselect {\n\t\tcase f := <-game.workQueue:\n\t\t\tf(game)\n\t\tcase <-ticker.C:\n\t\t\tgame.onTick()\n\t\tcase player := <-game.playerConnect:\n\t\t\tgame.onPlayerConnect(player)\n\t\tcase entityId := <-game.playerDisconnect:\n\t\t\tgame.onPlayerDisconnect(entityId)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b77813229a42613d5f32c28db3d21c5", "score": "0.5612127", "text": "func (h *hub) loop(ctx context.Context, dial DialFunc, prefix string) {\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t\tconn, err := dial()\n\t\tif err != nil {\n\t\t\th.log.Print(\"redis dial:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif err := h.ingestPubSub(ctx, conn, prefix); err != nil {\n\t\t\th.log.Print(\"pubsub ingest:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5e5735282fdee596cd1a4281c52d0f29", "score": "0.557031", "text": "func (ta *TimedActionsPlayer) playbackLoop(out chan<- Action, ctrl <-chan control) {\n\tdefer func() {\n\t\tta.wg.Done()\n\t\tclose(out)\n\t}()\n\n\tvar (\n\t\tcursor int // event position in script\n\t\tstartTime = time.Now() // time playback started/resumed\n\t\tstartPosition time.Duration // timecode where playback started\n\t\tpaused bool\n\t)\n\n\tfor cursor < len(ta.Script) {\n\t\ta := ta.Script[cursor]\n\t\tif a.Time < startPosition {\n\t\t\tcursor++\n\t\t\tcontinue\n\t\t}\n\n\t\tvar nextEventTime <-chan time.Time\n\t\tif !paused {\n\t\t\tnextEventTime = time.After(\n\t\t\t\ta.Time - calcPosition(startTime, startPosition) + ta.latency)\n\t\t}\n\n\t\tselect {\n\t\tcase cmd := <-ctrl:\n\t\t\tswitch cmd.Command {\n\t\t\tcase cmdStop:\n\t\t\t\treturn\n\t\t\tcase cmdPause:\n\t\t\t\tif !paused {\n\t\t\t\t\tpaused = true\n\t\t\t\t\tstartPosition = calcPosition(\n\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\tstartPosition,\n\t\t\t\t\t) + ta.latency\n\t\t\t\t}\n\t\t\tcase cmdResume:\n\t\t\t\tif paused {\n\t\t\t\t\tpaused = false\n\t\t\t\t\tstartTime = time.Now()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase cmdSkip:\n\t\t\t\tstartTime = time.Now()\n\t\t\t\tstartPosition = cmd.Position\n\t\t\t\tcursor = 0\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase <-nextEventTime:\n\t\t\tif !paused {\n\t\t\t\tout <- Action{\n\t\t\t\t\tPosition: ta.posLimitFunc(a.Position),\n\t\t\t\t\tSpeed: ta.speedLimitFunc(a.Speed),\n\t\t\t\t}\n\t\t\t\tcursor++\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "f63a23217c4c4ecb2e5f9b8d7a9934e2", "score": "0.5539108", "text": "func (d *Device) sendLoop() {\n\tfor {\n\t\td.inflightMessages.Lock()\n\t\td.publishMessage(<-d.inflightMessages.queue)\n\t\td.inflightMessages.Unlock()\n\t}\n}", "title": "" }, { "docid": "eb54ad48ebd1049e1a960025b79bba32", "score": "0.55351394", "text": "func (p *PageBlockVideo) SetLoop(value bool) {\n\tif value {\n\t\tp.Flags.Set(1)\n\t\tp.Loop = true\n\t} else {\n\t\tp.Flags.Unset(1)\n\t\tp.Loop = false\n\t}\n}", "title": "" }, { "docid": "58479018bda0826474ea172e284b67e2", "score": "0.5508328", "text": "func (s *Sound) Play(vc *discordgo.VoiceConnection, skip chan bool) {\n\tvc.Speaking(true)\n\tdefer vc.Speaking(false)\n\n\tfor _, buff := range s.buffer {\n\t\tvc.OpusSend <- buff\n\t\tdoSkip := false\n\t\tselect {\n\t\tcase <-skip:\n\t\t\tdoSkip = true\n\t\tdefault:\n\t\t}\n\t\tif doSkip {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c1eb07a3eaaa34b50c0aadacc051df1", "score": "0.55081826", "text": "func (s *Si4713Driver) Loop() error {\n\tif !s.DebugMode {\n\t\treturn nil\n\t}\n\n\tstatus, currASQ, currInLevel, err := s.readASQ()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.DebugLog(\"Curr Status: 0x%x ASQ: 0x%x InLevel: %d dBfs\\n\", status, currASQ, int8(currInLevel))\n\n\t// toggle GPO1 and GPO2\n\tif err = s.SetGPIO(1 << 1); err != nil {\n\t\treturn err\n\t}\n\ttime.Sleep(500 * time.Millisecond)\n\n\tif err = s.SetGPIO(1 << 2); err != nil {\n\t\treturn err\n\t}\n\ttime.Sleep(500 * time.Millisecond)\n\n\treturn s.deviceStatus()\n}", "title": "" }, { "docid": "cec0898f6d4c60ee74e54fd7c3bce69e", "score": "0.54988456", "text": "func (s *State) StartLoop() error {\n\tfor {\n\t\tswitch ev := termbox.PollEvent(); ev.Type {\n\t\tcase termbox.EventKey:\n\t\t\tif ev.Ch == 'q' {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\tcase termbox.EventError:\n\t\t\treturn ev.Err\n\t\t}\n\n\t\ts.redraw()\n\t}\n}", "title": "" }, { "docid": "370fef3ade3e9f719f08e4e20b071941", "score": "0.5491142", "text": "func (l *Loop) Start() {\n\t// Allocate channels\n\tfor i := range l.channel {\n\t\tl.channel[i] = make(chan int, 1)\n\t}\n\n\tgo l.run()\n}", "title": "" }, { "docid": "84b4f701baf25834936f996efcbc319b", "score": "0.5485073", "text": "func (r *Referee) Loop() os.Error {\n\tvar simultaneous bool\n\tsimultaneous = r.game.IsSimultaneous()\n\n\tsimul_chan := make(chan int)\n\n\tfor {\n\t\t\n\t\tfor id, player := range r.players {\n\n\t\t\t///////\n\t\t\t// check to see if the game is finished\n\t\t\tif r.checkFinished() {\n\t\t\t\tdefer r.Loop()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t///////\n\t\t\t// get and set the player's move\n\t\t\tgo r.getAndSetMove(id, player, simul_chan)\n\n\t\t\tif !simultaneous {\n\t\t\t\t<- simul_chan\n\t\t\t\tr.show(id)\n\t\t\t}\n\n\t\t}\n\n\t\tif simultaneous { \n\t\t\ttotal := 0\n\t\t\t// wait until all payers have moved\n\t\t\tfor total < len(r.players) {\n\t\t\t\ttotal += <- simul_chan\n\t\t\t}\n\t\t\tr.show()\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fef7decfbb7a782d2b484050c00a4b3c", "score": "0.5425567", "text": "func (w *Watcher) watchLoop() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\t// Close event.\n\t\t\tcase <-w.closeChan:\n\t\t\t\treturn\n\n\t\t\t// Event listening.\n\t\t\tcase ev := <-w.watcher.Events:\n\t\t\t\t// Filter the repeated event in custom duration.\n\t\t\t\t_, err := w.cache.SetIfNotExist(\n\t\t\t\t\tcontext.Background(),\n\t\t\t\t\tev.String(),\n\t\t\t\t\tfunc(ctx context.Context) (value interface{}, err error) {\n\t\t\t\t\t\tw.events.Push(&Event{\n\t\t\t\t\t\t\tevent: ev,\n\t\t\t\t\t\t\tPath: ev.Name,\n\t\t\t\t\t\t\tOp: Op(ev.Op),\n\t\t\t\t\t\t\tWatcher: w,\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn struct{}{}, nil\n\t\t\t\t\t}, repeatEventFilterDuration,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tintlog.Errorf(context.TODO(), `%+v`, err)\n\t\t\t\t}\n\n\t\t\tcase err := <-w.watcher.Errors:\n\t\t\t\tintlog.Errorf(context.TODO(), `%+v`, err)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "522404e43ce518935cf1ff3645c626b2", "score": "0.53702813", "text": "func (bp *BaseProducer) loopBroadcast() {\n\tfor msg := range bp.ch {\n\t\tbp.mu.RLock()\n\t\tbp.logger.Debug().Str(\"message\", msg.String()).Str(\"action\", \"received message from producer\").Msg(\"\")\n\n\t\tfor _, s := range bp.subscriptions {\n\t\t\tgo func(s chan Message, msg Message) {\n\t\t\t\ts <- msg\n\t\t\t\tbp.logger.Debug().Str(\"message\", msg.String()).Str(\"action\", \"sent message to subscription\").Msg(\"\")\n\t\t\t}(s.ch, msg)\n\t\t}\n\n\t\tbp.mu.RUnlock()\n\t}\n}", "title": "" }, { "docid": "df87bd70cf8d0da336957d9f86cd06d1", "score": "0.5340886", "text": "func (raft *Raft) loop() {\n\n\terr := raft.serv.startListening()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\traft.currentState.Set(follower)\n\tfor {\n\t\tswitch raft.currentState.Get() {\n\t\tcase follower:\n\t\t\traft.followerSelect()\n\t\tcase candidate:\n\t\t\traft.candidateSelect()\n\t\tcase leader:\n\t\t\traft.leaderSelect()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f2be5dca97b295c6eef5f467377cc1c9", "score": "0.5338691", "text": "func StartControlLoop(\n\tctx context.Context,\n\tiface Interactor,\n\tsecretsNamespacer v1.SecretsGetter,\n\tlookup k8s.ServiceCatalogLookup,\n\tlifecycler *mode.Lifecycler,\n) error {\n\n\t// start up the watcher so that events build up on the channel while we're listing events (which happens below)\n\tcancelCtx, cancelFn := context.WithCancel(ctx)\n\twatcher := iface.Watch(cancelCtx, api.ListOptions{LabelSelector: claimLabelSelector})\n\tch := watcher.ResultChan()\n\tdefer cancelFn()\n\n\t// iterate through all existing claims before streaming them\n\tclaimList, err := iface.List(api.ListOptions{LabelSelector: claimLabelSelector})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, wrapper := range claimList.Claims {\n\t\tevt := &Event{claim: wrapper, operation: watch.Added}\n\t\treceiveEvent(ctx, evt, iface, secretsNamespacer, lookup, lifecycler)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase evt, open := <-ch:\n\t\t\t// if the watch channel was closed, fail. this if statement is this is semantically equivalent to if evt == nil {...}\n\t\t\tif !open {\n\t\t\t\treturn errWatchClosed\n\t\t\t}\n\t\t\tlogger.Debugf(\"received event %s\", *evt.claim.Claim)\n\t\t\treceiveEvent(ctx, evt, iface, secretsNamespacer, lookup, lifecycler)\n\t\tcase <-ctx.Done():\n\t\t\tlogger.Debugf(\"loop has been stopped\")\n\t\t\treturn errLoopStopped\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f867980be88e1bb81600e49fba60eaa", "score": "0.5329545", "text": "func Initialize(instance *handler.AudioCodecSink) {\n\tportaudio.Initialize()\n\tstream, err := portaudio.OpenDefaultStream(0, 1, 8000, 800, func(out []float32) {\n\t\t//log.Printf(\"Requested to fill %d * float32 buffer, I have %d samples in buffer \\n\", len(out), instance.Buffer.Size())\n\t\tsamples := instance.GetSamples(len(out))\n\t\tfor i := range out {\n\t\t\tif i < len(samples) {\n\t\t\t\tout[i] = instance.Volume * samples[i]\n\t\t\t} else {\n\t\t\t\t// TODO: returning noise for easy debug\n\t\t\t\t//out[i] = instance.Volume * float32(rand.Float32())\n\t\t\t\tout[i] = 0\n\t\t\t}\n\t\t}\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)\n\tgo func() {\n\t\tfor sig := range ch {\n\t\t\t// sig is a ^C, handle it\n\t\t\tlog.Printf(\"Exiting with signal %v ...\", sig)\n\t\t\tportaudio.Terminate()\n\t\t}\n\t}()\n\n\tstream.Start()\n\n\tinstance.Stream = stream\n}", "title": "" }, { "docid": "3d510fe9bec51489e62b074e2903f390", "score": "0.5327041", "text": "func MainLoop(gs *State, r io.Reader) {\n\tfor gs.Active {\n\t\tplayerLoop(gs, r)\n\t\tif !gs.Active {\n\t\t\tbreak\n\t\t}\n\t\thouseLoop(gs)\n\t\tgs.printState(gs.PlayerActive)\n\t}\n\tgs.finalCheck()\n\n}", "title": "" }, { "docid": "83e55637702278a1121b0873327099f0", "score": "0.5308507", "text": "func (d *discovery) Loop() {\n\tgo func() {\n\t\td.getRevisions()\n\t\t// Instant fist \"tick\"\n\t\td.discoverAPIs()\n\t\tlogrus.Info(\"Starting poller for Mulesoft APIs\")\n\t\tticker := time.NewTicker(d.pollInterval)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\td.discoverAPIs()\n\t\t\t\tbreak\n\t\t\tcase <-d.stopDiscovery:\n\t\t\t\tlog.Debug(\"stopping discovery loop\")\n\t\t\t\tticker.Stop()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "7a3c341cbe5f0c202b9bd38fb27e5126", "score": "0.5291651", "text": "func (t *Term) Loop() {\n\ttermui.Loop()\n}", "title": "" }, { "docid": "272efe793fc83b3b1cd3ea0e3de48ced", "score": "0.5287959", "text": "func (p *Giraffe) Sound() {\n\tfmt.Println(\"Giraffe says hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii!\")\n}", "title": "" }, { "docid": "deaeefc6562c1e6e577ad4681e4a095f", "score": "0.5285312", "text": "func (b *Bot) ReadLoop() {\n\tfor {\n\t\tb.conn.SetDeadline(time.Now().Add(300 * time.Second))\n\t\tmsg, err := b.reader.Decode()\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error:\", err)\n\t\t\tb.Reconnect()\n\t\t\treturn\n\t\t}\n\t\tb.Data <- msg\n\t}\n}", "title": "" }, { "docid": "2b1546bc4c81c8f0d57f954ab0410137", "score": "0.5275308", "text": "func (c *cache) backendLoop(l loop.Loop) error {\n\t// Prepare ticker for lifetime check.\n\tchecker := time.NewTicker(c.interval)\n\tdefer checker.Stop()\n\t// Run loop.\n\tfor {\n\t\tselect {\n\t\tcase <-l.ShallStop():\n\t\t\treturn nil\n\t\tcase do := <-c.taskc:\n\t\t\tif err := do(c); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase lenc := <-c.lenc:\n\t\t\tlenc <- len(c.buckets)\n\t\tcase <-checker.C:\n\t\t\tif err := c.cleanup(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8eef9bff4eb5660a83c2dddf52ddf90d", "score": "0.52694255", "text": "func (sa *SA) Run() {\n\tvar event inputEvent\n\n\tfor {\n\t\tbinary.Read(sa.r, binary.LittleEndian, &event)\n\t\tsa.Update(&event)\n\t}\n}", "title": "" }, { "docid": "491b1885d8ca3b5a192c412f81d55821", "score": "0.52620965", "text": "func (t *Tuner) Run(i0 InInterface, sf tuning.Melody, callback DataSheetCallback) {\n\tid := t.music.AddMainMelody(&sf, t.bufLen)\n\ttrack, _ := t.music.Build(id)\n\ttuning.RunTrack(track).Super().Immediately()\n\n\tcmdInPipe, _ := i0.cmd.StdinPipe()\n\n\tmainTrack, _ := t.music.Build(i0.mainID)\n\ttuning.RunTrack(mainTrack).Super().Immediately()\n\n\tds := DataSheet{\n\t\tOutputer: &cmdInPipe,\n\t}\n\tcallback(&ds)\n\n\ttrack.Inputer(ds)\n\n\tmainTrack.Inputer(SwapData{\n\t\tSign: CmRun,\n\t})\n}", "title": "" }, { "docid": "e98eb1fde429680e392d717cffc04649", "score": "0.5261404", "text": "func (s *Simulation) loop() {\n defer s.ticker.Stop()\n simulationStart := time.Now().UnixNano()\n s.lastSync = simulationStart\n s.seq = 0\n shouldSync := false\n timestepNano := helpers.GetConfiguredTimestepNanos()\n var frameStartTime time.Time\n var frameStart int64\n var framesToProcess int64\n\n for {\n frameStartTime = <- s.ticker.C\n frameStart = frameStartTime.UnixNano()\n framesToProcess = ((frameStart - s.lastSync) / timestepNano) - int64(s.seq)\n if framesToProcess > 0 {\n for i := int64(0); i < framesToProcess; i++ {\n s.seq++\n s.lastFrame = s.lastSync + (int64(s.seq) * timestepNano)\n s.processFrame(s.lastFrame, int(s.seq))\n\n if s.seq == 0 {\n shouldSync = true\n s.seq = 1\n }\n }\n } else if shouldSync {\n shouldSync = false\n }\n\n framesToProcess = 0\n }\n}", "title": "" }, { "docid": "ee06d65564dae9251144200e49ad913c", "score": "0.52609277", "text": "func Run() {\n\tfor {\n\t\terr := engine.Subscribe(broadcast)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\ttime.Sleep(2 * time.Second)\n\t}\n}", "title": "" }, { "docid": "40dd3331891e73d1c01356aa5981f2b8", "score": "0.524168", "text": "func (g *Game) LoadAudio(gFunction GameLoadAudioFunction) {\n\tgo func() {\n\t\t/*var audioPlayer *AudioPlayer\n\t\tif audioPlayer = gFunction(); audioPlayer != nil {\n\t\t\tg.audioLoadedCh <- audioPlayer\n\t\t\t//close(g.audioLoadedCh)\n\t\t}*/\n\t\taudioPlayer := gFunction()\n\t\tg.audioLoadedCh <- audioPlayer\n\t}()\n}", "title": "" }, { "docid": "4ac39892c8b9fdf58d17b223acf566f3", "score": "0.5230614", "text": "func (p *MusicPlugin) start(vc *voiceConnection, close <-chan struct{}, control <-chan controlMessage, service rikka.Service) {\n\n\tif close == nil || control == nil || vc == nil {\n\t\tlog.Println(\"musicplugin: start() exited due to nil channels\")\n\t\treturn\n\t}\n\n\tvar i int\n\tvar s song\n\n\t// main loop keeps this going until close\n\tfor {\n\n\t\t// exit if close channel is closed\n\t\tselect {\n\t\tcase <-close:\n\t\t\tlog.Println(\"musicplugin: start() exited due to close channel.\")\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\t// loop until voice connection is ready and songs are in the queue.\n\t\tif vc.conn == nil || vc.conn.Ready == false || len(vc.Queue) < 1 {\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get song to play and store it in local Song var\n\t\tvc.Lock()\n\t\tif vc.Loop && vc.Repeat {\n\t\t\tservice.SendMessage(vc.playing.TextChannelID, \"There was an error. Resetting loop and repeat\")\n\t\t\tvc.Loop = false\n\t\t\tvc.Repeat = false\n\t\t}\n\n\t\tvcLen := len(vc.Queue)\n\t\tif vcLen-1 >= i {\n\t\t\ts = vc.Queue[i]\n\t\t} else {\n\t\t\ti = 0\n\t\t\tvc.Unlock()\n\t\t\tcontinue\n\t\t}\n\t\tvc.Unlock()\n\n\t\tvc.playing = &s\n\t\ttimeLeft := time.Duration(0)\n\t\tfor _, v := range vc.Queue {\n\t\t\ttimeLeft += time.Duration(v.Duration)\n\t\t}\n\t\ttimeLeft *= time.Second\n\t\tif vc.Announce {\n\t\t\ts.announceSongPlaying(service, vc.playing.TextChannelID, vcLen, timeLeft.String())\n\t\t}\n\t\tp.play(vc, close, control, s)\n\t\tvc.playing = nil\n\n\t\tvc.Lock()\n\t\tif len(vc.Queue) > 0 {\n\t\t\tif !vc.Repeat && !vc.Loop {\n\t\t\t\tvc.Queue = append(vc.Queue[:i], vc.Queue[i+1:]...)\n\t\t\t}\n\t\t\tif vc.Repeat {\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\tif vc.Loop {\n\t\t\t\tvar pop song\n\t\t\t\tpop, vc.Queue = vc.Queue[0], vc.Queue[1:]\n\t\t\t\tvc.Queue = append(vc.Queue, pop)\n\t\t\t}\n\t\t}\n\t\tvc.Unlock()\n\t}\n}", "title": "" }, { "docid": "921b7c237ed4648948e3bbc1f881e528", "score": "0.52099174", "text": "func flacplay(outputter *goflacook.Outputter, filename string) {\n\t// Let the peanut gallery know what's up.\n\tfmt.Printf(\"Playing %s...\\n\", filename)\n\n\t// Open the stream.\n\tchk(\"while opening infile\", outputter.Init(filename))\n\tchannels := outputter.Stream.Info.NChannels\n\tbps := outputter.Stream.Info.BitsPerSample\n\trate := outputter.Stream.Info.SampleRate\n\tfmt.Printf(\"%d channels, %d bits/sample, %d sample rate\\n\", channels,\n\t\tbps, rate)\n\n\tportaudio.Initialize()\n\tdefer portaudio.Terminate()\n\n\tstream, err := portaudio.OpenDefaultStream(0, int(channels), float64(rate), len(output), &output)\n\tchk(\"opening portaudio\", err)\n\tchk(\"starting stream\", stream.Start())\n\toutstream = stream\n\n\tchk(\"playing sample\", outputter.MainLoop())\n}", "title": "" }, { "docid": "a0b55bd9a97e40e6489907e90d935a20", "score": "0.52060056", "text": "func (self *Mixer) Playing() bool {\n return cb2b(C.al_get_mixer_playing(self.handle))\n}", "title": "" }, { "docid": "9da3f0413eb7074b10ec0bae41a43426", "score": "0.5199242", "text": "func Run(onReady func()) {\n\tgo func() {\n\t\t<-readyCh\n\t\tonReady()\n\t}()\n\n\tnativeLoop()\n}", "title": "" }, { "docid": "606962aa36b3347a56e3fb38fd30b6be", "score": "0.51919335", "text": "func (d *PeerLeecher) loop() {\n\t// Iterate the event fetching until a quit is requested\n\tsyncTicker := time.NewTicker(d.cfg.RecheckInterval)\n\tdefer syncTicker.Stop()\n\n\tfor {\n\t\t// Wait for an outside event to occur\n\t\tselect {\n\t\tcase <-d.quit:\n\t\t\t// terminating, abort all operations\n\t\t\treturn\n\n\t\tcase op := <-d.notifyReceivedChunk:\n\n\t\t\tif d.done {\n\t\t\t\td.Terminate()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(d.processingChunks) < d.cfg.ParallelChunksDownload*2 {\n\t\t\t\td.processingChunks = append(d.processingChunks, *op)\n\t\t\t\td.routine()\n\t\t\t}\n\n\t\tcase <-syncTicker.C:\n\t\t\td.routine()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "71d293bc8ab8a4a8a69977f0558de76e", "score": "0.5186206", "text": "func (w *WebSocket) readLoop() {\n\tdefer func() {\n\t\t// Close the socket and the session\n\t\tw.Close()\n\t}()\n\n\t// Set the limits\n\tw.ws.SetReadLimit(maxMessageSize)\n\n\t// Set the pong handler\n\tw.ws.SetPongHandler(func(string) error {\n\t\t// Reset the read deadline\n\t\tw.ws.SetReadDeadline(time.Now().Add(readWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\t// Reset the read deadline\n\t\tw.ws.SetReadDeadline(time.Now().Add(readWait))\n\n\t\t// Read from the websocket\n\t\t_, data, err := w.ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.L.Warning(\"failed to read data from websocket with remote address %s: %s\", w.RemoteAddr(), err.Error())\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Trigger the onRead function if defined\n\t\tif w.onRead != nil {\n\t\t\tw.onRead(string(data))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "66c89f3b1637423eb84aad33abe87c88", "score": "0.5184957", "text": "func (loop *EventLoop) Start() {\n\tloop.setRunning()\n\tgo loop.run(true)\n}", "title": "" }, { "docid": "97d0c64bf4604194bde575ca62106a4a", "score": "0.5183848", "text": "func (b *Builder) Audio(\n\tctx context.Context,\n\tfile tg.InputFileClass, caption ...StyledTextOption,\n) (tg.UpdatesClass, error) {\n\treturn b.Media(ctx, Audio(file, caption...))\n}", "title": "" }, { "docid": "02b6894a9fa5b3d329f99588cc860332", "score": "0.5180945", "text": "func (rf *Raft) mainLoop() {\n\n\tfor !rf.killed() {\n\t\t/*+++++++++++++++++++++++++++++++++++++++++*/\n\t\trf.mu.Lock()\n\t\tr := rf.role\n\t\trf.mu.Unlock()\n\t\t/*-----------------------------------------*/\n\t\tswitch r {\n\t\tcase FOLLOWER:\n\t\t\trf.followerLoop()\n\t\tcase CANDIDATE:\n\t\t\trf.candidateLoop()\n\t\tcase LEADER:\n\t\t\trf.leaderLoop()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "27fe5b065623ed8095e989c42afb0684", "score": "0.5178705", "text": "func (app *App) eventLoop() {\n\tdefer app.wg.Done()\n\tdefer app.cleanupAndRepanic()\n\tscreen := app.screen\nloop:\n\tfor {\n\t\tvar widget views.Widget\n\t\tif widget = app.widget; widget == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tev := screen.PollEvent()\n\t\tswitch ev.(type) {\n\t\tcase *terminateEventLoopEvent:\n\t\t\tbreak loop\n\t\tdefault:\n\t\t\tapp.HandleEvent(ev)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ed3f1b6bccac9e0b26e88baca410c29f", "score": "0.5165875", "text": "func (t *RPC) LoopDevice(image string, mode int, info loop.Info64, maxDevices int, shared bool) (int, error) {\n\targuments := &args.LoopArgs{\n\t\tImage: image,\n\t\tMode: mode,\n\t\tInfo: info,\n\t\tMaxDevices: maxDevices,\n\t\tShared: shared,\n\t}\n\tvar reply int\n\terr := t.Client.Call(t.Name+\".LoopDevice\", arguments, &reply)\n\treturn reply, err\n}", "title": "" }, { "docid": "3d3ef3f84d6d7421be13c433b55408ea", "score": "0.516508", "text": "func (g *GroupedSound) Play() {\n\tif g.playing {\n\t\treturn\n\t}\n\tg.playing = true\n\tif g.s.groupedCount == 0 {\n\t\tg.s.groupedPlayer = g.s.Play()\n\t}\n\tg.s.groupedCount++\n}", "title": "" }, { "docid": "d8d915742b1d7366ab1253722c260bb6", "score": "0.5162958", "text": "func (o *GSLB) SetDelayLoop(v int) {\n\to.DelayLoop = v\n}", "title": "" }, { "docid": "b512e469b55700737d25846f3ec5e4c4", "score": "0.5154315", "text": "func (p *Participant) loop() {\n\t// we need to keep a history of the messages that have been processed, so we don't process\n\t// them again. Start a goroutine to clean up this history once every 5 seconds so it won't\n\t// take too much memory\n\tmessageProcessedTime := make(map[string]time.Time)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(5 * time.Second):\n\t\t\t\tfor k, v := range messageProcessedTime {\n\t\t\t\t\tif time.Since(v).Seconds() > 10 {\n\t\t\t\t\t\tdelete(messageProcessedTime, k)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tmessagesChan, errChan := p.watchMessages()\n\n\tgo func() {\n\t\t// psStarted means the message loop is running, and\n\t\t// it can process p.stop message\n\t\tp.state = psStarted\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase m := <-messagesChan:\n\t\t\t\tfor _, msg := range m {\n\t\t\t\t\t// messageChan is a snapshot of all unprocessed messages whenever\n\t\t\t\t\t// a new message is added, so it will have duplicates.\n\t\t\t\t\tif _, seen := messageProcessedTime[msg]; !seen {\n\t\t\t\t\t\tp.processMessage(msg)\n\t\t\t\t\t\tmessageProcessedTime[msg] = time.Now()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase err := <-errChan:\n\t\t\t\tfmt.Println(err.Error())\n\t\t\tcase <-p.stop:\n\t\t\t\tp.state = psStopped\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "389af3846ff7c68753839e8c771f722d", "score": "0.51528186", "text": "func (stm *STM) sampleGetCurrentLoop(stop <-chan struct{}, ticker *time.Ticker) {\n\tfor process := true; process; process = stm.sampleGetCurrent(stop) {\n\t\tselect {\n\t\tcase <-stop:\n\t\t\t// sampleTicker has been stopped (before a tick occurred)\n\t\t\t// and this goroutine should terminate.\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44237d5875d8e1d8a6ffca998962b712", "score": "0.5144131", "text": "func (_m *DBusAPI) MainLoopRun(_a0 dbus.MainLoop) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "cfdf198bc430eec142daedea396c4e41", "score": "0.51364106", "text": "func (l *Loop) Stop() {\n\tl.running = false\n\tclose(l.channel[RECEIVER])\n}", "title": "" }, { "docid": "df9c1cb1ff2d2ca944e43474fbdcf6a0", "score": "0.5136401", "text": "func (p *Parrot) Sound() {\n\tfmt.Println(\"ARR. I'm the parrot!\")\n}", "title": "" }, { "docid": "b475f81693d95ae891314bec1d78ceb1", "score": "0.51304877", "text": "func (js *JobScheduler) RunLoop() {\n\tjs.latch.Started()\n\tdefer func() {\n\t\tjs.latch.Stopped()\n\t}()\n\n\tif js.JobSchedule != nil {\n\t\tjs.NextRuntime = js.JobSchedule.Next(js.NextRuntime)\n\t}\n\n\t// if the schedule returns a zero timestamp\n\t// it should be interpretted as *not* to automatically\n\t// schedule the job to be run.\n\tif js.NextRuntime.IsZero() {\n\t\treturn\n\t}\n\n\t// this references the underlying js.Latch\n\t// it returns the current latch signal for stopping *before*\n\t// the job kicks off.\n\tnotifyStopping := js.latch.NotifyStopping()\n\n\tfor {\n\t\tif js.NextRuntime.IsZero() {\n\t\t\treturn\n\t\t}\n\n\t\trunAt := time.After(js.NextRuntime.UTC().Sub(Now()))\n\t\tselect {\n\t\tcase <-runAt:\n\t\t\t// if the job is enabled\n\t\t\t// and there isn't another instance running\n\t\t\tif js.CanBeScheduled() {\n\t\t\t\t// start the job invocation\n\t\t\t\tgo js.Run()\n\t\t\t}\n\n\t\t\t// set up the next runtime.\n\t\t\tif js.JobSchedule != nil {\n\t\t\t\tjs.NextRuntime = js.JobSchedule.Next(js.NextRuntime)\n\t\t\t} else {\n\t\t\t\tjs.NextRuntime = Zero\n\t\t\t}\n\n\t\tcase <-notifyStopping:\n\t\t\t// note: we bail hard here\n\t\t\t// because the job executions in flight are\n\t\t\t// handled by the context cancellation.\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ddceb7282ac845eb64fb2547ffdf96d", "score": "0.512874", "text": "func (gr *GameRoom) readLoop() {\n\tfor {\n\t\tmsg, err := gr.sub.Next(gr.Ctx)\n\t\tif err != nil {\n\t\t\tclose(gr.Events)\n\t\t\treturn\n\t\t}\n\t\t// only forward events delivered by others\n\t\tif msg.ReceivedFrom == gr.Self.ID {\n\t\t\tcontinue\n\t\t}\n\n\t\tevent := SendEvent{}\n\t\treader := bytes.NewReader(msg.Data)\n\t\tdec := gob.NewDecoder(reader)\n\t\terr = dec.Decode(&event)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Err: %v\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif event.Event.Type() != event.Type {\n\t\t\t// TODO: Print errors\n\t\t\tcontinue\n\t\t}\n\n\t\tgr.Events <- event.Event\n\t}\n}", "title": "" }, { "docid": "be01ec08e88c4d8f2ecb1d05a73e5234", "score": "0.51276594", "text": "func (recv *PixbufSimpleAnim) GetLoop() bool {\n\tretC := C.gdk_pixbuf_simple_anim_get_loop((*C.GdkPixbufSimpleAnim)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "0ff3ac0b13a78aa5b79c88b35a7d54ca", "score": "0.51263285", "text": "func NewLoopFrames(nframes int, in Sound) *Loop {\n\treturn &Loop{newmono(in), newbufc(nframes, 0), false, false, 0, 0}\n}", "title": "" }, { "docid": "2ff17fe2ef4f3ad7778eb11d503d2285", "score": "0.5125902", "text": "func mainLoop() {\n\tendGame := make(chan int)\n\n\tfor {\n\t\tcurrentGame = engine.NewGame(endGame)\n\t\tcurrentGame.Start()\n\n\t\t<-endGame\n\t\tHistory = append(History, currentGame)\n\t\tutil.LogInfo(\"Game ended with id: %s.\", currentGame.Id)\n\t}\n}", "title": "" }, { "docid": "fd34f587c45fef326546c96e9a9b494c", "score": "0.5124956", "text": "func (e *Echo) Run() {\n\tfor p := range e.Ping {\n\t\te.Pong <- p\n\t}\n}", "title": "" }, { "docid": "83d2ff3913c4d0c53a6d393b9f8b61d1", "score": "0.51232374", "text": "func (c *wsconnection) ReadLoop(hub HubConnection) {\n\t// Setup our connection's websocket ping/pong handlers from our const values.\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error { c.ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\tgo c.doTick() // keeps the websocket simulated as per spec.\n\n\tfor {\n\t\tmess := c.decodeMessage()\n\t\tif mess == nil {\n\t\t\tc.Disconnect()\n\t\t\tbreak\n\t\t} else {\n\t\t\tif c.isSister {\n\t\t\t\thub.ReceivedSisterMessage(c, mess)\n\t\t\t} else {\n\t\t\t\thub.Write(c, mess)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "23fd49914ccfbffe0d7b1302d765e346", "score": "0.5117866", "text": "func (l *renderLoop) Run() {\n\truntime.LockOSThread()\n\tinitialize()\n\treshape(INITIAL_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT)\n\tinitShaders()\n\tfor {\n\t\tselect {\n\t\tcase <-l.pause:\n\t\t\tl.ticker.Stop()\n\t\t\tl.pause <- 0\n\t\tcase <-l.terminate:\n\t\t\tcleanup()\n\t\t\tl.terminate <- 0\n\t\tcase <-l.ticker.C:\n\t\t\tdraw(currWidth, currHeight)\n\t\t\tegl.SwapBuffers(platform.Display, platform.Surface)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "45a29e898484458caa28e2f8798c8950", "score": "0.51135975", "text": "func (h *Hare) tickLoop(ctx context.Context) {\n\tdefer h.wg.Done()\n\n\tfor layer := h.layerClock.GetCurrentLayer(); ; layer = layer.Add(1) {\n\t\tselect {\n\t\tcase <-h.layerClock.AwaitLayer(layer):\n\t\t\tif h.layerClock.LayerToTime(layer).Sub(time.Now()) > (time.Duration(h.config.WakeupDelta) * time.Second) {\n\t\t\t\th.With().Warning(\"missed hare window, skipping layer\", layer)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo func(l types.LayerID) {\n\t\t\t\tstarted, err := h.onTick(ctx, l)\n\t\t\t\tif err != nil {\n\t\t\t\t\th.With().Error(\"failed to handle tick\", log.Err(err))\n\t\t\t\t} else if !started {\n\t\t\t\t\th.WithContext(ctx).With().Warning(\"consensus not started for layer\", l)\n\t\t\t\t}\n\t\t\t}(layer)\n\t\tcase <-h.CloseChannel():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eea87b4cbdeec3d96a38c78462cc75a9", "score": "0.5107499", "text": "func New() *Loop {\n\treturn &Loop{\n\t\tinputCh: make(chan Event, inputChSize),\n\t\thandleCb: dummyHandleCb,\n\t\tredrawCb: dummyRedrawCb,\n\n\t\tredrawCh: make(chan struct{}, 1),\n\t\tredrawFull: false,\n\t\tredrawMutex: new(sync.Mutex),\n\t}\n}", "title": "" }, { "docid": "f2d162d14c050bbff743239e48c774a4", "score": "0.5107017", "text": "func (ec *ServiceManager) eventLoop() (err error) {\n\t// Run event loop\n\tfor {\n\t\t// Await event on global channel\n\t\tevent, open := <-ec.in\n\n\t\tif open {\n\t\t\t// Dispatch to bound services\n\t\t\tfor _, s := range ec.services {\n\t\t\t\ts.SendEvent(event)\n\t\t\t}\n\t\t} else {\n\t\t\t// Close service channels\n\t\t\tfor _, s := range ec.services {\n\t\t\t\ts.Exit()\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00eb4279a60520f946928df92377ba77", "score": "0.51044095", "text": "func (self *SampleInstance) Playing() bool {\n return cb2b(C.al_get_sample_instance_playing(self.handle))\n}", "title": "" }, { "docid": "3c5884419b08c26042910fd6a4f516ad", "score": "0.5094422", "text": "func (n *Node) pollReplyLoop() {\n\tvar timer time.Ticker\n\n\t// create an ArtPollReply packet to send out in response to an ArtPoll packet\n\tp := ArtPollReplyFromConfig(n.Config)\n\tme, err := p.MarshalBinary()\n\tif err != nil {\n\t\tn.log.With(Fields{\"err\": err}).Error(\"error creating ArtPollReply packet for self\")\n\t\treturn\n\t}\n\n\t// loop until shutdown\n\tfor {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\t// if we should regularly send replies (can be requested by the controller)\n\t\t\t// we send it here\n\n\t\tcase <-n.pollCh:\n\t\t\t// reply with pollReply\n\t\t\tn.log.With(nil).Debug(\"sending ArtPollReply\")\n\n\t\t\tn.sendCh <- netPayload{\n\t\t\t\taddress: broadcastAddr,\n\t\t\t\tdata: me,\n\t\t\t}\n\n\t\t\t// TODO: if we are asked to send changes regularly, set the Ticker here\n\n\t\tcase <-n.shutdownCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9aebefb6e8068319306c86628bfd0bac", "score": "0.5089226", "text": "func (l *Loop) run() {\n\tl.running = true\n\tgo l.runReceiver(l.receiver)\n\tgo l.runHandler(l.handler[JOURNALER], JOURNALER)\n\tgo l.runHandler(l.handler[REPLICATOR], REPLICATOR)\n\tgo l.runHandler(l.handler[UNMARSHALLER], UNMARSHALLER)\n\tgo l.runHandler(l.handler[EXECUTOR], EXECUTOR)\n}", "title": "" }, { "docid": "9ca554fc2b7edb150f43cff2d7f108ae", "score": "0.50883526", "text": "func MainLoop() {\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\n\tframes := MainLoopFrames()\n\tfor {\n\t\tframe := <-frames\n\t\tif !frame() {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7c9c18e832ba03ebf848c8056442786f", "score": "0.5068548", "text": "func (a Audio) Play() error {\n\n\tif a.ID == 0 {\n\t\treturn errors.New(\"need a id in order to play audio\")\n\t}\n\n\taudio, artist, _, err := db.AllSongInfo(a.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Infof(\"playing %s by %s\", audio.Title, artist.Name)\n\n\tfile, err := os.Open(audio.Location)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar (\n\t\tstream beep.StreamSeekCloser\n\t\tformat beep.Format\n\t)\n\n\tswitch audio.MIME {\n\tcase \"audio/mpeg\":\n\t\tstream, format, err = mp3.Decode(file)\n\tcase \"audio/x-wav\":\n\t\tstream, format, err = wav.Decode(file)\n\tcase \"audio/x-flac\":\n\t\tstream, format, err = flac.Decode(file)\n\tcase \"audio/ogg\":\n\t\tstream, format, err = vorbis.Decode(file)\n\tdefault:\n\t\treturn errors.New(\"MIME is missing\")\n\t}\n\n\tif err := speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10)); err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan struct{})\n\n\tspeaker.Play(beep.Seq(stream, beep.Callback(func() {\n\t\tclose(done)\n\t})))\n\n\t<-done\n\n\t// if err := speaker.Play(stream); err != nil {\n\t// \treturn err\n\t// }\n\n\t// s, format, err := wav.Decode(file)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\treturn nil\n\n}", "title": "" }, { "docid": "871534820522f72e961be33e42aaed9c", "score": "0.5065903", "text": "func (w *Worker) Start() {\n\tgo w.loop()\n}", "title": "" }, { "docid": "4b6a1362c0543ea14d073605a8ee4e92", "score": "0.506495", "text": "func (p *Player) Play() {\n\tp.playChan <- struct{}{}\n}", "title": "" }, { "docid": "56b1c1c2cccc7df655da32d159873aae", "score": "0.5055168", "text": "func (self *AudioStream) Drain() {\n C.al_drain_audio_stream(self.handle)\n}", "title": "" }, { "docid": "3cfae8050cc609bee1377e8a284bc434", "score": "0.5050084", "text": "func (pub *Publisher) heartbeatLoop() {\n\tlogrus.Infof(\"Publisher.heartbeatLoop: starting heartbeat loop\")\n\tpub.heartbeatChannel <- false\n\n\tfor {\n\t\ttime.Sleep(time.Second)\n\n\t\t// FIXME: The duration of publishing these updates adds to the heartbeat which delays the heartbeat\n\t\tpub.PublishUpdates()\n\n\t\tif pub.config.SaveDiscoveredPublishers && pub.domainIdentities.UpdateCount() > 0 {\n\t\t\tpub.SaveDomainPublishers()\n\t\t}\n\n\t\t// poll for discovery and values of registered nodes, inputs and outputs\n\t\tif (pub.pollCountdown <= 0) && (pub.pollHandler != nil) {\n\t\t\tpub.pollHandler(pub)\n\t\t\tpub.pollCountdown = pub.pollInterval\n\t\t}\n\t\tpub.pollCountdown--\n\n\t\tpub.updateMutex.Lock()\n\t\tisRunning := pub.isRunning\n\t\tpub.updateMutex.Unlock()\n\t\tif !isRunning {\n\t\t\tbreak\n\t\t}\n\t}\n\tpub.heartbeatChannel <- true\n\tlogrus.Infof(\"Publisher.heartbeatLoop: Ending loop of publisher %s\", pub.PublisherID())\n}", "title": "" } ]
4343ec5140cb6093c9c50e3cfb618b46
Get an item from the beginning of the queue (oldest), blocking.
[ { "docid": "6ae8eee7df7086ff52387133ce104009", "score": "0.6001905", "text": "func (b *CircularBuffer) Get() interface{} {\n\t_ = <-b.avail\n\n\tb.lock.Lock()\n\tdefer b.lock.Unlock()\n\n\tif b.start == b.pos {\n\t\tpanic(\"Trying to get from empty buffer\")\n\t}\n\n\tv := b.buffer[b.start]\n\tb.buffer[b.start] = nil\n\tb.start = (b.start + 1) % b.size\n\n\treturn v\n}", "title": "" } ]
[ { "docid": "f2f3e36f0612774fe5228d9cf5504bc3", "score": "0.7191909", "text": "func (q *Queue) Get() (interface{}, error) {\n\tif q.IsEmpty() {\n\t\treturn nil, errors.New(\"queue: Get() from empty queue\")\n\t}\n\n\titem := q.items[0]\n\tq.items = q.items[1:]\n\treturn item, nil\n}", "title": "" }, { "docid": "fdde1f187f42a5519947ceeabe2b8f0c", "score": "0.708822", "text": "func (e *Executor) Peek() *Item {\n\tif len(e.queue.Items) > 0 {\n\t\treturn &e.queue.Items[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e531275d4c4507f0312d32176fa4dfe2", "score": "0.6974915", "text": "func (q *Queue[V]) Front() (V, error) {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tif q.closed {\n\t\treturn *new(V), ErrClosed\n\t}\n\n\tid := q.buf[q.head]\n\tif id != 0 {\n\t\treturn q.items[id], ErrEmpty\n\t}\n\treturn *new(V), nil\n}", "title": "" }, { "docid": "e3f4345b1316f8e5826f1a2f04e499cf", "score": "0.693987", "text": "func (q *Queue) Peek() Item {\n\tvar item Item\n\tif q.Size() > 0 {\n\t\titem = (*q)[0]\n\t}\n\treturn item\n}", "title": "" }, { "docid": "4d7ed81e172524a374a5236ea6c6798d", "score": "0.68804914", "text": "func (q *queue) front() *tinyBatch {\n\tif q.count <= 0 {\n\t\tpanic(\"batchPool: pop called on empty queue\")\n\t}\n\treturn q.buf[q.head]\n}", "title": "" }, { "docid": "56d3c7987aa8802e93c1d8f6e66fdbe9", "score": "0.686708", "text": "func (q *Queue) Front() interface{} {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tid := q.buf[q.head]\n\tif id != 0 {\n\t\treturn q.items[id]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79d2428e5c5fc0556a3b9e5f0c77f0d0", "score": "0.68226916", "text": "func (q *Queue) Peek() (item interface{}) {\n\tq.l.Lock()\n\ti := q.queue.Peek()\n\tq.l.Unlock()\n\n\treturn i\n}", "title": "" }, { "docid": "01eb277126f66344620172e78dce84e8", "score": "0.67341816", "text": "func (r *RQueue) Pick() interface{} {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\tv := r.set.PeekMin()\n\tif v != nil {\n\t\treturn v.Value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c303da3bdc1e81cb80c5802322d380da", "score": "0.6725545", "text": "func (this *MyQueue) Peek() int {\n\treturn this.normal[0]\n}", "title": "" }, { "docid": "4359a5d6175a46f8fc823f4604e2a2a9", "score": "0.6703478", "text": "func (s Queue) Front() Item {\n\tif s.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn s.items[0]\n}", "title": "" }, { "docid": "7f92897096a54443f84e768cb3b92fb4", "score": "0.664766", "text": "func (q *Queue) Get(i int) interface{} {\n\tif i < 0 {\n\t\ti += q.count\n\t}\n\tif i < 0 || i >= q.count {\n\t\treturn nil\n\t}\n\treturn q.buf[(q.head+i)&len(q.buf)]\n}", "title": "" }, { "docid": "1c33ae9a2113082587a72bfa3ef2f907", "score": "0.66386247", "text": "func (dq *defaultDqueue) GetFirst() (interface{}, error) {\n\tif dq.data.Empty() {\n\t\treturn nil, ErrBlank\n\t}\n\n\treturn dq.data.Get(0)\n}", "title": "" }, { "docid": "3ea69bf51b61ee21b6e74519bdee09d8", "score": "0.6616692", "text": "func (dq *defaultDqueue) PeekFirst() interface{} {\n\tif dq.data.Empty() {\n\t\treturn nil\n\t}\n\n\te, _ := dq.data.Get(0)\n\treturn e\n}", "title": "" }, { "docid": "9e689710d3d3be94b67d5964bc4794c1", "score": "0.6600427", "text": "func (q *Queue) Pull() (model.Data, error) {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\tif len(q.q) > 0 {\n\t\titem := q.q[0]\n\t\tq.q = q.q[1:]\n\t\treturn item, nil\n\t}\n\treturn 0, errors.New(\"queue is empty\")\n}", "title": "" }, { "docid": "6d5f3e35bf762134c209c54289ecf4c2", "score": "0.6598755", "text": "func (this *MyQueue) Peek() int {\n\treturn this.data[0]\n}", "title": "" }, { "docid": "b20d38ac4cb8058c7d40173fafb6df15", "score": "0.65946436", "text": "func (q *Queue) Get(ctx context.Context) (interface{}, error) {\n\tq.l.Lock()\n\tif q.items.Len() > 0 {\n\t\titem := q.items.Pop()\n\t\tq.l.Unlock()\n\t\treturn item, nil\n\t}\n\n\twaiter := make(getter, 1) // Need buffer to prevent dead lock..\n\t// Using the same lock here, so there is no chance Get op\n\t// got starving even if items is not empty.\n\tq.getters.Append(waiter)\n\tq.l.Unlock()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase item := <-waiter:\n\t\treturn item, nil\n\t}\n}", "title": "" }, { "docid": "e7752ab222632ca1efe3b982c065dc10", "score": "0.6512133", "text": "func (q *Queue) Front() *dll.Element {\n\treturn q.front\n}", "title": "" }, { "docid": "6c3f8224c637bd65d3e3bd7b13001ae3", "score": "0.64971864", "text": "func (q *Queue) Peek() interface{} {\n\tif q.count <= 0 {\n\t\treturn nil\n\t}\n\treturn q.buf[q.head]\n}", "title": "" }, { "docid": "39be409ea183c850e47df90c74a7306a", "score": "0.6486051", "text": "func (q *Queue) Peek() interface{} {\n\tif !q.isQueueEmpty() {\n\t\tdata := q.items[0]\n\t\treturn data\n\t}\n\tfmt.Printf(\"Queue is Empty now, Capacity of the Queue is: %v and size of Queue is: %v \\n\", q.Capacity, q.pos)\n\treturn -1\n}", "title": "" }, { "docid": "2ea4ceca5f078ad95f4769eecb2ad72d", "score": "0.6466025", "text": "func (que *CacheQueue) Front() (*CacheItem, error) {\n\tif que.Len() == 0 {\n\t\treturn nil, ErrQueueEmpty\n\t}\n\treturn que.front.item, nil\n}", "title": "" }, { "docid": "eb34453c58ea200c206daad115aca7b3", "score": "0.64659685", "text": "func (p *ByteQueue) Pick() interface{} {\n\tsizeT := p.Size()\n\tif sizeT < 1 {\n\t\treturn fmt.Errorf(\"no item\")\n\t}\n\n\tif sizeT == 1 {\n\t\trs := p.Head.Value\n\n\t\tp.Head = nil\n\t\tp.Tail = nil\n\n\t\tp.SizeM = 0\n\n\t\treturn rs\n\t}\n\n\trs := p.Head.Value\n\n\tp.Head = p.Head.Next\n\tp.Head.Prev = nil\n\n\tp.SizeM--\n\n\treturn rs\n}", "title": "" }, { "docid": "d745242a6aa53862bfa8bc5afea82ce6", "score": "0.64386165", "text": "func (q *ListQueue) Peek() (interface{}, error) {\n\tif q.IsEmpty() {\n\t\treturn nil, errors.New(\"unable to peek element, queue is empty\")\n\t}\n\treturn q.first.item, nil\n}", "title": "" }, { "docid": "35dfe84b7247b5b403f60e3b955edc18", "score": "0.643165", "text": "func (q *Queue) Pop() Item {\n\titem := q.Peek()\n\tif item != nil {\n\t\t*q = (*q)[1:q.Size()]\n\t}\n\treturn item\n}", "title": "" }, { "docid": "462420c4bb46257e9628d0fe8f21158b", "score": "0.64197564", "text": "func (q *Queue) Pop() interface{} {\n\tslot, ticket := q.read.getTicket()\n\tq.write.waitUntilReady(ticket, q.IsDrained)\n\tif q.IsDrained() {\n\t\tatomic.StoreUint64(q.read.next, atomic.LoadUint64(q.write.next))\n\t\treturn nil\n\t}\n\n\titem := q.items[slot]\n\tq.read.ticketDone(ticket)\n\treturn item\n}", "title": "" }, { "docid": "19b807ecc1ac8d1e98d7550c5ebc7c8c", "score": "0.6418107", "text": "func (q *BytesQueue) Peek() []byte {\n\tif q.Len() <= 0 {\n\t\tpanic(\"queue: empty queue\")\n\t}\n\treturn q.buf[q.head]\n}", "title": "" }, { "docid": "5ad25ec74b254de607d5dd1bdbb53e81", "score": "0.64035356", "text": "func (dq *defaultDqueue) PollFirst() interface{} {\n\tif dq.data.Empty() {\n\t\treturn nil\n\t}\n\n\td, _ := dq.data.RemoveIdx(0)\n\treturn d\n}", "title": "" }, { "docid": "6712ea75103b8041bd519b5f410ade5b", "score": "0.63891", "text": "func (queue *Queue) Peek() interface{} {\n\treturn queue.front\n}", "title": "" }, { "docid": "2717b1bd0da46659c73db465d748a150", "score": "0.6364577", "text": "func (q *Queue) Peek() string {\n\tout, err := q.client.LRange(q.name, 0, 0).Result()\n\tif err != nil {\n\t\tsetup.LogCommon(err).Error(\"Failed LRange\")\n\t} else if len(out) != 1 {\n\t\tsetup.LogCommon(err).Error(\"Unexpected LRange return size\")\n\n\t\treturn \"\"\n\t}\n\n\treturn out[0]\n}", "title": "" }, { "docid": "3b2091eeff93dc27bce1dbe1c6b8393d", "score": "0.63489014", "text": "func (q *BytesQueue) Get(i int) []byte {\n\tif i >= q.Len() || i < 0 {\n\t\tpanic(\"queue: index out of range\")\n\t}\n\tmodi := (q.head + i) % len(q.buf)\n\treturn q.buf[modi]\n}", "title": "" }, { "docid": "d1dab97ff1a908ae5eefeaacc6e2f882", "score": "0.63444906", "text": "func (l *listQueue) Get() (v interface{}, err error) {\n\tfirst := true\n\tfor {\n\t\tif v, ok := l.get(first); ok {\n\t\t\treturn v, nil\n\t\t}\n\t\tfirst = false\n\t}\n}", "title": "" }, { "docid": "81eed8420218dbd4b02daf9facb8bf6a", "score": "0.6326795", "text": "func (q *Queue) Peek() *interface{} {\n\tif q.size <= 0 {\n\t\tfmt.Println(\"Peek: Empty queue\")\n\t\treturn nil\n\t}\n\n\treturn &q.buf[q.head]\n}", "title": "" }, { "docid": "c3c9f8df9fcc26e7465a21b245d1e977", "score": "0.6318575", "text": "func (this *MyQueue) Peek() int {\r\n\tif this.Empty() {\r\n\t\treturn 0\r\n\t}\r\n\r\n\toutLen := len(this.output)\r\n\tif outLen > 0 {\r\n\t\ttop := this.output[outLen-1]\r\n\t\treturn top\r\n\t}\r\n\r\n\tthis.move()\r\n\treturn this.Peek()\r\n}", "title": "" }, { "docid": "808b0bb43d754035f6d633af016241e3", "score": "0.6306114", "text": "func (queue *ArrayQueue) PeekFront() int {\n\tif queue.IsEmpty() {\n\t\tpanic(\"Queue is empty\")\n\t}\n\treturn queue.array[0]\n\n}", "title": "" }, { "docid": "1cb8d6980ee4b892365a28fb058fd700", "score": "0.629028", "text": "func (f *Queue) Pickup() (item interface{}) {\n\tif len(f.items) == 0 {\n\t\treturn\n\t}\n\n\titem = f.items[0]\n\treturn\n}", "title": "" }, { "docid": "1e3e4073439715cbd1437e03d2468a01", "score": "0.62887865", "text": "func (q *Queue[E]) Front() E {\n\tv, _ := q.front()\n\treturn v\n}", "title": "" }, { "docid": "dfe106559b8b547e514cd9e8be6baf43", "score": "0.62744415", "text": "func (q *Queue) GetNoWait() (interface{}, error) {\n\tq.l.Lock()\n\tdefer q.l.Unlock()\n\tif q.items.Len() > 0 {\n\t\treturn q.items.Pop(), nil\n\t}\n\treturn nil, ErrEmpty\n}", "title": "" }, { "docid": "5902b966cc946c9e7e431c48e8d6e6aa", "score": "0.626561", "text": "func (q *Queue) Get() (interface{}, error) {\n\tq.mutex.Lock()\n\tq.clearPending()\n\tif !q.isempty() {\n\t\tv := q.get()\n\t\tq.notifyPutter(nil)\n\t\tq.mutex.Unlock()\n\n\t\treturn v, nil\n\t}\n\n\te := q.newGetter()\n\tq.mutex.Unlock()\n\tw := e.Value.(waiter)\n\n\tvar v interface{}\n\tselect {\n\tcase v = <-w:\n\tcase <-q.ctx.Done():\n\t\treturn nil, q.ctx.Err()\n\t}\n\n\tq.mutex.Lock()\n\tq.notifyPutter(e)\n\tq.mutex.Unlock()\n\n\treturn v, nil\n}", "title": "" }, { "docid": "cc033f1c9ac3760afa19c90250f51601", "score": "0.62631214", "text": "func (this *MyQueue) Peek() int {\n if this.head == nil {\n panic(\"There is no one node\")\n }\n return this.head.Val\n}", "title": "" }, { "docid": "24348b895e3b0653f9c3932944788a46", "score": "0.62610763", "text": "func (self queueHandler) Peek() amq.Message {\n\treturn self.q.Peek().(amq.Message)\n}", "title": "" }, { "docid": "aa49a98dce5d09c071fec6748553687e", "score": "0.625568", "text": "func (queue *CapacityQueue) PeekFront() int {\n\tif queue.IsEmpty() {\n\t\tpanic(\"Queue is empty\")\n\t}\n\treturn queue.array[queue.front+1]\n}", "title": "" }, { "docid": "7d6e02f82a02449106c205f46047d41a", "score": "0.62548745", "text": "func (queue *Queue) Peek() interface{} {\n\tif queue.length == 0 {\n\t\treturn nil\n\t}\n\treturn queue.head.value\n}", "title": "" }, { "docid": "75a95d5e97a791fae12f7cbbe0cf224e", "score": "0.624866", "text": "func (q *Queue) Pop() *Item {\n\n\tif q.size > 0 {\n\t\titem, items := q.items[0], q.items[1:]\n\n\t\tq.items = items\n\n\t\tif q.items != nil {\n\t\t\tq.size--\n\t\t}\n\n\t\treturn item\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "55ef9606b0e03c53cba4b63a3552add0", "score": "0.6246498", "text": "func (r *Ring) GetFirst() *discordgo.Message {\n\tif r.cycled {\n\t\treturn r.Buffer[r.end]\n\t}\n\treturn r.Buffer[0]\n}", "title": "" }, { "docid": "6d0c23c9025a341559631adac9754fd8", "score": "0.62423396", "text": "func (p *AnyQueue) Pick() interface{} {\n\tsizeT := p.Size()\n\tif sizeT < 1 {\n\t\treturn fmt.Errorf(\"no item\")\n\t}\n\n\tif sizeT == 1 {\n\t\trs := p.Head.Value\n\n\t\tp.Head = nil\n\t\tp.Tail = nil\n\n\t\tp.SizeM = 0\n\n\t\treturn rs\n\t}\n\n\trs := p.Head.Value\n\n\tp.Head = p.Head.Next\n\tp.Head.Prev = nil\n\n\tp.SizeM--\n\n\treturn rs\n}", "title": "" }, { "docid": "772fc9f4a8c6af7ea84cd8aa9fb1dc56", "score": "0.62307096", "text": "func (q *Queue) Peek() interface{} {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\telement := q.head\n\tif element == nil {\n\t\treturn nil\n\t}\n\n\treturn element.data\n}", "title": "" }, { "docid": "73da8dd5a5c937ac17282dfa4905e3c6", "score": "0.6225918", "text": "func (q *Queue) Pop() (Item, error) {\n\tif len(q.Items) < 1 {\n\t\treturn Item{}, ErrEmpty\n\t}\n\titem := q.Items[0]\n\tq.Items = q.Items[1:]\n\treturn item, nil\n}", "title": "" }, { "docid": "2b3da3e8ace089e2a160da8c7d1da46b", "score": "0.6218994", "text": "func (q *Queue) Front() interface{} {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tn := q.head\n\tif q.head == nil {\n\t\treturn nil\n\t}\n\n\treturn n.data\n}", "title": "" }, { "docid": "537c8fd8a26bfae37393e9463f390aa6", "score": "0.6208086", "text": "func (q *T) Get(cancel <-chan struct{}) (interface{}, error) {\n\terr := q.avail.Dec(cancel)\n\tif err != nil {\n\t\tif err == vsync.ErrClosed {\n\t\t\terr = ErrQueueIsClosed\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn q.getContents()\n}", "title": "" }, { "docid": "417500ac062a31b1a511c160d3591fa2", "score": "0.6206441", "text": "func (queue *AnyQueue) Get(i int) interface{} {\n\n\tri := (queue.read + i) % queue.capacity\n\treturn queue.m[ri]\n}", "title": "" }, { "docid": "2fe9d12e1f94dbaa3a6dec38f90fb888", "score": "0.6198232", "text": "func (q *MessageQueue) Get() *model.Message {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tif len(q.Messages) > 0 {\n\t\tmessage := q.Messages[0]\n\t\tq.Messages = q.Messages[1:]\n\t\treturn message\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed7696409f44a0f9bc54730f4a3319ad", "score": "0.61824673", "text": "func (q *Queue) Next() (item interface{}) {\n\t// locking to make UnsafeQueue thread-safe\n\tq.l.Lock()\n\ti := q.queue.Next()\n\tq.l.Unlock()\n\n\treturn i\n}", "title": "" }, { "docid": "6ce5eb7ae1e7b816e807c18859f6bb90", "score": "0.61823386", "text": "func (s *SliceQueue) Peek() (interface{}, error) {\n\tif s.IsEmpty() {\n\t\treturn nil, errors.New(\"unable to peek element, queue is empty\")\n\t}\n\treturn s.backing[0], nil\n}", "title": "" }, { "docid": "4f3e44687f0faa3257e11838b2470c35", "score": "0.618009", "text": "func (m *taskQueue) peek() (t Task) {\n\tm.mu.Lock()\n\n\tif m.heap.Len() == 0 {\n\t\tm.mu.Unlock()\n\t\treturn nil\n\t}\n\tt = (*m.heap)[0].value\n\tm.mu.Unlock()\n\treturn\n}", "title": "" }, { "docid": "45ea5dab789cb1116e68023ce19dc0cb", "score": "0.6178211", "text": "func (this *MyQueue) Peek() int {\n\tfor !this.s1.Empty() {\n\t\tthis.s2.Push(this.s1.Pop())\n\t}\n\treturn this.s2.Top()\n}", "title": "" }, { "docid": "141cf31b530aaa86c2bf3c2fb7aaeba1", "score": "0.61738867", "text": "func (q *BoundedQueue[T]) Take() (t T) {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\tif len(q.items) == 0 {\n\t\treturn\n\t}\n\tt = q.items[0]\n\tq.items = q.items[1:]\n\treturn\n}", "title": "" }, { "docid": "d2fbd60bff6c1b5c24413a262b8ba9e4", "score": "0.6169004", "text": "func (q *Queue) Peek() (int, error) {\n\tif q.IsEmpty() {\n\t\treturn 0, errors.New(\"empty queue\")\n\t}\n\treturn q.Elements[0], nil\n}", "title": "" }, { "docid": "32df7b55bd954ab38f6206e1cb71a981", "score": "0.6156072", "text": "func (q *Queue) Pop() interface{} {\n\tq.Lock()\n\tdefer q.Unlock()\n\tif len(q.Items) == 0 {\n\t\treturn nil\n\t}\n\titem := q.Items[0]\n\tq.Items[0] = nil\n\tq.Items = q.Items[1:]\n\treturn item\n}", "title": "" }, { "docid": "d06cb54cb1cddeea61a73320e25b03ea", "score": "0.61556304", "text": "func (p *PollQueue) GetHead() (q PollQuery, err error) {\n\terr = nil\n\tif p.IsEmpty() {\n\t\terr = fmt.Errorf(\"fail to get head: queue is empty\")\n\t\treturn\n\t}\n\n\tq = p.buffer[p.start]\n\treturn\n}", "title": "" }, { "docid": "a2596f7d1b5e48dd8712aca0e4185c2e", "score": "0.6150585", "text": "func (q *Queue) Back() interface{} {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\tid := q.buf[(q.tail-1)&(len(q.buf)-1)]\n\tif id != 0 {\n\t\treturn q.items[id]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c09c9a2aaba8aa9f160d293aab4ada4", "score": "0.61446744", "text": "func (q *Queue) Peek() (int, error) {\n\tif q.IsEmpty() {\n\t\treturn 0, errors.New(\"empty Queue error\")\n\t}\n\n\treturn q.first.data, nil\n}", "title": "" }, { "docid": "c6e1fe55b1fadaf19f9805d59bde64f7", "score": "0.6139052", "text": "func (l *Queue) Get(index int) (interface{}, bool) {\n\tif index >= l.size {\n\t\treturn nil, false\n\t}\n\treturn l.elements[index], true\n}", "title": "" }, { "docid": "ee175d16ba114a33a6aa3b1cfdbd54e1", "score": "0.613852", "text": "func (q *Queue) Peek() (interface{}, bool) {\n\tif q.IsEmpty() {\n\t\treturn nil, false\n\t}\n\n\treturn q.items[0], true\n}", "title": "" }, { "docid": "86dbbaed9ad0abe4a3cc00b858b374ae", "score": "0.6135322", "text": "func (q *queue) peek() *node {\n\treturn q.top\n}", "title": "" }, { "docid": "53a9ff6882823375856e2d9d1ab97220", "score": "0.61316407", "text": "func (q *Queue) Front() (interface{}, error) {\n\tif q.l.Len() == 0 {\n\t\treturn nil, errors.New(\"The queue is emtpy\")\n\t}\n\treturn q.l.Front().Value, nil\n}", "title": "" }, { "docid": "445db80ff6a862c0d0c27ebcc7be3944", "score": "0.6120278", "text": "func (pq *PriorityQueue) Top() *Item {\n\tif n := pq.Len(); n > 0 {\n\t\treturn pq.heap.data[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afa93c569fb330a5b6f22999d3ddd534", "score": "0.6110178", "text": "func (q *Queue[V]) Back() (V, error) {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tif q.closed {\n\t\treturn *new(V), ErrClosed\n\t}\n\n\tid := q.buf[(q.tail-1)&(len(q.buf)-1)]\n\tif id != 0 {\n\t\treturn q.items[id], ErrEmpty\n\t}\n\treturn *new(V), nil\n}", "title": "" }, { "docid": "25e647de2603d719d9a08f004b6ae980", "score": "0.60933244", "text": "func (q *Queue[E]) PopFront() E {\n\tv, _ := q.popFront()\n\treturn v\n}", "title": "" }, { "docid": "fc65da6e390178d8dada67b9fe9387ef", "score": "0.60932916", "text": "func (pq *PQueue) returnToFront(msg *PQMsgMetaData) {\n\tif msg.PopCount > 0 {\n\t\tpq.lockedMsgCnt--\n\t}\n\tpopLimit := pq.config.PopCountLimit\n\tif popLimit > 0 && msg.PopCount >= popLimit {\n\t\tif pq.config.PopLimitQueueName == \"\" {\n\t\t\tpq.deleteMessage(msg.SerialNumber)\n\t\t} else {\n\t\t\tpq.trackHeap.Remove(msg.SerialNumber)\n\t\t\tdelete(pq.id2sn, msg.StrId)\n\t\t\tpq.popLimitMoveChan <- msg\n\t\t}\n\t} else {\n\t\tmsg.UnlockTs = 0\n\t\tpq.availMsgs.Push(msg)\n\t\tpq.trackHeap.Push(msg)\n\t\tpq.CacheItemData(msg.Sn2Bin(), msg.ByteMarshal())\n\t}\n}", "title": "" }, { "docid": "6a853aa21372deae6d20b1d908c2db35", "score": "0.60888875", "text": "func (oq *OrderQueue) First() *order.Order {\n\tif oq.Size() <= 0 {\n\t\treturn nil\n\t}\n\n\treturn oq.values[0]\n}", "title": "" }, { "docid": "1ecb117f9122fba714bdec0e3019583c", "score": "0.608777", "text": "func (q *Queue) Peek() *col.Node {\n\treturn q.queueNode.Head\n}", "title": "" }, { "docid": "6dec28452f18dfda95e98d8b03e642cd", "score": "0.60861593", "text": "func (q *softQueue[T]) Peek() (T, int) {\n\tif q.IsEmpty() {\n\t\tvar zero T\n\t\treturn zero, -1\n\t}\n\n\treturn q.list[q.front], q.front\n}", "title": "" }, { "docid": "72e8e7a18d6fc03af2cf1180a6dea0e5", "score": "0.6074298", "text": "func (q *MessageQueue) Pop() interface{} {\n\tn := len(*q)\n\titem := (*q)[n-1]\n\t*q = (*q)[0 : n-1]\n\treturn item\n}", "title": "" }, { "docid": "d84c38de3e066c6424659c668607524c", "score": "0.60725945", "text": "func (q *Queue) Peek() *Element {\n\treturn q.bottom\n}", "title": "" }, { "docid": "32cbd3d44cd6430835f1bea2aaa8684f", "score": "0.60639644", "text": "func (f * Queue) front() (*Element) {\n\treturn f.head\n}", "title": "" }, { "docid": "ef5fe7a74d28db052d4ef647729a32d8", "score": "0.6063583", "text": "func (q TimedWorkQueue) Get() (item interface{}, start time.Time, shutdown bool) {\n\titem, shutdown = q.Type.Get()\n\tif item != nil {\n\t\ttimed, _ := item.(timedWorkQueueItem)\n\t\titem = timed.obj\n\t\tstart = timed.time\n\t}\n\treturn item, start, shutdown\n}", "title": "" }, { "docid": "eec73cab23364c28bd6828f142c9004c", "score": "0.6056933", "text": "func (m *MemReadThroughCache) dequeue() *workItem {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tfor len(*m.pQ) == 0 {\n\t\tif m.finished() {\n\t\t\treturn nil\n\t\t}\n\t\tm.emptyCond.Wait()\n\t}\n\n\tret := heap.Pop(m.pQ).(*workItem)\n\tdelete(m.pqItemLookup, ret.id)\n\tm.inProgress[ret.id] = ret\n\treturn ret\n}", "title": "" }, { "docid": "7dc727208f8bbfe14f0529419dc04261", "score": "0.6056345", "text": "func (q *Queue) Peek() interface{} {\n\n\tif q.last == nil {\n\t\treturn nil\n\t}\n\n\treturn q.last.data\n}", "title": "" }, { "docid": "8d4503c218babfe8ff49e741e79337b1", "score": "0.6052152", "text": "func (q *Queue) frontElement() (interface{}, error) {\n\tif q.isEmpty() {\n\t\treturn nil, errors.New(\"unable to peek element, queue is empty\")\n\t}\n\treturn q.front.data, nil\n}", "title": "" }, { "docid": "6e7ef25a737468ea6ed55d58a3ac4212", "score": "0.6045471", "text": "func (q *Queue) Pop() (interface{}, error) {\n\tif len(q.data) > 0 {\n\t\tv := q.data[0]\n\t\tq.data = q.data[1:]\n\t\treturn v, nil\n\t}\n\treturn nil, errors.New(\"no more items in queue.\")\n}", "title": "" }, { "docid": "7e4b6271c8c8dd27f56b2abfbdc683f9", "score": "0.60406876", "text": "func (this *MyQueue) Peek() int {\n\tif len(*this.output) == 0 {\n\t\tfor len(*this.input) > 0 {\n\t\t\t*this.output = append(*this.output, (*this.input)[len(*this.input)-1])\n\t\t\t*this.input = (*this.input)[:len(*this.input)-1]\n\t\t}\n\t}\n\n\treturn (*this.output)[len(*this.output)-1]\n}", "title": "" }, { "docid": "9f055be5843d73c17665d9df3689c5c1", "score": "0.60392433", "text": "func (p *ByteQueue) Get(indexA ...int) interface{} {\n\tvar idxT int\n\n\tif len(indexA) > 0 {\n\t\tidxT = indexA[0]\n\t} else {\n\t\tidxT = 0\n\t}\n\n\tif idxT < 0 {\n\t\tidxT = p.Size() - 1\n\t}\n\n\tif idxT < 0 || idxT >= p.Size() {\n\t\treturn fmt.Errorf(\"out of index\")\n\t}\n\n\tcurrentT := p.Head\n\tcntT := 0\n\n\tfor cntT < idxT {\n\t\tcurrentT = currentT.Next\n\t\tcntT++\n\t}\n\n\tif currentT == nil {\n\t\treturn fmt.Errorf(\"out of index\")\n\t}\n\n\treturn currentT.Value\n}", "title": "" }, { "docid": "605678eb34215327639d1ef90de63669", "score": "0.60358286", "text": "func (q *PriorityQueue[T]) Top() T {\n\tq.locker.RLock()\n\tdefer q.locker.RUnlock()\n\n\treturn q.holder.top()\n}", "title": "" }, { "docid": "ef2d0372b6cbd2a33cd63ba059d3f25d", "score": "0.6033483", "text": "func (this *MyQueue) Peek() int {\n\tfor !this.first.Empty() {\n\t\tthis.second.Push(this.first.Pop())\n\t}\n\tresult := this.second.Peek()\n\tfor !this.second.Empty() {\n\t\tthis.first.Push(this.second.Pop())\n\t}\n\treturn result\n}", "title": "" }, { "docid": "288ec1268148121a6e7b4d5a17de4a07", "score": "0.60333586", "text": "func (q *AnyQueue) Get(val any) any {\n\tfor i, a := range q.slice {\n\t\tif q.eq(a, val) {\n\t\t\tq.slice = append(q.slice[:i], q.slice[i+1:]...)\n\t\t\treturn a\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "696615382a8113a862cf025123f5f274", "score": "0.60318375", "text": "func (dq *DirtyQueue) Front_() *list.Element {\n\treturn dq.l.Front()\n}", "title": "" }, { "docid": "24ddb9a91e7c04749508bb8740b9ae4b", "score": "0.602433", "text": "func (q *Queue) Peek() (int, error) {\n\tif q.IsEmpty() {\n\t\treturn 0, errors.New(\"There is no values in queue\")\n\t}\n\treturn q.list[0], nil\n}", "title": "" }, { "docid": "36e04b7f9142a8d84f8bb42796a870b4", "score": "0.6023745", "text": "func (this *MyQueue) Peek() int {\n\tthis.trans()\n\treturn this.outStack[len(this.outStack)-1]\n}", "title": "" }, { "docid": "a607f7e85e603da01801986cf59b04ec", "score": "0.60124356", "text": "func (this *MyQueue) Peek() int {\n\tif this.Empty() {\n\t\treturn -1\n\t}\n\tif len(this.inStack) != 0 {\n\t\treturn this.inStack[0]\n\t} else {\n\t\treturn this.outStack[len(this.outStack)-1]\n\t}\n}", "title": "" }, { "docid": "140dd404ab8d46aeb3f6ce8e7c72e343", "score": "0.60093385", "text": "func (q *Queue) Pop() interface{} {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tfor {\n\t\tid := q.pop()\n\n\t\titem, ok := q.items[id]\n\n\t\tif ok {\n\t\t\tdelete(q.ids, item)\n\t\t\tdelete(q.items, id)\n\t\t\tq.notify()\n\t\t\treturn item\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68d1f32ad6b232790eaa907615fbc0fc", "score": "0.59962565", "text": "func (q *NodeQueue) Front() Element {\n\tif q == nil || q.inbox.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn (*q.inbox)[0]\n}", "title": "" }, { "docid": "505e9dc855c178c0433192674479a5f1", "score": "0.5993289", "text": "func (m *Mailbox) retrieve() interface{} {\n\tif len(m.queue) == 0 {\n\t\treturn nil\n\t}\n\tx := m.queue[len(m.queue)-1]\n\tm.queue = m.queue[:len(m.queue)-1]\n\treturn x\n}", "title": "" }, { "docid": "c01e434e24ece936845c85a50f5010ef", "score": "0.59831095", "text": "func (q *IssuerQueue) Front() *Block {\n\tif q == nil || q.inbox.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn q.inbox[0].Value\n}", "title": "" }, { "docid": "eb30d4be3634602be692976e6ad6229d", "score": "0.5982578", "text": "func (q *Queue) Front() interface{} {\n\tif q.length == 0 {\n\t\treturn nil\n\t}\n\treturn q.front.data\n}", "title": "" }, { "docid": "634ff597f9d3737438d11245d929215f", "score": "0.59668237", "text": "func (bp *Buf) Front() interface{} {\n\tbp.lock()\n\tfor bp.sb.Empty() {\n\t\tbp.cvar.Wait()\n\t}\n\tv, _ := bp.sb.Front()\n\tbp.unlock()\n\treturn v\n}", "title": "" }, { "docid": "9f88f52f6a26445080a27d168b5393bb", "score": "0.5941226", "text": "func (this *MyQueue) Peek() int {\n\tif this.out.Empty() {\n\t\tfor !this.in.Empty() {\n\t\t\tthis.out.Push(this.in.Pop())\n\t\t}\n\t}\n\treturn this.out.Peek()\n}", "title": "" }, { "docid": "fc2469eed3c5f16289f1ebf147ba58a8", "score": "0.59396064", "text": "func (q *ArrayQueue) Peek() interface{} {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\n\treturn q.data[q.front+1]\n}", "title": "" }, { "docid": "834d469310d0e1ee53f115899685f2ad", "score": "0.5938255", "text": "func (f * Queue) dequeue() (*Element) {\n\tif (f.length == 0){\n\t\treturn nil\n\t} else {\n\t\tfirstElmt := f.head\n\t\tf.head = f.head.next\n\t\tf.length--\n\t\treturn firstElmt\n\t}\n}", "title": "" }, { "docid": "625916d22f2d8f77322c32319fb45817", "score": "0.59333235", "text": "func (q *SafeQueue) Pop() *Value {\n\tvar val = q.data[0]\n\tq.data = q.data[1:q.Len()]\n\treturn val\n}", "title": "" }, { "docid": "82d28c0f6937a7140cf17165a11c9107", "score": "0.5932649", "text": "func (queue *ArrayQueue) Peek() int {\n\tif queue.Size() == 0 {\n\t\tpanic(\"No such element\")\n\t}\n\n\treturn queue.Queue[queue.Front]\n}", "title": "" }, { "docid": "9c965080a9f61f87b278f96315e52c64", "score": "0.59312683", "text": "func (q *Queue) PopAt(index int) (interface{}, error) {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\n\tif q.queue == nil {\n\t\tpanic(\"Can't push: queue is uninitialised\")\n\t}\n\tif q.len == 0 {\n\t\treturn nil, fmt.Errorf(\"Can't pop: queue is empty\")\n\t}\n\n\tvar realIndex int\n\tif index < 0 {\n\t\tif -index > q.len {\n\t\t\treturn nil, fmt.Errorf(\"Index (%d) exceeds the length of the queue (%d)\", index, q.len)\n\t\t}\n\t\trealIndex = q.tail + index + 1\n\t} else {\n\t\tif index > q.len {\n\t\t\treturn nil, fmt.Errorf(\"Index (%d) exceeds the length of the queue (%d)\", index, q.len)\n\t\t}\n\t\trealIndex = q.tail - q.len + 1 + index\n\t}\n\n\tvar element interface{}\n\n\theadIndex := q.tail - q.len + 1\n\tif headIndex < 0 {\n\t\theadIndex += q.cap\n\t}\n\n\tif realIndex >= 0 {\n\t\telement = q.queue[realIndex]\n\t\tif realIndex == q.tail {\n\t\t\tq.queue[q.tail] = nil\n\t\t\tq.tail--\n\t\t} else if realIndex == headIndex {\n\t\t\tq.queue[realIndex] = nil\n\t\t} else {\n\t\t\tcopy(q.queue[realIndex:q.tail], q.queue[realIndex+1:q.tail+1])\n\t\t\tq.queue[q.tail] = nil\n\t\t\tq.tail--\n\t\t}\n\t} else {\n\t\trealIndex += q.cap\n\t\telement = q.queue[realIndex]\n\t\tif realIndex == q.tail {\n\t\t\tq.queue[q.tail] = nil\n\t\t\tq.tail--\n\t\t} else if realIndex == headIndex {\n\t\t\tq.queue[realIndex] = nil\n\t\t} else {\n\t\t\tcopy(q.queue[realIndex:q.cap], q.queue[realIndex+1:q.cap+1]) // copy the end of the slice\n\t\t\tq.queue[q.cap-1] = q.queue[0]\n\t\t\tcopy(q.queue[0:q.tail], q.queue[1:q.tail+1]) // copy the start of the slice\n\t\t\tq.queue[q.tail] = nil\n\t\t\tq.tail--\n\t\t}\n\t}\n\n\tif q.tail < 0 {\n\t\tq.tail += q.cap\n\t}\n\tq.len--\n\n\treturn element, nil\n}", "title": "" } ]
d422fa4f9656a3d693177e27cbe8d61c
/ DepartmentsPost creates a new department
[ { "docid": "a9f73f1d15947afb7d85327d2d1838de", "score": "0.74821025", "text": "func (a *Client) DepartmentsPost(params *DepartmentsPostParams, authInfo runtime.ClientAuthInfoWriter) (*DepartmentsPostOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDepartmentsPostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DepartmentsPost\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/departments\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/*+json\", \"application/json\", \"application/json-patch+json\", \"text/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DepartmentsPostReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DepartmentsPostOK), nil\n\n}", "title": "" } ]
[ { "docid": "097e93bfbee71cc02b4b2780bc59c560", "score": "0.69160503", "text": "func apiCreateDepartment(_ *itineris.ApiContext, _ *itineris.ApiAuth, params *itineris.ApiParams) *itineris.ApiResult {\n\tname, err := params.GetParamAsType(\"name\", reddo.TypeString)\n\tif err != nil || name == nil || strings.TrimSpace(name.(string)) == \"\" {\n\t\treturn itineris.NewApiResult(itineris.StatusErrorClient).SetMessage(\"Department must have a name.\")\n\t}\n\tbo := NewBoDepartment().SetName(strings.TrimSpace(name.(string)))\n\tdbResult, err := daoDepartment.Create(bo)\n\tif err != nil || !dbResult {\n\t\treturn itineris.NewApiResult(itineris.StatusErrorServer).SetMessage(\"Error while creating department: \" + err.Error())\n\t}\n\treturn itineris.NewApiResult(itineris.StatusOk).SetData(bo.ToMap())\n}", "title": "" }, { "docid": "e18f8bdd8ecd1cef5fe355901618774f", "score": "0.6383138", "text": "func (DepartmentDAO) Create(tx Transaction, dp *models.Department) error {\n\t_, err := tx.Exec(\"INSERT INTO Department (dept_id,dept_name) VALUES (@p1, @p2)\",\n\t\tdp.DeptID, dp.DeptName)\n\treturn err\n}", "title": "" }, { "docid": "f2d549b08ce8401eb817f6e7ac5f9129", "score": "0.638238", "text": "func (us DeptService) Create(dto dto.DeptCreateDto) model.Department {\n\tparentNode := deptDao.Get(dto.ParentId)\n\n\t// update parent siblings node's lft and rgt\n\t// all parents move right\n\tfor _, d := range deptDao.FindSameLevelParents(parentNode.Rgt) {\n\t\tup := map[string]interface{}{\n\t\t\t\"rgt\": d.Rgt + 2,\n\t\t}\n\t\tif d.Level >= parentNode.Level {\n\t\t\tup[\"lft\"] = d.Lft + 2\n\t\t}\n\t\tdeptDao.Update(&d, up)\n\t}\n\tpath := parentNode.Path + \" / \" + dto.Name\n\tif dto.ParentId == 0 {\n\t\tpath = dto.Name\n\t}\n\tdeptModel := model.Department{\n\t\tName: dto.Name,\n\t\tParentId: dto.ParentId,\n\t\tOrderNum: dto.OrderNum,\n\t\tLft: parentNode.Rgt,\n\t\tRgt: parentNode.Rgt + 1,\n\t\tLevel: parentNode.Level + 1,\n\t\tPath: path,\n\t}\n\tc := deptDao.Create(&deptModel)\n\tif c.Error != nil {\n\t\tlog.Error(c.Error.Error())\n\t}\n\tdeptDao.Update(&parentNode, map[string]interface{}{\n\t\t\"rgt\": parentNode.Rgt + 2,\n\t})\n\treturn deptModel\n}", "title": "" }, { "docid": "0cb8dd9b1ef5a1aa2d50ec9c29bdc279", "score": "0.61779284", "text": "func (m *Department) Create() error {\n\treturn DB().Create(m).Error\n}", "title": "" }, { "docid": "3b325fa42adb5f8684729272ed01c3d0", "score": "0.5933793", "text": "func CreateUnknownDepartment() {\n\tFirstOrCreateDepartment(&UnknownDepartment)\n}", "title": "" }, { "docid": "c90ebe6d9958e099679fc9291d56ea21", "score": "0.58709145", "text": "func CreatePost(c *gin.Context) {\n\t//We init a new Post sruct here\n\tdraft := models.Post{}\n\ttempID := c.Writer.Header().Get(\"user\")\n\n\t//Then Bind the Request to new Post\n\terr := c.ShouldBindJSON(&draft)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, u.Response{Status: false, Message: \"Invalid Request\", Data: []string{}})\n\t\treturn\n\t}\n\n\t//And call the Post-Repository to create Post\n\tpostRepository := post.NewPostRepository(models.GetDB())\n\tresp, statusCode := postRepository.Create(draft, tempID)\n\n\tPostHandler(statusCode, resp, c)\n}", "title": "" }, { "docid": "5313aaea63c0775e44a1cbf1b6ec1e26", "score": "0.5856928", "text": "func (c *Department) Create(db *sql.DB) error {\n\treturn db.QueryRow(`INSERT INTO department (code,name)\n VALUES($1,$2) RETURNING id`, &c.Code, &c.Name).Scan(&c.ID)\n}", "title": "" }, { "docid": "3940286357d45252912ecd172124c19a", "score": "0.5785048", "text": "func (query *dbStore) CreatePost(pt *PostModel) (err error) {\n\tif pt.ProjectID != 0 {\n\t\t_, err = query.db.Query(`INSERT INTO posts(titulo, project_id, fecha, replit, detalle, cuerpo) VALUES ($1,$2,$3,$4,$5,$6)`, pt.Titulo, pt.ProjectID, pt.Fecha, pt.Replit, pt.Detalle, pt.Cuerpo)\n\t} else {\n\t\t_, err = query.db.Query(`INSERT INTO posts(titulo, fecha, replit, detalle, cuerpo) VALUES ($1,$2,$3,$4,$5)`, pt.Titulo, pt.Fecha, pt.Replit, pt.Detalle, pt.Cuerpo)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\trows, err := query.db.Query(`SELECT post_id FROM posts WHERE titulo = $1 AND replit = $2`, pt.Titulo, pt.Replit)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tvar ID int\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&ID); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tfor _, leng := range pt.Lenguajes {\n\t\tln, err := Lenguage.ReadByName(leng.Titulo)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif ln == nil {\n\t\t\tln = &LenguageModel{Titulo: leng.Titulo}\n\t\t\terr = ln.CreateLenguage()\n\t\t}\n\t\t_, err = query.db.Query(`INSERT INTO post_leng(lenguaje_id, post_id) VALUES ($1,$2);`,\n\t\t\tln.ID, ID)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bc981278a6cb86184602040d4b92b73", "score": "0.57030845", "text": "func (strDB *StrDB) PostCreateProvince(c *gin.Context) {\n\tvar (\n\t\tprovince models.Provinces\n\t\tresult gin.H\n\t)\n\n\tif err := c.Bind(&province); err != nil {\n\t\tfmt.Println(\"No Data or something wrong happen!!!\")\n\t} else {\n\t\tstrDB.DB.Create(&province)\n\t\tresult = gin.H{\n\t\t\t\"message\": \"success\",\n\t\t\t\"data\": map[string]interface{}{\n\t\t\t\t\"ID\": province.ID,\n\t\t\t\t\"province\": province.Name,\n\t\t\t\t\"created_at\": province.CreatedAt,\n\t\t\t\t\"update_at\": province.UpdatedAt,\n\t\t\t},\n\t\t}\n\t\tc.JSON(http.StatusOK, result)\n\t}\n}", "title": "" }, { "docid": "12336edba793cb4f0a2642badb266361", "score": "0.56674045", "text": "func (p *PostLogic) CreatePost(obj viewmodels.PostRequest) error {\n\tif _, err := p.DB.Insert(&obj); err != nil {\n\t\treturn fmt.Errorf(\"Failed to create post\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8397a6fe0cb74b0a7d3406b081bf45e", "score": "0.5569328", "text": "func (r *mutationResolver) CreatePost(ctx context.Context, title string, url string) (*model.Post, error) {\n\tpost := entity.Post{\n\t\tTitle: title,\n\t\tURL: url,\n\t\tVotes: 0,\n\t\tCreatedAt: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t}\n\n\tresult := r.DB.Create(&post); \n\terr := result.Error;\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnew_post := model.Post{\n\t\tID: fmt.Sprintf(\"%d\", post.ID),\n\t\tTitle: post.Title,\n\t\tURL: post.URL,\n\t\tVotes: 0,\n\t\tCreatedAt: post.CreatedAt,\n\t}\n\tlog.Printf(\"%#v\\n\", new_post)\n\treturn &new_post, nil\n}", "title": "" }, { "docid": "27f286db312683934b43bb2cfe623393", "score": "0.5506164", "text": "func (s *Service) CreatePost(c *gin.Context) {\n\tvar post api.Post\n\n\tif err := c.Bind(&post); err != nil {\n\t\tc.JSON(400, api.NewError(\"HTTP: 400 Bad Request\"))\n\t\treturn\n\t}\n\n\tpost.Created = int32(time.Now().Unix())\n\n\ts.db.Save(&post)\n\n\tc.JSON(201, post)\n}", "title": "" }, { "docid": "08e4965686218363f750e920e1b1be54", "score": "0.54903245", "text": "func (query *dbStore) CreatePostRelationship(ln *LenguageModel, pt int) (err error) {\n\t_, err = query.db.Query(`INSERT INTO post_leng(lenguaje_id, post_id) VALUES ($1,$2);`, ln.ID, pt)\n\treturn\n}", "title": "" }, { "docid": "54a9288385847834090dd3e5ceeed5a2", "score": "0.5458838", "text": "func TestCreatePost(t *testing.T) {\n\tsuite.Run(t, new(CreatePostSuite))\n}", "title": "" }, { "docid": "43b602065d7a18c624f3d0890d83d118", "score": "0.54532117", "text": "func NewCreateDepartmentReportRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/reports/department\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "6f89aaea04a714d9c5e5fadd8259208b", "score": "0.54486805", "text": "func PostsCreateHandler(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\n}", "title": "" }, { "docid": "7462c391fc78ca0c770213d073c38ec8", "score": "0.54335964", "text": "func (department *Department) Insert() error {\n\tresult, err := Client.Database(util.MongoDBName).Collection(util.BusDBCollectionDepartment).InsertOne(context.TODO(), department)\n\tif err == nil {\n\t\tid, ok := result.InsertedID.(primitive.ObjectID)\n\t\tif !ok {\n\t\t\tglog.Errorf(\"Can't get mongo ID from insert result: %s./n\", result.InsertedID)\n\t\t} else {\n\t\t\tdepartment.ID = id\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cc55af28592768f5b5295a527719f4e5", "score": "0.54253393", "text": "func (*controller) AddPost(resp http.ResponseWriter, req *http.Request) {\n\t//set header\n\tresp.Header().Set(\"Content-type\", \"application/json\")\n\tvar post models.Post\n\n\t//unmarshal json\n\terr := json.NewDecoder(req.Body).Decode(&post)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(`{\"error\" : \"error unmarshal the request\"}`))\n\t\treturn\n\t}\n\n\terr = postService.Validate(&post)\n\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(`{\"error\" : \"error unmarshal the request\"}`))\n\t\treturn\n\t}\n\n\terr1 := postService.Create(&post)\n\n\tif err1 != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tresp.Write([]byte(`{\"error\" : \"error save to db\"}`))\n\t\treturn\n\t}\n\n\t//status ok\n\tresp.WriteHeader(http.StatusOK)\n\tresp.Write([]byte(`{\"message\" : \"save to db success\"}`))\n}", "title": "" }, { "docid": "530aa7ec5ca93214187b6af51ea32c99", "score": "0.54242617", "text": "func CreatePost(w http.ResponseWriter, r *http.Request) {\n\tvar post Post\n\tjson.NewDecoder(r.Body).Decode(&post)\n\tfmt.Println(post)\n\n\tquery, err := db.Prepare(fmt.Sprintf(queries[\"create-post\"], \"$1\", \"$2\"))\n\tcatch(err)\n\n\t_, err = query.Exec(post.Title, post.Content)\n\tcatch(err)\n\tdefer query.Close()\n\n\trespondwithJSON(w, http.StatusCreated, map[string]string{\"message\": \"successfully created\"})\n}", "title": "" }, { "docid": "646de4b70b9b5f7ef2848e6c27c0ab40", "score": "0.542095", "text": "func Departments(w http.ResponseWriter, r *http.Request) (interface{}, int, error) {\n\tdb := context.Get(r, \"storage\").(storage.Storage)\n\tdeps, err := db.GetDepartments()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, http.StatusInternalServerError, err\n\t}\n\treturn &model.DepartmentsResponse{\n\t\tResponse: model.Response{\n\t\t\tMessage: \"success\",\n\t\t\tContentType: \"departments\",\n\t\t},\n\t\tData: deps,\n\t}, http.StatusOK, nil\n}", "title": "" }, { "docid": "e2eb5d5f37e4867a929b950dcba5324e", "score": "0.539163", "text": "func (c *Router) CreatePost(ctx *gin.Context) {\n\n\tvar request CreatePostRequest\n\tif err := ctx.ShouldBindJSON(&request); err != nil {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tp := Post{\n\t\tOwnerID: request.Owner_ID,\n\t\tPost_Type: request.Post_Type,\n\t\tPicture_URL: \"\",\n\t\tTitle: request.Title,\n\t\tBody: request.Body,\n\t\tTime: time.Time{},\n\t\tTimeZone: \"\",\n\t}\n\n\tif result := database.DB().Create(&p); result.Error != nil {\n\t\terrors := result.GetErrors()\n\t\tfor _, err := range errors {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\t// Todo: Do better error handling with json response\n\t\tres := Response{\n\t\t\tSuccess: false,\n\t\t\tObject: nil,\n\t\t\tError: nil,\n\t\t}\n\t\tctx.JSON(http.StatusBadRequest, res)\n\t\treturn\n\t}\n\n\tres := Response{\n\t\tSuccess: true,\n\t\tObject: p,\n\t\tError: nil,\n\t}\n\tctx.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "785a765af7f7dd9bededa699a85641f2", "score": "0.53896236", "text": "func (pt *PostModel) CreatePost() (err error) {\n\terr = Queries.CreatePost(pt)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5fcf8c10193d7f9376aa47fb46cc813", "score": "0.53816414", "text": "func NewCreateDepartmentReportRequest(server string, body CreateDepartmentReportJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateDepartmentReportRequestWithBody(server, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "8912e00d42af3de470ae3330ee804bdd", "score": "0.5376313", "text": "func (a *DitasFrontend) createDep(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tvar request blueprint.Blueprint\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&request); err != nil {\n\t\tlog.WithError(err).Error(\"Error deserializing blueprint\")\n\t\trestfrontend.RespondWithError(w, http.StatusBadRequest, fmt.Sprintf(\"Invalid payload: %s\", err.Error()))\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tif err := a.ValidateRequest(request); err != nil {\n\t\trestfrontend.RespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tdep, err := a.VDCManagerInstance.DeployBlueprint(request)\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Error deploying blueprint\")\n\t\trestfrontend.RespondWithError(w, http.StatusInternalServerError, fmt.Sprintf(\"Error deploying blueprint: %s\", err.Error()))\n\t\treturn\n\t}\n\n\trestfrontend.RespondWithJSON(w, http.StatusCreated, dep)\n\treturn\n\n}", "title": "" }, { "docid": "3f47c4401c528728c5f79ecd0f025e4f", "score": "0.53680015", "text": "func (pg *PGClient) CreatePost(post *model.Post) error {\n\ttx, err := pg.DB.Beginx()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tswitch err {\n\t\tcase nil:\n\t\t\terr = tx.Commit()\n\t\tdefault:\n\t\t\ttx.Rollback()\n\t\t}\n\t}()\n\tpost.Id = chassis.NewID(model.PostTypeIDPrefixes[post.PostType])\n\trows, err := tx.NamedQuery(qCreatePost, post)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif rows.Next() {\n\t\terr = rows.Scan(&post.CreatedAt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "fb3164afaec995f9d4725f1e590c15ee", "score": "0.53646576", "text": "func (c *MainController) NewPost() {\n\tposts, err := c.getAllPosts()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Can not load posts\")\n\t\thttp.Error(c.Ctx.ResponseWriter, err.Error(), http.StatusInternalServerError)\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tif len(posts) == 0 {\n\t\tc.createTestPost(c.Ctx.ResponseWriter)\n\t\tc.Ctx.Redirect(http.StatusOK, \"/\")\n\t\treturn\n\t}\n\n\tids := []string{}\n\tfor _, p := range posts {\n\t\tids = append(ids, p.ID)\n\t}\n\tsort.Strings(ids)\n\tlast := ids[len(ids)-1]\n\tmewID := last + \"1\"\n\tc.createNewPost(c.Ctx.ResponseWriter, mewID)\n}", "title": "" }, { "docid": "af57b9c7cbef4304410b1a1dc0177099", "score": "0.5326613", "text": "func (app *App) CreateAnnouncement(w http.ResponseWriter, r *http.Request) {\n\n\t// Get current user\n\t_, user := app.LoggedIn(r)\n\n\t// Parse the post data\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tapp.ClientError(w, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Model the new announcement on the information from the form\n\tannouncement := &forms.NewAnnouncement{\n\t\tAuthor: user.Username,\n\t\tContent: r.PostForm.Get(\"content\"),\n\t}\n\n\t// Validate the new announcement form\n\t// if !announcement.Valid() {\n\t// \tapp.RenderHTML(w, r, \"newannouncement.page.html\", &HTMLData{Form: announcement})\n\t// \treturn\n\t// }\n\n\tlog.Printf(\"New announcement by %s: %s\", announcement.Author, announcement.Content)\n\n\t// Insert the new announcement\n\t_, err = app.DB.InsertAnnouncement(announcement)\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\t// Direct to home page\n\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "4e80951a3bb783a75117e38e0f88dd2d", "score": "0.5323477", "text": "func (mr *MockServiceMockRecorder) CreateDepartment(data interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateDepartment\", reflect.TypeOf((*MockService)(nil).CreateDepartment), data)\n}", "title": "" }, { "docid": "75fde5a3ad9cc36e95d170f735877077", "score": "0.5312538", "text": "func (c *Client) CreateDeal(locationID, desc, start, end string, days, types []string, allDay bool) (models.Deal, error) {\n\tpath := \"/locations/\" + locationID + \"/deals\"\n\tdata := map[string]interface{}{\n\t\t\"description\": desc,\n\t\t\"start_time\": start,\n\t\t\"end_time\": end,\n\t\t\"all_day\": allDay,\n\t\t\"days\": days,\n\t\t\"types\": types,\n\t}\n\tdeal := models.Deal{}\n\n\tbody, err := c.post(path, data)\n\tif err != nil {\n\t\treturn deal, err\n\t}\n\n\tif err := json.Unmarshal(body, &deal); err != nil {\n\t\tfmt.Println(string(body))\n\t\treturn deal, err\n\t}\n\treturn deal, nil\n}", "title": "" }, { "docid": "d96779437d5551efee840850ea924a61", "score": "0.52789557", "text": "func (p PostHandler) CreatePost(ctx context.Context, params api.CreatePostParams) middleware.Responder {\n\t// fmt.Println(params.HTTPRequest.Header.Get(\"X-API-Key\"))\n\t// validateErr := u.userService.Validate(params.HTTPRequest.Header.Get(\"X-API-Key\"), \"\")\n\t// if validateErr != nil {\n\t// \terr := models.Error{\n\t// \t\tMessage: validateErr.Error(),\n\t// \t}\n\t// \treturn api.NewRegisterUserUnauthorized().WithPayload(&err)\n\t// }\n\tpostRes := &models.PostResponse{}\n\tpostStatus, err := p.postService.CreatePost(params.PostBody)\n\n\tfmt.Println(\"postStatus:\", *postStatus)\n\tif err != nil {\n\t\tpostErr := models.Response{\n\t\t\tCode: 400,\n\t\t\tStatus: \"Failed\",\n\t\t\tMessage: err.Error(),\n\t\t}\n\t\tlogrus.Warnf(postErr.Message)\n\t\treturn api.NewCreatePostBadRequest().WithPayload(&postErr)\n\t}\n\tlogrus.Infoln(\"The post has been created in the DB:\", *postStatus)\n\n\tpostRes.Response = &models.Response{\n\t\tCode: 200,\n\t\tStatus: \"Success\",\n\t\tMessage: \"Post Created Successfully\",\n\t}\n\tparams.PostBody.ID = *postStatus\n\tpostRes.Post = params.PostBody\n\treturn api.NewCreatePostOK().WithPayload(postRes)\n}", "title": "" }, { "docid": "44cbe2834de1ef30ad087b2ac5c9a65b", "score": "0.5255776", "text": "func NewGroupPost(c *Context, w http.ResponseWriter, r *http.Request) error {\n\t// Check permissions\n\tif !c.User.IsAdmin() {\n\t\treturn ErrPermissionDenied.Here()\n\t}\n\t// Handle the request\n\tdata := newGroupPageData{User: c.User, CSRFField: csrf.TemplateField(r)}\n\tform := newFormNewGroup(r)\n\terr := user.AddGroup(c.Tx, form.Name, form.Description)\n\tif err != nil {\n\t\tdata.Form = form // Show current form values along with error\n\t\t//data.ErrorMessage = merry.UserMessage(err)\n\t\tdata.ErrorMessage = merry.Details(err)\n\t\tRender(w, \"group_new.html\", data)\n\t\treturn nil\n\t}\n\n\t// New group created successfully, redirect them to the list page?\n\tmsg := fmt.Sprintf(\"Group %s successfully created.\", form.Name)\n\tc.AddNormalFlash(msg)\n\thttp.Redirect(w, r, \"/groups\", 302)\n\treturn nil\n}", "title": "" }, { "docid": "d1d256cee3f27eaa65e0ec66c2b7239e", "score": "0.524566", "text": "func (m *MockService) CreateDepartment(data model.DepartmentInterface) (*model.Department, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateDepartment\", data)\n\tret0, _ := ret[0].(*model.Department)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "71289bf6a77c03e8df870bd3af6293ee", "score": "0.52379996", "text": "func PostArticle(w http.ResponseWriter, r *http.Request) {\r\n\ttitle := r.FormValue(\"Title\")\r\n\tcontent := r.FormValue(\"Content\")\r\n\tsubtitle := r.FormValue(\"Subtitle\")\r\n\r\n\tArticles = append(Articles, Article{Title: title, Content: content})\r\n\tInsertPost(title, subtitle, content)\r\n\tfmt.Fprintf(w, title)\r\n}", "title": "" }, { "docid": "b097c3bb9529c5617cee238901f36254", "score": "0.52218646", "text": "func PostCreateProjectHandler(w http.ResponseWriter, r *http.Request, t *jwt.Token) {\n\tc := NewCommunicator(w)\n\tvar p Project\n\tname, url, tldr := r.FormValue(\"name\"), r.FormValue(\"url\"), r.FormValue(\"tldr\")\n\tid, ok := t.Claims[\"User\"].(string)\n\n\tif !ok {\n\t\tc.Error(\"Unable to correctly marshal that id!\")\n\t\treturn\n\t}\n\n\tif err := models.Restore(&p, bson.M{\"url\": url}); err == nil {\n\t\tc.Fail(\"That project already exists!\")\n\t\treturn\n\t}\n\n\tif !bson.IsObjectIdHex(id) {\n\t\tc.Fail(\"That is not a recognized bson.ObjectID\")\n\t\treturn\n\t}\n\n\tlang, err := GetOrCreateLanguage(r.FormValue(\"lang\"))\n\tfmt.Println(lang, r.FormValue(\"lang\"))\n\tif err != nil {\n\t\tc.Error(\"Unable to create that language...\")\n\t}\n\n\tp = Project{ID: bson.NewObjectId(), Owner: bson.ObjectIdHex(id), Name: name, URL: url, TLDR: tldr, Language: lang, Time: time.Now()}\n\tif err := models.Persist(p); err != nil {\n\t\tc.Error(\"Error persisting that new project!\")\n\t\treturn\n\t}\n\n\tc.OKWithData(\"Here is your user!\", p)\n}", "title": "" }, { "docid": "2424d3b575a63a07b47600ab35ff518c", "score": "0.5206447", "text": "func NewPost() Post {\n\treturn Post{}\n}", "title": "" }, { "docid": "1462a54d406bd3e1d9f6e4c65f6bf76c", "score": "0.51891047", "text": "func (c *Client) CreatePost(post *Post) (*Post, error) {\n\tif c.token == nil {\n\t\terr := c.auth()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed authentication\")\n\t\t}\n\t}\n\n\tu := *c.baseURL\n\tu.Path = path.Join(u.Path, \"ghost\", \"api\", \"v0.1\", \"posts\")\n\n\tb := &bytes.Buffer{}\n\tbr := Payload{\n\t\tPosts: []Post{*post},\n\t}\n\terr := json.NewEncoder(b).Encode(br)\n\n\treq, err := http.NewRequest(http.MethodPost, u.String(), b)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed creating request\")\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.token.accessToken)\n\n\tc.log.Debugf(\"auth: querying %s\", u.String())\n\tres, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed making request \")\n\t}\n\tdefer res.Body.Close()\n\n\tif !validStatusCode(res.StatusCode) {\n\t\treturn nil, fmt.Errorf(\"invalid status code: %s\", res.Status)\n\t}\n\n\tdata := Payload{}\n\terr = json.NewDecoder(res.Body).Decode(&data)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed decoding response\")\n\t}\n\n\tif len(data.Errors) > 0 {\n\t\treturn nil, fmt.Errorf(\"message: %s context: %s\", data.Errors[0].Message, data.Errors[0].Context)\n\t}\n\n\treturn &data.Posts[0], nil\n}", "title": "" }, { "docid": "52ef4702095f603c6810537e54128466", "score": "0.51516914", "text": "func Post(w http.ResponseWriter, r *http.Request) {\n\tvar errs []string\n\tvar gocqlUUID gocql.UUID\n\n\t// FormToPipeline() is included in Pipelines/processing.go\n\tpipeline, errs := FormToPipeline(r)\n\n\t// have we created a pipeline correctly\n\tvar created = false\n\n\t// if we had no errors from FormToPipeline, we will\n\t// attempt to save our data to Cassandra\n\tif len(errs) == 0 {\n\t\tfmt.Println(\"creating a new pipeline\")\n\n\t\t// generate a unique UUID for this pipeline\n\t\tgocqlUUID = gocql.TimeUUID()\n\n\t\t// write data to Cassandra\n\t\tif err := Cassandra.Session.Query(`\n INSERT INTO pipelines (id, name, description) VALUES (?, ?, ?)`,\n\t\t\tgocqlUUID, pipeline.Name, pipeline.Description).Exec(); err != nil {\n\t\t\terrs = append(errs, err.Error())\n\t\t} else {\n\t\t\tcreated = true\n\t\t}\n\t}\n\n\t// depending on whether we created the pipeline, return the\n\t// resource ID in a JSON payload, or return our errors\n\tif created {\n\t\tfmt.Println(\"pipeline_id\", gocqlUUID)\n\t\tjson.NewEncoder(w).Encode(NewPipelineResponse{ID: gocqlUUID})\n\t} else {\n\t\tfmt.Println(\"errors\", errs)\n\t\tjson.NewEncoder(w).Encode(ErrorResponse{Errors: errs})\n\t}\n}", "title": "" }, { "docid": "907e01d65fd886b703bf9d866ca95019", "score": "0.51432264", "text": "func (c *Controller) CtrPostPost(w http.ResponseWriter, r *http.Request, opt router.URLOptions, sm session.ISessionManager, s store.IStore) {\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tc.HandleErrorResponse(w, \"error reading request body\")\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tvar newPost post.Post\n\n\terr = json.Unmarshal(requestBody, &newPost)\n\tif err != nil {\n\t\tc.HandleErrorResponse(w, err.Error())\n\t\treturn\n\t}\n\n\terr = c.PostUsecases.Add(newPost)\n\n\tif err != nil {\n\t\tc.HandleErrorResponse(w, \"error adding new post\")\n\t}\n}", "title": "" }, { "docid": "88052a588ebf17c7a59515da64ae9779", "score": "0.5124386", "text": "func (a *Client) PurchaseOrderDeviationPost(params *PurchaseOrderDeviationPostParams, authInfo runtime.ClientAuthInfoWriter) (*PurchaseOrderDeviationPostCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPurchaseOrderDeviationPostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PurchaseOrderDeviation_post\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/purchaseOrder/deviation\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json; charset=utf-8\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PurchaseOrderDeviationPostReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PurchaseOrderDeviationPostCreated)\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 PurchaseOrderDeviation_post: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "7047213dc576c0c4a870c0af26b6c675", "score": "0.5117288", "text": "func CreatePost(post *protocol.PostOperation) error {\n\t// use lib https://github.com/extemporalgenome/slug\n\tslugTitle := slug.Slug(post.Title)\n\n\tf := createFile(config.GlogchainConfigGlobal.HugoPostPath + slugTitle + \".md\")\n\n\tdefer f.Close()\n\n\tfmt.Fprintln(f, \"+++\")\n\tfmt.Fprintln(f, \"title = \\\"\" + post.Title + \"\\\"\")\n\tfmt.Fprintln(f, \"draft = true\")\n\tfmt.Fprintln(f, \"date = \\\"2016-10-22T12:50:18+07:00\\\"\")\n\tfmt.Fprintln(f, \"\")\n\tfmt.Fprintln(f, \"+++\")\n\tfmt.Fprintln(f, \"\")\n\tfmt.Fprintln(f, post.Body)\n\n\treturn nil\n}", "title": "" }, { "docid": "b11b7e8dad9262503a9eb93f190098f9", "score": "0.5111401", "text": "func AptPOST(w http.ResponseWriter, r *http.Request) {\n var apt model.Aparta\n\tsess := model.Instance(r)\n action := r.FormValue(\"action\")\n if ! (strings.Compare(action,\"Cancelar\") == 0) {\n\t if validate, missingField := view.Validate(r, []string{\"codigo\"}); !validate {\n sess.AddFlash(view.Flash{\"Falta Campo: \" + missingField, view.FlashError})\n sess.Save(r, w)\n AptGET(w, r)\n return\n\t }\n apt.Codigo = r.FormValue(\"codigo\")\n apt.Descripcion = r.FormValue(\"descripcion\")\n err := (&apt).AptByCode()\n if err == model.ErrNoResult { // Exito: no hay apartamento creado aun \n ex := (&apt).AptCreate()\n\t if ex != nil { // uyy como fue esto ? \n log.Println(ex)\n sess.AddFlash(view.Flash{\"Error guardando.\", view.FlashError})\n return\n\t } else { // todo bien\n sess.AddFlash(view.Flash{\"Apto. creado: \" +apt.Codigo, view.FlashSuccess})\n\t }\n }\n }\n sess.Save(r, w)\n\t http.Redirect(w, r, \"/apto/list\", http.StatusFound)\n }", "title": "" }, { "docid": "5567fbdfc7b7d5f114b7b4c9ee7baffa", "score": "0.5108027", "text": "func (a *Client) DepartmentsGet(params *DepartmentsGetParams, authInfo runtime.ClientAuthInfoWriter) (*DepartmentsGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDepartmentsGetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DepartmentsGet\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/departments\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DepartmentsGetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DepartmentsGetOK), nil\n\n}", "title": "" }, { "docid": "4da0a3feac14f4f8b483230206c95a29", "score": "0.5107809", "text": "func (v PostsResource) Create(c buffalo.Context) error {\n\t// Search for current logged in user\n\t// Get the DB connection from the context\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\t// Allocate an empty User\n\t// Allocate an empty Post\n\tpost := &models.Post{UserID: c.Value(\"current_user_id\").(uuid.UUID)}\n\t// Bind post to the html form elements\n\terr := c.Bind(post)\n\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Get the DB connection from the context\n\t//tx := c.Value(\"tx\").(*pop.Connection)\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(post)\n\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make post available inside the html template\n\t\tc.Set(\"post\", post)\n\t\t// Make the errors available inside the html template\n\t\tc.Set(\"errors\", verrs)\n\t\t// Render again the new.html template that the user can\n\t\t// correct the input.\n\t\treturn c.Render(422, r.HTML(\"posts/new.html\"))\n\t}\n\t// If there are no errors set a success message\n\tc.Flash().Add(\"success\", \"Post was created successfully\")\n\t// and redirect to the posts index page\n\treturn c.Redirect(302, \"/posts/%s\", post.ID)\n}", "title": "" }, { "docid": "e4314fbe51bb17b55b8bd1e906974a88", "score": "0.5089786", "text": "func (h *Handler) Post(c echo.Context) error {\n\n\tctx := c.Request().Context()\n\n\tvar body model.Team\n\terr := c.Bind(&body)\n\tif err != nil {\n\t\treturn api.ResponseUnprocessableEntity(c, \"invalid body\")\n\t}\n\n\tif len(body.Name) <= 0 {\n\t\treturn api.ResponseBadRequest(c, \"name cannot be empty\")\n\t}\n\tif len(body.Location) <= 0 {\n\t\treturn api.ResponseBadRequest(c, \"location cannot be empty\")\n\t}\n\n\tfor _, p := range body.Players {\n\t\tif len(p.Name) <= 0 {\n\t\t\treturn api.ResponseBadRequest(c, \"player name cannot be empty\")\n\t\t}\n\t\tif len(p.Position) <= 0 {\n\t\t\treturn api.ResponseBadRequest(c, \"player position cannot be empty\")\n\t\t}\n\t}\n\n\tres, err := h.teamRepo.CreateTeam(ctx, body)\n\tif err != nil {\n\t\treturn api.ResponseError(c, err)\n\t}\n\n\treturn api.ResponseCreated(c, res)\n}", "title": "" }, { "docid": "c79781a9bcdb595d238980ae28a9002f", "score": "0.5083243", "text": "func newDepartmentMutation(c config, op Op, opts ...departmentOption) *DepartmentMutation {\n\tm := &DepartmentMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeDepartment,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3ef01f4e79bf1a03bd9fa77ec0f93f89", "score": "0.5073912", "text": "func (m *Department) Save() error {\n\treturn DB().Save(m).Error\n}", "title": "" }, { "docid": "4c770d9032813ccac022565897a424f8", "score": "0.5071683", "text": "func ScheduleCreatePOST(c *gin.Context) {\n\n}", "title": "" }, { "docid": "2597fb3e8a08d725773b03a7f26a1e0d", "score": "0.50699985", "text": "func CreatePost(w http.ResponseWriter, r *http.Request) {\n\tvar post Post\n\tjson.NewDecoder(r.Body).Decode(&post)\n\n\tquery, err := db.Prepare(\"Insert posts Set title=?,content=?\")\n\tcatch(err)\n\n\t_, er := query.Exec(post.Title, post.Content)\n\tcatch(er)\n\n\tdefer query.Close()\n\trespondwithJSON(w, http.StatusCreated, map[string]string{\"message\": \"succesfully created\"})\n}", "title": "" }, { "docid": "3baf87c008b4eceaecde9c70f944560e", "score": "0.50498575", "text": "func (h *GuestListHandler) Post(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tname := vars[\"name\"]\n\n\tg, err := data.ParseRequestGuest(r)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\trespondWithError(err, http.StatusInternalServerError, w)\n\t\treturn\n\t}\n\tg.Name = name\n\n\tresult, err := model.AddGuest(g)\n\tif err != nil{\n\t\tlog.Println(err)\n\t\trespondWithError(err, http.StatusBadRequest, w)\n\t\treturn\n\t}\n\tencodeResponseAsJSON(result, http.StatusCreated, w)\n}", "title": "" }, { "docid": "b56493a281bd549ea7d3b7ce0ea216c2", "score": "0.50378734", "text": "func CreatePost(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tvar post model.Post\r\n\tpost.TimeStamp = time.Now()\r\n\r\n\t_ = json.NewDecoder(r.Body).Decode(&post)\r\n\tresult, err := collection_2.InsertOne(context.TODO(), &post)\r\n\r\n\tif err != nil {\r\n\t\tw.WriteHeader(http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tjson.NewEncoder(w).Encode(result)\r\n}", "title": "" }, { "docid": "04a2d910a9e82035fdbf20355b8589a8", "score": "0.5035677", "text": "func (a *Client) EmployeePost(params *EmployeePostParams, authInfo runtime.ClientAuthInfoWriter) (*EmployeePostCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewEmployeePostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Employee_post\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/employee\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json; charset=utf-8\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &EmployeePostReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*EmployeePostCreated)\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 Employee_post: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "83f4ff8bd1ef04d63cff057d1733e93c", "score": "0.5035069", "text": "func (a *BudgetApiService) CreateBudgetUsingPost(ctx context.Context, budgetRequest Budget) (Budget, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Budget\n\t)\n\n\t// create path and map variables\n\ta.client = NewAPIClient(&Configuration{\n\t\tBasePath: ctx.Value(\"BasePath\").(string),\n\t\tDefaultHeader: make(map[string]string),\n\t\tUserAgent: \"Swagger-Codegen/1.0.0/go\",\n\t})\n\tlocalVarPath := a.client.cfg.BasePath + \"/nucleus/v1/budget\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"*/*\"}\n\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 = &budgetRequest\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\treturn localVarReturnValue, localVarHttpResponse, err\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 Budget\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "a49947fd0a5dc942e51a96124a3d8a14", "score": "0.5030612", "text": "func (s *FakeStorage) adddepart(id int, name string) model.Department {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.department[name] = model.Department{id, name}\n\treturn s.department[name]\n}", "title": "" }, { "docid": "45cd574792c94986eb2f38ab3923c7b8", "score": "0.5028591", "text": "func (a *DitasFrontend) createDep(w http.ResponseWriter, r *http.Request) {\n\tvar request CreateDeploymentRequest\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&request); err != nil {\n\t\tlog.WithError(err).Error(\"Error deserializing deployment\")\n\t\trestfrontend.RespondWithError(w, http.StatusBadRequest, fmt.Sprintf(\"Invalid payload: %s\", err.Error()))\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\terr := a.VDCManagerInstance.DeployBlueprint(request)\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Error deploying blueprint\")\n\t\trestfrontend.RespondWithError(w, http.StatusInternalServerError, fmt.Sprintf(\"Error deploying blueprint: %s\", err.Error()))\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "adb875e685fea57686cfbb01bc469ac6", "score": "0.50100875", "text": "func postTeam(context echo.Context) error {\n\tteamCreation := new(TeamCreation)\n\n\tif jsonError := context.Bind(teamCreation); jsonError != nil {\n\t\treturn jsonError\n\t} else if teamCreation.isValid() {\n\t\tteam, databaseError := saveTeam(teamCreation)\n\n\t\tif databaseError != nil {\n\t\t\treturn databaseError\n\t\t} else {\n\t\t\treturn context.JSON(http.StatusCreated, team)\n\t\t}\n\t} else {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Name field, email cron field or user id field was empty!\")\n\t}\n}", "title": "" }, { "docid": "cade6ba59d0c066eb58e8b2d527c2c2e", "score": "0.50048316", "text": "func (trc *TriageResultCreate) SetDepartmentID(id int) *TriageResultCreate {\n\ttrc.mutation.SetDepartmentID(id)\n\treturn trc\n}", "title": "" }, { "docid": "72868bbe36d9a96fcdcf30ac1d9486ef", "score": "0.4987197", "text": "func (c *Client) CreatePost(ctx context.Context, r CreatePostRequest) (*CreatePostResponse, error) {\n\treq := c.createRequest(`\n\tmutation($title:String!, $contents:JSON!) {\n\t\tcreatePost(data: {\n\t\t\ttitle: $title,\n\t\t\tsubmitToFrontpage: true,\n\t\t\tdraft: true,\n\t\t\tmeta: false,\n\t\t\tisEvent: false,\n\t\t\ttypes: [],\n\t\t\tmoderationStyle: \"easy-going\",\n\t\t\tcontents: $contents,\n\t\t}) {\n\t\t\tdata {\n\t\t\t\tlinkUrl,\n\t\t\t}\n\t\t}\n\t}`)\n\n\t// The \"contents\" field below above is a raw JSON blob, so we have to make the whole thing a variable\n\tcontents := postContents{\n\t\tUpdateType: \"minor\",\n\t\tOriginalContents: postOriginalContents{\n\t\t\tType: \"markdown\",\n\t\t\tData: r.Content,\n\t\t},\n\t}\n\n\treq.Var(\"contents\", contents)\n\treq.Var(\"title\", r.Title)\n\n\t// run it and capture the response\n\tvar res createPostContainer\n\tif err := c.graphql.Run(ctx, req, &res); err != nil {\n\t\treturn nil, fmt.Errorf(\"error performing graphql query: %w\", err)\n\t}\n\treturn res.CreatePost.Data, nil\n}", "title": "" }, { "docid": "1157ceba035d11ba0af75a535971164e", "score": "0.49780223", "text": "func Post(data interface{}) error {\n\tLogger.Trace(constants.LogBeginFunc)\n\n\tSqliteInstance.AutoMigrate(data)\n\tLogger.Debug(\"Persisting new record : \", &data)\n\tresult := SqliteInstance.Create(data)\n\n\terr := result.Error\n\tif err != nil {\n\t\tLogger.Warn(err.Error(), err)\n\t\treturn result.Error\n\t}\n\n\tLogger.Trace(constants.LogFinishFunc)\n\treturn nil\n}", "title": "" }, { "docid": "296743f948d4620130a0102d027130ea", "score": "0.49681312", "text": "func AptUpPOST(w http.ResponseWriter, r *http.Request) {\n var apt , a2 model.Aparta\n\tsess := model.Instance(r)\n var params httprouter.Params\n\tparams = context.Get(r, \"params\").(httprouter.Params)\n\tSId := params.ByName(\"id\")\n Id,_ := atoi32(SId)\n apt.Id = Id\n\ta2.Id = Id\n path := \"/apto/list\"\n action := r.FormValue(\"action\")\n if ! (strings.Compare(action,\"Cancelar\") == 0) {\n err := (&apt).AptById()\n\t if err != nil{\n log.Println(err)\n sess.AddFlash(view.Flash{\"Error No Apto\", view.FlashError})\n\t }\n a2.Codigo = r.FormValue(\"codigo\")\n a2.Descripcion = r.FormValue(\"descripcion\")\n st := getAptFormUp(apt, a2, r)\n if len(st) == 0{\n sess.AddFlash(view.Flash{\"No hay actualizacion solicitada\", view.FlashSuccess})\n } else {\n err = apt.AptUpdate(st)\n if err == nil{\n sess.AddFlash(view.Flash{\"Apto actualizado exitosamente para: \" +apt.Codigo, view.FlashSuccess})\n } else {\n\t\tlog.Println(err)\n\t\tsess.AddFlash(view.Flash{\"Un error ocurrio actualizando.\", view.FlashError})\n\t }\n\t\tsess.Save(r, w)\n }\n\t}\n\thttp.Redirect(w, r, path, http.StatusFound)\n }", "title": "" }, { "docid": "346a398f56fe39aaf7e4c365046068aa", "score": "0.49586737", "text": "func (user *User) CreatePost(conv Thread, body string) (post Post, err error) {\n\tsql, err := readSqlFile(\"data/sql/insert_post.sql\")\n\tif err != nil {\n\t\treturn\n\t}\n\tstmt, err := Db.Prepare(sql)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\terr = stmt.QueryRow(createUUID(), body, user.Id, conv.Id, time.Now()).\n\t\tScan(&post.Id, &post.Uuid, &post.Body, &post.UserId, &post.ThreadId, &post.CreatedAt)\n\treturn\n}", "title": "" }, { "docid": "a23dc3363b2e0e535cad8621e2cb6ae8", "score": "0.4940277", "text": "func PostCreated(ctx context.Context, e FirestoreEvent) error {\n\tfullPath := strings.Split(e.Value.Name, \"/documents/\")[1]\n\tpathParts := strings.Split(fullPath, \"/\")\n\t//collection := pathParts[0]\n\tuid := strings.Join(pathParts[1:2], \"/\")\n\tpostid := strings.Join(pathParts[3:], \"/\")\n\tlog.Print(\"uid: \", uid)\n\tlog.Print(\"postid: \", postid)\n\tlog.Printf(\"event fields: %v\", e.Value.Fields)\n\n\tuDoc, err := fstore.Collection(\"user\").Doc(uid).Get(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tuser := &usermodel.User{}\n\terr = uDoc.DataTo(user)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar images []string\n\tfor i := 0; i < len(e.Value.Fields.Images.ArrayValue.Values); i++ {\n\t\timage := e.Value.Fields.Images.ArrayValue.Values[i]\n\t\timages = append(images, image.StringValue)\n\t}\n\tif err != nil {\n\t\tlog.Printf(\"error converting lieks: %v\", err)\n\t}\n\tpostE := postedition.PostEdition{\n\t\tBody: e.Value.Fields.Body.StringValue,\n\t\tTitle: e.Value.Fields.Title.StringValue,\n\t\tSubtitle: e.Value.Fields.Subtitle.StringValue,\n\t\tHasattach: e.Value.Fields.Hasattach.BooleanValue,\n\n\t\tImages: images,\n\t}\n\tlog.Println(postE)\n\tpostPub := CretePostPubfromPostEdition(postE, *user)\n\t_, _, err = fstore.Collection(\"posts\").Doc(user.UID).Collection(\"post\").Add(ctx, postPub)\n\tif err != nil {\n\t\tlog.Println(\"error while adding document in firebase\")\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tfstore.Collection(\"feedline\").Doc(uid).Collection(\"post\").Doc(pathParts[3]).Set(ctx, postPub)\n\tsubsciter := fstore.Collection(\"user\").Doc(user.UID).Collection(\"subscribers\").Documents(ctx)\n\tfor {\n\t\tsubDoc, err := subsciter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while iterating sub: \", err)\n\t\t\tbreak\n\t\t}\n\t\tsub := &usermodel.SubModel{}\n\t\terr = subDoc.DataTo(sub)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while marshaling request into sub: \", err)\n\t\t\tbreak\n\t\t}\n\t\tsuid := sub.UID\n\t\tlog.Printf(\"Subscriber: %v\", suid)\n\t\tlog.Printf(\"Documents: %v\", e.Value.Fields)\n\t\tfstore.Collection(\"feedline\").Doc(suid).Collection(\"post\").Doc(pathParts[3]).Set(ctx, postPub)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "83134aa1136ab2e5806d519cc5543608", "score": "0.49304825", "text": "func (dc *DiagnoseCreate) SetDepartmentID(id int) *DiagnoseCreate {\n\tdc.mutation.SetDepartmentID(id)\n\treturn dc\n}", "title": "" }, { "docid": "4ab28c0be78f502ea79f2447a8789827", "score": "0.49209866", "text": "func (s *Service) CreatePost(\n\tctx context.Context,\n\tcontent string,\n\tspoilerOf *string,\n\tnsfw bool,\n) (TimelineItem, error) {\n\tvar ti TimelineItem\n\tuid, ok := ctx.Value(KeyAuthUserID).(int64)\n\tif !ok {\n\t\treturn ti, ErrUnauthenticated\n\t}\n\n\tcontent = strings.TrimSpace(content)\n\tif content == \"\" || len([]rune(content)) > 480 {\n\t\treturn ti, ErrInvalidContent\n\t}\n\n\tif spoilerOf != nil {\n\t\t*spoilerOf = strings.TrimSpace(*spoilerOf)\n\t\tif *spoilerOf == \"\" || len([]rune(*spoilerOf)) > 64 {\n\t\t\treturn ti, ErrInvalidSpoiler\n\t\t}\n\t}\n\n\ttx, err := s.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn ti, fmt.Errorf(\"could not begin tx: %v\", err)\n\t}\n\tdefer tx.Rollback()\n\n\tquery := \"INSERT INTO posts (user_id, content, spoiler_of, nsfw) VALUES($1, $2, $3, $4) \" +\n\t\t\"RETURNING id, created_at\"\n\tif err = tx.QueryRowContext(ctx, query, uid, content, spoilerOf, nsfw).\n\t\tScan(&ti.Post.ID, &ti.Post.CreatedAt); err != nil {\n\t\treturn ti, fmt.Errorf(\"could not insert post: %v\", err)\n\t}\n\n\tti.Post.UserID = uid\n\tti.Post.Content = content\n\tti.Post.SpoilerOf = spoilerOf\n\tti.Post.NSFW = nsfw\n\tti.Post.Mine = true\n\n\tquery = \"INSERT INTO post_subscriptions(user_id, post_id) VALUES($1, $2)\"\n\tif _, err = tx.ExecContext(ctx, query, uid, ti.Post.ID); err != nil {\n\t\treturn ti, fmt.Errorf(\"could not insert post subscription: %v\", err)\n\t}\n\tti.Post.Subscribed = true\n\n\tquery = \"INSERT INTO timeline (user_id, post_id) VALUES ($1, $2) RETURNING id\"\n\tif err = tx.QueryRowContext(ctx, query, uid, ti.Post.ID).Scan(&ti.ID); err != nil {\n\t\treturn ti, fmt.Errorf(\"could not insert timeline item: %v\", err)\n\t}\n\n\tti.UserID = uid\n\tti.PostID = ti.Post.ID\n\n\tif err = tx.Commit(); err != nil {\n\t\treturn ti, fmt.Errorf(\"could not commit to create post: %v\", err)\n\t}\n\n\tgo func(p Post) {\n\t\tu, err := s.userByID(context.Background(), p.UserID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"could not get post user: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tp.User = &u\n\t\tp.Mine = false\n\t\tp.Subscribed = false\n\n\t\ttt, err := s.fanoutPost(p)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"could not fanout post: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, ti = range tt {\n\t\t\tlog.Println(litter.Sdump(ti))\n\t\t\t// TODO: broadcast timeline items.\n\t\t}\n\n\t}(ti.Post)\n\n\treturn ti, nil\n}", "title": "" }, { "docid": "7ba5081d248145937eab308519be6fdc", "score": "0.49184623", "text": "func (u PostService) Create(ctx context.Context, Text * string, MediaType * tweet.MediaType) (* domain.Post, error) {\n\temail, err := u.Auth.GetEmail(ctx)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\n\n\tuserInstance, err := user.Api.GetByEmail(ctx, email)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\n\tid, err := u.Repo.GetNewId()\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\ttweetInstance, err := tweet.Api.Create(Text, MediaType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\n\tcurrTime := time.Now().Unix()\n\tpost, err := domain.NewPost(id, userInstance.Id, tweetInstance.Id, []string{}, []string{}, &currTime)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\t_, err = u.Repo.Save(post)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tisReversal := false\n\tpe := &domain.PostEvent{PostId: post.Id, EventType: domain.PostCreated, MadeByUserId: userInstance.Id, MadeAt: &currTime, IsReversal: &isReversal}\n\terr = u.Repo.SaveOrDeleteEvent(pe)\n\treturn post, err\n}", "title": "" }, { "docid": "4d9889c681dd824f658efdde4e65be32", "score": "0.4911556", "text": "func CreateExpense(w http.ResponseWriter, r *http.Request) {\r\n\tsetAccessControlHeaders(w)\r\n\tvar expense models.Expense\r\n\t_ = json.NewDecoder(r.Body).Decode(&expense)\r\n\r\n\tif len(expense.Name) == 0 || expense.Amount <= 0 {\r\n\t\tw.WriteHeader(http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tid, err := insertExpense(expense)\r\n\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t\tfmt.Println(err)\r\n\t\tw.WriteHeader(http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\tif id != \"\" {\r\n\t\tw.Header().Set(\"Location\", r.RequestURI+\"/\"+id)\r\n\t\tw.WriteHeader(http.StatusCreated)\r\n\t\tfmt.Println(\"Location\", r.RequestURI+\"/\"+id)\r\n\t} else {\r\n\t\tw.WriteHeader(http.StatusInternalServerError)\r\n\t}\r\n}", "title": "" }, { "docid": "26b38956c1325c47bed36b5f29dacfc4", "score": "0.49070057", "text": "func (d *DAO) createPost(userID uuid.UUID, p Post) (Post, error) {\n\tp.ID = uuid.Must(uuid.NewV4())\n\tp.Date = time.Now()\n\n\t_, err := d.db.Exec(\n\t\t`INSERT INTO showcash.post(\n\t\t\tuser_id,\n\t\t\tid,\n\t\t\ttitle,\n\t\t\timageuri,\n\t\t\tdate\n\t\t) VALUES (\n\t\t\t$1, $2, $3, $4, $5\n\t\t)`, userID, p.ID, p.Title, p.ImageURI, p.Date)\n\tif err != nil {\n\t\treturn Post{}, err\n\t}\n\n\t// Note: need for items here\n\treturn p, err\n}", "title": "" }, { "docid": "6091232f6814d2057da5bb14b9ab05db", "score": "0.4891424", "text": "func (s *RESTPublisher) CreateDraft(createDraftRequest *PublishStepRequest) (*PublishStepResponse, error) {\n\tlog.Debug(\"Creating draft\")\n\n\tb, err := json.Marshal(createDraftRequest)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to marshal create draft request\")\n\t}\n\n\treq, err := http.NewRequest(\"POST\", s.generateURL(\"api\", \"publish\"), bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to create request\")\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := s.stepsClient.Do(req)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to make request\")\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\trespBody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Unable to read response body\")\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\te := fmt.Sprintf(\"Received error: %d: %s\", resp.StatusCode, string(respBody))\n\t\tlog.Errorf(e)\n\t\treturn nil, errors.New(e)\n\t}\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to read response body\")\n\t}\n\tdefer resp.Body.Close()\n\n\tvar createDraftResponse PublishStepResponse\n\terr = json.Unmarshal(respBody, &createDraftResponse)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Unable to unmarshal response body\")\n\t}\n\n\treturn &createDraftResponse, nil\n}", "title": "" }, { "docid": "74b9f4cb9e5ea81818f7f76dee2fd064", "score": "0.4881087", "text": "func (sc *ScheduleCreate) SetDepartmentID(id int) *ScheduleCreate {\n\tsc.mutation.SetDepartmentID(id)\n\treturn sc\n}", "title": "" }, { "docid": "ebabde75731463493c392e827b968ada", "score": "0.48744267", "text": "func (trc *TriageResultCreate) SetDepartment(d *Department) *TriageResultCreate {\n\treturn trc.SetDepartmentID(d.ID)\n}", "title": "" }, { "docid": "bc457bc51c341a319bb7fa8cf5ae93d8", "score": "0.48694032", "text": "func (c *Department) Validate() error {\n\tif c.Code == 0 {\n\t\treturn errors.New(\"Champ code incorrect\")\n\t}\n\tif c.Name == \"\" {\n\t\treturn errors.New(\"Champ name incorrect\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25eecd084e06f7bcea3256f3c52b89a1", "score": "0.4869197", "text": "func (sc *ScheduleCreate) SetDepartment(d *Department) *ScheduleCreate {\n\treturn sc.SetDepartmentID(d.ID)\n}", "title": "" }, { "docid": "6d9e82ba4055f819ce5a88703bc65ac6", "score": "0.48604512", "text": "func (*service) Create(post *entity.Post) (*entity.Post, error) {\n\n\tpost.ID = rand.Int63()\n\treturn repo.Save(post)\n}", "title": "" }, { "docid": "c0ddb327951d22bcd6411d4daae7d294", "score": "0.48584467", "text": "func CreateExpense(w http.ResponseWriter, r *http.Request) {\n\n\tvar expense models.Expense\n\terr := json.NewDecoder(r.Body).Decode(&expense)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\texpense.Date = time.Now()\n\tdb := models.GetDB()\n\tdbErr := db.Create(&expense).Error\n\n\tif dbErr == nil {\n\n\t\tw.WriteHeader(201)\n\n\t\tjson.NewEncoder(w).Encode(&expense)\n\t} else {\n\t\tmsg := fmt.Sprintf(\" %s\", dbErr)\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(\"{\\\"error\\\": \\\"\" + msg + \"\\\"}\"))\n\t}\n\n}", "title": "" }, { "docid": "6040c51e61d9029c35ec1eaa9447b438", "score": "0.48581246", "text": "func (a *Client) DepartmentsByIDPut(params *DepartmentsByIDPutParams, authInfo runtime.ClientAuthInfoWriter) (*DepartmentsByIDPutOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDepartmentsByIDPutParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DepartmentsByIdPut\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/departments/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/*+json\", \"application/json\", \"application/json-patch+json\", \"text/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DepartmentsByIDPutReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DepartmentsByIDPutOK), nil\n\n}", "title": "" }, { "docid": "da47649c11864e267bfd9d4a88db7fdf", "score": "0.48565263", "text": "func (c *Department) Delete(db *sql.DB) (err error) {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"tx begin %v\", err)\n\t}\n\tif _, err := tx.Exec(`UPDATE community SET department_id=NULL \n\t\tWHERE department_id=$1`, c.ID); err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"update %v\", err)\n\t}\n\tres, err := tx.Exec(\"DELETE FROM department WHERE id = $1\", c.ID)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"delete %v\", err)\n\t}\n\tcount, err := res.RowsAffected()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"rows affected %v\", err)\n\t}\n\tif count != 1 {\n\t\ttx.Rollback()\n\t\treturn errors.New(\"Département introuvable\")\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "6f7e718f006493d388296b37af4fa711", "score": "0.485591", "text": "func (os *OrganizationService) Post(w http.ResponseWriter, r *http.Request) {\n\tlog := logger.WithContext(r.Context())\n\tbody, _ := ioutil.ReadAll(r.Body)\n\n\torg, err := os.repo.Insert(r.Context(), body)\n\tif err != nil {\n\t\tlog.Error(\"Failed to create organization\", zap.Error(err))\n\t\tboom.BadData(w, err)\n\t\treturn\n\t}\n\n\torgBytes := new(bytes.Buffer)\n\tif err := json.NewEncoder(orgBytes).Encode(org); err != nil {\n\t\tlog.Error(fmt.Sprintf(\"Failed to convert orm model to bytes for organization\"), zap.Error(err))\n\t\tboom.Internal(w, err.Error())\n\t\treturn\n\t}\n\n\tif _, err := w.Write(orgBytes.Bytes()); err != nil {\n\t\tlog.Error(fmt.Sprintf(\"Failed to write organization to response for organization\"), zap.Error(err))\n\t\tboom.Internal(w, err.Error())\n\t}\n}", "title": "" }, { "docid": "09133114c4acb3950097a0312bb110c2", "score": "0.4855172", "text": "func (s *Server) CreatePost(ctx context.Context, req *blogpb.CreatePostRequest) (*blogpb.CreatePostResponse, error) {\n\tpost := req.GetPost()\n\n\tid, err := db.GetCollection(\"posts\").SaveOne(ctx, db.Post{\n\t\tAuthorID: post.GetAuthorId(),\n\t\tTitle: post.GetTitle(),\n\t\tContent: post.GetContent(),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"created post %s by author %s\", post.GetTitle(), post.GetAuthorId())\n\treturn &blogpb.CreatePostResponse{\n\t\tPost: &blogpb.Post{\n\t\t\tId: id,\n\t\t\tAuthorId: post.GetAuthorId(),\n\t\t\tTitle: post.GetTitle(),\n\t\t\tContent: post.GetContent(),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "28f62a74a17489c4961603e49b3d5b73", "score": "0.48481733", "text": "func postCourse(c *gin.Context) {\n\tvar newCourse Course\n\n\t// Call BindJSON to bind the received JSON to\n\t// newCourse.\n\tif err := c.BindJSON(&newCourse); err != nil {\n\t\treturn\n\t}\n\n\t// Add the new course to the slice.\n\tcourses = append(courses, newCourse)\n\tc.IndentedJSON(http.StatusCreated, newCourse)\n}", "title": "" }, { "docid": "b1792a5b3f53864c669501bc36839e35", "score": "0.48421505", "text": "func (s *Service) Post(v interface{}, path string, body interface{}) error {\n\treturn s.Do(v, \"POST\", path, body, nil, nil)\n}", "title": "" }, { "docid": "f1f2a05fc359b581b59be95ff0a92ce1", "score": "0.48325032", "text": "func (a *Client) PostProposal(params *PostProposalParams) (*PostProposalCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostProposalParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"post_proposal\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/rest/v1/products/{code}/proposal\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PostProposalReader{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.(*PostProposalCreated)\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 post_proposal: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "44e23e3e55e70b653beb8667fbfc1f9a", "score": "0.4830356", "text": "func createRde(client *Client, entity types.DefinedEntity, tenantContext *TenantContext) error {\n\tif entity.EntityType == \"\" {\n\t\treturn fmt.Errorf(\"ID of the Runtime Defined Entity type is empty\")\n\t}\n\n\tif entity.Entity == nil || len(entity.Entity) == 0 {\n\t\treturn fmt.Errorf(\"the entity JSON is empty\")\n\t}\n\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointRdeEntityTypes\n\tapiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turlRef, err := client.OpenApiBuildEndpoint(endpoint, entity.EntityType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client.OpenApiPostItemAsyncWithHeaders(apiVersion, urlRef, nil, entity, getTenantContextHeader(tenantContext))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48da97711d2de4deeee880676f42f10b", "score": "0.4825247", "text": "func (c *confluenceSvc) postNew(title string, body string) error {\n\tpost := NewPost{\n\t\tType: \"page\",\n\t\tTitle: title,\n\t}\n\tpost.Space.Key = c.cfg.Space\n\tpost.Body.Storage.Value = body\n\tpost.Body.Storage.Representation = \"storage\"\n\tpost.Ancestors = append(post.Ancestors, Ancestor{ID: fmt.Sprint(c.cfg.Page)})\n\n\tjsonValue, err := json.Marshal(post)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turi := fmt.Sprintf(\"%v/rest/api/content/\", c.cfg.Endpoint)\n\n\treq, err := http.NewRequest(\"POST\", uri, bytes.NewBuffer(jsonValue))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.SetBasicAuth(c.cfg.User, c.cfg.Pass)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tmod := &http.Client{}\n\n\tresp, err := mod.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbody := string(bodyBytes)\n\n\t\treturn fmt.Errorf(\"failed to post: %v %v\", resp.StatusCode, body)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "445cb56226666460b4a9e690db9df00b", "score": "0.48246005", "text": "func (a *Client) PostChannelDeposit(params *PostChannelDepositParams) (*PostChannelDepositOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostChannelDepositParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostChannelDeposit\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/tx/channel/deposit\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PostChannelDepositReader{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.(*PostChannelDepositOK), nil\n\n}", "title": "" }, { "docid": "2adb2449c3b9920ad1c9143bce02f977", "score": "0.48180303", "text": "func (s *Server) AddNewPost(w http.ResponseWriter, r *http.Request) {\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tpost := models.Post{}\n\n\terr = json.Unmarshal(body, &post)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tpost.Prepare()\n\n\tsavedPost, err := models.SavePost(s.Client, post)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t}\n\n\tresponses.JSON(w, http.StatusOK, savedPost)\n}", "title": "" }, { "docid": "174a93f536a9cbfe4eec1ea01e0b766d", "score": "0.48178267", "text": "func AddPost(ctx *gin.Context) {\n\tvar input models.Post\n\tif err := ctx.ShouldBindJSON(&input); err != nil {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tdata, err := repository.SavePost(&models.Post{\n\t\tTitle: input.Title,\n\t\tText: input.Text,\n\t\tDate: input.Date,\n\t\tPrice: input.Price,\n\t\tAuthors: input.Authors,\n\t\tPublished: input.Published,\n\t})\n\n\tif err != nil {\n\t\tctx.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusOK, gin.H{\n\t\t\"data\": data,\n\t})\n}", "title": "" }, { "docid": "099dfd9c73341dc9ddb74daae4e92508", "score": "0.48121387", "text": "func NewDepartmentLocation(department int) Location {\n\treturn Location{\n\t\tt: \"department\",\n\t\tdepartment: department,\n\t}\n}", "title": "" }, { "docid": "4ac4ed4b97c8e92e352cb0b215f2c38d", "score": "0.4812007", "text": "func (v *VLANs) Post(fabricID int, p *params.VLAN) (vlan *entity.VLAN, err error) {\n\tqsp := maas.ToQSP(p)\n\tvlan = new(entity.VLAN)\n\terr = v.client(fabricID).Post(\"\", qsp, func(data []byte) error {\n\t\treturn json.Unmarshal(data, vlan)\n\t})\n\treturn\n}", "title": "" }, { "docid": "9f5e6adf93527eace57c26dd3bae62c7", "score": "0.4811143", "text": "func (us DeptService) Update(dto dto.DeptEditDto) int64 {\n\tparentNode := deptDao.Get(dto.ParentId)\n\tdeptModel := model.Department{\n\t\tId: dto.Id,\n\t}\n\tpath := parentNode.Path + \" / \" + dto.Name\n\tif dto.ParentId == 0 {\n\t\tpath = dto.Name\n\t}\n\tc := deptDao.Update(&deptModel, map[string]interface{}{\n\t\t\"name\": dto.Name,\n\t\t\"parentId\": dto.ParentId,\n\t\t\"orderNum\": dto.OrderNum,\n\t\t\"level\": parentNode.Level + 1,\n\t\t\"path\": path,\n\t})\n\treturn c.RowsAffected\n}", "title": "" }, { "docid": "feb7d675f92922037dbe2f7fee475cad", "score": "0.48104948", "text": "func IgPostCreate(ctx context.Context, input model.NewIgPost) (*model.IgPost, error) {\n\tif len(input.Files) == 0 {\n\t\tfmt.Println(\"Files Len : 0\")\n\t\treturn nil, &gqlerror.Error{\n\t\t\tMessage: \"Uploaded File Must Not Empty\",\n\t\t\tExtensions: map[string]interface{}{\n\t\t\t\t\"code\": \"EMPTY_FILE\",\n\t\t\t},\n\t\t}\n\t}\n\n\tdb := config.ConnectGorm()\n\tsqlDB, _ := db.DB()\n\tdefer sqlDB.Close()\n\n\ttimeNow := tools.TimeUTC()\n\tuserID := ForContext(ctx).ID\n\n\tigPost := model.IgPost{\n\t\tCaption: input.Caption,\n\t\tCreatedAt: timeNow,\n\t\tUpdatedAt: nil,\n\t\tDeletedAt: nil,\n\t\tIsArchived: 0,\n\t\tUserID: userID,\n\t}\n\n\terr := db.Table(\"ig_post\").Create(&igPost).Error\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\tuploadedFile, err := UploadFileBatch(ctx, input.Files)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\tvar isPostFiles []*model.NewIgPostFile\n\n\tfor _, val := range uploadedFile {\n\t\tisPostFiles = append(isPostFiles, &model.NewIgPostFile{\n\t\t\tFileID: val.FileID,\n\t\t\tPostID: igPost.ID,\n\t\t})\n\t}\n\n\tigPost.Files, err = IgPostFileCreateBatch(ctx, isPostFiles)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn &igPost, nil\n}", "title": "" }, { "docid": "f6196b2a9042a58babe955b4611c7f12", "score": "0.48061457", "text": "func GetDepartment(w http.ResponseWriter, r *http.Request) {\n\tid, err := utils.GetId(r)\n\tif err != nil {\n\t\tlog.Errorf(\"Error calling servie Get(Single)Department: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdepartment, _ := service.GetDepartment(id)\n\tutils.SendJson(w, department)\n}", "title": "" }, { "docid": "37712660e8e827425dcba703d7ddb3c9", "score": "0.4784991", "text": "func (a *Access) CreatePost(post model.Post) error {\n\tquery := \"INSERT INTO posts (createdAt,title,userLogin,body) VALUES(NOW(),$1,$2,$3)\"\n\n\ttag, err := a.database.connection.Exec(context.Background(), query,\n\t\tpost.Title,\n\t\tpost.UserLogin,\n\t\tpost.Body,\n\t)\n\n\ta.log.Debug().Println(tag)\n\n\tif err != nil {\n\t\ta.log.Warning().Printf(\"Inserted failed: %v\\n\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a2e8905718b09286c56cb947395ebfe5", "score": "0.4781984", "text": "func (dc *DiagnoseCreate) SetDepartment(d *Department) *DiagnoseCreate {\n\treturn dc.SetDepartmentID(d.ID)\n}", "title": "" }, { "docid": "addbb87fd6af3b441f4e8c7c408c0e5f", "score": "0.4777458", "text": "func (postConnection PostConnection) CreatePost(pt entities.Post) bool {\n\tconst (\n\t\texecTvp = \"spCreatePost @UserUUID, @Image, @Title, @Body\"\n\t)\n\t_, err := postConnection.Db.Exec(execTvp,\n\t\tsql.Named(\"UserUUID\", pt.UserUUID),\n\t\tsql.Named(\"Image\", pt.Image),\n\t\tsql.Named(\"Title\", pt.Title),\n\t\tsql.Named(\"Body\", pt.Body),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "7d89bb3de6767f9f3a4f606afec888ae", "score": "0.4768985", "text": "func (ec *EmployeeCreate) SetDepartmentID(id int) *EmployeeCreate {\n\tec.mutation.SetDepartmentID(id)\n\treturn ec\n}", "title": "" }, { "docid": "6e4c9b9839e47d5073170004b80f7d0b", "score": "0.47550872", "text": "func postCreateHandler(w http.ResponseWriter, r *http.Request) {\n\t// r.ParseForm()\n\t// Posting application is not a form, you need to marshal the json\n\t// fmt.Println(\"creating somtething...\", r.Form, r.PostForm)\n\t// var m map[string]interface{}\n\n\t// fmt.Println(\"get body\", r.Body)\n\t// err = json.NewDecoder(req.Body).Decode(&m)\n\tvar m Model\n\tm = Model{\n\t\tName: \"\",\n\t}\n\n\t// body, err := ioutil.ReadAll(r.Body)\n\n\t// fmt.Println(\"this is model\", m)\n\t// err = json.Unmarshal(body, &m)\n\terr := json.NewDecoder(r.Body).Decode(&m)\n\n\tif err != nil {\n\t\tfmt.Println(\"error decoding\", err, m, r.Body)\n\t}\n\tdefer r.Body.Close()\n\tw.WriteHeader(http.StatusCreated)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tio.WriteString(w, `{\"ok\":true}`)\n}", "title": "" }, { "docid": "76c906361e70a85482173bbb5f5baaed", "score": "0.4747261", "text": "func (c *client) Post(request rest.Request) error {\n\treturn c.call(rest.PostMethod, request, nil)\n}", "title": "" }, { "docid": "b6e1f07f67d6346349c8638d3135c66b", "score": "0.47405168", "text": "func PostHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase \"POST\":\n\t\treqMessage := handlermodels.CreatePostRequest{}\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tAPIResponse(w, r, http.StatusBadRequest, \"Error while reading request\", make(map[string]string))\n\t\t\treturn\n\t\t}\n\t\terr = json.Unmarshal(body, &reqMessage)\n\t\tif err != nil {\n\t\t\tAPIResponse(w, r, http.StatusBadRequest, \"Error while unmarshalling\", make(map[string]string))\n\t\t\treturn\n\t\t}\n\n\t\tuser := r.Context().Value(\"user\").(*authpb.UserId)\n\t\t_, err = PostServiceClient.CreatePost(r.Context(), &postpb.Post{UserId: user.UserId, Message: reqMessage.Message})\n\n\t\tif err != nil {\n\t\t\tAPIResponse(w, r, http.StatusInternalServerError, \"Post not added:\"+err.Error(), make(map[string]string))\n\t\t\treturn\n\t\t}\n\t\tAPIResponse(w, r, http.StatusOK, \"Post added successfully\", make(map[string]string))\n\tdefault:\n\t\thttp.Error(w, \"Only POST allowed\", http.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "f0acc81aa1855dcd8b6b7acdd13a3934", "score": "0.47379264", "text": "func (ctx *CreateDepositContext) Created() error {\n\tctx.ResponseData.WriteHeader(201)\n\treturn nil\n}", "title": "" }, { "docid": "0d585a06c29342c3a34aaa929b1814eb", "score": "0.47244996", "text": "func (c *ClientWithResponses) CreateDepartmentReportWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*createDepartmentReportResponse, error) {\n\trsp, err := c.CreateDepartmentReportWithBody(ctx, contentType, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseCreateDepartmentReportResponse(rsp)\n}", "title": "" }, { "docid": "749697f05996c60c441320b766aa9ef1", "score": "0.472374", "text": "func (h *Handler) CreateStation(w http.ResponseWriter, r *http.Request) {\n\th.handlePost(w, r, models.PostStation)\n}", "title": "" } ]
cc23c3a5d6e43a05641f191e9792cf24
CallExample example function to show how to make an RPC call to the coordinator. the RPC argument and reply types are defined in rpc.go.
[ { "docid": "db32061df85774ce9256686d598f1359", "score": "0.82225597", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Coordinator.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" } ]
[ { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "7691d6744be6d6fefd560ff9f1356032", "score": "0.79496396", "text": "func CallExample() {\n\n\t// declare an argument structure.\n\targs := ExampleArgs{}\n\n\t// fill in the argument(s).\n\targs.X = 99\n\n\t// declare a reply structure.\n\treply := ExampleReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcall(\"Master.Example\", &args, &reply)\n\n\t// reply.Y should be 100.\n\tfmt.Printf(\"reply.Y %v\\n\", reply.Y)\n}", "title": "" }, { "docid": "240187ebb1c9f2b48ee940343847d562", "score": "0.6815926", "text": "func ClientCall(client *rpc.Client, serviceMethod string, args interface{}, reply interface{}) error", "title": "" }, { "docid": "5302cf7fe06270fe1c6d288e7de161c0", "score": "0.6643882", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\t//sockname := coordinatorSock()\n\t//c, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "5ceb5a9955f95571bf202b40858cd47c", "score": "0.66275275", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "664aa287333738ff80760c6d3b63b847", "score": "0.6587098", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\t\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "859ff80047246f951fd8cae38bc21cf6", "score": "0.65148646", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Logger.Warn(\"dialing:\", err)\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\tif err = c.Call(rpcname, args, reply); err != nil {\n\t\tlog.Logger.Warn(err)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e68ef60cc98fed86e7e5ae4d2557b5d9", "score": "0.6496252", "text": "func Call(address string, method string, request interface{}, reply interface{}) error {\n\tclient, err := rpc.DialHTTP(\"tcp\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = client.Call(method, request, reply); err != nil {\n\t\tlog.Fatalf(\"Error calling \"+method+\": %v\", err)\n\t}\n\tclient.Close()\n\treturn err\n}", "title": "" }, { "docid": "3098634d3de9f5e277190cf52a96df62", "score": "0.6410061", "text": "func (e *Example) Call(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tmd, _ := metadata.FromContext(ctx)\n\tlog.Printf(\"Received Example.Call request with metadata: %v\", md)\n\trsp.Msg = \": Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "f82fb6031293d9468c514e7c1261ef12", "score": "0.63027424", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\t// sockname := masterSock()\n\t// c, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "830312bb49ad7192e4786390847f75dd", "score": "0.6287823", "text": "func TestCall(t *testing.T) {\n\tcodec, err := NewClientCodec(\"http://\" + addr + \"/rpc\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclient := rpc.NewClientWithCodec(codec)\n\n\tvar request string\n\tvar response string\n\trequest = \"Hello there\"\n\tif err := client.Call(\"Mock.Echo\", &request, &response); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif request != response {\n\t\tt.Fatal(\"Was expecting an echo\")\n\t}\n}", "title": "" }, { "docid": "7e906c88c534e8ee1ae1b86b9d2bef01", "score": "0.6235581", "text": "func call(method string, task string) {\n\tconn, err := net.DialTimeout(\"tcp\", \"127.0.0.1:3333\", 1000*1000*1000*30)\n\tif err != nil {\n\t\tfmt.Printf(\"create client err:%s\\n\", err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\n\tclient := jsonrpc.NewClient(conn)\n\n\tvar reply bool\n\terr = client.Call(method, task, &reply)\n\n\tfmt.Printf(\"reply: %s, err: %s\\n\", reply, err)\n}", "title": "" }, { "docid": "dddc734db59bc0fc707669131c207ca0", "score": "0.6233591", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.DialHTTP(\"tcp\", masterHost +fmt.Sprintf(\":%d\", masterPort))\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err.Error())\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "aa6e58a07fce9f1213ccf7079b041f35", "score": "0.6206116", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\tlog.Printf(\"worker called rpc with name: [%s]\\n\", rpcname)\n\treturn false\n}", "title": "" }, { "docid": "5b150c5452308f8e98c9b2542cb9b97b", "score": "0.61758167", "text": "func call(serv string, rpcMethod string,\n\targs interface{}, reply interface{}) bool {\n\n\tclient, err := rpc.Dial(\"tcp4\", serv)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer client.Close()\n\terr = client.Call(rpcMethod, args, reply)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "7980bc0890c21bc85574b1299e146608", "score": "0.6164422", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "a452f8621bfa62d6c644502f1bbf2a7a", "score": "0.61545855", "text": "func (c *Rpc) Call(RPC xmlrpc.Client, command string, args []interface{}) ([]interface{}, error) {\n\tlog.Debugf(cmd.Colorfy(\" > [one-go] \", \"blue\", \"\", \"bold\")+\"%s\", command)\n\t//log.Debugf(cmd.Colorfy(\"\\n> args \", \"cyan\", \"\", \"bold\")+\" %v\\n\", args)\n\n\tresult := []interface{}{}\n\terr := RPC.Call(command, args, &result)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//log.Debugf(cmd.Colorfy(\"\\n> response \", \"cyan\", \"\", \"bold\")+\" %v\", result)\n\tlog.Debugf(cmd.Colorfy(\" > [one-go] ( ´ ▽ ` ) SUCCESS\", \"blue\", \"\", \"bold\"))\n\treturn result, nil\n}", "title": "" }, { "docid": "049a4710cc2a8667f7eeded834a4e147", "score": "0.61150026", "text": "func (rpc *RPC) Call(ctx context.Context, dest peer.ID,\n\tservice, method string,\n\targs, reply interface{}) error {\n\n\treturn rpc.client.CallContext(ctx, dest, service, method, args, reply)\n}", "title": "" }, { "docid": "1654c172a3f6fdd5a7c845908d53dd8a", "score": "0.6114702", "text": "func Call(ctx context.Context, method string, args, reply interface{}) error {\n\tcommand, cleanup, err := nodetime.Command(nodetime.CommandXRelayer)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cleanup()\n\n\treq, err := json2.EncodeClientRequest(method, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresr, resw := io.Pipe()\n\n\tg := errgroup.Group{}\n\tg.Go(func() error {\n\t\tdefer resw.Close()\n\n\t\treturn cmdrunner.New().Run(\n\t\t\tctx,\n\t\t\tstep.New(\n\t\t\t\tstep.Exec(command[0], command[1:]...),\n\t\t\t\tstep.Write(req),\n\t\t\t\tstep.Stdout(resw),\n\t\t\t),\n\t\t)\n\t})\n\n\t// regular logs can be printed to the stdout by the other process before a jsonrpc response is emitted.\n\t// differentiate both kinds and simulate printing regular logs if there are any.\n\tsc := bufio.NewScanner(resr)\n\tfor sc.Scan() {\n\t\terr = json2.DecodeClientResponse(bytes.NewReader(sc.Bytes()), reply)\n\n\t\tvar e *json2.Error\n\t\tif errors.As(err, &e) || errors.Is(err, json2.ErrNullResult) { // jsonrpc returned with a server-side error.\n\t\t\treturn err\n\t\t}\n\n\t\tif err != nil { // a line printed to the stdout by the other process.\n\t\t\tfmt.Println(sc.Text())\n\t\t}\n\t}\n\n\tif err := sc.Err(); err != nil {\n\t\treturn err\n\t}\n\n\treturn g.Wait()\n}", "title": "" }, { "docid": "b3f7435fff68fe7d2749e16ec782448a", "score": "0.6109987", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tc, err := rpc.DialHTTP(\"unix\", SocketFile)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "1fb6bda4b7401c50e44396a3b521a688", "score": "0.61090547", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t//c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tc, err := rpc.DialHTTP(\"unix\", \"mr-socket\")\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "bc069df166e0f862d558c451b5283947", "score": "0.6034194", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n fmt.Println(\"########### example_cc Invoke ###########\")\n function, args := stub.GetFunctionAndParameters()\n \n if function != \"invoke\" {\n return shim.Error(\"Unknown function call\")\n }\n if len(args) < 2 {\n return shim.Error(\"Incorrect number of arguments. Expecting at least 2\")\n }\n //设计合约\n if args[0]==\"transprofittwo\"{\n return t.transprofittwo(stub,args)\n }\n return shim.Error(\"Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'\")\n}", "title": "" }, { "docid": "6858a33a759243378efccd6640fb3ae0", "score": "0.6010782", "text": "func (c *Client) rpcInvoke(serviceName string, methodName string, in []reflect.Value, out []reflect.Type) (results []reflect.Value) {\n\n\t// convert reflect.Value to Interface{}\n\targs := make([]interface{}, 0, len(in))\n\tfor _, arg := range in {\n\t\targs = append(args, arg.Interface())\n\t}\n\n\t// register call\n\tcall := new(Call)\n\tcall.ServiceName = serviceName\n\tcall.MethodName = methodName\n\tcall.Args = args\n\t//TODO reply\n\t//call.Replys =\n\tcall.Done = make(chan *Call, 1)\n\n\t// create sequence number of the call\n\tc.mutex.Lock()\n\tseq := c.seq\n\tc.seq++\n\tc.pending[seq] = call\n\tc.mutex.Unlock()\n\n\t// build request\n\trequest := message.Request{\n\t\tPath: serviceName,\n\t\tMethod: call.MethodName,\n\t\tArgs: args,\n\t}\n\n\t// build message\n\treqBody, err := json.Marshal(request)\n\tif err != nil {\n\t\tlog.Print(\"ferry.rpcInvoke: Marshal Fail: \", err.Error())\n\t\treturn nil\n\t}\n\tmsg := message.Message{\n\t\tHeader: &message.Header{\n\t\t\tVersion: 0,\n\t\t\tMessageType: message.MsgTypeRequest,\n\t\t\tCompressType: message.NoneCompress,\n\t\t\tBodyLength: uint32(len(reqBody)),\n\t\t\t//ReqID\n\t\t\tSeqID: seq,\n\t\t},\n\t\tData: reqBody,\n\t}\n\n\t//TODO handle error\n\t_, err = c.conn.Write(msg.Encode())\n\tif err != nil {\n\t\tlog.Print(\"ferry.rpcInvoke: Write Fail: \", err.Error())\n\t\treturn nil\n\t}\n\n\t// wait for the response\n\trespCall := <-call.Done\n\n\t// convert to reflect.Type\n\treplys := make([]reflect.Value, 0, len(respCall.Replys))\n\tfor i, r := range respCall.Replys {\n\t\tinst := reflect.New(out[i])\n\t\terr = json.Unmarshal(r, inst.Interface())\n\t\tif err != nil {\n\t\t\tlog.Print(\"ferry.rpcInvoke: Replys Unmarshal Fail: \", i, err.Error())\n\t\t}\n\t\treplys = append(replys, inst.Elem())\n\t}\n\n\treturn replys\n}", "title": "" }, { "docid": "0a06e5a2d4bc55ab47e3089bc1f62c92", "score": "0.6005353", "text": "func (rt *RPCTarget) call(name string, args interface{}, reply *RPCReply) {\n rt.mutex.Lock()\n\n if rt.dead {\n reply.Success = false\n rt.mutex.Unlock()\n return\n }\n\n client := rt.client\n if client == nil {\n var err error\n\n // attempt to connect to get a client\n if USE_UNIX_SOCKETS {\n client, err = rpc.Dial(\"unix\", rt.receiver)\n } else {\n client, err = rpc.Dial(\"tcp\", rt.receiver)\n }\n\n if err != nil {\n log.Printf(\"Dial() failed: %v\\n\", err)\n reply.Success = false\n rt.mutex.Unlock()\n return\n }\n }\n\n rt.client = client\n rt.mutex.Unlock()\n\n err := client.Call(name, args, reply.Data)\n if err != nil {\n log.Printf(\"Call() failed: %v\\n\", err)\n reply.Success = false\n\n // if connection closed, reset client to try connecting again next time\n if err == rpc.ErrShutdown {\n rt.mutex.Lock()\n if rt.client == client {\n rt.client = nil\n }\n rt.mutex.Unlock()\n }\n return\n }\n\n reply.Success = true\n}", "title": "" }, { "docid": "826d8cbb1a4f52902a0b49c845a4ea0e", "score": "0.5977846", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, errx := rpc.Dial(\"unix\", srv)\n if errx != nil {\n return false\n }\n defer c.Close()\n \n err := c.Call(name, args, reply)\n if err == nil {\n return true\n }\n return false\n}", "title": "" }, { "docid": "4001d2cb506c6bce73b539c4fa44bbbe", "score": "0.59652483", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n \n err = c.Call(name, args, reply)\n if err == nil {\n return true\n }\n return false\n}", "title": "" }, { "docid": "e57b617146db031fd5c9e64b6d607703", "score": "0.59512454", "text": "func Call(server, method string, req, reply proto.Message) error {\n\tbody := new(bytes.Buffer)\n\tif err := JSONMarshaler.Marshal(body, req); err != nil {\n\t\treturn fmt.Errorf(\"error marshaling %T: %v\", req, err)\n\t}\n\tresp, err := http.Post(strings.TrimSuffix(server, \"/\")+\"/\"+strings.Trim(method, \"/\"),\n\t\tjsonBodyType, body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"http error: %v\", err)\n\t}\n\trec, err := ioutil.ReadAll(resp.Body)\n\tresp.Body.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading response body: %v\", err)\n\t} else if resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"remote method error (code %d): %s\", resp.StatusCode, string(rec))\n\t}\n\tif err := jsonpb.UnmarshalString(string(rec), reply); err != nil {\n\t\treturn fmt.Errorf(\"error unmarshaling %T: %v\", reply, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8197c070b6556966a12906e766925e19", "score": "0.5939192", "text": "func call(srv string, rpcname string,\n\targs interface{}, reply interface{}) bool {\n\tc, errx := rpc.Dial(\"unix\", srv)\n\tif errx != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\terr := c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\tlog.Print(\"RPC call error :\", err)\n\treturn false\n}", "title": "" }, { "docid": "521bef0ff9bbdc661953ada05ea52638", "score": "0.5931723", "text": "func call(srv string, rpcname string,\n\targs interface{}, reply interface{}) bool {\n\tc, errx := rpc.Dial(\"unix\", srv)\n\tif errx != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr := c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\t//fmt.Println(\"Call error\")\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "ba1dd542efeb079343650d293d19ea12", "score": "0.5926339", "text": "func call(message *rpc.Call) error {\n\tmessage.FrameworkId = frameworkInfo.Id\n\tbody, err := marshaller.MarshalToString(message)\n\tif err != nil {\n\t\tlog.Printf(\"CALL -> %v Error: %v\", log.Llongfile, err)\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(\"POST\", master+path, bytes.NewBuffer([]byte(body)))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Mesos-Stream-Id\", mesosStreamID)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tlog.Printf(\"Call %s %s\", message.Type, string(body))\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"CALL2-> %v Error: %v\", log.Llongfile, err)\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != 202 {\n\t\tio.Copy(os.Stderr, res.Body)\n\t\treturn fmt.Errorf(\"CALL3-> Error %d\", res.StatusCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b16e752f0659b570f29e4cd8e89553c", "score": "0.592489", "text": "func Call(endpoint string, params map[string]interface{}) *Response {\n\tqstr, _ := qs.Marshal(params)\n\turi := strings.Join([]string{endpoint, qstr}, \"?\")\n\n\txcallPath, _ := filepath.Abs(\"xcall/xcall.app/Contents/MacOS/xcall\")\n\n\tcmd := exec.Command(\n\t\txcallPath,\n\t\t\"-url\",\n\t\tstrings.Join([]string{\"bear://x-callback-url\", uri}, \"/\"),\n\t)\n\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar resp Response\n\n\tif err := json.Unmarshal(output, &resp); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &resp\n}", "title": "" }, { "docid": "015eb45187b8e990649619adeefb1eff", "score": "0.59078103", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n \n err = c.Call(name, args, reply)\n \n if err == nil {\n return true\n }\n\n fmt.Println(err)\n return false\n}", "title": "" }, { "docid": "e4b3b582c76824a5c58adbdaa4c0fae3", "score": "0.58873415", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n \n err = c.Call(name, args, reply)\n if err == nil {\n return true\n }\n\n fmt.Println(err)\n return false\n}", "title": "" }, { "docid": "97c119d45b4cc84c5d0135bb3b9e8cdf", "score": "0.5879083", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\t//fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\t//fmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "dc6e2789b34930738d8092dbad41d166", "score": "0.5873682", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\r\n\tc, err := rpc.Dial(\"unix\", srv)\r\n\tif err != nil {\r\n\t\terr1 := err.(*net.OpError)\r\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\r\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\r\n\t\t}\r\n\t\treturn false\r\n\t}\r\n\tdefer c.Close()\r\n\r\n\terr = c.Call(name, args, reply)\r\n\tif err == nil {\r\n\t\treturn true\r\n\t}\r\n\r\n\tfmt.Println(err)\r\n\treturn false\r\n}", "title": "" }, { "docid": "9fdb16f69b730f5950e86a9b16d55255", "score": "0.58686036", "text": "func ClientGo(client *rpc.Client, serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call,) *rpc.Call", "title": "" }, { "docid": "e0e20f6f50a052dc4f6ec59674509860", "score": "0.58551204", "text": "func (client *Client) Call(procedure string, params *jsonw.Wrapper, output ReplyPairChan) error {\n\n\tmsgid := client.idCounter\n\tclient.idCounter += 1\n\n\trequest := jsonw.NewArray(4)\n\trequest.SetIndex(0, jsonw.NewInt(int(rpc_request)))\n\trequest.SetIndex(1, jsonw.NewInt(int(msgid)))\n\trequest.SetIndex(2, jsonw.NewString(procedure))\n\trequest.SetIndex(3, params)\n\n\tmsg, err := packMessage(request.GetDataOrNil(), client.Framed)\n\tif err != nil {\n\t\tlog.Printf(\"Error packing message: %s\", err)\n\t\treturn err\n\t}\n\tclient.outputChannels[msgid] = output\n\tclient.conn.Write(msg)\n\n\treturn nil\n}", "title": "" }, { "docid": "dc28fd545d52fb69c95d6a247b901e32", "score": "0.5840528", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "dc28fd545d52fb69c95d6a247b901e32", "score": "0.5840528", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "dc28fd545d52fb69c95d6a247b901e32", "score": "0.5840528", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "dc28fd545d52fb69c95d6a247b901e32", "score": "0.5840528", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "dc28fd545d52fb69c95d6a247b901e32", "score": "0.5840528", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.Dial(\"unix\", srv)\n\tif err != nil {\n\t\terr1 := err.(*net.OpError)\n\t\tif err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n\t\t\tfmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n\t\t}\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(name, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "311790517434e30702ae69efb6c3b8fe", "score": "0.58392984", "text": "func (c *ZabbixClient) Call(method string, params interface{}, useAuth bool) (response RPCResponse, err error) {\n\tvar auth interface{}\n\tif useAuth {\n\t\tauth = c.auth\n\t}\n\n\t// create a json-rpc message\n\ttxMessage := RPCMessage{\n\t\tJSONRPC: \"2.0\",\n\t\tMethod: method,\n\t\tParams: params,\n\t\tAuth: auth,\n\t\tID: 1,\n\t}\n\n\ttxBytes, err := json.Marshal(txMessage)\n\tif err != nil {\n\t\treturn response, fmt.Errorf(\"ZabbixClient.Call json.Marshal error: %s\", err.Error())\n\t}\n\n\t// transmit the message\n\tresp, err := c.client.Post(c.url, \"application/json\", bytes.NewReader(txBytes))\n\tif err != nil {\n\t\treturn response, fmt.Errorf(\"ZabbixClient.Call POST error: %s\", err.Error())\n\t}\n\tdefer resp.Body.Close()\n\n\t// handle the response\n\tresponseData, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn response, fmt.Errorf(\"ZabbixClient.Call reading response error: %s\", err.Error())\n\t}\n\n\terr = json.Unmarshal(responseData, &response)\n\tif err != nil {\n\t\treturn response, fmt.Errorf(\"ZabbixClient.Call Unmarshal error: %s\", err.Error())\n\t}\n\n\t// handle API errors\n\tif response.Result == nil {\n\t\tif errorData, ok := response.Error.(map[string]interface{}); ok {\n\t\t\treturn response, fmt.Errorf(\"ZabbixClient.Call API Error code: %f | message: %s | data: %s\", errorData[\"code\"], errorData[\"message\"], errorData[\"data\"])\n\t\t}\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "58685f406e74802ca422a47b404bcf1d", "score": "0.5820918", "text": "func (w *WeightRpc) Call(serviceMethod string, args interface{}, reply interface{}) error {\n\t// w.Client may reuse and reset to nil, so use a local variables to store the pointer.\n\tclient := w.Client\n\tif client != nil {\n\t\treturn client.Call(serviceMethod, args, reply)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb7bb91ecda5f28f90ab5276cf0f9f99", "score": "0.58180475", "text": "func (c *Client) rpcCall(call *methodCall, resp response) error {\n\tbody, err := xml.MarshalIndent(call, \"\", \" \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error during unmarshalling the request body: %w\", err)\n\t}\n\n\tbody = append([]byte(`<?xml version=\"1.0\"?>`+\"\\n\"), body...)\n\n\trespBody, err := c.httpPost(c.BaseURL, \"text/xml\", bytes.NewReader(body))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = xml.Unmarshal(respBody, resp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error during unmarshalling the response body: %w\", err)\n\t}\n\n\tif resp.faultCode() != 0 {\n\t\treturn rpcError{\n\t\t\tfaultCode: resp.faultCode(),\n\t\t\tfaultString: strings.TrimSpace(resp.faultString()),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab2f4dbe0a60360b50c51b913e882108", "score": "0.5812882", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n\n err = c.Call(name, args, reply)\n if err == nil {\n return true\n }\n\n fmt.Println(err)\n return false\n}", "title": "" }, { "docid": "c3a8778ebb4b545b3dac83527dce6c3f", "score": "0.5809741", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n\n err = c.Call(name, args, reply)\n if err == nil {\n return true\n }\n\n // fmt.Println(err)\n return false\n}", "title": "" }, { "docid": "f541cb47890272d4ec97e985490a6e08", "score": "0.58088034", "text": "func call(srv string, rpcname string,\n\targs interface{}, reply interface{}) bool {\n\tc, errx := rpc.Dial(\"unix\", srv)\n\tif errx != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr := c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "f541cb47890272d4ec97e985490a6e08", "score": "0.58088034", "text": "func call(srv string, rpcname string,\n\targs interface{}, reply interface{}) bool {\n\tc, errx := rpc.Dial(\"unix\", srv)\n\tif errx != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr := c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "609980bc6745249cd868f0e206251722", "score": "0.57941115", "text": "func CallRPC(ctx context.Context, client tinykvpb.TinyKvClient, req *Request) (*Response, error) {\n\tresp := &Response{}\n\tvar err error\n\tswitch req.Type {\n\tcase CmdGet:\n\t\tresp.Resp, err = client.KvGet(ctx, req.Get())\n\tcase CmdScan:\n\t\tresp.Resp, err = client.KvScan(ctx, req.Scan())\n\tcase CmdPrewrite:\n\t\tresp.Resp, err = client.KvPrewrite(ctx, req.Prewrite())\n\tcase CmdCommit:\n\t\tresp.Resp, err = client.KvCommit(ctx, req.Commit())\n\tcase CmdBatchRollback:\n\t\tresp.Resp, err = client.KvBatchRollback(ctx, req.BatchRollback())\n\tcase CmdResolveLock:\n\t\tresp.Resp, err = client.KvResolveLock(ctx, req.ResolveLock())\n\tcase CmdRawGet:\n\t\tresp.Resp, err = client.RawGet(ctx, req.RawGet())\n\tcase CmdRawPut:\n\t\tresp.Resp, err = client.RawPut(ctx, req.RawPut())\n\tcase CmdRawDelete:\n\t\tresp.Resp, err = client.RawDelete(ctx, req.RawDelete())\n\tcase CmdRawScan:\n\t\tresp.Resp, err = client.RawScan(ctx, req.RawScan())\n\tcase CmdCop:\n\t\tresp.Resp, err = client.Coprocessor(ctx, req.Cop())\n\tcase CmdCheckTxnStatus:\n\t\tresp.Resp, err = client.KvCheckTxnStatus(ctx, req.CheckTxnStatus())\n\tdefault:\n\t\treturn nil, errors.Errorf(\"invalid request type: %v\", req.Type)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "17b4200213b764848ba73dc1dd7ea5e4", "score": "0.57564986", "text": "func (e *ClientEnd) Call(svcMeth string, args interface{}, reply interface{}) bool {\n\tfmt.Println(\"Enter PBServer.go Call function...\")\n\tfmt.Println(reflect.TypeOf(args))\n\tfmt.Println(reflect.TypeOf(reply))\n\t\n\tencBuf := new(bytes.Buffer)\n encErr := gob.NewEncoder(encBuf).Encode(args)\n if encErr != nil {\n log.Fatal(encErr)\n }\n argsEnc := []byte(encBuf.Bytes())\n\n fmt.Println(reflect.TypeOf(argsEnc))\n //fmt.Println(argsEnc)\n \n encErr = gob.NewEncoder(encBuf).Encode(reply)\n if encErr != nil {\n log.Fatal(encErr)\n }\n replyEnc := encBuf.Bytes()\n\n\n\tcallPBServerArgs := CallPBServerArgs {\n\t\tSvcMeth: svcMeth,\n\t\tSvcArgs: argsEnc,\n\t\tSvcReplys: replyEnc,\n\t}\n\n\tclient, err := rpc.Dial(\"tcp\", e.TcpAddress);\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn false\n\t}\n\n\tvar callPBServerReplys CallPBServerReplys\n\n\terr = client.Call(\"Listener.UnpackagePBServerCall\", &callPBServerArgs, &callPBServerReplys)\n\tif err != nil {\n\t\tfmt.Printf(\"client Call error... %s\\n\", err)\n\t\treturn false\n\t}\n\treturn true\n\t\n}", "title": "" }, { "docid": "7737975621411e8c2bf340dce8012975", "score": "0.5746799", "text": "func (c *rpcClient) call(method string, params interface{}) (rr rpcResponse, err error) {\r\n\tconnectTimer := time.NewTimer(time.Duration(c.timeout) * time.Second)\r\n\trpcR := rpcRequest{method, params, time.Now().UnixNano(), \"1.0\"}\r\n\tpayloadBuffer := &bytes.Buffer{}\r\n\tjsonEncoder := json.NewEncoder(payloadBuffer)\r\n\terr = jsonEncoder.Encode(rpcR)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\treq, err := http.NewRequest(\"POST\", c.serverAddr, payloadBuffer)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\treq.Header.Add(\"Content-Type\", \"application/json;charset=utf-8\")\r\n\treq.Header.Add(\"Accept\", \"application/json\")\r\n\r\n\t// Auth ?\r\n\tif len(c.user) > 0 || len(c.passwd) > 0 {\r\n\t\treq.SetBasicAuth(c.user, c.passwd)\r\n\t}\r\n\r\n\tresp, err := c.doTimeoutRequest(connectTimer, req)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\r\n\tdata, err := ioutil.ReadAll(resp.Body)\r\n\t//fmt.Println(string(data))\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\tif resp.StatusCode != 200 {\r\n\t\terr = errors.New(\"HTTP error: \" + resp.Status)\r\n\t\treturn\r\n\t}\r\n\terr = json.Unmarshal(data, &rr)\r\n\treturn\r\n}", "title": "" }, { "docid": "9bb96f16c44fd4e6d31d9c12ae3cb9cb", "score": "0.57352793", "text": "func (c *Client) rpcCall(ctx context.Context, call *methodCall, result response) error {\n\treq, err := newXMLRequest(ctx, c.BaseURL, call)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn errutils.NewHTTPDoError(req, err)\n\t}\n\n\tdefer func() { _ = resp.Body.Close() }()\n\n\traw, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errutils.NewReadResponseError(req, resp.StatusCode, err)\n\t}\n\n\terr = xml.Unmarshal(raw, result)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unmarshal error: %w\", err)\n\t}\n\n\tif result.faultCode() != 0 {\n\t\treturn RPCError{\n\t\t\tFaultCode: result.faultCode(),\n\t\t\tFaultString: result.faultString(),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb0f3215561c979ce092dbdf434df8c5", "score": "0.5715902", "text": "func (rpc *Client) Call(method string, params ...interface{}) (json.RawMessage, error) {\n\trequest := ethRequest{\n\t\tID: 1,\n\t\tJSONRPC: \"2.0\",\n\t\tMethod: method,\n\t\tParams: params,\n\t}\n\n\tbody, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := rpc.httpClient.Post(rpc.endpoint, \"application/json\", bytes.NewBuffer(body))\n\tif response != nil {\n\t\tdefer response.Body.Close()\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif rpc.Debug {\n\t\trpc.log.Println(fmt.Sprintf(\"%s\\nRequest: %s\\nResponse: %s\\n\", method, body, data))\n\t}\n\n\tresp := new(ethResponse)\n\tif err := json.Unmarshal(data, resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.Error != nil {\n\t\treturn nil, *resp.Error\n\t}\n\n\treturn resp.Result, nil\n\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.5711789", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.5711789", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "e6dc1a5bd54a8f0ba3e7c02af725b78f", "score": "0.5711789", "text": "func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {\n\treply.Y = args.X + 1\n\treturn nil\n}", "title": "" }, { "docid": "85f9d2d70b3d5fad486cc96e524d1a2f", "score": "0.56952614", "text": "func (c WrappedTClient) Call(ctx context.Context, method string, args, result thrift.TStruct) (err error) {\n\treturn c.Wrapped(ctx, method, args, result)\n}", "title": "" }, { "docid": "1ac02a54de95c17e768e4927891c71a0", "score": "0.567633", "text": "func NewRPCExample() xprotocol.Multiplexing {\n\treturn &rpcExample{}\n}", "title": "" }, { "docid": "30ed5124967b05f8f1105e998cc772ca", "score": "0.5667983", "text": "func TestCall(t *testing.T) {\n\tcallbackPostURL := fmt.Sprintf(\"http://twimlets.com/forward?PhoneNumber=%s\", ToPhoneNumber)\n\tcall, err := TestClient.Call(FromPhoneNumber, ToPhoneNumber, callbackPostURL)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed: %s\", err.Error())\n\t}\n\tbs, err := json.MarshalIndent(call, \"\", \" \")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed: %s\", err.Error())\n\t}\n\tt.Logf(\"Call:\\n%s\\n\", string(bs))\n}", "title": "" }, { "docid": "134aa75447c892291fc67d396a9c293a", "score": "0.5621008", "text": "func Example() {\n\taddr := \"127.0.0.1:1234\"\n\tm := exampleManager(addr)\n\ttime.Sleep(time.Millisecond)\n\texampleWorker(addr)\n\texampleWorker(addr)\n\tfor _, s := range []string{\"foo\", \"bar\", \"baz\"} {\n\t\tvar reply string\n\t\terr := m.Call(\"T.Echo\", s, &reply)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(reply)\n\t}\n\tm.Close()\n\t// Output:\n\t// foo\n\t// bar\n\t// baz\n}", "title": "" }, { "docid": "204f1cf92c380009b674c49d1d403094", "score": "0.5617538", "text": "func NewRPCExample() types.Multiplexing {\n\treturn &rpcExample{}\n}", "title": "" }, { "docid": "43255d2d47dab2ee7dfa1c62f2c45229", "score": "0.56132865", "text": "func (proxy *FabricProxy) FabricCall(ctx context.Context, binding, namespace, operation string, payload []byte) ([]byte, error) {\n\t// Route the payload to any custom functionality accordingly.\n\t// You can even route to other waPC modules!!!\n\tlog.Printf(\"[host] bd %s ns %s op %s payload length %d\\n\", binding, namespace, operation, len(payload))\n\n\tswitch namespace {\n\tcase \"LedgerService\":\n\t\tswitch operation {\n\t\tcase \"CreateState\":\n\t\t\tlog.Printf(\"[host] Processing CreateStateRequest...\\n\")\n\t\t\trequest := &contract.CreateStateRequest{}\n\t\t\terr := proto.Unmarshal(payload, request)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn proxy.createState(request)\n\t\tcase \"ReadState\":\n\t\t\tlog.Printf(\"[host] Processing ReadStateRequest...\\n\")\n\t\t\trequest := &contract.ReadStateRequest{}\n\t\t\terr := proto.Unmarshal(payload, request)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn proxy.readState(request)\n\t\tcase \"ExistsState\":\n\t\t\tlog.Printf(\"[host] Processing ExistsStateRequest...\\n\")\n\t\t\trequest := &contract.ExistsStateRequest{}\n\t\t\terr := proto.Unmarshal(payload, request)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn proxy.existsState(request)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Operation not supported: %s %s\", namespace, operation)\n}", "title": "" }, { "docid": "54e4d90bd1e8c1f8917e5a5297d7082a", "score": "0.56025165", "text": "func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {\n fmt.Println(\"########### example_cc Invoke ###########\")\n\tfunction, args := stub.GetFunctionAndParameters()\n\t\n\tif function != \"invoke\" {\n return shim.Error(\"Unknown function call\")\n\t}\n\n\tif len(args) < 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting at least 2\")\n\t}\n\n\tif args[0] == \"delete\" {\n\t\t// Deletes an entity from its state\n\t\treturn t.delete(stub, args)\n\t}\n\n\tif args[0] == \"query\" {\n\t\t// queries an entity state\n\t\treturn t.query(stub, args)\n\t}\n\tif args[0] == \"move\" {\n\t\t// Deletes an entity from its state\n\t\treturn t.move(stub, args)\n\t}\n\treturn shim.Error(\"Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'\")\n}", "title": "" }, { "docid": "8f16c539df022e76ace7bd4a892b50e4", "score": "0.55827045", "text": "func ConnectAndCall(srv_addr string, srv_port string, method string, args interface{}, reply interface{}) error {\n\tclient, err := rpc.DialHTTP(\"tcp\", srv_addr+\":\"+srv_port)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = client.Call(method, args, reply) // make rpc call\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil // no error\n}", "title": "" }, { "docid": "2ce36a32a1e3719225451c69218c40bd", "score": "0.5576509", "text": "func (client *Client) Call(serviceMethod string, args, reply interface{}) error {\n\n\tcall := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done\n\n\treturn call.Error\n}", "title": "" }, { "docid": "3244d45889ade4304cfa690e8455bd41", "score": "0.55764675", "text": "func (c *PcpClient) Call(funName string, params ...interface{}) CallResult {\n\tvar args []interface{}\n\n\tfor _, param := range params {\n\t\tswitch item := param.(type) {\n\t\tcase CallResult:\n\t\t\targs = append(args, item.Result)\n\t\tdefault:\n\t\t\tif reflect.ValueOf(item).Kind() == reflect.Slice {\n\t\t\t\targs = append(args, append([]interface{}{\"'\"}, getItems(item)...))\n\t\t\t} else {\n\t\t\t\targs = append(args, item)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn CallResult{append([]interface{}{funName}, args...)}\n}", "title": "" }, { "docid": "b7ab2156f815ee35fda61f3f778a8211", "score": "0.5565094", "text": "func DoRPC(ctx context.Context, client interface{}, serviceName string, method string, request interface{}) (response interface{}, err error) {\r\n\tdefer func() {\r\n\t\tif r := recover(); r != nil {\r\n\t\t\terr = fmt.Errorf(\"do RPC '%s' error: %v\", method, r)\r\n\t\t}\r\n\t}()\r\n\r\n\t// get a connection by the service name\r\n\tconn := serviceConns.Get(serviceName)\r\n\tif conn == nil {\r\n\t\treturn nil, fmt.Errorf(\"service conn '%s' not found\", serviceName)\r\n\t}\r\n\r\n\t// get NewServiceClient's reflect.Value\r\n\tvClient := reflect.ValueOf(client)\r\n\tvar vParams []reflect.Value\r\n\tvParams = append(vParams, reflect.ValueOf(conn))\r\n\r\n\t// c[0] is serviceServer reflect.Value\r\n\tc := vClient.Call(vParams)\r\n\r\n\t// rpc parameter: context and request\r\n\tv := make([]reflect.Value, 2)\r\n\tv[0] = reflect.ValueOf(ctx)\r\n\tv[1] = reflect.ValueOf(request)\r\n\r\n\t// rpc method call\r\n\tf := c[0].MethodByName(method)\r\n\tresult := f.Call(v)\r\n\tif !result[1].IsNil() {\r\n\t\treturn nil, result[1].Interface().(error)\r\n\t}\r\n\r\n\treturn result[0].Interface(), nil\r\n}", "title": "" }, { "docid": "a82f0041dbd075871933bb30f14d560a", "score": "0.5554486", "text": "func (ec *WalletClient) Call(ctx context.Context, method string, args interface{}, result interface{}) error {\n\treqMsg, err := prepareRequest(ec.nextID(), method, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbodyReader := bytes.NewReader(reqMsg)\n\tctx, cancel := context.WithTimeout(ctx, ec.Timeout)\n\tdefer cancel()\n\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, ec.url, bodyReader)\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpReq.Close = true\n\thttpReq.Header.Set(\"Content-Type\", \"application/json\")\n\thttpReq.Header.Set(\"Authorization\", ec.auth) // httpReq.SetBasicAuth(ec.user, ec.pass)\n\n\tresp, err := ec.HTTPClient.Do(httpReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tb, _ := io.ReadAll(resp.Body)\n\t\treturn fmt.Errorf(\"%d: %s\", resp.StatusCode, string(b))\n\t}\n\n\tjsonResp := &response{}\n\terr = json.NewDecoder(resp.Body).Decode(jsonResp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif jsonResp.Error != nil {\n\t\treturn jsonResp.Error\n\t}\n\n\tif result != nil {\n\t\treturn json.Unmarshal(jsonResp.Result, result)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47f85b0987afa811867751af791ad8b8", "score": "0.555421", "text": "func (c *Client) Call(ctx context.Context, req proto.Message, resp proto.Message) error {\n\tclient := c.Client\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\tctx, span := trace.StartSpan(ctx, \"go.chromium.org/goma/server/httprpc.Client.Call\")\n\tdefer span.End()\n\tcontentEncoding := c.ContentEncoding\n\tif contentEncoding == \"\" {\n\t\tcontentEncoding = \"deflate\"\n\t}\n\tpost, err := serializeToHTTPRequest(ctx, c.URL, req, contentEncoding)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresponse, err := client.Do(post)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = parseFromHTTPResponse(ctx, response, resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67b287b6af2b3bdb5e4b47c7b17f5172", "score": "0.5552477", "text": "func unaryCall(c ackpb.AckServiceClient) {\n\treq := &ackpb.AckReq{\n\t\tMsg: \"from-testserv\",\n\t}\n\tres, err := c.SendAck(context.Background(), req)\n\tif err != nil {\n\t\tlog.Fatalf(\"error while calling Greet RPC: %v\", err)\n\t} else if res.Msg != \"from-testserv:rgpc-recv\" {\n\t\tlog.Panicln(\"wrong gRPC response message: \", res)\n\t}\n\n}", "title": "" }, { "docid": "74c196fb6e7912eab8d2692bc2a93f90", "score": "0.55480343", "text": "func main() {\n\tparam1 := flag.Int(\"Param1\", 0, \"First parameter\")\n\tparam2 := flag.Int(\"Param2\", 0, \"Second parameter\")\n\taddress := flag.String(\"Address\", \"localhost:9000\", \"Address to the calculator server\")\n\toperation := flag.String(\"Operation\", \"\", \"Operation to execute, one of (add, subtract, multiply, divide)\")\n\tflag.Parse()\n\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\tconn, err := grpc.Dial(*address, opts...)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// close connection later\n\tdefer conn.Close()\n\tclient := mathpb.NewMathClient(conn)\n\n\tswitch *operation {\n\tcase \"add\":\n\n\t\tres, err := client.Add(context.Background(),\n\t\t\t&mathpb.Parameters{Param1: int32(*param1),\n\t\t\t\tParam2: int32(*param2)})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(res.Result)\n\n\tcase \"subtract\":\n\t\tres, err := client.Subtract(context.Background(),\n\t\t\t&mathpb.Parameters{Param1: int32(*param1),\n\t\t\t\tParam2: int32(*param2)})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(res.Result)\n\n\tcase \"multiply\":\n\t\tres, err := client.Multiply(context.Background(),\n\t\t\t&mathpb.Parameters{Param1: int32(*param1),\n\t\t\t\tParam2: int32(*param2)})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(res.Result)\n\n\tcase \"divide\":\n\t\tres, err := client.Divide(context.Background(),\n\t\t\t&mathpb.Parameters{Param1: int32(*param1),\n\t\t\t\tParam2: int32(*param2)})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(res.Result)\n\n\tdefault:\n\t\tfmt.Println(\"Operation must be one of the following (add, subtract, multiply, divide)\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "e4248dc617d77f40044bdaf18ff68039", "score": "0.55434513", "text": "func (s *APIService) Call(ctx context.Context, req *rpcpb.TransactionRequest) (*rpcpb.CallResponse, error) {\n\n\tneb := s.server.Neblet()\n\ttx, err := parseTransaction(neb, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult, err := neb.BlockChain().Call(tx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rpcpb.CallResponse{Result: result}, nil\n}", "title": "" }, { "docid": "6eadea63e36e7a5514dd67196a3d47ce", "score": "0.5534895", "text": "func Call(ctx context.Context, rawClient raw.Client) error {\n\tctx, cancel := context.WithTimeout(ctx, 100*testtime.Millisecond)\n\tdefer cancel()\n\tres, err := rawClient.Call(ctx, \"echo\", []byte(\"hello\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !bytes.Equal(res, []byte(\"hello\")) {\n\t\treturn fmt.Errorf(\"unexpected response %+v\", res)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e7a0f68231d367f519068e80301916c", "score": "0.55314976", "text": "func (t *ChaincodeWrapper) invoke(stub shim.ChaincodeStubInterface) pb.Response {\n\t// check number of args\n\tfunction, args := stub.GetFunctionAndParameters()\n\tif len(args) < 1 {\n\t\treturn shim.Error(\"Failed to invoke chaincode_wrapper with error: incorrect number of args, expecting at least name of function to execute\")\n\t}\n\n\t// set up the grpc client connection towards the chaincode_proxy\n\tconn, err := grpc.Dial(address, grpc.WithInsecure())\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer conn.Close() // https://godoc.org/google.golang.org/grpc#ClientConn.NewStream\n\tclient := grpcpb.NewInvocationClient(conn)\n\n\t// Setup context with timeout.\n\t// chaincode_wrapper waits at max 10 minutes for the gRPC to complete.\n\t// After the timeout the start of the gRPC call TransactionInvocation and\n\t// any send or receive will fail with an error. This error is caught by a cleanup.\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(10)*time.Minute) // client wait at max 10 minutes for the gRPC to complete // cancel context (https://godoc.org/google.golang.org/grpc#ClientConn.NewStream)\n\tdefer cancel() // https://godoc.org/google.golang.org/grpc#ClientConn.NewStream\n\n\t// create the grpc client stream\n\tstream, err := client.TransactionInvocation(ctx) // if no timeout do client.TransactionInvocation(context.Background()) (not used)\n\t// ctx := stream.Context // returns context (not used)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// prepare and send transaction invocation to chaincode_proxy\n\twrapperMsg := &grpcpb.ChaincodeWrapperMessage{\n\t\tMessageOneof: &grpcpb.ChaincodeWrapperMessage_InvocationRequest{\n\t\t\tInvocationRequest: &grpcpb.InvocationRequest{\n\t\t\t\tFunctionName: function,\n\t\t\t\tChaincodeUuid: t.Uuid,\n\t\t\t\tArguments: args,\n\t\t\t},\n\t\t},\n\t}\n\terr = stream.Send(wrapperMsg)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfor {\n\t\t// wait for the message of the chaincode_proxy and act accordingly\n\t\tproxyMsg, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\n\t\tswitch u := proxyMsg.Type.(type) {\n\t\tcase *grpcpb.ChaincodeProxyMessage_InvocationResponse:\n\t\t\t{\n\t\t\t\t// read execution response of InvocationResponse gRPC message from chaincode_proxy\n\t\t\t\texecutionResponse := u.InvocationResponse.ExecutionResponse\n\t\t\t\treturn shim.Success([]byte(executionResponse))\n\t\t\t}\n\t\tcase *grpcpb.ChaincodeProxyMessage_GetStateRequest:\n\t\t\t{\n\t\t\t\t// read key of GetStateRequest gRPC message from chaincode_proxy\n\t\t\t\tkey := u.GetStateRequest.Key\n\n\t\t\t\t// get state from ledger\n\t\t\t\tvalue, err := stub.GetState(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\n\t\t\t\t// since nil is not a valid string type in go\n\t\t\t\t// we pass an empty string as Value in case the value returend by GetState is nil\n\t\t\t\tvar valueString string\n\t\t\t\tif value == nil {\n\t\t\t\t\tvalueString = \"\"\n\t\t\t\t} else {\n\t\t\t\t\tvalueString = string(value)\n\t\t\t\t}\n\n\t\t\t\t// create and send putStateResponse gRPC message for chaincode_proxy\n\t\t\t\twrapperMsg := &grpcpb.ChaincodeWrapperMessage{\n\t\t\t\t\tMessageOneof: &grpcpb.ChaincodeWrapperMessage_GetStateResponse{\n\t\t\t\t\t\tGetStateResponse: &grpcpb.GetStateResponse{\n\t\t\t\t\t\t\tValue: valueString,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\terr = stream.Send(wrapperMsg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\tcase *grpcpb.ChaincodeProxyMessage_PutStateRequest:\n\t\t\t{\n\t\t\t\t// read key and value of PutStateRequest gRPC message from chaincode_proxy\n\t\t\t\tkey := u.PutStateRequest.Key\n\t\t\t\tvalue := u.PutStateRequest.Value\n\n\t\t\t\t// put state on ledger\n\t\t\t\terr = stub.PutState(key, []byte(value))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\n\t\t\t\t// create and send putStateResponse gRPC message for chaincode_proxy\n\t\t\t\twrapperMsg := &grpcpb.ChaincodeWrapperMessage{\n\t\t\t\t\tMessageOneof: &grpcpb.ChaincodeWrapperMessage_PutStateResponse{\n\t\t\t\t\t\tPutStateResponse: &grpcpb.PutStateResponse{\n\t\t\t\t\t\t\tAcknowledgement: \"OK\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\terr := stream.Send(wrapperMsg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn shim.Error(err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
281617d2b4524e133779594e87d74367
Is returns whether `t` is a Tuple type or not. If `t` is an instance of the Tuple type and its ElementTypes property is not nil, it will only return true if the ElementTypes are considered the same. To be considered the same, there must be the same number of ElementTypes, arranged in the same order, and the types in each position must be considered the same as the type in the same position in the other Tuple.
[ { "docid": "ae72c2164dad7f8b5b4b204ad5cf36e8", "score": "0.80705756", "text": "func (tu Tuple) Is(t Type) bool {\n\tv, ok := t.(Tuple)\n\tif !ok {\n\t\treturn false\n\t}\n\tif v.ElementTypes != nil {\n\t\tif len(v.ElementTypes) != len(tu.ElementTypes) {\n\t\t\treturn false\n\t\t}\n\t\tfor pos, typ := range tu.ElementTypes {\n\t\t\tif !typ.Is(v.ElementTypes[pos]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn ok\n}", "title": "" } ]
[ { "docid": "89e45e74a31d6e16c6d808867eaddd46", "score": "0.7529859", "text": "func IsTuple(t sql.Type) bool {\n\tv, ok := t.(TupleType)\n\treturn ok && len(v) > 1\n}", "title": "" }, { "docid": "ae15a9dc4a2beda23e3eb407c26449e9", "score": "0.6888878", "text": "func (t TupleType) Equals(otherType sql.Type) bool {\n\tif ot, ok := otherType.(TupleType); ok && len(t) == len(ot) {\n\t\tfor i, tupType := range t {\n\t\t\tif !tupType.Equals(ot[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e8af79c183c887ebf12e00c18a16b8e1", "score": "0.6854581", "text": "func (t *TupleType) Equals(other Type) bool {\n\treturn t.equals(other, nil)\n}", "title": "" }, { "docid": "f5d245303587fbd8e6ad81e712cfe8f2", "score": "0.6274216", "text": "func (t Tuple) Equals(a Tuple) bool {\n\treturn floatEquals(a.X, t.X) &&\n\t\tfloatEquals(a.Y, t.Y) &&\n\t\tfloatEquals(a.Z, t.Z) &&\n\t\tfloatEquals(a.W, t.W)\n}", "title": "" }, { "docid": "a1882e49f81adea8311d68c0690e7362", "score": "0.62663585", "text": "func (t *GenericTuple) Equal(v interface{}) bool {\n\tif b, ok := v.(Tuple); ok {\n\t\tfor e := t.Enumerator(); e.MoveNext(); {\n\t\t\taName, aValue := e.Current()\n\t\t\tif bVal, found := b.Get(aName); found {\n\t\t\t\tif !aValue.Equal(bVal) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tfor e := b.Enumerator(); e.MoveNext(); {\n\t\t\tname, _ := e.Current()\n\t\t\tif _, found := t.Get(name); !found {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "179e49a5d3079b6fb851880a76f084d7", "score": "0.60459983", "text": "func (s Set) Is(t Type) bool {\n\tv, ok := t.(Set)\n\tif !ok {\n\t\treturn false\n\t}\n\tif v.ElementType != nil {\n\t\treturn s.ElementType.Is(v.ElementType)\n\t}\n\treturn ok\n}", "title": "" }, { "docid": "cb80b4f6ec57895288753aecfbd5cc2e", "score": "0.59897906", "text": "func IsWildcardTupleType(t *T) bool {\n\treturn len(t.TupleContents()) == 1 && t.TupleContents()[0].Family() == AnyFamily\n}", "title": "" }, { "docid": "b57c736f2cb982ceae298aa2442f803d", "score": "0.58422285", "text": "func (t Tuple) Equal(t2 Tuple) bool {\n\tif float.Equal(t.X, t2.X) && float.Equal(t.Y, t2.Y) && float.Equal(t.Z, t2.Z) && float.Equal(t.W, t2.W) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "180f6a8ac2d24447ee4702a21f238559", "score": "0.57683754", "text": "func (t *GenericTuple) IsTrue() bool {\n\treturn t.Count() > 0\n}", "title": "" }, { "docid": "129631db2e7de57388b2ccbb6791f9ff", "score": "0.5647023", "text": "func (l List) Is(t Type) bool {\n\tv, ok := t.(List)\n\tif !ok {\n\t\treturn false\n\t}\n\tif v.ElementType != nil {\n\t\treturn l.ElementType.Is(v.ElementType)\n\t}\n\treturn ok\n}", "title": "" }, { "docid": "2e8ad791764f3c1b30e12ca19cb6f0b4", "score": "0.56092864", "text": "func (tv TypeAndValue) IsType() bool {\n\treturn tv.mode == typexpr\n}", "title": "" }, { "docid": "04a1fa7a3ce1880e600233606e022d9b", "score": "0.5578547", "text": "func (f *TupleFlags) IsSet(v TupleFlags) bool {\n\treturn TupleFlags(atomic.LoadUint32((*uint32)(f)))&v == v\n}", "title": "" }, { "docid": "3c6a321c0d81e27979642a5d61c85322", "score": "0.5551345", "text": "func (t *InternalType) Identical(other *InternalType) bool {\n\tif t.Family != other.Family {\n\t\treturn false\n\t}\n\tif t.Width != other.Width {\n\t\treturn false\n\t}\n\tif t.Precision != other.Precision {\n\t\treturn false\n\t}\n\tif t.TimePrecisionIsSet != other.TimePrecisionIsSet {\n\t\treturn false\n\t}\n\tif t.IntervalDurationField != nil && other.IntervalDurationField != nil {\n\t\tif *t.IntervalDurationField != *other.IntervalDurationField {\n\t\t\treturn false\n\t\t}\n\t} else if t.IntervalDurationField != nil {\n\t\treturn false\n\t} else if other.IntervalDurationField != nil {\n\t\treturn false\n\t}\n\tif t.GeoMetadata != nil && other.GeoMetadata != nil {\n\t\tif t.GeoMetadata.ShapeType != other.GeoMetadata.ShapeType {\n\t\t\treturn false\n\t\t}\n\t\tif t.GeoMetadata.SRID != other.GeoMetadata.SRID {\n\t\t\treturn false\n\t\t}\n\t} else if t.GeoMetadata != nil {\n\t\treturn false\n\t} else if other.GeoMetadata != nil {\n\t\treturn false\n\t}\n\tif t.Locale != nil && other.Locale != nil {\n\t\tif *t.Locale != *other.Locale {\n\t\t\treturn false\n\t\t}\n\t} else if t.Locale != nil {\n\t\treturn false\n\t} else if other.Locale != nil {\n\t\treturn false\n\t}\n\tif t.ArrayContents != nil && other.ArrayContents != nil {\n\t\tif !t.ArrayContents.Identical(other.ArrayContents) {\n\t\t\treturn false\n\t\t}\n\t} else if t.ArrayContents != nil {\n\t\treturn false\n\t} else if other.ArrayContents != nil {\n\t\treturn false\n\t}\n\tif len(t.TupleContents) != len(other.TupleContents) {\n\t\treturn false\n\t}\n\tfor i := range t.TupleContents {\n\t\tif !t.TupleContents[i].Identical(other.TupleContents[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\tif len(t.TupleLabels) != len(other.TupleLabels) {\n\t\treturn false\n\t}\n\tfor i := range t.TupleLabels {\n\t\tif t.TupleLabels[i] != other.TupleLabels[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\tif t.UDTMetadata != nil && other.UDTMetadata != nil {\n\t\tif t.UDTMetadata.StableTypeID != other.UDTMetadata.StableTypeID {\n\t\t\treturn false\n\t\t}\n\t\tif t.UDTMetadata.StableArrayTypeID != other.UDTMetadata.StableArrayTypeID {\n\t\t\treturn false\n\t\t}\n\t} else if t.UDTMetadata != nil {\n\t\treturn false\n\t} else if other.UDTMetadata != nil {\n\t\treturn false\n\t}\n\treturn t.Oid == other.Oid\n}", "title": "" }, { "docid": "e480705f8a3906ef811ade069dc4a250", "score": "0.5472794", "text": "func (t *GenericTuple) Less(v Value) bool {\n\tif t.Kind() != v.Kind() {\n\t\treturn t.Kind() < v.Kind()\n\t}\n\tif t.Count() == 1 {\n\t\tif x, ok := t.Get(negateTag); ok {\n\t\t\tu := v.(Tuple)\n\t\t\tif u.Count() != 1 {\n\t\t\t\tpanic(negateTag + \" kind not single-attr tuple\")\n\t\t\t}\n\t\t\tif y, ok := v.(Tuple).Get(negateTag); ok {\n\t\t\t\treturn y.Less(x)\n\t\t\t}\n\t\t\tpanic(negateTag + \" kind missing \" + negateTag + \" attr\")\n\t\t}\n\t}\n\n\tx := v.(*GenericTuple)\n\ta := TupleOrderedNames(t)\n\tb := TupleOrderedNames(x)\n\tn := len(a)\n\tif n > len(b) {\n\t\tn = len(b)\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tif a[i] != b[i] {\n\t\t\treturn a[i] < b[i]\n\t\t}\n\t\tva, _ := t.Get(a[i])\n\t\tvb, _ := x.Get(b[i])\n\t\tif va.Less(vb) {\n\t\t\treturn true\n\t\t}\n\t\tif vb.Less(va) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn len(a) < len(b)\n}", "title": "" }, { "docid": "20dc2de2f4b68b81d5e7246375a24713", "score": "0.53037393", "text": "func (ft FlowTuple) IsOrdered() bool {\n\treturn ft.IsOneWay || flowTupleOrdered(ft.Srcip, ft.Dstip, ft.Srcport, ft.Dstport)\n}", "title": "" }, { "docid": "b6da1fd7b8a17202f6980997812091c6", "score": "0.52994347", "text": "func (v Value) SameType(o Value) bool {\n\treturn v.ty.Same(o.ty)\n}", "title": "" }, { "docid": "8596c45791d6bffe7204e07a39b12187", "score": "0.5242044", "text": "func (tuple *Tuple) IsEmpty() bool {\n\treturn tuple.Size() == 0\n}", "title": "" }, { "docid": "cfa5f201cf02df76e91ef9c70fb6c180", "score": "0.5224822", "text": "func (t DataType) Is(o DataType) bool { return proto.Equal(&t, &o) }", "title": "" }, { "docid": "f3f177c0f216d8998032fbb5417772b0", "score": "0.52177525", "text": "func (t *T) EquivalentOrNull(other *T) bool {\n\t// Check normal equivalency first, then check for Null\n\tnormalEquivalency := t.Equivalent(other)\n\tif normalEquivalency {\n\t\treturn true\n\t}\n\n\tswitch t.Family() {\n\tcase UnknownFamily:\n\t\treturn other.Family() != TupleFamily\n\n\tcase TupleFamily:\n\t\tif other.Family() != TupleFamily {\n\t\t\treturn false\n\t\t}\n\t\t// If either tuple is the wildcard tuple, it's equivalent to any other\n\t\t// tuple type. This allows overloads to specify that they take an arbitrary\n\t\t// tuple type.\n\t\tif IsWildcardTupleType(t) || IsWildcardTupleType(other) {\n\t\t\treturn true\n\t\t}\n\t\tif len(t.TupleContents()) != len(other.TupleContents()) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range t.TupleContents() {\n\t\t\tif !t.TupleContents()[i].EquivalentOrNull(other.TupleContents()[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\n\tdefault:\n\t\treturn normalEquivalency\n\t}\n}", "title": "" }, { "docid": "ed45224122062215af4ab6aecc267644", "score": "0.51564455", "text": "func (s *set) IsEqual(t Interface) bool {\n\t// Force locking only if given set is threadsafe.\n\tif conv, ok := t.(*Set); ok {\n\t\tconv.l.RLock()\n\t\tdefer conv.l.RUnlock()\n\t}\n\n\t// return false if they are no the same size\n\tif sameSize := len(s.m) == t.Size(); !sameSize {\n\t\treturn false\n\t}\n\n\tequal := true\n\tt.Each(func(item interface{}) bool {\n\t\t_, equal = s.m[item]\n\t\treturn equal // if false, Each() will end\n\t})\n\n\treturn equal\n}", "title": "" }, { "docid": "ed45224122062215af4ab6aecc267644", "score": "0.51564455", "text": "func (s *set) IsEqual(t Interface) bool {\n\t// Force locking only if given set is threadsafe.\n\tif conv, ok := t.(*Set); ok {\n\t\tconv.l.RLock()\n\t\tdefer conv.l.RUnlock()\n\t}\n\n\t// return false if they are no the same size\n\tif sameSize := len(s.m) == t.Size(); !sameSize {\n\t\treturn false\n\t}\n\n\tequal := true\n\tt.Each(func(item interface{}) bool {\n\t\t_, equal = s.m[item]\n\t\treturn equal // if false, Each() will end\n\t})\n\n\treturn equal\n}", "title": "" }, { "docid": "9602b055e0676b4a8af7426efae09f14", "score": "0.5141306", "text": "func Equal(t1, t2 Tuple) bool {\n\tif math.Abs(t1.x-t2.x) < FLOAT_PRECISION &&\n\t\tmath.Abs(t1.y-t2.y) < FLOAT_PRECISION &&\n\t\tmath.Abs(t1.z-t2.z) < FLOAT_PRECISION &&\n\t\tt1.w == t2.w {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "71eb53241075e96ad0349f71f01e6541", "score": "0.51362044", "text": "func (tx *TxType) Is(txType types.TxCode) bool {\n\treturn tx.Type == txType\n}", "title": "" }, { "docid": "40270b9d4c44c67545191505712529b3", "score": "0.51315594", "text": "func (t *T) IsAmbiguous() bool {\n\tswitch t.Family() {\n\tcase UnknownFamily, AnyFamily:\n\t\treturn true\n\tcase CollatedStringFamily:\n\t\treturn t.Locale() == \"\"\n\tcase TupleFamily:\n\t\tif len(t.TupleContents()) == 0 {\n\t\t\treturn true\n\t\t}\n\t\tfor i := range t.TupleContents() {\n\t\t\tif t.TupleContents()[i].IsAmbiguous() {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\tcase ArrayFamily:\n\t\treturn t.ArrayContents().IsAmbiguous()\n\tcase EnumFamily:\n\t\treturn t.Oid() == oid.T_anyenum\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9169b58849937b7f6bbaf87a3813cc2b", "score": "0.51306236", "text": "func (t *T) Equivalent(other *T) bool {\n\tif t.Family() == AnyFamily || other.Family() == AnyFamily {\n\t\treturn true\n\t}\n\tif t.Family() != other.Family() {\n\t\treturn false\n\t}\n\n\tswitch t.Family() {\n\tcase CollatedStringFamily:\n\t\tif t.Locale() != \"\" && other.Locale() != \"\" && t.Locale() != other.Locale() {\n\t\t\treturn false\n\t\t}\n\n\tcase TupleFamily:\n\t\t// If either tuple is the wildcard tuple, it's equivalent to any other\n\t\t// tuple type. This allows overloads to specify that they take an arbitrary\n\t\t// tuple type.\n\t\tif IsWildcardTupleType(t) || IsWildcardTupleType(other) {\n\t\t\treturn true\n\t\t}\n\t\tif len(t.TupleContents()) != len(other.TupleContents()) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range t.TupleContents() {\n\t\t\tif !t.TupleContents()[i].Equivalent(other.TupleContents()[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\tcase ArrayFamily:\n\t\tif !t.ArrayContents().Equivalent(other.ArrayContents()) {\n\t\t\treturn false\n\t\t}\n\n\tcase EnumFamily:\n\t\t// If one of the types is anyenum, then allow the comparison to\n\t\t// go through -- anyenum is used when matching overloads.\n\t\tif t.Oid() == oid.T_anyenum || other.Oid() == oid.T_anyenum {\n\t\t\treturn true\n\t\t}\n\t\tif t.StableTypeID() != other.StableTypeID() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bffbaed7cf654f9da4de6cd479456b1e", "score": "0.5044296", "text": "func (t HandlerType) Is(types ...HandlerType) bool {\n\tt.MustValidate()\n\n\tfor _, x := range types {\n\t\tx.MustValidate()\n\n\t\tif t == x {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8f79af56d6846b950f4f06a5b630f1c6", "score": "0.50323284", "text": "func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool {\n\tfor _, t := range types {\n\t\tif tabletType == t {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4c0b07357af744f78fdf3013f45d45b3", "score": "0.5031592", "text": "func (s *Set) IsEqual(t Interface) bool {\n\ts.l.RLock()\n\tdefer s.l.RUnlock()\n\n\t// Force locking only if given set is threadsafe.\n\tif conv, ok := t.(*Set); ok {\n\t\tconv.l.RLock()\n\t\tdefer conv.l.RUnlock()\n\t}\n\n\t// return false if they are no the same size\n\tif sameSize := len(s.m) == t.Size(); !sameSize {\n\t\treturn false\n\t}\n\n\tequal := true\n\tt.Each(func(item interface{}) bool {\n\t\t_, equal = s.m[item]\n\t\treturn equal // if false, Each() will end\n\t})\n\n\treturn equal\n}", "title": "" }, { "docid": "aa635435fdca2db069cb9e78b608ed7c", "score": "0.5000759", "text": "func IsTypeInList(tabletType pb.TabletType, types []pb.TabletType) bool {\n\tfor _, t := range types {\n\t\tif tabletType == t {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5d9a3ce804b8065f225e594eacf44ee8", "score": "0.49993736", "text": "func (t STErr) Is(e STErr) bool {\n\tif (t & e) == e {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "3b887cd1bec0882900751e0c3721ff91", "score": "0.49874753", "text": "func (s IntTupleSet) Equal(x, y Elem) bool {\n\treturn x.(IntTuple).Compare(y) == 0\n}", "title": "" }, { "docid": "c51604f15a7e0c43a40a1c18894a9983", "score": "0.49591368", "text": "func (o KGObject) IsType(t KGObjectType) bool {\n\treturn o.ValueType() == t\n}", "title": "" }, { "docid": "77b1e96a832e0b563dab4654cdeaf77f", "score": "0.4947281", "text": "func (m *MapType) isType() {}", "title": "" }, { "docid": "8f798f636a5033f00078692d20db4462", "score": "0.49305215", "text": "func (t Type) SupportsEquality() bool {\n\treturn t != List && t != Dist && t != Unknown\n}", "title": "" }, { "docid": "eb7da4f913dc723fcc7bb93de3afc9d8", "score": "0.49250528", "text": "func Is(c cell.I) bool {\n\tswitch c.(type) {\n\tcase *T, *Plus:\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "34b5e637904b2f9213e6fa0b74584ad3", "score": "0.49128705", "text": "func (s IntTupleSet) Lt(x, y Elem) bool {\n\treturn x.(IntTuple).Compare(y) < 0\n}", "title": "" }, { "docid": "3d30edba765252bce88bc78d43109036", "score": "0.49018463", "text": "func (array *ArrayType) Equals(t Type, overrides EqualityOverrides) bool {\n\tif array == t {\n\t\treturn true\n\t}\n\n\tif et, ok := t.(*ArrayType); ok {\n\t\treturn array.element.Equals(et.element, overrides)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "25357529f8ec7424801c83af514b9390", "score": "0.4895203", "text": "func (s *Set) IsEqual(t *Set) (bool, error) {\n\tif err := s.typematch(t); err != nil {\n\t\treturn false, err\n\t}\n\n\tif s.Size() != t.Size() {\n\t\treturn false, nil\n\t}\n\tif u, _ := s.Union(t); s.Size() != u.Size() {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "20b82bc92d558e37002c23bce9101d4c", "score": "0.48826706", "text": "func (oneOf *OneOfType) Equals(t Type, overrides EqualityOverrides) bool {\n\tif oneOf == t {\n\t\treturn true // short-circuit\n\t}\n\n\tother, ok := t.(*OneOfType)\n\tif !ok {\n\t\treturn false\n\t}\n\n\treturn oneOf.types.Equals(other.types, overrides)\n}", "title": "" }, { "docid": "2fdd5ae5a03d68b711e3e28a2005f5e0", "score": "0.48802537", "text": "func (a *ArrayType) isType() {}", "title": "" }, { "docid": "654c80096068f577ccf886143244c4bd", "score": "0.4876284", "text": "func (i Type) IsAType() bool {\n\tfor _, v := range _TypeValues {\n\t\tif i == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6f9ec9d453169ba53d5562441bd2e065", "score": "0.48754895", "text": "func TypeEqual(l ast.TypeKind, r ast.TypeKind) bool {\n\tif _, isNamedType := l.(ast.NamedType); isNamedType {\n\t\treturn TypeEqual(l.BaseType(), r)\n\t}\n\tif _, isNamedType := r.(ast.NamedType); isNamedType {\n\t\treturn TypeEqual(l, r.BaseType())\n\t}\n\n\tif l.Kind() == ast.ComplexTypeStruct && r.Kind() == ast.ComplexTypeStruct {\n\t\treturn checkStructsEqual(l.(ast.StructType), r.(ast.StructType))\n\t}\n\tif l.Kind() == ast.ComplexTypeArray && r.Kind() == ast.ComplexTypeArray {\n\t\treturn TypeEqual(l.(ast.ArrayType).SubType, r.(ast.ArrayType).SubType)\n\t}\n\tif l.Kind() == ast.ComplexTypeFunction && r.Kind() == ast.ComplexTypeFunction {\n\t\treturn funcEqual(l.(ast.FunctionType), r.(ast.FunctionType))\n\t}\n\n\treturn l == r\n}", "title": "" }, { "docid": "cb0c5bbe784572f936f49d93b477358f", "score": "0.48739615", "text": "func (u UnionType) isType() {}", "title": "" }, { "docid": "41ee8b37def4e55ba8bf1e43d09b6a51", "score": "0.4864223", "text": "func (maybeSelf someDef[T]) IsType(t reflect.Type) bool {\n\treturn maybeSelf.Type() == t\n}", "title": "" }, { "docid": "12b8ce9e8d0f3d46a865be2a5b9dcf1c", "score": "0.4835314", "text": "func typeAsTuple(ev ExprView) types.T {\n\ttypes := make(types.TTuple, ev.ChildCount())\n\tfor i := 0; i < ev.ChildCount(); i++ {\n\t\tchild := ev.Child(i)\n\t\ttypes[i] = child.Logical().Scalar.Type\n\t}\n\treturn types\n}", "title": "" }, { "docid": "2a1114f62f5fa9fa5887bbc2b5f605bf", "score": "0.48144504", "text": "func (s IntTupleSet) Gt(x, y Elem) bool {\n\treturn x.(IntTuple).Compare(y) > 0\n}", "title": "" }, { "docid": "6225836319906ce73fcf697039971769", "score": "0.4811747", "text": "func (n *Node) IsTime() bool {\n\tif n == nil {\n\t\treturn false\n\t}\n\treturn n.ValueType() == \"time.Time\"\n}", "title": "" }, { "docid": "4f1df460c7f95b614fa15a0a405b1a7a", "score": "0.48068726", "text": "func (t *Arrow) IsGeneric() bool { return t.Flags&ContainsGenericVars != 0 }", "title": "" }, { "docid": "6b082f08437f4b7bc10ba3eea45df7f4", "score": "0.48060098", "text": "func (ct CounterType) IsType(ct2 CounterType) bool {\n\treturn ct&ct2 == ct2\n}", "title": "" }, { "docid": "709e9691c56e9765d0781293409bb4e0", "score": "0.48020107", "text": "func IsAbstractType(t Type) bool {\n\treturn (t.Specifiers() & TS_Abstract) != 0\n}", "title": "" }, { "docid": "267cfd460ca71a67c1c14ae3b0ba32b3", "score": "0.48009777", "text": "func IsTime(t sql.Type) bool {\n\t_, ok := t.(datetimeType)\n\treturn ok\n}", "title": "" }, { "docid": "283227f3ac00ac192b7d184f32248b42", "score": "0.47880632", "text": "func IsType(err error, t E2APType) bool {\n\tif typed, ok := err.(*TypedError); ok {\n\t\treturn typed.E2APType == t\n\t}\n\treturn false\n}", "title": "" }, { "docid": "dd6ea969cbd808819af23114dc59516e", "score": "0.4774464", "text": "func (obj *schema) IsUniqueElements() bool {\n\treturn obj.isUniqueElements\n}", "title": "" }, { "docid": "4d82dd471ab7bbddc1596d3fa43a39b1", "score": "0.47699705", "text": "func (t *Struct) Equal(u Type) bool {\n\tswitch u := u.(type) {\n\tcase *Struct:\n\t\tif len(t.fields) != len(u.fields) {\n\t\t\treturn false\n\t\t}\n\t\tfor i := range t.fields {\n\t\t\tif !t.fields[i].Equal(u.fields[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn t.packed == u.packed\n\t}\n\treturn false\n}", "title": "" }, { "docid": "28908c95c4b8ae9a0d037c9e54175fd4", "score": "0.4758622", "text": "func (c *C) Is(e, g interface{}, msg ...interface{}) bool {\n\tte := reflect.TypeOf(e)\n\ttg := reflect.TypeOf(g)\n\n\tif !c.equal(te, tg) {\n\t\tc.fail(\"%s\\n\"+\n\t\t\t\"Expected type: %s.%s\\n\"+\n\t\t\t\" == %s.%s\",\n\t\t\tformat(msg...),\n\t\t\tte.PkgPath(), te.Name(),\n\t\t\ttg.PkgPath(), tg.Name())\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "fb75a1a83dd692d35274cd9ec210647b", "score": "0.47579554", "text": "func (t TagMap) IsSet() bool {\n\treturn len(t) > 0\n}", "title": "" }, { "docid": "0fc386ad66cd9e5d3269ba0a3411d336", "score": "0.4746937", "text": "func (*Lsp_Tlv_MultiTopology) IsYANGGoStruct() {}", "title": "" }, { "docid": "eac18a582b977c0b2b0d3a64a1933063", "score": "0.4746698", "text": "func (*Lsp_Tlv_MultiTopology_Topology) IsYANGGoStruct() {}", "title": "" }, { "docid": "391ef898cfb39dd6449d74ee3981e9c9", "score": "0.47382382", "text": "func (node TTuple) TypeName() string { return \"\" }", "title": "" }, { "docid": "02044575a63b6ea4a13d87bc0e2cb6dc", "score": "0.47242996", "text": "func (p Piece) SameType(piece Piece) bool {\n\treturn p.RemoveColor() == piece.RemoveColor()\n}", "title": "" }, { "docid": "4dfb54e0a7d4dc9328bd934036257259", "score": "0.47087413", "text": "func (a *AST) IsType(t string) bool {\n\tif a.Type == t {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5dcbdb7baef10600bfbc3f2b72b68340", "score": "0.47046107", "text": "func Teq(a, b T) bool { return a == b }", "title": "" }, { "docid": "4303107b5df22977c9f4c8fd3f196662", "score": "0.470442", "text": "func (t *Struct) IsPacked() bool {\n\treturn t.packed\n}", "title": "" }, { "docid": "0007f42e339b79fd96925e710bb43f7e", "score": "0.47044063", "text": "func IsType(s string) bool {\n\tfor _, t := range Types {\n\t\tif t == s {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "503a274ccc598643c1cbabf269f91be1", "score": "0.47017705", "text": "func (t *Tensor) IsEqualDims(t2 *Tensor) bool {\r\n\tif t.Size.X != t2.Size.X || t.Size.Y != t2.Size.Y || t.Size.Z != t2.Size.Z {\r\n\t\treturn false\r\n\t}\r\n\treturn true\r\n}", "title": "" }, { "docid": "0b981dfa0a306498a3a7a69a5eeab102", "score": "0.4700141", "text": "func (e *Error) IsOneOf(tt ...string) bool {\n\tif e == nil {\n\t\treturn false\n\t}\n\tfor _, t := range tt {\n\t\tif e.IsType(t) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a0a8f4318d39e9c425b6ae503b75c317", "score": "0.4699657", "text": "func (e Edge) IsSharedByTriangles(triangles []Triangle) bool {\n\tvar edges []Edge\n\n\tfor _, t := range triangles {\n\t\tedges = append(edges, t.Edges()...)\n\t}\n\n\tfor _, other := range edges {\n\t\tif e.Equals(other) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "347cfe599b20751a562b4355e5563e2f", "score": "0.46892193", "text": "func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {\n\t\treturn Fail(t, fmt.Sprintf(\"Object expected to be of type %v, but was %v\", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "be22790cef8fd552ce208aca0a1d80a7", "score": "0.46884364", "text": "func (p OrderedPair) Equal(q Element) bool {\n\tr, ok := q.(OrderedPair)\n\treturn ok && p == r\n}", "title": "" }, { "docid": "2172f5557a1f5db89232a77b45819ec2", "score": "0.46878427", "text": "func (r ResultColumns) TypesEqual(other ResultColumns) bool {\n\tif len(r) != len(other) {\n\t\treturn false\n\t}\n\tfor i, c := range r {\n\t\t// NULLs are considered equal because some types of queries (SELECT CASE,\n\t\t// for example) can change their output types between a type and NULL based\n\t\t// on input.\n\t\tif other[i].Typ == types.Unknown {\n\t\t\tcontinue\n\t\t}\n\t\tif !c.Typ.Equivalent(other[i].Typ) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6a4478bc9b4704c80667377fce97afb2", "score": "0.46846005", "text": "func (a nilPair) Contains(item interface{}) (contains bool) {\n\tif i, contains := item.(nilPair); contains && i == a { return contains }\n\treturn false\n}", "title": "" }, { "docid": "18e0c6974e9760354f08512af8e1c79f", "score": "0.46783763", "text": "func (entry TOCEntry) IsType(t SupportedType) bool {\n\treturn t.matchesTitle(entry.Text) || t.matchesID(entry.ID)\n}", "title": "" }, { "docid": "3d9986c9cb039f75a57bf6e7ad4dd49f", "score": "0.46768034", "text": "func TimeEqual(t time.Time, u time.Time,) bool", "title": "" }, { "docid": "6a5f646b0de004c4af06167b56e72bce", "score": "0.46755093", "text": "func (t Type) IsObjectType() bool {\n\t_, ok := t.typeImpl.(typeObject)\n\treturn ok\n}", "title": "" }, { "docid": "4e2d144a40db9ec674c83992e8df5a74", "score": "0.46740204", "text": "func (typeSelf ProductType) Matches(value ...interface{}) bool {\n\tif len(value) != len(typeSelf.kinds) {\n\t\treturn false\n\t}\n\n\tmatches := true\n\tfor i, v := range value {\n\t\tmatches = matches && typeSelf.kinds[i] == Maybe.Just(v).Kind()\n\t}\n\treturn matches\n}", "title": "" }, { "docid": "c7f4776a2a009938e398a54ebf8c26b7", "score": "0.4673103", "text": "func EqualSets(first []model.TupleType, second []model.TupleType) bool {\n\treturn len(SecondMinusFirst(first, second)) == 0 &&\n\t\tlen(SecondMinusFirst(second, first)) == 0\n}", "title": "" }, { "docid": "acbab726fc58b021a105dfe058bba53d", "score": "0.46685714", "text": "func (l *LexemeType) IsA(l2 *LexemeType) bool {\n\tif l == l2 {\n\t\treturn true\n\t}\n\tif l2 != nil {\n\t\tfor l1 := l.Parent; l1 != nil; l1 = l1.Parent {\n\t\t\tif l1 == l2 {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "79668d7ba06b6e73cca19cd7a83f4bfb", "score": "0.46482283", "text": "func (t *TSTime) IsSet() bool {\n\treturn (t.ET != nil && !t.ET.IsZero()) || (t.AT != nil && !t.AT.IsZero())\n}", "title": "" }, { "docid": "f3668b618ec33d1367ebead2cd5ba065", "score": "0.4641303", "text": "func (enum *EnumType) Equals(t Type) bool {\n\tif e, ok := t.(*EnumType); ok {\n\t\tif !enum.BaseType.Equals(e.BaseType) {\n\t\t\treturn false\n\t\t}\n\n\t\tif len(enum.options) != len(e.options) {\n\t\t\t// Different number of fields, not equal\n\t\t\treturn false\n\t\t}\n\n\t\tfor i := range enum.options {\n\t\t\tif !enum.options[i].Equals(&e.options[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\t// All options match, equal\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "35e18eff703ac7f62aba5317698f9ca0", "score": "0.46327055", "text": "func (s IntTupleSet) Eq(x, y Elem) bool {\n\treturn x.(IntTuple).Compare(y) == 0\n}", "title": "" }, { "docid": "50d695c4154c59195675b14de47ba91d", "score": "0.46232206", "text": "func typeEquality(t1, t2 reflect.Type) error {\n\tt1Fields, t2Fields := make(map[string]bool), make(map[string]bool)\n\tfor i := 0; i < t1.NumField(); i++ {\n\t\tt1Fields[t1.Field(i).Name] = true\n\t}\n\tfor i := 0; i < t2.NumField(); i++ {\n\t\tt2Fields[t2.Field(i).Name] = true\n\t}\n\tif !reflect.DeepEqual(t1Fields, t2Fields) {\n\t\treturn fmt.Errorf(\"type = %+v, want %+v\", t1Fields, t2Fields)\n\t}\n\tfor n := range t1Fields {\n\t\tf1, _ := t1.FieldByName(n)\n\t\tf2, _ := t2.FieldByName(n)\n\t\tif err := compareFields(f1, f2); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7bcfd620254cc296bb02ae7a8c790d18", "score": "0.46124217", "text": "func (t Tuple) Len() int { return len(t) }", "title": "" }, { "docid": "fea3a0010534d8d0b87a65e8dca93263", "score": "0.46113476", "text": "func (tk Token) IsType() bool {\n\treturn tk == T_BOOL || tk == T_NUM || tk == T_STR\n}", "title": "" }, { "docid": "dfc949b2ea53cbc2f74c78290946b4a3", "score": "0.4601295", "text": "func (t Type) OneOf(types ...Type) bool {\n\tfor _, check := range types {\n\t\tif t == check {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a005fe68b562c2185d475eaca31c2022", "score": "0.4593991", "text": "func Identical(t1, t2 *Type) bool {\n\treturn identical(t1, t2, true, nil)\n}", "title": "" }, { "docid": "d4a134df795cbda0340b4866fa8da977", "score": "0.45923406", "text": "func (l LanguagePair) Same(other LanguagePair) bool {\n\tfirst1, second1 := l.First, l.Second\n\tfirst2, second2 := other.First, other.Second\n\tif first1 != first2 {\n\t\t// Swapping first1 and first2\n\t\tfirst2, first1 = first1, first2\n\t}\n\n\treturn (first1 == first2 && second1 == second2) ||\n\t\t(first1 == second1 && first2 == second2)\n}", "title": "" }, { "docid": "4010153b881eb9433308b72807779b5b", "score": "0.45804694", "text": "func IsUnion(t Type) bool {\n\tswitch t {\n\tcase DENSE_UNION, SPARSE_UNION:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f7816885537069435186a2fe6d23ede1", "score": "0.4575819", "text": "func (t *T) Identical(other *T) bool {\n\treturn t.InternalType.Identical(&other.InternalType)\n}", "title": "" }, { "docid": "8b7e39f52573a8e34de115ca77ead43d", "score": "0.4575237", "text": "func IsEqu(a, b, c float64) bool {\n\tif a == b && b == c {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fae4022e411614ce27a467cb20e2d65d", "score": "0.45679736", "text": "func (vt *Struct) IsTrue() bool {\n\treturn false\n}", "title": "" }, { "docid": "ea8884f9d2eee06bbef7c9d9568e8b9f", "score": "0.45591953", "text": "func TestTupleType(t *testing.T) {\n\tresources := loadResources12ToTest(t, \"./testdata/resources/multi_level.tf\")\n\tassert.Equal(t, 1, len(resources), \"Expecting 1 resource\")\n\tstatement := resources[0].Properties.(map[string]interface{})[\"statement\"]\n\tprincipals := statement.([]interface{})[0].(map[string]interface{})[\"principals\"]\n\tidentifiers := principals.([]interface{})[0].(map[string]interface{})[\"identifiers\"]\n\tvalue, ok := identifiers.([]interface{})\n\tassert.True(t, ok)\n\t_, ok = value[0].(string)\n\tassert.True(t, ok)\n}", "title": "" }, { "docid": "6e5aef8fbd2c7c915587e81b4e97948c", "score": "0.45587027", "text": "func (t *Record) IsGeneric() bool { return t.Flags&ContainsGenericVars != 0 }", "title": "" }, { "docid": "f6b577f991ff7833492c925798739af6", "score": "0.45552683", "text": "func equal(a interface{}, b interface{}) bool {\n\ta, at := getType(a)\n\tb, bt := getType(b)\n\n\tif at == stringType {\n\t\tif bt != stringType {\n\t\t\treturn false\n\t\t}\n\t\treturn a.(string) == b.(string)\n\t} else if bt == stringType {\n\t\tif at != stringType {\n\t\t\treturn false\n\t\t}\n\t\treturn a.(string) == b.(string)\n\t} else if at == boolType {\n\t\tif bt != boolType {\n\t\t\treturn false\n\t\t}\n\t\treturn a.(bool) == b.(bool)\n\t} else if bt == boolType {\n\t\tif at != boolType {\n\t\t\treturn false\n\t\t}\n\t\treturn a.(bool) == b.(bool)\n\t} else {\n\t\t// got numeric types\n\t\treturn compare(a, b) == 0\n\t}\n}", "title": "" }, { "docid": "e0c9f04fb8a657cfddb71ae4598c08f5", "score": "0.45523518", "text": "func (m Map) Is(typ string) bool {\n\tif m.Len() != 1 {\n\t\treturn false\n\t}\n\n\t_, ok := m.m[typ]\n\treturn ok\n}", "title": "" }, { "docid": "f028eb395c50e29bf1a14474c587daba", "score": "0.4552133", "text": "func IsTimespan(t sql.Type) bool {\n\t_, ok := t.(TimespanType_)\n\treturn ok\n}", "title": "" }, { "docid": "c15035d43e319b37ccb9abf5ed81922a", "score": "0.45441556", "text": "func (me TxsdTagClass) IsElement() bool { return me == \"element\" }", "title": "" }, { "docid": "3a30c80e739b0d2267c0dc022768d6ac", "score": "0.45415738", "text": "func IsNested(t Type) bool {\n\tswitch t {\n\tcase LIST, LARGE_LIST, FIXED_SIZE_LIST, MAP, STRUCT, SPARSE_UNION, DENSE_UNION:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9c0913dbaa0a02406c91f20ae4d45480", "score": "0.4539324", "text": "func (t *Transformer) IsStruct(pkg, name string) bool {\n\treturn t.structSet.Contains(pkg, name)\n}", "title": "" }, { "docid": "78d695953dd8f52e5fb4262f59c41290", "score": "0.4531515", "text": "func (adaType *StructureType) IsStructure() bool {\n\treturn true\n}", "title": "" }, { "docid": "5adf497403e3cfafcb2ec69ad827e2d8", "score": "0.4530019", "text": "func (*NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MultiTopology_Topology) IsYANGGoStruct() {}", "title": "" } ]
5b3a7da0a40b8559b3d7ef670fef4f46
GetPoints returns the array of points, where each point is the usage at that time
[ { "docid": "a248f6135903c1cf1dd8d3bd28ee9ba5", "score": "0.698338", "text": "func (s *ScaleInfo) GetPoints() []float32 {\n\treturn s.points\n}", "title": "" } ]
[ { "docid": "21853bd4fe3a0c61ae1c8072ce3b4633", "score": "0.7238961", "text": "func (ema *Ema) GetPoints() []point {\n\treturn ema.points\n}", "title": "" }, { "docid": "84a9c71899cdd371aa765e8cec75345d", "score": "0.69611245", "text": "func GetPoints(l *Line, quantity int, stepRate float64, out []*point.Point) []*point.Point {\n\tif quantity <= 0 && stepRate > 0 {\n\t\tquantity = int(Length(l) / stepRate)\n\t}\n\n\tif out == nil {\n\t\tout = make([]*point.Point, 0)\n\t}\n\n\tfor idx := 0; idx < quantity; idx++ {\n\t\tposition := float64(idx) / float64(quantity)\n\n\t\tx := l.X1 + (l.X2-l.X1)*position\n\t\ty := l.Y1 + (l.Y2-l.Y1)*position\n\n\t\tout = append(out, point.New(x, y))\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "caaa188185b7c941b38973a4a0a83623", "score": "0.69404685", "text": "func (s *Server) GetPoints() []Message {\n\ts.cond.L.Lock()\n\tdefer s.cond.L.Unlock()\n\tcpy := make([]Message, len(s.points))\n\tcopy(cpy, s.points)\n\treturn cpy\n}", "title": "" }, { "docid": "9295747d1b4ec8b3095c3d293f5c6108", "score": "0.67994595", "text": "func (c *Aggregator) Points() ([]Point, error) {\n\treturn c.samples, nil\n}", "title": "" }, { "docid": "cb63cc0fe581c5920e30ea6e14e2aa51", "score": "0.654223", "text": "func (s *QuasiSampler) GetSamplingPoints() []f64.Vec2 {\n\ts.buildAdaptiveSubdivision(6)\n\tpointlist := s.collectPoints(true)\n\treturn pointlist\n}", "title": "" }, { "docid": "696639f4432d7896cc6b5e1506bd98ed", "score": "0.636475", "text": "func (c Cluster) GetPoints() []int {\n\treturn append([]int(nil), c.indices...)\n}", "title": "" }, { "docid": "622f7aed4d29030c650c9d664cd9789c", "score": "0.6216373", "text": "func (t *Tile) GetPoints(output chan<- Point) {\n\tif t.Level == level_depth {\n\t\tfor _, point := range t.Points {\n\t\t\toutput <- point\n\t\t}\n\t} else {\n\t\tfor _, tile := range t.SubTiles {\n\t\t\tif tile != nil {\n\t\t\t\ttile.GetPoints(output)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a2c51f0bafbf33c131dcf07de471a514", "score": "0.6183968", "text": "func (s *Series) Points() DataPoints {\n\tif s.Len() == 0 {\n\t\treturn DataPoints{}\n\t}\n\tpoints := make(DataPoints, 0, s.Len())\n\tend := s.End()\n\tvals := s.Values()\n\ti := 0\n\tfor t := s.Start(); t <= end; t += int64(s.Step()) {\n\t\tpoints = append(points, NewDataPoint(t, vals[i]))\n\t\ti++\n\t}\n\treturn points\n}", "title": "" }, { "docid": "274dfe01a8756247e291c8f662ddf511", "score": "0.6142261", "text": "func (s *Asteroid) getPoints() {\n\ts.points = s.init\n\ts.drawable = makeVertexArrayObj(s.points)\n}", "title": "" }, { "docid": "0516d0370b07956bf62e2d109432fd3a", "score": "0.6111751", "text": "func (d *DBManager) ListPoints() ([]*TrackerPoint, error) {\n\tpoints := []*TrackerPoint{}\n\n\trows, err := d.listPoint.Query()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tbusID := \"\"\n\t\tlongitude := float64(0)\n\t\tlatitude := float64(0)\n\t\ttimestamp := \"\"\n\n\t\terr = rows.Scan(&busID, &longitude, &latitude, &timestamp)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpoints = append(points, &TrackerPoint{\n\t\t\tBusID: busID,\n\t\t\tTimeStamp: timestamp,\n\t\t\tLongitude: longitude,\n\t\t\tLatitude: latitude,\n\t\t})\n\n\t}\n\n\treturn points, nil\n}", "title": "" }, { "docid": "7eecd64265113897b883599a0fb8ac62", "score": "0.60896665", "text": "func (g *Group) Points() []kyber.Point {\n\tpts := make([]kyber.Point, g.Len())\n\tfor i, pu := range g.Nodes {\n\t\tpts[i] = pu.Key\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "131c0beb781cf539ce7fb6a05c3ddd30", "score": "0.60697925", "text": "func getPoint(x, y []byte) plotter.XYZs {\n\tpts := make(plotter.XYZs, len(x))\n\tfor i := range x {\n\t\tpts[i].X = float64(x[i])\n\t\tpts[i].Y = float64(y[i])\n\t\tpts[i].Z = 0.1\n\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "04dfca2a7b370ae3dae52afb832a51fa", "score": "0.60361797", "text": "func (r *Rdp) ToPoints() []Point {\n\tpoints := make([]Point, 0, r.vs.Len())\n\tfor i := 0; i < r.vs.Len(); i++ {\n\t\tpoints = append(points, Point{xCoordinate: r.ts.Value(i), yCoordinate: r.vs.Value(i)})\n\t}\n\n\treturn points\n}", "title": "" }, { "docid": "7ecbb5ecc92881169d4adf1c4557898a", "score": "0.60297346", "text": "func GetListOfPoints(token string, vid int64) (pointListForProto []*dlVisitedProto.PointInfoMsg, err error) {\n\tpointList, err := libForVisitedPoints.GetVisitedPoints(token, vid)\n\tfor i, val := range pointList {\n\t\tpointListForProto[i].Lat = float32(val.Lat)\n\t\tpointListForProto[i].Long = float32(val.Long)\n\t\tpointListForProto[i].Id = val.ID\n\t\tpointListForProto[i].Title = val.Title\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c0e0a0d6972418725e1e69d0644861c", "score": "0.6026676", "text": "func GetHisPoint() []vm.HisPointView {\n\titems := make([]vm.HisPointView, 0)\n\n\tps := influxstore.GetAllHisCorePoint()\n\n\tfor _, p := range ps {\n\t\tvp := vm.HisPointView{}\n\t\tmodel.Copy(&vp, p)\n\t\tvp.CurrentNumericValueString = fmt.Sprintf(\"%.2f\", p.CurrentNumericValue)\n\t\tvp.TimestampString = str.TimeToString(p.Timstamp)\n\t\titems = append(items, vp)\n\t}\n\treturn items\n}", "title": "" }, { "docid": "e0cefbc194554b3e1dbd8273b96d81bd", "score": "0.60222524", "text": "func (db *AppDB) RetrieveAllPoints(chargerType []string) ([]PointJS, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\r\n\tdefer cancel()\r\n\r\n\tvar results []PointJS\r\n\tcur, err := db.MDB.Collection(db.Env.DBPointColl).Find(ctx, bson.M{})\r\n\tif err != nil {\r\n\t\tlogger.Error.Println(\"retrieveAllPoints-query: \", err)\r\n\t\treturn []PointJS{}, err\r\n\t}\r\n\r\n\tfor cur.Next(ctx) {\r\n\t\tvar p Point\r\n\t\terr := cur.Decode(&p)\r\n\t\tif err != nil {\r\n\t\t\tlogger.Error.Println(\"retrieveAllPoints-decoding: \", err)\r\n\t\t\treturn []PointJS{}, err\r\n\t\t}\r\n\r\n\t\tpJS := parsePoint(p, chargerType)\r\n\t\tresults = append(results, pJS)\r\n\t}\r\n\treturn results, nil\r\n}", "title": "" }, { "docid": "cfde7f92f242c3ab87808b25d8e6e3f3", "score": "0.59625393", "text": "func (s *RestServer) getDropMetricsPoints() ([]*tsdb.Point, error) {\n\n\titer, err := goproto.NewDropMetricsIterator()\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\tpoints := []*tsdb.Point{}\n\n\tfor iter.HasNext() {\n\t\tm := iter.Next()\n\t\tif m == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// translate key to meta\n\t\tobjMeta := s.GetObjectMeta(\"DropMetricsKey\", m.GetKey())\n\t\tif objMeta == nil {\n\t\t\tlog.Errorf(\"failed to get objMeta for DropMetrics key %+v\", m.GetKey())\n\t\t\tcontinue\n\t\t}\n\t\ttags := s.getTagsFromMeta(objMeta)\n\t\tfields := structs.Map(m)\n\n\t\tif len(fields) > 0 {\n\t\t\tdelete(fields, \"ObjectMeta\")\n\t\t\tpoints = append(points, &tsdb.Point{Tags: tags, Fields: fields})\n\t\t}\n\t}\n\n\titer.Free()\n\treturn points, nil\n\n}", "title": "" }, { "docid": "222d8e5c398f3ee180b4a68f3665efca", "score": "0.59189636", "text": "func (t *BasicKDTree) Points() [][2]float64 {\n\treturn t.points\n}", "title": "" }, { "docid": "976ae37bdd6ceec832d543c369a51f93", "score": "0.59041375", "text": "func getDataPoints(pmd pmetric.Metric, metadata cWMetricMetadata, logger *zap.Logger) dataPoints {\n\tmetricMetadata := deltaMetricMetadata{\n\t\tadjustToDelta: false,\n\t\tretainInitialValueForDelta: metadata.retainInitialValueForDelta,\n\t\tmetricName: pmd.Name(),\n\t\tnamespace: metadata.namespace,\n\t\tlogGroup: metadata.logGroup,\n\t\tlogStream: metadata.logStream,\n\t}\n\n\tvar dps dataPoints\n\n\t//exhaustive:enforce\n\tswitch pmd.Type() {\n\tcase pmetric.MetricTypeGauge:\n\t\tmetric := pmd.Gauge()\n\t\tdps = numberDataPointSlice{\n\t\t\tmetricMetadata,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pmetric.MetricTypeSum:\n\t\tmetric := pmd.Sum()\n\t\tmetricMetadata.adjustToDelta = metric.AggregationTemporality() == pmetric.AggregationTemporalityCumulative\n\t\tdps = numberDataPointSlice{\n\t\t\tmetricMetadata,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pmetric.MetricTypeHistogram:\n\t\tmetric := pmd.Histogram()\n\t\tdps = histogramDataPointSlice{\n\t\t\tmetricMetadata,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pmetric.MetricTypeExponentialHistogram:\n\t\tmetric := pmd.ExponentialHistogram()\n\t\tdps = exponentialHistogramDataPointSlice{\n\t\t\tmetricMetadata,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tcase pmetric.MetricTypeSummary:\n\t\tmetric := pmd.Summary()\n\t\t// For summaries coming from the prometheus receiver, the sum and count are cumulative, whereas for summaries\n\t\t// coming from other sources, e.g. SDK, the sum and count are delta by being accumulated and reset periodically.\n\t\t// In order to ensure metrics are sent as deltas, we check the receiver attribute (which can be injected by\n\t\t// attribute processor) from resource metrics. If it exists, and equals to prometheus, the sum and count will be\n\t\t// converted.\n\t\t// For more information: https://github.com/open-telemetry/opentelemetry-collector/blob/main/receiver/prometheusreceiver/DESIGN.md#summary\n\t\tmetricMetadata.adjustToDelta = metadata.receiver == prometheusReceiver\n\t\tdps = summaryDataPointSlice{\n\t\t\tmetricMetadata,\n\t\t\tmetric.DataPoints(),\n\t\t}\n\tdefault:\n\t\tlogger.Warn(\"Unhandled metric data type.\",\n\t\t\tzap.String(\"DataType\", pmd.Type().String()),\n\t\t\tzap.String(\"Name\", pmd.Name()),\n\t\t\tzap.String(\"Unit\", pmd.Unit()),\n\t\t)\n\t}\n\n\treturn dps\n}", "title": "" }, { "docid": "258d042cb541ad494f487caf14db2e86", "score": "0.58203816", "text": "func (c *CSVHandler) GetSampledPointsForMetric(metric string, start time.Time, end time.Time, resolution int) ([]float64, error) {\n\tpoints, err := c.store.SelectMetricTimeRange(metric, start, end)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tduration := end.Sub(start)\n\tdurMillis := duration.Nanoseconds() / 1e6\n\tresolutionDur := time.Duration(resolution) * time.Millisecond\n\tnumRows := int(durMillis-1)/resolution + 1\n\tcolumn := make([]float64, numRows)\n\tvar last float64\n\ti := 0\n\trow := 0\n\tfor timestamp := start; timestamp.Before(end); timestamp = timestamp.Add(resolutionDur) {\n\t\tfor i < len(points) && points[i].Time.Before(timestamp) {\n\t\t\ti++\n\t\t}\n\t\tnext := timestamp.Add(resolutionDur)\n\t\tif i >= len(points) || points[i].Time.Equal(next) || points[i].Time.After(next) {\n\t\t\tcolumn[row] = last\n\t\t} else {\n\t\t\tcolumn[row] = points[i].Value\n\t\t\tlast = points[i].Value\n\t\t}\n\t\trow++\n\t}\n\treturn column, nil\n}", "title": "" }, { "docid": "67ce355c07f934735cc1693300d2c7cc", "score": "0.57425284", "text": "func (s *RestServer) getPciePortMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "0cc6ad3db833256acb005d8fed0ba0b1", "score": "0.5721127", "text": "func ToPoints(xys plotter.XYs) []rdp.Point {\n\tpoints := make([]rdp.Point, 0, len(xys))\n\tfor i := range xys {\n\t\tpoints = append(points, rdp.Point{X: xys[i].X, Y: xys[i].Y})\n\t}\n\n\treturn points\n}", "title": "" }, { "docid": "ef90b361a96eb54b9ae4f21b8d42dbdc", "score": "0.5712575", "text": "func (s *QuasiSampler) collectPoints(filterBounds bool) []f64.Vec2 {\n\tvar pointlist []f64.Vec2\n\n\tit := NewTileLeafIterator(s.root)\n\tfor {\n\t\tpt := it.GetShape().GetP1()\n\t\t// Only \"pentagonal\" tiles generate sampling points.\n\t\tif it.GetShape().IsSamplingType() {\n\t\t\timportance := s.GetImportanceAt_bounded(pt)\n\n\t\t\t// Threshold the function against the F-Code value.\n\t\t\tif importance >= calcFCodeValue(it.GetShape().GetFCode(), it.GetShape().GetLevel()) {\n\t\t\t\t// Get the displaced point using the lookup table.\n\t\t\t\tpt_displaced := it.GetShape().GetDisplacedSamplingPoint(importance)\n\n\t\t\t\tif !filterBounds ||\n\t\t\t\t\t(pt_displaced.X >= 0 && pt_displaced.X < s.width &&\n\t\t\t\t\t\tpt_displaced.Y >= 0 && pt_displaced.Y < s.height) {\n\t\t\t\t\tpointlist = append(pointlist, pt_displaced)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif !it.Next() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn pointlist\n}", "title": "" }, { "docid": "843baafbb0146d2233dd9a8d6704abfd", "score": "0.5708957", "text": "func (p performanceData) getInfo() []PerformanceDataPoint {\n\tvar info []PerformanceDataPoint\n\tfor _, pd := range p {\n\t\tinfo = append(info, pd)\n\t}\n\treturn info\n}", "title": "" }, { "docid": "6f1e583ca8bd44eb8fdc682f07940f9a", "score": "0.56946605", "text": "func (c *Circle) Points() []*Point {\n\tx, y, dx, dy := c.R-1, 0, 1, 1\n\te := dx - (c.R * 2)\n\n\tpoints := make([]*Point, 0)\n\n\tfor x > y {\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + x,\n\t\t\tY: c.Center.Y + y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + y,\n\t\t\tY: c.Center.Y + x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - y,\n\t\t\tY: c.Center.Y + x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - x,\n\t\t\tY: c.Center.Y + y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - x,\n\t\t\tY: c.Center.Y - y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - y,\n\t\t\tY: c.Center.Y - x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + y,\n\t\t\tY: c.Center.Y - x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + x,\n\t\t\tY: c.Center.Y - y,\n\t\t})\n\n\t\tif e <= 0 {\n\t\t\ty++\n\t\t\te += dy\n\t\t\tdy += 2\n\t\t}\n\n\t\tif e > 0 {\n\t\t\tx--\n\t\t\tdx += 2\n\t\t\te += dx - (c.R * 2)\n\t\t}\n\t}\n\n\treturn points\n}", "title": "" }, { "docid": "1bdc50894563f1d0bfb903260c82f9b1", "score": "0.56914914", "text": "func NewPoints(points []data.Point) []Point {\n\tret := make([]Point, len(points))\n\n\tfor i, p := range points {\n\t\tret[i] = NewPoint(p)\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "06e113be0f3091a16e421b5b9b49441c", "score": "0.5683929", "text": "func (g *Game) CalculatePoints(from, to int) []models.PointsEntrySimple {\n\tg.mu.RLock()\n\tdefer g.mu.RUnlock()\n\ttotalPoints := make(map[string]int)\n\tfor i := from; i <= to; i++ {\n\t\tqp := getPointsForQuestion(g.players, i)\n\t\tfor _, entry := range qp {\n\t\t\ttotalPoints[entry.Player] += entry.Points\n\t\t}\n\t}\n\tvar pes []models.PointsEntrySimple\n\tfor player, points := range totalPoints {\n\t\tpes = append(pes, models.PointsEntrySimple{\n\t\t\tPlayer: player,\n\t\t\tPoints: points,\n\t\t})\n\t}\n\treturn pes\n}", "title": "" }, { "docid": "369aa2019c60ccd56da598dd6fa391d7", "score": "0.56613445", "text": "func (o *LoyaltySubLedger) GetActivePoints() []LoyaltyLedgerEntry {\n\tif o == nil || o.ActivePoints == nil {\n\t\tvar ret []LoyaltyLedgerEntry\n\t\treturn ret\n\t}\n\treturn *o.ActivePoints\n}", "title": "" }, { "docid": "2f7180b1b20059826e2a0440a07cc8fb", "score": "0.56499636", "text": "func (p *point) GetCoordinates() []float64 {\n\treturn p.Coordinates\n}", "title": "" }, { "docid": "f30784119a7201cef61200d16c13a80d", "score": "0.5597183", "text": "func (d Datapoints) Datapoints() []Datapoint { return d }", "title": "" }, { "docid": "361c2aaf2055fe69b6e8dc906ab5c50b", "score": "0.55749714", "text": "func GetDataPoints(points [][]float64, score map[int]float64, threshold float64) [][]float64 {\n\tdataCols := len(points[0])\n\tscoreCols := 1\n\tif threshold > 0 {\n\t\tscoreCols = 2\n\t}\n\n\tplotPoints := array.Zero2D(len(points), dataCols+scoreCols)\n\n\tfor row := range points {\n\t\t// Store the data points for this row\n\t\tfor col, value := range points[row] {\n\t\t\tplotPoints[row][col] = value\n\t\t}\n\t\t// Next column is the score for this row\n\t\tplotPoints[row][dataCols] = score[row]\n\t\tif threshold > 0 {\n\t\t\t// Last column is above/below threshold (1/0)\n\t\t\tplotPoints[row][dataCols+1] = BoolToFloat(score[row] >= threshold)\n\t\t}\n\t}\n\treturn plotPoints\n}", "title": "" }, { "docid": "e85550ccf8d058410b6d63ca698d0e30", "score": "0.5559253", "text": "func GetChartData(user *User) []int {\n\thours := time.Duration(time.Now().Round(time.Hour).Hour()) * time.Hour\n\tdays := time.Duration((time.Now().Day()-1)*24) * time.Hour\n\tstart := time.Now().Round(time.Hour).Add(-hours).Add(-days).AddDate(-1, 1, 0)\n\n\tend := start.AddDate(0, 1, 0)\n\n\tlog.Printf(\"[GetChartData] start: %s %s\", start, end)\n\n\tvar data []int\n\n\tfor i := 12; i > 0; i-- {\n\t\tvar visits []*Visit\n\t\tdb.Where(\"created_at BETWEEN ? AND ? AND user_id = ?\", start, end, user.ID).Find(&visits)\n\t\tdata = append(data, len(visits))\n\t\tstart = start.AddDate(0, 1, 0)\n\t\tend = end.AddDate(0, 1, 0)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "457c9b8445e670e9108d36ff25f8e77d", "score": "0.55454963", "text": "func (g *goMetrics) Datapoints() []*datapoint.Datapoint {\n\tmstat := runtime.MemStats{}\n\truntime.ReadMemStats(&mstat)\n\n\t// inform the cb routine that you have new stats to work on\n\tg.mu.RLock()\n\tfor _, cb := range g.cb {\n\t\tcb(&mstat)\n\t}\n\tg.mu.RUnlock()\n\n\tdims := map[string]string{\n\t\t\"instance\": \"global_stats\",\n\t\t\"stattype\": \"golang_sys\",\n\t}\n\treturn []*datapoint.Datapoint{\n\t\tGauge(\"Alloc\", dims, int64(mstat.Alloc)),\n\t\tCumulative(\"TotalAlloc\", dims, int64(mstat.TotalAlloc)),\n\t\tGauge(\"Sys\", dims, int64(mstat.Alloc)),\n\t\tCumulative(\"Lookups\", dims, int64(mstat.Lookups)),\n\t\tCumulative(\"Mallocs\", dims, int64(mstat.Mallocs)),\n\t\tCumulative(\"Frees\", dims, int64(mstat.Frees)),\n\t\tGauge(\"HeapAlloc\", dims, int64(mstat.HeapAlloc)),\n\t\tGauge(\"HeapSys\", dims, int64(mstat.HeapSys)),\n\t\tGauge(\"HeapIdle\", dims, int64(mstat.HeapIdle)),\n\t\tGauge(\"HeapInuse\", dims, int64(mstat.HeapInuse)),\n\t\tGauge(\"HeapReleased\", dims, int64(mstat.HeapReleased)),\n\t\tGauge(\"HeapObjects\", dims, int64(mstat.HeapObjects)),\n\t\tGauge(\"StackInuse\", dims, int64(mstat.StackInuse)),\n\t\tGauge(\"StackSys\", dims, int64(mstat.StackSys)),\n\t\tGauge(\"MSpanInuse\", dims, int64(mstat.MSpanInuse)),\n\t\tGauge(\"MSpanSys\", dims, int64(mstat.MSpanSys)),\n\t\tGauge(\"MCacheInuse\", dims, int64(mstat.MCacheInuse)),\n\t\tGauge(\"MCacheSys\", dims, int64(mstat.MCacheSys)),\n\t\tGauge(\"BuckHashSys\", dims, int64(mstat.BuckHashSys)),\n\t\tGauge(\"GCSys\", dims, int64(mstat.GCSys)),\n\t\tGauge(\"OtherSys\", dims, int64(mstat.OtherSys)),\n\t\tGauge(\"NextGC\", dims, int64(mstat.NextGC)),\n\t\tGauge(\"LastGC\", dims, int64(mstat.LastGC)),\n\t\tCumulative(\"PauseTotalNs\", dims, int64(mstat.PauseTotalNs)),\n\t\tGauge(\"NumGC\", dims, int64(mstat.NumGC)),\n\n\t\tGauge(\"GOMAXPROCS\", dims, int64(runtime.GOMAXPROCS(0))),\n\t\tGauge(\"process.uptime.ns\", dims, time.Since(startTime).Nanoseconds()),\n\t\tGauge(\"num_cpu\", dims, int64(runtime.NumCPU())),\n\n\t\tCumulative(\"num_cgo_call\", dims, runtime.NumCgoCall()),\n\n\t\tGauge(\"num_goroutine\", dims, int64(runtime.NumGoroutine())),\n\t}\n}", "title": "" }, { "docid": "22634aedd5e6db68c79833bc0887329f", "score": "0.5544322", "text": "func (s *RestServer) getL2FlowPerformanceMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "1c70fa4cd87c2be95cee46949eb80f17", "score": "0.55434424", "text": "func Points(scorer interface{ Number() uint8 }) uint8 {\n\tvar points = map[uint8]uint8{1: 11, 3: 10, 8: 2, 9: 3, 10: 4}\n\treturn points[scorer.Number()]\n}", "title": "" }, { "docid": "c72b636182c0c0603034a97518f0db3f", "score": "0.55414957", "text": "func (c *Counter) Datapoints() []*datapoint.Datapoint {\n\tvar dims map[string]string\n\tif c.DroppedReason != \"\" {\n\t\tdims = map[string]string{\"reason\": c.DroppedReason}\n\t}\n\treturn []*datapoint.Datapoint{\n\t\tsfxclient.Cumulative(\"total_process_errors\", nil, atomic.LoadInt64(&c.TotalProcessErrors)),\n\t\tsfxclient.Cumulative(\"total_datapoints\", nil, atomic.LoadInt64(&c.TotalDatapoints)),\n\t\tsfxclient.Cumulative(\"total_events\", nil, atomic.LoadInt64(&c.TotalEvents)),\n\t\tsfxclient.Cumulative(\"total_spans\", nil, atomic.LoadInt64(&c.TotalSpans)),\n\t\tsfxclient.Cumulative(\"total_process_calls\", nil, atomic.LoadInt64(&c.TotalProcessCalls)),\n\t\tsfxclient.Cumulative(\"dropped_points\", dims, atomic.LoadInt64(&c.ProcessErrorPoints)),\n\t\tsfxclient.Cumulative(\"dropped_events\", dims, atomic.LoadInt64(&c.ProcessErrorEvents)),\n\t\tsfxclient.Cumulative(\"dropped_spans\", dims, atomic.LoadInt64(&c.ProcessErrorSpans)),\n\t\tsfxclient.Cumulative(\"process_time_ns\", nil, atomic.LoadInt64(&c.TotalProcessTimeNs)),\n\t\tsfxclient.Gauge(\"calls_in_flight\", nil, atomic.LoadInt64(&c.CallsInFlight)),\n\t}\n}", "title": "" }, { "docid": "a34b3835f244dc8e1e00bf818ee3915b", "score": "0.5532466", "text": "func (r *ImageRef) GetPoint(x int, y int) ([]float64, error) {\n\tn := 3\n\tif vipsHasAlpha(r.image) {\n\t\tn = 4\n\t}\n\treturn vipsGetPoint(r.image, n, x, y)\n}", "title": "" }, { "docid": "7a99e87936dc64736f512e8d5c77f76f", "score": "0.5527248", "text": "func NewPoints() Points {\n\treturn Points{\n\t\t\"P\": NewAttributes(Vector, 3),\n\t}\n}", "title": "" }, { "docid": "bfca0b6db68d6ac38ab5082d3f3da999", "score": "0.55196726", "text": "func Points(r io.Reader, cfg Config) (client.BatchPoints, error) {\n\tif err := cfg.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbenchset, err := parse.ParseMultipleBenchmarks(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbp, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tPrecision: \"s\",\n\t\tDatabase: cfg.Database,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor pkg, bs := range benchset {\n\t\tfor _, b := range bs {\n\t\t\ttags := map[string]string{\n\t\t\t\t\"goversion\": cfg.GoVersion,\n\t\t\t\t\"hwid\": cfg.HardwareID,\n\t\t\t\t\"pkg\": pkg,\n\t\t\t\t\"procs\": strconv.Itoa(b.Procs),\n\t\t\t\t\"name\": b.Name,\n\t\t\t}\n\t\t\tif cfg.Branch != \"\" {\n\t\t\t\ttags[\"branch\"] = cfg.Branch\n\t\t\t}\n\t\t\tp, err := client.NewPoint(\n\t\t\t\tcfg.Measurement,\n\t\t\t\ttags,\n\t\t\t\tmakeFields(b, cfg.Revision),\n\t\t\t\tcfg.Timestamp,\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tbp.AddPoint(p)\n\t\t}\n\t}\n\n\treturn bp, nil\n}", "title": "" }, { "docid": "749c92dcaf14fc249602a81566fdb421", "score": "0.54806954", "text": "func (p Point) Values() []float64 {\n\treturn p\n}", "title": "" }, { "docid": "02d96a27778cbe88ef7bb0b2e13340cf", "score": "0.5480375", "text": "func GenerateStats() []aflShared.StatsModel {\n\ti := 0\n\tvar result []aflShared.StatsModel\n\n\tgroupByPoint := groupMatchesByPoints()\n\n\tfor _, p := range groupByPoint {\n\t\tif i == 0 {\n\t\t\tpointLow = p.Point\n\t\t}\n\n\t\tbetCount += p.BetTotal\n\t\twonCount += p.WonCount\n\t\twon40plus += p.WonOver40Count\n\t\twonUnder40 += p.WonUnder40Count\n\t\tlose40plus += p.LoseOver40Count\n\t\tloseUnder40 += p.LoseUnder40Count\n\n\t\ti++\n\t\tif i > 4 {\n\t\t\tresult = addToArray(result, p.Point)\n\t\t\treset()\n\t\t\ti = 0\n\t\t}\n\t}\n\n\t// Add Leftover results\n\tif i > 0 {\n\t\tresult = addToArray(result, groupByPoint[len(groupByPoint)-1].Point)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5a1a9ed67fe383f0a05f9be375995dc0", "score": "0.54616565", "text": "func (r *Automaton) GetStartPoints() []int {\n\tpointset := make(map[int]struct{})\n\tpointset[0] = struct{}{}\n\n\tfor s := 0; s < r.nextState; s += 2 {\n\t\ttrans := r.states[s]\n\t\tlimit := trans + 3*r.states[s+1]\n\t\t//System.out.println(\" state=\" + (s/2) + \" trans=\" + trans + \" limit=\" + limit);\n\t\tfor trans < limit {\n\t\t\tmin := r.transitions[trans+1]\n\t\t\tmax := r.transitions[trans+2]\n\t\t\t//System.out.println(\" min=\" + min);\n\t\t\tpointset[min] = struct{}{}\n\t\t\tif max < 0x10FFFF {\n\t\t\t\tpointset[max+1] = struct{}{}\n\t\t\t}\n\t\t\ttrans += 3\n\t\t}\n\t}\n\n\tpoints := make([]int, 0, len(pointset))\n\tfor k, _ := range pointset {\n\t\tpoints = append(points, k)\n\t}\n\tsort.Ints(points)\n\treturn points\n}", "title": "" }, { "docid": "d667a01f6fc29461cba5b881dd1e91eb", "score": "0.54577875", "text": "func (s *RestServer) getPcieMgrMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "14cc5754f017e17ce2c6ecb377e20849", "score": "0.5442662", "text": "func (s *RestServer) getIPv4FlowPerformanceMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "509a3192ba50fb11a00bee6b92b77de3", "score": "0.5442065", "text": "func (pc *ParticleClient) Points(nodeID string, points []data.Point) {\n\tpc.newPoints <- NewPoints{nodeID, \"\", points}\n}", "title": "" }, { "docid": "a18ec4a0cd55bab66458189f18b5e922", "score": "0.54394096", "text": "func pPoints(q []plotValues) map[plotKeys]plotter.XYs {\n\tpts := make(map[plotKeys]plotter.XYs)\n\tfor i := range q {\n\t\tfmt.Println(i)\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "f9bed9ac9b666936f17bb26041bcef35", "score": "0.543868", "text": "func testPoints(nodes ...*runtime.Node) (points []*client.Point) {\n\t// Create dummy client\n\tinfluxClient, err := client.NewHTTPClient(client.HTTPConfig{Addr: \"http://127.0.0.1\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tnodesList := runtime.NewNodes(&runtime.Config{})\n\n\t// Create dummy connection\n\tconn := &Connection{\n\t\tpoints: make(chan *client.Point),\n\t\tclient: influxClient,\n\t}\n\n\tfor _, node := range nodes {\n\t\tnodesList.AddNode(node)\n\t}\n\n\t// Process data\n\tgo func() {\n\t\tfor _, node := range nodes {\n\t\t\tconn.InsertNode(node)\n\t\t\tif node.Neighbours != nil {\n\t\t\t\tfor _, link := range nodesList.NodeLinks(node) {\n\t\t\t\t\tconn.InsertLink(&link, node.Lastseen.GetTime())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconn.Close()\n\t}()\n\n\t// Read points\n\tfor point := range conn.points {\n\t\tpoints = append(points, point)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a1940defc2cf2be02547453d8bb7d1ce", "score": "0.5434798", "text": "func (o *LoyaltySubLedger) GetExpiredPoints() []LoyaltyLedgerEntry {\n\tif o == nil || o.ExpiredPoints == nil {\n\t\tvar ret []LoyaltyLedgerEntry\n\t\treturn ret\n\t}\n\treturn *o.ExpiredPoints\n}", "title": "" }, { "docid": "2c90ed9a8f9d74ebade50ab2683dd813", "score": "0.5420959", "text": "func (u *UpdateShortMessage) GetPts() (value int) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Pts\n}", "title": "" }, { "docid": "28e3be99e371ca41209ae991beac028d", "score": "0.54147637", "text": "func (s *RestServer) getL2FlowRawMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "877990ec89c2b8265c3201ebdec2c065", "score": "0.5413468", "text": "func (u *UpdateShortSentMessage) GetPts() (value int) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Pts\n}", "title": "" }, { "docid": "aa165ebf49d001cf13a8c9aab698ea25", "score": "0.5413133", "text": "func (tee *Tee) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType topodatapb.TabletType) (*topodatapb.EndPoints, int64, error) {\n\treturn tee.readFrom.GetEndPoints(ctx, cell, keyspace, shard, tabletType)\n}", "title": "" }, { "docid": "3d26d65be0533d223f1efaa9c545d449", "score": "0.5412243", "text": "func GetRoutePoints(db *sql.DB, routeid string) float64 {\n\tresults, err := db.Query(\"SELECT * FROM BikeTransport_db.RoutePoints WHERE RouteID=? ORDER BY Position\", routeid)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to execute SQL command:\", err)\n\t\tlog.Fatalln(\"Failed to execute SQL command:\", err)\n\t}\n\n\tvar distance float64\n\tvar route pkgs.LinkedList\n\tvar routePx pkgs.RoutePoint\n\tfor results.Next() {\n\t\terr := results.Scan(&routePx.ID, &routePx.RouteID, &routePx.Lat, &routePx.Lon, &routePx.Time.Day, &routePx.Time.Month, &routePx.Time.Year, &routePx.Time.Hour, &routePx.Time.Min, &routePx.Position)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed to scan in SQL records:\", err)\n\t\t\tlog.Fatalln(\"Failed to scan in SQL records:\", err)\n\t\t}\n\t\troute.AddNode(routePx)\n\t}\n\n\tcurrentNode := route.Head\n\tnextNode := currentNode.Next\n\tfor nextNode.Next != nil {\n\t\tfmt.Println(currentNode.Item.Lat, currentNode.Item.Lon)\n\t\tfmt.Println(nextNode.Item.Lat, nextNode.Item.Lon)\n\t\tdistance += findDistance(currentNode.Item.Lat, currentNode.Item.Lon, nextNode.Item.Lat, nextNode.Item.Lon)\n\t\tcurrentNode = currentNode.Next\n\t\tnextNode = nextNode.Next\n\t}\n\tfmt.Println(\"Distance calculate: \", distance)\n\treturn distance\n}", "title": "" }, { "docid": "416d915bf9b4939d880e83fd66eb2e9e", "score": "0.5405135", "text": "func GetHistoryPoints(c *gin.Context) {\n\tpagedrequest := model.Pagedrequest{}\n\tspecExerciseID, _ := strconv.Atoi(c.Param(\"specExerciseId\"))\n\n\tbodyErr := c.BindJSON(&pagedrequest)\n\n\tif bodyErr == nil {\n\t\tresult := service.GetHistoryPoints(pagedrequest, specExerciseID)\n\t\tc.JSON(200, result)\n\t}\n}", "title": "" }, { "docid": "c0150be17d2fb24d56e0fbb57a266f88", "score": "0.5376321", "text": "func (cb *CanBusClient) Points(nodeID string, points []data.Point) {\n\tcb.newPoints <- NewPoints{nodeID, \"\", points}\n}", "title": "" }, { "docid": "299432108e9cd67b7c2a52c810b2766a", "score": "0.53739274", "text": "func (t *Datastore) GetTracepoints() ([]*storepb.TracepointInfo, error) {\n\t_, vals, err := t.ds.GetWithPrefix(tracepointsPrefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttracepoints := make([]*storepb.TracepointInfo, len(vals))\n\tfor i, val := range vals {\n\t\tpb := &storepb.TracepointInfo{}\n\t\terr := proto.Unmarshal(val, pb)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttracepoints[i] = pb\n\t}\n\treturn tracepoints, nil\n}", "title": "" }, { "docid": "5cdbbb5737fceb7c2008df570ea0ddd0", "score": "0.53604025", "text": "func (s *GeoDistanceSort) Points(points ...*GeoPoint) *GeoDistanceSort {\n\ts.points = append(s.points, points...)\n\treturn s\n}", "title": "" }, { "docid": "96a0ec05aa128b0439bb47f2f03149bf", "score": "0.53483623", "text": "func (s *RestServer) getIPv4FlowLatencyMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "f7d7c9054898c90d582641c6d15d6475", "score": "0.5345963", "text": "func (o *AccountDashboardStatistic) GetLoyaltyPoints() []AccountDashboardStatisticLoyaltyPoints {\n\tif o == nil || o.LoyaltyPoints == nil {\n\t\tvar ret []AccountDashboardStatisticLoyaltyPoints\n\t\treturn ret\n\t}\n\treturn *o.LoyaltyPoints\n}", "title": "" }, { "docid": "3dee048625735b6d33b767c4b5e9942d", "score": "0.53299356", "text": "func makePoints(arr d.Points) plotter.XYs {\n\tpts := make(plotter.XYs, len(arr))\n\tfor i := range pts {\n\t\tpts[i].X = util.AssertFloat64(arr[i].X(), 0)\n\t\tpts[i].Y = util.AssertFloat64(arr[i].Y(), 0)\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "9a06bc99f26b1cb683608b8810767408", "score": "0.53190184", "text": "func Points(cfg *driver.Config) (client.BatchPoints, error) {\n\tbp, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tPrecision: \"s\",\n\t\tDatabase: cfg.Database,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, rec := range cfg.Records {\n\t\tfields := makeFields(rec)\n\t\ttags := makeTags(rec, fields)\n\t\tvar (\n\t\t\terr error\n\t\t\tp *client.Point\n\t\t)\n\t\tif cfg.Timestamp == nil {\n\t\t\tp, err = client.NewPoint(\n\t\t\t\tcfg.Collection,\n\t\t\t\ttags,\n\t\t\t\tfields,\n\t\t\t)\n\t\t} else {\n\t\t\tp, err = client.NewPoint(\n\t\t\t\tcfg.Collection,\n\t\t\t\ttags,\n\t\t\t\tfields,\n\t\t\t\t*cfg.Timestamp,\n\t\t\t)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbp.AddPoint(p)\n\t}\n\n\treturn bp, nil\n}", "title": "" }, { "docid": "e54093cbc50a35d9ccac281e72ac1d0a", "score": "0.53183234", "text": "func (u *UpdateShortChatMessage) GetPts() (value int) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Pts\n}", "title": "" }, { "docid": "b204885c3bc857e1de26c44c80c31bac", "score": "0.5318295", "text": "func (sl *TimeSlice) NumPoints() uint32 {\n\tif sl.IsEmpty() {\n\t\treturn 0\n\t}\n\treturn sl.lastIdx - sl.firstIdx + 1\n}", "title": "" }, { "docid": "84489d8e74a781a9f30d34fb8f56dfcb", "score": "0.5303127", "text": "func DataPointsFromMetricJSONFormat(raw []metricapi.MetricPoint) (dp metricapi.DataPoints) {\n\tfor _, point := range raw {\n\t\tconverted := metricapi.DataPoint{\n\t\t\tX: point.Timestamp.Unix(),\n\t\t\tY: int64(point.Value),\n\t\t}\n\n\t\tif converted.Y < 0 {\n\t\t\tconverted.Y = 0\n\t\t}\n\n\t\tdp = append(dp, converted)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8e27bcd0915b9d10b19de57fc90aada3", "score": "0.52572554", "text": "func USGPoints(u *unifi.USG, now time.Time) ([]*influx.Point, error) {\n\tif u.Stat.Gw == nil {\n\t\tu.Stat.Gw = &unifi.Gw{}\n\t}\n\ttags := map[string]string{\n\t\t\"id\": u.ID,\n\t\t\"mac\": u.Mac,\n\t\t\"device_type\": u.Stat.O,\n\t\t\"device_oid\": u.Stat.Oid,\n\t\t\"site_id\": u.SiteID,\n\t\t\"site_name\": u.SiteName,\n\t\t\"adopted\": u.Adopted.Txt,\n\t\t\"name\": u.Name,\n\t\t\"cfgversion\": u.Cfgversion,\n\t\t\"config_network_ip\": u.ConfigNetwork.IP,\n\t\t\"config_network_type\": u.ConfigNetwork.Type,\n\t\t\"connect_request_ip\": u.ConnectRequestIP,\n\t\t\"connect_request_port\": u.ConnectRequestPort,\n\t\t\"device_id\": u.DeviceID,\n\t\t\"guest_token\": u.GuestToken,\n\t\t\"inform_ip\": u.InformIP,\n\t\t\"known_cfgversion\": u.KnownCfgversion,\n\t\t\"led_override\": u.LedOverride,\n\t\t\"locating\": u.Locating.Txt,\n\t\t\"model\": u.Model,\n\t\t\"outdoor_mode_override\": u.OutdoorModeOverride,\n\t\t\"serial\": u.Serial,\n\t\t\"type\": u.Type,\n\t\t\"usg_caps\": u.UsgCaps.Txt,\n\t\t\"speedtest-status-saved\": u.SpeedtestStatusSaved.Txt,\n\t\t\"wan1_up\": u.Wan1.Up.Txt,\n\t\t\"wan2_up\": u.Wan2.Up.Txt,\n\t}\n\tfields := map[string]interface{}{\n\t\t\"ip\": u.IP,\n\t\t\"bytes\": u.Bytes.Val,\n\t\t\"last_seen\": u.LastSeen.Val,\n\t\t\"license_state\": u.LicenseState,\n\t\t\"fw_caps\": u.FwCaps.Val,\n\t\t\"guest-num_sta\": u.GuestNumSta.Val,\n\t\t\"rx_bytes\": u.RxBytes.Val,\n\t\t\"tx_bytes\": u.TxBytes.Val,\n\t\t\"uptime\": u.Uptime.Val,\n\t\t\"roll_upgrade\": u.Rollupgrade.Val,\n\t\t\"state\": u.State.Val,\n\t\t\"upgradable\": u.Upgradable.Val,\n\t\t\"user-num_sta\": u.UserNumSta.Val,\n\t\t\"version\": u.Version,\n\t\t\"num_desktop\": u.NumDesktop.Val,\n\t\t\"num_handheld\": u.NumHandheld.Val,\n\t\t\"num_mobile\": u.NumMobile.Val,\n\t\t\"speedtest-status_latency\": u.SpeedtestStatus.Latency.Val,\n\t\t\"speedtest-status_rundate\": u.SpeedtestStatus.Rundate.Val,\n\t\t\"speedtest-status_runtime\": u.SpeedtestStatus.Runtime.Val,\n\t\t\"speedtest-status_download\": u.SpeedtestStatus.StatusDownload.Val,\n\t\t\"speedtest-status_ping\": u.SpeedtestStatus.StatusPing.Val,\n\t\t\"speedtest-status_summary\": u.SpeedtestStatus.StatusSummary.Val,\n\t\t\"speedtest-status_upload\": u.SpeedtestStatus.StatusUpload.Val,\n\t\t\"speedtest-status_xput_download\": u.SpeedtestStatus.XputDownload.Val,\n\t\t\"speedtest-status_xput_upload\": u.SpeedtestStatus.XputUpload.Val,\n\t\t\"config_network_wan_type\": u.ConfigNetwork.Type,\n\t\t\"wan1_bytes-r\": u.Wan1.BytesR.Val,\n\t\t\"wan1_enable\": u.Wan1.Enable.Val,\n\t\t\"wan1_full_duplex\": u.Wan1.FullDuplex.Val,\n\t\t\"wan1_gateway\": u.Wan1.Gateway,\n\t\t\"wan1_ifname\": u.Wan1.Ifname,\n\t\t\"wan1_ip\": u.Wan1.IP,\n\t\t\"wan1_mac\": u.Wan1.Mac,\n\t\t\"wan1_max_speed\": u.Wan1.MaxSpeed.Val,\n\t\t\"wan1_name\": u.Wan1.Name,\n\t\t\"wan1_netmask\": u.Wan1.Netmask,\n\t\t\"wan1_rx_bytes\": u.Wan1.RxBytes.Val,\n\t\t\"wan1_rx_bytes-r\": u.Wan1.RxBytesR.Val,\n\t\t\"wan1_rx_dropped\": u.Wan1.RxDropped.Val,\n\t\t\"wan1_rx_errors\": u.Wan1.RxErrors.Val,\n\t\t\"wan1_rx_multicast\": u.Wan1.RxMulticast.Val,\n\t\t\"wan1_rx_packets\": u.Wan1.RxPackets.Val,\n\t\t\"wan1_type\": u.Wan1.Type,\n\t\t\"wan1_speed\": u.Wan1.Speed.Val,\n\t\t\"wan1_up\": u.Wan1.Up.Val,\n\t\t\"wan1_tx_bytes\": u.Wan1.TxBytes.Val,\n\t\t\"wan1_tx_bytes-r\": u.Wan1.TxBytesR.Val,\n\t\t\"wan1_tx_dropped\": u.Wan1.TxDropped.Val,\n\t\t\"wan1_tx_errors\": u.Wan1.TxErrors.Val,\n\t\t\"wan1_tx_packets\": u.Wan1.TxPackets.Val,\n\t\t\"wan2_bytes-r\": u.Wan2.BytesR.Val,\n\t\t\"wan2_enable\": u.Wan2.Enable.Val,\n\t\t\"wan2_full_duplex\": u.Wan2.FullDuplex.Val,\n\t\t\"wan2_gateway\": u.Wan2.Gateway,\n\t\t\"wan2_ifname\": u.Wan2.Ifname,\n\t\t\"wan2_ip\": u.Wan2.IP,\n\t\t\"wan2_mac\": u.Wan2.Mac,\n\t\t\"wan2_max_speed\": u.Wan2.MaxSpeed.Val,\n\t\t\"wan2_name\": u.Wan2.Name,\n\t\t\"wan2_netmask\": u.Wan2.Netmask,\n\t\t\"wan2_rx_bytes\": u.Wan2.RxBytes.Val,\n\t\t\"wan2_rx_bytes-r\": u.Wan2.RxBytesR.Val,\n\t\t\"wan2_rx_dropped\": u.Wan2.RxDropped.Val,\n\t\t\"wan2_rx_errors\": u.Wan2.RxErrors.Val,\n\t\t\"wan2_rx_multicast\": u.Wan2.RxMulticast.Val,\n\t\t\"wan2_rx_packets\": u.Wan2.RxPackets.Val,\n\t\t\"wan2_type\": u.Wan2.Type,\n\t\t\"wan2_speed\": u.Wan2.Speed.Val,\n\t\t\"wan2_up\": u.Wan2.Up.Val,\n\t\t\"wan2_tx_bytes\": u.Wan2.TxBytes.Val,\n\t\t\"wan2_tx_bytes-r\": u.Wan2.TxBytesR.Val,\n\t\t\"wan2_tx_dropped\": u.Wan2.TxDropped.Val,\n\t\t\"wan2_tx_errors\": u.Wan2.TxErrors.Val,\n\t\t\"wan2_tx_packets\": u.Wan2.TxPackets.Val,\n\t\t\"loadavg_1\": u.SysStats.Loadavg1.Val,\n\t\t\"loadavg_5\": u.SysStats.Loadavg5.Val,\n\t\t\"loadavg_15\": u.SysStats.Loadavg15.Val,\n\t\t\"mem_used\": u.SysStats.MemUsed.Val,\n\t\t\"mem_buffer\": u.SysStats.MemBuffer.Val,\n\t\t\"mem_total\": u.SysStats.MemTotal.Val,\n\t\t\"cpu\": u.SystemStats.CPU.Val,\n\t\t\"mem\": u.SystemStats.Mem.Val,\n\t\t\"system_uptime\": u.SystemStats.Uptime.Val,\n\t\t\"stat_duration\": u.Stat.Duration.Val,\n\t\t\"stat_datetime\": u.Stat.Datetime,\n\t\t\"gw\": u.Stat.Gw,\n\t\t\"lan-rx_bytes\": u.Stat.LanRxBytes.Val,\n\t\t\"lan-rx_packets\": u.Stat.LanRxPackets.Val,\n\t\t\"lan-tx_bytes\": u.Stat.LanTxBytes.Val,\n\t\t\"lan-tx_packets\": u.Stat.LanTxPackets.Val,\n\t\t\"wan-rx_bytes\": u.Stat.WanRxBytes.Val,\n\t\t\"wan-rx_dropped\": u.Stat.WanRxDropped.Val,\n\t\t\"wan-rx_packets\": u.Stat.WanRxPackets.Val,\n\t\t\"wan-tx_bytes\": u.Stat.WanTxBytes.Val,\n\t\t\"wan-tx_packets\": u.Stat.WanTxPackets.Val,\n\t\t\"uplink_name\": u.Uplink.Name,\n\t\t\"uplink_latency\": u.Uplink.Latency.Val,\n\t\t\"uplink_speed\": u.Uplink.Speed.Val,\n\t\t\"uplink_num_ports\": u.Uplink.NumPort.Val,\n\t\t\"uplink_max_speed\": u.Uplink.MaxSpeed.Val,\n\t}\n\tpt, err := influx.NewPoint(\"usg\", tags, fields, now)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpoints := []*influx.Point{pt}\n\tfor _, p := range u.NetworkTable {\n\t\ttags := map[string]string{\n\t\t\t\"device_name\": u.Name,\n\t\t\t\"device_id\": u.ID,\n\t\t\t\"device_mac\": u.Mac,\n\t\t\t\"site_name\": u.SiteName,\n\t\t\t\"up\": p.Up.Txt,\n\t\t\t\"dhcpd_dns_enabled\": p.DhcpdDNSEnabled.Txt,\n\t\t\t\"dhcpd_enabled\": p.DhcpdEnabled.Txt,\n\t\t\t\"dhcpd_time_offset_enabled\": p.DhcpdTimeOffsetEnabled.Txt,\n\t\t\t\"dhcp_relay_enabledy\": p.DhcpRelayEnabled.Txt,\n\t\t\t\"dhcpd_gateway_enabled\": p.DhcpdGatewayEnabled.Txt,\n\t\t\t\"enabled\": p.Enabled.Txt,\n\t\t\t\"vlan_enabled\": p.VlanEnabled.Txt,\n\t\t\t\"attr_no_delete\": p.AttrNoDelete.Txt,\n\t\t\t\"is_guest\": p.IsGuest.Txt,\n\t\t\t\"is_nat\": p.IsNat.Txt,\n\t\t\t\"networkgroup\": p.Networkgroup,\n\t\t\t\"site_id\": p.SiteID,\n\t\t}\n\t\tfields := map[string]interface{}{\n\t\t\t\"domain_name\": p.DomainName,\n\t\t\t\"dhcpd_start\": p.DhcpdStart,\n\t\t\t\"dhcpd_stop\": p.DhcpdStop,\n\t\t\t\"ip\": p.IP,\n\t\t\t\"ip_subnet\": p.IPSubnet,\n\t\t\t\"mac\": p.Mac,\n\t\t\t\"name\": p.Name,\n\t\t\t\"num_sta\": p.NumSta.Val,\n\t\t\t\"purpose\": p.Purpose,\n\t\t\t\"rx_bytes\": p.RxBytes.Val,\n\t\t\t\"rx_packets\": p.RxPackets.Val,\n\t\t\t\"tx_bytes\": p.TxBytes.Val,\n\t\t\t\"tx_packets\": p.TxPackets.Val,\n\t\t\t\"ipv6_interface_type\": p.Ipv6InterfaceType,\n\t\t\t\"attr_hidden_id\": p.AttrHiddenID,\n\t\t}\n\t\tpt, err = influx.NewPoint(\"usg_networks\", tags, fields, now)\n\t\tif err != nil {\n\t\t\treturn points, err\n\t\t}\n\t\tpoints = append(points, pt)\n\t}\n\tfor _, p := range u.PortTable {\n\t\ttags := map[string]string{\n\t\t\t\"device_name\": u.Name,\n\t\t\t\"device_id\": u.ID,\n\t\t\t\"device_mac\": u.Mac,\n\t\t\t\"site_name\": u.SiteName,\n\t\t\t\"name\": p.Name,\n\t\t\t\"ifname\": p.Ifname,\n\t\t\t\"ip\": p.IP,\n\t\t\t\"mac\": p.Mac,\n\t\t\t\"up\": p.Up.Txt,\n\t\t\t\"speed\": p.Speed.Txt,\n\t\t\t\"full_duplex\": p.FullDuplex.Txt,\n\t\t\t\"enable\": p.Enable.Txt,\n\t\t}\n\t\tfields := map[string]interface{}{\n\t\t\t\"rx_bytes\": p.RxBytes.Val,\n\t\t\t\"rx_dropped\": p.RxDropped.Val,\n\t\t\t\"rx_errors\": p.RxErrors.Val,\n\t\t\t\"rx_packets\": p.RxBytes.Val,\n\t\t\t\"tx_bytes\": p.TxBytes.Val,\n\t\t\t\"tx_dropped\": p.TxDropped.Val,\n\t\t\t\"tx_errors\": p.TxErrors.Val,\n\t\t\t\"tx_packets\": p.TxPackets.Val,\n\t\t\t\"rx_multicast\": p.RxMulticast.Val,\n\t\t\t\"dns_servers\": strings.Join(p.DNS, \",\"),\n\t\t}\n\t\tpt, err = influx.NewPoint(\"usg_ports\", tags, fields, now)\n\t\tif err != nil {\n\t\t\treturn points, err\n\t\t}\n\t\tpoints = append(points, pt)\n\t}\n\treturn points, nil\n}", "title": "" }, { "docid": "3668a24cfa17cbd60fb4c11b0810089e", "score": "0.52427226", "text": "func metricsToPoints(metrics []statboard.Metric) []chartjs.Point {\n\tvar data []chartjs.Point\n\n\tfor _, met := range metrics {\n\t\tpoint := chartjs.Point{X: met.Date.Format(\"02-Jan-2006\"), Y: met.Value}\n\t\tdata = append(data, point)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "2a86453d66283b29857fefdc03529e57", "score": "0.5226302", "text": "func Point2dkpt(pts ...*point.Point) (res []*dkpt.Point) {\n\tfor _, pt := range pts {\n\t\tpt, err := influxdb.NewPoint(string(pt.Name()), pt.InfluxTags(), pt.InfluxFields(), pt.Time())\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tres = append(res, &dkpt.Point{Point: pt})\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "fa2b713fe67a3a2caae06170f8befaa8", "score": "0.52066815", "text": "func GetCpuUsage() ([]float64, error) {\n\n currProcStat := getProcStats()\n usage := make([]float64, len(currProcStat))\n for i := 0; i < len(currProcStat); i++ {\n\n // Get Difference\n dIdle := float64(currProcStat[i].GetIdle() - prevProcStat[i].GetIdle())\n dTotal := float64(currProcStat[i].GetTotal() - prevProcStat[i].GetTotal())\n\n // Get Usage\n usage[i] = (dTotal - dIdle) / dTotal * 100.0\n\n }\n\n // Assign Previous Value\n prevProcStat = currProcStat\n return usage, nil\n}", "title": "" }, { "docid": "6b4102890ed70082b360fd4eb3f42aaf", "score": "0.5185077", "text": "func (o *LoyaltySubLedger) GetPendingPoints() []LoyaltyLedgerEntry {\n\tif o == nil || o.PendingPoints == nil {\n\t\tvar ret []LoyaltyLedgerEntry\n\t\treturn ret\n\t}\n\treturn *o.PendingPoints\n}", "title": "" }, { "docid": "9fed51fc865514a7274f2c5f25e0ba59", "score": "0.5154093", "text": "func jobsPoints(term string) plotter.XYs {\n\t//records := readCSV(\"jobs-count.csv\")\n\trecords := readSqlite()\n\n\tvar newRecords []Record\n\n\tfor _, record := range records {\n\t\tif !(record.Term == term) {\n\t\t\tcontinue\n\t\t}\n\t\tnewRecords = append(newRecords, record)\n\t}\n\n\tpts := make(plotter.XYs, len(newRecords))\n\tfor i, record := range newRecords {\n\t\tdate, err := time.Parse(\"2006-01-02\", record.Date)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tpts[i].X = float64(date.Unix())\n\t\tpts[i].Y = float64(record.Count)\n\t}\n\n\treturn pts\n}", "title": "" }, { "docid": "5a407fee8dd625ef2d390706101681a4", "score": "0.51396275", "text": "func (c *Client) Read(req *remote.ReadRequest) ([]map[string]interface{}, error) {\n\tctx := context.Background()\n\tquerier := req.Queries[0]\n\tquery := elastic.NewBoolQuery()\n\n\tfor _, matcher := range querier.Matchers {\n\t\tquery = query.Must(elastic.NewTermQuery(matcher.Name, matcher.Value))\n\t}\n\n\t// building elasticsearch query\n\tquery = query.Filter(elastic.\n\t\tNewRangeQuery(\"timestamp\").\n\t\tFrom(querier.StartTimestampMs).\n\t\tTo(querier.EndTimestampMs))\n\n\tsearchResult, err := c.client.\n\t\tSearch().\n\t\tIndex(c.esIndex).\n\t\tQuery(query).\n\t\tSize(1000).\n\t\tSort(\"timestamp\", true).\n\t\tDo(ctx)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar dataPoints []map[string]interface{}\n\n\t// parsing elasticsearch hits to array with datapoints\n\tif searchResult.Hits.TotalHits > 0 {\n\t\tfmt.Printf(\"Found a total of %d data points\\n\", searchResult.Hits.TotalHits)\n\n\t\tfor _, hit := range searchResult.Hits.Hits {\n\t\t\tvar dataPoint map[string]interface{}\n\t\t\tjson.Unmarshal(*hit.Source, &dataPoint)\n\t\t\tdataPoints = append(dataPoints, dataPoint)\n\t\t}\n\t} else {\n\t\treturn nil, newErrNoDataPointsFound(\"Found no metrics\")\n\t}\n\n\treturn dataPoints, nil\n}", "title": "" }, { "docid": "77897a7a77b737a04ecd090738b6e3bd", "score": "0.5137482", "text": "func GPXToPoints(gpx GPX) [][]Point {\n\tsegmentPoints := make([][]Point, len(gpx.Trk.Trkseg))\n\tfor i := range gpx.Trk.Trkseg {\n\t\tsegmentPoints[i] = make([]Point, len(gpx.Trk.Trkseg[i].Trkpt))\n\n\t\tfor j := range gpx.Trk.Trkseg[i].Trkpt {\n\t\t\ttrackPoint := gpx.Trk.Trkseg[i].Trkpt[j]\n\t\t\tlon, lat := trackPoint.Longitude, trackPoint.Latitude\n\t\t\tpoint := Point{X: lon, Y: lat}\n\n\t\t\tsegmentPoints[i][j] = DegreesToMeters(point)\n\t\t}\n\t}\n\treturn segmentPoints\n}", "title": "" }, { "docid": "5d45b8f8af30438aae389d77a3abcba7", "score": "0.5124423", "text": "func (column TsTimestampColumn) GetRanges(rgs ...TsRange) ([]TsTimestampPoint, error) {\n\talias := convertToCharStar(column.parent.alias)\n\tdefer releaseCharStar(alias)\n\tcolumnName := convertToCharStar(column.name)\n\tdefer releaseCharStar(columnName)\n\tranges := rangeArrayToC(rgs...)\n\trangesCount := C.qdb_size_t(len(rgs))\n\tvar points *C.qdb_ts_timestamp_point\n\tvar pointsCount C.qdb_size_t\n\terr := C.qdb_ts_timestamp_get_ranges(column.parent.handle, alias, columnName, ranges, rangesCount, &points, &pointsCount)\n\n\tif err == 0 {\n\t\tdefer column.parent.Release(unsafe.Pointer(points))\n\t\treturn timestampPointArrayToGo(points, pointsCount), nil\n\t}\n\treturn nil, ErrorType(err)\n}", "title": "" }, { "docid": "e203594676bb4a81c1e51898e36debc4", "score": "0.511603", "text": "func ExplodePoints(org, bucket platform.ID, points []models.Point) ([]models.Point, error) {\n\tout := make([]models.Point, 0, len(points))\n\n\t// TODO(jeff): We should add a RawEncode() method or something to the platform.ID type\n\t// or we should use hex encoded measurement names. Either way, we shouldn't be doing a\n\t// decode of the encode here, and we don't want to depend on details of how the ID type\n\t// is represented.\n\tob := EncodeName(org, bucket)\n\tname := string(ob[:])\n\n\ttags := make(models.Tags, 1)\n\tfor _, pt := range points {\n\t\ttags = tags[:1] // reset buffer for next point.\n\n\t\ttags[0] = models.NewTag(models.MeasurementTagKeyBytes, pt.Name())\n\t\tpt.ForEachTag(func(k, v []byte) bool {\n\t\t\ttags = append(tags, models.NewTag(k, v))\n\t\t\treturn true\n\t\t})\n\n\t\tt := pt.Time()\n\t\titr := pt.FieldIterator()\n\t\ttags = append(tags, models.Tag{}) // Make room for field key and value.\n\n\t\tfor itr.Next() {\n\t\t\ttags[len(tags)-1] = models.NewTag(models.FieldKeyTagKeyBytes, itr.FieldKey())\n\n\t\t\tvar err error\n\t\t\tfield := make(models.Fields, 1)\n\t\t\tswitch itr.Type() {\n\t\t\tcase models.Float:\n\t\t\t\tfield[string(itr.FieldKey())], err = itr.FloatValue()\n\t\t\tcase models.Integer:\n\t\t\t\tfield[string(itr.FieldKey())], err = itr.IntegerValue()\n\t\t\tcase models.Boolean:\n\t\t\t\tfield[string(itr.FieldKey())], err = itr.BooleanValue()\n\t\t\tcase models.String:\n\t\t\t\tfield[string(itr.FieldKey())] = itr.StringValue()\n\t\t\tcase models.Unsigned:\n\t\t\t\tfield[string(itr.FieldKey())], err = itr.UnsignedValue()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tpt, err := models.NewPoint(name, tags, field, t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tout = append(out, pt)\n\t\t}\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "379ec507f7a7be8fe6719a0298858d35", "score": "0.5110766", "text": "func NewPoints(igeom geometry.IGeometry, imat material.IMaterial) *Points {\n\n\tp := new(Points)\n\tp.Graphic.Init(p, igeom, gls.POINTS)\n\tif imat != nil {\n\t\tp.AddMaterial(p, imat, 0, 0)\n\t}\n\tp.uniMVPm.Init(\"MVP\")\n\tp.uniMVm.Init(\"MV\")\n\treturn p\n}", "title": "" }, { "docid": "692991ac250a14d5d1e25d037e4644f8", "score": "0.509684", "text": "func filterPoints(data []Datum, dataItem Datum) []Datum {\n\tif len(data) == 0 {\n\t\tdata = append(data, dataItem)\n\t} else {\n\t\td := haversine(data[len(data)-1], dataItem)\n\t\tt := dataItem.Ts.Sub(data[len(data)-1].Ts)\n\t\tv := d / float64(t/3600) * 1000000000\n\t\tif d > 0.0 && v < 90.0 && v > 0.1 {\n\t\t\tdata = append(data, dataItem)\n\t\t}\n\t}\n\treturn data\n}", "title": "" }, { "docid": "2df6b6b42458a0a4cf6fadbd1265bdb5", "score": "0.50912154", "text": "func (s *RestServer) getIPv4FlowRawMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "2763e460fd7ed1156147aa3c76d4c085", "score": "0.5077275", "text": "func (m *MockTestClient) GetPoints(arg0 context.Context, arg1 test.GetPointsArgs) (*[]test.TestPoint, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPoints\", arg0, arg1)\n\tret0, _ := ret[0].(*[]test.TestPoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6b5b5cb6ffcd4cb27dc3a2177cf9af82", "score": "0.505552", "text": "func (st *StressTest) GetPoint(name, precision string) models.Point {\n\tp := st.communes[name].point(precision)\n\n\t// Function needs to return a point. Panic if it doesn't\n\tif p == nil {\n\t\tlog.Fatal(\"Commune not returning point\")\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "1400ac0a1756f8753c6b1c2d1eeecb91", "score": "0.5054471", "text": "func (slice ExerciseSlice) ToDataPointSlice(matchingReads []GlucoseRead, glucoseUnit GlucoseUnit) (dataPoints []DataPoint) {\n\tdataPoints = make([]DataPoint, len(slice))\n\tfor i := range slice {\n\t\tlocalTime, err := slice[i].Time.Format()\n\t\tif err != nil {\n\t\t\tutil.Propagate(err)\n\t\t}\n\n\t\tdataPoint := DataPoint{localTime, slice.GetEpochTime(i),\n\t\t\tlinearInterpolateY(matchingReads, slice[i].Time, glucoseUnit), float32(slice[i].DurationMinutes), EXERCISE_TAG, \"minutes\"}\n\t\tdataPoints[i] = dataPoint\n\t}\n\n\treturn dataPoints\n}", "title": "" }, { "docid": "bad24ec3fe259fb14622f39d57455f64", "score": "0.50538445", "text": "func (o *GetProjectMetricsResponse) GetData() []MetricsDatapoint {\n\tif o == nil {\n\t\tvar ret []MetricsDatapoint\n\t\treturn ret\n\t}\n\n\treturn o.Data\n}", "title": "" }, { "docid": "e5eb7ae468bf6e4a2a77f6779fe0755f", "score": "0.50535345", "text": "func (s *FeatureStats_Numerical) PivotPoints() []float64 {\n\tvar tmin, tmax float64\n\ts.Min.ForEach(func(i int, min float64) bool {\n\t\tif tmin == 0 || min < tmin {\n\t\t\ttmin = min\n\t\t}\n\t\tif max := s.Max.Get(i); tmax == 0 || max > tmax {\n\t\t\ttmax = max\n\t\t}\n\t\treturn true\n\t})\n\treturn hoeffding.PivotPoints(tmin, tmax)\n}", "title": "" }, { "docid": "962782977c2351b51facab26141d9b0b", "score": "0.505102", "text": "func (mr *MockTestClientMockRecorder) GetPoints(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPoints\", reflect.TypeOf((*MockTestClient)(nil).GetPoints), arg0, arg1)\n}", "title": "" }, { "docid": "bac9f2e40febba59fe2b03080be649e0", "score": "0.5050833", "text": "func (ms Metric) DoubleDataPoints() DoubleDataPointSlice {\n\treturn newDoubleDataPointSlice(&(*ms.orig).DoubleDataPoints)\n}", "title": "" }, { "docid": "94b5b59da7f8065ce791e3f005541862", "score": "0.50466627", "text": "func GenerateRandomPoints(n int) []Point {\n\tlist := make([]Point, 0)\n\n\tfor i := 0; i < n; i++ {\n\t\tx := float32(rnd.Int31()%100) / 10.0\n\t\ty := float32(rnd.Int31()%100) / 10.0\n\n\t\tlist = append(list, NewPoint2D(x, y))\n\t}\n\n\treturn list\n}", "title": "" }, { "docid": "f4f05badca9c9a9f4a464d3684e53821", "score": "0.50204635", "text": "func (a *ManagementApiService) GetLoyaltyPoints(ctx _context.Context, loyaltyProgramId string, integrationId string) apiGetLoyaltyPointsRequest {\n\treturn apiGetLoyaltyPointsRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tloyaltyProgramId: loyaltyProgramId,\n\t\tintegrationId: integrationId,\n\t}\n}", "title": "" }, { "docid": "fca387065ae454c84007f50d866e1867", "score": "0.50189924", "text": "func RandomPoints(n int, inpX data, inpY data) plotter.XYs {\n\tl1 := inpX.Len()\n\tl2 := inpY.Len()\n\n\tif l1 == 0 || l2 == 0 {\n\t\treturn nil\n\t}\n\n\tif l1 != l2 {\n\t\treturn nil\n\t}\n\n\tpts := make(plotter.XYs, l1)\n\tfor i := range pts {\n\t\tpts[i].X = inpX[i]\n\t\tpts[i].Y = inpY[i]\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "8fd1dc4c4576375cf3c8c3441d02fb66", "score": "0.4963886", "text": "func GeneratePoints(img image.Image, threshold float64) []*Point {\n\tpoints := make([]*Point, 0)\n\n\tfor x := 0; x < img.Bounds().Max.X; x++ {\n\t\tfor y := 0; y < img.Bounds().Max.Y; y++ {\n\t\t\tr, g, b, _ := img.At(x, y).RGBA()\n\n\t\t\tif uint8(r) <= 250 && uint8(g) <= 250 && uint8(b) <= 250 {\n\t\t\t\tval := randFloats(0, 100)\n\t\t\t\tif val < threshold {\n\t\t\t\t\tpoints = append(points, newPoint(x, y, uint8(r), uint8(g), uint8(b)))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn points\n}", "title": "" }, { "docid": "f59672db8e48002f6b3f9bbf958b72b7", "score": "0.4948758", "text": "func (ms Metric) SummaryDataPoints() SummaryDataPointSlice {\n\treturn newSummaryDataPointSlice(&(*ms.orig).SummaryDataPoints)\n}", "title": "" }, { "docid": "1ada25172799dddc456c3b0957eda241", "score": "0.49477687", "text": "func (s *RestServer) getL2FlowBehavioralMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "1b861b9be9aabf44d947ebb0c661ce6f", "score": "0.49426743", "text": "func (s *RestServer) getEgressDropMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "c2cbfb881bf651880dc6a39ac21c3dd1", "score": "0.4941057", "text": "func equidistantPoints(x0, x1 float64, n uint) (points []float64) {\n\tdelta := (x1 - x0) / math.Max(float64(n-1), 1) // prevent /0 error\n\tfor i := uint(0); i < n; i++ {\n\t\tpoints = append(points, delta*float64(i))\n\t}\n\treturn points\n}", "title": "" }, { "docid": "5e4545221c4ed762ab267b0c371ea982", "score": "0.49382913", "text": "func (s *RestServer) getIPv6FlowPerformanceMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "1b87019cd268947e2a3b4acbe9dc8395", "score": "0.49345568", "text": "func (o *Bspline) Point(t float64, option int) (C []float64) {\n\t// check\n\tif !o.okQ {\n\t\tchk.Panic(\"Q must be set before calling this method\")\n\t}\n\t// compute point on curve\n\tncp := len(o.Q[0]) // number of components in Q\n\tC = make([]float64, ncp)\n\tswitch option {\n\tcase 0: // recursive\n\t\tfor i, q := range o.Q {\n\t\t\tfor j := 0; j < ncp; j++ {\n\t\t\t\tC[j] += o.RecursiveBasis(t, i) * q[j]\n\t\t\t}\n\t\t}\n\tcase 1: // Piegl & Tiller: A3.1 p82\n\t\tspan := o.findSpan(t)\n\t\to.basisFuns(t, span)\n\t\tfor i := 0; i <= o.p; i++ {\n\t\t\tfor j := 0; j < ncp; j++ {\n\t\t\t\tC[j] += o.ndu[i][o.p] * o.Q[span-o.p+i][j]\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "85276f7908fc315395c96365548fca23", "score": "0.4932099", "text": "func (d *DXF) Points(s v2.VecSet, r float64) {\n\td.drawing.ChangeLayer(\"Points\")\n\tfor _, p := range s {\n\t\td.drawing.Circle(p.X, p.Y, 0, r)\n\t}\n}", "title": "" }, { "docid": "c342b8aa90be9adde8549bf0c9f54407", "score": "0.49310082", "text": "func (s *RestServer) getL2FlowDropMetricsPoints() ([]*tsdb.Point, error) {\n\n\treturn nil, nil\n\n}", "title": "" }, { "docid": "0dea2a4ebb63756add361b331ce8b03f", "score": "0.49178743", "text": "func (d Datapoints) Values() []float64 {\n\tvalues := make([]float64, len(d))\n\tfor i, dp := range d {\n\t\tvalues[i] = dp.Value\n\t}\n\n\treturn values\n}", "title": "" }, { "docid": "b2bc596aa132163e687c13cb6411c685", "score": "0.49154493", "text": "func (s *TXPoolServer) getStats() []uint64 {\n\ts.stats.RLock()\n\tdefer s.stats.RUnlock()\n\tret := make([]uint64, 0, len(s.stats.count))\n\tfor _, v := range s.stats.count {\n\t\tret = append(ret, v)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "95d8bcef6a29fe45f6375f589c9c3025", "score": "0.48967913", "text": "func OrderPoints(pts []image.Point) []image.Point {\n\tsort.Slice(pts[:], func(a, b int) bool {\n\t\treturn pts[a].X < pts[b].X\n\t})\n\tleftMost := pts[:2]\n\trightMost := pts[2:]\n\tsort.Slice(leftMost[:], func(a, b int) bool {\n\t\treturn leftMost[a].Y < leftMost[b].Y\n\t})\n\tsort.Slice(rightMost[:], func(a, b int) bool {\n\t\tpythagoreanDist := func(i, j image.Point) float64 {\n\t\t\tvar x, y int\n\t\t\tif i.X > j.X {\n\t\t\t\tx = (i.X - j.X) ^ 2\n\t\t\t} else {\n\t\t\t\tx = (j.X - i.X) ^ 2\n\t\t\t}\n\t\t\tif i.Y > j.Y {\n\t\t\t\ty = (i.Y - j.Y) ^ 2\n\t\t\t} else {\n\t\t\t\ty = (j.Y - i.Y) ^ 2\n\t\t\t}\n\n\t\t\treturn math.Sqrt((float64(x) + float64(y)))\n\t\t}\n\t\treturn pythagoreanDist(leftMost[0], rightMost[0]) <\n\t\t\tpythagoreanDist(leftMost[0], rightMost[1])\n\t})\n\treturn []image.Point{leftMost[0], rightMost[1], rightMost[0], leftMost[1]}\n}", "title": "" }, { "docid": "82c985c88ece40a5e85a988d8b41e9e3", "score": "0.4895528", "text": "func (d *Datapoint) Set() []float64 {\n\tvar export = make([]float64, len(d.set), len(d.set))\n\tcopy(export, d.set)\n\treturn export\n}", "title": "" } ]
18e5f8fefe985d15a3494cc442f4c5f2
AsNodeOpenedSuccessEvent is the BasicFabricEvent implementation for NodeAbortingEvent.
[ { "docid": "c03cb3424179db1e1a352f804e252afa", "score": "0.86496884", "text": "func (nae NodeAbortingEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "dec74ff8a72a4f3c481da8860640f824", "score": "0.8404202", "text": "func (nae NodeAbortedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "23c09fa56524f7a36e43274afcadf9df", "score": "0.82112414", "text": "func (curce ClusterUpgradeRollbackCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "473a85089da5cdae99cda95bcbe6d2fc", "score": "0.8153211", "text": "func (crrfce ChaosRemoveReplicaFaultCompletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "47100a4f04798b647b5aca4f987cc10a", "score": "0.8088472", "text": "func (curse ClusterUpgradeRollbackStartEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "af0cd4140948d5435942964ede3d0191", "score": "0.8080757", "text": "func (cde ContainerDeactivatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4fe8bed3823da5e8db24707ad5b2a248", "score": "0.8070563", "text": "func (ade ApplicationDeletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "402edbf48253f961503accd1c86aaf8f", "score": "0.80680466", "text": "func (crnfce ChaosRestartNodeFaultCompletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0712e2e85b16ff1040ab33f0a8746572", "score": "0.80636907", "text": "func (nce NodeClosingEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f3d0254127c118c3cfad973e1bfbf608", "score": "0.80448127", "text": "func (fe FabricEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cc1868b5917e2bbcf72c12b4a63d96d7", "score": "0.8028645", "text": "func (nce NodeCloseEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7627d1a75ae3df3973c9f8ce0491a548", "score": "0.79881924", "text": "func (aurce ApplicationUpgradeRollbackCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9cdc4d7ad360d2e0d965f6db7a3d69ee", "score": "0.79856604", "text": "func (ndse NodeDeactivateStartEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "629721575a0aa54c224a33c4da10c64d", "score": "0.79823995", "text": "func (cse ChaosStoppedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "eeb396a4a97555bd4f4071ef902aada1", "score": "0.79801565", "text": "func (ndce NodeDeactivateCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "987ceb88aca80703ab2416c6ef28993c", "score": "0.79708546", "text": "func (crrfse ChaosRemoveReplicaFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8c77a407b2839e595616c4233d947794", "score": "0.796819", "text": "func (cuce ClusterUpgradeCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ef5b63a91277d28fd2baa137ace39738", "score": "0.795433", "text": "func (ce ClusterEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8d1499e89b344d40b98fc06d6da78170", "score": "0.7929916", "text": "func (sde ServiceDeletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5fccc445111b3af71a04527275fd745b", "score": "0.79068345", "text": "func (aurse ApplicationUpgradeRollbackStartEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7bedaa60f254f6713f02a049657a5edf", "score": "0.78923076", "text": "func (nre NodeRemovedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5a87d29013d0ba51d8a20eb4850494bf", "score": "0.78918076", "text": "func (cudce ClusterUpgradeDomainCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1d19111955c5abcbd411671bfabeb9c9", "score": "0.7881418", "text": "func (cuse ClusterUpgradeStartEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "09a2ac3d3b319a337a68c4dbdd6a22b5", "score": "0.78745085", "text": "func (cse ChaosStartedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ef38bc691b6406861be733fcfe633b13", "score": "0.78665453", "text": "func (noe NodeOpeningEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c4c473359d7b58cc2a0906baa6ebb484", "score": "0.7852054", "text": "func (crcpfce ChaosRestartCodePackageFaultCompletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5feac73e20b132f9fb83be1f9bf63b3a", "score": "0.78497976", "text": "func (chree ClusterHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f3501670bc65fef3ae626e0f8befd235", "score": "0.7836137", "text": "func (ne NodeEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8582e29ffbef9dbd1f23433c5a472aa8", "score": "0.78157485", "text": "func (crnfse ChaosRestartNodeFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7c5fa765017a112b486f3767d98cc6b9", "score": "0.77922463", "text": "func (prce PartitionReconfigurationCompletedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "45534bea810a9b1b031283e57eeb5d37", "score": "0.77804834", "text": "func (crrfse ChaosRestartReplicaFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ad2a8916b4a58d5e4aacb1cf6b206869", "score": "0.77752", "text": "func (nofe NodeOpenFailedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "11061fb2c3e44d22c5135cf7628c295c", "score": "0.7754948", "text": "func (pde ProcessDeactivatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a62ccce2eae95737a82a5dc84ce12b48", "score": "0.7729366", "text": "func (audce ApplicationUpgradeDomainCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fa55a1e35fa52eaa86752d7f6fb12bf2", "score": "0.77234524", "text": "func (nose NodeOpenedSuccessEvent) AsNodeAbortingEvent() (*NodeAbortingEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "71459fc0be15227e588a0cb9d8b0189c", "score": "0.7723023", "text": "func (cie ContainerInstanceEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "962f01504748057bc133a48c9595b2d2", "score": "0.77198076", "text": "func (phree PartitionHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "22c01571adc159ef2fd64adfe2d1c398", "score": "0.7708678", "text": "func (nde NodeDownEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "95f52efeab13d977d9878c11a851468f", "score": "0.76959836", "text": "func (auce ApplicationUpgradeCompleteEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f68e074bf7852397719af4578170b982", "score": "0.76959395", "text": "func (chrce ClusterHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "664f037a64686dfecb7b41797c011e34", "score": "0.7691769", "text": "func (srhree StatefulReplicaHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "754cff964b101b108e12288bb26476fc", "score": "0.76898766", "text": "func (ause ApplicationUpgradeStartEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "62935111aab25d67c63c9fd8767e8a03", "score": "0.7684546", "text": "func (ae ApplicationEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9fe0b57a20dfce7ae3d55a2dd94f967a", "score": "0.76823753", "text": "func (ahree ApplicationHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a164e539a6732c2038c19d1e3a1eb889", "score": "0.76779485", "text": "func (srhree StatelessReplicaHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "962cf85dab9f65b052de59cc20ab3b73", "score": "0.7673843", "text": "func (se ServiceEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f0d0bcad75d1d799edc8ca60ffb90eac", "score": "0.76574606", "text": "func (nhree NodeHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "11aeec3bad561340271fc5225412c642", "score": "0.7647765", "text": "func (nae NodeAddedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "22b2931159b51de1fbb4b0856d26cd66", "score": "0.76393795", "text": "func (crcpfse ChaosRestartCodePackageFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e6be7bf0cebef1acaa53616a9686a79e", "score": "0.76245725", "text": "func (shree ServiceHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "35c1957a25b522dd02e996880e015ee2", "score": "0.7619482", "text": "func (sce ServiceCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1f03e7278f3598fbf5c3c1e9e7372ebc", "score": "0.7614793", "text": "func (cmpfse ChaosMovePrimaryFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c4725540a00524b2de1093cb7b556d4e", "score": "0.76133865", "text": "func (phrce PartitionHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4ea68a1e27c0ba929a487cbb57dd3cc9", "score": "0.7604457", "text": "func (re ReplicaEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dff2fc91732c0d7ee6403abcca2a8ecd", "score": "0.7600196", "text": "func (nue NodeUpEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d644de83bc1f27618d88a00d4f8a04ee", "score": "0.759892", "text": "func (peVar PartitionEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "267d1e61722b6f2dbdabf180faabf9a1", "score": "0.7573221", "text": "func (cmsfse ChaosMoveSecondaryFaultScheduledEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c83825b553e6cc82e1d0f0fd839559e5", "score": "0.75581807", "text": "func (pae PartitionAnalysisEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b6bb8f95de88c48c9d79468db6e0ecea", "score": "0.7554272", "text": "func (ahrce ApplicationHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ff6f699fa2117d3eee9497240bb0e2e0", "score": "0.7549761", "text": "func (dahree DeployedApplicationHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "88e4a4282f8caa3387e2d88f943b93f4", "score": "0.75488245", "text": "func (nhrce NodeHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2976f17756aceae0d51715d9ff2e473e", "score": "0.75304914", "text": "func (ace ApplicationCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e9f2d9a4b93c331cead46bd28b48b780", "score": "0.7509292", "text": "func (shrce ServiceHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4f099d396ba69e5fd54a4f3998363ac6", "score": "0.74470574", "text": "func (dshree DeployedServiceHealthReportExpiredEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3bd17ba84addbca76a99343ae8949964", "score": "0.7445523", "text": "func (srhrce StatefulReplicaHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "00e0b897d2ef8bc89e6095cc9d685cbf", "score": "0.7400374", "text": "func (nose NodeOpenedSuccessEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn &nose, true\n}", "title": "" }, { "docid": "55edd16a7d8d2864076f082fdc552844", "score": "0.7397685", "text": "func (srhrce StatelessReplicaHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dc5afab146bd05d54ee4ce95d0c875fc", "score": "0.73508734", "text": "func (dahrce DeployedApplicationHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "affcea9d98071a257a907d243432a1ef", "score": "0.731699", "text": "func (nose NodeOpenedSuccessEvent) AsNodeAbortedEvent() (*NodeAbortedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bc3a03a70e007c4df9eb512b7283396f", "score": "0.73110867", "text": "func (ppmae PartitionPrimaryMoveAnalysisEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "398d8a8256a9fc542f1408884b0df055", "score": "0.72555107", "text": "func (dshrce DeployedServiceHealthReportCreatedEvent) AsNodeOpenedSuccessEvent() (*NodeOpenedSuccessEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "32365eb04f169e30219a38a45cb28c24", "score": "0.72073674", "text": "func (nose NodeOpenedSuccessEvent) AsNodeEvent() (*NodeEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d20f469f9c32e55060080a05fa9959d5", "score": "0.7197729", "text": "func (nose NodeOpenedSuccessEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "985875e96776fbfbf7e83fb318d216f6", "score": "0.7152197", "text": "func (nose NodeOpenedSuccessEvent) AsFabricEvent() (*FabricEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bf444587634bc5d21694e0cb046e02ad", "score": "0.71303225", "text": "func (nose NodeOpenedSuccessEvent) AsChaosRestartNodeFaultCompletedEvent() (*ChaosRestartNodeFaultCompletedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "51154bfeca448577222e2e52b7544b08", "score": "0.7096537", "text": "func (nae NodeAbortingEvent) AsNodeOpenFailedEvent() (*NodeOpenFailedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ffbdfabd2bc367981dc6ea36b483d42b", "score": "0.7081288", "text": "func (curce ClusterUpgradeRollbackCompleteEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ae4b95b978331d5b2dd8cf94063b63ca", "score": "0.70714855", "text": "func (nose NodeOpenedSuccessEvent) AsNodeCloseEvent() (*NodeCloseEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dcbf5409704d9194b763cd33361f77ad", "score": "0.7063031", "text": "func (nose NodeOpenedSuccessEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "752e6d2581402c76ccb239972cbf45be", "score": "0.7038616", "text": "func (noe NodeOpeningEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e6e611b1eb39c8379fd64581fca8d134", "score": "0.70354056", "text": "func (nose NodeOpenedSuccessEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ec26813f44cbdc24680cc6b09a57c4ca", "score": "0.70307344", "text": "func (nose NodeOpenedSuccessEvent) AsNodeClosingEvent() (*NodeClosingEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "12096372721cac479aae03d837bbcda6", "score": "0.70060545", "text": "func (cuce ClusterUpgradeCompleteEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7af6ead03cd8d85742342d5a4d477aba", "score": "0.6963646", "text": "func (cudce ClusterUpgradeDomainCompleteEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "af819716aa43c34af6eb937373a2fd08", "score": "0.69476926", "text": "func (nose NodeOpenedSuccessEvent) AsNodeOpenFailedEvent() (*NodeOpenFailedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "54026cb2d51b2adac3b717b51cd3d24b", "score": "0.6945104", "text": "func (curce ClusterUpgradeRollbackCompleteEvent) AsNodeOpenFailedEvent() (*NodeOpenFailedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b0342c939f1d0c8b3ed7dd37298b87e5", "score": "0.694332", "text": "func (nose NodeOpenedSuccessEvent) AsBasicFabricEvent() (BasicFabricEvent, bool) {\n\treturn &nose, true\n}", "title": "" }, { "docid": "8ff584f9e0c1a3d738759717c752b638", "score": "0.6933924", "text": "func (nae NodeAbortedEvent) AsNodeOpenFailedEvent() (*NodeOpenFailedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "fd9fea6d8412efc019a2688601fe9760", "score": "0.69267", "text": "func (nose NodeOpenedSuccessEvent) AsBasicNodeEvent() (BasicNodeEvent, bool) {\n\treturn &nose, true\n}", "title": "" }, { "docid": "ae2d444e0e1ba11e7dd92b4991692c8a", "score": "0.6923268", "text": "func (crrfce ChaosRemoveReplicaFaultCompletedEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "35157b239527050c5bb50fdb173148b4", "score": "0.6909717", "text": "func (cuce ClusterUpgradeCompleteEvent) AsNodeOpenFailedEvent() (*NodeOpenFailedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "652850fd3f3fcdef6e5aaa273fa0c8f9", "score": "0.69061035", "text": "func (nose NodeOpenedSuccessEvent) AsClusterUpgradeDomainCompleteEvent() (*ClusterUpgradeDomainCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9e29ad5559839d2d31696d6676791015", "score": "0.6890806", "text": "func (nofe NodeOpenFailedEvent) AsClusterUpgradeRollbackCompleteEvent() (*ClusterUpgradeRollbackCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9124f7de013649f0c5cb3eaeb297a15a", "score": "0.68883973", "text": "func (noe NodeOpeningEvent) AsClusterUpgradeCompleteEvent() (*ClusterUpgradeCompleteEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0aef9ab20a49fb11a920fd994285e9fa", "score": "0.6886821", "text": "func (cuce ClusterUpgradeCompleteEvent) AsNodeAbortingEvent() (*NodeAbortingEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6ef91c1e56a7e283ea4c4653724b0d0d", "score": "0.6881183", "text": "func (noe NodeOpeningEvent) AsChaosRestartNodeFaultCompletedEvent() (*ChaosRestartNodeFaultCompletedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "55c855da86b18e5ca94ab0bcaf7560b2", "score": "0.6875993", "text": "func (nofe NodeOpenFailedEvent) AsNodeAbortingEvent() (*NodeAbortingEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "03d0172f1dcda8d3618624635a438040", "score": "0.68659335", "text": "func (nae NodeAbortedEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "322b1e833497ef7e56d9e381d63de5c0", "score": "0.6862144", "text": "func (nae NodeAbortingEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "33eb9468a30363207ec3ee1d8b3c8c75", "score": "0.68203956", "text": "func (nose NodeOpenedSuccessEvent) AsChaosRestartCodePackageFaultCompletedEvent() (*ChaosRestartCodePackageFaultCompletedEvent, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9d9c4de554c917668091eac0a2708098", "score": "0.6819184", "text": "func (crnfce ChaosRestartNodeFaultCompletedEvent) AsNodeOpeningEvent() (*NodeOpeningEvent, bool) {\n\treturn nil, false\n}", "title": "" } ]
856a8cd3ed05d5296ef5ca6ec254a4d8
The providerassigned unique ID for this managed resource.
[ { "docid": "103a057194b3873fe4aab0a7aba8530a", "score": "0.0", "text": "func (o LookupVappContainerResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupVappContainerResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "15534dcfb0d12811b318b47609d84a90", "score": "0.6435992", "text": "func (p *Provisioner) ID() string {\n\treturn p.Name + \":\" + p.Key.KeyID\n}", "title": "" }, { "docid": "75818384484ba50cec41d7f1804cffe0", "score": "0.63563263", "text": "func (o *CloudProvider) 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}", "title": "" }, { "docid": "e8aeea06209ade06a12996049dec5c55", "score": "0.63275474", "text": "func (o GetExtensionProvidersProviderOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetExtensionProvidersProvider) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7d9d595f8005e6de16ab95ef18a797f3", "score": "0.61169255", "text": "func (o CreateTrustedIdProviderWithAccountParametersOutput) IdProvider() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CreateTrustedIdProviderWithAccountParameters) string { return v.IdProvider }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c71f147c484afa9d0870e7fb554ab717", "score": "0.6103998", "text": "func (o OriginEndpointSpekeKeyProviderOutput) ResourceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OriginEndpointSpekeKeyProvider) string { return v.ResourceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9f13a75de8f01237388f5525fc213954", "score": "0.60398036", "text": "func (r RID) Provider() string { return r.Get(keyProv) }", "title": "" }, { "docid": "ad7c2717eb02c0c30b9fd7f75a8bfcb6", "score": "0.601441", "text": "func RidProviderID(rid string) (int, error) {\n\t_, _, provID, _, err := SplitRMID(rid)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(emInvalidRid, rid)\n\t}\n\treturn provID, nil\n}", "title": "" }, { "docid": "c1fefd637d91fac8818046f2dac06b6c", "score": "0.6002825", "text": "func (o *MetricsProvider) 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}", "title": "" }, { "docid": "959f4b718597f94324eddb38f931287c", "score": "0.5999717", "text": "func (o OriginEndpointSpekeKeyProviderPtrOutput) ResourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *OriginEndpointSpekeKeyProvider) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResourceId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "86555f27cb0c4bd4452cc92733c214bd", "score": "0.59343", "text": "func (m *Module) ID(version bool) string {\n\tid := fmt.Sprintf(\"namespace=%s/name=%s/provider=%s\", m.Namespace, m.Name, m.Provider)\n\tif version {\n\t\tid = fmt.Sprintf(\"%s/version=%s\", id, m.Version)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "a0689eeb8d1e5ec80e708b4a7385eb59", "score": "0.59122527", "text": "func (o TrustedIdProviderResponseOutput) IdProvider() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TrustedIdProviderResponse) string { return v.IdProvider }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "18c4ed215babc8ff628597d610094b3b", "score": "0.58868164", "text": "func (o GetSharedResourcesResourceOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSharedResourcesResource) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "abd0166f9f9783a7de8a712b38836325", "score": "0.58796227", "text": "func ID(r *Resource) (string, error) {\n\trr := registration(r)\n\tif rr == nil {\n\t\treturn \"\", fmt.Errorf(\"unknown resource type %s\", r.STV.String())\n\t}\n\treturn rr.ID(r)\n}", "title": "" }, { "docid": "c8ca462fd34f62e02676ae42326a5c26", "score": "0.5844937", "text": "func (provider *HadeIDProvider) Name() string {\n\treturn contract.IDKey\n}", "title": "" }, { "docid": "99bf9f15a3730d49c9d6f743dfe9e504", "score": "0.58076507", "text": "func (c *hetznerCloudImplementation) ProviderID() kops.CloudProviderID {\n\treturn kops.CloudProviderHetzner\n}", "title": "" }, { "docid": "77e1ab2d6ca93486e837d18639430dbc", "score": "0.5786367", "text": "func (o BackendOutput) ResourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Backend) pulumi.StringPtrOutput { return v.ResourceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ace9faad9a6b3a34296cb5f6219dd273", "score": "0.57569057", "text": "func (o StorageAccountOutput) ResourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageAccount) *string { return v.ResourceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "16ad59babc2be044c88c4c9d0a6b589d", "score": "0.5723692", "text": "func (br *BaseResource) ResourceID() string {\n\treturn fmt.Sprintf(\"%s[%s]\", br.Type, br.Title)\n}", "title": "" }, { "docid": "3f6863d32debdf7ce54089fb7a755c83", "score": "0.5720357", "text": "func (ucs *UnlockedCryptoService) ID() string {\n\treturn ucs.PublicKey().ID()\n}", "title": "" }, { "docid": "31c50c8ca32050966506157ccad0dc2e", "score": "0.5671056", "text": "func (k Key) ResourceID() string {\n\treturn fmt.Sprintf(\n\t\tresourceIDFormat,\n\t\tk.ProjectID,\n\t\tk.LocationID,\n\t\tk.KeyRingID,\n\t\tk.KeyID,\n\t\tk.KeyVersion,\n\t)\n}", "title": "" }, { "docid": "5dfe3684eba995077747d4dc24234010", "score": "0.56658405", "text": "func (m *WindowsAppX) GetIdentityResourceIdentifier()(*string) {\n val, err := m.GetBackingStore().Get(\"identityResourceIdentifier\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "47860d369bbee09b59910778ea99cf34", "score": "0.5643048", "text": "func (o *ProviderAgentResourceEvent) 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}", "title": "" }, { "docid": "ac9b54e2596849b9dbca109fce51cf4b", "score": "0.56255025", "text": "func Id() string {\n\t// lock for lastTime, lastRand, and chars\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tnow := time.Now().UTC().UnixNano()\n\tvar r int64\n\n\t// if we have the same time, just inc lastRand, else create a new one\n\tif now == lastTime {\n\t\tlastRand++\n\t} else {\n\t\tlastRand = rand.Int63()\n\t}\n\tr = lastRand\n\n\t// remember this for next time\n\tlastTime = now\n\n\tnowStr := strconv.FormatInt(now, 10)\n\trStr := strconv.FormatInt(r, 10)\n\n\tfor len(rStr) < 19 {\n\t\trStr = \"0\" + rStr\n\t}\n\n\treturn nowStr + \"-\" + rStr\n}", "title": "" }, { "docid": "acb6a0c7c48165f0f6904e02da30b0e1", "score": "0.56013304", "text": "func (t *GrpcManager) GetCloudProviderID() string {\n\treturn t.GetConfig().GetIdentifier()\n}", "title": "" }, { "docid": "34d0639cfa688874f424e23aeb9dbc2e", "score": "0.5597226", "text": "func (a *alloc) ID() string {\n\treturn a.id\n}", "title": "" }, { "docid": "ff362e5852c43d802f1390f7667a89b6", "score": "0.5590226", "text": "func (o IssuerSpecAcmeSolversDns01AzureDNSManagedIdentityOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IssuerSpecAcmeSolversDns01AzureDNSManagedIdentity) *string { return v.ResourceID }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ecc1f406cb996c5b5c51a77e80a32529", "score": "0.55806977", "text": "func (o *ManagedService) ID() string {\n\tif o != nil && o.bitmap_&2 != 0 {\n\t\treturn o.id\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "582602458f8575f864d8b6d8c134cddb", "score": "0.5569103", "text": "func (o ProviderOutput) ClientId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.ClientId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5fcec907ceca485580f140f2732a39b9", "score": "0.55396646", "text": "func (c *gencommon) ID() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\tif c.id == \"\" {\n\t\treturn c.pkgID\n\t}\n\treturn c.id\n}", "title": "" }, { "docid": "ae4cef87bcb0203e44d26688e8e9e990", "score": "0.5521016", "text": "func (o GetUserExternalIdOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserExternalId) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "56bb7f2f8c09716d052df3b6f68a1ef0", "score": "0.5519154", "text": "func (o ClusterIssuerSpecAcmeSolversDns01AzureDNSManagedIdentityOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterIssuerSpecAcmeSolversDns01AzureDNSManagedIdentity) *string { return v.ResourceID }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fee91d695b3cc193dfa4b391957785c0", "score": "0.55142665", "text": "func (c *Client) ID() string { return c.host }", "title": "" }, { "docid": "6ef703b9f81a1dbbabf87ee04c4a8804", "score": "0.55131096", "text": "func (id AdministratorId) ID() string {\n\tfmtString := \"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/administrators/%s\"\n\treturn fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, id.ObjectId)\n}", "title": "" }, { "docid": "58b2947573d0e576c0bb55073bf151f1", "score": "0.5508793", "text": "func getProviderIDFromNode(node *corev1.Node) string {\n\treturn node.Spec.ProviderID\n}", "title": "" }, { "docid": "4cfff8e2ed1515923cd72a2596e236cc", "score": "0.54914385", "text": "func (r *ResourceIdentifier) GetResourceIdentifier() *ResourceIdentifier { return r }", "title": "" }, { "docid": "4cfff8e2ed1515923cd72a2596e236cc", "score": "0.54914385", "text": "func (r *ResourceIdentifier) GetResourceIdentifier() *ResourceIdentifier { return r }", "title": "" }, { "docid": "de9a3aa630bd5b8edf5573a4001b4db1", "score": "0.5486097", "text": "func (m *AccessReviewInstanceDecisionItemResource) 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}", "title": "" }, { "docid": "88e82dd672090813e9fbf98d6d3c7d77", "score": "0.54789317", "text": "func (tr *EventHub) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "ce558563d235748151ab0af7fb8193af", "score": "0.5469935", "text": "func (tr *ConsumerGroup) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "a0cf923d1edb3f3baa5b28deb7b259b6", "score": "0.5464073", "text": "func (c *ModuleClient) GenerationID() string {\n\treturn c.creds.GetGenerationID()\n}", "title": "" }, { "docid": "f717e854c416a0ba9dfbd7453fbbc66c", "score": "0.5458991", "text": "func (p *CloudProvider) ExternalID(nodeName types.NodeName) (string, error) {\n\tvms, err := p.getVms()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvm, ok := vms[string(nodeName)]\n\tif !ok {\n\t\treturn \"\", cloudprovider.InstanceNotFound\n\t}\n\treturn vm.Id, nil\n}", "title": "" }, { "docid": "d65d076e1bc6f95cc33bb3a0c934fb64", "score": "0.5457364", "text": "func (l *link) Id() string {\n\tl.RLock()\n\tdefer l.RUnlock()\n\treturn l.id\n}", "title": "" }, { "docid": "852b65f72265d7a5d3bb6f774f1c714f", "score": "0.54568917", "text": "func (a *AzureCloudProvider) InstanceID() string {\n\treturn a.instanceID\n}", "title": "" }, { "docid": "141298f1b3fd334dbdc1074a44a8ea3e", "score": "0.5440089", "text": "func (i *Identity) InstanceID() (string, error) { return managedInstance.InstanceID(i.Log), nil }", "title": "" }, { "docid": "371a585930bb50bc41bfb1f9465d79d2", "score": "0.54370797", "text": "func (k Kapp) Id() string {\n\treturn k.mergedDescriptor.Id\n}", "title": "" }, { "docid": "582223c69f40d83bfd728aae4d3f09c4", "score": "0.54346025", "text": "func (d *dropbox) ID() uint {\n\treturn dropboxProviderID\n}", "title": "" }, { "docid": "28f1e9ad87e4f8c5adfc5d265444229e", "score": "0.54267573", "text": "func ID() string {\n\treturn xid.New().String()\n}", "title": "" }, { "docid": "e726975af04bae5d81f325f5002534f4", "score": "0.54250646", "text": "func (p *BasicProvider) ClientID() (string, error) {\n\treturn p.ClientIDVal, nil\n}", "title": "" }, { "docid": "c1c5d77ff9eda09913347affeae834a8", "score": "0.5422549", "text": "func (mySourceConfig *SourceConfig) ID() (param string) {\n\treturn mySourceConfig.IDvar\n}", "title": "" }, { "docid": "a684f3cf0337db8157a4a944be93f9f9", "score": "0.54206693", "text": "func (i *instances) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error) {\n\tserver, err := findServerByName(i.vultrClient, string(nodeName))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\toptional := \"\"\n\tsegments := strconv.Itoa(server.RegionID)\n\tproviderID := fmt.Sprintf(\"%s/%s/%s\", optional, segments, server.ID)\n\n\treturn providerID, nil\n}", "title": "" }, { "docid": "8787340d4275e8c14588635003ed7fe9", "score": "0.54168206", "text": "func (m *Manager) UniqueID() []byte {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\n\treturn m.j.UniqueID\n}", "title": "" }, { "docid": "e6b7a49fab0c00d872ce83bc614fd8f6", "score": "0.5410453", "text": "func (c *secureConn) ID() string {\n\treturn iconn.ID(c)\n}", "title": "" }, { "docid": "cd3655a5f6f6578c5cd5cb28bf9f4612", "score": "0.54083425", "text": "func (ng *AutomiumServiceNodeGroup) Id() string {\n\treturn fmt.Sprintf(\"%s-nodegroup\", ng.serviceName)\n}", "title": "" }, { "docid": "c83c94a6ffbe9c209e898d88f605cb62", "score": "0.54056346", "text": "func getUUIDFromProviderID(providerID string) string {\n\treturn strings.TrimPrefix(providerID, providerPrefix)\n}", "title": "" }, { "docid": "b625a8aecee1885ae9df6ab0adc554dc", "score": "0.53972036", "text": "func (id WebPubSubId) ID() string {\n\tfmtString := \"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s\"\n\treturn fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName)\n}", "title": "" }, { "docid": "7aa3ede58becb38d63e1c73f88b86e89", "score": "0.5394893", "text": "func (tr *EventHubNamespace) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "5010568711f7a3225286e5f72a171691", "score": "0.53893125", "text": "func (p *Peer) ID() int64 {\n\tid, _ := eos.StringToName(string(p.Discovery.SeedNetworkAccountName))\n\treturn int64(id)\n}", "title": "" }, { "docid": "108994cd5cecffdc19431901b54a06fc", "score": "0.5385477", "text": "func (ser *StorageElementRecord) Id() string {\n\treturn ser.UniqueID\n}", "title": "" }, { "docid": "85173e0bd551bc75b4cc57e5bbd96d0d", "score": "0.5380291", "text": "func (o ProviderOutput) PartnerId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PartnerId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8c9ecf1cae7173be22302938adfbf6e3", "score": "0.53769624", "text": "func (o GetSharedResourcesResourceOutput) ResourceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSharedResourcesResource) string { return v.ResourceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0bc02bcfda8e7e8af9dac8f3aef37583", "score": "0.53735715", "text": "func (o UserExternalIdOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserExternalId) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "60c00b794b3925b2089fa51ca27ab248", "score": "0.5372301", "text": "func (c *Context) UUID() string {\n\treturn c.id\n}", "title": "" }, { "docid": "c016303c6eb0b14e3bbd5843572aa6d0", "score": "0.5370036", "text": "func (t *Bgp_Global_Confederation) GetIdentifier() uint32 {\n\tif t == nil || t.Identifier == nil {\n\t\treturn 0\n\t}\n\treturn *t.Identifier\n}", "title": "" }, { "docid": "662a8d3a64460a6cbcc4727e6f382eeb", "score": "0.53687036", "text": "func (o StorageAccountPropertiesOutput) ResourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageAccountProperties) *string { return v.ResourceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4678c33e183131f9a902236f47fe082f", "score": "0.53657985", "text": "func (o GetGroupAlternateIdentifierExternalIdOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetGroupAlternateIdentifierExternalId) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9bfd5d621f9454ef55ce8fa53c919bb4", "score": "0.53650093", "text": "func (cs CarShare) GetID() string {\n\treturn cs.ID.Hex()\n}", "title": "" }, { "docid": "12391da01cb81a776b201f174840bc5c", "score": "0.5363456", "text": "func (c *DNSContext) ID() uuid.UUID {\n\treturn c.id\n}", "title": "" }, { "docid": "9099a6f71b72f83610efb9011a19af03", "score": "0.5361688", "text": "func newID() string {\n\tvar data [8]byte\n\tbinary.LittleEndian.PutUint64(data[:], uint64(time.Now().UnixNano()))\n\treturn base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(data[:])\n}", "title": "" }, { "docid": "4ba4c80dbe1eace416bd9ecdd4b4ee12", "score": "0.53602463", "text": "func (o *CloudManagedNetwork) Identifier() string {\n\n\treturn o.ID\n}", "title": "" }, { "docid": "f2e1999961af40b2e7ecefaa1908ace5", "score": "0.53598243", "text": "func newID() string {\n\treturn fmt.Sprintf(\"%x\", rand.Int63())\n}", "title": "" }, { "docid": "cad2ea601b60b36dc73afb59997fd942", "score": "0.5359502", "text": "func (cp ConfigurableProduct) Identifier() string {\n\treturn cp.product.GetIdentifier()\n}", "title": "" }, { "docid": "de473c94ca3866bd639ee5e723726de7", "score": "0.5358729", "text": "func (o GetGroupExternalIdOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetGroupExternalId) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "91212906cf2fbf0bd94714f28919b82d", "score": "0.53556436", "text": "func (o GetUserAlternateIdentifierExternalIdOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserAlternateIdentifierExternalId) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4f72efbd5dbd76bbb813427ea32868d0", "score": "0.5353434", "text": "func (tr *AuthorizationRule) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "58ec5d4e2119e51f01bdea703354b6a8", "score": "0.53472674", "text": "func (o IssuerSpecAcmeSolversDns01AzureDNSManagedIdentityPtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IssuerSpecAcmeSolversDns01AzureDNSManagedIdentity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a4f9e1e7c861a3a60803a1bb57ed89ef", "score": "0.5342871", "text": "func (r *SourceCredential) ID() pulumi.IDOutput {\n\treturn r.s.ID()\n}", "title": "" }, { "docid": "01ebc328813a77a0bbf2bd1bfcce4cb2", "score": "0.5338243", "text": "func (s server) ID() string {\n\treturn s.id\n}", "title": "" }, { "docid": "9174da8d067c4a5ca3426d424559efcb", "score": "0.5338225", "text": "func (o LookupSamlProviderResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupSamlProviderResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "748f21a73f81467c5f0cfdc67064d6dc", "score": "0.5337724", "text": "func (i *Info) DisplayID() string {\n\tswitch i.Type {\n\tcase authn.IdentityTypeLoginID:\n\t\tdisplayID, _ := i.Claims[IdentityClaimLoginIDOriginalValue].(string)\n\t\treturn displayID\n\tcase authn.IdentityTypeOAuth:\n\t\tdisplayID, _ := i.Claims[StandardClaimEmail].(string)\n\t\treturn displayID\n\tcase authn.IdentityTypeAnonymous:\n\t\tdisplayID, _ := i.Claims[IdentityClaimAnonymousKeyID].(string)\n\t\treturn displayID\n\tdefault:\n\t\tpanic(fmt.Errorf(\"identity: unexpected identity type %v\", i.Type))\n\t}\n}", "title": "" }, { "docid": "c609f520280475310e2a1c7fe4e6119b", "score": "0.5335479", "text": "func (o *Point) GetResourceOwnerId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.ResourceOwnerId\n}", "title": "" }, { "docid": "033fb1f271645e5938862094c5bbb603", "score": "0.53338647", "text": "func NewID() string {\n\treturn InstanceID + \"-\" + strconv.FormatInt(time.Now().UnixNano(), 36)\n}", "title": "" }, { "docid": "0933f28a2a2be393e2ce8cf6c86f0faa", "score": "0.533336", "text": "func (o GroupExternalIdOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupExternalId) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3bcba8b83764eadcbd90f4e627812185", "score": "0.5331196", "text": "func (o StorageAccountResponseOutput) ResourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageAccountResponse) *string { return v.ResourceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3b950a6ca71303beea7772127660cad1", "score": "0.5329905", "text": "func (p policy) Id() string {\n\treturn p.id\n}", "title": "" }, { "docid": "0d787c83e139147bce731aa42498b9b2", "score": "0.5327474", "text": "func newID() string {\n\tid := uuid.NewV4()\n\treturn id.String()\n}", "title": "" }, { "docid": "38bc8519f0fec269c62316c492b8e16a", "score": "0.5327127", "text": "func (env *environment) Id() string {\n\treturn env.id\n}", "title": "" }, { "docid": "58ad95976906856774539e44089c2ffc", "score": "0.53193134", "text": "func (o *SamlAuthProviderModelAuthProvider) GetId() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Id\n}", "title": "" }, { "docid": "10bffda9beb4d5192ff142a5935bf0d0", "score": "0.5315171", "text": "func (o ClusterIssuerSpecAcmeSolversDns01AzureDNSManagedIdentityPtrOutput) ResourceID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ClusterIssuerSpecAcmeSolversDns01AzureDNSManagedIdentity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceID\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e42f3a8cda7d50c58899baf171496db5", "score": "0.53142965", "text": "func (o StorageAccountCredentialsResponseOutput) ResourceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StorageAccountCredentialsResponse) string { return v.ResourceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2b562d197cc7bb9e5b0b2e0643174196", "score": "0.5313499", "text": "func (r *Resource) OwnerID() uint {\n\treturn r.ParentID()\n}", "title": "" }, { "docid": "cffc5f5cd03bd0e6bc6866b44d1b6e43", "score": "0.53064084", "text": "func (instance job) ID() string {\n\treturn instance.uuid\n}", "title": "" }, { "docid": "6d02a0e0bfc4e49aed790b912d5d6ab7", "score": "0.5302464", "text": "func (o *Instance) GetProvider() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Provider\n}", "title": "" }, { "docid": "f5a4125f79eaa2de46751a89d4051f09", "score": "0.5302046", "text": "func (v *VirtualMachine) ID() (string, error) {\n\tid, err := v.activeSettingsData.GetProperty(\"VirtualSystemIdentifier\")\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"fetching VM ID\")\n\t}\n\treturn id.Value().(string), nil\n}", "title": "" }, { "docid": "db87c9e68ce5499a4b0d21834c51fa0e", "score": "0.5301731", "text": "func CurrentUserId(r *http.Request) (id string) {\n\tf := NewBackendStore(r)\n\treq, err := oauthprovider.NewAuthenticatedRequest(f.r, f)\n\tif err != nil {\n\t\treturn\n\t}\n\ttoken, _ := req.GetToken()\n\ttok, err := f.GetOAuthToken(token)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn tok.UserID\n}", "title": "" }, { "docid": "7c6f2c3a01819b5e54de01c6ca38b993", "score": "0.5300093", "text": "func (n *MVCCHandle) GetID() *common.ID { return n.meta.AsCommonID() }", "title": "" }, { "docid": "f1db61e844794ce936853544d44de86f", "score": "0.529498", "text": "func GetServerID(provider string) error {\n\tp, err := newProvider(provider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsid, err := p.GetServerID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmetavars.ServerID = sid\n\treturn nil\n}", "title": "" }, { "docid": "4ab6d9bcc267fbc251c010a0223f943b", "score": "0.52915287", "text": "func (c *Chain) ID() (string, error) {\n\t// chainID in App has the most priority.\n\tif c.options.chainID != \"\" {\n\t\treturn c.options.chainID, nil\n\t}\n\n\t// otherwise uses defined in config.yml\n\tchainConfig, err := c.Config()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tgenid, ok := chainConfig.Genesis[\"chain_id\"]\n\tif ok {\n\t\treturn genid.(string), nil\n\t}\n\n\t// use app name by default.\n\treturn c.app.N(), nil\n}", "title": "" }, { "docid": "66b50bb850c6173c212fc468b21b75b3", "score": "0.5289976", "text": "func (u *User) ID() string {\n\treturn kivik.UserPrefix + u.Name\n}", "title": "" }, { "docid": "ba9cb12c8635bc0ef2b985cc3ebe4b23", "score": "0.5286145", "text": "func (m *GroupMembers) 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}", "title": "" }, { "docid": "028dbe0883f9cac04ea385373b7fca21", "score": "0.5285875", "text": "func (s *server) ID() string {\n\treturn s.id\n}", "title": "" }, { "docid": "5ca610070e81c9d58b278a58b03ecdda", "score": "0.5284416", "text": "func (p Person) ID() string {\n\treturn fmt.Sprintf(\"Person's identifier: %s\", p.Citizen.ID())\n}", "title": "" } ]
ddc887eda3a24886f89723ffe2a8d4dc
SetUserPermissions sets the userPermissions property value. List of user permissions when the audit was performed.
[ { "docid": "eaed0d982b23849225baa757002d579b", "score": "0.83288175", "text": "func (m *AuditActor) SetUserPermissions(value []string)() {\n err := m.GetBackingStore().Set(\"userPermissions\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" } ]
[ { "docid": "c96c1b94c605847449ffc33236a97be4", "score": "0.8383027", "text": "func (m *CloudPcAuditActor) SetUserPermissions(value []string)() {\n err := m.GetBackingStore().Set(\"userPermissions\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "08484bd3e203a7305415b94ab9a6d331", "score": "0.72036445", "text": "func (mr *MockFileManagerMockRecorder) SetUserPermissions(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetUserPermissions\", reflect.TypeOf((*MockFileManager)(nil).SetUserPermissions), arg0, arg1)\n}", "title": "" }, { "docid": "a84062b68a87389976384ff575977e5a", "score": "0.68954647", "text": "func (m *website) SetUserPermission(val string) {\n\tm.userPermissionField = val\n}", "title": "" }, { "docid": "27663e2978a283b5dc7196f77247c391", "score": "0.6673129", "text": "func (r *Visualizer) SetPermissions(ctx context.Context, permissions []*httpv1.Permission) error {\n\tdbPermissions := toDBPermissions(permissions...)\n\n\taffectedIDs, err := r.permissionStore.Update(ctx, dbPermissions...)\n\tif err != nil {\n\t\tlog.\n\t\t\tFromContext(ctx).\n\t\t\tWithErr(err).\n\t\t\tError(\"failed to update permissions\")\n\n\t\treturn err\n\t}\n\n\tskipIDs := make(map[int64]struct{}, len(affectedIDs))\n\tfor _, id := range affectedIDs {\n\t\tskipIDs[id] = struct{}{}\n\t}\n\n\tfor i, p := range dbPermissions {\n\t\tif _, should := skipIDs[p.UserID]; should {\n\t\t\tdbPermissions[i] = dbPermissions[len(dbPermissions)-1]\n\t\t\tdbPermissions = dbPermissions[:len(dbPermissions)-1]\n\t\t}\n\t}\n\n\tif len(dbPermissions) == 0 {\n\t\treturn nil\n\t}\n\n\tif err := r.permissionStore.Add(ctx, dbPermissions...); err != nil {\n\t\tlog.\n\t\t\tFromContext(ctx).\n\t\t\tWithErr(err).\n\t\t\tError(\"failed to add permissions\")\n\n\t\tif derr := ierr.CheckDuplicate(err, \"user_id\"); derr != nil {\n\t\t\treturn derr\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9c66591efad54525c8623d3fe4d5c1e6", "score": "0.66674393", "text": "func (o *PatchedUpdateWorkspaceUser) SetPermissions(v string) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "35e1702832a7c73010d7c9d6f35dc1ed", "score": "0.6623188", "text": "func (m *WebCheck) SetUserPermission(val string) {\n\tm.userPermissionField = val\n}", "title": "" }, { "docid": "ebc19a44b5fce803f44d86a5b0f92f9a", "score": "0.651877", "text": "func (m *Site) SetPermissions(value []Permissionable)() {\n m.permissions = value\n}", "title": "" }, { "docid": "587b407f31745568736896d3e9991475", "score": "0.6425205", "text": "func (ctx *Context) UserPermissions(channelID, userID string,\n) (apermissions int, err error) {\n\n\t// Try to just get permissions from state.\n\tapermissions, err = ctx.Session.State.UserChannelPermissions(\n\t\tuserID, channelID)\n\tif err == nil {\n\t\treturn\n\t}\n\n\t// Otherwise try get as much data from state as possible, falling back to the network.\n\tchannel, err := ctx.Channel(channelID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tguild, err := ctx.Guild(channel.GuildID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif userID == guild.OwnerID {\n\t\tapermissions = discordgo.PermissionAll\n\t\treturn\n\t}\n\n\tmember, err := ctx.Member(guild.ID, userID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn MemberPermissions(guild, channel, member), nil\n}", "title": "" }, { "docid": "3e591553cf06a699995f543d30a6f1bd", "score": "0.62960386", "text": "func (s *service) SetPermissions(ctx *context.T, call rpc.ServerCall, perms access.Permissions, version string) error {\n\treturn fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "f4d44424791e52f5f3e3bfc0734af1c1", "score": "0.6214126", "text": "func (m *MockFileManager) SetUserPermissions(arg0 string, arg1 fs.FileMode) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetUserPermissions\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8b6d30dc8947cda8c8194466670fffc3", "score": "0.611308", "text": "func (mr *MockServiceMockRecorder) UpdateUserPermissions(ctx, user interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateUserPermissions\", reflect.TypeOf((*MockService)(nil).UpdateUserPermissions), ctx, user)\n}", "title": "" }, { "docid": "6b85bf7852254f6f65ad715cb15dbcda", "score": "0.60870945", "text": "func AuthUserUserPermissions(mods ...qm.QueryMod) authUserUserPermissionQuery {\n\tmods = append(mods, qm.From(\"\\\"auth_user_user_permissions\\\"\"))\n\treturn authUserUserPermissionQuery{NewQuery(mods...)}\n}", "title": "" }, { "docid": "9ca89e304227794017d4ccfe90ea721e", "score": "0.6079372", "text": "func (s *authzStore) RevokeUserPermissions(ctx context.Context, args *database.RevokeUserPermissionsArgs) (err error) {\n\ttxs, err := s.store.Transact(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"start transaction\")\n\t}\n\tdefer func() { err = txs.Done(err) }()\n\n\tif err = txs.DeleteAllUserPermissions(ctx, args.UserID); err != nil {\n\t\treturn errors.Wrap(err, \"delete all user permissions\")\n\t}\n\n\tfor _, accounts := range args.Accounts {\n\t\tif err := txs.DeleteAllUserPendingPermissions(ctx, accounts); err != nil {\n\t\t\treturn errors.Wrap(err, \"delete all user pending permissions\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a26b2a713ac224622b81df022f967748", "score": "0.6075761", "text": "func (s *DiscordGoSession) UserPermissions(userID DiscordUser, guildID string) (int, error) {\n\tguild, err := s.State.Guild(guildID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tmember, err := s.State.Member(guild.ID, userID.String())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\ts.State.RLock()\n\tdefer s.State.RUnlock()\n\treturn GuildMemberPermissions(member, guild), nil\n}", "title": "" }, { "docid": "a8178fc5ef0ae45c6dcad2d86e71f5ea", "score": "0.60226744", "text": "func (s *ModerationService) SetPermissions(ctx context.Context, subreddit string, username string, permissions *ModPermissions) (*Response, error) {\n\tpath := fmt.Sprintf(\"r/%s/api/setpermissions\", subreddit)\n\n\tform := url.Values{}\n\tform.Set(\"api_type\", \"json\")\n\tform.Set(\"name\", username)\n\tform.Set(\"type\", \"moderator_invite\")\n\tform.Set(\"permissions\", permissions.String())\n\n\treq, err := s.client.NewRequestWithForm(http.MethodPost, path, form)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.client.Do(ctx, req, nil)\n}", "title": "" }, { "docid": "96206aa8b9cc55f0b8076224c37eda01", "score": "0.60124373", "text": "func (o *AuthUserUserPermission) SetUser(ctx context.Context, exec boil.ContextExecutor, insert bool, related *AuthUser) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"auth_user_user_permissions\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"user_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, authUserUserPermissionPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, updateQuery)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.UserID = related.ID\n\tif o.R == nil {\n\t\to.R = &authUserUserPermissionR{\n\t\t\tUser: related,\n\t\t}\n\t} else {\n\t\to.R.User = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &authUserR{\n\t\t\tUserAuthUserUserPermissions: AuthUserUserPermissionSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.UserAuthUserUserPermissions = append(related.R.UserAuthUserUserPermissions, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79938593a578afb9caeb6f449a0ba5cf", "score": "0.59219706", "text": "func (s *GenericPermission) Set(subjectID string, userID string, permissions []string) ([]string, error) {\n\n\tbody := make(map[string]interface{})\n\tbody[\"user\"] = userID\n\tbody[\"permissions\"] = permissions\n\n\traw, err := s.GetClient().Put(fmt.Sprintf(PERMISSION_SET, s.subjectType, subjectID), body, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := make([]string, 0)\n\terr = s.GetClient().FromJSON(raw, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "460d1882ea97d2fea073ff51353f080c", "score": "0.5906925", "text": "func (o *LegacyAuthorizationPostRequestAllOf) SetPermissions(v []Permission) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "ca343da3a39f79637f6e6bfd4c4bbee6", "score": "0.5850133", "text": "func (n *ReferenceTypeNode) UserRolePermissions(ctx context.Context) []ua.RolePermissionType {\n\tfilteredPermissions := []ua.RolePermissionType{}\n\tsession, ok := ctx.Value(SessionKey).(*Session)\n\tif !ok {\n\t\treturn filteredPermissions\n\t}\n\troles := session.UserRoles()\n\trolePermissions := n.RolePermissions()\n\tif rolePermissions == nil {\n\t\trolePermissions = session.Server().RolePermissions()\n\t}\n\tfor _, role := range roles {\n\t\tfor _, rp := range rolePermissions {\n\t\t\tif rp.RoleID == role {\n\t\t\t\tfilteredPermissions = append(filteredPermissions, rp)\n\t\t\t}\n\t\t}\n\t}\n\treturn filteredPermissions\n}", "title": "" }, { "docid": "4c39015a3dbebad76e2417b96c15087f", "score": "0.5820451", "text": "func (c *Client) SetUserGroupPermissions(group string, permissionItems *[]types.GuacPermissionItem) error {\n\trequest, err := c.CreateJSONRequest(http.MethodPatch, fmt.Sprintf(\"%s/%s/%s/permissions\", c.baseURL, userGroupsBasePath, group), permissionItems)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Call(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ee10e836c0f5a5c889bda51d031c71b", "score": "0.5805768", "text": "func (o *ProcessorRunStatusDetailsEntity) SetPermissions(v PermissionsDTO) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "060b7797d46cab42fab2354357554acf", "score": "0.5785586", "text": "func (s *GetEffectivePermissionsForPathOutput) SetPermissions(v []*PrincipalResourcePermissions) *GetEffectivePermissionsForPathOutput {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "76c1defba27fa1353698b23f5eda1bce", "score": "0.57634", "text": "func AssignUserPermission(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tuserPermission := models.UsuarioPermiso{}\n\tdecoder := json.NewDecoder(r.Body)\n\tdecoder.DisallowUnknownFields()\n\tif err := decoder.Decode(&userPermission); err != nil {\n\t\tfmt.Println(err.Error())\n\t\trespondJSON(w, http.StatusBadRequest, JSONResponse{Message: \"Petición mal estructurada\"})\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tif err := db.Omit(\"UsuarioPermisoFecha\").Save(&userPermission).Error; err != nil {\n\t\trespondJSON(w, http.StatusBadRequest, JSONResponse{Message: err.Error()})\n\t\treturn\n\t}\n\trespondJSON(w, http.StatusOK, JSONResponse{Message: \"Operación realizada con éxito!!\"})\n}", "title": "" }, { "docid": "60b9b41a98082bd62a593df27846c330", "score": "0.5749347", "text": "func (c *Client) SetUserPrivacySettingRules(ctx context.Context, request *SetUserPrivacySettingRulesRequest) error {\n\tvar ok Ok\n\n\tif err := c.rpc.Invoke(ctx, request, &ok); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84ecfaba8dd6a659caa6eefff15dba85", "score": "0.5654826", "text": "func (o *ProcessGroupEntity) SetPermissions(v PermissionsDTO) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "3c5c1e8eccab57744f5034b0d2a318a9", "score": "0.56251836", "text": "func (o *Bucket) SetPermissions(v Permissions) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "d4c7ca4aafe91c2b901d8d42e90456cc", "score": "0.5595811", "text": "func (s *BatchPermissionsRequestEntry) SetPermissions(v []*string) *BatchPermissionsRequestEntry {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "51114353576c01135a7947f0564c7bd7", "score": "0.55937773", "text": "func (m Mongo) AddUserPermission(username, permission string) error {\n\tquery := bson.M{\"_id\": username}\n\tupdate := bson.M{\n\t\t\"$addToSet\": bson.M{\n\t\t\t\"permissions\": permission,\n\t\t},\n\t}\n\n\tif err := m.profiles().Update(query, update); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update permissions list\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e784228ad4a82ac3da3c38cd760e62c2", "score": "0.55656683", "text": "func (o *ComponentReferenceEntity) SetPermissions(v PermissionsDTO) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "b16762f23967913c24cac699e2f727a6", "score": "0.5554124", "text": "func (s *RevokePermissionsInput) SetPermissions(v []*string) *RevokePermissionsInput {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "f717c6da9d8b4f9833c7e43d78783e90", "score": "0.5547775", "text": "func (o *PeopleSpecificPerson) SetPermissions(v PeoplePermissions) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "a6ba71d748c3aae56b4029e781ba4b7e", "score": "0.5495226", "text": "func (client *Client) SetAPIKeyPermissions(userID string, publicKey string, tradePermission bool, accountPermission bool) SuccessReturn {\r\n\tr := new(SuccessReturn)\r\n\tparams := \"\"\r\n\r\n\tvar permissions APIKeyPermissions\r\n\tpermissions.Account = accountPermission\r\n\tpermissions.Trade = tradePermission\r\n\tstringBody, err := json.Marshal(permissions)\r\n\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\r\n\tfinalBody := string(stringBody)\r\n\tjsonStringReturn := httpDo(POST, params, \"/v1/users/\"+userID+\"/keys/\"+publicKey+\"/permissions\", finalBody, client.Config.MasterAPIKey, client.Config.MasterSecretKey)\r\n\r\n\tif client.Config.DebugMessages {\r\n\t\tfmt.Println(jsonStringReturn)\r\n\t}\r\n\r\n\tjson.Unmarshal([]byte(jsonStringReturn), r)\r\n\treturn *r\r\n}", "title": "" }, { "docid": "ae6b0aac5815462e1bc9fd70d950dd6f", "score": "0.5478499", "text": "func SetPermissions(path string, fileMode os.FileMode) error {\n\tif err := os.Chmod(path, fileMode); err != nil {\n\t\treturn err\n\t}\n\n\tsystemGroup := GetenvWithDefault(\"DOKKU_SYSTEM_GROUP\", \"dokku\")\n\tsystemUser := GetenvWithDefault(\"DOKKU_SYSTEM_USER\", \"dokku\")\n\tif strings.HasPrefix(path, \"/etc/sudoers.d/\") {\n\t\tsystemGroup = \"root\"\n\t\tsystemUser = \"root\"\n\t}\n\n\tgroup, err := user.LookupGroup(systemGroup)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuser, err := user.Lookup(systemUser)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuid, err := strconv.Atoi(user.Uid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgid, err := strconv.Atoi(group.Gid)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.Chown(path, uid, gid)\n}", "title": "" }, { "docid": "d8bcce714147b874fe0bff83031209ba", "score": "0.5447864", "text": "func (o *CrossAccountRequestWithRolesRoles) SetPermissions(v []Permission) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "e810968c19a68a953591f62147dd8a0e", "score": "0.5441907", "text": "func (s *GrantPermissionsInput) SetPermissions(v []*string) *GrantPermissionsInput {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "1cf7ebb4945bb29d7d439e296b0ac638", "score": "0.5416389", "text": "func (o *AuthUserUserPermission) SetPermission(ctx context.Context, exec boil.ContextExecutor, insert bool, related *AuthPermission) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE \\\"auth_user_user_permissions\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, []string{\"permission_id\"}),\n\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 2, authUserUserPermissionPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.ID, o.ID}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, updateQuery)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.PermissionID = related.ID\n\tif o.R == nil {\n\t\to.R = &authUserUserPermissionR{\n\t\t\tPermission: related,\n\t\t}\n\t} else {\n\t\to.R.Permission = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &authPermissionR{\n\t\t\tPermissionAuthUserUserPermissions: AuthUserUserPermissionSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.PermissionAuthUserUserPermissions = append(related.R.PermissionAuthUserUserPermissions, o)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "573224a1b559ede64e18d96d6ce96cd1", "score": "0.5389939", "text": "func SetUserQuota(path string, user *user.User, limits Limits) (info *Info, err error) {\n\treturn setUserQuota(path, user, &limits)\n}", "title": "" }, { "docid": "77152ba6b5580b9828bb2831a983eb9a", "score": "0.53872794", "text": "func (m *MockService) UpdateUserPermissions(ctx context.Context, user model.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateUserPermissions\", ctx, user)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "9e95d4396284871617a3c44b33faa1de", "score": "0.5360324", "text": "func (c *Container) SetPermissions(permissions ContainerPermissions, options *SetContainerPermissionOptions) error {\n\tbody, length, err := generateContainerACLpayload(permissions.AccessPolicies)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := url.Values{\n\t\t\"restype\": {\"container\"},\n\t\t\"comp\": {\"acl\"},\n\t}\n\theaders := c.bsc.client.getStandardHeaders()\n\theaders = addToHeaders(headers, ContainerAccessHeader, string(permissions.AccessType))\n\theaders[\"Content-Length\"] = strconv.Itoa(length)\n\n\tif options != nil {\n\t\tparams = addTimeout(params, options.Timeout)\n\t\theaders = mergeHeaders(headers, headersFromStruct(*options))\n\t}\n\turi := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)\n\n\tresp, err := c.bsc.client.exec(http.MethodPut, uri, headers, body, c.bsc.auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer drainRespBody(resp)\n\treturn checkRespCode(resp, []int{http.StatusOK})\n}", "title": "" }, { "docid": "1cbd44773cc787e10ab771c30a1af199", "score": "0.5331451", "text": "func (s *PrincipalPermissions) SetPermissions(v []*string) *PrincipalPermissions {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "11db8387819d895daf13fd0825a808a4", "score": "0.53115183", "text": "func (s *PrincipalResourcePermissions) SetPermissions(v []*string) *PrincipalResourcePermissions {\n\ts.Permissions = v\n\treturn s\n}", "title": "" }, { "docid": "bdad2e0a9bf94bb22cdae597f210a4ab", "score": "0.52743447", "text": "func (o UserSchemaPropertyOutput) Permissions() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserSchemaProperty) pulumi.StringPtrOutput { return v.Permissions }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fdb428be26485c53f739edc0c45f0127", "score": "0.52727187", "text": "func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePermissionOptions) error {\n\tbody, length, err := generateQueueACLpayload(permissions.AccessPolicies)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tparams := url.Values{\n\t\t\"comp\": {\"acl\"},\n\t}\n\theaders := q.qsc.client.getStandardHeaders()\n\theaders[\"Content-Length\"] = strconv.Itoa(length)\n\n\tif options != nil {\n\t\tparams = addTimeout(params, options.Timeout)\n\t\theaders = mergeHeaders(headers, headersFromStruct(*options))\n\t}\n\turi := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)\n\tresp, err := q.qsc.client.exec(http.MethodPut, uri, headers, body, q.qsc.auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer drainRespBody(resp)\n\treturn checkRespCode(resp, []int{http.StatusNoContent})\n}", "title": "" }, { "docid": "6eccfea333c549bb643f86de3b3c031c", "score": "0.527091", "text": "func (ss *sqlStore) UpdatePermissions(ctx context.Context, userID int64, isAdmin bool) error {\n\treturn ss.db.WithTransactionalDbSession(ctx, func(sess *db.Session) error {\n\t\tvar user user.User\n\t\tif _, err := sess.ID(userID).Where(ss.notServiceAccountFilter()).Get(&user); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tuser.IsAdmin = isAdmin\n\t\tsess.UseBool(\"is_admin\")\n\t\t_, err := sess.ID(user.ID).Update(&user)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// validate that after update there is at least one server admin\n\t\tif err := validateOneAdminLeft(ctx, sess); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "da6f253db116effa5a92e6f54227b6c0", "score": "0.5249844", "text": "func (dMgr *DirMgr) SetPermissions(permissionConfig FilePermissionConfig) (err error) {\n\n ePrefix := \"DirMgr.SetPermissions() \"\n err = nil\n dMgrHlpr := dirMgrHelper{}\n\n dMgr.dataMutex.Lock()\n\n err = dMgrHlpr.setPermissions(\n dMgr,\n permissionConfig,\n ePrefix,\n \"dMgr\",\n \"permissionConfig\")\n\n dMgr.dataMutex.Unlock()\n\n return err\n}", "title": "" }, { "docid": "8ad8730502b29677876d9f4136e13309", "score": "0.5248348", "text": "func (m *IdentityContainer) SetUserFlowAttributes(value []IdentityUserFlowAttributeable)() {\n m.userFlowAttributes = value\n}", "title": "" }, { "docid": "fde3cb1ff499d201bf795b47aef6ee98", "score": "0.521129", "text": "func CheckPermissions(user *User, perms ...string) []error {\n\tif user == nil {\n\t\treturn []error{errNilUser}\n\t}\n\treturn user.CheckPermissions(perms...)\n}", "title": "" }, { "docid": "8805fbe00b199ba39d12370f834a8360", "score": "0.52002376", "text": "func (c *Client) SetUserGroupConnectionPermissions(group string, permissionItems *[]types.GuacPermissionItem) error {\n\n\trequest, err := c.CreateJSONRequest(http.MethodPatch, fmt.Sprintf(\"%s/%s/%s/permissions\", c.baseURL, userGroupsBasePath, group), permissionItems)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Call(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e6b0810bf8c21e0709d68c58c62b82b", "score": "0.5178546", "text": "func (in *ActionUserOutageIndexInput) SetUser(value int64) *ActionUserOutageIndexInput {\n\tin.User = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetUserNil(false)\n\tin._selectedParameters[\"User\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "09ff8d4b853cf4676a20e33b2b0c28f6", "score": "0.5173248", "text": "func (in *ActionExportIndexInput) SetUser(value int64) *ActionExportIndexInput {\n\tin.User = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetUserNil(false)\n\tin._selectedParameters[\"User\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "f0c3558ca080d22dd610b12548c54899", "score": "0.51588356", "text": "func (o *DriveItem) SetPermissions(v []MicrosoftGraphPermission) {\n\to.Permissions = &v\n}", "title": "" }, { "docid": "4d33bf6c1c864c70dcc3a77132ba4a5c", "score": "0.51581293", "text": "func (c *DefaultCommandRunner) checkUserPermissions(repo models.Repo, user models.User, cmd *CommentCommand) (bool, error) {\n\tif c.TeamAllowlistChecker == nil || !c.TeamAllowlistChecker.HasRules() {\n\t\t// allowlist restriction is not enabled\n\t\treturn true, nil\n\t}\n\tteams, err := c.VCSClient.GetTeamNamesForUser(repo, user)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tok := c.TeamAllowlistChecker.IsCommandAllowedForAnyTeam(teams, cmd.Name.String())\n\tif !ok {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "f494f2e7bbb24b68851b6fa4e66f01ea", "score": "0.5158119", "text": "func (c *Client) UpdatePermissionsIn(vhost, username string, permissions Permissions) (res *http.Response, err error) {\n\tbody, err := json.Marshal(permissions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := newRequestWithBody(c, \"PUT\", \"permissions/\"+url.PathEscape(vhost)+\"/\"+url.PathEscape(username), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res, err = executeRequest(c, req); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "adac91d217c5ec5a8d6f25b7da28bd71", "score": "0.5149569", "text": "func UpdatePermissions(ctx context.Context, logger log.Logger, db database.DB) {\n\tscopedLog := logger.Scoped(\"permission_update\", \"Updates the permission in the database based on the rbac schema configuration.\")\n\terr := db.WithTransact(ctx, func(tx database.DB) error {\n\t\tpermissionStore := tx.Permissions()\n\t\trolePermissionStore := tx.RolePermissions()\n\n\t\tdbPerms, err := permissionStore.FetchAll(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"fetching permissions from database\")\n\t\t}\n\n\t\ttoBeAdded, toBeDeleted := rbac.ComparePermissions(dbPerms, rbac.RBACSchema)\n\t\tscopedLog.Info(\"RBAC Permissions update\", log.Int(\"added\", len(toBeAdded)), log.Int(\"deleted\", len(toBeDeleted)))\n\n\t\tif len(toBeDeleted) > 0 {\n\t\t\t// We delete all the permissions that need to be deleted from the database. The role <> permissions are\n\t\t\t// automatically deleted: https://app.golinks.io/role_permissions-permission_id_cascade.\n\t\t\terr = permissionStore.BulkDelete(ctx, toBeDeleted)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"deleting redundant permissions\")\n\t\t\t}\n\t\t}\n\n\t\tif len(toBeAdded) > 0 {\n\t\t\t// Adding new permissions to the database. This permissions will be assigned to the System roles\n\t\t\t// (USER and SITE_ADMINISTRATOR).\n\t\t\tpermissions, err := permissionStore.BulkCreate(ctx, toBeAdded)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"creating new permissions\")\n\t\t\t}\n\n\t\t\tfor _, permission := range permissions {\n\t\t\t\t// Assign the permission to both SITE_ADMINISTRATOR and USER roles. We do this so that we don't break the\n\t\t\t\t// current experience and always assume that everyone has access until a site administrator revokes that\n\t\t\t\t// access.\n\t\t\t\t// Context: https://sourcegraph.slack.com/archives/C044BUJET7C/p1675292124253779?thread_ts=1675280399.192819&cid=C044BUJET7C\n\t\t\t\tif err := rolePermissionStore.BulkAssignPermissionsToSystemRoles(ctx, database.BulkAssignPermissionsToSystemRolesOpts{\n\t\t\t\t\tRoles: []types.SystemRole{types.SiteAdministratorSystemRole, types.UserSystemRole},\n\t\t\t\t\tPermissionID: permission.ID,\n\t\t\t\t}); err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"assigning permission to system roles\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tscopedLog.Error(\"failed to update RBAC permissions\", log.Error(err))\n\t}\n}", "title": "" }, { "docid": "9f790e187de5a7211fcaeac211047fed", "score": "0.5127828", "text": "func (UserService) GetAllPermissions(uid string) []string {\n\tperms := []string{}\n\tfor _, p := range perm.GetAllPermsByUser(uid) {\n\t\tperms = append(perms, p[1])\n\t}\n\treturn perms\n}", "title": "" }, { "docid": "e36fd4cad7ca0a0d9426f9d76fe99b82", "score": "0.51123255", "text": "func (m *User) SetActivities(value []UserActivityable)() {\n err := m.GetBackingStore().Set(\"activities\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "59412b87f6c97dd1e37e97bcc054e8b7", "score": "0.51108885", "text": "func (m *WebCheck) UserPermission() string {\n\treturn m.userPermissionField\n}", "title": "" }, { "docid": "84b2ca82cdb86b6b7dcda2570dbb0b3a", "score": "0.5106846", "text": "func UserModPerm(c *gin.Context) {\n\tform := &model.UserModParams{}\n\n\tif err := c.BindJSON(&form); err != nil {\n\t\tlogrus.Warnf(\"Failed to bind user mod data. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusPreconditionFailed,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusPreconditionFailed,\n\t\t\t\t\"message\": \"Failed to bind form data\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tassigned := store.GetUserHasMod(\n\t\tc,\n\t\tform,\n\t)\n\n\tif !assigned {\n\t\tc.JSON(\n\t\t\thttp.StatusPreconditionFailed,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusPreconditionFailed,\n\t\t\t\t\"message\": \"Mod is not assigned\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\terr := store.UpdateUserMod(\n\t\tc,\n\t\tform,\n\t)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to update permissions. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusInternalServerError,\n\t\t\t\t\"message\": \"Failed to update permissions\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(\n\t\thttp.StatusOK,\n\t\tgin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"message\": \"Successfully updated permissions\",\n\t\t},\n\t)\n}", "title": "" }, { "docid": "82c36499c41ccee2e9bbaa14a36e49e7", "score": "0.5101844", "text": "func (in *ActionMonitoredEventIndexInput) SetUser(value int64) *ActionMonitoredEventIndexInput {\n\tin.User = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetUserNil(false)\n\tin._selectedParameters[\"User\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "4bbd5a3f90867f696f805f31edb5519c", "score": "0.5090258", "text": "func (m *CloudAppSecurityProfile) SetPermissionsRequired(value *ApplicationPermissionsRequired)() {\n err := m.GetBackingStore().Set(\"permissionsRequired\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d8129675005bc12bafeaaac515dad5e0", "score": "0.50737524", "text": "func (h *Handle3) TestPermissions(ctx context.Context, permissions []string) (allowed []string, err error) {\n\tinternal.StartExitSpan(ctx, \"gcs\", ot.Tags{\n\t\ttags.GcsOp: iamOpPrefix(h.Resource) + \".testIamPermissions\",\n\t\tiamResourceTag(h.Resource): h.Resource.Name,\n\t})\n\tdefer func() { internal.FinishSpan(ctx, err) }()\n\n\treturn h.Handle3.TestPermissions(ctx, permissions)\n}", "title": "" }, { "docid": "c382121663f81b7b42dfc203070d1d2e", "score": "0.50616866", "text": "func (q *QuotaHandler) SetUserStorageQuota(quota int64) {\n\tq.database.Write(\"quota\", q.username+\"/quota\", quota)\n\tq.TotalStorageQuota = quota\n}", "title": "" }, { "docid": "c4b35dfc9f58ebed41025ec5ea2313eb", "score": "0.50213474", "text": "func GetAllUserPermissions(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tvar permisos []models.Permiso\n\tuserPermission := models.UsuarioPermiso{}\n\tuserPermission.UsuarioID, _ = strconv.ParseUint(mux.Vars(r)[\"UsuarioID\"], 10, 64)\n\n\trows, err := db.Raw(\"SELECT * FROM (SELECT permiso_id FROM usuario_permiso WHERE usuario_permiso_estado = ? AND usuario_id = 10109182) AS foo NATURAL JOIN permiso\",\n\t\ttrue, userPermission.UsuarioID).Rows()\n\n\tif err != nil {\n\t\trespondError(w, http.StatusInternalServerError, \"Data base error\")\n\t\treturn\n\t}\n\n\tdefer rows.Close()\n\tentered := rows.Next()\n\n\tif !entered {\n\t\trespondJSON(w, http.StatusNoContent, permisos)\n\t\treturn\n\t}\n\n\tfor entered {\n\t\tif db.ScanRows(rows, &permisos) != nil {\n\t\t\trespondError(w, http.StatusInternalServerError, \"Data base error\")\n\t\t\treturn\n\t\t}\n\t\tentered = rows.Next()\n\t}\n\n\trespondJSON(w, http.StatusOK, permisos)\n}", "title": "" }, { "docid": "3fa54e5610a1e759f3e9b626b1ad0155", "score": "0.5008721", "text": "func (m *Windows10GeneralConfiguration) SetPrivacyBlockPublishUserActivities(value *bool)() {\n err := m.GetBackingStore().Set(\"privacyBlockPublishUserActivities\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "919e782d5e2d99e44fcd3324995175ef", "score": "0.5000791", "text": "func (s *IAMStorage) UserPermissionsGet(\n\tsearch string,\n) (*pb.UserPermissions, error) {\n\tdefer s.log.WithSection(\"iam/storage\")()\n\n\t// First verify the supplied user exists\n\tuserRec, err := s.userRecord(search)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuserId := userRec.id\n\tuser := userRec.pb\n\n\t// Grab the system permissions (permissions for any unscoped role that the\n\t// user has)\n\tqs := `\nSELECT\n rp.permission\nFROM roles AS r\nJOIN user_roles AS ur\n ON r.id = ur.role_id\nJOIN role_permissions AS rp\n ON r.id = rp.role_id\nWHERE r.root_organization_id IS NULL\nAND ur.user_id = ?\nGROUP BY rp.permission\n`\n\tsysPerms := make([]pb.Permission, 0)\n\trows, err := s.Rows(qs, userId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tvar perm int64\n\t\terr = rows.Scan(&perm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsysPerms = append(sysPerms, pb.Permission(perm))\n\t}\n\n\t// Now load the \"scoped\" permissions, which are the permissions that\n\t// correspond to roles that are scoped to a particular organization that\n\t// the user has\n\tqs = `\nSELECT\n o.uuid, rp.permission\nFROM roles AS r\nJOIN user_roles AS ur\n ON r.id = ur.role_id\nJOIN role_permissions AS rp\n ON r.id = rp.role_id\nJOIN organizations AS o\n ON r.root_organization_id = o.id\nAND ur.user_id = ?\nGROUP BY o.uuid, rp.permission\nORDER BY o.uuid, rp.permission\n`\n\tscopedPerms := make(map[string]*pb.PermissionSet, 0)\n\trows, err = s.Rows(qs, userId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tvar perm int64\n\t\tvar orgUuid string\n\t\terr = rows.Scan(&orgUuid, &perm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentry, ok := scopedPerms[orgUuid]\n\t\tif !ok {\n\t\t\tentry = &pb.PermissionSet{\n\t\t\t\tPermissions: make([]pb.Permission, 0),\n\t\t\t}\n\t\t\tscopedPerms[orgUuid] = entry\n\t\t}\n\t\tentry.Permissions = append(entry.Permissions, pb.Permission(perm))\n\t}\n\tperms := &pb.UserPermissions{\n\t\tUser: user,\n\t\tSystem: &pb.PermissionSet{\n\t\t\tPermissions: sysPerms,\n\t\t},\n\t\tScoped: scopedPerms,\n\t}\n\treturn perms, nil\n}", "title": "" }, { "docid": "edb5bd91141cb63fd126b0a8fa6dcdd9", "score": "0.499639", "text": "func (m *website) UserPermission() string {\n\treturn m.userPermissionField\n}", "title": "" }, { "docid": "cfad337b5e0ca85c4977632fb63bf095", "score": "0.49746174", "text": "func (h *Handle) TestPermissions(ctx context.Context, permissions []string) (allowed []string, err error) {\n\tinternal.StartExitSpan(ctx, \"gcs\", ot.Tags{\n\t\ttags.GcsOp: iamOpPrefix(h.Resource) + \".testIamPermissions\",\n\t\tiamResourceTag(h.Resource): h.Resource.Name,\n\t})\n\tdefer func() { internal.FinishSpan(ctx, err) }()\n\n\treturn h.Handle.TestPermissions(ctx, permissions)\n}", "title": "" }, { "docid": "907b03a1cc4471813642f15576bff6a9", "score": "0.4965399", "text": "func (s *Server) UserRolesSet(\n\tctx context.Context,\n\treq *pb.UserRolesSetRequest,\n) (*pb.UserRolesSetResponse, error) {\n\tdefer s.log.WithSection(\"iam/server\")()\n\n\tif !s.authz.Check(req.Session, pb.Permission_MODIFY_USER) {\n\t\treturn nil, errors.FORBIDDEN\n\t}\n\n\tadded, removed, err := s.storage.UserRolesSet(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp := &pb.UserRolesSetResponse{\n\t\tNumAdded: added,\n\t\tNumRemoved: removed,\n\t}\n\ts.log.L1(\n\t\t\"Updated roles for user %s (added %d, removed %d)\",\n\t\treq.User,\n\t\tadded,\n\t\tremoved,\n\t)\n\treturn resp, nil\n}", "title": "" }, { "docid": "8d93c9d196eb43d8687e2f9beaf64c62", "score": "0.4962409", "text": "func AddAuthUserUserPermissionHook(hookPoint boil.HookPoint, authUserUserPermissionHook AuthUserUserPermissionHook) {\n\tswitch hookPoint {\n\tcase boil.BeforeInsertHook:\n\t\tauthUserUserPermissionBeforeInsertHooks = append(authUserUserPermissionBeforeInsertHooks, authUserUserPermissionHook)\n\tcase boil.BeforeUpdateHook:\n\t\tauthUserUserPermissionBeforeUpdateHooks = append(authUserUserPermissionBeforeUpdateHooks, authUserUserPermissionHook)\n\tcase boil.BeforeDeleteHook:\n\t\tauthUserUserPermissionBeforeDeleteHooks = append(authUserUserPermissionBeforeDeleteHooks, authUserUserPermissionHook)\n\tcase boil.BeforeUpsertHook:\n\t\tauthUserUserPermissionBeforeUpsertHooks = append(authUserUserPermissionBeforeUpsertHooks, authUserUserPermissionHook)\n\tcase boil.AfterInsertHook:\n\t\tauthUserUserPermissionAfterInsertHooks = append(authUserUserPermissionAfterInsertHooks, authUserUserPermissionHook)\n\tcase boil.AfterSelectHook:\n\t\tauthUserUserPermissionAfterSelectHooks = append(authUserUserPermissionAfterSelectHooks, authUserUserPermissionHook)\n\tcase boil.AfterUpdateHook:\n\t\tauthUserUserPermissionAfterUpdateHooks = append(authUserUserPermissionAfterUpdateHooks, authUserUserPermissionHook)\n\tcase boil.AfterDeleteHook:\n\t\tauthUserUserPermissionAfterDeleteHooks = append(authUserUserPermissionAfterDeleteHooks, authUserUserPermissionHook)\n\tcase boil.AfterUpsertHook:\n\t\tauthUserUserPermissionAfterUpsertHooks = append(authUserUserPermissionAfterUpsertHooks, authUserUserPermissionHook)\n\t}\n}", "title": "" }, { "docid": "e60126712cd864620ebb360dfb5d9afe", "score": "0.49431217", "text": "func (o *AdminAddUserPermissionsV3Params) WithUserID(userID string) *AdminAddUserPermissionsV3Params {\n\to.SetUserID(userID)\n\treturn o\n}", "title": "" }, { "docid": "5b6770eefbca7c40593de0e285207d06", "score": "0.49336597", "text": "func (st *Status) SetUser(user string) {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.user = user\n}", "title": "" }, { "docid": "1fb9aa723e79505b26c90ddc33a9b0b7", "score": "0.492301", "text": "func (m *UserMutation) ResetPermissions() {\n\tm.permissions = nil\n\tm.clearedpermissions = false\n\tm.removedpermissions = nil\n}", "title": "" }, { "docid": "078f22170f445ea476731a6bdc0c34ae", "score": "0.48827899", "text": "func (o *UpdateLocalUserParams) SetUser(user *models.LocalUser) {\n\to.User = user\n}", "title": "" }, { "docid": "7bb96f45d7e3c9a9aae8c8df79e7eda0", "score": "0.48809046", "text": "func (d *Deployment) SetUser(v string) {\n\t// return if Deployment type is nil\n\tif d == nil {\n\t\treturn\n\t}\n\n\td.User = &v\n}", "title": "" }, { "docid": "8a1c6bc24d11e89613f1a60d3e0059fc", "score": "0.486774", "text": "func (in *ActionIpAddressUpdateInput) SetUser(value int64) *ActionIpAddressUpdateInput {\n\tin.User = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetUserNil(false)\n\tin._selectedParameters[\"User\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "41af493a46941d38114e482a014f40af", "score": "0.48652837", "text": "func (m *modelImpl) SetUser(user repository.User) {\n\tm.user = user\n}", "title": "" }, { "docid": "4fea61b4b345d9283eac8ce05d05213f", "score": "0.48646826", "text": "func UnmarshalPermissions(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Permissions)\n\terr = core.UnmarshalModel(m, \"recommended\", &obj.Recommended, UnmarshalPermissionsAnalysis)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"required\", &obj.Required, UnmarshalPermissionsAnalysis)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "9da9ae65e773dbee71527a9198e72201", "score": "0.48592424", "text": "func (o *PatchedUpdateWorkspaceUser) HasPermissions() bool {\n\tif o != nil && !IsNil(o.Permissions) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b66a0c8684a8aa0124616d487d74427", "score": "0.48500893", "text": "func (o *Object) SetUserMetadata(v map[string]string) *Object {\n\to.userMetadata = v\n\to.bit |= objectIndexUserMetadata\n\treturn o\n}", "title": "" }, { "docid": "ddd7b8969144d3a899ae7e3cde1aa367", "score": "0.4843623", "text": "func (o *PatchedUpdateWorkspaceUser) GetPermissions() string {\n\tif o == nil || IsNil(o.Permissions) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Permissions\n}", "title": "" }, { "docid": "150c49705705b8d91dcd0acc9eed3618", "score": "0.48317903", "text": "func (uc *UserCreate) SetUserPatientrights(p *Patientrights) *UserCreate {\n\treturn uc.SetUserPatientrightsID(p.ID)\n}", "title": "" }, { "docid": "88c03a60b017099e625a0633d0318006", "score": "0.48265567", "text": "func (m *UserRegistrationMethodSummary) SetUserRoles(value *IncludedUserRoles)() {\n err := m.GetBackingStore().Set(\"userRoles\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3da50cd5d7de4ed59fa5a035bc0ca8bf", "score": "0.48209167", "text": "func (mu *MetadataUpdate) SetUser(u *User) *MetadataUpdate {\n\treturn mu.SetUserID(u.ID)\n}", "title": "" }, { "docid": "ccebaf2ebc3849e3dd9c99260903e303", "score": "0.47949088", "text": "func (a *OrmPermissionAdapter) updateUserPermission(line *Line) (int64, error) {\n\tmLine := &Line{}\n\thas, err := a.engine.Where(\"username=?\", mLine.Username).Get(mLine)\n\n\tif err != nil {\n\t\tfmt.Println(\"Exception, ORM could not find the record properly\")\n\t\treturn -1, err\n\t} else if has != true {\n\t\tfmt.Println(\"ORM could not find the record properly\")\n\t\treturn -1, err\n\t} else {\n\t\treturn a.engine.Update(line)\n\t}\n}", "title": "" }, { "docid": "c554650482d1e43c9edf6dff2c2646dd", "score": "0.47861445", "text": "func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) {\n\treturn s.setCustomAttribute(\"users\", user, c, options...)\n}", "title": "" }, { "docid": "163ff8d0c52354bf557c8b311f47b596", "score": "0.47755316", "text": "func (u *User) WithPermissions() *User {\n\tvar (\n\t\tpermissions = make([]map[string]interface{}, 0)\n\t\tuserPermissions = make([]map[string]interface{}, 0)\n\t)\n\t//roleIds := u.GetAllRoleId()\n\troleIds := \"1,2\"\n\tqb, _ := orm.NewQueryBuilder(\"mysql\")\n\tqb1, _ := orm.NewQueryBuilder(\"mysql\")\n\t// 构建查询对象 导出 SQL 语句\n\tsql := qb.Select(\"p.id\", \"p.name\", \"p.slug\", \"p.http_path\", \"p.http_method\", \"p.created_at\", \"p.updated_at\").\n\t\tFrom(RolePermissionTBName() + \" as rp\").\n\t\tLeftJoin(PermissionTBName() + \" as p\").On(\"rp.permission_id = p.id\").\n\t\tWhere(\"rp.role_id in (\" + roleIds + \")\").\n\t\tOrderBy(\"p.id\").Desc().String()\n\n\tpermissionSql := qb1.Select(\"p.id\", \"p.name\", \"p.slug\", \"p.http_path\", \"p.http_method\", \"p.created_at\", \"p.updated_at\").\n\t\tFrom(RolePermissionTBName() + \" as rp\").\n\t\tLeftJoin(PermissionTBName() + \" as p\").On(\"rp.permission_id = p.id\").\n\t\tWhere(\"rp.role_id in (\" + roleIds + \")\").\n\t\tOrderBy(\"p.id\").Desc().String()\n\t// 执行 SQL 语句\n\to := orm.NewOrm()\n\to.Raw(sql).QueryRows(&permissions)\n\t// 执行 SQL 语句\n\tpermissionOrm := orm.NewOrm()\n\tpermissionOrm.Raw(permissionSql).QueryRows(&userPermissions)\n\n\tpermissions = append(permissions, userPermissions...)\n\tfor i := 0; i < len(permissions); i++ {\n\t\texist := false\n\t\tfor j := 0; j < len(u.Permissions); j++ {\n\t\t\tif u.Permissions[j].Id == permissions[i][\"id\"] {\n\t\t\t\texist = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif exist {\n\t\t\tcontinue\n\t\t}\n\t\tu.Permissions = append(u.Permissions, new(Permission).MapToModel(permissions[i]))\n\t}\n\n\treturn u\n}", "title": "" }, { "docid": "08934b13fc5a989c08323522e8370ccb", "score": "0.47744828", "text": "func (sn *SecurityNamespace) SetPrincipalPermissions(permissionList *[]SetPrincipalPermission) error {\n\tif nil == permissionList || len(*permissionList) <= 0 {\n\t\treturn nil\n\t}\n\n\tpermissionMap := map[string]SetPrincipalPermission{}\n\tlinq.From(*permissionList).\n\t\tToMapBy(&permissionMap,\n\t\t\tfunc(item interface{}) interface{} {\n\t\t\t\treturn item.(SetPrincipalPermission).PrincipalPermission.SubjectDescriptor\n\t\t\t},\n\t\t\tfunc(item interface{}) interface{} { return item })\n\n\tsubjectList := make([]string, len(permissionMap))\n\tlinq.From(*permissionList).\n\t\tSelect(func(item interface{}) interface{} {\n\t\t\treturn item.(SetPrincipalPermission).PrincipalPermission.SubjectDescriptor\n\t\t}).\n\t\tToSlice(&subjectList)\n\n\tidList, err := sn.getIdentitiesFromSubjects(&subjectList)\n\tif err != nil {\n\t\treturn err\n\t}\n\tidMap := map[string]identity.Identity{}\n\tlinq.From(*idList).\n\t\tToMapBy(&idMap,\n\t\t\tfunc(item interface{}) interface{} { return *item.(identity.Identity).SubjectDescriptor },\n\t\t\tfunc(item interface{}) interface{} { return item })\n\n\tvar descriptorList []string\n\tlinq.From(*idList).\n\t\tSelect(func(elem interface{}) interface{} {\n\t\t\treturn *elem.(identity.Identity).Descriptor\n\t\t}).\n\t\tToSlice(&descriptorList)\n\n\tacl, err := sn.GetAccessControlList(&descriptorList)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar aceMap map[string]security.AccessControlEntry\n\tif acl == nil || acl.AcesDictionary == nil {\n\t\t// create a dummy ACE map, so that we always create new ACE entries below\n\t\taceMap = map[string]security.AccessControlEntry{}\n\t} else {\n\t\taceMap = *acl.AcesDictionary\n\t}\n\n\tactionMap, err := sn.GetActionDefinitions()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor subjectDescriptor, principalPermissions := range permissionMap {\n\t\tdesc, ok := idMap[subjectDescriptor]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Unable to resolve id descriptor for principal [%s]\", subjectDescriptor)\n\t\t}\n\n\t\tlog.Printf(\"[TRACE] Checking ACE list for descriptor [%s]\", subjectDescriptor)\n\t\tvar aceItem *security.AccessControlEntry\n\t\tace, update := aceMap[*desc.Descriptor]\n\t\tif !update {\n\t\t\tlog.Printf(\"[TRACE] Creating new ACE for subject [%s]\", subjectDescriptor)\n\t\t\taceItem = new(security.AccessControlEntry)\n\t\t\taceItem.Allow = new(int)\n\t\t\taceItem.Deny = new(int)\n\t\t\taceItem.Descriptor = desc.Descriptor\n\t\t} else {\n\t\t\t// update existing ACE for principal\n\t\t\tlog.Printf(\"[TRACE] Updating ACE for descriptor [%s]\", *desc.Descriptor)\n\t\t\taceItem = &ace\n\t\t}\n\n\t\tfor key, value := range principalPermissions.PrincipalPermission.Permissions {\n\t\t\tactionDef, ok := (*actionMap)[string(key)]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"Invalid permission [%s]\", key)\n\t\t\t}\n\t\t\tif aceItem.Deny == nil {\n\t\t\t\taceItem.Deny = new(int)\n\t\t\t}\n\t\t\tif aceItem.Allow == nil {\n\t\t\t\taceItem.Allow = new(int)\n\t\t\t}\n\n\t\t\tif strings.EqualFold(\"deny\", string(value)) {\n\t\t\t\t*aceItem.Allow = (*aceItem.Allow) &^ (*actionDef.Bit)\n\t\t\t\t*aceItem.Deny = (*aceItem.Deny) | (*actionDef.Bit)\n\t\t\t} else if strings.EqualFold(\"allow\", string(value)) {\n\t\t\t\t*aceItem.Deny = (*aceItem.Deny) &^ (*actionDef.Bit)\n\t\t\t\t*aceItem.Allow = (*aceItem.Allow) | (*actionDef.Bit)\n\t\t\t} else if strings.EqualFold(\"notset\", string(value)) {\n\t\t\t\t*aceItem.Allow = (*aceItem.Allow) &^ (*actionDef.Bit)\n\t\t\t\t*aceItem.Deny = (*aceItem.Deny) &^ (*actionDef.Bit)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Invalid permission action [%s]\", value)\n\t\t\t}\n\t\t}\n\n\t\tbMerge := !principalPermissions.Replace\n\t\tcontainer := struct {\n\t\t\tToken *string `json:\"token,omitempty\"`\n\t\t\tMerge *bool `json:\"merge,omitempty\"`\n\t\t\tAccessControlEntries *[]security.AccessControlEntry `json:\"accessControlEntries,omitempty\"`\n\t\t}{\n\t\t\tToken: &sn.token,\n\t\t\tMerge: &bMerge,\n\t\t\tAccessControlEntries: &[]security.AccessControlEntry{*aceItem},\n\t\t}\n\n\t\t_, err = sn.securityClient.SetAccessControlEntries(sn.context, security.SetAccessControlEntriesArgs{\n\t\t\tSecurityNamespaceId: &sn.namespaceID,\n\t\t\tContainer: container,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7efdbd84b09291f30cc49c9746a7ea94", "score": "0.47738278", "text": "func (m *UserMutation) ClearPermissions() {\n\tm.clearedpermissions = true\n}", "title": "" }, { "docid": "5ac1bacdefadfad1013776eb2efb5212", "score": "0.47710976", "text": "func UpdatePermissions(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tpermiso := models.Permiso{}\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&permiso); err != nil {\n\t\trespondError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tif queryRes := db.Updates(&permiso); queryRes.Error != nil || queryRes.RowsAffected == 0 {\n\t\tfmt.Println(\"queryRes.Error.Error()\")\n\t\trespondError(w, http.StatusBadRequest, \"Error in operation or Not found\")\n\t\treturn\n\t}\n\t// return all the profiles\n\tvar permisos []models.Permiso\n\tif err := db.Find(&permisos).Error; err != nil {\n\t\tfmt.Println(err.Error())\n\t\trespondError(w, http.StatusBadRequest, \"Error in operation or Not found\")\n\t\treturn\n\t}\n\trespondJSON(w, http.StatusOK, permisos)\n}", "title": "" }, { "docid": "ae1fe5ae34f3de2d60b0e571e02272eb", "score": "0.4765671", "text": "func (c *Column) changeUserValues(_userDirection string, _userActualFloor int, _userDestination int) {\n\tc.userDirection = _userDirection\n\tc.userActualFloor = _userActualFloor\n\tc.userDestination = _userDestination\n}", "title": "" }, { "docid": "24be8196bff0c1f0922aa56c3b9bb468", "score": "0.47622293", "text": "func (m *UserRegistrationMethodSummary) SetUserTypes(value *IncludedUserTypes)() {\n err := m.GetBackingStore().Set(\"userTypes\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "adde7725e979d559396e1bf6bde155e3", "score": "0.4753927", "text": "func (o *ChangeCurrentUserPasswordParams) SetUser(user ChangeCurrentUserPasswordBody) {\n\to.User = user\n}", "title": "" }, { "docid": "6ea36875959682b2187569c7f3020470", "score": "0.47508126", "text": "func (m *AuditActor) GetUserPermissions()([]string) {\n val, err := m.GetBackingStore().Get(\"userPermissions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "1b80d025409d25976181d688253a4e4a", "score": "0.47474375", "text": "func (o *InlineResponse20077TodoItems) SetUserFollowingChanges(v bool) {\n\to.UserFollowingChanges = &v\n}", "title": "" }, { "docid": "efeddb26db16b2e163462054e4a4c30f", "score": "0.4726307", "text": "func (m *ManagedDeviceMobileAppConfiguration) SetUserStatuses(value []ManagedDeviceMobileAppConfigurationUserStatusable)() {\n m.userStatuses = value\n}", "title": "" }, { "docid": "468b0a30296ed98b47de8ddbdb04623a", "score": "0.4723595", "text": "func FixPermissions(fs boshsys.FileSystem, path string, user string, group string) error {\n\tug := fmt.Sprintf(\"%s:%s\", user, group)\n\tbinPath := gopath.Join(path, \"bin\") + \"/\"\n\n\terr := fs.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := fs.Chown(path, ug); err != nil {\n\t\t\treturn bosherr.WrapError(err, \"Failed to chown dir\")\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn fs.Chmod(path, os.FileMode(0750))\n\t\t}\n\n\t\t// If the file is in /var/vcap/jobs/JOB/bin.\n\t\tif strings.HasPrefix(path, binPath) {\n\t\t\treturn fs.Chmod(path, os.FileMode(0750))\n\t\t}\n\n\t\treturn fs.Chmod(path, os.FileMode(0640))\n\t})\n\n\tif err != nil {\n\t\treturn bosherr.WrapError(err, \"Correcting file permissions\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f2da200426862a044ad6bf867a87054f", "score": "0.47215337", "text": "func HasPermissions(user *User, perms ...string) bool {\n\tif user == nil {\n\t\treturn false\n\t}\n\treturn user.HasPermissions(perms...)\n}", "title": "" }, { "docid": "641d78273d24c4ebb384c7fd62be5da0", "score": "0.471506", "text": "func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {\n\treturn c.internalClient.TestIamPermissions(ctx, req, opts...)\n}", "title": "" }, { "docid": "76da7a2a1159ae464258e71888bebc51", "score": "0.4705633", "text": "func (r *TagValuesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *TagValuesTestIamPermissionsCall {\n\tc := &TagValuesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.resource = resource\n\tc.testiampermissionsrequest = testiampermissionsrequest\n\treturn c\n}", "title": "" }, { "docid": "3e971c745a8121770b0744b2dc1c914c", "score": "0.47055802", "text": "func (m *CloudPcAuditActor) GetUserPermissions()([]string) {\n val, err := m.GetBackingStore().Get(\"userPermissions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" } ]
567222c15fadd7a913ac838fa165accb
SetLicenseEntitlement gets a reference to the given string and assigns it to the LicenseEntitlement field.
[ { "docid": "d3e55622f315851776e5aab0474701ea", "score": "0.7723068", "text": "func (o *WorkflowServiceItemDefinitionAllOf) SetLicenseEntitlement(v string) {\n\to.LicenseEntitlement = &v\n}", "title": "" } ]
[ { "docid": "f3960bbd445bd1b7e527492b5ecbf9f9", "score": "0.7785962", "text": "func (o *WorkflowWorkflowDefinitionAllOf) SetLicenseEntitlement(v string) {\n\to.LicenseEntitlement = &v\n}", "title": "" }, { "docid": "719c71f4f8ba66ecb80b63031716b8c4", "score": "0.74616367", "text": "func (n *resPool) SetEntitlement(res *scalar.Resources) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.entitlement = res\n\tlog.WithFields(log.Fields{\n\t\t\"respool_id\": n.id,\n\t\t\"entitlement\": res,\n\t}).Debug(\"Setting Entitlement\")\n}", "title": "" }, { "docid": "dffe0f1ef3519f9e524462e718eaa8f9", "score": "0.6276412", "text": "func (o *WorkflowWorkflowDefinitionAllOf) GetLicenseEntitlement() string {\n\tif o == nil || o.LicenseEntitlement == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LicenseEntitlement\n}", "title": "" }, { "docid": "31612a011c91c4608fc82328e5245fd7", "score": "0.61330503", "text": "func (n *resPool) SetSlackEntitlement(res *scalar.Resources) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.slackEntitlement = res\n\tlog.WithFields(log.Fields{\n\t\t\"respool_id\": n.id,\n\t\t\"slack_entitlement\": res,\n\t}).Debug(\"Setting Slack Entitlement\")\n}", "title": "" }, { "docid": "70c1e6cbec98999083ce659fb90a700a", "score": "0.6097441", "text": "func (o *WorkflowServiceItemDefinitionAllOf) GetLicenseEntitlement() string {\n\tif o == nil || o.LicenseEntitlement == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LicenseEntitlement\n}", "title": "" }, { "docid": "4daf929b3614dba2ad38b4ee2ed38d6b", "score": "0.60352725", "text": "func (m *SmsLogRow) SetLicenseCapability(value *string)() {\n err := m.GetBackingStore().Set(\"licenseCapability\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2cbaff3fd3d93f1c897cf5bc3d52273b", "score": "0.55743647", "text": "func (s *SampleStore) SetLicense(license map[string]string) error {\n\treturn nil\n}", "title": "" }, { "docid": "837a9041ed75efba02da9826ea4059f1", "score": "0.5518519", "text": "func NewEntitlement(ctx *pulumi.Context,\n\tname string, args *EntitlementArgs, opts ...pulumi.ResourceOption) (*Entitlement, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AccountId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AccountId'\")\n\t}\n\tif args.CustomerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'CustomerId'\")\n\t}\n\tif args.Offer == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Offer'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"accountId\",\n\t\t\"customerId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Entitlement\n\terr := ctx.RegisterResource(\"google-native:cloudchannel/v1:Entitlement\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "38e0a71021a227cfc95e1950681740db", "score": "0.54336447", "text": "func (n *resPool) SetNonSlackEntitlement(res *scalar.Resources) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.nonSlackEntitlement = res\n}", "title": "" }, { "docid": "042b6d858d35086bee65ae29289d9a91", "score": "0.54211575", "text": "func SetLicenseKey(licenseKey string) int {\n\tcLicenseKey := goToCString(licenseKey)\n\tstatus := C.SetLicenseKey(cLicenseKey)\n\tfreeCString(cLicenseKey)\n\treturn int(status)\n}", "title": "" }, { "docid": "ba83371e4d785836377db9e1a18a4a7a", "score": "0.5271164", "text": "func (o *ShowSystem) SetEntitlementStatus(v string) {\n\to.EntitlementStatus = &v\n}", "title": "" }, { "docid": "9db1e0b5117f3df74febebb808086d8f", "score": "0.52473503", "text": "func (c *C7000) SetLicense(*cfgresources.License) error {\n\treturn nil\n}", "title": "" }, { "docid": "4d87ac10302d71f3329c7ff57cfaaf0a", "score": "0.5201889", "text": "func (m *User) SetAssignedLicenses(value []AssignedLicenseable)() {\n m.assignedLicenses = value\n}", "title": "" }, { "docid": "ca9804ed734f3c153f3eefdcf37b5f79", "score": "0.5187138", "text": "func (o *WorkflowWorkflowDefinitionAllOf) HasLicenseEntitlement() bool {\n\tif o != nil && o.LicenseEntitlement != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "57aad4cb190a0ac6821c95357542cae6", "score": "0.50724894", "text": "func (m *Group) SetAssignedLicenses(value []AssignedLicenseable)() {\n m.assignedLicenses = value\n}", "title": "" }, { "docid": "8e873b02afe671df49769c0c36c86f10", "score": "0.50503516", "text": "func (k Keeper) SetInvite(ctx sdk.Context, recipient, sender sdk.AccAddress) error {\n\tstore := ctx.KVStore(k.storeKey)\n\n\t// Check if the user has already been invited\n\tinviteKey := k.getInviteStoreKey(recipient)\n\tif store.Has(inviteKey) {\n\t\treturn sdkErr.Wrap(sdkErr.ErrUnknownRequest, fmt.Sprintf(\"%s has already been invited\", recipient))\n\t}\n\n\t// Verify that the user that is inviting has already a membership\n\tinviterMembership, err := k.GetMembership(ctx, sender)\n\tif err != nil {\n\t\treturn sdkErr.Wrap(sdkErr.ErrUnauthorized, fmt.Sprintf(\"Cannot send an invitation without having a membership: %s\", err.Error()))\n\n\t}\n\n\t// Build and save the invite\n\taccreditation := types.NewInvite(sender, recipient, inviterMembership.MembershipType)\n\tstore.Set(inviteKey, k.cdc.MustMarshal(&accreditation))\n\n\t// Emits events\n\tctx.EventManager().EmitEvent(sdk.NewEvent(\n\t\teventInvite,\n\t\tsdk.NewAttribute(\"recipient\", recipient.String()),\n\t\tsdk.NewAttribute(\"sender\", sender.String()),\n\t\tsdk.NewAttribute(\"sender_membership_type\", inviterMembership.MembershipType),\n\t))\n\tlogger := k.Logger(ctx)\n\tlogger.Debug(\"User successfully invited\")\n\n\treturn nil\n}", "title": "" }, { "docid": "0d9adb9cddf370dba1bc0df6d3849d12", "score": "0.50394005", "text": "func SetLicenseUserCredential(email string, password string) int {\n\tcEmail := goToCString(email)\n\tcPassword := goToCString(password)\n\tstatus := C.SetLicenseUserCredential(cEmail, cPassword)\n\tfreeCString(cEmail)\n\tfreeCString(cPassword)\n\treturn int(status)\n}", "title": "" }, { "docid": "264b3fdd026e8ad5d3e95cde3380d048", "score": "0.49582833", "text": "func (o *QueryEntitlementsParams) SetEntitlementName(entitlementName *string) {\n\to.EntitlementName = entitlementName\n}", "title": "" }, { "docid": "79c5ffcb38c55da80a59cedcf6da3d5c", "score": "0.49568462", "text": "func (o *WorkflowServiceItemDefinitionAllOf) HasLicenseEntitlement() bool {\n\tif o != nil && o.LicenseEntitlement != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cfefd97be5dd44adb9c07734505d22fb", "score": "0.49511847", "text": "func (o *WorkflowWorkflowDefinitionAllOf) GetLicenseEntitlementOk() (*string, bool) {\n\tif o == nil || o.LicenseEntitlement == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LicenseEntitlement, true\n}", "title": "" }, { "docid": "8484f828e49034b796acea80188262f3", "score": "0.48949417", "text": "func (i *Ibmc) SetLicense(*cfgresources.License) error {\n\treturn nil\n}", "title": "" }, { "docid": "c94b39b8bde34d524de3083e69e1bc58", "score": "0.48776245", "text": "func LookupEntitlement(ctx *pulumi.Context, args *LookupEntitlementArgs, opts ...pulumi.InvokeOption) (*LookupEntitlementResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupEntitlementResult\n\terr := ctx.Invoke(\"google-native:cloudchannel/v1:getEntitlement\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "15a8e59953ea9e511d209699bd68d8f1", "score": "0.4863839", "text": "func (m *MicrosoftStoreForBusinessApp) SetLicenseType(value *MicrosoftStoreForBusinessLicenseType)() {\n err := m.GetBackingStore().Set(\"licenseType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4af64076fc1b696496a8ce083f430fc8", "score": "0.4849031", "text": "func (m *MicrosoftStoreForBusinessApp) SetLicensingType(value VppLicensingTypeable)() {\n err := m.GetBackingStore().Set(\"licensingType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9873417dcabba3a39060529c7d7eff1f", "score": "0.4816769", "text": "func (me *TSAFPTProductID) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "77d285194e139669d3054d2eea7343b8", "score": "0.4792387", "text": "func (c *Context) SetOrganization(o string) { c.orgName = o }", "title": "" }, { "docid": "d266e3b52374be0ced5c52114600f575", "score": "0.47658682", "text": "func BuildEntitlement(db *pop.Connection, customs []Customization, traits []Trait) models.Entitlement {\n\tcustoms = setupCustomizations(customs, traits)\n\n\t// Find Entitlement Customization and extract the custom Entitlement\n\tvar cEntitlement models.Entitlement\n\tif result := findValidCustomization(customs, Entitlement); result != nil {\n\t\tcEntitlement = result.Model.(models.Entitlement)\n\t\tif result.LinkOnly {\n\t\t\treturn cEntitlement\n\t\t}\n\t}\n\t// At this point, Entitlement may exist or be blank. Depending on if customization was provided.\n\n\t// Find an Orders customization if available - to extract the grade\n\tvar grade *string\n\tvar order models.Order\n\tresult := findValidCustomization(customs, Order)\n\tif result != nil {\n\t\torder = result.Model.(models.Order)\n\t\tgrade = order.Grade // extract grade\n\t}\n\tif grade == nil || *grade == \"\" {\n\t\tgrade = models.StringPointer(\"E_1\")\n\t}\n\n\tdependents := 0\n\tstorageInTransit := 90\n\trmeWeight := 1000\n\tocie := true\n\tproGearWeight := 2000\n\tproGearWeightSpouse := 500\n\n\t// Create default Entitlement\n\tentitlement := models.Entitlement{\n\t\tDependentsAuthorized: setBoolPtr(cEntitlement.DependentsAuthorized, true),\n\t\tTotalDependents: &dependents,\n\t\tNonTemporaryStorage: setBoolPtr(cEntitlement.NonTemporaryStorage, true),\n\t\tPrivatelyOwnedVehicle: setBoolPtr(cEntitlement.PrivatelyOwnedVehicle, true),\n\t\tStorageInTransit: &storageInTransit,\n\t\tProGearWeight: proGearWeight,\n\t\tProGearWeightSpouse: proGearWeightSpouse,\n\t\tRequiredMedicalEquipmentWeight: rmeWeight,\n\t\tOrganizationalClothingAndIndividualEquipment: ocie,\n\t}\n\t// Set default calculated values\n\tentitlement.SetWeightAllotment(*grade)\n\tentitlement.DBAuthorizedWeight = entitlement.AuthorizedWeight()\n\n\t// Overwrite default values with those from custom Entitlement\n\ttestdatagen.MergeModels(&entitlement, cEntitlement)\n\n\t// If db is false, it's a stub. No need to create in database.\n\tif db != nil {\n\t\tmustCreate(db, &entitlement)\n\t}\n\n\treturn entitlement\n}", "title": "" }, { "docid": "43b70eef3ebd8c41263238115bd36507", "score": "0.4744929", "text": "func (o *WorkflowServiceItemDefinitionAllOf) GetLicenseEntitlementOk() (*string, bool) {\n\tif o == nil || o.LicenseEntitlement == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LicenseEntitlement, true\n}", "title": "" }, { "docid": "07c8a787e8e9bfe5a8d67929c43714ea", "score": "0.4670677", "text": "func (m *User) SetLicenseDetails(value []LicenseDetailsable)() {\n m.licenseDetails = value\n}", "title": "" }, { "docid": "18770a8c624969a254eeaf659c12e187", "score": "0.46635312", "text": "func (o *V0037JobProperties) SetLicenses(v string) {\n\to.Licenses = &v\n}", "title": "" }, { "docid": "179d731bdc07663bd5bbf379e87bc545", "score": "0.46467787", "text": "func (o *Dig) SetLicenseID(v int32) {\n\to.LicenseID = v\n}", "title": "" }, { "docid": "cf2c6dd9420b0b681b01ff4a39b62950", "score": "0.4615317", "text": "func (l Licence) WithInvitationRevoked() Licence {\n\tl.HintGrantMismatch = false\n\tl.Status = LicStatusAvailable\n\tl.LatestInvitation = InvitationJSON{}\n\tl.AssigneeID = null.String{}\n\tl.UpdatedUTC = chrono.TimeUTCNow()\n\n\treturn l\n}", "title": "" }, { "docid": "d18a25ab461ce25d96992c1b1bf90fcc", "score": "0.4604857", "text": "func GetEntitlement(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EntitlementState, opts ...pulumi.ResourceOption) (*Entitlement, error) {\n\tvar resource Entitlement\n\terr := ctx.ReadResource(\"google-native:cloudchannel/v1:Entitlement\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "515925d504bbe36120bd5aa6b8af2641", "score": "0.4602816", "text": "func SetTLSIssuer(ctx context.Context, issuer string) context.Context {\n\treturn context.WithValue(ctx, PouchTLSIssuer, issuer)\n}", "title": "" }, { "docid": "ae733821ec3bc806120f6888ecd9038a", "score": "0.4591955", "text": "func (b EntitlementBuilder) Write() (EntitlementBuilder, error) {\n\t// Create new Object ID if this is a new entitlement\n\tif b.Entitlement.ID.IsZero() {\n\t\tb.Entitlement.ID = primitive.NewObjectID()\n\t}\n\n\tif _, err := mongo.Database.Collection(\"entitlements\").UpdateByID(b.ctx, b.Entitlement.ID, bson.M{\n\t\t\"$set\": b.Entitlement,\n\t}, &options.UpdateOptions{\n\t\tUpsert: utils.BoolPointer(true),\n\t}); err != nil {\n\t\tlog.WithError(err).Error(\"mongo\")\n\t\treturn b, err\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "31fe8a86c23ddd90d2fb49b5e412d733", "score": "0.45888254", "text": "func (m *AgreementAcceptance) SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.expirationDateTime = value\n}", "title": "" }, { "docid": "7233ed8a4bc0978408c276749c44b8e1", "score": "0.45736736", "text": "func (i Issuer) Set(c *x509.Certificate) {\n\tc.Issuer = pkix.Name{\n\t\tCountry: i.Country,\n\t\tOrganization: i.Organization,\n\t\tOrganizationalUnit: i.OrganizationalUnit,\n\t\tLocality: i.Locality,\n\t\tProvince: i.Province,\n\t\tStreetAddress: i.StreetAddress,\n\t\tPostalCode: i.PostalCode,\n\t\tSerialNumber: i.SerialNumber,\n\t\tCommonName: i.CommonName,\n\t}\n}", "title": "" }, { "docid": "bf8ffea23fac757b95b6dde255d2b8be", "score": "0.4571918", "text": "func (me *TAttlistIssnIssnType) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "b92f9050eba271f0667c741cce42a74f", "score": "0.45262063", "text": "func (_Contract *ContractTransactor) SetAuthorisation(opts *bind.TransactOpts, node [32]byte, target common.Address, isAuthorised bool) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"setAuthorisation\", node, target, isAuthorised)\n}", "title": "" }, { "docid": "e26440f510a27043c0e2da320e4fd379", "score": "0.450594", "text": "func (_Contract *ContractSession) SetAuthorisation(node [32]byte, target common.Address, isAuthorised bool) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetAuthorisation(&_Contract.TransactOpts, node, target, isAuthorised)\n}", "title": "" }, { "docid": "22d69aa3b7beab87ff72bf2b5a240582", "score": "0.44899926", "text": "func (o *RevokeUserEntitlementsParams) SetEntitlementIds(entitlementIds string) {\n\to.EntitlementIds = entitlementIds\n}", "title": "" }, { "docid": "bac67d3bc869d80b7e95207ac9d5366c", "score": "0.44738373", "text": "func (m *EducationAssignment) SetAssignTo(value EducationAssignmentRecipientable)() {\n m.assignTo = value\n}", "title": "" }, { "docid": "7090f056096cf46a486f160f185028bb", "score": "0.4473454", "text": "func (b EntitlementBuilder) SetUserID(id primitive.ObjectID) EntitlementBuilder {\n\tb.Entitlement.UserID = id\n\n\treturn b\n}", "title": "" }, { "docid": "e6f2bd5ef17b9fec51621a0d71dd76cd", "score": "0.4451502", "text": "func (me *TSAFPTProductDescription) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "2f52c71eaab66b8471736634b6799c7d", "score": "0.44385752", "text": "func (me *TAttlistELocationIDEIdType) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "46d675adf21b6cc7b89049624851648b", "score": "0.44127622", "text": "func SetProductId(productId string, flags uint) int {\n\tcProductId := goToCString(productId)\n\tcFlags := (C.uint)(flags)\n\tstatus := C.SetProductId(cProductId, cFlags)\n\tfreeCString(cProductId)\n\treturn int(status)\n}", "title": "" }, { "docid": "3b17fa0a46156a2d724831912e550e45", "score": "0.4411055", "text": "func (subscription *Subscription) SetExpiration(expiration time.Time) (*SubscriptionInfo, error) {\n\treturn subscription.Update(map[string]interface{}{\n\t\t\"expirationDateTime\": expiration,\n\t})\n}", "title": "" }, { "docid": "2132b6491189bab520ce715e95bbc834", "score": "0.43974924", "text": "func (o LicenseResourceCommitmentOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LicenseResourceCommitment) *string { return v.License }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dba3d8d764c57271e42013ea2d43b7fa", "score": "0.43841773", "text": "func UpdateLicense(w http.ResponseWriter, r *http.Request, s Server) {\n\n\tvars := mux.Vars(r)\n\tlicenseID := vars[\"license_id\"]\n\tvar lic license.License\n\terr := DecodeJsonLicense(r, &lic)\n\tif err != nil { // no or incorrect (json) license found in body\n\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\treturn\n\t}\n\tif lic.Id != licenseID {\n\t\tproblem.Error(w, r, problem.Problem{Detail: \"Different license IDs\"}, http.StatusNotFound)\n\t\treturn\n\t}\n\t_, err = updateLicenseInDatabase(licenseID, lic, s)\n\tif err != nil {\n\t\tif err == license.NotFound {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: license.NotFound.Error()}, http.StatusNotFound)\n\t\t} else {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\t}\n\t\treturn\n\t}\n\t// go on and GET license io to return the updated license\n\tGetLicense(w, r, s)\n}", "title": "" }, { "docid": "0458bc89375ae412036499b0a06016e8", "score": "0.43783095", "text": "func InstallLicenseSecret(client *kubernetes.Clientset, licenseData string) error {\n\tsecret := &v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: constants.LicenseSecretName,\n\t\t\tNamespace: defaults.KubeSystemNamespace,\n\t\t},\n\t\tStringData: map[string]string{\n\t\t\tconstants.LicenseSecretName: licenseData,\n\t\t},\n\t}\n\n\t_, err := client.CoreV1().Secrets(defaults.KubeSystemNamespace).\n\t\tCreate(context.TODO(), secret, metav1.CreateOptions{})\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif !trace.IsAlreadyExists(rigging.ConvertError(err)) {\n\t\treturn trace.Wrap(rigging.ConvertError(err))\n\t}\n\n\t_, err = client.CoreV1().Secrets(defaults.KubeSystemNamespace).\n\t\tUpdate(context.TODO(), secret, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn trace.Wrap(rigging.ConvertError(err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "495ca452885925aeb98434561e774d37", "score": "0.43690616", "text": "func SetTrialActivationMetadata(key string, value string) int {\n\tcKey := goToCString(key)\n\tcValue := goToCString(value)\n\tstatus := C.SetTrialActivationMetadata(cKey, cValue)\n\tfreeCString(cKey)\n\tfreeCString(cValue)\n\treturn int(status)\n}", "title": "" }, { "docid": "672f40f842d1f53ce77e1bc289a3d099", "score": "0.43690503", "text": "func (m *Group) SetSecurityIdentifier(value *string)() {\n m.securityIdentifier = value\n}", "title": "" }, { "docid": "8e604a5c0fad52427b18d4b6290f2e88", "score": "0.43680155", "text": "func (c *cloudChannelRESTClient) ActivateEntitlementOperation(name string) *ActivateEntitlementOperation {\n\toverride := fmt.Sprintf(\"/v1/%s\", name)\n\treturn &ActivateEntitlementOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),\n\t\tpollPath: override,\n\t}\n}", "title": "" }, { "docid": "19b229581dfcb6346168532893cc1cc7", "score": "0.43607983", "text": "func (b EntitlementBuilder) SetSubscriptionData(data datastructure.EntitledSubscription) EntitlementBuilder {\n\treturn b.marshalData(data)\n}", "title": "" }, { "docid": "9e16f6fae4b389dd71f86fa9497b849e", "score": "0.43537998", "text": "func (m *User) SetLicenseAssignmentStates(value []LicenseAssignmentStateable)() {\n m.licenseAssignmentStates = value\n}", "title": "" }, { "docid": "c3aba73f7d464401c0ed051d2939c922", "score": "0.43522307", "text": "func WithLicense(accept bool) Option {\n\treturn func(o *P) {\n\t\to.AcceptLicense = accept\n\t}\n}", "title": "" }, { "docid": "04b5c0b936349a0c62f45df8761f61c4", "score": "0.4341511", "text": "func (b EntitlementBuilder) SetKind(kind datastructure.EntitlementKind) EntitlementBuilder {\n\tb.Entitlement.Kind = kind\n\n\treturn b\n}", "title": "" }, { "docid": "3882c41cd02255ba38310df7ad3791e3", "score": "0.43404526", "text": "func (s UserSet) SetIndustry(value m.PartnerIndustrySet) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Industry\", \"industry_id\"), value)\n}", "title": "" }, { "docid": "a229a1ac66c98f216858b3f4ad8c138d", "score": "0.43402502", "text": "func (s UserSet) SetCommercialPartner(value m.PartnerSet) {\n\ts.RecordCollection.Set(models.NewFieldName(\"CommercialPartner\", \"commercial_partner_id\"), value)\n}", "title": "" }, { "docid": "383d8f1b7beddf3c3e4121baba98569c", "score": "0.4325167", "text": "func (o LicenseResourceCommitmentResponsePtrOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LicenseResourceCommitmentResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.License\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "62c79f9b5154d96da314060f8a718d6e", "score": "0.43153653", "text": "func (_Contract *ContractTransactorSession) SetAuthorisation(node [32]byte, target common.Address, isAuthorised bool) (*types.Transaction, error) {\n\treturn _Contract.Contract.SetAuthorisation(&_Contract.TransactOpts, node, target, isAuthorised)\n}", "title": "" }, { "docid": "f166889f55282d2f51cc65e4d54a7ba8", "score": "0.43093592", "text": "func SetLicenseCallback(callbackFunction func(int)) int {\n\tstatus := C.SetLicenseCallback((C.CallbackType)(unsafe.Pointer(C.licenseCallbackCgoGateway)))\n\tlicenseCallbackFuncion = callbackFunction\n\treturn int(status)\n}", "title": "" }, { "docid": "2413174be65ed244fd4a1cab9b8c7f63", "score": "0.43066904", "text": "func (ct *ctrlerCtx) WatchLicense(handler LicenseHandler) error {\n\tkind := \"License\"\n\n\t// see if we already have a watcher\n\tct.Lock()\n\t_, ok := ct.watchCancel[kind]\n\tct.Unlock()\n\tif ok {\n\t\treturn fmt.Errorf(\"License watcher already exists\")\n\t}\n\n\t// save handler\n\tct.Lock()\n\tct.handlers[kind] = handler\n\tct.Unlock()\n\n\t// run License watcher in a go routine\n\tct.runLicenseWatcher()\n\n\treturn nil\n}", "title": "" }, { "docid": "06b119abfc2d2d523ce1a35510b657f2", "score": "0.42924732", "text": "func (l Licence) CreateInvitation(params input.InvitationParams, claims admin.PassportClaims) (Licence, error) {\n\tinv, err := NewInvitation(params, claims)\n\tif err != nil {\n\t\treturn Licence{}, err\n\t}\n\n\tl.HintGrantMismatch = false\n\tl.Status = LicStatusInvited\n\tl.LatestInvitation = InvitationJSON{inv}\n\tl.AssigneeID = null.String{} // Only exists after accepted.\n\tl.UpdatedUTC = chrono.TimeNow()\n\n\treturn l, nil\n}", "title": "" }, { "docid": "61ef9a9eac48732178aa12873a48bd6a", "score": "0.4287455", "text": "func (me *TxsdProductType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "11eef59d69beafaa43c91617c6ad4bc5", "score": "0.4284323", "text": "func (me *TAttlistELocationIDValidYN) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "2fe74ed502c33f6a27bfd73da5922848", "score": "0.4283792", "text": "func (c *cloudChannelGRPCClient) ActivateEntitlementOperation(name string) *ActivateEntitlementOperation {\n\treturn &ActivateEntitlementOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),\n\t}\n}", "title": "" }, { "docid": "1960baf288b0fe60c65acf376591136a", "score": "0.42750302", "text": "func (m *IdentityGovernanceRequestBuilder) EntitlementManagement()(*ife915c8a8f434e475a7b17efdcb242db3e0f1f1ef327268189874360082827ec.EntitlementManagementRequestBuilder) {\n return ife915c8a8f434e475a7b17efdcb242db3e0f1f1ef327268189874360082827ec.NewEntitlementManagementRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "5be468e513bd384b91e384f642ad2738", "score": "0.42734352", "text": "func (n *resPool) GetEntitlement() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.entitlement\n}", "title": "" }, { "docid": "d7c1c0cbb7a5281c24c0e5fff86dfd30", "score": "0.4272852", "text": "func (o LicenseResourceCommitmentPtrOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LicenseResourceCommitment) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.License\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eb16786d4be9c1ffd0f8ce4b2983a94d", "score": "0.4261079", "text": "func (m *Group) SetLicenseProcessingState(value LicenseProcessingStateable)() {\n m.licenseProcessingState = value\n}", "title": "" }, { "docid": "93216d20cfaac85a73919dcb4eecc1d0", "score": "0.42593864", "text": "func (o LicenseResourceCommitmentResponseOutput) License() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LicenseResourceCommitmentResponse) string { return v.License }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ddd3180e3f17b5b363014bc93293f105", "score": "0.42454252", "text": "func (m *SequentialActivationRenewalsAlertIncident) SetAssigneeId(value *string)() {\n err := m.GetBackingStore().Set(\"assigneeId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9149b7a60c7f807b56a8d05d4a0b4828", "score": "0.42431104", "text": "func EntitlementModel(entitlementPayload *supportmessages.Entitlement) *models.Entitlement {\n\tif entitlementPayload == nil {\n\t\treturn nil\n\t}\n\n\t// proGearWeight and ProGearWeightSpouse currently not handled as\n\t// they are not in the entitlement record in the db.\n\tmodel := &models.Entitlement{\n\t\tID: uuid.FromStringOrNil(entitlementPayload.ID.String()),\n\t\tDependentsAuthorized: entitlementPayload.DependentsAuthorized,\n\t\tNonTemporaryStorage: entitlementPayload.NonTemporaryStorage,\n\t\tPrivatelyOwnedVehicle: entitlementPayload.PrivatelyOwnedVehicle,\n\t}\n\n\tif entitlementPayload.AuthorizedWeight != nil {\n\t\tmodel.DBAuthorizedWeight = swag.Int(int(*entitlementPayload.AuthorizedWeight))\n\t}\n\n\ttotalDependents := int(entitlementPayload.TotalDependents)\n\tmodel.TotalDependents = &totalDependents\n\n\tstorageInTransit := int(entitlementPayload.StorageInTransit)\n\tmodel.StorageInTransit = &storageInTransit\n\n\treturn model\n}", "title": "" }, { "docid": "cbf3ec0d9b194423f9533cea80d708d1", "score": "0.4241356", "text": "func WithLicense(accept bool) Option {\n\treturn func(o *P) {\n\t\to.License = accept\n\t}\n}", "title": "" }, { "docid": "78d9a2c9574b28f13fd03344858a1de7", "score": "0.42238814", "text": "func (t *NumberPortabilityChaincode) EntitlementFromRecipientCSP(stub shim.ChaincodeStubInterface, argsOld []string) ([]byte, error) {\n \n if len(argsOld) != 4 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 4\")\n\t }\n\t\t\n\t\tif(argsOld[3] != \"user_type1_0\") {\n\t return nil, fmt.Errorf(\"User: %s not Authorized for this transaction: \", string(argsOld[3]))\n\t }\n\t\t\n\t\tvar ServiceValidity,TalktimeBalance,SMSbalance,DataBalance int\n\t\t\n\t\n\t\tkey := argsOld[0]+argsOld[1]+argsOld[2]\n\t\t\n\t\tvalAsbytes, err := stub.GetState(key)\n\t\tif err != nil {\n\t\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + key + \"\\\"}\"\n\t\t\treturn nil, errors.New(jsonResp)\n\t\t} else if len(valAsbytes) == 0{\n\t\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get Query for \" + key + \"\\\"}\"\n\t\t\treturn nil, errors.New(jsonResp)\n\t\t}\n\t\t\n\t\tres := UsageDetailsFromCSP{}\n json.Unmarshal(valAsbytes, &res)\n \n\t\t\n\t\t\n\t fmt.Println(\"Donor Service Details Structure\",res)\n\t \n\t \n\t\tPlan := res.Plan\n\t\t\n\t ServiceValidity, err = strconv.Atoi(res.ServiceValidity)\n\t\tif err != nil {\n\t\treturn nil, err\n\t }\n\t\t\n\t TalktimeBalance, err = strconv.Atoi(res.TalktimeBalance)\n\t\tif err != nil {\n\t\treturn nil, err\n\t }\n\t\t\n\t\tSMSbalance, err = strconv.Atoi(res.SMSbalance)\n\t\tif err != nil {\n\t\treturn nil, err\n\t }\n\t\t\n\t\tDataBalance, err = strconv.Atoi(res.DataBalance)\n\t\tif err != nil {\n\t\treturn nil, err\n\t }\n\t\t\n\t\t\n\t\t\t\n\t\t// Calculate Acceptor Service\n\t\t\n\t\tif Plan == \"PlanA\"{\n\t\t Plan = \"PlanC\"\n\t\t\tServiceValidity = ServiceValidity - (ServiceValidity/5)\n\t\t\tTalktimeBalance = TalktimeBalance - (TalktimeBalance/5)\n\t\t\tSMSbalance = SMSbalance - (SMSbalance/5)\n\t\t\tDataBalance = DataBalance - (DataBalance/5)\n\t\t}\t\n\n if Plan == \"PlanB\"{\n\t\t Plan = \"PlanA\"\n\t\t\tServiceValidity = ServiceValidity - (ServiceValidity/6)\n\t\t\tTalktimeBalance = TalktimeBalance - (TalktimeBalance/6)\n\t\t\tSMSbalance = SMSbalance - (SMSbalance/6)\n\t\t\tDataBalance = DataBalance - (DataBalance/6)\n\t\t}\n\t\t\n if Plan == \"PlanC\"{\n\t\t Plan = \"PlanB\"\n\t\t\tServiceValidity = ServiceValidity - (ServiceValidity/4)\n\t\t\tTalktimeBalance = TalktimeBalance - (TalktimeBalance/4)\n\t\t\tSMSbalance = SMSbalance - (SMSbalance/4)\n\t\t\tDataBalance = DataBalance - (DataBalance/4)\n\t\t}\n\n ServiceValidityNew := strconv.Itoa(ServiceValidity)\n TalktimeBalanceNew := strconv.Itoa(TalktimeBalance)\n SMSbalanceNew := strconv.Itoa(SMSbalance)\n DataBalanceNew := strconv.Itoa(DataBalance)\n\t\t \n\t\t \n\t\t // Put the state of Acceptor\n\t\t \n Status1 := \"AcceptorApproved\"\n\t\t\n UsageDetailsFromAcceptorCSPObj := UsageDetailsFromCSP{Number: argsOld[0], ServiceProviderOld: argsOld[1], ServiceProviderNew: argsOld[2], Plan: Plan, ServiceValidity: ServiceValidityNew, TalktimeBalance: TalktimeBalanceNew, SMSbalance: SMSbalanceNew, DataBalance: DataBalanceNew, Status: Status1}\n\t\t\tres2F, _ := json.Marshal(UsageDetailsFromAcceptorCSPObj)\n\t\t fmt.Println(string(res2F))\n\t\t err = stub.PutState(key,[]byte(string(res2F)))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\n\t\t\n\t\t\n\t\tUsageDetailsFromDonorandAcceptorCSPObj := UsageDetailsFromDonorandAcceptorCSP{Number: argsOld[0], ServiceProviderOld: argsOld[1], PlanOld: res.Plan, ServiceValidityOld: res.ServiceValidity, TalktimeBalanceOld: res.TalktimeBalance, SMSbalanceOld: res.SMSbalance, DataBalanceOld: res.DataBalance, ServiceProviderNew: argsOld[2], PlanNew: Plan, ServiceValidityNew: ServiceValidityNew, TalktimeBalanceNew: TalktimeBalanceNew, SMSbalanceNew: SMSbalanceNew, DataBalanceNew: DataBalanceNew, Status: Status1}\n res2F, _ = json.Marshal(UsageDetailsFromDonorandAcceptorCSPObj)\n\t\t fmt.Println(string(res2F))\n\t\t err = stub.PutState(key,[]byte(string(res2F)))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfmt.Println(\"Donor+Acceptor Service Details Structure\",UsageDetailsFromDonorandAcceptorCSPObj)\n\t\t\t\n\t\t\t\n\t\tfmt.Println(\"Invoke EntitlementFromRecipientCSP Chaincode... end\") \n\t\treturn nil,nil\n\t\n\t\n\n}", "title": "" }, { "docid": "6d41b584778320f3c055357c9e42fab5", "score": "0.4218311", "text": "func SetIss(issuer string) {\n\tiss = issuer\n}", "title": "" }, { "docid": "f861782ce59201749b05b0684b6c8cae", "score": "0.4215314", "text": "func (s *ServerReplicationParameters) SetLicenseType(v string) *ServerReplicationParameters {\n\ts.LicenseType = &v\n\treturn s\n}", "title": "" }, { "docid": "021ce7a796ee520e03e930cf7531eaf6", "score": "0.4206483", "text": "func (me *TAttlistInvestigatorValidYN) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "8fae439cd0794c5743a09d0b43026ca4", "score": "0.4198746", "text": "func (m CrossOrderCancelReplaceRequest) SetIssuer(v string) {\n\tm.Set(field.NewIssuer(v))\n}", "title": "" }, { "docid": "7ca65872212b373cbc59106717cc85a0", "score": "0.41957286", "text": "func (o *Operator) UpdateLicense(ctx context.Context, req ops.UpdateLicenseRequest) error {\n\tcluster, err := o.backend().GetSite(req.SiteDomain)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif req.License == \"\" {\n\t\treturn trace.BadParameter(\"can't set an empty license\")\n\t}\n\n\t// make sure we can parse the provided license before installing it\n\tlicense, err := licenseapi.ParseLicense(req.License)\n\tif err != nil {\n\t\treturn trace.BadParameter(\"failed to parse license\")\n\t}\n\n\tca, err := o.readOpsCertAuthority(cluster.Domain)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\terr = license.Verify(ca.CertPEM)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tcluster.License = req.License\n\tif _, err = o.backend().UpdateSite(*cluster); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tclient, err := o.GetKubeClient()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif err = InstallLicenseSecret(client, req.License); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tlibevents.Emit(ctx, o, events.LicenseUpdated, libevents.Fields{\n\t\tevents.FieldExpires: license.GetPayload().Expiration,\n\t\tevents.FieldMaxNodes: license.GetPayload().MaxNodes,\n\t})\n\n\tapplication, err := o.apps().GetApp(cluster.App.Locator())\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif !application.Manifest.HasHook(schema.HookLicenseUpdated) {\n\t\treturn nil\n\t}\n\n\t_, _, err = app.RunAppHook(ctx, o.apps(), app.HookRunRequest{\n\t\tApplication: cluster.App.Locator(),\n\t\tHook: schema.HookLicenseUpdated,\n\t\tServiceUser: cluster.ServiceUser,\n\t})\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "e1c42cb8817276b09aad308319c2dbee", "score": "0.4173309", "text": "func (entitlements) With(ctx context.Context, e datastructure.Entitlement) EntitlementBuilder {\n\treturn EntitlementBuilder{\n\t\tEntitlement: e,\n\t}\n}", "title": "" }, { "docid": "138b421d8216d69d8f36bc25cb0e64cc", "score": "0.41644868", "text": "func (s *CreateReplicationJobInput) SetLicenseType(v string) *CreateReplicationJobInput {\n\ts.LicenseType = &v\n\treturn s\n}", "title": "" }, { "docid": "7b27c729a00305695cae84c2089572ae", "score": "0.41623655", "text": "func (c *CloudChannelClient) ActivateEntitlementOperation(name string) *ActivateEntitlementOperation {\n\treturn c.internalClient.ActivateEntitlementOperation(name)\n}", "title": "" }, { "docid": "7b66a461f9bfd72d0c3543bd62ebd93d", "score": "0.41463673", "text": "func (m *User) SetSecurityIdentifier(value *string)() {\n m.securityIdentifier = value\n}", "title": "" }, { "docid": "7b363d8c381fd1672ab73ee6ff1dbcb8", "score": "0.41355655", "text": "func (s *UpdateReplicationJobInput) SetLicenseType(v string) *UpdateReplicationJobInput {\n\ts.LicenseType = &v\n\treturn s\n}", "title": "" }, { "docid": "a9ddf7784abe5495a31ec46a1b380cce", "score": "0.41279286", "text": "func (e *Entitlements) Set(key string, value interface{}) {\n\te.custom[key] = value\n}", "title": "" }, { "docid": "900232694f5ac8fa907ff3888dfa6c5f", "score": "0.41271177", "text": "func (m *ImpactedMailboxAsset) SetIdentifier(value *MailboxAssetIdentifier)() {\n err := m.GetBackingStore().Set(\"identifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "69c45c2f77b1f0ccf1070aafe02803ec", "score": "0.41265166", "text": "func (m OrderStatusRequest) SetIssuer(v string) {\n\tm.Set(field.NewIssuer(v))\n}", "title": "" }, { "docid": "69c45c2f77b1f0ccf1070aafe02803ec", "score": "0.41265166", "text": "func (m OrderStatusRequest) SetIssuer(v string) {\n\tm.Set(field.NewIssuer(v))\n}", "title": "" }, { "docid": "ef460f89f93904f8f3fc9ac63389a9c7", "score": "0.41234645", "text": "func (m *AndroidEnrollmentCompanyCode) SetEnrollmentToken(value *string)() {\n err := m.GetBackingStore().Set(\"enrollmentToken\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "677b16ed0fe083f6f788b73a1063d005", "score": "0.41216436", "text": "func NewEntitlementManagementRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*EntitlementManagementRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewEntitlementManagementRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "15c982eee77b12dfc3da5086b16c2e38", "score": "0.41215125", "text": "func (s *ManagedLicensesService) EditManagedLicense(pid, mlid interface{}, opt *EditManagedLicenceOptions, options ...RequestOptionFunc) (*ManagedLicense, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tlicense, err := parseID(mlid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/managed_licenses/%s\", PathEscape(project), PathEscape(license))\n\n\treq, err := s.client.NewRequest(http.MethodPatch, u, opt, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tml := new(ManagedLicense)\n\tresp, err := s.client.Do(req, ml)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn ml, resp, nil\n}", "title": "" }, { "docid": "598d62b0eaeca800bcdde7a4b4fd9568", "score": "0.41176403", "text": "func (op *ActivateEntitlementOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*channelpb.Entitlement, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp channelpb.Entitlement\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "3ba2622b7064b6858c1e87b3241132bd", "score": "0.41167858", "text": "func (me *TxsdCompanyID) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "e36e6027745d2597587a478f66a89cce", "score": "0.41124797", "text": "func (s *ReplicationJob) SetLicenseType(v string) *ReplicationJob {\n\ts.LicenseType = &v\n\treturn s\n}", "title": "" }, { "docid": "4b7311ece114fe7ff9e7b792fe522373", "score": "0.41108644", "text": "func EncodeGrpcReqLicense(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*License)\n\treturn req, nil\n}", "title": "" }, { "docid": "2022922a4c3816d3b7744bd824c0bb8d", "score": "0.41098875", "text": "func (c *cloudChannelGRPCClient) SuspendEntitlementOperation(name string) *SuspendEntitlementOperation {\n\treturn &SuspendEntitlementOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),\n\t}\n}", "title": "" }, { "docid": "ab391f761f635230a1e0346008687929", "score": "0.40942618", "text": "func (me *TAttlistGrantListCompleteYN) Set(s string) { (*xsdt.Token)(me).Set(s) }", "title": "" }, { "docid": "fbd353dd27a46e39797859da064cd299", "score": "0.40904152", "text": "func (t *EnergyMarket) registerProductOffering(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\tvar ProductOffering ProductOffering\n\n\tProductOffering.ObjectType = \"productOfferings\"\n\tProductOffering.ProductName = args[0]\n\tProductOffering.Description = args[1]\n\tProductOffering.OfferorID = args[2]\n\tprice, err := strconv.ParseFloat(args[3], 32)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tProductOffering.Price = float32(price)\n\tProductOffering.Status = available\n\tmytime := time.Now()\n\tProductOffering.Timestamp = mytime.Format(\"2006-01-02 15:04:05\")\n\n\t// ==== Create productOffering object and marshal to JSON ====\n\tproductOfferingJSON, err := json.Marshal(ProductOffering)\n\tif err != nil {\n\t\treturn shim.Error(\"Marshal failed for productOffering Entry\" + fmt.Sprint(err))\n\t}\n\t// === Save product offering to state ===\n\trand.Seed(time.Now().UnixNano())\n\n\terr = stub.PutState(randSeq(10), productOfferingJSON)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" } ]
19d93dd635affe1ccb8ed62371f6715a
DispatchMessage is a method to dispatch a message to a consumer
[ { "docid": "8acc3edf3990596544592745f005b794", "score": "0.68295294", "text": "func (dispatcher HTTPDispatcher) DispatchMessage(message *handler.Message, route Route) error {\n\n\treq, err := http.NewRequest(\"POST\", route.URL, bytes.NewBuffer([]byte(message.Message)))\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := dispatcher.Client.Do(req)\n\n\tif err != nil {\n\t\tlog.Println(\"ERROR: error making http call \", err)\n\t\treturn errors.New(\"error making http call\")\n\t}\n\n\tdefer resp.Body.Close()\n\n\tfmt.Println(\"response Status:\", resp.Status)\n\n\tif is2xx(&resp.StatusCode) {\n\t\treturn nil\n\t}\n\n\tlog.Println(\"ERROR: returned response \", resp)\n\treturn errors.New(\"Client returned http status code\")\n}", "title": "" } ]
[ { "docid": "c1ddb1b9a035221f2bfa5263154b0c7c", "score": "0.7555655", "text": "func (_m *MessageDispatcher) Dispatch(message *data.Message) {\n\t_m.Called(message)\n}", "title": "" }, { "docid": "fec4f2fb08e18f5d5cbcc81e8c64d98d", "score": "0.72879755", "text": "func DispatchMessage(ctx context.Context, event *client.ClientSentEvent) error {\n\tparams := ctx.Value(knKey{})\n\tif params == nil {\n\t\tpanic(\"Invalid context provided. This is not a KnossosContext\")\n\t}\n\n\tknCtx, ok := params.(KnossosCtxParams)\n\tif !ok {\n\t\tpanic(\"wrong type in knossos context\")\n\t}\n\n\treturn knCtx.MessageCallback(event)\n}", "title": "" }, { "docid": "a10f6b5f6ee926099121b440e846914c", "score": "0.7050072", "text": "func (c *Client) dispatchMessage(msgType uint32, msgData interface{}, returnChannel chan interface{}) {\n\tdefer func() {\n\t\tif r := recover(); !c.closing && r != nil { // a panic was raised (most likely the channel was closed)\n\t\t\tif c.lastError != nil {\n\t\t\t\tpanic(c.lastError)\n\t\t\t}\n\t\t\tpanic(r)\n\t\t}\n\t}()\n\n\tif !c.closing {\n\t\tselect {\n\t\tcase c.dispatchChannel <- &messageDispatch{msg: &ProtocolMessage{Type: msgType, Data: msgData}, returnChannel: returnChannel}:\n\t\t\treturn\n\t\tcase err, _ := <-c.errorChannel:\n\t\t\tif c.lastError != nil {\n\t\t\t\tpanic(c.lastError)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tpanic(\"Why did we end up here?\")\n\t\t}\n\t} else {\n\t\tif returnChannel != nil {\n\t\t\tclose(returnChannel)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "97282dc77d9db843be77f9556bf7a2bd", "score": "0.6907855", "text": "func (m *Msg) Dispatch(dispatcher MsgDispatcher) error {\n\treturn dispatcher.DispatchMsg(m)\n}", "title": "" }, { "docid": "1afa152af2a1c5ea9baa15b16782bcc5", "score": "0.6807779", "text": "func (m *mockDispatcher) Dispatch(routingKey string, message interface{}) error {\n\tm.Messages = append(m.Messages, message)\n\treturn nil\n}", "title": "" }, { "docid": "174095e0aed67dba13d88e9d93fb9941", "score": "0.66504896", "text": "func (c *Controller) Dispatch() error {\n\tvar err error\n\tc.conn.SetDeadline(time.Now().Add(3e9))\n\tmessage, err := c.ReadFirstMessage()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.conn.SetDeadline(time.Time{})\n\tcommand := strings.Split(strings.Trim(message, \" \\r\\n\"), \" \")\n\tcommand[0] = strings.ToLower(command[0])\n\n\tswitch command[0] {\n\tcase \"get\", \"gets\":\n\t\terr = c.Get(command)\n\tcase \"set\":\n\t\terr = c.Set(command)\n\tcase \"version\":\n\t\terr = c.Version()\n\tcase \"stats\":\n\t\terr = c.Stats()\n\tcase \"delete\":\n\t\terr = c.Delete(command)\n\tcase \"flush\":\n\t\terr = c.Flush(command)\n\tcase \"flush_all\":\n\t\terr = c.FlushAll()\n\tdefault:\n\t\treturn c.UnknownCommand()\n\t}\n\n\tif err != nil {\n\t\tc.SendError(err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e695b5df587f43195ce004fa105186a", "score": "0.6601249", "text": "func (hub *Hub) Dispatch(message *rumour.Message) error {\n\tmysql.StoreService.Store().SingleMessage().Insert(\n\t\tmessage.Content[\"id\"].(uint64),\n\t\tmessage.From,\n\t\tmessage.To,\n\t\tuint32(message.Type),\n\t\tmessage.Content[\"message\"].(string))\n\tctx := context.WithValue(context.Background(), ctxKeyMessage, message)\n\n\treturn hub.pool.Schedule(ctx, scheduler.TaskFunc(hub.dispatch))\n}", "title": "" }, { "docid": "62383bba5ea1c3a1079131f7ea61882b", "score": "0.6295304", "text": "func (b Bus) Dispatch(msg interface{}) Envelope {\n\treturn b.DispatchWithId(uuid.New(), msg)\n}", "title": "" }, { "docid": "1550fb61560801c3a4d691ee41a2f922", "score": "0.61879927", "text": "func (s *Server) dispatch(msg []byte, senderID string) {\n\tids, msg := s.onDispatch(msg, senderID)\n\tif (ids != nil && len(ids) == 0) || len(msg) == 0 {\n\t\treturn\n\t}\n\n\tvar sendTo []*messenger\n\ts.mu.RLock()\n\tfor _, m := range s.messengers {\n\t\tvar c *messenger\n\t\tif ids != nil {\n\t\t\tfor _, id := range ids {\n\t\t\t\tif m.clientID == id {\n\t\t\t\t\tc = m\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tc = m\n\t\t}\n\t\tif c == nil {\n\t\t\t// Since the server has no knowledge of the OnErr call expense, we\n\t\t\t// currently won't risk calling it while holding a lock.\n\t\t\t// s.err(ErrClientNotFound)\n\t\t\tcontinue\n\t\t}\n\t\tsendTo = append(sendTo, c)\n\t\tif len(sendTo) == len(ids) {\n\t\t\tbreak\n\t\t}\n\t}\n\ts.mu.RUnlock()\n\n\tfor _, m := range sendTo {\n\t\tm.send(msg)\n\t}\n}", "title": "" }, { "docid": "56e8e2a7cba76abf9e84cecf37dc87b2", "score": "0.6182185", "text": "func (self *SocketGW) Dispatch(p packet.Packet) {\n\t// !Note: in net-thread\n\top := p.Op()\n\n\t// check\n\tif !self.IsRegistered() && op != COPREGISTERGATE {\n\t\treturn\n\t}\n\n\t// get msg creator\n\tf := msg.MsgCreators[op]\n\tif f == nil {\n\t\treturn\n\t}\n\n\t// remove sid\n\tsid := p.RemoveSid()\n\tTempSeqid = sid\n\t// unmarshal\n\tmessage := f()\n\terr := msg.Unmarshal(p.Body(), message)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// find handler\n\th := msg.MsgHandlers[op]\n\tif h != nil {\n\t\tloop.Push(func() {\n\t\t\t// set ctx\n\t\t\tvar ctx interface{}\n\t\t\tif sid == 0 {\n\t\t\t\t// directly from gate\n\t\t\t\tctx = self\n\t\t\t} else {\n\t\t\t\t// from player\n\t\t\t\tctx = PlayerMgr.FindPlayerBySid(sid) // this function MUST be run in loop thread\n\t\t\t\tif ctx == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\th(message, ctx)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "68f03b5a043736336892d7532a2f7b34", "score": "0.6110644", "text": "func (c *Client) dispatchRequest(msg []byte) {\n\tc.verbose(\"dispatching request: %s\", msg)\n\tc.requests <- msg\n}", "title": "" }, { "docid": "00d657fadb4c6bfb436c4961ae00848a", "score": "0.60551405", "text": "func (d *Dispatcher) Dispatch(eventName string, data service.CallData, subscribers []service.Subscriber) {\n\tdispatch(subscribers, eventName, data)\n}", "title": "" }, { "docid": "b9938db7305c70f5a9d6a9290e4366f5", "score": "0.60386026", "text": "func (c *StubPublisher) Dispatch(n gosqs.Notifier, event string) {\n\tsm := SentMessage{\n\t\tEvent: fmt.Sprintf(\"%s_%s\", n.ModelName(), event),\n\t\tBody: n,\n\t}\n\tc.DispatcherMessages = append(c.DispatcherMessages, sm)\n\tc.EventList = append(c.EventList, sm.Event)\n}", "title": "" }, { "docid": "6b14ff69dfcc4a41ea9ebd1df997179d", "score": "0.60159713", "text": "func (s *shard) dispatch(ctx context.Context, roster players.Roster, failSignaller chan startMessage, world *World) error {\n\tif err := s.initiateHandlers(s.chunkIDs, world, roster); err != nil {\n\t\treturn fmt.Errorf(\"failed to instantiate world processors: %w\", err)\n\t}\n\n\tif err := s.ps.Subscribe(subj.MkShardEvent(string(s.id)), s.incomingEventHandler); err != nil {\n\t\treturn fmt.Errorf(\"failed to register shard events handler: %w\", err)\n\t}\n\n\tgo s.runEventLoop(ctx, failSignaller)\n\treturn nil\n}", "title": "" }, { "docid": "a2f8280780a1e02834e3dbc12f568ac0", "score": "0.5897287", "text": "func (_m *DeliveryJobRepository) DispatchMessage(message *data.Message, deliveryJobs ...*data.DeliveryJob) error {\n\t_va := make([]interface{}, len(deliveryJobs))\n\tfor _i := range deliveryJobs {\n\t\t_va[_i] = deliveryJobs[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, message)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*data.Message, ...*data.DeliveryJob) error); ok {\n\t\tr0 = rf(message, deliveryJobs...)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f170a16af9ca367fb388960ee0bfe8fb", "score": "0.5834268", "text": "func (d *Dispatcher) Dispatch(op *grpc_inventory_manager_go.AgentOpRequest) derrors.Error {\n\t// Make dispatching non-blocking\n\tvar status grpc_inventory_go.OpStatus\n\tvar info string\n\tselect {\n\tcase d.opQueue <- op:\n\t\tlog.Debug().Str(\"operation_id\", op.GetOperationId()).Msg(\"queued operation\")\n\t\tstatus = grpc_inventory_go.OpStatus_SCHEDULED\n\tdefault:\n\t\tlog.Debug().Str(\"operation_id\", op.GetOperationId()).Msg(\"operation queue full\")\n\t\tstatus = grpc_inventory_go.OpStatus_FAIL\n\t\tinfo = \"agent operation queue full\"\n\t}\n\n\t// Add to response queue\n\td.respond(op, status, info)\n\n\treturn nil\n}", "title": "" }, { "docid": "624889cba732f923c0b8362479e34e31", "score": "0.5810471", "text": "func (a *actor) Dispatch(e Event) error {\n\ta.events <- e\n\treturn nil\n}", "title": "" }, { "docid": "6f2b94d41f0374594a5b8cb4dda5dc75", "score": "0.576644", "text": "func dispatch(qid uint16, packet *RawPacket) {\n\t_dispatcher.RLock()\n\t// TODO: what should happen when this blocks?\n\t_dispatcher.queues[qid] <- packet\n\t_dispatcher.RUnlock()\n}", "title": "" }, { "docid": "4b1a28dc948dd0e6a4330ba48c853849", "score": "0.576357", "text": "func (p *Provider) dispatch(eventName fsm.EventName, deal fsm.StateType) {\n\tevt, ok := eventName.(storagemarket.ProviderEvent)\n\tif !ok {\n\t\tlog.Errorf(\"dropped bad event %s\", eventName)\n\t}\n\trealDeal, ok := deal.(storagemarket.MinerDeal)\n\tif !ok {\n\t\tlog.Errorf(\"not a MinerDeal %v\", deal)\n\t}\n\tpubSubEvt := internalProviderEvent{evt, realDeal}\n\n\tif err := p.pubSub.Publish(pubSubEvt); err != nil {\n\t\tlog.Errorf(\"failed to publish event %d\", evt)\n\t}\n}", "title": "" }, { "docid": "fe23d809e7424357d5ec7028a8977161", "score": "0.57273984", "text": "func dispatchMessages(nodeConn *NodeConnection) {\n\tlog.Printf(\"starting dispatch thread for node %s\\n\", nodeConn.nodeAddr)\n\tme := MakeThread()\n\tdefer RemoveThread(me.Tid)\n\tnodeConn.dispatchTheadId = me.Tid\n\tqueue := nodeConn.Queue\n\tvar message *common.Message\n\tvar err error\n\tfor {\n\t\tselect {\n\t case <- me.KillChan:\n\t \tlog.Printf(\"Node %s is gone, stopping dispatching \\n\", nodeConn.nodeAddr)\n\t \t//TODO: if die, put failures in the right threads\n\t return\n\t case message = <- queue:\n\t \t//if fails, put a failure in accepqueue\n\t \terr = nodeConn.sendMessage(message)\t\n\t \tif err != nil {\n\t \t\tlog.Printf(\"Could not dispatch message %#v, sending failure instead: %#v\", *message, err)\n\t \t\tfailureResponse := common.Message{Tid: message.Tid, PrimaryType: \"response\", SecType: \"failure\"}\n\t \t\tgetThread(message.Tid).Responses <- &failureResponse\n\t \t}\n }\n\t}\n}", "title": "" }, { "docid": "fbc9f5d4eb603241803c295a280bae39", "score": "0.5704659", "text": "func (msgDisp *MessageDispatcher) Dispatcher(msg *xuper_p2p.XuperMessage) {\n\tmsgDisp.handlerLimitChan <- true\n\tgo msgDisp.Work(msg)\n}", "title": "" }, { "docid": "571d1802d818fe71b46cb5138c7c8126", "score": "0.5698578", "text": "func (r *HttpRouter) Dispatch(p *mqtt.PublishPacket) {\n\n}", "title": "" }, { "docid": "89734a82121cb10aca2f5f671a3f40be", "score": "0.56756884", "text": "func (ns *QlcService) PutMessage(msg Message) {\n\tns.dispatcher.PutMessage(msg)\n}", "title": "" }, { "docid": "c30dce691a5fbf773ce396e9df9fcfd1", "score": "0.5674367", "text": "func (d *Dispatcher) Dispatch(objID int, task TaskFunc) (err error) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\terr = errors.New(\"dispatcher closed\")\n\t\t}\n\t}()\n\n\t// dispatch at random if objID is less than 0\n\tif objID < 0 {\n\t\tobjID = rand.Intn(d.gcNum)\n\t}\n\t// dispatching to closed channel is limited\n\tif atomic.LoadInt32(&d.status) == dispatcherStatusClosed {\n\t\treturn errors.New(\"dispatcher closed\")\n\t}\n\n\tindex := objID % d.gcNum\n\td.gcs[index].tasksChan <- task\n\treturn\n}", "title": "" }, { "docid": "7fb227e5acdc1f5eaf6cd21327e1d55d", "score": "0.5665382", "text": "func (self *loadBalancer) dispatch(service *lbService, msg [][]byte) {\n\tif service == nil {\n\t\tlog.Fatal(\"Nil service\")\n\t}\n\t// Queue message if any\n\tif len(msg) != 0 {\n\t\tservice.requests = append(service.requests, msg)\n\t}\n\tself.purgeWorkers()\n\tfor service.waiting.Len() > 0 && len(service.requests) > 0 {\n\t\tmsg, service.requests = service.requests[0], service.requests[1:]\n\t\telem := service.waiting.Pop()\n\t\tself.waiting.Delete(elem.Value)\n\t\tworker, _ := elem.Value.(*lbWorker)\n\n\t\tself.sendToWorker(worker, SIGNAL_REQUEST, nil, msg)\n\t}\n}", "title": "" }, { "docid": "e1d2127801f72148fcbc6b791cf93bd3", "score": "0.5654559", "text": "func (dispatch *Dispatcher) Dispatch(action Dispatchable) {\n\tdispatch.messages = append(dispatch.messages, action)\n\t//dispatch.processMessages()\n}", "title": "" }, { "docid": "c203c7000c88501bcbd90476097a05d3", "score": "0.56176794", "text": "func Dispatch(ctx *Context) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Printf(\"Recovered from panic in dispatch\")\n\t\t\tctx.Respond(\"Something in that command scared me :( could almost say I was paniced\")\n\t\t\tdebug.PrintStack()\n\t\t}\n\t}()\n\n\tc := strings.ToLower(strings.Split(ctx.Ev.Text, \" \")[0])\n\tif len(ctx.Ev.Text) == 0 {\n\t\tlog.Printf(\"Got blank message\")\n\t\treturn\n\t}\n\tif ctx.Ev.Text[0] == '!' {\n\t\tif v, ok := Commands[strings.TrimLeft(c, \"!\")]; ok {\n\t\t\tif !v.adminCheck || isAdmin(ctx) {\n\t\t\t\tv.handler(ctx)\n\t\t\t} else {\n\t\t\t\tctx.Respond(\"You do not have permission to do that. Sorry :(\")\n\t\t\t}\n\t\t} else {\n\t\t\tctx.Respond(\"I don't know what you want from me :( do !help?\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8eddb56f1f8ef3a4e98fcb596b941b71", "score": "0.56097734", "text": "func (d *Driver) dispatch() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg := <-d.pool:\n\t\t\t\td.consume(msg)\n\t\t\tcase <-d.kill:\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "1d8ffa69eb971f6e4c357ae7b839f3a8", "score": "0.5606742", "text": "func ConsumerMsg(topicName, channelName, lookupAddr string, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tif k, ok := libs.CheckStrEmpty(topicName, channelName, lookupAddr); !ok {\n\t\tfmt.Printf(\"args[%d] is null\", k)\n\t\tos.Exit(1)\n\t}\n\tinChan := make(chan *nsq.Message)\n\tconf := nsq.NewConfig()\n\tconf.Set(\"max-in-flight\", 1000)\n\tconsumer, err := nsq.NewConsumer(topicName, channelName, conf)\n\tif err != nil {\n\t\tfmt.Println(\"[Error NewConsumer]\", err)\n\t\tpanic(err)\n\t}\n\n\tconsumer.AddHandler(nsq.HandlerFunc(func(m *nsq.Message) error {\n\t\tinChan <- m\n\t\treturn nil\n\t}))\n\n\tif err := consumer.ConnectToNSQLookupd(lookupAddr); err != nil {\n\t\tfmt.Println(\"[Error ConnectToNSQLookupd]\", err)\n\t\tpanic(err)\n\t}\n\n\tgo dealMsg(inChan)\n\t// read from this channel to block until consumer is cleanly stopped\n\t<-consumer.StopChan\n}", "title": "" }, { "docid": "1c95e1bcbc4c8a19754b5ad509d87b45", "score": "0.5603389", "text": "func (f HandlerFunc) HandleMessage(msg *sqs.Message) error {\n\treturn f(msg)\n}", "title": "" }, { "docid": "1c95e1bcbc4c8a19754b5ad509d87b45", "score": "0.5603389", "text": "func (f HandlerFunc) HandleMessage(msg *sqs.Message) error {\n\treturn f(msg)\n}", "title": "" }, { "docid": "3dfa27dd430aab76cfc18cc7f8ee42d0", "score": "0.5598698", "text": "func (n *TreeNodeInstance) dispatchMsgToProtocol(onetMsg *ProtocolMsg) error {\n\t// if message comes from parent, dispatch directly\n\t// if messages come from children we must aggregate them\n\t// if we still need to wait for additional messages, we return\n\tmsgType, msgs, done := n.aggregate(onetMsg)\n\tif !done {\n\t\tlog.Lvl3(n.Name(), \"Not done aggregating children msgs\")\n\t\treturn nil\n\t}\n\tlog.Lvlf5(\"%s->%s: Message is: %+v\", onetMsg.From, n.Name(), onetMsg.Msg)\n\n\tvar err error\n\tswitch {\n\tcase n.channels[msgType] != nil:\n\t\tlog.Lvl4(n.Name(), \"Dispatching to channel\")\n\t\terr = n.dispatchChannel(msgs)\n\tcase n.handlers[msgType] != nil:\n\t\tlog.Lvl4(\"Dispatching to handler\", n.ServerIdentity().Address)\n\t\terr = n.dispatchHandler(msgs)\n\tdefault:\n\t\treturn fmt.Errorf(\"message-type not handled by the protocol: %s\", reflect.TypeOf(onetMsg.Msg))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "3f247803d9256d63228451eae7729679", "score": "0.558304", "text": "func (b *Bot) dispatchCommand(slashCmd *slashCommand) {\n\tif slashCmd.Command == \"\" {\n\t\treturn\n\t}\n\tcmdName := slashCmd.Command[1:]\n\n\tcmd := b.GetCommand(cmdName)\n\tif cmd == nil {\n\t\treturn\n\t}\n\n\tcmd.Command.Channel() <- &CommandMsg{\n\t\tBot: b,\n\t\tCommand: slashCmd,\n\t\tStore: b.getStore(cmd.PluginId),\n\t}\n}", "title": "" }, { "docid": "1328fcd1eafe5ce740e3ea95e22417dc", "score": "0.55689263", "text": "func (p *publisher) Dispatch(n Notifier, event string) {\n\te := p.event(n, event)\n\tgo p.send(n, e)\n}", "title": "" }, { "docid": "2ff4cca21a296c2af1fff2ef85bc09a6", "score": "0.55503523", "text": "func (s *Store) dispatch(e core.Event) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\treturn s.dispatcher.Dispatch(e)\n}", "title": "" }, { "docid": "864cf177e579fd73d18d847d38af4a60", "score": "0.5526488", "text": "func (controller *Controller) HandleMessage(data []byte) error {\n\tsomething := &domain.Something{}\n\n\tif err := json.Unmarshal(data, something); err != nil {\n\t\treturn err\n\t}\n\n\treturn controller.Interactor.DoSomething()\n}", "title": "" }, { "docid": "864cf177e579fd73d18d847d38af4a60", "score": "0.5526488", "text": "func (controller *Controller) HandleMessage(data []byte) error {\n\tsomething := &domain.Something{}\n\n\tif err := json.Unmarshal(data, something); err != nil {\n\t\treturn err\n\t}\n\n\treturn controller.Interactor.DoSomething()\n}", "title": "" }, { "docid": "6423c9fe9789d99174446cda615ab500", "score": "0.5523252", "text": "func DispatchAction(a Action) {\n\tcurrentDispatcher.DispChan <- a\n}", "title": "" }, { "docid": "5636c28a8331566636e9238a9085393d", "score": "0.54986626", "text": "func Invoke(msg *sarama.ConsumerMessage, consumerList []model.Consumer, logger *zap.Logger) {\n\tvar event model.Event\n\tch := make(chan HTTPResponse)\n\n\terr := json.Unmarshal(msg.Value, &event)\n\tif err != nil {\n\t\tlogger.Error(\"message value deserialisation to event object failed\", zap.String(\"value\", string(msg.Value)), zap.Error(err))\n\t}\n\n\tfor _, c := range consumerList {\n\t\tgo handler(c.HTTPMethod, c.URL, event.Payload, logger, ch)\n\t}\n\n\tfor _, c := range consumerList {\n\t\t// Use the response (<-ch).body\n\t\tr := <-ch\n\t\tresponse := r.response\n\n\t\tdeliveredMessage := model.DeliveredMessage{}\n\n\t\tdeliveredMessage.EventID = event.ID\n\n\t\tbody, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"response body read failed\", zap.String(\"eventId\", event.ID), zap.String(\"topic\", c.Topic), zap.Error(err))\n\t\t}\n\t\tdeliveredMessage.Response = string(body)\n\t\tdeliveredMessage.Payload = string(msg.Value)\n\t\tdeliveredMessage.CreatedAt = event.Time\n\t\tdeliveredMessage.DeliveredAt = time.Now().Unix()\n\n\t\terr = r.err\n\t\tif err != nil {\n\t\t\tdeliveredMessage.Status = constant.Failed\n\t\t}\n\t\tdeliveredMessage.Status = constant.Success\n\t\tdeliveredMessage.GroupID = c.GroupID\n\n\t\t//stats.RecordWithTags(context.Background(), []tag.Mutator{tag.Upsert(c.ocView.Key(\"topic\"), msg.Topic), tag.Upsert(c.ocView.Key(\"groupId\"))},metrics.KafkaSuccessfulConsumed.M(1))\n\t\tfmt.Sprintf(\"%s\", deliveredMessage)\n\t}\n}", "title": "" }, { "docid": "7ffc0c013b4a1a8c1c64bdd99b29190f", "score": "0.5474543", "text": "func (t Quorum) Dispatch(ctx context.Context, req *DispatchRequest) (*DispatchResponse, error) {\n\tif err := t.auth.Deploy(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DispatchResponse{}, t.q.Dispatch(ctx, req.Messages...)\n}", "title": "" }, { "docid": "8f7704f8edd7767a8238e5ee159a5296", "score": "0.54638755", "text": "func (e *Executor) handleMessage(ev *executor.Event) error {\n\tlogger.GetInstance().Info(\"Handled MESSAGE event\",\n\t\tzap.String(\"eventMessage\", string(ev.GetMessage().GetData())),\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "a3400f8871936a8f43b28e6abef6e9e4", "score": "0.5462482", "text": "func (s *Server) HandleMessage(a Msg) (err error) {\n\taction := a.Action()\n\tswitch action {\n\tcase ActionReset:\n\t\terr = s.Reset()\n\tcase ActionObject:\n\t\tif obj := a.Object(); obj != nil {\n\t\t\terr = s.Update(obj)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"missing property object\")\n\t\t}\n\tcase ActionRemove:\n\t\terr = s.Remove(a.ID())\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown action\")\n\t}\n\tif err == nil {\n\t\ts.Logger.Infof(\"%s: %s\", strings.ToUpper(action), a.MustEncode())\n\t} else {\n\t\ts.Logger.Errorf(\"%s: %s: %s\", strings.ToUpper(action), err.Error(), a.MustEncode())\n\t}\n\treturn\n}", "title": "" }, { "docid": "5b2a265fd605a8e4bf8de2a030b99abe", "score": "0.5458536", "text": "func (h HandlerFunc) HandleMessage(m *Message) error {\n\treturn h(m)\n}", "title": "" }, { "docid": "bd21289465e17630ef9e5da224e571be", "score": "0.5457738", "text": "func (djRepo *DeliveryJobDBRepository) DispatchMessage(message *data.Message, deliveryJobs ...*data.DeliveryJob) (err error) {\n\tif message == nil || !message.IsInValidState() {\n\t\terr = ErrInvalidStateToSave\n\t}\n\targs := make([]interface{}, 0, len(deliveryJobs)*jobPropertyCount)\n\tquery := \"INSERT INTO job (id, messageId, consumerId, dispatchReceivedAt, statusChangedAt, earliestNextAttemptAt, status, createdAt, updatedAt) VALUES\"\n\tif err == nil {\n\t\tfor _, job := range deliveryJobs {\n\t\t\tif job == nil || !job.IsInValidState() || job.Message.ID != message.ID {\n\t\t\t\terr = ErrInvalidStateToSave\n\t\t\t\tbreak\n\t\t\t}\n\t\t\targs = append(args, job.ID, job.Message.ID, job.Listener.ID, job.DispatchReceivedAt, job.StatusChangedAt, job.EarliestNextAttemptAt, job.Status, job.CreatedAt, job.UpdatedAt)\n\t\t\tquery = query + \" (?, ?, ?, ?, ?, ?, ?, ?, ?),\"\n\t\t}\n\t}\n\tif err == nil {\n\t\tquery = query[:len(query)-1]\n\t\terr = transactionalWrites(djRepo.db, func(tx *sql.Tx) error {\n\t\t\treturn inTransactionExec(tx, emptyOps, query, args2SliceFnWrapper(args...), int64(len(deliveryJobs)))\n\t\t}, func(tx *sql.Tx) error {\n\t\t\treturn djRepo.mesageRepository.SetDispatched(context.WithValue(context.Background(), txContextKey, tx), message)\n\t\t})\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7f9b781169ffdae77996894586cd4a9a", "score": "0.5451863", "text": "func (c *consumer) messageProcessor(ctx context.Context, ID int, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\n\taddChan, quitChan := c.commitbg()\nkafkaConsumer:\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tquitChan <- true\n\t\t\tbreak kafkaConsumer\n\n\t\tdefault:\n\t\t\tev := c.consumer.Poll(100)\n\t\t\tif ev == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch e := ev.(type) {\n\t\t\tcase *kafka.Message:\n\t\t\t\tmessageCH <- Message{e.Value}\n\t\t\t\taddChan <- true\n\n\t\t\tcase kafka.PartitionEOF:\n\t\t\t\tfmt.Printf(\"[Consumer-%v] - reached %v\", ID, e)\n\n\t\t\tcase kafka.Error:\n\t\t\t\tmessage := fmt.Sprintf(\"[Consumer-%v] - error %v\", ID, e)\n\t\t\t\tc.logger.Error(message, consumerOperationCategory, nil, e)\n\t\t\t\tbreak kafkaConsumer\n\t\t\tdefault:\n\t\t\t\tmessage := fmt.Sprintf(\"[Consumer-%v] - %v\", ID, e)\n\t\t\t\tc.logger.Warning(message, consumerOperationCategory, nil, nil)\n\t\t\t}\n\t\t}\n\t}\n\n\terr := c.consumer.Close()\n\tif err != nil {\n\t\tc.logger.Warning(fmt.Sprintf(\"[Consumer-%v] - failed to close current consumer\", ID), consumerOperationCategory, nil, nil)\n\t}\n\tmessage := fmt.Sprintf(\"[Consumer-%v] - successfully terminated\", ID)\n\tc.logger.Warning(message, consumerOperationCategory, nil, nil)\n}", "title": "" }, { "docid": "706f965541e6bb249a4d3033cef366bf", "score": "0.5399888", "text": "func (w *Worker) Dispatch(job Payload) error {\n\tif w.shutdown {\n\t\treturn errors.New(\"WORKER IS SHUT DOWN\")\n\t}\n\tw.dispatcher <- job\n\treturn nil\n}", "title": "" }, { "docid": "f9cd18fd2c4a0caf2c700e4d63d5a49a", "score": "0.53942096", "text": "func (r *Ref) sendInternalMessage(message Message) error {\n\tctx := &Context{recipient: r, message: message}\n\terr := r.actor.Receive(ctx)\n\t// `errUnexpectedMessage` is ignored; other errors cause the actor to shut down.\n\tif _, ok := err.(errUnexpectedMessage); err != nil && !ok {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43dd2732f991fcd87bd87d96e1d40b58", "score": "0.53895074", "text": "func (d *NullDispatcher) Dispatch(ctx context.Context, body []byte) *webhookd.WebhookError {\n\n\treturn nil\n}", "title": "" }, { "docid": "71cf15fff953b58804f99a28ad6a7d40", "score": "0.5374425", "text": "func ClaimMessage(ctx context.Context, msg *sarama.ConsumerMessage, d encoding.DecodeRawFunc, sess sarama.ConsumerGroupSession) (async.Message, error) {\n\tslog.Debug(\"data received\", slog.String(\"topic\", msg.Topic))\n\n\tcorID := getCorrelationID(msg.Headers)\n\n\tsp, ctxCh := trace.ConsumerSpan(ctx, trace.ComponentOpName(consumerComponent, msg.Topic),\n\t\tconsumerComponent, corID, mapHeader(msg.Headers))\n\tctxCh = correlation.ContextWithID(ctxCh, corID)\n\tctxCh = log.WithContext(ctxCh, slog.With(slog.String(correlation.ID, corID)))\n\n\tdec, err := determineDecoder(d, msg, sp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not determine decoder %w\", err)\n\t}\n\n\treturn &message{\n\t\tctx: ctxCh,\n\t\tdec: dec,\n\t\tspan: sp,\n\t\tmsg: msg,\n\t\tsess: sess,\n\t}, nil\n}", "title": "" }, { "docid": "401187a3880798ce51aaabbfc680f76d", "score": "0.5369556", "text": "func processMessage(taskProcessor common.TaskProcessor, taskMessage common.TaskMessage) {\n\tdefer func() {\n\t\t//assure for not panicking out\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Error(\"Error trying to process message processor \", taskMessage.TaskProcessorName)\n\t\t\treturn\n\t\t}\n\n\t\twaitingGroup.Done()\n\t}()\n\n\tlog.Debug(\"Starting message consumption, msg processor:\", taskMessage.TaskProcessorName)\n\n\ttaskMessage.StartedAt = time.Now()\n\toutputTask, errProc := taskProcessor.ProcessTask(taskMessage)\n\toutputTask.FinishedAt = time.Now()\n\tproduceTaskFeedback(outputTask, errProc)\n\n\n}", "title": "" }, { "docid": "e496a7f84e884dfb7d234ac174b2c94b", "score": "0.5365858", "text": "func (a *Adapter) receiveMessage(ctx context.Context, m *sqs.Message, ack func()) {\n\tlogger := logging.FromContext(ctx).With(zap.Any(\"eventID\", m.MessageId)).With(zap.Any(\"sink\", a.SinkURI))\n\tlogger.Debugw(\"Received message from SQS:\", zap.Any(\"message\", m))\n\n\tctx = cloudevents.ContextWithTarget(ctx, a.SinkURI)\n\n\terr := a.postMessage(ctx, logger, m)\n\tif err != nil {\n\t\tlogger.Infof(\"Event delivery failed: %s\", err)\n\t} else {\n\t\tlogger.Debug(\"Message successfully posted to Sink\")\n\t\tack()\n\t}\n}", "title": "" }, { "docid": "a9e747ee48f4b7a537dbd42efbfa6945", "score": "0.5362634", "text": "func (c *StubConsumer) Message(ctx context.Context, queue, event string, body interface{}) {\n\tsm := SentMessage{\n\t\tQueueName: queue,\n\t\tEvent: event,\n\t\tBody: body,\n\t}\n\tc.DirectMessages = append(c.DirectMessages, sm)\n\tc.EventList = append(c.EventList, sm.Event)\n}", "title": "" }, { "docid": "e33a2a79483fe1136cfa6b679c684721", "score": "0.5347886", "text": "func (r *resultsHandler) handleMessage(ctx context.Context, msg interface{}) error {\n\tswitch v := msg.(type) {\n\tcase *control.RunStart:\n\t\treturn r.handleRunStart(ctx, v)\n\tcase *control.RunLog:\n\t\treturn r.handleRunLog(ctx, v)\n\tcase *control.RunError:\n\t\treturn r.handleRunError(ctx, v)\n\tcase *control.RunEnd:\n\t\treturn r.handleRunEnd(ctx, v)\n\tcase *control.EntityStart:\n\t\treturn r.handleTestStart(ctx, v)\n\tcase *control.EntityLog:\n\t\treturn r.handleTestLog(ctx, v)\n\tcase *control.EntityError:\n\t\treturn r.handleTestError(ctx, v)\n\tcase *control.EntityEnd:\n\t\treturn r.handleTestEnd(ctx, v)\n\tcase *control.Heartbeat:\n\t\treturn r.handleHeartbeat(ctx, v)\n\tdefault:\n\t\treturn errors.New(\"unknown message type\")\n\t}\n}", "title": "" }, { "docid": "ec50943069dc2dad3b95ae0ad1b20744", "score": "0.53470296", "text": "func (n *TreeNodeInstance) dispatchChannel(msgSlice []*ProtocolMsg) error {\n\tmt := msgSlice[0].MsgType\n\tto := reflect.TypeOf(n.channels[mt])\n\tif n.hasFlag(mt, AggregateMessages) {\n\t\tlog.Lvl4(\"Received aggregated message of type:\", mt)\n\t\tto = to.Elem()\n\t\tout := reflect.MakeSlice(to, len(msgSlice), len(msgSlice))\n\t\tfor i, msg := range msgSlice {\n\t\t\tlog.Lvl4(\"Dispatching aggregated to\", to)\n\t\t\tm := n.reflectCreate(to.Elem(), msg)\n\t\t\tlog.Lvl4(\"Adding msg\", m, \"to\", n.ServerIdentity().Address)\n\t\t\tout.Index(i).Set(m)\n\t\t}\n\t\t// Debugging some rare error found in travis\n\t\tswitch {\n\t\tcase mt == network.ErrorType:\n\t\t\tlog.Print(\"https://gopkg.in/dedis/onet.v1/issues/51\",\n\t\t\t\tlog.Stack())\n\t\tcase n.channels[mt] == nil:\n\t\t\tlog.Print(\"https://gopkg.in/dedis/onet.v1/issues/51\",\n\t\t\t\tmt, log.Stack())\n\t\t}\n\t\treflect.ValueOf(n.channels[mt]).Send(out)\n\t} else {\n\t\tfor _, msg := range msgSlice {\n\t\t\tout := reflect.ValueOf(n.channels[mt])\n\t\t\tm := n.reflectCreate(to.Elem(), msg)\n\t\t\tlog.Lvl4(n.Name(), \"Dispatching msg type\", mt, \" to\", to, \" :\", m.Field(1).Interface())\n\t\t\tif out.Len() < out.Cap() {\n\t\t\t\tout.Send(m)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"channel too small for msg %s in %s: \"+\n\t\t\t\t\t\"please use RegisterChannelLength()\",\n\t\t\t\t\tmt, n.ProtocolName())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ba350df3f351646e9bfaff2c4585a16", "score": "0.5340035", "text": "func Dispatch(a ActionID) {\n\tDispatchWithPayload(a, nil)\n}", "title": "" }, { "docid": "eee38dfac51707c8dd49f88ce151d2df", "score": "0.53303844", "text": "func (h *myMessageHandler) HandleMessage(m *nsq.Message) error {\n\tif len(m.Body) == 0 {\n\t\t// Returning nil will automatically send a FIN command to NSQ to mark the message as processed.\n\t\treturn nil\n\t}\n\tsuiteInfo, err := processMessage(m.Body)\n\tif err != nil {\n\t\tlog.Fatalf(\"unmarshal error: %s\", err.Error())\n\t}\n\n\t// 消息应该收到mtr suite的初始化消息\n\tmtr := downloadsuite.NewMeituriSuite(suiteInfo.FirstPage, suiteInfo.FolderPath, downloadsuite.MeituriParser{})\n\tcfg := nsq.NewConfig()\n\tnsqAddr := \"127.0.0.1:4150\"\n\tproducer, err := nsq.NewProducer(nsqAddr, cfg)\n\tif err != nil {\n\t\tlog.Printf(\"produce error: %s\", err.Error())\n\t\treturn err\n\t}\n\n\ttopic := \"mtr_image\"\n\tif err = mtr.Produce(producer, topic); err != nil {\n\t\tlog.Printf(\"produce error: %s\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f4de1ba82a0522b9f561adbe8838961d", "score": "0.532337", "text": "func redisHandleMessage(msg interface{}, rConn redis.Conn) error {\n\tswitch msg := msg.(type) {\n\tcase modObj:\n\t\treturn redisModObject(msg.Object, rConn)\n\tcase newObj:\n\t\treturn redisNewObject(msg.Object, rConn)\n\tcase delObj:\n\t\treturn redisDelObject(msg.Object, rConn)\n\tdefault:\n\t\ttxt := fmt.Sprintf(\"Unknown Message Type: %T\", msg)\n\t\treturn errors.New(txt)\n\t}\n}", "title": "" }, { "docid": "468f8d4fd81303a4342d8ba35b6e02b7", "score": "0.53230476", "text": "func (d *dispatcher) Dispatch(evt Event) {\n\td.lock.RLock()\n\tfor _, lis := range d.listeners {\n\t\tlis.Send(evt)\n\t}\n\td.logger.WithField(\"count\", len(d.listeners)).Debug(\"dispatched event to listeners\")\n\td.lock.RUnlock()\n}", "title": "" }, { "docid": "5cb8534a242ba922b921b9409f16ea4f", "score": "0.5320539", "text": "func (b *bully) ProcessMsg(msg packet.Message) {\n\tb.messageQueue <- msg\n}", "title": "" }, { "docid": "b807ebc800e22c91dd928d6e6ddad403", "score": "0.53051126", "text": "func (b *Broadcaster) dispatch() {\n\tfor {\n\t\tselect {\n\t\tcase message := <-b.send:\n\t\t\tfor client := range b.clients {\n\t\t\t\tgo b.trySend(message, client)\n\t\t\t}\n\t\tcase newclient := <-b.connect:\n\t\t\tb.clients[newclient] = struct{}{}\n\n\t\tcase deadclient := <-b.disconnect:\n\t\t\tdelete(b.clients, deadclient)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d8f424e05a61243d638d0841aee25da", "score": "0.52954173", "text": "func (m *Manager) dispatch(w work) error {\n\tworker := m.pool.GetWorker()\n\tif worker == nil {\n\t\terr := errors.New(\"No worker\")\n\t\tw.Done <- err\n\t\treturn err\n\t}\n\tgo func() {\n\t\terr := worker.client.Call(w.Service, w.Args, w.Reply)\n\t\tw.Done <- err\n\t\tif err != nil {\n\t\t\tm.pool.RemoveWorker(worker)\n\t\t} else {\n\t\t\tm.pool.FinishWorker(worker)\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "fc73959ef99eda2655e83cc8a62b38c7", "score": "0.5292567", "text": "func (h *MyMessageHandler) HandleMessage(message *nsq.Message) error {\n\th.totalMessages++\n\tlog.Printf(\"Message no %d received , body : %s \\n\", h.totalMessages, string(message.Body))\n\treturn nil\n}", "title": "" }, { "docid": "de8a355c9eb9e7ea598428324fc3d237", "score": "0.528133", "text": "func (p *ProcessQueue) PutMessage(msgs []message.MessageExtImpl) (dispatchToConsume bool) {\n\tdispatchToConsume = false\n\tmsgsLen := len(msgs)\n\tif msgsLen == 0 {\n\t\treturn\n\t}\n\tdefer p.lockTreeMap.Unlock()\n\tp.lockTreeMap.Lock()\n\n\tfor _, msg := range msgs {\n\t\tp.msgTreeMap.Put(int(msg.QueueOffset), msg)\n\n\t}\n\tp.msgCount = p.msgTreeMap.Size()\n\tmaxOffset, _ := p.msgTreeMap.Max()\n\tp.queueOffsetMax = int64(maxOffset.(int))\n\tif p.msgCount > 0 && !p.consuming {\n\t\tdispatchToConsume = true\n\t\tp.consuming = true\n\t}\n\tlastMsg := msgs[msgsLen-1]\n\tremoteMaxOffset := util.StrToInt64WithDefaultValue(lastMsg.PropertiesKeyValue(constant.PROPERTY_MAX_OFFSET), -1)\n\tif remoteMaxOffset > 0 {\n\t\taccTotal := remoteMaxOffset - lastMsg.QueueOffset\n\t\tif accTotal > 0 {\n\t\t\tp.msgAccCnt = accTotal\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb4ad078706ee01c0cd83ba70c12e9f0", "score": "0.5281306", "text": "func (m *subMachineInterfaceImpl) Dispatch(ctx state.Context, e state.Event) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn\n\tcase m.Super().(SuperMachineInterface).Sink() <- e:\n\t}\n}", "title": "" }, { "docid": "765f8716723e0c25fd0baf2e7ccf592d", "score": "0.52766824", "text": "func (s *ThreadSafeDispatcher) DispatchRaw(message []byte) ([]byte, error) {\n\tif len(message) == 0 {\n\t\treturn nil, errors.New(\"empty message\")\n\t}\n\n\t// First byte is the command code\n\tcommand := message[0] - ASCII_0\n\n\tswitch command {\n\tcase CMD_INSERT:\n\t\tlogger.Infof(\"inserting %s\", message[1:])\n\n\t\t// result: true if the key was inserted, false if it was already present\n\t\tresult, err := s.DispatchInsert(string(message[1:]))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn json.Marshal(result)\n\n\tcase CMD_DELETE:\n\t\tlogger.Infof(\"deleting %s\", message[1:])\n\n\t\t// result: true if the key was deleted, false if it was not present\n\t\tresult, err := s.DispatchDelete(string(message[1:]))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn json.Marshal(result)\n\n\tcase CMD_EXISTS:\n\t\tlogger.Infof(\"checking if %s exists\", message[1:])\n\n\t\t// result: true if the key exists, false if it does not\n\t\tresult, err := s.DispatchExists(string(message[1:]))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn json.Marshal(result)\n\n\tcase CMD_COMPLETIONS:\n\t\tlogger.Infof(\"completing %s\", message[1:])\n\n\t\t// result: list of completions\n\t\tresult, err := s.DispatchCompetions(string(message[1:]))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn json.Marshal(result)\n\n\tcase CMD_KEYS:\n\t\tlogger.Infof(\"listing keys\")\n\n\t\tif len(message) > 1 {\n\t\t\treturn nil, errors.New(\"key listing command takes no arguments\")\n\t\t}\n\n\t\t// result: list of keys\n\t\tresult := s.DispatchKeys()\n\t\treturn json.Marshal(result)\n\n\tcase CMD_RESET:\n\t\tlogger.Infof(\"resetting trie\")\n\n\t\tif len(message) > 1 {\n\t\t\treturn nil, errors.New(\"reset command takes no arguments\")\n\t\t}\n\n\t\t// result: true if the reset was successful\n\t\tresult := s.DispatchReset()\n\t\treturn json.Marshal(result)\n\t}\n\n\treturn []byte{}, errors.New(\"invalid command\")\n}", "title": "" }, { "docid": "889b900f49616c0117690b14eb6b91d2", "score": "0.52765113", "text": "func ProcessMessage(conn net.Conn, msg Message) {\n\tlog.Printf(\"Message received (%s) from %s\", msg.Type.String(), conn.RemoteAddr().String())\n\t// unauthenticated messages\n\tswitch mt := msg.Type; mt {\n\tcase CONNECT:\n\t\tlog.Printf(\"Client connected %s\", conn.RemoteAddr().String())\n\t\treturn\n\tcase DISCONNECT:\n\t\tfmt.Println(\"Client disconnected\")\n\t\treturn\n\tcase PING:\n\t\tfmt.Println(\"Client ping\")\n\t\treturn\n\tcase JOIN:\n\t\tp := newPlayer(msg.Name, conn)\n\t\tSVR.PlayerJoin(p)\n\t\treturn\n\t}\n\n\t// drop unauthenticated messages\n\tif msg.Sender == uuid.Nil {\n\t\tlog.Print(\"MSG dropped due to unknown sender\")\n\t\treturn\n\t}\n\n\tpn := ROSTER.PlayerName(msg.Sender)\n\n\tswitch mt := msg.Type; mt {\n\tcase JUMP:\n\t\tlog.Printf(\"Player %s jump\", pn)\n\tcase MOVE:\n\t\tlog.Printf(\"Player %s move\", pn)\n\tcase FIRE:\n\t\tlog.Printf(\"Player %s fireed\", pn)\n\tcase HIT:\n\t\tSVR.PlayerHit(msg.Name, msg.Sender, 50.0)\n\tcase LEAVE:\n\t\tSVR.RemovePlayer(msg.Sender)\n\tcase SCOREBOARD:\n\t\tSVR.SendScores()\n\tcase BROADCAST:\n\t\tfmt.Println(\"broadcast\")\n\tcase CHAT:\n\t\tfmt.Println(\"chat\")\n\tdefault:\n\t\tfmt.Printf(\"unknown message type %d.\\n\", mt)\n\t}\n\t// authenticated messages\n}", "title": "" }, { "docid": "c3c7a31b68a05495a193e0d7dd5c33b7", "score": "0.52747566", "text": "func (p Processor) ProcessMessage(msg Message) {\n\tsendChannel := <-p.workerpool\n\tsendChannel <- msg\n}", "title": "" }, { "docid": "d9ebc94e2d35ce4d12a6033f52aac966", "score": "0.5266753", "text": "func (n *TreeNodeInstance) ProcessProtocolMsg(msg *ProtocolMsg) {\n\tlog.Lvl4(n.Info(), \"Received message\")\n\tn.msgDispatchQueueMutex.Lock()\n\tn.msgDispatchQueue = append(n.msgDispatchQueue, msg)\n\tlog.Lvl4(n.Info(), \"DispatchQueue-length is\", len(n.msgDispatchQueue))\n\tif len(n.msgDispatchQueue) == 1 && len(n.msgDispatchQueueWait) == 0 {\n\t\tn.msgDispatchQueueWait <- true\n\t}\n\tn.msgDispatchQueueMutex.Unlock()\n}", "title": "" }, { "docid": "5f0f210ca7ea347a3bb281a9f246741b", "score": "0.52665657", "text": "func Dispatch(event events.SchedulingEvent) {\n\t// currently if dispatch fails, we simply log the error\n\t// we may revisit this later, e.g add retry here\n\tif err := dispatcher.dispatch(event); err != nil {\n\t\tlog.Logger.Warn(\"failed to dispatch SchedulingEvent\",\n\t\t\tzap.Error(err))\n\t}\n}", "title": "" }, { "docid": "cdc0aa94425fa4f1d7085f1e20038d76", "score": "0.52649546", "text": "func (dispatcher *CallbackDispatcher) Dispatch(cb *Callback) error {\n\tfor _, entry := range cb.Entries {\n\t\tfor _, messagingEntry := range entry.Messaging {\n\t\t\tif messagingEntry.Message != nil {\n\t\t\t\tif dispatcher.MessageHandler != nil {\n\t\t\t\t\tdispatcher.MessageHandler(messagingEntry)\n\t\t\t\t}\n\t\t\t} else if messagingEntry.Delivery != nil {\n\t\t\t\tif dispatcher.DeliveryHandler != nil {\n\t\t\t\t\tdispatcher.DeliveryHandler(messagingEntry)\n\t\t\t\t}\n\t\t\t} else if messagingEntry.Postback != nil {\n\t\t\t\tif dispatcher.PostbackHandler != nil {\n\t\t\t\t\tdispatcher.PostbackHandler(messagingEntry)\n\t\t\t\t}\n\t\t\t} else if messagingEntry.OptIn != nil {\n\t\t\t\tif dispatcher.AuthenticationHandler != nil {\n\t\t\t\t\tdispatcher.AuthenticationHandler(messagingEntry)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "27bbb160c3bf7fd06f29b58595337c57", "score": "0.52603245", "text": "func (c *Consumer) Process(msg *Message) error {\n\tatomic.AddUint32(&c.inFlight, 1)\n\n\tif msg.Delay > 0 {\n\t\terr := c.q.Add(msg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.delete(msg)\n\t\treturn nil\n\t}\n\n\tif msg.Err != nil {\n\t\tmsg.Delay = -1\n\t\tc.Put(msg)\n\t\treturn msg.Err\n\t}\n\n\tevt, err := c.beforeProcessMessage(msg)\n\tif err != nil {\n\t\tmsg.Err = err\n\t\tc.Put(msg)\n\t\treturn err\n\t}\n\n\tmsg.evt = evt\n\n\tstart := time.Now()\n\tmsgErr := c.opt.Handler.HandleMessage(msg)\n\tif msgErr == ErrAsyncTask {\n\t\treturn ErrAsyncTask\n\t}\n\n\tc.updateTiming(msg.TaskName, time.Since(start))\n\n\tmsg.Err = msgErr\n\tc.Put(msg)\n\n\treturn msg.Err\n}", "title": "" }, { "docid": "89a58da592b03f192158c0705382bdc3", "score": "0.52553916", "text": "func (this *EventDispatcher) Dispatch(eventName string, event Eventer) {\n\tcallbacks, ok := this.callbacks[eventName]\n\tif !ok {\n\t\treturn\n\t}\n\n\tfor _, callback := range callbacks {\n\t\tcallback.call(callback.subscriber, event)\n\t\tif event.IsPropagationStopped() {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "53a38e371eac07f9336ce508e2235f86", "score": "0.52528954", "text": "func (s *Server) HandleMessage(m *nsq.Message) error {\n\tfin := func() {\n\t\tm.DisableAutoResponse()\n\t\tm.Finish()\n\t}\n\t// decode message\n\treq, err := Decode(m.Body)\n\tif err != nil {\n\t\tfin() // raise error without message requeue\n\t\treturn errors.Wrap(err, \"envelope unpack failed\")\n\t}\n\t// check expiration\n\tif req.Expired() {\n\t\tfin()\n\t\treturn fmt.Errorf(\"expired %s %d\", req.Method, req.CorrelationID)\n\t}\n\t// periodically call touch on the nsq message while app is still processing it\n\tdefer touchMessage(s.ctx, m)()\n\t// call aplication\n\tappRsp, appErr := s.srv.Serve(s.ctx, req.Method, req.Body)\n\tif s.ctx.Err() != nil || appErr == context.Canceled {\n\t\t// context timeout/cancel\n\t\t// notice that we are also requeuing on appErr == context.Cancel\n\t\t// that's mechanism for application to postpone processing of the message\n\t\tm.RequeueWithoutBackoff(requeueDelay)\n\t\treturn nil\n\t}\n\t// need to reply\n\tif req.ReplyTo == \"\" {\n\t\treturn nil\n\t}\n\t// create reply\n\trsp := req.Reply(appRsp, appErr)\n\t// send reply\n\tif err := s.producer.Publish(req.ReplyTo, rsp.Encode()); err != nil {\n\t\treturn errors.Wrap(err, \"nsq publish failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05b572ca3ee7e11d854d3289a3465d12", "score": "0.52493155", "text": "func (b *EventBus) handle(m eh.EventMatcher, h eh.EventHandler, r *kafka.Reader) {\n\tdefer b.wg.Done()\n\tdefer func() {\n\t\tif err := r.Close(); err != nil {\n\t\t\tlog.Printf(\"eventhorizon: failed to close Kafka reader: %s\", err)\n\t\t}\n\t}()\n\n\thandler := b.handler(m, h, r)\n\n\tfor {\n\t\tselect {\n\t\tcase <-b.cctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\tmsg, err := r.FetchMessage(b.cctx)\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\terr = fmt.Errorf(\"could not fetch message: %w\", err)\n\t\t\tselect {\n\t\t\tcase b.errCh <- &eh.EventBusError{Err: err}:\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t}\n\n\t\t\t// Retry the receive loop if there was an error.\n\t\t\ttime.Sleep(time.Second)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-b.cctx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif err := handler(b.cctx, msg); err != nil {\n\t\t\t\tselect {\n\t\t\t\tcase b.errCh <- err:\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t\t}\n\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t} else {\n\t\t\t\t// Use a new context to always finish the commit.\n\t\t\t\tif err := r.CommitMessages(context.Background(), msg); err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"could not commit message: %w\", err)\n\t\t\t\t\tselect {\n\t\t\t\t\tcase b.errCh <- &eh.EventBusError{Err: err}:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.Printf(\"eventhorizon: missed error in Kafka event bus: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "a2775753e9f1495dcc4bda82c98f1e0a", "score": "0.5248024", "text": "func (d *Dispatcher) dispatch(node Node, cb Callback) {\n\n\tif d.registry[node.Handle] == nil {\n\t\t// TODO: log this\n\t\treturn\n\t}\n\n\td.registry[node.Handle].Handle(node, cb)\n}", "title": "" }, { "docid": "fd17102a18b986986662e7bb8865c758", "score": "0.52350706", "text": "func dispatchEvent(ctx context.Context, client pb.GNMIClient, ev *event, value string) {\n\tswitch ev.evType {\n\tcase adminStatusEvent:\n\t\tgetInterfaceSm(ctx, client, ev.iface).adminStatusEventHandler(ev, value)\n\tcase prefixEvent:\n\t\tgetInterfaceSm(ctx, client, ev.iface).prefixEventHandler(ev, value)\n\tcase prefixLenEvent:\n\t\tgetInterfaceSm(ctx, client, ev.iface).prefixLenEventHandler(ev, value)\n\tdefault:\n\t\tglog.Errorf(\"Unknown event: %#v\", ev)\n\t}\n}", "title": "" }, { "docid": "4391120f262fb8e4311c6392d4d85616", "score": "0.5227383", "text": "func consumeMessage(ctx context.Context) {\n\n\tl := log.New(os.Stdout, \"Kafka Writer:\", 0)\n\n\t// initialize a new reader with the brokers and topic\n\t// the groupID identifies the consumer and prevents\n\t// it from receiving duplicate messages\n\treader := kafka.NewReader(kafka.ReaderConfig{\n\t\tBrokers: []string{broker1Address, broker2Address, broker3Address},\n\t\tTopic: topic,\n\t\tLogger: l,\n\t\tGroupID: \"my-group\",\n\t\tMinBytes: 5,\n\t\tMaxBytes: 1e6,\n\t\t// Wait for at most 3 sec before receiving new data\n\t\tMaxWait: 3 * time.Second,\n\t})\n\n\tfor {\n\t\t// the `ReadMessage` method blocks until we receive the next event\n\t\tmsg, err := reader.ReadMessage(ctx)\n\t\tif err != nil {\n\t\t\tpanic(\"could not read message \" + err.Error())\n\t\t}\n\t\t// after receiving the message, log its value\n\t\tfmt.Println(\"received: \", string(msg.Value))\n\t}\n\n}", "title": "" }, { "docid": "2dd24e8b47f9389d6fe5ec544bc58642", "score": "0.5208405", "text": "func (c *clientConn) dispatchRequest(ch chan<- result, p idmarshaler) {\n\tsid := p.id()\n\n\tif !c.putChannel(ch, sid) {\n\t\t// already closed.\n\t\treturn\n\t}\n\n\tif err := c.conn.sendPacket(p); err != nil {\n\t\tif ch, ok := c.getChannel(sid); ok {\n\t\t\tch <- result{err: err}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "88842603d43d23ad3c6b4542d19afee9", "score": "0.5205263", "text": "func (p *Proxy) ProcessMessage(ctx context.Context, msg server.Message) error {\n\tif p.Endpoint == \"\" {\n\t\tp.Endpoint = proxy.DefaultEndpoint\n\t}\n\n\t// get the header\n\thdr := msg.Header()\n\n\t// get topic\n\t// use /topic as endpoint\n\tendpoint := getTopic(hdr)\n\n\t// set the endpoint\n\tif len(endpoint) == 0 {\n\t\tendpoint = p.Endpoint\n\t} else {\n\t\t// add endpoint to backend\n\t\tu, err := url.Parse(p.Endpoint)\n\t\tif err != nil {\n\t\t\treturn errors.InternalServerError(msg.Topic(), err.Error())\n\t\t}\n\t\tu.Path = path.Join(u.Path, endpoint)\n\t\tendpoint = u.String()\n\t}\n\n\t// send to backend\n\threq, err := http.NewRequest(\"POST\", endpoint, bytes.NewReader(msg.Body()))\n\tif err != nil {\n\t\treturn errors.InternalServerError(msg.Topic(), err.Error())\n\t}\n\n\t// set the headers\n\tfor k, v := range hdr {\n\t\threq.Header.Set(k, v)\n\t}\n\n\t// make the call\n\thrsp, err := http.DefaultClient.Do(hreq)\n\tif err != nil {\n\t\treturn errors.InternalServerError(msg.Topic(), err.Error())\n\t}\n\n\t// read body\n\tb, err := ioutil.ReadAll(hrsp.Body)\n\thrsp.Body.Close()\n\tif err != nil {\n\t\treturn errors.InternalServerError(msg.Topic(), err.Error())\n\t}\n\n\tif hrsp.StatusCode != 200 {\n\t\treturn errors.New(msg.Topic(), string(b), int32(hrsp.StatusCode))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "35f4148086c24cb2970b468a45657959", "score": "0.5202516", "text": "func (dsp *Dispatcher) Dispatch() {\n\tlog.Print(\"=== Dispatcher started\")\n\n\tfor {\n\t\tselect {\n\t\tcase subRequest := <-dsp.SubscriptionChan:\n\t\t\ts := dsp.SubscriberFactory(subRequest.SubscriberID)\n\t\t\ts.Connect(subRequest.Conn)\n\t\t\tdsp.directory.Subscribe(s)\n\t\tcase e := <-dsp.DispatchChan:\n\t\t\t// Broadcast\n\t\t\tif e.EventType() == BROADCAST_ETYPE {\n\t\t\t\tdsp.directory.Broadcast(e)\n\t\t\t} else {\n\t\t\t\tsender, recipient := dsp.directory.SenderAndRecipientFromEvent(e)\n\t\t\t\tsender.HandleEvent(e, recipient)\n\t\t\t}\n\t\tcase <-dsp.EventSourceCloseChan:\n\t\t\t// EventSource disconnected\n\t\t\tdsp.directory.UnsubscribeAll()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "871be33e238a42f8c386dd42a532a8da", "score": "0.52018744", "text": "func (fn DispatcherFunc) Dispatch(factory CommandFactory, options ...func(*DispatchOptions)) error {\n\treturn fn(factory, options...)\n}", "title": "" }, { "docid": "0a80058d2ba05fe6a2027fab1f92e312", "score": "0.5199685", "text": "func (ctrl *Controller) HandleMessage(c echo.Context) error {\n\tmsg := c.Param(\"message\")\n\tif msg == \"\" {\n\t\tmsg = \"Hello, from http!\"\n\t}\n\n\targ := service1.AppCoreLogicIn{\n\t\tFrom: \"http\",\n\t\tMessage: msg,\n\t}\n\n\tservice1.AppCoreLogic(c.Request().Context(), arg)\n\treturn nil\n}", "title": "" }, { "docid": "817796994e2568cf4e4c36a3ae6eb89a", "score": "0.51911086", "text": "func (s *Store) Dispatch(e core.Event) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.dispatcher.Dispatch(e)\n}", "title": "" }, { "docid": "0b6bb5204ee9062cbd3a3846a6db6d48", "score": "0.5183004", "text": "func (state *mockComponent) Receive(ctx *network.ComponentContext) error {\n\tswitch msg := ctx.Message().(type) {\n\tcase *messages.BasicMessage:\n\t\tstate.Mailbox <- msg\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b7a316598abe2193ec169d63ab8aa71", "score": "0.5174421", "text": "func handleMessage(c *wsLink, msg *msgjson.Message) *msgjson.Error {\n\tswitch msg.Type {\n\tcase msgjson.Request:\n\t\tif msg.ID == 0 {\n\t\t\treturn msgjson.NewError(msgjson.RPCParseError, \"request id cannot be zero\")\n\t\t}\n\t\t// Look for a registered route handler.\n\t\thandler := RouteHandler(msg.Route)\n\t\tif handler != nil {\n\t\t\t// Handle the request.\n\t\t\treturn handler(c, msg)\n\t\t}\n\n\t\t// Look for an HTTP handler.\n\t\thttpHandler := httpRoutes[msg.Route]\n\t\tif httpHandler == nil {\n\t\t\treturn msgjson.NewError(msgjson.RPCUnknownRoute, \"unknown route\")\n\t\t}\n\n\t\t// If it's not a critical route, check the rate limiters.\n\t\tif !criticalRoutes[msg.Route] {\n\t\t\tif _, err := c.meter(); err != nil {\n\t\t\t\t// These errors are actually formatted nicely for sending, since\n\t\t\t\t// they are used directly in HTTP errors as well.\n\t\t\t\treturn msgjson.NewError(msgjson.RouteUnavailableError, err.Error())\n\t\t\t}\n\t\t}\n\n\t\t// Prepare the thing and unmarshal.\n\t\tvar thing interface{}\n\t\tswitch msg.Route {\n\t\tcase msgjson.CandlesRoute:\n\t\t\tthing = new(msgjson.CandlesRequest)\n\t\tcase msgjson.OrderBookRoute:\n\t\t\tthing = new(msgjson.OrderBookSubscription)\n\t\t}\n\t\tif thing != nil {\n\t\t\terr := msg.Unmarshal(thing)\n\t\t\tif err != nil {\n\t\t\t\treturn msgjson.NewError(msgjson.RPCParseError, \"json parse error\")\n\t\t\t}\n\t\t}\n\n\t\t// Process request.\n\t\tresp, err := httpHandler(thing)\n\t\tif err != nil {\n\t\t\treturn msgjson.NewError(msgjson.HTTPRouteError, err.Error())\n\t\t}\n\n\t\t// Respond.\n\t\tmsg, err := msgjson.NewResponse(msg.ID, resp, nil)\n\t\tif err == nil {\n\t\t\terr = c.Send(msg)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error sending response to %s for requested route %q: %v\", c.Addr(), msg.Route, err)\n\t\t}\n\t\treturn nil\n\n\tcase msgjson.Response:\n\t\t// NOTE: In the event of an error, we respond to a response, which makes\n\t\t// no sense. A new mechanism is needed with appropriate client handling.\n\t\tif msg.ID == 0 {\n\t\t\treturn msgjson.NewError(msgjson.RPCParseError, \"response id cannot be 0\")\n\t\t}\n\t\tcb := c.respHandler(msg.ID)\n\t\tif cb == nil {\n\t\t\tlog.Debugf(\"comms.handleMessage: handler for msg ID %d not found\", msg.ID)\n\t\t\treturn msgjson.NewError(msgjson.UnknownResponseID,\n\t\t\t\t\"unknown response ID\")\n\t\t}\n\t\tcb.f(c, msg)\n\t\treturn nil\n\t}\n\treturn msgjson.NewError(msgjson.UnknownMessageType, \"unknown message type\")\n}", "title": "" }, { "docid": "4fb51ec1daf20de8958d03baa61205b4", "score": "0.51742566", "text": "func (e *Elastic) HandleMessage(msg *gelf.Message) {\n\te.mutexHandleMessage.Lock()\n\tdefer e.mutexHandleMessage.Unlock()\n\n\te.messages = append(e.messages, storage.NewMessageFromGelf(msg))\n}", "title": "" }, { "docid": "89be2d2c8a35bde6acf75e9037e04980", "score": "0.51719856", "text": "func (s *userServer) DispatchCommand(ctx context.Context, cmd *proto.DispatchCommandRequest) (*empty.Empty, error) {\n\tout := make(chan error)\n\tdefer close(out)\n\n\tgo func() {\n\t\tc, err := buildDomainCommand(ctx, cmd)\n\t\tif err != nil {\n\t\t\tout <- err\n\t\t\treturn\n\t\t}\n\n\t\ts.commandBus.Publish(ctx, fmt.Sprintf(\"%T\", c), c, out)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn new(empty.Empty), ctx.Err()\n\tcase err := <-out:\n\t\treturn new(empty.Empty), err\n\t}\n}", "title": "" }, { "docid": "f337996e698bf3ac2bb0b991fb31cd50", "score": "0.51478523", "text": "func (s *InMemoryState) dispatchEvent(filesystem string, e *types.Event, requestId string) (chan *types.Event, error) {\n\tfs, err := s.InitFilesystemMachine(filesystem)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fs.Submit(e, requestId)\n}", "title": "" }, { "docid": "1a37e2996c18b1d1686b065dd06e588e", "score": "0.5136584", "text": "func (cm *connectionManager) dispatch() {\n\tticker := time.NewTicker(cmDispatcherLoopMsec * time.Millisecond)\n\tbatch := make([]interface{}, 0)\n\tfor {\n\t\t<-ticker.C\n\t\t// Shutting down? Stop delivering and just leave\n\t\tif atomic.LoadInt32(&cm.exiting) != 0 {\n\t\t\tticker.Stop()\n\t\t\tbreak\n\t\t}\n\t\t// Copy entire queue, deliver everything in one fell swoop\n\t\t// Hold lock only for this copy\n\t\tfunc() {\n\t\t\tcm.qmu.Lock()\n\t\t\tdefer cm.qmu.Unlock()\n\t\t\tfor _, x := range cm.queue {\n\t\t\t\tbatch = append(batch, x)\n\t\t\t}\n\t\t\tcm.queue = cm.queue[:0]\n\t\t}()\n\t\t// Perform each item\n\t\tfor _, itm := range batch {\n\t\t\tswitch v := itm.(type) {\n\t\t\tcase *changeToBroadcast:\n\t\t\t\tcm.doBroadcast(v)\n\t\t\tcase map[string]bool:\n\t\t\t\tcm.doTerminateSessions(v)\n\t\t\tdefault:\n\t\t\t\tpanic(\"Unexpected type in message queue\")\n\t\t\t}\n\t\t}\n\t\t// Clear batch slice\n\t\tbatch = batch[:0]\n\t}\n\tcm.wgShutdown.Done()\n}", "title": "" }, { "docid": "747e1c127b9fd3096f87b12a189ba303", "score": "0.51344043", "text": "func (m *Notify) HandleMessage(msg *nsq.Message) error {\n\tvar notifyMsg map[string]string\n\tvar err error\n\tif err = json.Unmarshal([]byte(msg.Body), &notifyMsg); err == nil {\n\t\tmessage := &metrictools.Message{\n\t\t\tBody: notifyMsg,\n\t\t\tErrorChannel: make(chan error),\n\t\t}\n\t\tm.msgChannel <- message\n\t\treturn <-message.ErrorChannel\n\t}\n\tlog.Println(err)\n\treturn nil\n}", "title": "" }, { "docid": "0b4714df36b08a389e8b45e3949ab5e7", "score": "0.513243", "text": "func (m *MessengerIntegration) ProcessMessage(message *MessagingItem, errChan chan error) {\n\n\t// Panic recovery\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(Red(\"FB PANIC: \"), Red(r))\n\t\t\tfmt.Println(Red(string(debug.Stack())))\n\n\t\t\terrChan <- fmt.Errorf(\"%v\", r)\n\t\t}\n\t}()\n\n\t// Request processing\n\tinputCtx := gbl.InputContext{\n\t\tRawRequest: message,\n\t\tIntegration: m,\n\t\tResponse: &MBResponse{},\n\t}\n\n\tm.Bot.Execute(&inputCtx)\n\n\terrChan <- nil\n}", "title": "" }, { "docid": "e3e450ddb41c9a4e8cc8660ded2f96de", "score": "0.5127896", "text": "func PublishMessage(w http.ResponseWriter, r *http.Request) {\n\t// Read the request body.\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Printf(\"ioutil.ReadAll: %v\", err)\n\t\thttp.Error(w, \"Error reading request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Parse the request body to get the topic name.\n\tp := publishRequest{}\n\tif err := json.Unmarshal(data, &p); err != nil {\n\t\tlog.Printf(\"json.Unmarshal: %v\", err)\n\t\thttp.Error(w, \"Error parsing request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tm := &pubsub.Message{\n\t\tData: []byte(\"Test message\"),\n\t}\n\t// Publish and Get use r.Context() because they are only needed for this\n\t// function invocation. If this were a background function, they would use\n\t// the ctx passed as an argument.\n\tid, err := client.Topic(p.Topic).Publish(r.Context(), m).Get(r.Context())\n\tif err != nil {\n\t\tlog.Printf(\"topic(%s).Publish.Get: %v\", p.Topic, err)\n\t\thttp.Error(w, \"Error publishing message\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfmt.Fprintf(w, \"Published msg: %v\", id)\n}", "title": "" }, { "docid": "c6053b2c86fb771950dc611c25285f6c", "score": "0.5122542", "text": "func (msgDisp *MessageDispatcher) Register(h func(*xuper_p2p.XuperMessage)) {\n\tmsgDisp.handle = h\n}", "title": "" }, { "docid": "d56b5160364bdd5781d3daf373040412", "score": "0.51182973", "text": "func (c *commander) dispatcher() {\n\tfor {\n\t\tc.mutex.Lock()\n\t\tif c.queue.Len() != 0 {\n\t\t\tuw := unwrap(c.queue.Front().Value)\n\t\t\tif c.settings&(1<<LOG_OUT) != 0 {\n\t\t\t\tfmt.Fprintf(c.log, \"Dispatch\\t%v\\n\", uw)\n\t\t\t}\n\t\t\tc.queue.Remove(c.queue.Front())\n\t\t\tc.mutex.Unlock()\n\t\t\tc.dispatch_chan <- uw\n\t\t} else {\n\t\t\tc.mutex.Unlock()\n time.Sleep(PAUSE * time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "376e352d932f2541029e27b5850b73bc", "score": "0.5106591", "text": "func (d *Dispatcher) Dispatch(evname string, ev interface{}) int {\r\n\r\n\t// Get list of subscribers for this event\r\n\tsubs := d.evmap[evname]\r\n\tnsubs := len(subs)\r\n\tif nsubs == 0 {\r\n\t\treturn 0\r\n\t}\r\n\r\n\t// Dispatch event to all subscribers\r\n\tfor _, s := range subs {\r\n\t\ts.cb(evname, ev)\r\n\t}\r\n\treturn nsubs\r\n}", "title": "" }, { "docid": "ed7802237624299f66302b33d519796c", "score": "0.5105044", "text": "func dispatch(chatServer chat.Server, mailServer mail.Server, fwdMappings []fwdMapping) error {\n\tmsgC, errC, err := chatServer.Listen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tlogger.Info(\"observe chat for messages to forward\")\n\t\tselect {\n\t\tcase msg := <-msgC:\n\n\t\t\tif mappings, content, found := findFwdMappings(msg.Content, fwdMappings); found {\n\t\t\t\tlogger.Infof(\"%d marker found - chat-msg from: %s, in channel: %s - forward to each recipient\",\n\t\t\t\t\tlen(mappings), msg.UserName, msg.ChannelName)\n\n\t\t\t\tfor _, m := range mappings {\n\t\t\t\t\tlogger.Infof(\"forward message with marker: '%s' to %s\", m.marker, m.mailAddr)\n\n\t\t\t\t\t// send the mail\n\t\t\t\t\tif err = mailServer.Send(composeMessage(&msg, content, m.mailAddr), *mailUseTLS); err != nil {\n\t\t\t\t\t\tlogger.Errorf(\"unable to send mail - notify user in chat - mail error: %s\", err.Error())\n\t\t\t\t\t\tif err = chatServer.Send(&chat.Message{\n\t\t\t\t\t\t\tReplyToID: msg.ID,\n\t\t\t\t\t\t\tChannelID: msg.ChannelID,\n\t\t\t\t\t\t\tChannelName: msg.ChannelName,\n\t\t\t\t\t\t\tContent: \"matterbot error: \" + err.Error(),\n\t\t\t\t\t\t}); err != nil {\n\t\t\t\t\t\t\tlogger.Errorf(\"unable to notify user about mail error - i give up - sorry! - chat error: %s\",\n\t\t\t\t\t\t\t\terr.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.Debugf(\"mail to %s delivered\", m.mailAddr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogger.Debugf(\"ignore message from: '%s' - didn't contain any configured marker\", msg.UserName)\n\t\t\t}\n\t\tcase chatErr := <-errC:\n\t\t\treturn chatErr\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ddf9947cbd2087ba21a3bf7c94db058", "score": "0.51025814", "text": "func (mock *ServerMock) TriggerMsgEvent(msg Message) {\n\tmock.msgC <- msg\n\n\t// give the 'dispatcher' time to react\n\ttime.Sleep(100 * time.Millisecond)\n}", "title": "" }, { "docid": "ccf519b7e985f9d0b0587b8d5e09edd8", "score": "0.5100093", "text": "func (manager *actionManager) Dispatch(action string) QueueAction {\n\treturn QueueAction{\n\t\taction: action,\n\t\tmanager: manager,\n\t}\n}", "title": "" }, { "docid": "23916eae838da469b4bdbc80b32ad897", "score": "0.50974214", "text": "func (d *Dispatcher) Dispatch(typ string, payload any) error {\n\terr := validateArguments(d, typ, nil, false)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.mx.RLock()\n\n\tif d.handlers[typ] == nil {\n\t\td.mx.RUnlock()\n\t\treturn fmt.Errorf(\"No handlers for event %q\", typ)\n\t}\n\n\td.mx.RUnlock()\n\td.mx.RLock()\n\n\tfor _, h := range d.handlers[typ] {\n\t\tgo h(payload)\n\t}\n\n\td.mx.RUnlock()\n\treturn nil\n}", "title": "" }, { "docid": "8f0f00f38f8a4b91b828f1f68998705c", "score": "0.5096167", "text": "func (b *Bot) dispatchWebhook(webhook *PluginWebhook) {\n\twh := b.GetWebhook(webhook.Name)\n\tif wh == nil {\n\t\treturn\n\t}\n\n\twh.Webhook.Channel() <- &WebhookMsg{\n\t\tBot: b,\n\t\tRequest: webhook.Request,\n\t\tResponseWriter: webhook.ResponseWriter,\n\t\tStore: b.getStore(wh.PluginId),\n\t}\n}", "title": "" } ]
b362472b64b8dab523fc8b5bdf0b8260
UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
[ { "docid": "f4d2b2dff196f90fe2d3394a21b65912", "score": "0.835961", "text": "func UpdatedAtLTE(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" } ]
[ { "docid": "bc8a473b8729e8e26f74a416f1c1c30e", "score": "0.8291871", "text": "func UpdatedAtLTE(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "27955785c8ef1accaf6e2f1e516f73c0", "score": "0.8167697", "text": "func UpdatedAtLTE(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "f03448b3624fec5e5c8fffc9b783309f", "score": "0.8128685", "text": "func UpdatedAtLTE(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "3c050cb49ab64587a803549e6ffddefb", "score": "0.8125655", "text": "func UpdatedAtLTE(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "6dfdd2ab1af09d7f8bd854971cf0d1dc", "score": "0.8041044", "text": "func UpdatedAtLTE(v time.Time) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "283b970222e0a76d37a198328ab59330", "score": "0.8035237", "text": "func UpdatedAtLTE(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "1337e4d706d10579cc0288bc09ecef38", "score": "0.80084753", "text": "func UpdatedAtLTE(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "690bec4b6b064cda4468fb3a4af6ee34", "score": "0.78964245", "text": "func UpdatedAtLTE(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "653302a712495d68901e1569464e9b41", "score": "0.7753454", "text": "func UpdatedAtLTE(v time.Time) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2fa39b88ff195551c6f08fd5cb0aefb2", "score": "0.7466779", "text": "func (qs ArticleQuerySet) UpdatedAtLte(updatedAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "29e391ab69e14ef120fb0add0fc4151d", "score": "0.7451757", "text": "func (qs PageQuerySet) UpdatedAtLte(updatedAt time.Time) PageQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "806bdc01ad261dd9e9af965a61243ed4", "score": "0.74431425", "text": "func (qs DistributionQuerySet) UpdatedAtLte(updatedAt time.Time) DistributionQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "86ca59941cae13adb23417018390d164", "score": "0.744222", "text": "func (qs ProfileQuerySet) UpdatedAtLte(updatedAt time.Time) ProfileQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "3f33817270cec4b0ac57694d84b6456a", "score": "0.73507494", "text": "func (qs WalletQuerySet) UpdatedAtLte(updatedAt time.Time) WalletQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at <= ?\", updatedAt))\n}", "title": "" }, { "docid": "0ee71b810dd5340c6062cb388e646467", "score": "0.72085416", "text": "func UpdatedAtLT(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "8cf0745622da88e2e897aa9a587768b6", "score": "0.69544524", "text": "func UpdatedAtLT(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "4e153229ed0dd4cb53e5eb6dcc16d44b", "score": "0.6884968", "text": "func UpdatedAtLT(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "90eddea74feb08e76136c2ac80b70cd3", "score": "0.6843142", "text": "func UpdatedAtLT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "af82425819c42f1101eed24360947481", "score": "0.68126386", "text": "func UpdatedAtLT(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "d2b924cf59d1f7907149b186ff6fa0c6", "score": "0.6804159", "text": "func UpdatedAtLT(v time.Time) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "c07eb27bf30913ee9953152cc27558b3", "score": "0.67999464", "text": "func UpdatedDateLTE(v time.Time) predicate.Transaction {\n\treturn predicate.Transaction(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedDate), v))\n\t})\n}", "title": "" }, { "docid": "038d995b0d44737e0353f7fb416265a5", "score": "0.67645603", "text": "func CreatedAtLTE(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "f0d89292f0d0e5545cdc34b18dbb9bfe", "score": "0.67564666", "text": "func UpdatedAtLT(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "5ddc039ae50b882c9ee4327bc2d6abed", "score": "0.6664205", "text": "func UpdatedAtLT(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "5374531a66eac13cadaab8394a95d1eb", "score": "0.66612136", "text": "func CreatedAtLTE(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "ae9072d1018cc29179d9fd2006330f38", "score": "0.6629249", "text": "func UpdatedAt(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "075df1bb7b4222588b3309f2be5b6f2f", "score": "0.6620524", "text": "func UpdatedAtGTE(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "b34f9d12a65d12124532f4e18684de8e", "score": "0.6583133", "text": "func (qs ArticleQuerySet) UpdatedAtLt(updatedAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at < ?\", updatedAt))\n}", "title": "" }, { "docid": "9a6f67fe376badb34c234b6644bb9ed8", "score": "0.65693855", "text": "func UpdatedAtGTE(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "66be3b43cc5141d4e1539ea544a7eb26", "score": "0.65332603", "text": "func UpdatedAtLT(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "1725085f2990c0c7dad2833454bfd070", "score": "0.65278655", "text": "func UpdatedAtLT(v time.Time) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "71704be700d8a2d7fb07824ba0a518b5", "score": "0.6511678", "text": "func (qs DistributionQuerySet) UpdatedAtLt(updatedAt time.Time) DistributionQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at < ?\", updatedAt))\n}", "title": "" }, { "docid": "36a827673bc991d091b1561baba60cb0", "score": "0.64660525", "text": "func UpdatedWithLTE(v string) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedWith), v))\n\t})\n}", "title": "" }, { "docid": "6a6466ab3c2238af7825a6534a1617f5", "score": "0.64559704", "text": "func (qs ProfileQuerySet) UpdatedAtLt(updatedAt time.Time) ProfileQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at < ?\", updatedAt))\n}", "title": "" }, { "docid": "d23fc381b81eabfdfb34ff5e0eb88828", "score": "0.6449278", "text": "func UpdatedAtGTE(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "11041dafc2243b5fbf4a035595c0010f", "score": "0.6442758", "text": "func DeletedAtLTE(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldDeletedAt), v))\n\t})\n}", "title": "" }, { "docid": "5eff4b75f6bdf77de0471f70bd1a6873", "score": "0.6433055", "text": "func (qs WalletQuerySet) UpdatedAtLt(updatedAt time.Time) WalletQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at < ?\", updatedAt))\n}", "title": "" }, { "docid": "464c9d7393300d4c4d2c12776d868614", "score": "0.6431329", "text": "func UpdatedAtGTE(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "c5e9b7baf9b41c3fcd7f011f254bdc38", "score": "0.64196384", "text": "func (qs PageQuerySet) UpdatedAtLt(updatedAt time.Time) PageQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at < ?\", updatedAt))\n}", "title": "" }, { "docid": "bc509b451123f55fbe1316dc52a683f7", "score": "0.6403656", "text": "func CreatedAtLTE(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "6050f94e52ed6447e5916e01ed745bd0", "score": "0.63938665", "text": "func UpdatedByLTE(v int) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdatedBy), v))\n\t})\n}", "title": "" }, { "docid": "610e5d97db427ecc7f65ea23547ef305", "score": "0.63920885", "text": "func CreatedAtLTE(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "46ffe0b57e9fc668a2b911c89742065a", "score": "0.63571066", "text": "func UpdatedAtGTE(v time.Time) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "c108418da082e2dde00bc22188625d3a", "score": "0.63531256", "text": "func UpdateTimeLTE(v time.Time) predicate.LocationType {\n\treturn predicate.LocationType(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "e922e12b7456a618901b51e28dc05383", "score": "0.6345853", "text": "func UpdatedAtGTE(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "e3527cfe4a3f3162b32d74d231e7e582", "score": "0.6344644", "text": "func CreatedAtLTE(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "b462f5f64613c54ea9607b84e0ecb967", "score": "0.63440615", "text": "func CreatedAtLTE(v time.Time) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "eccc5e366d34b9fc0a601524a56bf7dc", "score": "0.6343049", "text": "func UpdatedAtGTE(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "04aeb04882c0ccca25ef285de4e8c2ac", "score": "0.63382924", "text": "func UpdateTimeLTE(v time.Time) predicate.Entry {\n\treturn predicate.Entry(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t})\n}", "title": "" }, { "docid": "a0bc878e85926d60d88a18dc9c7e6ac9", "score": "0.63294214", "text": "func UpdatedAtGTE(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "a0f92ca4ee734f4c295510e58357bdf9", "score": "0.6300422", "text": "func UpdateDateLTE(v time.Time) predicate.Transactionfactor {\n\treturn predicate.Transactionfactor(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateDate), v))\n\t})\n}", "title": "" }, { "docid": "1f43a2eafeee986b5bdc8276475dad67", "score": "0.6268332", "text": "func CreatedAtLTE(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "c3c4f4cef985b582da1b6b36ced301b1", "score": "0.6241532", "text": "func CreatedAtLTE(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "93813a0da425ad5c1787bbd5145d10e8", "score": "0.621996", "text": "func UpdatedAt(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "d8401cd4883e9708ddc7a5208396f6b0", "score": "0.6209696", "text": "func UpdateTimeLTE(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t})\n}", "title": "" }, { "docid": "face76635b94ce87316f58e66b2414bd", "score": "0.62004715", "text": "func UpdatedAt(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "0fba8d8a08a0ffd85be2f7956a484737", "score": "0.6200062", "text": "func CreatedAtLTE(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "1f1b310936c85b5644ab440ef401b4d2", "score": "0.6183019", "text": "func UpdatedAt(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "70e0c4186434a19d6affae826c7d6427", "score": "0.61643463", "text": "func CreatedAtLTE(v time.Time) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCreatedAt), v))\n\t})\n}", "title": "" }, { "docid": "e2f49b798bb9ad0d3cdf27f74b816d53", "score": "0.6161534", "text": "func UpdatedAt(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "ff0a81ee2d72ae686aeb5b2975c5d14b", "score": "0.6161337", "text": "func UpdatedAtGT(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "689fb0e76dace46571eda7b8c8773d0e", "score": "0.60944647", "text": "func UpdateTimeLTE(v time.Time) predicate.DetectionJob {\n\treturn predicate.DetectionJob(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t})\n}", "title": "" }, { "docid": "35abbbb3f3518d9316e74c7ccac2211d", "score": "0.6083825", "text": "func UpdatedAt(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "7fd05e21b3b155bae4b83bd424b69205", "score": "0.6055938", "text": "func CreatedAtLTE(v time.Time) predicate.Task {\n\treturn predicate.Task(sql.FieldLTE(FieldCreatedAt, v))\n}", "title": "" }, { "docid": "73ca7b533898628cab3045ed890dbbaf", "score": "0.6025913", "text": "func UpdatedAt(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "da80b426deb157f547156b5f94c93135", "score": "0.6021738", "text": "func UpdatedAtGTE(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "6b48585ad866bd1d4baae35795d9534b", "score": "0.59540844", "text": "func UpdateTimeLTE(v time.Time) predicate.SurveyWiFiScan {\n\treturn predicate.SurveyWiFiScan(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUpdateTime), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "c3a5163e2703ed1451e461c0977daf87", "score": "0.5952272", "text": "func (f *EthnicityFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(ethnicity.FieldUpdatedAt))\n}", "title": "" }, { "docid": "a36499aa62caceb750ba7919714c6705", "score": "0.5931482", "text": "func UpdatedAt(v time.Time) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "df791aabf3b142b076a1273751646499", "score": "0.5911791", "text": "func (f *VehicleModelFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(vehiclemodel.FieldUpdatedAt))\n}", "title": "" }, { "docid": "a3aeb6f67fe88a397337a1957d63f652", "score": "0.5891242", "text": "func UpdatedAtGTE(v time.Time) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "03ac6012b5080df70095ca16b93a7fbd", "score": "0.5880279", "text": "func (m *HTTPDetectorResultMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "8bd7394f9f82ce9eaff663a5b3b61a4a", "score": "0.5875044", "text": "func (f *UserFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(user.FieldUpdatedAt))\n}", "title": "" }, { "docid": "727f8e87b7ef7e6955e1011e631cdbb0", "score": "0.5872007", "text": "func DeletedAtLTE(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldDeletedAt), v))\n\t})\n}", "title": "" }, { "docid": "b577aab15c61e16faf1589b6d5baffe6", "score": "0.5863109", "text": "func (m *HTTPDetectorMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "37c4d152c06196076eae084f2b3847dd", "score": "0.58597803", "text": "func UpdatedAtEQ(v time.Time) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "f9e27629e2c4a9fbf8862b73e17a1086", "score": "0.5842314", "text": "func UpdatedAtGT(v time.Time) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "39439d4c23ea710de23e232fe9022cd3", "score": "0.5836357", "text": "func (m *PingDetectorResultMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "03ebc2a5c0f7b3094df35a582d01c52e", "score": "0.5835156", "text": "func DeletedAtLTE(v *sql.NullTime) predicate.FieldType {\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.Has(Label, FieldDeletedAt, p.LTE(v))\n\t})\n}", "title": "" }, { "docid": "b325561b54f44fc172d313972da30d53", "score": "0.5800846", "text": "func (m *PingDetectorMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "b16850bd412439738f3d19c7e054df8f", "score": "0.5792134", "text": "func (qs ProfileQuerySet) CreatedAtLte(createdAt time.Time) ProfileQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at <= ?\", createdAt))\n}", "title": "" }, { "docid": "26ad2d4acfe4e21fb1b4a2f07f64b2ca", "score": "0.5785501", "text": "func (f *VehicleClassFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(vehicleclass.FieldUpdatedAt))\n}", "title": "" }, { "docid": "462c138aa2f29fc894d13fb1611eac22", "score": "0.5783314", "text": "func UpdatedAtGT(v time.Time) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "4029b6a23c1b4a01df4d21e9c44fd955", "score": "0.57785296", "text": "func UpdatedAt(v time.Time) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "2377b625ab531a24f99608f690bebd96", "score": "0.5765733", "text": "func (f *VehicleFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(vehicle.FieldUpdatedAt))\n}", "title": "" }, { "docid": "15127bb58b90b40caf549745c3263678", "score": "0.5756817", "text": "func (m *check) UpdatedAt() strfmt.DateTime {\n\treturn m.updatedAtField\n}", "title": "" }, { "docid": "e5a64de8e6a2eb0d4e047af90fc8a477", "score": "0.57478845", "text": "func UpdatedAtGT(v time.Time) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "a7423fa6ca0cc4365eaa191aa5311e49", "score": "0.57446843", "text": "func (m *Model) TouchUpdatedAt() {\n\tfbn, err := m.fieldByName(\"UpdatedAt\")\n\tif err == nil {\n\t\tfbn.Set(reflect.ValueOf(time.Now()))\n\t}\n}", "title": "" }, { "docid": "c1a6f5c98f7f6517b9a2a55c6640bbb0", "score": "0.5742978", "text": "func (f *MetadataFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(metadata.FieldUpdatedAt))\n}", "title": "" }, { "docid": "c5d4d8fef9e9d81555620c6272719d48", "score": "0.5721024", "text": "func (m *DNSDetectorMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "75faf2bb3cef000fa0dddea170ed3ec4", "score": "0.5720706", "text": "func UpdatedAtGT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "76ede5d8044d71bef3af1237340856be", "score": "0.57183695", "text": "func PinnedAtLTE(v time.Time) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldPinnedAt), v))\n\t})\n}", "title": "" }, { "docid": "f4d118c67f28f4990595be83d5aea0d5", "score": "0.57173175", "text": "func (m *TaskMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "aec78703ade40d4759e1fbf3a9d237c7", "score": "0.57127637", "text": "func UpdatedAtGT(v time.Time) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "7795fa31fa0bfa8b155215f32a704410", "score": "0.57113814", "text": "func (f *VehicleRegistrationFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(vehicleregistration.FieldUpdatedAt))\n}", "title": "" }, { "docid": "4fa44ab45995dd1a1848027272234001", "score": "0.5711082", "text": "func (f *GameServerFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(gameserver.FieldUpdatedAt))\n}", "title": "" }, { "docid": "d0b7c1d8088be390c3dab5aae9047c67", "score": "0.5709577", "text": "func (m *DNSDetectorResultMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, errors.New(\"OldUpdatedAt is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, errors.New(\"OldUpdatedAt requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldUpdatedAt: %w\", err)\n\t}\n\treturn oldValue.UpdatedAt, nil\n}", "title": "" }, { "docid": "ff1def29da0bda7b926e3b13b84bca49", "score": "0.57057965", "text": "func (f *GithubGistFilter) WhereUpdatedAt(p entql.TimeP) {\n\tf.Where(p.Field(githubgist.FieldUpdatedAt))\n}", "title": "" }, { "docid": "d1636b18adcaf8d48516ed8d8334b57c", "score": "0.5684705", "text": "func UpdatedAtGT(v time.Time) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "8025fb87d493365ef0a504aa0b8f1155", "score": "0.5659306", "text": "func (qs ArticleQuerySet) UpdatedAtGt(updatedAt time.Time) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"updated_at > ?\", updatedAt))\n}", "title": "" } ]
6d792b6b72fbbdf98248ebf72338b8a2
Value of a literal is its string value, without the datatype and langauge
[ { "docid": "9cdf9a0215808957422635749ebfdac0", "score": "0.736195", "text": "func (node *Literal) Value() string { return node.value }", "title": "" } ]
[ { "docid": "a3e0215496296cbfb9c43ed611a9b81c", "score": "0.6983297", "text": "func (sl *StringLiteral) String() string { return sl.Token.Literal }", "title": "" }, { "docid": "49946e9a8b57214ae7e3de699a4e611a", "score": "0.69696563", "text": "func (l *StringLiteral) String() string { return QuoteString(l.Val) }", "title": "" }, { "docid": "49946e9a8b57214ae7e3de699a4e611a", "score": "0.69696563", "text": "func (l *StringLiteral) String() string { return QuoteString(l.Val) }", "title": "" }, { "docid": "f355bd76b6f04849dde5035ab48927ea", "score": "0.6930888", "text": "func (node StringLiteral) Type() ExprType { return STRING }", "title": "" }, { "docid": "f0c0635626022c1fe4407858a7b75ff1", "score": "0.68939495", "text": "func (il *IntegerLiteral) String() string { return il.Token.Literal }", "title": "" }, { "docid": "f0c0635626022c1fe4407858a7b75ff1", "score": "0.68939495", "text": "func (il *IntegerLiteral) String() string { return il.Token.Literal }", "title": "" }, { "docid": "f0c0635626022c1fe4407858a7b75ff1", "score": "0.68939495", "text": "func (il *IntegerLiteral) String() string { return il.Token.Literal }", "title": "" }, { "docid": "00e51e38e2b01d89fce74adbdd62a683", "score": "0.6784433", "text": "func (b Literal) String() (s string) {\n\tif b.Kind() == '\"' && json.Unmarshal(b, &s) == nil {\n\t\treturn s\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "08dc87abf0aedc3fd4593ba0c8c4c389", "score": "0.66890186", "text": "func (parser *Parser) valueLiteral(isConstant bool) (ASTNode, error) {\n\tstart := parser.lookahead.Start\n\tswitch parser.lookahead.Type {\n\tcase LBRACK:\n\t\treturn parser.list(isConstant)\n\tcase LBRACE:\n\t\treturn parser.object(isConstant)\n\tcase INT:\n\t\ttoken := parser.lookahead\n\t\terr := parser.match(INT)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tval, err := strconv.ParseInt(token.Val, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &Int{\n\t\t\tValue: int32(val),\n\t\t\tLOC: parser.loc(start),\n\t\t}, nil\n\tcase FLOAT:\n\t\ttoken := parser.lookahead\n\t\terr := parser.match(FLOAT)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tval, err := strconv.ParseFloat(token.Val, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &Float{\n\t\t\tValue: float32(val),\n\t\t\tLOC: parser.loc(start),\n\t\t}, nil\n\tcase STRING:\n\t\ttoken := parser.lookahead\n\t\terr := parser.match(STRING)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &String{\n\t\t\tValue: token.Val,\n\t\t\tLOC: parser.loc(start),\n\t\t}, nil\n\tcase NAME:\n\t\ttoken := parser.lookahead\n\t\terr := parser.match(NAME)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif token.Val == \"true\" {\n\t\t\treturn &Boolean{\n\t\t\t\tValue: true,\n\t\t\t\tLOC: parser.loc(start),\n\t\t\t}, nil\n\t\t} else if token.Val == \"false\" {\n\t\t\treturn &Boolean{\n\t\t\t\tValue: false,\n\t\t\t\tLOC: parser.loc(start),\n\t\t\t}, nil\n\t\t}\n\t\tif token.Val == \"true\" || token.Val == \"false\" || token.Val == \"null\" {\n\t\t\treturn nil, &GraphQLError{\n\t\t\t\tMessage: fmt.Sprintf(\"GraphQL Syntax Error (%d:%d) Unexpected %s\", token.Start.Line, token.Start.Column, token.String()),\n\t\t\t\tSource: parser.source,\n\t\t\t\tStart: token.Start,\n\t\t\t\tEnd: token.End,\n\t\t\t}\n\t\t} else {\n\t\t\treturn &Enum{\n\t\t\t\tValue: token.Val,\n\t\t\t\tLOC: parser.loc(start),\n\t\t\t}, nil\n\t\t}\n\tcase DOLLAR:\n\t\tif !isConstant {\n\t\t\treturn parser.variable()\n\t\t}\n\t}\n\n\treturn nil, &GraphQLError{\n\t\tMessage: fmt.Sprintf(\"GraphQL Syntax Error (%d:%d) Unexpected %s\", parser.lookahead.Start.Line, parser.lookahead.Start.Column, parser.lookahead.String()),\n\t\tSource: parser.source,\n\t\tStart: parser.lookahead.Start,\n\t\tEnd: parser.lookahead.End,\n\t}\n\n}", "title": "" }, { "docid": "433c7ae750ed6d82b21a2d05490f7e08", "score": "0.66174644", "text": "func String(v string) Value { return Value{typ: stringType, s: v} }", "title": "" }, { "docid": "43a70a244c789d441d640cc49a816432", "score": "0.6541216", "text": "func (sl *StringLiteral) TokenLiteral() string { return sl.Token.Literal }", "title": "" }, { "docid": "43a70a244c789d441d640cc49a816432", "score": "0.6541216", "text": "func (sl *StringLiteral) TokenLiteral() string { return sl.Token.Literal }", "title": "" }, { "docid": "7d24d09bcdb9a45dee8adf3ff34341a5", "score": "0.6461227", "text": "func (stringliteral PDFStringLiteral) Value() string {\n\treturn string(stringliteral)\n}", "title": "" }, { "docid": "86fb0b5211329ff43965bb6c27b5c0ec", "score": "0.6460904", "text": "func literalToken(literal uint32) token { return token(literalType + literal) }", "title": "" }, { "docid": "bb7a97b7eacc73e3c2eaa9cbc4f06246", "score": "0.64310116", "text": "func (i *Identifier) String() string { return i.Value }", "title": "" }, { "docid": "bb7a97b7eacc73e3c2eaa9cbc4f06246", "score": "0.64310116", "text": "func (i *Identifier) String() string { return i.Value }", "title": "" }, { "docid": "bb7a97b7eacc73e3c2eaa9cbc4f06246", "score": "0.64310116", "text": "func (i *Identifier) String() string { return i.Value }", "title": "" }, { "docid": "b2204b3a0d0bc50cfc96bd2e03525d28", "score": "0.6397299", "text": "func (node *Literal) TermType() string { return LiteralType }", "title": "" }, { "docid": "fa443b955400879c8ebd3effbae1313d", "score": "0.6368961", "text": "func (node ScalarLiteral) Type() ExprType { return SCALAR }", "title": "" }, { "docid": "f1e76c65cd3ef017f9f4a4bd83788ddf", "score": "0.6363949", "text": "func (sl *StringLiteral) String() string {\n\treturn sl.Token.Literal\n}", "title": "" }, { "docid": "68edcd4b5730466997ff7e59f949a50c", "score": "0.63544595", "text": "func (*Quote) IsLiteral() bool { return true }", "title": "" }, { "docid": "f36f03597948956115cbaefc8b655dd9", "score": "0.6351463", "text": "func (il *IntegerLiteral) String() string {\n\treturn il.Token.Literal\n}", "title": "" }, { "docid": "f36f03597948956115cbaefc8b655dd9", "score": "0.6351463", "text": "func (il *IntegerLiteral) String() string {\n\treturn il.Token.Literal\n}", "title": "" }, { "docid": "f22f716679b9cd3bf0628c143f86c718", "score": "0.63381714", "text": "func Literal(lit interface{}) (ast.Node, error) {\n\ttypeOf := ast.TypeOf(lit)\n\tif typeOf == ast.InvalidType {\n\t\tif node, ok := lit.(ast.Node); ok {\n\t\t\treturn node, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"unsupported literal type %T\", lit)\n\t}\n\treturn ast.ValueToLiteralNode(&NullPosition{}, lit)\n}", "title": "" }, { "docid": "1e4bc14ef94615155692542cd3f3b098", "score": "0.6318582", "text": "func (t *Token) CharLiteralValue() string {\n\treturn string(t.Lit[1 : len(t.Lit)-1])\n}", "title": "" }, { "docid": "594ffb171ab196b3ce06d2ea2989fe68", "score": "0.63002324", "text": "func (t token) literal() uint32 { return uint32(t - literalType) }", "title": "" }, { "docid": "ff3c6d1ecae56344ac5eedebaf5661e8", "score": "0.6276484", "text": "func (i Identifier) String() string {\n\treturn i.Token.Literal\n}", "title": "" }, { "docid": "635a760eeaa88014687244cb6f16966d", "score": "0.62717074", "text": "func (i *Identifier) TokenLiteral() string { return i.Token.Literal }", "title": "" }, { "docid": "635a760eeaa88014687244cb6f16966d", "score": "0.62717074", "text": "func (i *Identifier) TokenLiteral() string { return i.Token.Literal }", "title": "" }, { "docid": "635a760eeaa88014687244cb6f16966d", "score": "0.62717074", "text": "func (i *Identifier) TokenLiteral() string { return i.Token.Literal }", "title": "" }, { "docid": "635a760eeaa88014687244cb6f16966d", "score": "0.62717074", "text": "func (i *Identifier) TokenLiteral() string { return i.Token.Literal }", "title": "" }, { "docid": "6e75256f7d55187dee155cf7556af2f0", "score": "0.6271164", "text": "func (b Literal) Kind() Kind {\n\tif len(b) == 0 {\n\t\treturn 0\n\t}\n\tswitch k := b[0]; k {\n\tcase 'n', 'f', 't', '\"':\n\t\treturn Kind(k)\n\tcase '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\treturn '0'\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "60ebbc4e91bd8dfdfe4b58715bde0cb0", "score": "0.6270078", "text": "func (liter *StringLiteral) String() string {\n\treturn fmt.Sprintf(\"\\\"%v\\\"\", liter.str)\n}", "title": "" }, { "docid": "09a42ded4182e57f4d1e24cb5935912b", "score": "0.6256689", "text": "func (liter *CharLiteral) String() string {\n\treturn fmt.Sprintf(\"'%v'\", liter.char)\n}", "title": "" }, { "docid": "80e3287d17871c5394ba9f77a20d8262", "score": "0.62560517", "text": "func TokenIsLiteral(tok token.Token,) bool", "title": "" }, { "docid": "c51ed64ed6b3a57138ccdf1096682dd9", "score": "0.6186238", "text": "func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }", "title": "" }, { "docid": "c51ed64ed6b3a57138ccdf1096682dd9", "score": "0.6186238", "text": "func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }", "title": "" }, { "docid": "c51ed64ed6b3a57138ccdf1096682dd9", "score": "0.6186238", "text": "func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }", "title": "" }, { "docid": "c51ed64ed6b3a57138ccdf1096682dd9", "score": "0.6186238", "text": "func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }", "title": "" }, { "docid": "46bf4fc4a91458569d5784793e0beed7", "score": "0.61859745", "text": "func (o *LiteralAllOf) GetValue() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Value\n}", "title": "" }, { "docid": "79f24b47cddc286ef706bea486de0bec", "score": "0.6171883", "text": "func String(x string) Const { return Const{x, nil} }", "title": "" }, { "docid": "b1fb0d50ee01ef7c0f23a48f11359d55", "score": "0.614649", "text": "func (hl *HashLiteral) TokenLiteral() string { return hl.Token.Literal }", "title": "" }, { "docid": "5d7075f65e141c12d83c320bb3d22ea5", "score": "0.61403644", "text": "func str(s string) value {\n\treturn value{typ: typeStr, s: s}\n}", "title": "" }, { "docid": "4ab94421b73c68895da5af03ce933f59", "score": "0.61290604", "text": "func (t *Token) StringValue() string {\n\treturn string(t.Lit[1 : len(t.Lit)-1])\n}", "title": "" }, { "docid": "ca2e7709be4868fe2e522af561fa72b7", "score": "0.61263704", "text": "func (fl *FloatLiteral) String() string { return fl.Token.Literal }", "title": "" }, { "docid": "26c850adb388d1d9a613297ab31d976a", "score": "0.6118406", "text": "func (a *Assignment) TokenLiteral() token.Token { return a.Token }", "title": "" }, { "docid": "b25c0303a5b4feb0c4be73dd8e1fef23", "score": "0.6116213", "text": "func (tk Token) IsLiteral() bool {\n\treturn tk == BOOL || tk == NUM || tk == STR\n}", "title": "" }, { "docid": "f24d11726374068683d892e16f226f38", "score": "0.60823596", "text": "func Literal(s string) Rx {\n\treturn literalForm{\n\t\tliteral: s,\n\t}\n}", "title": "" }, { "docid": "78db3db6aa1bd5480e5acba4c782187e", "score": "0.60791653", "text": "func String(v string) Literal {\n\t// Format according to RFC 8785, section 3.2.2.2.\n\tb := make([]byte, 0, len(`\"`)+len(v)+len(`\"`))\n\tb = append(b, '\"')\n\tvar arr [utf8.UTFMax]byte\n\tfor _, r := range v {\n\t\tswitch {\n\t\tcase r < ' ' || r == '\\\\' || r == '\"':\n\t\t\tswitch r {\n\t\t\tcase '\\b':\n\t\t\t\tb = append(b, `\\b`...)\n\t\t\tcase '\\t':\n\t\t\t\tb = append(b, `\\t`...)\n\t\t\tcase '\\n':\n\t\t\t\tb = append(b, `\\n`...)\n\t\t\tcase '\\f':\n\t\t\t\tb = append(b, `\\f`...)\n\t\t\tcase '\\r':\n\t\t\t\tb = append(b, `\\r`...)\n\t\t\tcase '\\\\':\n\t\t\t\tb = append(b, `\\\\`...)\n\t\t\tcase '\"':\n\t\t\t\tb = append(b, `\\\"`...)\n\t\t\tdefault:\n\t\t\t\tb = append(b, fmt.Sprintf(`\\u%04x`, r)...)\n\t\t\t}\n\t\tdefault:\n\t\t\tb = append(b, arr[:utf8.EncodeRune(arr[:], r)]...)\n\t\t}\n\t}\n\tb = append(b, '\"')\n\treturn Literal(b)\n}", "title": "" }, { "docid": "c38453dbe1f138e0467c38750cc35697", "score": "0.60748917", "text": "func (l *IntegerLiteral) String() string { return fmt.Sprintf(\"%d\", l.Val) }", "title": "" }, { "docid": "c38453dbe1f138e0467c38750cc35697", "score": "0.60748917", "text": "func (l *IntegerLiteral) String() string { return fmt.Sprintf(\"%d\", l.Val) }", "title": "" }, { "docid": "5aae2527f70e30963b29bbf1c3837887", "score": "0.6071875", "text": "func (x ByValType) Value() string { return x.Val }", "title": "" }, { "docid": "4f16ee9bc7c48c48c7a9e694f7f5d64b", "score": "0.6053898", "text": "func TypeLiteral(ast TypeAst) string {\n\ttokens := (&typeScriptTypeUnparser{}).unparse(ast)\n\treturn toLiteral(tokens)\n}", "title": "" }, { "docid": "1b0493f0bd0e9b22e1011239896cde46", "score": "0.60507154", "text": "func (i Integer) String() string {\n\treturn i.Token.Literal\n}", "title": "" }, { "docid": "e25106161c9fc27a7beba56f31abb14b", "score": "0.6044685", "text": "func (b *Boolean) TokenLiteral() string { return b.Token.Literal }", "title": "" }, { "docid": "e25106161c9fc27a7beba56f31abb14b", "score": "0.6044685", "text": "func (b *Boolean) TokenLiteral() string { return b.Token.Literal }", "title": "" }, { "docid": "004e4d821ce181914cd20711aed6484c", "score": "0.603407", "text": "func NewLiteral(value string, language string, datatype *NamedNode) *Literal {\n\treturn &Literal{value, language, datatype}\n}", "title": "" }, { "docid": "9109f04cff84acdb882e8e0d362175b0", "score": "0.6022258", "text": "func A(atom string) String {\n\treturn String{Value: atom, ErlangType: StringTypeAtom}\n}", "title": "" }, { "docid": "6525bc57132740fe87a8806fefd2f940", "score": "0.6014899", "text": "func (node *Literal) Language() string { return node.language }", "title": "" }, { "docid": "023d3ae27a6a365801f1f70b629629f4", "score": "0.6008973", "text": "func (b *Boolean) String() string { return b.Token.Literal }", "title": "" }, { "docid": "023d3ae27a6a365801f1f70b629629f4", "score": "0.6008973", "text": "func (b *Boolean) String() string { return b.Token.Literal }", "title": "" }, { "docid": "b76d1a26d858ba27fb07ce33be79e816", "score": "0.6006358", "text": "func (t Token) String() string {\n\treturn fmt.Sprintf(`Type: [%s] | Literal: '%s'`, t.Type, t.Literal)\n}", "title": "" }, { "docid": "c4a14230186981568e3a0c89dadd1ce5", "score": "0.6004316", "text": "func (sv *StringLiteral) Eval(*EvalContext) (Value, error) {\n\treturn &StringValue{\n\t\tVal: sv.Str,\n\t}, nil\n}", "title": "" }, { "docid": "f98ef47496fd5a6caf0c7b19e55b5275", "score": "0.6000992", "text": "func isLiteralEquality(expr string) (ok bool, lit string, err error) {\n\tr, err := syntax.Parse(expr, syntax.Perl)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\t// Want a Concat of size 3 which is [Begin, Literal, End]\n\tif r.Op != syntax.OpConcat || len(r.Sub) != 3 || // size 3 concat\n\t\t!(r.Sub[0].Op == syntax.OpBeginLine || r.Sub[0].Op == syntax.OpBeginText) || // Starts with ^\n\t\t!(r.Sub[2].Op == syntax.OpEndLine || r.Sub[2].Op == syntax.OpEndText) || // Ends with $\n\t\tr.Sub[1].Op != syntax.OpLiteral { // is a literal\n\t\treturn false, \"\", nil\n\t}\n\treturn true, string(r.Sub[1].Rune), nil\n}", "title": "" }, { "docid": "5efd2b653cc50d26f93434f6c2dd13cf", "score": "0.5993925", "text": "func newLiteral(data []byte) core.Code {\n\treturn &Literal{Value: data}\n}", "title": "" }, { "docid": "452a518165f4d62548e7c6b2a9aa53ba", "score": "0.5976593", "text": "func (fl *FunctionLiteral) TokenLiteral() string { return fl.Token.Literal }", "title": "" }, { "docid": "452a518165f4d62548e7c6b2a9aa53ba", "score": "0.5976593", "text": "func (fl *FunctionLiteral) TokenLiteral() string { return fl.Token.Literal }", "title": "" }, { "docid": "452a518165f4d62548e7c6b2a9aa53ba", "score": "0.5976593", "text": "func (fl *FunctionLiteral) TokenLiteral() string { return fl.Token.Literal }", "title": "" }, { "docid": "95e20dfd243020795d86a8a199356ad2", "score": "0.5968634", "text": "func (sl *StringLiteral) expressionNode() {}", "title": "" }, { "docid": "58bb1988b6be7e36d299b6559d690941", "score": "0.59493285", "text": "func (liter *IntLiteral) String() string {\n\treturn fmt.Sprint(liter.value)\n}", "title": "" }, { "docid": "a4f1670aee22a64edbbc57f9b21b69b9", "score": "0.59454465", "text": "func (ce *CallExpression) TokenLiteral() string { return ce.Token.Literal }", "title": "" }, { "docid": "a4f1670aee22a64edbbc57f9b21b69b9", "score": "0.59454465", "text": "func (ce *CallExpression) TokenLiteral() string { return ce.Token.Literal }", "title": "" }, { "docid": "a4f1670aee22a64edbbc57f9b21b69b9", "score": "0.59454465", "text": "func (ce *CallExpression) TokenLiteral() string { return ce.Token.Literal }", "title": "" }, { "docid": "2a3e0647a291d2b75894ff01e878e63d", "score": "0.59392333", "text": "func stringLit(n ast.StringLit) string {\n\ttext := n.Text()\n\ts := enc.Unquote(text)\n\treturn string(s)\n}", "title": "" }, { "docid": "6f23587412a7892b3272f9766431ed6c", "score": "0.59382844", "text": "func (t Type) Literal() bool { return literalBegin < t && t < literalEnd }", "title": "" }, { "docid": "f727857968953dc9006ebac020f14256", "score": "0.59285986", "text": "func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }", "title": "" }, { "docid": "f727857968953dc9006ebac020f14256", "score": "0.59285986", "text": "func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }", "title": "" }, { "docid": "f727857968953dc9006ebac020f14256", "score": "0.59285986", "text": "func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }", "title": "" }, { "docid": "03baaead05ae7eaa8c47dd283189a8ab", "score": "0.59249854", "text": "func (es *ExpressionStatement) TokenLiteral() string { return es.Token.Literal }", "title": "" }, { "docid": "03baaead05ae7eaa8c47dd283189a8ab", "score": "0.59249854", "text": "func (es *ExpressionStatement) TokenLiteral() string { return es.Token.Literal }", "title": "" }, { "docid": "03baaead05ae7eaa8c47dd283189a8ab", "score": "0.59249854", "text": "func (es *ExpressionStatement) TokenLiteral() string { return es.Token.Literal }", "title": "" }, { "docid": "37c9c25f47081960679ba8c8287f8047", "score": "0.59179956", "text": "func (c *completer) basicLiteral(T types.Type, snip *snippet.Builder, typeName string, matchScore float64, edits []protocol.TextEdit) {\n\t// Never give type conversions like \"untyped int()\".\n\tif isUntyped(T) {\n\t\treturn\n\t}\n\n\tsnip.WriteText(\"(\")\n\tsnip.WriteFinalTabstop()\n\tsnip.WriteText(\")\")\n\n\tnonSnippet := typeName + \"()\"\n\n\tc.items = append(c.items, CompletionItem{\n\t\tLabel: nonSnippet,\n\t\tInsertText: nonSnippet,\n\t\tDetail: T.String(),\n\t\tScore: matchScore * literalCandidateScore,\n\t\tKind: protocol.VariableCompletion,\n\t\tAdditionalTextEdits: edits,\n\t\tsnippet: snip,\n\t})\n}", "title": "" }, { "docid": "b5854305265d128cbde5add4ff3c72d3", "score": "0.5914659", "text": "func (e *stringExpr) asConstant(v *validator) (value string, ok bool) {\n\tif e.Literal != nil {\n\t\tliteral, err := unescapeStringLiteral(*e.Literal)\n\t\tif err != nil {\n\t\t\tv.reportError(err)\n\t\t\treturn \"\", true\n\t\t}\n\t\treturn literal, true\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "0c87050147e15b74438b6e8cb3202c48", "score": "0.5900815", "text": "func (sl *StringLiteral) TokenLiteral() string {\n\treturn sl.Token.Literal\n}", "title": "" }, { "docid": "063e3a169cd46f0d9db8d3709dcde3d1", "score": "0.59006554", "text": "func (an *ArithmeticNode) Literal() string {\n\treturn an.Token.Literal\n}", "title": "" }, { "docid": "f5a02e988b4f708a555859e43cd9d4e3", "score": "0.5898039", "text": "func (d *Decoder) parseLiteralValue() (Token, bool) {\n\tsize := parseIdent(d.in, true)\n\tif size == 0 {\n\t\treturn Token{}, false\n\t}\n\treturn d.consumeToken(Scalar, size, literalValue), true\n}", "title": "" }, { "docid": "365768af27a37f94a35eeea45f2e4a9e", "score": "0.58940834", "text": "func mapLiteralType(literal string) (goType string, err error) {\n\tswitch literal {\n\tcase \"http://www.w3.org/2001/XMLSchema#time\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#dateTime\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#date\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#duration\":\n\t\tgoType = \"time.Duration\"\n\tcase \"http://www.w3.org/2001/XMLSchema#dateTimeStamp\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#gYear\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#gDay\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#gYearMonth\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#gMonth\":\n\t\tgoType = \"time.Time\"\n\tcase \"http://www.w3.org/2001/XMLSchema#string\":\n\t\tgoType = \"string\"\n\tcase \"http://www.w3.org/2001/XMLSchema#float\":\n\t\tgoType = \"float64\"\n\tcase \"http://www.w3.org/2001/XMLSchema#decimal\":\n\t\tgoType = \"float64\"\n\tcase \"http://www.w3.org/2001/XMLSchema#integer\":\n\t\tgoType = \"int\"\n\tcase \"http://www.w3.org/2001/XMLSchema#nonNegativeInteger\":\n\t\tgoType = \"int\"\n\tcase \"http://www.w3.org/2001/XMLSchema#unsignedInt\":\n\t\tgoType = \"int\"\n\tcase \"http://www.w3.org/2001/XMLSchema#boolean\":\n\t\tgoType = \"bool\"\n\tdefault:\n\t\terr = errors.New(\"Unknown literal\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "3cf55afaffbee6d64e2f67951c5037c5", "score": "0.5891686", "text": "func (e *exprHelper) LiteralString(value string) *exprpb.Expr {\n\treturn e.parserHelper.newLiteralString(e.nextMacroID(), value)\n}", "title": "" }, { "docid": "d0ac7f8691e66b369dabf6f47373b479", "score": "0.5882148", "text": "func (al *ArrayLiteral) TokenLiteral() string { return al.Token.Literal }", "title": "" }, { "docid": "d0ac7f8691e66b369dabf6f47373b479", "score": "0.5882148", "text": "func (al *ArrayLiteral) TokenLiteral() string { return al.Token.Literal }", "title": "" }, { "docid": "d0ac7f8691e66b369dabf6f47373b479", "score": "0.5882148", "text": "func (al *ArrayLiteral) TokenLiteral() string { return al.Token.Literal }", "title": "" }, { "docid": "8a1bdb6fffebf7cce8f540030ca31680", "score": "0.5876545", "text": "func (i *Identifier) String() string {\n\treturn i.Value\n}", "title": "" }, { "docid": "8a1bdb6fffebf7cce8f540030ca31680", "score": "0.5876545", "text": "func (i *Identifier) String() string {\n\treturn i.Value\n}", "title": "" }, { "docid": "8a1bdb6fffebf7cce8f540030ca31680", "score": "0.5876545", "text": "func (i *Identifier) String() string {\n\treturn i.Value\n}", "title": "" }, { "docid": "1b0dd668e55d8b5f5dff021da7989688", "score": "0.58653235", "text": "func (me TxsdLiterallayoutClass) String() string { return xsdt.Token(me).String() }", "title": "" }, { "docid": "cb3cd53d7b9b0bdfbbda1a9cfb256756", "score": "0.5836708", "text": "func String(v string) StringValue {\n\treturn &v\n}", "title": "" }, { "docid": "c5472364e4b10f070afc1a9ca502f07e", "score": "0.58285856", "text": "func (l *nilLiteral) String() string { return `nil` }", "title": "" }, { "docid": "bd6c1c3676fc8a857a2ed5bcd723c6a2", "score": "0.5827921", "text": "func literal(s string) *regexp.Regexp {\n\tregx := match(regexp.QuoteMeta(s))\n\n\tif _, complete := regx.LiteralPrefix(); !complete {\n\t\tpanic(\"must be a literal\")\n\t}\n\n\treturn regx\n}", "title": "" }, { "docid": "8364253387008981b02cea1acb97942a", "score": "0.58252716", "text": "func (b *BooleanLiteral) TokenLiteral() string { return b.Token.Literal }", "title": "" }, { "docid": "650831efced0b2b2887e2b617c344c89", "score": "0.58202463", "text": "func literal(s string) *regexp.Regexp {\n\tre := match(regexp.QuoteMeta(s))\n\n\tif _, complete := re.LiteralPrefix(); !complete {\n\t\tpanic(\"must be a literal\")\n\t}\n\n\treturn re\n}", "title": "" } ]
9b1e8004c815d14dd00db0f9dbb79e19
testIndex tests Index, assuming that the vector contains begin...int1.
[ { "docid": "269212ce3c1d32661e7383d3bd7a1d2e", "score": "0.77518094", "text": "func testIndex(t *testing.T, v Vector, begin, end int) {\n\tn := v.Len()\n\tfor i := 0; i < n; i++ {\n\t\telem, _ := v.Index(i)\n\t\tif elem != i {\n\t\t\tt.Errorf(\"v.Index(%v) == %v, want %v\", i, elem, i)\n\t\t}\n\t}\n\tfor _, i := range []int{-2, -1, n, n + 1, n * 2} {\n\t\tif elem, _ := v.Index(i); elem != nil {\n\t\t\tt.Errorf(\"v.Index(%d) == %v, want nil\", i, elem)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "1cf2dfac34616fffb3ca3ad38311195a", "score": "0.64759934", "text": "func testIndexOfIntSlice(a [][]int, target []int) int {\n\tfor i, v := range a {\n\t\t// different lengths\n\t\tif len(v) != len(target) {\n\t\t\treturn -1\n\t\t}\n\t\t// equal values\n\t\tfor j := 0; j < len(v); j++ {\n\t\t\tif target[j] == v[j] {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "c3afc8620dbbdaada59fe3dba80c5e0e", "score": "0.64243054", "text": "func TestSliceIndexes(t *testing.T) {\n\tvec := NewIntVector(inputSlice(0, 1000)...)\n\tslice := vec.Slice(0, 10)\n\tassertEqual(t, 1000, vec.Len())\n\tassertEqual(t, 10, slice.Len())\n\tassertEqual(t, 0, slice.Get(0))\n\tassertEqual(t, 9, slice.Get(9))\n\n\t// Slice of slice\n\tslice2 := slice.Slice(3, 7)\n\tassertEqual(t, 10, slice.Len())\n\tassertEqual(t, 4, slice2.Len())\n\tassertEqual(t, 3, slice2.Get(0))\n\tassertEqual(t, 6, slice2.Get(3))\n}", "title": "" }, { "docid": "e5204040817f43f4b9755bf863958daa", "score": "0.5852373", "text": "func IndexIn(min, max int, pred func(i int) bool) int {\n\tfor i := min; i < max; i++ {\n\t\tif pred(i) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "75eecf3085775a45aa7befdabdf728f9", "score": "0.58054626", "text": "func IntIndex(n int, a []int) int {\n\tfor i, v := range a {\n\t\tif n == v {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "063546f91d3a9524eec13c7bea40ee2a", "score": "0.5748956", "text": "func testIndexOfStrings(a []string, target string) int {\n\tfor i, v := range a {\n\t\tif v == target {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "feb9aa5adb6faa3da42b4ea824b81e36", "score": "0.5644005", "text": "func main() {\n\tfmt.Println(targetIndices([]int{1, 2, 5, 2, 3}, 2))\n}", "title": "" }, { "docid": "541b500bb78a3e8247a96f9496dac883", "score": "0.5548975", "text": "func isValidIndex(slice []uint8, index int) bool {\n\treturn index >= 0 && index < len(slice)\n}", "title": "" }, { "docid": "4dd8aed34db6b4d27b629f83ec0aef46", "score": "0.55317175", "text": "func (ss *Slice) index(i int) (int, int) {\n\treturn i >> ss.shift, i & ss.segLen\n}", "title": "" }, { "docid": "7c540c91eda223cb7538c09a1c1fec3b", "score": "0.5482751", "text": "func Index(vs []string, t string) int {\n\tfor i, v := range vs {\n\t\tif v == t {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "de6a02ad0300104610eb7353c03257b4", "score": "0.546684", "text": "func (s *Span) ContainsIndex(i int64) bool {\n\treturn s.start <= i && i < s.end\n}", "title": "" }, { "docid": "c702fa1563690c9942ac909967693c55", "score": "0.5438779", "text": "func Index(slice []interface{}, x interface{}) int {\n\tindex := -1\n\t// 返回最终索引\n\tfor i:=0; i<len(slice); i++ {\n\t\tif slice[i] == x {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn index\n}", "title": "" }, { "docid": "08487afc6e29c3227054edce95044009", "score": "0.54219556", "text": "func (i *Int32) IndexOf(ints []int32, e int32, fromIndex ...int32) int32 {\n\tvar start int32\n\tvar n = int32(len(ints))\n\n\tfor _, id := range fromIndex {\n\t\tstart = id\n\t}\n\n\tstart = i.Min(start, n)\n\tif start < 0 {\n\t\tstart = i.Max(n+start, 0)\n\t}\n\n\tfor i := start; i < n; i++ {\n\t\tif e == ints[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "13064df6ffa05df60d9b10d2fd7f76f9", "score": "0.54086614", "text": "func (v *Vector[T]) withinRange(index int) bool {\n\treturn index >= 0 && index < v.elementCount\n}", "title": "" }, { "docid": "e5af8047d3f95ff4071bcaadaf86f269", "score": "0.5401", "text": "func (bs *bitset) test(idx int) bool {\n\treturn (*bs)[idx/32]&(1<<(idx%32)) != 0\n}", "title": "" }, { "docid": "d299f3d3365b71cd944e19c990d3b5c9", "score": "0.53988296", "text": "func (t *Trace) indexIn(v int64, min, max int) int {\n\tif max < min {\n\t\treturn min\n\t}\n\tmid := (min + max) / 2\n\tmidValue := *t.Child[mid].Start\n\n\tif midValue > v {\n\t\treturn t.indexIn(v, min, mid-1)\n\t} else if midValue < v {\n\t\treturn t.indexIn(v, mid+1, max)\n\t} else {\n\t\treturn mid\n\t}\n}", "title": "" }, { "docid": "9501ee5b7c0710fa80e5a079118a0ddd", "score": "0.53884596", "text": "func (s *Slice) trueIndex(start, length int) int {\n\treturn (start + length) % s.cap\n}", "title": "" }, { "docid": "66bf7c78a0c839906951be3cad731d11", "score": "0.5384631", "text": "func (vs Vs) IntAt(index int) int {\n\tif len(vs) > index {\n\t\tif v, ok := vs[index].(int); ok {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "bf7c51efcde0377d95e4c7a2f9c5eb58", "score": "0.5352233", "text": "func index[T comparable](vs []T, t T) int {\n\tfor i, v := range vs {\n\t\tif v == t {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "c3abaa323dde65bbf83dd9d7b59d5465", "score": "0.5308953", "text": "func IndexInt(s int, list []int) int {\n\tfor i, b := range list {\n\t\tif b == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "f01368fea7bcdb3c6362d422569a01af", "score": "0.53038514", "text": "func (m *MockAssertion) index(uri, method string) int {\n\tif isZero(m.indexes) {\n\t\tm.indexes = make(map[string]int)\n\t}\n\n\tk := strings.ToLower(uri + method)\n\n\tif i, ok := m.indexes[k]; ok {\n\t\treturn i\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "7e832caa03a2a7fd990489adf05786db", "score": "0.5278538", "text": "func (ic IdxConverter) Index(idx []int) int {\n\tn := 0\n\tfor i := range ic {\n\t\tn += ic[i] * idx[i]\n\t}\n\treturn n\n}", "title": "" }, { "docid": "65c22aef506c22a004cc3bc38324f17a", "score": "0.52767175", "text": "func testSearch(t *testing.T, searchFunc func([]int, int) (int, error), iters int, length int, sorted bool) {\n\tfor i := 0; i < iters; i++ {\n\t\tseed := time.Now().UnixNano()\n\t\tsource := rand.NewSource(seed)\n\t\trandom := rand.New(source)\n\n\t\ttarget := random.Int()\n\n\t\t// Create our first slice, which will include our target value.\n\t\tlist := make([]int, length)\n\t\tfor i := 0; i < length; i++ {\n\t\t\tlist[i] = random.Int()\n\t\t}\n\t\tindex := int(random.Int31n(int32(length)))\n\t\tlist[index] = target\n\t\tif sorted {\n\t\t\t// Sort the list and find our new target index.\n\t\t\tsort.Ints(list)\n\t\t\tindex = sort.SearchInts(list, target)\n\t\t}\n\n\t\t// Test the first slice.\n\t\ti, err := searchFunc(list, target)\n\t\tif err != nil {\n\t\t\tt.Log(\"Expected to find target at index\", index)\n\t\t\tt.Error(err)\n\t\t} else if i != index {\n\t\t\tt.Error(\"Incorrect index\")\n\t\t\tt.Log(\"Expected index =\", index)\n\t\t\tt.Log(\"Returned index =\", i)\n\t\t}\n\n\t\t// Create our second slice, which will not include our target value.\n\t\tlist = make([]int, length)\n\t\tfor i := 0; i < length; i++ {\n\t\t\tv := target\n\t\t\tfor v == target {\n\t\t\t\tv = random.Int()\n\t\t\t}\n\t\t\tlist[i] = v\n\t\t}\n\t\tif sorted {\n\t\t\tsort.Ints(list)\n\t\t}\n\n\t\t// Test the second slice.\n\t\ti, err = searchFunc(list, target)\n\t\tif i != -1 {\n\t\t\tt.Error(\"Found unexpected target in list B\")\n\t\t} else if err == nil {\n\t\t\tt.Error(\"Unexpectedly passed Test 2\")\n\t\t} else if err.Error() != \"not found\" {\n\t\t\tt.Error(\"Received unexpected error:\")\n\t\t\tt.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "590074f91f304537ed670a08b0f973d3", "score": "0.52585423", "text": "func (h *Unit) index(a ...int) int {\n\tvar index int\n\tfor i := len(h.Naxis) - 1; i >= 0; i-- {\n\t\tindex = index*h.Naxis[i] + a[i]\n\t}\n\treturn index\n}", "title": "" }, { "docid": "afa311d85ab6167084d9085143b594a7", "score": "0.52577305", "text": "func TestSetIndexNoNewIndex(t *testing.T) {\n\tr := New(os.Stdout)\n\tintValue := IntValue(42)\n\tmeta := NewTable()\n\tudValue := UserDataValue(NewUserData([]int{}, meta))\n\tif err := SetIndex(r.MainThread(), intValue, intValue, intValue); err == nil {\n\t\tt.Error(\"expected error indexing int value\")\n\t}\n\tif err := SetIndex(r.MainThread(), udValue, intValue, intValue); err == nil {\n\t\tt.Error(\"expected error indexing userdata value\")\n\t}\n}", "title": "" }, { "docid": "01ad4ea528a2abe6f6d7fe2fa6dcf654", "score": "0.5255028", "text": "func (t *SimilarTomates) Index(s *SimilarTomate) int {\n\tret := -1\n\tfor i, item := range t.items {\n\t\tif s.GetID() == item.GetID() {\n\t\t\tret = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "67dc8ba13ae67ee390dc3ec3a87ad4f9", "score": "0.5250148", "text": "func Index(s, substr string) int {\n\tsRune := []rune(s)\n\tsubRune := []rune(substr)\n\tif len(subRune) > len(sRune) {\n\t\treturn -1\n\t}\n\tfor i := 0; i < len(sRune)-len(subRune)+1; i++ {\n\t\tif reflect.DeepEqual(sRune[i:i+len(subRune)], subRune) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "0fb06740f5ec09da53aab5173705196f", "score": "0.52397454", "text": "func IndexIn(vs ...int) predicate.StepRun {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.StepRun(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldIndex), v...))\n\t})\n}", "title": "" }, { "docid": "8e6939a0c59d40b2fe2567e4157bf7d8", "score": "0.52319765", "text": "func TestMergeableIndexes(t *testing.T) {\n\tengine, db, idxv1, idxv2v1 := setupMergeableIndexes(t)\n\n\ttests := []struct {\n\t\twhereStmt string\n\t\tfinalRanges []lookup.Range\n\t\tpks []int64\n\t}{\n\t\t{\n\t\t\t\"v1 = 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 = 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(19), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{1, 5, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 = 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 = 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 != 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 != 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 != 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(19)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 OR v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(19)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{1, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 OR v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{1, 5, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 OR v1 = 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 = 11 AND v1 = 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11 OR v1 <> 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11 AND v1 <> 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 OR v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11 OR v1 <> 15 OR v1 <> 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 AND v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11 OR v1 <> 15 AND v1 <> 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 AND v1 != 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 <> 11 AND v1 <> 15 AND v1 <> 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 OR v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 OR v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(11), idxv1.tuple(15),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 OR v1 != 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 != 11 AND v1 != 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(15), idxv1.tuple(19),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{0, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 OR v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 AND v1 > 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(11), idxv1.tuple(15),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 OR v1 > 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(15), idxv1.tuple(19),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 > 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(15), idxv1.tuple(19),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 > 11 AND v1 < 15 OR v1 > 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t\tlookup.MustOpenRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 OR v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15 AND v1 >= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(11), idxv1.tuple(15),\n\t\t\t\t\tlookup.Closed, lookup.Open),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(15), idxv1.tuple(19),\n\t\t\t\t\tlookup.Closed, lookup.Open),\n\t\t\t},\n\t\t\t[]int64{5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 OR v1 >= 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 >= 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 >= 11 AND v1 <= 14 OR v1 >= 16 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(14)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(16), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 < 15 OR v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 < 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 < 15 AND v1 < 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 < 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 < 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 < 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 < 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(11)),\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 < 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"(v1 < 13 OR v1 > 16) AND (v1 > 10 OR v1 < 19)\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.LessThanRange(idxv1.tuple(13)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(16)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 1},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 OR v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 AND v1 <= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 1},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 OR v1 <= 15 OR v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 OR v1 <= 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 AND v1 <= 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(11)),\n\t\t\t},\n\t\t\t[]int64{0, 1},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 OR v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 AND v1 > 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 OR v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustLessOrEqualRange(idxv1.tuple(11)),\n\t\t\t\tlookup.GreaterOrEqualRange(idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{0, 1, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 <= 11 AND v1 >= 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.EmptyRange(),\n\t\t\t},\n\t\t\t[]int64{},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 OR v1 BETWEEN 15 AND 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(19)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 AND v1 BETWEEN 15 AND 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(15), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{5},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 OR v1 = 13\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 OR v1 != 13\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 AND v1 != 13\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(11), idxv1.tuple(13),\n\t\t\t\t\tlookup.Closed, lookup.Open),\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(13), idxv1.tuple(15),\n\t\t\t\t\tlookup.Open, lookup.Closed),\n\t\t\t},\n\t\t\t[]int64{1, 2, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 BETWEEN 11 AND 15 AND v1 <= 19\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(15)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4, 5},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13)\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(12), idxv1.tuple(12)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(13), idxv1.tuple(13)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13) OR v1 BETWEEN 11 and 13\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(13)),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13) AND v1 > 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(12), idxv1.tuple(12)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(13), idxv1.tuple(13)),\n\t\t\t},\n\t\t\t[]int64{2, 3},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13) OR v1 != 12\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.AllRange(),\n\t\t\t},\n\t\t\t[]int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13) AND v1 != 12\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(13), idxv1.tuple(13)),\n\t\t\t},\n\t\t\t[]int64{1, 3},\n\t\t},\n\t\t{\n\t\t\t\"v1 IN (11, 12, 13) OR v1 >= 13 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(11), idxv1.tuple(11)),\n\t\t\t\tlookup.MustClosedRange(idxv1.tuple(12), idxv1.tuple(12)),\n\t\t\t\tlookup.MustCustomRange(idxv1.tuple(13), idxv1.tuple(15),\n\t\t\t\t\tlookup.Closed, lookup.Open),\n\t\t\t},\n\t\t\t[]int64{1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t\"v2 = 21 AND v1 = 11 OR v2 > 25 AND v1 > 11\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustClosedRange(idxv2v1.tuple(21, 11), idxv2v1.tuple(21, 11)),\n\t\t\t\tlookup.MustGreaterThanRange(idxv2v1.tuple(25, 11)),\n\t\t\t},\n\t\t\t[]int64{1, 6, 7, 8, 9},\n\t\t},\n\t\t{\n\t\t\t\"v2 > 21 AND v1 > 11 AND v2 < 25 AND v1 < 15\",\n\t\t\t[]lookup.Range{\n\t\t\t\tlookup.MustOpenRange(idxv2v1.tuple(21, 11), idxv2v1.tuple(25, 15)),\n\t\t\t},\n\t\t\t[]int64{2, 3, 4},\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.whereStmt, func(t *testing.T) {\n\t\t\tvar finalRanges []lookup.Range\n\t\t\tdb.t = t\n\t\t\tdb.finalRanges = func(ranges []lookup.Range) {\n\t\t\t\tfinalRanges = ranges\n\t\t\t}\n\n\t\t\tctx := context.Background()\n\t\t\tsqlCtx := NewTestSQLCtx(ctx)\n\t\t\t_, iter, err := engine.Query(sqlCtx, fmt.Sprintf(`SELECT pk FROM test WHERE %s ORDER BY 1`, test.whereStmt))\n\t\t\trequire.NoError(t, err)\n\t\t\tres, err := sql.RowIterToRows(iter)\n\t\t\trequire.NoError(t, err)\n\t\t\tif assert.Equal(t, len(test.pks), len(res)) {\n\t\t\t\tfor i, pk := range test.pks {\n\t\t\t\t\tif assert.Equal(t, 1, len(res[i])) {\n\t\t\t\t\t\tassert.Equal(t, pk, res[i][0])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif assert.Equal(t, len(test.finalRanges), len(finalRanges)) {\n\t\t\t\tfor i, r := range test.finalRanges {\n\t\t\t\t\trequire.True(t, r.Equals(finalRanges[i]), fmt.Sprintf(\"Expected: `%v`\\nActual: `%v`\", r, finalRanges[i]))\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "5ce9da26ad6a567561c328fd1296a028", "score": "0.5188171", "text": "func (ids RunIDs) Index(target RunID) int {\n\tfor i, id := range ids {\n\t\tif id == target {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "b2368b01341faf5ac51d1a927bac7d5e", "score": "0.51768506", "text": "func TestUtilities_FindInSlice1(t *testing.T) {\n\t//Create a simple slice.\n\tslice1 := []string{\"A\", \"B\", \"C\", \"E\"}\n\ttarget1 := \"E\"\n\n\tfoundIndex, tf := FindInSlice(target1, slice1)\n\n\tif !tf {\n\t\tt.Errorf(\"The function FindInSlice() could not find the target even though it exists in slice1!\")\n\t}\n\n\tif foundIndex != 3 {\n\t\tt.Errorf(\"Expected that the foundIndex would be 3, but received %v.\", foundIndex)\n\t}\n}", "title": "" }, { "docid": "96c48a9c8a0eb0589e3b2921ca9d68e7", "score": "0.5164768", "text": "func Index(context Context, top, left Expr, index []Expr) Value {\n\tvar ix indexState\n\tix.init(context, top, left, index)\n\torigin := Int(context.Config().Origin())\n\n\tif len(ix.outShape) == 0 {\n\t\t// Trivial scalar case.\n\t\toffset := 0\n\t\tfor j := 0; j < len(ix.indexes); j++ {\n\t\t\tif j > 0 {\n\t\t\t\toffset *= ix.shape[j]\n\t\t\t}\n\t\t\toffset += int(ix.indexes[j][0].(Int) - origin)\n\t\t}\n\t\treturn ix.slice[offset]\n\t}\n\n\tdata := make(Vector, ix.outSize)\n\tcopySize := int(size(ix.shape[len(ix.indexes):]))\n\tn := len(data) / copySize\n\tcoord := make([]int, len(ix.indexes))\n\tfor i := 0; i < n; i++ {\n\t\t// Copy data for indexes[coord].\n\t\toffset := 0\n\t\tfor j := 0; j < len(ix.indexes); j++ {\n\t\t\tif j > 0 {\n\t\t\t\toffset *= ix.shape[j]\n\t\t\t}\n\t\t\toffset += int(ix.indexes[j][coord[j]].(Int) - origin)\n\t\t}\n\t\tcopy(data[i*copySize:(i+1)*copySize], ix.slice[offset*copySize:(offset+1)*copySize])\n\n\t\t// Increment coord.\n\t\tfor j := len(coord) - 1; j >= 0; j-- {\n\t\t\tif coord[j]++; coord[j] < len(ix.indexes[j]) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcoord[j] = 0\n\t\t}\n\t}\n\n\tif len(ix.outShape) == 0 {\n\t\treturn data[0]\n\t}\n\tif len(ix.outShape) == 1 {\n\t\treturn data\n\t}\n\treturn NewMatrix(ix.outShape, data)\n}", "title": "" }, { "docid": "a7b81ee98a96d46eb34c4ddeee7b6702", "score": "0.5154393", "text": "func TestIndexer(t *testing.T) {\n\tassert := assert.New(t)\n\tcd := &triggers.EventDispatcher{}\n\tcd.Initialize(logging.NoLog{})\n\tdd := &triggers.EventDispatcher{}\n\tdd.Initialize(logging.NoLog{})\n\tbaseDB := memdb.New()\n\tdb := versiondb.New(baseDB)\n\tconfig := Config{\n\t\tIndexingEnabled: true,\n\t\tAllowIncompleteIndex: false,\n\t\tLog: logging.NoLog{},\n\t\tDB: db,\n\t\tConsensusDispatcher: cd,\n\t\tDecisionDispatcher: dd,\n\t\tAPIServer: &apiServerMock{},\n\t\tShutdownF: func() {},\n\t}\n\n\t// Create indexer\n\tidxrIntf, err := NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok := idxrIntf.(*indexer)\n\tassert.True(ok)\n\tnow := time.Now()\n\tidxr.clock.Set(now)\n\n\t// Assert state is right\n\tchain1Ctx := snow.DefaultContextTest()\n\tchain1Ctx.ChainID = ids.GenerateTestID()\n\tisIncomplete, err := idxr.isIncomplete(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(isIncomplete)\n\tpreviouslyIndexed, err := idxr.previouslyIndexed(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(previouslyIndexed)\n\n\t// Register this chain, creating a new index\n\tchainVM := &smblockmocks.ChainVM{}\n\tchainEngine := &smengmocks.Engine{}\n\tchainEngine.On(\"GetVM\").Return(chainVM)\n\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tisIncomplete, err = idxr.isIncomplete(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(isIncomplete)\n\tpreviouslyIndexed, err = idxr.previouslyIndexed(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.True(previouslyIndexed)\n\tserver := config.APIServer.(*apiServerMock)\n\tassert.EqualValues(1, server.timesCalled)\n\tassert.EqualValues(\"index/chain1\", server.bases[0])\n\tassert.EqualValues(\"/block\", server.endpoints[0])\n\tassert.Len(idxr.blockIndices, 1)\n\tassert.Len(idxr.txIndices, 0)\n\tassert.Len(idxr.vtxIndices, 0)\n\n\t// Accept a container\n\tblkID, blkBytes := ids.GenerateTestID(), utils.RandomBytes(32)\n\texpectedContainer := Container{\n\t\tID: blkID,\n\t\tBytes: blkBytes,\n\t\tTimestamp: now.UnixNano(),\n\t}\n\t// Mocked VM knows about this block now\n\tchainVM.On(\"GetBlock\", blkID).Return(\n\t\t&snowman.TestBlock{\n\t\t\tTestDecidable: choices.TestDecidable{\n\t\t\t\tStatusV: choices.Accepted,\n\t\t\t\tIDV: blkID,\n\t\t\t},\n\t\t\tBytesV: blkBytes,\n\t\t}, nil,\n\t).Twice()\n\n\tassert.NoError(cd.Accept(chain1Ctx, blkID, blkBytes))\n\n\tblkIdx := idxr.blockIndices[chain1Ctx.ChainID]\n\tassert.NotNil(blkIdx)\n\n\t// Verify GetLastAccepted is right\n\tgotLastAccepted, err := blkIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.Equal(expectedContainer, gotLastAccepted)\n\n\t// Verify GetContainerByID is right\n\tcontainer, err := blkIdx.GetContainerByID(blkID)\n\tassert.NoError(err)\n\tassert.Equal(expectedContainer, container)\n\n\t// Verify GetIndex is right\n\tindex, err := blkIdx.GetIndex(blkID)\n\tassert.NoError(err)\n\tassert.EqualValues(0, index)\n\n\t// Verify GetContainerByIndex is right\n\tcontainer, err = blkIdx.GetContainerByIndex(0)\n\tassert.NoError(err)\n\tassert.Equal(expectedContainer, container)\n\n\t// Verify GetContainerRange is right\n\tcontainers, err := blkIdx.GetContainerRange(0, 1)\n\tassert.NoError(err)\n\tassert.Len(containers, 1)\n\tassert.Equal(expectedContainer, containers[0])\n\n\t// Close the indexer\n\tassert.NoError(db.Commit())\n\tassert.NoError(idxr.Close())\n\tassert.True(idxr.closed)\n\t// Calling Close again should be fine\n\tassert.NoError(idxr.Close())\n\tserver.timesCalled = 0\n\n\t// Re-open the indexer\n\tconfig.DB = versiondb.New(baseDB)\n\tidxrIntf, err = NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok = idxrIntf.(*indexer)\n\tnow = time.Now()\n\tidxr.clock.Set(now)\n\tassert.True(ok)\n\tassert.Len(idxr.blockIndices, 0)\n\tassert.Len(idxr.txIndices, 0)\n\tassert.Len(idxr.vtxIndices, 0)\n\tassert.True(idxr.hasRunBefore)\n\tpreviouslyIndexed, err = idxr.previouslyIndexed(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.True(previouslyIndexed)\n\thasRun, err := idxr.hasRun()\n\tassert.NoError(err)\n\tassert.True(hasRun)\n\tisIncomplete, err = idxr.isIncomplete(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(isIncomplete)\n\n\t// Register the same chain as before\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tblkIdx = idxr.blockIndices[chain1Ctx.ChainID]\n\tassert.NotNil(blkIdx)\n\tcontainer, err = blkIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.Equal(blkID, container.ID)\n\n\t// Register a DAG chain\n\tchain2Ctx := snow.DefaultContextTest()\n\tchain2Ctx.ChainID = ids.GenerateTestID()\n\tisIncomplete, err = idxr.isIncomplete(chain2Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(isIncomplete)\n\tpreviouslyIndexed, err = idxr.previouslyIndexed(chain2Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(previouslyIndexed)\n\tdagVM := &avvtxmocks.DAGVM{}\n\tdagEngine := &mocks.Engine{}\n\tdagEngine.On(\"GetVM\").Return(dagVM).Once()\n\tidxr.RegisterChain(\"chain2\", chain2Ctx, dagEngine)\n\tassert.NoError(err)\n\tserver = config.APIServer.(*apiServerMock)\n\tassert.EqualValues(3, server.timesCalled) // block index, vtx index, tx index\n\tassert.Contains(server.bases, \"index/chain2\")\n\tassert.Contains(server.endpoints, \"/vtx\")\n\tassert.Contains(server.endpoints, \"/tx\")\n\tassert.Len(idxr.blockIndices, 1)\n\tassert.Len(idxr.txIndices, 1)\n\tassert.Len(idxr.vtxIndices, 1)\n\n\t// Accept a vertex\n\tvtxID, vtxBytes := ids.GenerateTestID(), utils.RandomBytes(32)\n\texpectedVtx := Container{\n\t\tID: vtxID,\n\t\tBytes: blkBytes,\n\t\tTimestamp: now.UnixNano(),\n\t}\n\t// Mocked VM knows about this block now\n\tdagEngine.On(\"GetVtx\", vtxID).Return(\n\t\t&avalanche.TestVertex{\n\t\t\tTestDecidable: choices.TestDecidable{\n\t\t\t\tStatusV: choices.Accepted,\n\t\t\t\tIDV: vtxID,\n\t\t\t},\n\t\t\tBytesV: vtxBytes,\n\t\t}, nil,\n\t).Once()\n\n\tassert.NoError(cd.Accept(chain2Ctx, vtxID, blkBytes))\n\n\tvtxIdx := idxr.vtxIndices[chain2Ctx.ChainID]\n\tassert.NotNil(vtxIdx)\n\n\t// Verify GetLastAccepted is right\n\tgotLastAccepted, err = vtxIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.Equal(expectedVtx, gotLastAccepted)\n\n\t// Verify GetContainerByID is right\n\tvtx, err := vtxIdx.GetContainerByID(vtxID)\n\tassert.NoError(err)\n\tassert.Equal(expectedVtx, vtx)\n\n\t// Verify GetIndex is right\n\tindex, err = vtxIdx.GetIndex(vtxID)\n\tassert.NoError(err)\n\tassert.EqualValues(0, index)\n\n\t// Verify GetContainerByIndex is right\n\tvtx, err = vtxIdx.GetContainerByIndex(0)\n\tassert.NoError(err)\n\tassert.Equal(expectedVtx, vtx)\n\n\t// Verify GetContainerRange is right\n\tvtxs, err := vtxIdx.GetContainerRange(0, 1)\n\tassert.NoError(err)\n\tassert.Len(vtxs, 1)\n\tassert.Equal(expectedVtx, vtxs[0])\n\n\t// Accept a tx\n\ttxID, txBytes := ids.GenerateTestID(), utils.RandomBytes(32)\n\texpectedTx := Container{\n\t\tID: txID,\n\t\tBytes: blkBytes,\n\t\tTimestamp: now.UnixNano(),\n\t}\n\t// Mocked VM knows about this tx now\n\tdagVM.On(\"GetTx\", txID).Return(\n\t\t&snowstorm.TestTx{\n\t\t\tTestDecidable: choices.TestDecidable{\n\t\t\t\tIDV: txID,\n\t\t\t\tStatusV: choices.Accepted,\n\t\t\t},\n\t\t\tBytesV: txBytes,\n\t\t}, nil,\n\t).Once()\n\n\tassert.NoError(dd.Accept(chain2Ctx, txID, blkBytes))\n\n\ttxIdx := idxr.txIndices[chain2Ctx.ChainID]\n\tassert.NotNil(txIdx)\n\n\t// Verify GetLastAccepted is right\n\tgotLastAccepted, err = txIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.Equal(expectedTx, gotLastAccepted)\n\n\t// Verify GetContainerByID is right\n\ttx, err := txIdx.GetContainerByID(txID)\n\tassert.NoError(err)\n\tassert.Equal(expectedTx, tx)\n\n\t// Verify GetIndex is right\n\tindex, err = txIdx.GetIndex(txID)\n\tassert.NoError(err)\n\tassert.EqualValues(0, index)\n\n\t// Verify GetContainerByIndex is right\n\ttx, err = txIdx.GetContainerByIndex(0)\n\tassert.NoError(err)\n\tassert.Equal(expectedTx, tx)\n\n\t// Verify GetContainerRange is right\n\ttxs, err := txIdx.GetContainerRange(0, 1)\n\tassert.NoError(err)\n\tassert.Len(txs, 1)\n\tassert.Equal(expectedTx, txs[0])\n\n\t// Accepting a vertex shouldn't have caused anything to\n\t// happen on the block/tx index. Similar for tx.\n\tlastAcceptedTx, err := txIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(txID, lastAcceptedTx.ID)\n\tlastAcceptedVtx, err := vtxIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(vtxID, lastAcceptedVtx.ID)\n\tlastAcceptedBlk, err := blkIdx.GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(blkID, lastAcceptedBlk.ID)\n\n\t// Close the indexer again\n\tassert.NoError(config.DB.(*versiondb.Database).Commit())\n\tassert.NoError(idxr.Close())\n\n\t// Re-open one more time and re-register chains\n\tconfig.DB = versiondb.New(baseDB)\n\tidxrIntf, err = NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok = idxrIntf.(*indexer)\n\tassert.True(ok)\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tidxr.RegisterChain(\"chain2\", chain2Ctx, dagEngine)\n\n\t// Verify state\n\tlastAcceptedTx, err = idxr.txIndices[chain2Ctx.ChainID].GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(txID, lastAcceptedTx.ID)\n\tlastAcceptedVtx, err = idxr.vtxIndices[chain2Ctx.ChainID].GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(vtxID, lastAcceptedVtx.ID)\n\tlastAcceptedBlk, err = idxr.blockIndices[chain1Ctx.ChainID].GetLastAccepted()\n\tassert.NoError(err)\n\tassert.EqualValues(blkID, lastAcceptedBlk.ID)\n}", "title": "" }, { "docid": "00c0c349379b3fdba1be1547ddabf406", "score": "0.51449746", "text": "func (m *Matcher) Index() []int {\n\tif !m.Matches {\n\t\treturn nil\n\t}\n\n\treturn []int{int(m.oVector[0]), int(m.oVector[1])}\n}", "title": "" }, { "docid": "34fa3ac4396f38fbd583c61111322db9", "score": "0.5138804", "text": "func TestIncompleteIndex(t *testing.T) {\n\t// Create an indexer with indexing disabled\n\tassert := assert.New(t)\n\tcd := &triggers.EventDispatcher{}\n\tcd.Initialize(logging.NoLog{})\n\tdd := &triggers.EventDispatcher{}\n\tdd.Initialize(logging.NoLog{})\n\tbaseDB := memdb.New()\n\tconfig := Config{\n\t\tIndexingEnabled: false,\n\t\tAllowIncompleteIndex: false,\n\t\tLog: logging.NoLog{},\n\t\tDB: versiondb.New(baseDB),\n\t\tConsensusDispatcher: cd,\n\t\tDecisionDispatcher: dd,\n\t\tAPIServer: &apiServerMock{},\n\t\tShutdownF: func() {},\n\t}\n\tidxrIntf, err := NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok := idxrIntf.(*indexer)\n\tassert.True(ok)\n\tassert.False(idxr.indexingEnabled)\n\n\t// Register a chain\n\tchain1Ctx := snow.DefaultContextTest()\n\tchain1Ctx.ChainID = ids.GenerateTestID()\n\tisIncomplete, err := idxr.isIncomplete(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(isIncomplete)\n\tpreviouslyIndexed, err := idxr.previouslyIndexed(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.False(previouslyIndexed)\n\tchainEngine := &smengmocks.Engine{}\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tisIncomplete, err = idxr.isIncomplete(chain1Ctx.ChainID)\n\tassert.NoError(err)\n\tassert.True(isIncomplete)\n\tassert.Len(idxr.blockIndices, 0)\n\n\t// Close and re-open the indexer, this time with indexing enabled\n\tassert.NoError(config.DB.(*versiondb.Database).Commit())\n\tassert.NoError(idxr.Close())\n\tconfig.IndexingEnabled = true\n\tconfig.DB = versiondb.New(baseDB)\n\tidxrIntf, err = NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok = idxrIntf.(*indexer)\n\tassert.True(ok)\n\tassert.True(idxr.indexingEnabled)\n\n\t// Register the chain again. Should die due to incomplete index.\n\tassert.NoError(config.DB.(*versiondb.Database).Commit())\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tassert.True(idxr.closed)\n\n\t// Close and re-open the indexer, this time with indexing enabled\n\t// and incomplete index allowed.\n\tassert.NoError(idxr.Close())\n\tconfig.AllowIncompleteIndex = true\n\tconfig.DB = versiondb.New(baseDB)\n\tidxrIntf, err = NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok = idxrIntf.(*indexer)\n\tassert.True(ok)\n\tassert.True(idxr.allowIncompleteIndex)\n\n\t// Register the chain again. Should be OK\n\tidxr.RegisterChain(\"chain1\", chain1Ctx, chainEngine)\n\tassert.False(idxr.closed)\n\n\t// Close the indexer and re-open with indexing disabled and\n\t// incomplete index not allowed.\n\tassert.NoError(idxr.Close())\n\tconfig.AllowIncompleteIndex = false\n\tconfig.IndexingEnabled = false\n\tconfig.DB = versiondb.New(baseDB)\n\tidxrIntf, err = NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok = idxrIntf.(*indexer)\n\tassert.True(ok)\n}", "title": "" }, { "docid": "dcbd17c39ecf9b2651247053283d3910", "score": "0.5129411", "text": "func testIntSliceEqual(a []int, b []int) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n\n}", "title": "" }, { "docid": "73d6084f321b95a2ae16f07441760c4b", "score": "0.5123504", "text": "func (r Range) Index(i int) interface{} { return r.b + i }", "title": "" }, { "docid": "c6e18b6d82e2822d76a624ca73ef12ad", "score": "0.5093936", "text": "func IndexOf[T ~string | comdef.XintOrFloat](val T, list []T) int {\n\tfor i, v := range list {\n\t\tif v == val {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "2772c04074ab6abfd700b787bc6f4331", "score": "0.509208", "text": "func TestIndex_Iterate(t *testing.T) {\n\tdb := newTestDB(t)\n\n\tindex, err := db.NewIndex(\"retrieval\", retrievalIndexFuncs)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\titems := []Item{\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-01\"),\n\t\t\tData: []byte(\"data80\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-03\"),\n\t\t\tData: []byte(\"data22\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-05\"),\n\t\t\tData: []byte(\"data41\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-02\"),\n\t\t\tData: []byte(\"data84\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-06\"),\n\t\t\tData: []byte(\"data1\"),\n\t\t},\n\t}\n\tbatch := new(leveldb.Batch)\n\tfor _, i := range items {\n\t\terr = index.PutInBatch(batch, i)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\terr = db.WriteBatch(batch)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\titem04 := Item{\n\t\tAddress: []byte(\"iterate-hash-04\"),\n\t\tData: []byte(\"data0\"),\n\t}\n\terr = index.Put(item04)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\titems = append(items, item04)\n\n\tsort.SliceStable(items, func(i, j int) bool {\n\t\treturn bytes.Compare(items[i].Address, items[j].Address) < 0\n\t})\n\n\tt.Run(\"all\", func(t *testing.T) {\n\t\tvar i int\n\t\terr := index.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > len(items)-1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\twant := items[i]\n\t\t\tcheckItem(t, item, want)\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t})\n\n\tt.Run(\"start from\", func(t *testing.T) {\n\t\tstartIndex := 2\n\t\ti := startIndex\n\t\terr := index.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > len(items)-1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\twant := items[i]\n\t\t\tcheckItem(t, item, want)\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, &IterateOptions{\n\t\t\tStartFrom: &items[startIndex],\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t})\n\n\tt.Run(\"skip start from\", func(t *testing.T) {\n\t\tstartIndex := 2\n\t\ti := startIndex + 1\n\t\terr := index.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > len(items)-1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\twant := items[i]\n\t\t\tcheckItem(t, item, want)\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, &IterateOptions{\n\t\t\tStartFrom: &items[startIndex],\n\t\t\tSkipStartFromItem: true,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t})\n\n\tt.Run(\"stop\", func(t *testing.T) {\n\t\tvar i int\n\t\tstopIndex := 3\n\t\tvar count int\n\t\terr := index.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > len(items)-1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\twant := items[i]\n\t\t\tcheckItem(t, item, want)\n\t\t\tcount++\n\t\t\tif i == stopIndex {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\twantItemsCount := stopIndex + 1\n\t\tif count != wantItemsCount {\n\t\t\tt.Errorf(\"got %v items, expected %v\", count, wantItemsCount)\n\t\t}\n\t})\n\n\tt.Run(\"no overflow\", func(t *testing.T) {\n\t\tsecondIndex, err := db.NewIndex(\"second-index\", retrievalIndexFuncs)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tsecondItem := Item{\n\t\t\tAddress: []byte(\"iterate-hash-10\"),\n\t\t\tData: []byte(\"data-second\"),\n\t\t}\n\t\terr = secondIndex.Put(secondItem)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tvar i int\n\t\terr = index.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > len(items)-1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\twant := items[i]\n\t\t\tcheckItem(t, item, want)\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\ti = 0\n\t\terr = secondIndex.Iterate(func(item Item) (stop bool, err error) {\n\t\t\tif i > 1 {\n\t\t\t\treturn true, fmt.Errorf(\"got unexpected index item: %#v\", item)\n\t\t\t}\n\t\t\tcheckItem(t, item, secondItem)\n\t\t\ti++\n\t\t\treturn false, nil\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "046b4d634ca1d07571a18cc7b39b8eef", "score": "0.5083276", "text": "func IArrayIndex(arr []interface{}, s interface{}) int {\n\tfor i, a := range arr {\n\t\tif reflect.DeepEqual(a, s) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "2d61e1daf5bcbd8f68a57ff32208ea68", "score": "0.5081408", "text": "func (fi *FIx) Idx(i uint32) uint32 {\n\ti += fi.Zi\n\tif i >= fi.Len {\n\t\ti -= fi.Len\n\t}\n\treturn i\n}", "title": "" }, { "docid": "7ddaab238c333c0a644bdaf46def2c1f", "score": "0.5080631", "text": "func (m NodeMarks) Test(i int) bool {\n\tif i < 0 || i/32 >= len(m.marks) {\n\t\treturn false\n\t}\n\treturn m.marks[i/32]&(1<<uint(i%32)) != 0\n}", "title": "" }, { "docid": "cc7dd80b5e9c4b05575e2869cecb59d4", "score": "0.50740707", "text": "func Index(v int) predicate.StepRun {\n\treturn predicate.StepRun(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIndex), v))\n\t})\n}", "title": "" }, { "docid": "fac2207826cd50483b998a32def78463", "score": "0.50739413", "text": "func (gen *generator) getIndex(index ast.Constant) gep.Index {\n\tswitch index := index.(type) {\n\tcase *ast.IntConst:\n\t\t// use types.I64 as dummy type for gep indices, the type doesn't matter.\n\t\tidx, err := gen.irIntConst(types.I64, index)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"unable to parse integer %q; %v\", index.Text(), err))\n\t\t}\n\t\tval := idx.X.Int64()\n\t\treturn gep.NewIndex(val)\n\tcase *ast.BoolConst:\n\t\tif boolLit(index.BoolLit()) {\n\t\t\treturn gep.NewIndex(1)\n\t\t}\n\t\treturn gep.NewIndex(0)\n\tcase *ast.ZeroInitializerConst:\n\t\treturn gep.NewIndex(0)\n\tcase *ast.VectorConst:\n\t\t// ref: https://llvm.org/docs/LangRef.html#getelementptr-instruction\n\t\t//\n\t\t// > The getelementptr returns a vector of pointers, instead of a single\n\t\t// > address, when one or more of its arguments is a vector. In such\n\t\t// > cases, all vector arguments should have the same number of elements,\n\t\t// > and every scalar argument will be effectively broadcast into a vector\n\t\t// > during address calculation.\n\t\telems := index.Elems()\n\t\tif len(elems) == 0 {\n\t\t\treturn gep.Index{HasVal: false}\n\t\t}\n\t\t// Sanity check. All vector elements must be integers, and must have the\n\t\t// same value.\n\t\tvar val int64\n\t\tfor i, elem := range elems {\n\t\t\tswitch elem := elem.Val().(type) {\n\t\t\tcase *ast.IntConst:\n\t\t\t\t// use types.I64 as dummy type for gep indices, the type doesn't matter.\n\t\t\t\tidx, err := gen.irIntConst(types.I64, elem)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(fmt.Errorf(\"unable to parse integer %q; %v\", elem.Text(), err))\n\t\t\t\t}\n\t\t\t\tx := idx.X.Int64()\n\t\t\t\tif i == 0 {\n\t\t\t\t\tval = x\n\t\t\t\t} else if x != val {\n\t\t\t\t\t// since all elements were not identical, we must conclude that\n\t\t\t\t\t// the index vector does not have a concrete value.\n\t\t\t\t\treturn gep.Index{\n\t\t\t\t\t\tHasVal: false,\n\t\t\t\t\t\tVectorLen: uint64(len(elems)),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t// TODO: remove debug output.\n\t\t\t\tpanic(fmt.Errorf(\"support for gep index vector element type %T not yet implemented\", elem))\n\t\t\t\t//return gep.Index{HasVal: false}\n\t\t\t}\n\t\t}\n\t\treturn gep.Index{\n\t\t\tHasVal: true,\n\t\t\tVal: val,\n\t\t\tVectorLen: uint64(len(elems)),\n\t\t}\n\tcase *ast.PtrToIntExpr:\n\t\treturn gep.Index{HasVal: false}\n\tcase *ast.UndefConst:\n\t\treturn gep.Index{HasVal: false}\n\tcase *ast.PoisonConst:\n\t\treturn gep.Index{HasVal: false}\n\tdefault:\n\t\t// TODO: add support for more constant expressions.\n\t\t// TODO: remove debug output.\n\t\tpanic(fmt.Errorf(\"support for gep index type %T not yet implemented\", index))\n\t\t//return gep.Index{HasVal: false}\n\t}\n}", "title": "" }, { "docid": "912e2bb361de14cf4d039a9b8c68202b", "score": "0.5071112", "text": "func TestSearchIndexInHeadColumn(t *testing.T) {\n\tassert := assert.New(t)\n\tsk := NewIntSkipList(10, 8)\n\tdump(\"TestSearchInHeadColumn.dot\", sk)\n\n\tn1, n2 := sk.SearchIndex(0, 0)\n\tassert.Equal(idxLevel(sk, 1), n1, \"Left\")\n\tassert.Equal(20, n2.Root.Value(), \"Right\")\n}", "title": "" }, { "docid": "ac08be88c3722bc6b29e27a03e768acc", "score": "0.50696576", "text": "func (s Int8Slice) Index(comp int8) int {\n\tfor index, key := range s {\n\t\tif key == comp {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "9157646cbd050d629779bd5edd7d2b85", "score": "0.50684893", "text": "func (b Bitset) Test(i int) bool {\n\tw := i / WordBitSize\n\treturn i >= 0 && w < len(b) && ((b[w]>>uint(i%WordBitSize))&1) == 1\n}", "title": "" }, { "docid": "1da624620b007dccb2c6291059309cf1", "score": "0.506554", "text": "func (pd *PictureData) Index(at Vec) int {\n\tat = at.Sub(pd.Rect.Min.Map(math.Floor))\n\tx, y := int(at.X), int(at.Y)\n\treturn y*pd.Stride + x\n}", "title": "" }, { "docid": "172dd86dea202dc600b73db5db8164c9", "score": "0.50629324", "text": "func main() {\n\n\tx := []int{0, 0, 1, 0, 1, 1, 1, 0, 1, 1}\n\tindex := findIndex(x)\n\tfmt.Print(index)\n}", "title": "" }, { "docid": "25defb2f5c529bab614d5e5e384aed76", "score": "0.5058812", "text": "func indexAt(s string, tgt string, startIdx int) int {\n\tidx := strings.Index(s[startIdx:], tgt)\n\tif idx > -1 {\n\t\tidx += startIdx\n\t}\n\treturn idx\n}", "title": "" }, { "docid": "551243058a321c4f7c80ec59c54919de", "score": "0.50576943", "text": "func (s DNA8) AllIndex(m DNA8) (x []int) {\nij:\n\tfor i, j := 0, len(m); j <= len(s); i, j = i+1, j+1 {\n\t\tfor k, mk := range m {\n\t\t\tif (s[i+k]^mk)&^LCBit != 0 {\n\t\t\t\tcontinue ij\n\t\t\t}\n\t\t}\n\t\tx = append(x, i)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d2afa8222c3a56c759fa6ba5aa82de6d", "score": "0.50497174", "text": "func (arr *ArrayList) isIndexOutOfRange(index int) bool {\n\treturn index >= len(arr.data) || index < 0\n}", "title": "" }, { "docid": "83540b1d77d770a69736247c3c83388e", "score": "0.50488967", "text": "func SliceIndexOf(item interface{}, list []interface{}) int {\n\tfor i := 0; i < len(list); i++ {\n\t\tif list[i] != nil {\n\t\t\tif reflect.DeepEqual(item, list[i]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "c474e9bbe3e82d2c4ac24341b5a1ccf9", "score": "0.5046137", "text": "func inIntSlice(x []int, y int) bool {\n\tfor v := range x {\n\t\tif x[v] == y {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6ed0621029864877f22ef1c17ab9300e", "score": "0.50403273", "text": "func indexInBlock(target ssa.Instruction) (int, bool) {\n\tfor i, instr := range target.Block().Instrs {\n\t\tif instr == target {\n\t\t\treturn i, true\n\t\t}\n\t}\n\t// we can only hit this return if there is a bug in the ssa package\n\t// i.e. an instruction does not appear within its parent block\n\treturn 0, false\n}", "title": "" }, { "docid": "9b7140d72af6da58c4aad147fed4699f", "score": "0.50199693", "text": "func TestObjectPartIndex(t *testing.T) {\n\ttestCases := []struct {\n\t\tpartNum int\n\t\texpectedIndex int\n\t}{\n\t\t{2, 1},\n\t\t{1, 0},\n\t\t{5, 3},\n\t\t{4, 2},\n\t\t{7, 4},\n\t}\n\n\t// Setup.\n\tfi := newFileInfo(\"test-object\", 8, 8)\n\tif !fi.IsValid() {\n\t\tt.Fatalf(\"unable to get xl meta\")\n\t}\n\n\t// Add some parts for testing.\n\tfor _, testCase := range testCases {\n\t\tpartNumString := strconv.Itoa(testCase.partNum)\n\t\tfi.AddObjectPart(testCase.partNum, \"etag.\"+partNumString, int64(testCase.partNum+humanize.MiByte), ActualSize)\n\t}\n\n\t// Add failure test case.\n\ttestCases = append(testCases, struct {\n\t\tpartNum int\n\t\texpectedIndex int\n\t}{6, -1})\n\n\t// Test them.\n\tfor _, testCase := range testCases {\n\t\tif index := objectPartIndex(fi.Parts, testCase.partNum); index != testCase.expectedIndex {\n\t\t\tt.Fatalf(\"%+v: expected = %d, got: %d\", testCase, testCase.expectedIndex, index)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef9acd869cf7b9115adce7a8d8feb0a0", "score": "0.5004072", "text": "func indexExists(enis map[string]eniTypes.ENI, index int64) bool {\n\tfor _, e := range enis {\n\t\tif e.Number == int(index) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c41695d90d8b476e92acabec9afde52d", "score": "0.49964035", "text": "func sliceIndex(limit int, predicate func(i int) bool) int {\n\tfor i := 0; i < limit; i++ {\n\t\tif predicate(i) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "12d7699e9c82dae0bb51485767871f5d", "score": "0.49959925", "text": "func TestIntIntArray(t *testing.T) {\n\tscr := NewScript()\n\ta := scr.NewValueArray()\n\tfor i := 0; i < 10; i++ {\n\t\ta.Set(i, i*10)\n\t}\n\tfor i := 9; i >= 0; i-- {\n\t\tgot := a.Get(i).Int()\n\t\tif got != i*10 {\n\t\t\tt.Fatalf(\"Expected %d but received %d\", i*10, got)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c500d0b3cded8decf4bb6c051d89a2fd", "score": "0.49909627", "text": "func (this *Array) isIndexOutOfRange(index uint) bool{\n\treturn false\n}", "title": "" }, { "docid": "8eeff6312938ff5145b8028aba9e37cc", "score": "0.49903464", "text": "func Index(slice []string, text string) int {\n\tfor i, item := range slice {\n\t\tif item == text {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "ace81b1ad061792d0058d28a4cf83b6d", "score": "0.4989649", "text": "func TestCombInd(t *testing.T) {\n\tval := 0\n\tif rv := combInd(0, 0); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 1\n\tif rv := combInd(1, 1); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 2\n\tif rv := combInd(2, 2); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 3\n\tif rv := combInd(1, 2); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 3\n\tif rv := combInd(2, 1); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 4\n\tif rv := combInd(2, 0); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 4\n\tif rv := combInd(0, 2); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 5\n\tif rv := combInd(0, 1); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n\n\tval = 5\n\tif rv := combInd(1, 0); rv != val {\n\t\tt.Error(\"Expected: \", val, \" received \", rv)\n\t} \n}", "title": "" }, { "docid": "ebf9a5ab7559ea9e6b724a5d58296d17", "score": "0.4984928", "text": "func Test085ForRangeOverSliceAndChangeValue(t *testing.T) {\n\n\tcv.Convey(`for i := range a { a[i] = a[i] + 1 } should change the value of a[i]`, t, func() {\n\n\t\tcode := `\n b := []int{0}\n for i := range b {\n b[i] = b[i]+1\n }\n b0 := b[0]\n`\n\n\t\tvm, err := NewLuaVmWithPrelude(nil)\n\t\tpanicOn(err)\n\t\tdefer vm.Close()\n\t\tinc := NewIncrState(vm, nil)\n\n\t\ttranslation, err := inc.Tr([]byte(code))\n\t\tfmt.Printf(\"\\n translation='%s'\\n\", translation)\n\n\t\t// and verify that it happens correctly\n\t\tLuaRunAndReport(vm, string(translation))\n\n\t\t// check for exception\n\t\tLuaMustInt64(vm, \"b0\", 1)\n\t\tcv.So(true, cv.ShouldBeTrue)\n\t})\n}", "title": "" }, { "docid": "b4e20f8cbadbea0dbadf70949dfe2592", "score": "0.49835446", "text": "func (tm *terrainMap) index(x, y int) int {\n\treturn (x & (tm.size - 1)) + (y&(tm.size-1))*tm.size\n}", "title": "" }, { "docid": "9cb656d0a199198e2d5743b70c9e95b4", "score": "0.49793783", "text": "func (list *IntList) IndexWhere(p func(int) bool) int {\n\treturn list.IndexWhere2(p, 0)\n}", "title": "" }, { "docid": "3afbaeb516f54ec9dcbed5427433add5", "score": "0.4973795", "text": "func (b *BitSet) Test(i uint) bool {\n\tif i >= b.length {\n\t\treturn false\n\t}\n\treturn ((b.set[i>>log2WordSize] & (1 << (i & (wordSize - 1)))) != 0)\n}", "title": "" }, { "docid": "bb384c652add988a1ef053cf1d6184fd", "score": "0.49690104", "text": "func getIndex(s string, c string) int {\n\tfor i, v := range s {\n\t\tif reflect.DeepEqual(string(v), c) {\n\t\t\treturn i\n\t\t}\n\t}\n\t// won't happen\n\treturn -1\n}", "title": "" }, { "docid": "c2b62538ff8dc715c192cc6407d7162a", "score": "0.49680674", "text": "func (m *Machine) doOpIndex() {\n\tif debug {\n\t\t_ = m.PopExpr().(*IndexExpr)\n\t} else {\n\t\tm.PopExpr()\n\t}\n\tiv := m.PopValue() // index\n\txv := m.PeekValue(1) // x\n\tres := xv.GetPointerAtIndex(iv)\n\t*xv = res.Deref() // reuse as result\n}", "title": "" }, { "docid": "dfb1676de9b4dacd3c18dfe41d63d94b", "score": "0.49679196", "text": "func TestUtilities_FindInSlice2(t *testing.T) {\n\t//Create a simple slice.\n\tslice1 := []string{\"A\", \"B\", \"C\", \"E\"}\n\ttarget1 := \"D\"\n\n\tfoundIndex, tf := FindInSlice(target1, slice1)\n\n\tif tf {\n\t\tt.Errorf(\"The function FindInSlice() found the target even though it DOES NOT exist in slice1!\")\n\t}\n\n\tif foundIndex != -1 {\n\t\tt.Errorf(\"Expected that the foundIndex would be -1, but received %v.\", foundIndex)\n\t}\n}", "title": "" }, { "docid": "4e0b4171ecb3cc6724eea63a0c819f64", "score": "0.49664935", "text": "func SliceIndex(limit int, predicate func(i int) bool) int {\n\tfor i := 0; i < limit; i++ {\n\t\tif predicate(i) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "4e0b4171ecb3cc6724eea63a0c819f64", "score": "0.49664935", "text": "func SliceIndex(limit int, predicate func(i int) bool) int {\n\tfor i := 0; i < limit; i++ {\n\t\tif predicate(i) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "33017784619487757a1fdd39ff09499b", "score": "0.49619544", "text": "func (tb *tripleIntBuffer) EachOfWithIndex(f func(int, int, int, int), indices ...int) {\n\tfor _, i := range indices {\n\t\tf(i, tb.Buffer[i*3], tb.Buffer[i*3+1], tb.Buffer[i*3+2])\n\t}\n}", "title": "" }, { "docid": "47ab5c93e73716c13ba00d45bd1bbb95", "score": "0.49476042", "text": "func IndexOf(s, v interface{}) int {\n\t// Check for slice type\n\trv := reflect.ValueOf(s)\n\tif rv.Kind() != reflect.Slice {\n\t\treturn -1\n\t}\n\n\t// Interate on slice elements\n\tfor i, n := 0, rv.Len(); i < n; i++ {\n\t\tif reflect.DeepEqual(rv.Index(i).Interface(), v) {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "a08e85b5c6811735e023846f9aabeb9b", "score": "0.4933558", "text": "func TestIntegers(t *testing.T) {\n\ttx := newTxForSlices(t)\n\tvalues, err := query.SelectIntegers(tx, \"SELECT id FROM test ORDER BY id\")\n\tif err != nil {\n\t\tt.Errorf(\"expected err to be nil: %v\", err)\n\t}\n\tif expected, actual := []int{0, 1}, values; !reflect.DeepEqual(expected, actual) {\n\t\tt.Errorf(\"expected: %v, actual: %v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "78fa4c2ad9f4daf6233164be887e9441", "score": "0.49298435", "text": "func Index(index int) OpFunc {\n\treturn func(in []byte) ([]byte, error) {\n\t\treturn scanner.FindIndex(in, 0, index)\n\t}\n}", "title": "" }, { "docid": "c9ce1f76626ed1975a971102e565e393", "score": "0.49155557", "text": "func updateIndex(i int, plus bool) int {\n\tif plus {\n\t\treturn i + 1\n\t} else {\n\t\treturn i - 1\n\t}\n}", "title": "" }, { "docid": "989833bced446fd4471e717e98943e7b", "score": "0.49149877", "text": "func (m *MockStateService) Index() *chainindex.BlockIndex {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Index\")\n\tret0, _ := ret[0].(*chainindex.BlockIndex)\n\treturn ret0\n}", "title": "" }, { "docid": "ce164e14420ad97a728bdf2a0f7a7692", "score": "0.49085993", "text": "func Index(list, value cty.Value) (cty.Value, error) {\n\treturn IndexFunc.Call([]cty.Value{list, value})\n}", "title": "" }, { "docid": "b826d7a99819474c00a261d373506a32", "score": "0.48971826", "text": "func TestIsItemInSlice1(t *testing.T) {\n\tif isItemInSlice(1, []int{2, 3, 5, 7, 11, 13}) {\n\t\tt.Errorf(\"1 should not be found in [2, 3, 5, 7, 11, 13]\")\n\t}\n}", "title": "" }, { "docid": "2160be0304d67c0adb2fba90a20deccf", "score": "0.48961225", "text": "func IntInSlice(a int, list []int) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2067de1a9d6d44a486c3cae4aa5cd792", "score": "0.48909163", "text": "func Offsetof(v ArbitraryType) int", "title": "" }, { "docid": "e844f5cbdf6a4bc9151cd0274cf7d953", "score": "0.48900324", "text": "func (c Columns) IndexOf(v *plandef.Variable) (int, bool) {\n\tfor i, x := range c {\n\t\tif x == v {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "4e43b0f0014b37a807d9e98b9fad31ec", "score": "0.4884438", "text": "func Index(name interface{}) Expr { return fn1(\"index\", name) }", "title": "" }, { "docid": "4adc12bf01afd3c61a008e6d28a7be5b", "score": "0.4872808", "text": "func (m *MockOnIndexSeries) IndexedRange() (time.UnixNano, time.UnixNano) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IndexedRange\")\n\tret0, _ := ret[0].(time.UnixNano)\n\tret1, _ := ret[1].(time.UnixNano)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "39395afd0d9b64492915f06b02e7f935", "score": "0.4861884", "text": "func (m *MockIndexer) Index(arg0 string, arg1 interface{}) ([]interface{}, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Index\", arg0, arg1)\n\tret0, _ := ret[0].([]interface{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "dbe619a056d7176cd98944fdd91c3390", "score": "0.48593143", "text": "func (m *MockOnIndexSeries) IndexedForBlockStart(blockStart time.UnixNano) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IndexedForBlockStart\", blockStart)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "72a3ee2755ccd8ccf261b4f55b1cdeaf", "score": "0.4855225", "text": "func TestChromaticIndex(t *testing.T) {\n\ttruthData := make([][]int, 10)\n\ttruthData[0] = []int{1}\n\ttruthData[1] = []int{1, 1}\n\ttruthData[2] = []int{1, 1, 1, 1}\n\ttruthData[3] = []int{1, 2, 3, 5}\n\ttruthData[4] = []int{1, 2, 5, 14, 10, 2}\n\ttruthData[5] = []int{1, 3, 10, 46, 58, 38}\n\ttruthData[6] = []int{1, 3, 15, 123, 347, 392, 159, 4}\n\ttruthData[7] = []int{1, 4, 26, 375, 2130, 4895, 3855, 1060}\n\ttruthData[8] = []int{1, 4, 37, 1061, 14039, 68696, 113774, 64669, 12378, 9}\n\tfor i := 1; i <= 7; i++ {\n\t\tvar foundData []int\n\t\tif i%2 == 0 || i == 1 {\n\t\t\tfoundData = make([]int, i)\n\t\t} else {\n\t\t\tfoundData = make([]int, i+1)\n\t\t}\n\n\t\titer := search.All(i, 0, 1)\n\t\tfor iter.Next() {\n\t\t\tg := iter.Value()\n\t\t\tchromaticIndex, _ := graph.ChromaticIndex(g)\n\t\t\tfoundData[chromaticIndex]++\n\t\t}\n\t\tif !ints.Equal(foundData, truthData[i-1]) {\n\t\t\tt.Log(foundData)\n\t\t\tt.Log(truthData)\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "576f3850f60c7e0b9b1c1f860716fe90", "score": "0.4849412", "text": "func getIndex(s int, sl []int) int {\n\tfor key, val := range sl {\n\t\tif s == val {\n\t\t\treturn key\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "3c2769a72f0bdbb75e61d399a14a2958", "score": "0.48489618", "text": "func (this sliceValue) Index(index int) (Value, bool) {\n\tif index < 0 {\n\t\tindex = len(this) + index\n\t}\n\n\tif index >= 0 && index < len(this) {\n\t\treturn NewValue(this[index]), true\n\t}\n\n\treturn missingIndex(index), false\n}", "title": "" }, { "docid": "27c72587a462dedc2cbea593dbebb137", "score": "0.48470762", "text": "func (sig Discrete) Index(t float64) float64 {\n\tt -= float64(int(t))\n\tt *= float64(len(sig))\n\treturn sig[int(t)]\n}", "title": "" }, { "docid": "288893802740b958c19bda1c147bc921", "score": "0.4845159", "text": "func (p Polymorph) Index() int {\n\tvar _, _, i = p()\n\treturn i\n}", "title": "" }, { "docid": "86a982a7de283ff1bce156a7c11aa220", "score": "0.48435745", "text": "func IndexOf(sl []int, si int) (rind int) {\n\tfor i := 0; i < len(sl); i++ {\n\t\tif sl[i] == si {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "99b9eb106754306c0896783aeff04acc", "score": "0.48413077", "text": "func (s Slice) Index(id *ID) int {\n\tif id == nil {\n\t\treturn -1\n\t}\n\treturn sort.Search(len(s), func(i int) bool { return s[i] != nil && s[i].Cmp(id) >= 0 })\n}", "title": "" }, { "docid": "550b85fe3b95d421392153dce91a1226", "score": "0.48367918", "text": "func (n *BinaryNode) IndexOf(val float64) int {\n\ti := -2\n\tn.Search(&val, &i)\n\treturn i\n}", "title": "" }, { "docid": "b07f967aa374176a3b0c43a16694a8e7", "score": "0.48367032", "text": "func TestIndex_count(t *testing.T) {\n\tdb := newTestDB(t)\n\n\tindex, err := db.NewIndex(\"retrieval\", retrievalIndexFuncs)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\titems := []Item{\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-01\"),\n\t\t\tData: []byte(\"data80\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-02\"),\n\t\t\tData: []byte(\"data84\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-03\"),\n\t\t\tData: []byte(\"data22\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-04\"),\n\t\t\tData: []byte(\"data41\"),\n\t\t},\n\t\t{\n\t\t\tAddress: []byte(\"iterate-hash-05\"),\n\t\t\tData: []byte(\"data1\"),\n\t\t},\n\t}\n\tbatch := new(leveldb.Batch)\n\tfor _, i := range items {\n\t\terr = index.PutInBatch(batch, i)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\terr = db.WriteBatch(batch)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tt.Run(\"Count\", func(t *testing.T) {\n\t\tgot, err := index.Count()\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\twant := len(items)\n\t\tif got != want {\n\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t}\n\t})\n\n\tt.Run(\"CountFrom\", func(t *testing.T) {\n\t\tgot, err := index.CountFrom(Item{\n\t\t\tAddress: items[1].Address,\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\twant := len(items) - 1\n\t\tif got != want {\n\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t}\n\t})\n\n\t// update the index with another item\n\tt.Run(\"add item\", func(t *testing.T) {\n\t\titem04 := Item{\n\t\t\tAddress: []byte(\"iterate-hash-06\"),\n\t\t\tData: []byte(\"data0\"),\n\t\t}\n\t\terr = index.Put(item04)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tcount := len(items) + 1\n\n\t\tt.Run(\"Count\", func(t *testing.T) {\n\t\t\tgot, err := index.Count()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\twant := count\n\t\t\tif got != want {\n\t\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"CountFrom\", func(t *testing.T) {\n\t\t\tgot, err := index.CountFrom(Item{\n\t\t\t\tAddress: items[1].Address,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\twant := count - 1\n\t\t\tif got != want {\n\t\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t\t}\n\t\t})\n\t})\n\n\t// delete some items\n\tt.Run(\"delete items\", func(t *testing.T) {\n\t\tdeleteCount := 3\n\n\t\tfor _, item := range items[:deleteCount] {\n\t\t\terr := index.Delete(item)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\tcount := len(items) + 1 - deleteCount\n\n\t\tt.Run(\"Count\", func(t *testing.T) {\n\t\t\tgot, err := index.Count()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\twant := count\n\t\t\tif got != want {\n\t\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t\t}\n\t\t})\n\n\t\tt.Run(\"CountFrom\", func(t *testing.T) {\n\t\t\tgot, err := index.CountFrom(Item{\n\t\t\t\tAddress: items[deleteCount+1].Address,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\twant := count - 1\n\t\t\tif got != want {\n\t\t\t\tt.Errorf(\"got %v items count, want %v\", got, want)\n\t\t\t}\n\t\t})\n\t})\n}", "title": "" }, { "docid": "85417c0ae65f83e3123465cf49a0659e", "score": "0.4833873", "text": "func (self *Node) Index(idx int) *Node {\n if err := self.checkRaw(); err != nil {\n return unwrapError(err)\n }\n\n it := self.itype()\n if it == types.V_ARRAY {\n return self.skipIndex(idx)\n\n }else if it == types.V_OBJECT {\n pr := self.skipIndexPair(idx)\n if pr == nil {\n return nodeNotExist\n }\n return &pr.Value\n\n }else{\n return nodeUnsupportType\n }\n}", "title": "" }, { "docid": "dbf996797b12e36c2c7eb5b6f31e5fb4", "score": "0.48321667", "text": "func IndexOf(array []interface{}, key interface{}, comparator cmp.Compare, ij ...int) int {\n\tvar idx int\n\tif len(ij) > 0 {\n\t\tidx = BS(array, key, comparator, ij[0], ij[1])\n\t} else {\n\t\tidx = BS(array, key, comparator)\n\t}\n\tif idx < 0 {\n\t\tidx = -idx - 1\n\t}\n\treturn idx\n}", "title": "" }, { "docid": "f663f5555a789a4cb99eebd31fe26a38", "score": "0.48271507", "text": "func (curve shortWeierstrassCurve) ComputeIndexWithinRange(a, b, x, y, min, max *big.Int) (index *big.Int, err error) {\n\tindex = new(big.Int).SetBytes(min.Bytes())\n\tfor index.Cmp(max) != 1 {\n\t\taa, bb := curve.ScalarMult(x, y, index.Bytes())\n\t\tif curve.PointEquals(a, b, aa, bb) {\n\t\t\treturn\n\t\t}\n\t\tindex = index.Add(index, one)\n\t}\n\treturn nil, IndexNotRecoveredErr\n\n}", "title": "" }, { "docid": "8180337ed50b7825390f01182c36d408", "score": "0.48191416", "text": "func IndexIn(vs ...int) predicate.PropertyType {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldIndex), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "b5d3705c1493bdca2aee5072cf326642", "score": "0.48169035", "text": "func TestBinSearchLoop_NotFindValueInMiddle(t *testing.T) {\n\tarr := []int{2, 3, 5, 7, 11, 13}\n\twant := -1\n\tresult := BinSearchLoop(&arr, 1)\n\tif want != result {\n\t\tt.Fatalf(`Error %d`, result)\n\t}\n}", "title": "" }, { "docid": "280219a6d9e43c7995d79305002c940a", "score": "0.4811268", "text": "func TestNewIndexer(t *testing.T) {\n\tassert := assert.New(t)\n\ted := &triggers.EventDispatcher{}\n\ted.Initialize(logging.NoLog{})\n\tconfig := Config{\n\t\tIndexingEnabled: true,\n\t\tAllowIncompleteIndex: true,\n\t\tLog: logging.NoLog{},\n\t\tDB: memdb.New(),\n\t\tConsensusDispatcher: ed,\n\t\tDecisionDispatcher: ed,\n\t\tAPIServer: &apiServerMock{},\n\t\tShutdownF: func() {},\n\t}\n\n\tidxrIntf, err := NewIndexer(config)\n\tassert.NoError(err)\n\tidxr, ok := idxrIntf.(*indexer)\n\tassert.True(ok)\n\tassert.NotNil(idxr.codec)\n\tassert.NotNil(idxr.log)\n\tassert.NotNil(idxr.db)\n\tassert.False(idxr.closed)\n\tassert.NotNil(idxr.routeAdder)\n\tassert.True(idxr.indexingEnabled)\n\tassert.True(idxr.allowIncompleteIndex)\n\tassert.NotNil(idxr.blockIndices)\n\tassert.Len(idxr.blockIndices, 0)\n\tassert.NotNil(idxr.txIndices)\n\tassert.Len(idxr.txIndices, 0)\n\tassert.NotNil(idxr.vtxIndices)\n\tassert.Len(idxr.vtxIndices, 0)\n\tassert.NotNil(idxr.consensusDispatcher)\n\tassert.NotNil(idxr.decisionDispatcher)\n\tassert.NotNil(idxr.shutdownF)\n\tassert.False(idxr.hasRunBefore)\n}", "title": "" } ]
62d00b94a8a1eb7404afed73efa3036d
ConvertFormToMetaValues convert form to meta values
[ { "docid": "4766f437fb9e107a18ade30cf0aec06a", "score": "0.7662201", "text": "func ConvertFormToMetaValues(request *http.Request, metaors []Metaor, prefix string) (*MetaValues, error) {\n\tmetaValues := &MetaValues{}\n\tmetaorsMap := map[string]Metaor{}\n\tconvertedNextLevel := map[string]bool{}\n\tnestedStructIndex := map[string]int{}\n\tfor _, metaor := range metaors {\n\t\tmetaorsMap[metaor.GetName()] = metaor\n\t}\n\n\tnewMetaValue := func(key string, value interface{}) {\n\t\tif strings.HasPrefix(key, prefix) {\n\t\t\tvar metaValue *MetaValue\n\t\t\tkey = strings.TrimPrefix(key, prefix)\n\n\t\t\tif matches := isCurrentLevel.FindStringSubmatch(key); len(matches) > 0 {\n\t\t\t\tname := matches[0]\n\t\t\t\tmetaValue = &MetaValue{Name: name, Value: value, Meta: metaorsMap[name]}\n\t\t\t} else if matches := isNextLevel.FindStringSubmatch(key); len(matches) > 0 {\n\t\t\t\tname := matches[1]\n\t\t\t\tif _, ok := convertedNextLevel[name]; !ok {\n\t\t\t\t\tvar metaors []Metaor\n\t\t\t\t\tconvertedNextLevel[name] = true\n\t\t\t\t\tmetaor := metaorsMap[matches[2]]\n\t\t\t\t\tif metaor != nil {\n\t\t\t\t\t\tmetaors = metaor.GetMetas()\n\t\t\t\t\t}\n\n\t\t\t\t\tif children, err := ConvertFormToMetaValues(request, metaors, prefix+name+\".\"); err == nil {\n\t\t\t\t\t\tnestedName := prefix + matches[2]\n\t\t\t\t\t\tif _, ok := nestedStructIndex[nestedName]; ok {\n\t\t\t\t\t\t\tnestedStructIndex[nestedName] += 1\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnestedStructIndex[nestedName] = 0\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmetaValue = &MetaValue{Name: matches[2], Meta: metaor, MetaValues: children, Index: nestedStructIndex[nestedName]}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif metaValue != nil {\n\t\t\t\tmetaValues.Values = append(metaValues.Values, metaValue)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar sortedFormKeys []string\n\tfor key := range request.Form {\n\t\tsortedFormKeys = append(sortedFormKeys, key)\n\t}\n\tsort.Strings(sortedFormKeys)\n\n\tfor _, key := range sortedFormKeys {\n\t\tnewMetaValue(key, request.Form[key])\n\t}\n\n\tif request.MultipartForm != nil {\n\t\tsortedFormKeys = []string{}\n\t\tfor key := range request.MultipartForm.File {\n\t\t\tsortedFormKeys = append(sortedFormKeys, key)\n\t\t}\n\t\tsort.Strings(sortedFormKeys)\n\n\t\tfor _, key := range sortedFormKeys {\n\t\t\tnewMetaValue(key, request.MultipartForm.File[key])\n\t\t}\n\t}\n\treturn metaValues, nil\n}", "title": "" } ]
[ { "docid": "01c52e7b119b3688713480d7f4483b63", "score": "0.58839303", "text": "func parseFormToStruct(form url.Values, objT reflect.Type, objV reflect.Value) error {\n\tfor i := 0; i < objT.NumField(); i++ {\n\t\tfieldV := objV.Field(i)\n\t\tif !fieldV.CanSet() {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldT := objT.Field(i)\n\t\tif fieldT.Anonymous && fieldT.Type.Kind() == reflect.Struct {\n\t\t\terr := parseFormToStruct(form, fieldT.Type, fieldV)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\ttags := strings.Split(fieldT.Tag.Get(\"form\"), \",\")\n\t\tvar tag string\n\t\tif len(tags) == 0 || len(tags[0]) == 0 {\n\t\t\ttag = fieldT.Name\n\t\t} else if tags[0] == \"-\" {\n\t\t\tcontinue\n\t\t} else {\n\t\t\ttag = tags[0]\n\t\t}\n\n\t\tvalue := form.Get(tag)\n\t\tif len(value) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch fieldT.Type.Kind() {\n\t\tcase reflect.Bool:\n\t\t\tb, err := strconv.ParseBool(value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfieldV.SetBool(b)\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tx, err := strconv.ParseInt(value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfieldV.SetInt(x)\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tx, err := strconv.ParseUint(value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfieldV.SetUint(x)\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tx, err := strconv.ParseFloat(value, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfieldV.SetFloat(x)\n\t\tcase reflect.Interface:\n\t\t\tfieldV.Set(reflect.ValueOf(value))\n\t\tcase reflect.String:\n\t\t\tfieldV.SetString(value)\n\t\tcase reflect.Struct:\n\t\t\tswitch fieldT.Type.String() {\n\t\t\tcase \"time.Time\":\n\t\t\t\tvar (\n\t\t\t\t\tt time.Time\n\t\t\t\t\terr error\n\t\t\t\t)\n\t\t\t\tif len(value) >= 25 {\n\t\t\t\t\tvalue = value[:25]\n\t\t\t\t\tt, err = time.ParseInLocation(time.RFC3339, value, time.Local)\n\t\t\t\t} else if len(value) >= 19 {\n\t\t\t\t\tif strings.Contains(value, \"T\") {\n\t\t\t\t\t\tvalue = value[:19]\n\t\t\t\t\t\tt, err = time.ParseInLocation(formatDateTimeT, value, time.Local)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = value[:19]\n\t\t\t\t\t\tt, err = time.ParseInLocation(formatDateTime, value, time.Local)\n\t\t\t\t\t}\n\t\t\t\t} else if len(value) >= 10 {\n\t\t\t\t\tif len(value) > 10 {\n\t\t\t\t\t\tvalue = value[:10]\n\t\t\t\t\t}\n\t\t\t\t\tt, err = time.ParseInLocation(formatDate, value, time.Local)\n\t\t\t\t} else if len(value) >= 8 {\n\t\t\t\t\tif len(value) > 8 {\n\t\t\t\t\t\tvalue = value[:8]\n\t\t\t\t\t}\n\t\t\t\t\tt, err = time.ParseInLocation(formatTime, value, time.Local)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfieldV.Set(reflect.ValueOf(t))\n\t\t\t}\n\t\tcase reflect.Slice:\n\t\t\tif fieldT.Type == sliceOfInts {\n\t\t\t\tformVals := form[tag]\n\t\t\t\tfieldV.Set(reflect.MakeSlice(reflect.SliceOf(reflect.TypeOf(int(1))), len(formVals), len(formVals)))\n\t\t\t\tfor i := 0; i < len(formVals); i++ {\n\t\t\t\t\tval, err := strconv.Atoi(formVals[i])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfieldV.Index(i).SetInt(int64(val))\n\t\t\t\t}\n\t\t\t} else if fieldT.Type == sliceOfStrings {\n\t\t\t\tformVals := form[tag]\n\t\t\t\tfieldV.Set(reflect.MakeSlice(reflect.SliceOf(reflect.TypeOf(\"\")), len(formVals), len(formVals)))\n\t\t\t\tfor i := 0; i < len(formVals); i++ {\n\t\t\t\t\tfieldV.Index(i).SetString(formVals[i])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3028529e8111b8f052960f4f9f4405e7", "score": "0.58207756", "text": "func (f Form) Values() map[string]interface{} {\n\treturn f.context.Values\n}", "title": "" }, { "docid": "1453dfc03269f74c82c74a14d30ec2e1", "score": "0.5729139", "text": "func ParseForm(form url.Values, obj interface{}) error {\n\treturn context.ParseForm(form, obj)\n}", "title": "" }, { "docid": "a08841c145e815f2338c69b8a5479c69", "score": "0.5714322", "text": "func (lcc *LifeCircleControl) InjectFormValues() {\n\tfmt.Println(\"++++ Inject Form Values ++++++++>---\")\n\tpage := lcc.page\n\n\t// debug print\n\tif debug.FLAG_print_form_submit_details && lcc.page.kind == core.PAGE {\n\t\tdebug.PrintFormMap(\"~ 1 ~ Request.Form\", lcc.r.PostForm)\n\t}\n\n\t// 为了迎合gorilla/schema的奇葩要求,这里需要转换格式为:FormData\n\t// version 1: for form.keys for path.segments.\n\t// TODO version 2: l2cache\n\n\t// 1) Precondition\n\tv := page.v\n\t// if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {\n\t// \tlcc.Err = errors.New(\"got/lifecircle: interface must be a pointer to struct\")\n\t// \treturn\n\t// }\n\n\t// 2) Parse array in form\n\tdata := map[string][]string{} // stores transfered FormData\n\n\tfor path, formValue := range lcc.r.PostForm {\n\n\t\t// Get something from cache.\n\t\t// is path in name Attribute need translate to \"x.y.1.z\" format\n\t\tvar (\n\t\t\tleafType reflect.Type\n\t\t\ttemplate string\n\t\t\tok bool\n\t\t)\n\t\tti := tcache.translateInfo(v.Type())\n\t\tif ti == nil {\n\t\t\tpanic(fmt.Sprintf(\"translateInfo for %v is nil!\", v.Type()))\n\t\t}\n\t\ttemplate, ok = ti.template(path)\n\t\tif !ok {\n\t\t\ttemplate, leafType = ti.create(path, v.Type())\n\t\t} else {\n\t\t\tleafType = ti.types[path]\n\t\t}\n\t\t// ---- END ----\n\n\t\t// { // DEBUG PRINT\n\t\t// \tvar k string\n\t\t// \tif leafType == nil {\n\t\t// \t\tk = \"nil\"\n\t\t// \t} else {\n\t\t// \t\tk = leafType.Kind().String()\n\t\t// \t}\n\t\t// \tfmt.Printf(\" ~~ processing key-path [%-20v],\"+\n\t\t// \t\t\" leafKind:[%v], template:[%-20v] v.type: %v\\n\",\n\t\t// \t\tpath, k, template, v.Type(),\n\t\t// \t)\n\t\t// } // ---- END DEBUG ----\n\n\t\t// issue #4: in github.com/gorilla/schema\n\t\t// this is just a fix. filter out all empty string.\n\t\tif leafType != nil && leafType.Kind() == reflect.Slice {\n\t\t\tswitch leafType.Elem().Kind() {\n\t\t\tcase reflect.Int, reflect.Float32, reflect.Float64, reflect.Int64:\n\t\t\t\tformValue = _killEmpty(formValue, \"0\")\n\t\t\tcase reflect.String:\n\t\t\t\tformValue = _killEmpty(formValue, \" \")\n\t\t\t}\n\t\t}\n\n\t\tif template == \"\" {\n\t\t\t// no need to translate, copy the value\n\t\t\tdata[path] = formValue\n\t\t} else {\n\t\t\tfor idx, value := range formValue {\n\t\t\t\tkey := fmt.Sprintf(template, idx)\n\t\t\t\tdata[key] = []string{value}\n\t\t\t}\n\t\t}\n\t}\n\n\t// debug print\n\tif debug.FLAG_print_form_submit_details && lcc.page.kind == core.PAGE {\n\t\tdebug.PrintFormMap(\"~ 2 ~ gorilla/schema Data (Difference is array.)\", data)\n\t}\n\n\t// 3) decode\n\tInjectValues(lcc.page.proton, data)\n\n\t// { // debug print // TODO finish debug.InspectDeeply()\n\t// \tfmt.Println(\"--------- debug print -------------\")\n\t// \tdebug.DebugPrintVariable(v)\n\n\t// \tvv := v\n\t// \tif vv.Kind() == reflect.Ptr {\n\t// \t\tvv = vv.Elem()\n\t// \t}\n\t// \tvv = vv.FieldByName(\"Search\")\n\t// \tif vv.Kind() == reflect.Ptr {\n\t// \t\tvv = vv.Elem()\n\t// \t}\n\n\t// \tfor i := 0; i < vv.NumField(); i++ {\n\t// \t\tf := vv.Field(i)\n\t// \t\tfmt.Println(\">>> \", f, \" || value is: \", f.Interface())\n\t// \t}\n\n\t// }\n\n\t// debug print\n\tif debug.FLAG_print_form_submit_details {\n\t\tfmt.Println(\"\\n++++ END FORM SUBMIT LOG +++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" +\n\t\t\t\"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\\n\")\n\t}\n}", "title": "" }, { "docid": "a2446816e1b272be42d9400a8b9087a0", "score": "0.55258954", "text": "func (c *ColumnBase) UpdateFormValues(ctx *page.Context) {}", "title": "" }, { "docid": "1adc8fe48bb77aa96f99aa24c1bb797e", "score": "0.54886025", "text": "func (c *Context) FormValues() url.Values {\n\treturn c.Request.FormValues()\n}", "title": "" }, { "docid": "de3de8bbb093139316490b459b21446d", "score": "0.5460028", "text": "func GetFieldsWithValues(bf baseForm) (map[string]interface{}, map[string]interface{}) {\n\tvar (\n\t\tfieldValue = make(map[string]interface{})\n\t\tfieldTag = make(map[string]interface{})\n\t)\n\trfields := reflect.TypeOf(bf).Elem()\n\trvalues := reflect.ValueOf(bf).Elem()\n\tfor i := 0; i < rfields.NumField(); i++ {\n\t\tfield := rfields.Field(i)\n\t\tvalue := rvalues.Field(i)\n\t\ttag := field.Tag.Get(\"validate\")\n\t\tfieldValue[field.Name] = value.Interface()\n\t\tfieldTag[field.Name] = tag\n\t}\n\treturn fieldValue, fieldTag\n}", "title": "" }, { "docid": "e16e6e75e2d2d17f702ec5bc23b9a6d9", "score": "0.5428654", "text": "func processFormValues(r *http.Request) ([]string, error) {\n\tvar args []string\n\terr := r.ParseMultipartForm(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams := r.MultipartForm.Value\n\tfor key, value := range params {\n\t\tif key != \"null\" {\n\t\t\tkv := \"--\" + key + \"=\" + value[0]\n\t\t\targs = append(args, kv)\n\t\t}\n\t}\n\treturn args, nil\n}", "title": "" }, { "docid": "9b3f977cb84848254e34debc278ad474", "score": "0.53768843", "text": "func parseForm() url.Values {\n\treturn url.Values{\n\t\t\"Name\": []string{\" joeybloggs \"},\n\t\t\"Age\": []string{\"3\"},\n\t\t\"Gender\": []string{\"Male\"},\n\t\t\"Email\": []string{\"Dean.Karn@gmail.com \"},\n\t\t\"Address[0].Name\": []string{\"26 Here Blvd.\"},\n\t\t\"Address[0].Phone\": []string{\"9(999)999-9999\"},\n\t\t\"Address[1].Name\": []string{\"26 There Blvd.\"},\n\t\t\"Address[1].Phone\": []string{\"1(111)111-1111\"},\n\t\t\"active\": []string{\"true\"},\n\t\t\"Misc[ b4 ]\": []string{\" b4 \"},\n\t}\n}", "title": "" }, { "docid": "8e7c2c2ae30610aca123d59075c47a22", "score": "0.5252935", "text": "func serializeForm(sel *goquery.Selection) (url.Values, url.Values) {\n\tinput := sel.Find(\"input,button,textarea\")\n\tif input.Length() == 0 {\n\t\treturn url.Values{}, url.Values{}\n\t}\n\n\tfields := make(url.Values)\n\tbuttons := make(url.Values)\n\tinput.Each(func(_ int, s *goquery.Selection) {\n\t\tname, ok := s.Attr(\"name\")\n\t\tif ok {\n\t\t\tval, _ := s.Attr(\"value\")\n\t\t\tif t, _ := s.Attr(\"type\"); t == \"submit\" {\n\t\t\t\tbuttons.Add(name, val)\n\t\t\t} else {\n\t\t\t\tfields.Add(name, val)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn fields, buttons\n}", "title": "" }, { "docid": "94937719b600391b1490a5b034aea1e9", "score": "0.5250571", "text": "func parseForm(form url.Values, obj interface{}) error {\n\tobjT := reflect.TypeOf(obj)\n\tobjV := reflect.ValueOf(obj)\n\tif !isStructPtr(objT) {\n\t\treturn fmt.Errorf(\"%v must be a struct pointer\", obj)\n\t}\n\tobjT = objT.Elem()\n\tobjV = objV.Elem()\n\n\treturn parseFormToStruct(form, objT, objV)\n}", "title": "" }, { "docid": "86fad8e427f52a3594c2191c2949a2eb", "score": "0.5206022", "text": "func (a *Api) UpdateFromForm(form map[string][]string) {\n\tfor k, v := range form {\n\t\tswitch k {\n\t\tcase \"name\":\n\t\t\ta.Name = v[0]\n\t\tcase \"route\":\n\t\t\ta.Route = v[0]\n\t\tcase \"backends\":\n\t\t\ta.Backends = v\n\t\tcase \"groups\":\n\t\t\ta.Groups = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91cf31f97c8b6dba03b1148fda085bcc", "score": "0.5201614", "text": "func SetFormValues(from interface{}, to interface{}, skipTheseFields, onlyIncludeTheseFields []string) {\n\tif len(skipTheseFields) > 0 && len(onlyIncludeTheseFields) > 0 {\n\t\tpanic(\"Please specify only ONE OF 'skipTheseFields' or 'onlyIncludeTheseFields' for call to SetFormValues\")\n\t}\n\n\tval := reflect.ValueOf(from)\n\telm := reflect.Indirect(val)\n\n\tvalTo := reflect.ValueOf(to)\n\telmTo := reflect.Indirect(valTo)\n\n\tdupPanicAssertStructPtr(val)\n\tdupPanicAssertStructPtr(valTo)\n\noutFor:\n\tfor i := 0; i < elmTo.NumField(); i++ {\n\t\ttoF := elmTo.Field(i)\n\t\tname := elmTo.Type().Field(i).Name\n\n\t\tif len(onlyIncludeTheseFields) > 0 {\n\t\t\tmustInclude := false\n\t\t\tfor _, includeField := range onlyIncludeTheseFields {\n\t\t\t\tif includeField == name {\n\t\t\t\t\tmustInclude = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !mustInclude {\n\t\t\t\tcontinue outFor\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, skip := range skipTheseFields {\n\t\t\t\tif skip == name {\n\t\t\t\t\tcontinue outFor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tf := elm.FieldByName(name)\n\t\tif f.Kind() != reflect.Invalid {\n\t\t\t// set value if type matched\n\t\t\tif f.Type().String() == toF.Type().String() {\n\t\t\t\ttoF.Set(f)\n\t\t\t} else {\n\t\t\t\tfInt := false\n\t\t\t\tfFloat := false\n\t\t\t\tswitch f.Interface().(type) {\n\t\t\t\tcase int, int8, int16, int32, int64:\n\t\t\t\t\tfInt = true\n\t\t\t\tcase float32, float64:\n\t\t\t\t\tfFloat = true\n\t\t\t\tcase uint, uint8, uint16, uint32, uint64:\n\t\t\t\tdefault:\n\t\t\t\t\tcontinue outFor\n\t\t\t\t}\n\t\t\t\tswitch toF.Interface().(type) {\n\t\t\t\tcase int, int8, int16, int32, int64:\n\t\t\t\t\tvar v int64\n\t\t\t\t\tif fInt {\n\t\t\t\t\t\tv = f.Int()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvu := f.Uint()\n\t\t\t\t\t\tif vu > math.MaxInt64 {\n\t\t\t\t\t\t\tcontinue outFor\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv = int64(vu)\n\t\t\t\t\t}\n\t\t\t\t\tif toF.OverflowInt(v) {\n\t\t\t\t\t\tcontinue outFor\n\t\t\t\t\t}\n\t\t\t\t\ttoF.SetInt(v)\n\t\t\t\tcase float32, float64:\n\t\t\t\t\tvar v float64\n\t\t\t\t\tif fFloat {\n\t\t\t\t\t\tv = f.Float()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvu := f.String()\n\t\t\t\t\t\tv2, err := strconv.ParseFloat(vu, 32)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tcontinue outFor\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv = v2\n\t\t\t\t\t}\n\t\t\t\t\ttoF.SetFloat(v)\n\t\t\t\tcase uint, uint8, uint16, uint32, uint64:\n\t\t\t\t\tvar v uint64\n\t\t\t\t\tif fInt {\n\t\t\t\t\t\tvu := f.Int()\n\t\t\t\t\t\tif vu < 0 {\n\t\t\t\t\t\t\tcontinue outFor\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv = uint64(vu)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tv = f.Uint()\n\t\t\t\t\t}\n\t\t\t\t\tif toF.OverflowUint(v) {\n\t\t\t\t\t\tcontinue outFor\n\t\t\t\t\t}\n\t\t\t\t\ttoF.SetUint(v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2d6a3ecee1c19d90182f7ec36fdfb4ff", "score": "0.51959306", "text": "func (form FormData) Values() map[string][]string {\n\tif form.data.values == nil {\n\t\tform.parse()\n\t}\n\treturn form.data.values\n}", "title": "" }, { "docid": "04b4eda98c9bc600877ed0278735ad51", "score": "0.5172106", "text": "func GetFormValues(r *http.Request, keys ...string) ([]string, error) {\n\t// ParseForm() populates the request.Form prior to using FormValue()\n\tif err := r.ParseForm(); err != nil {\n\t\treturn nil, err\n\t}\n\tarrayOfValues := make([]string, len(keys))\n\tfor i, j := range keys {\n\t\tarrayOfValues[i] = r.FormValue(j)\n\t}\n\tif len(arrayOfValues) != 0 {\n\t\tif arrayOfValues[0] == \"\" {\n\t\t\treturn nil, errors.New(\"Form Values Empty\")\n\t\t}\n\t}\n\treturn arrayOfValues, nil\n}", "title": "" }, { "docid": "661cb0ed4dda0486c8ea142334c4be6b", "score": "0.51646966", "text": "func mapForm(formStruct reflect.Value, form map[string][]string,\n\tformfile map[string][]*multipart.FileHeader, errors Errors) {\n\n\tif formStruct.Kind() == reflect.Ptr {\n\t\tformStruct = formStruct.Elem()\n\t}\n\ttyp := formStruct.Type()\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\ttypeField := typ.Field(i)\n\t\tstructField := formStruct.Field(i)\n\n\t\tif typeField.Type.Kind() == reflect.Ptr && typeField.Anonymous {\n\t\t\tstructField.Set(reflect.New(typeField.Type.Elem()))\n\t\t\tmapForm(structField.Elem(), form, formfile, errors)\n\t\t\tif reflect.DeepEqual(structField.Elem().Interface(), reflect.Zero(structField.Elem().Type()).Interface()) {\n\t\t\t\tstructField.Set(reflect.Zero(structField.Type()))\n\t\t\t}\n\t\t} else if typeField.Type.Kind() == reflect.Struct {\n\t\t\tmapForm(structField, form, formfile, errors)\n\t\t} else if inputFieldName := typeField.Tag.Get(\"form\"); inputFieldName != \"\" {\n\t\t\tif !structField.CanSet() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tinputValue, exists := form[inputFieldName]\n\t\t\tinputFile, existsFile := formfile[inputFieldName]\n\t\t\tif exists && !existsFile {\n\t\t\t\tnumElems := len(inputValue)\n\t\t\t\tif structField.Kind() == reflect.Slice && numElems > 0 {\n\t\t\t\t\tsliceOf := structField.Type().Elem().Kind()\n\t\t\t\t\tslice := reflect.MakeSlice(structField.Type(), numElems, numElems)\n\t\t\t\t\tfor i := 0; i < numElems; i++ {\n\t\t\t\t\t\tsetWithProperType(sliceOf, inputValue[i], slice.Index(i), inputFieldName, errors)\n\t\t\t\t\t}\n\t\t\t\t\tformStruct.Field(i).Set(slice)\n\t\t\t\t} else {\n\t\t\t\t\tkind := typeField.Type.Kind()\n\t\t\t\t\tif structField.Kind() == reflect.Ptr {\n\t\t\t\t\t\tstructField.Set(reflect.New(typeField.Type.Elem()))\n\t\t\t\t\t\tstructField = structField.Elem()\n\t\t\t\t\t\tkind = typeField.Type.Elem().Kind()\n\t\t\t\t\t}\n\t\t\t\t\tsetWithProperType(kind, inputValue[0], structField, inputFieldName, errors)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !existsFile {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfhType := reflect.TypeOf((*multipart.FileHeader)(nil))\n\t\t\tnumElems := len(inputFile)\n\t\t\tif structField.Kind() == reflect.Slice && numElems > 0 && structField.Type().Elem() == fhType {\n\t\t\t\tslice := reflect.MakeSlice(structField.Type(), numElems, numElems)\n\t\t\t\tfor i := 0; i < numElems; i++ {\n\t\t\t\t\tslice.Index(i).Set(reflect.ValueOf(inputFile[i]))\n\t\t\t\t}\n\t\t\t\tstructField.Set(slice)\n\t\t\t} else if structField.Type() == fhType {\n\t\t\t\tstructField.Set(reflect.ValueOf(inputFile[0]))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8850d8981addfab8b323e5f2dd5d0146", "score": "0.51599395", "text": "func decodeFormIntoStruct(r *http.Request, e interface{}) error {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Gorilla decoder to decode form into struct\n\tdecoder := schema.NewDecoder()\n\n\tlog.Println(\"r.PostForm :\", r.PostForm)\n\t// r.PostForm now has a map of our POST form values\n\tif err = decoder.Decode(e, r.PostForm); err != nil {\n\t\tlog.Println(\"Error decoding.\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "41139fb91ea62fd5e049a9645547b261", "score": "0.51242536", "text": "func AssignForm(form any, data map[string]any) {\n\ttyp := reflect.TypeOf(form)\n\tval := reflect.ValueOf(form)\n\n\tfor typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t\tval = val.Elem()\n\t}\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\n\t\tfieldName := field.Tag.Get(\"form\")\n\t\t// Allow ignored fields in the struct\n\t\tif fieldName == \"-\" {\n\t\t\tcontinue\n\t\t} else if len(fieldName) == 0 {\n\t\t\tfieldName = util.ToSnakeCase(field.Name)\n\t\t}\n\n\t\tdata[fieldName] = val.Field(i).Interface()\n\t}\n}", "title": "" }, { "docid": "b3bebc1ea538d5aa6f5f4176ecc6f8ca", "score": "0.5114165", "text": "func ConvertJSONToMetaValues(reader io.Reader, metaors []Metaor) (*MetaValues, error) {\n\tvar (\n\t\terr error\n\t\tvalues = map[string]interface{}{}\n\t\tdecoder = json.NewDecoder(reader)\n\t)\n\n\tif err = decoder.Decode(&values); err == nil {\n\t\treturn convertMapToMetaValues(values, metaors)\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "d5adc90319111cb54bab08d63a7e5c0e", "score": "0.5107137", "text": "func (r *resolver) ParseFieldMeta(meta string) map[string]string {\n\toutput := make(map[string]string, 0)\n\tcaps := r.metaRx.FindAllStringSubmatch(meta, -1)\n\tfor _, c := range caps {\n\t\toutput[c[1]] = strings.Split(c[2], \",\")[0]\n\t}\n\treturn output\n}", "title": "" }, { "docid": "19875d205326e4da7b578df7547af5b1", "score": "0.507018", "text": "func (o *AssigneeFormAssignee) GetMeta() map[string]interface{} {\n\tif o == nil || o.Meta == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Meta\n}", "title": "" }, { "docid": "c8f98dc8cff6150f2b2c9612de5f2dc1", "score": "0.50648737", "text": "func (r *Request) Form() url.Values {\n\tif r.form == nil {\n\t\tr.form = make(url.Values)\n\t}\n\treturn r.form\n}", "title": "" }, { "docid": "24646a073608409a3402278370b44157", "score": "0.5062982", "text": "func (f *FastHttpMultipartForm) GetValues() url.Values {\n\treturn url.Values(f.Form.Value)\n}", "title": "" }, { "docid": "0ffd5e5ffddd535871221de1bb464b7e", "score": "0.5046409", "text": "func parseFormTag(fieldT reflect.StructField) (label, name, fType string, id string, class string, ignored bool, required bool) {\n\ttags := strings.Split(fieldT.Tag.Get(\"form\"), \",\")\n\tlabel = fieldT.Name + \": \"\n\tname = fieldT.Name\n\tfType = \"text\"\n\tignored = false\n\tid = fieldT.Tag.Get(\"id\")\n\tclass = fieldT.Tag.Get(\"class\")\n\n\trequired = false\n\trequiredField := fieldT.Tag.Get(\"required\")\n\tif requiredField != \"-\" && requiredField != \"\" {\n\t\trequired, _ = strconv.ParseBool(requiredField)\n\t}\n\n\tswitch len(tags) {\n\tcase 1:\n\t\tif tags[0] == \"-\" {\n\t\t\tignored = true\n\t\t}\n\t\tif len(tags[0]) > 0 {\n\t\t\tname = tags[0]\n\t\t}\n\tcase 2:\n\t\tif len(tags[0]) > 0 {\n\t\t\tname = tags[0]\n\t\t}\n\t\tif len(tags[1]) > 0 {\n\t\t\tfType = tags[1]\n\t\t}\n\tcase 3:\n\t\tif len(tags[0]) > 0 {\n\t\t\tname = tags[0]\n\t\t}\n\t\tif len(tags[1]) > 0 {\n\t\t\tfType = tags[1]\n\t\t}\n\t\tif len(tags[2]) > 0 {\n\t\t\tlabel = tags[2]\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c9312103d4b6184a1d6e743f8e668c2a", "score": "0.5023181", "text": "func Form(formStruct interface{}) martini.Handler {\n\treturn func(context martini.Context, req *http.Request) {\n\t\tensureNotPointer(formStruct)\n\t\tformStruct := reflect.New(reflect.TypeOf(formStruct))\n\t\terrors := newErrors()\n\t\tparseErr := req.ParseForm()\n\n\t\tif parseErr != nil {\n\t\t\terrors.Overall[DeserializationError] = parseErr.Error()\n\t\t}\n\n\t\ttyp := formStruct.Elem().Type()\n\n\t\tfor i := 0; i < typ.NumField(); i++ {\n\t\t\ttypeField := typ.Field(i)\n\t\t\tif inputFieldName := typeField.Tag.Get(\"form\"); inputFieldName != \"\" {\n\t\t\t\tinputValue := req.Form.Get(inputFieldName)\n\t\t\t\tstructField := formStruct.Elem().Field(i)\n\n\t\t\t\tif !structField.CanSet() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tsetWithProperType(typeField, inputValue, structField, inputFieldName, errors)\n\t\t\t}\n\t\t}\n\n\t\tcontext.Invoke(Validate(formStruct.Interface()))\n\n\t\terrors.combine(getErrors(context))\n\n\t\tcontext.Map(*errors)\n\t\tcontext.Map(formStruct.Elem().Interface())\n\t}\n}", "title": "" }, { "docid": "651028e555b5d3f4df81032adaf23c27", "score": "0.49533236", "text": "func (g *Gas) UnmarshalForm(dst interface{}) error {\n\tdv := reflect.ValueOf(dst)\n\tif dv.Kind() != reflect.Ptr {\n\t\treturn errNotStructPointer\n\t}\n\tdv = dv.Elem()\n\tif dv.Kind() != reflect.Struct {\n\t\treturn errNotStructPointer\n\t}\n\tdt := dv.Type()\n\n\tfor i := 0; i < dv.NumField(); i++ {\n\t\tfield := dv.Field(i)\n\t\ttf := dt.Field(i)\n\t\tkey := tf.Tag.Get(\"form\")\n\t\tif key == \"\" {\n\t\t\tkey = tf.Name\n\t\t}\n\t\tval := g.FormValue(key)\n\t\tif len(val) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// handle common non-core types\n\t\tfi := field.Interface()\n\t\tswitch v := fi.(type) {\n\t\tcase encoding.TextUnmarshaler:\n\t\t\terr := v.UnmarshalText([]byte(val))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\tcase time.Time:\n\t\t\tformat := tf.Tag.Get(\"timeFormat\")\n\t\t\tvar t time.Time\n\t\t\tif format == \"\" {\n\t\t\t\tn, err := strconv.ParseInt(val, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt = time.Unix(n, 0)\n\t\t\t} else {\n\t\t\t\tvar err error\n\t\t\t\tt, err = time.Parse(format, val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tfield.Set(reflect.ValueOf(t))\n\t\t\tcontinue\n\t\t}\n\n\t\t// handle core types\n\t\tswitch field.Kind() {\n\t\tcase reflect.Bool:\n\t\t\tx, err := strconv.ParseBool(val)\n\t\t\tif err != nil {\n\t\t\t\tif val == \"on\" {\n\t\t\t\t\tfield.SetBool(true)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfield.SetBool(x)\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tif val == \"\" {\n\t\t\t\tfield.SetInt(0)\n\t\t\t} else {\n\t\t\t\tx, err := strconv.ParseInt(val, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfield.SetInt(x)\n\t\t\t}\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tif val == \"\" {\n\t\t\t\tfield.SetUint(0)\n\t\t\t} else {\n\t\t\t\tx, err := strconv.ParseUint(val, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfield.SetUint(x)\n\t\t\t}\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tif val == \"\" {\n\t\t\t\tfield.SetFloat(0.0)\n\t\t\t} else {\n\t\t\t\tx, err := strconv.ParseFloat(val, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfield.SetFloat(x)\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\ts, err := url.QueryUnescape(val)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfield.SetString(s)\n\t\t//case reflect.Slice: // byte slice\n\t\tdefault:\n\t\t\treturn fmt.Errorf(errUnsupportedKind, key, fi)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0e21dde480bffc413bb30f76f1f8a22", "score": "0.49469823", "text": "func (a *Context) FormValue(key string) string {\n\treturn a.Request.PostFormValue(key)\n}", "title": "" }, { "docid": "e685f2fb0510464c2a4bb73c0c9e3ff4", "score": "0.49372497", "text": "func getFormData(req *http.Request) (url.Values, error) {\n\tif err := req.ParseForm(); err != nil {\n\t\treturn url.Values{}, err\n\t}\n\treturn req.Form, nil\n}", "title": "" }, { "docid": "6bd06118ee566f76dcf498462aefce86", "score": "0.49000022", "text": "func getFormData(ctx iris.Context, values interface{}) bool {\n\tisEmpty := true\n\n\tmyData := make(map[string]interface{})\n\titems := reflect.ValueOf(values).Elem()\n\tfor i := 0; i < items.NumField(); i++ {\n\t\t//obtiene el nombre del campo de la estructura\n\t\tfieldName := items.Type().Field(i).Name\n\n\t\t//obtiene el nombre del campo del \"tag\" (json) de la estructura\n\t\tjsonFieldName := items.Type().Field(i).Tag.Get(tagName)\n\n\t\t//obtiene el valor\n\t\tvalue := ctx.Request().FormValue(jsonFieldName)\n\n\t\t//convierte a el tipo de dato correspondiente\n\t\tmyData[fieldName] = parseValue(value, items.Type().Field(i).Type.String())\n\n\t\tif value != \"\" {\n\t\t\tisEmpty = false\n\t\t}\n\t}\n\t//si hay datos en el request entonces decodifica y lo convierte en estructura\n\tif isEmpty == false {\n\t\tmapstructure.Decode(myData, &values)\n\t}\n\t//fmt.Println(\"%v\", values)\n\t// fmt.Println(\"%v\", isEmpty)\n\treturn isEmpty\n}", "title": "" }, { "docid": "26d2c44c3448682174c40c017a1ba14a", "score": "0.48849148", "text": "func (s *Setting) ParseFormValue(v []string) {\n\tswitch s.DataType {\n\tcase s.DataType.Boolean():\n\t\ttempV := len(v) == 1 && v[0] == \"on\"\n\t\tif tempV {\n\t\t\ts.Value = \"1\"\n\t\t} else {\n\t\t\ts.Value = \"0\"\n\t\t}\n\tcase s.DataType.DateTime():\n\t\tif len(v) == 1 && v[0] != \"\" {\n\t\t\ts.Value = v[0] + \":00\"\n\t\t} else {\n\t\t\ts.Value = \"\"\n\t\t}\n\tdefault:\n\t\tif len(v) == 1 && v[0] != \"\" {\n\t\t\ts.Value = v[0]\n\t\t} else {\n\t\t\ts.Value = \"\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31bfdb7a01c9a1eeb87108ea158ecbb4", "score": "0.4868705", "text": "func ParseForm(r *http.Request, destinationForm interface{}) error {\n\tif err := r.ParseForm(); err != nil {\n\t\treturn err\n\n\t}\n\t//var form SignUpForm\n\tdecoder := schema.NewDecoder()\n\tif err := decoder.Decode(destinationForm, r.PostForm); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "711b64bda0a05cc3ea521bf4621617ae", "score": "0.48597264", "text": "func (this *StrongParamsRequireOne) PostForm(request *http.Request) ReturnOfType {\n\treturn this.Values(request.PostForm)\n}", "title": "" }, { "docid": "efcb8ec76dd38c7e5b973268bfe5febe", "score": "0.4856381", "text": "func (c *Controller) ParseForm(obj interface{}) error {\n\treturn parseForm(c.R.Form, obj)\n}", "title": "" }, { "docid": "9570a7071a7ba345d243697e0057b476", "score": "0.48317882", "text": "func (context *Context) FormValue(name string) string {\n\treturn context.Request.Form.Get(name)\n}", "title": "" }, { "docid": "a94deb9ccf108af86f9f37d9cd2b6cfe", "score": "0.48311487", "text": "func (t *Transaction) Form() url.Values {\n\t// cause ParseMultipartForm to be called with\n\tconst maxMemory = 32 << 20 // 32 MB (matches defaultMaxMemory of go/net/http/request.go)\n\tif t.Request.PostForm == nil {\n\t\tt.Request.ParseMultipartForm(maxMemory)\n\t}\n\t// ignore error (complains if the conent type is not multipart)\n\treturn t.Request.PostForm\n}", "title": "" }, { "docid": "62c162b63e84f657a56c740c9764ab73", "score": "0.48099187", "text": "func mapForm(path string, formStruct reflect.Value, form map[string][]string, formfile map[string][]*multipart.FileHeader) error {\n\tformStruct = reflect.Indirect(formStruct)\n\ttyp := formStruct.Type()\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\ttypeField := typ.Field(i)\n\t\tstructField := formStruct.Field(i)\n\n\t\tinputFieldName := typeField.Tag.Get(\"form\")\n\t\tif inputFieldName == \"\" {\n\t\t\tinputFieldName = strings.ToLower(typeField.Name)\n\t\t}\n\n\t\tif typeField.Anonymous {\n\t\t\tif typeField.Type.Kind() == reflect.Ptr {\n\t\t\t\tstructField.Set(reflect.New(typeField.Type.Elem()))\n\t\t\t\tif err := mapForm(path, structField.Elem(), form, formfile); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif reflect.DeepEqual(structField.Elem().Interface(), reflect.Zero(structField.Elem().Type()).Interface()) {\n\t\t\t\t\tstructField.Set(reflect.Zero(structField.Type()))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := mapForm(path, structField, form, formfile); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t} else if structField.Kind() == reflect.Slice && structField.Type().Elem() == fhType {\n\t\t\t//slice of file uploads\n\t\t\tinputFile, exists := formfile[path+inputFieldName]\n\t\t\tif exists {\n\t\t\t\tnumFiles := len(inputFile)\n\t\t\t\tif numFiles > 0 {\n\t\t\t\t\tslice := reflect.MakeSlice(structField.Type(), numFiles, numFiles)\n\t\t\t\t\tfor i := 0; i < numFiles; i++ {\n\t\t\t\t\t\tslice.Index(i).Set(reflect.ValueOf(inputFile[i]))\n\t\t\t\t\t}\n\t\t\t\t\tstructField.Set(slice)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if structField.Type() == fhType {\n\t\t\t//single file\n\t\t\tinputFile, exists := formfile[path+inputFieldName]\n\t\t\tif exists && len(inputFile) >= 1 {\n\t\t\t\tstructField.Set(reflect.ValueOf(inputFile[0]))\n\t\t\t}\n\t\t} else if typeField.Type.Kind() == reflect.Ptr && typeField.Type.Elem().Kind() == reflect.Struct {\n\t\t\t//find if we have posted this field and or need to init the pointer\n\t\t\tfor key, _ := range form {\n\t\t\t\tif strings.HasPrefix(key, path+inputFieldName+\".\") {\n\t\t\t\t\tif structField.IsNil() {\n\t\t\t\t\t\tstructField.Set(reflect.New(typeField.Type.Elem()))\n\t\t\t\t\t}\n\t\t\t\t\tif err := mapForm(path+inputFieldName+\".\", structField.Elem(), form, formfile); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else if typeField.Type.Kind() == reflect.Struct {\n\t\t\tif err := mapForm(path+inputFieldName+\".\", structField, form, formfile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if typeField.Type.Kind() == reflect.Slice &&\n\t\t\t(typeField.Type.Elem().Kind() == reflect.Struct ||\n\t\t\t\t(typeField.Type.Elem().Kind() == reflect.Ptr && typeField.Type.Elem().Elem().Kind() == reflect.Struct)) {\n\n\t\t\t//size slice (if necessary)\n\t\t\tsize := pathSliceSize(path+inputFieldName, form)\n\t\t\tif structField.Len() < size {\n\t\t\t\tvalue := reflect.MakeSlice(structField.Type(), size, size)\n\t\t\t\tif structField.Len() > 0 {\n\t\t\t\t\treflect.Copy(value, structField)\n\t\t\t\t}\n\t\t\t\tstructField.Set(value)\n\t\t\t}\n\n\t\t\t//assign structs\n\t\t\tfor i := 0; i < size; i++ {\n\t\t\t\tsliceValue := structField.Index(i)\n\t\t\t\tif sliceValue.Kind() == reflect.Ptr && sliceValue.IsNil() {\n\t\t\t\t\tsliceValue.Set(reflect.New(sliceValue.Type().Elem()))\n\t\t\t\t}\n\t\t\t\tif err := mapForm(path+inputFieldName+\".\"+strconv.Itoa(i)+\".\", sliceValue, form, formfile); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else if inputFieldName := typeField.Tag.Get(\"form\"); inputFieldName != \"\" {\n\t\t\tif !structField.CanSet() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tinputValue, exists := form[path+inputFieldName]\n\t\t\tif exists {\n\t\t\t\tnumElems := len(inputValue)\n\t\t\t\tif structField.Kind() == reflect.Slice && numElems > 0 {\n\t\t\t\t\tsliceOf := structField.Type().Elem().Kind()\n\t\t\t\t\tslice := reflect.MakeSlice(structField.Type(), numElems, numElems)\n\t\t\t\t\tfor i := 0; i < numElems; i++ {\n\t\t\t\t\t\tsetWithProperType(sliceOf, inputValue[i], slice.Index(i), inputFieldName)\n\t\t\t\t\t}\n\t\t\t\t\tformStruct.Field(i).Set(slice)\n\t\t\t\t} else {\n\t\t\t\t\tsetWithProperType(typeField.Type.Kind(), inputValue[0], structField, inputFieldName)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f9d085f27af096feb08a87d5754d660", "score": "0.47929686", "text": "func (ctx *Context) FormValue(name string) string {\n\treturn ctx.ginContext.Request.FormValue(name)\n}", "title": "" }, { "docid": "34f893aa7b0315b78147256a4d11116f", "score": "0.4758691", "text": "func FromMeta(m *q.Metadata) (*Metadata, error) {\n\tt, err := ptypes.TimestampProto(m.Created)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot parse timestamp\")\n\t}\n\treturn &Metadata{Id: fmt.Sprint(m.ID), Created: t, Tags: FromTags(m.Tags.Get())}, nil\n}", "title": "" }, { "docid": "ef0f8d43c2ad055ea85dff93c1b825bd", "score": "0.47531876", "text": "func GetRequesterValuesFromForm(req *http.Request) (string, string) {\n\tissuer := req.FormValue(\"iss\")\n\tclientID := req.FormValue(\"client_id\")\n\n\tif clientID == \"\" {\n\t\tclientID = req.FormValue(\"aud\")\n\t}\n\n\treturn issuer, clientID\n}", "title": "" }, { "docid": "322f40fec691430f93cffaa660f2a8d0", "score": "0.47399956", "text": "func get_form(req *http.Request) {\n\t// clear old variables\n\tfor _, env_raw := range os.Environ() {\n\t\tenv := strings.SplitN(env_raw, \"=\", 2)\n\t\tif strings.HasPrefix(env[0], \"v_\") && len(env[0]) > 2 {\n\t\t\terr := os.Unsetenv(env[0])\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// set new\n\terr := req.ParseForm()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfor key, value := range req.Form {\n\t\tos.Setenv(\"v_\"+key, strings.Join(value, \",\"))\n\t}\n}", "title": "" }, { "docid": "1ea32bd50a5a6492898621e050331c1a", "score": "0.47362572", "text": "func Unpack(req *http.Request, ptr interface{}) error {\n\tif err := req.ParseForm(); err != nil {\n\t\treturn err\n\t}\n\tfields := make(map[string]valueValidator)\n\tv := reflect.ValueOf(ptr).Elem()\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfieldInfo := v.Type().Field(i) // reflect.StructField\n\t\ttag := fieldInfo.Tag // reflect.StructTag\n\t\tname := tag.Get(\"http\")\n\t\tif name == \"\" {\n\t\t\tname = strings.ToLower(fieldInfo.Name)\n\t\t}\n\t\tvalidatorTag := tag.Get(\"validator\")\n\t\tvalidator := GetValidator(validatorTag)\n\t\tfields[name] = valueValidator{v.Field(i), validator}\n\t}\n\tfor name, values := range req.Form {\n\t\tf := fields[name].value\n\t\tvalidator := fields[name].validator\n\t\tif !f.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, value := range values {\n\t\t\tif f.Kind() == reflect.Slice {\n\t\t\t\telem := reflect.New(f.Type().Elem()).Elem()\n\t\t\t\tif err := populate(elem, validator, value); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"%s: %v\", name, err)\n\t\t\t\t}\n\t\t\t\tf.Set(reflect.Append(f, elem))\n\t\t\t} else {\n\t\t\t\tif err := populate(f, validator, value); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"%s: %v\", name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0fdf1696ddfb47e5db9983713d35c05", "score": "0.4734879", "text": "func (Formality) Values() []Formality {\n\treturn []Formality{\n\t\t\"FORMAL\",\n\t\t\"INFORMAL\",\n\t}\n}", "title": "" }, { "docid": "e709bfe5410277c8a17c06414ea6fb39", "score": "0.4715592", "text": "func (api *API) extractPostForms(c *gin.Context, formNames ...string) (map[string]string, string) {\n\tforms := make(map[string]string)\n\tfor _, name := range formNames {\n\t\tvalue, exists := c.GetPostForm(name)\n\t\tif !exists {\n\t\t\treturn nil, name\n\t\t}\n\t\tforms[name] = value\n\t}\n\treturn forms, \"\"\n}", "title": "" }, { "docid": "284ffb3e8241e6528738f9b9578c7b4a", "score": "0.47117454", "text": "func (ctx *HttpContext) FormValue(key string) string {\n\treturn ctx.request.FormValue(key)\n}", "title": "" }, { "docid": "08ef0f85522a48902307a51088c748a7", "score": "0.47011986", "text": "func Values(obj interface{}) (map[string]interface{}, error) {\n\tobjValue, err := getReflectValue(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalueMap := map[string]interface{}{}\n\tobjType := objValue.Type()\n\tfor i := 0; i < objValue.NumField(); i++ {\n\t\tfieldType := objType.Field(i)\n\t\tfieldValue := objValue.Field(i)\n\n\t\tif fieldValue.CanInterface() {\n\t\t\tvalueMap[fieldType.Name] = fieldValue.Interface()\n\t\t}\n\t}\n\n\treturn valueMap, nil\n}", "title": "" }, { "docid": "18dc586cd7bf96b7afd8f801fc2f8bf0", "score": "0.4687479", "text": "func (r *Request) FillForm(m interface{}) error {\n\tformMeta, err := InspectForm(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tform := reflect.Indirect(reflect.New(*formMeta.Type))\n\tfor fieldName, fieldConf := range formMeta.FieldMap {\n\t\tvar v string\n\t\tif fieldConf.FromPath {\n\t\t\tv = r.PathParam(fieldConf.ParamName)\n\t\t} else if fieldConf.FromHeader {\n\t\t\tv = r.Header(fieldConf.ParamName)\n\t\t} else if fieldConf.FromCookie {\n\t\t\tv = r.Cookie(fieldConf.ParamName)\n\t\t} else {\n\t\t\tv = r.Param(fieldConf.ParamName)\n\t\t}\n\n\t\tif fieldConf.IsRequired && v == \"\" {\n\t\t\treturn newFormError(FormErrMissingRequired, fieldConf.ParamName, nil)\n\t\t}\n\n\t\tvalue, err := StringCast(v, fieldConf.Type)\n\t\tif err != nil {\n\t\t\tif !fieldConf.IsRequired {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn newFormError(FormErrTypeCannotCast, fieldConf.ParamName, err)\n\t\t}\n\n\t\tfieldV := form.FieldByName(fieldName)\n\t\tvv := reflect.ValueOf(value)\n\t\tif fieldV.CanSet() && vv.IsValid() {\n\t\t\tfieldV.Set(vv)\n\t\t}\n\t}\n\n\tmV := reflect.Indirect(reflect.ValueOf(m))\n\tmV.Set(form)\n\n\t// Validate required\n\tif vd, ok := m.(FormValidator); ok {\n\t\terr = vd.ValidateForm()\n\t\tif err != nil {\n\t\t\treturn newFormError(FormErrNotAValidForm, \"\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b52db52206f18bfd577abd31073b542d", "score": "0.46791533", "text": "func extractURLValues(req *http.Request) (form url.Values, query url.Values, err error) {\n\tif query, err = url.ParseQuery(req.URL.RawQuery); err != nil {\n\t\treturn\n\t}\n\t// Blank RawQuery before parsing the rest of the form\n\treq.URL.RawQuery = \"\"\n\n\terr = req.ParseForm()\n\tform = req.Form\n\treturn\n}", "title": "" }, { "docid": "ec28da6dfc72ae05b7133761d1bfe350", "score": "0.4674737", "text": "func (c *Context) FormValue(name string) string {\n\treturn c.req.FormValue(name)\n}", "title": "" }, { "docid": "42cc370a54f1e368932869685e6338b1", "score": "0.46686396", "text": "func (c *Context) FormValue(key string) string {\n\treturn c.Request.FormValue(key)\n}", "title": "" }, { "docid": "ee40a533c7fb8ce7b1ed80630f4612be", "score": "0.46664298", "text": "func (s *View) Meta(options ...MetaOption) (ret map[string]interface{}) {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tr := MetaInt{}\n\tr.ApplyOption(s, options...)\n\treturn map[string]interface{}(r)\n}", "title": "" }, { "docid": "e5349cc86d46344fcf6bce7bc08382c4", "score": "0.4661972", "text": "func Form(req *http.Request, userStruct FieldMapper) error {\n\terr := formBinder(req, userStruct)\n\tif len(err) > 0 {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07b602c360c5e2ce561fb4840961a794", "score": "0.46476063", "text": "func (c *Context) FormValue(name string) string {\n\treturn c.request.FormValue(name)\n}", "title": "" }, { "docid": "07b602c360c5e2ce561fb4840961a794", "score": "0.46476063", "text": "func (c *Context) FormValue(name string) string {\n\treturn c.request.FormValue(name)\n}", "title": "" }, { "docid": "8bf0e8804ccb492568decb8e11c22229", "score": "0.46330598", "text": "func (c *Context) Form(key string) string {\n\treturn c.Request.PostFormValue(key)\n}", "title": "" }, { "docid": "665657f2aa1bb65f8c763c4aeefa00dc", "score": "0.46110183", "text": "func FormValue(r *http.Request, json map[string]interface{}, key string) string {\n\t// query args have priority\n\tres := r.FormValue(key)\n\tif res != \"\" {\n\t\tlog.Debugf(\"key %q in query args so using that value %q\", key, res)\n\t\treturn res\n\t}\n\tif json == nil { // When called from uihandler we don't have a json map.\n\t\tlog.Debugf(\"no json data so returning empty string for key %q\", key)\n\t\treturn \"\"\n\t}\n\tres2, found := json[key]\n\tif !found {\n\t\tlog.Debugf(\"key %q not in json map\", key)\n\t\treturn \"\"\n\t}\n\tres, ok := res2.(string)\n\tif !ok {\n\t\tlog.Warnf(\"%q is %+v / not a string, can't be used\", key, res2)\n\t\treturn \"\"\n\t}\n\tlog.LogVf(\"Getting %q from json: %q\", key, res)\n\treturn res\n}", "title": "" }, { "docid": "2a63309829b4cc4cf07379fe7abe99f1", "score": "0.46026322", "text": "func (c *Context) Form(key string) (string, error) {\n\tvalue, _, err := c.GetForm(key)\n\treturn value, err\n}", "title": "" }, { "docid": "8aaa5fc9d3d4f8113fc000e151d6ee92", "score": "0.4600248", "text": "func (o *UserMeta) FromUserMeta(m *UserMeta) {\n\to.UMetaId = m.UMetaId\n\to.UserId = m.UserId\n\to.MetaKey = m.MetaKey\n\to.MetaValue = m.MetaValue\n\n}", "title": "" }, { "docid": "d04d58d3ea7b0e342e336afa802129bf", "score": "0.45774907", "text": "func (rc *Ctx) FormValue(key string) (output string, err error) {\n\tif err = rc.EnsureForm(); err != nil {\n\t\treturn\n\t}\n\tif value := rc.Form.Get(key); len(value) > 0 {\n\t\toutput = value\n\t\treturn\n\t}\n\terr = NewParameterMissingError(key)\n\treturn\n}", "title": "" }, { "docid": "ffce72855e00fbf4c18d25c04ff9d994", "score": "0.4577286", "text": "func (c *Client) Form(form Value) *Client {\n\tc.headers.Set(ContentType, TypeForm)\n\tfor k, v := range form {\n\t\tc.form.Set(k, v)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "95336c928a1ea1931da74fe6edcb937b", "score": "0.4567306", "text": "func (c *Context) GetForms() (url.Values, error) {\n\tc.initPostFormCache()\n\n\tif *c.parseFrom {\n\t\treturn c.Request.Form, c.parseFromError\n\t} else {\n\t\treturn nil, c.parseFromError\n\t}\n}", "title": "" }, { "docid": "c724aa914ce99470dfa977df2584d065", "score": "0.45609343", "text": "func UnmarshalFromMeta(meta []byte) (Payload, error) {\n\tm := Meta{}\n\t// Can be optimized by using proto.NewBuffer.\n\terr := m.Unmarshal(meta)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpl, err := Unmarshal(m.Payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pl, nil\n}", "title": "" }, { "docid": "de85445bd5121a32496fe327fafbc6e9", "score": "0.45605022", "text": "func (form FormData) parse() {\n\terr := form.request.ParseForm()\n\tif err != nil {\n\t\tif _, ok := err.(url.EscapeError); ok {\n\t\t\tpanic(ErrBadRequest)\n\t\t} else if s := err.Error(); s == \"invalid semicolon separator in query\" {\n\t\t\tpanic(ErrBadRequest)\n\t\t} else if s == \"http: POST too large\" {\n\t\t\tpanic(ErrRequestEntityTooLarge)\n\t\t} else if ct := form.request.Header.Get(\"Content-Type\"); ct != \"\" {\n\t\t\tif _, _, e := mime.ParseMediaType(ct); e != nil {\n\t\t\t\tpanic(ErrBadRequest)\n\t\t\t}\n\t\t}\n\t\tpanic(\"form:\" + err.Error())\n\t}\n\tform.data.values = form.request.Form\n}", "title": "" }, { "docid": "6d30810ab977862a10392954882dc6bb", "score": "0.4555946", "text": "func (ctx *Context) FormParams() (url.Values, error) {\n\t// NOTE: 这一段逻辑使用 echo 的实现\n\n\tr := ctx.ginContext.Request\n\n\tif strings.HasPrefix(ctx.ContentType(), web.MIMEMultipartForm) {\n\t\tif err := r.ParseMultipartForm(defaultMemory); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := r.ParseForm(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ctx.ginContext.Request.Form, nil\n}", "title": "" }, { "docid": "a4a1fa40083ed43cb014725a4f72eea5", "score": "0.4545336", "text": "func buildFormDecoder() *formam.Decoder {\n\tdecoder := formam.NewDecoder(&formam.DecoderOptions{\n\t\tTagName: \"form\",\n\t\tIgnoreUnknownKeys: true,\n\t})\n\n\tdecoder.RegisterCustomType(decoders.TimeDecoderFn(), []interface{}{time.Time{}}, nil)\n\tdecoder.RegisterCustomType(decoders.NullTimeDecoderFn(), []interface{}{nulls.Time{}}, nil)\n\n\treturn decoder\n}", "title": "" }, { "docid": "601dc7210bc5cd2580f20b3e7e3169cc", "score": "0.4542533", "text": "func getAboutCustomDataFieldValues(aboutConfigMap map[string]interface{}, aboutFilePath string) map[string]interface{} {\n\n\tvalue, ok := aboutConfigMap[\"customData\"]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tmapValue, ok := value.(map[string]interface{})\n\tif !ok {\n\t\tNormalLog(fmt.Sprintf(\"Field `customData` is not a valid JSON object in %s.\", aboutFilePath))\n\t\treturn nil\n\t}\n\n\treturn mapValue\n}", "title": "" }, { "docid": "24fff1f835185c85badb161ab7405318", "score": "0.45329067", "text": "func (f *Form) PermittedValues(field string, opts ...string) {\n\tvalue := f.Get(field)\n\tif value == \"\" {\n\t\treturn\n\t}\n\tfor _, opt := range opts {\n\t\tif value == opt {\n\t\t\treturn\n\t\t}\n\t}\n\tf.Errors.Add(field, \"This field is invalid\")\n}", "title": "" }, { "docid": "f363138859638e5a7a392f04f39de2a1", "score": "0.45317745", "text": "func MakeMetaMap(git, link, twit interface{}) []byte {\n\n\tm2 := make(map[string]interface{})\n\tm2[\"Github\"] = git\n\tm2[\"Linkedin\"] = link\n\tm2[\"Twitter\"] = twit\n\n\tval, err := json.Marshal(m2)\n\tif err != nil {\n\t\tlog.Println(\"Marshal error: \", err)\n\t\treturn nil\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "178ad2c00aa4618a06cd1b87a8677e9b", "score": "0.45277745", "text": "func JsonToSignupForm(jsonForm SignupJsonForm) (form SignupForm) {\n\tform = SignupForm{\n\t\tUsername: jsonForm.Username,\n\t\tPassword: jsonForm.Password,\n\t\tPhone: jsonForm.Phone,\n\t\tEmail: jsonForm.Email,\n\t}\n\treturn form\n}", "title": "" }, { "docid": "150e8f41cd727f52117e7f6e7f32481e", "score": "0.44864425", "text": "func (o *PostMeta) FromPostMeta(m *PostMeta) {\n\to.MetaId = m.MetaId\n\to.PostId = m.PostId\n\to.MetaKey = m.MetaKey\n\to.MetaValue = m.MetaValue\n\n}", "title": "" }, { "docid": "d4bd1bde38b3e227879f10b150c38f37", "score": "0.44699928", "text": "func ToValues(target interface{}) (url.Values, error) {\r\n\tValue := reflect.Indirect(reflect.ValueOf(target))\r\n\tType := Value.Type()\r\n\t// if not struct ,return error\r\n\tif Type.Kind() != reflect.Struct {\r\n\t\treturn nil, ErrNotAStruct\r\n\t}\r\n\tvalues := url.Values{}\r\n\t// for each field in struct\r\n\tfor i := 0; i < Type.NumField(); i++ {\r\n\t\tfield := Type.Field(i)\r\n\t\tkey := field.Name\r\n\t\t// if it has a schema struct tag , use it as key\r\n\t\tif tagValue, ok := field.Tag.Lookup(\"schema\"); ok {\r\n\t\t\tif tagValue == \"-\" {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tkey = tagValue\r\n\t\t}\r\n\t\tfieldValue := reflect.Indirect(Value.FieldByName(field.Name))\r\n\t\t// if the filed is a slice or an array\r\n\t\tif fieldKind := fieldValue.Kind(); fieldKind == reflect.Slice || fieldKind == reflect.Array {\r\n\t\t\tvalue := Value.FieldByName(field.Name)\r\n\t\t\tfor i := 0; i < value.Len(); i++ {\r\n\t\t\t\t// put each element of the array in the map , keyed by the same key\r\n\t\t\t\tvalues.Add(key, fmt.Sprint(value.Index(i).Interface()))\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// or put the value of the field in the map directly\r\n\t\t\tvalues.Set(key, fmt.Sprint(Value.FieldByName(field.Name).Interface()))\r\n\r\n\t\t}\r\n\t}\r\n\treturn values, nil\r\n}", "title": "" }, { "docid": "d60d17dca46bae8274a375ac378516d8", "score": "0.44522786", "text": "func (c *Context) FormParams() (url.Values, error) {\n\tif strings.HasPrefix(c.req.Header.Get(HeaderContentType), MIMEMultipartForm) {\n\t\tif err := c.req.ParseMultipartForm(MaxMemoryLimit); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := c.req.ParseForm(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn c.req.Form, nil\n}", "title": "" }, { "docid": "1ce49211f73e5294b0f1f98d698fa775", "score": "0.44459817", "text": "func formPartToPayload(field, data string, p *payload) {\n\tif field == \"text\" {\n\t\tp.UserText = data\n\t} else if field == \"app\" {\n\t\tp.AppName = data\n\t} else if field == \"version\" {\n\t\tp.Data[\"Version\"] = data\n\t} else if field == \"user_agent\" {\n\t\tp.Data[\"User-Agent\"] = data\n\t} else if field == \"label\" {\n\t\tp.Labels = append(p.Labels, data)\n\t} else {\n\t\tp.Data[field] = data\n\t}\n}", "title": "" }, { "docid": "2e5287af64a904f22228a129d276e4bd", "score": "0.443991", "text": "func toMobileRedirectSettings(in interface{}) *v1alpha1.MobileRedirectSettings {\n\tif m, ok := in.(map[string]interface{}); ok {\n\t\tmobileRedirectSettings := &v1alpha1.MobileRedirectSettings{}\n\t\tfor key, value := range m {\n\t\t\tswitch key {\n\t\t\tcase cfsMobileRedirectStatus:\n\t\t\t\tmobileRedirectSettings.Status = clients.ToString(value)\n\t\t\tcase cfsMobileRedirectSubdomain:\n\t\t\t\tmobileRedirectSettings.Subdomain = clients.ToString(value)\n\t\t\tcase cfsMobileRedirectStripURI:\n\t\t\t\tmobileRedirectSettings.StripURI = clients.ToBool(value)\n\t\t\t}\n\t\t}\n\n\t\treturn mobileRedirectSettings\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eaa6ad8ed88b04acb188fb8cc9b19e6f", "score": "0.44289586", "text": "func (h *HTTPSend) SetFormV2(form map[string][]string) {\n\th.Lock()\n\tdefer h.Unlock()\n\tformMap := make(map[string]string, len(form))\n\tfor key, val := range form {\n\t\tformMap[key] = val[0]\n\t}\n\th.Form = formMap\n}", "title": "" }, { "docid": "94d6fb6cfc6d0b697b78f555405c4640", "score": "0.44264337", "text": "func (scheme *Field) Meta() []interface{} {\n\treturn scheme.metadata\n}", "title": "" }, { "docid": "60f27f30224393ddae3e03f8bd30e626", "score": "0.43972275", "text": "func NewMeta(id, label, version string, inGroups []string, inputs []Input,\n subs []Sub) *Meta {\n // This is a good place to have the less readable field:value struct\n // literal format. Having it is nice because it will break the build if\n // another field is added to the struct, which makes me think twice about\n // accessors and other new-field necessities.\n return &Meta { meta_ { id, label, version, inGroups, inputs, subs },\n nil }\n}", "title": "" }, { "docid": "d0ab902213107ad68980a29ce72d07f3", "score": "0.43968457", "text": "func (c *Ctx) ParseForm() error {\n\tif c.formParsed {\n\t\treturn nil\n\t}\n\n\tif err := c.request.ParseForm(); err != nil {\n\t\treturn err\n\t}\n\n\tfor key, value := range c.params {\n\t\tc.request.Form.Add(key, value.(string))\n\t}\n\n\tc.formParsed = true\n\n\treturn nil\n}", "title": "" }, { "docid": "f07b21b814a9c45d4f54be1ffa985618", "score": "0.43948346", "text": "func (m *ModelInfo) FieldValues(i interface{}) []interface{} {\n v := reflect.ValueOf(i)\n if v.Kind() == reflect.Ptr {\n v = v.Elem()\n }\n if v.Type() != m.Type {\n log.Panicf(\"Invalid argument for FieldValues: Type mismatch. Expected %v but got %v\",\n v.Type(), m.Type)\n }\n\n fvs := []interface{}{}\n for _, field := range m.Fields {\n name := field.Name\n fieldValue := v.FieldByName(name)\n if field.Autoinc { //&& fieldValue.Interface() == reflect.Zero(field.Type).Interface() {\n continue\n } else if field.Null && fieldValue.Interface() == reflect.Zero(field.Type).Interface() {\n fvs = append(fvs, nil)\n } else {\n fvs = append(fvs, fieldValue.Interface())\n }\n }\n return fvs\n}", "title": "" }, { "docid": "e5dbd3371c7d2d126b171c5b88da051e", "score": "0.43900838", "text": "func (ru reflectionUtil) DecomposeToPostData(object interface{}) []KeyValuePairOfString {\n\tkvps := []KeyValuePairOfString{}\n\n\tobjType := ru.ReflectType(object)\n\tobjValue := ru.ReflectValue(object)\n\n\tnumberOfFields := objType.NumField()\n\tfor index := 0; index < numberOfFields; index++ {\n\t\tfield := objType.Field(index)\n\t\tvalueField := objValue.Field(index)\n\n\t\tkvp := KeyValuePairOfString{}\n\n\t\tif !field.Anonymous {\n\t\t\ttag := field.Tag.Get(\"json\")\n\t\t\tif len(tag) != 0 {\n\t\t\t\tif strings.Contains(tag, \",\") {\n\t\t\t\t\tparts := strings.Split(tag, \",\")\n\t\t\t\t\tkvp.Key = parts[0]\n\t\t\t\t} else {\n\t\t\t\t\tkvp.Key = tag\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkvp.Key = field.Name\n\t\t\t}\n\n\t\t\tif field.Type.Kind() == reflect.Slice {\n\t\t\t\t//do something special\n\t\t\t\tfor subIndex := 0; subIndex < valueField.Len(); subIndex++ {\n\t\t\t\t\titemAtIndex := valueField.Index(subIndex).Interface()\n\t\t\t\t\tfor _, prop := range ru.DecomposeToPostData(itemAtIndex) {\n\t\t\t\t\t\tif len(prop.Value) != 0 { //this is a gutcheck, it shouldn't be needed\n\t\t\t\t\t\t\tikvp := KeyValuePairOfString{}\n\t\t\t\t\t\t\tikvp.Key = fmt.Sprintf(\"%s[%d].%s\", kvp.Key, subIndex, prop.Key)\n\t\t\t\t\t\t\tikvp.Value = prop.Value\n\t\t\t\t\t\t\tkvps = append(kvps, ikvp)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvalue := ru.FollowValuePointer(valueField)\n\t\t\t\tif value != nil {\n\t\t\t\t\tkvp.Value = fmt.Sprintf(\"%v\", value)\n\t\t\t\t\tif len(kvp.Value) != 0 {\n\t\t\t\t\t\tkvps = append(kvps, kvp)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn kvps\n}", "title": "" }, { "docid": "e140fe205082dcb23ec9c6d1402679ee", "score": "0.43827918", "text": "func isMeta(value interface{}) (bool, interface{}) {\n\tset, isSet := value.(map[string]interface{})\n\tif !isSet {\n\t\treturn false, nil\n\t}\n\tif len(set) != 1 {\n\t\treturn false, nil\n\t}\n\n\t_, ok := set[\"unMeta\"]\n\tif !ok {\n\t\treturn false, nil\n\t}\n\n\treturn true, set\n}", "title": "" }, { "docid": "7d5afa9d1adc8300db647e230d8e72df", "score": "0.4370081", "text": "func parseGenericLoginForm(res *http.Response) (result *loginFormInfo, err error) {\n\tparsed, err := html.ParseFragment(res.Body, nil)\n\tif err != nil {\n\t\treturn\n\t} else if len(parsed) != 1 {\n\t\treturn nil, errors.New(\"wrong number of root elements\")\n\t}\n\n\troot := parsed[0]\n\n\tvar form loginFormInfo\n\n\thtmlForm, ok := scrape.Find(root, scrape.ByTag(atom.Form))\n\tif !ok {\n\t\treturn nil, errors.New(\"no form element found\")\n\t}\n\n\tif actionStr := getNodeAttribute(htmlForm, \"action\"); actionStr == \"\" {\n\t\tform.action = res.Request.URL.String()\n\t} else {\n\t\tactionURL, err := url.Parse(actionStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif actionURL.Host == \"\" {\n\t\t\tactionURL.Host = res.Request.URL.Host\n\t\t}\n\t\tif actionURL.Scheme == \"\" {\n\t\t\tactionURL.Scheme = res.Request.URL.Scheme\n\t\t}\n\t\tif !path.IsAbs(actionURL.Path) {\n\t\t\tactionURL.Path = path.Join(res.Request.URL.Path, actionURL.Path)\n\t\t}\n\t\tform.action = actionURL.String()\n\t}\n\n\tinputs := scrape.FindAll(root, scrape.ByTag(atom.Input))\n\tform.otherFields = url.Values{}\n\tfor _, input := range inputs {\n\t\tinputName := getNodeAttribute(input, \"name\")\n\t\tswitch getNodeAttribute(input, \"type\") {\n\t\tcase \"text\":\n\t\t\tform.usernameField = inputName\n\t\tcase \"password\":\n\t\t\tform.passwordField = inputName\n\t\tdefault:\n\t\t\tform.otherFields.Add(inputName, getNodeAttribute(input, \"value\"))\n\t\t}\n\t}\n\n\tif form.usernameField == \"\" {\n\t\treturn nil, errors.New(\"no username field found\")\n\t} else if form.passwordField == \"\" {\n\t\treturn nil, errors.New(\"no password field found\")\n\t}\n\n\treturn &form, nil\n}", "title": "" }, { "docid": "b55dda40799630f1727c18f47128cacf", "score": "0.43667683", "text": "func transformValues(params []APIParam, values map[string]string, forceRequired bool) (Values, error) {\n\tvs := Values{}\n\tfor _, p := range params {\n\t\tif v, ok := values[p.Name]; ok {\n\t\t\tvs.Set(p.Name, v)\n\t\t}\n\t}\n\n\tfor _, p := range params {\n\t\tctx := &Context{\n\t\t\tparamValues: vs,\n\t\t\tparamName: p.Name,\n\t\t}\n\n\t\t// PreModelTransformer can be used to set default value\n\t\terr := transform(ctx, p.PreModelTransformer)\n\t\tif err != nil {\n\t\t\treturn nil, ErrInvalidParam.Wrap(err, \"param: %s\", p.Name)\n\t\t}\n\t\terr = transform(ctx, p.Model.PreTransform)\n\t\tif err != nil {\n\t\t\treturn nil, ErrInvalidParam.Wrap(err, \"param: %s\", p.Name)\n\t\t}\n\t\tif ctx.Value() == \"\" {\n\t\t\tif forceRequired || p.Required {\n\t\t\t\treturn nil, ErrMissingRequiredParam.New(\"missing required param: %s\", p.Name)\n\t\t\t}\n\t\t\t// There's no value from the client or default value generate from the pre-transformer,\n\t\t\t// so we can skip the model transformer and the post-transformer\n\t\t\tcontinue\n\t\t}\n\n\t\terr = transform(ctx, p.Model.Transform)\n\t\tif err != nil {\n\t\t\treturn nil, ErrInvalidParam.Wrap(err, \"param: %s\", p.Name)\n\t\t}\n\n\t\terr = transform(ctx, p.PostModelTransformer)\n\t\tif err != nil {\n\t\t\treturn nil, ErrInvalidParam.Wrap(err, \"param: %s\", p.Name)\n\t\t}\n\t}\n\n\treturn vs, nil\n}", "title": "" }, { "docid": "b15cd527de1b0fff797586ed569d1b1d", "score": "0.43663535", "text": "func PostForm(c httpClient, u string, params url.Values) (*FormResponse, error) {\n\tresp, err := c.PostForm(u, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\tr := &FormResponse{\n\t\tStatusCode: resp.StatusCode,\n\t\trequestURI: u,\n\t}\n\n\tmediaType, _, _ := mime.ParseMediaType(resp.Header.Get(\"Content-Type\"))\n\tswitch mediaType {\n\tcase \"application/x-www-form-urlencoded\":\n\t\tvar bb []byte\n\t\tbb, err = ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\n\t\tr.values, err = url.ParseQuery(string(bb))\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\tcase \"application/json\":\n\t\tvar values map[string]interface{}\n\t\tif err := json.NewDecoder(resp.Body).Decode(&values); err != nil {\n\t\t\treturn r, err\n\t\t}\n\n\t\tr.values = make(url.Values)\n\t\tfor key, value := range values {\n\t\t\tswitch v := value.(type) {\n\t\t\tcase string:\n\t\t\t\tr.values.Set(key, v)\n\t\t\tcase int64:\n\t\t\t\tr.values.Set(key, strconv.FormatInt(v, 10))\n\t\t\tcase float64:\n\t\t\t\tr.values.Set(key, strconv.FormatFloat(v, 'f', -1, 64))\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t_, err = io.Copy(ioutil.Discard, resp.Body)\n\t\tif err != nil {\n\t\t\treturn r, err\n\t\t}\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "fcc63f6e12586a294ca899269e696791", "score": "0.4362803", "text": "func (ctx *Context) PostFormValue(name string) string {\n\treturn string(ctx.RequestCtx.PostArgs().Peek(name))\n}", "title": "" }, { "docid": "5f2565634c9a18be814d5eaf57d51e1d", "score": "0.4360097", "text": "func (f Filter) values(fields map[string]struct{}) url.Values {\n\tvals := url.Values{}\n\tfor k, v := range f {\n\t\tif _, ok := fields[k]; ok {\n\t\t\tvals.Add(k, v)\n\t\t}\n\t}\n\treturn vals\n}", "title": "" }, { "docid": "fbbd5320faed95c7f85f1a25250d8aed", "score": "0.43597913", "text": "func ToMeta(m *Metadata) (*q.Metadata, error) {\n\tid, err := ParseID(m.GetId())\n\tif err != nil {\n\t\treturn nil, e.ErrInvalid(errors.Wrap(err, \"cannot parse metadata ID\"))\n\t}\n\tcreated := time.Unix(m.GetCreated().GetSeconds(), int64(m.GetCreated().GetNanos()))\n\tmeta := &q.Metadata{ID: id, Created: created, Tags: &q.Tags{}}\n\n\t// TODO(negz): Revisit the Tags API. It's starting to feel pretty awkward.\n\tfor _, t := range ToTags(m.GetTags()) {\n\t\tmeta.Tags.AddTag(t)\n\t}\n\treturn meta, nil\n}", "title": "" }, { "docid": "0396cab104f5540b11592749f2878407", "score": "0.4356852", "text": "func (a *SignificantTermsAggregation) Meta(metaData map[string]interface{}) *SignificantTermsAggregation {\n\ta.meta = metaData\n\treturn a\n}", "title": "" }, { "docid": "199420fb367956900844ae9366e2d169", "score": "0.43500364", "text": "func (m *Monitor) setPostValues() {\n\tpostForms := make([]KVPair, 0)\n\tdb, _ := storage.UpsMoDBConn()\n\tdefer db.Close()\n\n\tpostFormRows, _ := db.Query(`SELECT\n\t\"Key\", \n\t\"Value\"\n\tFROM \"PostForms\" \n\tWHERE (\"DeletedAt\" IS NULL AND \"MonitorID\" = $1) \n\tORDER BY \"CreatedAt\"`, m.ID)\n\tdefer postFormRows.Close()\n\n\tfor postFormRows.Next() {\n\t\tpostForm := new(KVPair)\n\t\t_ = postFormRows.Scan(&postForm.Key, &postForm.Value)\n\t\tpostForms = append(postForms, *postForm)\n\t}\n\tm.PostValues = postForms\n}", "title": "" }, { "docid": "759a96abeaba1819d54fb31a5343dad2", "score": "0.43390876", "text": "func (c *Context) FormArray(key string) ([]string, error) {\n\tvalues, _, err := c.GetFormArray(key)\n\treturn values, err\n}", "title": "" }, { "docid": "8a6734af5aa9b2e28a401c2f1b697ef5", "score": "0.43334663", "text": "func (self *Cartographer) FieldValueMapFor(o interface{}) (values map[interface{}]interface{}, err error) {\n\ttyp, err := self.DiscoverType(o)\n\n\tif nil != err {\n\t\treturn\n\t}\n\n\tvalues = make(map[interface{}]interface{})\n\n\titem := reflect.ValueOf(o)\n\n\tif reflect.Ptr == item.Kind() {\n\t\titem = item.Elem()\n\t}\n\n\tfor key, _ := range self.fieldsToColumns[typ] {\n\t\tvalues[key] = item.FieldByName(key.(string)).Interface()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c3028181feca9c7842743525b40f5c82", "score": "0.43217388", "text": "func (r *Request) PostForm(kv ...string) *Request {\n\tdata := url.Values{}\n\tfor idx := range kv {\n\t\tif idx > 0 {\n\t\t\tidx++\n\t\t\tif idx == len(kv)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tdata.Add(kv[idx], kv[idx+1])\n\t}\n\t// expected to create a body, and not append the postform to save allocations\n\tr.body = strings.NewReader(data.Encode())\n\treturn r\n}", "title": "" }, { "docid": "5f677916b793b71a8f6bdc3c09934766", "score": "0.43209887", "text": "func (s *server) configFromForm(cf *cfg.Config, form url.Values) error {\n\tfor k, vs := range form {\n\t\tif strings.HasPrefix(k, \"config.\") || strings.HasPrefix(k, \"source.\") {\n\t\t\tcf.Put(k, vs[len(vs)-1])\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2270565837ebca36d7606f2e58b2160c", "score": "0.43187773", "text": "func (c *Context) FormParams() (url.Values, error) {\n\tif strings.HasPrefix(c.request.Header.Get(HeaderContentType), MIMEMultipartForm) {\n\t\tif err := c.request.ParseMultipartForm(defaultMemory); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := c.request.ParseForm(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn c.request.Form, nil\n}", "title": "" }, { "docid": "a89d87dd8e7303ed21474bad9678c80f", "score": "0.431584", "text": "func FormToUser(r *http.Request) (User, []string) {\n\tvar user User\n\tvar errStr string\n\tvar errs []string\n\t// var err error\n\n\tuser.common_name, errStr = processFormField(r, \"common_name\")\n\terrs = appendError(errs, errStr)\n\n\t// user.number,errStr = strconv.Atoi(processFormField(r, \"number\"))\n\t\n\treturn user, errs\n}", "title": "" }, { "docid": "9e1ff3aa3610a62c2de1e6f12abb0798", "score": "0.431576", "text": "func RenderForm(obj interface{}) template.HTML {\n\tobjT := reflect.TypeOf(obj)\n\tobjV := reflect.ValueOf(obj)\n\tif objT.Kind() != reflect.Ptr || objT.Elem().Kind() != reflect.Struct {\n\t\treturn template.HTML(\"\")\n\t}\n\tobjT = objT.Elem()\n\tobjV = objV.Elem()\n\n\tvar raw []string\n\tfor i := 0; i < objT.NumField(); i++ {\n\t\tfieldV := objV.Field(i)\n\t\tif !fieldV.CanSet() || unKind[fieldV.Kind()] {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldT := objT.Field(i)\n\n\t\tlabel, name, fType, id, class, ignored, required := parseFormTag(fieldT)\n\t\tif ignored {\n\t\t\tcontinue\n\t\t}\n\n\t\traw = append(raw, renderFormField(label, name, fType, fieldV.Interface(), id, class, required))\n\t}\n\treturn template.HTML(strings.Join(raw, \"</br>\"))\n}", "title": "" }, { "docid": "5cdd97971973782e50dea7b5ef75d84b", "score": "0.4313229", "text": "func (v ElementBuildingVisitor) createMapValues(\n\tschemaFn schemaFn,\n\tmeta apply.FieldMetaImpl,\n\tdata apply.MapElementData) (map[string]apply.Element, error) {\n\n\t// Collate each key in the map\n\tvalues := map[string]apply.Element{}\n\tfor _, key := range keysUnion(data.GetRecordedMap(), data.GetLocalMap(), data.GetRemoteMap()) {\n\t\tcombined := apply.RawElementData{}\n\t\tif recorded, recordedSet := nilSafeLookup(key, data.GetRecordedMap()); recordedSet {\n\t\t\tcombined.SetRecorded(recorded)\n\t\t}\n\t\tif local, localSet := nilSafeLookup(key, data.GetLocalMap()); localSet {\n\t\t\tcombined.SetLocal(local)\n\t\t}\n\t\tif remote, remoteSet := nilSafeLookup(key, data.GetRemoteMap()); remoteSet {\n\t\t\tcombined.SetRemote(remote)\n\t\t}\n\n\t\t// Create an item for the field\n\t\tfield, err := v.getItem(schemaFn(key), key, combined)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Build the element for this field\n\t\telement, err := field.CreateElement(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Add the field element to the map\n\t\tvalues[key] = element\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "3d34b50c1da5ee7c85b84dcb6202c09d", "score": "0.43077722", "text": "func FormChanges(base interface{}, modified interface{}, skipTheseFields, onlyIncludeTheseFields []string) (fields []ChangedField) {\n\tif len(skipTheseFields) > 0 && len(onlyIncludeTheseFields) > 0 {\n\t\tpanic(\"Please specify only ONE OF 'skipTheseFields' or 'onlyIncludeTheseFields' for call to SetFormValues\")\n\t}\n\n\tval := reflect.ValueOf(base)\n\telm := reflect.Indirect(val)\n\n\tvalMod := reflect.ValueOf(modified)\n\telmMod := reflect.Indirect(valMod)\n\n\tdupPanicAssertStructPtr(val)\n\tdupPanicAssertStructPtr(valMod)\n\nouterForLoop:\n\tfor i := 0; i < elmMod.NumField(); i++ {\n\t\tmodF := elmMod.Field(i)\n\t\tname := elmMod.Type().Field(i).Name\n\n\t\tf := elm.FieldByName(name)\n\t\tif f.Kind() == reflect.Invalid {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(onlyIncludeTheseFields) > 0 {\n\t\t\tmustInclude := false\n\t\t\tfor _, includeField := range onlyIncludeTheseFields {\n\t\t\t\tif includeField == name {\n\t\t\t\t\tmustInclude = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !mustInclude {\n\t\t\t\tcontinue outerForLoop\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, skip := range skipTheseFields {\n\t\t\t\tif skip == name {\n\t\t\t\t\tcontinue outerForLoop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfTOrig, success := elm.Type().FieldByName(name)\n\t\tif success {\n\t\t\tfor _, v := range strings.Split(fTOrig.Tag.Get(\"orm\"), \";\") {\n\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\tif v == \"auto_now_add\" {\n\t\t\t\t\tcontinue outerForLoop\n\t\t\t\t}\n\t\t\t\tif v == \"auto_now\" {\n\t\t\t\t\tcontinue outerForLoop\n\t\t\t\t}\n\t\t\t\tif v == \"-\" {\n\t\t\t\t\tcontinue outerForLoop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfTMod := elmMod.Type().Field(i)\n\n\t\tfor _, v := range strings.Split(fTMod.Tag.Get(\"form\"), \";\") {\n\t\t\tv = strings.TrimSpace(v)\n\t\t\tif v == \"-\" {\n\t\t\t\tcontinue outerForLoop\n\t\t\t}\n\t\t}\n\n\t\t// compare two values use string\n\t\toldValStr := ToStr(f.Interface())\n\t\tnewValStr := ToStr(modF.Interface())\n\t\tif newValStr != oldValStr {\n\t\t\tfields = append(fields, ChangedField{FieldName: name, OldValue: oldValStr, NewValue: newValStr})\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dbe514925e782a47e0a266425e229d92", "score": "0.4300123", "text": "func (c *Context) FormParams() (url.Values, error) {\n\tconst defaultMemory = 32 << 20\n\tif strings.HasPrefix(c.request.Header().Get(HeaderContentType), MIMEMultipartForm) {\n\t\tif err := c.request.ParseMultipartForm(defaultMemory); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := c.request.ParseForm(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c.request.Form, nil\n}", "title": "" }, { "docid": "95b6aa0b3950b125faa57d82640b07b6", "score": "0.42963207", "text": "func (r *Request) ParseForm(pointer interface{}) error {\n\treturn r.doParse(pointer, parseTypeForm)\n}", "title": "" }, { "docid": "9c32bbfb1711a7bd67033d5aa86ad405", "score": "0.428966", "text": "func (c *Context) PostForm(key string) (string, error) {\n\tvalue, _, err := c.GetPostForm(key)\n\treturn value, err\n}", "title": "" } ]
f5f2eede6671a1184fb4292834fdf801
GetMenuTreesByMlidAndEnabledAndExpanded Get MenuTrees via MlidAndEnabledAndExpanded
[ { "docid": "6ec9e3936dfc54c21ac812340a1a40a3", "score": "0.84973544", "text": "func GetMenuTreesByMlidAndEnabledAndExpanded(offset int, limit int, Mlid_ int, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and expanded = ?\", Mlid_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" } ]
[ { "docid": "e369a4d925c5189828605a2a2f4780f8", "score": "0.8128843", "text": "func GetMenuTreesByMlidAndExpanded(offset int, limit int, Mlid_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ?\", Mlid_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "139eb1e07456c83348e81f2d6dcf5cd9", "score": "0.8025142", "text": "func GetMenuTreesByMlidAndOptionsAndExpanded(offset int, limit int, Mlid_ int, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and options = ? and expanded = ?\", Mlid_, Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "5bd924c85caaa28bfb0d7a2e5411dfd7", "score": "0.79320407", "text": "func GetMenuTreesByMlidAndExpandedAndDepth(offset int, limit int, Mlid_ int, Expanded_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and depth = ?\", Mlid_, Expanded_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "ad8666fbb8fdb1edb3c00f7f00e37de5", "score": "0.79293835", "text": "func GetMenuTreesByMlidAndExpandedAndWeight(offset int, limit int, Mlid_ int, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and weight = ?\", Mlid_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "ad650734e814b17e9d49f0dff5078ac3", "score": "0.79121876", "text": "func GetMenuTreesByMlidAndExpandedAndHasChildren(offset int, limit int, Mlid_ int, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and has_children = ?\", Mlid_, Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "942c9e7348124192b0406470f5729324", "score": "0.7881113", "text": "func GetMenuTreesByEnabledAndExpanded(offset int, limit int, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ?\", Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "f99b26a4bac32c17ec62890b9ed6f53f", "score": "0.78291655", "text": "func GetMenuTreesByMlidAndParentAndExpanded(offset int, limit int, Mlid_ int, Parent_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and parent = ? and expanded = ?\", Mlid_, Parent_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "99f05f435688be5358625b59f9675e76", "score": "0.780344", "text": "func GetMenuTreesByMlidAndDescriptionAndExpanded(offset int, limit int, Mlid_ int, Description_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and description = ? and expanded = ?\", Mlid_, Description_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "0b7ea3e4423f466b1beb40d4af1ad854", "score": "0.7798094", "text": "func GetMenuTreesByMlidAndUrlAndExpanded(offset int, limit int, Mlid_ int, Url_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and url = ? and expanded = ?\", Mlid_, Url_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "d524a424708766278ceecbbde7a711f2", "score": "0.77934176", "text": "func GetMenuTreesByMlidAndDiscoveredAndExpanded(offset int, limit int, Mlid_ int, Discovered_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and discovered = ? and expanded = ?\", Mlid_, Discovered_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "f3c43e5a17b01abca6792cc33976a783", "score": "0.7789921", "text": "func GetMenuTreesByMlidAndTitleAndExpanded(offset int, limit int, Mlid_ int, Title_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and title = ? and expanded = ?\", Mlid_, Title_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "3e2c39ff099458eeb183a5360e65d4c6", "score": "0.77845126", "text": "func GetMenuTreesByMlidAndProviderAndExpanded(offset int, limit int, Mlid_ int, Provider_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and provider = ? and expanded = ?\", Mlid_, Provider_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "c93e630805bc4a529e1713315f520683", "score": "0.77472156", "text": "func GetMenuTreesByEnabledAndExpandedAndWeight(offset int, limit int, Enabled_ int, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ? and weight = ?\", Enabled_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "d9cc1d5d1306d88a962e7cc78da0c212", "score": "0.7741587", "text": "func GetMenuTreesByMlidAndIdAndExpanded(offset int, limit int, Mlid_ int, Id_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and id = ? and expanded = ?\", Mlid_, Id_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "6d5e964ed721a85a5408e4bafdc8dfe4", "score": "0.77379346", "text": "func GetMenuTreesByIdAndEnabledAndExpanded(offset int, limit int, Id_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and enabled = ? and expanded = ?\", Id_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "ae34553c3720b14edc10954eb1a7bcd8", "score": "0.7712514", "text": "func GetMenuTreesByMlidAndRouteNameAndExpanded(offset int, limit int, Mlid_ int, RouteName_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and route_name = ? and expanded = ?\", Mlid_, RouteName_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "2c98c9e44554f5e8c6dbca428d1bdfbf", "score": "0.77089256", "text": "func GetMenuTreesByMenuNameAndMlidAndExpanded(offset int, limit int, MenuName_ string, Mlid_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and mlid = ? and expanded = ?\", MenuName_, Mlid_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "63c4f9b6762b1ff6ebb281034dd05c40", "score": "0.7706946", "text": "func GetMenuTreesByEnabledAndExpandedAndHasChildren(offset int, limit int, Enabled_ int, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ? and has_children = ?\", Enabled_, Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "cb29c45ff287117b354698ae5ad9f06d", "score": "0.7686492", "text": "func GetMenuTreesByMlidAndRouteParametersAndExpanded(offset int, limit int, Mlid_ int, RouteParameters_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and route_parameters = ? and expanded = ?\", Mlid_, RouteParameters_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "759d28cd905dec40aee0bdda6f66b134", "score": "0.7675004", "text": "func GetMenuTreesByMlidAndEnabled(offset int, limit int, Mlid_ int, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ?\", Mlid_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "7c978ef8d0d8b8b68095082b1e2ce288", "score": "0.76581675", "text": "func GetMenuTreesByMlidAndDescriptionAndEnabled(offset int, limit int, Mlid_ int, Description_ []byte, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and description = ? and enabled = ?\", Mlid_, Description_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "4d18978b3f9c3a157f3fc4be41176c89", "score": "0.76434815", "text": "func GetMenuTreesByMlidAndEnabledAndDepth(offset int, limit int, Mlid_ int, Enabled_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and depth = ?\", Mlid_, Enabled_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "1cf08a7887145de297c959cc26866950", "score": "0.7633801", "text": "func GetMenuTreesByEnabledAndDiscoveredAndExpanded(offset int, limit int, Enabled_ int, Discovered_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and discovered = ? and expanded = ?\", Enabled_, Discovered_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "1b737239553f772d60a4efebc6311e02", "score": "0.761466", "text": "func GetMenuTreesByEnabledAndExpandedAndDepth(offset int, limit int, Enabled_ int, Expanded_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ? and depth = ?\", Enabled_, Expanded_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "b6b1136021bf423e07af317577b10564", "score": "0.7600902", "text": "func GetMenuTreesByMlidAndClassAndExpanded(offset int, limit int, Mlid_ int, Class_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and class = ? and expanded = ?\", Mlid_, Class_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "81c0e8e5bdcfba3419a7b865e8f0189e", "score": "0.75936705", "text": "func GetMenuTreesByMlidAndEnabledAndHasChildren(offset int, limit int, Mlid_ int, Enabled_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and has_children = ?\", Mlid_, Enabled_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "46d4b2023e0345a04bc548e73284029f", "score": "0.75919473", "text": "func GetMenuTreesByOptionsAndEnabledAndExpanded(offset int, limit int, Options_ []byte, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"options = ? and enabled = ? and expanded = ?\", Options_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "430593fcde7be2bee3707fa84dbfdb75", "score": "0.7559216", "text": "func GetMenuTreesByEnabledAndExpandedAndMetadata(offset int, limit int, Enabled_ int, Expanded_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ? and metadata = ?\", Enabled_, Expanded_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "bd21304381ae5334cb3e77c856e31e45", "score": "0.7543518", "text": "func GetMenuTreesByMlidAndExpandedAndMetadata(offset int, limit int, Mlid_ int, Expanded_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and metadata = ?\", Mlid_, Expanded_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "8024898871ba6eb94348c73f35bbf2a3", "score": "0.7522675", "text": "func GetMenuTreesByMenuNameAndEnabledAndExpanded(offset int, limit int, MenuName_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and enabled = ? and expanded = ?\", MenuName_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "1fa27b2cf1db6d4d3d837a824fab7f61", "score": "0.7513554", "text": "func GetMenuTreesByMlidAndOptionsAndEnabled(offset int, limit int, Mlid_ int, Options_ []byte, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and options = ? and enabled = ?\", Mlid_, Options_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "a23b2c46bb93c4a9a5cf45790f7ac472", "score": "0.7495177", "text": "func GetMenuTreesByMlidAndEnabledAndWeight(offset int, limit int, Mlid_ int, Enabled_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and weight = ?\", Mlid_, Enabled_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "c1543d05acb0e3e6c7979b2869bf315a", "score": "0.74886495", "text": "func GetMenuTreesByDescriptionAndEnabledAndExpanded(offset int, limit int, Description_ []byte, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"description = ? and enabled = ? and expanded = ?\", Description_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "29d729d9d4008f76fbe53bba9e3d52b3", "score": "0.7487821", "text": "func GetMenuTreesByRouteNameAndEnabledAndExpanded(offset int, limit int, RouteName_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"route_name = ? and enabled = ? and expanded = ?\", RouteName_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e92677f7411bb3af3f9ffe4a425f61cd", "score": "0.74854666", "text": "func GetMenuTreesByMlidAndEnabledAndDiscovered(offset int, limit int, Mlid_ int, Enabled_ int, Discovered_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and discovered = ?\", Mlid_, Enabled_, Discovered_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "8f55f55e535cb052e1c87123640126d7", "score": "0.7459826", "text": "func GetMenuTreesByExpandedAndWeight(offset int, limit int, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and weight = ?\", Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "4b5ef4ca3df01931662fa84f28698ce3", "score": "0.74572116", "text": "func GetMenuTreesByProviderAndEnabledAndExpanded(offset int, limit int, Provider_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"provider = ? and enabled = ? and expanded = ?\", Provider_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "199559d214f02eacbd9ad472db6eb3c3", "score": "0.7455552", "text": "func GetMenuTreesByMlidAndParentAndEnabled(offset int, limit int, Mlid_ int, Parent_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and parent = ? and enabled = ?\", Mlid_, Parent_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "3ec352c1225dbf9a8a49c2a556d8f8a0", "score": "0.7438237", "text": "func GetMenuTreesByRouteParametersAndEnabledAndExpanded(offset int, limit int, RouteParameters_ []byte, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"route_parameters = ? and enabled = ? and expanded = ?\", RouteParameters_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "eeb232f6572be12df53c909317adb737", "score": "0.7426847", "text": "func GetMenuTreesByTitleAndEnabledAndExpanded(offset int, limit int, Title_ []byte, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"title = ? and enabled = ? and expanded = ?\", Title_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "2f97bc74a865a78d189e29f8ca6b910d", "score": "0.74222034", "text": "func GetMenuTreesByMlidAndProviderAndEnabled(offset int, limit int, Mlid_ int, Provider_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and provider = ? and enabled = ?\", Mlid_, Provider_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "d31c0f5c465d82d7a82babf2153af7b4", "score": "0.74076587", "text": "func GetMenuTreesByMlidAndIdAndEnabled(offset int, limit int, Mlid_ int, Id_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and id = ? and enabled = ?\", Mlid_, Id_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "faadb9b06d726242dd9c5afd47c2ed4a", "score": "0.7404719", "text": "func GetMenuTreesByIdAndExpandedAndWeight(offset int, limit int, Id_ string, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and expanded = ? and weight = ?\", Id_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "a4d5274de5aaac33eb5f5484e266a233", "score": "0.7395472", "text": "func GetMenuTreesByMlidAndTitleAndEnabled(offset int, limit int, Mlid_ int, Title_ []byte, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and title = ? and enabled = ?\", Mlid_, Title_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "3a8564482d5e6dc6bbc1cba86cbd2717", "score": "0.7378006", "text": "func GetMenuTreesByMlidAndRouteParamKeyAndExpanded(offset int, limit int, Mlid_ int, RouteParamKey_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and route_param_key = ? and expanded = ?\", Mlid_, RouteParamKey_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "ec294ed35a50b6314c236ce90cc4eb2b", "score": "0.73470694", "text": "func GetMenuTreesByExpandedAndWeightAndHasChildren(offset int, limit int, Expanded_ int, Weight_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and weight = ? and has_children = ?\", Expanded_, Weight_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "cb0e089a2c1719d3654b0914986db3bf", "score": "0.7342769", "text": "func GetMenuTreesByIdAndOptionsAndExpanded(offset int, limit int, Id_ string, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and options = ? and expanded = ?\", Id_, Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "ba596e2dbc449b197778c356f4557e8c", "score": "0.7339832", "text": "func GetMenuTreesByClassAndEnabledAndExpanded(offset int, limit int, Class_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"class = ? and enabled = ? and expanded = ?\", Class_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "f7ae6a69da63076ffee0edf624acf207", "score": "0.7323084", "text": "func GetMenuTreesByParentAndEnabledAndExpanded(offset int, limit int, Parent_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"parent = ? and enabled = ? and expanded = ?\", Parent_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "706838997e776555c0337731b64c1236", "score": "0.7323045", "text": "func GetMenuTreesByIdAndExpanded(offset int, limit int, Id_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and expanded = ?\", Id_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "7ec4239724887e63f5c7c8cf1c68f49d", "score": "0.7316691", "text": "func GetMenuTreesByMlidAndEnabledAndMetadata(offset int, limit int, Mlid_ int, Enabled_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and enabled = ? and metadata = ?\", Mlid_, Enabled_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "34fe1235df1ef16fdaed841c4bcc0c48", "score": "0.731326", "text": "func GetMenuTreesByExpandedAndDepth(offset int, limit int, Expanded_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and depth = ?\", Expanded_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "af8958afa7f080af6252ea0e78c5f78e", "score": "0.7305425", "text": "func GetMenuTreesByIdAndExpandedAndHasChildren(offset int, limit int, Id_ string, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and expanded = ? and has_children = ?\", Id_, Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "8fdba2526147b0581be642070d7f1637", "score": "0.7305045", "text": "func GetMenuTreesByIdAndDescriptionAndExpanded(offset int, limit int, Id_ string, Description_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and description = ? and expanded = ?\", Id_, Description_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "a9e45c4b7aafe44985cd76d191d94c1e", "score": "0.72998977", "text": "func GetMenuTreesByOptionsAndExpanded(offset int, limit int, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"options = ? and expanded = ?\", Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "d5bc0671f1d77a8b3d869d91daafa584", "score": "0.7294125", "text": "func GetMenuTreesByMlidAndUrlAndEnabled(offset int, limit int, Mlid_ int, Url_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and url = ? and enabled = ?\", Mlid_, Url_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "4cfa4cef5020d9cc2986f85b5dd385cd", "score": "0.72885066", "text": "func GetMenuTreesByMlidAndRouteParametersAndEnabled(offset int, limit int, Mlid_ int, RouteParameters_ []byte, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and route_parameters = ? and enabled = ?\", Mlid_, RouteParameters_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "b4b8d1cb8d2e19fda86087e59b6e009f", "score": "0.7280014", "text": "func GetMenuTreesByUrlAndEnabledAndExpanded(offset int, limit int, Url_ string, Enabled_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"url = ? and enabled = ? and expanded = ?\", Url_, Enabled_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "9af15fa9200a4e7f3f2e51c9252d216c", "score": "0.72652245", "text": "func GetMenuTreesByMlidAndExpandedAndP4(offset int, limit int, Mlid_ int, Expanded_ int, P4_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and p4 = ?\", Mlid_, Expanded_, P4_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "5f76e0b965972d5234a765a19cb7d4c7", "score": "0.72602314", "text": "func GetMenuTreesByIdAndRouteNameAndExpanded(offset int, limit int, Id_ string, RouteName_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and route_name = ? and expanded = ?\", Id_, RouteName_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "d8036ad727cfdb07dd8345e466743b21", "score": "0.7259366", "text": "func GetMenuTreesByMenuNameAndIdAndExpanded(offset int, limit int, MenuName_ string, Id_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and id = ? and expanded = ?\", MenuName_, Id_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "2e2402c3de1b2e9f4a1a2fdff7084a2e", "score": "0.7257051", "text": "func GetMenuTreesByMlidAndClassAndEnabled(offset int, limit int, Mlid_ int, Class_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and class = ? and enabled = ?\", Mlid_, Class_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e0789dc12fb743e7a52460bd4df8fea8", "score": "0.725586", "text": "func GetMenuTreesByIdAndExpandedAndDepth(offset int, limit int, Id_ string, Expanded_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and expanded = ? and depth = ?\", Id_, Expanded_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "838a1b9897b092c25a2651c87ce649a1", "score": "0.72375023", "text": "func GetMenuTreesViaExpanded(offset int, limit int, Expanded_ int, field string) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ?\", Expanded_).Limit(limit, offset).Desc(field).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "76522e423dbb7e515fe64c07e74eb123", "score": "0.7232179", "text": "func GetMenuTreesByExpandedAndWeightAndDepth(offset int, limit int, Expanded_ int, Weight_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and weight = ? and depth = ?\", Expanded_, Weight_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "410b5ffc4d9441e11af55eb597343218", "score": "0.7228636", "text": "func GetMenuTreesByIdAndDiscoveredAndExpanded(offset int, limit int, Id_ string, Discovered_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and discovered = ? and expanded = ?\", Id_, Discovered_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "1423cccff1a858e459cb623ca9825682", "score": "0.722351", "text": "func GetMenuTreesByExpandedAndHasChildren(offset int, limit int, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and has_children = ?\", Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "c7b7d5ceb31767ecbb1641879509a85f", "score": "0.72228944", "text": "func GetMenuTreesByOptionsAndExpandedAndWeight(offset int, limit int, Options_ []byte, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"options = ? and expanded = ? and weight = ?\", Options_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "fd1dbbfa195badca85697a9d545d4840", "score": "0.72163904", "text": "func GetMenuTreesByMlidAndRouteNameAndEnabled(offset int, limit int, Mlid_ int, RouteName_ string, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and route_name = ? and enabled = ?\", Mlid_, RouteName_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "56ab6516bb47d21e06d3936c19cb651b", "score": "0.7206512", "text": "func GetMenuTreesByMenuNameAndMlidAndEnabled(offset int, limit int, MenuName_ string, Mlid_ int, Enabled_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and mlid = ? and enabled = ?\", MenuName_, Mlid_, Enabled_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e175ef413cd6516a5bab147a04e06a94", "score": "0.72018796", "text": "func GetMenuTreesByExpandedAndMetadataAndDepth(offset int, limit int, Expanded_ int, Metadata_ []byte, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and metadata = ? and depth = ?\", Expanded_, Metadata_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "29094479115271407ed138c30cd3a8d7", "score": "0.7198143", "text": "func GetMenuTreesByMlidAndExpandedAndFormClass(offset int, limit int, Mlid_ int, Expanded_ int, FormClass_ string) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and form_class = ?\", Mlid_, Expanded_, FormClass_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "56eb4d35c66a6bdd318579cde7ee6a59", "score": "0.717734", "text": "func GetMenuTreesByExpandedAndMetadata(offset int, limit int, Expanded_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and metadata = ?\", Expanded_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "c8be2862031d1dcb77778082beed952e", "score": "0.7162906", "text": "func GetMenuTreesByOptionsAndExpandedAndHasChildren(offset int, limit int, Options_ []byte, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"options = ? and expanded = ? and has_children = ?\", Options_, Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "297553c35bbf5ab5671ed923a7f03ce2", "score": "0.7162571", "text": "func GetMenuTreesByMenuNameAndOptionsAndExpanded(offset int, limit int, MenuName_ string, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and options = ? and expanded = ?\", MenuName_, Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "08e9107fdd6bbefa8f41912b6e53148d", "score": "0.7151724", "text": "func GetMenuTreesByIdAndRouteParametersAndExpanded(offset int, limit int, Id_ string, RouteParameters_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and route_parameters = ? and expanded = ?\", Id_, RouteParameters_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "cc65cea7375d5222179f2b8c532c5bd7", "score": "0.7144899", "text": "func GetMenuTreesByIdAndUrlAndExpanded(offset int, limit int, Id_ string, Url_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and url = ? and expanded = ?\", Id_, Url_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "7abbd352139e1a25d4e1fa6a64ebeba4", "score": "0.71445215", "text": "func GetMenuTreesByExpandedAndMetadataAndHasChildren(offset int, limit int, Expanded_ int, Metadata_ []byte, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and metadata = ? and has_children = ?\", Expanded_, Metadata_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e4908cca3693cdc703aa901387a8e7ac", "score": "0.7143529", "text": "func GetMenuTreesByIdAndExpandedAndMetadata(offset int, limit int, Id_ string, Expanded_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and expanded = ? and metadata = ?\", Id_, Expanded_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "96f3fcd69c23544a9e8cb4f0dbf1320c", "score": "0.7123033", "text": "func GetMenuTreesByEnabledAndExpandedAndFormClass(offset int, limit int, Enabled_ int, Expanded_ int, FormClass_ string) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"enabled = ? and expanded = ? and form_class = ?\", Enabled_, Expanded_, FormClass_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "2f21d76daadeef18df29696d001aaad2", "score": "0.71228665", "text": "func GetMenuTreesByIdAndProviderAndExpanded(offset int, limit int, Id_ string, Provider_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and provider = ? and expanded = ?\", Id_, Provider_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e1ee40205f89e0c8109a598dc44d8008", "score": "0.7122375", "text": "func GetMenuTreesByMlidAndExpandedAndP2(offset int, limit int, Mlid_ int, Expanded_ int, P2_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and p2 = ?\", Mlid_, Expanded_, P2_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "3581ae803dee3657178d51c11b8de060", "score": "0.71210295", "text": "func GetMenuTreesByExpandedAndHasChildrenAndDepth(offset int, limit int, Expanded_ int, HasChildren_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and has_children = ? and depth = ?\", Expanded_, HasChildren_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "721fc11614691111ed199c1f475b7339", "score": "0.7116106", "text": "func GetMenuTreesByDiscoveredAndExpandedAndWeight(offset int, limit int, Discovered_ int, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"discovered = ? and expanded = ? and weight = ?\", Discovered_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "adbbd0d514c0aaf3200c8ed36818a5b7", "score": "0.71155626", "text": "func GetMenuTreesByIdAndTitleAndExpanded(offset int, limit int, Id_ string, Title_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"id = ? and title = ? and expanded = ?\", Id_, Title_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "8951bd0823fe599e56bb47fa290e41b0", "score": "0.7112867", "text": "func GetMenuTreesByDiscoveredAndExpanded(offset int, limit int, Discovered_ int, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"discovered = ? and expanded = ?\", Discovered_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "a5d9761a878edc61dd8ba41a33ea2fd9", "score": "0.71108186", "text": "func GetMenuTreesByMenuNameAndDescriptionAndExpanded(offset int, limit int, MenuName_ string, Description_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and description = ? and expanded = ?\", MenuName_, Description_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "8ec3d05c472d5f9079205dd3afc87f1f", "score": "0.71099705", "text": "func GetMenuTreesByMlidAndExpandedAndP6(offset int, limit int, Mlid_ int, Expanded_ int, P6_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and p6 = ?\", Mlid_, Expanded_, P6_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "28f1253502690c289427098b4b8dcda0", "score": "0.7101285", "text": "func GetMenuTreesByMenuNameAndRouteParametersAndExpanded(offset int, limit int, MenuName_ string, RouteParameters_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and route_parameters = ? and expanded = ?\", MenuName_, RouteParameters_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "07889124fb393fce5f4ac6010a6051d8", "score": "0.7101285", "text": "func GetMenuTreesByOptionsAndExpandedAndDepth(offset int, limit int, Options_ []byte, Expanded_ int, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"options = ? and expanded = ? and depth = ?\", Options_, Expanded_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "0a1d85af13e94de69bf59282915cb0a4", "score": "0.7091525", "text": "func GetMenuTreesByDiscoveredAndExpandedAndHasChildren(offset int, limit int, Discovered_ int, Expanded_ int, HasChildren_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"discovered = ? and expanded = ? and has_children = ?\", Discovered_, Expanded_, HasChildren_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "3cc0242e08123c89dccb62566c88ec13", "score": "0.70899063", "text": "func GetMenuTreesByMenuNameAndExpandedAndWeight(offset int, limit int, MenuName_ string, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and expanded = ? and weight = ?\", MenuName_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "df39c059b0cf49ff37a3da3558b5cb24", "score": "0.707903", "text": "func GetMenuTreesByDescriptionAndOptionsAndExpanded(offset int, limit int, Description_ []byte, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"description = ? and options = ? and expanded = ?\", Description_, Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "82018de31ffe35d0a7db6209773ef2bf", "score": "0.70779324", "text": "func GetMenuTreesByRouteNameAndOptionsAndExpanded(offset int, limit int, RouteName_ string, Options_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"route_name = ? and options = ? and expanded = ?\", RouteName_, Options_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "90b55ba6c2382baa3ce781fdb364d7cc", "score": "0.7060578", "text": "func GetMenuTreesByMlidAndDescriptionAndDepth(offset int, limit int, Mlid_ int, Description_ []byte, Depth_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and description = ? and depth = ?\", Mlid_, Description_, Depth_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "e5d2706b48498536b1e8461c9626c056", "score": "0.7060117", "text": "func GetMenuTreesByMenuNameAndExpanded(offset int, limit int, MenuName_ string, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"menu_name = ? and expanded = ?\", MenuName_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "98aaa98cf5001c5b23335eaf7e04e563", "score": "0.7050817", "text": "func GetMenuTreesByExpandedAndWeightAndMetadata(offset int, limit int, Expanded_ int, Weight_ int, Metadata_ []byte) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"expanded = ? and weight = ? and metadata = ?\", Expanded_, Weight_, Metadata_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "b9eb36b78421e8bcc5f7fb703bab6b69", "score": "0.70495844", "text": "func GetMenuTreesByProviderAndExpandedAndWeight(offset int, limit int, Provider_ string, Expanded_ int, Weight_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"provider = ? and expanded = ? and weight = ?\", Provider_, Expanded_, Weight_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "064e5a9a5bb86d33aa22003b85f35cd1", "score": "0.70478576", "text": "func GetMenuTreesByMlidAndExpandedAndP7(offset int, limit int, Mlid_ int, Expanded_ int, P7_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"mlid = ? and expanded = ? and p7 = ?\", Mlid_, Expanded_, P7_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" }, { "docid": "9c24711e302bae6fe8d1f809a011e8f0", "score": "0.7046594", "text": "func GetMenuTreesByRouteParametersAndExpanded(offset int, limit int, RouteParameters_ []byte, Expanded_ int) (*[]*MenuTree, error) {\n\tvar _MenuTree = new([]*MenuTree)\n\terr := Engine.Table(\"menu_tree\").Where(\"route_parameters = ? and expanded = ?\", RouteParameters_, Expanded_).Limit(limit, offset).Find(_MenuTree)\n\treturn _MenuTree, err\n}", "title": "" } ]
afa76eacca85d2d2f8cf74513fadb6da
FadingMusic reports whether music is fading in, out, or not at all. Does not tell you if the channel is playing anything, or paused, so you'd need to test that separately. Returns: the fading status. (
[ { "docid": "3d0d25194f86e0381ed7a8bd3873c115", "score": "0.754181", "text": "func FadingMusic() Fading {\n\treturn (Fading)(C.Mix_FadingMusic())\n}", "title": "" } ]
[ { "docid": "5e8d96b9adc8af432e4b27a7c1958fa6", "score": "0.71581614", "text": "func FadeOutMusic(ms int) bool {\n\t_ms := (C.int)(ms)\n\treturn int(C.Mix_FadeOutMusic(_ms)) == 0\n}", "title": "" }, { "docid": "ca6a2ce5258afca247caf13670c43d36", "score": "0.59728664", "text": "func PlayingMusic() bool {\n\treturn int(C.Mix_PlayingMusic()) > 0\n}", "title": "" }, { "docid": "f49e3b63e66b17ef034ca6c29a52e82e", "score": "0.57607806", "text": "func PausedMusic() bool {\n\treturn int(C.Mix_PausedMusic()) > 0\n}", "title": "" }, { "docid": "69c25d3b644cb4ec26138bb4b68ff0a6", "score": "0.5758606", "text": "func (music *Music) FadeIn(loops, ms int) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\t_ms := (C.int)(ms)\n\tif C.Mix_FadeInMusic(_music, _loops, _ms) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4dc2bcdb75c7dee2b8c1211cddc0876", "score": "0.57261544", "text": "func FadingChannel(which int) Fading {\n\t_which := (C.int)(which)\n\treturn (Fading)(C.Mix_FadingChannel(_which))\n}", "title": "" }, { "docid": "575018a78d3998919fff32a36d87fbc1", "score": "0.52798516", "text": "func (music *Music) FadeInPos(loops, ms int, position float64) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\t_ms := (C.int)(ms)\n\t_position := (C.double)(position)\n\tif C.Mix_FadeInMusicPos(_music, _loops, _ms, _position) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd296a26cf05e69359605430e739bcb6", "score": "0.49504477", "text": "func (chunk *Chunk) FadeIn(channel, loops, ms int) (channel_ int, err error) {\n\treturn chunk.FadeInTimed(channel, loops, ms, -1)\n}", "title": "" }, { "docid": "7aa3b8b7b131b6cf3dc7dacb78f47a10", "score": "0.4903433", "text": "func FadeOutChannel(which, ms int) int {\n\t_which := (C.int)(which)\n\t_ms := (C.int)(ms)\n\treturn int(C.Mix_FadeOutChannel(_which, _ms))\n}", "title": "" }, { "docid": "947073a7b52fe9b7da4683a3299e0113", "score": "0.48096097", "text": "func (chunk *Chunk) FadeInTimed(channel, loops, ms, ticks int) (channel_ int, err error) {\n\t_channel := (C.int)(channel)\n\t_chunk := (*C.Mix_Chunk)(unsafe.Pointer(chunk))\n\t_loops := (C.int)(loops)\n\t_ms := (C.int)(ms)\n\t_ticks := (C.int)(ticks)\n\tchannel_ = int(C.Mix_FadeInChannelTimed(_channel, _chunk, _loops, _ms, _ticks))\n\tif channel_ == -1 {\n\t\terr = sdl.GetError()\n\t}\n\treturn\n}", "title": "" }, { "docid": "841a173345a18a15cf31d370ed030712", "score": "0.47934338", "text": "func (p *Player) IsTrading() bool {\n\treturn p.HasState(StateTrading)\n}", "title": "" }, { "docid": "1b2522e5a3316754a7a37d49951a1100", "score": "0.4753523", "text": "func (fm FavoritesManager) IsFavorite(musicID int) bool {\n\tif musicID >= fm.cap() {\n\t\treturn false\n\t}\n\treturn fm.musics[musicID/8]&(1<<uint(musicID%8)) != 0\n}", "title": "" }, { "docid": "a47d0f9693c095d77dd678e3a10f1427", "score": "0.46792108", "text": "func (s *Step) Fin() bool {\n\treturn math.Abs(float64(s.step)) == 1\n}", "title": "" }, { "docid": "61a344e9cef05e72b3f64789c67ddd38", "score": "0.45853424", "text": "func (np *NowPlaying) CurrentlyHasSong() bool {\n\treturn np.nowPlaying != \"\"\n}", "title": "" }, { "docid": "57eee1e2387e99222e5b66e9632f891e", "score": "0.455706", "text": "func PauseMusic() {\n\tC.Mix_PauseMusic()\n}", "title": "" }, { "docid": "35ba8f79f59142adbe633ba8dcb1783f", "score": "0.452359", "text": "func HaltMusic() {\n\tC.Mix_HaltMusic()\n}", "title": "" }, { "docid": "a425f6765153df4d4edadafdf8933229", "score": "0.4523011", "text": "func (s *Steps) Fin() bool {\n\treturn int(math.Abs(float64(s.step))) == len(s.steppers)\n}", "title": "" }, { "docid": "8bcbddd832a564ae5d92b5ac791a941a", "score": "0.44857028", "text": "func isWAVTrack(fi os.FileInfo) bool {\n\tif strings.HasSuffix(fi.Name(), \".wav\") {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e7ff2b9fa1c0f4543728e690ee05923f", "score": "0.44819838", "text": "func (e *end) fadeIn() animation { return e.createFadeIn() }", "title": "" }, { "docid": "8a2482b6c9d61eecf36c36fffa48f215", "score": "0.44481054", "text": "func (me TxsdFmXrefIdClass) IsFmPalette() bool { return me.String() == \"FM-PALETTE\" }", "title": "" }, { "docid": "7f0aa1fe7fcbb2496bec80e86042e9c5", "score": "0.4398783", "text": "func (s *Stream) IsPlaying() bool {\n\treturn s.cmd != nil && !s.paused\n}", "title": "" }, { "docid": "e8eca5cc8a16878e05ee8b8a8a393246", "score": "0.4397683", "text": "func (f *fadeEndAnimation) Animate(dt float64) bool {\n\tswitch f.state {\n\tcase 0:\n\t\tf.tkcnt = 0\n\t\tf.e.bg.SetVisible(true)\n\t\tf.e.bg.SetAlpha(0)\n\t\tf.e.scale = 0.01\n\t\tf.state = 1\n\t\treturn true\n\tcase 1:\n\t\tf.e.scale += 0.99 / float64(f.ticks)\n\t\tf.e.atom.SetScale(f.e.scale, f.e.scale, f.e.scale)\n\t\tf.e.bg.SetAlpha(f.e.bg.Alpha() + float64(1)/float64(f.ticks))\n\t\tif f.tkcnt >= f.ticks {\n\t\t\tf.Wrap()\n\t\t\treturn false // animation done.\n\t\t}\n\t\tf.tkcnt += 1\n\t\treturn true\n\tdefault:\n\t\treturn false // animation done.\n\t}\n}", "title": "" }, { "docid": "218a7194433a383c38ec293fd4e97905", "score": "0.43757388", "text": "func (m *Music) IsCustomMusic() bool {\n\treturn m.Type == \"custom\"\n}", "title": "" }, { "docid": "c1220aba7435cdd33da7dad38cadbf6d", "score": "0.4352036", "text": "func (b *BlinkMDriver) Fade(red byte, green byte, blue byte) (err error) {\n\tif err = b.connection.I2cWrite(blinkmAddress, []byte(\"c\")); err != nil {\n\t\treturn\n\t}\n\terr = b.connection.I2cWrite(blinkmAddress, []byte{red, green, blue})\n\treturn\n}", "title": "" }, { "docid": "1ff4ebb858c386c761cc3f366ccc6465", "score": "0.4292971", "text": "func HookMusic(musicFunc func([]uint8)) {\n\thookMusicFunc = musicFunc\n\tC.Mix_HookMusic((*[0]byte)(C.callHookMusic), nil)\n}", "title": "" }, { "docid": "4f1afabe33c1e5627114795eb690d863", "score": "0.42917946", "text": "func ResumeMusic() {\n\tC.Mix_ResumeMusic()\n}", "title": "" }, { "docid": "4a23af5517d06a439ade69e8eced816f", "score": "0.42859718", "text": "func (o *FormatTest) GetFloatOk() (*float32, bool) {\n\tif o == nil || IsNil(o.Float) {\n\t\treturn nil, false\n\t}\n\treturn o.Float, true\n}", "title": "" }, { "docid": "fbff3f39d6a864da10fe355e466a66ae", "score": "0.42823464", "text": "func TestFLAC(t *testing.T) {\n\t// Generate a flacParser\n\tflac, err := New(bytes.NewReader(flacFile))\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\t// Verify that we actually got a FLAC flac\n\tif reflect.TypeOf(flac) != reflect.TypeOf(&flacParser{}) {\n\t\tt.Fatalf(\"unexpected flac type: %v\", reflect.TypeOf(flac))\n\t}\n\n\t// Verify all exported methods work properly\n\n\t// Album\n\tif flac.Album() != \"Album\" {\n\t\tt.Fatalf(\"mismatched tag Album: %v\", flac.Album())\n\t}\n\n\t// AlbumArtist\n\tif flac.AlbumArtist() != \"AlbumArtist\" {\n\t\tt.Fatalf(\"mismatched tag AlbumArtist: %v\", flac.AlbumArtist())\n\t}\n\n\t// Artist\n\tif flac.Artist() != \"Artist\" {\n\t\tt.Fatalf(\"mismatched tag Artist: %v\", flac.Artist())\n\t}\n\n\t// BitDepth\n\tif flac.BitDepth() != 16 {\n\t\tt.Fatalf(\"mismatched property BitDepth: %v\", flac.BitDepth())\n\t}\n\n\t// Bitrate\n\tif flac.Bitrate() != 202 {\n\t\tt.Fatalf(\"mismatched property Bitrate: %v\", flac.Bitrate())\n\t}\n\n\t// Channels\n\tif flac.Channels() != 2 {\n\t\tt.Fatalf(\"mismatched property Channels: %v\", flac.Channels())\n\t}\n\n\t// Comment\n\tif flac.Comment() != \"Comment\" {\n\t\tt.Fatalf(\"mismatched tag Comment: %v\", flac.Comment())\n\t}\n\n\t// Date\n\tif flac.Date() != \"2014-01-01\" {\n\t\tt.Fatalf(\"mismatched tag Date: %v\", flac.Date())\n\t}\n\n\t// DiscNumber\n\tif flac.DiscNumber() != 1 {\n\t\tt.Fatalf(\"mismatched tag DiscNumber: %v\", flac.DiscNumber())\n\t}\n\n\t// Duration\n\tif int(flac.Duration().Seconds()) != 5 {\n\t\tt.Fatalf(\"mismatched property Duration: %v\", flac.Duration().Seconds())\n\t}\n\n\t// Encoder\n\tif flac.Encoder() != \"reference libFLAC 1.1.4 20070213\" {\n\t\tt.Fatalf(\"mismatched property Encoder: %v\", flac.Encoder())\n\t}\n\n\t// Format\n\tif flac.Format() != \"FLAC\" {\n\t\tt.Fatalf(\"mismatched property Format: %v\", flac.Format())\n\t}\n\n\t// Genre\n\tif flac.Genre() != \"Genre\" {\n\t\tt.Fatalf(\"mismatched tag Genre: %v\", flac.Genre())\n\t}\n\n\t// SampleRate\n\tif flac.SampleRate() != 44100 {\n\t\tt.Fatalf(\"mismatched property SampleRate: %v\", flac.SampleRate())\n\t}\n\n\t// Publisher\n\tif flac.Publisher() != \"Publisher\" {\n\t\tt.Fatalf(\"mismatched tag Publisher: %v\", flac.Publisher())\n\t}\n\n\t// Title\n\tif flac.Title() != \"Title\" {\n\t\tt.Fatalf(\"mismatched tag Title: %v\", flac.Title())\n\t}\n\n\t// TrackNumber\n\tif flac.TrackNumber() != 1 {\n\t\tt.Fatalf(\"mismatched tag TrackNumber: %v\", flac.TrackNumber())\n\t}\n\n\t// Check a few raw tags\n\n\tif flac.Tag(\"ARTIST\") != \"Artist\" {\n\t\tt.Fatalf(\"unexpected raw tag ARTIST: %v\", flac.Tag(\"ARTIST\"))\n\t}\n\n\tif flac.Tag(\"ALBUM\") != \"Album\" {\n\t\tt.Fatalf(\"unexpected raw tag ALBUM: %v\", flac.Tag(\"ALBUM\"))\n\t}\n\n\tif flac.Tag(\"TITLE\") != \"Title\" {\n\t\tt.Fatalf(\"unexpected raw tag TITLE: %v\", flac.Tag(\"TITLE\"))\n\t}\n\n\t// Check a non-existant tag\n\tif flac.Tag(\"NOTEXISTS\") != \"\" {\n\t\tt.Fatalf(\"unexpected raw tag NOTEXISTS: %v\", flac.Tag(\"NOTEXISTS\"))\n\t}\n}", "title": "" }, { "docid": "190f1d93fae4eed92428d8a67f343436", "score": "0.4275348", "text": "func Playing(channel int) int {\n\t_channel := (C.int)(channel)\n\treturn int(C.Mix_Playing(_channel))\n}", "title": "" }, { "docid": "59f6295f9a81fee262a9855b03dfc73a", "score": "0.4258018", "text": "func (o *options) fadeIn() animation { return nil }", "title": "" }, { "docid": "09841d8da77f150fb98879897f0b89a2", "score": "0.42565152", "text": "func (o *FormatTest) HasFloat() bool {\n\tif o != nil && !IsNil(o.Float) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "841c05dc7fdef3ef0714db35f681a357", "score": "0.4224217", "text": "func Music() string {\n\treturn dirs.Music\n}", "title": "" }, { "docid": "34c0a0b4c1e3a62d44b08dce559c2e73", "score": "0.4216538", "text": "func (me TxsdFmXrefIdClass) IsFmFunction() bool { return me.String() == \"FM-FUNCTION\" }", "title": "" }, { "docid": "3cd4213921a2ef2a76c86ea1985247ac", "score": "0.42112988", "text": "func SetMusic(musicStatus bool) Command {\n\treturn &setMusicCommand{\n\t\tmusicStatus: musicStatus,\n\t}\n}", "title": "" }, { "docid": "5a790aa985d34e9ddb49817e884f0a31", "score": "0.41877922", "text": "func comesFromGuild(s *discordgo.Session, m *discordgo.Message) bool {\n\tchannel, err := s.State.Channel(m.ChannelID)\n\tif err != nil {\n\t\tif channel, err = s.Channel(m.ChannelID); err != nil {\n\t\t\treturn len(m.GuildID) != 0 // final fallback to check if a text channel in guild\n\t\t}\n\t}\n\n\treturn channel.Type == discordgo.ChannelTypeGuildText\n}", "title": "" }, { "docid": "92fe58d1de5f33620d510fd399669673", "score": "0.4186002", "text": "func enabled() bool {\n\treturn os.Getenv(\"FF_ENABLED\") == \"true\"\n}", "title": "" }, { "docid": "6da393758298c375f1accdd388bbb123", "score": "0.4183514", "text": "func (t Type) Float() bool {\n\treturn t == TypeFloat32 || t == TypeFloat64\n}", "title": "" }, { "docid": "a8d4dac7ef0901e2604966e83fdbc9b2", "score": "0.41768718", "text": "func (land *Land) IsTrading() bool {\n\treturn land.state == TRADING\n}", "title": "" }, { "docid": "9e84808e2d8c561d1c3206a21bf5c900", "score": "0.4167131", "text": "func (me TxsdFmXrefIdClass) IsFmVariant() bool { return me.String() == \"FM-VARIANT\" }", "title": "" }, { "docid": "b8a82679ae6e5fd8ad98e62f41254718", "score": "0.41526493", "text": "func IsTrack(f os.FileInfo) bool {\n\tfor i := 0; i < len(mediaSuffix); i++ {\n\t\tif strings.HasSuffix(f.Name(), \".\"+mediaSuffix[i]) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "39339fa1e74d32a14271fc0dd35f9a2c", "score": "0.41456062", "text": "func (me TxsdFmXrefIdClass) IsFmAction() bool { return me.String() == \"FM-ACTION\" }", "title": "" }, { "docid": "bd25fea600d1170b6715b2dffe97a1ec", "score": "0.41358453", "text": "func SearchMusic(locale, sentence string) (music, artist string) {\n\twords := strings.Split(sentence, \" \")\n\n\t// Iterate through the words of the sentence\n\tplayAppeared, fromAppeared, onAppeared := false, false, false\n\tfor _, word := range words {\n\t\t// If \"on\" appeared\n\t\tif word == SpotifyKeyword[locale].On {\n\t\t\tonAppeared = true\n\t\t}\n\n\t\t// Add the current word if its between from and on\n\t\tif fromAppeared && !onAppeared {\n\t\t\tartist += word + \" \"\n\t\t}\n\n\t\t// If \"from\" appeared\n\t\tif LevenshteinDistance(word, SpotifyKeyword[locale].From) < 2 {\n\t\t\tfromAppeared = true\n\t\t}\n\n\t\t// Add the current word if its between play and from\n\t\tif playAppeared && !fromAppeared && !onAppeared {\n\t\t\tmusic += word + \" \"\n\t\t}\n\n\t\t// If \"play\" appeared\n\t\tif LevenshteinDistance(word, SpotifyKeyword[locale].Play) < 2 {\n\t\t\tplayAppeared = true\n\t\t}\n\t}\n\n\t// Trim the spaces and return\n\treturn strings.TrimSpace(music), strings.TrimSpace(artist)\n}", "title": "" }, { "docid": "34e630f4eb0a07a4cc213ab44a87d09a", "score": "0.41220587", "text": "func HasAudio() FilterFunc {\n\treturn func(u *Update) bool {\n\t\tmessage := u.EffectiveMessage()\n\t\treturn message != nil && message.Audio != nil\n\t}\n}", "title": "" }, { "docid": "60d6d9c972ec24acdd22c1951d56324b", "score": "0.41031235", "text": "func (o *SpatialMaterial) IsProximityFadeEnabled() gdnative.Bool {\n\t//log.Println(\"Calling SpatialMaterial.IsProximityFadeEnabled()\")\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(\"SpatialMaterial\", \"is_proximity_fade_enabled\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\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.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "136ef03ff3ab055da95658751ec6360b", "score": "0.40757075", "text": "func (f *directoryForest) fadeTracks() {\n\tlist := []string{}\n\tfor loc, track := range f.tracks {\n\t\tage := time.Now().Sub(track.Timestamp)\n\t\tif age >= TrackFadeTime {\n\t\t\tlist = append(list, loc)\n\t\t}\n\t}\n\n\tfor _, loc := range list {\n\t\tdelete(f.tracks, loc)\n\t}\n}", "title": "" }, { "docid": "987edc5aba4645f1432da7b5c8fb8862", "score": "0.4067112", "text": "func (me TxsdFmXrefIdClass) IsFmFault() bool { return me.String() == \"FM-FAULT\" }", "title": "" }, { "docid": "5cb05ae834873c231d12286f53337c25", "score": "0.40588006", "text": "func (e *end) newFadeAnimation() animation { return &fadeEndAnimation{e: e, ticks: 75} }", "title": "" }, { "docid": "2bf684955cb75b65e9f1b88c51fe8a2b", "score": "0.40352294", "text": "func (d DFloat) HasPrev() bool {\n\treturn true\n}", "title": "" }, { "docid": "37e8c6eb0332873d40773d406c8df4e0", "score": "0.40207365", "text": "func IsFizz(number int) bool {\n\tif number%3 == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b1552d7b8b12eaa8df3d3192350c0891", "score": "0.40156162", "text": "func (f Float) IsZero() bool {\n\treturn !f.Valid\n}", "title": "" }, { "docid": "c4c27932b6ab5c39063545da89b0da24", "score": "0.40119177", "text": "func (me TxsdFmXrefIdClass) IsFmCharacteristic() bool { return me.String() == \"FM-CHARACTERISTIC\" }", "title": "" }, { "docid": "14cee395bb8f12f48243fa436f5824da", "score": "0.40027013", "text": "func (card *Card) IsFaceDown() bool {\n\treturn card.faceDown\n}", "title": "" }, { "docid": "8dd5fe4c2b6f064e3e844e7dff4c2171", "score": "0.3998481", "text": "func (m *Model) IsAnimating() bool {\n\tdist := math.Abs(m.percentShown - m.targetPercent)\n\treturn !(dist < 0.001 && m.velocity < 0.01)\n}", "title": "" }, { "docid": "b16ef5fb8c0d95e5ced69a0540e1ad75", "score": "0.39910382", "text": "func (s *Source) IsPlaying() bool {\n\tif s.isValid() {\n\t\treturn s.GetState() == \"playing\"\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a5db0376cfc74a47d70e123509c876fa", "score": "0.39812836", "text": "func (f *Float) Changed() bool {\n\tchanged := f.changed\n\tf.changed = false\n\treturn changed\n}", "title": "" }, { "docid": "099370e458477bb0d72896d711661949", "score": "0.39803317", "text": "func IsFloat(t querypb.Type) bool {\n\treturn int(t)&flagIsFloat == flagIsFloat\n}", "title": "" }, { "docid": "6ec16effccaad550dde55a7041a174b3", "score": "0.3973101", "text": "func (ui *UI) UpdateMusicButton(on bool) {\n\tif on {\n\t\tui.musicButton.SetImage(gui.ButtonNormal, \"./gui/music_normal.png\")\n\t\tui.musicButton.SetImage(gui.ButtonOver, \"./gui/music_hover.png\")\n\t\tui.musicButton.SetImage(gui.ButtonPressed, \"./gui/music_click.png\")\n\t\tui.musicSlider.SetEnabled(true)\n\t\tui.musicSlider.SetValue(ui.musicSlider.Value())\n\t} else {\n\t\tui.musicButton.SetImage(gui.ButtonNormal, \"./gui/music_normal_off.png\")\n\t\tui.musicButton.SetImage(gui.ButtonOver, \"./gui/music_hover_off.png\")\n\t\tui.musicButton.SetImage(gui.ButtonPressed, \"./gui/music_click_off.png\")\n\t\tui.musicSlider.SetEnabled(false)\n\t\tui.game.audio.SetMusicVolume(0)\n\t}\n}", "title": "" }, { "docid": "2ebe423ea4d42c469cba64739bd3751f", "score": "0.397142", "text": "func IsAudioInstalled() bool {\n\treturn bool(C.al_is_audio_installed())\n}", "title": "" }, { "docid": "6c7daa8b13b4a59bc22b275dcd518ec2", "score": "0.3938305", "text": "func FadeOutGroup(tag, ms int) int {\n\t_tag := (C.int)(tag)\n\t_ms := (C.int)(ms)\n\treturn int(C.Mix_FadeOutGroup(_tag, _ms))\n}", "title": "" }, { "docid": "91bfd3f41eb59117148b1c35c2265829", "score": "0.39314678", "text": "func CookieSupported() bool {\n\treturn DmCookieSupported() != 0\n}", "title": "" }, { "docid": "f2346249b4c1c98aa8a86fc04db19e0b", "score": "0.39273006", "text": "func (o *InsightTransferEntry) HasInFloat() bool {\n\tif o != nil && o.InFloat != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2da8a8f16a26e05cde258e970c9d9876", "score": "0.39266843", "text": "func GetNumMusicDecoders() int {\n\treturn int(C.Mix_GetNumMusicDecoders())\n}", "title": "" }, { "docid": "f336d53bae60b00c78d34b7f1b7b1af0", "score": "0.3924295", "text": "func (v Float) Nil() bool {\n\treturn !v.present\n}", "title": "" }, { "docid": "3336fb083ea767ecbf5ecb99824f71ba", "score": "0.3918951", "text": "func (e Float16Element) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "e984c07fc18ebb5ac7802e6d32cef903", "score": "0.39183646", "text": "func HookMusicFinished(musicFinished func()) {\n\thookMusicFinishedFunc = musicFinished\n\tC.Mix_HookMusicFinished((*[0]byte)(C.callHookMusicFinished))\n}", "title": "" }, { "docid": "7bf4c174e690b4b20bc842c895d131aa", "score": "0.39145237", "text": "func (f Flag) Float() *float32 {\n\tif f.Value == nil {\n\t\treturn nil\n\t}\n\n\tv := strings.TrimSpace(*f.Value)\n\tvi, _ := strconv.ParseFloat(v, 32)\n\n\tret := new(float32)\n\t*ret = float32(vi)\n\treturn ret\n}", "title": "" }, { "docid": "91b37cb52ed8be23aa38d7588cc34a51", "score": "0.3912931", "text": "func (me TxsdFmXrefIdClass) IsFmProject() bool { return me.String() == \"FM-PROJECT\" }", "title": "" }, { "docid": "4564cf24b66b85b229e810c88f80157e", "score": "0.39086545", "text": "func (o *InsightTransferEntry) GetInFloatOk() (*float64, bool) {\n\tif o == nil || o.InFloat == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InFloat, true\n}", "title": "" }, { "docid": "732db5be1245ba768f7e5e5d1ec994e3", "score": "0.39018735", "text": "func (m *M3u8File) HasDefaultExtAudioStream() (bool, *Audiostream) {\n\tif m == nil {\n\t\treturn false, nil\n\t}\n\tfor _, s := range m.Audiostreams {\n\t\tif s.Default && s.URI != \"\" {\n\t\t\treturn true, &s\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "f9ed8a1ef26cd0d9ab634ad3b9cf6c62", "score": "0.390074", "text": "func (me TxsdGraphicCategory) IsWaveform() bool { return me.String() == \"WAVEFORM\" }", "title": "" }, { "docid": "ed27f89a63b2b5306db97868a795443f", "score": "0.38895738", "text": "func (e Float32Element) IsNil() bool {\n\treturn e.v == nil\n}", "title": "" }, { "docid": "d0e3664328b3871cb0c01f71b392851e", "score": "0.387834", "text": "func (a *Accumulator) HasFloatValue(measurement string) bool {\n\tfor _, p := range a.Points {\n\t\tif p.Measurement == measurement {\n\t\t\t_, ok := p.Values[\"value\"].(float64)\n\t\t\treturn ok\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4ab4ef745b593693090209411ec20475", "score": "0.38777632", "text": "func (music *Music) Play(loops int) error {\n\t_music := (*C.Mix_Music)(unsafe.Pointer(music))\n\t_loops := (C.int)(loops)\n\tif C.Mix_PlayMusic(_music, _loops) == -1 {\n\t\treturn sdl.GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1eb5e223a8476bc90a988328489d918", "score": "0.386347", "text": "func (strm *AudioStream) IsStreaming() bool {\n\treturn strm.streaming\n}", "title": "" }, { "docid": "3aa3c1b763f36efe39fe0aff350347b5", "score": "0.38499197", "text": "func (t String) Float() (ret float64, ok bool) {\n f, err := strconv.ParseFloat(string(t), 64)\n if err == nil { ret = f; ok = true; return }\n\n i, err := strconv.ParseInt(string(t), 0, 64)\n if err == nil { ret = float64(i); ok = true; return }\n\n b, err := strconv.ParseBool(string(t))\n if err == nil { if b { ret = 1.0 }; ok = true; return }\n\n return\n}", "title": "" }, { "docid": "991307041f72f5caae1fc28dc8929045", "score": "0.38494468", "text": "func Alone(guildID string) bool {\n\tconn, ok := voiceConnection(guildID)\n\tif !ok {\n\t\treturn true\n\t}\n\tvcID := \"\"\n\tg, err := dg.State.Guild(conn.GuildID)\n\tif err != nil {\n\t\tlog.Print(\"error failed to get state of guild by GuildID : \", err.Error())\n\t\treturn true\n\t}\n\tfor _, vs := range g.VoiceStates {\n\t\tif vs.UserID == conn.UserID {\n\t\t\tvcID = vs.ChannelID\n\t\t\tbreak\n\t\t}\n\t}\n\tif vcID == \"\" {\n\t\tlog.Print(\"error voice channel bot is joining not found\")\n\t\treturn true\n\t}\n\tcount := 0\n\tfor _, vs := range g.VoiceStates {\n\t\tif vs.ChannelID == vcID {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count <= 1\n}", "title": "" }, { "docid": "69fa82dd46a12ae5f17873d13474bdc1", "score": "0.384005", "text": "func (flag TileFlag) MusicIndex() int {\n\treturn int((flag & 0x0000F000) >> 12)\n}", "title": "" }, { "docid": "9e7fef629e5bd249375b72a29edb25d3", "score": "0.3836393", "text": "func (o *Game) GetSoundOk() (*string, bool) {\n\tif o == nil || o.Sound == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Sound, true\n}", "title": "" }, { "docid": "8d3f0f72b0022f4eabdc9a2701fed103", "score": "0.38355437", "text": "func (me TfloatType) IsFloat() bool { return me.String() == \"FLOAT\" }", "title": "" }, { "docid": "d4e21dd19f429ac06f9b460299d26ed7", "score": "0.38337597", "text": "func (v *Var) IsFloat() bool {\n\tswitch v.Val().(type) {\n\tcase float32, *float32, float64, *float64:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2b4a2667d0f35e19c8e633f8a1fe95a2", "score": "0.3833159", "text": "func (gop *GameOperator) Playing() bool {\n\treturn gop.playing\n}", "title": "" }, { "docid": "d3f6cd67f3e81fc69dbffb7d29c2b3ff", "score": "0.38204157", "text": "func (me TxsdFmXrefIdClass) IsFmFunctionType() bool { return me.String() == \"FM-FUNCTION-TYPE\" }", "title": "" }, { "docid": "40030bc5737b83dff2862b5de03d0f90", "score": "0.3815587", "text": "func (m PlcValueAdapter) IsFloat32() bool {\n\treturn false\n}", "title": "" }, { "docid": "482ff7a0292116fa8b54d91e2327c3f3", "score": "0.38132358", "text": "func (a *Alien) IsInvading() bool {\n\treturn a.city != nil\n}", "title": "" }, { "docid": "15ea6b00d8843e83d1f71bfed43be56b", "score": "0.38092887", "text": "func (q *Quaternion) IsInfinite() bool {\n\treturn q.Primitive.IsInfinite()\n}", "title": "" }, { "docid": "c85a91267c3cca72d8720e923d37799b", "score": "0.37920564", "text": "func (s *site) check(song, artist string) (bool, error) {\n\treturn s.f(song, artist)\n}", "title": "" }, { "docid": "a1e3b515f570a1252d74656e847b2176", "score": "0.37806934", "text": "func (m *portfolioManager) IsRunning() bool {\n\treturn m != nil && atomic.LoadInt32(&m.started) == 1\n}", "title": "" }, { "docid": "9f713ee67d6bbd4231e3f2a54fba9a9c", "score": "0.3778669", "text": "func (f Factor) Infinite() bool {\n\treturn f.Exact.infinite && f.Prefix.infinite && f.Suffix.infinite && f.Fragment.infinite\n}", "title": "" }, { "docid": "430443e8c508c512cf94b48119ad9029", "score": "0.3766492", "text": "func (e *VAudioAlarm) IsAlarm() {}", "title": "" }, { "docid": "03c3e72404b89fe5dede009c583369d9", "score": "0.37637308", "text": "func (s *Service) IsFavByFidRPC(c context.Context, typ int8, mid, aid int64, fid int64) (res bool, err error) {\n\targ := &favpb.IsFavoredByFidReq{Type: int32(typ), Mid: mid, Oid: aid, Fid: fid}\n\tvar reply *favpb.IsFavoredReply\n\tif reply, err = s.favClient.IsFavoredByFid(c, arg); err != nil {\n\t\tlog.Error(\"s.favClient.IsFavoredByFid(%+v) error(%v)\", arg, err)\n\t\treturn\n\t}\n\tres = reply.Faved\n\treturn\n}", "title": "" }, { "docid": "a08100d179a7670fc2ad0b61158c275e", "score": "0.37629867", "text": "func (z *Float) Equals(y *Float) bool {\n\treturn z.l.Cmp(&y.l) == 0 && z.r.Cmp(&y.r) == 0\n}", "title": "" }, { "docid": "33a1d5493c7978bb9a6e32a358f7deb9", "score": "0.37628207", "text": "func (o *SpatialMaterial) IsDistanceFadeEnabled() gdnative.Bool {\n\t//log.Println(\"Calling SpatialMaterial.IsDistanceFadeEnabled()\")\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(\"SpatialMaterial\", \"is_distance_fade_enabled\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\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.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "5ab725af02c3791b079dbe2e6b839dd2", "score": "0.37595162", "text": "func (fi *Installer) IsFluxInstalled() (bool, error) {\n\t_, err := fi.k8sClientSet.AppsV1().Deployments(fi.opts.Operator.Namespace).Get(context.TODO(), \"flux\", metav1.GetOptions{})\n\tif err != nil {\n\t\tif apierrs.IsNotFound(err) {\n\t\t\tlogger.Warning(\"flux deployment was not found\")\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, errors.Wrapf(err, \"error while looking for flux pod\")\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "af4283e08c984dcc2949f972863562cc", "score": "0.37589857", "text": "func TestMethodBooleanToFloat32Checked(t *testing.T) {\n\tcases := []struct {\n\t\to Boolean\n\t}{\n\t\t{MaxBoolean},\n\t}\n\tfor _, c := range cases {\n\t\tconverted, ok := c.o.ToFloat32Checked()\n\t\tif ok {\n\t\t\tv, ok := converted.ToBooleanChecked()\n\t\t\tif ok {\n\t\t\t\tequal, err := v.Eq(c.o)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"error checking for overflow overflow for Boolean to Float32: %v\", err)\n\t\t\t\t}\n\t\t\t\tif err != nil || !equal {\n\t\t\t\t\tt.Errorf(\"detected unhandled overflow for Boolean to Float32 - %#v != %#v\", v, c.o)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6ee00f38257e19cc7400bd3e769885f2", "score": "0.37567654", "text": "func (m SQLMode) HasRealAsFloatMode() bool {\n\treturn m&ModeRealAsFloat == ModeRealAsFloat\n}", "title": "" }, { "docid": "e37ffd8833db929a351666a9c730cda2", "score": "0.37551537", "text": "func (me TcolorModeEnumType) IsNormal() bool { return me == \"normal\" }", "title": "" }, { "docid": "3ad546c55c1943f58c46dc094b7132d3", "score": "0.37488654", "text": "func Float(s string) bool {\n\t_, err := strconv.ParseFloat(s, 0)\n\treturn err == nil\n}", "title": "" }, { "docid": "474eed07b62850e2d4f4906f006a2df4", "score": "0.37426552", "text": "func (s *QuoteStream) Stopped() bool {\n\treturn s.stop\n}", "title": "" }, { "docid": "64e4599f5d142fb6e1084a3f8e7dd4b1", "score": "0.37396598", "text": "func (cf CapFlags) On(f CapFlags) bool {\n\treturn cf&f == f\n}", "title": "" }, { "docid": "6f4329ede2fe37366170b127bbe57c78", "score": "0.37345833", "text": "func (v *Validator) Float(value string) bool {\n\tif value == \"\" {\n\t\treturn true\n\t}\n\n\treturn regexp.MustCompile(\"^(?:[-+]?(?:[0-9]+))?(?:\\\\.[0-9]*)?(?:[eE][\\\\+\\\\-]?(?:[0-9]+))?$\").MatchString(value)\n}", "title": "" }, { "docid": "246e8293c830af72ad2d8d2b54f69591", "score": "0.373428", "text": "func (s *SampleInstance) Playing() bool {\n\treturn bool(C.al_get_sample_instance_playing((*C.ALLEGRO_SAMPLE_INSTANCE)(s)))\n}", "title": "" } ]
dab68de9750795db450e1761bcb6f9ff
MarshalJSON JSON representation of card
[ { "docid": "22991a2230dfe0ea9208cf3d0f52dec9", "score": "0.7251524", "text": "func (c Cards) MarshalJSON() ([]byte, error) {\n\t//if len(c) == 0 {\n\t// return []byte(\"null\"), nil\n\t//}\n\n\t//var buf bytes.Buffer\n\t//buf.Write(c.Binary())\n\t//return json.Marshal(buf.String())\n\treturn json.Marshal(c.Binary())\n}", "title": "" } ]
[ { "docid": "a927b42fc09768057f0208b12f46ae6f", "score": "0.6498155", "text": "func (cards Prototypes) JSON() cast.IStringer {\n\tjson := make([]string, 0)\n\tkeys := make([]int, len(cards))\n\n\tvar i int\n\tfor k := range cards {\n\t\tkeys[i] = k\n\t\ti++\n\t}\n\tcast.SortInts(keys)\n\tfor _, id := range keys {\n\t\tjson = append(json, cards[id].JSON().String())\n\t}\n\treturn cast.Stringer(`[` + strings.Join(json, \",\") + `]`)\n}", "title": "" }, { "docid": "93e1297988aeeee15fdf6eb1b1f002d7", "score": "0.64195925", "text": "func (o *Card) String() string {\n \n \n \n \n o.Actions = []Cardaction{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "1dd83f91a0d149d42d18d6a261ed9a1e", "score": "0.637574", "text": "func (card *CreditCard) ToJSON() string {\n\tb, err := json.Marshal(card)\n\t// Data is validated, very unlikely that this error may happen\n\t// for simplicity, I've decided to omit returning it.\n\tif err != nil {\n\t\tlog.Println(\"Unable to Marshall to JSON this CreditCard\", err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "b8a9ef763f13b278556c18ad9ba2f888", "score": "0.6220013", "text": "func (c *Prototype) JSON() cast.JSON {\n\treturn cast.JSON{\n\t\t\"id\": c.ID,\n\t\t\"image\": c.Image,\n\t\t\"name\": c.Name,\n\t\t\"text\": c.Text,\n\t\t\"type\": c.Type.String(),\n\t\t\"powers\": c.Powers.JSON(),\n\t\t\"costs\": c.Costs.JSON(),\n\t\t\"body\": c.Body.JSON(),\n\t}\n}", "title": "" }, { "docid": "d99ef4f223f4d4d8b958e777c6b71d45", "score": "0.591603", "text": "func (c *card) Marshal(depth int) string {\n\tbody := \"\"\n\tcurr := c\n\tfor curr != nil {\n\t\tbody += fmt.Sprintf(\"\\n%s %s\\n\\n%s\\n\", strings.Repeat(\"#\", depth), curr.title, curr.body)\n\t\tif curr.firstChild != nil {\n\t\t\tbody += curr.firstChild.Marshal(depth + 1)\n\t\t}\n\t\tcurr = curr.next\n\t}\n\treturn body\n}", "title": "" }, { "docid": "5beb51c150205e46f8623d65e6052ec8", "score": "0.5873092", "text": "func (v GetCharactersCharacterIdContracts200Ok) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonAa810831EncodeGithubComAntihaxGoesiEsi1(w, v)\n}", "title": "" }, { "docid": "b76dcd288b960f3d7a0aac11c6999073", "score": "0.58690137", "text": "func (cc *CardCollection) MarshalJSON() ([]byte, error) {\n\tids := make([]string, 0, len(cc.col))\n\tfor id := range cc.col {\n\t\tids = append(ids, id)\n\t}\n\tsort.Strings(ids)\n\treturn json.Marshal(ids)\n}", "title": "" }, { "docid": "90af62cfd76c671d0f740bb91b53c9f9", "score": "0.56944525", "text": "func (mc *MessageCard) PrettyPrint() string {\n\tif mc.payload != nil {\n\t\tvar prettyJSON bytes.Buffer\n\t\t_ = json.Indent(&prettyJSON, mc.payload.Bytes(), \"\", \"\\t\")\n\n\t\treturn prettyJSON.String()\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ab5c581b7d03deccb16e13baa0a9fa13", "score": "0.56938374", "text": "func (d *Deck) MarshalJSON() ([]byte, error) {\n\tif err := d.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tdoc := struct {\n\t\tdeckAlias\n\t\tType string `json:\"type\"`\n\t\tImported *time.Time `json:\"imported,omitempty\"`\n\t}{\n\t\tType: \"deck\",\n\t\tdeckAlias: deckAlias(*d),\n\t}\n\tif !d.Imported.IsZero() {\n\t\tdoc.Imported = &d.Imported\n\t}\n\treturn json.Marshal(doc)\n}", "title": "" }, { "docid": "e18267e1f399ea2a0ee616ab7b46f202", "score": "0.56663567", "text": "func (c CatalogMsrp) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"p1Y\", c.P1Y)\n\tpopulate(objectMap, \"p3Y\", c.P3Y)\n\tpopulate(objectMap, \"p5Y\", c.P5Y)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ca15ebdf4ded6d27aba3b1882a2e1ecd", "score": "0.56362", "text": "func (c *ComponentChest) MarshalJSON() ([]byte, error) {\n\tobj := struct {\n\t\tDecks map[string]*Deck\n\t\tEnums *enum.Set\n\t\tConstants map[string]interface{}\n\t}{\n\t\tc.decks,\n\t\tc.enums,\n\t\tc.constants,\n\t}\n\treturn DefaultMarshalJSON(obj)\n}", "title": "" }, { "docid": "7cf45d1c3fa149f5037117ac53a2ecd0", "score": "0.5594444", "text": "func (v GetCharactersCharacterIdContracts200OkList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonAa810831EncodeGithubComAntihaxGoesiEsi(w, v)\n}", "title": "" }, { "docid": "3975adf32e5800db848d017fd386d76b", "score": "0.554411", "text": "func (c CloudProviderProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"infraNetworkProfile\", c.InfraNetworkProfile)\n\tpopulate(objectMap, \"infraStorageProfile\", c.InfraStorageProfile)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "72f2e07906ab2a00380ee4fa76b4ac32", "score": "0.55364454", "text": "func (sc SKUCapability) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d96a2701a832cbd2b79a7fe885e81ce9", "score": "0.55349123", "text": "func (c Catalog) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"billingPlans\", c.BillingPlans)\n\tpopulate(objectMap, \"capabilities\", c.Capabilities)\n\tpopulate(objectMap, \"locations\", c.Locations)\n\tpopulate(objectMap, \"msrp\", c.Msrp)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"resourceType\", c.ResourceType)\n\tpopulate(objectMap, \"restrictions\", c.Restrictions)\n\tpopulate(objectMap, \"skuProperties\", c.SKUProperties)\n\tpopulate(objectMap, \"size\", c.Size)\n\tpopulate(objectMap, \"terms\", c.Terms)\n\tpopulate(objectMap, \"tier\", c.Tier)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6bef7c0eb243f347c3daf58995cf28d9", "score": "0.54986924", "text": "func (c Container) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3d7d6d69efe914898972d1caa89a5379", "score": "0.5452733", "text": "func (c ConnectivityProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"ssh\", c.SSH)\n\tpopulate(objectMap, \"web\", c.Web)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b1b833af7f139153ae4b27845647d425", "score": "0.5452364", "text": "func (oscd OrchestratorSpecificConnectionDetails) MarshalJSON() ([]byte, error) {\n\toscd.InstanceType = InstanceTypeOrchestratorSpecificConnectionDetails\n\tobjectMap := make(map[string]interface{})\n\tif oscd.InstanceType != \"\" {\n\t\tobjectMap[\"instanceType\"] = oscd.InstanceType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7a3a43eaf36a7fd6290247a2744110e0", "score": "0.5445476", "text": "func (v ConnectionJSON) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42c839f2EncodeGithubComGoParkMailRu20191EscapadeInternalServicesGameEngine6(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "d417f5adbdfc6eeafa51e55b11304415", "score": "0.5436144", "text": "func (m MabContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"agentVersion\", m.AgentVersion)\n\tpopulate(objectMap, \"backupManagementType\", m.BackupManagementType)\n\tpopulate(objectMap, \"canReRegister\", m.CanReRegister)\n\tpopulate(objectMap, \"containerHealthState\", m.ContainerHealthState)\n\tpopulate(objectMap, \"containerId\", m.ContainerID)\n\tobjectMap[\"containerType\"] = ContainerTypeWindows\n\tpopulate(objectMap, \"extendedInfo\", m.ExtendedInfo)\n\tpopulate(objectMap, \"friendlyName\", m.FriendlyName)\n\tpopulate(objectMap, \"healthStatus\", m.HealthStatus)\n\tpopulate(objectMap, \"mabContainerHealthDetails\", m.MabContainerHealthDetails)\n\tpopulate(objectMap, \"protectableObjectType\", m.ProtectableObjectType)\n\tpopulate(objectMap, \"protectedItemCount\", m.ProtectedItemCount)\n\tpopulate(objectMap, \"registrationStatus\", m.RegistrationStatus)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ae44f7b3b245146183f88384d71e605d", "score": "0.54117495", "text": "func (c ConnectionDetail) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"groupId\", c.GroupID)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"linkIdentifier\", c.LinkIdentifier)\n\tpopulate(objectMap, \"memberName\", c.MemberName)\n\tpopulate(objectMap, \"privateIpAddress\", c.PrivateIPAddress)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3fb57c18bb39dc1089db3c2a747b415f", "score": "0.5391291", "text": "func (v VideoEncodeAcceleratorCapability) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1fdf67e30f2995d4cd723c3bf6d971ff", "score": "0.5383881", "text": "func (v GetCharactersCharacterIdContracts200Ok) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonAa810831EncodeGithubComAntihaxGoesiEsi1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "3663c3afe9b0f3578c45a5e0bc3a75e8", "score": "0.537589", "text": "func (pc PrivateCloud) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pc.Sku != nil {\n\t\tobjectMap[\"sku\"] = pc.Sku\n\t}\n\tif pc.PrivateCloudProperties != nil {\n\t\tobjectMap[\"properties\"] = pc.PrivateCloudProperties\n\t}\n\tif pc.Location != nil {\n\t\tobjectMap[\"location\"] = pc.Location\n\t}\n\tif pc.Tags != nil {\n\t\tobjectMap[\"tags\"] = pc.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "556ecebb10374a3024bdbe2861698820", "score": "0.53747666", "text": "func (c Catalog) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"location\", c.Location)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"systemData\", c.SystemData)\n\tpopulate(objectMap, \"tags\", c.Tags)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84f2b8fa362c0ffd6f648a2c0060bba9", "score": "0.53707445", "text": "func (c ConnectionProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"clientRdpAccess\", c.ClientRdpAccess)\n\tpopulate(objectMap, \"clientSshAccess\", c.ClientSSHAccess)\n\tpopulate(objectMap, \"webRdpAccess\", c.WebRdpAccess)\n\tpopulate(objectMap, \"webSshAccess\", c.WebSSHAccess)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "db36a744688eadb75470c77356e9e60a", "score": "0.53694534", "text": "func (acc *Account) JSON() ([]byte, error) {\n\treturn json.Marshal(acc)\n}", "title": "" }, { "docid": "5e5001342b9cb750892e23a8d95aa5a5", "score": "0.53641343", "text": "func (kcd KubernetesConnectionDetails) MarshalJSON() ([]byte, error) {\n\tkcd.InstanceType = InstanceTypeKubernetes\n\tobjectMap := make(map[string]interface{})\n\tif kcd.KubeConfig != nil {\n\t\tobjectMap[\"kubeConfig\"] = kcd.KubeConfig\n\t}\n\tif kcd.InstanceType != \"\" {\n\t\tobjectMap[\"instanceType\"] = kcd.InstanceType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "326c7d5e05e98cf904904165ae51ebf2", "score": "0.5350125", "text": "func (v Camera) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC6317731EncodeGithubComSturfeeincGlTF(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "19814f95f8ebd6d5eb08cba260e66c95", "score": "0.53483444", "text": "func (s SSHProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"count\", s.Count)\n\tpopulate(objectMap, \"podPrefix\", s.PodPrefix)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ee35cd02928dc0190eb59061bf8bf1c2", "score": "0.5346053", "text": "func (c ConnectedRegistry) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"systemData\", c.SystemData)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56e5792f7dfe7cac5606c7127f7c86c6", "score": "0.5340096", "text": "func (s ImageResponseCard) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11e4af5d43382cf1c88c5ba0e7a5c2be", "score": "0.5321316", "text": "func (v GetCharactersCharacterIdContracts200OkList) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonAa810831EncodeGithubComAntihaxGoesiEsi(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "2e3ccb44d18576bb64323b0b4da8e424", "score": "0.53164566", "text": "func (jn JoinNonce) MarshalJSON() ([]byte, error) { return marshalJSONHexBytes(jn[:]) }", "title": "" }, { "docid": "fd0695e58755b1a5c701e45ca2da0763", "score": "0.5313089", "text": "func (c *Contract) Marshal() (JSONContract, error) {\n\tencodedSender, err := publickey.Encode(c.SenderPubKey)\n\tif err != nil {\n\t\treturn JSONContract{}, errors.New(\"Failed to encode sender pubkey: \" + err.Error())\n\t}\n\n\tvar newJSONContract = JSONContract{\n\t\tVersion: c.Version,\n\t\tSenderPublicKey: hex.EncodeToString(encodedSender),\n\t\tSignatureLength: c.SigLen,\n\t\tSignature: hex.EncodeToString(c.Signature),\n\t\tRecipientWalletAddress: hex.EncodeToString(c.RecipPubKeyHash),\n\t\tValue: c.Value,\n\t\tStateNonce: c.StateNonce,\n\t}\n\n\treturn newJSONContract, nil\n}", "title": "" }, { "docid": "f9a61326125403145737e293c136af2a", "score": "0.53115827", "text": "func (c CustomerSecret) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"algorithm\", c.Algorithm)\n\tpopulate(objectMap, \"keyIdentifier\", c.KeyIdentifier)\n\tpopulate(objectMap, \"keyValue\", c.KeyValue)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2f39e2a0eb7a9e08daa29e7785f3db63", "score": "0.5307735", "text": "func CardCreate(w http.ResponseWriter, r *http.Request) {\n\tvar card Card\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := json.Unmarshal(body, &card); err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\n\t\t// unprocessable entitiy\n\t\tw.WriteHeader(422)\n\t\terrMsg := ErrorMessage{Message: err}\n\t\tif err := json.NewEncoder(w).Encode(errMsg); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tfmt.Println(\"json\", json.Unmarshal(body, &card))\n\tt := RepoCreateCard(card)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.WriteHeader(http.StatusCreated)\n\tif err := json.NewEncoder(w).Encode(t); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "af8d5478a8cb6fd57420a9003bd6049c", "score": "0.53050995", "text": "func (s StorageProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"disks\", s.Disks)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2202225f024136ddce73b3f7ef06e108", "score": "0.52997655", "text": "func (p ProofOfPossessionNonceResponse) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"certificate\", p.Certificate)\n\tpopulateTimeRFC3339(objectMap, \"expiryUtc\", p.ExpiryUTC)\n\tpopulateTimeRFC3339(objectMap, \"notBeforeUtc\", p.NotBeforeUTC)\n\tpopulate(objectMap, \"provisioningState\", p.ProvisioningState)\n\tpopulate(objectMap, \"status\", p.Status)\n\tpopulate(objectMap, \"subject\", p.Subject)\n\tpopulate(objectMap, \"thumbprint\", p.Thumbprint)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "92a6414688ec084e5edc98bfe5aa9312", "score": "0.5293561", "text": "func (s SKUCapability) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"value\", s.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4e2b1980bd37e3324581c5058b5399fb", "score": "0.52895766", "text": "func (m MabContainerExtendedInfo) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"backupItemType\", m.BackupItemType)\n\tpopulate(objectMap, \"backupItems\", m.BackupItems)\n\tpopulate(objectMap, \"lastBackupStatus\", m.LastBackupStatus)\n\tpopulateTimeRFC3339(objectMap, \"lastRefreshedAt\", m.LastRefreshedAt)\n\tpopulate(objectMap, \"policyName\", m.PolicyName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "dde4c1de31ac88ae6b4151e59edbc095", "score": "0.5277773", "text": "func (i ImageDescriptor) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"digest\", i.Digest)\n\tpopulate(objectMap, \"registry\", i.Registry)\n\tpopulate(objectMap, \"repository\", i.Repository)\n\tpopulate(objectMap, \"tag\", i.Tag)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ca55c1c137b8442bd7d00ce8564df109", "score": "0.52753174", "text": "func Marshal(c Czml) ([]byte, error) {\n\treturn json.Marshal(c.Packets)\n}", "title": "" }, { "docid": "cabfc6c43520f6e1614b70e84634a296", "score": "0.52717555", "text": "func (sk *SecretShare) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(jsonSecretShare{\n\t\tID: int(sk.ID),\n\t\tSecretShare: sk.Secret.Bytes(),\n\t})\n}", "title": "" }, { "docid": "b5d1a7417f3513621e985db34bb7fe48", "score": "0.52624667", "text": "func (v ImageDecodeAcceleratorCapability) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "3d63cf620c4d39b380a39673bb1696a6", "score": "0.52601576", "text": "func (v CBAvatar) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonAa50737dEncodeGithubComDarthfennecJsonmuncherBenchmark14(w, v)\n}", "title": "" }, { "docid": "f2ea965b6224f05a10054f5fd074f7c7", "score": "0.52557653", "text": "func (c CloudMetadata) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"provider\", c.Provider)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6dedf952d245074452b785617528e368", "score": "0.5253833", "text": "func (v Camera) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC6317731EncodeGithubComSturfeeincGlTF(w, v)\n}", "title": "" }, { "docid": "7e45d477b6b89c5ead56a67abae91f67", "score": "0.52484334", "text": "func get_card(appengine_context context.Context, bucket *storage.BucketHandle, name string) (Card, int64) {\n\tobject := bucket.Object(name + \"/info\")\n\tattrs, err := object.Attrs(appengine_context)\n\tif (err != nil) {\n\t\tpanic(err);\n\t}\n\n\treader, err := object.NewReader(appengine_context)\n\tif (err != nil) {\n\t\tpanic(err);\n\t}\n\n\tvar card Card\n\n\tdecoder := json.NewDecoder(reader)\n\terr = decoder.Decode(&card)\n\tif (err != nil) {\n\t\tpanic(err)\n\t}\n\n\treturn card, attrs.Generation\n}", "title": "" }, { "docid": "1faef9c99aea0cb04a9926bb31ca27cf", "score": "0.52360106", "text": "func (r *ScorecardResult) AsRawJSON(writer io.Writer) error {\n\tencoder := json.NewEncoder(writer)\n\tout := jsonScorecardRawResult{\n\t\tRepo: jsonRepoV2{\n\t\t\tName: r.Repo.Name,\n\t\t\tCommit: r.Repo.CommitSHA,\n\t\t},\n\t\tScorecard: jsonScorecardV2{\n\t\t\tVersion: r.Scorecard.Version,\n\t\t\tCommit: r.Scorecard.CommitSHA,\n\t\t},\n\t\tDate: r.Date.Format(\"2006-01-02\"),\n\t\tMetadata: r.Metadata,\n\t}\n\n\tif err := out.fillJSONRawResults(&r.RawResults); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoder.Encode(out); err != nil {\n\t\treturn sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf(\"encoder.Encode: %v\", err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3b9a7c89ef75fc98231a11360e166ee0", "score": "0.5234827", "text": "func (a AzureVMAppContainerProtectableContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"backupManagementType\", a.BackupManagementType)\n\tpopulate(objectMap, \"containerId\", a.ContainerID)\n\tpopulate(objectMap, \"friendlyName\", a.FriendlyName)\n\tpopulate(objectMap, \"healthStatus\", a.HealthStatus)\n\tobjectMap[\"protectableContainerType\"] = ContainerTypeVMAppContainer\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0500afbeb98cb453956af9c8287f0813", "score": "0.5234043", "text": "func (s SKUCapabilities) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"value\", s.Value)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d8e7de5f648744a8a64cb2adcccf59a5", "score": "0.52308273", "text": "func (pk PublicKey) MarshalJSON() ([]byte, error) {\n return json.Marshal(pk[:])\n}", "title": "" }, { "docid": "c489fd294ddd8ac9133708aa4c5b171a", "score": "0.52303845", "text": "func (m MABContainerHealthDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"code\", m.Code)\n\tpopulate(objectMap, \"message\", m.Message)\n\tpopulate(objectMap, \"recommendations\", m.Recommendations)\n\tpopulate(objectMap, \"title\", m.Title)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0c8879a2e997c958266a3f2bb91a4389", "score": "0.5229817", "text": "func (c Cloud) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"extendedLocation\", c.ExtendedLocation)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"location\", c.Location)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"systemData\", c.SystemData)\n\tpopulate(objectMap, \"tags\", c.Tags)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c08a22df90056c0ea995e04d0256b954", "score": "0.52278495", "text": "func (CritIssuer) MarshalJSON() ([]byte, error) {\n\treturn packedCritIssuerFields, nil\n}", "title": "" }, { "docid": "b77109bb96fd6024e5b27eba5222411f", "score": "0.522142", "text": "func (c Circuit) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9ce13c6fdfd4b1da93bd235f753b50e4", "score": "0.5219508", "text": "func (v Network) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC5839400EncodeGithubComKhliengDispatchStorage(w, v)\n}", "title": "" }, { "docid": "fd0590ea266fd1a762a428e1f0528827", "score": "0.52192813", "text": "func printCard(card model.Card) {\n\tfmt.Println(card.Color, card.Value)\n}", "title": "" }, { "docid": "68054254dff03229d827998fe1300cc1", "score": "0.52162784", "text": "func (r AdvCardListRequest) Encode() []byte {\n\tret, _ := json.Marshal(r)\n\treturn ret\n}", "title": "" }, { "docid": "1a903efa0159140af7c54a2d12327aa0", "score": "0.5212759", "text": "func (c SSHCertificate) MarshalJSON() ([]byte, error) {\n\tif c.Certificate == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\ts := base64.StdEncoding.EncodeToString(c.Certificate.Marshal())\n\treturn []byte(`\"` + s + `\"`), nil\n}", "title": "" }, { "docid": "082db2e93ea062bba8e2bef239997641", "score": "0.5209687", "text": "func (s SignedCapabilityImageResponse) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"image\", s.Image)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "89cd07c59951ecaf3ea9a4fb9108de0b", "score": "0.5206532", "text": "func (p ProtectableContainerResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", p.ETag)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"location\", p.Location)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "243428b1bb5eb97a359f94a86e375c72", "score": "0.52041274", "text": "func (rszd ResourceSkuZoneDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4acd22b4c2436396aea19356ac3a8620", "score": "0.5203159", "text": "func (v VideoDecodeAcceleratorCapability) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "e6747bb2f6149bfff96ae26c73d6ede3", "score": "0.5197783", "text": "func (v GPUInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo5(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "01dd81e12270cde4658d7d1b6a472fb0", "score": "0.5196446", "text": "func BuildCards(res *map[string]interface{}) ([]byte, error) {\n\tcards := make([]*Card, 0)\n\n\tfor _, s := range ((*res)[\"streams\"]).([]interface{}) {\n\t\tcard := new(Card)\n\t\tstream := s.(map[string]interface{})\n\t\tcard.ID = (stream[\"_id\"]).(float64)\n\t\tcard.Game = stream[\"game\"].(string)\n\t\tcard.Viewers = stream[\"viewers\"].(float64)\n\t\tcard.StreamType = stream[\"stream_type\"].(string)\n\t\tcard.ThumbnailURI = stream[\"preview\"].(map[string]interface{})[\"large\"].(string)\n\t\tcard.Title = stream[\"channel\"].(map[string]interface{})[\"status\"].(string)\n\t\tcard.StreamerName = stream[\"channel\"].(map[string]interface{})[\"display_name\"].(string)\n\t\tcard.StreamURI = stream[\"channel\"].(map[string]interface{})[\"url\"].(string)\n\t\tcards = append(cards, card)\n\t}\n\n\treturn json.Marshal(cards)\n}", "title": "" }, { "docid": "0166326286400cbd922434414fa794fc", "score": "0.51863295", "text": "func (k *KeyPair) Marshal() []byte {\n\tcp := new(keyPairExport)\n\tcp.KeyPair = k\n\n\tcp.Private = k.GetPrivateDER()\n\tcp.Public = nil\n\n\tret, _ := json.Marshal(cp)\n\n\treturn ret\n}", "title": "" }, { "docid": "a600a0cc51b0877a5c2779e551886a8f", "score": "0.5186189", "text": "func (a AzureIaaSClassicComputeVMContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"backupManagementType\", a.BackupManagementType)\n\tobjectMap[\"containerType\"] = \"Microsoft.ClassicCompute/virtualMachines\"\n\tpopulate(objectMap, \"friendlyName\", a.FriendlyName)\n\tpopulate(objectMap, \"healthStatus\", a.HealthStatus)\n\tpopulate(objectMap, \"protectableObjectType\", a.ProtectableObjectType)\n\tpopulate(objectMap, \"registrationStatus\", a.RegistrationStatus)\n\tpopulate(objectMap, \"resourceGroup\", a.ResourceGroup)\n\tpopulate(objectMap, \"virtualMachineId\", a.VirtualMachineID)\n\tpopulate(objectMap, \"virtualMachineVersion\", a.VirtualMachineVersion)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f44413597c187f20a41c5fb67d7b94df", "score": "0.51845133", "text": "func jwsEncodeJSON(claimset interface{}, key *rsa.PrivateKey, nonce string) ([]byte, error) {\n\tjwk := jwkEncode(&key.PublicKey)\n\tphead := fmt.Sprintf(`{\"alg\":\"RS256\",\"jwk\":%s,\"nonce\":%q}`, jwk, nonce)\n\tphead = base64.RawURLEncoding.EncodeToString([]byte(phead))\n\tcs, err := json.Marshal(claimset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpayload := base64.RawURLEncoding.EncodeToString(cs)\n\th := sha256.New()\n\th.Write([]byte(phead + \".\" + payload))\n\tsig, err := rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, h.Sum(nil))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tenc := struct {\n\t\tProtected string `json:\"protected\"`\n\t\tPayload string `json:\"payload\"`\n\t\tSig string `json:\"signature\"`\n\t}{\n\t\tProtected: phead,\n\t\tPayload: payload,\n\t\tSig: base64.RawURLEncoding.EncodeToString(sig),\n\t}\n\treturn json.Marshal(&enc)\n}", "title": "" }, { "docid": "682cbfe4ef9611b28b646f6096091c47", "score": "0.51833296", "text": "func (s Share) 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, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "223c47f50b325d6a45fcf26a2ac15346", "score": "0.51824915", "text": "func (v VideoEncodeAcceleratorCapability) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo(w, v)\n}", "title": "" }, { "docid": "5de3862369bc384541b86a74402798df", "score": "0.5179941", "text": "func (v Frame) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "dc38498375ddf6c9ca48aa8d1e79cad3", "score": "0.5176387", "text": "func (c *Chain) Marshal() ([]byte, error) {\n\tenc, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn enc, nil\n}", "title": "" }, { "docid": "b7dcb9bb5b7b90af22b65e19845e0aa1", "score": "0.5161448", "text": "func (a AzureStorageProtectableContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"backupManagementType\", a.BackupManagementType)\n\tpopulate(objectMap, \"containerId\", a.ContainerID)\n\tpopulate(objectMap, \"friendlyName\", a.FriendlyName)\n\tpopulate(objectMap, \"healthStatus\", a.HealthStatus)\n\tobjectMap[\"protectableContainerType\"] = ContainerTypeStorageContainer\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "44a1f2893a9b8a845b8f90d0a43cafcb", "score": "0.51566344", "text": "func (v GameInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonD2b7633eEncodeGithubComDmitriyPrischepBackendWAOPkgModel9(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "47c38fd72ccc3a0747fe10c07396fd1a", "score": "0.5155934", "text": "func (mc *MessageCard) Prepare() error {\n\tjsonMessage, err := json.Marshal(mc)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"error marshalling MessageCard to JSON: %w\",\n\t\t\terr,\n\t\t)\n\t}\n\n\tswitch {\n\tcase mc.payload == nil:\n\t\tmc.payload = &bytes.Buffer{}\n\tdefault:\n\t\tmc.payload.Reset()\n\t}\n\n\t_, err = mc.payload.Write(jsonMessage)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"error updating JSON payload for MessageCard: %w\",\n\t\t\terr,\n\t\t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6e5d64131e0b42dfbbe481abbfb7b354", "score": "0.5154927", "text": "func (v Layer) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoCss50(w, v)\n}", "title": "" }, { "docid": "192000dc0b3dc604e7ebd90f5f621e17", "score": "0.5152044", "text": "func (c CloudProviderProfileInfraStorageProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"storageSpaceIds\", c.StorageSpaceIDs)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "22c8901504b57e3f807edd4a0ac8c193", "score": "0.51482904", "text": "func (c *Candidatura) ToJSON() ([]byte, error) {\n\treturn json.Marshal(c)\n}", "title": "" }, { "docid": "1ceaa39623d348802a12322d372b2157", "score": "0.5143247", "text": "func (v ConnectionsJSON) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42c839f2EncodeGithubComGoParkMailRu20191EscapadeInternalServicesGameEngine1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "badb0d05047f2e155e175c07a356cf6b", "score": "0.5142766", "text": "func (v Banner) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC16456caEncodeGithubComVungleVungoOpenrtb(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "c9097414a4a656d4c043bb7e67cbfcb8", "score": "0.514173", "text": "func (c *XChaCha20Cipher) Marshal(s interface{}) (string, error) {\n\t// encode json value\n\tplaintext, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// compress the plaintext bytes\n\tcompressed, err := compress(plaintext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// encrypt the compressed JSON bytes\n\tciphertext, err := c.Encrypt(compressed)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// base64-encode the result\n\tencoded := base64.RawURLEncoding.EncodeToString(ciphertext)\n\treturn encoded, nil\n}", "title": "" }, { "docid": "47ee89a89df24cc3de4e5984cc225e76", "score": "0.5141669", "text": "func (m ChannelFull) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tDateCreated string `json:\"date_created,omitempty\"`\n\n\t\tDateModified string `json:\"date_modified,omitempty\"`\n\n\t\tID int32 `json:\"id,omitempty\"`\n\n\t\tPlatform string `json:\"platform,omitempty\"`\n\n\t\tType string `json:\"type,omitempty\"`\n\t}\n\n\tdataAO0.DateCreated = m.DateCreated\n\n\tdataAO0.DateModified = m.DateModified\n\n\tdataAO0.ID = m.ID\n\n\tdataAO0.Platform = m.Platform\n\n\tdataAO0.Type = m.Type\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\n\taO1, err := swag.WriteJSON(m.ChannelFullAllOf1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_parts = append(_parts, aO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "b69d88b8471aa4dcaf0c7e4c421c1cee", "score": "0.51414084", "text": "func (bc BlobContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif bc.ContainerProperties != nil {\n\t\tobjectMap[\"properties\"] = bc.ContainerProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "efc8b310b8e96a2406cd38a958facfa9", "score": "0.5137583", "text": "func (s SecretsProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"keyVaultResourceId\", s.KeyVaultResourceID)\n\tpopulate(objectMap, \"secrets\", s.Secrets)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5e2e64ea408ef995f7a5c3a4fa171690", "score": "0.5137077", "text": "func (adc ASCDataConnector) MarshalJSON() ([]byte, error) {\n\tadc.Kind = KindAzureSecurityCenter\n\tobjectMap := make(map[string]interface{})\n\tif adc.ASCDataConnectorProperties != nil {\n\t\tobjectMap[\"properties\"] = adc.ASCDataConnectorProperties\n\t}\n\tif adc.Etag != nil {\n\t\tobjectMap[\"etag\"] = adc.Etag\n\t}\n\tif adc.Kind != \"\" {\n\t\tobjectMap[\"kind\"] = adc.Kind\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a4aed505f7ad62e97c2c036c10cb7429", "score": "0.5132216", "text": "func (v GPUInfo) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo11(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "9caec35448950f81d512e74411d08704", "score": "0.51293695", "text": "func (p Principal) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e83eaa81f170c856750e59ad067f6653", "score": "0.5129229", "text": "func (sc SimpleCharacter) MarshalJSON() ([]byte, error) {\n\tif blank.Is(sc.Name) {\n\t\treturn nil, fmt.Errorf(\"cannot marshal SimpleCharacter into JSON with a missing Name\")\n\t}\n\n\ttype alias SimpleCharacter\n\treturn json.Marshal(alias(sc))\n}", "title": "" }, { "docid": "ec7bc1c77698f2e944adba1d0c147ee6", "score": "0.51236975", "text": "func (g GenericContainer) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"backupManagementType\", g.BackupManagementType)\n\tobjectMap[\"containerType\"] = ContainerTypeGenericContainer\n\tpopulate(objectMap, \"extendedInformation\", g.ExtendedInformation)\n\tpopulate(objectMap, \"fabricName\", g.FabricName)\n\tpopulate(objectMap, \"friendlyName\", g.FriendlyName)\n\tpopulate(objectMap, \"healthStatus\", g.HealthStatus)\n\tpopulate(objectMap, \"protectableObjectType\", g.ProtectableObjectType)\n\tpopulate(objectMap, \"registrationStatus\", g.RegistrationStatus)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7ba8b6ed26f8e8c01e7d7fee354d6b20", "score": "0.5118269", "text": "func (g GenericContainerExtendedInfo) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"containerIdentityInfo\", g.ContainerIdentityInfo)\n\tpopulate(objectMap, \"rawCertData\", g.RawCertData)\n\tpopulate(objectMap, \"serviceEndpoints\", g.ServiceEndpoints)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6332a7a856036fc246e297b1eb3e39c9", "score": "0.5117342", "text": "func (v GPUDevice) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo12(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "bc533951dcb891298f0119e6c81d0527", "score": "0.511572", "text": "func (p Principal) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", p.DisplayName)\n\tpopulate(objectMap, \"email\", p.Email)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "751d83c9737ce89ce6b2696c4dc3bdd5", "score": "0.511324", "text": "func (c ControlPlaneProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"availabilityZones\", c.AvailabilityZones)\n\tpopulate(objectMap, \"cloudProviderProfile\", c.CloudProviderProfile)\n\tpopulate(objectMap, \"controlPlaneEndpoint\", c.ControlPlaneEndpoint)\n\tpopulate(objectMap, \"count\", c.Count)\n\tpopulate(objectMap, \"linuxProfile\", c.LinuxProfile)\n\tpopulate(objectMap, \"maxCount\", c.MaxCount)\n\tpopulate(objectMap, \"maxPods\", c.MaxPods)\n\tpopulate(objectMap, \"minCount\", c.MinCount)\n\tpopulate(objectMap, \"mode\", c.Mode)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"nodeImageVersion\", c.NodeImageVersion)\n\tpopulate(objectMap, \"nodeLabels\", c.NodeLabels)\n\tpopulate(objectMap, \"nodeTaints\", c.NodeTaints)\n\tpopulate(objectMap, \"osType\", c.OSType)\n\tpopulate(objectMap, \"vmSize\", c.VMSize)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "302a3ac9bbad47ebdc70df90599bc22c", "score": "0.51124954", "text": "func (m AssetSudiInfo) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 1)\n\n\tvar dataAO0 struct {\n\t\tPid string `json:\"Pid,omitempty\"`\n\n\t\tSerialNumber string `json:\"SerialNumber,omitempty\"`\n\n\t\tSignature string `json:\"Signature,omitempty\"`\n\n\t\tStatus *string `json:\"Status,omitempty\"`\n\n\t\tSudiCertificate *X509Certificate `json:\"SudiCertificate,omitempty\"`\n\t}\n\n\tdataAO0.Pid = m.Pid\n\n\tdataAO0.SerialNumber = m.SerialNumber\n\n\tdataAO0.Signature = m.Signature\n\n\tdataAO0.Status = m.Status\n\n\tdataAO0.SudiCertificate = m.SudiCertificate\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "4265ff7429ce1d0e010177f16aeb5211", "score": "0.5111735", "text": "func (asc *authSessionCookie) MarshalJSON() ([]byte, error) {\n\ttype envelope struct {\n\t\tID string `json:\"id\"`\n\t\tExpiry string `json:\"expiry\"`\n\t}\n\tval := envelope{\n\t\tID: asc.ID,\n\t\tExpiry: asc.ExpiresUtc.Format(common.Iso8601Layout),\n\t}\n\treturn json.Marshal(&val)\n}", "title": "" }, { "docid": "65449d9b937f6e34cb1d69e756900b68", "score": "0.51081574", "text": "func (e *Account) MarshalJSON() ([]byte, error) { return ent.JsonEncode(e, \"\") }", "title": "" }, { "docid": "f75825aa0b6bf535ce698079c6b506c7", "score": "0.5106813", "text": "func (v GameInfo) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjsonD2b7633eEncodeGithubComDmitriyPrischepBackendWAOPkgModel9(w, v)\n}", "title": "" }, { "docid": "226319f6cc2d945b317351fb430e18d1", "score": "0.51055217", "text": "func (v CameraPerspective) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson522fe41bEncodeGithubComSturfeeincGlTF(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]